mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-13 23:45:27 +00:00
(js/css) Update generated files
This commit is contained in:
+189
-246
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @license AngularJS v1.4.8
|
||||
* @license AngularJS v1.4.9
|
||||
* (c) 2010-2015 Google, Inc. http://angularjs.org
|
||||
* License: MIT
|
||||
*/
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
/* jshint ignore:start */
|
||||
var noop = angular.noop;
|
||||
var copy = angular.copy;
|
||||
var extend = angular.extend;
|
||||
var jqLite = angular.element;
|
||||
var forEach = angular.forEach;
|
||||
@@ -76,6 +77,7 @@ var isPromiseLike = function(p) {
|
||||
return p && p.then ? true : false;
|
||||
};
|
||||
|
||||
var ngMinErr = angular.$$minErr('ng');
|
||||
function assertArg(arg, name, reason) {
|
||||
if (!arg) {
|
||||
throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
|
||||
@@ -788,9 +790,9 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
|
||||
var gcsStaggerLookup = createLocalCacheLookup();
|
||||
|
||||
this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout',
|
||||
'$$forceReflow', '$sniffer', '$$rAFScheduler', '$animate',
|
||||
'$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue',
|
||||
function($window, $$jqLite, $$AnimateRunner, $timeout,
|
||||
$$forceReflow, $sniffer, $$rAFScheduler, $animate) {
|
||||
$$forceReflow, $sniffer, $$rAFScheduler, $$animateQueue) {
|
||||
|
||||
var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
|
||||
|
||||
@@ -882,17 +884,24 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
|
||||
return timings;
|
||||
}
|
||||
|
||||
return function init(element, options) {
|
||||
return function init(element, initialOptions) {
|
||||
// all of the animation functions should create
|
||||
// a copy of the options data, however, if a
|
||||
// parent service has already created a copy then
|
||||
// we should stick to using that
|
||||
var options = initialOptions || {};
|
||||
if (!options.$$prepared) {
|
||||
options = prepareAnimationOptions(copy(options));
|
||||
}
|
||||
|
||||
var restoreStyles = {};
|
||||
var node = getDomNode(element);
|
||||
if (!node
|
||||
|| !node.parentNode
|
||||
|| !$animate.enabled()) {
|
||||
|| !$$animateQueue.enabled()) {
|
||||
return closeAndReturnNoopAnimator();
|
||||
}
|
||||
|
||||
options = prepareAnimationOptions(options);
|
||||
|
||||
var temporaryStyles = [];
|
||||
var classes = element.attr('class');
|
||||
var styles = packageStyles(options);
|
||||
@@ -905,6 +914,8 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
|
||||
var maxDelayTime;
|
||||
var maxDuration;
|
||||
var maxDurationTime;
|
||||
var startTime;
|
||||
var events = [];
|
||||
|
||||
if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) {
|
||||
return closeAndReturnNoopAnimator();
|
||||
@@ -1058,7 +1069,12 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
|
||||
}
|
||||
|
||||
if (options.delay != null) {
|
||||
var delayStyle = parseFloat(options.delay);
|
||||
var delayStyle;
|
||||
if (typeof options.delay !== "boolean") {
|
||||
delayStyle = parseFloat(options.delay);
|
||||
// number in options.delay means we have to recalculate the delay for the closing timeout
|
||||
maxDelay = Math.max(delayStyle, 0);
|
||||
}
|
||||
|
||||
if (flags.applyTransitionDelay) {
|
||||
temporaryStyles.push(getCssDelayStyle(delayStyle));
|
||||
@@ -1173,6 +1189,11 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
|
||||
options.onDone();
|
||||
}
|
||||
|
||||
if (events && events.length) {
|
||||
// Remove the transitionend / animationend listener(s)
|
||||
element.off(events.join(' '), onAnimationProgress);
|
||||
}
|
||||
|
||||
// if the preparation function fails then the promise is not setup
|
||||
if (runner) {
|
||||
runner.complete(!rejected);
|
||||
@@ -1208,6 +1229,33 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
|
||||
};
|
||||
}
|
||||
|
||||
function onAnimationProgress(event) {
|
||||
event.stopPropagation();
|
||||
var ev = event.originalEvent || event;
|
||||
|
||||
// we now always use `Date.now()` due to the recent changes with
|
||||
// event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info)
|
||||
var timeStamp = ev.$manualTimeStamp || Date.now();
|
||||
|
||||
/* Firefox (or possibly just Gecko) likes to not round values up
|
||||
* when a ms measurement is used for the animation */
|
||||
var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));
|
||||
|
||||
/* $manualTimeStamp is a mocked timeStamp value which is set
|
||||
* within browserTrigger(). This is only here so that tests can
|
||||
* mock animations properly. Real events fallback to event.timeStamp,
|
||||
* or, if they don't, then a timeStamp is automatically created for them.
|
||||
* We're checking to see if the timeStamp surpasses the expected delay,
|
||||
* but we're using elapsedTime instead of the timeStamp on the 2nd
|
||||
* pre-condition since animationPauseds sometimes close off early */
|
||||
if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {
|
||||
// we set this flag to ensure that if the transition is paused then, when resumed,
|
||||
// the animation will automatically close itself since transitions cannot be paused.
|
||||
animationCompleted = true;
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
function start() {
|
||||
if (animationClosed) return;
|
||||
if (!node.parentNode) {
|
||||
@@ -1215,8 +1263,6 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
|
||||
return;
|
||||
}
|
||||
|
||||
var startTime, events = [];
|
||||
|
||||
// even though we only pause keyframe animations here the pause flag
|
||||
// will still happen when transitions are used. Only the transition will
|
||||
// not be paused since that is not possible. If the animation ends when
|
||||
@@ -1357,7 +1403,10 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
|
||||
element.data(ANIMATE_TIMER_KEY, animationsData);
|
||||
}
|
||||
|
||||
element.on(events.join(' '), onAnimationProgress);
|
||||
if (events.length) {
|
||||
element.on(events.join(' '), onAnimationProgress);
|
||||
}
|
||||
|
||||
if (options.to) {
|
||||
if (options.cleanupStyles) {
|
||||
registerRestorableStyles(restoreStyles, node, Object.keys(options.to));
|
||||
@@ -1379,30 +1428,6 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
|
||||
element.removeData(ANIMATE_TIMER_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
function onAnimationProgress(event) {
|
||||
event.stopPropagation();
|
||||
var ev = event.originalEvent || event;
|
||||
var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now();
|
||||
|
||||
/* Firefox (or possibly just Gecko) likes to not round values up
|
||||
* when a ms measurement is used for the animation */
|
||||
var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));
|
||||
|
||||
/* $manualTimeStamp is a mocked timeStamp value which is set
|
||||
* within browserTrigger(). This is only here so that tests can
|
||||
* mock animations properly. Real events fallback to event.timeStamp,
|
||||
* or, if they don't, then a timeStamp is automatically created for them.
|
||||
* We're checking to see if the timeStamp surpasses the expected delay,
|
||||
* but we're using elapsedTime instead of the timeStamp on the 2nd
|
||||
* pre-condition since animations sometimes close off early */
|
||||
if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {
|
||||
// we set this flag to ensure that if the transition is paused then, when resumed,
|
||||
// the animation will automatically close itself since transitions cannot be paused.
|
||||
animationCompleted = true;
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}];
|
||||
@@ -1687,6 +1712,8 @@ var $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {
|
||||
var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
|
||||
// $animateJs(element, 'enter');
|
||||
return function(element, event, classes, options) {
|
||||
var animationClosed = false;
|
||||
|
||||
// the `classes` argument is optional and if it is not used
|
||||
// then the classes will be resolved from the element's className
|
||||
// property as well as options.addClass/options.removeClass.
|
||||
@@ -1739,8 +1766,32 @@ var $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {
|
||||
applyAnimationClasses(element, options);
|
||||
}
|
||||
|
||||
function close() {
|
||||
animationClosed = true;
|
||||
applyOptions();
|
||||
applyAnimationStyles(element, options);
|
||||
}
|
||||
|
||||
var runner;
|
||||
|
||||
return {
|
||||
$$willAnimate: true,
|
||||
end: function() {
|
||||
if (runner) {
|
||||
runner.end();
|
||||
} else {
|
||||
close();
|
||||
runner = new $$AnimateRunner();
|
||||
runner.complete(true);
|
||||
}
|
||||
return runner;
|
||||
},
|
||||
start: function() {
|
||||
if (runner) {
|
||||
return runner;
|
||||
}
|
||||
|
||||
runner = new $$AnimateRunner();
|
||||
var closeActiveAnimations;
|
||||
var chain = [];
|
||||
|
||||
@@ -1765,8 +1816,7 @@ var $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {
|
||||
});
|
||||
}
|
||||
|
||||
var animationClosed = false;
|
||||
var runner = new $$AnimateRunner({
|
||||
runner.setHost({
|
||||
end: function() {
|
||||
endAnimations();
|
||||
},
|
||||
@@ -1779,9 +1829,7 @@ var $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {
|
||||
return runner;
|
||||
|
||||
function onComplete(success) {
|
||||
animationClosed = true;
|
||||
applyOptions();
|
||||
applyAnimationStyles(element, options);
|
||||
close(success);
|
||||
runner.complete(success);
|
||||
}
|
||||
|
||||
@@ -2001,6 +2049,7 @@ var NG_ANIMATE_PIN_DATA = '$ngAnimatePin';
|
||||
var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
var PRE_DIGEST_STATE = 1;
|
||||
var RUNNING_STATE = 2;
|
||||
var ONE_SPACE = ' ';
|
||||
|
||||
var rules = this.rules = {
|
||||
skip: [],
|
||||
@@ -2008,6 +2057,29 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
join: []
|
||||
};
|
||||
|
||||
function makeTruthyCssClassMap(classString) {
|
||||
if (!classString) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var keys = classString.split(ONE_SPACE);
|
||||
var map = Object.create(null);
|
||||
|
||||
forEach(keys, function(key) {
|
||||
map[key] = true;
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
function hasMatchingClasses(newClassString, currentClassString) {
|
||||
if (newClassString && currentClassString) {
|
||||
var currentClassMap = makeTruthyCssClassMap(currentClassString);
|
||||
return newClassString.split(ONE_SPACE).some(function(className) {
|
||||
return currentClassMap[className];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function isAllowed(ruleType, element, currentAnimation, previousAnimation) {
|
||||
return rules[ruleType].some(function(fn) {
|
||||
return fn(element, currentAnimation, previousAnimation);
|
||||
@@ -2055,11 +2127,19 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
});
|
||||
|
||||
rules.cancel.push(function(element, newAnimation, currentAnimation) {
|
||||
var nO = newAnimation.options;
|
||||
var cO = currentAnimation.options;
|
||||
|
||||
// if the exact same CSS class is added/removed then it's safe to cancel it
|
||||
return (nO.addClass && nO.addClass === cO.removeClass) || (nO.removeClass && nO.removeClass === cO.addClass);
|
||||
|
||||
var nA = newAnimation.options.addClass;
|
||||
var nR = newAnimation.options.removeClass;
|
||||
var cA = currentAnimation.options.addClass;
|
||||
var cR = currentAnimation.options.removeClass;
|
||||
|
||||
// early detection to save the global CPU shortage :)
|
||||
if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (hasMatchingClasses(nA, cR)) || (hasMatchingClasses(nR, cA));
|
||||
});
|
||||
|
||||
this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',
|
||||
@@ -2135,6 +2215,13 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
return mergeAnimationOptions(element, options, {});
|
||||
}
|
||||
|
||||
// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
|
||||
var contains = Node.prototype.contains || function(arg) {
|
||||
// jshint bitwise: false
|
||||
return this === arg || !!(this.compareDocumentPosition(arg) & 16);
|
||||
// jshint bitwise: true
|
||||
};
|
||||
|
||||
function findCallbacks(parent, element, event) {
|
||||
var targetNode = getDomNode(element);
|
||||
var targetParentNode = getDomNode(parent);
|
||||
@@ -2143,9 +2230,9 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
var entries = callbackRegistry[event];
|
||||
if (entries) {
|
||||
forEach(entries, function(entry) {
|
||||
if (entry.node.contains(targetNode)) {
|
||||
if (contains.call(entry.node, targetNode)) {
|
||||
matches.push(entry.callback);
|
||||
} else if (event === 'leave' && entry.node.contains(targetParentNode)) {
|
||||
} else if (event === 'leave' && contains.call(entry.node, targetParentNode)) {
|
||||
matches.push(entry.callback);
|
||||
}
|
||||
});
|
||||
@@ -2220,12 +2307,7 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
bool = !recordExists;
|
||||
} else {
|
||||
// (element, bool) - Element setter
|
||||
bool = !!bool;
|
||||
if (!bool) {
|
||||
disabledElementsLookup.put(node, true);
|
||||
} else if (recordExists) {
|
||||
disabledElementsLookup.remove(node);
|
||||
}
|
||||
disabledElementsLookup.put(node, !bool);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2234,7 +2316,12 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
}
|
||||
};
|
||||
|
||||
function queueAnimation(element, event, options) {
|
||||
function queueAnimation(element, event, initialOptions) {
|
||||
// we always make a copy of the options since
|
||||
// there should never be any side effects on
|
||||
// the input data when running `$animateCss`.
|
||||
var options = copy(initialOptions);
|
||||
|
||||
var node, parent;
|
||||
element = stripCommentsFromElement(element);
|
||||
if (element) {
|
||||
@@ -2294,7 +2381,9 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
// this is a hard disable of all animations for the application or on
|
||||
// the element itself, therefore there is no need to continue further
|
||||
// past this point if not enabled
|
||||
var skipAnimations = !animationsEnabled || disabledElementsLookup.get(node);
|
||||
// Animations are also disabled if the document is currently hidden (page is not visible
|
||||
// to the user), because browsers slow down or do not flush calls to requestAnimationFrame
|
||||
var skipAnimations = !animationsEnabled || $document[0].hidden || disabledElementsLookup.get(node);
|
||||
var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {};
|
||||
var hasExistingAnimation = !!existingAnimation.state;
|
||||
|
||||
@@ -2503,15 +2592,15 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
forEach(children, function(child) {
|
||||
var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));
|
||||
var animationDetails = activeAnimationsLookup.get(child);
|
||||
switch (state) {
|
||||
case RUNNING_STATE:
|
||||
animationDetails.runner.end();
|
||||
/* falls through */
|
||||
case PRE_DIGEST_STATE:
|
||||
if (animationDetails) {
|
||||
if (animationDetails) {
|
||||
switch (state) {
|
||||
case RUNNING_STATE:
|
||||
animationDetails.runner.end();
|
||||
/* falls through */
|
||||
case PRE_DIGEST_STATE:
|
||||
activeAnimationsLookup.remove(child);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2526,12 +2615,20 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
return getDomNode(nodeOrElmA) === getDomNode(nodeOrElmB);
|
||||
}
|
||||
|
||||
/**
|
||||
* This fn returns false if any of the following is true:
|
||||
* a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed
|
||||
* b) a parent element has an ongoing structural animation, and animateChildren is false
|
||||
* c) the element is not a child of the body
|
||||
* d) the element is not a child of the $rootElement
|
||||
*/
|
||||
function areAnimationsAllowed(element, parentElement, event) {
|
||||
var bodyElement = jqLite($document[0].body);
|
||||
var bodyElementDetected = isMatchingElement(element, bodyElement) || element[0].nodeName === 'HTML';
|
||||
var rootElementDetected = isMatchingElement(element, $rootElement);
|
||||
var parentAnimationDetected = false;
|
||||
var animateChildren;
|
||||
var elementDisabled = disabledElementsLookup.get(getDomNode(element));
|
||||
|
||||
var parentHost = element.data(NG_ANIMATE_PIN_DATA);
|
||||
if (parentHost) {
|
||||
@@ -2556,7 +2653,18 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
// therefore we can't allow any animations to take place
|
||||
// but if a parent animation is class-based then that's ok
|
||||
if (!parentAnimationDetected) {
|
||||
parentAnimationDetected = details.structural || disabledElementsLookup.get(parentNode);
|
||||
var parentElementDisabled = disabledElementsLookup.get(parentNode);
|
||||
|
||||
if (parentElementDisabled === true && elementDisabled !== false) {
|
||||
// disable animations if the user hasn't explicitly enabled animations on the
|
||||
// current element
|
||||
elementDisabled = true;
|
||||
// element is disabled via parent element, no need to check anything else
|
||||
break;
|
||||
} else if (parentElementDisabled === false) {
|
||||
elementDisabled = false;
|
||||
}
|
||||
parentAnimationDetected = details.structural;
|
||||
}
|
||||
|
||||
if (isUndefined(animateChildren) || animateChildren === true) {
|
||||
@@ -2569,28 +2677,32 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
// there is no need to continue traversing at this point
|
||||
if (parentAnimationDetected && animateChildren === false) break;
|
||||
|
||||
if (!rootElementDetected) {
|
||||
// angular doesn't want to attempt to animate elements outside of the application
|
||||
// therefore we need to ensure that the rootElement is an ancestor of the current element
|
||||
rootElementDetected = isMatchingElement(parentElement, $rootElement);
|
||||
if (!rootElementDetected) {
|
||||
parentHost = parentElement.data(NG_ANIMATE_PIN_DATA);
|
||||
if (parentHost) {
|
||||
parentElement = parentHost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bodyElementDetected) {
|
||||
// we also need to ensure that the element is or will be apart of the body element
|
||||
// we also need to ensure that the element is or will be a part of the body element
|
||||
// otherwise it is pointless to even issue an animation to be rendered
|
||||
bodyElementDetected = isMatchingElement(parentElement, bodyElement);
|
||||
}
|
||||
|
||||
if (bodyElementDetected && rootElementDetected) {
|
||||
// If both body and root have been found, any other checks are pointless,
|
||||
// as no animation data should live outside the application
|
||||
break;
|
||||
}
|
||||
|
||||
if (!rootElementDetected) {
|
||||
// If no rootElement is detected, check if the parentElement is pinned to another element
|
||||
parentHost = parentElement.data(NG_ANIMATE_PIN_DATA);
|
||||
if (parentHost) {
|
||||
// The pin target element becomes the next parent element
|
||||
parentElement = parentHost;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
parentElement = parentElement.parent();
|
||||
}
|
||||
|
||||
var allowAnimation = !parentAnimationDetected || animateChildren;
|
||||
var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true;
|
||||
return allowAnimation && rootElementDetected && bodyElementDetected;
|
||||
}
|
||||
|
||||
@@ -2610,171 +2722,6 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
|
||||
}];
|
||||
}];
|
||||
|
||||
var $$AnimateAsyncRunFactory = ['$$rAF', function($$rAF) {
|
||||
var waitQueue = [];
|
||||
|
||||
function waitForTick(fn) {
|
||||
waitQueue.push(fn);
|
||||
if (waitQueue.length > 1) return;
|
||||
$$rAF(function() {
|
||||
for (var i = 0; i < waitQueue.length; i++) {
|
||||
waitQueue[i]();
|
||||
}
|
||||
waitQueue = [];
|
||||
});
|
||||
}
|
||||
|
||||
return function() {
|
||||
var passed = false;
|
||||
waitForTick(function() {
|
||||
passed = true;
|
||||
});
|
||||
return function(callback) {
|
||||
passed ? callback() : waitForTick(callback);
|
||||
};
|
||||
};
|
||||
}];
|
||||
|
||||
var $$AnimateRunnerFactory = ['$q', '$sniffer', '$$animateAsyncRun',
|
||||
function($q, $sniffer, $$animateAsyncRun) {
|
||||
|
||||
var INITIAL_STATE = 0;
|
||||
var DONE_PENDING_STATE = 1;
|
||||
var DONE_COMPLETE_STATE = 2;
|
||||
|
||||
AnimateRunner.chain = function(chain, callback) {
|
||||
var index = 0;
|
||||
|
||||
next();
|
||||
function next() {
|
||||
if (index === chain.length) {
|
||||
callback(true);
|
||||
return;
|
||||
}
|
||||
|
||||
chain[index](function(response) {
|
||||
if (response === false) {
|
||||
callback(false);
|
||||
return;
|
||||
}
|
||||
index++;
|
||||
next();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
AnimateRunner.all = function(runners, callback) {
|
||||
var count = 0;
|
||||
var status = true;
|
||||
forEach(runners, function(runner) {
|
||||
runner.done(onProgress);
|
||||
});
|
||||
|
||||
function onProgress(response) {
|
||||
status = status && response;
|
||||
if (++count === runners.length) {
|
||||
callback(status);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function AnimateRunner(host) {
|
||||
this.setHost(host);
|
||||
|
||||
this._doneCallbacks = [];
|
||||
this._runInAnimationFrame = $$animateAsyncRun();
|
||||
this._state = 0;
|
||||
}
|
||||
|
||||
AnimateRunner.prototype = {
|
||||
setHost: function(host) {
|
||||
this.host = host || {};
|
||||
},
|
||||
|
||||
done: function(fn) {
|
||||
if (this._state === DONE_COMPLETE_STATE) {
|
||||
fn();
|
||||
} else {
|
||||
this._doneCallbacks.push(fn);
|
||||
}
|
||||
},
|
||||
|
||||
progress: noop,
|
||||
|
||||
getPromise: function() {
|
||||
if (!this.promise) {
|
||||
var self = this;
|
||||
this.promise = $q(function(resolve, reject) {
|
||||
self.done(function(status) {
|
||||
status === false ? reject() : resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
return this.promise;
|
||||
},
|
||||
|
||||
then: function(resolveHandler, rejectHandler) {
|
||||
return this.getPromise().then(resolveHandler, rejectHandler);
|
||||
},
|
||||
|
||||
'catch': function(handler) {
|
||||
return this.getPromise()['catch'](handler);
|
||||
},
|
||||
|
||||
'finally': function(handler) {
|
||||
return this.getPromise()['finally'](handler);
|
||||
},
|
||||
|
||||
pause: function() {
|
||||
if (this.host.pause) {
|
||||
this.host.pause();
|
||||
}
|
||||
},
|
||||
|
||||
resume: function() {
|
||||
if (this.host.resume) {
|
||||
this.host.resume();
|
||||
}
|
||||
},
|
||||
|
||||
end: function() {
|
||||
if (this.host.end) {
|
||||
this.host.end();
|
||||
}
|
||||
this._resolve(true);
|
||||
},
|
||||
|
||||
cancel: function() {
|
||||
if (this.host.cancel) {
|
||||
this.host.cancel();
|
||||
}
|
||||
this._resolve(false);
|
||||
},
|
||||
|
||||
complete: function(response) {
|
||||
var self = this;
|
||||
if (self._state === INITIAL_STATE) {
|
||||
self._state = DONE_PENDING_STATE;
|
||||
self._runInAnimationFrame(function() {
|
||||
self._resolve(response);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_resolve: function(response) {
|
||||
if (this._state !== DONE_COMPLETE_STATE) {
|
||||
forEach(this._doneCallbacks, function(fn) {
|
||||
fn(response);
|
||||
});
|
||||
this._doneCallbacks.length = 0;
|
||||
this._state = DONE_COMPLETE_STATE;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return AnimateRunner;
|
||||
}];
|
||||
|
||||
var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
|
||||
var NG_ANIMATE_REF_ATTR = 'ng-animate-ref';
|
||||
|
||||
@@ -3178,7 +3125,6 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
|
||||
$$AnimateAsyncRunFactory,
|
||||
$$rAFSchedulerFactory,
|
||||
$$AnimateChildrenDirective,
|
||||
$$AnimateRunnerFactory,
|
||||
$$AnimateQueueProvider,
|
||||
$$AnimationProvider,
|
||||
$AnimateCssProvider,
|
||||
@@ -3914,9 +3860,6 @@ angular.module('ngAnimate', [])
|
||||
.directive('ngAnimateChildren', $$AnimateChildrenDirective)
|
||||
.factory('$$rAFScheduler', $$rAFSchedulerFactory)
|
||||
|
||||
.factory('$$AnimateRunner', $$AnimateRunnerFactory)
|
||||
.factory('$$animateAsyncRun', $$AnimateAsyncRunFactory)
|
||||
|
||||
.provider('$$animateQueue', $$AnimateQueueProvider)
|
||||
.provider('$$animation', $$AnimationProvider)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user