TIF_E41201027/public/Backend/tinydash-master/light/js/jquery.steps.min.js

1 line
13 KiB
JavaScript

!function(m,c){function v(d,e,t){var n=d.children(e.headerTag),u=d.children(e.bodyTag);n.length>u.length?M(j,"contents"):n.length<u.length&&M(j,"titles");var r,a,i=e.startIndex;t.stepCount=n.length,e.saveState&&m.cookie&&(r=m.cookie(L+p(d)),a=parseInt(r,0),!isNaN(a)&&a<t.stepCount&&(i=a)),t.currentIndex=i,n.each(function(e){var t,n=m(this),r=u.eq(e),a=r.data("mode"),i=null==a?U.html:x(U,/^\s*$/.test(a)||isNaN(a)?a:parseInt(a,0)),s=i===U.html||r.data("url")===c?"":r.data("url"),o=i!==U.html&&"1"===r.data("loaded"),l=m.extend({},Q,{title:n.html(),content:i===U.html?r.html():"",contentUrl:s,contentMode:i,contentLoaded:o});t=l,f(d).push(t)})}function s(e,t){var n=e.find(".steps li").eq(t.currentIndex);e.triggerHandler("finishing",[t.currentIndex])?(n.addClass("done").removeClass("error"),e.triggerHandler("finished",[t.currentIndex])):n.addClass("error")}function C(e){var t=e.data("eventNamespace");return null==t&&(t="."+p(e),e.data("eventNamespace",t)),t}function b(e,t){var n=p(e);return e.find("#"+n+O+t)}function u(e,t){var n=p(e);return e.find("#"+n+B+t)}function o(e){return e.data("options")}function g(e){return e.data("state")}function f(e){return e.data("steps")}function l(e,t){var n=f(e);return(t<0||t>=n.length)&&M(P),n[t]}function p(e){var t=e.data("uid");return null==t&&(null==(t=e._id())&&(t="steps-uid-".concat(N),e._id(t)),N++,e.data("uid",t)),t}function x(e,t){if(i("enumType",e),i("keyOrValue",t),"string"==typeof t){var n=e[t];return n===c&&M("The enum key '{0}' does not exist.",t),n}if("number"==typeof t){for(var r in e)if(e[r]===t)return t;M("Invalid enum value '{0}'.",t)}else M("Invalid key or value type.")}function d(e,t,n){return a(e,t,n,(r=1,n.currentIndex+r));var r}function h(e,t,n){return a(e,t,n,(r=1,n.currentIndex-r));var r}function y(e,t,n,r){if((r<0||r>=n.stepCount)&&M(P),!(t.forceMoveForward&&r<n.currentIndex)){var a=n.currentIndex;return e.triggerHandler("stepChanging",[n.currentIndex,r])?(n.currentIndex=r,D(e,t,n),F(e,t,n,a),w(e,t,n),_(e,t,n),function(e,t,n,r,a,i){var s=e.find(".content > .body"),o=x($,t.transitionEffect),l=t.transitionEffectSpeed,d=s.eq(r),u=s.eq(a);switch(o){case $.fade:case $.slide:var c=o===$.fade?"fadeOut":"slideUp",f=o===$.fade?"fadeIn":"slideDown";n.transitionElement=d,u[c](l,function(){var e=g(m(this)._showAria(!1).parent().parent());e.transitionElement&&(e.transitionElement[f](l,function(){m(this)._showAria()}).promise().done(i),e.transitionElement=null)});break;case $.slideLeft:var p=u.outerWidth(!0),h=a<r?-p:p,v=a<r?p:-p;m.when(u.animate({left:h},l,function(){m(this)._showAria(!1)}),d.css("left",v+"px")._showAria().animate({left:0},l)).done(i);break;default:m.when(u._showAria(!1),d._showAria()).done(i)}}(e,t,n,r,a,function(){e.triggerHandler("stepChanged",[r,a])})):e.find(".steps li").eq(a).addClass("error"),1}}function t(e){var h=m.extend(!0,{},K,e);return this.each(function(){var e,t,n,r,a,i,s,o,l,d,u,c,f=m(this),p={currentIndex:h.startIndex,currentStep:null,stepCount:0,transitionElement:null};f.data("options",h),f.data("state",p),f.data("steps",[]),v(f,h,p),r=f,i=p,s='<{0} class="{1}">{2}</{0}>',o=x(z,(a=h).stepsOrientation)===z.vertical?" vertical":"",l=m(s.format(a.contentContainerTag,"content "+a.clearFixCssClass,r.html())),d=m(s.format(a.stepsContainerTag,"steps "+a.clearFixCssClass,'<ul role="tablist"></ul>')),u=l.children(a.headerTag),c=l.children(a.bodyTag),r.attr("role","application").empty().append(d).append(l).addClass(a.cssClass+" "+a.clearFixCssClass+o),c.each(function(e){k(r,i,m(this),e)}),u.each(function(e){q(r,a,i,m(this),e)}),F(r,a,i),function(e,t,n){{var r,a;t.enablePagination&&(r='<li><a href="#{0}" role="menuitem">{1}</a></li>',a="",t.forceMoveForward||(a+=r.format("previous",t.labels.previous)),a+=r.format("next",t.labels.next),t.enableFinishButton&&(a+=r.format("finish",t.labels.finish)),t.enableCancelButton&&(a+=r.format("cancel",t.labels.cancel)),e.append('<{0} class="actions {1}"><ul role="menu" aria-label="{2}">{3}</ul></{0}>'.format(t.actionContainerTag,t.clearFixCssClass,t.labels.pagination,a)),w(e,t,n),_(e,t,n))}}(r,a,i),t=h,n=C(e=f),e.bind("canceled"+n,t.onCanceled),e.bind("contentLoaded"+n,t.onContentLoaded),e.bind("finishing"+n,t.onFinishing),e.bind("finished"+n,t.onFinished),e.bind("init"+n,t.onInit),e.bind("stepChanging"+n,t.onStepChanging),e.bind("stepChanged"+n,t.onStepChanged),t.enableKeyNavigation&&e.bind("keyup"+n,I),e.find(".actions a").bind("click"+n,A),h.autoFocus&&0===N&&b(f,h.startIndex).focus(),f.triggerHandler("init",[h.startIndex])})}function n(e,t,n,r,a){var i,s;(r<0||r>n.stepCount)&&M(P),a=m.extend({},Q,a),i=r,s=a,f(e).splice(i,0,s),n.currentIndex!==n.stepCount&&n.currentIndex>=r&&(n.currentIndex++,D(e,t,n)),n.stepCount++;var o=e.find(".content"),l=m("<{0}>{1}</{0}>".format(t.headerTag,a.title)),d=m("<{0}></{0}>".format(t.bodyTag));return null!=a.contentMode&&a.contentMode!==U.html||d.html(a.content),0===r?o.prepend(d).prepend(l):u(e,r-1).after(d).after(l),k(e,n,d,r),q(e,t,n,l,r),T(e,t,n,r),r===n.currentIndex&&F(e,t,n),w(e,t,n),e}function I(e){var t=m(this),n=o(t),r=g(t);if(n.suppressPaginationOnFocus&&t.find(":focus").is(":input"))return e.preventDefault(),!1;var a=37,i=39;e.keyCode===a?(e.preventDefault(),h(t,n,r)):e.keyCode===i&&(e.preventDefault(),d(t,n,r))}function _(t,e,n){if(0<n.stepCount){var r=n.currentIndex,a=l(t,r);if(!e.enableContentCache||!a.contentLoaded)switch(x(U,a.contentMode)){case U.iframe:t.find(".content > .body").eq(n.currentIndex).empty().html('<iframe src="'+a.contentUrl+'" frameborder="0" scrolling="no" />').data("loaded","1");break;case U.async:var i=u(t,r)._aria("busy","true").empty().append(S(e.loadingTemplate,{text:e.labels.loading}));m.ajax({url:a.contentUrl,cache:!1}).done(function(e){i.empty().html(e)._aria("busy","false").data("loaded","1"),t.triggerHandler("contentLoaded",[r])})}}}function a(e,t,n,r){var a=n.currentIndex;if(!(0<=r&&r<n.stepCount)||t.forceMoveForward&&r<n.currentIndex)return!1;var i=b(e,r),s=i.parent(),o=s.hasClass("disabled");return s._enableAria(),i.click(),a!==n.currentIndex||!o||(s._enableAria(!1),!1)}function A(e){e.preventDefault();var t=m(this),n=t.parent().parent().parent().parent(),r=o(n),a=g(n),i=t.attr("href");switch(i.substring(i.lastIndexOf("#")+1)){case"cancel":n.triggerHandler("canceled");break;case"finish":s(n,a);break;case"next":d(n,r,a);break;case"previous":h(n,r,a)}}function w(e,t,n){var r,a;t.enablePagination&&(r=e.find(".actions a[href$='#finish']").parent(),a=e.find(".actions a[href$='#next']").parent(),t.forceMoveForward||e.find(".actions a[href$='#previous']").parent()._enableAria(0<n.currentIndex),t.enableFinishButton&&t.showFinishButtonAlways?(r._enableAria(0<n.stepCount),a._enableAria(1<n.stepCount&&n.stepCount>n.currentIndex+1)):(r._showAria(t.enableFinishButton&&n.stepCount===n.currentIndex+1),a._showAria(0===n.stepCount||n.stepCount>n.currentIndex+1)._enableAria(n.stepCount>n.currentIndex+1||!t.enableFinishButton)))}function F(e,t,n,r){var a,i=b(e,n.currentIndex),s=m('<span class="current-info audible">'+t.labels.current+" </span>"),o=e.find(".content > .title");null!=r&&((a=b(e,r)).parent().addClass("done").removeClass("error")._selectAria(!1),o.eq(r).removeClass("current").next(".body").removeClass("current"),s=a.find(".current-info"),i.focus()),i.prepend(s).parent()._selectAria().removeClass("done")._enableAria(),o.eq(n.currentIndex).addClass("current").next(".body").addClass("current")}function T(e,t,n,r){for(var a=p(e),i=r;i<n.stepCount;i++){var s=a+O+i,o=a+B+i,l=a+H+i,d=e.find(".title").eq(i)._id(l);e.find(".steps a").eq(i)._id(s)._aria("controls",o).attr("href","#"+l).html(S(t.titleTemplate,{index:i+1,title:d.html()})),e.find(".body").eq(i)._id(o)._aria("labelledby",l)}}function r(e,t,n,r){return!(r<0||r>=n.stepCount||n.currentIndex===r)&&(o=r,f(e).splice(o,1),n.currentIndex>r&&(n.currentIndex--,D(e,t,n)),n.stepCount--,i=r,s=p(a=e),a.find("#"+s+H+i).remove(),u(e,r).remove(),b(e,r).parent().remove(),0===r&&e.find(".steps li").first().addClass("first"),r===n.stepCount&&e.find(".steps li").eq(r).addClass("last"),T(e,t,n,r),w(e,t,n),!0);var a,i,s,o}function k(e,t,n,r){var a=p(e),i=a+B+r,s=a+H+r;n._id(i).attr("role","tabpanel")._aria("labelledby",s).addClass("body")._showAria(t.currentIndex===r)}function S(e,t){for(var n=e.match(/#([a-z]*)#/gi),r=0;r<n.length;r++){var a=n[r],i=a.substring(1,a.length-1);t[i]===c&&M("The key '{0}' does not exist in the substitute collection!",i),e=e.replace(a,t[i])}return e}function q(e,t,n,r,a){var i=p(e),s=i+O+a,o=i+B+a,l=i+H+a,d=e.find(".steps > ul"),u=S(t.titleTemplate,{index:a+1,title:r.html()}),c=m('<li role="tab"><a id="'+s+'" href="#'+l+'" aria-controls="'+o+'">'+u+"</a></li>");c._enableAria(t.enableAllSteps||n.currentIndex>a),n.currentIndex>a&&c.addClass("done"),r._id(l).attr("tabindex","-1").addClass("title"),0===a?d.prepend(c):d.find("li").eq(a-1).after(c),0===a&&d.find("li").removeClass("first").eq(a).addClass("first"),a===n.stepCount-1&&d.find("li").removeClass("last").eq(a).addClass("last"),c.children("a").bind("click"+C(e),E)}function D(e,t,n){t.saveState&&m.cookie&&m.cookie(L+p(e),n.currentIndex)}function E(e){e.preventDefault();var t,n=m(this),r=n.parent().parent().parent().parent(),a=o(r),i=g(r),s=i.currentIndex;return n.parent().is(":not(.disabled):not(.current)")&&(t=n.attr("href"),y(r,a,i,parseInt(t.substring(t.lastIndexOf("-")+1),0))),s===i.currentIndex?(b(r,s).focus(),!1):void 0}function M(e){throw 1<arguments.length&&(e=e.format(Array.prototype.slice.call(arguments,1))),new Error(e)}function i(e,t){null==t&&M("The argument '{0}' is null or undefined.",e)}m.fn.extend({_aria:function(e,t){return this.attr("aria-"+e,t)},_removeAria:function(e){return this.removeAttr("aria-"+e)},_enableAria:function(e){return null==e||e?this.removeClass("disabled")._aria("disabled","false"):this.addClass("disabled")._aria("disabled","true")},_showAria:function(e){return null==e||e?this.show()._aria("hidden","false"):this.hide()._aria("hidden","true")},_selectAria:function(e){return null==e||e?this.addClass("current")._aria("selected","true"):this.removeClass("current")._aria("selected","false")},_id:function(e){return e?this.attr("id",e):this.attr("id")}}),String.prototype.format||(String.prototype.format=function(){for(var e=1===arguments.length&&m.isArray(arguments[0])?arguments[0]:arguments,t=this,n=0;n<e.length;n++)var r=new RegExp("\\{"+n+"\\}","gm"),t=t.replace(r,e[n]);return t});var N=0,L="jQu3ry_5teps_St@te_",O="-t-",B="-p-",H="-h-",P="Index out of range.",j="One or more corresponding step {0} are missing.";m.fn.steps=function(e){return m.fn.steps[e]?m.fn.steps[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void m.error("Method "+e+" does not exist on jQuery.steps"):t.apply(this,arguments)},m.fn.steps.add=function(e){var t=g(this);return n(this,o(this),t,t.stepCount,e)},m.fn.steps.destroy=function(){return function(e,t){var n=C(e);e.unbind(n).removeData("uid").removeData("options").removeData("state").removeData("steps").removeData("eventNamespace").find(".actions a").unbind(n),e.removeClass(t.clearFixCssClass+" vertical");var r=e.find(".content > *");r.removeData("loaded").removeData("mode").removeData("url"),r.removeAttr("id").removeAttr("role").removeAttr("tabindex").removeAttr("class").removeAttr("style")._removeAria("labelledby")._removeAria("hidden"),e.find(".content > [data-mode='async'],.content > [data-mode='iframe']").empty();var a=m('<{0} class="{1}"></{0}>'.format(e.get(0).tagName,e.attr("class"))),i=e._id();return null!=i&&""!==i&&a._id(i),a.html(e.find(".content").html()),e.after(a),e.remove(),a}(this,o(this))},m.fn.steps.finish=function(){s(this,g(this))},m.fn.steps.getCurrentIndex=function(){return g(this).currentIndex},m.fn.steps.getCurrentStep=function(){return l(this,g(this).currentIndex)},m.fn.steps.getStep=function(e){return l(this,e)},m.fn.steps.insert=function(e,t){return n(this,o(this),g(this),e,t)},m.fn.steps.next=function(){return d(this,o(this),g(this))},m.fn.steps.previous=function(){return h(this,o(this),g(this))},m.fn.steps.remove=function(e){return r(this,o(this),g(this),e)},m.fn.steps.setStep=function(){throw new Error("Not yet implemented!")},m.fn.steps.skip=function(){throw new Error("Not yet implemented!")};var U=m.fn.steps.contentMode={html:0,iframe:1,async:2},z=m.fn.steps.stepsOrientation={horizontal:0,vertical:1},$=m.fn.steps.transitionEffect={none:0,fade:1,slide:2,slideLeft:3},Q=m.fn.steps.stepModel={title:"",content:"",contentUrl:"",contentMode:U.html,contentLoaded:!1},K=m.fn.steps.defaults={headerTag:"h1",bodyTag:"div",contentContainerTag:"div",actionContainerTag:"div",stepsContainerTag:"div",cssClass:"wizard",clearFixCssClass:"clearfix",stepsOrientation:z.horizontal,titleTemplate:'<span class="number">#index#.</span> #title#',loadingTemplate:'<span class="spinner"></span> #text#',autoFocus:!1,enableAllSteps:!1,enableKeyNavigation:!0,enablePagination:!0,suppressPaginationOnFocus:!0,enableContentCache:!0,enableCancelButton:!1,enableFinishButton:!0,preloadContent:!1,showFinishButtonAlways:!1,forceMoveForward:!1,saveState:!1,startIndex:0,transitionEffect:$.none,transitionEffectSpeed:200,onStepChanging:function(){return!0},onStepChanged:function(){},onCanceled:function(){},onFinishing:function(){return!0},onFinished:function(){},onContentLoaded:function(){},onInit:function(){},labels:{cancel:"Cancel",current:"current step:",pagination:"Pagination",finish:"Finish",next:"Next",previous:"Previous",loading:"Loading ..."}}}(jQuery);