angular-rails-engine 1.2.0.0 → 1.2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +1 -1
- data/app/assets/javascripts/angular/angular-animate.js +837 -288
- data/app/assets/javascripts/angular/angular-animate.min.js +17 -10
- data/app/assets/javascripts/angular/angular-animate.min.js.map +8 -0
- data/app/assets/javascripts/angular/angular-cookies.js +20 -2
- data/app/assets/javascripts/angular/angular-cookies.min.js +2 -4
- data/app/assets/javascripts/angular/angular-cookies.min.js.map +8 -0
- data/app/assets/javascripts/angular/angular-loader.js +31 -19
- data/app/assets/javascripts/angular/angular-loader.min.js +4 -6
- data/app/assets/javascripts/angular/angular-loader.min.js.map +8 -0
- data/app/assets/javascripts/angular/angular-mocks.js +263 -85
- data/app/assets/javascripts/angular/angular-resource.js +125 -95
- data/app/assets/javascripts/angular/angular-resource.min.js +8 -10
- data/app/assets/javascripts/angular/angular-resource.min.js.map +8 -0
- data/app/assets/javascripts/angular/angular-route.js +161 -141
- data/app/assets/javascripts/angular/angular-route.min.js +10 -11
- data/app/assets/javascripts/angular/angular-route.min.js.map +8 -0
- data/app/assets/javascripts/angular/angular-sanitize.js +135 -116
- data/app/assets/javascripts/angular/angular-sanitize.min.js +10 -11
- data/app/assets/javascripts/angular/angular-sanitize.min.js.map +8 -0
- data/app/assets/javascripts/angular/angular-scenario.js +13909 -11404
- data/app/assets/javascripts/angular/angular-touch.js +47 -20
- data/app/assets/javascripts/angular/angular-touch.min.js +9 -10
- data/app/assets/javascripts/angular/angular-touch.min.js.map +8 -0
- data/app/assets/javascripts/angular/angular.js +4407 -2278
- data/app/assets/javascripts/angular/angular.min.js +196 -181
- data/app/assets/javascripts/angular/angular.min.js.map +8 -0
- data/app/assets/stylesheets/angular-csp.css +24 -0
- data/lib/angular-rails-engine.rb +1 -1
- data/lib/angular-rails-engine/version.rb +1 -1
- metadata +11 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcc88a35ed7b914956f9f530021b831e9866eedc
|
4
|
+
data.tar.gz: 525f92cc763e6c85961bbb56e471f3d8d501e2c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb17c5071f548ea3889459cd31666590b468fd04e96afaa0af062c4592712f1af41d85d2847b19feb7664123bca0f8f649cf24cf032a75195a1d9b3471a5daee
|
7
|
+
data.tar.gz: ab2c403cce4c754919c67f41e31fc01b367c26bca1b0885e028ce6c08377e3c15b16b6ac0c8c21590c1d68243f9103856cbc021bb63f1c60367b03e2d9eaa111
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -1,44 +1,43 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.0
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
6
6
|
(function(window, angular, undefined) {'use strict';
|
7
7
|
|
8
|
+
/* jshint maxlen: false */
|
9
|
+
|
8
10
|
/**
|
9
11
|
* @ngdoc overview
|
10
12
|
* @name ngAnimate
|
11
13
|
* @description
|
12
14
|
*
|
13
|
-
* ngAnimate
|
14
|
-
* =========
|
15
|
+
* # ngAnimate
|
15
16
|
*
|
16
|
-
* The ngAnimate module
|
17
|
-
* application to provide support for CSS and JavaScript animation hooks.
|
17
|
+
* The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives.
|
18
18
|
*
|
19
|
-
*
|
20
|
-
* and the `ngAnimate` module must be included as a dependency.
|
19
|
+
* {@installModule animate}
|
21
20
|
*
|
22
|
-
* <
|
23
|
-
*
|
24
|
-
*
|
21
|
+
* <div doc-module-components="ngAnimate"></div>
|
22
|
+
*
|
23
|
+
* # Usage
|
25
24
|
*
|
26
|
-
*
|
27
|
-
* or to register a JavaScript animation via the
|
28
|
-
* `ngRepeat`, `ngInclude`, `ngSwitch`, `ngShow`, `ngHide` and `
|
25
|
+
* To see animations in action, all that is required is to define the appropriate CSS classes
|
26
|
+
* or to register a JavaScript animation via the myModule.animation() function. The directives that support animation automatically are:
|
27
|
+
* `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation
|
29
28
|
* by using the `$animate` service.
|
30
29
|
*
|
31
30
|
* Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives:
|
32
31
|
*
|
33
32
|
* | Directive | Supported Animations |
|
34
33
|
* |---------------------------------------------------------- |----------------------------------------------------|
|
35
|
-
* | {@link ng.directive:ngRepeat#
|
36
|
-
* | {@link ngRoute.directive:ngView#
|
37
|
-
* | {@link ng.directive:ngInclude#
|
38
|
-
* | {@link ng.directive:ngSwitch#
|
39
|
-
* | {@link ng.directive:ngIf#
|
40
|
-
* | {@link ng.directive:
|
41
|
-
* | {@link ng.directive:ngShow#
|
34
|
+
* | {@link ng.directive:ngRepeat#usage_animations ngRepeat} | enter, leave and move |
|
35
|
+
* | {@link ngRoute.directive:ngView#usage_animations ngView} | enter and leave |
|
36
|
+
* | {@link ng.directive:ngInclude#usage_animations ngInclude} | enter and leave |
|
37
|
+
* | {@link ng.directive:ngSwitch#usage_animations ngSwitch} | enter and leave |
|
38
|
+
* | {@link ng.directive:ngIf#usage_animations ngIf} | enter and leave |
|
39
|
+
* | {@link ng.directive:ngClass#usage_animations ngClass} | add and remove |
|
40
|
+
* | {@link ng.directive:ngShow#usage_animations ngShow & ngHide} | add and remove (the ng-hide class value) |
|
42
41
|
*
|
43
42
|
* You can find out more information about animations upon visiting each directive page.
|
44
43
|
*
|
@@ -46,14 +45,11 @@
|
|
46
45
|
*
|
47
46
|
* <pre>
|
48
47
|
* <style type="text/css">
|
49
|
-
* .slide.ng-enter
|
50
|
-
* .slide.ng-leave > div {
|
48
|
+
* .slide.ng-enter, .slide.ng-leave {
|
51
49
|
* -webkit-transition:0.5s linear all;
|
52
|
-
* -moz-transition:0.5s linear all;
|
53
|
-
* -o-transition:0.5s linear all;
|
54
50
|
* transition:0.5s linear all;
|
55
51
|
* }
|
56
|
-
*
|
52
|
+
*
|
57
53
|
* .slide.ng-enter { } /* starting animations for enter */
|
58
54
|
* .slide.ng-enter-active { } /* terminal animations for enter */
|
59
55
|
* .slide.ng-leave { } /* starting animations for leave */
|
@@ -85,9 +81,7 @@
|
|
85
81
|
* */
|
86
82
|
* .reveal-animation.ng-enter {
|
87
83
|
* -webkit-transition: 1s linear all; /* Safari/Chrome */
|
88
|
-
*
|
89
|
-
* -o-transition: 1s linear all; /* Opera */
|
90
|
-
* transition: 1s linear all; /* IE10+ and Future Browsers */
|
84
|
+
* transition: 1s linear all; /* All other modern browsers and IE10+ */
|
91
85
|
*
|
92
86
|
* /* The animation preparation code */
|
93
87
|
* opacity: 0;
|
@@ -115,22 +109,12 @@
|
|
115
109
|
* <style type="text/css">
|
116
110
|
* .reveal-animation.ng-enter {
|
117
111
|
* -webkit-animation: enter_sequence 1s linear; /* Safari/Chrome */
|
118
|
-
* -moz-animation: enter_sequence 1s linear; /* Firefox */
|
119
|
-
* -o-animation: enter_sequence 1s linear; /* Opera */
|
120
112
|
* animation: enter_sequence 1s linear; /* IE10+ and Future Browsers */
|
121
113
|
* }
|
122
114
|
* @-webkit-keyframes enter_sequence {
|
123
115
|
* from { opacity:0; }
|
124
116
|
* to { opacity:1; }
|
125
117
|
* }
|
126
|
-
* @-moz-keyframes enter_sequence {
|
127
|
-
* from { opacity:0; }
|
128
|
-
* to { opacity:1; }
|
129
|
-
* }
|
130
|
-
* @-o-keyframes enter_sequence {
|
131
|
-
* from { opacity:0; }
|
132
|
-
* to { opacity:1; }
|
133
|
-
* }
|
134
118
|
* @keyframes enter_sequence {
|
135
119
|
* from { opacity:0; }
|
136
120
|
* to { opacity:1; }
|
@@ -151,6 +135,61 @@
|
|
151
135
|
* immediately resulting in a DOM element that is at its final state. This final state is when the DOM element
|
152
136
|
* has no CSS transition/animation classes applied to it.
|
153
137
|
*
|
138
|
+
* <h3>CSS Staggering Animations</h3>
|
139
|
+
* A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a
|
140
|
+
* curtain-like effect. The ngAnimate module, as of 1.2.0, supports staggering animations and the stagger effect can be
|
141
|
+
* performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for
|
142
|
+
* the animation. The style property expected within the stagger class can either be a **transition-delay** or an
|
143
|
+
* **animation-delay** property (or both if your animation contains both transitions and keyframe animations).
|
144
|
+
*
|
145
|
+
* <pre>
|
146
|
+
* .my-animation.ng-enter {
|
147
|
+
* /* standard transition code */
|
148
|
+
* -webkit-transition: 1s linear all;
|
149
|
+
* transition: 1s linear all;
|
150
|
+
* opacity:0;
|
151
|
+
* }
|
152
|
+
* .my-animation.ng-enter-stagger {
|
153
|
+
* /* this will have a 100ms delay between each successive leave animation */
|
154
|
+
* -webkit-transition-delay: 0.1s;
|
155
|
+
* transition-delay: 0.1s;
|
156
|
+
*
|
157
|
+
* /* in case the stagger doesn't work then these two values
|
158
|
+
* must be set to 0 to avoid an accidental CSS inheritance */
|
159
|
+
* -webkit-transition-duration: 0s;
|
160
|
+
* transition-duration: 0s;
|
161
|
+
* }
|
162
|
+
* .my-animation.ng-enter.ng-enter-active {
|
163
|
+
* /* standard transition styles */
|
164
|
+
* opacity:1;
|
165
|
+
* }
|
166
|
+
* </pre>
|
167
|
+
*
|
168
|
+
* Staggering animations work by default in ngRepeat (so long as the CSS class is defiend). Outside of ngRepeat, to use staggering animations
|
169
|
+
* on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this
|
170
|
+
* are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation
|
171
|
+
* will also be reset if more than 10ms has passed after the last animation has been fired.
|
172
|
+
*
|
173
|
+
* The following code will issue the **ng-leave-stagger** event on the element provided:
|
174
|
+
*
|
175
|
+
* <pre>
|
176
|
+
* var kids = parent.children();
|
177
|
+
*
|
178
|
+
* $animate.leave(kids[0]); //stagger index=0
|
179
|
+
* $animate.leave(kids[1]); //stagger index=1
|
180
|
+
* $animate.leave(kids[2]); //stagger index=2
|
181
|
+
* $animate.leave(kids[3]); //stagger index=3
|
182
|
+
* $animate.leave(kids[4]); //stagger index=4
|
183
|
+
*
|
184
|
+
* $timeout(function() {
|
185
|
+
* //stagger has reset itself
|
186
|
+
* $animate.leave(kids[5]); //stagger index=0
|
187
|
+
* $animate.leave(kids[6]); //stagger index=1
|
188
|
+
* }, 100, false);
|
189
|
+
* </pre>
|
190
|
+
*
|
191
|
+
* Stagger animations are currently only supported within CSS-defined animations.
|
192
|
+
*
|
154
193
|
* <h2>JavaScript-defined Animations</h2>
|
155
194
|
* In the event that you do not want to use CSS3 transitions or CSS3 animations or if you wish to offer animations on browsers that do not
|
156
195
|
* yet support CSS transitions/animations, then you can make use of JavaScript animations defined inside of your AngularJS module.
|
@@ -161,18 +200,27 @@
|
|
161
200
|
* ngModule.animation('.my-crazy-animation', function() {
|
162
201
|
* return {
|
163
202
|
* enter: function(element, done) {
|
164
|
-
* //run the animation
|
165
|
-
*
|
166
|
-
*
|
167
|
-
* //
|
203
|
+
* //run the animation here and call done when the animation is complete
|
204
|
+
* return function(cancelled) {
|
205
|
+
* //this (optional) function will be called when the animation
|
206
|
+
* //completes or when the animation is cancelled (the cancelled
|
207
|
+
* //flag will be set to true if cancelled).
|
168
208
|
* }
|
169
209
|
* }
|
170
210
|
* leave: function(element, done) { },
|
171
211
|
* move: function(element, done) { },
|
172
|
-
*
|
173
|
-
*
|
212
|
+
*
|
213
|
+
* //animation that can be triggered before the class is added
|
214
|
+
* beforeAddClass: function(element, className, done) { },
|
215
|
+
*
|
216
|
+
* //animation that can be triggered after the class is added
|
174
217
|
* addClass: function(element, className, done) { },
|
175
|
-
*
|
218
|
+
*
|
219
|
+
* //animation that can be triggered before the class is removed
|
220
|
+
* beforeRemoveClass: function(element, className, done) { },
|
221
|
+
*
|
222
|
+
* //animation that can be triggered after the class is removed
|
223
|
+
* removeClass: function(element, className, done) { }
|
176
224
|
* }
|
177
225
|
* });
|
178
226
|
* </pre>
|
@@ -181,7 +229,7 @@
|
|
181
229
|
* a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits
|
182
230
|
* the element's CSS class attribute value and then run the matching animation event function (if found).
|
183
231
|
* In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function
|
184
|
-
* be executed. It should be also noted that only simple class selectors are allowed.
|
232
|
+
* be executed. It should be also noted that only simple, single class selectors are allowed (compound class selectors are not supported).
|
185
233
|
*
|
186
234
|
* Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned.
|
187
235
|
* As explained above, these callbacks are triggered based on the animation event. Therefore if an enter animation is run,
|
@@ -197,11 +245,13 @@ angular.module('ngAnimate', ['ng'])
|
|
197
245
|
* @name ngAnimate.$animateProvider
|
198
246
|
* @description
|
199
247
|
*
|
200
|
-
* The
|
201
|
-
*
|
202
|
-
*
|
248
|
+
* The `$animateProvider` allows developers to register JavaScript animation event handlers directly inside of a module.
|
249
|
+
* When an animation is triggered, the $animate service will query the $animate service to find any animations that match
|
250
|
+
* the provided name value.
|
251
|
+
*
|
252
|
+
* Requires the {@link ngAnimate `ngAnimate`} module to be installed.
|
203
253
|
*
|
204
|
-
* Please visit the {@link ngAnimate ngAnimate} module overview page learn more about how to use animations in your application.
|
254
|
+
* Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.
|
205
255
|
*
|
206
256
|
*/
|
207
257
|
.config(['$provide', '$animateProvider', function($provide, $animateProvider) {
|
@@ -209,13 +259,21 @@ angular.module('ngAnimate', ['ng'])
|
|
209
259
|
var forEach = angular.forEach;
|
210
260
|
var selectors = $animateProvider.$$selectors;
|
211
261
|
|
262
|
+
var ELEMENT_NODE = 1;
|
212
263
|
var NG_ANIMATE_STATE = '$$ngAnimateState';
|
213
|
-
var
|
214
|
-
|
215
|
-
|
216
|
-
|
264
|
+
var NG_ANIMATE_CLASS_NAME = 'ng-animate';
|
265
|
+
var rootAnimateState = {running: true};
|
266
|
+
|
267
|
+
$provide.decorator('$animate', ['$delegate', '$injector', '$sniffer', '$rootElement', '$timeout', '$rootScope', '$document',
|
268
|
+
function($delegate, $injector, $sniffer, $rootElement, $timeout, $rootScope, $document) {
|
269
|
+
|
217
270
|
$rootElement.data(NG_ANIMATE_STATE, rootAnimateState);
|
218
271
|
|
272
|
+
// disable animations during bootstrap, but once we bootstrapped, enable animations
|
273
|
+
$rootScope.$$postDigest(function() {
|
274
|
+
rootAnimateState.running = false;
|
275
|
+
});
|
276
|
+
|
219
277
|
function lookup(name) {
|
220
278
|
if (name) {
|
221
279
|
var matches = [],
|
@@ -225,8 +283,11 @@ angular.module('ngAnimate', ['ng'])
|
|
225
283
|
//the empty string value is the default animation
|
226
284
|
//operation which performs CSS transition and keyframe
|
227
285
|
//animations sniffing. This is always included for each
|
228
|
-
//element animation procedure
|
229
|
-
|
286
|
+
//element animation procedure if the browser supports
|
287
|
+
//transitions and/or keyframe animations
|
288
|
+
if ($sniffer.transitions || $sniffer.animations) {
|
289
|
+
classes.push('');
|
290
|
+
}
|
230
291
|
|
231
292
|
for(var i=0; i < classes.length; i++) {
|
232
293
|
var klass = classes[i],
|
@@ -243,19 +304,20 @@ angular.module('ngAnimate', ['ng'])
|
|
243
304
|
/**
|
244
305
|
* @ngdoc object
|
245
306
|
* @name ngAnimate.$animate
|
246
|
-
* @requires $timeout, $sniffer, $rootElement
|
247
307
|
* @function
|
248
308
|
*
|
249
309
|
* @description
|
250
|
-
* The `$animate` service provides animation detection support while performing DOM operations (enter, leave and move)
|
251
|
-
*
|
310
|
+
* The `$animate` service provides animation detection support while performing DOM operations (enter, leave and move) as well as during addClass and removeClass operations.
|
311
|
+
* When any of these operations are run, the $animate service
|
252
312
|
* will examine any JavaScript-defined animations (which are defined by using the $animateProvider provider object)
|
253
313
|
* as well as any CSS-defined animations against the CSS classes present on the element once the DOM operation is run.
|
254
314
|
*
|
255
315
|
* The `$animate` service is used behind the scenes with pre-existing directives and animation with these directives
|
256
316
|
* will work out of the box without any extra configuration.
|
257
317
|
*
|
258
|
-
*
|
318
|
+
* Requires the {@link ngAnimate `ngAnimate`} module to be installed.
|
319
|
+
*
|
320
|
+
* Please visit the {@link ngAnimate `ngAnimate`} module overview page learn more about how to use animations in your application.
|
259
321
|
*
|
260
322
|
*/
|
261
323
|
return {
|
@@ -266,31 +328,35 @@ angular.module('ngAnimate', ['ng'])
|
|
266
328
|
* @function
|
267
329
|
*
|
268
330
|
* @description
|
269
|
-
* Appends the element to the
|
331
|
+
* Appends the element to the parentElement element that resides in the document and then runs the enter animation. Once
|
270
332
|
* the animation is started, the following CSS classes will be present on the element for the duration of the animation:
|
271
333
|
*
|
272
334
|
* Below is a breakdown of each step that occurs during enter animation:
|
273
335
|
*
|
274
|
-
* | Animation Step | What the element class attribute looks like
|
275
|
-
*
|
276
|
-
* | 1. $animate.enter(...) is called | class="my-animation"
|
277
|
-
* | 2. element is inserted into the
|
278
|
-
* | 3.
|
279
|
-
* | 4.
|
280
|
-
* | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-enter"
|
281
|
-
* | 6.
|
282
|
-
* | 7.
|
283
|
-
* | 8.
|
284
|
-
* | 9. The
|
336
|
+
* | Animation Step | What the element class attribute looks like |
|
337
|
+
* |----------------------------------------------------------------------------------------------|---------------------------------------------|
|
338
|
+
* | 1. $animate.enter(...) is called | class="my-animation" |
|
339
|
+
* | 2. element is inserted into the parentElement element or beside the afterElement element | class="my-animation" |
|
340
|
+
* | 3. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" |
|
341
|
+
* | 4. the .ng-enter class is added to the element | class="my-animation ng-animate ng-enter" |
|
342
|
+
* | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-enter" |
|
343
|
+
* | 6. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-enter" |
|
344
|
+
* | 7. the .ng-enter-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-enter ng-enter-active" |
|
345
|
+
* | 8. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-enter ng-enter-active" |
|
346
|
+
* | 9. The animation ends and all generated CSS classes are removed from the element | class="my-animation" |
|
347
|
+
* | 10. The doneCallback() callback is fired (if provided) | class="my-animation" |
|
285
348
|
*
|
286
349
|
* @param {jQuery/jqLite element} element the element that will be the focus of the enter animation
|
287
|
-
* @param {jQuery/jqLite element}
|
288
|
-
* @param {jQuery/jqLite element}
|
289
|
-
* @param {function()=}
|
350
|
+
* @param {jQuery/jqLite element} parentElement the parent element of the element that will be the focus of the enter animation
|
351
|
+
* @param {jQuery/jqLite element} afterElement the sibling element (which is the previous element) of the element that will be the focus of the enter animation
|
352
|
+
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
|
290
353
|
*/
|
291
|
-
enter : function(element,
|
292
|
-
|
293
|
-
|
354
|
+
enter : function(element, parentElement, afterElement, doneCallback) {
|
355
|
+
this.enabled(false, element);
|
356
|
+
$delegate.enter(element, parentElement, afterElement);
|
357
|
+
$rootScope.$$postDigest(function() {
|
358
|
+
performAnimation('enter', 'ng-enter', element, parentElement, afterElement, noop, doneCallback);
|
359
|
+
});
|
294
360
|
},
|
295
361
|
|
296
362
|
/**
|
@@ -305,24 +371,29 @@ angular.module('ngAnimate', ['ng'])
|
|
305
371
|
*
|
306
372
|
* Below is a breakdown of each step that occurs during enter animation:
|
307
373
|
*
|
308
|
-
* | Animation Step | What the element class attribute looks like
|
309
|
-
*
|
310
|
-
* | 1. $animate.leave(...) is called | class="my-animation"
|
311
|
-
* | 2.
|
312
|
-
* | 3.
|
313
|
-
* | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-leave"
|
314
|
-
* | 5.
|
315
|
-
* | 6.
|
316
|
-
* | 7.
|
317
|
-
* | 8. The
|
318
|
-
* | 9. The
|
374
|
+
* | Animation Step | What the element class attribute looks like |
|
375
|
+
* |----------------------------------------------------------------------------------------------|---------------------------------------------|
|
376
|
+
* | 1. $animate.leave(...) is called | class="my-animation" |
|
377
|
+
* | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" |
|
378
|
+
* | 3. the .ng-leave class is added to the element | class="my-animation ng-animate ng-leave" |
|
379
|
+
* | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-leave" |
|
380
|
+
* | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-leave" |
|
381
|
+
* | 6. the .ng-leave-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-leave ng-leave-active" |
|
382
|
+
* | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-leave ng-leave-active" |
|
383
|
+
* | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation" |
|
384
|
+
* | 9. The element is removed from the DOM | ... |
|
385
|
+
* | 10. The doneCallback() callback is fired (if provided) | ... |
|
319
386
|
*
|
320
387
|
* @param {jQuery/jqLite element} element the element that will be the focus of the leave animation
|
321
|
-
* @param {function()=}
|
388
|
+
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
|
322
389
|
*/
|
323
|
-
leave : function(element,
|
324
|
-
|
325
|
-
|
390
|
+
leave : function(element, doneCallback) {
|
391
|
+
cancelChildAnimations(element);
|
392
|
+
this.enabled(false, element);
|
393
|
+
$rootScope.$$postDigest(function() {
|
394
|
+
performAnimation('leave', 'ng-leave', element, null, null, function() {
|
395
|
+
$delegate.leave(element);
|
396
|
+
}, doneCallback);
|
326
397
|
});
|
327
398
|
},
|
328
399
|
|
@@ -333,8 +404,8 @@ angular.module('ngAnimate', ['ng'])
|
|
333
404
|
* @function
|
334
405
|
*
|
335
406
|
* @description
|
336
|
-
* Fires the move DOM operation. Just before the animation starts, the animate service will either append it into the
|
337
|
-
* add the element directly after the
|
407
|
+
* Fires the move DOM operation. Just before the animation starts, the animate service will either append it into the parentElement container or
|
408
|
+
* add the element directly after the afterElement element if present. Then the move animation will be run. Once
|
338
409
|
* the animation is started, the following CSS classes will be added for the duration of the animation:
|
339
410
|
*
|
340
411
|
* Below is a breakdown of each step that occurs during move animation:
|
@@ -342,23 +413,28 @@ angular.module('ngAnimate', ['ng'])
|
|
342
413
|
* | Animation Step | What the element class attribute looks like |
|
343
414
|
* |----------------------------------------------------------------------------------------------|---------------------------------------------|
|
344
415
|
* | 1. $animate.move(...) is called | class="my-animation" |
|
345
|
-
* | 2. element is moved into the
|
346
|
-
* | 3.
|
347
|
-
* | 4.
|
348
|
-
* | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-move"
|
349
|
-
* | 6.
|
350
|
-
* | 7.
|
351
|
-
* | 8.
|
352
|
-
* | 9. The
|
416
|
+
* | 2. element is moved into the parentElement element or beside the afterElement element | class="my-animation" |
|
417
|
+
* | 3. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" |
|
418
|
+
* | 4. the .ng-move class is added to the element | class="my-animation ng-animate ng-move" |
|
419
|
+
* | 5. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate ng-move" |
|
420
|
+
* | 6. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate ng-move" |
|
421
|
+
* | 7. the .ng-move-active and .ng-animate-active classes is added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active ng-move ng-move-active" |
|
422
|
+
* | 8. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active ng-move ng-move-active" |
|
423
|
+
* | 9. The animation ends and all generated CSS classes are removed from the element | class="my-animation" |
|
424
|
+
* | 10. The doneCallback() callback is fired (if provided) | class="my-animation" |
|
353
425
|
*
|
354
426
|
* @param {jQuery/jqLite element} element the element that will be the focus of the move animation
|
355
|
-
* @param {jQuery/jqLite element}
|
356
|
-
* @param {jQuery/jqLite element}
|
357
|
-
* @param {function()=}
|
427
|
+
* @param {jQuery/jqLite element} parentElement the parentElement element of the element that will be the focus of the move animation
|
428
|
+
* @param {jQuery/jqLite element} afterElement the sibling element (which is the previous element) of the element that will be the focus of the move animation
|
429
|
+
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
|
358
430
|
*/
|
359
|
-
move : function(element,
|
360
|
-
|
361
|
-
|
431
|
+
move : function(element, parentElement, afterElement, doneCallback) {
|
432
|
+
cancelChildAnimations(element);
|
433
|
+
this.enabled(false, element);
|
434
|
+
$delegate.move(element, parentElement, afterElement);
|
435
|
+
$rootScope.$$postDigest(function() {
|
436
|
+
performAnimation('move', 'ng-move', element, parentElement, afterElement, noop, doneCallback);
|
437
|
+
});
|
362
438
|
},
|
363
439
|
|
364
440
|
/**
|
@@ -369,30 +445,32 @@ angular.module('ngAnimate', ['ng'])
|
|
369
445
|
* @description
|
370
446
|
* Triggers a custom animation event based off the className variable and then attaches the className value to the element as a CSS class.
|
371
447
|
* Unlike the other animation methods, the animate service will suffix the className value with {@type -add} in order to provide
|
372
|
-
* the animate service the setup and active CSS classes in order to trigger the animation
|
448
|
+
* the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if no CSS transitions
|
449
|
+
* or keyframes are defined on the -add or base CSS class).
|
373
450
|
*
|
374
451
|
* Below is a breakdown of each step that occurs during addClass animation:
|
375
452
|
*
|
376
453
|
* | Animation Step | What the element class attribute looks like |
|
377
454
|
* |------------------------------------------------------------------------------------------------|---------------------------------------------|
|
378
|
-
* | 1. $animate.addClass(element, 'super') is called | class=""
|
379
|
-
* | 2.
|
380
|
-
* | 3.
|
381
|
-
* | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="super-add"
|
382
|
-
* | 5.
|
383
|
-
* | 6.
|
384
|
-
* | 7.
|
385
|
-
* | 8. The
|
386
|
-
* | 9. The
|
455
|
+
* | 1. $animate.addClass(element, 'super') is called | class="my-animation" |
|
456
|
+
* | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation ng-animate" |
|
457
|
+
* | 3. the .super-add class are added to the element | class="my-animation ng-animate super-add" |
|
458
|
+
* | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation ng-animate super-add" |
|
459
|
+
* | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation ng-animate super-add" |
|
460
|
+
* | 6. the .super, .super-add-active and .ng-animate-active classes are added (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active super super-add super-add-active" |
|
461
|
+
* | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation super-add super-add-active" |
|
462
|
+
* | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation super" |
|
463
|
+
* | 9. The super class is kept on the element | class="my-animation super" |
|
464
|
+
* | 10. The doneCallback() callback is fired (if provided) | class="my-animation super" |
|
387
465
|
*
|
388
466
|
* @param {jQuery/jqLite element} element the element that will be animated
|
389
|
-
* @param {string} className the CSS class that will be
|
390
|
-
* @param {function()=}
|
467
|
+
* @param {string} className the CSS class that will be added to the element and then animated
|
468
|
+
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
|
391
469
|
*/
|
392
|
-
addClass : function(element, className,
|
470
|
+
addClass : function(element, className, doneCallback) {
|
393
471
|
performAnimation('addClass', className, element, null, null, function() {
|
394
|
-
$delegate.addClass(element, className
|
395
|
-
});
|
472
|
+
$delegate.addClass(element, className);
|
473
|
+
}, doneCallback);
|
396
474
|
},
|
397
475
|
|
398
476
|
/**
|
@@ -403,29 +481,32 @@ angular.module('ngAnimate', ['ng'])
|
|
403
481
|
* @description
|
404
482
|
* Triggers a custom animation event based off the className variable and then removes the CSS class provided by the className value
|
405
483
|
* from the element. Unlike the other animation methods, the animate service will suffix the className value with {@type -remove} in
|
406
|
-
* order to provide the animate service the setup and active CSS classes in order to trigger the animation
|
484
|
+
* order to provide the animate service the setup and active CSS classes in order to trigger the animation (this will be skipped if
|
485
|
+
* no CSS transitions or keyframes are defined on the -remove or base CSS classes).
|
407
486
|
*
|
408
487
|
* Below is a breakdown of each step that occurs during removeClass animation:
|
409
488
|
*
|
410
489
|
* | Animation Step | What the element class attribute looks like |
|
411
|
-
*
|
412
|
-
* | 1. $animate.removeClass(element, 'super') is called | class="super"
|
413
|
-
* | 2.
|
414
|
-
* | 3.
|
415
|
-
* | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="super super-remove"
|
416
|
-
* | 5.
|
417
|
-
* | 6.
|
418
|
-
* | 7.
|
419
|
-
* | 8. The
|
490
|
+
* |-----------------------------------------------------------------------------------------------|---------------------------------------------|
|
491
|
+
* | 1. $animate.removeClass(element, 'super') is called | class="my-animation super" |
|
492
|
+
* | 2. $animate runs any JavaScript-defined animations on the element | class="my-animation super ng-animate" |
|
493
|
+
* | 3. the .super-remove class are added to the element | class="my-animation super ng-animate super-remove"|
|
494
|
+
* | 4. $animate scans the element styles to get the CSS transition/animation duration and delay | class="my-animation super ng-animate super-remove" |
|
495
|
+
* | 5. $animate waits for 10ms (this performs a reflow) | class="my-animation super ng-animate super-remove" |
|
496
|
+
* | 6. the .super-remove-active and .ng-animate-active classes are added and .super is removed (this triggers the CSS transition/animation) | class="my-animation ng-animate ng-animate-active super-remove super-remove-active" |
|
497
|
+
* | 7. $animate waits for X milliseconds for the animation to complete | class="my-animation ng-animate ng-animate-active super-remove super-remove-active" |
|
498
|
+
* | 8. The animation ends and all generated CSS classes are removed from the element | class="my-animation" |
|
499
|
+
* | 9. The doneCallback() callback is fired (if provided) | class="my-animation" |
|
500
|
+
*
|
420
501
|
*
|
421
502
|
* @param {jQuery/jqLite element} element the element that will be animated
|
422
503
|
* @param {string} className the CSS class that will be animated and then removed from the element
|
423
|
-
* @param {function()=}
|
504
|
+
* @param {function()=} doneCallback the callback function that will be called once the animation is complete
|
424
505
|
*/
|
425
|
-
removeClass : function(element, className,
|
506
|
+
removeClass : function(element, className, doneCallback) {
|
426
507
|
performAnimation('removeClass', className, element, null, null, function() {
|
427
|
-
$delegate.removeClass(element, className
|
428
|
-
});
|
508
|
+
$delegate.removeClass(element, className);
|
509
|
+
}, doneCallback);
|
429
510
|
},
|
430
511
|
|
431
512
|
/**
|
@@ -441,236 +522,704 @@ angular.module('ngAnimate', ['ng'])
|
|
441
522
|
* Globally enables/disables animations.
|
442
523
|
*
|
443
524
|
*/
|
444
|
-
enabled : function(value) {
|
445
|
-
|
446
|
-
|
525
|
+
enabled : function(value, element) {
|
526
|
+
switch(arguments.length) {
|
527
|
+
case 2:
|
528
|
+
if(value) {
|
529
|
+
cleanup(element);
|
530
|
+
} else {
|
531
|
+
var data = element.data(NG_ANIMATE_STATE) || {};
|
532
|
+
data.disabled = true;
|
533
|
+
element.data(NG_ANIMATE_STATE, data);
|
534
|
+
}
|
535
|
+
break;
|
536
|
+
|
537
|
+
case 1:
|
538
|
+
rootAnimateState.disabled = !value;
|
539
|
+
break;
|
540
|
+
|
541
|
+
default:
|
542
|
+
value = !rootAnimateState.disabled;
|
543
|
+
break;
|
447
544
|
}
|
448
|
-
return
|
449
|
-
|
545
|
+
return !!value;
|
546
|
+
}
|
450
547
|
};
|
451
548
|
|
452
549
|
/*
|
453
550
|
all animations call this shared animation triggering function internally.
|
454
|
-
The
|
551
|
+
The animationEvent variable refers to the JavaScript animation event that will be triggered
|
455
552
|
and the className value is the name of the animation that will be applied within the
|
456
|
-
CSS code. Element,
|
553
|
+
CSS code. Element, parentElement and afterElement are provided DOM elements for the animation
|
457
554
|
and the onComplete callback will be fired once the animation is fully complete.
|
458
555
|
*/
|
459
|
-
function performAnimation(
|
556
|
+
function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback) {
|
460
557
|
var classes = (element.attr('class') || '') + ' ' + className;
|
461
|
-
var animationLookup = (' ' + classes).replace(/\s+/g,'.')
|
462
|
-
|
463
|
-
|
464
|
-
animations.push({
|
465
|
-
start : animation[event]
|
466
|
-
});
|
467
|
-
});
|
468
|
-
|
469
|
-
if (!parent) {
|
470
|
-
parent = after ? after.parent() : element.parent();
|
558
|
+
var animationLookup = (' ' + classes).replace(/\s+/g,'.');
|
559
|
+
if (!parentElement) {
|
560
|
+
parentElement = afterElement ? afterElement.parent() : element.parent();
|
471
561
|
}
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
562
|
+
|
563
|
+
var matches = lookup(animationLookup);
|
564
|
+
var isClassBased = animationEvent == 'addClass' || animationEvent == 'removeClass';
|
565
|
+
var ngAnimateState = element.data(NG_ANIMATE_STATE) || {};
|
566
|
+
|
567
|
+
//skip the animation if animations are disabled, a parent is already being animated,
|
568
|
+
//the element is not currently attached to the document body or then completely close
|
569
|
+
//the animation if any matching animations are not found at all.
|
570
|
+
//NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case a NO animation is not found.
|
571
|
+
if (animationsDisabled(element, parentElement) || matches.length === 0) {
|
572
|
+
domOperation();
|
573
|
+
closeAnimation();
|
481
574
|
return;
|
482
575
|
}
|
483
576
|
|
484
|
-
var
|
577
|
+
var animations = [];
|
578
|
+
//only add animations if the currently running animation is not structural
|
579
|
+
//or if there is no animation running at all
|
580
|
+
if(!ngAnimateState.running || !(isClassBased && ngAnimateState.structural)) {
|
581
|
+
forEach(matches, function(animation) {
|
582
|
+
//add the animation to the queue to if it is allowed to be cancelled
|
583
|
+
if(!animation.allowCancel || animation.allowCancel(element, animationEvent, className)) {
|
584
|
+
var beforeFn, afterFn = animation[animationEvent];
|
585
|
+
|
586
|
+
//Special case for a leave animation since there is no point in performing an
|
587
|
+
//animation on a element node that has already been removed from the DOM
|
588
|
+
if(animationEvent == 'leave') {
|
589
|
+
beforeFn = afterFn;
|
590
|
+
afterFn = null; //this must be falsy so that the animation is skipped for leave
|
591
|
+
} else {
|
592
|
+
beforeFn = animation['before' + animationEvent.charAt(0).toUpperCase() + animationEvent.substr(1)];
|
593
|
+
}
|
594
|
+
animations.push({
|
595
|
+
before : beforeFn,
|
596
|
+
after : afterFn
|
597
|
+
});
|
598
|
+
}
|
599
|
+
});
|
600
|
+
}
|
601
|
+
|
602
|
+
//this would mean that an animation was not allowed so let the existing
|
603
|
+
//animation do it's thing and close this one early
|
604
|
+
if(animations.length === 0) {
|
605
|
+
domOperation();
|
606
|
+
fireDoneCallbackAsync();
|
607
|
+
return;
|
608
|
+
}
|
485
609
|
|
486
|
-
//if an animation is currently running on the element then lets take the steps
|
487
|
-
//to cancel that animation and fire any required callbacks
|
488
610
|
if(ngAnimateState.running) {
|
611
|
+
//if an animation is currently running on the element then lets take the steps
|
612
|
+
//to cancel that animation and fire any required callbacks
|
613
|
+
$timeout.cancel(ngAnimateState.closeAnimationTimeout);
|
614
|
+
cleanup(element);
|
489
615
|
cancelAnimations(ngAnimateState.animations);
|
490
|
-
ngAnimateState.done();
|
616
|
+
(ngAnimateState.done || noop)(true);
|
617
|
+
}
|
618
|
+
|
619
|
+
//There is no point in perform a class-based animation if the element already contains
|
620
|
+
//(on addClass) or doesn't contain (on removeClass) the className being animated.
|
621
|
+
//The reason why this is being called after the previous animations are cancelled
|
622
|
+
//is so that the CSS classes present on the element can be properly examined.
|
623
|
+
if((animationEvent == 'addClass' && element.hasClass(className)) ||
|
624
|
+
(animationEvent == 'removeClass' && !element.hasClass(className))) {
|
625
|
+
domOperation();
|
626
|
+
fireDoneCallbackAsync();
|
627
|
+
return;
|
491
628
|
}
|
492
629
|
|
630
|
+
//the ng-animate class does nothing, but it's here to allow for
|
631
|
+
//parent animations to find and cancel child animations when needed
|
632
|
+
element.addClass(NG_ANIMATE_CLASS_NAME);
|
633
|
+
|
493
634
|
element.data(NG_ANIMATE_STATE, {
|
494
635
|
running:true,
|
636
|
+
structural:!isClassBased,
|
495
637
|
animations:animations,
|
496
|
-
done:
|
638
|
+
done:onBeforeAnimationsComplete
|
497
639
|
});
|
498
640
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
641
|
+
//first we run the before animations and when all of those are complete
|
642
|
+
//then we perform the DOM operation and run the next set of animations
|
643
|
+
invokeRegisteredAnimationFns(animations, 'before', onBeforeAnimationsComplete);
|
644
|
+
|
645
|
+
function onBeforeAnimationsComplete(cancelled) {
|
646
|
+
domOperation();
|
647
|
+
if(cancelled === true) {
|
648
|
+
closeAnimation();
|
649
|
+
return;
|
650
|
+
}
|
651
|
+
|
652
|
+
//set the done function to the final done function
|
653
|
+
//so that the DOM event won't be executed twice by accident
|
654
|
+
//if the after animation is cancelled as well
|
655
|
+
var data = element.data(NG_ANIMATE_STATE);
|
656
|
+
if(data) {
|
657
|
+
data.done = closeAnimation;
|
658
|
+
element.data(NG_ANIMATE_STATE, data);
|
659
|
+
}
|
660
|
+
invokeRegisteredAnimationFns(animations, 'after', closeAnimation);
|
504
661
|
}
|
505
662
|
|
506
|
-
|
663
|
+
function invokeRegisteredAnimationFns(animations, phase, allAnimationFnsComplete) {
|
664
|
+
var endFnName = phase + 'End';
|
665
|
+
forEach(animations, function(animation, index) {
|
666
|
+
var animationPhaseCompleted = function() {
|
667
|
+
progress(index, phase);
|
668
|
+
};
|
507
669
|
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
670
|
+
//there are no before functions for enter + move since the DOM
|
671
|
+
//operations happen before the performAnimation method fires
|
672
|
+
if(phase == 'before' && (animationEvent == 'enter' || animationEvent == 'move')) {
|
673
|
+
animationPhaseCompleted();
|
674
|
+
return;
|
675
|
+
}
|
512
676
|
|
513
|
-
|
514
|
-
|
515
|
-
|
677
|
+
if(animation[phase]) {
|
678
|
+
animation[endFnName] = isClassBased ?
|
679
|
+
animation[phase](element, className, animationPhaseCompleted) :
|
680
|
+
animation[phase](element, animationPhaseCompleted);
|
516
681
|
} else {
|
517
|
-
|
682
|
+
animationPhaseCompleted();
|
518
683
|
}
|
519
|
-
}
|
520
|
-
|
684
|
+
});
|
685
|
+
|
686
|
+
function progress(index, phase) {
|
687
|
+
var phaseCompletionFlag = phase + 'Complete';
|
688
|
+
var currentAnimation = animations[index];
|
689
|
+
currentAnimation[phaseCompletionFlag] = true;
|
690
|
+
(currentAnimation[endFnName] || noop)();
|
691
|
+
|
692
|
+
for(var i=0;i<animations.length;i++) {
|
693
|
+
if(!animations[i][phaseCompletionFlag]) return;
|
694
|
+
}
|
695
|
+
|
696
|
+
allAnimationFnsComplete();
|
521
697
|
}
|
522
|
-
}
|
698
|
+
}
|
523
699
|
|
524
|
-
function
|
525
|
-
|
526
|
-
forEach(animations, function(animation) {
|
527
|
-
(animation.endFn || noop)(isCancelledFlag);
|
528
|
-
});
|
700
|
+
function fireDoneCallbackAsync() {
|
701
|
+
doneCallback && $timeout(doneCallback, 0, false);
|
529
702
|
}
|
530
703
|
|
531
|
-
function
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
if(
|
704
|
+
function closeAnimation() {
|
705
|
+
if(!closeAnimation.hasBeenRun) {
|
706
|
+
closeAnimation.hasBeenRun = true;
|
707
|
+
var data = element.data(NG_ANIMATE_STATE);
|
708
|
+
if(data) {
|
709
|
+
/* only structural animations wait for reflow before removing an
|
710
|
+
animation, but class-based animations don't. An example of this
|
711
|
+
failing would be when a parent HTML tag has a ng-class attribute
|
712
|
+
causing ALL directives below to skip animations during the digest */
|
713
|
+
if(isClassBased) {
|
714
|
+
cleanup(element);
|
715
|
+
} else {
|
716
|
+
data.closeAnimationTimeout = $timeout(function() {
|
717
|
+
cleanup(element);
|
718
|
+
}, 0, false);
|
719
|
+
element.data(NG_ANIMATE_STATE, data);
|
720
|
+
}
|
721
|
+
}
|
722
|
+
fireDoneCallbackAsync();
|
536
723
|
}
|
537
|
-
|
724
|
+
}
|
725
|
+
}
|
726
|
+
|
727
|
+
function cancelChildAnimations(element) {
|
728
|
+
var node = element[0];
|
729
|
+
if(node.nodeType != ELEMENT_NODE) {
|
730
|
+
return;
|
538
731
|
}
|
539
732
|
|
540
|
-
function
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
(
|
733
|
+
forEach(node.querySelectorAll('.' + NG_ANIMATE_CLASS_NAME), function(element) {
|
734
|
+
element = angular.element(element);
|
735
|
+
var data = element.data(NG_ANIMATE_STATE);
|
736
|
+
if(data) {
|
737
|
+
cancelAnimations(data.animations);
|
738
|
+
cleanup(element);
|
546
739
|
}
|
547
|
-
}
|
740
|
+
});
|
548
741
|
}
|
549
|
-
}]);
|
550
742
|
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
743
|
+
function cancelAnimations(animations) {
|
744
|
+
var isCancelledFlag = true;
|
745
|
+
forEach(animations, function(animation) {
|
746
|
+
if(!animations['beforeComplete']) {
|
747
|
+
(animation.beforeEnd || noop)(isCancelledFlag);
|
748
|
+
}
|
749
|
+
if(!animations['afterComplete']) {
|
750
|
+
(animation.afterEnd || noop)(isCancelledFlag);
|
751
|
+
}
|
752
|
+
});
|
753
|
+
}
|
754
|
+
|
755
|
+
function cleanup(element) {
|
756
|
+
if(element[0] == $rootElement[0]) {
|
757
|
+
if(!rootAnimateState.disabled) {
|
758
|
+
rootAnimateState.running = false;
|
759
|
+
rootAnimateState.structural = false;
|
760
|
+
}
|
557
761
|
} else {
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
//this acts as the cancellation function in case
|
562
|
-
//a new animation is triggered while another animation
|
563
|
-
//is still going on (otherwise the active className
|
564
|
-
//would still hang around until the timer is complete).
|
565
|
-
return onEnd;
|
762
|
+
element.removeClass(NG_ANIMATE_CLASS_NAME);
|
763
|
+
element.removeData(NG_ANIMATE_STATE);
|
566
764
|
}
|
765
|
+
}
|
567
766
|
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
return total;
|
767
|
+
function animationsDisabled(element, parentElement) {
|
768
|
+
if (rootAnimateState.disabled) return true;
|
769
|
+
|
770
|
+
if(element[0] == $rootElement[0]) {
|
771
|
+
return rootAnimateState.disabled || rootAnimateState.running;
|
574
772
|
}
|
575
773
|
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
774
|
+
do {
|
775
|
+
//the element did not reach the root element which means that it
|
776
|
+
//is not apart of the DOM. Therefore there is no reason to do
|
777
|
+
//any animations on it
|
778
|
+
if(parentElement.length === 0) break;
|
779
|
+
|
780
|
+
var isRoot = parentElement[0] == $rootElement[0];
|
781
|
+
var state = isRoot ? rootAnimateState : parentElement.data(NG_ANIMATE_STATE);
|
782
|
+
var result = state && (!!state.disabled || !!state.running);
|
783
|
+
if(isRoot || result) {
|
784
|
+
return result;
|
785
|
+
}
|
786
|
+
|
787
|
+
if(isRoot) return true;
|
788
|
+
}
|
789
|
+
while(parentElement = parentElement.parent());
|
581
790
|
|
582
|
-
|
791
|
+
return true;
|
792
|
+
}
|
793
|
+
}]);
|
794
|
+
|
795
|
+
$animateProvider.register('', ['$window', '$sniffer', '$timeout', function($window, $sniffer, $timeout) {
|
796
|
+
// Detect proper transitionend/animationend event names.
|
797
|
+
var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;
|
798
|
+
|
799
|
+
// If unprefixed events are not supported but webkit-prefixed are, use the latter.
|
800
|
+
// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
|
801
|
+
// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
|
802
|
+
// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
|
803
|
+
// Register both events in case `window.onanimationend` is not supported because of that,
|
804
|
+
// do the same for `transitionend` as Safari is likely to exhibit similar behavior.
|
805
|
+
// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
|
806
|
+
// therefore there is no reason to test anymore for other vendor prefixes: http://caniuse.com/#search=transition
|
807
|
+
if (window.ontransitionend === undefined && window.onwebkittransitionend !== undefined) {
|
808
|
+
CSS_PREFIX = '-webkit-';
|
809
|
+
TRANSITION_PROP = 'WebkitTransition';
|
810
|
+
TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';
|
811
|
+
} else {
|
812
|
+
TRANSITION_PROP = 'transition';
|
813
|
+
TRANSITIONEND_EVENT = 'transitionend';
|
814
|
+
}
|
815
|
+
|
816
|
+
if (window.onanimationend === undefined && window.onwebkitanimationend !== undefined) {
|
817
|
+
CSS_PREFIX = '-webkit-';
|
818
|
+
ANIMATION_PROP = 'WebkitAnimation';
|
819
|
+
ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';
|
820
|
+
} else {
|
821
|
+
ANIMATION_PROP = 'animation';
|
822
|
+
ANIMATIONEND_EVENT = 'animationend';
|
823
|
+
}
|
583
824
|
|
584
|
-
|
585
|
-
|
586
|
-
|
825
|
+
var DURATION_KEY = 'Duration';
|
826
|
+
var PROPERTY_KEY = 'Property';
|
827
|
+
var DELAY_KEY = 'Delay';
|
828
|
+
var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';
|
829
|
+
var NG_ANIMATE_PARENT_KEY = '$$ngAnimateKey';
|
830
|
+
var NG_ANIMATE_CSS_DATA_KEY = '$$ngAnimateCSS3Data';
|
831
|
+
var NG_ANIMATE_FALLBACK_CLASS_NAME = 'ng-animate-start';
|
832
|
+
var NG_ANIMATE_FALLBACK_ACTIVE_CLASS_NAME = 'ng-animate-active';
|
587
833
|
|
588
|
-
|
589
|
-
|
590
|
-
var vendorTransitionProp = $sniffer.vendorPrefix + 'Transition';
|
834
|
+
var lookupCache = {};
|
835
|
+
var parentCounter = 0;
|
591
836
|
|
592
|
-
|
593
|
-
|
594
|
-
|
837
|
+
var animationReflowQueue = [], animationTimer, timeOut = false;
|
838
|
+
function afterReflow(callback) {
|
839
|
+
animationReflowQueue.push(callback);
|
840
|
+
$timeout.cancel(animationTimer);
|
841
|
+
animationTimer = $timeout(function() {
|
842
|
+
forEach(animationReflowQueue, function(fn) {
|
843
|
+
fn();
|
844
|
+
});
|
845
|
+
animationReflowQueue = [];
|
846
|
+
animationTimer = null;
|
847
|
+
lookupCache = {};
|
848
|
+
}, 10, false);
|
849
|
+
}
|
850
|
+
|
851
|
+
function applyStyle(node, style) {
|
852
|
+
var oldStyle = node.getAttribute('style') || '';
|
853
|
+
var newStyle = (oldStyle.length > 0 ? '; ' : '') + style;
|
854
|
+
node.setAttribute('style', newStyle);
|
855
|
+
return oldStyle;
|
856
|
+
}
|
857
|
+
|
858
|
+
function getElementAnimationDetails(element, cacheKey) {
|
859
|
+
var data = cacheKey ? lookupCache[cacheKey] : null;
|
860
|
+
if(!data) {
|
861
|
+
var transitionDuration = 0;
|
862
|
+
var transitionDelay = 0;
|
863
|
+
var animationDuration = 0;
|
864
|
+
var animationDelay = 0;
|
865
|
+
var transitionDelayStyle;
|
866
|
+
var animationDelayStyle;
|
867
|
+
var transitionDurationStyle;
|
868
|
+
var transitionPropertyStyle;
|
595
869
|
|
596
870
|
//we want all the styles defined before and after
|
597
|
-
var ELEMENT_NODE = 1;
|
598
871
|
forEach(element, function(element) {
|
599
872
|
if (element.nodeType == ELEMENT_NODE) {
|
600
873
|
var elementStyles = $window.getComputedStyle(element) || {};
|
601
874
|
|
602
|
-
|
603
|
-
|
875
|
+
transitionDurationStyle = elementStyles[TRANSITION_PROP + DURATION_KEY];
|
876
|
+
|
877
|
+
transitionDuration = Math.max(parseMaxTime(transitionDurationStyle), transitionDuration);
|
604
878
|
|
605
|
-
|
606
|
-
parseMaxTime(elementStyles[vendorAnimationProp + delayKey]));
|
879
|
+
transitionPropertyStyle = elementStyles[TRANSITION_PROP + PROPERTY_KEY];
|
607
880
|
|
608
|
-
|
609
|
-
parseMaxTime(elementStyles[vendorTransitionProp + durationKey]));
|
881
|
+
transitionDelayStyle = elementStyles[TRANSITION_PROP + DELAY_KEY];
|
610
882
|
|
611
|
-
|
612
|
-
parseMaxTime(elementStyles[vendorAnimationProp + durationKey]));
|
883
|
+
transitionDelay = Math.max(parseMaxTime(transitionDelayStyle), transitionDelay);
|
613
884
|
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
885
|
+
animationDelayStyle = elementStyles[ANIMATION_PROP + DELAY_KEY];
|
886
|
+
|
887
|
+
animationDelay = Math.max(parseMaxTime(animationDelayStyle), animationDelay);
|
888
|
+
|
889
|
+
var aDuration = parseMaxTime(elementStyles[ANIMATION_PROP + DURATION_KEY]);
|
890
|
+
|
891
|
+
if(aDuration > 0) {
|
892
|
+
aDuration *= parseInt(elementStyles[ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY], 10) || 1;
|
618
893
|
}
|
619
894
|
|
620
|
-
|
621
|
-
transitionDelay + transitionDuration,
|
622
|
-
duration);
|
895
|
+
animationDuration = Math.max(aDuration, animationDuration);
|
623
896
|
}
|
624
897
|
});
|
898
|
+
data = {
|
899
|
+
total : 0,
|
900
|
+
transitionPropertyStyle: transitionPropertyStyle,
|
901
|
+
transitionDurationStyle: transitionDurationStyle,
|
902
|
+
transitionDelayStyle: transitionDelayStyle,
|
903
|
+
transitionDelay: transitionDelay,
|
904
|
+
transitionDuration: transitionDuration,
|
905
|
+
animationDelayStyle: animationDelayStyle,
|
906
|
+
animationDelay: animationDelay,
|
907
|
+
animationDuration: animationDuration
|
908
|
+
};
|
909
|
+
if(cacheKey) {
|
910
|
+
lookupCache[cacheKey] = data;
|
911
|
+
}
|
912
|
+
}
|
913
|
+
return data;
|
914
|
+
}
|
625
915
|
|
626
|
-
|
916
|
+
function parseMaxTime(str) {
|
917
|
+
var maxValue = 0;
|
918
|
+
var values = angular.isString(str) ?
|
919
|
+
str.split(/\s*,\s*/) :
|
920
|
+
[];
|
921
|
+
forEach(values, function(value) {
|
922
|
+
maxValue = Math.max(parseFloat(value) || 0, maxValue);
|
923
|
+
});
|
924
|
+
return maxValue;
|
925
|
+
}
|
926
|
+
|
927
|
+
function getCacheKey(element) {
|
928
|
+
var parentElement = element.parent();
|
929
|
+
var parentID = parentElement.data(NG_ANIMATE_PARENT_KEY);
|
930
|
+
if(!parentID) {
|
931
|
+
parentElement.data(NG_ANIMATE_PARENT_KEY, ++parentCounter);
|
932
|
+
parentID = parentCounter;
|
627
933
|
}
|
934
|
+
return parentID + '-' + element[0].className;
|
935
|
+
}
|
936
|
+
|
937
|
+
function animateSetup(element, className) {
|
938
|
+
var cacheKey = getCacheKey(element);
|
939
|
+
var eventCacheKey = cacheKey + ' ' + className;
|
940
|
+
var stagger = {};
|
941
|
+
var ii = lookupCache[eventCacheKey] ? ++lookupCache[eventCacheKey].total : 0;
|
942
|
+
|
943
|
+
if(ii > 0) {
|
944
|
+
var staggerClassName = className + '-stagger';
|
945
|
+
var staggerCacheKey = cacheKey + ' ' + staggerClassName;
|
946
|
+
var applyClasses = !lookupCache[staggerCacheKey];
|
947
|
+
|
948
|
+
applyClasses && element.addClass(staggerClassName);
|
628
949
|
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
950
|
+
stagger = getElementAnimationDetails(element, staggerCacheKey);
|
951
|
+
|
952
|
+
applyClasses && element.removeClass(staggerClassName);
|
953
|
+
}
|
954
|
+
|
955
|
+
element.addClass(className);
|
956
|
+
|
957
|
+
var timings = getElementAnimationDetails(element, eventCacheKey);
|
958
|
+
|
959
|
+
/* there is no point in performing a reflow if the animation
|
960
|
+
timeout is empty (this would cause a flicker bug normally
|
961
|
+
in the page. There is also no point in performing an animation
|
962
|
+
that only has a delay and no duration */
|
963
|
+
var maxDuration = Math.max(timings.transitionDuration, timings.animationDuration);
|
964
|
+
if(maxDuration === 0) {
|
965
|
+
element.removeClass(className);
|
966
|
+
return false;
|
967
|
+
}
|
968
|
+
|
969
|
+
var node = element[0];
|
970
|
+
//temporarily disable the transition so that the enter styles
|
971
|
+
//don't animate twice (this is here to avoid a bug in Chrome/FF).
|
972
|
+
var activeClassName = '';
|
973
|
+
if(timings.transitionDuration > 0) {
|
974
|
+
element.addClass(NG_ANIMATE_FALLBACK_CLASS_NAME);
|
975
|
+
activeClassName += NG_ANIMATE_FALLBACK_ACTIVE_CLASS_NAME + ' ';
|
976
|
+
node.style[TRANSITION_PROP + PROPERTY_KEY] = 'none';
|
977
|
+
}
|
978
|
+
|
979
|
+
forEach(className.split(' '), function(klass, i) {
|
980
|
+
activeClassName += (i > 0 ? ' ' : '') + klass + '-active';
|
981
|
+
});
|
982
|
+
|
983
|
+
element.data(NG_ANIMATE_CSS_DATA_KEY, {
|
984
|
+
className : className,
|
985
|
+
activeClassName : activeClassName,
|
986
|
+
maxDuration : maxDuration,
|
987
|
+
classes : className + ' ' + activeClassName,
|
988
|
+
timings : timings,
|
989
|
+
stagger : stagger,
|
990
|
+
ii : ii
|
991
|
+
});
|
992
|
+
|
993
|
+
return true;
|
994
|
+
}
|
995
|
+
|
996
|
+
function animateRun(element, className, activeAnimationComplete) {
|
997
|
+
var data = element.data(NG_ANIMATE_CSS_DATA_KEY);
|
998
|
+
if(!element.hasClass(className) || !data) {
|
999
|
+
activeAnimationComplete();
|
1000
|
+
return;
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
var node = element[0];
|
1004
|
+
var timings = data.timings;
|
1005
|
+
var stagger = data.stagger;
|
1006
|
+
var maxDuration = data.maxDuration;
|
1007
|
+
var activeClassName = data.activeClassName;
|
1008
|
+
var maxDelayTime = Math.max(timings.transitionDelay, timings.animationDelay) * 1000;
|
1009
|
+
var startTime = Date.now();
|
1010
|
+
var css3AnimationEvents = ANIMATIONEND_EVENT + ' ' + TRANSITIONEND_EVENT;
|
1011
|
+
var formerStyle;
|
1012
|
+
var ii = data.ii;
|
1013
|
+
|
1014
|
+
var applyFallbackStyle, style = '';
|
1015
|
+
if(timings.transitionDuration > 0) {
|
1016
|
+
node.style[TRANSITION_PROP + PROPERTY_KEY] = '';
|
1017
|
+
|
1018
|
+
var propertyStyle = timings.transitionPropertyStyle;
|
1019
|
+
if(propertyStyle.indexOf('all') == -1) {
|
1020
|
+
applyFallbackStyle = true;
|
1021
|
+
var fallbackProperty = $sniffer.msie ? '-ms-zoom' : 'clip';
|
1022
|
+
style += CSS_PREFIX + 'transition-property: ' + propertyStyle + ', ' + fallbackProperty + '; ';
|
1023
|
+
style += CSS_PREFIX + 'transition-duration: ' + timings.transitionDurationStyle + ', ' + timings.transitionDuration + 's; ';
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
if(ii > 0) {
|
1028
|
+
if(stagger.transitionDelay > 0 && stagger.transitionDuration === 0) {
|
1029
|
+
var delayStyle = timings.transitionDelayStyle;
|
1030
|
+
if(applyFallbackStyle) {
|
1031
|
+
delayStyle += ', ' + timings.transitionDelay + 's';
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
style += CSS_PREFIX + 'transition-delay: ' +
|
1035
|
+
prepareStaggerDelay(delayStyle, stagger.transitionDelay, ii) + '; ';
|
1036
|
+
}
|
1037
|
+
|
1038
|
+
if(stagger.animationDelay > 0 && stagger.animationDuration === 0) {
|
1039
|
+
style += CSS_PREFIX + 'animation-delay: ' +
|
1040
|
+
prepareStaggerDelay(timings.animationDelayStyle, stagger.animationDelay, ii) + '; ';
|
1041
|
+
}
|
1042
|
+
}
|
1043
|
+
|
1044
|
+
if(style.length > 0) {
|
1045
|
+
formerStyle = applyStyle(node, style);
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
element.on(css3AnimationEvents, onAnimationProgress);
|
1049
|
+
element.addClass(activeClassName);
|
1050
|
+
|
1051
|
+
// This will automatically be called by $animate so
|
1052
|
+
// there is no need to attach this internally to the
|
1053
|
+
// timeout done method.
|
1054
|
+
return function onEnd(cancelled) {
|
1055
|
+
element.off(css3AnimationEvents, onAnimationProgress);
|
633
1056
|
element.removeClass(activeClassName);
|
1057
|
+
animateClose(element, className);
|
1058
|
+
if(formerStyle != null) {
|
1059
|
+
formerStyle.length > 0 ?
|
1060
|
+
node.setAttribute('style', formerStyle) :
|
1061
|
+
node.removeAttribute('style');
|
1062
|
+
}
|
1063
|
+
};
|
634
1064
|
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
1065
|
+
function onAnimationProgress(event) {
|
1066
|
+
event.stopPropagation();
|
1067
|
+
var ev = event.originalEvent || event;
|
1068
|
+
var timeStamp = ev.$manualTimeStamp || ev.timeStamp || Date.now();
|
1069
|
+
/* $manualTimeStamp is a mocked timeStamp value which is set
|
1070
|
+
* within browserTrigger(). This is only here so that tests can
|
1071
|
+
* mock animations properly. Real events fallback to event.timeStamp,
|
1072
|
+
* or, if they don't, then a timeStamp is automatically created for them.
|
1073
|
+
* We're checking to see if the timeStamp surpasses the expected delay,
|
1074
|
+
* but we're using elapsedTime instead of the timeStamp on the 2nd
|
1075
|
+
* pre-condition since animations sometimes close off early */
|
1076
|
+
if(Math.max(timeStamp - startTime, 0) >= maxDelayTime && ev.elapsedTime >= maxDuration) {
|
1077
|
+
activeAnimationComplete();
|
640
1078
|
}
|
641
1079
|
}
|
642
1080
|
}
|
643
1081
|
|
1082
|
+
function prepareStaggerDelay(delayStyle, staggerDelay, index) {
|
1083
|
+
var style = '';
|
1084
|
+
forEach(delayStyle.split(','), function(val, i) {
|
1085
|
+
style += (i > 0 ? ',' : '') +
|
1086
|
+
(index * staggerDelay + parseInt(val, 10)) + 's';
|
1087
|
+
});
|
1088
|
+
return style;
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
function animateBefore(element, className) {
|
1092
|
+
if(animateSetup(element, className)) {
|
1093
|
+
return function(cancelled) {
|
1094
|
+
cancelled && animateClose(element, className);
|
1095
|
+
};
|
1096
|
+
}
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
function animateAfter(element, className, afterAnimationComplete) {
|
1100
|
+
if(element.data(NG_ANIMATE_CSS_DATA_KEY)) {
|
1101
|
+
return animateRun(element, className, afterAnimationComplete);
|
1102
|
+
} else {
|
1103
|
+
animateClose(element, className);
|
1104
|
+
afterAnimationComplete();
|
1105
|
+
}
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
function animate(element, className, animationComplete) {
|
1109
|
+
//If the animateSetup function doesn't bother returning a
|
1110
|
+
//cancellation function then it means that there is no animation
|
1111
|
+
//to perform at all
|
1112
|
+
var preReflowCancellation = animateBefore(element, className);
|
1113
|
+
if(!preReflowCancellation) {
|
1114
|
+
animationComplete();
|
1115
|
+
return;
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
//There are two cancellation functions: one is before the first
|
1119
|
+
//reflow animation and the second is during the active state
|
1120
|
+
//animation. The first function will take care of removing the
|
1121
|
+
//data from the element which will not make the 2nd animation
|
1122
|
+
//happen in the first place
|
1123
|
+
var cancel = preReflowCancellation;
|
1124
|
+
afterReflow(function() {
|
1125
|
+
//once the reflow is complete then we point cancel to
|
1126
|
+
//the new cancellation function which will remove all of the
|
1127
|
+
//animation properties from the active animation
|
1128
|
+
cancel = animateAfter(element, className, animationComplete);
|
1129
|
+
});
|
1130
|
+
|
1131
|
+
return function(cancelled) {
|
1132
|
+
(cancel || noop)(cancelled);
|
1133
|
+
};
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
function animateClose(element, className) {
|
1137
|
+
element.removeClass(className);
|
1138
|
+
element.removeClass(NG_ANIMATE_FALLBACK_CLASS_NAME);
|
1139
|
+
element.removeData(NG_ANIMATE_CSS_DATA_KEY);
|
1140
|
+
}
|
1141
|
+
|
644
1142
|
return {
|
645
|
-
|
646
|
-
|
1143
|
+
allowCancel : function(element, animationEvent, className) {
|
1144
|
+
//always cancel the current animation if it is a
|
1145
|
+
//structural animation
|
1146
|
+
var oldClasses = (element.data(NG_ANIMATE_CSS_DATA_KEY) || {}).classes;
|
1147
|
+
if(!oldClasses || ['enter','leave','move'].indexOf(animationEvent) >= 0) {
|
1148
|
+
return true;
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
var parentElement = element.parent();
|
1152
|
+
var clone = angular.element(element[0].cloneNode());
|
1153
|
+
|
1154
|
+
//make the element super hidden and override any CSS style values
|
1155
|
+
clone.attr('style','position:absolute; top:-9999px; left:-9999px');
|
1156
|
+
clone.removeAttr('id');
|
1157
|
+
clone.html('');
|
1158
|
+
|
1159
|
+
forEach(oldClasses.split(' '), function(klass) {
|
1160
|
+
clone.removeClass(klass);
|
1161
|
+
});
|
1162
|
+
|
1163
|
+
var suffix = animationEvent == 'addClass' ? '-add' : '-remove';
|
1164
|
+
clone.addClass(suffixClasses(className, suffix));
|
1165
|
+
parentElement.append(clone);
|
1166
|
+
|
1167
|
+
var timings = getElementAnimationDetails(clone);
|
1168
|
+
clone.remove();
|
1169
|
+
|
1170
|
+
return Math.max(timings.transitionDuration, timings.animationDuration) > 0;
|
647
1171
|
},
|
648
|
-
|
649
|
-
|
1172
|
+
|
1173
|
+
enter : function(element, animationCompleted) {
|
1174
|
+
return animate(element, 'ng-enter', animationCompleted);
|
650
1175
|
},
|
651
|
-
|
652
|
-
|
1176
|
+
|
1177
|
+
leave : function(element, animationCompleted) {
|
1178
|
+
return animate(element, 'ng-leave', animationCompleted);
|
653
1179
|
},
|
654
|
-
|
655
|
-
|
1180
|
+
|
1181
|
+
move : function(element, animationCompleted) {
|
1182
|
+
return animate(element, 'ng-move', animationCompleted);
|
656
1183
|
},
|
657
|
-
|
658
|
-
|
1184
|
+
|
1185
|
+
beforeAddClass : function(element, className, animationCompleted) {
|
1186
|
+
var cancellationMethod = animateBefore(element, suffixClasses(className, '-add'));
|
1187
|
+
if(cancellationMethod) {
|
1188
|
+
afterReflow(animationCompleted);
|
1189
|
+
return cancellationMethod;
|
1190
|
+
}
|
1191
|
+
animationCompleted();
|
1192
|
+
},
|
1193
|
+
|
1194
|
+
addClass : function(element, className, animationCompleted) {
|
1195
|
+
return animateAfter(element, suffixClasses(className, '-add'), animationCompleted);
|
1196
|
+
},
|
1197
|
+
|
1198
|
+
beforeRemoveClass : function(element, className, animationCompleted) {
|
1199
|
+
var cancellationMethod = animateBefore(element, suffixClasses(className, '-remove'));
|
1200
|
+
if(cancellationMethod) {
|
1201
|
+
afterReflow(animationCompleted);
|
1202
|
+
return cancellationMethod;
|
1203
|
+
}
|
1204
|
+
animationCompleted();
|
1205
|
+
},
|
1206
|
+
|
1207
|
+
removeClass : function(element, className, animationCompleted) {
|
1208
|
+
return animateAfter(element, suffixClasses(className, '-remove'), animationCompleted);
|
659
1209
|
}
|
660
1210
|
};
|
661
1211
|
|
1212
|
+
function suffixClasses(classes, suffix) {
|
1213
|
+
var className = '';
|
1214
|
+
classes = angular.isArray(classes) ? classes : classes.split(/\s+/);
|
1215
|
+
forEach(classes, function(klass, i) {
|
1216
|
+
if(klass && klass.length > 0) {
|
1217
|
+
className += (i > 0 ? ' ' : '') + klass + suffix;
|
1218
|
+
}
|
1219
|
+
});
|
1220
|
+
return className;
|
1221
|
+
}
|
662
1222
|
}]);
|
663
|
-
|
664
|
-
function suffixClasses(classes, suffix) {
|
665
|
-
var className = '';
|
666
|
-
classes = angular.isArray(classes) ? classes : classes.split(/\s+/);
|
667
|
-
forEach(classes, function(klass, i) {
|
668
|
-
if(klass && klass.length > 0) {
|
669
|
-
className += (i > 0 ? ' ' : '') + klass + suffix;
|
670
|
-
}
|
671
|
-
});
|
672
|
-
return className;
|
673
|
-
}
|
674
1223
|
}]);
|
675
1224
|
|
676
1225
|
|