neo.mjs 3.0.5 → 3.0.6
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.
- package/package.json +1 -1
- package/src/list/plugin/Animate.mjs +59 -11
package/package.json
CHANGED
|
@@ -6,6 +6,16 @@ import CssUtil from '../../util/Css.mjs';
|
|
|
6
6
|
* @extends Neo.plugin.Base
|
|
7
7
|
*/
|
|
8
8
|
class Animate extends Base {
|
|
9
|
+
static getStaticConfig() {return {
|
|
10
|
+
/**
|
|
11
|
+
* Valid values for transitionEasing
|
|
12
|
+
* @member {String[]} transitionEasings=['ease','ease-in','ease-out','ease-in-out','linear']
|
|
13
|
+
* @protected
|
|
14
|
+
* @static
|
|
15
|
+
*/
|
|
16
|
+
transitionEasings: ['ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear']
|
|
17
|
+
}}
|
|
18
|
+
|
|
9
19
|
static getConfig() {return {
|
|
10
20
|
/**
|
|
11
21
|
* @member {String} className='Neo.list.plugin.Animate'
|
|
@@ -46,6 +56,12 @@ class Animate extends Base {
|
|
|
46
56
|
* @member {Number} transitionDuration_=500
|
|
47
57
|
*/
|
|
48
58
|
transitionDuration_: 500,
|
|
59
|
+
/**
|
|
60
|
+
* The easing used for fadeIn, fadeOut and position changes.
|
|
61
|
+
* Valid values: 'ease','ease-in','ease-out','ease-in-out','linear'
|
|
62
|
+
* @member {String} transitionEasing_='ease-in-out'
|
|
63
|
+
*/
|
|
64
|
+
transitionEasing_: 'ease-in-out',
|
|
49
65
|
/**
|
|
50
66
|
* The id of the setTimeout() call which gets triggered after a transition is done.
|
|
51
67
|
* @member {Number|null} transitionTimeoutId=null
|
|
@@ -70,6 +86,8 @@ class Animate extends Base {
|
|
|
70
86
|
sort : me.onStoreSort,
|
|
71
87
|
scope: me
|
|
72
88
|
});
|
|
89
|
+
|
|
90
|
+
this.updateTransitionDetails(false);
|
|
73
91
|
}
|
|
74
92
|
|
|
75
93
|
/**
|
|
@@ -85,21 +103,32 @@ class Animate extends Base {
|
|
|
85
103
|
|
|
86
104
|
/**
|
|
87
105
|
* Triggered after the transitionDuration config got changed.
|
|
88
|
-
*
|
|
89
|
-
* We do not want to apply the style to each list item itself,
|
|
90
|
-
* so we are using Neo.util.Css
|
|
91
106
|
* @param {Boolean} value
|
|
92
107
|
* @param {Boolean} oldValue
|
|
93
108
|
* @protected
|
|
94
109
|
*/
|
|
95
110
|
afterSetTransitionDuration(value, oldValue) {
|
|
96
|
-
|
|
111
|
+
this.isConstructed && this.updateTransitionDetails(Neo.isNumber(oldValue));
|
|
112
|
+
}
|
|
97
113
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Triggered after the transitionEasing config got changed.
|
|
116
|
+
* @param {Number} value
|
|
117
|
+
* @param {Number} oldValue
|
|
118
|
+
* @protected
|
|
119
|
+
*/
|
|
120
|
+
afterSetTransitionEasing(value, oldValue) {
|
|
121
|
+
this.isConstructed && this.updateTransitionDetails(!!oldValue);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Triggered before the transitionEasing config gets changed
|
|
126
|
+
* @param {String} value
|
|
127
|
+
* @param {String} oldValue
|
|
128
|
+
* @protected
|
|
129
|
+
*/
|
|
130
|
+
beforeSetTransitionEasing(value, oldValue) {
|
|
131
|
+
return this.beforeSetEnumValue(value, oldValue, 'transitionEasing');
|
|
103
132
|
}
|
|
104
133
|
|
|
105
134
|
/**
|
|
@@ -130,7 +159,6 @@ class Animate extends Base {
|
|
|
130
159
|
}
|
|
131
160
|
|
|
132
161
|
/**
|
|
133
|
-
*
|
|
134
162
|
* @param {Object} record
|
|
135
163
|
* @param {Number} index
|
|
136
164
|
* @returns {{x: Number, y: Number}}
|
|
@@ -147,7 +175,6 @@ class Animate extends Base {
|
|
|
147
175
|
}
|
|
148
176
|
|
|
149
177
|
/**
|
|
150
|
-
*
|
|
151
178
|
* @param {Object} obj
|
|
152
179
|
* @param {String[]} map
|
|
153
180
|
* @param {Boolean} intercept
|
|
@@ -345,6 +372,27 @@ class Animate extends Base {
|
|
|
345
372
|
me.owner.createItems();
|
|
346
373
|
}, me.transitionDuration);
|
|
347
374
|
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* We do not want to apply the style to each list item itself,
|
|
378
|
+
* so we are using Neo.util.Css
|
|
379
|
+
* @param {Boolean} deleteRule
|
|
380
|
+
* @protected
|
|
381
|
+
*/
|
|
382
|
+
updateTransitionDetails(deleteRule) {
|
|
383
|
+
let me = this,
|
|
384
|
+
duration = me.transitionDuration,
|
|
385
|
+
easing = me.transitionEasing,
|
|
386
|
+
id = me.owner.id;
|
|
387
|
+
|
|
388
|
+
deleteRule && CssUtil.deleteRules(`#${id} .neo-list-item`);
|
|
389
|
+
|
|
390
|
+
CssUtil.insertRules([
|
|
391
|
+
`#${id} .neo-list-item {`,
|
|
392
|
+
`transition: opacity ${duration}ms ${easing}, transform ${duration}ms ${easing}`,
|
|
393
|
+
'}'
|
|
394
|
+
].join(''));
|
|
395
|
+
}
|
|
348
396
|
}
|
|
349
397
|
|
|
350
398
|
Neo.applyClassConfig(Animate);
|