angular-animate.min.js 10.9 KB
"use strict";angular.module("ngAnimate",["ng"]).directive("ngAnimateChildren",function(){var a="$$ngAnimateChildren";return function(b,c,d){var e=d.ngAnimateChildren;angular.isString(e)&&0===e.length?c.data(a,!0):b.$watch(e,function(b){c.data(a,!!b)})}}).factory("$$animateReflow",["$$rAF","$document",function(a,b){var c=b[0].body;return function(b){return a(function(){c.offsetWidth+1;b()})}}]).config(["$provide","$animateProvider",function(a,b){function c(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.nodeType==j)return c}}function d(a){return a&&angular.element(a)}function e(a){return angular.element(c(a))}function f(a,b){return c(a)==c(b)}var g=angular.noop,h=angular.forEach,i=b.$$selectors,j=1,k="$$ngAnimateState",l="$$ngAnimateChildren",m="ng-animate",n={running:!0};a.decorator("$animate",["$delegate","$injector","$sniffer","$rootElement","$$asyncCallback","$rootScope","$document",function(a,j,o,p,q,r,s){function t(a){var b=a.data(k)||{};b.running=!0,a.data(k,b)}function u(a){var b;return r.$$postDigest(function(){b=a()}),function(){b&&b()}}function v(a){if(a){var b=[],c={},d=a.substr(1).split(".");(o.transitions||o.animations)&&b.push(j.get(i[""]));for(var e=0;e<d.length;e++){var f=d[e],g=i[f];g&&!c[f]&&(b.push(j.get(g)),c[f]=!0)}return b}}function w(a,b,c){function d(a,b){var c=a[b],d=a["before"+b.charAt(0).toUpperCase()+b.substr(1)];return c||d?("leave"==b&&(d=c,c=null),t.push({event:b,fn:c}),q.push({event:b,fn:d}),!0):void 0}function e(b,d,e){function f(a){if(d){if((d[a]||g)(),++l<k.length)return;d=null}e()}var k=[];h(b,function(a){a.fn&&k.push(a)});var l=0;h(k,function(b,e){var g=function(){f(e)};switch(b.event){case"setClass":d.push(b.fn(a,i,j,g));break;case"addClass":d.push(b.fn(a,i||c,g));break;case"removeClass":d.push(b.fn(a,j||c,g));break;default:d.push(b.fn(a,g))}}),d&&0===d.length&&e()}var f=a[0];if(f){var i,j,k="setClass"==b,l=k||"addClass"==b||"removeClass"==b;angular.isArray(c)&&(i=c[0],j=c[1],c=i+" "+j);var m=a.attr("class"),n=m+" "+c;if(D(n)){var o=g,p=[],q=[],r=g,s=[],t=[],u=(" "+n).replace(/\s+/g,".");return h(v(u),function(a){var c=d(a,b);!c&&k&&(d(a,"addClass"),d(a,"removeClass"))}),{node:f,event:b,className:c,isClassBased:l,isSetClassOperation:k,before:function(a){o=a,e(q,p,function(){o=g,a()})},after:function(a){r=a,e(t,s,function(){r=g,a()})},cancel:function(){p&&(h(p,function(a){(a||g)(!0)}),o(!0)),s&&(h(s,function(a){(a||g)(!0)}),r(!0))}}}}}function x(a,b,c,d,e,f,i){function j(d){var e="$animate:"+d;u&&u[e]&&u[e].length>0&&q(function(){c.triggerHandler(e,{event:a,className:b})})}function l(){j("before")}function n(){j("after")}function o(){j("close"),i&&q(function(){i()})}function p(){p.hasBeenRun||(p.hasBeenRun=!0,f())}function r(){if(!r.hasBeenRun){r.hasBeenRun=!0;var d=c.data(k);d&&(t&&t.isClassBased?z(c,b):(q(function(){var d=c.data(k)||{};I==d.index&&z(c,b,a)}),c.data(k,d))),o()}}var s=g,t=w(c,a,b);if(!t)return p(),l(),n(),r(),s;b=t.className;var u=angular.element._data(t.node);u=u&&u.events,d||(d=e?e.parent():c.parent());var v,x=c.data(k)||{},y=x.active||{},C=x.totalActive||0,D=x.last;if(t.isClassBased&&(v=x.running||x.disabled||D&&!D.isClassBased),v||A(c,d))return p(),l(),n(),r(),s;var E=!1;if(C>0){var F=[];if(t.isClassBased){if("setClass"==D.event)F.push(D),z(c,b);else if(y[b]){var G=y[b];G.event==a?E=!0:(F.push(G),z(c,b))}}else if("leave"==a&&y["ng-leave"])E=!0;else{for(var H in y)F.push(y[H]);x={},z(c,!0)}F.length>0&&h(F,function(a){a.cancel()})}if(y=x.active||{},C=x.totalActive||0,!t.isClassBased||t.isSetClassOperation||E||(E="addClass"==a==c.hasClass(b)),E)return p(),l(),n(),o(),s;"leave"==a&&c.one("$destroy",function(a){var b=angular.element(this),c=b.data(k);if(c){var d=c.active["ng-leave"];d&&(d.cancel(),z(b,"ng-leave"))}}),c.addClass(m);var I=B++;return C++,y[b]=t,c.data(k,{last:t,active:y,index:I,totalActive:C}),l(),t.before(function(d){var e=c.data(k);d=d||!e||!e.active[b]||t.isClassBased&&e.active[b].event!=a,p(),d===!0?r():(n(),t.after(r))}),t.cancel}function y(a){var b=c(a);if(b){var d=angular.isFunction(b.getElementsByClassName)?b.getElementsByClassName(m):b.querySelectorAll("."+m);h(d,function(a){a=angular.element(a);var b=a.data(k);b&&b.active&&h(b.active,function(a){a.cancel()})})}}function z(a,b){if(f(a,p))n.disabled||(n.running=!1,n.structural=!1);else if(b){var c=a.data(k)||{},d=b===!0;!d&&c.active&&c.active[b]&&(c.totalActive--,delete c.active[b]),(d||!c.totalActive)&&(a.removeClass(m),a.removeData(k))}}function A(a,b){if(n.disabled)return!0;if(f(a,p))return n.running;var c,d,e;do{if(0===b.length)break;var g=f(b,p),h=g?n:b.data(k)||{};if(h.disabled)return!0;if(g&&(e=!0),c!==!1){var i=b.data(l);angular.isDefined(i)&&(c=i)}d=d||h.running||h.last&&!h.last.isClassBased}while(b=b.parent());return!e||!c&&d}var B=0;p.data(k,n),r.$$postDigest(function(){r.$$postDigest(function(){n.running=!1})});var C=b.classNameFilter(),D=C?function(a){return C.test(a)}:function(){return!0};return{enter:function(b,c,f,h){return b=angular.element(b),c=d(c),f=d(f),t(b),a.enter(b,c,f),u(function(){return x("enter","ng-enter",e(b),c,f,g,h)})},leave:function(b,c){return b=angular.element(b),y(b),t(b),this.enabled(!1,b),u(function(){return x("leave","ng-leave",e(b),null,null,function(){a.leave(b)},c)})},move:function(b,c,f,h){return b=angular.element(b),c=d(c),f=d(f),y(b),t(b),a.move(b,c,f),u(function(){return x("move","ng-move",e(b),c,f,g,h)})},addClass:function(b,c,d){return b=angular.element(b),b=e(b),x("addClass",c,b,null,null,function(){a.addClass(b,c)},d)},removeClass:function(b,c,d){return b=angular.element(b),b=e(b),x("removeClass",c,b,null,null,function(){a.removeClass(b,c)},d)},setClass:function(b,c,d,f){return b=angular.element(b),b=e(b),x("setClass",[c,d],b,null,null,function(){a.setClass(b,c,d)},f)},enabled:function(a,b){switch(arguments.length){case 2:if(a)z(b);else{var c=b.data(k)||{};c.disabled=!0,b.data(k,c)}break;case 1:n.disabled=!a;break;default:a=!n.disabled}return!!a}}}]),b.register("",["$window","$sniffer","$timeout","$$animateReflow",function(a,b,d,e){function f(a,b){B&&B(),N.push(b),B=e(function(){h(N,function(a){a()}),N=[],B=null,L={}})}function i(a,b){var e=c(a);a=angular.element(e),Q.push(a);var f=Date.now()+b;P>=f||(d.cancel(O),P=f,O=d(function(){k(Q),Q=[]},b,!1))}function k(a){h(a,function(a){var b=a.data(H);b&&h(b.closeAnimationFns,function(a){a()})})}function l(b,c){var d=c?L[c]:null;if(!d){var e,f,g,i,k=0,l=0,n=0,o=0;h(b,function(b){if(b.nodeType==j){var c=a.getComputedStyle(b)||{};g=c[w+C],k=Math.max(m(g),k),i=c[w+D],e=c[w+E],l=Math.max(m(e),l),f=c[y+E],o=Math.max(m(f),o);var d=m(c[y+C]);d>0&&(d*=parseInt(c[y+F],10)||1),n=Math.max(d,n)}}),d={total:0,transitionPropertyStyle:i,transitionDurationStyle:g,transitionDelayStyle:e,transitionDelay:l,transitionDuration:k,animationDelayStyle:f,animationDelay:o,animationDuration:n},c&&(L[c]=d)}return d}function m(a){var b=0,c=angular.isString(a)?a.split(/\s*,\s*/):[];return h(c,function(a){b=Math.max(parseFloat(a)||0,b)}),b}function n(a){var b=a.parent(),d=b.data(G);return d||(b.data(G,++M),d=M),d+"-"+c(a).getAttribute("class")}function o(a,b,d){var e=["ng-enter","ng-leave","ng-move"].indexOf(d)>=0,f=n(b),g=f+" "+d,h=L[g]?++L[g].total:0,i={};if(h>0){var j=d+"-stagger",k=f+" "+j,m=!L[k];m&&b.addClass(j),i=l(b,k),m&&b.removeClass(j)}b.addClass(d);var o=b.data(H)||{},p=l(b,g),q=p.transitionDuration,r=p.animationDuration;if(e&&0===q&&0===r)return b.removeClass(d),!1;var s=e&&q>0,t=r>0&&i.animationDelay>0&&0===i.animationDuration,u=o.closeAnimationFns||[];b.data(H,{stagger:i,cacheKey:g,running:o.running||0,itemIndex:h,blockTransition:s,blockAnimation:t,closeAnimationFns:u});var v=c(b);return s&&(v.style[w+D]="none"),t&&(v.style[y]="none 0s"),!0}function p(a,b,d,e){function f(a){b.off(M,g),b.removeClass(m),u(b,d);var e=c(b);for(var f in C)e.style.removeProperty(C[f])}function g(a){a.stopPropagation();var b=a.originalEvent||a,c=b.$manualTimeStamp||b.timeStamp||Date.now(),d=parseFloat(b.elapsedTime.toFixed(I));Math.max(c-L,0)>=v&&d>=p&&e()}var j=c(b),k=b.data(H);if(-1==j.getAttribute("class").indexOf(d)||!k)return void e();k.blockTransition&&(j.style[w+D]=""),k.blockAnimation&&(j.style[y]="");var m="";h(d.split(" "),function(a,b){m+=(b>0?" ":"")+a+"-active"}),b.addClass(m);var n=k.cacheKey+" "+m,o=l(b,n),p=Math.max(o.transitionDuration,o.animationDuration);if(0===p)return b.removeClass(m),u(b,d),void e();var r=Math.max(o.transitionDelay,o.animationDelay),s=k.stagger,t=k.itemIndex,v=r*K,B="",C=[];if(o.transitionDuration>0){var E=o.transitionPropertyStyle;-1==E.indexOf("all")&&(B+=A+"transition-property: "+E+";",B+=A+"transition-duration: "+o.transitionDurationStyle+";",C.push(A+"transition-property"),C.push(A+"transition-duration"))}if(t>0){if(s.transitionDelay>0&&0===s.transitionDuration){var F=o.transitionDelayStyle;B+=A+"transition-delay: "+q(F,s.transitionDelay,t)+"; ",C.push(A+"transition-delay")}s.animationDelay>0&&0===s.animationDuration&&(B+=A+"animation-delay: "+q(o.animationDelayStyle,s.animationDelay,t)+"; ",C.push(A+"animation-delay"))}if(C.length>0){var G=j.getAttribute("style")||"";j.setAttribute("style",G+"; "+B)}var L=Date.now(),M=z+" "+x;b.on(M,g),k.closeAnimationFns.push(function(){f(),e()});var N=t*(Math.max(s.animationDelay,s.transitionDelay)||0),O=(r+p)*J,P=(N+O)*K;return k.running++,i(b,P),f}function q(a,b,c){var d="";return h(a.split(","),function(a,e){d+=(e>0?",":"")+(c*b+parseInt(a,10))+"s"}),d}function r(a,b,c,d){return o(a,b,c,d)?function(a){a&&u(b,c)}:void 0}function s(a,b,c,d){return b.data(H)?p(a,b,c,d):(u(b,c),void d())}function t(a,b,c,d){var e=r(a,b,c);if(!e)return void d();var h=e;return f(b,function(){h=s(a,b,c,d)}),function(a){(h||g)(a)}}function u(a,b){a.removeClass(b);var c=a.data(H);c&&(c.running&&c.running--,c.running&&0!==c.running||a.removeData(H))}function v(a,b){var c="";return a=angular.isArray(a)?a:a.split(/\s+/),h(a,function(a,d){a&&a.length>0&&(c+=(d>0?" ":"")+a+b)}),c}var w,x,y,z,A="";void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend?(A="-webkit-",w="WebkitTransition",x="webkitTransitionEnd transitionend"):(w="transition",x="transitionend"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend?(A="-webkit-",y="WebkitAnimation",z="webkitAnimationEnd animationend"):(y="animation",z="animationend");var B,C="Duration",D="Property",E="Delay",F="IterationCount",G="$$ngAnimateKey",H="$$ngAnimateCSS3Data",I=3,J=1.5,K=1e3,L={},M=0,N=[],O=null,P=0,Q=[];return{enter:function(a,b){return t("enter",a,"ng-enter",b)},leave:function(a,b){return t("leave",a,"ng-leave",b)},move:function(a,b){return t("move",a,"ng-move",b)},beforeSetClass:function(a,b,c,d){var e=v(c,"-remove")+" "+v(b,"-add"),g=r("setClass",a,e);return g?(f(a,d),g):void d()},beforeAddClass:function(a,b,c){var d=r("addClass",a,v(b,"-add"));return d?(f(a,c),d):void c()},beforeRemoveClass:function(a,b,c){var d=r("removeClass",a,v(b,"-remove"));return d?(f(a,c),d):void c()},setClass:function(a,b,c,d){c=v(c,"-remove"),b=v(b,"-add");var e=c+" "+b;return s("setClass",a,e,d)},addClass:function(a,b,c){return s("addClass",a,v(b,"-add"),c)},removeClass:function(a,b,c){return s("removeClass",a,v(b,"-remove"),c)}}}])}]);