@visactor/vtable 1.19.2 → 1.19.3

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.
Files changed (91) hide show
  1. package/cjs/ListTable-all.js +5 -5
  2. package/cjs/ListTable-all.js.map +1 -1
  3. package/cjs/ListTable.d.ts +4 -1
  4. package/cjs/ListTable.js +39 -0
  5. package/cjs/ListTable.js.map +1 -1
  6. package/cjs/PivotChart.js +4 -4
  7. package/cjs/PivotChart.js.map +1 -1
  8. package/cjs/PivotTable-all.js +4 -4
  9. package/cjs/PivotTable-all.js.map +1 -1
  10. package/cjs/PivotTable.d.ts +4 -0
  11. package/cjs/PivotTable.js +40 -0
  12. package/cjs/PivotTable.js.map +1 -1
  13. package/cjs/components/index.d.ts +1 -0
  14. package/cjs/components/index.js +8 -2
  15. package/cjs/components/index.js.map +1 -1
  16. package/cjs/core/BaseTable.js +1 -1
  17. package/cjs/core/BaseTable.js.map +1 -1
  18. package/cjs/core/record-helper.d.ts +1 -1
  19. package/cjs/core/record-helper.js +99 -65
  20. package/cjs/core/record-helper.js.map +1 -1
  21. package/cjs/data/DataSource.d.ts +3 -0
  22. package/cjs/data/DataSource.js +20 -0
  23. package/cjs/data/DataSource.js.map +1 -1
  24. package/cjs/event/listener/container-dom.js +32 -30
  25. package/cjs/event/listener/container-dom.js.map +1 -1
  26. package/cjs/event/listener/table-group.js +32 -28
  27. package/cjs/event/listener/table-group.js.map +1 -1
  28. package/cjs/index.d.ts +1 -1
  29. package/cjs/index.js +1 -1
  30. package/cjs/index.js.map +1 -1
  31. package/cjs/layout/pivot-header-layout.d.ts +6 -0
  32. package/cjs/layout/pivot-header-layout.js +74 -0
  33. package/cjs/layout/pivot-header-layout.js.map +1 -1
  34. package/cjs/layout/tree-helper.d.ts +2 -0
  35. package/cjs/layout/tree-helper.js +9 -0
  36. package/cjs/layout/tree-helper.js.map +1 -1
  37. package/cjs/state/state.d.ts +2 -0
  38. package/cjs/state/state.js +16 -4
  39. package/cjs/state/state.js.map +1 -1
  40. package/cjs/ts-types/events.d.ts +1 -0
  41. package/cjs/ts-types/events.js.map +1 -1
  42. package/cjs/ts-types/table-engine.d.ts +2 -1
  43. package/cjs/ts-types/table-engine.js.map +1 -1
  44. package/cjs/vrender.js.map +1 -1
  45. package/dist/vtable.js +3885 -363
  46. package/dist/vtable.min.js +2 -2
  47. package/es/ListTable-all.js +4 -4
  48. package/es/ListTable-all.js.map +1 -1
  49. package/es/ListTable.d.ts +4 -1
  50. package/es/ListTable.js +39 -0
  51. package/es/ListTable.js.map +1 -1
  52. package/es/PivotChart.js +4 -4
  53. package/es/PivotChart.js.map +1 -1
  54. package/es/PivotTable-all.js +3 -3
  55. package/es/PivotTable-all.js.map +1 -1
  56. package/es/PivotTable.d.ts +4 -0
  57. package/es/PivotTable.js +40 -0
  58. package/es/PivotTable.js.map +1 -1
  59. package/es/components/index.d.ts +1 -0
  60. package/es/components/index.js +6 -0
  61. package/es/components/index.js.map +1 -1
  62. package/es/core/BaseTable.js +1 -1
  63. package/es/core/BaseTable.js.map +1 -1
  64. package/es/core/record-helper.d.ts +1 -1
  65. package/es/core/record-helper.js +99 -65
  66. package/es/core/record-helper.js.map +1 -1
  67. package/es/data/DataSource.d.ts +3 -0
  68. package/es/data/DataSource.js +20 -0
  69. package/es/data/DataSource.js.map +1 -1
  70. package/es/event/listener/container-dom.js +32 -30
  71. package/es/event/listener/container-dom.js.map +1 -1
  72. package/es/event/listener/table-group.js +31 -28
  73. package/es/event/listener/table-group.js.map +1 -1
  74. package/es/index.d.ts +1 -1
  75. package/es/index.js +1 -1
  76. package/es/index.js.map +1 -1
  77. package/es/layout/pivot-header-layout.d.ts +6 -0
  78. package/es/layout/pivot-header-layout.js +74 -0
  79. package/es/layout/pivot-header-layout.js.map +1 -1
  80. package/es/layout/tree-helper.d.ts +2 -0
  81. package/es/layout/tree-helper.js +9 -0
  82. package/es/layout/tree-helper.js.map +1 -1
  83. package/es/state/state.d.ts +2 -0
  84. package/es/state/state.js +16 -4
  85. package/es/state/state.js.map +1 -1
  86. package/es/ts-types/events.d.ts +1 -0
  87. package/es/ts-types/events.js.map +1 -1
  88. package/es/ts-types/table-engine.d.ts +2 -1
  89. package/es/ts-types/table-engine.js.map +1 -1
  90. package/es/vrender.js.map +1 -1
  91. package/package.json +4 -4
package/dist/vtable.js CHANGED
@@ -24089,6 +24089,103 @@
24089
24089
  }
24090
24090
  }
24091
24091
 
24092
+ class AnimationTransitionRegistry {
24093
+ constructor() {
24094
+ this.transitions = new Map(), this.registerDefaultTransitions();
24095
+ }
24096
+ static getInstance() {
24097
+ return AnimationTransitionRegistry.instance || (AnimationTransitionRegistry.instance = new AnimationTransitionRegistry()), AnimationTransitionRegistry.instance;
24098
+ }
24099
+ registerDefaultTransitions() {
24100
+ this.registerTransition("appear", "*", () => ({
24101
+ allowTransition: !0,
24102
+ stopOriginalTransition: !1
24103
+ })), this.registerTransition("appear", "appear", () => ({
24104
+ allowTransition: !1,
24105
+ stopOriginalTransition: !1
24106
+ })), this.registerTransition("appear", "disappear", () => ({
24107
+ allowTransition: !0,
24108
+ stopOriginalTransition: !0
24109
+ })), this.registerTransition("appear", "exit", () => ({
24110
+ allowTransition: !0,
24111
+ stopOriginalTransition: !0
24112
+ })), this.registerTransition("normal", "*", () => ({
24113
+ allowTransition: !0,
24114
+ stopOriginalTransition: !1
24115
+ })), this.registerTransition("normal", "normal", () => ({
24116
+ allowTransition: !1,
24117
+ stopOriginalTransition: !1
24118
+ })), this.registerTransition("normal", "disappear", () => ({
24119
+ allowTransition: !0,
24120
+ stopOriginalTransition: !0
24121
+ })), this.registerTransition("normal", "exit", () => ({
24122
+ allowTransition: !0,
24123
+ stopOriginalTransition: !0
24124
+ })), this.registerTransition("exit", "*", () => ({
24125
+ allowTransition: !1,
24126
+ stopOriginalTransition: !1
24127
+ })), this.registerTransition("exit", "disappear", () => ({
24128
+ allowTransition: !0,
24129
+ stopOriginalTransition: !0
24130
+ })), this.registerTransition("exit", "enter", () => ({
24131
+ allowTransition: !0,
24132
+ stopOriginalTransition: !0
24133
+ })), this.registerTransition("exit", "exit", () => ({
24134
+ allowTransition: !1,
24135
+ stopOriginalTransition: !1
24136
+ })), this.registerTransition("enter", "*", () => ({
24137
+ allowTransition: !0,
24138
+ stopOriginalTransition: !1
24139
+ })), this.registerTransition("enter", "enter", () => ({
24140
+ allowTransition: !1,
24141
+ stopOriginalTransition: !1
24142
+ })), this.registerTransition("enter", "disappear", () => ({
24143
+ allowTransition: !0,
24144
+ stopOriginalTransition: !0
24145
+ })), this.registerTransition("enter", "exit", () => ({
24146
+ allowTransition: !0,
24147
+ stopOriginalTransition: !0
24148
+ })), this.registerTransition("disappear", "*", () => ({
24149
+ allowTransition: !1,
24150
+ stopOriginalTransition: !1
24151
+ })), this.registerTransition("disappear", "appear", () => ({
24152
+ allowTransition: !0,
24153
+ stopOriginalTransition: !0
24154
+ })), this.registerTransition("update", "*", () => ({
24155
+ allowTransition: !0,
24156
+ stopOriginalTransition: !1
24157
+ })), this.registerTransition("update", "disappear", () => ({
24158
+ allowTransition: !0,
24159
+ stopOriginalTransition: !0
24160
+ })), this.registerTransition("update", "exit", () => ({
24161
+ allowTransition: !0,
24162
+ stopOriginalTransition: !0
24163
+ })), this.registerTransition("state", "*", () => ({
24164
+ allowTransition: !0,
24165
+ stopOriginalTransition: !1
24166
+ })), this.registerTransition("state", "disappear", () => ({
24167
+ allowTransition: !0,
24168
+ stopOriginalTransition: !0
24169
+ })), this.registerTransition("state", "exit", () => ({
24170
+ allowTransition: !0,
24171
+ stopOriginalTransition: !0
24172
+ }));
24173
+ }
24174
+ isTransitionAllowed(fromState, toState, graphic) {
24175
+ var _a, _b, _c, _d;
24176
+ let func = null === (_a = this.transitions.get(fromState)) || void 0 === _a ? void 0 : _a.get(toState);
24177
+ return func ? func(graphic, fromState) : (func = null === (_b = this.transitions.get(fromState)) || void 0 === _b ? void 0 : _b.get("*"), func ? func(graphic, fromState) : (func = null === (_c = this.transitions.get("*")) || void 0 === _c ? void 0 : _c.get(toState), func ? func(graphic, fromState) : (func = null === (_d = this.transitions.get("*")) || void 0 === _d ? void 0 : _d.get("*"), func ? func(graphic, fromState) : {
24178
+ allowTransition: !0,
24179
+ stopOriginalTransition: !0
24180
+ })));
24181
+ }
24182
+ registerTransition(fromState, toState, transition) {
24183
+ let fromStateMap = this.transitions.get(fromState);
24184
+ fromStateMap || (fromStateMap = new Map(), this.transitions.set(fromState, fromStateMap)), fromStateMap.set(toState, transition);
24185
+ }
24186
+ }
24187
+ AnimationTransitionRegistry.getInstance();
24188
+
24092
24189
  class AnimateExecutor {
24093
24190
  static registerBuiltInAnimate(name, animate) {
24094
24191
  AnimateExecutor.builtInAnimateMap[name] = animate;
@@ -24096,333 +24193,3406 @@
24096
24193
  constructor(target) {
24097
24194
  this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
24098
24195
  }
24099
- onStart(cb) {
24100
- cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
24101
- cb();
24196
+ onStart(cb) {
24197
+ cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
24198
+ cb();
24199
+ });
24200
+ }
24201
+ onEnd(cb) {
24202
+ cb ? this._endCallbacks.push(cb) : this._endCallbacks.forEach(cb => {
24203
+ cb();
24204
+ });
24205
+ }
24206
+ _trackAnimation(animate) {
24207
+ this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
24208
+ this._activeCount--;
24209
+ const index = this._animates.indexOf(animate);
24210
+ index >= 0 && this._animates.splice(index, 1), 0 === this._activeCount && this._started && (this._started = !1, this.onEnd());
24211
+ });
24212
+ }
24213
+ parseParams(params, isTimeline, child) {
24214
+ var _a, _b;
24215
+ const totalTime = this.resolveValue(params.totalTime, void 0, void 0),
24216
+ startTime = this.resolveValue(params.startTime, void 0, 0),
24217
+ parsedParams = Object.assign({}, params);
24218
+ parsedParams.oneByOneDelay = 0, parsedParams.startTime = startTime, parsedParams.totalTime = totalTime;
24219
+ const oneByOne = this.resolveValue(params.oneByOne, child, !1);
24220
+ if (isTimeline) {
24221
+ const timeSlices = parsedParams.timeSlices;
24222
+ isArray$9(timeSlices) || (parsedParams.timeSlices = [timeSlices]);
24223
+ let sliceTime = 0;
24224
+ parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
24225
+ const delay = this.resolveValue(slice.delay, child, 0),
24226
+ delayAfter = this.resolveValue(slice.delayAfter, child, 0),
24227
+ duration = this.resolveValue(slice.duration, child, 300);
24228
+ return sliceTime += delay + duration + delayAfter, Object.assign(Object.assign({}, slice), {
24229
+ delay: delay,
24230
+ delayAfter: delayAfter,
24231
+ duration: duration
24232
+ });
24233
+ });
24234
+ let oneByOneDelay = 0;
24235
+ oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? sliceTime : 0), parsedParams.oneByOneDelay = oneByOneDelay;
24236
+ let scale = 1;
24237
+ if (totalTime) {
24238
+ const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);
24239
+ scale = totalTime ? totalTime / _totalTime : 1;
24240
+ }
24241
+ parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
24242
+ let effects = slice.effects;
24243
+ return Array.isArray(effects) || (effects = [effects]), Object.assign(Object.assign({}, slice), {
24244
+ delay: slice.delay * scale,
24245
+ delayAfter: slice.delayAfter * scale,
24246
+ duration: slice.duration * scale,
24247
+ effects: effects.map(effect => {
24248
+ var _a, _b;
24249
+ const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = effect.type) && void 0 !== _b ? _b : "fromTo"],
24250
+ customType = custom && isFunction$7(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
24251
+ return Object.assign(Object.assign({}, effect), {
24252
+ custom: custom,
24253
+ customType: customType
24254
+ });
24255
+ })
24256
+ });
24257
+ }), parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime * scale;
24258
+ } else {
24259
+ const delay = this.resolveValue(params.delay, child, 0),
24260
+ delayAfter = this.resolveValue(params.delayAfter, child, 0),
24261
+ duration = this.resolveValue(params.duration, child, 300);
24262
+ let oneByOneDelay = 0;
24263
+ oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? delay + delayAfter + duration : 0), parsedParams.oneByOneDelay = oneByOneDelay, parsedParams.custom = null !== (_a = params.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = params.type) && void 0 !== _b ? _b : "fromTo"];
24264
+ const customType = parsedParams.custom && isFunction$7(parsedParams.custom) ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) ? 1 : 2 : 0;
24265
+ if (parsedParams.customType = customType, totalTime) {
24266
+ const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2),
24267
+ scale = totalTime ? totalTime / _totalTime : 1;
24268
+ parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime;
24269
+ }
24270
+ }
24271
+ return parsedParams;
24272
+ }
24273
+ execute(params) {
24274
+ Array.isArray(params) ? params.forEach(param => this._execute(param)) : this._execute(params);
24275
+ }
24276
+ _execute(params) {
24277
+ if (params.selfOnly) return this._executeItem(params, this._target, 0, 1);
24278
+ const isTimeline = ("timeSlices" in params);
24279
+ let filteredChildren;
24280
+ isTimeline && params.partitioner && (filteredChildren = (null != filteredChildren ? filteredChildren : this._target.getChildren()).filter(child => {
24281
+ var _a, _b;
24282
+ return params.partitioner(null === (_b = null === (_a = child.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], child, {});
24283
+ })), isTimeline && params.sort && (filteredChildren = null != filteredChildren ? filteredChildren : this._target.getChildren(), filteredChildren.sort((a, b) => {
24284
+ var _a, _b, _c, _d;
24285
+ return params.sort(null === (_b = null === (_a = a.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], null === (_d = null === (_c = b.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], a, b, {});
24286
+ }));
24287
+ const cb = isTimeline ? (child, index, count) => {
24288
+ const parsedParams = this.parseParams(params, isTimeline, child),
24289
+ animate = this.executeTimelineItem(parsedParams, child, index, count);
24290
+ animate && this._trackAnimation(animate);
24291
+ } : (child, index, count) => {
24292
+ const parsedParams = this.parseParams(params, isTimeline, child),
24293
+ animate = this.executeTypeConfigItem(parsedParams, child, index, count);
24294
+ animate && this._trackAnimation(animate);
24295
+ };
24296
+ filteredChildren ? filteredChildren.forEach((child, index) => cb(child, index, filteredChildren.length)) : this._target.count <= 1 ? cb(this._target, 0, 1) : this._target.forEachChildren((child, index) => cb(child, index, this._target.count - 1));
24297
+ }
24298
+ executeTypeConfigItem(params, graphic, index, count) {
24299
+ var _a, _b, _c, _d, _e, _f, _g, _h;
24300
+ const {
24301
+ type = "fromTo",
24302
+ channel: channel,
24303
+ customParameters: customParameters,
24304
+ easing = "linear",
24305
+ delay = 0,
24306
+ delayAfter = 0,
24307
+ duration = 300,
24308
+ startTime = 0,
24309
+ oneByOneDelay = 0,
24310
+ loop: loop,
24311
+ bounce: bounce,
24312
+ priority = 0,
24313
+ options: options,
24314
+ custom: custom,
24315
+ customType: customType,
24316
+ controlOptions: controlOptions
24317
+ } = params,
24318
+ animate = graphic.animate();
24319
+ animate.priority = priority;
24320
+ const delayValue = isFunction$7(delay) ? delay(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : delay,
24321
+ datum = null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0],
24322
+ indexKey = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.indexKey;
24323
+ datum && indexKey && (index = null !== (_f = datum[indexKey]) && void 0 !== _f ? _f : index), animate.startAt(startTime);
24324
+ const wait = index * oneByOneDelay + delayValue;
24325
+ wait > 0 && animate.wait(wait);
24326
+ let parsedFromProps = null,
24327
+ props = params.to,
24328
+ from = params.from;
24329
+ props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
24330
+ let totalDelay = 0;
24331
+ oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
24332
+ const delayAfterValue = isFunction$7(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
24333
+ return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
24334
+ }
24335
+ _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
24336
+ var _a, _b, _c, _d;
24337
+ if (custom && customType) {
24338
+ const customParams = Object.assign({
24339
+ width: graphic.stage.width,
24340
+ height: graphic.stage.height,
24341
+ group: this._target.parent
24342
+ }, this.resolveValue(customParameters, graphic)),
24343
+ objOptions = isFunction$7(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParams) : options;
24344
+ customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
24345
+ } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
24346
+ }
24347
+ executeTimelineItem(params, graphic, index, count) {
24348
+ var _a, _b, _c, _d;
24349
+ const {
24350
+ timeSlices: timeSlices,
24351
+ startTime = 0,
24352
+ loop: loop,
24353
+ bounce: bounce,
24354
+ oneByOneDelay: oneByOneDelay,
24355
+ priority: priority,
24356
+ controlOptions: controlOptions
24357
+ } = params,
24358
+ datum = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0],
24359
+ indexKey = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.indexKey;
24360
+ datum && indexKey && (index = null !== (_d = datum[indexKey]) && void 0 !== _d ? _d : index);
24361
+ const animate = graphic.animate();
24362
+ animate.priority = priority, animate.startAt(startTime), animate.wait(index * oneByOneDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0);
24363
+ return (Array.isArray(timeSlices) ? timeSlices : [timeSlices]).forEach(slice => {
24364
+ this.applyTimeSliceToAnimate(slice, animate, graphic, controlOptions);
24365
+ }), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
24366
+ }
24367
+ applyTimeSliceToAnimate(slice, animate, graphic, controlOptions) {
24368
+ var _a, _b, _c, _d;
24369
+ const {
24370
+ effects: effects,
24371
+ duration = 300,
24372
+ delay = 0,
24373
+ delayAfter = 0
24374
+ } = slice,
24375
+ delayValue = isFunction$7(delay) ? delay(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : delay,
24376
+ delayAfterValue = isFunction$7(delayAfter) ? delayAfter(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : delayAfter;
24377
+ delayValue > 0 && animate.wait(delayValue);
24378
+ (Array.isArray(effects) ? effects : [effects]).forEach(effect => {
24379
+ var _a;
24380
+ const {
24381
+ type = "fromTo",
24382
+ channel: channel,
24383
+ customParameters: customParameters,
24384
+ easing = "linear",
24385
+ options: options
24386
+ } = effect;
24387
+ let parsedFromProps = null,
24388
+ props = effect.to,
24389
+ from = effect.from;
24390
+ props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
24391
+ const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
24392
+ customType = effect.customType;
24393
+ this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
24394
+ }), delayAfterValue > 0 && animate.wait(delayAfterValue);
24395
+ }
24396
+ createCustomInterpolatorAnimation(animate, interpolator, props, duration, easing, customParams) {
24397
+ const to = props;
24398
+ Object.keys(to).forEach(key => {
24399
+ animate.target.getComputedAttribute(key);
24400
+ }), animate.interpolateUpdateFunction = (from, to, ratio, step, target) => {
24401
+ interpolator(ratio, from, to, step, target, animate.target, customParams);
24402
+ }, animate.to(props, duration, easing);
24403
+ }
24404
+ createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
24405
+ const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
24406
+ animate.play(customAnimate);
24407
+ }
24408
+ createPropsFromChannel(channel, graphic) {
24409
+ const props = {};
24410
+ let from = null;
24411
+ return channel ? (Array.isArray(channel) ? channel.forEach(key => {
24412
+ var _a, _b;
24413
+ const value = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs) || void 0 === _b ? void 0 : _b[key];
24414
+ void 0 !== value && (props[key] = value);
24415
+ }) : Object.keys(channel).forEach(key => {
24416
+ var _a, _b, _c, _d;
24417
+ const config = channel[key];
24418
+ void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : props[key] = config.to), void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : from[key] = config.from);
24419
+ }), {
24420
+ from: from,
24421
+ props: props
24422
+ }) : {
24423
+ from: from,
24424
+ props: props
24425
+ };
24426
+ }
24427
+ resolveValue(value, graphic, defaultValue) {
24428
+ var _a, _b;
24429
+ return void 0 === value ? defaultValue : "function" == typeof value && graphic ? value(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : value;
24430
+ }
24431
+ executeItem(params, graphic, index = 0, count = 1) {
24432
+ return Array.isArray(params) ? params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean) : [this._executeItem(params, graphic, index, count)].filter(Boolean);
24433
+ }
24434
+ _executeItem(params, graphic, index = 0, count = 1) {
24435
+ if (!graphic) return null;
24436
+ const isTimeline = ("timeSlices" in params);
24437
+ let animate = null;
24438
+ const parsedParams = this.parseParams(params, isTimeline);
24439
+ return animate = isTimeline ? this.executeTimelineItem(parsedParams, graphic, index, count) : this.executeTypeConfigItem(parsedParams, graphic, index, count), animate && this._trackAnimation(animate), animate;
24440
+ }
24441
+ stop(type) {
24442
+ for (; this._animates.length > 0;) {
24443
+ const animate = this._animates.pop();
24444
+ null == animate || animate.stop(type);
24445
+ }
24446
+ this._animates = [], this._activeCount = 0, this._started && (this._started = !1, this.onEnd());
24447
+ }
24448
+ }
24449
+ AnimateExecutor.builtInAnimateMap = {};
24450
+
24451
+ const AnimationStates = {
24452
+ APPEAR: "appear",
24453
+ DISAPPEAR: "disappear",
24454
+ UPDATE: "update",
24455
+ HIGHLIGHT: "highlight",
24456
+ UNHIGHLIGHT: "unhighlight",
24457
+ SELECT: "select",
24458
+ UNSELECT: "unselect",
24459
+ HOVER: "hover",
24460
+ UNHOVER: "unhover",
24461
+ ACTIVE: "active",
24462
+ INACTIVE: "inactive"
24463
+ };
24464
+ class AnimationStateStore {
24465
+ constructor(graphic) {
24466
+ this.graphic = graphic;
24467
+ }
24468
+ registerState(state) {
24469
+ this.states || (this.states = new Map()), this.states.set(state.name, state);
24470
+ }
24471
+ clearStates() {
24472
+ var _a;
24473
+ null === (_a = this.states) || void 0 === _a || _a.clear();
24474
+ }
24475
+ }
24476
+ class AnimationStateManager {
24477
+ constructor(graphic) {
24478
+ this.stateList = null, this.graphic = graphic;
24479
+ }
24480
+ applyState(nextState, animationConfig, callback) {
24481
+ const registry = AnimationTransitionRegistry.getInstance(),
24482
+ shouldStopState = [],
24483
+ shouldApplyState = [];
24484
+ if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
24485
+ const result = {
24486
+ allowTransition: !0,
24487
+ stopOriginalTransition: !0
24488
+ };
24489
+ this.stateList.forEach(currState => {
24490
+ const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
24491
+ result.allowTransition = result.allowTransition && _result.allowTransition;
24492
+ }), result.allowTransition && (shouldApplyState.push({
24493
+ state: state,
24494
+ animationConfig: isArray$9(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
24495
+ executor: new AnimateExecutor(this.graphic)
24496
+ }), this.stateList.forEach(currState => {
24497
+ registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
24498
+ }));
24499
+ }) : nextState.forEach((state, index) => {
24500
+ shouldApplyState.push({
24501
+ state: state,
24502
+ animationConfig: isArray$9(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
24503
+ executor: new AnimateExecutor(this.graphic)
24504
+ });
24505
+ }), shouldStopState.forEach(state => {
24506
+ state.executor.stop();
24507
+ }), shouldApplyState.length) {
24508
+ shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
24509
+ for (let i = 0; i < shouldApplyState.length; i++) {
24510
+ const nextState = shouldApplyState[i + 1],
24511
+ currentState = shouldApplyState[i];
24512
+ currentState.executor.onEnd(() => {
24513
+ nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
24514
+ });
24515
+ }
24516
+ } else callback && callback(!0);
24517
+ this.stateList ? this.stateList = this.stateList.filter(state => !shouldStopState.includes(state)) : this.stateList = [], this.stateList.push(...shouldApplyState);
24518
+ }
24519
+ applyAppearState(animationConfig, callback) {
24520
+ this.applyState([AnimationStates.APPEAR], [{
24521
+ name: AnimationStates.APPEAR,
24522
+ animation: animationConfig
24523
+ }], callback);
24524
+ }
24525
+ applyDisappearState(animationConfig, callback) {
24526
+ this.applyState([AnimationStates.DISAPPEAR], [{
24527
+ name: AnimationStates.DISAPPEAR,
24528
+ animation: animationConfig
24529
+ }], callback);
24530
+ }
24531
+ applyUpdateState(animationConfig, callback) {
24532
+ this.applyState([AnimationStates.UPDATE], [{
24533
+ name: AnimationStates.UPDATE,
24534
+ animation: animationConfig
24535
+ }], callback);
24536
+ }
24537
+ applyHighlightState(animationConfig, callback) {
24538
+ this.applyState([AnimationStates.HIGHLIGHT], [{
24539
+ name: AnimationStates.HIGHLIGHT,
24540
+ animation: animationConfig
24541
+ }], callback);
24542
+ }
24543
+ applyUnhighlightState(animationConfig, callback) {
24544
+ this.applyState([AnimationStates.UNHIGHLIGHT], [{
24545
+ name: AnimationStates.UNHIGHLIGHT,
24546
+ animation: animationConfig
24547
+ }], callback);
24548
+ }
24549
+ stopState(state, type) {
24550
+ var _a;
24551
+ const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
24552
+ stateInfo && stateInfo.executor.stop(type);
24553
+ }
24554
+ clearState() {
24555
+ var _a;
24556
+ null === (_a = this.stateList) || void 0 === _a || _a.forEach(state => {
24557
+ state.executor.stop();
24558
+ }), this.stateList = null;
24559
+ }
24560
+ }
24561
+
24562
+ class GraphicStateExtension {
24563
+ _getAnimationStateManager(graphic) {
24564
+ return graphic._animationStateManager || (graphic._animationStateManager = new AnimationStateManager(graphic)), graphic._animationStateManager;
24565
+ }
24566
+ _getAnimationStateStore(graphic) {
24567
+ return graphic._animationStateStore || (graphic._animationStateStore = new AnimationStateStore(graphic)), graphic._animationStateStore;
24568
+ }
24569
+ registerAnimationState(state) {
24570
+ return this._getAnimationStateStore(this).registerState(state), this;
24571
+ }
24572
+ applyAnimationState(state, animationConfig, callback) {
24573
+ return this._getAnimationStateManager(this).applyState(state, animationConfig, callback), this;
24574
+ }
24575
+ applyAppearState(animationConfig, callback) {
24576
+ return this._getAnimationStateManager(this).applyAppearState(animationConfig, callback), this;
24577
+ }
24578
+ applyDisappearState(animationConfig, callback) {
24579
+ return this._getAnimationStateManager(this).applyDisappearState(animationConfig, callback), this;
24580
+ }
24581
+ applyUpdateState(animationConfig, callback) {
24582
+ return this._getAnimationStateManager(this).applyUpdateState(animationConfig, callback), this;
24583
+ }
24584
+ applyHighlightState(animationConfig, callback) {
24585
+ return this._getAnimationStateManager(this).applyHighlightState(animationConfig, callback), this;
24586
+ }
24587
+ applyUnhighlightState(animationConfig, callback) {
24588
+ return this._getAnimationStateManager(this).applyUnhighlightState(animationConfig, callback), this;
24589
+ }
24590
+ stopAnimationState(state, type) {
24591
+ return this._getAnimationStateManager(this).stopState(state, type), this;
24592
+ }
24593
+ clearAnimationStates() {
24594
+ return this._getAnimationStateManager(this).clearState(), this;
24595
+ }
24596
+ static extend(graphic) {
24597
+ return new GraphicStateExtension()._getAnimationStateManager(graphic), graphic;
24598
+ }
24599
+ }
24600
+
24601
+ class AnimateExtension {
24602
+ getAttributes(final = !1) {
24603
+ return final && this.finalAttribute ? this.finalAttribute : this.attribute;
24604
+ }
24605
+ animate(params) {
24606
+ var _a, _b, _c;
24607
+ const animate = new Animate(null == params ? void 0 : params.id, null !== (_b = null !== (_a = null == params ? void 0 : params.timeline) && void 0 !== _a ? _a : this.stage && this.stage.getTimeline()) && void 0 !== _b ? _b : defaultTimeline, null == params ? void 0 : params.slience);
24608
+ if (animate.bind(this), params) {
24609
+ const {
24610
+ onStart: onStart,
24611
+ onEnd: onEnd,
24612
+ onRemove: onRemove
24613
+ } = params;
24614
+ null != onStart && animate.onStart(onStart), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove);
24615
+ }
24616
+ return null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
24617
+ }
24618
+ createTimeline() {
24619
+ return new DefaultTimeline();
24620
+ }
24621
+ createTicker(stage) {
24622
+ return new DefaultTicker(stage);
24623
+ }
24624
+ setFinalAttributes(finalAttribute) {
24625
+ this.finalAttribute || (this.finalAttribute = {}), Object.assign(this.finalAttribute, finalAttribute);
24626
+ }
24627
+ initFinalAttributes(finalAttribute) {
24628
+ this.finalAttribute = finalAttribute;
24629
+ }
24630
+ initAnimateExecutor() {
24631
+ this._animateExecutor || (this._animateExecutor = new AnimateExecutor(this));
24632
+ }
24633
+ executeAnimation(config) {
24634
+ return this.initAnimateExecutor(), this._animateExecutor.execute(config), this;
24635
+ }
24636
+ executeAnimations(configs) {
24637
+ return this.initAnimateExecutor(), configs.forEach(config => {
24638
+ this._animateExecutor.execute(config);
24639
+ }), this;
24640
+ }
24641
+ getFinalAttribute() {
24642
+ return this.finalAttribute;
24643
+ }
24644
+ getGraphicAttribute(key, prev = !1) {
24645
+ return !prev && this.finalAttribute ? this.finalAttribute[key] : this.attribute[key];
24646
+ }
24647
+ }
24648
+
24649
+ function registerAnimate() {
24650
+ mixin$1(Graphic, GraphicStateExtension), mixin$1(Graphic, AnimateExtension);
24651
+ }
24652
+
24653
+ class ACustomAnimate extends Step {
24654
+ constructor(customFrom, customTo, duration, easing, params) {
24655
+ super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params, this.from = customFrom, this.to = customTo;
24656
+ }
24657
+ update(end, ratio, out) {
24658
+ if (this.onStart(), !this.props || !this.propKeys) return;
24659
+ const easedRatio = this.easing(ratio);
24660
+ this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
24661
+ }
24662
+ setProps(props) {
24663
+ this.props = props, this.propKeys = Object.keys(props), this.animate.reSyncProps();
24664
+ }
24665
+ }
24666
+ class AComponentAnimate extends ACustomAnimate {
24667
+ completeBind(animator) {
24668
+ this.setStartTime(0), this._animator && this._animator.start(), this.setDuration(animator.getDuration());
24669
+ }
24670
+ stop() {
24671
+ this._animator && this._animator.stop();
24672
+ }
24673
+ }
24674
+
24675
+ class ComponentAnimator {
24676
+ constructor(component) {
24677
+ this.tasks = [], this.started = !1, this.completed = 0, this.totalDuration = 0, this.onStartCallbacks = [], this.onEndCallbacks = [], this.onUpdateCallbacks = [], this.component = component;
24678
+ }
24679
+ animate(graphic, config) {
24680
+ return this.started ? (this) : (this.tasks.push({
24681
+ graphic: graphic,
24682
+ config: config
24683
+ }), this);
24684
+ }
24685
+ onStart(callback) {
24686
+ return this.onStartCallbacks.push(callback), this;
24687
+ }
24688
+ onEnd(callback) {
24689
+ return this.onEndCallbacks.push(callback), this;
24690
+ }
24691
+ onUpdate(callback) {
24692
+ return this.onUpdateCallbacks.push(callback), this;
24693
+ }
24694
+ start() {
24695
+ return this.started ? (this) : (this.started = !0, this.completed = 0, this.onStartCallbacks.forEach(callback => callback()), 0 === this.tasks.length ? (setTimeout(() => {
24696
+ this.onEndCallbacks.forEach(callback => callback());
24697
+ }, 0), this) : (this.tasks.forEach(task => {
24698
+ const executor = new AnimateExecutor(task.graphic);
24699
+ executor.onEnd(() => {
24700
+ this.completed++, this.completed === this.tasks.length && this.onEndCallbacks.forEach(callback => callback());
24701
+ });
24702
+ const animate = executor.executeItem(task.config, task.graphic);
24703
+ task.animate = animate, animate.forEach(animate => {
24704
+ this.totalDuration = Math.max(this.totalDuration, animate.getStartTime() + animate.getDuration());
24705
+ });
24706
+ }), this));
24707
+ }
24708
+ deleteSelfAttr(key) {
24709
+ this.tasks.forEach(task => {
24710
+ task.animate && task.animate.forEach(animate => animate.preventAttr(key));
24711
+ });
24712
+ }
24713
+ stop(type) {
24714
+ return this.tasks.forEach(task => {
24715
+ task.animate && task.animate.forEach(animate => animate.stop(type));
24716
+ }), this.started && this.completed !== this.tasks.length && (this.onEndCallbacks.forEach(callback => callback()), this.completed = this.tasks.length), this;
24717
+ }
24718
+ getDuration() {
24719
+ return this.totalDuration;
24720
+ }
24721
+ }
24722
+ function createComponentAnimator(component) {
24723
+ return new ComponentAnimator(component);
24724
+ }
24725
+
24726
+ class IncreaseCount extends ACustomAnimate {
24727
+ constructor(from, to, duration, easing, params) {
24728
+ super(from, to, duration, easing, params), this.formatTemplate = null, this.decimalLength = null == params ? void 0 : params.decimalLength, (null == params ? void 0 : params.formatTemplate) && params.formatTemplate.includes("{{var}}") && (this.formatTemplate = params.formatTemplate);
24729
+ }
24730
+ onFirstRun() {
24731
+ var _a, _b, _c;
24732
+ const fromProps = this.getLastProps(),
24733
+ toProps = this.getEndProps(),
24734
+ fromText = null !== (_a = fromProps.text) && void 0 !== _a ? _a : 0,
24735
+ toText = null !== (_b = toProps.text) && void 0 !== _b ? _b : 0;
24736
+ this.valid = !0;
24737
+ let fromNum = 0,
24738
+ toNum = 0,
24739
+ fromFormat = "",
24740
+ toFormat = "",
24741
+ maxDecimalLength = 0;
24742
+ if ("number" == typeof fromText) {
24743
+ fromNum = fromText;
24744
+ const decimalPart = fromText.toString().split(".")[1] || "";
24745
+ maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
24746
+ } else {
24747
+ if ("string" != typeof fromText) return void (this.valid = !1);
24748
+ if (fromText.endsWith("%")) {
24749
+ fromFormat = "%";
24750
+ const cleanNumStr = fromText.substring(0, fromText.length - 1).replace(/,/g, "");
24751
+ if (fromNum = parseFloat(cleanNumStr) / 100, isNaN(fromNum)) return void (this.valid = !1);
24752
+ const decimalPart = cleanNumStr.split(".")[1] || "";
24753
+ maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length + 2);
24754
+ } else {
24755
+ const cleanNumStr = fromText.replace(/,/g, "");
24756
+ if (fromNum = parseFloat(cleanNumStr), isNaN(fromNum)) return void (this.valid = !1);
24757
+ fromText.includes(",") && (fromFormat = ",");
24758
+ const decimalPart = cleanNumStr.split(".")[1] || "";
24759
+ maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
24760
+ }
24761
+ }
24762
+ if ("number" == typeof toText) {
24763
+ toNum = toText;
24764
+ const decimalPart = toText.toString().split(".")[1] || "";
24765
+ maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
24766
+ } else {
24767
+ if ("string" != typeof toText) return void (this.valid = !1);
24768
+ if (toText.endsWith("%")) {
24769
+ toFormat = "%";
24770
+ const cleanNumStr = toText.substring(0, toText.length - 1).replace(/,/g, "");
24771
+ if (toNum = parseFloat(cleanNumStr) / 100, isNaN(toNum)) return void (this.valid = !1);
24772
+ const decimalPart = cleanNumStr.split(".")[1] || "";
24773
+ maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length + 2);
24774
+ } else {
24775
+ const cleanNumStr = toText.replace(/,/g, "");
24776
+ if (toNum = parseFloat(cleanNumStr), isNaN(toNum)) return void (this.valid = !1);
24777
+ toText.includes(",") && (toFormat = ",");
24778
+ const decimalPart = cleanNumStr.split(".")[1] || "";
24779
+ maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
24780
+ }
24781
+ }
24782
+ if (null === (_c = this.params) || void 0 === _c ? void 0 : _c.format) {
24783
+ switch (this.params.format) {
24784
+ case "percent":
24785
+ this.format = "%";
24786
+ break;
24787
+ case "thousandth":
24788
+ this.format = ",";
24789
+ break;
24790
+ case "none":
24791
+ this.format = "";
24792
+ break;
24793
+ default:
24794
+ this.format = toFormat || fromFormat;
24795
+ }
24796
+ "%" === this.format && "%" !== toFormat && "%" !== fromFormat && void 0 === this.decimalLength && (this.decimalLength = 2), "%" === this.format || "%" !== toFormat && "%" !== fromFormat || (fromNum *= 100, toNum *= 100);
24797
+ } else this.format = toFormat || fromFormat;
24798
+ this.fromNumber = fromNum, this.toNumber = toNum, void 0 === this.decimalLength && (this.decimalLength = maxDecimalLength);
24799
+ }
24800
+ onEnd(cb) {
24801
+ super.onEnd(cb), cb || this.props && this.target.setAttributes(this.props);
24802
+ }
24803
+ onUpdate(end, ratio, out) {
24804
+ if (!this.valid) return;
24805
+ const currentNumber = this.fromNumber + (this.toNumber - this.fromNumber) * ratio;
24806
+ let formattedText = "";
24807
+ const format = this.format,
24808
+ numberWithDecimals = ("%" === format ? 100 * currentNumber : currentNumber).toFixed(this.decimalLength);
24809
+ let formattedWithBasicFormat,
24810
+ formattedNumber = numberWithDecimals;
24811
+ if (parseFloat(numberWithDecimals) === Math.floor(parseFloat(numberWithDecimals)) && (formattedNumber = Math.floor(parseFloat(numberWithDecimals))), "%" === format) formattedWithBasicFormat = `${formattedNumber}%`;else if ("," === format) {
24812
+ const parts = formattedNumber.toString().split(".");
24813
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), formattedWithBasicFormat = parts.join(".");
24814
+ } else formattedWithBasicFormat = formattedNumber;
24815
+ formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, this.target.setAttribute("text", formattedText);
24816
+ }
24817
+ }
24818
+
24819
+ class InputText extends ACustomAnimate {
24820
+ constructor(from, to, duration, easing, params) {
24821
+ super(from, to, duration, easing, params), this.fromText = "", this.toText = "", this.showCursor = !1, this.cursorChar = "|", this.blinkCursor = !0, this.beforeText = "", this.afterText = "", void 0 !== (null == params ? void 0 : params.showCursor) && (this.showCursor = params.showCursor), void 0 !== (null == params ? void 0 : params.cursorChar) && (this.cursorChar = params.cursorChar), void 0 !== (null == params ? void 0 : params.blinkCursor) && (this.blinkCursor = params.blinkCursor), void 0 !== (null == params ? void 0 : params.beforeText) && (this.beforeText = params.beforeText), void 0 !== (null == params ? void 0 : params.afterText) && (this.afterText = params.afterText);
24822
+ }
24823
+ onFirstRun() {
24824
+ var _a, _b;
24825
+ const fromProps = this.getLastProps(),
24826
+ toProps = this.getEndProps(),
24827
+ fromText = null !== (_a = fromProps.text) && void 0 !== _a ? _a : "",
24828
+ toText = null !== (_b = toProps.text) && void 0 !== _b ? _b : "";
24829
+ this.valid = !0, this.fromText = fromText.toString(), this.toText = toText.toString(), this.toText || "" === this.toText || (this.valid = !1);
24830
+ }
24831
+ onEnd(cb) {
24832
+ super.onEnd(cb), cb || (this.showCursor && !this.blinkCursor ? this.target.setAttribute("text", this.beforeText + this.toText + this.cursorChar + this.afterText) : this.target.setAttribute("text", this.beforeText + this.toText + this.afterText));
24833
+ }
24834
+ onUpdate(end, ratio, out) {
24835
+ if (!this.valid) return;
24836
+ const totalChars = this.toText.length,
24837
+ fromChars = this.fromText.length;
24838
+ let currentLength, currentText;
24839
+ fromChars > totalChars ? (currentLength = Math.round(fromChars - (fromChars - totalChars) * ratio), currentText = this.fromText.substring(0, currentLength)) : (currentLength = Math.round(fromChars + (totalChars - fromChars) * ratio), currentText = this.toText.startsWith(this.fromText) ? this.toText.substring(0, currentLength) : currentLength <= fromChars ? this.fromText.substring(0, currentLength) : this.toText.substring(0, currentLength - fromChars + Math.min(fromChars, currentLength)));
24840
+ let displayText = this.beforeText + currentText + this.afterText;
24841
+ if (this.showCursor) if (this.blinkCursor) {
24842
+ const blinkRate = .1;
24843
+ Math.floor(ratio / blinkRate) % 2 == 0 && (displayText = this.beforeText + currentText + this.cursorChar + this.afterText);
24844
+ } else displayText = this.beforeText + currentText + this.cursorChar + this.afterText;
24845
+ this.target.setAttribute("text", displayText);
24846
+ }
24847
+ }
24848
+
24849
+ class CommonIn extends ACustomAnimate {
24850
+ constructor(from, to, duration, easing, params) {
24851
+ super(from, to, duration, easing, params);
24852
+ }
24853
+ onBind() {
24854
+ var _a, _b, _c;
24855
+ super.onBind();
24856
+ const attrs = this.target.getFinalAttribute(),
24857
+ fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {},
24858
+ to = {},
24859
+ from = null !== (_b = this.from) && void 0 !== _b ? _b : {};
24860
+ this.keys.forEach(key => {
24861
+ var _a, _b, _c;
24862
+ to[key] = null !== (_a = null == attrs ? void 0 : attrs[key]) && void 0 !== _a ? _a : 1, from[key] = null !== (_c = null !== (_b = from[key]) && void 0 !== _b ? _b : fromAttrs[key]) && void 0 !== _c ? _c : 0;
24863
+ });
24864
+ const finalAttribute = this.target.getFinalAttribute();
24865
+ finalAttribute && this.target.setAttributes(finalAttribute), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, !1 !== (null === (_c = this.params.controlOptions) || void 0 === _c ? void 0 : _c.immediatelyApply) && this.target.setAttributes(from);
24866
+ }
24867
+ onUpdate(end, ratio, out) {
24868
+ const attribute = this.target.attribute;
24869
+ this.propKeys.forEach(key => {
24870
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
24871
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
24872
+ }
24873
+ }
24874
+ class CommonOut extends ACustomAnimate {
24875
+ constructor(from, to, duration, easing, params) {
24876
+ super(from, to, duration, easing, params);
24877
+ }
24878
+ onBind() {
24879
+ super.onBind();
24880
+ const attrs = this.target.attribute,
24881
+ to = {},
24882
+ from = {};
24883
+ this.keys.forEach(key => {
24884
+ var _a;
24885
+ to[key] = 0, from[key] = null !== (_a = attrs[key]) && void 0 !== _a ? _a : 1;
24886
+ }), this.props = to, this.propKeys = this.keys, this.from = from, this.to = to, Object.assign(this.target.attribute, from), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
24887
+ }
24888
+ onEnd(cb) {
24889
+ super.onEnd(cb);
24890
+ }
24891
+ onUpdate(end, ratio, out) {
24892
+ const attribute = this.target.attribute;
24893
+ this.propKeys.forEach(key => {
24894
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
24895
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
24896
+ }
24897
+ }
24898
+
24899
+ class ClipIn extends CommonIn {
24900
+ constructor(from, to, duration, easing, params) {
24901
+ super(from, to, duration, easing, params), this.keys = ["clipRange"], this.from = {
24902
+ clipRange: 0
24903
+ };
24904
+ }
24905
+ onFirstRun() {
24906
+ var _a;
24907
+ super.onFirstRun();
24908
+ const {
24909
+ clipDimension: clipDimension
24910
+ } = (null === (_a = this.params) || void 0 === _a ? void 0 : _a.options) || {};
24911
+ clipDimension && (this.target.attribute.clipRangeByDimension = clipDimension);
24912
+ }
24913
+ }
24914
+ class ClipOut extends CommonOut {
24915
+ constructor(from, to, duration, easing, params) {
24916
+ super(from, to, duration, easing, params), this.keys = ["clipRange"];
24917
+ }
24918
+ }
24919
+
24920
+ class FadeIn extends CommonIn {
24921
+ constructor(from, to, duration, easing, params) {
24922
+ super(from, to, duration, easing, params), this.keys = ["opacity", "fillOpacity", "strokeOpacity"], this.from = {
24923
+ opacity: 0,
24924
+ fillOpacity: 0,
24925
+ strokeOpacity: 0
24926
+ };
24927
+ }
24928
+ }
24929
+ class FadeOut extends CommonOut {
24930
+ constructor(from, to, duration, easing, params) {
24931
+ super(from, to, duration, easing, params), this.keys = ["opacity", "fillOpacity", "strokeOpacity"];
24932
+ }
24933
+ }
24934
+
24935
+ const growAngleInIndividual = (graphic, options, animationParameters) => {
24936
+ const attrs = graphic.getFinalAttribute();
24937
+ return options && "anticlockwise" === options.orient ? {
24938
+ from: {
24939
+ startAngle: null == attrs ? void 0 : attrs.endAngle
24940
+ },
24941
+ to: {
24942
+ startAngle: null == attrs ? void 0 : attrs.startAngle
24943
+ }
24944
+ } : {
24945
+ from: {
24946
+ endAngle: null == attrs ? void 0 : attrs.startAngle
24947
+ },
24948
+ to: {
24949
+ endAngle: null == attrs ? void 0 : attrs.endAngle
24950
+ }
24951
+ };
24952
+ },
24953
+ growAngleInOverall = (graphic, options, animationParameters) => {
24954
+ const attrs = graphic.getFinalAttribute();
24955
+ if (options && "anticlockwise" === options.orient) {
24956
+ const overallValue = isNumber$6(options.overall) ? options.overall : 2 * Math.PI;
24957
+ return {
24958
+ from: {
24959
+ startAngle: overallValue,
24960
+ endAngle: overallValue
24961
+ },
24962
+ to: {
24963
+ startAngle: null == attrs ? void 0 : attrs.startAngle,
24964
+ endAngle: null == attrs ? void 0 : attrs.endAngle
24965
+ }
24966
+ };
24967
+ }
24968
+ const overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0;
24969
+ return {
24970
+ from: {
24971
+ startAngle: overallValue,
24972
+ endAngle: overallValue
24973
+ },
24974
+ to: {
24975
+ startAngle: null == attrs ? void 0 : attrs.startAngle,
24976
+ endAngle: null == attrs ? void 0 : attrs.endAngle
24977
+ }
24978
+ };
24979
+ };
24980
+ const growAngleIn = (graphic, options, animationParameters) => {
24981
+ var _a;
24982
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growAngleInOverall(graphic, options) : growAngleInIndividual(graphic, options);
24983
+ };
24984
+ const growAngleOutIndividual = (graphic, options, animationParameters) => {
24985
+ const attrs = graphic.attribute;
24986
+ return options && "anticlockwise" === options.orient ? {
24987
+ from: {
24988
+ startAngle: attrs.startAngle
24989
+ },
24990
+ to: {
24991
+ startAngle: null == attrs ? void 0 : attrs.endAngle
24992
+ }
24993
+ } : {
24994
+ from: {
24995
+ endAngle: attrs.endAngle
24996
+ },
24997
+ to: {
24998
+ endAngle: null == attrs ? void 0 : attrs.startAngle
24999
+ }
25000
+ };
25001
+ },
25002
+ growAngleOutOverall = (graphic, options, animationParameters) => {
25003
+ const attrs = graphic.attribute;
25004
+ if (options && "anticlockwise" === options.orient) {
25005
+ const overallValue = isNumber$6(options.overall) ? options.overall : 2 * Math.PI;
25006
+ return {
25007
+ from: {
25008
+ startAngle: attrs.startAngle,
25009
+ endAngle: attrs.endAngle
25010
+ },
25011
+ to: {
25012
+ startAngle: overallValue,
25013
+ endAngle: overallValue
25014
+ }
25015
+ };
25016
+ }
25017
+ const overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0;
25018
+ return {
25019
+ from: {
25020
+ startAngle: attrs.startAngle,
25021
+ endAngle: attrs.endAngle
25022
+ },
25023
+ to: {
25024
+ startAngle: overallValue,
25025
+ endAngle: overallValue
25026
+ }
25027
+ };
25028
+ };
25029
+ class GrowAngleBase extends ACustomAnimate {
25030
+ constructor(from, to, duration, easing, params) {
25031
+ super(from, to, duration, easing, params);
25032
+ }
25033
+ determineUpdateFunction() {
25034
+ this.propKeys ? this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : "startAngle" === this.propKeys[0] ? this._updateFunction = this.updateStartAngle : "endAngle" === this.propKeys[0] ? this._updateFunction = this.updateEndAngle : this.valid = !1 : this.valid = !1;
25035
+ }
25036
+ deleteSelfAttr(key) {
25037
+ delete this.props[key], this.fromProps && delete this.fromProps[key];
25038
+ const index = this.propKeys.indexOf(key);
25039
+ -1 !== index && this.propKeys.splice(index, 1), this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateAngle : "startAngle" === this.propKeys[0] ? this._updateFunction = this.updateStartAngle : "endAngle" === this.propKeys[0] ? this._updateFunction = this.updateEndAngle : this._updateFunction = null;
25040
+ }
25041
+ updateStartAngle(ratio) {
25042
+ this.target.attribute.startAngle = this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
25043
+ }
25044
+ updateEndAngle(ratio) {
25045
+ this.target.attribute.endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;
25046
+ }
25047
+ updateAngle(ratio) {
25048
+ this.updateStartAngle(ratio), this.updateEndAngle(ratio);
25049
+ }
25050
+ onUpdate(end, ratio, out) {
25051
+ this._updateFunction && (this._updateFunction(ratio), this.target.addUpdateShapeAndBoundsTag());
25052
+ }
25053
+ }
25054
+ class GrowAngleIn extends GrowAngleBase {
25055
+ onBind() {
25056
+ var _a, _b;
25057
+ super.onBind();
25058
+ const {
25059
+ from: from,
25060
+ to: to
25061
+ } = growAngleIn(this.target, this.params.options, this.params),
25062
+ fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
25063
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
25064
+ const finalAttribute = this.target.getFinalAttribute();
25065
+ finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs), this.determineUpdateFunction();
25066
+ }
25067
+ }
25068
+ class GrowAngleOut extends GrowAngleBase {
25069
+ onBind() {
25070
+ super.onBind();
25071
+ const {
25072
+ from: from,
25073
+ to: to
25074
+ } = (graphic = this.target, options = this.params.options, this.params, !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growAngleOutOverall(graphic, options) : growAngleOutIndividual(graphic, options));
25075
+ var graphic, options, _a;
25076
+ const fromAttrs = from;
25077
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = null != fromAttrs ? fromAttrs : this.target.attribute, this.to = to, this.determineUpdateFunction();
25078
+ }
25079
+ }
25080
+
25081
+ const growCenterIn = (graphic, options, animationParameters) => {
25082
+ const attrs = graphic.getFinalAttribute();
25083
+ switch (null == options ? void 0 : options.direction) {
25084
+ case "x":
25085
+ {
25086
+ const x = attrs.x,
25087
+ x1 = attrs.x1,
25088
+ width = attrs.width;
25089
+ return {
25090
+ from: isValid$5(width) ? {
25091
+ x: x + width / 2,
25092
+ x1: void 0,
25093
+ width: 0
25094
+ } : {
25095
+ x: (x + x1) / 2,
25096
+ x1: (x + x1) / 2,
25097
+ width: void 0
25098
+ },
25099
+ to: {
25100
+ x: x,
25101
+ x1: x1,
25102
+ width: width
25103
+ }
25104
+ };
25105
+ }
25106
+ case "y":
25107
+ {
25108
+ const y = attrs.y,
25109
+ y1 = attrs.y1,
25110
+ height = attrs.height;
25111
+ return {
25112
+ from: isValid$5(height) ? {
25113
+ y: y + height / 2,
25114
+ y1: void 0,
25115
+ height: 0
25116
+ } : {
25117
+ y: (y + y1) / 2,
25118
+ y1: (y + y1) / 2,
25119
+ height: void 0
25120
+ },
25121
+ to: {
25122
+ y: y,
25123
+ y1: y1,
25124
+ height: height
25125
+ }
25126
+ };
25127
+ }
25128
+ default:
25129
+ {
25130
+ const x = attrs.x,
25131
+ x1 = attrs.x1,
25132
+ width = attrs.width,
25133
+ y = attrs.y,
25134
+ y1 = attrs.y1,
25135
+ height = attrs.height,
25136
+ from = {};
25137
+ return isValid$5(width) ? (from.x = x + width / 2, from.width = 0, from.x1 = void 0) : (from.x = (x + x1) / 2, from.x1 = (x + x1) / 2, from.width = void 0), isValid$5(height) ? (from.y = y + height / 2, from.height = 0, from.y1 = void 0) : (from.y = (y + y1) / 2, from.y1 = (y + y1) / 2, from.height = void 0), {
25138
+ from: from,
25139
+ to: {
25140
+ x: x,
25141
+ y: y,
25142
+ x1: x1,
25143
+ y1: y1,
25144
+ width: width,
25145
+ height: height
25146
+ }
25147
+ };
25148
+ }
25149
+ }
25150
+ },
25151
+ growCenterOut = (graphic, options, animationParameters) => {
25152
+ const attrs = graphic.attribute;
25153
+ switch (null == options ? void 0 : options.direction) {
25154
+ case "x":
25155
+ {
25156
+ const x = attrs.x,
25157
+ x1 = attrs.x1,
25158
+ width = attrs.width;
25159
+ return {
25160
+ to: isValid$5(width) ? {
25161
+ x: x + width / 2,
25162
+ x1: void 0,
25163
+ width: 0
25164
+ } : {
25165
+ x: (x + x1) / 2,
25166
+ x1: (x + x1) / 2,
25167
+ width: void 0
25168
+ }
25169
+ };
25170
+ }
25171
+ case "y":
25172
+ {
25173
+ const y = attrs.y,
25174
+ y1 = attrs.y1,
25175
+ height = attrs.height;
25176
+ return {
25177
+ to: isValid$5(height) ? {
25178
+ y: y + height / 2,
25179
+ y1: void 0,
25180
+ height: 0
25181
+ } : {
25182
+ y: (y + y1) / 2,
25183
+ y1: (y + y1) / 2,
25184
+ height: void 0
25185
+ }
25186
+ };
25187
+ }
25188
+ default:
25189
+ {
25190
+ const x = attrs.x,
25191
+ y = attrs.y,
25192
+ x1 = attrs.x1,
25193
+ y1 = attrs.y1,
25194
+ width = attrs.width,
25195
+ height = attrs.height,
25196
+ to = {};
25197
+ return isValid$5(width) ? (to.x = x + width / 2, to.width = 0, to.x1 = void 0) : (to.x = (x + x1) / 2, to.x1 = (x + x1) / 2, to.width = void 0), isValid$5(height) ? (to.y = y + height / 2, to.height = 0, to.y1 = void 0) : (to.y = (y + y1) / 2, to.y1 = (y + y1) / 2, to.height = void 0), {
25198
+ to: to
25199
+ };
25200
+ }
25201
+ }
25202
+ };
25203
+ class GrowCenterIn extends ACustomAnimate {
25204
+ constructor(from, to, duration, easing, params) {
25205
+ super(from, to, duration, easing, params);
25206
+ }
25207
+ onBind() {
25208
+ var _a, _b;
25209
+ super.onBind();
25210
+ const {
25211
+ from: from,
25212
+ to: to
25213
+ } = growCenterIn(this.target, this.params.options, this.params),
25214
+ fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
25215
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
25216
+ const finalAttribute = this.target.getFinalAttribute();
25217
+ finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
25218
+ }
25219
+ onEnd(cb) {
25220
+ super.onEnd(cb);
25221
+ }
25222
+ onUpdate(end, ratio, out) {
25223
+ const attribute = this.target.attribute;
25224
+ this.propKeys.forEach(key => {
25225
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
25226
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
25227
+ }
25228
+ }
25229
+ class GrowCenterOut extends ACustomAnimate {
25230
+ constructor(from, to, duration, easing, params) {
25231
+ super(from, to, duration, easing, params);
25232
+ }
25233
+ onBind() {
25234
+ super.onBind();
25235
+ const {
25236
+ from: from,
25237
+ to: to
25238
+ } = growCenterOut(this.target, this.params.options, this.params);
25239
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = null != from ? from : this.target.attribute, this.to = to;
25240
+ }
25241
+ onEnd(cb) {
25242
+ super.onEnd(cb);
25243
+ }
25244
+ onUpdate(end, ratio, out) {
25245
+ const attribute = this.target.attribute;
25246
+ this.propKeys.forEach(key => {
25247
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
25248
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
25249
+ }
25250
+ }
25251
+
25252
+ function growHeightInIndividual(graphic, options, animationParameters) {
25253
+ const attrs = graphic.getFinalAttribute(),
25254
+ y = attrs.y,
25255
+ y1 = attrs.y1,
25256
+ height = attrs.height;
25257
+ if (options && "negative" === options.orient) {
25258
+ const computedY1 = isValid$5(height) ? Math.max(y, y + height) : Math.max(y, y1);
25259
+ return {
25260
+ from: {
25261
+ y: computedY1,
25262
+ y1: isNil$5(y1) ? void 0 : computedY1,
25263
+ height: isNil$5(height) ? void 0 : 0
25264
+ },
25265
+ to: {
25266
+ y: y,
25267
+ y1: y1,
25268
+ height: height
25269
+ }
25270
+ };
25271
+ }
25272
+ const computedY = isValid$5(height) ? Math.min(y, y + height) : Math.min(y, y1);
25273
+ return {
25274
+ from: {
25275
+ y: computedY,
25276
+ y1: isNil$5(y1) ? void 0 : computedY,
25277
+ height: isNil$5(height) ? void 0 : 0
25278
+ },
25279
+ to: {
25280
+ y: y,
25281
+ y1: y1,
25282
+ height: height
25283
+ }
25284
+ };
25285
+ }
25286
+ function growHeightInOverall(graphic, options, animationParameters) {
25287
+ var _a, _b, _c;
25288
+ const attrs = graphic.getFinalAttribute(),
25289
+ y = attrs.y,
25290
+ y1 = attrs.y1,
25291
+ height = attrs.height;
25292
+ let overallValue;
25293
+ return options && "negative" === options.orient ? isNumber$6(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_c = null !== (_a = animationParameters.groupHeight) && void 0 !== _a ? _a : null === (_b = options.layoutRect) || void 0 === _b ? void 0 : _b.height) && void 0 !== _c ? _c : animationParameters.group.getBounds().height(), animationParameters.groupHeight = overallValue) : overallValue = animationParameters.height : overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0, {
25294
+ from: {
25295
+ y: overallValue,
25296
+ y1: isNil$5(y1) ? void 0 : overallValue,
25297
+ height: isNil$5(height) ? void 0 : 0
25298
+ },
25299
+ to: {
25300
+ y: y,
25301
+ y1: y1,
25302
+ height: height
25303
+ }
25304
+ };
25305
+ }
25306
+ const growHeightIn = (graphic, options, animationParameters) => {
25307
+ var _a;
25308
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growHeightInOverall(graphic, options, animationParameters) : growHeightInIndividual(graphic, options);
25309
+ };
25310
+ class GrowHeightIn extends ACustomAnimate {
25311
+ constructor(from, to, duration, easing, params) {
25312
+ super(from, to, duration, easing, params);
25313
+ }
25314
+ onBind() {
25315
+ var _a, _b;
25316
+ super.onBind();
25317
+ const {
25318
+ from: from,
25319
+ to: to
25320
+ } = growHeightIn(this.target, this.params.options, this.params),
25321
+ fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
25322
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
25323
+ const finalAttribute = this.target.getFinalAttribute();
25324
+ finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
25325
+ }
25326
+ onEnd(cb) {
25327
+ super.onEnd(cb);
25328
+ }
25329
+ onUpdate(end, ratio, out) {
25330
+ const attribute = this.target.attribute;
25331
+ this.propKeys.forEach(key => {
25332
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
25333
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
25334
+ }
25335
+ }
25336
+ function growHeightOutIndividual(graphic, options, animationParameters) {
25337
+ const attrs = graphic.getFinalAttribute(),
25338
+ y = attrs.y,
25339
+ y1 = attrs.y1,
25340
+ height = attrs.height;
25341
+ if (options && "negative" === options.orient) {
25342
+ const computedY1 = isValid$5(height) ? Math.max(y, y + height) : Math.max(y, y1);
25343
+ return {
25344
+ to: {
25345
+ y: computedY1,
25346
+ y1: isNil$5(y1) ? void 0 : computedY1,
25347
+ height: isNil$5(height) ? void 0 : 0
25348
+ }
25349
+ };
25350
+ }
25351
+ const computedY = isValid$5(height) ? Math.min(y, y + height) : Math.min(y, y1);
25352
+ return {
25353
+ to: {
25354
+ y: computedY,
25355
+ y1: isNil$5(y1) ? void 0 : computedY,
25356
+ height: isNil$5(height) ? void 0 : 0
25357
+ }
25358
+ };
25359
+ }
25360
+ function growHeightOutOverall(graphic, options, animationParameters) {
25361
+ var _a, _b, _c;
25362
+ const attrs = graphic.getFinalAttribute(),
25363
+ y1 = attrs.y1,
25364
+ height = attrs.height;
25365
+ let overallValue;
25366
+ return options && "negative" === options.orient ? isNumber$6(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_c = null !== (_a = animationParameters.groupHeight) && void 0 !== _a ? _a : null === (_b = options.layoutRect) || void 0 === _b ? void 0 : _b.height) && void 0 !== _c ? _c : animationParameters.group.getBounds().height(), animationParameters.groupHeight = overallValue) : overallValue = animationParameters.height : overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0, {
25367
+ to: {
25368
+ y: overallValue,
25369
+ y1: isNil$5(y1) ? void 0 : overallValue,
25370
+ height: isNil$5(height) ? void 0 : 0
25371
+ }
25372
+ };
25373
+ }
25374
+ class GrowHeightOut extends ACustomAnimate {
25375
+ constructor(from, to, duration, easing, params) {
25376
+ super(from, to, duration, easing, params);
25377
+ }
25378
+ onBind() {
25379
+ super.onBind();
25380
+ const {
25381
+ from: from,
25382
+ to: to
25383
+ } = (graphic = this.target, options = this.params.options, animationParameters = this.params, !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growHeightOutOverall(graphic, options, animationParameters) : growHeightOutIndividual(graphic, options));
25384
+ var graphic, options, animationParameters, _a;
25385
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = null != from ? from : this.target.attribute, this.to = to;
25386
+ }
25387
+ onEnd(cb) {
25388
+ super.onEnd(cb);
25389
+ }
25390
+ onUpdate(end, ratio, out) {
25391
+ const attribute = this.target.attribute;
25392
+ this.propKeys.forEach(key => {
25393
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
25394
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
25395
+ }
25396
+ }
25397
+
25398
+ const getCenterPoints = (graphic, options, animationParameters) => {
25399
+ const points = graphic.getFinalAttribute().points,
25400
+ center = {
25401
+ x: 0,
25402
+ y: 0
25403
+ };
25404
+ return points.forEach(point => {
25405
+ center.x += point.x, center.y += point.y;
25406
+ }), center.x /= points.length, center.y /= points.length, options && options.center && (isValidNumber$3(options.center.x) && (center.x = options.center.x), isValidNumber$3(options.center.y) && (center.y = options.center.y)), "area" === graphic.type && (center.x1 = center.x, center.y1 = center.y), points.map(point => Object.assign({}, point, center));
25407
+ };
25408
+ const growPointsIn = (graphic, options, animationParameters) => {
25409
+ const attrs = graphic.getFinalAttribute();
25410
+ return {
25411
+ from: {
25412
+ points: getCenterPoints(graphic, options)
25413
+ },
25414
+ to: {
25415
+ points: attrs.points
25416
+ }
25417
+ };
25418
+ };
25419
+ class GworPointsBase extends ACustomAnimate {
25420
+ constructor(from, to, duration, easing, params) {
25421
+ super(from, to, duration, easing, params);
25422
+ }
25423
+ onUpdate(end, ratio, out) {
25424
+ var _a, _b;
25425
+ const fromPoints = null === (_a = this.from) || void 0 === _a ? void 0 : _a.points,
25426
+ toPoints = null === (_b = this.to) || void 0 === _b ? void 0 : _b.points;
25427
+ fromPoints && toPoints && (this.target.attribute.points = fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio)), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
25428
+ }
25429
+ }
25430
+ class GrowPointsIn extends GworPointsBase {
25431
+ onBind() {
25432
+ var _a;
25433
+ if (super.onBind(), ["area", "line", "polygon"].includes(this.target.type)) {
25434
+ const {
25435
+ from: from,
25436
+ to: to
25437
+ } = growPointsIn(this.target, this.params.options, this.params);
25438
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
25439
+ const finalAttribute = this.target.getFinalAttribute();
25440
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
25441
+ } else this.valid = !1;
25442
+ }
25443
+ }
25444
+ class GrowPointsOut extends GworPointsBase {
25445
+ onBind() {
25446
+ if (super.onBind(), ["area", "line"].includes(this.target.type)) {
25447
+ const attrs = this.target.getFinalAttribute(),
25448
+ {
25449
+ from: from,
25450
+ to: to
25451
+ } = (graphic = this.target, options = this.params.options, this.params, {
25452
+ from: {
25453
+ points: graphic.getFinalAttribute().points
25454
+ },
25455
+ to: {
25456
+ points: getCenterPoints(graphic, options)
25457
+ }
25458
+ });
25459
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from || attrs, this.to = to;
25460
+ } else this.valid = !1;
25461
+ var graphic, options;
25462
+ }
25463
+ }
25464
+ const changePointsX = (graphic, options, animationParameters) => graphic.getFinalAttribute().points.map(point => {
25465
+ if (options && "negative" === options.orient) {
25466
+ let groupRight = graphic.stage.viewWidth;
25467
+ return graphic.parent.parent.parent && (groupRight = graphic.parent.parent.parent.AABBBounds.width()), Object.assign(Object.assign({}, point), {
25468
+ x: groupRight,
25469
+ y: point.y,
25470
+ x1: groupRight,
25471
+ y1: point.y1,
25472
+ defined: !1 !== point.defined
25473
+ });
25474
+ }
25475
+ return Object.assign(Object.assign({}, point), {
25476
+ x: 0,
25477
+ y: point.y,
25478
+ x1: 0,
25479
+ y1: point.y1,
25480
+ defined: !1 !== point.defined
25481
+ });
25482
+ }),
25483
+ growPointsXIn = (graphic, options, animationParameters) => {
25484
+ const attrs = graphic.getFinalAttribute();
25485
+ return {
25486
+ from: {
25487
+ points: changePointsX(graphic, options)
25488
+ },
25489
+ to: {
25490
+ points: attrs.points
25491
+ }
25492
+ };
25493
+ };
25494
+ class GrowPointsXIn extends GworPointsBase {
25495
+ onBind() {
25496
+ var _a;
25497
+ if (super.onBind(), ["area", "line", "polygon"].includes(this.target.type)) {
25498
+ const {
25499
+ from: from,
25500
+ to: to
25501
+ } = growPointsXIn(this.target, this.params.options, this.params);
25502
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
25503
+ const finalAttribute = this.target.getFinalAttribute();
25504
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
25505
+ } else this.valid = !1;
25506
+ }
25507
+ }
25508
+ class GrowPointsXOut extends GworPointsBase {
25509
+ onBind() {
25510
+ if (super.onBind(), ["area", "line"].includes(this.target.type)) {
25511
+ const attrs = this.target.getFinalAttribute(),
25512
+ {
25513
+ from: from,
25514
+ to: to
25515
+ } = (graphic = this.target, options = this.params.options, this.params, {
25516
+ from: {
25517
+ points: graphic.getFinalAttribute().points
25518
+ },
25519
+ to: {
25520
+ points: changePointsX(graphic, options)
25521
+ }
25522
+ });
25523
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from || attrs, this.to = to;
25524
+ } else this.valid = !1;
25525
+ var graphic, options;
25526
+ }
25527
+ }
25528
+ const changePointsY = (graphic, options, animationParameters) => graphic.getFinalAttribute().points.map(point => {
25529
+ if (options && "negative" === options.orient) {
25530
+ let groupBottom = graphic.stage.viewHeight;
25531
+ return graphic.parent.parent.parent && (groupBottom = graphic.parent.parent.parent.AABBBounds.height()), Object.assign(Object.assign({}, point), {
25532
+ x: point.x,
25533
+ y: groupBottom,
25534
+ x1: point.x1,
25535
+ y1: groupBottom,
25536
+ defined: !1 !== point.defined
25537
+ });
25538
+ }
25539
+ return Object.assign(Object.assign({}, point), {
25540
+ x: point.x,
25541
+ y: 0,
25542
+ x1: point.x1,
25543
+ y1: 0,
25544
+ defined: !1 !== point.defined
25545
+ });
25546
+ }),
25547
+ growPointsYIn = (graphic, options, animationParameters) => {
25548
+ const attrs = graphic.getFinalAttribute();
25549
+ return {
25550
+ from: {
25551
+ points: changePointsY(graphic, options)
25552
+ },
25553
+ to: {
25554
+ points: attrs.points
25555
+ }
25556
+ };
25557
+ };
25558
+ class GrowPointsYIn extends GworPointsBase {
25559
+ onBind() {
25560
+ var _a;
25561
+ if (super.onBind(), ["area", "line", "polygon"].includes(this.target.type)) {
25562
+ const {
25563
+ from: from,
25564
+ to: to
25565
+ } = growPointsYIn(this.target, this.params.options, this.params);
25566
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
25567
+ const finalAttribute = this.target.getFinalAttribute();
25568
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
25569
+ } else this.valid = !1;
25570
+ }
25571
+ }
25572
+ class GrowPointsYOut extends GworPointsBase {
25573
+ onBind() {
25574
+ if (super.onBind(), ["area", "line", "polygon"].includes(this.target.type)) {
25575
+ const {
25576
+ from: from,
25577
+ to: to
25578
+ } = (graphic = this.target, options = this.params.options, this.params, {
25579
+ from: {
25580
+ points: graphic.getFinalAttribute().points
25581
+ },
25582
+ to: {
25583
+ points: changePointsY(graphic, options)
25584
+ }
25585
+ });
25586
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = null != from ? from : this.target.attribute, this.to = to;
25587
+ } else this.valid = !1;
25588
+ var graphic, options;
25589
+ }
25590
+ }
25591
+
25592
+ const growRadiusInIndividual = (graphic, options, animationParameters) => {
25593
+ const attrs = graphic.getFinalAttribute();
25594
+ return options && "inside" === options.orient ? {
25595
+ from: {
25596
+ innerRadius: null == attrs ? void 0 : attrs.outerRadius
25597
+ },
25598
+ to: {
25599
+ innerRadius: null == attrs ? void 0 : attrs.innerRadius
25600
+ }
25601
+ } : {
25602
+ from: {
25603
+ outerRadius: null == attrs ? void 0 : attrs.innerRadius
25604
+ },
25605
+ to: {
25606
+ outerRadius: null == attrs ? void 0 : attrs.outerRadius
25607
+ }
25608
+ };
25609
+ },
25610
+ growRadiusInOverall = (graphic, options, animationParameters) => {
25611
+ const attrs = graphic.getFinalAttribute(),
25612
+ overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0;
25613
+ return {
25614
+ from: {
25615
+ innerRadius: overallValue,
25616
+ outerRadius: overallValue
25617
+ },
25618
+ to: {
25619
+ innerRadius: null == attrs ? void 0 : attrs.innerRadius,
25620
+ outerRadius: null == attrs ? void 0 : attrs.outerRadius
25621
+ }
25622
+ };
25623
+ };
25624
+ const growRadiusIn = (graphic, options, animationParameters) => {
25625
+ var _a;
25626
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growRadiusInOverall(graphic, options) : growRadiusInIndividual(graphic, options);
25627
+ };
25628
+ const growRadiusOutIndividual = (graphic, options, animationParameters) => {
25629
+ const attrs = graphic.getFinalAttribute();
25630
+ return options && "inside" === options.orient ? {
25631
+ from: {
25632
+ innerRadius: null == attrs ? void 0 : attrs.innerRadius
25633
+ },
25634
+ to: {
25635
+ innerRadius: null == attrs ? void 0 : attrs.outerRadius
25636
+ }
25637
+ } : {
25638
+ from: {
25639
+ outerRadius: null == attrs ? void 0 : attrs.outerRadius
25640
+ },
25641
+ to: {
25642
+ outerRadius: null == attrs ? void 0 : attrs.innerRadius
25643
+ }
25644
+ };
25645
+ },
25646
+ growRadiusOutOverall = (graphic, options, animationParameters) => {
25647
+ const attrs = graphic.getFinalAttribute(),
25648
+ overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0;
25649
+ return {
25650
+ from: {
25651
+ innerRadius: null == attrs ? void 0 : attrs.innerRadius,
25652
+ outerRadius: null == attrs ? void 0 : attrs.outerRadius
25653
+ },
25654
+ to: {
25655
+ innerRadius: overallValue,
25656
+ outerRadius: overallValue
25657
+ }
25658
+ };
25659
+ };
25660
+ class GrowPointsBase extends ACustomAnimate {
25661
+ constructor(from, to, duration, easing, params) {
25662
+ super(from, to, duration, easing, params);
25663
+ }
25664
+ onUpdate(end, ratio, out) {
25665
+ const attribute = this.target.attribute;
25666
+ this.propKeys.forEach(key => {
25667
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
25668
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
25669
+ }
25670
+ }
25671
+ class GrowRadiusIn extends GrowPointsBase {
25672
+ onBind() {
25673
+ var _a, _b;
25674
+ super.onBind();
25675
+ const {
25676
+ from: from,
25677
+ to: to
25678
+ } = growRadiusIn(this.target, this.params.options, this.params),
25679
+ fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
25680
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
25681
+ const finalAttribute = this.target.getFinalAttribute();
25682
+ finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
25683
+ }
25684
+ }
25685
+ class GrowRadiusOut extends GrowPointsBase {
25686
+ onBind() {
25687
+ super.onBind();
25688
+ const {
25689
+ to: to
25690
+ } = (graphic = this.target, options = this.params.options, this.params, !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growRadiusOutOverall(graphic, options) : growRadiusOutIndividual(graphic, options));
25691
+ var graphic, options, _a;
25692
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = this.target.attribute, this.to = to;
25693
+ }
25694
+ }
25695
+
25696
+ function growWidthInIndividual(graphic, options, animationParameters) {
25697
+ const attrs = graphic.getFinalAttribute(),
25698
+ x = attrs.x,
25699
+ x1 = attrs.x1,
25700
+ width = attrs.width;
25701
+ if (options && "negative" === options.orient) {
25702
+ const computedX1 = isValid$5(width) ? Math.max(x, x + width) : Math.max(x, x1);
25703
+ return {
25704
+ from: {
25705
+ x: computedX1,
25706
+ x1: isNil$5(x1) ? void 0 : computedX1,
25707
+ width: isNil$5(width) ? void 0 : 0
25708
+ },
25709
+ to: {
25710
+ x: x,
25711
+ x1: x1,
25712
+ width: width
25713
+ }
25714
+ };
25715
+ }
25716
+ const computedX = isValid$5(width) ? Math.min(x, x + width) : Math.min(x, x1);
25717
+ return {
25718
+ from: {
25719
+ x: computedX,
25720
+ x1: isNil$5(x1) ? void 0 : computedX,
25721
+ width: isNil$5(width) ? void 0 : 0
25722
+ },
25723
+ to: {
25724
+ x: x,
25725
+ x1: x1,
25726
+ width: width
25727
+ }
25728
+ };
25729
+ }
25730
+ function growWidthInOverall(graphic, options, animationParameters) {
25731
+ var _a;
25732
+ const attrs = graphic.getFinalAttribute(),
25733
+ x = attrs.x,
25734
+ x1 = attrs.x1,
25735
+ width = attrs.width;
25736
+ let overallValue;
25737
+ return options && "negative" === options.orient ? isNumber$6(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(), animationParameters.groupWidth = overallValue) : overallValue = animationParameters.width : overallValue = isNumber$6(null == options ? void 0 : options.overall) ? null == options ? void 0 : options.overall : 0, {
25738
+ from: {
25739
+ x: overallValue,
25740
+ x1: isNil$5(x1) ? void 0 : overallValue,
25741
+ width: isNil$5(width) ? void 0 : 0
25742
+ },
25743
+ to: {
25744
+ x: x,
25745
+ x1: x1,
25746
+ width: width
25747
+ }
25748
+ };
25749
+ }
25750
+ const growWidthIn = (graphic, options, animationParameters) => {
25751
+ var _a;
25752
+ return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growWidthInOverall(graphic, options, animationParameters) : growWidthInIndividual(graphic, options);
25753
+ };
25754
+ function growWidthOutIndividual(graphic, options, animationParameters) {
25755
+ const attrs = graphic.getFinalAttribute(),
25756
+ x = attrs.x,
25757
+ x1 = attrs.x1,
25758
+ width = attrs.width;
25759
+ if (options && "negative" === options.orient) {
25760
+ const computedX1 = isValid$5(width) ? Math.max(x, x + width) : Math.max(x, x1);
25761
+ return {
25762
+ to: {
25763
+ x: computedX1,
25764
+ x1: isNil$5(x1) ? void 0 : computedX1,
25765
+ width: isNil$5(width) ? void 0 : 0
25766
+ }
25767
+ };
25768
+ }
25769
+ const computedX = isValid$5(width) ? Math.min(x, x + width) : Math.min(x, x1);
25770
+ return {
25771
+ to: {
25772
+ x: computedX,
25773
+ x1: isNil$5(x1) ? void 0 : computedX,
25774
+ width: isNil$5(width) ? void 0 : 0
25775
+ }
25776
+ };
25777
+ }
25778
+ function growWidthOutOverall(graphic, options, animationParameters) {
25779
+ var _a;
25780
+ const attrs = graphic.getFinalAttribute(),
25781
+ x1 = attrs.x1,
25782
+ width = attrs.width;
25783
+ let overallValue;
25784
+ return options && "negative" === options.orient ? isNumber$6(options.overall) ? overallValue = options.overall : animationParameters.group ? (overallValue = null !== (_a = animationParameters.groupWidth) && void 0 !== _a ? _a : animationParameters.group.getBounds().width(), animationParameters.groupWidth = overallValue) : overallValue = animationParameters.width : overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0, {
25785
+ to: {
25786
+ x: overallValue,
25787
+ x1: isNil$5(x1) ? void 0 : overallValue,
25788
+ width: isNil$5(width) ? void 0 : 0
25789
+ }
25790
+ };
25791
+ }
25792
+ class GrowWidthIn extends ACustomAnimate {
25793
+ constructor(from, to, duration, easing, params) {
25794
+ super(from, to, duration, easing, params);
25795
+ }
25796
+ onBind() {
25797
+ var _a, _b;
25798
+ super.onBind();
25799
+ const {
25800
+ from: from,
25801
+ to: to
25802
+ } = growWidthIn(this.target, this.params.options, this.params),
25803
+ fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
25804
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
25805
+ const finalAttribute = this.target.getFinalAttribute();
25806
+ finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
25807
+ }
25808
+ onEnd(cb) {
25809
+ super.onEnd(cb);
25810
+ }
25811
+ onUpdate(end, ratio, out) {
25812
+ const attribute = this.target.attribute;
25813
+ this.propKeys.forEach(key => {
25814
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
25815
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
25816
+ }
25817
+ }
25818
+ class GrowWidthOut extends ACustomAnimate {
25819
+ constructor(from, to, duration, easing, params) {
25820
+ super(from, to, duration, easing, params);
25821
+ }
25822
+ onBind() {
25823
+ super.onBind();
25824
+ const {
25825
+ from: from,
25826
+ to: to
25827
+ } = (graphic = this.target, options = this.params.options, animationParameters = this.params, !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growWidthOutOverall(graphic, options, animationParameters) : growWidthOutIndividual(graphic, options));
25828
+ var graphic, options, animationParameters, _a;
25829
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = null != from ? from : this.target.attribute, this.to = to;
25830
+ }
25831
+ onEnd(cb) {
25832
+ super.onEnd(cb);
25833
+ }
25834
+ onUpdate(end, ratio, out) {
25835
+ const attribute = this.target.attribute;
25836
+ this.propKeys.forEach(key => {
25837
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
25838
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
25839
+ }
25840
+ }
25841
+
25842
+ class LabelItemAppear extends AComponentAnimate {
25843
+ onBind() {
25844
+ super.onBind();
25845
+ const animator = createComponentAnimator(this.target);
25846
+ this._animator = animator;
25847
+ const duration = this.duration,
25848
+ easing = this.easing,
25849
+ target = this.target,
25850
+ {
25851
+ symbolStartOuterType = "scale",
25852
+ titleType = "typewriter",
25853
+ titlePanelType = "scale"
25854
+ } = this.params,
25855
+ symbolTime = duration / 10;
25856
+ let symbolStartOuterFrom, symbolStartOuterTo;
25857
+ if (target._symbolStart.setAttributes({
25858
+ scaleX: 0,
25859
+ scaleY: 0
25860
+ }), animator.animate(target._symbolStart, {
25861
+ type: "to",
25862
+ to: {
25863
+ scaleX: 1,
25864
+ scaleY: 1
25865
+ },
25866
+ duration: 5 * symbolTime,
25867
+ easing: easing
25868
+ }), "scale" === symbolStartOuterType ? (symbolStartOuterFrom = {
25869
+ scaleX: 0,
25870
+ scaleY: 0
25871
+ }, symbolStartOuterTo = {
25872
+ scaleX: 1,
25873
+ scaleY: 1
25874
+ }) : (symbolStartOuterFrom = {
25875
+ clipRange: 0
25876
+ }, symbolStartOuterTo = {
25877
+ clipRange: 1
25878
+ }), target._symbolStartOuter.setAttributes(symbolStartOuterFrom), animator.animate(target._symbolStartOuter, {
25879
+ type: "to",
25880
+ to: symbolStartOuterTo,
25881
+ duration: 5 * symbolTime,
25882
+ easing: easing
25883
+ }), target._symbolEnd.setAttributes({
25884
+ scaleX: 0,
25885
+ scaleY: 0
25886
+ }), animator.animate(target._symbolEnd, {
25887
+ type: "to",
25888
+ to: {
25889
+ scaleX: 1,
25890
+ scaleY: 1
25891
+ },
25892
+ duration: 2 * symbolTime,
25893
+ delay: 8 * symbolTime,
25894
+ easing: easing
25895
+ }), target._line.setAttributes({
25896
+ clipRange: 0
25897
+ }), animator.animate(target._line, {
25898
+ type: "to",
25899
+ to: {
25900
+ clipRange: 1
25901
+ },
25902
+ duration: 9 * symbolTime,
25903
+ easing: easing
25904
+ }), "typewriter" === titleType) {
25905
+ const titleTopText = target._titleTop.attribute.text;
25906
+ target._titleTop.setAttributes({
25907
+ text: ""
25908
+ }), animator.animate(target._titleTop, {
25909
+ type: "custom",
25910
+ delay: 5 * symbolTime,
25911
+ duration: 4 * symbolTime,
25912
+ easing: "linear",
25913
+ to: {
25914
+ text: titleTopText
25915
+ },
25916
+ custom: InputText
25917
+ });
25918
+ const titleBottomText = target._titleBottom.attribute.text;
25919
+ target._titleBottom.setAttributes({
25920
+ text: ""
25921
+ }), animator.animate(target._titleBottom, {
25922
+ type: "custom",
25923
+ delay: 5 * symbolTime,
25924
+ duration: 4 * symbolTime,
25925
+ easing: "linear",
25926
+ to: {
25927
+ text: titleBottomText
25928
+ },
25929
+ custom: InputText
25930
+ });
25931
+ } else target._titleTop.setAttributes({
25932
+ dy: target._titleTop.AABBBounds.height() + 10
25933
+ }), animator.animate(target._titleTop, {
25934
+ type: "to",
25935
+ to: {
25936
+ dy: 0
25937
+ },
25938
+ delay: 5 * symbolTime,
25939
+ duration: 4 * symbolTime,
25940
+ easing: "linear"
25941
+ }), target._titleBottom.setAttributes({
25942
+ dy: -(10 + target._titleBottom.AABBBounds.height())
25943
+ }), animator.animate(target._titleBottom, {
25944
+ type: "to",
25945
+ to: {
25946
+ dy: 0
25947
+ },
25948
+ delay: 5 * symbolTime,
25949
+ duration: 4 * symbolTime,
25950
+ easing: "linear"
25951
+ });
25952
+ "scale" === titlePanelType ? [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {
25953
+ var _a;
25954
+ const scaleX = null !== (_a = panel.attribute.scaleX) && void 0 !== _a ? _a : 1;
25955
+ panel.setAttributes({
25956
+ scaleX: 0
25957
+ }), animator.animate(panel, {
25958
+ type: "to",
25959
+ to: {
25960
+ scaleX: scaleX
25961
+ },
25962
+ duration: duration,
25963
+ easing: easing
25964
+ });
25965
+ }) : "stroke" === titlePanelType && [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {
25966
+ const b = panel.AABBBounds,
25967
+ totalLen = 2 * (b.width() + b.height());
25968
+ panel.setAttributes({
25969
+ lineDash: [0, 10 * totalLen]
25970
+ }), animator.animate(panel, {
25971
+ type: "to",
25972
+ to: {
25973
+ lineDash: [totalLen, 10 * totalLen]
25974
+ },
25975
+ duration: duration,
25976
+ easing: easing
25977
+ });
25978
+ }), this.completeBind(animator);
25979
+ }
25980
+ }
25981
+ class LabelItemDisappear extends AComponentAnimate {
25982
+ onBind() {
25983
+ super.onBind();
25984
+ const animator = createComponentAnimator(this.target);
25985
+ this._animator = animator;
25986
+ const duration = this.duration,
25987
+ easing = this.easing,
25988
+ target = this.target,
25989
+ {
25990
+ mode: mode
25991
+ } = this.params;
25992
+ "scale" === mode ? animator.animate(target._symbolStart, {
25993
+ type: "to",
25994
+ to: {
25995
+ scaleX: 0,
25996
+ scaleY: 0
25997
+ },
25998
+ duration: duration,
25999
+ easing: easing
26000
+ }) : (animator.animate(target._line, {
26001
+ type: "to",
26002
+ to: {
26003
+ clipRange: 0
26004
+ },
26005
+ duration: duration,
26006
+ easing: easing
26007
+ }), animator.animate(target._symbolStart, {
26008
+ type: "to",
26009
+ to: {
26010
+ scaleX: 0,
26011
+ scaleY: 0
26012
+ },
26013
+ duration: duration / 2,
26014
+ delay: duration / 2,
26015
+ easing: easing
26016
+ }), animator.animate(target._symbolEnd, {
26017
+ type: "to",
26018
+ to: {
26019
+ scaleX: 0,
26020
+ scaleY: 0
26021
+ },
26022
+ duration: duration,
26023
+ easing: easing
26024
+ }), animator.animate(target._titleTop, {
26025
+ type: "to",
26026
+ to: {
26027
+ dy: target._titleTop.AABBBounds.height() + 10
26028
+ },
26029
+ duration: duration / 2,
26030
+ easing: easing
26031
+ }), animator.animate(target._titleBottom, {
26032
+ type: "to",
26033
+ to: {
26034
+ dy: -(10 + target._titleBottom.AABBBounds.height())
26035
+ },
26036
+ duration: duration / 2,
26037
+ easing: easing
26038
+ }), animator.animate(target._symbolStartOuter, {
26039
+ type: "to",
26040
+ to: {
26041
+ clipRange: 0
26042
+ },
26043
+ duration: duration / 2,
26044
+ delay: duration / 2,
26045
+ easing: easing
26046
+ }), animator.animate(target._titleTopPanel, {
26047
+ type: "to",
26048
+ to: {
26049
+ scaleX: 0
26050
+ },
26051
+ duration: duration,
26052
+ easing: easing
26053
+ }), animator.animate(target._titleBottomPanel, {
26054
+ type: "to",
26055
+ to: {
26056
+ scaleX: 0
26057
+ },
26058
+ duration: duration,
26059
+ easing: easing
26060
+ })), this.completeBind(animator);
26061
+ }
26062
+ }
26063
+
26064
+ class PoptipAppear extends AComponentAnimate {
26065
+ onBind() {
26066
+ super.onBind();
26067
+ const animator = createComponentAnimator(this.target);
26068
+ this._animator = animator;
26069
+ const duration = this.duration,
26070
+ easing = this.easing,
26071
+ target = this.target,
26072
+ {
26073
+ wave: wave
26074
+ } = this.params;
26075
+ if (target.setAttributes({
26076
+ scaleX: 0,
26077
+ scaleY: 0
26078
+ }), animator.animate(target, {
26079
+ type: "to",
26080
+ to: {
26081
+ scaleX: 1,
26082
+ scaleY: 1
26083
+ },
26084
+ duration: duration / 3 * 2,
26085
+ easing: easing
26086
+ }), target.titleShape && animator.animate(target.titleShape, {
26087
+ type: "custom",
26088
+ to: {
26089
+ text: target.titleShape.attribute.text
26090
+ },
26091
+ duration: duration,
26092
+ easing: easing,
26093
+ custom: InputText
26094
+ }), target.contentShape && animator.animate(target.contentShape, {
26095
+ type: "custom",
26096
+ to: {
26097
+ text: target.contentShape.attribute.text
26098
+ },
26099
+ duration: duration,
26100
+ easing: easing,
26101
+ custom: InputText
26102
+ }), wave) {
26103
+ const dur = duration / 6;
26104
+ animator.animate(target.group, {
26105
+ timeSlices: [{
26106
+ duration: dur,
26107
+ effects: {
26108
+ type: "to",
26109
+ to: {
26110
+ angle: wave
26111
+ },
26112
+ easing: easing
26113
+ }
26114
+ }, {
26115
+ duration: 2 * dur,
26116
+ effects: {
26117
+ type: "to",
26118
+ to: {
26119
+ angle: -wave
26120
+ },
26121
+ easing: easing
26122
+ }
26123
+ }, {
26124
+ duration: 2 * dur,
26125
+ effects: {
26126
+ type: "to",
26127
+ to: {
26128
+ angle: wave
26129
+ },
26130
+ easing: easing
26131
+ }
26132
+ }, {
26133
+ duration: dur,
26134
+ effects: {
26135
+ type: "to",
26136
+ to: {
26137
+ angle: 0
26138
+ },
26139
+ easing: easing
26140
+ }
26141
+ }]
26142
+ });
26143
+ }
26144
+ this.completeBind(animator);
26145
+ }
26146
+ }
26147
+ class PoptipDisappear extends AComponentAnimate {
26148
+ onBind() {
26149
+ super.onBind();
26150
+ const animator = createComponentAnimator(this.target);
26151
+ this._animator = animator;
26152
+ const duration = this.duration,
26153
+ easing = this.easing,
26154
+ target = this.target;
26155
+ animator.animate(target, {
26156
+ type: "to",
26157
+ to: {
26158
+ scaleX: 0,
26159
+ scaleY: 0
26160
+ },
26161
+ duration: duration,
26162
+ easing: easing
26163
+ }), this.completeBind(animator);
26164
+ }
26165
+ }
26166
+
26167
+ class InputRichText extends ACustomAnimate {
26168
+ constructor(from, to, duration, easing, params) {
26169
+ super(from, to, duration, easing, params), this.fromTextConfig = [], this.toTextConfig = [], this.originalTextConfig = [], this.showCursor = !1, this.cursorChar = "|", this.blinkCursor = !0, this.fadeInChars = !1, this.fadeInDuration = .3, this.strokeFirst = !1, this.strokeToFillRatio = .3, void 0 !== (null == params ? void 0 : params.showCursor) && (this.showCursor = params.showCursor), void 0 !== (null == params ? void 0 : params.cursorChar) && (this.cursorChar = params.cursorChar), void 0 !== (null == params ? void 0 : params.blinkCursor) && (this.blinkCursor = params.blinkCursor), void 0 !== (null == params ? void 0 : params.fadeInChars) && (this.fadeInChars = params.fadeInChars), void 0 !== (null == params ? void 0 : params.fadeInDuration) && (this.fadeInDuration = params.fadeInDuration), void 0 !== (null == params ? void 0 : params.strokeFirst) && (this.strokeFirst = params.strokeFirst), void 0 !== (null == params ? void 0 : params.strokeToFillRatio) && (this.strokeToFillRatio = params.strokeToFillRatio);
26170
+ }
26171
+ onFirstRun() {
26172
+ const fromProps = this.getLastProps(),
26173
+ toProps = this.getEndProps();
26174
+ this.originalTextConfig = toProps.textConfig ? [...toProps.textConfig] : [], this.valid = !0, this.originalTextConfig && 0 !== this.originalTextConfig.length ? (this.fromTextConfig = fromProps.textConfig && fromProps.textConfig.length > 0 ? RichText.TransformTextConfig2SingleCharacter(fromProps.textConfig) : [], this.toTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig)) : this.valid = !1;
26175
+ }
26176
+ onEnd(cb) {
26177
+ super.onEnd(cb), cb || this.target.setAttribute("textConfig", this.originalTextConfig);
26178
+ }
26179
+ onUpdate(end, ratio, out) {
26180
+ if (!this.valid) return;
26181
+ const totalItems = this.toTextConfig.length,
26182
+ fromItems = this.fromTextConfig.length,
26183
+ maxTextShowRatio = this.fadeInChars ? 1 - this.fadeInDuration : 1;
26184
+ let currentLength, currentTextConfig;
26185
+ if (fromItems > totalItems) currentLength = Math.round(fromItems - (fromItems - totalItems) * ratio);else if (this.fadeInChars) {
26186
+ const adjustedRatio = Math.min(1, ratio / maxTextShowRatio);
26187
+ currentLength = Math.round(fromItems + (totalItems - fromItems) * adjustedRatio);
26188
+ } else currentLength = Math.round(fromItems + (totalItems - fromItems) * ratio);
26189
+ if (currentTextConfig = fromItems > totalItems ? this.fromTextConfig.slice(0, currentLength) : this.toTextConfig.slice(0, currentLength).map((item, index) => {
26190
+ if ("text" in item) {
26191
+ const newItem = Object.assign({}, item);
26192
+ if (this.strokeFirst) {
26193
+ const appearTime = index / totalItems * maxTextShowRatio,
26194
+ itemLifetime = Math.max(0, ratio - appearTime),
26195
+ maxLifetime = 1 - appearTime,
26196
+ fillProgress = Math.min(1, itemLifetime / (this.strokeToFillRatio * maxLifetime));
26197
+ if ("fill" in newItem && newItem.fill && (newItem.stroke = newItem.fill, fillProgress < 1 && (newItem.fillOpacity = fillProgress)), this.fadeInChars) {
26198
+ const fadeProgress = Math.min(1, itemLifetime / (this.fadeInDuration * maxLifetime));
26199
+ newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
26200
+ }
26201
+ } else if (this.fadeInChars) {
26202
+ const fadeProgress = (ratio - index / totalItems * maxTextShowRatio) / this.fadeInDuration;
26203
+ newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
26204
+ }
26205
+ return newItem;
26206
+ }
26207
+ return item;
26208
+ }), this.showCursor && currentLength < totalItems) {
26209
+ let shouldShowCursor = !0;
26210
+ if (this.blinkCursor) {
26211
+ const blinkRate = .1;
26212
+ shouldShowCursor = Math.floor(ratio / blinkRate) % 2 == 0;
26213
+ }
26214
+ if (shouldShowCursor && currentTextConfig.length > 0) {
26215
+ const lastIndex = currentTextConfig.length - 1,
26216
+ lastItem = currentTextConfig[lastIndex];
26217
+ if ("text" in lastItem) currentTextConfig[lastIndex] = Object.assign(Object.assign({}, lastItem), {
26218
+ text: String(lastItem.text) + this.cursorChar
26219
+ });else {
26220
+ const cursorItem = {
26221
+ text: this.cursorChar,
26222
+ fontSize: 16
26223
+ };
26224
+ currentTextConfig.push(cursorItem);
26225
+ }
26226
+ }
26227
+ }
26228
+ this.target.setAttribute("textConfig", currentTextConfig);
26229
+ }
26230
+ }
26231
+
26232
+ class OutputRichText extends ACustomAnimate {
26233
+ constructor(from, to, duration, easing, params) {
26234
+ super(from, to, duration, easing, params), this.fromTextConfig = [], this.toTextConfig = [], this.originalTextConfig = [], this.showCursor = !1, this.cursorChar = "|", this.blinkCursor = !0, this.beforeText = "", this.afterText = "", this.fadeOutChars = !1, this.fadeOutDuration = .3, this.direction = "backward", void 0 !== (null == params ? void 0 : params.showCursor) && (this.showCursor = params.showCursor), void 0 !== (null == params ? void 0 : params.cursorChar) && (this.cursorChar = params.cursorChar), void 0 !== (null == params ? void 0 : params.blinkCursor) && (this.blinkCursor = params.blinkCursor), void 0 !== (null == params ? void 0 : params.beforeText) && (this.beforeText = params.beforeText), void 0 !== (null == params ? void 0 : params.afterText) && (this.afterText = params.afterText), void 0 !== (null == params ? void 0 : params.fadeOutChars) && (this.fadeOutChars = params.fadeOutChars), void 0 !== (null == params ? void 0 : params.fadeOutDuration) && (this.fadeOutDuration = params.fadeOutDuration), void 0 !== (null == params ? void 0 : params.direction) && (this.direction = params.direction), this.propKeys = ["textConfig"];
26235
+ }
26236
+ onFirstRun() {
26237
+ const fromProps = this.getLastProps(),
26238
+ toProps = this.getEndProps();
26239
+ this.originalTextConfig = fromProps.textConfig ? [...fromProps.textConfig] : [], this.valid = !0, this.originalTextConfig && 0 !== this.originalTextConfig.length ? (this.fromTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig), this.toTextConfig = toProps.textConfig && toProps.textConfig.length > 0 ? RichText.TransformTextConfig2SingleCharacter(toProps.textConfig) : []) : this.valid = !1;
26240
+ }
26241
+ onEnd(cb) {
26242
+ super.onEnd(cb), cb || (this.toTextConfig.length > 0 ? this.target.setAttribute("textConfig", this.toTextConfig) : this.target.setAttribute("textConfig", []));
26243
+ }
26244
+ onUpdate(end, ratio, out) {
26245
+ if (!this.valid) return;
26246
+ const fromItems = this.fromTextConfig.length,
26247
+ maxTextHideRatio = this.fadeOutChars ? 1 - this.fadeOutDuration : 1;
26248
+ let displayedLength;
26249
+ if ("forward" === this.direction) {
26250
+ if (this.fadeOutChars) {
26251
+ const adjustedRatio = Math.min(1, ratio / maxTextHideRatio);
26252
+ displayedLength = Math.round(fromItems * (1 - adjustedRatio));
26253
+ } else displayedLength = Math.round(fromItems * (1 - ratio));
26254
+ let currentTextConfig = "forward" === this.direction ? this.fromTextConfig.slice(fromItems - displayedLength) : this.fromTextConfig.slice(0, displayedLength);
26255
+ this.fadeOutChars && (currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength)), this.showCursor && displayedLength > 0 && (currentTextConfig = this.addCursor(currentTextConfig, ratio)), this.target.setAttribute("textConfig", currentTextConfig);
26256
+ } else {
26257
+ if (this.fadeOutChars) {
26258
+ const adjustedRatio = Math.min(1, ratio / maxTextHideRatio);
26259
+ displayedLength = Math.round(fromItems * (1 - adjustedRatio));
26260
+ } else displayedLength = Math.round(fromItems * (1 - ratio));
26261
+ let currentTextConfig = this.fromTextConfig.slice(0, displayedLength);
26262
+ this.fadeOutChars && (currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength)), this.showCursor && displayedLength > 0 && (currentTextConfig = this.addCursor(currentTextConfig, ratio)), this.target.setAttribute("textConfig", currentTextConfig);
26263
+ }
26264
+ }
26265
+ applyFadeEffect(textConfig, ratio, totalItems, displayedLength) {
26266
+ "forward" === this.direction ? totalItems - displayedLength : displayedLength;
26267
+ const fadeProgress = (ratio - (1 - this.fadeOutDuration)) / this.fadeOutDuration,
26268
+ fadeOpacity = Math.max(0, 1 - Math.min(1, fadeProgress));
26269
+ return textConfig.map((item, index) => {
26270
+ if ("forward" === this.direction) {
26271
+ if (0 === index && "text" in item) return Object.assign(Object.assign({}, item), {
26272
+ opacity: fadeOpacity
26273
+ });
26274
+ } else if (index === textConfig.length - 1 && "text" in item) return Object.assign(Object.assign({}, item), {
26275
+ opacity: fadeOpacity
26276
+ });
26277
+ return item;
26278
+ });
26279
+ }
26280
+ addCursor(textConfig, ratio) {
26281
+ let shouldShowCursor = !0;
26282
+ if (this.blinkCursor) {
26283
+ const blinkRate = .1;
26284
+ shouldShowCursor = Math.floor(ratio / blinkRate) % 2 == 0;
26285
+ }
26286
+ if (shouldShowCursor && textConfig.length > 0) {
26287
+ const cursorIndex = "forward" === this.direction ? 0 : textConfig.length - 1,
26288
+ cursorItem = textConfig[cursorIndex];
26289
+ if ("text" in cursorItem) {
26290
+ const result = [...textConfig];
26291
+ return "forward" === this.direction ? result[cursorIndex] = Object.assign(Object.assign({}, cursorItem), {
26292
+ text: this.cursorChar + String(cursorItem.text)
26293
+ }) : result[cursorIndex] = Object.assign(Object.assign({}, cursorItem), {
26294
+ text: String(cursorItem.text) + this.cursorChar
26295
+ }), result;
26296
+ }
26297
+ }
26298
+ return textConfig;
26299
+ }
26300
+ }
26301
+
26302
+ class SlideRichText extends ACustomAnimate {
26303
+ constructor(from, to, duration, easing, params) {
26304
+ super(from, to, duration, easing, params), this.fromTextConfig = [], this.toTextConfig = [], this.originalTextConfig = [], this.singleCharConfig = [], this.fadeInDuration = .3, this.slideDirection = "right", this.slideDistance = 30, this.wordByWord = !1, this.wordRegex = /[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g, this.wordGroups = [], void 0 !== (null == params ? void 0 : params.fadeInDuration) && (this.fadeInDuration = params.fadeInDuration), void 0 !== (null == params ? void 0 : params.slideDirection) && (this.slideDirection = params.slideDirection), void 0 !== (null == params ? void 0 : params.slideDistance) && (this.slideDistance = params.slideDistance), void 0 !== (null == params ? void 0 : params.wordByWord) && (this.wordByWord = params.wordByWord), void 0 !== (null == params ? void 0 : params.wordRegex) && (this.wordRegex = params.wordRegex);
26305
+ }
26306
+ onFirstRun() {
26307
+ const fromProps = this.getLastProps(),
26308
+ toProps = this.getEndProps();
26309
+ this.originalTextConfig = toProps.textConfig ? [...toProps.textConfig] : [], this.valid = !0, this.originalTextConfig && 0 !== this.originalTextConfig.length ? (this.fromTextConfig = fromProps.textConfig && fromProps.textConfig.length > 0 ? RichText.TransformTextConfig2SingleCharacter(fromProps.textConfig) : [], this.toTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig), this.singleCharConfig = this.toTextConfig.map(item => "text" in item ? Object.assign(Object.assign({}, item), {
26310
+ opacity: 0,
26311
+ dx: this.getInitialDx(),
26312
+ dy: this.getInitialDy()
26313
+ }) : Object.assign(Object.assign({}, item), {
26314
+ opacity: 0
26315
+ })), this.wordByWord && this.calculateWordGroups()) : this.valid = !1;
26316
+ }
26317
+ calculateWordGroups() {
26318
+ this.wordGroups = [];
26319
+ let fullText = "";
26320
+ const charMap = {};
26321
+ let match,
26322
+ fullTextIndex = 0;
26323
+ for (this.toTextConfig.forEach((item, configIndex) => {
26324
+ if (("text" in item)) {
26325
+ const text = String(item.text);
26326
+ fullText += text, charMap[fullTextIndex] = configIndex, fullTextIndex++;
26327
+ }
26328
+ }), this.wordRegex.lastIndex = 0; null !== (match = this.wordRegex.exec(fullText));) {
26329
+ const wordStart = match.index,
26330
+ wordEnd = match.index + match[0].length,
26331
+ wordIndices = [];
26332
+ for (let i = wordStart; i < wordEnd; i++) void 0 !== charMap[i] && wordIndices.push(charMap[i]);
26333
+ wordIndices.length > 0 && this.wordGroups.push(wordIndices);
26334
+ }
26335
+ const allocatedIndices = new Set();
26336
+ this.wordGroups.forEach(group => {
26337
+ group.forEach(index => allocatedIndices.add(index));
26338
+ });
26339
+ for (let i = 0; i < this.toTextConfig.length; i++) "text" in this.toTextConfig[i] && !allocatedIndices.has(i) && this.wordGroups.push([i]);
26340
+ }
26341
+ getInitialDx() {
26342
+ switch (this.slideDirection) {
26343
+ case "left":
26344
+ return -this.slideDistance;
26345
+ case "right":
26346
+ return this.slideDistance;
26347
+ default:
26348
+ return 0;
26349
+ }
26350
+ }
26351
+ getInitialDy() {
26352
+ switch (this.slideDirection) {
26353
+ case "up":
26354
+ return -this.slideDistance;
26355
+ case "down":
26356
+ return this.slideDistance;
26357
+ default:
26358
+ return 0;
26359
+ }
26360
+ }
26361
+ onEnd(cb) {
26362
+ super.onEnd(cb), cb || this.target.setAttribute("textConfig", this.originalTextConfig);
26363
+ }
26364
+ onUpdate(end, ratio, out) {
26365
+ if (!this.valid) return;
26366
+ const maxTextShowRatio = 1 - this.fadeInDuration;
26367
+ let updatedTextConfig;
26368
+ updatedTextConfig = this.wordByWord && this.wordGroups.length > 0 ? this.updateByWord(ratio, maxTextShowRatio) : this.updateByCharacter(ratio, maxTextShowRatio), this.target.setAttribute("textConfig", updatedTextConfig);
26369
+ }
26370
+ updateByWord(ratio, maxTextShowRatio) {
26371
+ const totalGroups = this.wordGroups.length,
26372
+ updatedTextConfig = [...this.singleCharConfig];
26373
+ for (let groupIndex = 0; groupIndex < this.wordGroups.length; groupIndex++) {
26374
+ let appearTime;
26375
+ if (appearTime = "left" === this.slideDirection ? (totalGroups - 1 - groupIndex) / totalGroups * maxTextShowRatio : groupIndex / totalGroups * maxTextShowRatio, ratio < appearTime) {
26376
+ for (const charIndex of this.wordGroups[groupIndex]) {
26377
+ const item = updatedTextConfig[charIndex];
26378
+ "text" in item && (updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), {
26379
+ opacity: 0,
26380
+ dx: this.getInitialDx(),
26381
+ dy: this.getInitialDy()
26382
+ }));
26383
+ }
26384
+ continue;
26385
+ }
26386
+ const animProgress = (ratio - appearTime) / this.fadeInDuration,
26387
+ progress = Math.max(0, Math.min(1, animProgress)),
26388
+ dx = this.getInitialDx() * (1 - progress),
26389
+ dy = this.getInitialDy() * (1 - progress);
26390
+ for (const charIndex of this.wordGroups[groupIndex]) {
26391
+ const item = updatedTextConfig[charIndex];
26392
+ "text" in item && (updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), {
26393
+ opacity: progress,
26394
+ dx: dx,
26395
+ dy: dy
26396
+ }));
26397
+ }
26398
+ }
26399
+ return updatedTextConfig;
26400
+ }
26401
+ updateByCharacter(ratio, maxTextShowRatio) {
26402
+ const totalItems = this.toTextConfig.length,
26403
+ updatedTextConfig = [...this.singleCharConfig];
26404
+ for (let index = 0; index < updatedTextConfig.length; index++) {
26405
+ const item = updatedTextConfig[index];
26406
+ if ("text" in item) {
26407
+ let appearTime;
26408
+ if (appearTime = "left" === this.slideDirection ? (totalItems - 1 - index) / totalItems * maxTextShowRatio : index / totalItems * maxTextShowRatio, ratio < appearTime) {
26409
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), {
26410
+ opacity: 0,
26411
+ dx: this.getInitialDx(),
26412
+ dy: this.getInitialDy()
26413
+ });
26414
+ continue;
26415
+ }
26416
+ const animProgress = (ratio - appearTime) / this.fadeInDuration,
26417
+ progress = Math.max(0, Math.min(1, animProgress)),
26418
+ dx = this.getInitialDx() * (1 - progress),
26419
+ dy = this.getInitialDy() * (1 - progress);
26420
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), {
26421
+ opacity: progress,
26422
+ dx: dx,
26423
+ dy: dy
26424
+ });
26425
+ }
26426
+ }
26427
+ return updatedTextConfig;
26428
+ }
26429
+ }
26430
+
26431
+ class SlideOutRichText extends ACustomAnimate {
26432
+ constructor(from, to, duration, easing, params) {
26433
+ super(from, to, duration, easing, params), this.fromTextConfig = [], this.toTextConfig = [], this.originalTextConfig = [], this.singleCharConfig = [], this.fadeOutDuration = .3, this.slideDirection = "right", this.slideDistance = 30, this.wordByWord = !1, this.wordRegex = /[a-zA-Z]+(-[a-zA-Z]+)*|[\u4e00-\u9fa5]+|[0-9]+|[^\s\w\u4e00-\u9fa5]/g, this.wordGroups = [], this.reverseOrder = !1, void 0 !== (null == params ? void 0 : params.fadeOutDuration) && (this.fadeOutDuration = params.fadeOutDuration), void 0 !== (null == params ? void 0 : params.slideDirection) && (this.slideDirection = params.slideDirection), void 0 !== (null == params ? void 0 : params.slideDistance) && (this.slideDistance = params.slideDistance), void 0 !== (null == params ? void 0 : params.wordByWord) && (this.wordByWord = params.wordByWord), void 0 !== (null == params ? void 0 : params.wordRegex) && (this.wordRegex = params.wordRegex), void 0 !== (null == params ? void 0 : params.reverseOrder) && (this.reverseOrder = params.reverseOrder), this.propKeys = ["textConfig"];
26434
+ }
26435
+ onFirstRun() {
26436
+ const fromProps = this.getLastProps(),
26437
+ toProps = this.getEndProps();
26438
+ this.originalTextConfig = fromProps.textConfig ? [...fromProps.textConfig] : [], this.valid = !0, this.originalTextConfig && 0 !== this.originalTextConfig.length ? (this.fromTextConfig = RichText.TransformTextConfig2SingleCharacter(this.originalTextConfig), this.toTextConfig = toProps.textConfig && toProps.textConfig.length > 0 ? RichText.TransformTextConfig2SingleCharacter(toProps.textConfig) : [], this.singleCharConfig = this.fromTextConfig.map(item => "text" in item ? Object.assign(Object.assign({}, item), {
26439
+ opacity: 1,
26440
+ dx: 0,
26441
+ dy: 0
26442
+ }) : Object.assign(Object.assign({}, item), {
26443
+ opacity: 1
26444
+ })), this.wordByWord && this.calculateWordGroups()) : this.valid = !1;
26445
+ }
26446
+ calculateWordGroups() {
26447
+ this.wordGroups = [];
26448
+ let fullText = "";
26449
+ const charMap = {};
26450
+ let match,
26451
+ fullTextIndex = 0;
26452
+ for (this.fromTextConfig.forEach((item, configIndex) => {
26453
+ if (("text" in item)) {
26454
+ const text = String(item.text);
26455
+ fullText += text, charMap[fullTextIndex] = configIndex, fullTextIndex++;
26456
+ }
26457
+ }), this.wordRegex.lastIndex = 0; null !== (match = this.wordRegex.exec(fullText));) {
26458
+ const wordStart = match.index,
26459
+ wordEnd = match.index + match[0].length,
26460
+ wordIndices = [];
26461
+ for (let i = wordStart; i < wordEnd; i++) void 0 !== charMap[i] && wordIndices.push(charMap[i]);
26462
+ wordIndices.length > 0 && this.wordGroups.push(wordIndices);
26463
+ }
26464
+ const allocatedIndices = new Set();
26465
+ this.wordGroups.forEach(group => {
26466
+ group.forEach(index => allocatedIndices.add(index));
26467
+ });
26468
+ for (let i = 0; i < this.fromTextConfig.length; i++) "text" in this.fromTextConfig[i] && !allocatedIndices.has(i) && this.wordGroups.push([i]);
26469
+ }
26470
+ getTargetDx() {
26471
+ switch (this.slideDirection) {
26472
+ case "left":
26473
+ return -this.slideDistance;
26474
+ case "right":
26475
+ return this.slideDistance;
26476
+ default:
26477
+ return 0;
26478
+ }
26479
+ }
26480
+ getTargetDy() {
26481
+ switch (this.slideDirection) {
26482
+ case "up":
26483
+ return -this.slideDistance;
26484
+ case "down":
26485
+ return this.slideDistance;
26486
+ default:
26487
+ return 0;
26488
+ }
26489
+ }
26490
+ onEnd(cb) {
26491
+ super.onEnd(cb), cb || (this.toTextConfig.length > 0 ? this.target.setAttribute("textConfig", this.toTextConfig) : this.target.setAttribute("textConfig", []));
26492
+ }
26493
+ onUpdate(end, ratio, out) {
26494
+ if (!this.valid) return;
26495
+ const maxTextShowRatio = 1 - this.fadeOutDuration;
26496
+ let updatedTextConfig;
26497
+ updatedTextConfig = this.wordByWord && this.wordGroups.length > 0 ? this.updateByWord(ratio, maxTextShowRatio) : this.updateByCharacter(ratio, maxTextShowRatio), this.target.setAttribute("textConfig", updatedTextConfig);
26498
+ }
26499
+ updateByWord(ratio, maxTextShowRatio) {
26500
+ const totalGroups = this.wordGroups.length,
26501
+ updatedTextConfig = [...this.singleCharConfig];
26502
+ for (let groupIndex = 0; groupIndex < this.wordGroups.length; groupIndex++) {
26503
+ let disappearTime;
26504
+ if (disappearTime = this.reverseOrder ? "left" === this.slideDirection ? groupIndex / totalGroups * maxTextShowRatio : (totalGroups - 1 - groupIndex) / totalGroups * maxTextShowRatio : "left" === this.slideDirection ? (totalGroups - 1 - groupIndex) / totalGroups * maxTextShowRatio : groupIndex / totalGroups * maxTextShowRatio, ratio < disappearTime) {
26505
+ for (const charIndex of this.wordGroups[groupIndex]) {
26506
+ const item = updatedTextConfig[charIndex];
26507
+ "text" in item && (updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), {
26508
+ opacity: 1,
26509
+ dx: 0,
26510
+ dy: 0
26511
+ }));
26512
+ }
26513
+ continue;
26514
+ }
26515
+ const animProgress = (ratio - disappearTime) / this.fadeOutDuration,
26516
+ progress = Math.max(0, Math.min(1, animProgress)),
26517
+ dx = this.getTargetDx() * progress,
26518
+ dy = this.getTargetDy() * progress,
26519
+ opacity = 1 - progress;
26520
+ for (const charIndex of this.wordGroups[groupIndex]) {
26521
+ const item = updatedTextConfig[charIndex];
26522
+ "text" in item && (updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), {
26523
+ opacity: opacity,
26524
+ dx: dx,
26525
+ dy: dy
26526
+ }));
26527
+ }
26528
+ }
26529
+ return updatedTextConfig;
26530
+ }
26531
+ updateByCharacter(ratio, maxTextShowRatio) {
26532
+ const totalItems = this.fromTextConfig.length,
26533
+ updatedTextConfig = [...this.singleCharConfig];
26534
+ for (let index = 0; index < updatedTextConfig.length; index++) {
26535
+ const item = updatedTextConfig[index];
26536
+ if ("text" in item) {
26537
+ let disappearTime;
26538
+ if (disappearTime = this.reverseOrder ? "left" === this.slideDirection ? index / totalItems * maxTextShowRatio : (totalItems - 1 - index) / totalItems * maxTextShowRatio : "left" === this.slideDirection ? (totalItems - 1 - index) / totalItems * maxTextShowRatio : index / totalItems * maxTextShowRatio, ratio < disappearTime) {
26539
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), {
26540
+ opacity: 1,
26541
+ dx: 0,
26542
+ dy: 0
26543
+ });
26544
+ continue;
26545
+ }
26546
+ const animProgress = (ratio - disappearTime) / this.fadeOutDuration,
26547
+ progress = Math.max(0, Math.min(1, animProgress)),
26548
+ dx = this.getTargetDx() * progress,
26549
+ dy = this.getTargetDy() * progress,
26550
+ opacity = 1 - progress;
26551
+ updatedTextConfig[index] = Object.assign(Object.assign({}, item), {
26552
+ opacity: opacity,
26553
+ dx: dx,
26554
+ dy: dy
26555
+ });
26556
+ }
26557
+ }
26558
+ return updatedTextConfig;
26559
+ }
26560
+ }
26561
+
26562
+ class ScaleIn extends ACustomAnimate {
26563
+ constructor(from, to, duration, easing, params) {
26564
+ super(from, to, duration, easing, params);
26565
+ }
26566
+ onBind() {
26567
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
26568
+ let from, to;
26569
+ super.onBind();
26570
+ const attrs = this.target.getFinalAttribute(),
26571
+ fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {};
26572
+ switch (null === (_b = this.params) || void 0 === _b ? void 0 : _b.direction) {
26573
+ case "x":
26574
+ from = {
26575
+ scaleX: null !== (_c = fromAttrs.scaleX) && void 0 !== _c ? _c : 0
26576
+ }, to = {
26577
+ scaleX: null !== (_d = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _d ? _d : 1
26578
+ }, this._updateFunction = this.updateX;
26579
+ break;
26580
+ case "y":
26581
+ from = {
26582
+ scaleY: null !== (_e = fromAttrs.scaleY) && void 0 !== _e ? _e : 0
26583
+ }, to = {
26584
+ scaleY: null !== (_f = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _f ? _f : 1
26585
+ }, this._updateFunction = this.updateY;
26586
+ break;
26587
+ default:
26588
+ from = {
26589
+ scaleX: null !== (_g = fromAttrs.scaleX) && void 0 !== _g ? _g : 0,
26590
+ scaleY: null !== (_h = fromAttrs.scaleY) && void 0 !== _h ? _h : 0
26591
+ }, to = {
26592
+ scaleX: null !== (_j = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _j ? _j : 1,
26593
+ scaleY: null !== (_k = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _k ? _k : 1
26594
+ }, this._updateFunction = this.updateXY;
26595
+ }
26596
+ const finalAttribute = this.target.getFinalAttribute();
26597
+ finalAttribute && this.target.setAttributes(finalAttribute), this.props = to, this.from = from, this.to = to, !1 !== (null === (_l = this.params.controlOptions) || void 0 === _l ? void 0 : _l.immediatelyApply) && this.target.setAttributes(from);
26598
+ }
26599
+ onEnd(cb) {
26600
+ super.onEnd(cb);
26601
+ }
26602
+ updateX(ratio) {
26603
+ this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
26604
+ }
26605
+ updateY(ratio) {
26606
+ this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
26607
+ }
26608
+ updateXY(ratio) {
26609
+ this.updateX(ratio), this.updateY(ratio);
26610
+ }
26611
+ deleteSelfAttr(key) {
26612
+ delete this.props[key], this.fromProps && delete this.fromProps[key];
26613
+ const index = this.propKeys.indexOf(key);
26614
+ -1 !== index && this.propKeys.splice(index, 1), this.propKeys && this.propKeys.length > 1 ? this._updateFunction = this.updateXY : "scaleX" === this.propKeys[0] ? this._updateFunction = this.updateX : "scaleY" === this.propKeys[0] ? this._updateFunction = this.updateY : this._updateFunction = null;
26615
+ }
26616
+ onUpdate(end, ratio, out) {
26617
+ this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag());
26618
+ }
26619
+ }
26620
+ class ScaleOut extends ACustomAnimate {
26621
+ constructor(from, to, duration, easing, params) {
26622
+ super(from, to, duration, easing, params);
26623
+ }
26624
+ onBind() {
26625
+ var _a, _b, _c, _d, _e;
26626
+ let from, to;
26627
+ super.onBind();
26628
+ const attrs = this.target.attribute;
26629
+ switch (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) {
26630
+ case "x":
26631
+ from = {
26632
+ scaleX: null !== (_b = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _b ? _b : 1
26633
+ }, to = {
26634
+ scaleX: 0
26635
+ };
26636
+ break;
26637
+ case "y":
26638
+ from = {
26639
+ scaleY: null !== (_c = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _c ? _c : 1
26640
+ }, to = {
26641
+ scaleY: 0
26642
+ };
26643
+ break;
26644
+ default:
26645
+ from = {
26646
+ scaleX: null !== (_d = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _d ? _d : 1,
26647
+ scaleY: null !== (_e = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _e ? _e : 1
26648
+ }, to = {
26649
+ scaleX: 0,
26650
+ scaleY: 0
26651
+ };
26652
+ }
26653
+ this.props = to, this.from = from, this.to = to;
26654
+ }
26655
+ onEnd(cb) {
26656
+ super.onEnd(cb);
26657
+ }
26658
+ onUpdate(end, ratio, out) {
26659
+ const attribute = this.target.attribute;
26660
+ this.propKeys.forEach(key => {
26661
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
26662
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
26663
+ }
26664
+ }
26665
+
26666
+ class State extends ACustomAnimate {
26667
+ constructor(from, to, duration, easing, params) {
26668
+ super(from, to, duration, easing, params);
26669
+ }
26670
+ update(end, ratio, out) {
26671
+ if (this.onStart(), !this.props || !this.propKeys) return;
26672
+ const easedRatio = this.easing(ratio);
26673
+ this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
26674
+ if (!this.animate.validAttr(this.propKeys[index])) return;
26675
+ const key = this.propKeys[index];
26676
+ func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
26677
+ }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
26678
+ }
26679
+ }
26680
+
26681
+ class SlideIn extends ACustomAnimate {
26682
+ constructor(from, to, duration, easing, params) {
26683
+ super(from, to, duration, easing, params);
26684
+ }
26685
+ onBind() {
26686
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
26687
+ super.onBind();
26688
+ const attrs = this.target.getFinalAttribute(),
26689
+ direction = (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) || "right",
26690
+ distance = (null === (_b = this.params) || void 0 === _b ? void 0 : _b.distance) || 50,
26691
+ fromOpacity = null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromOpacity) && void 0 !== _d ? _d : 0,
26692
+ from = {
26693
+ opacity: fromOpacity,
26694
+ baseOpacity: fromOpacity
26695
+ },
26696
+ to = {
26697
+ opacity: 1,
26698
+ baseOpacity: 1
26699
+ };
26700
+ "top" === direction ? (from.y = (null !== (_e = attrs.y) && void 0 !== _e ? _e : 0) - distance, to.y = null !== (_f = attrs.y) && void 0 !== _f ? _f : 0, this.propKeys = ["opacity", "baseOpacity", "y"]) : "bottom" === direction ? (from.y = (null !== (_g = attrs.y) && void 0 !== _g ? _g : 0) + distance, to.y = null !== (_h = attrs.y) && void 0 !== _h ? _h : 0, this.propKeys = ["opacity", "baseOpacity", "y"]) : "left" === direction ? (from.x = (null !== (_j = attrs.x) && void 0 !== _j ? _j : 0) - distance, to.x = null !== (_k = attrs.x) && void 0 !== _k ? _k : 0, this.propKeys = ["opacity", "baseOpacity", "x"]) : (from.x = (null !== (_l = attrs.x) && void 0 !== _l ? _l : 0) + distance, to.x = null !== (_m = attrs.x) && void 0 !== _m ? _m : 0, this.propKeys = ["opacity", "baseOpacity", "x"]), this.from = from, this.to = to, this.props = to, this.target.setAttributes(from);
26701
+ }
26702
+ onUpdate(end, ratio, out) {
26703
+ const attribute = this.target.attribute;
26704
+ this.propKeys.forEach(key => {
26705
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
26706
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
26707
+ }
26708
+ }
26709
+ class GrowIn extends ACustomAnimate {
26710
+ constructor(from, to, duration, easing, params) {
26711
+ super(from, to, duration, easing, params);
26712
+ }
26713
+ onBind() {
26714
+ var _a, _b, _c, _d, _e, _f, _g;
26715
+ super.onBind();
26716
+ const attrs = this.target.getFinalAttribute(),
26717
+ fromScale = null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromScale) && void 0 !== _b ? _b : 0,
26718
+ direction = (null === (_c = this.params) || void 0 === _c ? void 0 : _c.direction) || "xy",
26719
+ fromOpacity = null !== (_e = null === (_d = this.params) || void 0 === _d ? void 0 : _d.fromOpacity) && void 0 !== _e ? _e : 0,
26720
+ from = {
26721
+ opacity: fromOpacity,
26722
+ baseOpacity: fromOpacity
26723
+ },
26724
+ to = {
26725
+ opacity: 1,
26726
+ baseOpacity: 1
26727
+ };
26728
+ this.propKeys = ["opacity", "baseOpacity"], "x" !== direction && "xy" !== direction || (from.scaleX = fromScale, to.scaleX = null !== (_f = attrs.scaleX) && void 0 !== _f ? _f : 1, this.propKeys.push("scaleX")), "y" !== direction && "xy" !== direction || (from.scaleY = fromScale, to.scaleY = null !== (_g = attrs.scaleY) && void 0 !== _g ? _g : 1, this.propKeys.push("scaleY")), this.from = from, this.to = to, this.props = to, this.target.setAttributes(from);
26729
+ }
26730
+ onUpdate(end, ratio, out) {
26731
+ const attribute = this.target.attribute;
26732
+ this.propKeys.forEach(key => {
26733
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
26734
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
26735
+ }
26736
+ }
26737
+ class SpinIn extends ACustomAnimate {
26738
+ constructor(from, to, duration, easing, params) {
26739
+ super(from, to, duration, easing, params);
26740
+ }
26741
+ onBind() {
26742
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26743
+ super.onBind();
26744
+ const attrs = this.target.getFinalAttribute(),
26745
+ fromAngle = null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromAngle) && void 0 !== _b ? _b : 2 * Math.PI,
26746
+ fromScale = null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromScale) && void 0 !== _d ? _d : 0,
26747
+ fromOpacity = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.fromOpacity) && void 0 !== _f ? _f : 0,
26748
+ from = {
26749
+ opacity: fromOpacity,
26750
+ baseOpacity: fromOpacity,
26751
+ angle: fromAngle,
26752
+ scaleX: fromScale,
26753
+ scaleY: fromScale
26754
+ },
26755
+ to = {
26756
+ opacity: 1,
26757
+ baseOpacity: 1,
26758
+ angle: null !== (_g = attrs.angle) && void 0 !== _g ? _g : 0,
26759
+ scaleX: null !== (_h = attrs.scaleX) && void 0 !== _h ? _h : 1,
26760
+ scaleY: null !== (_j = attrs.scaleY) && void 0 !== _j ? _j : 1
26761
+ };
26762
+ this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to, this.target.setAttributes(from);
26763
+ }
26764
+ onUpdate(end, ratio, out) {
26765
+ const attribute = this.target.attribute;
26766
+ this.propKeys.forEach(key => {
26767
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
26768
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
26769
+ }
26770
+ }
26771
+ class StrokeIn extends ACustomAnimate {
26772
+ constructor(from, to, duration, easing, params) {
26773
+ super(from, to, duration, easing, params), this.perimeter = 0, this.originalAttributes = {};
26774
+ }
26775
+ onBind() {
26776
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
26777
+ if (super.onBind(), this.originalAttributes = Object.assign({}, this.target.getAttributes()), "rect" === this.target.type) {
26778
+ const attr = this.target.attribute,
26779
+ width = null !== (_a = attr.width) && void 0 !== _a ? _a : 100,
26780
+ height = null !== (_b = attr.height) && void 0 !== _b ? _b : 100;
26781
+ this.perimeter = 2 * (width + height);
26782
+ } else if ("circle" === this.target.type) {
26783
+ const radius = null !== (_c = this.target.attribute.radius) && void 0 !== _c ? _c : 50;
26784
+ this.perimeter = 2 * Math.PI * radius;
26785
+ } else if ("ellipse" === this.target.type) {
26786
+ const attr = this.target.attribute,
26787
+ radiusX = null !== (_d = attr.radiusX) && void 0 !== _d ? _d : 50,
26788
+ radiusY = null !== (_e = attr.radiusY) && void 0 !== _e ? _e : 50;
26789
+ this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
26790
+ } else this.perimeter = 1e3;
26791
+ const lineWidth = null !== (_g = null === (_f = this.params) || void 0 === _f ? void 0 : _f.lineWidth) && void 0 !== _g ? _g : 2,
26792
+ strokeColor = null !== (_j = null === (_h = this.params) || void 0 === _h ? void 0 : _h.strokeColor) && void 0 !== _j ? _j : "black",
26793
+ fromOpacity = null !== (_l = null === (_k = this.params) || void 0 === _k ? void 0 : _k.fromOpacity) && void 0 !== _l ? _l : 1,
26794
+ dashLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.dashLength) && void 0 !== _o ? _o : this.perimeter,
26795
+ showFill = null !== (_q = null === (_p = this.params) || void 0 === _p ? void 0 : _p.showFill) && void 0 !== _q && _q,
26796
+ fillOpacity = null !== (_s = null === (_r = this.params) || void 0 === _r ? void 0 : _r.fillOpacity) && void 0 !== _s ? _s : 0;
26797
+ this.from = {
26798
+ lineDash: [dashLength, dashLength],
26799
+ lineDashOffset: dashLength,
26800
+ lineWidth: lineWidth,
26801
+ stroke: strokeColor,
26802
+ strokeOpacity: fromOpacity
26803
+ }, this.to = {
26804
+ lineDash: [dashLength, dashLength],
26805
+ lineDashOffset: 0,
26806
+ lineWidth: lineWidth,
26807
+ stroke: strokeColor,
26808
+ strokeOpacity: fromOpacity
26809
+ }, showFill ? (this.from.fillOpacity = fillOpacity, this.to.fillOpacity = null !== (_t = this.originalAttributes.fillOpacity) && void 0 !== _t ? _t : 1) : (this.from.fillOpacity = 0, this.to.fillOpacity = 0), this.propKeys = ["lineDash", "lineDashOffset", "lineWidth", "stroke", "strokeOpacity", "fillOpacity"], this.props = this.to, this.target.setAttributes(this.from);
26810
+ }
26811
+ onUpdate(end, ratio, out) {
26812
+ var _a;
26813
+ const attribute = this.target.attribute;
26814
+ attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio, (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio);
26815
+ }
26816
+ onEnd() {
26817
+ var _a;
26818
+ if (super.onEnd(), !(null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill)) {
26819
+ const originalAttrs = Object.assign({}, this.originalAttributes);
26820
+ originalAttrs.fillOpacity = 0, this.target.setAttributes(originalAttrs);
26821
+ }
26822
+ }
26823
+ }
26824
+ class StrokeOut extends ACustomAnimate {
26825
+ constructor(from, to, duration, easing, params) {
26826
+ super(from, to, duration, easing, params), this.perimeter = 0, this.originalAttributes = {};
26827
+ }
26828
+ onFirstRun() {
26829
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
26830
+ if (this.originalAttributes = Object.assign({}, this.target.getAttributes()), "rect" === this.target.type) {
26831
+ const attr = this.target.attribute,
26832
+ width = null !== (_a = attr.width) && void 0 !== _a ? _a : 100,
26833
+ height = null !== (_b = attr.height) && void 0 !== _b ? _b : 100;
26834
+ this.perimeter = 2 * (width + height);
26835
+ } else if ("circle" === this.target.type) {
26836
+ const radius = null !== (_c = this.target.attribute.radius) && void 0 !== _c ? _c : 50;
26837
+ this.perimeter = 2 * Math.PI * radius;
26838
+ } else if ("ellipse" === this.target.type) {
26839
+ const attr = this.target.attribute,
26840
+ radiusX = null !== (_d = attr.radiusX) && void 0 !== _d ? _d : 50,
26841
+ radiusY = null !== (_e = attr.radiusY) && void 0 !== _e ? _e : 50;
26842
+ this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
26843
+ } else this.perimeter = 1e3;
26844
+ const lineWidth = null !== (_g = null === (_f = this.params) || void 0 === _f ? void 0 : _f.lineWidth) && void 0 !== _g ? _g : 2,
26845
+ strokeColor = null !== (_j = null === (_h = this.params) || void 0 === _h ? void 0 : _h.strokeColor) && void 0 !== _j ? _j : "black",
26846
+ fromOpacity = null !== (_l = null === (_k = this.params) || void 0 === _k ? void 0 : _k.fromOpacity) && void 0 !== _l ? _l : 1,
26847
+ dashLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.dashLength) && void 0 !== _o ? _o : this.perimeter,
26848
+ showFill = null !== (_q = null === (_p = this.params) || void 0 === _p ? void 0 : _p.showFill) && void 0 !== _q && _q;
26849
+ this.from = {
26850
+ lineDash: [dashLength, dashLength],
26851
+ lineDashOffset: 0,
26852
+ lineWidth: lineWidth,
26853
+ stroke: strokeColor,
26854
+ strokeOpacity: fromOpacity
26855
+ }, this.to = {
26856
+ lineDash: [dashLength, dashLength],
26857
+ lineDashOffset: -dashLength,
26858
+ lineWidth: lineWidth,
26859
+ stroke: strokeColor,
26860
+ strokeOpacity: fromOpacity
26861
+ }, showFill ? (this.from.fillOpacity = null !== (_r = this.originalAttributes.fillOpacity) && void 0 !== _r ? _r : 1, this.to.fillOpacity = 0) : (this.from.fillOpacity = 0, this.to.fillOpacity = 0), this.propKeys = ["lineDash", "lineDashOffset", "lineWidth", "stroke", "strokeOpacity", "fillOpacity"], this.props = this.to, this.target.setAttributes(this.from);
26862
+ }
26863
+ onUpdate(end, ratio, out) {
26864
+ var _a;
26865
+ const attribute = this.target.attribute;
26866
+ attribute.lineDashOffset = this.from.lineDashOffset + (this.to.lineDashOffset - this.from.lineDashOffset) * ratio, (null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill) && (attribute.fillOpacity = this.from.fillOpacity + (this.to.fillOpacity - this.from.fillOpacity) * ratio);
26867
+ }
26868
+ }
26869
+ class MoveScaleIn extends ACustomAnimate {
26870
+ constructor(from, to, duration, easing, params) {
26871
+ var _a;
26872
+ super(from, to, duration, easing, params);
26873
+ const slideRatio = null !== (_a = null == params ? void 0 : params.slideRatio) && void 0 !== _a ? _a : .5;
26874
+ this.slideInDuration = duration * slideRatio, this.growInDuration = duration * (1 - slideRatio);
26875
+ }
26876
+ onBind() {
26877
+ var _a, _b, _c, _d, _e, _f;
26878
+ super.onBind();
26879
+ const executor = new AnimateExecutor(this.target);
26880
+ executor.execute({
26881
+ type: "custom",
26882
+ custom: SlideIn,
26883
+ customParameters: {
26884
+ direction: (null === (_a = this.params) || void 0 === _a ? void 0 : _a.slideDirection) || "right",
26885
+ distance: (null === (_b = this.params) || void 0 === _b ? void 0 : _b.slideDistance) || 50,
26886
+ fromOpacity: null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromOpacity) && void 0 !== _d ? _d : 0
26887
+ },
26888
+ duration: this.slideInDuration,
26889
+ easing: this.easing
26890
+ }), executor.execute({
26891
+ type: "custom",
26892
+ custom: GrowIn,
26893
+ customParameters: {
26894
+ fromScale: (null === (_e = this.params) || void 0 === _e ? void 0 : _e.fromScale) || .5,
26895
+ direction: (null === (_f = this.params) || void 0 === _f ? void 0 : _f.scaleDirection) || "xy",
26896
+ fromOpacity: 1
26897
+ },
26898
+ duration: this.growInDuration,
26899
+ easing: this.easing,
26900
+ delay: this.slideInDuration
26901
+ });
26902
+ }
26903
+ onUpdate(end, ratio, out) {}
26904
+ }
26905
+ class MoveRotateIn extends ACustomAnimate {
26906
+ constructor(from, to, duration, easing, params) {
26907
+ var _a;
26908
+ super(from, to, duration, easing, params);
26909
+ const slideRatio = null !== (_a = null == params ? void 0 : params.slideRatio) && void 0 !== _a ? _a : .5;
26910
+ this.slideInDuration = duration * slideRatio, this.spinInDuration = duration * (1 - slideRatio);
26911
+ }
26912
+ onBind() {
26913
+ var _a, _b, _c, _d, _e, _f;
26914
+ super.onBind();
26915
+ const executor = new AnimateExecutor(this.target);
26916
+ executor.execute({
26917
+ type: "custom",
26918
+ custom: SlideIn,
26919
+ customParameters: {
26920
+ direction: (null === (_a = this.params) || void 0 === _a ? void 0 : _a.slideDirection) || "right",
26921
+ distance: (null === (_b = this.params) || void 0 === _b ? void 0 : _b.slideDistance) || 50,
26922
+ fromOpacity: null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromOpacity) && void 0 !== _d ? _d : 0
26923
+ },
26924
+ duration: this.slideInDuration,
26925
+ easing: this.easing
26926
+ }), executor.execute({
26927
+ type: "custom",
26928
+ custom: SpinIn,
26929
+ customParameters: {
26930
+ fromAngle: (null === (_e = this.params) || void 0 === _e ? void 0 : _e.fromAngle) || Math.PI,
26931
+ fromScale: (null === (_f = this.params) || void 0 === _f ? void 0 : _f.fromScale) || .5,
26932
+ fromOpacity: 1
26933
+ },
26934
+ duration: this.spinInDuration,
26935
+ easing: this.easing,
26936
+ delay: this.slideInDuration
26937
+ });
26938
+ }
26939
+ onUpdate(end, ratio, out) {}
26940
+ }
26941
+ class SlideOut extends ACustomAnimate {
26942
+ constructor(from, to, duration, easing, params) {
26943
+ super(from, to, duration, easing, params);
26944
+ }
26945
+ onFirstRun() {
26946
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
26947
+ const attrs = this.target.getAttributes(),
26948
+ direction = (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) || "right",
26949
+ distance = (null === (_b = this.params) || void 0 === _b ? void 0 : _b.distance) || 50,
26950
+ fromOpacity = null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromOpacity) && void 0 !== _d ? _d : 1,
26951
+ toOpacity = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.toOpacity) && void 0 !== _f ? _f : 0,
26952
+ from = {
26953
+ opacity: fromOpacity,
26954
+ baseOpacity: fromOpacity
26955
+ },
26956
+ to = {
26957
+ opacity: toOpacity,
26958
+ baseOpacity: toOpacity
26959
+ };
26960
+ "top" === direction ? (from.y = null !== (_g = attrs.y) && void 0 !== _g ? _g : 0, to.y = (null !== (_h = attrs.y) && void 0 !== _h ? _h : 0) - distance, this.propKeys = ["opacity", "baseOpacity", "y"]) : "bottom" === direction ? (from.y = null !== (_j = attrs.y) && void 0 !== _j ? _j : 0, to.y = (null !== (_k = attrs.y) && void 0 !== _k ? _k : 0) + distance, this.propKeys = ["opacity", "baseOpacity", "y"]) : "left" === direction ? (from.x = null !== (_l = attrs.x) && void 0 !== _l ? _l : 0, to.x = (null !== (_m = attrs.x) && void 0 !== _m ? _m : 0) - distance, this.propKeys = ["opacity", "baseOpacity", "x"]) : (from.x = null !== (_o = attrs.x) && void 0 !== _o ? _o : 0, to.x = (null !== (_p = attrs.x) && void 0 !== _p ? _p : 0) + distance, this.propKeys = ["opacity", "baseOpacity", "x"]), this.from = from, this.to = to, this.props = to;
26961
+ }
26962
+ onUpdate(end, ratio, out) {
26963
+ const attribute = this.target.attribute;
26964
+ this.propKeys.forEach(key => {
26965
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
26966
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
26967
+ }
26968
+ }
26969
+ class GrowOut extends ACustomAnimate {
26970
+ constructor(from, to, duration, easing, params) {
26971
+ super(from, to, duration, easing, params);
26972
+ }
26973
+ onFirstRun() {
26974
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26975
+ const attrs = this.target.getAttributes(),
26976
+ toScale = null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromScale) && void 0 !== _b ? _b : 0,
26977
+ direction = (null === (_c = this.params) || void 0 === _c ? void 0 : _c.direction) || "xy",
26978
+ fromOpacity = null !== (_e = null === (_d = this.params) || void 0 === _d ? void 0 : _d.fromOpacity) && void 0 !== _e ? _e : 1,
26979
+ toOpacity = null !== (_g = null === (_f = this.params) || void 0 === _f ? void 0 : _f.toOpacity) && void 0 !== _g ? _g : 0,
26980
+ from = {
26981
+ opacity: fromOpacity,
26982
+ baseOpacity: fromOpacity
26983
+ },
26984
+ to = {
26985
+ opacity: toOpacity,
26986
+ baseOpacity: toOpacity
26987
+ };
26988
+ this.propKeys = ["opacity", "baseOpacity"], "x" !== direction && "xy" !== direction || (from.scaleX = null !== (_h = attrs.scaleX) && void 0 !== _h ? _h : 1, to.scaleX = toScale, this.propKeys.push("scaleX")), "y" !== direction && "xy" !== direction || (from.scaleY = null !== (_j = attrs.scaleY) && void 0 !== _j ? _j : 1, to.scaleY = toScale, this.propKeys.push("scaleY")), this.from = from, this.to = to, this.props = to;
26989
+ }
26990
+ onUpdate(end, ratio, out) {
26991
+ const attribute = this.target.attribute;
26992
+ this.propKeys.forEach(key => {
26993
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
26994
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
26995
+ }
26996
+ }
26997
+ class SpinOut extends ACustomAnimate {
26998
+ constructor(from, to, duration, easing, params) {
26999
+ super(from, to, duration, easing, params);
27000
+ }
27001
+ onFirstRun() {
27002
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
27003
+ const attrs = this.target.getAttributes(),
27004
+ toAngle = null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromAngle) && void 0 !== _b ? _b : 2 * Math.PI,
27005
+ toScale = null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromScale) && void 0 !== _d ? _d : 0,
27006
+ fromOpacity = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.fromOpacity) && void 0 !== _f ? _f : 1,
27007
+ toOpacity = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.toOpacity) && void 0 !== _h ? _h : 0,
27008
+ from = {
27009
+ opacity: fromOpacity,
27010
+ baseOpacity: fromOpacity,
27011
+ angle: null !== (_j = attrs.angle) && void 0 !== _j ? _j : 0,
27012
+ scaleX: null !== (_k = attrs.scaleX) && void 0 !== _k ? _k : 1,
27013
+ scaleY: null !== (_l = attrs.scaleY) && void 0 !== _l ? _l : 1
27014
+ },
27015
+ to = {
27016
+ opacity: toOpacity,
27017
+ baseOpacity: toOpacity,
27018
+ angle: toAngle,
27019
+ scaleX: toScale,
27020
+ scaleY: toScale
27021
+ };
27022
+ this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to;
27023
+ }
27024
+ onUpdate(end, ratio, out) {
27025
+ const attribute = this.target.attribute;
27026
+ this.propKeys.forEach(key => {
27027
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
27028
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
27029
+ }
27030
+ }
27031
+ class MoveScaleOut extends ACustomAnimate {
27032
+ constructor(from, to, duration, easing, params) {
27033
+ var _a;
27034
+ super(from, to, duration, easing, params);
27035
+ const slideRatio = null !== (_a = null == params ? void 0 : params.slideRatio) && void 0 !== _a ? _a : .5;
27036
+ this.growOutDuration = duration * (1 - slideRatio), this.slideOutDuration = duration * slideRatio;
27037
+ }
27038
+ onFirstRun() {
27039
+ var _a, _b, _c, _d;
27040
+ const executor = new AnimateExecutor(this.target);
27041
+ executor.execute({
27042
+ type: "custom",
27043
+ custom: GrowOut,
27044
+ customParameters: {
27045
+ fromScale: (null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromScale) || .5,
27046
+ direction: (null === (_b = this.params) || void 0 === _b ? void 0 : _b.scaleDirection) || "xy",
27047
+ fromOpacity: 1,
27048
+ toOpacity: 1
27049
+ },
27050
+ duration: this.growOutDuration,
27051
+ easing: this.easing
27052
+ }), executor.execute({
27053
+ type: "custom",
27054
+ custom: SlideOut,
27055
+ customParameters: {
27056
+ direction: (null === (_c = this.params) || void 0 === _c ? void 0 : _c.slideDirection) || "right",
27057
+ distance: (null === (_d = this.params) || void 0 === _d ? void 0 : _d.slideDistance) || 50,
27058
+ fromOpacity: 1
27059
+ },
27060
+ duration: this.slideOutDuration,
27061
+ easing: this.easing,
27062
+ delay: this.growOutDuration
24102
27063
  });
24103
27064
  }
24104
- onEnd(cb) {
24105
- cb ? this._endCallbacks.push(cb) : this._endCallbacks.forEach(cb => {
24106
- cb();
24107
- });
27065
+ onUpdate(end, ratio, out) {}
27066
+ }
27067
+ class MoveRotateOut extends ACustomAnimate {
27068
+ constructor(from, to, duration, easing, params) {
27069
+ var _a;
27070
+ super(from, to, duration, easing, params);
27071
+ const slideRatio = null !== (_a = null == params ? void 0 : params.slideRatio) && void 0 !== _a ? _a : .5;
27072
+ this.spinOutDuration = duration * (1 - slideRatio), this.slideOutDuration = duration * slideRatio;
24108
27073
  }
24109
- _trackAnimation(animate) {
24110
- this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
24111
- this._activeCount--;
24112
- const index = this._animates.indexOf(animate);
24113
- index >= 0 && this._animates.splice(index, 1), 0 === this._activeCount && this._started && (this._started = !1, this.onEnd());
27074
+ onFirstRun() {
27075
+ var _a, _b, _c, _d;
27076
+ const executor = new AnimateExecutor(this.target);
27077
+ executor.execute({
27078
+ type: "custom",
27079
+ custom: SpinOut,
27080
+ customParameters: {
27081
+ fromAngle: (null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromAngle) || Math.PI,
27082
+ fromScale: (null === (_b = this.params) || void 0 === _b ? void 0 : _b.fromScale) || .5,
27083
+ fromOpacity: 1,
27084
+ toOpacity: 1
27085
+ },
27086
+ duration: this.spinOutDuration,
27087
+ easing: this.easing
27088
+ }), executor.execute({
27089
+ type: "custom",
27090
+ custom: SlideOut,
27091
+ customParameters: {
27092
+ direction: (null === (_c = this.params) || void 0 === _c ? void 0 : _c.slideDirection) || "right",
27093
+ distance: (null === (_d = this.params) || void 0 === _d ? void 0 : _d.slideDistance) || 50,
27094
+ fromOpacity: 1
27095
+ },
27096
+ duration: this.slideOutDuration,
27097
+ easing: this.easing,
27098
+ delay: this.spinOutDuration
24114
27099
  });
24115
27100
  }
24116
- parseParams(params, isTimeline, child) {
24117
- var _a, _b;
24118
- const totalTime = this.resolveValue(params.totalTime, void 0, void 0),
24119
- startTime = this.resolveValue(params.startTime, void 0, 0),
24120
- parsedParams = Object.assign({}, params);
24121
- parsedParams.oneByOneDelay = 0, parsedParams.startTime = startTime, parsedParams.totalTime = totalTime;
24122
- const oneByOne = this.resolveValue(params.oneByOne, child, !1);
24123
- if (isTimeline) {
24124
- const timeSlices = parsedParams.timeSlices;
24125
- isArray$9(timeSlices) || (parsedParams.timeSlices = [timeSlices]);
24126
- let sliceTime = 0;
24127
- parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
24128
- const delay = this.resolveValue(slice.delay, child, 0),
24129
- delayAfter = this.resolveValue(slice.delayAfter, child, 0),
24130
- duration = this.resolveValue(slice.duration, child, 300);
24131
- return sliceTime += delay + duration + delayAfter, Object.assign(Object.assign({}, slice), {
24132
- delay: delay,
24133
- delayAfter: delayAfter,
24134
- duration: duration
24135
- });
24136
- });
24137
- let oneByOneDelay = 0;
24138
- oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? sliceTime : 0), parsedParams.oneByOneDelay = oneByOneDelay;
24139
- let scale = 1;
24140
- if (totalTime) {
24141
- const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);
24142
- scale = totalTime ? totalTime / _totalTime : 1;
24143
- }
24144
- parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
24145
- let effects = slice.effects;
24146
- return Array.isArray(effects) || (effects = [effects]), Object.assign(Object.assign({}, slice), {
24147
- delay: slice.delay * scale,
24148
- delayAfter: slice.delayAfter * scale,
24149
- duration: slice.duration * scale,
24150
- effects: effects.map(effect => {
24151
- var _a, _b;
24152
- const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = effect.type) && void 0 !== _b ? _b : "fromTo"],
24153
- customType = custom && isFunction$7(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
24154
- return Object.assign(Object.assign({}, effect), {
24155
- custom: custom,
24156
- customType: customType
24157
- });
24158
- })
24159
- });
24160
- }), parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime * scale;
24161
- } else {
24162
- const delay = this.resolveValue(params.delay, child, 0),
24163
- delayAfter = this.resolveValue(params.delayAfter, child, 0),
24164
- duration = this.resolveValue(params.duration, child, 300);
24165
- let oneByOneDelay = 0;
24166
- oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? delay + delayAfter + duration : 0), parsedParams.oneByOneDelay = oneByOneDelay, parsedParams.custom = null !== (_a = params.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = params.type) && void 0 !== _b ? _b : "fromTo"];
24167
- const customType = parsedParams.custom && isFunction$7(parsedParams.custom) ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) ? 1 : 2 : 0;
24168
- if (parsedParams.customType = customType, totalTime) {
24169
- const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2),
24170
- scale = totalTime ? totalTime / _totalTime : 1;
24171
- parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime;
24172
- }
27101
+ onUpdate(end, ratio, out) {}
27102
+ }
27103
+ class PulseAnimate extends ACustomAnimate {
27104
+ constructor(from, to, duration, easing, params) {
27105
+ super(from, to, duration, easing, params), this.originalAttributes = {}, this.pulseCount = 3, this.pulseOpacity = .3, this.pulseScale = 1.05, this.pulseColor = null, this.pulseColorIntensity = .2, this.strokeOnly = !1, this.fillOnly = !1, this.useScale = !0, this.useOpacity = !0, this.useStroke = !0, this.useFill = !0, this.useColor = !1, this.originalFill = null, this.originalStroke = null, void 0 !== (null == params ? void 0 : params.pulseCount) && (this.pulseCount = params.pulseCount), void 0 !== (null == params ? void 0 : params.pulseScale) && (this.pulseScale = params.pulseScale), void 0 !== (null == params ? void 0 : params.pulseColor) && (this.pulseColor = params.pulseColor), void 0 !== (null == params ? void 0 : params.pulseColorIntensity) && (this.pulseColorIntensity = params.pulseColorIntensity), void 0 !== (null == params ? void 0 : params.strokeOnly) && (this.strokeOnly = params.strokeOnly), void 0 !== (null == params ? void 0 : params.fillOnly) && (this.fillOnly = params.fillOnly), void 0 !== (null == params ? void 0 : params.useScale) && (this.useScale = params.useScale), void 0 !== (null == params ? void 0 : params.useOpacity) && (this.useOpacity = params.useOpacity), void 0 !== (null == params ? void 0 : params.useStroke) && (this.useStroke = params.useStroke), void 0 !== (null == params ? void 0 : params.useFill) && (this.useFill = params.useFill), void 0 !== (null == params ? void 0 : params.useColor) && (this.useColor = params.useColor);
27106
+ }
27107
+ onBind() {
27108
+ super.onBind(), this.originalAttributes = Object.assign({}, this.target.getAttributes()), this.useColor && (this.originalFill = this.originalAttributes.fill || null, this.originalStroke = this.originalAttributes.stroke || null, this.pulseColor || (this.fillOnly && this.originalFill ? this.pulseColor = this.originalFill : this.strokeOnly && this.originalStroke ? this.pulseColor = this.originalStroke : this.originalFill ? this.pulseColor = this.originalFill : this.originalStroke ? this.pulseColor = this.originalStroke : this.pulseColor = "#FFFFFF"));
27109
+ }
27110
+ onUpdate(end, ratio, out) {
27111
+ const angle = ratio * Math.PI * this.pulseCount,
27112
+ pulseValue = Math.abs(Math.sin(angle)),
27113
+ attribute = this.target.attribute;
27114
+ if (this.useOpacity) {
27115
+ const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
27116
+ this.useStroke && (attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
24173
27117
  }
24174
- return parsedParams;
27118
+ if (this.useScale) {
27119
+ const scale = 1 + (this.pulseScale - 1) * pulseValue;
27120
+ attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale, attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
27121
+ }
27122
+ this.useColor && this.pulseColor && this.applyColorPulse(attribute, pulseValue), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
24175
27123
  }
24176
- execute(params) {
24177
- Array.isArray(params) ? params.forEach(param => this._execute(param)) : this._execute(params);
27124
+ applyColorPulse(attribute, pulseValue) {
27125
+ const colorRatio = this.pulseColorIntensity * pulseValue;
27126
+ this.useFill && this.originalFill && this.pulseColor && (attribute.fill = interpolateColor(this.originalFill, this.pulseColor, colorRatio, !0)), this.useStroke && this.originalStroke && this.pulseColor && (attribute.stroke = interpolateColor(this.originalStroke, this.pulseColor, colorRatio, !0));
24178
27127
  }
24179
- _execute(params) {
24180
- if (params.selfOnly) return this._executeItem(params, this._target, 0, 1);
24181
- const isTimeline = ("timeSlices" in params);
24182
- let filteredChildren;
24183
- isTimeline && params.partitioner && (filteredChildren = (null != filteredChildren ? filteredChildren : this._target.getChildren()).filter(child => {
24184
- var _a, _b;
24185
- return params.partitioner(null === (_b = null === (_a = child.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], child, {});
24186
- })), isTimeline && params.sort && (filteredChildren = null != filteredChildren ? filteredChildren : this._target.getChildren(), filteredChildren.sort((a, b) => {
24187
- var _a, _b, _c, _d;
24188
- return params.sort(null === (_b = null === (_a = a.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], null === (_d = null === (_c = b.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], a, b, {});
24189
- }));
24190
- const cb = isTimeline ? (child, index, count) => {
24191
- const parsedParams = this.parseParams(params, isTimeline, child),
24192
- animate = this.executeTimelineItem(parsedParams, child, index, count);
24193
- animate && this._trackAnimation(animate);
24194
- } : (child, index, count) => {
24195
- const parsedParams = this.parseParams(params, isTimeline, child),
24196
- animate = this.executeTypeConfigItem(parsedParams, child, index, count);
24197
- animate && this._trackAnimation(animate);
24198
- };
24199
- filteredChildren ? filteredChildren.forEach((child, index) => cb(child, index, filteredChildren.length)) : this._target.count <= 1 ? cb(this._target, 0, 1) : this._target.forEachChildren((child, index) => cb(child, index, this._target.count - 1));
27128
+ onEnd() {
27129
+ super.onEnd(), this.target.setAttributes(this.originalAttributes);
24200
27130
  }
24201
- executeTypeConfigItem(params, graphic, index, count) {
24202
- var _a, _b, _c, _d, _e, _f, _g, _h;
27131
+ }
27132
+
27133
+ class Update extends ACustomAnimate {
27134
+ constructor(from, to, duration, easing, params) {
27135
+ super(from, to, duration, easing, params);
27136
+ }
27137
+ onBind() {
27138
+ var _a, _b;
27139
+ super.onBind();
27140
+ let {
27141
+ diffAttrs = {}
27142
+ } = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
24203
27143
  const {
24204
- type = "fromTo",
24205
- channel: channel,
24206
- customParameters: customParameters,
24207
- easing = "linear",
24208
- delay = 0,
24209
- delayAfter = 0,
24210
- duration = 300,
24211
- startTime = 0,
24212
- oneByOneDelay = 0,
24213
- loop: loop,
24214
- bounce: bounce,
24215
- priority = 0,
24216
- options: options,
24217
- custom: custom,
24218
- customType: customType,
24219
- controlOptions: controlOptions
24220
- } = params,
24221
- animate = graphic.animate();
24222
- animate.priority = priority;
24223
- const delayValue = isFunction$7(delay) ? delay(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : delay,
24224
- datum = null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0],
24225
- indexKey = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.indexKey;
24226
- datum && indexKey && (index = null !== (_f = datum[indexKey]) && void 0 !== _f ? _f : index), animate.startAt(startTime);
24227
- const wait = index * oneByOneDelay + delayValue;
24228
- wait > 0 && animate.wait(wait);
24229
- let parsedFromProps = null,
24230
- props = params.to,
24231
- from = params.from;
24232
- props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
24233
- let totalDelay = 0;
24234
- oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
24235
- const delayAfterValue = isFunction$7(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
24236
- return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
27144
+ options: options
27145
+ } = this.params;
27146
+ diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
27147
+ delete diffAttrs[channel];
27148
+ }), this.props = diffAttrs;
24237
27149
  }
24238
- _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
24239
- var _a, _b, _c, _d;
24240
- if (custom && customType) {
24241
- const customParams = Object.assign({
24242
- width: graphic.stage.width,
24243
- height: graphic.stage.height,
24244
- group: this._target.parent
24245
- }, this.resolveValue(customParameters, graphic)),
24246
- objOptions = isFunction$7(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParams) : options;
24247
- customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
24248
- } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
27150
+ update(end, ratio, out) {
27151
+ if (this.onStart(), !this.props || !this.propKeys) return;
27152
+ const easedRatio = this.easing(ratio);
27153
+ this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
27154
+ if (!this.animate.validAttr(this.propKeys[index])) return;
27155
+ const key = this.propKeys[index];
27156
+ func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
27157
+ }), this.onUpdate(end, easedRatio, out);
24249
27158
  }
24250
- executeTimelineItem(params, graphic, index, count) {
24251
- var _a, _b, _c, _d;
27159
+ }
27160
+
27161
+ const moveIn = (graphic, options, animationParameters) => {
27162
+ var _a, _b, _c, _d;
27163
+ const {
27164
+ offset = 0,
27165
+ orient: orient,
27166
+ direction: direction,
27167
+ point: pointOpt,
27168
+ excludeChannels = [],
27169
+ layoutRect = {}
27170
+ } = null != options ? options : {};
27171
+ let changedX = 0,
27172
+ changedY = 0;
27173
+ "negative" === orient && (changedX = null !== (_a = layoutRect.width) && void 0 !== _a ? _a : graphic.stage.viewWidth, changedY = null !== (_b = layoutRect.height) && void 0 !== _b ? _b : graphic.stage.viewHeight), changedX += offset, changedY += offset;
27174
+ const point = isFunction$7(pointOpt) ? pointOpt.call(null, null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, animationParameters) : pointOpt,
27175
+ fromX = point && isValidNumber$3(point.x) ? point.x : changedX,
27176
+ fromY = point && isValidNumber$3(point.y) ? point.y : changedY,
27177
+ finalAttrs = graphic.getFinalAttribute(),
27178
+ finalAttrsX = excludeChannels.includes("x") ? graphic.attribute.x : finalAttrs.x,
27179
+ finalAttrsY = excludeChannels.includes("y") ? graphic.attribute.y : finalAttrs.y;
27180
+ switch (direction) {
27181
+ case "x":
27182
+ return {
27183
+ from: {
27184
+ x: fromX
27185
+ },
27186
+ to: {
27187
+ x: finalAttrsX
27188
+ }
27189
+ };
27190
+ case "y":
27191
+ return {
27192
+ from: {
27193
+ y: fromY
27194
+ },
27195
+ to: {
27196
+ y: finalAttrsY
27197
+ }
27198
+ };
27199
+ default:
27200
+ return {
27201
+ from: {
27202
+ x: fromX,
27203
+ y: fromY
27204
+ },
27205
+ to: {
27206
+ x: finalAttrsX,
27207
+ y: finalAttrsY
27208
+ }
27209
+ };
27210
+ }
27211
+ };
27212
+ const moveOut = (graphic, options, animationParameters) => {
27213
+ var _a, _b, _c, _d;
27214
+ const {
27215
+ offset = 0,
27216
+ orient: orient,
27217
+ direction: direction,
27218
+ point: pointOpt
27219
+ } = null != options ? options : {},
27220
+ groupBounds = animationParameters.group ? animationParameters.group.AABBBounds : null,
27221
+ groupWidth = null !== (_a = groupBounds.width()) && void 0 !== _a ? _a : animationParameters.width,
27222
+ groupHeight = null !== (_b = groupBounds.height()) && void 0 !== _b ? _b : animationParameters.height,
27223
+ changedX = ("negative" === orient ? groupWidth : 0) + offset,
27224
+ changedY = ("negative" === orient ? groupHeight : 0) + offset,
27225
+ point = isFunction$7(pointOpt) ? pointOpt.call(null, null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, animationParameters) : pointOpt,
27226
+ fromX = point && isValidNumber$3(point.x) ? point.x : changedX,
27227
+ fromY = point && isValidNumber$3(point.y) ? point.y : changedY;
27228
+ switch (direction) {
27229
+ case "x":
27230
+ return {
27231
+ from: {
27232
+ x: graphic.attribute.x
27233
+ },
27234
+ to: {
27235
+ x: fromX
27236
+ }
27237
+ };
27238
+ case "y":
27239
+ return {
27240
+ from: {
27241
+ y: graphic.attribute.y
27242
+ },
27243
+ to: {
27244
+ y: fromY
27245
+ }
27246
+ };
27247
+ default:
27248
+ return {
27249
+ from: {
27250
+ x: graphic.attribute.x,
27251
+ y: graphic.attribute.y
27252
+ },
27253
+ to: {
27254
+ x: fromX,
27255
+ y: fromY
27256
+ }
27257
+ };
27258
+ }
27259
+ };
27260
+ class MoveBase extends ACustomAnimate {
27261
+ constructor(from, to, duration, easing, params) {
27262
+ super(from, to, duration, easing, params);
27263
+ }
27264
+ onUpdate(end, ratio, out) {
27265
+ const attribute = this.target.attribute;
27266
+ this.propKeys.forEach(key => {
27267
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
27268
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
27269
+ }
27270
+ }
27271
+ class MoveIn extends MoveBase {
27272
+ onBind() {
27273
+ var _a;
27274
+ super.onBind();
24252
27275
  const {
24253
- timeSlices: timeSlices,
24254
- startTime = 0,
24255
- loop: loop,
24256
- bounce: bounce,
24257
- oneByOneDelay: oneByOneDelay,
24258
- priority: priority,
24259
- controlOptions: controlOptions
24260
- } = params,
24261
- datum = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0],
24262
- indexKey = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.indexKey;
24263
- datum && indexKey && (index = null !== (_d = datum[indexKey]) && void 0 !== _d ? _d : index);
24264
- const animate = graphic.animate();
24265
- animate.priority = priority, animate.startAt(startTime), animate.wait(index * oneByOneDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0);
24266
- return (Array.isArray(timeSlices) ? timeSlices : [timeSlices]).forEach(slice => {
24267
- this.applyTimeSliceToAnimate(slice, animate, graphic, controlOptions);
24268
- }), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
27276
+ from: from,
27277
+ to: to
27278
+ } = moveIn(this.target, this.params.options, this.params);
27279
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
27280
+ const finalAttribute = this.target.getFinalAttribute();
27281
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
24269
27282
  }
24270
- applyTimeSliceToAnimate(slice, animate, graphic, controlOptions) {
24271
- var _a, _b, _c, _d;
27283
+ }
27284
+ class MoveOut extends MoveBase {
27285
+ onBind() {
27286
+ super.onBind();
24272
27287
  const {
24273
- effects: effects,
24274
- duration = 300,
24275
- delay = 0,
24276
- delayAfter = 0
24277
- } = slice,
24278
- delayValue = isFunction$7(delay) ? delay(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : delay,
24279
- delayAfterValue = isFunction$7(delayAfter) ? delayAfter(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : delayAfter;
24280
- delayValue > 0 && animate.wait(delayValue);
24281
- (Array.isArray(effects) ? effects : [effects]).forEach(effect => {
24282
- var _a;
24283
- const {
24284
- type = "fromTo",
24285
- channel: channel,
24286
- customParameters: customParameters,
24287
- easing = "linear",
24288
- options: options
24289
- } = effect;
24290
- let parsedFromProps = null,
24291
- props = effect.to,
24292
- from = effect.from;
24293
- props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
24294
- const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
24295
- customType = effect.customType;
24296
- this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
24297
- }), delayAfterValue > 0 && animate.wait(delayAfterValue);
27288
+ from: from,
27289
+ to: to
27290
+ } = moveOut(this.target, this.params.options, this.params);
27291
+ this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
24298
27292
  }
24299
- createCustomInterpolatorAnimation(animate, interpolator, props, duration, easing, customParams) {
24300
- const to = props;
24301
- Object.keys(to).forEach(key => {
24302
- animate.target.getComputedAttribute(key);
24303
- }), animate.interpolateUpdateFunction = (from, to, ratio, step, target) => {
24304
- interpolator(ratio, from, to, step, target, animate.target, customParams);
24305
- }, animate.to(props, duration, easing);
27293
+ }
27294
+
27295
+ const rotateIn = (graphic, options) => {
27296
+ var _a;
27297
+ const attributeAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
27298
+ let angle = 0;
27299
+ return angle = isNumberClose$1(attributeAngle / (2 * Math.PI), 0) ? Math.round(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : isValidNumber$3(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(attributeAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(attributeAngle / (2 * Math.PI)) * Math.PI * 2, {
27300
+ from: {
27301
+ angle: angle
27302
+ },
27303
+ to: {
27304
+ angle: attributeAngle
27305
+ }
27306
+ };
27307
+ };
27308
+ const rotateOut = (graphic, options) => {
27309
+ var _a;
27310
+ const finalAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
27311
+ let angle = 0;
27312
+ return angle = isNumberClose$1(finalAngle / (2 * Math.PI), 0) ? Math.round(finalAngle / (2 * Math.PI)) * Math.PI * 2 : isValidNumber$3(null == options ? void 0 : options.angle) ? options.angle : "anticlockwise" === (null == options ? void 0 : options.orient) ? Math.ceil(finalAngle / (2 * Math.PI)) * Math.PI * 2 : Math.floor(finalAngle / (2 * Math.PI)) * Math.PI * 2, {
27313
+ from: {
27314
+ angle: finalAngle
27315
+ },
27316
+ to: {
27317
+ angle: angle
27318
+ }
27319
+ };
27320
+ };
27321
+ class RotateBase extends ACustomAnimate {
27322
+ constructor(from, to, duration, easing, params) {
27323
+ super(from, to, duration, easing, params);
24306
27324
  }
24307
- createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
24308
- const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
24309
- animate.play(customAnimate);
27325
+ onUpdate(end, ratio, out) {
27326
+ const attribute = this.target.attribute;
27327
+ this.propKeys.forEach(key => {
27328
+ attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
27329
+ }), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
24310
27330
  }
24311
- createPropsFromChannel(channel, graphic) {
24312
- const props = {};
24313
- let from = null;
24314
- return channel ? (Array.isArray(channel) ? channel.forEach(key => {
24315
- var _a, _b;
24316
- const value = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs) || void 0 === _b ? void 0 : _b[key];
24317
- void 0 !== value && (props[key] = value);
24318
- }) : Object.keys(channel).forEach(key => {
24319
- var _a, _b, _c, _d;
24320
- const config = channel[key];
24321
- void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : props[key] = config.to), void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : from[key] = config.from);
24322
- }), {
24323
- from: from,
24324
- props: props
24325
- }) : {
27331
+ }
27332
+ class RotateIn extends RotateBase {
27333
+ onBind() {
27334
+ var _a;
27335
+ super.onBind();
27336
+ const {
24326
27337
  from: from,
24327
- props: props
24328
- };
27338
+ to: to
27339
+ } = rotateIn(this.target, this.params.options);
27340
+ this.props = to, this.propKeys = ["angle"], this.from = from, this.to = to;
27341
+ const finalAttribute = this.target.getFinalAttribute();
27342
+ finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
24329
27343
  }
24330
- resolveValue(value, graphic, defaultValue) {
24331
- var _a, _b;
24332
- return void 0 === value ? defaultValue : "function" == typeof value && graphic ? value(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : value;
27344
+ }
27345
+ class RotateOut extends RotateBase {
27346
+ onBind() {
27347
+ super.onBind();
27348
+ const {
27349
+ from: from,
27350
+ to: to
27351
+ } = rotateOut(this.target, this.params.options);
27352
+ this.props = to, this.propKeys = ["angle"], this.from = from, this.to = to;
24333
27353
  }
24334
- executeItem(params, graphic, index = 0, count = 1) {
24335
- return Array.isArray(params) ? params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean) : [this._executeItem(params, graphic, index, count)].filter(Boolean);
27354
+ }
27355
+
27356
+ class MotionPath extends ACustomAnimate {
27357
+ constructor(from, to, duration, easing, params) {
27358
+ var _a;
27359
+ super(from, to, duration, easing, params), params && (this.pathLength = params.path.getLength(), this.path = params.path, this.distance = params.distance, this.totalLength = this.distance * this.pathLength, this.initAngle = null !== (_a = params.initAngle) && void 0 !== _a ? _a : 0, this.changeAngle = !!params.changeAngle, this.cb = params.cb);
24336
27360
  }
24337
- _executeItem(params, graphic, index = 0, count = 1) {
24338
- if (!graphic) return null;
24339
- const isTimeline = ("timeSlices" in params);
24340
- let animate = null;
24341
- const parsedParams = this.parseParams(params, isTimeline);
24342
- return animate = isTimeline ? this.executeTimelineItem(parsedParams, graphic, index, count) : this.executeTypeConfigItem(parsedParams, graphic, index, count), animate && this._trackAnimation(animate), animate;
27361
+ onBind() {
27362
+ this.from = {
27363
+ x: 0,
27364
+ y: 0
27365
+ }, this.to = this.path.getAttrAt(this.totalLength).pos, this.props = this.to;
24343
27366
  }
24344
- stop(type) {
24345
- for (; this._animates.length > 0;) {
24346
- const animate = this._animates.pop();
24347
- null == animate || animate.stop(type);
24348
- }
24349
- this._animates = [], this._activeCount = 0, this._started && (this._started = !1, this.onEnd());
27367
+ onUpdate(end, ratio, out) {
27368
+ const attrs = {},
27369
+ at = this.totalLength * ratio,
27370
+ {
27371
+ pos: pos,
27372
+ angle: angle
27373
+ } = this.path.getAttrAt(at);
27374
+ attrs.x = pos.x, attrs.y = pos.y, this.changeAngle && (attrs.angle = angle + this.initAngle), this.cb && this.cb(this.from, this.to, ratio, this.target), this.target.setAttributes(attrs);
24350
27375
  }
24351
27376
  }
24352
- AnimateExecutor.builtInAnimateMap = {};
24353
27377
 
24354
- class ACustomAnimate extends Step {
24355
- constructor(customFrom, customTo, duration, easing, params) {
24356
- super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params, this.from = customFrom, this.to = customTo;
27378
+ class FromTo extends ACustomAnimate {
27379
+ constructor(from, to, duration, easing, params) {
27380
+ super(from, to, duration, easing, params), this.from = null != from ? from : {};
27381
+ }
27382
+ onBind() {
27383
+ var _a, _b;
27384
+ super.onBind(), Object.keys(this.from).forEach(key => {
27385
+ null == this.props[key] && (this.props[key] = this.target.getGraphicAttribute(key));
27386
+ });
27387
+ const finalAttribute = this.target.getFinalAttribute();
27388
+ "appear" === (null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.animationState) && finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_b = this.params.controlOptions) || void 0 === _b ? void 0 : _b.immediatelyApply) && this.target.setAttributes(this.from);
27389
+ }
27390
+ onFirstRun() {
27391
+ this.from = Object.assign(Object.assign({}, this.getLastProps()), this.from);
27392
+ const startProps = this.animate.getStartProps();
27393
+ this.propKeys && this.propKeys.forEach(key => {
27394
+ var _a;
27395
+ this.from[key] = null !== (_a = this.from[key]) && void 0 !== _a ? _a : startProps[key];
27396
+ }), this.target.setAttributes(this.from);
27397
+ }
27398
+ deleteSelfAttr(key) {
27399
+ super.deleteSelfAttr(key), delete this.from[key];
24357
27400
  }
24358
27401
  update(end, ratio, out) {
24359
27402
  if (this.onStart(), !this.props || !this.propKeys) return;
24360
27403
  const easedRatio = this.easing(ratio);
24361
- this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
24362
- }
24363
- setProps(props) {
24364
- this.props = props, this.propKeys = Object.keys(props), this.animate.reSyncProps();
27404
+ this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
27405
+ if (!this.animate.validAttr(this.propKeys[index])) return;
27406
+ const key = this.propKeys[index];
27407
+ func(key, this.from[key], this.props[key], easedRatio, this, this.target);
27408
+ }), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
24365
27409
  }
24366
27410
  }
24367
- class AComponentAnimate extends ACustomAnimate {
24368
- completeBind(animator) {
24369
- this.setStartTime(0), this._animator && this._animator.start(), this.setDuration(animator.getDuration());
27411
+
27412
+ class StreamLight extends ACustomAnimate {
27413
+ constructor(from, to, duration, easing, params) {
27414
+ super(from, to, duration, easing, params);
24370
27415
  }
24371
- stop() {
24372
- this._animator && this._animator.stop();
27416
+ getEndProps() {
27417
+ return {};
24373
27418
  }
24374
- }
24375
-
24376
- class ComponentAnimator {
24377
- constructor(component) {
24378
- this.tasks = [], this.started = !1, this.completed = 0, this.totalDuration = 0, this.onStartCallbacks = [], this.onEndCallbacks = [], this.onUpdateCallbacks = [], this.component = component;
27419
+ onStart() {
27420
+ this.target && ("rect" === this.target.type ? this.onStartRect() : "line" === this.target.type ? this.onStartLineOrArea("line") : "area" === this.target.type && this.onStartLineOrArea("area"));
24379
27421
  }
24380
- animate(graphic, config) {
24381
- return this.started ? (this) : (this.tasks.push({
24382
- graphic: graphic,
24383
- config: config
24384
- }), this);
27422
+ onStartLineOrArea(type) {
27423
+ var _a;
27424
+ const root = this.target.attachShadow(),
27425
+ line = application.graphicService.creator[type](Object.assign({}, null === (_a = this.params) || void 0 === _a ? void 0 : _a.attribute));
27426
+ this[type] = line, line.pathProxy = new CustomPath2D(), root.add(line);
24385
27427
  }
24386
- onStart(callback) {
24387
- return this.onStartCallbacks.push(callback), this;
27428
+ onStartRect() {
27429
+ var _a, _b, _c;
27430
+ const root = this.target.attachShadow(),
27431
+ isHorizontal = null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.isHorizontal) || void 0 === _b || _b,
27432
+ sizeAttr = isHorizontal ? "height" : "width",
27433
+ otherSizeAttr = isHorizontal ? "width" : "height",
27434
+ size = this.target.AABBBounds[sizeAttr](),
27435
+ y = isHorizontal ? 0 : this.target.AABBBounds.y1,
27436
+ rect = application.graphicService.creator.rect(Object.assign(Object.assign({
27437
+ [sizeAttr]: size,
27438
+ fill: "#bcdeff",
27439
+ shadowBlur: 30,
27440
+ shadowColor: "#bcdeff"
27441
+ }, null === (_c = this.params) || void 0 === _c ? void 0 : _c.attribute), {
27442
+ x: 0,
27443
+ y: y,
27444
+ [otherSizeAttr]: 0
27445
+ }));
27446
+ this.rect = rect, root.add(rect);
24388
27447
  }
24389
- onEnd(callback) {
24390
- return this.onEndCallbacks.push(callback), this;
27448
+ onBind() {}
27449
+ onEnd() {
27450
+ this.target.detachShadow();
24391
27451
  }
24392
- onUpdate(callback) {
24393
- return this.onUpdateCallbacks.push(callback), this;
27452
+ onUpdate(end, ratio, out) {
27453
+ return this.rect ? this.onUpdateRect(end, ratio, out) : this.line || this.area ? this.onUpdateLineOrArea(end, ratio, out) : void 0;
24394
27454
  }
24395
- start() {
24396
- return this.started ? (this) : (this.started = !0, this.completed = 0, this.onStartCallbacks.forEach(callback => callback()), 0 === this.tasks.length ? (setTimeout(() => {
24397
- this.onEndCallbacks.forEach(callback => callback());
24398
- }, 0), this) : (this.tasks.forEach(task => {
24399
- const executor = new AnimateExecutor(task.graphic);
24400
- executor.onEnd(() => {
24401
- this.completed++, this.completed === this.tasks.length && this.onEndCallbacks.forEach(callback => callback());
27455
+ onUpdateRect(end, ratio, out) {
27456
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
27457
+ const isHorizontal = null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.isHorizontal) || void 0 === _b || _b,
27458
+ parentAttr = this.target.attribute;
27459
+ if (isHorizontal) {
27460
+ const parentWidth = null !== (_d = null !== (_c = parentAttr.width) && void 0 !== _c ? _c : Math.abs(parentAttr.x1 - parentAttr.x)) && void 0 !== _d ? _d : 250,
27461
+ streamLength = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.streamLength) && void 0 !== _f ? _f : parentWidth,
27462
+ maxLength = null !== (_j = null === (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.attribute) || void 0 === _h ? void 0 : _h.width) && void 0 !== _j ? _j : 60,
27463
+ startX = -maxLength,
27464
+ currentX = startX + (streamLength - startX) * ratio,
27465
+ x = Math.max(currentX, 0),
27466
+ w = Math.min(Math.min(currentX + maxLength, maxLength), streamLength - currentX),
27467
+ width = w + x > parentWidth ? Math.max(parentWidth - x, 0) : w;
27468
+ this.rect.setAttributes({
27469
+ x: x,
27470
+ width: width,
27471
+ dx: Math.min(parentAttr.x1 - parentAttr.x, 0)
27472
+ }, !1, {
27473
+ type: AttributeUpdateType.ANIMATE_PLAY,
27474
+ animationState: {
27475
+ ratio: ratio,
27476
+ end: end
27477
+ }
24402
27478
  });
24403
- const animate = executor.executeItem(task.config, task.graphic);
24404
- task.animate = animate, animate.forEach(animate => {
24405
- this.totalDuration = Math.max(this.totalDuration, animate.getStartTime() + animate.getDuration());
27479
+ } else {
27480
+ const parentHeight = null !== (_l = null !== (_k = parentAttr.height) && void 0 !== _k ? _k : Math.abs(parentAttr.y1 - parentAttr.y)) && void 0 !== _l ? _l : 250,
27481
+ streamLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.streamLength) && void 0 !== _o ? _o : parentHeight,
27482
+ maxLength = null !== (_r = null === (_q = null === (_p = this.params) || void 0 === _p ? void 0 : _p.attribute) || void 0 === _q ? void 0 : _q.height) && void 0 !== _r ? _r : 60,
27483
+ currentY = parentHeight - (streamLength + maxLength) * ratio;
27484
+ let y = Math.min(currentY, parentHeight);
27485
+ const h = Math.min(parentHeight - currentY, maxLength);
27486
+ let height;
27487
+ y <= 0 ? (height = Math.max(y + h, 0), y = 0) : height = h, this.rect.setAttributes({
27488
+ y: y,
27489
+ height: height,
27490
+ dy: Math.min(parentAttr.y1 - parentAttr.y, 0)
27491
+ }, !1, {
27492
+ type: AttributeUpdateType.ANIMATE_PLAY,
27493
+ animationState: {
27494
+ ratio: ratio,
27495
+ end: end
27496
+ }
24406
27497
  });
24407
- }), this));
27498
+ }
24408
27499
  }
24409
- deleteSelfAttr(key) {
24410
- this.tasks.forEach(task => {
24411
- task.animate && task.animate.forEach(animate => animate.preventAttr(key));
24412
- });
27500
+ onUpdateLineOrArea(end, ratio, out) {
27501
+ const target = this.line || this.area;
27502
+ if (!target) return;
27503
+ const customPath = target.pathProxy,
27504
+ targetLine = this.target;
27505
+ targetLine.cache || targetLine.cacheArea ? this._onUpdateLineOrAreaWithCache(customPath, targetLine, end, ratio, out) : this._onUpdateLineWithoutCache(customPath, targetLine, end, ratio, out);
27506
+ const targetAttrs = targetLine.attribute;
27507
+ target.setAttributes(Object.assign({
27508
+ stroke: targetAttrs.stroke
27509
+ }, target.attribute)), target.addUpdateBoundTag();
24413
27510
  }
24414
- stop(type) {
24415
- return this.tasks.forEach(task => {
24416
- task.animate && task.animate.forEach(animate => animate.stop(type));
24417
- }), this.started && this.completed !== this.tasks.length && (this.onEndCallbacks.forEach(callback => callback()), this.completed = this.tasks.length), this;
27511
+ _onUpdateLineOrAreaWithCache(customPath, g, end, ratio, out) {
27512
+ var _a, _b;
27513
+ if (customPath.clear(), "line" === g.type) {
27514
+ let cache = g.cache;
27515
+ Array.isArray(cache) || (cache = [cache]);
27516
+ const totalLen = cache.reduce((l, c) => l + c.getLength(), 0),
27517
+ curves = [];
27518
+ return cache.forEach(c => {
27519
+ c.curves.forEach(ci => curves.push(ci));
27520
+ }), this._updateCurves(customPath, curves, totalLen, ratio);
27521
+ }
27522
+ if ("area" === g.type && (null === (_b = null === (_a = g.cacheArea) || void 0 === _a ? void 0 : _a.top) || void 0 === _b ? void 0 : _b.curves)) {
27523
+ const cache = g.cacheArea,
27524
+ totalLen = cache.top.curves.reduce((a, b) => a + b.getLength(), 0);
27525
+ return this._updateCurves(customPath, cache.top.curves, totalLen, ratio);
27526
+ }
27527
+ }
27528
+ _updateCurves(customPath, curves, totalLen, ratio) {
27529
+ var _a, _b;
27530
+ const startLen = totalLen * ratio,
27531
+ endLen = Math.min(startLen + (null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.streamLength) && void 0 !== _b ? _b : 10), totalLen);
27532
+ let lastLen = 0,
27533
+ start = !1;
27534
+ for (let i = 0; i < curves.length; i++) if (!1 !== curves[i].defined) {
27535
+ const curveItem = curves[i],
27536
+ len = curveItem.getLength(),
27537
+ startPercent = 1 - (lastLen + len - startLen) / len;
27538
+ let curveForStart,
27539
+ endPercent = 1 - (lastLen + len - endLen) / len;
27540
+ if (lastLen < startLen && lastLen + len > startLen) if (start = !0, curveItem.p2 && curveItem.p3) {
27541
+ const [_, curve2] = divideCubic(curveItem, startPercent);
27542
+ customPath.moveTo(curve2.p0.x, curve2.p0.y), curveForStart = curve2;
27543
+ } else {
27544
+ const p = curveItem.getPointAt(startPercent);
27545
+ customPath.moveTo(p.x, p.y);
27546
+ }
27547
+ if (lastLen < endLen && lastLen + len > endLen) {
27548
+ if (curveItem.p2 && curveItem.p3) {
27549
+ curveForStart && (endPercent = (endLen - startLen) / curveForStart.getLength());
27550
+ const [curve1] = divideCubic(curveForStart || curveItem, endPercent);
27551
+ customPath.bezierCurveTo(curve1.p1.x, curve1.p1.y, curve1.p2.x, curve1.p2.y, curve1.p3.x, curve1.p3.y);
27552
+ } else {
27553
+ const p = curveItem.getPointAt(endPercent);
27554
+ customPath.lineTo(p.x, p.y);
27555
+ }
27556
+ break;
27557
+ }
27558
+ if (start) if (curveItem.p2 && curveItem.p3) {
27559
+ const curve = curveForStart || curveItem;
27560
+ customPath.bezierCurveTo(curve.p1.x, curve.p1.y, curve.p2.x, curve.p2.y, curve.p3.x, curve.p3.y);
27561
+ } else customPath.lineTo(curveItem.p1.x, curveItem.p1.y);
27562
+ lastLen += len;
27563
+ }
24418
27564
  }
24419
- getDuration() {
24420
- return this.totalDuration;
27565
+ _onUpdateLineWithoutCache(customPath, line, end, ratio, out) {
27566
+ var _a, _b;
27567
+ const {
27568
+ points: points,
27569
+ curveType: curveType
27570
+ } = line.attribute;
27571
+ if (!points || points.length < 2 || "linear" !== curveType) return;
27572
+ let totalLen = 0;
27573
+ for (let i = 1; i < points.length; i++) totalLen += PointService.distancePP(points[i], points[i - 1]);
27574
+ const startLen = totalLen * ratio,
27575
+ endLen = Math.min(startLen + (null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.streamLength) && void 0 !== _b ? _b : 10), totalLen),
27576
+ nextPoints = [];
27577
+ let lastLen = 0;
27578
+ for (let i = 1; i < points.length; i++) {
27579
+ const len = PointService.distancePP(points[i], points[i - 1]);
27580
+ if (lastLen < startLen && lastLen + len > startLen && nextPoints.push(PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - startLen) / len)), lastLen < endLen && lastLen + len > endLen) {
27581
+ nextPoints.push(PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - endLen) / len));
27582
+ break;
27583
+ }
27584
+ nextPoints.length && nextPoints.push(points[i]), lastLen += len;
27585
+ }
27586
+ if (nextPoints.length && !(nextPoints.length < 2)) {
27587
+ customPath.clear(), customPath.moveTo(nextPoints[0].x, nextPoints[0].y);
27588
+ for (let i = 1; i < nextPoints.length; i++) customPath.lineTo(nextPoints[i].x, nextPoints[i].y);
27589
+ }
24421
27590
  }
24422
27591
  }
24423
- function createComponentAnimator(component) {
24424
- return new ComponentAnimator(component);
24425
- }
27592
+
27593
+ const registerCustomAnimate = () => {
27594
+ AnimateExecutor.registerBuiltInAnimate("increaseCount", IncreaseCount), AnimateExecutor.registerBuiltInAnimate("fromTo", FromTo), AnimateExecutor.registerBuiltInAnimate("scaleIn", ScaleIn), AnimateExecutor.registerBuiltInAnimate("scaleOut", ScaleOut), AnimateExecutor.registerBuiltInAnimate("growHeightIn", GrowHeightIn), AnimateExecutor.registerBuiltInAnimate("growHeightOut", GrowHeightOut), AnimateExecutor.registerBuiltInAnimate("growWidthIn", GrowWidthIn), AnimateExecutor.registerBuiltInAnimate("growWidthOut", GrowWidthOut), AnimateExecutor.registerBuiltInAnimate("growCenterIn", GrowCenterIn), AnimateExecutor.registerBuiltInAnimate("growCenterOut", GrowCenterOut), AnimateExecutor.registerBuiltInAnimate("clipIn", ClipIn), AnimateExecutor.registerBuiltInAnimate("clipOut", ClipOut), AnimateExecutor.registerBuiltInAnimate("fadeIn", FadeIn), AnimateExecutor.registerBuiltInAnimate("fadeOut", FadeOut), AnimateExecutor.registerBuiltInAnimate("growPointsIn", GrowPointsIn), AnimateExecutor.registerBuiltInAnimate("growPointsOut", GrowPointsOut), AnimateExecutor.registerBuiltInAnimate("growPointsXIn", GrowPointsXIn), AnimateExecutor.registerBuiltInAnimate("growPointsXOut", GrowPointsXOut), AnimateExecutor.registerBuiltInAnimate("growPointsYIn", GrowPointsYIn), AnimateExecutor.registerBuiltInAnimate("growPointsYOut", GrowPointsYOut), AnimateExecutor.registerBuiltInAnimate("growAngleIn", GrowAngleIn), AnimateExecutor.registerBuiltInAnimate("growAngleOut", GrowAngleOut), AnimateExecutor.registerBuiltInAnimate("growRadiusIn", GrowRadiusIn), AnimateExecutor.registerBuiltInAnimate("growRadiusOut", GrowRadiusOut), AnimateExecutor.registerBuiltInAnimate("moveIn", MoveIn), AnimateExecutor.registerBuiltInAnimate("moveOut", MoveOut), AnimateExecutor.registerBuiltInAnimate("rotateIn", RotateIn), AnimateExecutor.registerBuiltInAnimate("rotateOut", RotateOut), AnimateExecutor.registerBuiltInAnimate("update", Update), AnimateExecutor.registerBuiltInAnimate("state", State), AnimateExecutor.registerBuiltInAnimate("labelItemAppear", LabelItemAppear), AnimateExecutor.registerBuiltInAnimate("labelItemDisappear", LabelItemDisappear), AnimateExecutor.registerBuiltInAnimate("poptipAppear", PoptipAppear), AnimateExecutor.registerBuiltInAnimate("poptipDisappear", PoptipDisappear), AnimateExecutor.registerBuiltInAnimate("inputText", InputText), AnimateExecutor.registerBuiltInAnimate("inputRichText", InputRichText), AnimateExecutor.registerBuiltInAnimate("outputRichText", OutputRichText), AnimateExecutor.registerBuiltInAnimate("slideRichText", SlideRichText), AnimateExecutor.registerBuiltInAnimate("slideOutRichText", SlideOutRichText), AnimateExecutor.registerBuiltInAnimate("slideIn", SlideIn), AnimateExecutor.registerBuiltInAnimate("growIn", GrowIn), AnimateExecutor.registerBuiltInAnimate("spinIn", SpinIn), AnimateExecutor.registerBuiltInAnimate("moveScaleIn", MoveScaleIn), AnimateExecutor.registerBuiltInAnimate("moveRotateIn", MoveRotateIn), AnimateExecutor.registerBuiltInAnimate("strokeIn", StrokeIn), AnimateExecutor.registerBuiltInAnimate("slideOut", SlideOut), AnimateExecutor.registerBuiltInAnimate("growOut", GrowOut), AnimateExecutor.registerBuiltInAnimate("spinOut", SpinOut), AnimateExecutor.registerBuiltInAnimate("moveScaleOut", MoveScaleOut), AnimateExecutor.registerBuiltInAnimate("moveRotateOut", MoveRotateOut), AnimateExecutor.registerBuiltInAnimate("strokeOut", StrokeOut), AnimateExecutor.registerBuiltInAnimate("pulse", PulseAnimate), AnimateExecutor.registerBuiltInAnimate("MotionPath", MotionPath), AnimateExecutor.registerBuiltInAnimate("streamLight", StreamLight);
27595
+ };
24426
27596
 
24427
27597
  class AxisEnter extends AComponentAnimate {
24428
27598
  onBind() {
@@ -31867,7 +35037,7 @@
31867
35037
  }
31868
35038
 
31869
35039
  let idCount = 1;
31870
- class ResizeObserver {
35040
+ let ResizeObserver$1 = class ResizeObserver {
31871
35041
  resizeTime = 100;
31872
35042
  element;
31873
35043
  cb;
@@ -31942,7 +35112,7 @@
31942
35112
  height: Math.floor(this.element.clientHeight)
31943
35113
  };
31944
35114
  }
31945
- }
35115
+ };
31946
35116
  class EventHandler {
31947
35117
  resizeTime;
31948
35118
  listeners = {};
@@ -31957,7 +35127,7 @@
31957
35127
  target?.addEventListener(type, listener, ...options);
31958
35128
  }
31959
35129
  else {
31960
- const resizeObserver = new ResizeObserver(target, listener, this.resizeTime);
35130
+ const resizeObserver = new ResizeObserver$1(target, listener, this.resizeTime);
31961
35131
  this.reseizeListeners[id] = resizeObserver;
31962
35132
  }
31963
35133
  }
@@ -34875,6 +38045,51 @@
34875
38045
  }
34876
38046
  return childTotalLength;
34877
38047
  }
38048
+ _setNodeStateRecursive(node, targetState) {
38049
+ if (!node) {
38050
+ return;
38051
+ }
38052
+ const children = node.filteredChildren ?? node.children;
38053
+ if (children && (Array.isArray(children) ? children.length > 0 : children === true)) {
38054
+ node.hierarchyState = targetState;
38055
+ }
38056
+ if (children && Array.isArray(children)) {
38057
+ for (const child of children) {
38058
+ this._setNodeStateRecursive(child, targetState);
38059
+ }
38060
+ }
38061
+ }
38062
+ expandAllNodes() {
38063
+ if (Array.isArray(this._source)) {
38064
+ for (const rootNode of this._source) {
38065
+ this._setNodeStateRecursive(rootNode, HierarchyState.expand);
38066
+ }
38067
+ this.hasHierarchyStateExpand = true;
38068
+ this.clearSortedIndexMap();
38069
+ this.restoreTreeHierarchyState();
38070
+ if (this.lastSortStates && this.lastSortStates.length > 0) {
38071
+ this.sort(this.lastSortStates);
38072
+ }
38073
+ else {
38074
+ this.updatePagerData();
38075
+ }
38076
+ }
38077
+ }
38078
+ collapseAllNodes() {
38079
+ if (Array.isArray(this._source)) {
38080
+ for (const rootNode of this._source) {
38081
+ this._setNodeStateRecursive(rootNode, HierarchyState.collapse);
38082
+ }
38083
+ this.clearSortedIndexMap();
38084
+ this.restoreTreeHierarchyState();
38085
+ if (this.lastSortStates && this.lastSortStates.length > 0) {
38086
+ this.sort(this.lastSortStates);
38087
+ }
38088
+ else {
38089
+ this.updatePagerData();
38090
+ }
38091
+ }
38092
+ }
34878
38093
  }
34879
38094
  function getValueFromDeepArray(array, index) {
34880
38095
  let result = array;
@@ -54886,6 +58101,7 @@
54886
58101
  sparkLine;
54887
58102
  _clearVerticalScrollBar;
54888
58103
  _clearHorizontalScrollBar;
58104
+ _frozenObserver;
54889
58105
  fastScrolling = false;
54890
58106
  checkedState = new Map();
54891
58107
  headerCheckedState = {};
@@ -55424,11 +58640,30 @@
55424
58640
  ? (this.table.rowHeaderLevelCount ?? 0) + this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount
55425
58641
  : 0;
55426
58642
  if (originalFrozenColCount) {
55427
- if (originalFrozenColCount > this.table.colCount) {
55428
- originalFrozenColCount = this.table.colCount;
58643
+ originalFrozenColCount = Math.min(originalFrozenColCount, this.table.colCount);
58644
+ const container = this.table.getContainer();
58645
+ if (container && container.clientWidth === 0) {
58646
+ if (this._frozenObserver) {
58647
+ return;
58648
+ }
58649
+ this._frozenObserver = new ResizeObserver(entries => {
58650
+ for (const entry of entries) {
58651
+ if (entry.contentRect.width > 0) {
58652
+ this.clearFrozenObserver();
58653
+ this.table.resize();
58654
+ setTimeout(() => {
58655
+ this.checkFrozen();
58656
+ }, 0);
58657
+ return;
58658
+ }
58659
+ }
58660
+ });
58661
+ this._frozenObserver.observe(container);
58662
+ return;
55429
58663
  }
58664
+ const frozenWidth = this.table.getColsWidth(0, originalFrozenColCount - 1);
55430
58665
  const maxFrozenWidth = this.table._getMaxFrozenWidth();
55431
- if (this.table.getColsWidth(0, originalFrozenColCount - 1) > maxFrozenWidth) {
58666
+ if (frozenWidth > maxFrozenWidth) {
55432
58667
  if (this.table.internalProps.unfreezeAllOnExceedsMaxWidth) {
55433
58668
  this.table._setFrozenColCount(0);
55434
58669
  this.setFrozenCol(-1);
@@ -55444,6 +58679,15 @@
55444
58679
  this.setFrozenCol(originalFrozenColCount);
55445
58680
  }
55446
58681
  }
58682
+ else {
58683
+ this.clearFrozenObserver();
58684
+ }
58685
+ }
58686
+ clearFrozenObserver() {
58687
+ if (this._frozenObserver) {
58688
+ this._frozenObserver.disconnect();
58689
+ this._frozenObserver = null;
58690
+ }
55447
58691
  }
55448
58692
  setFrozenCol(col) {
55449
58693
  if (col !== this.frozen.col) {
@@ -56815,32 +60059,13 @@
56815
60059
  else if (stateManager.interactionState === InteractionState.scrolling) {
56816
60060
  stateManager.updateInteractionState(InteractionState.default);
56817
60061
  }
56818
- if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL)) {
60062
+ if (!table.eventManager.isDraging) {
56819
60063
  const eventArgsSet = getCellEventArgsSet(e);
56820
- if (eventArgsSet.eventArgs) {
56821
- table.fireListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL, {
56822
- col: eventArgsSet.eventArgs.col,
56823
- row: eventArgsSet.eventArgs.row,
56824
- event: e.nativeEvent,
56825
- target: eventArgsSet?.eventArgs?.target,
56826
- mergeCellInfo: eventArgsSet.eventArgs?.mergeInfo
56827
- });
56828
- }
56829
- }
56830
- setTimeout(() => {
56831
- eventManager.isDown = false;
56832
- eventManager.isTouchdown = false;
56833
- eventManager.isTouchMove = false;
56834
- eventManager.isDraging = false;
56835
- eventManager.touchMovePoints = [];
56836
- }, 0);
56837
- });
56838
- table.scenegraph.tableGroup.addEventListener('rightdown', (e) => {
56839
- const eventArgsSet = getCellEventArgsSet(e);
56840
- if (eventArgsSet.eventArgs) {
56841
- stateManager.triggerContextMenu(eventArgsSet.eventArgs.col, eventArgsSet.eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
56842
- const { col, row } = eventArgsSet.eventArgs;
56843
- if (table.hasListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL)) {
60064
+ if (!eventManager.isTouchMove &&
60065
+ e.button === 0 &&
60066
+ eventArgsSet.eventArgs &&
60067
+ table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
60068
+ const { col, row } = eventArgsSet.eventArgs;
56844
60069
  const cellInfo = table.getCellInfo(col, row);
56845
60070
  let icon;
56846
60071
  let position;
@@ -56854,6 +60079,7 @@
56854
60079
  const cellsEvent = {
56855
60080
  ...cellInfo,
56856
60081
  event: e.nativeEvent,
60082
+ federatedEvent: e,
56857
60083
  cells: [],
56858
60084
  targetIcon: icon
56859
60085
  ? {
@@ -56865,11 +60091,66 @@
56865
60091
  target: eventArgsSet?.eventArgs?.target,
56866
60092
  mergeCellInfo: eventArgsSet.eventArgs?.mergeInfo
56867
60093
  };
56868
- if (cellInRanges(table.stateManager.select.ranges, col, row)) {
56869
- cellsEvent.cells = table.getSelectedCellInfos();
60094
+ table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
60095
+ }
60096
+ }
60097
+ if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL)) {
60098
+ const eventArgsSet = getCellEventArgsSet(e);
60099
+ if (eventArgsSet.eventArgs) {
60100
+ table.fireListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL, {
60101
+ col: eventArgsSet.eventArgs.col,
60102
+ row: eventArgsSet.eventArgs.row,
60103
+ event: e.nativeEvent,
60104
+ target: eventArgsSet?.eventArgs?.target,
60105
+ mergeCellInfo: eventArgsSet.eventArgs?.mergeInfo
60106
+ });
60107
+ }
60108
+ }
60109
+ setTimeout(() => {
60110
+ eventManager.isDown = false;
60111
+ eventManager.isTouchdown = false;
60112
+ eventManager.isTouchMove = false;
60113
+ eventManager.isDraging = false;
60114
+ eventManager.touchMovePoints = [];
60115
+ }, 0);
60116
+ });
60117
+ table.scenegraph.tableGroup.addEventListener('rightdown', (e) => {
60118
+ const eventArgsSet = getCellEventArgsSet(e);
60119
+ if (eventArgsSet.eventArgs) {
60120
+ stateManager.triggerContextMenu(eventArgsSet.eventArgs.col, eventArgsSet.eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
60121
+ const { col, row } = eventArgsSet.eventArgs;
60122
+ if (table.hasListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL)) {
60123
+ const cellInfo = table.getCellInfo(col, row);
60124
+ let icon;
60125
+ let position;
60126
+ if (eventArgsSet.eventArgs?.target) {
60127
+ const iconInfo = getIconAndPositionFromTarget(eventArgsSet.eventArgs?.target);
60128
+ if (iconInfo) {
60129
+ icon = iconInfo.icon;
60130
+ position = iconInfo.position;
60131
+ }
56870
60132
  }
56871
- else {
56872
- cellsEvent.cells = [[cellInfo]];
60133
+ const cellsEvent = {
60134
+ ...cellInfo,
60135
+ event: e.nativeEvent,
60136
+ cells: [],
60137
+ targetIcon: icon
60138
+ ? {
60139
+ name: icon.name,
60140
+ position: position,
60141
+ funcType: icon.attribute.funcType
60142
+ }
60143
+ : undefined,
60144
+ target: eventArgsSet?.eventArgs?.target,
60145
+ mergeCellInfo: eventArgsSet.eventArgs?.mergeInfo
60146
+ };
60147
+ if (table.options.eventOptions?.contextmenuReturnAllSelectedCells ?? true) {
60148
+ if (cellInRanges(table.stateManager.select.ranges, col, row)) {
60149
+ cellsEvent.cells = table.getSelectedCellInfos();
60150
+ }
60151
+ else {
60152
+ cellsEvent.cells = [[cellInfo]];
60153
+ }
56873
60154
  }
56874
60155
  table.fireListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL, cellsEvent);
56875
60156
  }
@@ -56880,38 +60161,6 @@
56880
60161
  return;
56881
60162
  }
56882
60163
  const eventArgsSet = getCellEventArgsSet(e);
56883
- if (!eventManager.isTouchMove &&
56884
- e.button === 0 &&
56885
- eventArgsSet.eventArgs &&
56886
- table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
56887
- const { col, row } = eventArgsSet.eventArgs;
56888
- const cellInfo = table.getCellInfo(col, row);
56889
- let icon;
56890
- let position;
56891
- if (eventArgsSet.eventArgs?.target) {
56892
- const iconInfo = getIconAndPositionFromTarget(eventArgsSet.eventArgs?.target);
56893
- if (iconInfo) {
56894
- icon = iconInfo.icon;
56895
- position = iconInfo.position;
56896
- }
56897
- }
56898
- const cellsEvent = {
56899
- ...cellInfo,
56900
- event: e.nativeEvent,
56901
- federatedEvent: e,
56902
- cells: [],
56903
- targetIcon: icon
56904
- ? {
56905
- name: icon.name,
56906
- position: position,
56907
- funcType: icon.attribute.funcType
56908
- }
56909
- : undefined,
56910
- target: eventArgsSet?.eventArgs?.target,
56911
- mergeCellInfo: eventArgsSet.eventArgs?.mergeInfo
56912
- };
56913
- table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
56914
- }
56915
60164
  if (table.stateManager.columnResize.resizing || table.stateManager.columnMove.moving) {
56916
60165
  return;
56917
60166
  }
@@ -57665,7 +60914,7 @@
57665
60914
  }
57666
60915
  }
57667
60916
  });
57668
- handler.on(table.getElement(), 'paste', (e) => {
60917
+ handler.on(table.getElement(), 'paste', async (e) => {
57669
60918
  if (table.keyboardOptions?.pasteValueToCell && table.changeCellValues) {
57670
60919
  if (table.editorManager?.editingEditor) {
57671
60920
  return;
@@ -57703,7 +60952,7 @@
57703
60952
  rowValues.push(cell);
57704
60953
  });
57705
60954
  });
57706
- const changedCellResults = table.changeCellValues(col, row, values);
60955
+ const changedCellResults = await table.changeCellValues(col, row, values);
57707
60956
  if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
57708
60957
  table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
57709
60958
  col,
@@ -57756,7 +61005,7 @@
57756
61005
  let pasteValuesRowCount = 0;
57757
61006
  let values = [];
57758
61007
  item.getType('text/html').then((blob) => {
57759
- blob.text().then((pastedData) => {
61008
+ blob.text().then(async (pastedData) => {
57760
61009
  if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
57761
61010
  const matches = Array.from(pastedData.matchAll(regex));
57762
61011
  for (const match of matches) {
@@ -57777,7 +61026,7 @@
57777
61026
  }
57778
61027
  pasteValuesRowCount = values.length ?? 0;
57779
61028
  values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
57780
- const changedCellResults = table.changeCellValues(col, row, values, true);
61029
+ const changedCellResults = await table.changeCellValues(col, row, values, true);
57781
61030
  if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
57782
61031
  table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
57783
61032
  col,
@@ -57801,7 +61050,7 @@
57801
61050
  });
57802
61051
  });
57803
61052
  }
57804
- function _pasteValue(pastedData) {
61053
+ async function _pasteValue(pastedData) {
57805
61054
  const ranges = table.stateManager.select.ranges;
57806
61055
  const selectRangeLength = ranges.length;
57807
61056
  const col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col);
@@ -57826,7 +61075,7 @@
57826
61075
  });
57827
61076
  pasteValuesRowCount = values.length ?? 0;
57828
61077
  values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
57829
- const changedCellResults = table.changeCellValues(col, row, values, true);
61078
+ const changedCellResults = await table.changeCellValues(col, row, values, true);
57830
61079
  if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
57831
61080
  table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
57832
61081
  col,
@@ -57846,7 +61095,7 @@
57846
61095
  let pasteValuesColCount = 0;
57847
61096
  let pasteValuesRowCount = 0;
57848
61097
  item.getType('text/plain').then((blob) => {
57849
- blob.text().then((pastedData) => {
61098
+ blob.text().then(async (pastedData) => {
57850
61099
  const rows = pastedData.replace(/\r(?!\n)/g, '\r\n').split('\r\n');
57851
61100
  let values = [];
57852
61101
  if (rows.length > 1 && rows[rows.length - 1] === '') {
@@ -57868,7 +61117,7 @@
57868
61117
  });
57869
61118
  pasteValuesRowCount = values.length ?? 0;
57870
61119
  values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
57871
- const changedCellResults = table.changeCellValues(col, row, values, true);
61120
+ const changedCellResults = await table.changeCellValues(col, row, values, true);
57872
61121
  if (table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA)) {
57873
61122
  table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
57874
61123
  col,
@@ -61473,6 +64722,22 @@
61473
64722
  clearNode(children);
61474
64723
  return children;
61475
64724
  }
64725
+ setAllNodesState(state) {
64726
+ this._updateNodeHierarchyState(this.tree, state);
64727
+ }
64728
+ _updateNodeHierarchyState(node, hierarchyState) {
64729
+ if (node.children && node.children.length > 0 && node.children[0].dimensionKey) {
64730
+ if (node.level !== -1) {
64731
+ node.hierarchyState = hierarchyState;
64732
+ }
64733
+ node.children.forEach(child => {
64734
+ this._updateNodeHierarchyState(child, hierarchyState);
64735
+ });
64736
+ }
64737
+ else {
64738
+ node.hierarchyState = HierarchyState.none;
64739
+ }
64740
+ }
61476
64741
  }
61477
64742
  function generateLayoutTree(tree, children) {
61478
64743
  children?.forEach((node) => {
@@ -63773,7 +67038,7 @@
63773
67038
  return TABLE_EVENT_TYPE;
63774
67039
  }
63775
67040
  options;
63776
- version = "1.19.2";
67041
+ version = "1.19.3";
63777
67042
  pagination;
63778
67043
  id = `VTable${Date.now()}`;
63779
67044
  headerStyleCache;
@@ -70254,7 +73519,7 @@
70254
73519
  table.scenegraph.updateNextFrame();
70255
73520
  }
70256
73521
  }
70257
- function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
73522
+ async function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
70258
73523
  const changedCellResults = [];
70259
73524
  let pasteColEnd = startCol;
70260
73525
  let pasteRowEnd = startRow;
@@ -70303,15 +73568,17 @@
70303
73568
  const editor = table.getEditor(startCol + j, startRow + i);
70304
73569
  const oldValue = oldValues[i][j];
70305
73570
  const value = rowValues[j];
70306
- const maybePromiseOrValue = editor?.validateValue?.(value, oldValue) ?? true;
73571
+ const maybePromiseOrValue = editor?.validateValue?.(value, oldValue, { col: startCol + j, row: startRow + i }, table) ?? true;
70307
73572
  if (isPromise(maybePromiseOrValue)) {
70308
- isCanChange = true;
73573
+ const validateResult = await maybePromiseOrValue;
73574
+ isCanChange =
73575
+ validateResult === true || validateResult === 'validate-exit' || validateResult === 'validate-not-exit';
70309
73576
  }
70310
73577
  else {
70311
73578
  isCanChange =
70312
73579
  maybePromiseOrValue === true ||
70313
73580
  maybePromiseOrValue === 'validate-exit' ||
70314
- maybePromiseOrValue === 'invalidate-exit';
73581
+ maybePromiseOrValue === 'validate-not-exit';
70315
73582
  }
70316
73583
  }
70317
73584
  }
@@ -71074,6 +74341,23 @@
71074
74341
  this.renderAsync();
71075
74342
  this.eventManager.updateEventBinder();
71076
74343
  }
74344
+ _recreateSceneForStateChange() {
74345
+ this.scenegraph.clearCells();
74346
+ const oldHoverState = { col: this.stateManager.hover.cellPos.col, row: this.stateManager.hover.cellPos.row };
74347
+ this._hasAutoImageColumn = undefined;
74348
+ this.refreshHeader();
74349
+ if (this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns)) {
74350
+ this.dataSource.processRecords(this.dataSource.dataSourceObj?.records ?? this.dataSource.dataSourceObj);
74351
+ }
74352
+ this.internalProps.useOneRowHeightFillAll = false;
74353
+ this.headerStyleCache = new Map();
74354
+ this.bodyStyleCache = new Map();
74355
+ this.bodyBottomStyleCache = new Map();
74356
+ this.scenegraph.createSceneGraph();
74357
+ this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row);
74358
+ this.renderAsync();
74359
+ this.eventManager.updateEventBinder();
74360
+ }
71077
74361
  addColumn(column) {
71078
74362
  const columns = this.options.columns;
71079
74363
  columns.push(column);
@@ -72009,6 +75293,44 @@
72009
75293
  this.editorManager.release();
72010
75294
  super.release();
72011
75295
  }
75296
+ expandAllTreeNode() {
75297
+ if (!this._hasHierarchyTreeHeader()) {
75298
+ return;
75299
+ }
75300
+ let stateChanged = false;
75301
+ if (this.dataSource && typeof this.dataSource.expandAllNodes === 'function') {
75302
+ this.dataSource.expandAllNodes();
75303
+ stateChanged = true;
75304
+ }
75305
+ if (stateChanged) {
75306
+ this._recreateSceneForStateChange();
75307
+ this.fireListeners(TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
75308
+ col: -1,
75309
+ row: -1,
75310
+ hierarchyState: HierarchyState.expand,
75311
+ originData: { children: this.records }
75312
+ });
75313
+ }
75314
+ }
75315
+ collapseAllTreeNode() {
75316
+ if (!this._hasHierarchyTreeHeader()) {
75317
+ return;
75318
+ }
75319
+ let stateChanged = false;
75320
+ if (this.dataSource && typeof this.dataSource.collapseAllNodes === 'function') {
75321
+ this.dataSource.collapseAllNodes();
75322
+ stateChanged = true;
75323
+ }
75324
+ if (stateChanged) {
75325
+ this._recreateSceneForStateChange();
75326
+ this.fireListeners(TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
75327
+ col: -1,
75328
+ row: -1,
75329
+ hierarchyState: HierarchyState.collapse,
75330
+ originData: { children: this.records }
75331
+ });
75332
+ }
75333
+ }
72012
75334
  }
72013
75335
 
72014
75336
  function isXAxis(orient) {
@@ -75755,6 +79077,10 @@
75755
79077
  const registerTooltip = () => {
75756
79078
  Factory.registerComponent('tooltipHandler', TooltipHandler);
75757
79079
  };
79080
+ const registerAnimation = () => {
79081
+ registerCustomAnimate();
79082
+ registerAnimate();
79083
+ };
75758
79084
 
75759
79085
  class ListTreeStickCellPlugin {
75760
79086
  table;
@@ -78462,6 +81788,7 @@
78462
81788
  registerTooltip();
78463
81789
  registerListTreeStickCellPlugin();
78464
81790
  registerCustomCellStylePlugin();
81791
+ registerAnimation();
78465
81792
  registerChartCell();
78466
81793
  registerCheckboxCell();
78467
81794
  registerImageCell();
@@ -80398,6 +83725,111 @@
80398
83725
  isIndicatorHeader(col, row) {
80399
83726
  return this.isColumnIndicatorHeader(col, row) || this.isRowIndicatorHeader(col, row);
80400
83727
  }
83728
+ _rebuildRowLayout() {
83729
+ this.rowDimensionTree.reset(this.rowDimensionTree.tree.children);
83730
+ this.resetRowHeaderLevelCount();
83731
+ this._rowHeaderCellFullPathIds_FULL = [];
83732
+ this.rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr();
83733
+ this.fullRowDimensionKeys = [...this.rowDimensionKeys];
83734
+ if (this.rowHierarchyType === 'tree') {
83735
+ this._addHeadersForTreeMode(this._rowHeaderCellFullPathIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, true, this.rowsDefine, this.rowHeaderObjs);
83736
+ }
83737
+ else if (this.rowHierarchyType === 'grid-tree') {
83738
+ this._addHeadersForGridTreeMode(this._rowHeaderCellFullPathIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, this._getRowHeaderTreeExpandedMaxLevelCount(), true, this.rowsDefine, this.rowHeaderObjs, true);
83739
+ this.cornerHeaderObjs = this._addCornerHeaders(this.colDimensionKeys, this.rowDimensionKeys, this.columnsDefine.concat(...this.rowsDefine));
83740
+ }
83741
+ if (this.rowHeaderTitle) {
83742
+ const id = ++this.sharedVar.seqId;
83743
+ const firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
83744
+ this._rowHeaderCellFullPathIds_FULL.unshift(firstColIds);
83745
+ const cell = {
83746
+ id,
83747
+ title: typeof this.rowHeaderTitle.title === 'string'
83748
+ ? this.rowHeaderTitle.title
83749
+ : this.rowsDefine.reduce((title, value) => {
83750
+ if (typeof value === 'string') {
83751
+ return title;
83752
+ }
83753
+ return title + (title ? `/${value.title}` : `${value.title}`);
83754
+ }, ''),
83755
+ field: undefined,
83756
+ headerType: this.rowHeaderTitle?.headerType ?? 'text',
83757
+ style: this.rowHeaderTitle?.headerStyle,
83758
+ define: {
83759
+ field: '',
83760
+ headerType: 'text',
83761
+ cellType: 'text',
83762
+ disableHeaderHover: !!this.rowHeaderTitle?.disableHeaderHover,
83763
+ disableHeaderSelect: !!this.rowHeaderTitle?.disableHeaderSelect
83764
+ }
83765
+ };
83766
+ this.rowHeaderObjs.push(cell);
83767
+ this._headerObjects[id] = cell;
83768
+ }
83769
+ this._rowHeaderCellFullPathIds_FULL = transpose(this._rowHeaderCellFullPathIds_FULL);
83770
+ if (this.rowHierarchyType === 'tree' && this.extensionRows?.length >= 1) {
83771
+ this.generateExtensionRowTree();
83772
+ }
83773
+ this.colIndex = 0;
83774
+ this._headerObjectMap = this._headerObjects.reduce((o, e) => {
83775
+ o[e.id] = e;
83776
+ return o;
83777
+ }, {});
83778
+ this._CellHeaderPathMap = new Map();
83779
+ this._largeCellRangeCache.length = 0;
83780
+ this.generateCellIdsConsiderHideHeader();
83781
+ this.setPagination(this.pagination);
83782
+ if (this.rowHierarchyType === 'grid-tree') {
83783
+ this.setColumnWidths();
83784
+ }
83785
+ }
83786
+ _rebuildColumnLayout() {
83787
+ this.columnDimensionTree.reset(this.columnDimensionTree.tree.children);
83788
+ this.resetColumnHeaderLevelCount();
83789
+ this._columnHeaderCellFullPathIds = [];
83790
+ this.colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();
83791
+ if (this.columnHierarchyType === 'grid-tree') {
83792
+ this._addHeadersForGridTreeMode(this._columnHeaderCellFullPathIds, 0, this.columnDimensionTree.tree.children, [], this.columnDimensionTree.totalLevel, this._getColumnHeaderTreeExpandedMaxLevelCount(), true, this.columnsDefine, this.columnHeaderObjs, false);
83793
+ this.cornerHeaderObjs = this._addCornerHeaders(this.colDimensionKeys, this.rowDimensionKeys, this.columnsDefine.concat(...this.rowsDefine));
83794
+ }
83795
+ if (this.columnHeaderTitle) {
83796
+ const id = ++this.sharedVar.seqId;
83797
+ const firstRowIds = Array(this.colCount - this.rowHeaderLevelCount - this.rightFrozenColCount).fill(id);
83798
+ this._columnHeaderCellFullPathIds.unshift(firstRowIds);
83799
+ const cell = {
83800
+ id,
83801
+ title: typeof this.columnHeaderTitle.title === 'string'
83802
+ ? this.columnHeaderTitle.title
83803
+ : this.columnsDefine.reduce((title, value) => {
83804
+ if (typeof value === 'string') {
83805
+ return title;
83806
+ }
83807
+ return title + (title ? `/${value.title}` : `${value.title}`);
83808
+ }, ''),
83809
+ field: undefined,
83810
+ headerType: this.columnHeaderTitle?.headerType ?? 'text',
83811
+ style: this.columnHeaderTitle?.headerStyle,
83812
+ define: {
83813
+ id,
83814
+ disableHeaderHover: !!this.columnHeaderTitle?.disableHeaderHover,
83815
+ disableHeaderSelect: !!this.columnHeaderTitle?.disableHeaderSelect
83816
+ }
83817
+ };
83818
+ this.columnHeaderObjs.push(cell);
83819
+ this._headerObjects[id] = cell;
83820
+ }
83821
+ this.colIndex = 0;
83822
+ this._headerObjectMap = this._headerObjects.reduce((o, e) => {
83823
+ o[e.id] = e;
83824
+ return o;
83825
+ }, {});
83826
+ this._CellHeaderPathMap = new Map();
83827
+ this._largeCellRangeCache.length = 0;
83828
+ this.generateCellIdsConsiderHideHeader();
83829
+ if (this.columnHierarchyType === 'grid-tree') {
83830
+ this.setColumnWidths();
83831
+ }
83832
+ }
80401
83833
  toggleHierarchyState(col, row) {
80402
83834
  this.colIndex = 0;
80403
83835
  const lastLevelIndex = (this.indicatorsAsCol ? this.rowHeaderLevelCount - 1 : this.rowHeaderLevelCount - 2) -
@@ -81865,6 +85297,30 @@
81865
85297
  }
81866
85298
  return false;
81867
85299
  }
85300
+ expandAllForRowDimensionTree() {
85301
+ if (this.rowDimensionTree) {
85302
+ this.rowDimensionTree.setAllNodesState(HierarchyState.expand);
85303
+ this._rebuildRowLayout();
85304
+ }
85305
+ }
85306
+ collapseAllForRowDimensionTree() {
85307
+ if (this.rowDimensionTree) {
85308
+ this.rowDimensionTree.setAllNodesState(HierarchyState.collapse);
85309
+ this._rebuildRowLayout();
85310
+ }
85311
+ }
85312
+ expandAllForColumnDimensionTree() {
85313
+ if (this.columnDimensionTree) {
85314
+ this.columnDimensionTree.setAllNodesState(HierarchyState.expand);
85315
+ this._rebuildColumnLayout();
85316
+ }
85317
+ }
85318
+ collapseAllForColumnDimensionTree() {
85319
+ if (this.columnDimensionTree) {
85320
+ this.columnDimensionTree.setAllNodesState(HierarchyState.collapse);
85321
+ this._rebuildColumnLayout();
85322
+ }
85323
+ }
81868
85324
  }
81869
85325
  function scaleWholeRangeSize(count, bandwidth, paddingInner, paddingOuter) {
81870
85326
  if (paddingInner === 1) {
@@ -85456,6 +88912,70 @@
85456
88912
  setLoadingHierarchyState(col, row) {
85457
88913
  this.scenegraph.setLoadingHierarchyState(col, row);
85458
88914
  }
88915
+ expandAllForRowTree() {
88916
+ if (this.rowHierarchyType !== 'tree' && this.rowHierarchyType !== 'grid-tree') {
88917
+ return;
88918
+ }
88919
+ if (this.internalProps.layoutMap.rowDimensionTree) {
88920
+ this.internalProps.layoutMap.clearHeaderPathCache();
88921
+ this.internalProps.layoutMap.expandAllForRowDimensionTree();
88922
+ this.renderWithRecreateCells();
88923
+ this.fireListeners(PIVOT_TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
88924
+ col: -1,
88925
+ row: -1,
88926
+ hierarchyState: HierarchyState.expand,
88927
+ changeAll: true
88928
+ });
88929
+ }
88930
+ }
88931
+ collapseAllForRowTree() {
88932
+ if (this.rowHierarchyType !== 'tree' && this.rowHierarchyType !== 'grid-tree') {
88933
+ return;
88934
+ }
88935
+ if (this.internalProps.layoutMap.rowDimensionTree) {
88936
+ this.internalProps.layoutMap.clearHeaderPathCache();
88937
+ this.internalProps.layoutMap.collapseAllForRowDimensionTree();
88938
+ this.renderWithRecreateCells();
88939
+ this.fireListeners(PIVOT_TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
88940
+ col: -1,
88941
+ row: -1,
88942
+ hierarchyState: HierarchyState.collapse,
88943
+ changeAll: true
88944
+ });
88945
+ }
88946
+ }
88947
+ expandAllForColumnTree() {
88948
+ if (this.columnHierarchyType !== 'grid-tree') {
88949
+ return;
88950
+ }
88951
+ if (this.internalProps.layoutMap.columnDimensionTree) {
88952
+ this.internalProps.layoutMap.clearHeaderPathCache();
88953
+ this.internalProps.layoutMap.expandAllForColumnDimensionTree();
88954
+ this.renderWithRecreateCells();
88955
+ this.fireListeners(PIVOT_TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
88956
+ col: -1,
88957
+ row: -1,
88958
+ hierarchyState: HierarchyState.expand,
88959
+ changeAll: true
88960
+ });
88961
+ }
88962
+ }
88963
+ collapseAllForColumnTree() {
88964
+ if (this.columnHierarchyType !== 'grid-tree') {
88965
+ return;
88966
+ }
88967
+ if (this.internalProps.layoutMap.columnDimensionTree) {
88968
+ this.internalProps.layoutMap.clearHeaderPathCache();
88969
+ this.internalProps.layoutMap.collapseAllForColumnDimensionTree();
88970
+ this.renderWithRecreateCells();
88971
+ this.fireListeners(PIVOT_TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
88972
+ col: -1,
88973
+ row: -1,
88974
+ hierarchyState: HierarchyState.collapse,
88975
+ changeAll: true
88976
+ });
88977
+ }
88978
+ }
85459
88979
  release() {
85460
88980
  this.internalProps.layoutMap.clearHeaderPathCache();
85461
88981
  this.editorManager.release();
@@ -85469,7 +88989,7 @@
85469
88989
  registerMenu();
85470
88990
  registerTitle();
85471
88991
  registerTooltip();
85472
- registerChartCell();
88992
+ registerAnimation();
85473
88993
  registerCheckboxCell();
85474
88994
  registerImageCell();
85475
88995
  registerProgressBarCell();
@@ -85490,6 +89010,7 @@
85490
89010
  registerMenu();
85491
89011
  registerTitle();
85492
89012
  registerTooltip();
89013
+ registerAnimation();
85493
89014
  registerChartCell();
85494
89015
  registerCheckboxCell();
85495
89016
  registerImageCell();
@@ -87190,7 +90711,7 @@
87190
90711
  }
87191
90712
 
87192
90713
  registerForVrender();
87193
- const version = "1.19.2";
90714
+ const version = "1.19.3";
87194
90715
  function getIcons() {
87195
90716
  return get$2();
87196
90717
  }
@@ -87236,6 +90757,7 @@
87236
90757
  exports.jsx = jsx;
87237
90758
  exports.plugins = index$1;
87238
90759
  exports.register = register$1;
90760
+ exports.registerAnimation = registerAnimation;
87239
90761
  exports.registerAxis = registerAxis;
87240
90762
  exports.registerButtonCell = registerButtonCell;
87241
90763
  exports.registerChartCell = registerChartCell;