@visactor/vtable-calendar 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.
- package/dist/vtable-calendar.js +3698 -417
- package/dist/vtable-calendar.min.js +1 -1
- package/package.json +2 -2
package/dist/vtable-calendar.js
CHANGED
|
@@ -667,7 +667,7 @@
|
|
|
667
667
|
decorator(target, key, paramIndex);
|
|
668
668
|
};
|
|
669
669
|
},
|
|
670
|
-
__awaiter$
|
|
670
|
+
__awaiter$c = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
671
671
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
672
672
|
function fulfilled(value) {
|
|
673
673
|
try {
|
|
@@ -833,7 +833,7 @@
|
|
|
833
833
|
return this._env || this.setEnv("browser"), this.envContribution.loadBlob(url);
|
|
834
834
|
}
|
|
835
835
|
loadFont(name, source, descriptors) {
|
|
836
|
-
return __awaiter$
|
|
836
|
+
return __awaiter$c(this, void 0, void 0, function* () {
|
|
837
837
|
return this._env || this.setEnv("browser"), this.envContribution.loadFont(name, source, descriptors);
|
|
838
838
|
});
|
|
839
839
|
}
|
|
@@ -6352,7 +6352,7 @@
|
|
|
6352
6352
|
return null;
|
|
6353
6353
|
}
|
|
6354
6354
|
|
|
6355
|
-
var __awaiter$
|
|
6355
|
+
var __awaiter$b = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
6356
6356
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6357
6357
|
function fulfilled(value) {
|
|
6358
6358
|
try {
|
|
@@ -6420,7 +6420,7 @@
|
|
|
6420
6420
|
}
|
|
6421
6421
|
}
|
|
6422
6422
|
forEachChildrenAsync(cb, reverse = !1) {
|
|
6423
|
-
return __awaiter$
|
|
6423
|
+
return __awaiter$b(this, void 0, void 0, function* () {
|
|
6424
6424
|
if (reverse) {
|
|
6425
6425
|
let child = this._lastChild,
|
|
6426
6426
|
i = 0;
|
|
@@ -15900,7 +15900,7 @@
|
|
|
15900
15900
|
container.load(envModules), container.load(textMeasureModules), container.load(layerHandlerModules);
|
|
15901
15901
|
}
|
|
15902
15902
|
|
|
15903
|
-
var __awaiter$
|
|
15903
|
+
var __awaiter$a = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
15904
15904
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15905
15905
|
function fulfilled(value) {
|
|
15906
15906
|
try {
|
|
@@ -15970,7 +15970,7 @@
|
|
|
15970
15970
|
} else graphic.forEachChildren(cb, reverse);
|
|
15971
15971
|
}
|
|
15972
15972
|
function foreachAsync(graphic, defaultZIndex, cb, reverse = !1) {
|
|
15973
|
-
return __awaiter$
|
|
15973
|
+
return __awaiter$a(this, void 0, void 0, function* () {
|
|
15974
15974
|
yield graphic.forEachChildrenAsync(cb, reverse);
|
|
15975
15975
|
});
|
|
15976
15976
|
}
|
|
@@ -16339,7 +16339,7 @@
|
|
|
16339
16339
|
decorator(target, key, paramIndex);
|
|
16340
16340
|
};
|
|
16341
16341
|
},
|
|
16342
|
-
__awaiter$
|
|
16342
|
+
__awaiter$9 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
16343
16343
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16344
16344
|
function fulfilled(value) {
|
|
16345
16345
|
try {
|
|
@@ -16374,7 +16374,7 @@
|
|
|
16374
16374
|
}, this.defaultRenderMap.set(this.lineRender.numberType, this.lineRender), this.defaultRenderMap.set(this.areaRender.numberType, this.areaRender);
|
|
16375
16375
|
}
|
|
16376
16376
|
draw(renderService, drawContext) {
|
|
16377
|
-
return __awaiter$
|
|
16377
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
16378
16378
|
if (this.checkingForDrawPromise) return;
|
|
16379
16379
|
this.lastRenderService = renderService, this.lastDrawContext = drawContext, this.checkingForDrawPromise = this.checkForDraw(drawContext);
|
|
16380
16380
|
const skipDraw = yield this.checkingForDrawPromise;
|
|
@@ -16395,15 +16395,15 @@
|
|
|
16395
16395
|
});
|
|
16396
16396
|
}
|
|
16397
16397
|
_increaseRender(group, drawContext) {
|
|
16398
|
-
return __awaiter$
|
|
16398
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
16399
16399
|
this.rendering = !0, yield this._renderIncrementalGroup(group, drawContext);
|
|
16400
16400
|
});
|
|
16401
16401
|
}
|
|
16402
16402
|
_renderIncrementalGroup(group, drawContext) {
|
|
16403
|
-
return __awaiter$
|
|
16403
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
16404
16404
|
this.count = group.count, yield new Promise(resolve => {
|
|
16405
16405
|
this.renderItem(group, drawContext, {
|
|
16406
|
-
drawingCb: () => __awaiter$
|
|
16406
|
+
drawingCb: () => __awaiter$9(this, void 0, void 0, function* () {
|
|
16407
16407
|
if (2 !== group.count) yield foreachAsync(group, DefaultAttribute.zIndex, (item, i) => {
|
|
16408
16408
|
if (this.status === STATUS.STOP) return !0;
|
|
16409
16409
|
if (item.isContainer) return !1;
|
|
@@ -16424,7 +16424,7 @@
|
|
|
16424
16424
|
});
|
|
16425
16425
|
}
|
|
16426
16426
|
waitToNextFrame() {
|
|
16427
|
-
return __awaiter$
|
|
16427
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
16428
16428
|
return new Promise(resolve => {
|
|
16429
16429
|
this.global.getRequestAnimationFrame()(() => {
|
|
16430
16430
|
resolve(!1);
|
|
@@ -16433,13 +16433,13 @@
|
|
|
16433
16433
|
});
|
|
16434
16434
|
}
|
|
16435
16435
|
checkForDraw(drawContext) {
|
|
16436
|
-
return __awaiter$
|
|
16436
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
16437
16437
|
let skip = this.rendering;
|
|
16438
16438
|
return drawContext.restartIncremental && (skip = !1, yield this.forceStop(), this.resetToInit()), skip;
|
|
16439
16439
|
});
|
|
16440
16440
|
}
|
|
16441
16441
|
forceStop() {
|
|
16442
|
-
return __awaiter$
|
|
16442
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
16443
16443
|
this.rendering && (this.status = STATUS.STOP, yield new Promise(resolve => {
|
|
16444
16444
|
this.hooks.completeDraw.tap("stopCb", () => {
|
|
16445
16445
|
this.status = STATUS.NORMAL, this.hooks.completeDraw.taps = this.hooks.completeDraw.taps.filter(item => "stopCb" !== item.name), resolve(!1);
|
|
@@ -16451,11 +16451,11 @@
|
|
|
16451
16451
|
this.currFrameStartAt = 0, this.currentIdx = 0;
|
|
16452
16452
|
}
|
|
16453
16453
|
renderGroup(group, drawContext) {
|
|
16454
|
-
return __awaiter$
|
|
16454
|
+
return __awaiter$9(this, void 0, void 0, function* () {
|
|
16455
16455
|
if (!drawContext.break && !1 !== group.attribute.visibleAll) return group.incremental && drawContext.startAtId === group._uid ? (yield this._increaseRender(group, drawContext), void (drawContext.break = !0)) : void (yield new Promise(resolve => {
|
|
16456
16456
|
this.renderItem(group, drawContext, {
|
|
16457
|
-
drawingCb: () => __awaiter$
|
|
16458
|
-
yield foreachAsync(group, DefaultAttribute.zIndex, item => __awaiter$
|
|
16457
|
+
drawingCb: () => __awaiter$9(this, void 0, void 0, function* () {
|
|
16458
|
+
yield foreachAsync(group, DefaultAttribute.zIndex, item => __awaiter$9(this, void 0, void 0, function* () {
|
|
16459
16459
|
drawContext.break || item.isContainer && (yield this.renderGroup(item, drawContext));
|
|
16460
16460
|
})), resolve(!1);
|
|
16461
16461
|
})
|
|
@@ -17182,7 +17182,7 @@
|
|
|
17182
17182
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
17183
17183
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
17184
17184
|
},
|
|
17185
|
-
__awaiter$
|
|
17185
|
+
__awaiter$8 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
17186
17186
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17187
17187
|
function fulfilled(value) {
|
|
17188
17188
|
try {
|
|
@@ -17276,7 +17276,7 @@
|
|
|
17276
17276
|
};
|
|
17277
17277
|
}
|
|
17278
17278
|
loadFont(font, source, descriptors) {
|
|
17279
|
-
return __awaiter$
|
|
17279
|
+
return __awaiter$8(this, void 0, void 0, function* () {
|
|
17280
17280
|
return {
|
|
17281
17281
|
loadState: "fail"
|
|
17282
17282
|
};
|
|
@@ -19112,7 +19112,7 @@
|
|
|
19112
19112
|
__metadata$k = undefined && undefined.__metadata || function (k, v) {
|
|
19113
19113
|
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
19114
19114
|
},
|
|
19115
|
-
__awaiter$
|
|
19115
|
+
__awaiter$7 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
19116
19116
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19117
19117
|
function fulfilled(value) {
|
|
19118
19118
|
try {
|
|
@@ -19331,7 +19331,7 @@
|
|
|
19331
19331
|
};
|
|
19332
19332
|
}
|
|
19333
19333
|
loadFont(font, source, descriptors) {
|
|
19334
|
-
return __awaiter$
|
|
19334
|
+
return __awaiter$7(this, void 0, void 0, function* () {
|
|
19335
19335
|
return new FontFace(font, isString$6(source) ? `url(${source})` : source, descriptors).load().then(function (loadedFont) {
|
|
19336
19336
|
return document.fonts.add(loadedFont), {
|
|
19337
19337
|
loadState: "success"
|
|
@@ -23994,6 +23994,103 @@
|
|
|
23994
23994
|
}
|
|
23995
23995
|
}
|
|
23996
23996
|
|
|
23997
|
+
class AnimationTransitionRegistry {
|
|
23998
|
+
constructor() {
|
|
23999
|
+
this.transitions = new Map(), this.registerDefaultTransitions();
|
|
24000
|
+
}
|
|
24001
|
+
static getInstance() {
|
|
24002
|
+
return AnimationTransitionRegistry.instance || (AnimationTransitionRegistry.instance = new AnimationTransitionRegistry()), AnimationTransitionRegistry.instance;
|
|
24003
|
+
}
|
|
24004
|
+
registerDefaultTransitions() {
|
|
24005
|
+
this.registerTransition("appear", "*", () => ({
|
|
24006
|
+
allowTransition: !0,
|
|
24007
|
+
stopOriginalTransition: !1
|
|
24008
|
+
})), this.registerTransition("appear", "appear", () => ({
|
|
24009
|
+
allowTransition: !1,
|
|
24010
|
+
stopOriginalTransition: !1
|
|
24011
|
+
})), this.registerTransition("appear", "disappear", () => ({
|
|
24012
|
+
allowTransition: !0,
|
|
24013
|
+
stopOriginalTransition: !0
|
|
24014
|
+
})), this.registerTransition("appear", "exit", () => ({
|
|
24015
|
+
allowTransition: !0,
|
|
24016
|
+
stopOriginalTransition: !0
|
|
24017
|
+
})), this.registerTransition("normal", "*", () => ({
|
|
24018
|
+
allowTransition: !0,
|
|
24019
|
+
stopOriginalTransition: !1
|
|
24020
|
+
})), this.registerTransition("normal", "normal", () => ({
|
|
24021
|
+
allowTransition: !1,
|
|
24022
|
+
stopOriginalTransition: !1
|
|
24023
|
+
})), this.registerTransition("normal", "disappear", () => ({
|
|
24024
|
+
allowTransition: !0,
|
|
24025
|
+
stopOriginalTransition: !0
|
|
24026
|
+
})), this.registerTransition("normal", "exit", () => ({
|
|
24027
|
+
allowTransition: !0,
|
|
24028
|
+
stopOriginalTransition: !0
|
|
24029
|
+
})), this.registerTransition("exit", "*", () => ({
|
|
24030
|
+
allowTransition: !1,
|
|
24031
|
+
stopOriginalTransition: !1
|
|
24032
|
+
})), this.registerTransition("exit", "disappear", () => ({
|
|
24033
|
+
allowTransition: !0,
|
|
24034
|
+
stopOriginalTransition: !0
|
|
24035
|
+
})), this.registerTransition("exit", "enter", () => ({
|
|
24036
|
+
allowTransition: !0,
|
|
24037
|
+
stopOriginalTransition: !0
|
|
24038
|
+
})), this.registerTransition("exit", "exit", () => ({
|
|
24039
|
+
allowTransition: !1,
|
|
24040
|
+
stopOriginalTransition: !1
|
|
24041
|
+
})), this.registerTransition("enter", "*", () => ({
|
|
24042
|
+
allowTransition: !0,
|
|
24043
|
+
stopOriginalTransition: !1
|
|
24044
|
+
})), this.registerTransition("enter", "enter", () => ({
|
|
24045
|
+
allowTransition: !1,
|
|
24046
|
+
stopOriginalTransition: !1
|
|
24047
|
+
})), this.registerTransition("enter", "disappear", () => ({
|
|
24048
|
+
allowTransition: !0,
|
|
24049
|
+
stopOriginalTransition: !0
|
|
24050
|
+
})), this.registerTransition("enter", "exit", () => ({
|
|
24051
|
+
allowTransition: !0,
|
|
24052
|
+
stopOriginalTransition: !0
|
|
24053
|
+
})), this.registerTransition("disappear", "*", () => ({
|
|
24054
|
+
allowTransition: !1,
|
|
24055
|
+
stopOriginalTransition: !1
|
|
24056
|
+
})), this.registerTransition("disappear", "appear", () => ({
|
|
24057
|
+
allowTransition: !0,
|
|
24058
|
+
stopOriginalTransition: !0
|
|
24059
|
+
})), this.registerTransition("update", "*", () => ({
|
|
24060
|
+
allowTransition: !0,
|
|
24061
|
+
stopOriginalTransition: !1
|
|
24062
|
+
})), this.registerTransition("update", "disappear", () => ({
|
|
24063
|
+
allowTransition: !0,
|
|
24064
|
+
stopOriginalTransition: !0
|
|
24065
|
+
})), this.registerTransition("update", "exit", () => ({
|
|
24066
|
+
allowTransition: !0,
|
|
24067
|
+
stopOriginalTransition: !0
|
|
24068
|
+
})), this.registerTransition("state", "*", () => ({
|
|
24069
|
+
allowTransition: !0,
|
|
24070
|
+
stopOriginalTransition: !1
|
|
24071
|
+
})), this.registerTransition("state", "disappear", () => ({
|
|
24072
|
+
allowTransition: !0,
|
|
24073
|
+
stopOriginalTransition: !0
|
|
24074
|
+
})), this.registerTransition("state", "exit", () => ({
|
|
24075
|
+
allowTransition: !0,
|
|
24076
|
+
stopOriginalTransition: !0
|
|
24077
|
+
}));
|
|
24078
|
+
}
|
|
24079
|
+
isTransitionAllowed(fromState, toState, graphic) {
|
|
24080
|
+
var _a, _b, _c, _d;
|
|
24081
|
+
let func = null === (_a = this.transitions.get(fromState)) || void 0 === _a ? void 0 : _a.get(toState);
|
|
24082
|
+
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) : {
|
|
24083
|
+
allowTransition: !0,
|
|
24084
|
+
stopOriginalTransition: !0
|
|
24085
|
+
})));
|
|
24086
|
+
}
|
|
24087
|
+
registerTransition(fromState, toState, transition) {
|
|
24088
|
+
let fromStateMap = this.transitions.get(fromState);
|
|
24089
|
+
fromStateMap || (fromStateMap = new Map(), this.transitions.set(fromState, fromStateMap)), fromStateMap.set(toState, transition);
|
|
24090
|
+
}
|
|
24091
|
+
}
|
|
24092
|
+
AnimationTransitionRegistry.getInstance();
|
|
24093
|
+
|
|
23997
24094
|
class AnimateExecutor {
|
|
23998
24095
|
static registerBuiltInAnimate(name, animate) {
|
|
23999
24096
|
AnimateExecutor.builtInAnimateMap[name] = animate;
|
|
@@ -24078,256 +24175,3329 @@
|
|
|
24078
24175
|
}
|
|
24079
24176
|
return parsedParams;
|
|
24080
24177
|
}
|
|
24081
|
-
execute(params) {
|
|
24082
|
-
Array.isArray(params) ? params.forEach(param => this._execute(param)) : this._execute(params);
|
|
24178
|
+
execute(params) {
|
|
24179
|
+
Array.isArray(params) ? params.forEach(param => this._execute(param)) : this._execute(params);
|
|
24180
|
+
}
|
|
24181
|
+
_execute(params) {
|
|
24182
|
+
if (params.selfOnly) return this._executeItem(params, this._target, 0, 1);
|
|
24183
|
+
const isTimeline = ("timeSlices" in params);
|
|
24184
|
+
let filteredChildren;
|
|
24185
|
+
isTimeline && params.partitioner && (filteredChildren = (null != filteredChildren ? filteredChildren : this._target.getChildren()).filter(child => {
|
|
24186
|
+
var _a, _b;
|
|
24187
|
+
return params.partitioner(null === (_b = null === (_a = child.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], child, {});
|
|
24188
|
+
})), isTimeline && params.sort && (filteredChildren = null != filteredChildren ? filteredChildren : this._target.getChildren(), filteredChildren.sort((a, b) => {
|
|
24189
|
+
var _a, _b, _c, _d;
|
|
24190
|
+
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, {});
|
|
24191
|
+
}));
|
|
24192
|
+
const cb = isTimeline ? (child, index, count) => {
|
|
24193
|
+
const parsedParams = this.parseParams(params, isTimeline, child),
|
|
24194
|
+
animate = this.executeTimelineItem(parsedParams, child, index, count);
|
|
24195
|
+
animate && this._trackAnimation(animate);
|
|
24196
|
+
} : (child, index, count) => {
|
|
24197
|
+
const parsedParams = this.parseParams(params, isTimeline, child),
|
|
24198
|
+
animate = this.executeTypeConfigItem(parsedParams, child, index, count);
|
|
24199
|
+
animate && this._trackAnimation(animate);
|
|
24200
|
+
};
|
|
24201
|
+
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));
|
|
24202
|
+
}
|
|
24203
|
+
executeTypeConfigItem(params, graphic, index, count) {
|
|
24204
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
24205
|
+
const {
|
|
24206
|
+
type = "fromTo",
|
|
24207
|
+
channel: channel,
|
|
24208
|
+
customParameters: customParameters,
|
|
24209
|
+
easing = "linear",
|
|
24210
|
+
delay = 0,
|
|
24211
|
+
delayAfter = 0,
|
|
24212
|
+
duration = 300,
|
|
24213
|
+
startTime = 0,
|
|
24214
|
+
oneByOneDelay = 0,
|
|
24215
|
+
loop: loop,
|
|
24216
|
+
bounce: bounce,
|
|
24217
|
+
priority = 0,
|
|
24218
|
+
options: options,
|
|
24219
|
+
custom: custom,
|
|
24220
|
+
customType: customType,
|
|
24221
|
+
controlOptions: controlOptions
|
|
24222
|
+
} = params,
|
|
24223
|
+
animate = graphic.animate();
|
|
24224
|
+
animate.priority = priority;
|
|
24225
|
+
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,
|
|
24226
|
+
datum = null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0],
|
|
24227
|
+
indexKey = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.indexKey;
|
|
24228
|
+
datum && indexKey && (index = null !== (_f = datum[indexKey]) && void 0 !== _f ? _f : index), animate.startAt(startTime);
|
|
24229
|
+
const wait = index * oneByOneDelay + delayValue;
|
|
24230
|
+
wait > 0 && animate.wait(wait);
|
|
24231
|
+
let parsedFromProps = null,
|
|
24232
|
+
props = params.to,
|
|
24233
|
+
from = params.from;
|
|
24234
|
+
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);
|
|
24235
|
+
let totalDelay = 0;
|
|
24236
|
+
oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
|
|
24237
|
+
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;
|
|
24238
|
+
return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
|
|
24239
|
+
}
|
|
24240
|
+
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
|
|
24241
|
+
var _a, _b, _c, _d;
|
|
24242
|
+
if (custom && customType) {
|
|
24243
|
+
const customParams = Object.assign({
|
|
24244
|
+
width: graphic.stage.width,
|
|
24245
|
+
height: graphic.stage.height,
|
|
24246
|
+
group: this._target.parent
|
|
24247
|
+
}, this.resolveValue(customParameters, graphic)),
|
|
24248
|
+
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;
|
|
24249
|
+
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);
|
|
24250
|
+
} else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
|
|
24251
|
+
}
|
|
24252
|
+
executeTimelineItem(params, graphic, index, count) {
|
|
24253
|
+
var _a, _b, _c, _d;
|
|
24254
|
+
const {
|
|
24255
|
+
timeSlices: timeSlices,
|
|
24256
|
+
startTime = 0,
|
|
24257
|
+
loop: loop,
|
|
24258
|
+
bounce: bounce,
|
|
24259
|
+
oneByOneDelay: oneByOneDelay,
|
|
24260
|
+
priority: priority,
|
|
24261
|
+
controlOptions: controlOptions
|
|
24262
|
+
} = params,
|
|
24263
|
+
datum = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0],
|
|
24264
|
+
indexKey = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.indexKey;
|
|
24265
|
+
datum && indexKey && (index = null !== (_d = datum[indexKey]) && void 0 !== _d ? _d : index);
|
|
24266
|
+
const animate = graphic.animate();
|
|
24267
|
+
animate.priority = priority, animate.startAt(startTime), animate.wait(index * oneByOneDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0);
|
|
24268
|
+
return (Array.isArray(timeSlices) ? timeSlices : [timeSlices]).forEach(slice => {
|
|
24269
|
+
this.applyTimeSliceToAnimate(slice, animate, graphic, controlOptions);
|
|
24270
|
+
}), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
|
|
24271
|
+
}
|
|
24272
|
+
applyTimeSliceToAnimate(slice, animate, graphic, controlOptions) {
|
|
24273
|
+
var _a, _b, _c, _d;
|
|
24274
|
+
const {
|
|
24275
|
+
effects: effects,
|
|
24276
|
+
duration = 300,
|
|
24277
|
+
delay = 0,
|
|
24278
|
+
delayAfter = 0
|
|
24279
|
+
} = slice,
|
|
24280
|
+
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,
|
|
24281
|
+
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;
|
|
24282
|
+
delayValue > 0 && animate.wait(delayValue);
|
|
24283
|
+
(Array.isArray(effects) ? effects : [effects]).forEach(effect => {
|
|
24284
|
+
var _a;
|
|
24285
|
+
const {
|
|
24286
|
+
type = "fromTo",
|
|
24287
|
+
channel: channel,
|
|
24288
|
+
customParameters: customParameters,
|
|
24289
|
+
easing = "linear",
|
|
24290
|
+
options: options
|
|
24291
|
+
} = effect;
|
|
24292
|
+
let parsedFromProps = null,
|
|
24293
|
+
props = effect.to,
|
|
24294
|
+
from = effect.from;
|
|
24295
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
|
|
24296
|
+
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
24297
|
+
customType = effect.customType;
|
|
24298
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
24299
|
+
}), delayAfterValue > 0 && animate.wait(delayAfterValue);
|
|
24300
|
+
}
|
|
24301
|
+
createCustomInterpolatorAnimation(animate, interpolator, props, duration, easing, customParams) {
|
|
24302
|
+
const to = props;
|
|
24303
|
+
Object.keys(to).forEach(key => {
|
|
24304
|
+
animate.target.getComputedAttribute(key);
|
|
24305
|
+
}), animate.interpolateUpdateFunction = (from, to, ratio, step, target) => {
|
|
24306
|
+
interpolator(ratio, from, to, step, target, animate.target, customParams);
|
|
24307
|
+
}, animate.to(props, duration, easing);
|
|
24308
|
+
}
|
|
24309
|
+
createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
|
|
24310
|
+
const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
|
|
24311
|
+
animate.play(customAnimate);
|
|
24312
|
+
}
|
|
24313
|
+
createPropsFromChannel(channel, graphic) {
|
|
24314
|
+
const props = {};
|
|
24315
|
+
let from = null;
|
|
24316
|
+
return channel ? (Array.isArray(channel) ? channel.forEach(key => {
|
|
24317
|
+
var _a, _b;
|
|
24318
|
+
const value = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs) || void 0 === _b ? void 0 : _b[key];
|
|
24319
|
+
void 0 !== value && (props[key] = value);
|
|
24320
|
+
}) : Object.keys(channel).forEach(key => {
|
|
24321
|
+
var _a, _b, _c, _d;
|
|
24322
|
+
const config = channel[key];
|
|
24323
|
+
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);
|
|
24324
|
+
}), {
|
|
24325
|
+
from: from,
|
|
24326
|
+
props: props
|
|
24327
|
+
}) : {
|
|
24328
|
+
from: from,
|
|
24329
|
+
props: props
|
|
24330
|
+
};
|
|
24331
|
+
}
|
|
24332
|
+
resolveValue(value, graphic, defaultValue) {
|
|
24333
|
+
var _a, _b;
|
|
24334
|
+
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;
|
|
24335
|
+
}
|
|
24336
|
+
executeItem(params, graphic, index = 0, count = 1) {
|
|
24337
|
+
return Array.isArray(params) ? params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean) : [this._executeItem(params, graphic, index, count)].filter(Boolean);
|
|
24338
|
+
}
|
|
24339
|
+
_executeItem(params, graphic, index = 0, count = 1) {
|
|
24340
|
+
if (!graphic) return null;
|
|
24341
|
+
const isTimeline = ("timeSlices" in params);
|
|
24342
|
+
let animate = null;
|
|
24343
|
+
const parsedParams = this.parseParams(params, isTimeline);
|
|
24344
|
+
return animate = isTimeline ? this.executeTimelineItem(parsedParams, graphic, index, count) : this.executeTypeConfigItem(parsedParams, graphic, index, count), animate && this._trackAnimation(animate), animate;
|
|
24345
|
+
}
|
|
24346
|
+
stop(type) {
|
|
24347
|
+
for (; this._animates.length > 0;) {
|
|
24348
|
+
const animate = this._animates.pop();
|
|
24349
|
+
null == animate || animate.stop(type);
|
|
24350
|
+
}
|
|
24351
|
+
this._animates = [], this._activeCount = 0, this._started && (this._started = !1, this.onEnd());
|
|
24352
|
+
}
|
|
24353
|
+
}
|
|
24354
|
+
AnimateExecutor.builtInAnimateMap = {};
|
|
24355
|
+
|
|
24356
|
+
const AnimationStates = {
|
|
24357
|
+
APPEAR: "appear",
|
|
24358
|
+
DISAPPEAR: "disappear",
|
|
24359
|
+
UPDATE: "update",
|
|
24360
|
+
HIGHLIGHT: "highlight",
|
|
24361
|
+
UNHIGHLIGHT: "unhighlight",
|
|
24362
|
+
SELECT: "select",
|
|
24363
|
+
UNSELECT: "unselect",
|
|
24364
|
+
HOVER: "hover",
|
|
24365
|
+
UNHOVER: "unhover",
|
|
24366
|
+
ACTIVE: "active",
|
|
24367
|
+
INACTIVE: "inactive"
|
|
24368
|
+
};
|
|
24369
|
+
class AnimationStateStore {
|
|
24370
|
+
constructor(graphic) {
|
|
24371
|
+
this.graphic = graphic;
|
|
24372
|
+
}
|
|
24373
|
+
registerState(state) {
|
|
24374
|
+
this.states || (this.states = new Map()), this.states.set(state.name, state);
|
|
24375
|
+
}
|
|
24376
|
+
clearStates() {
|
|
24377
|
+
var _a;
|
|
24378
|
+
null === (_a = this.states) || void 0 === _a || _a.clear();
|
|
24379
|
+
}
|
|
24380
|
+
}
|
|
24381
|
+
class AnimationStateManager {
|
|
24382
|
+
constructor(graphic) {
|
|
24383
|
+
this.stateList = null, this.graphic = graphic;
|
|
24384
|
+
}
|
|
24385
|
+
applyState(nextState, animationConfig, callback) {
|
|
24386
|
+
const registry = AnimationTransitionRegistry.getInstance(),
|
|
24387
|
+
shouldStopState = [],
|
|
24388
|
+
shouldApplyState = [];
|
|
24389
|
+
if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
|
|
24390
|
+
const result = {
|
|
24391
|
+
allowTransition: !0,
|
|
24392
|
+
stopOriginalTransition: !0
|
|
24393
|
+
};
|
|
24394
|
+
this.stateList.forEach(currState => {
|
|
24395
|
+
const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
|
|
24396
|
+
result.allowTransition = result.allowTransition && _result.allowTransition;
|
|
24397
|
+
}), result.allowTransition && (shouldApplyState.push({
|
|
24398
|
+
state: state,
|
|
24399
|
+
animationConfig: isArray$9(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
24400
|
+
executor: new AnimateExecutor(this.graphic)
|
|
24401
|
+
}), this.stateList.forEach(currState => {
|
|
24402
|
+
registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
|
|
24403
|
+
}));
|
|
24404
|
+
}) : nextState.forEach((state, index) => {
|
|
24405
|
+
shouldApplyState.push({
|
|
24406
|
+
state: state,
|
|
24407
|
+
animationConfig: isArray$9(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
24408
|
+
executor: new AnimateExecutor(this.graphic)
|
|
24409
|
+
});
|
|
24410
|
+
}), shouldStopState.forEach(state => {
|
|
24411
|
+
state.executor.stop();
|
|
24412
|
+
}), shouldApplyState.length) {
|
|
24413
|
+
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
|
|
24414
|
+
for (let i = 0; i < shouldApplyState.length; i++) {
|
|
24415
|
+
const nextState = shouldApplyState[i + 1],
|
|
24416
|
+
currentState = shouldApplyState[i];
|
|
24417
|
+
currentState.executor.onEnd(() => {
|
|
24418
|
+
nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
|
|
24419
|
+
});
|
|
24420
|
+
}
|
|
24421
|
+
} else callback && callback(!0);
|
|
24422
|
+
this.stateList ? this.stateList = this.stateList.filter(state => !shouldStopState.includes(state)) : this.stateList = [], this.stateList.push(...shouldApplyState);
|
|
24423
|
+
}
|
|
24424
|
+
applyAppearState(animationConfig, callback) {
|
|
24425
|
+
this.applyState([AnimationStates.APPEAR], [{
|
|
24426
|
+
name: AnimationStates.APPEAR,
|
|
24427
|
+
animation: animationConfig
|
|
24428
|
+
}], callback);
|
|
24429
|
+
}
|
|
24430
|
+
applyDisappearState(animationConfig, callback) {
|
|
24431
|
+
this.applyState([AnimationStates.DISAPPEAR], [{
|
|
24432
|
+
name: AnimationStates.DISAPPEAR,
|
|
24433
|
+
animation: animationConfig
|
|
24434
|
+
}], callback);
|
|
24435
|
+
}
|
|
24436
|
+
applyUpdateState(animationConfig, callback) {
|
|
24437
|
+
this.applyState([AnimationStates.UPDATE], [{
|
|
24438
|
+
name: AnimationStates.UPDATE,
|
|
24439
|
+
animation: animationConfig
|
|
24440
|
+
}], callback);
|
|
24441
|
+
}
|
|
24442
|
+
applyHighlightState(animationConfig, callback) {
|
|
24443
|
+
this.applyState([AnimationStates.HIGHLIGHT], [{
|
|
24444
|
+
name: AnimationStates.HIGHLIGHT,
|
|
24445
|
+
animation: animationConfig
|
|
24446
|
+
}], callback);
|
|
24447
|
+
}
|
|
24448
|
+
applyUnhighlightState(animationConfig, callback) {
|
|
24449
|
+
this.applyState([AnimationStates.UNHIGHLIGHT], [{
|
|
24450
|
+
name: AnimationStates.UNHIGHLIGHT,
|
|
24451
|
+
animation: animationConfig
|
|
24452
|
+
}], callback);
|
|
24453
|
+
}
|
|
24454
|
+
stopState(state, type) {
|
|
24455
|
+
var _a;
|
|
24456
|
+
const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
|
|
24457
|
+
stateInfo && stateInfo.executor.stop(type);
|
|
24458
|
+
}
|
|
24459
|
+
clearState() {
|
|
24460
|
+
var _a;
|
|
24461
|
+
null === (_a = this.stateList) || void 0 === _a || _a.forEach(state => {
|
|
24462
|
+
state.executor.stop();
|
|
24463
|
+
}), this.stateList = null;
|
|
24464
|
+
}
|
|
24465
|
+
}
|
|
24466
|
+
|
|
24467
|
+
class GraphicStateExtension {
|
|
24468
|
+
_getAnimationStateManager(graphic) {
|
|
24469
|
+
return graphic._animationStateManager || (graphic._animationStateManager = new AnimationStateManager(graphic)), graphic._animationStateManager;
|
|
24470
|
+
}
|
|
24471
|
+
_getAnimationStateStore(graphic) {
|
|
24472
|
+
return graphic._animationStateStore || (graphic._animationStateStore = new AnimationStateStore(graphic)), graphic._animationStateStore;
|
|
24473
|
+
}
|
|
24474
|
+
registerAnimationState(state) {
|
|
24475
|
+
return this._getAnimationStateStore(this).registerState(state), this;
|
|
24476
|
+
}
|
|
24477
|
+
applyAnimationState(state, animationConfig, callback) {
|
|
24478
|
+
return this._getAnimationStateManager(this).applyState(state, animationConfig, callback), this;
|
|
24479
|
+
}
|
|
24480
|
+
applyAppearState(animationConfig, callback) {
|
|
24481
|
+
return this._getAnimationStateManager(this).applyAppearState(animationConfig, callback), this;
|
|
24482
|
+
}
|
|
24483
|
+
applyDisappearState(animationConfig, callback) {
|
|
24484
|
+
return this._getAnimationStateManager(this).applyDisappearState(animationConfig, callback), this;
|
|
24485
|
+
}
|
|
24486
|
+
applyUpdateState(animationConfig, callback) {
|
|
24487
|
+
return this._getAnimationStateManager(this).applyUpdateState(animationConfig, callback), this;
|
|
24488
|
+
}
|
|
24489
|
+
applyHighlightState(animationConfig, callback) {
|
|
24490
|
+
return this._getAnimationStateManager(this).applyHighlightState(animationConfig, callback), this;
|
|
24491
|
+
}
|
|
24492
|
+
applyUnhighlightState(animationConfig, callback) {
|
|
24493
|
+
return this._getAnimationStateManager(this).applyUnhighlightState(animationConfig, callback), this;
|
|
24494
|
+
}
|
|
24495
|
+
stopAnimationState(state, type) {
|
|
24496
|
+
return this._getAnimationStateManager(this).stopState(state, type), this;
|
|
24497
|
+
}
|
|
24498
|
+
clearAnimationStates() {
|
|
24499
|
+
return this._getAnimationStateManager(this).clearState(), this;
|
|
24500
|
+
}
|
|
24501
|
+
static extend(graphic) {
|
|
24502
|
+
return new GraphicStateExtension()._getAnimationStateManager(graphic), graphic;
|
|
24503
|
+
}
|
|
24504
|
+
}
|
|
24505
|
+
|
|
24506
|
+
class AnimateExtension {
|
|
24507
|
+
getAttributes(final = !1) {
|
|
24508
|
+
return final && this.finalAttribute ? this.finalAttribute : this.attribute;
|
|
24509
|
+
}
|
|
24510
|
+
animate(params) {
|
|
24511
|
+
var _a, _b, _c;
|
|
24512
|
+
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);
|
|
24513
|
+
if (animate.bind(this), params) {
|
|
24514
|
+
const {
|
|
24515
|
+
onStart: onStart,
|
|
24516
|
+
onEnd: onEnd,
|
|
24517
|
+
onRemove: onRemove
|
|
24518
|
+
} = params;
|
|
24519
|
+
null != onStart && animate.onStart(onStart), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove);
|
|
24520
|
+
}
|
|
24521
|
+
return null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
|
|
24522
|
+
}
|
|
24523
|
+
createTimeline() {
|
|
24524
|
+
return new DefaultTimeline();
|
|
24525
|
+
}
|
|
24526
|
+
createTicker(stage) {
|
|
24527
|
+
return new DefaultTicker(stage);
|
|
24528
|
+
}
|
|
24529
|
+
setFinalAttributes(finalAttribute) {
|
|
24530
|
+
this.finalAttribute || (this.finalAttribute = {}), Object.assign(this.finalAttribute, finalAttribute);
|
|
24531
|
+
}
|
|
24532
|
+
initFinalAttributes(finalAttribute) {
|
|
24533
|
+
this.finalAttribute = finalAttribute;
|
|
24534
|
+
}
|
|
24535
|
+
initAnimateExecutor() {
|
|
24536
|
+
this._animateExecutor || (this._animateExecutor = new AnimateExecutor(this));
|
|
24537
|
+
}
|
|
24538
|
+
executeAnimation(config) {
|
|
24539
|
+
return this.initAnimateExecutor(), this._animateExecutor.execute(config), this;
|
|
24540
|
+
}
|
|
24541
|
+
executeAnimations(configs) {
|
|
24542
|
+
return this.initAnimateExecutor(), configs.forEach(config => {
|
|
24543
|
+
this._animateExecutor.execute(config);
|
|
24544
|
+
}), this;
|
|
24545
|
+
}
|
|
24546
|
+
getFinalAttribute() {
|
|
24547
|
+
return this.finalAttribute;
|
|
24548
|
+
}
|
|
24549
|
+
getGraphicAttribute(key, prev = !1) {
|
|
24550
|
+
return !prev && this.finalAttribute ? this.finalAttribute[key] : this.attribute[key];
|
|
24551
|
+
}
|
|
24552
|
+
}
|
|
24553
|
+
|
|
24554
|
+
function registerAnimate() {
|
|
24555
|
+
mixin$1(Graphic, GraphicStateExtension), mixin$1(Graphic, AnimateExtension);
|
|
24556
|
+
}
|
|
24557
|
+
|
|
24558
|
+
class ACustomAnimate extends Step {
|
|
24559
|
+
constructor(customFrom, customTo, duration, easing, params) {
|
|
24560
|
+
super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params, this.from = customFrom, this.to = customTo;
|
|
24561
|
+
}
|
|
24562
|
+
update(end, ratio, out) {
|
|
24563
|
+
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
24564
|
+
const easedRatio = this.easing(ratio);
|
|
24565
|
+
this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
24566
|
+
}
|
|
24567
|
+
setProps(props) {
|
|
24568
|
+
this.props = props, this.propKeys = Object.keys(props), this.animate.reSyncProps();
|
|
24569
|
+
}
|
|
24570
|
+
}
|
|
24571
|
+
class AComponentAnimate extends ACustomAnimate {
|
|
24572
|
+
completeBind(animator) {
|
|
24573
|
+
this.setStartTime(0), this._animator && this._animator.start(), this.setDuration(animator.getDuration());
|
|
24574
|
+
}
|
|
24575
|
+
stop() {
|
|
24576
|
+
this._animator && this._animator.stop();
|
|
24577
|
+
}
|
|
24578
|
+
}
|
|
24579
|
+
|
|
24580
|
+
class ComponentAnimator {
|
|
24581
|
+
constructor(component) {
|
|
24582
|
+
this.tasks = [], this.started = !1, this.completed = 0, this.totalDuration = 0, this.onStartCallbacks = [], this.onEndCallbacks = [], this.onUpdateCallbacks = [], this.component = component;
|
|
24583
|
+
}
|
|
24584
|
+
animate(graphic, config) {
|
|
24585
|
+
return this.started ? (this) : (this.tasks.push({
|
|
24586
|
+
graphic: graphic,
|
|
24587
|
+
config: config
|
|
24588
|
+
}), this);
|
|
24589
|
+
}
|
|
24590
|
+
onStart(callback) {
|
|
24591
|
+
return this.onStartCallbacks.push(callback), this;
|
|
24592
|
+
}
|
|
24593
|
+
onEnd(callback) {
|
|
24594
|
+
return this.onEndCallbacks.push(callback), this;
|
|
24595
|
+
}
|
|
24596
|
+
onUpdate(callback) {
|
|
24597
|
+
return this.onUpdateCallbacks.push(callback), this;
|
|
24598
|
+
}
|
|
24599
|
+
start() {
|
|
24600
|
+
return this.started ? (this) : (this.started = !0, this.completed = 0, this.onStartCallbacks.forEach(callback => callback()), 0 === this.tasks.length ? (setTimeout(() => {
|
|
24601
|
+
this.onEndCallbacks.forEach(callback => callback());
|
|
24602
|
+
}, 0), this) : (this.tasks.forEach(task => {
|
|
24603
|
+
const executor = new AnimateExecutor(task.graphic);
|
|
24604
|
+
executor.onEnd(() => {
|
|
24605
|
+
this.completed++, this.completed === this.tasks.length && this.onEndCallbacks.forEach(callback => callback());
|
|
24606
|
+
});
|
|
24607
|
+
const animate = executor.executeItem(task.config, task.graphic);
|
|
24608
|
+
task.animate = animate, animate.forEach(animate => {
|
|
24609
|
+
this.totalDuration = Math.max(this.totalDuration, animate.getStartTime() + animate.getDuration());
|
|
24610
|
+
});
|
|
24611
|
+
}), this));
|
|
24612
|
+
}
|
|
24613
|
+
deleteSelfAttr(key) {
|
|
24614
|
+
this.tasks.forEach(task => {
|
|
24615
|
+
task.animate && task.animate.forEach(animate => animate.preventAttr(key));
|
|
24616
|
+
});
|
|
24617
|
+
}
|
|
24618
|
+
stop(type) {
|
|
24619
|
+
return this.tasks.forEach(task => {
|
|
24620
|
+
task.animate && task.animate.forEach(animate => animate.stop(type));
|
|
24621
|
+
}), this.started && this.completed !== this.tasks.length && (this.onEndCallbacks.forEach(callback => callback()), this.completed = this.tasks.length), this;
|
|
24622
|
+
}
|
|
24623
|
+
getDuration() {
|
|
24624
|
+
return this.totalDuration;
|
|
24625
|
+
}
|
|
24626
|
+
}
|
|
24627
|
+
function createComponentAnimator(component) {
|
|
24628
|
+
return new ComponentAnimator(component);
|
|
24629
|
+
}
|
|
24630
|
+
|
|
24631
|
+
class IncreaseCount extends ACustomAnimate {
|
|
24632
|
+
constructor(from, to, duration, easing, params) {
|
|
24633
|
+
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);
|
|
24634
|
+
}
|
|
24635
|
+
onFirstRun() {
|
|
24636
|
+
var _a, _b, _c;
|
|
24637
|
+
const fromProps = this.getLastProps(),
|
|
24638
|
+
toProps = this.getEndProps(),
|
|
24639
|
+
fromText = null !== (_a = fromProps.text) && void 0 !== _a ? _a : 0,
|
|
24640
|
+
toText = null !== (_b = toProps.text) && void 0 !== _b ? _b : 0;
|
|
24641
|
+
this.valid = !0;
|
|
24642
|
+
let fromNum = 0,
|
|
24643
|
+
toNum = 0,
|
|
24644
|
+
fromFormat = "",
|
|
24645
|
+
toFormat = "",
|
|
24646
|
+
maxDecimalLength = 0;
|
|
24647
|
+
if ("number" == typeof fromText) {
|
|
24648
|
+
fromNum = fromText;
|
|
24649
|
+
const decimalPart = fromText.toString().split(".")[1] || "";
|
|
24650
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
24651
|
+
} else {
|
|
24652
|
+
if ("string" != typeof fromText) return void (this.valid = !1);
|
|
24653
|
+
if (fromText.endsWith("%")) {
|
|
24654
|
+
fromFormat = "%";
|
|
24655
|
+
const cleanNumStr = fromText.substring(0, fromText.length - 1).replace(/,/g, "");
|
|
24656
|
+
if (fromNum = parseFloat(cleanNumStr) / 100, isNaN(fromNum)) return void (this.valid = !1);
|
|
24657
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
24658
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length + 2);
|
|
24659
|
+
} else {
|
|
24660
|
+
const cleanNumStr = fromText.replace(/,/g, "");
|
|
24661
|
+
if (fromNum = parseFloat(cleanNumStr), isNaN(fromNum)) return void (this.valid = !1);
|
|
24662
|
+
fromText.includes(",") && (fromFormat = ",");
|
|
24663
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
24664
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
24665
|
+
}
|
|
24666
|
+
}
|
|
24667
|
+
if ("number" == typeof toText) {
|
|
24668
|
+
toNum = toText;
|
|
24669
|
+
const decimalPart = toText.toString().split(".")[1] || "";
|
|
24670
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
24671
|
+
} else {
|
|
24672
|
+
if ("string" != typeof toText) return void (this.valid = !1);
|
|
24673
|
+
if (toText.endsWith("%")) {
|
|
24674
|
+
toFormat = "%";
|
|
24675
|
+
const cleanNumStr = toText.substring(0, toText.length - 1).replace(/,/g, "");
|
|
24676
|
+
if (toNum = parseFloat(cleanNumStr) / 100, isNaN(toNum)) return void (this.valid = !1);
|
|
24677
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
24678
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length + 2);
|
|
24679
|
+
} else {
|
|
24680
|
+
const cleanNumStr = toText.replace(/,/g, "");
|
|
24681
|
+
if (toNum = parseFloat(cleanNumStr), isNaN(toNum)) return void (this.valid = !1);
|
|
24682
|
+
toText.includes(",") && (toFormat = ",");
|
|
24683
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
24684
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
24685
|
+
}
|
|
24686
|
+
}
|
|
24687
|
+
if (null === (_c = this.params) || void 0 === _c ? void 0 : _c.format) {
|
|
24688
|
+
switch (this.params.format) {
|
|
24689
|
+
case "percent":
|
|
24690
|
+
this.format = "%";
|
|
24691
|
+
break;
|
|
24692
|
+
case "thousandth":
|
|
24693
|
+
this.format = ",";
|
|
24694
|
+
break;
|
|
24695
|
+
case "none":
|
|
24696
|
+
this.format = "";
|
|
24697
|
+
break;
|
|
24698
|
+
default:
|
|
24699
|
+
this.format = toFormat || fromFormat;
|
|
24700
|
+
}
|
|
24701
|
+
"%" === this.format && "%" !== toFormat && "%" !== fromFormat && void 0 === this.decimalLength && (this.decimalLength = 2), "%" === this.format || "%" !== toFormat && "%" !== fromFormat || (fromNum *= 100, toNum *= 100);
|
|
24702
|
+
} else this.format = toFormat || fromFormat;
|
|
24703
|
+
this.fromNumber = fromNum, this.toNumber = toNum, void 0 === this.decimalLength && (this.decimalLength = maxDecimalLength);
|
|
24704
|
+
}
|
|
24705
|
+
onEnd(cb) {
|
|
24706
|
+
super.onEnd(cb), cb || this.props && this.target.setAttributes(this.props);
|
|
24707
|
+
}
|
|
24708
|
+
onUpdate(end, ratio, out) {
|
|
24709
|
+
if (!this.valid) return;
|
|
24710
|
+
const currentNumber = this.fromNumber + (this.toNumber - this.fromNumber) * ratio;
|
|
24711
|
+
let formattedText = "";
|
|
24712
|
+
const format = this.format,
|
|
24713
|
+
numberWithDecimals = ("%" === format ? 100 * currentNumber : currentNumber).toFixed(this.decimalLength);
|
|
24714
|
+
let formattedWithBasicFormat,
|
|
24715
|
+
formattedNumber = numberWithDecimals;
|
|
24716
|
+
if (parseFloat(numberWithDecimals) === Math.floor(parseFloat(numberWithDecimals)) && (formattedNumber = Math.floor(parseFloat(numberWithDecimals))), "%" === format) formattedWithBasicFormat = `${formattedNumber}%`;else if ("," === format) {
|
|
24717
|
+
const parts = formattedNumber.toString().split(".");
|
|
24718
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), formattedWithBasicFormat = parts.join(".");
|
|
24719
|
+
} else formattedWithBasicFormat = formattedNumber;
|
|
24720
|
+
formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, this.target.setAttribute("text", formattedText);
|
|
24721
|
+
}
|
|
24722
|
+
}
|
|
24723
|
+
|
|
24724
|
+
class InputText extends ACustomAnimate {
|
|
24725
|
+
constructor(from, to, duration, easing, params) {
|
|
24726
|
+
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);
|
|
24727
|
+
}
|
|
24728
|
+
onFirstRun() {
|
|
24729
|
+
var _a, _b;
|
|
24730
|
+
const fromProps = this.getLastProps(),
|
|
24731
|
+
toProps = this.getEndProps(),
|
|
24732
|
+
fromText = null !== (_a = fromProps.text) && void 0 !== _a ? _a : "",
|
|
24733
|
+
toText = null !== (_b = toProps.text) && void 0 !== _b ? _b : "";
|
|
24734
|
+
this.valid = !0, this.fromText = fromText.toString(), this.toText = toText.toString(), this.toText || "" === this.toText || (this.valid = !1);
|
|
24735
|
+
}
|
|
24736
|
+
onEnd(cb) {
|
|
24737
|
+
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));
|
|
24738
|
+
}
|
|
24739
|
+
onUpdate(end, ratio, out) {
|
|
24740
|
+
if (!this.valid) return;
|
|
24741
|
+
const totalChars = this.toText.length,
|
|
24742
|
+
fromChars = this.fromText.length;
|
|
24743
|
+
let currentLength, currentText;
|
|
24744
|
+
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)));
|
|
24745
|
+
let displayText = this.beforeText + currentText + this.afterText;
|
|
24746
|
+
if (this.showCursor) if (this.blinkCursor) {
|
|
24747
|
+
const blinkRate = .1;
|
|
24748
|
+
Math.floor(ratio / blinkRate) % 2 == 0 && (displayText = this.beforeText + currentText + this.cursorChar + this.afterText);
|
|
24749
|
+
} else displayText = this.beforeText + currentText + this.cursorChar + this.afterText;
|
|
24750
|
+
this.target.setAttribute("text", displayText);
|
|
24751
|
+
}
|
|
24752
|
+
}
|
|
24753
|
+
|
|
24754
|
+
class CommonIn extends ACustomAnimate {
|
|
24755
|
+
constructor(from, to, duration, easing, params) {
|
|
24756
|
+
super(from, to, duration, easing, params);
|
|
24757
|
+
}
|
|
24758
|
+
onBind() {
|
|
24759
|
+
var _a, _b, _c;
|
|
24760
|
+
super.onBind();
|
|
24761
|
+
const attrs = this.target.getFinalAttribute(),
|
|
24762
|
+
fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {},
|
|
24763
|
+
to = {},
|
|
24764
|
+
from = null !== (_b = this.from) && void 0 !== _b ? _b : {};
|
|
24765
|
+
this.keys.forEach(key => {
|
|
24766
|
+
var _a, _b, _c;
|
|
24767
|
+
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;
|
|
24768
|
+
});
|
|
24769
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
24770
|
+
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);
|
|
24771
|
+
}
|
|
24772
|
+
onUpdate(end, ratio, out) {
|
|
24773
|
+
const attribute = this.target.attribute;
|
|
24774
|
+
this.propKeys.forEach(key => {
|
|
24775
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
24776
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
24777
|
+
}
|
|
24778
|
+
}
|
|
24779
|
+
class CommonOut extends ACustomAnimate {
|
|
24780
|
+
constructor(from, to, duration, easing, params) {
|
|
24781
|
+
super(from, to, duration, easing, params);
|
|
24782
|
+
}
|
|
24783
|
+
onBind() {
|
|
24784
|
+
super.onBind();
|
|
24785
|
+
const attrs = this.target.attribute,
|
|
24786
|
+
to = {},
|
|
24787
|
+
from = {};
|
|
24788
|
+
this.keys.forEach(key => {
|
|
24789
|
+
var _a;
|
|
24790
|
+
to[key] = 0, from[key] = null !== (_a = attrs[key]) && void 0 !== _a ? _a : 1;
|
|
24791
|
+
}), 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();
|
|
24792
|
+
}
|
|
24793
|
+
onEnd(cb) {
|
|
24794
|
+
super.onEnd(cb);
|
|
24795
|
+
}
|
|
24796
|
+
onUpdate(end, ratio, out) {
|
|
24797
|
+
const attribute = this.target.attribute;
|
|
24798
|
+
this.propKeys.forEach(key => {
|
|
24799
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
24800
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
24801
|
+
}
|
|
24802
|
+
}
|
|
24803
|
+
|
|
24804
|
+
class ClipIn extends CommonIn {
|
|
24805
|
+
constructor(from, to, duration, easing, params) {
|
|
24806
|
+
super(from, to, duration, easing, params), this.keys = ["clipRange"], this.from = {
|
|
24807
|
+
clipRange: 0
|
|
24808
|
+
};
|
|
24809
|
+
}
|
|
24810
|
+
onFirstRun() {
|
|
24811
|
+
var _a;
|
|
24812
|
+
super.onFirstRun();
|
|
24813
|
+
const {
|
|
24814
|
+
clipDimension: clipDimension
|
|
24815
|
+
} = (null === (_a = this.params) || void 0 === _a ? void 0 : _a.options) || {};
|
|
24816
|
+
clipDimension && (this.target.attribute.clipRangeByDimension = clipDimension);
|
|
24817
|
+
}
|
|
24818
|
+
}
|
|
24819
|
+
class ClipOut extends CommonOut {
|
|
24820
|
+
constructor(from, to, duration, easing, params) {
|
|
24821
|
+
super(from, to, duration, easing, params), this.keys = ["clipRange"];
|
|
24822
|
+
}
|
|
24823
|
+
}
|
|
24824
|
+
|
|
24825
|
+
class FadeIn extends CommonIn {
|
|
24826
|
+
constructor(from, to, duration, easing, params) {
|
|
24827
|
+
super(from, to, duration, easing, params), this.keys = ["opacity", "fillOpacity", "strokeOpacity"], this.from = {
|
|
24828
|
+
opacity: 0,
|
|
24829
|
+
fillOpacity: 0,
|
|
24830
|
+
strokeOpacity: 0
|
|
24831
|
+
};
|
|
24832
|
+
}
|
|
24833
|
+
}
|
|
24834
|
+
class FadeOut extends CommonOut {
|
|
24835
|
+
constructor(from, to, duration, easing, params) {
|
|
24836
|
+
super(from, to, duration, easing, params), this.keys = ["opacity", "fillOpacity", "strokeOpacity"];
|
|
24837
|
+
}
|
|
24838
|
+
}
|
|
24839
|
+
|
|
24840
|
+
const growAngleInIndividual = (graphic, options, animationParameters) => {
|
|
24841
|
+
const attrs = graphic.getFinalAttribute();
|
|
24842
|
+
return options && "anticlockwise" === options.orient ? {
|
|
24843
|
+
from: {
|
|
24844
|
+
startAngle: null == attrs ? void 0 : attrs.endAngle
|
|
24845
|
+
},
|
|
24846
|
+
to: {
|
|
24847
|
+
startAngle: null == attrs ? void 0 : attrs.startAngle
|
|
24848
|
+
}
|
|
24849
|
+
} : {
|
|
24850
|
+
from: {
|
|
24851
|
+
endAngle: null == attrs ? void 0 : attrs.startAngle
|
|
24852
|
+
},
|
|
24853
|
+
to: {
|
|
24854
|
+
endAngle: null == attrs ? void 0 : attrs.endAngle
|
|
24855
|
+
}
|
|
24856
|
+
};
|
|
24857
|
+
},
|
|
24858
|
+
growAngleInOverall = (graphic, options, animationParameters) => {
|
|
24859
|
+
const attrs = graphic.getFinalAttribute();
|
|
24860
|
+
if (options && "anticlockwise" === options.orient) {
|
|
24861
|
+
const overallValue = isNumber$6(options.overall) ? options.overall : 2 * Math.PI;
|
|
24862
|
+
return {
|
|
24863
|
+
from: {
|
|
24864
|
+
startAngle: overallValue,
|
|
24865
|
+
endAngle: overallValue
|
|
24866
|
+
},
|
|
24867
|
+
to: {
|
|
24868
|
+
startAngle: null == attrs ? void 0 : attrs.startAngle,
|
|
24869
|
+
endAngle: null == attrs ? void 0 : attrs.endAngle
|
|
24870
|
+
}
|
|
24871
|
+
};
|
|
24872
|
+
}
|
|
24873
|
+
const overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
24874
|
+
return {
|
|
24875
|
+
from: {
|
|
24876
|
+
startAngle: overallValue,
|
|
24877
|
+
endAngle: overallValue
|
|
24878
|
+
},
|
|
24879
|
+
to: {
|
|
24880
|
+
startAngle: null == attrs ? void 0 : attrs.startAngle,
|
|
24881
|
+
endAngle: null == attrs ? void 0 : attrs.endAngle
|
|
24882
|
+
}
|
|
24883
|
+
};
|
|
24884
|
+
};
|
|
24885
|
+
const growAngleIn = (graphic, options, animationParameters) => {
|
|
24886
|
+
var _a;
|
|
24887
|
+
return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growAngleInOverall(graphic, options) : growAngleInIndividual(graphic, options);
|
|
24888
|
+
};
|
|
24889
|
+
const growAngleOutIndividual = (graphic, options, animationParameters) => {
|
|
24890
|
+
const attrs = graphic.attribute;
|
|
24891
|
+
return options && "anticlockwise" === options.orient ? {
|
|
24892
|
+
from: {
|
|
24893
|
+
startAngle: attrs.startAngle
|
|
24894
|
+
},
|
|
24895
|
+
to: {
|
|
24896
|
+
startAngle: null == attrs ? void 0 : attrs.endAngle
|
|
24897
|
+
}
|
|
24898
|
+
} : {
|
|
24899
|
+
from: {
|
|
24900
|
+
endAngle: attrs.endAngle
|
|
24901
|
+
},
|
|
24902
|
+
to: {
|
|
24903
|
+
endAngle: null == attrs ? void 0 : attrs.startAngle
|
|
24904
|
+
}
|
|
24905
|
+
};
|
|
24906
|
+
},
|
|
24907
|
+
growAngleOutOverall = (graphic, options, animationParameters) => {
|
|
24908
|
+
const attrs = graphic.attribute;
|
|
24909
|
+
if (options && "anticlockwise" === options.orient) {
|
|
24910
|
+
const overallValue = isNumber$6(options.overall) ? options.overall : 2 * Math.PI;
|
|
24911
|
+
return {
|
|
24912
|
+
from: {
|
|
24913
|
+
startAngle: attrs.startAngle,
|
|
24914
|
+
endAngle: attrs.endAngle
|
|
24915
|
+
},
|
|
24916
|
+
to: {
|
|
24917
|
+
startAngle: overallValue,
|
|
24918
|
+
endAngle: overallValue
|
|
24919
|
+
}
|
|
24920
|
+
};
|
|
24921
|
+
}
|
|
24922
|
+
const overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
24923
|
+
return {
|
|
24924
|
+
from: {
|
|
24925
|
+
startAngle: attrs.startAngle,
|
|
24926
|
+
endAngle: attrs.endAngle
|
|
24927
|
+
},
|
|
24928
|
+
to: {
|
|
24929
|
+
startAngle: overallValue,
|
|
24930
|
+
endAngle: overallValue
|
|
24931
|
+
}
|
|
24932
|
+
};
|
|
24933
|
+
};
|
|
24934
|
+
class GrowAngleBase extends ACustomAnimate {
|
|
24935
|
+
constructor(from, to, duration, easing, params) {
|
|
24936
|
+
super(from, to, duration, easing, params);
|
|
24937
|
+
}
|
|
24938
|
+
determineUpdateFunction() {
|
|
24939
|
+
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;
|
|
24940
|
+
}
|
|
24941
|
+
deleteSelfAttr(key) {
|
|
24942
|
+
delete this.props[key], this.fromProps && delete this.fromProps[key];
|
|
24943
|
+
const index = this.propKeys.indexOf(key);
|
|
24944
|
+
-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;
|
|
24945
|
+
}
|
|
24946
|
+
updateStartAngle(ratio) {
|
|
24947
|
+
this.target.attribute.startAngle = this.from.startAngle + (this.to.startAngle - this.from.startAngle) * ratio;
|
|
24948
|
+
}
|
|
24949
|
+
updateEndAngle(ratio) {
|
|
24950
|
+
this.target.attribute.endAngle = this.from.endAngle + (this.to.endAngle - this.from.endAngle) * ratio;
|
|
24951
|
+
}
|
|
24952
|
+
updateAngle(ratio) {
|
|
24953
|
+
this.updateStartAngle(ratio), this.updateEndAngle(ratio);
|
|
24954
|
+
}
|
|
24955
|
+
onUpdate(end, ratio, out) {
|
|
24956
|
+
this._updateFunction && (this._updateFunction(ratio), this.target.addUpdateShapeAndBoundsTag());
|
|
24957
|
+
}
|
|
24958
|
+
}
|
|
24959
|
+
class GrowAngleIn extends GrowAngleBase {
|
|
24960
|
+
onBind() {
|
|
24961
|
+
var _a, _b;
|
|
24962
|
+
super.onBind();
|
|
24963
|
+
const {
|
|
24964
|
+
from: from,
|
|
24965
|
+
to: to
|
|
24966
|
+
} = growAngleIn(this.target, this.params.options, this.params),
|
|
24967
|
+
fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
24968
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
|
|
24969
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
24970
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs), this.determineUpdateFunction();
|
|
24971
|
+
}
|
|
24972
|
+
}
|
|
24973
|
+
class GrowAngleOut extends GrowAngleBase {
|
|
24974
|
+
onBind() {
|
|
24975
|
+
super.onBind();
|
|
24976
|
+
const {
|
|
24977
|
+
from: from,
|
|
24978
|
+
to: to
|
|
24979
|
+
} = (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));
|
|
24980
|
+
var graphic, options, _a;
|
|
24981
|
+
const fromAttrs = from;
|
|
24982
|
+
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();
|
|
24983
|
+
}
|
|
24984
|
+
}
|
|
24985
|
+
|
|
24986
|
+
const growCenterIn = (graphic, options, animationParameters) => {
|
|
24987
|
+
const attrs = graphic.getFinalAttribute();
|
|
24988
|
+
switch (null == options ? void 0 : options.direction) {
|
|
24989
|
+
case "x":
|
|
24990
|
+
{
|
|
24991
|
+
const x = attrs.x,
|
|
24992
|
+
x1 = attrs.x1,
|
|
24993
|
+
width = attrs.width;
|
|
24994
|
+
return {
|
|
24995
|
+
from: isValid$5(width) ? {
|
|
24996
|
+
x: x + width / 2,
|
|
24997
|
+
x1: void 0,
|
|
24998
|
+
width: 0
|
|
24999
|
+
} : {
|
|
25000
|
+
x: (x + x1) / 2,
|
|
25001
|
+
x1: (x + x1) / 2,
|
|
25002
|
+
width: void 0
|
|
25003
|
+
},
|
|
25004
|
+
to: {
|
|
25005
|
+
x: x,
|
|
25006
|
+
x1: x1,
|
|
25007
|
+
width: width
|
|
25008
|
+
}
|
|
25009
|
+
};
|
|
25010
|
+
}
|
|
25011
|
+
case "y":
|
|
25012
|
+
{
|
|
25013
|
+
const y = attrs.y,
|
|
25014
|
+
y1 = attrs.y1,
|
|
25015
|
+
height = attrs.height;
|
|
25016
|
+
return {
|
|
25017
|
+
from: isValid$5(height) ? {
|
|
25018
|
+
y: y + height / 2,
|
|
25019
|
+
y1: void 0,
|
|
25020
|
+
height: 0
|
|
25021
|
+
} : {
|
|
25022
|
+
y: (y + y1) / 2,
|
|
25023
|
+
y1: (y + y1) / 2,
|
|
25024
|
+
height: void 0
|
|
25025
|
+
},
|
|
25026
|
+
to: {
|
|
25027
|
+
y: y,
|
|
25028
|
+
y1: y1,
|
|
25029
|
+
height: height
|
|
25030
|
+
}
|
|
25031
|
+
};
|
|
25032
|
+
}
|
|
25033
|
+
default:
|
|
25034
|
+
{
|
|
25035
|
+
const x = attrs.x,
|
|
25036
|
+
x1 = attrs.x1,
|
|
25037
|
+
width = attrs.width,
|
|
25038
|
+
y = attrs.y,
|
|
25039
|
+
y1 = attrs.y1,
|
|
25040
|
+
height = attrs.height,
|
|
25041
|
+
from = {};
|
|
25042
|
+
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), {
|
|
25043
|
+
from: from,
|
|
25044
|
+
to: {
|
|
25045
|
+
x: x,
|
|
25046
|
+
y: y,
|
|
25047
|
+
x1: x1,
|
|
25048
|
+
y1: y1,
|
|
25049
|
+
width: width,
|
|
25050
|
+
height: height
|
|
25051
|
+
}
|
|
25052
|
+
};
|
|
25053
|
+
}
|
|
25054
|
+
}
|
|
25055
|
+
},
|
|
25056
|
+
growCenterOut = (graphic, options, animationParameters) => {
|
|
25057
|
+
const attrs = graphic.attribute;
|
|
25058
|
+
switch (null == options ? void 0 : options.direction) {
|
|
25059
|
+
case "x":
|
|
25060
|
+
{
|
|
25061
|
+
const x = attrs.x,
|
|
25062
|
+
x1 = attrs.x1,
|
|
25063
|
+
width = attrs.width;
|
|
25064
|
+
return {
|
|
25065
|
+
to: isValid$5(width) ? {
|
|
25066
|
+
x: x + width / 2,
|
|
25067
|
+
x1: void 0,
|
|
25068
|
+
width: 0
|
|
25069
|
+
} : {
|
|
25070
|
+
x: (x + x1) / 2,
|
|
25071
|
+
x1: (x + x1) / 2,
|
|
25072
|
+
width: void 0
|
|
25073
|
+
}
|
|
25074
|
+
};
|
|
25075
|
+
}
|
|
25076
|
+
case "y":
|
|
25077
|
+
{
|
|
25078
|
+
const y = attrs.y,
|
|
25079
|
+
y1 = attrs.y1,
|
|
25080
|
+
height = attrs.height;
|
|
25081
|
+
return {
|
|
25082
|
+
to: isValid$5(height) ? {
|
|
25083
|
+
y: y + height / 2,
|
|
25084
|
+
y1: void 0,
|
|
25085
|
+
height: 0
|
|
25086
|
+
} : {
|
|
25087
|
+
y: (y + y1) / 2,
|
|
25088
|
+
y1: (y + y1) / 2,
|
|
25089
|
+
height: void 0
|
|
25090
|
+
}
|
|
25091
|
+
};
|
|
25092
|
+
}
|
|
25093
|
+
default:
|
|
25094
|
+
{
|
|
25095
|
+
const x = attrs.x,
|
|
25096
|
+
y = attrs.y,
|
|
25097
|
+
x1 = attrs.x1,
|
|
25098
|
+
y1 = attrs.y1,
|
|
25099
|
+
width = attrs.width,
|
|
25100
|
+
height = attrs.height,
|
|
25101
|
+
to = {};
|
|
25102
|
+
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), {
|
|
25103
|
+
to: to
|
|
25104
|
+
};
|
|
25105
|
+
}
|
|
25106
|
+
}
|
|
25107
|
+
};
|
|
25108
|
+
class GrowCenterIn extends ACustomAnimate {
|
|
25109
|
+
constructor(from, to, duration, easing, params) {
|
|
25110
|
+
super(from, to, duration, easing, params);
|
|
25111
|
+
}
|
|
25112
|
+
onBind() {
|
|
25113
|
+
var _a, _b;
|
|
25114
|
+
super.onBind();
|
|
25115
|
+
const {
|
|
25116
|
+
from: from,
|
|
25117
|
+
to: to
|
|
25118
|
+
} = growCenterIn(this.target, this.params.options, this.params),
|
|
25119
|
+
fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
25120
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
|
|
25121
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
25122
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
25123
|
+
}
|
|
25124
|
+
onEnd(cb) {
|
|
25125
|
+
super.onEnd(cb);
|
|
25126
|
+
}
|
|
25127
|
+
onUpdate(end, ratio, out) {
|
|
25128
|
+
const attribute = this.target.attribute;
|
|
25129
|
+
this.propKeys.forEach(key => {
|
|
25130
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
25131
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
25132
|
+
}
|
|
25133
|
+
}
|
|
25134
|
+
class GrowCenterOut extends ACustomAnimate {
|
|
25135
|
+
constructor(from, to, duration, easing, params) {
|
|
25136
|
+
super(from, to, duration, easing, params);
|
|
25137
|
+
}
|
|
25138
|
+
onBind() {
|
|
25139
|
+
super.onBind();
|
|
25140
|
+
const {
|
|
25141
|
+
from: from,
|
|
25142
|
+
to: to
|
|
25143
|
+
} = growCenterOut(this.target, this.params.options, this.params);
|
|
25144
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = null != from ? from : this.target.attribute, this.to = to;
|
|
25145
|
+
}
|
|
25146
|
+
onEnd(cb) {
|
|
25147
|
+
super.onEnd(cb);
|
|
25148
|
+
}
|
|
25149
|
+
onUpdate(end, ratio, out) {
|
|
25150
|
+
const attribute = this.target.attribute;
|
|
25151
|
+
this.propKeys.forEach(key => {
|
|
25152
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
25153
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
25154
|
+
}
|
|
25155
|
+
}
|
|
25156
|
+
|
|
25157
|
+
function growHeightInIndividual(graphic, options, animationParameters) {
|
|
25158
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25159
|
+
y = attrs.y,
|
|
25160
|
+
y1 = attrs.y1,
|
|
25161
|
+
height = attrs.height;
|
|
25162
|
+
if (options && "negative" === options.orient) {
|
|
25163
|
+
const computedY1 = isValid$5(height) ? Math.max(y, y + height) : Math.max(y, y1);
|
|
25164
|
+
return {
|
|
25165
|
+
from: {
|
|
25166
|
+
y: computedY1,
|
|
25167
|
+
y1: isNil$5(y1) ? void 0 : computedY1,
|
|
25168
|
+
height: isNil$5(height) ? void 0 : 0
|
|
25169
|
+
},
|
|
25170
|
+
to: {
|
|
25171
|
+
y: y,
|
|
25172
|
+
y1: y1,
|
|
25173
|
+
height: height
|
|
25174
|
+
}
|
|
25175
|
+
};
|
|
25176
|
+
}
|
|
25177
|
+
const computedY = isValid$5(height) ? Math.min(y, y + height) : Math.min(y, y1);
|
|
25178
|
+
return {
|
|
25179
|
+
from: {
|
|
25180
|
+
y: computedY,
|
|
25181
|
+
y1: isNil$5(y1) ? void 0 : computedY,
|
|
25182
|
+
height: isNil$5(height) ? void 0 : 0
|
|
25183
|
+
},
|
|
25184
|
+
to: {
|
|
25185
|
+
y: y,
|
|
25186
|
+
y1: y1,
|
|
25187
|
+
height: height
|
|
25188
|
+
}
|
|
25189
|
+
};
|
|
25190
|
+
}
|
|
25191
|
+
function growHeightInOverall(graphic, options, animationParameters) {
|
|
25192
|
+
var _a, _b, _c;
|
|
25193
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25194
|
+
y = attrs.y,
|
|
25195
|
+
y1 = attrs.y1,
|
|
25196
|
+
height = attrs.height;
|
|
25197
|
+
let overallValue;
|
|
25198
|
+
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, {
|
|
25199
|
+
from: {
|
|
25200
|
+
y: overallValue,
|
|
25201
|
+
y1: isNil$5(y1) ? void 0 : overallValue,
|
|
25202
|
+
height: isNil$5(height) ? void 0 : 0
|
|
25203
|
+
},
|
|
25204
|
+
to: {
|
|
25205
|
+
y: y,
|
|
25206
|
+
y1: y1,
|
|
25207
|
+
height: height
|
|
25208
|
+
}
|
|
25209
|
+
};
|
|
25210
|
+
}
|
|
25211
|
+
const growHeightIn = (graphic, options, animationParameters) => {
|
|
25212
|
+
var _a;
|
|
25213
|
+
return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growHeightInOverall(graphic, options, animationParameters) : growHeightInIndividual(graphic, options);
|
|
25214
|
+
};
|
|
25215
|
+
class GrowHeightIn extends ACustomAnimate {
|
|
25216
|
+
constructor(from, to, duration, easing, params) {
|
|
25217
|
+
super(from, to, duration, easing, params);
|
|
25218
|
+
}
|
|
25219
|
+
onBind() {
|
|
25220
|
+
var _a, _b;
|
|
25221
|
+
super.onBind();
|
|
25222
|
+
const {
|
|
25223
|
+
from: from,
|
|
25224
|
+
to: to
|
|
25225
|
+
} = growHeightIn(this.target, this.params.options, this.params),
|
|
25226
|
+
fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
25227
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
|
|
25228
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
25229
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
25230
|
+
}
|
|
25231
|
+
onEnd(cb) {
|
|
25232
|
+
super.onEnd(cb);
|
|
25233
|
+
}
|
|
25234
|
+
onUpdate(end, ratio, out) {
|
|
25235
|
+
const attribute = this.target.attribute;
|
|
25236
|
+
this.propKeys.forEach(key => {
|
|
25237
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
25238
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
25239
|
+
}
|
|
25240
|
+
}
|
|
25241
|
+
function growHeightOutIndividual(graphic, options, animationParameters) {
|
|
25242
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25243
|
+
y = attrs.y,
|
|
25244
|
+
y1 = attrs.y1,
|
|
25245
|
+
height = attrs.height;
|
|
25246
|
+
if (options && "negative" === options.orient) {
|
|
25247
|
+
const computedY1 = isValid$5(height) ? Math.max(y, y + height) : Math.max(y, y1);
|
|
25248
|
+
return {
|
|
25249
|
+
to: {
|
|
25250
|
+
y: computedY1,
|
|
25251
|
+
y1: isNil$5(y1) ? void 0 : computedY1,
|
|
25252
|
+
height: isNil$5(height) ? void 0 : 0
|
|
25253
|
+
}
|
|
25254
|
+
};
|
|
25255
|
+
}
|
|
25256
|
+
const computedY = isValid$5(height) ? Math.min(y, y + height) : Math.min(y, y1);
|
|
25257
|
+
return {
|
|
25258
|
+
to: {
|
|
25259
|
+
y: computedY,
|
|
25260
|
+
y1: isNil$5(y1) ? void 0 : computedY,
|
|
25261
|
+
height: isNil$5(height) ? void 0 : 0
|
|
25262
|
+
}
|
|
25263
|
+
};
|
|
25264
|
+
}
|
|
25265
|
+
function growHeightOutOverall(graphic, options, animationParameters) {
|
|
25266
|
+
var _a, _b, _c;
|
|
25267
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25268
|
+
y1 = attrs.y1,
|
|
25269
|
+
height = attrs.height;
|
|
25270
|
+
let overallValue;
|
|
25271
|
+
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, {
|
|
25272
|
+
to: {
|
|
25273
|
+
y: overallValue,
|
|
25274
|
+
y1: isNil$5(y1) ? void 0 : overallValue,
|
|
25275
|
+
height: isNil$5(height) ? void 0 : 0
|
|
25276
|
+
}
|
|
25277
|
+
};
|
|
25278
|
+
}
|
|
25279
|
+
class GrowHeightOut extends ACustomAnimate {
|
|
25280
|
+
constructor(from, to, duration, easing, params) {
|
|
25281
|
+
super(from, to, duration, easing, params);
|
|
25282
|
+
}
|
|
25283
|
+
onBind() {
|
|
25284
|
+
super.onBind();
|
|
25285
|
+
const {
|
|
25286
|
+
from: from,
|
|
25287
|
+
to: to
|
|
25288
|
+
} = (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));
|
|
25289
|
+
var graphic, options, animationParameters, _a;
|
|
25290
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = null != from ? from : this.target.attribute, this.to = to;
|
|
25291
|
+
}
|
|
25292
|
+
onEnd(cb) {
|
|
25293
|
+
super.onEnd(cb);
|
|
25294
|
+
}
|
|
25295
|
+
onUpdate(end, ratio, out) {
|
|
25296
|
+
const attribute = this.target.attribute;
|
|
25297
|
+
this.propKeys.forEach(key => {
|
|
25298
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
25299
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
25300
|
+
}
|
|
25301
|
+
}
|
|
25302
|
+
|
|
25303
|
+
const getCenterPoints = (graphic, options, animationParameters) => {
|
|
25304
|
+
const points = graphic.getFinalAttribute().points,
|
|
25305
|
+
center = {
|
|
25306
|
+
x: 0,
|
|
25307
|
+
y: 0
|
|
25308
|
+
};
|
|
25309
|
+
return points.forEach(point => {
|
|
25310
|
+
center.x += point.x, center.y += point.y;
|
|
25311
|
+
}), 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));
|
|
25312
|
+
};
|
|
25313
|
+
const growPointsIn = (graphic, options, animationParameters) => {
|
|
25314
|
+
const attrs = graphic.getFinalAttribute();
|
|
25315
|
+
return {
|
|
25316
|
+
from: {
|
|
25317
|
+
points: getCenterPoints(graphic, options)
|
|
25318
|
+
},
|
|
25319
|
+
to: {
|
|
25320
|
+
points: attrs.points
|
|
25321
|
+
}
|
|
25322
|
+
};
|
|
25323
|
+
};
|
|
25324
|
+
class GworPointsBase extends ACustomAnimate {
|
|
25325
|
+
constructor(from, to, duration, easing, params) {
|
|
25326
|
+
super(from, to, duration, easing, params);
|
|
25327
|
+
}
|
|
25328
|
+
onUpdate(end, ratio, out) {
|
|
25329
|
+
var _a, _b;
|
|
25330
|
+
const fromPoints = null === (_a = this.from) || void 0 === _a ? void 0 : _a.points,
|
|
25331
|
+
toPoints = null === (_b = this.to) || void 0 === _b ? void 0 : _b.points;
|
|
25332
|
+
fromPoints && toPoints && (this.target.attribute.points = fromPoints.map((point, index) => pointInterpolation(fromPoints[index], toPoints[index], ratio)), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag());
|
|
25333
|
+
}
|
|
25334
|
+
}
|
|
25335
|
+
class GrowPointsIn extends GworPointsBase {
|
|
25336
|
+
onBind() {
|
|
25337
|
+
var _a;
|
|
25338
|
+
if (super.onBind(), ["area", "line", "polygon"].includes(this.target.type)) {
|
|
25339
|
+
const {
|
|
25340
|
+
from: from,
|
|
25341
|
+
to: to
|
|
25342
|
+
} = growPointsIn(this.target, this.params.options, this.params);
|
|
25343
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
|
|
25344
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
25345
|
+
finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
|
|
25346
|
+
} else this.valid = !1;
|
|
25347
|
+
}
|
|
25348
|
+
}
|
|
25349
|
+
class GrowPointsOut extends GworPointsBase {
|
|
25350
|
+
onBind() {
|
|
25351
|
+
if (super.onBind(), ["area", "line"].includes(this.target.type)) {
|
|
25352
|
+
const attrs = this.target.getFinalAttribute(),
|
|
25353
|
+
{
|
|
25354
|
+
from: from,
|
|
25355
|
+
to: to
|
|
25356
|
+
} = (graphic = this.target, options = this.params.options, this.params, {
|
|
25357
|
+
from: {
|
|
25358
|
+
points: graphic.getFinalAttribute().points
|
|
25359
|
+
},
|
|
25360
|
+
to: {
|
|
25361
|
+
points: getCenterPoints(graphic, options)
|
|
25362
|
+
}
|
|
25363
|
+
});
|
|
25364
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from || attrs, this.to = to;
|
|
25365
|
+
} else this.valid = !1;
|
|
25366
|
+
var graphic, options;
|
|
25367
|
+
}
|
|
25368
|
+
}
|
|
25369
|
+
const changePointsX = (graphic, options, animationParameters) => graphic.getFinalAttribute().points.map(point => {
|
|
25370
|
+
if (options && "negative" === options.orient) {
|
|
25371
|
+
let groupRight = graphic.stage.viewWidth;
|
|
25372
|
+
return graphic.parent.parent.parent && (groupRight = graphic.parent.parent.parent.AABBBounds.width()), Object.assign(Object.assign({}, point), {
|
|
25373
|
+
x: groupRight,
|
|
25374
|
+
y: point.y,
|
|
25375
|
+
x1: groupRight,
|
|
25376
|
+
y1: point.y1,
|
|
25377
|
+
defined: !1 !== point.defined
|
|
25378
|
+
});
|
|
25379
|
+
}
|
|
25380
|
+
return Object.assign(Object.assign({}, point), {
|
|
25381
|
+
x: 0,
|
|
25382
|
+
y: point.y,
|
|
25383
|
+
x1: 0,
|
|
25384
|
+
y1: point.y1,
|
|
25385
|
+
defined: !1 !== point.defined
|
|
25386
|
+
});
|
|
25387
|
+
}),
|
|
25388
|
+
growPointsXIn = (graphic, options, animationParameters) => {
|
|
25389
|
+
const attrs = graphic.getFinalAttribute();
|
|
25390
|
+
return {
|
|
25391
|
+
from: {
|
|
25392
|
+
points: changePointsX(graphic, options)
|
|
25393
|
+
},
|
|
25394
|
+
to: {
|
|
25395
|
+
points: attrs.points
|
|
25396
|
+
}
|
|
25397
|
+
};
|
|
25398
|
+
};
|
|
25399
|
+
class GrowPointsXIn extends GworPointsBase {
|
|
25400
|
+
onBind() {
|
|
25401
|
+
var _a;
|
|
25402
|
+
if (super.onBind(), ["area", "line", "polygon"].includes(this.target.type)) {
|
|
25403
|
+
const {
|
|
25404
|
+
from: from,
|
|
25405
|
+
to: to
|
|
25406
|
+
} = growPointsXIn(this.target, this.params.options, this.params);
|
|
25407
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
|
|
25408
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
25409
|
+
finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
|
|
25410
|
+
} else this.valid = !1;
|
|
25411
|
+
}
|
|
25412
|
+
}
|
|
25413
|
+
class GrowPointsXOut extends GworPointsBase {
|
|
25414
|
+
onBind() {
|
|
25415
|
+
if (super.onBind(), ["area", "line"].includes(this.target.type)) {
|
|
25416
|
+
const attrs = this.target.getFinalAttribute(),
|
|
25417
|
+
{
|
|
25418
|
+
from: from,
|
|
25419
|
+
to: to
|
|
25420
|
+
} = (graphic = this.target, options = this.params.options, this.params, {
|
|
25421
|
+
from: {
|
|
25422
|
+
points: graphic.getFinalAttribute().points
|
|
25423
|
+
},
|
|
25424
|
+
to: {
|
|
25425
|
+
points: changePointsX(graphic, options)
|
|
25426
|
+
}
|
|
25427
|
+
});
|
|
25428
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from || attrs, this.to = to;
|
|
25429
|
+
} else this.valid = !1;
|
|
25430
|
+
var graphic, options;
|
|
25431
|
+
}
|
|
25432
|
+
}
|
|
25433
|
+
const changePointsY = (graphic, options, animationParameters) => graphic.getFinalAttribute().points.map(point => {
|
|
25434
|
+
if (options && "negative" === options.orient) {
|
|
25435
|
+
let groupBottom = graphic.stage.viewHeight;
|
|
25436
|
+
return graphic.parent.parent.parent && (groupBottom = graphic.parent.parent.parent.AABBBounds.height()), Object.assign(Object.assign({}, point), {
|
|
25437
|
+
x: point.x,
|
|
25438
|
+
y: groupBottom,
|
|
25439
|
+
x1: point.x1,
|
|
25440
|
+
y1: groupBottom,
|
|
25441
|
+
defined: !1 !== point.defined
|
|
25442
|
+
});
|
|
25443
|
+
}
|
|
25444
|
+
return Object.assign(Object.assign({}, point), {
|
|
25445
|
+
x: point.x,
|
|
25446
|
+
y: 0,
|
|
25447
|
+
x1: point.x1,
|
|
25448
|
+
y1: 0,
|
|
25449
|
+
defined: !1 !== point.defined
|
|
25450
|
+
});
|
|
25451
|
+
}),
|
|
25452
|
+
growPointsYIn = (graphic, options, animationParameters) => {
|
|
25453
|
+
const attrs = graphic.getFinalAttribute();
|
|
25454
|
+
return {
|
|
25455
|
+
from: {
|
|
25456
|
+
points: changePointsY(graphic, options)
|
|
25457
|
+
},
|
|
25458
|
+
to: {
|
|
25459
|
+
points: attrs.points
|
|
25460
|
+
}
|
|
25461
|
+
};
|
|
25462
|
+
};
|
|
25463
|
+
class GrowPointsYIn extends GworPointsBase {
|
|
25464
|
+
onBind() {
|
|
25465
|
+
var _a;
|
|
25466
|
+
if (super.onBind(), ["area", "line", "polygon"].includes(this.target.type)) {
|
|
25467
|
+
const {
|
|
25468
|
+
from: from,
|
|
25469
|
+
to: to
|
|
25470
|
+
} = growPointsYIn(this.target, this.params.options, this.params);
|
|
25471
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
|
|
25472
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
25473
|
+
finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
|
|
25474
|
+
} else this.valid = !1;
|
|
25475
|
+
}
|
|
25476
|
+
}
|
|
25477
|
+
class GrowPointsYOut extends GworPointsBase {
|
|
25478
|
+
onBind() {
|
|
25479
|
+
if (super.onBind(), ["area", "line", "polygon"].includes(this.target.type)) {
|
|
25480
|
+
const {
|
|
25481
|
+
from: from,
|
|
25482
|
+
to: to
|
|
25483
|
+
} = (graphic = this.target, options = this.params.options, this.params, {
|
|
25484
|
+
from: {
|
|
25485
|
+
points: graphic.getFinalAttribute().points
|
|
25486
|
+
},
|
|
25487
|
+
to: {
|
|
25488
|
+
points: changePointsY(graphic, options)
|
|
25489
|
+
}
|
|
25490
|
+
});
|
|
25491
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = null != from ? from : this.target.attribute, this.to = to;
|
|
25492
|
+
} else this.valid = !1;
|
|
25493
|
+
var graphic, options;
|
|
25494
|
+
}
|
|
25495
|
+
}
|
|
25496
|
+
|
|
25497
|
+
const growRadiusInIndividual = (graphic, options, animationParameters) => {
|
|
25498
|
+
const attrs = graphic.getFinalAttribute();
|
|
25499
|
+
return options && "inside" === options.orient ? {
|
|
25500
|
+
from: {
|
|
25501
|
+
innerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
25502
|
+
},
|
|
25503
|
+
to: {
|
|
25504
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
25505
|
+
}
|
|
25506
|
+
} : {
|
|
25507
|
+
from: {
|
|
25508
|
+
outerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
25509
|
+
},
|
|
25510
|
+
to: {
|
|
25511
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
25512
|
+
}
|
|
25513
|
+
};
|
|
25514
|
+
},
|
|
25515
|
+
growRadiusInOverall = (graphic, options, animationParameters) => {
|
|
25516
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25517
|
+
overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
25518
|
+
return {
|
|
25519
|
+
from: {
|
|
25520
|
+
innerRadius: overallValue,
|
|
25521
|
+
outerRadius: overallValue
|
|
25522
|
+
},
|
|
25523
|
+
to: {
|
|
25524
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius,
|
|
25525
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
25526
|
+
}
|
|
25527
|
+
};
|
|
25528
|
+
};
|
|
25529
|
+
const growRadiusIn = (graphic, options, animationParameters) => {
|
|
25530
|
+
var _a;
|
|
25531
|
+
return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growRadiusInOverall(graphic, options) : growRadiusInIndividual(graphic, options);
|
|
25532
|
+
};
|
|
25533
|
+
const growRadiusOutIndividual = (graphic, options, animationParameters) => {
|
|
25534
|
+
const attrs = graphic.getFinalAttribute();
|
|
25535
|
+
return options && "inside" === options.orient ? {
|
|
25536
|
+
from: {
|
|
25537
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
25538
|
+
},
|
|
25539
|
+
to: {
|
|
25540
|
+
innerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
25541
|
+
}
|
|
25542
|
+
} : {
|
|
25543
|
+
from: {
|
|
25544
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
25545
|
+
},
|
|
25546
|
+
to: {
|
|
25547
|
+
outerRadius: null == attrs ? void 0 : attrs.innerRadius
|
|
25548
|
+
}
|
|
25549
|
+
};
|
|
25550
|
+
},
|
|
25551
|
+
growRadiusOutOverall = (graphic, options, animationParameters) => {
|
|
25552
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25553
|
+
overallValue = isNumber$6(null == options ? void 0 : options.overall) ? options.overall : 0;
|
|
25554
|
+
return {
|
|
25555
|
+
from: {
|
|
25556
|
+
innerRadius: null == attrs ? void 0 : attrs.innerRadius,
|
|
25557
|
+
outerRadius: null == attrs ? void 0 : attrs.outerRadius
|
|
25558
|
+
},
|
|
25559
|
+
to: {
|
|
25560
|
+
innerRadius: overallValue,
|
|
25561
|
+
outerRadius: overallValue
|
|
25562
|
+
}
|
|
25563
|
+
};
|
|
25564
|
+
};
|
|
25565
|
+
class GrowPointsBase extends ACustomAnimate {
|
|
25566
|
+
constructor(from, to, duration, easing, params) {
|
|
25567
|
+
super(from, to, duration, easing, params);
|
|
25568
|
+
}
|
|
25569
|
+
onUpdate(end, ratio, out) {
|
|
25570
|
+
const attribute = this.target.attribute;
|
|
25571
|
+
this.propKeys.forEach(key => {
|
|
25572
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
25573
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
25574
|
+
}
|
|
25575
|
+
}
|
|
25576
|
+
class GrowRadiusIn extends GrowPointsBase {
|
|
25577
|
+
onBind() {
|
|
25578
|
+
var _a, _b;
|
|
25579
|
+
super.onBind();
|
|
25580
|
+
const {
|
|
25581
|
+
from: from,
|
|
25582
|
+
to: to
|
|
25583
|
+
} = growRadiusIn(this.target, this.params.options, this.params),
|
|
25584
|
+
fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
25585
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
|
|
25586
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
25587
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
25588
|
+
}
|
|
25589
|
+
}
|
|
25590
|
+
class GrowRadiusOut extends GrowPointsBase {
|
|
25591
|
+
onBind() {
|
|
25592
|
+
super.onBind();
|
|
25593
|
+
const {
|
|
25594
|
+
to: to
|
|
25595
|
+
} = (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));
|
|
25596
|
+
var graphic, options, _a;
|
|
25597
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = this.target.attribute, this.to = to;
|
|
25598
|
+
}
|
|
25599
|
+
}
|
|
25600
|
+
|
|
25601
|
+
function growWidthInIndividual(graphic, options, animationParameters) {
|
|
25602
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25603
|
+
x = attrs.x,
|
|
25604
|
+
x1 = attrs.x1,
|
|
25605
|
+
width = attrs.width;
|
|
25606
|
+
if (options && "negative" === options.orient) {
|
|
25607
|
+
const computedX1 = isValid$5(width) ? Math.max(x, x + width) : Math.max(x, x1);
|
|
25608
|
+
return {
|
|
25609
|
+
from: {
|
|
25610
|
+
x: computedX1,
|
|
25611
|
+
x1: isNil$5(x1) ? void 0 : computedX1,
|
|
25612
|
+
width: isNil$5(width) ? void 0 : 0
|
|
25613
|
+
},
|
|
25614
|
+
to: {
|
|
25615
|
+
x: x,
|
|
25616
|
+
x1: x1,
|
|
25617
|
+
width: width
|
|
25618
|
+
}
|
|
25619
|
+
};
|
|
25620
|
+
}
|
|
25621
|
+
const computedX = isValid$5(width) ? Math.min(x, x + width) : Math.min(x, x1);
|
|
25622
|
+
return {
|
|
25623
|
+
from: {
|
|
25624
|
+
x: computedX,
|
|
25625
|
+
x1: isNil$5(x1) ? void 0 : computedX,
|
|
25626
|
+
width: isNil$5(width) ? void 0 : 0
|
|
25627
|
+
},
|
|
25628
|
+
to: {
|
|
25629
|
+
x: x,
|
|
25630
|
+
x1: x1,
|
|
25631
|
+
width: width
|
|
25632
|
+
}
|
|
25633
|
+
};
|
|
25634
|
+
}
|
|
25635
|
+
function growWidthInOverall(graphic, options, animationParameters) {
|
|
25636
|
+
var _a;
|
|
25637
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25638
|
+
x = attrs.x,
|
|
25639
|
+
x1 = attrs.x1,
|
|
25640
|
+
width = attrs.width;
|
|
25641
|
+
let overallValue;
|
|
25642
|
+
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, {
|
|
25643
|
+
from: {
|
|
25644
|
+
x: overallValue,
|
|
25645
|
+
x1: isNil$5(x1) ? void 0 : overallValue,
|
|
25646
|
+
width: isNil$5(width) ? void 0 : 0
|
|
25647
|
+
},
|
|
25648
|
+
to: {
|
|
25649
|
+
x: x,
|
|
25650
|
+
x1: x1,
|
|
25651
|
+
width: width
|
|
25652
|
+
}
|
|
25653
|
+
};
|
|
25654
|
+
}
|
|
25655
|
+
const growWidthIn = (graphic, options, animationParameters) => {
|
|
25656
|
+
var _a;
|
|
25657
|
+
return !1 !== (null !== (_a = null == options ? void 0 : options.overall) && void 0 !== _a && _a) ? growWidthInOverall(graphic, options, animationParameters) : growWidthInIndividual(graphic, options);
|
|
25658
|
+
};
|
|
25659
|
+
function growWidthOutIndividual(graphic, options, animationParameters) {
|
|
25660
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25661
|
+
x = attrs.x,
|
|
25662
|
+
x1 = attrs.x1,
|
|
25663
|
+
width = attrs.width;
|
|
25664
|
+
if (options && "negative" === options.orient) {
|
|
25665
|
+
const computedX1 = isValid$5(width) ? Math.max(x, x + width) : Math.max(x, x1);
|
|
25666
|
+
return {
|
|
25667
|
+
to: {
|
|
25668
|
+
x: computedX1,
|
|
25669
|
+
x1: isNil$5(x1) ? void 0 : computedX1,
|
|
25670
|
+
width: isNil$5(width) ? void 0 : 0
|
|
25671
|
+
}
|
|
25672
|
+
};
|
|
25673
|
+
}
|
|
25674
|
+
const computedX = isValid$5(width) ? Math.min(x, x + width) : Math.min(x, x1);
|
|
25675
|
+
return {
|
|
25676
|
+
to: {
|
|
25677
|
+
x: computedX,
|
|
25678
|
+
x1: isNil$5(x1) ? void 0 : computedX,
|
|
25679
|
+
width: isNil$5(width) ? void 0 : 0
|
|
25680
|
+
}
|
|
25681
|
+
};
|
|
25682
|
+
}
|
|
25683
|
+
function growWidthOutOverall(graphic, options, animationParameters) {
|
|
25684
|
+
var _a;
|
|
25685
|
+
const attrs = graphic.getFinalAttribute(),
|
|
25686
|
+
x1 = attrs.x1,
|
|
25687
|
+
width = attrs.width;
|
|
25688
|
+
let overallValue;
|
|
25689
|
+
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, {
|
|
25690
|
+
to: {
|
|
25691
|
+
x: overallValue,
|
|
25692
|
+
x1: isNil$5(x1) ? void 0 : overallValue,
|
|
25693
|
+
width: isNil$5(width) ? void 0 : 0
|
|
25694
|
+
}
|
|
25695
|
+
};
|
|
25696
|
+
}
|
|
25697
|
+
class GrowWidthIn extends ACustomAnimate {
|
|
25698
|
+
constructor(from, to, duration, easing, params) {
|
|
25699
|
+
super(from, to, duration, easing, params);
|
|
25700
|
+
}
|
|
25701
|
+
onBind() {
|
|
25702
|
+
var _a, _b;
|
|
25703
|
+
super.onBind();
|
|
25704
|
+
const {
|
|
25705
|
+
from: from,
|
|
25706
|
+
to: to
|
|
25707
|
+
} = growWidthIn(this.target, this.params.options, this.params),
|
|
25708
|
+
fromAttrs = null !== (_b = null === (_a = this.target.context) || void 0 === _a ? void 0 : _a.lastAttrs) && void 0 !== _b ? _b : from;
|
|
25709
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = fromAttrs, this.to = to;
|
|
25710
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
25711
|
+
finalAttribute && this.target.setAttributes(finalAttribute), this.target.setAttributes(fromAttrs);
|
|
25712
|
+
}
|
|
25713
|
+
onEnd(cb) {
|
|
25714
|
+
super.onEnd(cb);
|
|
25715
|
+
}
|
|
25716
|
+
onUpdate(end, ratio, out) {
|
|
25717
|
+
const attribute = this.target.attribute;
|
|
25718
|
+
this.propKeys.forEach(key => {
|
|
25719
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
25720
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
25721
|
+
}
|
|
25722
|
+
}
|
|
25723
|
+
class GrowWidthOut extends ACustomAnimate {
|
|
25724
|
+
constructor(from, to, duration, easing, params) {
|
|
25725
|
+
super(from, to, duration, easing, params);
|
|
25726
|
+
}
|
|
25727
|
+
onBind() {
|
|
25728
|
+
super.onBind();
|
|
25729
|
+
const {
|
|
25730
|
+
from: from,
|
|
25731
|
+
to: to
|
|
25732
|
+
} = (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));
|
|
25733
|
+
var graphic, options, animationParameters, _a;
|
|
25734
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = null != from ? from : this.target.attribute, this.to = to;
|
|
25735
|
+
}
|
|
25736
|
+
onEnd(cb) {
|
|
25737
|
+
super.onEnd(cb);
|
|
25738
|
+
}
|
|
25739
|
+
onUpdate(end, ratio, out) {
|
|
25740
|
+
const attribute = this.target.attribute;
|
|
25741
|
+
this.propKeys.forEach(key => {
|
|
25742
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
25743
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
25744
|
+
}
|
|
25745
|
+
}
|
|
25746
|
+
|
|
25747
|
+
class LabelItemAppear extends AComponentAnimate {
|
|
25748
|
+
onBind() {
|
|
25749
|
+
super.onBind();
|
|
25750
|
+
const animator = createComponentAnimator(this.target);
|
|
25751
|
+
this._animator = animator;
|
|
25752
|
+
const duration = this.duration,
|
|
25753
|
+
easing = this.easing,
|
|
25754
|
+
target = this.target,
|
|
25755
|
+
{
|
|
25756
|
+
symbolStartOuterType = "scale",
|
|
25757
|
+
titleType = "typewriter",
|
|
25758
|
+
titlePanelType = "scale"
|
|
25759
|
+
} = this.params,
|
|
25760
|
+
symbolTime = duration / 10;
|
|
25761
|
+
let symbolStartOuterFrom, symbolStartOuterTo;
|
|
25762
|
+
if (target._symbolStart.setAttributes({
|
|
25763
|
+
scaleX: 0,
|
|
25764
|
+
scaleY: 0
|
|
25765
|
+
}), animator.animate(target._symbolStart, {
|
|
25766
|
+
type: "to",
|
|
25767
|
+
to: {
|
|
25768
|
+
scaleX: 1,
|
|
25769
|
+
scaleY: 1
|
|
25770
|
+
},
|
|
25771
|
+
duration: 5 * symbolTime,
|
|
25772
|
+
easing: easing
|
|
25773
|
+
}), "scale" === symbolStartOuterType ? (symbolStartOuterFrom = {
|
|
25774
|
+
scaleX: 0,
|
|
25775
|
+
scaleY: 0
|
|
25776
|
+
}, symbolStartOuterTo = {
|
|
25777
|
+
scaleX: 1,
|
|
25778
|
+
scaleY: 1
|
|
25779
|
+
}) : (symbolStartOuterFrom = {
|
|
25780
|
+
clipRange: 0
|
|
25781
|
+
}, symbolStartOuterTo = {
|
|
25782
|
+
clipRange: 1
|
|
25783
|
+
}), target._symbolStartOuter.setAttributes(symbolStartOuterFrom), animator.animate(target._symbolStartOuter, {
|
|
25784
|
+
type: "to",
|
|
25785
|
+
to: symbolStartOuterTo,
|
|
25786
|
+
duration: 5 * symbolTime,
|
|
25787
|
+
easing: easing
|
|
25788
|
+
}), target._symbolEnd.setAttributes({
|
|
25789
|
+
scaleX: 0,
|
|
25790
|
+
scaleY: 0
|
|
25791
|
+
}), animator.animate(target._symbolEnd, {
|
|
25792
|
+
type: "to",
|
|
25793
|
+
to: {
|
|
25794
|
+
scaleX: 1,
|
|
25795
|
+
scaleY: 1
|
|
25796
|
+
},
|
|
25797
|
+
duration: 2 * symbolTime,
|
|
25798
|
+
delay: 8 * symbolTime,
|
|
25799
|
+
easing: easing
|
|
25800
|
+
}), target._line.setAttributes({
|
|
25801
|
+
clipRange: 0
|
|
25802
|
+
}), animator.animate(target._line, {
|
|
25803
|
+
type: "to",
|
|
25804
|
+
to: {
|
|
25805
|
+
clipRange: 1
|
|
25806
|
+
},
|
|
25807
|
+
duration: 9 * symbolTime,
|
|
25808
|
+
easing: easing
|
|
25809
|
+
}), "typewriter" === titleType) {
|
|
25810
|
+
const titleTopText = target._titleTop.attribute.text;
|
|
25811
|
+
target._titleTop.setAttributes({
|
|
25812
|
+
text: ""
|
|
25813
|
+
}), animator.animate(target._titleTop, {
|
|
25814
|
+
type: "custom",
|
|
25815
|
+
delay: 5 * symbolTime,
|
|
25816
|
+
duration: 4 * symbolTime,
|
|
25817
|
+
easing: "linear",
|
|
25818
|
+
to: {
|
|
25819
|
+
text: titleTopText
|
|
25820
|
+
},
|
|
25821
|
+
custom: InputText
|
|
25822
|
+
});
|
|
25823
|
+
const titleBottomText = target._titleBottom.attribute.text;
|
|
25824
|
+
target._titleBottom.setAttributes({
|
|
25825
|
+
text: ""
|
|
25826
|
+
}), animator.animate(target._titleBottom, {
|
|
25827
|
+
type: "custom",
|
|
25828
|
+
delay: 5 * symbolTime,
|
|
25829
|
+
duration: 4 * symbolTime,
|
|
25830
|
+
easing: "linear",
|
|
25831
|
+
to: {
|
|
25832
|
+
text: titleBottomText
|
|
25833
|
+
},
|
|
25834
|
+
custom: InputText
|
|
25835
|
+
});
|
|
25836
|
+
} else target._titleTop.setAttributes({
|
|
25837
|
+
dy: target._titleTop.AABBBounds.height() + 10
|
|
25838
|
+
}), animator.animate(target._titleTop, {
|
|
25839
|
+
type: "to",
|
|
25840
|
+
to: {
|
|
25841
|
+
dy: 0
|
|
25842
|
+
},
|
|
25843
|
+
delay: 5 * symbolTime,
|
|
25844
|
+
duration: 4 * symbolTime,
|
|
25845
|
+
easing: "linear"
|
|
25846
|
+
}), target._titleBottom.setAttributes({
|
|
25847
|
+
dy: -(10 + target._titleBottom.AABBBounds.height())
|
|
25848
|
+
}), animator.animate(target._titleBottom, {
|
|
25849
|
+
type: "to",
|
|
25850
|
+
to: {
|
|
25851
|
+
dy: 0
|
|
25852
|
+
},
|
|
25853
|
+
delay: 5 * symbolTime,
|
|
25854
|
+
duration: 4 * symbolTime,
|
|
25855
|
+
easing: "linear"
|
|
25856
|
+
});
|
|
25857
|
+
"scale" === titlePanelType ? [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {
|
|
25858
|
+
var _a;
|
|
25859
|
+
const scaleX = null !== (_a = panel.attribute.scaleX) && void 0 !== _a ? _a : 1;
|
|
25860
|
+
panel.setAttributes({
|
|
25861
|
+
scaleX: 0
|
|
25862
|
+
}), animator.animate(panel, {
|
|
25863
|
+
type: "to",
|
|
25864
|
+
to: {
|
|
25865
|
+
scaleX: scaleX
|
|
25866
|
+
},
|
|
25867
|
+
duration: duration,
|
|
25868
|
+
easing: easing
|
|
25869
|
+
});
|
|
25870
|
+
}) : "stroke" === titlePanelType && [target._titleTopPanel, target._titleBottomPanel].forEach(panel => {
|
|
25871
|
+
const b = panel.AABBBounds,
|
|
25872
|
+
totalLen = 2 * (b.width() + b.height());
|
|
25873
|
+
panel.setAttributes({
|
|
25874
|
+
lineDash: [0, 10 * totalLen]
|
|
25875
|
+
}), animator.animate(panel, {
|
|
25876
|
+
type: "to",
|
|
25877
|
+
to: {
|
|
25878
|
+
lineDash: [totalLen, 10 * totalLen]
|
|
25879
|
+
},
|
|
25880
|
+
duration: duration,
|
|
25881
|
+
easing: easing
|
|
25882
|
+
});
|
|
25883
|
+
}), this.completeBind(animator);
|
|
25884
|
+
}
|
|
25885
|
+
}
|
|
25886
|
+
class LabelItemDisappear extends AComponentAnimate {
|
|
25887
|
+
onBind() {
|
|
25888
|
+
super.onBind();
|
|
25889
|
+
const animator = createComponentAnimator(this.target);
|
|
25890
|
+
this._animator = animator;
|
|
25891
|
+
const duration = this.duration,
|
|
25892
|
+
easing = this.easing,
|
|
25893
|
+
target = this.target,
|
|
25894
|
+
{
|
|
25895
|
+
mode: mode
|
|
25896
|
+
} = this.params;
|
|
25897
|
+
"scale" === mode ? animator.animate(target._symbolStart, {
|
|
25898
|
+
type: "to",
|
|
25899
|
+
to: {
|
|
25900
|
+
scaleX: 0,
|
|
25901
|
+
scaleY: 0
|
|
25902
|
+
},
|
|
25903
|
+
duration: duration,
|
|
25904
|
+
easing: easing
|
|
25905
|
+
}) : (animator.animate(target._line, {
|
|
25906
|
+
type: "to",
|
|
25907
|
+
to: {
|
|
25908
|
+
clipRange: 0
|
|
25909
|
+
},
|
|
25910
|
+
duration: duration,
|
|
25911
|
+
easing: easing
|
|
25912
|
+
}), animator.animate(target._symbolStart, {
|
|
25913
|
+
type: "to",
|
|
25914
|
+
to: {
|
|
25915
|
+
scaleX: 0,
|
|
25916
|
+
scaleY: 0
|
|
25917
|
+
},
|
|
25918
|
+
duration: duration / 2,
|
|
25919
|
+
delay: duration / 2,
|
|
25920
|
+
easing: easing
|
|
25921
|
+
}), animator.animate(target._symbolEnd, {
|
|
25922
|
+
type: "to",
|
|
25923
|
+
to: {
|
|
25924
|
+
scaleX: 0,
|
|
25925
|
+
scaleY: 0
|
|
25926
|
+
},
|
|
25927
|
+
duration: duration,
|
|
25928
|
+
easing: easing
|
|
25929
|
+
}), animator.animate(target._titleTop, {
|
|
25930
|
+
type: "to",
|
|
25931
|
+
to: {
|
|
25932
|
+
dy: target._titleTop.AABBBounds.height() + 10
|
|
25933
|
+
},
|
|
25934
|
+
duration: duration / 2,
|
|
25935
|
+
easing: easing
|
|
25936
|
+
}), animator.animate(target._titleBottom, {
|
|
25937
|
+
type: "to",
|
|
25938
|
+
to: {
|
|
25939
|
+
dy: -(10 + target._titleBottom.AABBBounds.height())
|
|
25940
|
+
},
|
|
25941
|
+
duration: duration / 2,
|
|
25942
|
+
easing: easing
|
|
25943
|
+
}), animator.animate(target._symbolStartOuter, {
|
|
25944
|
+
type: "to",
|
|
25945
|
+
to: {
|
|
25946
|
+
clipRange: 0
|
|
25947
|
+
},
|
|
25948
|
+
duration: duration / 2,
|
|
25949
|
+
delay: duration / 2,
|
|
25950
|
+
easing: easing
|
|
25951
|
+
}), animator.animate(target._titleTopPanel, {
|
|
25952
|
+
type: "to",
|
|
25953
|
+
to: {
|
|
25954
|
+
scaleX: 0
|
|
25955
|
+
},
|
|
25956
|
+
duration: duration,
|
|
25957
|
+
easing: easing
|
|
25958
|
+
}), animator.animate(target._titleBottomPanel, {
|
|
25959
|
+
type: "to",
|
|
25960
|
+
to: {
|
|
25961
|
+
scaleX: 0
|
|
25962
|
+
},
|
|
25963
|
+
duration: duration,
|
|
25964
|
+
easing: easing
|
|
25965
|
+
})), this.completeBind(animator);
|
|
25966
|
+
}
|
|
25967
|
+
}
|
|
25968
|
+
|
|
25969
|
+
class PoptipAppear extends AComponentAnimate {
|
|
25970
|
+
onBind() {
|
|
25971
|
+
super.onBind();
|
|
25972
|
+
const animator = createComponentAnimator(this.target);
|
|
25973
|
+
this._animator = animator;
|
|
25974
|
+
const duration = this.duration,
|
|
25975
|
+
easing = this.easing,
|
|
25976
|
+
target = this.target,
|
|
25977
|
+
{
|
|
25978
|
+
wave: wave
|
|
25979
|
+
} = this.params;
|
|
25980
|
+
if (target.setAttributes({
|
|
25981
|
+
scaleX: 0,
|
|
25982
|
+
scaleY: 0
|
|
25983
|
+
}), animator.animate(target, {
|
|
25984
|
+
type: "to",
|
|
25985
|
+
to: {
|
|
25986
|
+
scaleX: 1,
|
|
25987
|
+
scaleY: 1
|
|
25988
|
+
},
|
|
25989
|
+
duration: duration / 3 * 2,
|
|
25990
|
+
easing: easing
|
|
25991
|
+
}), target.titleShape && animator.animate(target.titleShape, {
|
|
25992
|
+
type: "custom",
|
|
25993
|
+
to: {
|
|
25994
|
+
text: target.titleShape.attribute.text
|
|
25995
|
+
},
|
|
25996
|
+
duration: duration,
|
|
25997
|
+
easing: easing,
|
|
25998
|
+
custom: InputText
|
|
25999
|
+
}), target.contentShape && animator.animate(target.contentShape, {
|
|
26000
|
+
type: "custom",
|
|
26001
|
+
to: {
|
|
26002
|
+
text: target.contentShape.attribute.text
|
|
26003
|
+
},
|
|
26004
|
+
duration: duration,
|
|
26005
|
+
easing: easing,
|
|
26006
|
+
custom: InputText
|
|
26007
|
+
}), wave) {
|
|
26008
|
+
const dur = duration / 6;
|
|
26009
|
+
animator.animate(target.group, {
|
|
26010
|
+
timeSlices: [{
|
|
26011
|
+
duration: dur,
|
|
26012
|
+
effects: {
|
|
26013
|
+
type: "to",
|
|
26014
|
+
to: {
|
|
26015
|
+
angle: wave
|
|
26016
|
+
},
|
|
26017
|
+
easing: easing
|
|
26018
|
+
}
|
|
26019
|
+
}, {
|
|
26020
|
+
duration: 2 * dur,
|
|
26021
|
+
effects: {
|
|
26022
|
+
type: "to",
|
|
26023
|
+
to: {
|
|
26024
|
+
angle: -wave
|
|
26025
|
+
},
|
|
26026
|
+
easing: easing
|
|
26027
|
+
}
|
|
26028
|
+
}, {
|
|
26029
|
+
duration: 2 * dur,
|
|
26030
|
+
effects: {
|
|
26031
|
+
type: "to",
|
|
26032
|
+
to: {
|
|
26033
|
+
angle: wave
|
|
26034
|
+
},
|
|
26035
|
+
easing: easing
|
|
26036
|
+
}
|
|
26037
|
+
}, {
|
|
26038
|
+
duration: dur,
|
|
26039
|
+
effects: {
|
|
26040
|
+
type: "to",
|
|
26041
|
+
to: {
|
|
26042
|
+
angle: 0
|
|
26043
|
+
},
|
|
26044
|
+
easing: easing
|
|
26045
|
+
}
|
|
26046
|
+
}]
|
|
26047
|
+
});
|
|
26048
|
+
}
|
|
26049
|
+
this.completeBind(animator);
|
|
26050
|
+
}
|
|
26051
|
+
}
|
|
26052
|
+
class PoptipDisappear extends AComponentAnimate {
|
|
26053
|
+
onBind() {
|
|
26054
|
+
super.onBind();
|
|
26055
|
+
const animator = createComponentAnimator(this.target);
|
|
26056
|
+
this._animator = animator;
|
|
26057
|
+
const duration = this.duration,
|
|
26058
|
+
easing = this.easing,
|
|
26059
|
+
target = this.target;
|
|
26060
|
+
animator.animate(target, {
|
|
26061
|
+
type: "to",
|
|
26062
|
+
to: {
|
|
26063
|
+
scaleX: 0,
|
|
26064
|
+
scaleY: 0
|
|
26065
|
+
},
|
|
26066
|
+
duration: duration,
|
|
26067
|
+
easing: easing
|
|
26068
|
+
}), this.completeBind(animator);
|
|
26069
|
+
}
|
|
26070
|
+
}
|
|
26071
|
+
|
|
26072
|
+
class InputRichText extends ACustomAnimate {
|
|
26073
|
+
constructor(from, to, duration, easing, params) {
|
|
26074
|
+
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);
|
|
26075
|
+
}
|
|
26076
|
+
onFirstRun() {
|
|
26077
|
+
const fromProps = this.getLastProps(),
|
|
26078
|
+
toProps = this.getEndProps();
|
|
26079
|
+
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;
|
|
26080
|
+
}
|
|
26081
|
+
onEnd(cb) {
|
|
26082
|
+
super.onEnd(cb), cb || this.target.setAttribute("textConfig", this.originalTextConfig);
|
|
26083
|
+
}
|
|
26084
|
+
onUpdate(end, ratio, out) {
|
|
26085
|
+
if (!this.valid) return;
|
|
26086
|
+
const totalItems = this.toTextConfig.length,
|
|
26087
|
+
fromItems = this.fromTextConfig.length,
|
|
26088
|
+
maxTextShowRatio = this.fadeInChars ? 1 - this.fadeInDuration : 1;
|
|
26089
|
+
let currentLength, currentTextConfig;
|
|
26090
|
+
if (fromItems > totalItems) currentLength = Math.round(fromItems - (fromItems - totalItems) * ratio);else if (this.fadeInChars) {
|
|
26091
|
+
const adjustedRatio = Math.min(1, ratio / maxTextShowRatio);
|
|
26092
|
+
currentLength = Math.round(fromItems + (totalItems - fromItems) * adjustedRatio);
|
|
26093
|
+
} else currentLength = Math.round(fromItems + (totalItems - fromItems) * ratio);
|
|
26094
|
+
if (currentTextConfig = fromItems > totalItems ? this.fromTextConfig.slice(0, currentLength) : this.toTextConfig.slice(0, currentLength).map((item, index) => {
|
|
26095
|
+
if ("text" in item) {
|
|
26096
|
+
const newItem = Object.assign({}, item);
|
|
26097
|
+
if (this.strokeFirst) {
|
|
26098
|
+
const appearTime = index / totalItems * maxTextShowRatio,
|
|
26099
|
+
itemLifetime = Math.max(0, ratio - appearTime),
|
|
26100
|
+
maxLifetime = 1 - appearTime,
|
|
26101
|
+
fillProgress = Math.min(1, itemLifetime / (this.strokeToFillRatio * maxLifetime));
|
|
26102
|
+
if ("fill" in newItem && newItem.fill && (newItem.stroke = newItem.fill, fillProgress < 1 && (newItem.fillOpacity = fillProgress)), this.fadeInChars) {
|
|
26103
|
+
const fadeProgress = Math.min(1, itemLifetime / (this.fadeInDuration * maxLifetime));
|
|
26104
|
+
newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
|
|
26105
|
+
}
|
|
26106
|
+
} else if (this.fadeInChars) {
|
|
26107
|
+
const fadeProgress = (ratio - index / totalItems * maxTextShowRatio) / this.fadeInDuration;
|
|
26108
|
+
newItem.opacity = Math.max(0, Math.min(1, fadeProgress));
|
|
26109
|
+
}
|
|
26110
|
+
return newItem;
|
|
26111
|
+
}
|
|
26112
|
+
return item;
|
|
26113
|
+
}), this.showCursor && currentLength < totalItems) {
|
|
26114
|
+
let shouldShowCursor = !0;
|
|
26115
|
+
if (this.blinkCursor) {
|
|
26116
|
+
const blinkRate = .1;
|
|
26117
|
+
shouldShowCursor = Math.floor(ratio / blinkRate) % 2 == 0;
|
|
26118
|
+
}
|
|
26119
|
+
if (shouldShowCursor && currentTextConfig.length > 0) {
|
|
26120
|
+
const lastIndex = currentTextConfig.length - 1,
|
|
26121
|
+
lastItem = currentTextConfig[lastIndex];
|
|
26122
|
+
if ("text" in lastItem) currentTextConfig[lastIndex] = Object.assign(Object.assign({}, lastItem), {
|
|
26123
|
+
text: String(lastItem.text) + this.cursorChar
|
|
26124
|
+
});else {
|
|
26125
|
+
const cursorItem = {
|
|
26126
|
+
text: this.cursorChar,
|
|
26127
|
+
fontSize: 16
|
|
26128
|
+
};
|
|
26129
|
+
currentTextConfig.push(cursorItem);
|
|
26130
|
+
}
|
|
26131
|
+
}
|
|
26132
|
+
}
|
|
26133
|
+
this.target.setAttribute("textConfig", currentTextConfig);
|
|
26134
|
+
}
|
|
26135
|
+
}
|
|
26136
|
+
|
|
26137
|
+
class OutputRichText extends ACustomAnimate {
|
|
26138
|
+
constructor(from, to, duration, easing, params) {
|
|
26139
|
+
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"];
|
|
26140
|
+
}
|
|
26141
|
+
onFirstRun() {
|
|
26142
|
+
const fromProps = this.getLastProps(),
|
|
26143
|
+
toProps = this.getEndProps();
|
|
26144
|
+
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;
|
|
26145
|
+
}
|
|
26146
|
+
onEnd(cb) {
|
|
26147
|
+
super.onEnd(cb), cb || (this.toTextConfig.length > 0 ? this.target.setAttribute("textConfig", this.toTextConfig) : this.target.setAttribute("textConfig", []));
|
|
26148
|
+
}
|
|
26149
|
+
onUpdate(end, ratio, out) {
|
|
26150
|
+
if (!this.valid) return;
|
|
26151
|
+
const fromItems = this.fromTextConfig.length,
|
|
26152
|
+
maxTextHideRatio = this.fadeOutChars ? 1 - this.fadeOutDuration : 1;
|
|
26153
|
+
let displayedLength;
|
|
26154
|
+
if ("forward" === this.direction) {
|
|
26155
|
+
if (this.fadeOutChars) {
|
|
26156
|
+
const adjustedRatio = Math.min(1, ratio / maxTextHideRatio);
|
|
26157
|
+
displayedLength = Math.round(fromItems * (1 - adjustedRatio));
|
|
26158
|
+
} else displayedLength = Math.round(fromItems * (1 - ratio));
|
|
26159
|
+
let currentTextConfig = "forward" === this.direction ? this.fromTextConfig.slice(fromItems - displayedLength) : this.fromTextConfig.slice(0, displayedLength);
|
|
26160
|
+
this.fadeOutChars && (currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength)), this.showCursor && displayedLength > 0 && (currentTextConfig = this.addCursor(currentTextConfig, ratio)), this.target.setAttribute("textConfig", currentTextConfig);
|
|
26161
|
+
} else {
|
|
26162
|
+
if (this.fadeOutChars) {
|
|
26163
|
+
const adjustedRatio = Math.min(1, ratio / maxTextHideRatio);
|
|
26164
|
+
displayedLength = Math.round(fromItems * (1 - adjustedRatio));
|
|
26165
|
+
} else displayedLength = Math.round(fromItems * (1 - ratio));
|
|
26166
|
+
let currentTextConfig = this.fromTextConfig.slice(0, displayedLength);
|
|
26167
|
+
this.fadeOutChars && (currentTextConfig = this.applyFadeEffect(currentTextConfig, ratio, fromItems, displayedLength)), this.showCursor && displayedLength > 0 && (currentTextConfig = this.addCursor(currentTextConfig, ratio)), this.target.setAttribute("textConfig", currentTextConfig);
|
|
26168
|
+
}
|
|
26169
|
+
}
|
|
26170
|
+
applyFadeEffect(textConfig, ratio, totalItems, displayedLength) {
|
|
26171
|
+
"forward" === this.direction ? totalItems - displayedLength : displayedLength;
|
|
26172
|
+
const fadeProgress = (ratio - (1 - this.fadeOutDuration)) / this.fadeOutDuration,
|
|
26173
|
+
fadeOpacity = Math.max(0, 1 - Math.min(1, fadeProgress));
|
|
26174
|
+
return textConfig.map((item, index) => {
|
|
26175
|
+
if ("forward" === this.direction) {
|
|
26176
|
+
if (0 === index && "text" in item) return Object.assign(Object.assign({}, item), {
|
|
26177
|
+
opacity: fadeOpacity
|
|
26178
|
+
});
|
|
26179
|
+
} else if (index === textConfig.length - 1 && "text" in item) return Object.assign(Object.assign({}, item), {
|
|
26180
|
+
opacity: fadeOpacity
|
|
26181
|
+
});
|
|
26182
|
+
return item;
|
|
26183
|
+
});
|
|
26184
|
+
}
|
|
26185
|
+
addCursor(textConfig, ratio) {
|
|
26186
|
+
let shouldShowCursor = !0;
|
|
26187
|
+
if (this.blinkCursor) {
|
|
26188
|
+
const blinkRate = .1;
|
|
26189
|
+
shouldShowCursor = Math.floor(ratio / blinkRate) % 2 == 0;
|
|
26190
|
+
}
|
|
26191
|
+
if (shouldShowCursor && textConfig.length > 0) {
|
|
26192
|
+
const cursorIndex = "forward" === this.direction ? 0 : textConfig.length - 1,
|
|
26193
|
+
cursorItem = textConfig[cursorIndex];
|
|
26194
|
+
if ("text" in cursorItem) {
|
|
26195
|
+
const result = [...textConfig];
|
|
26196
|
+
return "forward" === this.direction ? result[cursorIndex] = Object.assign(Object.assign({}, cursorItem), {
|
|
26197
|
+
text: this.cursorChar + String(cursorItem.text)
|
|
26198
|
+
}) : result[cursorIndex] = Object.assign(Object.assign({}, cursorItem), {
|
|
26199
|
+
text: String(cursorItem.text) + this.cursorChar
|
|
26200
|
+
}), result;
|
|
26201
|
+
}
|
|
26202
|
+
}
|
|
26203
|
+
return textConfig;
|
|
26204
|
+
}
|
|
26205
|
+
}
|
|
26206
|
+
|
|
26207
|
+
class SlideRichText extends ACustomAnimate {
|
|
26208
|
+
constructor(from, to, duration, easing, params) {
|
|
26209
|
+
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);
|
|
26210
|
+
}
|
|
26211
|
+
onFirstRun() {
|
|
26212
|
+
const fromProps = this.getLastProps(),
|
|
26213
|
+
toProps = this.getEndProps();
|
|
26214
|
+
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), {
|
|
26215
|
+
opacity: 0,
|
|
26216
|
+
dx: this.getInitialDx(),
|
|
26217
|
+
dy: this.getInitialDy()
|
|
26218
|
+
}) : Object.assign(Object.assign({}, item), {
|
|
26219
|
+
opacity: 0
|
|
26220
|
+
})), this.wordByWord && this.calculateWordGroups()) : this.valid = !1;
|
|
26221
|
+
}
|
|
26222
|
+
calculateWordGroups() {
|
|
26223
|
+
this.wordGroups = [];
|
|
26224
|
+
let fullText = "";
|
|
26225
|
+
const charMap = {};
|
|
26226
|
+
let match,
|
|
26227
|
+
fullTextIndex = 0;
|
|
26228
|
+
for (this.toTextConfig.forEach((item, configIndex) => {
|
|
26229
|
+
if (("text" in item)) {
|
|
26230
|
+
const text = String(item.text);
|
|
26231
|
+
fullText += text, charMap[fullTextIndex] = configIndex, fullTextIndex++;
|
|
26232
|
+
}
|
|
26233
|
+
}), this.wordRegex.lastIndex = 0; null !== (match = this.wordRegex.exec(fullText));) {
|
|
26234
|
+
const wordStart = match.index,
|
|
26235
|
+
wordEnd = match.index + match[0].length,
|
|
26236
|
+
wordIndices = [];
|
|
26237
|
+
for (let i = wordStart; i < wordEnd; i++) void 0 !== charMap[i] && wordIndices.push(charMap[i]);
|
|
26238
|
+
wordIndices.length > 0 && this.wordGroups.push(wordIndices);
|
|
26239
|
+
}
|
|
26240
|
+
const allocatedIndices = new Set();
|
|
26241
|
+
this.wordGroups.forEach(group => {
|
|
26242
|
+
group.forEach(index => allocatedIndices.add(index));
|
|
26243
|
+
});
|
|
26244
|
+
for (let i = 0; i < this.toTextConfig.length; i++) "text" in this.toTextConfig[i] && !allocatedIndices.has(i) && this.wordGroups.push([i]);
|
|
26245
|
+
}
|
|
26246
|
+
getInitialDx() {
|
|
26247
|
+
switch (this.slideDirection) {
|
|
26248
|
+
case "left":
|
|
26249
|
+
return -this.slideDistance;
|
|
26250
|
+
case "right":
|
|
26251
|
+
return this.slideDistance;
|
|
26252
|
+
default:
|
|
26253
|
+
return 0;
|
|
26254
|
+
}
|
|
26255
|
+
}
|
|
26256
|
+
getInitialDy() {
|
|
26257
|
+
switch (this.slideDirection) {
|
|
26258
|
+
case "up":
|
|
26259
|
+
return -this.slideDistance;
|
|
26260
|
+
case "down":
|
|
26261
|
+
return this.slideDistance;
|
|
26262
|
+
default:
|
|
26263
|
+
return 0;
|
|
26264
|
+
}
|
|
26265
|
+
}
|
|
26266
|
+
onEnd(cb) {
|
|
26267
|
+
super.onEnd(cb), cb || this.target.setAttribute("textConfig", this.originalTextConfig);
|
|
26268
|
+
}
|
|
26269
|
+
onUpdate(end, ratio, out) {
|
|
26270
|
+
if (!this.valid) return;
|
|
26271
|
+
const maxTextShowRatio = 1 - this.fadeInDuration;
|
|
26272
|
+
let updatedTextConfig;
|
|
26273
|
+
updatedTextConfig = this.wordByWord && this.wordGroups.length > 0 ? this.updateByWord(ratio, maxTextShowRatio) : this.updateByCharacter(ratio, maxTextShowRatio), this.target.setAttribute("textConfig", updatedTextConfig);
|
|
26274
|
+
}
|
|
26275
|
+
updateByWord(ratio, maxTextShowRatio) {
|
|
26276
|
+
const totalGroups = this.wordGroups.length,
|
|
26277
|
+
updatedTextConfig = [...this.singleCharConfig];
|
|
26278
|
+
for (let groupIndex = 0; groupIndex < this.wordGroups.length; groupIndex++) {
|
|
26279
|
+
let appearTime;
|
|
26280
|
+
if (appearTime = "left" === this.slideDirection ? (totalGroups - 1 - groupIndex) / totalGroups * maxTextShowRatio : groupIndex / totalGroups * maxTextShowRatio, ratio < appearTime) {
|
|
26281
|
+
for (const charIndex of this.wordGroups[groupIndex]) {
|
|
26282
|
+
const item = updatedTextConfig[charIndex];
|
|
26283
|
+
"text" in item && (updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), {
|
|
26284
|
+
opacity: 0,
|
|
26285
|
+
dx: this.getInitialDx(),
|
|
26286
|
+
dy: this.getInitialDy()
|
|
26287
|
+
}));
|
|
26288
|
+
}
|
|
26289
|
+
continue;
|
|
26290
|
+
}
|
|
26291
|
+
const animProgress = (ratio - appearTime) / this.fadeInDuration,
|
|
26292
|
+
progress = Math.max(0, Math.min(1, animProgress)),
|
|
26293
|
+
dx = this.getInitialDx() * (1 - progress),
|
|
26294
|
+
dy = this.getInitialDy() * (1 - progress);
|
|
26295
|
+
for (const charIndex of this.wordGroups[groupIndex]) {
|
|
26296
|
+
const item = updatedTextConfig[charIndex];
|
|
26297
|
+
"text" in item && (updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), {
|
|
26298
|
+
opacity: progress,
|
|
26299
|
+
dx: dx,
|
|
26300
|
+
dy: dy
|
|
26301
|
+
}));
|
|
26302
|
+
}
|
|
26303
|
+
}
|
|
26304
|
+
return updatedTextConfig;
|
|
26305
|
+
}
|
|
26306
|
+
updateByCharacter(ratio, maxTextShowRatio) {
|
|
26307
|
+
const totalItems = this.toTextConfig.length,
|
|
26308
|
+
updatedTextConfig = [...this.singleCharConfig];
|
|
26309
|
+
for (let index = 0; index < updatedTextConfig.length; index++) {
|
|
26310
|
+
const item = updatedTextConfig[index];
|
|
26311
|
+
if ("text" in item) {
|
|
26312
|
+
let appearTime;
|
|
26313
|
+
if (appearTime = "left" === this.slideDirection ? (totalItems - 1 - index) / totalItems * maxTextShowRatio : index / totalItems * maxTextShowRatio, ratio < appearTime) {
|
|
26314
|
+
updatedTextConfig[index] = Object.assign(Object.assign({}, item), {
|
|
26315
|
+
opacity: 0,
|
|
26316
|
+
dx: this.getInitialDx(),
|
|
26317
|
+
dy: this.getInitialDy()
|
|
26318
|
+
});
|
|
26319
|
+
continue;
|
|
26320
|
+
}
|
|
26321
|
+
const animProgress = (ratio - appearTime) / this.fadeInDuration,
|
|
26322
|
+
progress = Math.max(0, Math.min(1, animProgress)),
|
|
26323
|
+
dx = this.getInitialDx() * (1 - progress),
|
|
26324
|
+
dy = this.getInitialDy() * (1 - progress);
|
|
26325
|
+
updatedTextConfig[index] = Object.assign(Object.assign({}, item), {
|
|
26326
|
+
opacity: progress,
|
|
26327
|
+
dx: dx,
|
|
26328
|
+
dy: dy
|
|
26329
|
+
});
|
|
26330
|
+
}
|
|
26331
|
+
}
|
|
26332
|
+
return updatedTextConfig;
|
|
26333
|
+
}
|
|
26334
|
+
}
|
|
26335
|
+
|
|
26336
|
+
class SlideOutRichText extends ACustomAnimate {
|
|
26337
|
+
constructor(from, to, duration, easing, params) {
|
|
26338
|
+
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"];
|
|
26339
|
+
}
|
|
26340
|
+
onFirstRun() {
|
|
26341
|
+
const fromProps = this.getLastProps(),
|
|
26342
|
+
toProps = this.getEndProps();
|
|
26343
|
+
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), {
|
|
26344
|
+
opacity: 1,
|
|
26345
|
+
dx: 0,
|
|
26346
|
+
dy: 0
|
|
26347
|
+
}) : Object.assign(Object.assign({}, item), {
|
|
26348
|
+
opacity: 1
|
|
26349
|
+
})), this.wordByWord && this.calculateWordGroups()) : this.valid = !1;
|
|
26350
|
+
}
|
|
26351
|
+
calculateWordGroups() {
|
|
26352
|
+
this.wordGroups = [];
|
|
26353
|
+
let fullText = "";
|
|
26354
|
+
const charMap = {};
|
|
26355
|
+
let match,
|
|
26356
|
+
fullTextIndex = 0;
|
|
26357
|
+
for (this.fromTextConfig.forEach((item, configIndex) => {
|
|
26358
|
+
if (("text" in item)) {
|
|
26359
|
+
const text = String(item.text);
|
|
26360
|
+
fullText += text, charMap[fullTextIndex] = configIndex, fullTextIndex++;
|
|
26361
|
+
}
|
|
26362
|
+
}), this.wordRegex.lastIndex = 0; null !== (match = this.wordRegex.exec(fullText));) {
|
|
26363
|
+
const wordStart = match.index,
|
|
26364
|
+
wordEnd = match.index + match[0].length,
|
|
26365
|
+
wordIndices = [];
|
|
26366
|
+
for (let i = wordStart; i < wordEnd; i++) void 0 !== charMap[i] && wordIndices.push(charMap[i]);
|
|
26367
|
+
wordIndices.length > 0 && this.wordGroups.push(wordIndices);
|
|
26368
|
+
}
|
|
26369
|
+
const allocatedIndices = new Set();
|
|
26370
|
+
this.wordGroups.forEach(group => {
|
|
26371
|
+
group.forEach(index => allocatedIndices.add(index));
|
|
26372
|
+
});
|
|
26373
|
+
for (let i = 0; i < this.fromTextConfig.length; i++) "text" in this.fromTextConfig[i] && !allocatedIndices.has(i) && this.wordGroups.push([i]);
|
|
26374
|
+
}
|
|
26375
|
+
getTargetDx() {
|
|
26376
|
+
switch (this.slideDirection) {
|
|
26377
|
+
case "left":
|
|
26378
|
+
return -this.slideDistance;
|
|
26379
|
+
case "right":
|
|
26380
|
+
return this.slideDistance;
|
|
26381
|
+
default:
|
|
26382
|
+
return 0;
|
|
26383
|
+
}
|
|
26384
|
+
}
|
|
26385
|
+
getTargetDy() {
|
|
26386
|
+
switch (this.slideDirection) {
|
|
26387
|
+
case "up":
|
|
26388
|
+
return -this.slideDistance;
|
|
26389
|
+
case "down":
|
|
26390
|
+
return this.slideDistance;
|
|
26391
|
+
default:
|
|
26392
|
+
return 0;
|
|
26393
|
+
}
|
|
26394
|
+
}
|
|
26395
|
+
onEnd(cb) {
|
|
26396
|
+
super.onEnd(cb), cb || (this.toTextConfig.length > 0 ? this.target.setAttribute("textConfig", this.toTextConfig) : this.target.setAttribute("textConfig", []));
|
|
26397
|
+
}
|
|
26398
|
+
onUpdate(end, ratio, out) {
|
|
26399
|
+
if (!this.valid) return;
|
|
26400
|
+
const maxTextShowRatio = 1 - this.fadeOutDuration;
|
|
26401
|
+
let updatedTextConfig;
|
|
26402
|
+
updatedTextConfig = this.wordByWord && this.wordGroups.length > 0 ? this.updateByWord(ratio, maxTextShowRatio) : this.updateByCharacter(ratio, maxTextShowRatio), this.target.setAttribute("textConfig", updatedTextConfig);
|
|
26403
|
+
}
|
|
26404
|
+
updateByWord(ratio, maxTextShowRatio) {
|
|
26405
|
+
const totalGroups = this.wordGroups.length,
|
|
26406
|
+
updatedTextConfig = [...this.singleCharConfig];
|
|
26407
|
+
for (let groupIndex = 0; groupIndex < this.wordGroups.length; groupIndex++) {
|
|
26408
|
+
let disappearTime;
|
|
26409
|
+
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) {
|
|
26410
|
+
for (const charIndex of this.wordGroups[groupIndex]) {
|
|
26411
|
+
const item = updatedTextConfig[charIndex];
|
|
26412
|
+
"text" in item && (updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), {
|
|
26413
|
+
opacity: 1,
|
|
26414
|
+
dx: 0,
|
|
26415
|
+
dy: 0
|
|
26416
|
+
}));
|
|
26417
|
+
}
|
|
26418
|
+
continue;
|
|
26419
|
+
}
|
|
26420
|
+
const animProgress = (ratio - disappearTime) / this.fadeOutDuration,
|
|
26421
|
+
progress = Math.max(0, Math.min(1, animProgress)),
|
|
26422
|
+
dx = this.getTargetDx() * progress,
|
|
26423
|
+
dy = this.getTargetDy() * progress,
|
|
26424
|
+
opacity = 1 - progress;
|
|
26425
|
+
for (const charIndex of this.wordGroups[groupIndex]) {
|
|
26426
|
+
const item = updatedTextConfig[charIndex];
|
|
26427
|
+
"text" in item && (updatedTextConfig[charIndex] = Object.assign(Object.assign({}, item), {
|
|
26428
|
+
opacity: opacity,
|
|
26429
|
+
dx: dx,
|
|
26430
|
+
dy: dy
|
|
26431
|
+
}));
|
|
26432
|
+
}
|
|
26433
|
+
}
|
|
26434
|
+
return updatedTextConfig;
|
|
26435
|
+
}
|
|
26436
|
+
updateByCharacter(ratio, maxTextShowRatio) {
|
|
26437
|
+
const totalItems = this.fromTextConfig.length,
|
|
26438
|
+
updatedTextConfig = [...this.singleCharConfig];
|
|
26439
|
+
for (let index = 0; index < updatedTextConfig.length; index++) {
|
|
26440
|
+
const item = updatedTextConfig[index];
|
|
26441
|
+
if ("text" in item) {
|
|
26442
|
+
let disappearTime;
|
|
26443
|
+
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) {
|
|
26444
|
+
updatedTextConfig[index] = Object.assign(Object.assign({}, item), {
|
|
26445
|
+
opacity: 1,
|
|
26446
|
+
dx: 0,
|
|
26447
|
+
dy: 0
|
|
26448
|
+
});
|
|
26449
|
+
continue;
|
|
26450
|
+
}
|
|
26451
|
+
const animProgress = (ratio - disappearTime) / this.fadeOutDuration,
|
|
26452
|
+
progress = Math.max(0, Math.min(1, animProgress)),
|
|
26453
|
+
dx = this.getTargetDx() * progress,
|
|
26454
|
+
dy = this.getTargetDy() * progress,
|
|
26455
|
+
opacity = 1 - progress;
|
|
26456
|
+
updatedTextConfig[index] = Object.assign(Object.assign({}, item), {
|
|
26457
|
+
opacity: opacity,
|
|
26458
|
+
dx: dx,
|
|
26459
|
+
dy: dy
|
|
26460
|
+
});
|
|
26461
|
+
}
|
|
26462
|
+
}
|
|
26463
|
+
return updatedTextConfig;
|
|
26464
|
+
}
|
|
26465
|
+
}
|
|
26466
|
+
|
|
26467
|
+
class ScaleIn extends ACustomAnimate {
|
|
26468
|
+
constructor(from, to, duration, easing, params) {
|
|
26469
|
+
super(from, to, duration, easing, params);
|
|
26470
|
+
}
|
|
26471
|
+
onBind() {
|
|
26472
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
26473
|
+
let from, to;
|
|
26474
|
+
super.onBind();
|
|
26475
|
+
const attrs = this.target.getFinalAttribute(),
|
|
26476
|
+
fromAttrs = null !== (_a = this.target.attribute) && void 0 !== _a ? _a : {};
|
|
26477
|
+
switch (null === (_b = this.params) || void 0 === _b ? void 0 : _b.direction) {
|
|
26478
|
+
case "x":
|
|
26479
|
+
from = {
|
|
26480
|
+
scaleX: null !== (_c = fromAttrs.scaleX) && void 0 !== _c ? _c : 0
|
|
26481
|
+
}, to = {
|
|
26482
|
+
scaleX: null !== (_d = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _d ? _d : 1
|
|
26483
|
+
}, this._updateFunction = this.updateX;
|
|
26484
|
+
break;
|
|
26485
|
+
case "y":
|
|
26486
|
+
from = {
|
|
26487
|
+
scaleY: null !== (_e = fromAttrs.scaleY) && void 0 !== _e ? _e : 0
|
|
26488
|
+
}, to = {
|
|
26489
|
+
scaleY: null !== (_f = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _f ? _f : 1
|
|
26490
|
+
}, this._updateFunction = this.updateY;
|
|
26491
|
+
break;
|
|
26492
|
+
default:
|
|
26493
|
+
from = {
|
|
26494
|
+
scaleX: null !== (_g = fromAttrs.scaleX) && void 0 !== _g ? _g : 0,
|
|
26495
|
+
scaleY: null !== (_h = fromAttrs.scaleY) && void 0 !== _h ? _h : 0
|
|
26496
|
+
}, to = {
|
|
26497
|
+
scaleX: null !== (_j = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _j ? _j : 1,
|
|
26498
|
+
scaleY: null !== (_k = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _k ? _k : 1
|
|
26499
|
+
}, this._updateFunction = this.updateXY;
|
|
26500
|
+
}
|
|
26501
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
26502
|
+
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);
|
|
26503
|
+
}
|
|
26504
|
+
onEnd(cb) {
|
|
26505
|
+
super.onEnd(cb);
|
|
26506
|
+
}
|
|
26507
|
+
updateX(ratio) {
|
|
26508
|
+
this.target.attribute.scaleX = this.from.scaleX + (this.to.scaleX - this.from.scaleX) * ratio;
|
|
26509
|
+
}
|
|
26510
|
+
updateY(ratio) {
|
|
26511
|
+
this.target.attribute.scaleY = this.from.scaleY + (this.to.scaleY - this.from.scaleY) * ratio;
|
|
26512
|
+
}
|
|
26513
|
+
updateXY(ratio) {
|
|
26514
|
+
this.updateX(ratio), this.updateY(ratio);
|
|
26515
|
+
}
|
|
26516
|
+
deleteSelfAttr(key) {
|
|
26517
|
+
delete this.props[key], this.fromProps && delete this.fromProps[key];
|
|
26518
|
+
const index = this.propKeys.indexOf(key);
|
|
26519
|
+
-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;
|
|
26520
|
+
}
|
|
26521
|
+
onUpdate(end, ratio, out) {
|
|
26522
|
+
this._updateFunction && (this._updateFunction(ratio), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag());
|
|
26523
|
+
}
|
|
26524
|
+
}
|
|
26525
|
+
class ScaleOut extends ACustomAnimate {
|
|
26526
|
+
constructor(from, to, duration, easing, params) {
|
|
26527
|
+
super(from, to, duration, easing, params);
|
|
26528
|
+
}
|
|
26529
|
+
onBind() {
|
|
26530
|
+
var _a, _b, _c, _d, _e;
|
|
26531
|
+
let from, to;
|
|
26532
|
+
super.onBind();
|
|
26533
|
+
const attrs = this.target.attribute;
|
|
26534
|
+
switch (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) {
|
|
26535
|
+
case "x":
|
|
26536
|
+
from = {
|
|
26537
|
+
scaleX: null !== (_b = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _b ? _b : 1
|
|
26538
|
+
}, to = {
|
|
26539
|
+
scaleX: 0
|
|
26540
|
+
};
|
|
26541
|
+
break;
|
|
26542
|
+
case "y":
|
|
26543
|
+
from = {
|
|
26544
|
+
scaleY: null !== (_c = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _c ? _c : 1
|
|
26545
|
+
}, to = {
|
|
26546
|
+
scaleY: 0
|
|
26547
|
+
};
|
|
26548
|
+
break;
|
|
26549
|
+
default:
|
|
26550
|
+
from = {
|
|
26551
|
+
scaleX: null !== (_d = null == attrs ? void 0 : attrs.scaleX) && void 0 !== _d ? _d : 1,
|
|
26552
|
+
scaleY: null !== (_e = null == attrs ? void 0 : attrs.scaleY) && void 0 !== _e ? _e : 1
|
|
26553
|
+
}, to = {
|
|
26554
|
+
scaleX: 0,
|
|
26555
|
+
scaleY: 0
|
|
26556
|
+
};
|
|
26557
|
+
}
|
|
26558
|
+
this.props = to, this.from = from, this.to = to;
|
|
26559
|
+
}
|
|
26560
|
+
onEnd(cb) {
|
|
26561
|
+
super.onEnd(cb);
|
|
26562
|
+
}
|
|
26563
|
+
onUpdate(end, ratio, out) {
|
|
26564
|
+
const attribute = this.target.attribute;
|
|
26565
|
+
this.propKeys.forEach(key => {
|
|
26566
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
26567
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateBoundTag();
|
|
26568
|
+
}
|
|
26569
|
+
}
|
|
26570
|
+
|
|
26571
|
+
class State extends ACustomAnimate {
|
|
26572
|
+
constructor(from, to, duration, easing, params) {
|
|
26573
|
+
super(from, to, duration, easing, params);
|
|
26574
|
+
}
|
|
26575
|
+
update(end, ratio, out) {
|
|
26576
|
+
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
26577
|
+
const easedRatio = this.easing(ratio);
|
|
26578
|
+
this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
|
|
26579
|
+
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
26580
|
+
const key = this.propKeys[index];
|
|
26581
|
+
func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
|
|
26582
|
+
}), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
26583
|
+
}
|
|
26584
|
+
}
|
|
26585
|
+
|
|
26586
|
+
class SlideIn extends ACustomAnimate {
|
|
26587
|
+
constructor(from, to, duration, easing, params) {
|
|
26588
|
+
super(from, to, duration, easing, params);
|
|
26589
|
+
}
|
|
26590
|
+
onBind() {
|
|
26591
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
26592
|
+
super.onBind();
|
|
26593
|
+
const attrs = this.target.getFinalAttribute(),
|
|
26594
|
+
direction = (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) || "right",
|
|
26595
|
+
distance = (null === (_b = this.params) || void 0 === _b ? void 0 : _b.distance) || 50,
|
|
26596
|
+
fromOpacity = null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromOpacity) && void 0 !== _d ? _d : 0,
|
|
26597
|
+
from = {
|
|
26598
|
+
opacity: fromOpacity,
|
|
26599
|
+
baseOpacity: fromOpacity
|
|
26600
|
+
},
|
|
26601
|
+
to = {
|
|
26602
|
+
opacity: 1,
|
|
26603
|
+
baseOpacity: 1
|
|
26604
|
+
};
|
|
26605
|
+
"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);
|
|
26606
|
+
}
|
|
26607
|
+
onUpdate(end, ratio, out) {
|
|
26608
|
+
const attribute = this.target.attribute;
|
|
26609
|
+
this.propKeys.forEach(key => {
|
|
26610
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
26611
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
26612
|
+
}
|
|
26613
|
+
}
|
|
26614
|
+
class GrowIn extends ACustomAnimate {
|
|
26615
|
+
constructor(from, to, duration, easing, params) {
|
|
26616
|
+
super(from, to, duration, easing, params);
|
|
26617
|
+
}
|
|
26618
|
+
onBind() {
|
|
26619
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
26620
|
+
super.onBind();
|
|
26621
|
+
const attrs = this.target.getFinalAttribute(),
|
|
26622
|
+
fromScale = null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromScale) && void 0 !== _b ? _b : 0,
|
|
26623
|
+
direction = (null === (_c = this.params) || void 0 === _c ? void 0 : _c.direction) || "xy",
|
|
26624
|
+
fromOpacity = null !== (_e = null === (_d = this.params) || void 0 === _d ? void 0 : _d.fromOpacity) && void 0 !== _e ? _e : 0,
|
|
26625
|
+
from = {
|
|
26626
|
+
opacity: fromOpacity,
|
|
26627
|
+
baseOpacity: fromOpacity
|
|
26628
|
+
},
|
|
26629
|
+
to = {
|
|
26630
|
+
opacity: 1,
|
|
26631
|
+
baseOpacity: 1
|
|
26632
|
+
};
|
|
26633
|
+
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);
|
|
26634
|
+
}
|
|
26635
|
+
onUpdate(end, ratio, out) {
|
|
26636
|
+
const attribute = this.target.attribute;
|
|
26637
|
+
this.propKeys.forEach(key => {
|
|
26638
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
26639
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
26640
|
+
}
|
|
26641
|
+
}
|
|
26642
|
+
class SpinIn extends ACustomAnimate {
|
|
26643
|
+
constructor(from, to, duration, easing, params) {
|
|
26644
|
+
super(from, to, duration, easing, params);
|
|
26645
|
+
}
|
|
26646
|
+
onBind() {
|
|
26647
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
26648
|
+
super.onBind();
|
|
26649
|
+
const attrs = this.target.getFinalAttribute(),
|
|
26650
|
+
fromAngle = null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromAngle) && void 0 !== _b ? _b : 2 * Math.PI,
|
|
26651
|
+
fromScale = null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromScale) && void 0 !== _d ? _d : 0,
|
|
26652
|
+
fromOpacity = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.fromOpacity) && void 0 !== _f ? _f : 0,
|
|
26653
|
+
from = {
|
|
26654
|
+
opacity: fromOpacity,
|
|
26655
|
+
baseOpacity: fromOpacity,
|
|
26656
|
+
angle: fromAngle,
|
|
26657
|
+
scaleX: fromScale,
|
|
26658
|
+
scaleY: fromScale
|
|
26659
|
+
},
|
|
26660
|
+
to = {
|
|
26661
|
+
opacity: 1,
|
|
26662
|
+
baseOpacity: 1,
|
|
26663
|
+
angle: null !== (_g = attrs.angle) && void 0 !== _g ? _g : 0,
|
|
26664
|
+
scaleX: null !== (_h = attrs.scaleX) && void 0 !== _h ? _h : 1,
|
|
26665
|
+
scaleY: null !== (_j = attrs.scaleY) && void 0 !== _j ? _j : 1
|
|
26666
|
+
};
|
|
26667
|
+
this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to, this.target.setAttributes(from);
|
|
26668
|
+
}
|
|
26669
|
+
onUpdate(end, ratio, out) {
|
|
26670
|
+
const attribute = this.target.attribute;
|
|
26671
|
+
this.propKeys.forEach(key => {
|
|
26672
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
26673
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
26674
|
+
}
|
|
26675
|
+
}
|
|
26676
|
+
class StrokeIn extends ACustomAnimate {
|
|
26677
|
+
constructor(from, to, duration, easing, params) {
|
|
26678
|
+
super(from, to, duration, easing, params), this.perimeter = 0, this.originalAttributes = {};
|
|
26679
|
+
}
|
|
26680
|
+
onBind() {
|
|
26681
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
26682
|
+
if (super.onBind(), this.originalAttributes = Object.assign({}, this.target.getAttributes()), "rect" === this.target.type) {
|
|
26683
|
+
const attr = this.target.attribute,
|
|
26684
|
+
width = null !== (_a = attr.width) && void 0 !== _a ? _a : 100,
|
|
26685
|
+
height = null !== (_b = attr.height) && void 0 !== _b ? _b : 100;
|
|
26686
|
+
this.perimeter = 2 * (width + height);
|
|
26687
|
+
} else if ("circle" === this.target.type) {
|
|
26688
|
+
const radius = null !== (_c = this.target.attribute.radius) && void 0 !== _c ? _c : 50;
|
|
26689
|
+
this.perimeter = 2 * Math.PI * radius;
|
|
26690
|
+
} else if ("ellipse" === this.target.type) {
|
|
26691
|
+
const attr = this.target.attribute,
|
|
26692
|
+
radiusX = null !== (_d = attr.radiusX) && void 0 !== _d ? _d : 50,
|
|
26693
|
+
radiusY = null !== (_e = attr.radiusY) && void 0 !== _e ? _e : 50;
|
|
26694
|
+
this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
|
|
26695
|
+
} else this.perimeter = 1e3;
|
|
26696
|
+
const lineWidth = null !== (_g = null === (_f = this.params) || void 0 === _f ? void 0 : _f.lineWidth) && void 0 !== _g ? _g : 2,
|
|
26697
|
+
strokeColor = null !== (_j = null === (_h = this.params) || void 0 === _h ? void 0 : _h.strokeColor) && void 0 !== _j ? _j : "black",
|
|
26698
|
+
fromOpacity = null !== (_l = null === (_k = this.params) || void 0 === _k ? void 0 : _k.fromOpacity) && void 0 !== _l ? _l : 1,
|
|
26699
|
+
dashLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.dashLength) && void 0 !== _o ? _o : this.perimeter,
|
|
26700
|
+
showFill = null !== (_q = null === (_p = this.params) || void 0 === _p ? void 0 : _p.showFill) && void 0 !== _q && _q,
|
|
26701
|
+
fillOpacity = null !== (_s = null === (_r = this.params) || void 0 === _r ? void 0 : _r.fillOpacity) && void 0 !== _s ? _s : 0;
|
|
26702
|
+
this.from = {
|
|
26703
|
+
lineDash: [dashLength, dashLength],
|
|
26704
|
+
lineDashOffset: dashLength,
|
|
26705
|
+
lineWidth: lineWidth,
|
|
26706
|
+
stroke: strokeColor,
|
|
26707
|
+
strokeOpacity: fromOpacity
|
|
26708
|
+
}, this.to = {
|
|
26709
|
+
lineDash: [dashLength, dashLength],
|
|
26710
|
+
lineDashOffset: 0,
|
|
26711
|
+
lineWidth: lineWidth,
|
|
26712
|
+
stroke: strokeColor,
|
|
26713
|
+
strokeOpacity: fromOpacity
|
|
26714
|
+
}, 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);
|
|
26715
|
+
}
|
|
26716
|
+
onUpdate(end, ratio, out) {
|
|
26717
|
+
var _a;
|
|
26718
|
+
const attribute = this.target.attribute;
|
|
26719
|
+
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);
|
|
26720
|
+
}
|
|
26721
|
+
onEnd() {
|
|
26722
|
+
var _a;
|
|
26723
|
+
if (super.onEnd(), !(null === (_a = this.params) || void 0 === _a ? void 0 : _a.showFill)) {
|
|
26724
|
+
const originalAttrs = Object.assign({}, this.originalAttributes);
|
|
26725
|
+
originalAttrs.fillOpacity = 0, this.target.setAttributes(originalAttrs);
|
|
26726
|
+
}
|
|
26727
|
+
}
|
|
26728
|
+
}
|
|
26729
|
+
class StrokeOut extends ACustomAnimate {
|
|
26730
|
+
constructor(from, to, duration, easing, params) {
|
|
26731
|
+
super(from, to, duration, easing, params), this.perimeter = 0, this.originalAttributes = {};
|
|
26732
|
+
}
|
|
26733
|
+
onFirstRun() {
|
|
26734
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
26735
|
+
if (this.originalAttributes = Object.assign({}, this.target.getAttributes()), "rect" === this.target.type) {
|
|
26736
|
+
const attr = this.target.attribute,
|
|
26737
|
+
width = null !== (_a = attr.width) && void 0 !== _a ? _a : 100,
|
|
26738
|
+
height = null !== (_b = attr.height) && void 0 !== _b ? _b : 100;
|
|
26739
|
+
this.perimeter = 2 * (width + height);
|
|
26740
|
+
} else if ("circle" === this.target.type) {
|
|
26741
|
+
const radius = null !== (_c = this.target.attribute.radius) && void 0 !== _c ? _c : 50;
|
|
26742
|
+
this.perimeter = 2 * Math.PI * radius;
|
|
26743
|
+
} else if ("ellipse" === this.target.type) {
|
|
26744
|
+
const attr = this.target.attribute,
|
|
26745
|
+
radiusX = null !== (_d = attr.radiusX) && void 0 !== _d ? _d : 50,
|
|
26746
|
+
radiusY = null !== (_e = attr.radiusY) && void 0 !== _e ? _e : 50;
|
|
26747
|
+
this.perimeter = 2 * Math.PI * Math.sqrt((radiusX * radiusX + radiusY * radiusY) / 2);
|
|
26748
|
+
} else this.perimeter = 1e3;
|
|
26749
|
+
const lineWidth = null !== (_g = null === (_f = this.params) || void 0 === _f ? void 0 : _f.lineWidth) && void 0 !== _g ? _g : 2,
|
|
26750
|
+
strokeColor = null !== (_j = null === (_h = this.params) || void 0 === _h ? void 0 : _h.strokeColor) && void 0 !== _j ? _j : "black",
|
|
26751
|
+
fromOpacity = null !== (_l = null === (_k = this.params) || void 0 === _k ? void 0 : _k.fromOpacity) && void 0 !== _l ? _l : 1,
|
|
26752
|
+
dashLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.dashLength) && void 0 !== _o ? _o : this.perimeter,
|
|
26753
|
+
showFill = null !== (_q = null === (_p = this.params) || void 0 === _p ? void 0 : _p.showFill) && void 0 !== _q && _q;
|
|
26754
|
+
this.from = {
|
|
26755
|
+
lineDash: [dashLength, dashLength],
|
|
26756
|
+
lineDashOffset: 0,
|
|
26757
|
+
lineWidth: lineWidth,
|
|
26758
|
+
stroke: strokeColor,
|
|
26759
|
+
strokeOpacity: fromOpacity
|
|
26760
|
+
}, this.to = {
|
|
26761
|
+
lineDash: [dashLength, dashLength],
|
|
26762
|
+
lineDashOffset: -dashLength,
|
|
26763
|
+
lineWidth: lineWidth,
|
|
26764
|
+
stroke: strokeColor,
|
|
26765
|
+
strokeOpacity: fromOpacity
|
|
26766
|
+
}, 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);
|
|
26767
|
+
}
|
|
26768
|
+
onUpdate(end, ratio, out) {
|
|
26769
|
+
var _a;
|
|
26770
|
+
const attribute = this.target.attribute;
|
|
26771
|
+
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);
|
|
26772
|
+
}
|
|
26773
|
+
}
|
|
26774
|
+
class MoveScaleIn extends ACustomAnimate {
|
|
26775
|
+
constructor(from, to, duration, easing, params) {
|
|
26776
|
+
var _a;
|
|
26777
|
+
super(from, to, duration, easing, params);
|
|
26778
|
+
const slideRatio = null !== (_a = null == params ? void 0 : params.slideRatio) && void 0 !== _a ? _a : .5;
|
|
26779
|
+
this.slideInDuration = duration * slideRatio, this.growInDuration = duration * (1 - slideRatio);
|
|
26780
|
+
}
|
|
26781
|
+
onBind() {
|
|
26782
|
+
var _a, _b, _c, _d, _e, _f;
|
|
26783
|
+
super.onBind();
|
|
26784
|
+
const executor = new AnimateExecutor(this.target);
|
|
26785
|
+
executor.execute({
|
|
26786
|
+
type: "custom",
|
|
26787
|
+
custom: SlideIn,
|
|
26788
|
+
customParameters: {
|
|
26789
|
+
direction: (null === (_a = this.params) || void 0 === _a ? void 0 : _a.slideDirection) || "right",
|
|
26790
|
+
distance: (null === (_b = this.params) || void 0 === _b ? void 0 : _b.slideDistance) || 50,
|
|
26791
|
+
fromOpacity: null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromOpacity) && void 0 !== _d ? _d : 0
|
|
26792
|
+
},
|
|
26793
|
+
duration: this.slideInDuration,
|
|
26794
|
+
easing: this.easing
|
|
26795
|
+
}), executor.execute({
|
|
26796
|
+
type: "custom",
|
|
26797
|
+
custom: GrowIn,
|
|
26798
|
+
customParameters: {
|
|
26799
|
+
fromScale: (null === (_e = this.params) || void 0 === _e ? void 0 : _e.fromScale) || .5,
|
|
26800
|
+
direction: (null === (_f = this.params) || void 0 === _f ? void 0 : _f.scaleDirection) || "xy",
|
|
26801
|
+
fromOpacity: 1
|
|
26802
|
+
},
|
|
26803
|
+
duration: this.growInDuration,
|
|
26804
|
+
easing: this.easing,
|
|
26805
|
+
delay: this.slideInDuration
|
|
26806
|
+
});
|
|
26807
|
+
}
|
|
26808
|
+
onUpdate(end, ratio, out) {}
|
|
26809
|
+
}
|
|
26810
|
+
class MoveRotateIn extends ACustomAnimate {
|
|
26811
|
+
constructor(from, to, duration, easing, params) {
|
|
26812
|
+
var _a;
|
|
26813
|
+
super(from, to, duration, easing, params);
|
|
26814
|
+
const slideRatio = null !== (_a = null == params ? void 0 : params.slideRatio) && void 0 !== _a ? _a : .5;
|
|
26815
|
+
this.slideInDuration = duration * slideRatio, this.spinInDuration = duration * (1 - slideRatio);
|
|
26816
|
+
}
|
|
26817
|
+
onBind() {
|
|
26818
|
+
var _a, _b, _c, _d, _e, _f;
|
|
26819
|
+
super.onBind();
|
|
26820
|
+
const executor = new AnimateExecutor(this.target);
|
|
26821
|
+
executor.execute({
|
|
26822
|
+
type: "custom",
|
|
26823
|
+
custom: SlideIn,
|
|
26824
|
+
customParameters: {
|
|
26825
|
+
direction: (null === (_a = this.params) || void 0 === _a ? void 0 : _a.slideDirection) || "right",
|
|
26826
|
+
distance: (null === (_b = this.params) || void 0 === _b ? void 0 : _b.slideDistance) || 50,
|
|
26827
|
+
fromOpacity: null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromOpacity) && void 0 !== _d ? _d : 0
|
|
26828
|
+
},
|
|
26829
|
+
duration: this.slideInDuration,
|
|
26830
|
+
easing: this.easing
|
|
26831
|
+
}), executor.execute({
|
|
26832
|
+
type: "custom",
|
|
26833
|
+
custom: SpinIn,
|
|
26834
|
+
customParameters: {
|
|
26835
|
+
fromAngle: (null === (_e = this.params) || void 0 === _e ? void 0 : _e.fromAngle) || Math.PI,
|
|
26836
|
+
fromScale: (null === (_f = this.params) || void 0 === _f ? void 0 : _f.fromScale) || .5,
|
|
26837
|
+
fromOpacity: 1
|
|
26838
|
+
},
|
|
26839
|
+
duration: this.spinInDuration,
|
|
26840
|
+
easing: this.easing,
|
|
26841
|
+
delay: this.slideInDuration
|
|
26842
|
+
});
|
|
26843
|
+
}
|
|
26844
|
+
onUpdate(end, ratio, out) {}
|
|
26845
|
+
}
|
|
26846
|
+
class SlideOut extends ACustomAnimate {
|
|
26847
|
+
constructor(from, to, duration, easing, params) {
|
|
26848
|
+
super(from, to, duration, easing, params);
|
|
26849
|
+
}
|
|
26850
|
+
onFirstRun() {
|
|
26851
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
26852
|
+
const attrs = this.target.getAttributes(),
|
|
26853
|
+
direction = (null === (_a = this.params) || void 0 === _a ? void 0 : _a.direction) || "right",
|
|
26854
|
+
distance = (null === (_b = this.params) || void 0 === _b ? void 0 : _b.distance) || 50,
|
|
26855
|
+
fromOpacity = null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromOpacity) && void 0 !== _d ? _d : 1,
|
|
26856
|
+
toOpacity = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.toOpacity) && void 0 !== _f ? _f : 0,
|
|
26857
|
+
from = {
|
|
26858
|
+
opacity: fromOpacity,
|
|
26859
|
+
baseOpacity: fromOpacity
|
|
26860
|
+
},
|
|
26861
|
+
to = {
|
|
26862
|
+
opacity: toOpacity,
|
|
26863
|
+
baseOpacity: toOpacity
|
|
26864
|
+
};
|
|
26865
|
+
"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;
|
|
26866
|
+
}
|
|
26867
|
+
onUpdate(end, ratio, out) {
|
|
26868
|
+
const attribute = this.target.attribute;
|
|
26869
|
+
this.propKeys.forEach(key => {
|
|
26870
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
26871
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
26872
|
+
}
|
|
26873
|
+
}
|
|
26874
|
+
class GrowOut extends ACustomAnimate {
|
|
26875
|
+
constructor(from, to, duration, easing, params) {
|
|
26876
|
+
super(from, to, duration, easing, params);
|
|
26877
|
+
}
|
|
26878
|
+
onFirstRun() {
|
|
26879
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
26880
|
+
const attrs = this.target.getAttributes(),
|
|
26881
|
+
toScale = null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromScale) && void 0 !== _b ? _b : 0,
|
|
26882
|
+
direction = (null === (_c = this.params) || void 0 === _c ? void 0 : _c.direction) || "xy",
|
|
26883
|
+
fromOpacity = null !== (_e = null === (_d = this.params) || void 0 === _d ? void 0 : _d.fromOpacity) && void 0 !== _e ? _e : 1,
|
|
26884
|
+
toOpacity = null !== (_g = null === (_f = this.params) || void 0 === _f ? void 0 : _f.toOpacity) && void 0 !== _g ? _g : 0,
|
|
26885
|
+
from = {
|
|
26886
|
+
opacity: fromOpacity,
|
|
26887
|
+
baseOpacity: fromOpacity
|
|
26888
|
+
},
|
|
26889
|
+
to = {
|
|
26890
|
+
opacity: toOpacity,
|
|
26891
|
+
baseOpacity: toOpacity
|
|
26892
|
+
};
|
|
26893
|
+
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;
|
|
26894
|
+
}
|
|
26895
|
+
onUpdate(end, ratio, out) {
|
|
26896
|
+
const attribute = this.target.attribute;
|
|
26897
|
+
this.propKeys.forEach(key => {
|
|
26898
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
26899
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
26900
|
+
}
|
|
26901
|
+
}
|
|
26902
|
+
class SpinOut extends ACustomAnimate {
|
|
26903
|
+
constructor(from, to, duration, easing, params) {
|
|
26904
|
+
super(from, to, duration, easing, params);
|
|
26905
|
+
}
|
|
26906
|
+
onFirstRun() {
|
|
26907
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
26908
|
+
const attrs = this.target.getAttributes(),
|
|
26909
|
+
toAngle = null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromAngle) && void 0 !== _b ? _b : 2 * Math.PI,
|
|
26910
|
+
toScale = null !== (_d = null === (_c = this.params) || void 0 === _c ? void 0 : _c.fromScale) && void 0 !== _d ? _d : 0,
|
|
26911
|
+
fromOpacity = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.fromOpacity) && void 0 !== _f ? _f : 1,
|
|
26912
|
+
toOpacity = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.toOpacity) && void 0 !== _h ? _h : 0,
|
|
26913
|
+
from = {
|
|
26914
|
+
opacity: fromOpacity,
|
|
26915
|
+
baseOpacity: fromOpacity,
|
|
26916
|
+
angle: null !== (_j = attrs.angle) && void 0 !== _j ? _j : 0,
|
|
26917
|
+
scaleX: null !== (_k = attrs.scaleX) && void 0 !== _k ? _k : 1,
|
|
26918
|
+
scaleY: null !== (_l = attrs.scaleY) && void 0 !== _l ? _l : 1
|
|
26919
|
+
},
|
|
26920
|
+
to = {
|
|
26921
|
+
opacity: toOpacity,
|
|
26922
|
+
baseOpacity: toOpacity,
|
|
26923
|
+
angle: toAngle,
|
|
26924
|
+
scaleX: toScale,
|
|
26925
|
+
scaleY: toScale
|
|
26926
|
+
};
|
|
26927
|
+
this.propKeys = ["opacity", "baseOpacity", "angle", "scaleX", "scaleY"], this.from = from, this.to = to, this.props = to;
|
|
26928
|
+
}
|
|
26929
|
+
onUpdate(end, ratio, out) {
|
|
26930
|
+
const attribute = this.target.attribute;
|
|
26931
|
+
this.propKeys.forEach(key => {
|
|
26932
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
26933
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
26934
|
+
}
|
|
26935
|
+
}
|
|
26936
|
+
class MoveScaleOut extends ACustomAnimate {
|
|
26937
|
+
constructor(from, to, duration, easing, params) {
|
|
26938
|
+
var _a;
|
|
26939
|
+
super(from, to, duration, easing, params);
|
|
26940
|
+
const slideRatio = null !== (_a = null == params ? void 0 : params.slideRatio) && void 0 !== _a ? _a : .5;
|
|
26941
|
+
this.growOutDuration = duration * (1 - slideRatio), this.slideOutDuration = duration * slideRatio;
|
|
26942
|
+
}
|
|
26943
|
+
onFirstRun() {
|
|
26944
|
+
var _a, _b, _c, _d;
|
|
26945
|
+
const executor = new AnimateExecutor(this.target);
|
|
26946
|
+
executor.execute({
|
|
26947
|
+
type: "custom",
|
|
26948
|
+
custom: GrowOut,
|
|
26949
|
+
customParameters: {
|
|
26950
|
+
fromScale: (null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromScale) || .5,
|
|
26951
|
+
direction: (null === (_b = this.params) || void 0 === _b ? void 0 : _b.scaleDirection) || "xy",
|
|
26952
|
+
fromOpacity: 1,
|
|
26953
|
+
toOpacity: 1
|
|
26954
|
+
},
|
|
26955
|
+
duration: this.growOutDuration,
|
|
26956
|
+
easing: this.easing
|
|
26957
|
+
}), executor.execute({
|
|
26958
|
+
type: "custom",
|
|
26959
|
+
custom: SlideOut,
|
|
26960
|
+
customParameters: {
|
|
26961
|
+
direction: (null === (_c = this.params) || void 0 === _c ? void 0 : _c.slideDirection) || "right",
|
|
26962
|
+
distance: (null === (_d = this.params) || void 0 === _d ? void 0 : _d.slideDistance) || 50,
|
|
26963
|
+
fromOpacity: 1
|
|
26964
|
+
},
|
|
26965
|
+
duration: this.slideOutDuration,
|
|
26966
|
+
easing: this.easing,
|
|
26967
|
+
delay: this.growOutDuration
|
|
26968
|
+
});
|
|
26969
|
+
}
|
|
26970
|
+
onUpdate(end, ratio, out) {}
|
|
26971
|
+
}
|
|
26972
|
+
class MoveRotateOut extends ACustomAnimate {
|
|
26973
|
+
constructor(from, to, duration, easing, params) {
|
|
26974
|
+
var _a;
|
|
26975
|
+
super(from, to, duration, easing, params);
|
|
26976
|
+
const slideRatio = null !== (_a = null == params ? void 0 : params.slideRatio) && void 0 !== _a ? _a : .5;
|
|
26977
|
+
this.spinOutDuration = duration * (1 - slideRatio), this.slideOutDuration = duration * slideRatio;
|
|
26978
|
+
}
|
|
26979
|
+
onFirstRun() {
|
|
26980
|
+
var _a, _b, _c, _d;
|
|
26981
|
+
const executor = new AnimateExecutor(this.target);
|
|
26982
|
+
executor.execute({
|
|
26983
|
+
type: "custom",
|
|
26984
|
+
custom: SpinOut,
|
|
26985
|
+
customParameters: {
|
|
26986
|
+
fromAngle: (null === (_a = this.params) || void 0 === _a ? void 0 : _a.fromAngle) || Math.PI,
|
|
26987
|
+
fromScale: (null === (_b = this.params) || void 0 === _b ? void 0 : _b.fromScale) || .5,
|
|
26988
|
+
fromOpacity: 1,
|
|
26989
|
+
toOpacity: 1
|
|
26990
|
+
},
|
|
26991
|
+
duration: this.spinOutDuration,
|
|
26992
|
+
easing: this.easing
|
|
26993
|
+
}), executor.execute({
|
|
26994
|
+
type: "custom",
|
|
26995
|
+
custom: SlideOut,
|
|
26996
|
+
customParameters: {
|
|
26997
|
+
direction: (null === (_c = this.params) || void 0 === _c ? void 0 : _c.slideDirection) || "right",
|
|
26998
|
+
distance: (null === (_d = this.params) || void 0 === _d ? void 0 : _d.slideDistance) || 50,
|
|
26999
|
+
fromOpacity: 1
|
|
27000
|
+
},
|
|
27001
|
+
duration: this.slideOutDuration,
|
|
27002
|
+
easing: this.easing,
|
|
27003
|
+
delay: this.spinOutDuration
|
|
27004
|
+
});
|
|
27005
|
+
}
|
|
27006
|
+
onUpdate(end, ratio, out) {}
|
|
27007
|
+
}
|
|
27008
|
+
class PulseAnimate extends ACustomAnimate {
|
|
27009
|
+
constructor(from, to, duration, easing, params) {
|
|
27010
|
+
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);
|
|
27011
|
+
}
|
|
27012
|
+
onBind() {
|
|
27013
|
+
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"));
|
|
27014
|
+
}
|
|
27015
|
+
onUpdate(end, ratio, out) {
|
|
27016
|
+
const angle = ratio * Math.PI * this.pulseCount,
|
|
27017
|
+
pulseValue = Math.abs(Math.sin(angle)),
|
|
27018
|
+
attribute = this.target.attribute;
|
|
27019
|
+
if (this.useOpacity) {
|
|
27020
|
+
const opacity = 1 + (this.pulseOpacity - 1) * pulseValue;
|
|
27021
|
+
this.useStroke && (attribute.strokeOpacity = (this.originalAttributes.strokeOpacity || 1) * opacity), this.useFill && (attribute.fillOpacity = (this.originalAttributes.fillOpacity || 1) * opacity);
|
|
27022
|
+
}
|
|
27023
|
+
if (this.useScale) {
|
|
27024
|
+
const scale = 1 + (this.pulseScale - 1) * pulseValue;
|
|
27025
|
+
attribute.scaleX = (this.originalAttributes.scaleX || 1) * scale, attribute.scaleY = (this.originalAttributes.scaleY || 1) * scale;
|
|
27026
|
+
}
|
|
27027
|
+
this.useColor && this.pulseColor && this.applyColorPulse(attribute, pulseValue), this.target.addUpdateShapeAndBoundsTag(), this.target.addUpdatePositionTag();
|
|
27028
|
+
}
|
|
27029
|
+
applyColorPulse(attribute, pulseValue) {
|
|
27030
|
+
const colorRatio = this.pulseColorIntensity * pulseValue;
|
|
27031
|
+
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));
|
|
27032
|
+
}
|
|
27033
|
+
onEnd() {
|
|
27034
|
+
super.onEnd(), this.target.setAttributes(this.originalAttributes);
|
|
27035
|
+
}
|
|
27036
|
+
}
|
|
27037
|
+
|
|
27038
|
+
class Update extends ACustomAnimate {
|
|
27039
|
+
constructor(from, to, duration, easing, params) {
|
|
27040
|
+
super(from, to, duration, easing, params);
|
|
27041
|
+
}
|
|
27042
|
+
onBind() {
|
|
27043
|
+
var _a, _b;
|
|
27044
|
+
super.onBind();
|
|
27045
|
+
let {
|
|
27046
|
+
diffAttrs = {}
|
|
27047
|
+
} = null !== (_a = this.target.context) && void 0 !== _a ? _a : {};
|
|
27048
|
+
const {
|
|
27049
|
+
options: options
|
|
27050
|
+
} = this.params;
|
|
27051
|
+
diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach(channel => {
|
|
27052
|
+
delete diffAttrs[channel];
|
|
27053
|
+
}), this.props = diffAttrs;
|
|
27054
|
+
}
|
|
27055
|
+
update(end, ratio, out) {
|
|
27056
|
+
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
27057
|
+
const easedRatio = this.easing(ratio);
|
|
27058
|
+
this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
|
|
27059
|
+
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
27060
|
+
const key = this.propKeys[index];
|
|
27061
|
+
func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
|
|
27062
|
+
}), this.onUpdate(end, easedRatio, out);
|
|
27063
|
+
}
|
|
27064
|
+
}
|
|
27065
|
+
|
|
27066
|
+
const moveIn = (graphic, options, animationParameters) => {
|
|
27067
|
+
var _a, _b, _c, _d;
|
|
27068
|
+
const {
|
|
27069
|
+
offset = 0,
|
|
27070
|
+
orient: orient,
|
|
27071
|
+
direction: direction,
|
|
27072
|
+
point: pointOpt,
|
|
27073
|
+
excludeChannels = [],
|
|
27074
|
+
layoutRect = {}
|
|
27075
|
+
} = null != options ? options : {};
|
|
27076
|
+
let changedX = 0,
|
|
27077
|
+
changedY = 0;
|
|
27078
|
+
"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;
|
|
27079
|
+
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,
|
|
27080
|
+
fromX = point && isValidNumber$3(point.x) ? point.x : changedX,
|
|
27081
|
+
fromY = point && isValidNumber$3(point.y) ? point.y : changedY,
|
|
27082
|
+
finalAttrs = graphic.getFinalAttribute(),
|
|
27083
|
+
finalAttrsX = excludeChannels.includes("x") ? graphic.attribute.x : finalAttrs.x,
|
|
27084
|
+
finalAttrsY = excludeChannels.includes("y") ? graphic.attribute.y : finalAttrs.y;
|
|
27085
|
+
switch (direction) {
|
|
27086
|
+
case "x":
|
|
27087
|
+
return {
|
|
27088
|
+
from: {
|
|
27089
|
+
x: fromX
|
|
27090
|
+
},
|
|
27091
|
+
to: {
|
|
27092
|
+
x: finalAttrsX
|
|
27093
|
+
}
|
|
27094
|
+
};
|
|
27095
|
+
case "y":
|
|
27096
|
+
return {
|
|
27097
|
+
from: {
|
|
27098
|
+
y: fromY
|
|
27099
|
+
},
|
|
27100
|
+
to: {
|
|
27101
|
+
y: finalAttrsY
|
|
27102
|
+
}
|
|
27103
|
+
};
|
|
27104
|
+
default:
|
|
27105
|
+
return {
|
|
27106
|
+
from: {
|
|
27107
|
+
x: fromX,
|
|
27108
|
+
y: fromY
|
|
27109
|
+
},
|
|
27110
|
+
to: {
|
|
27111
|
+
x: finalAttrsX,
|
|
27112
|
+
y: finalAttrsY
|
|
27113
|
+
}
|
|
27114
|
+
};
|
|
24083
27115
|
}
|
|
24084
|
-
|
|
24085
|
-
|
|
24086
|
-
|
|
24087
|
-
|
|
24088
|
-
|
|
24089
|
-
|
|
24090
|
-
|
|
24091
|
-
|
|
24092
|
-
|
|
24093
|
-
|
|
24094
|
-
|
|
24095
|
-
|
|
24096
|
-
|
|
24097
|
-
|
|
24098
|
-
|
|
24099
|
-
|
|
24100
|
-
|
|
24101
|
-
|
|
24102
|
-
|
|
24103
|
-
|
|
24104
|
-
|
|
27116
|
+
};
|
|
27117
|
+
const moveOut = (graphic, options, animationParameters) => {
|
|
27118
|
+
var _a, _b, _c, _d;
|
|
27119
|
+
const {
|
|
27120
|
+
offset = 0,
|
|
27121
|
+
orient: orient,
|
|
27122
|
+
direction: direction,
|
|
27123
|
+
point: pointOpt
|
|
27124
|
+
} = null != options ? options : {},
|
|
27125
|
+
groupBounds = animationParameters.group ? animationParameters.group.AABBBounds : null,
|
|
27126
|
+
groupWidth = null !== (_a = groupBounds.width()) && void 0 !== _a ? _a : animationParameters.width,
|
|
27127
|
+
groupHeight = null !== (_b = groupBounds.height()) && void 0 !== _b ? _b : animationParameters.height,
|
|
27128
|
+
changedX = ("negative" === orient ? groupWidth : 0) + offset,
|
|
27129
|
+
changedY = ("negative" === orient ? groupHeight : 0) + offset,
|
|
27130
|
+
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,
|
|
27131
|
+
fromX = point && isValidNumber$3(point.x) ? point.x : changedX,
|
|
27132
|
+
fromY = point && isValidNumber$3(point.y) ? point.y : changedY;
|
|
27133
|
+
switch (direction) {
|
|
27134
|
+
case "x":
|
|
27135
|
+
return {
|
|
27136
|
+
from: {
|
|
27137
|
+
x: graphic.attribute.x
|
|
27138
|
+
},
|
|
27139
|
+
to: {
|
|
27140
|
+
x: fromX
|
|
27141
|
+
}
|
|
27142
|
+
};
|
|
27143
|
+
case "y":
|
|
27144
|
+
return {
|
|
27145
|
+
from: {
|
|
27146
|
+
y: graphic.attribute.y
|
|
27147
|
+
},
|
|
27148
|
+
to: {
|
|
27149
|
+
y: fromY
|
|
27150
|
+
}
|
|
27151
|
+
};
|
|
27152
|
+
default:
|
|
27153
|
+
return {
|
|
27154
|
+
from: {
|
|
27155
|
+
x: graphic.attribute.x,
|
|
27156
|
+
y: graphic.attribute.y
|
|
27157
|
+
},
|
|
27158
|
+
to: {
|
|
27159
|
+
x: fromX,
|
|
27160
|
+
y: fromY
|
|
27161
|
+
}
|
|
27162
|
+
};
|
|
24105
27163
|
}
|
|
24106
|
-
|
|
24107
|
-
|
|
24108
|
-
|
|
24109
|
-
|
|
24110
|
-
channel: channel,
|
|
24111
|
-
customParameters: customParameters,
|
|
24112
|
-
easing = "linear",
|
|
24113
|
-
delay = 0,
|
|
24114
|
-
delayAfter = 0,
|
|
24115
|
-
duration = 300,
|
|
24116
|
-
startTime = 0,
|
|
24117
|
-
oneByOneDelay = 0,
|
|
24118
|
-
loop: loop,
|
|
24119
|
-
bounce: bounce,
|
|
24120
|
-
priority = 0,
|
|
24121
|
-
options: options,
|
|
24122
|
-
custom: custom,
|
|
24123
|
-
customType: customType,
|
|
24124
|
-
controlOptions: controlOptions
|
|
24125
|
-
} = params,
|
|
24126
|
-
animate = graphic.animate();
|
|
24127
|
-
animate.priority = priority;
|
|
24128
|
-
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,
|
|
24129
|
-
datum = null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0],
|
|
24130
|
-
indexKey = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.indexKey;
|
|
24131
|
-
datum && indexKey && (index = null !== (_f = datum[indexKey]) && void 0 !== _f ? _f : index), animate.startAt(startTime);
|
|
24132
|
-
const wait = index * oneByOneDelay + delayValue;
|
|
24133
|
-
wait > 0 && animate.wait(wait);
|
|
24134
|
-
let parsedFromProps = null,
|
|
24135
|
-
props = params.to,
|
|
24136
|
-
from = params.from;
|
|
24137
|
-
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);
|
|
24138
|
-
let totalDelay = 0;
|
|
24139
|
-
oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
|
|
24140
|
-
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;
|
|
24141
|
-
return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
|
|
27164
|
+
};
|
|
27165
|
+
class MoveBase extends ACustomAnimate {
|
|
27166
|
+
constructor(from, to, duration, easing, params) {
|
|
27167
|
+
super(from, to, duration, easing, params);
|
|
24142
27168
|
}
|
|
24143
|
-
|
|
24144
|
-
|
|
24145
|
-
|
|
24146
|
-
|
|
24147
|
-
|
|
24148
|
-
height: graphic.stage.height,
|
|
24149
|
-
group: this._target.parent
|
|
24150
|
-
}, this.resolveValue(customParameters, graphic)),
|
|
24151
|
-
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;
|
|
24152
|
-
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);
|
|
24153
|
-
} else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
|
|
27169
|
+
onUpdate(end, ratio, out) {
|
|
27170
|
+
const attribute = this.target.attribute;
|
|
27171
|
+
this.propKeys.forEach(key => {
|
|
27172
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
27173
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
24154
27174
|
}
|
|
24155
|
-
|
|
24156
|
-
|
|
27175
|
+
}
|
|
27176
|
+
class MoveIn extends MoveBase {
|
|
27177
|
+
onBind() {
|
|
27178
|
+
var _a;
|
|
27179
|
+
super.onBind();
|
|
24157
27180
|
const {
|
|
24158
|
-
|
|
24159
|
-
|
|
24160
|
-
|
|
24161
|
-
|
|
24162
|
-
|
|
24163
|
-
|
|
24164
|
-
controlOptions: controlOptions
|
|
24165
|
-
} = params,
|
|
24166
|
-
datum = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0],
|
|
24167
|
-
indexKey = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.indexKey;
|
|
24168
|
-
datum && indexKey && (index = null !== (_d = datum[indexKey]) && void 0 !== _d ? _d : index);
|
|
24169
|
-
const animate = graphic.animate();
|
|
24170
|
-
animate.priority = priority, animate.startAt(startTime), animate.wait(index * oneByOneDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0);
|
|
24171
|
-
return (Array.isArray(timeSlices) ? timeSlices : [timeSlices]).forEach(slice => {
|
|
24172
|
-
this.applyTimeSliceToAnimate(slice, animate, graphic, controlOptions);
|
|
24173
|
-
}), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
|
|
27181
|
+
from: from,
|
|
27182
|
+
to: to
|
|
27183
|
+
} = moveIn(this.target, this.params.options, this.params);
|
|
27184
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
|
|
27185
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
27186
|
+
finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
|
|
24174
27187
|
}
|
|
24175
|
-
|
|
24176
|
-
|
|
27188
|
+
}
|
|
27189
|
+
class MoveOut extends MoveBase {
|
|
27190
|
+
onBind() {
|
|
27191
|
+
super.onBind();
|
|
24177
27192
|
const {
|
|
24178
|
-
|
|
24179
|
-
|
|
24180
|
-
|
|
24181
|
-
|
|
24182
|
-
} = slice,
|
|
24183
|
-
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,
|
|
24184
|
-
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;
|
|
24185
|
-
delayValue > 0 && animate.wait(delayValue);
|
|
24186
|
-
(Array.isArray(effects) ? effects : [effects]).forEach(effect => {
|
|
24187
|
-
var _a;
|
|
24188
|
-
const {
|
|
24189
|
-
type = "fromTo",
|
|
24190
|
-
channel: channel,
|
|
24191
|
-
customParameters: customParameters,
|
|
24192
|
-
easing = "linear",
|
|
24193
|
-
options: options
|
|
24194
|
-
} = effect;
|
|
24195
|
-
let parsedFromProps = null,
|
|
24196
|
-
props = effect.to,
|
|
24197
|
-
from = effect.from;
|
|
24198
|
-
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
|
|
24199
|
-
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
24200
|
-
customType = effect.customType;
|
|
24201
|
-
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
24202
|
-
}), delayAfterValue > 0 && animate.wait(delayAfterValue);
|
|
27193
|
+
from: from,
|
|
27194
|
+
to: to
|
|
27195
|
+
} = moveOut(this.target, this.params.options, this.params);
|
|
27196
|
+
this.props = to, this.propKeys = Object.keys(to).filter(key => null != to[key]), this.from = from, this.to = to;
|
|
24203
27197
|
}
|
|
24204
|
-
|
|
24205
|
-
|
|
24206
|
-
|
|
24207
|
-
|
|
24208
|
-
|
|
24209
|
-
|
|
24210
|
-
|
|
27198
|
+
}
|
|
27199
|
+
|
|
27200
|
+
const rotateIn = (graphic, options) => {
|
|
27201
|
+
var _a;
|
|
27202
|
+
const attributeAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
|
|
27203
|
+
let angle = 0;
|
|
27204
|
+
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, {
|
|
27205
|
+
from: {
|
|
27206
|
+
angle: angle
|
|
27207
|
+
},
|
|
27208
|
+
to: {
|
|
27209
|
+
angle: attributeAngle
|
|
27210
|
+
}
|
|
27211
|
+
};
|
|
27212
|
+
};
|
|
27213
|
+
const rotateOut = (graphic, options) => {
|
|
27214
|
+
var _a;
|
|
27215
|
+
const finalAngle = null !== (_a = graphic.getFinalAttribute().angle) && void 0 !== _a ? _a : 0;
|
|
27216
|
+
let angle = 0;
|
|
27217
|
+
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, {
|
|
27218
|
+
from: {
|
|
27219
|
+
angle: finalAngle
|
|
27220
|
+
},
|
|
27221
|
+
to: {
|
|
27222
|
+
angle: angle
|
|
27223
|
+
}
|
|
27224
|
+
};
|
|
27225
|
+
};
|
|
27226
|
+
class RotateBase extends ACustomAnimate {
|
|
27227
|
+
constructor(from, to, duration, easing, params) {
|
|
27228
|
+
super(from, to, duration, easing, params);
|
|
24211
27229
|
}
|
|
24212
|
-
|
|
24213
|
-
const
|
|
24214
|
-
|
|
27230
|
+
onUpdate(end, ratio, out) {
|
|
27231
|
+
const attribute = this.target.attribute;
|
|
27232
|
+
this.propKeys.forEach(key => {
|
|
27233
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
27234
|
+
}), this.target.addUpdatePositionTag(), this.target.addUpdateShapeAndBoundsTag();
|
|
24215
27235
|
}
|
|
24216
|
-
|
|
24217
|
-
|
|
24218
|
-
|
|
24219
|
-
|
|
24220
|
-
|
|
24221
|
-
|
|
24222
|
-
void 0 !== value && (props[key] = value);
|
|
24223
|
-
}) : Object.keys(channel).forEach(key => {
|
|
24224
|
-
var _a, _b, _c, _d;
|
|
24225
|
-
const config = channel[key];
|
|
24226
|
-
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);
|
|
24227
|
-
}), {
|
|
24228
|
-
from: from,
|
|
24229
|
-
props: props
|
|
24230
|
-
}) : {
|
|
27236
|
+
}
|
|
27237
|
+
class RotateIn extends RotateBase {
|
|
27238
|
+
onBind() {
|
|
27239
|
+
var _a;
|
|
27240
|
+
super.onBind();
|
|
27241
|
+
const {
|
|
24231
27242
|
from: from,
|
|
24232
|
-
|
|
24233
|
-
};
|
|
27243
|
+
to: to
|
|
27244
|
+
} = rotateIn(this.target, this.params.options);
|
|
27245
|
+
this.props = to, this.propKeys = ["angle"], this.from = from, this.to = to;
|
|
27246
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
27247
|
+
finalAttribute && this.target.setAttributes(finalAttribute), !1 !== (null === (_a = this.params.controlOptions) || void 0 === _a ? void 0 : _a.immediatelyApply) && this.target.setAttributes(from);
|
|
24234
27248
|
}
|
|
24235
|
-
|
|
24236
|
-
|
|
24237
|
-
|
|
27249
|
+
}
|
|
27250
|
+
class RotateOut extends RotateBase {
|
|
27251
|
+
onBind() {
|
|
27252
|
+
super.onBind();
|
|
27253
|
+
const {
|
|
27254
|
+
from: from,
|
|
27255
|
+
to: to
|
|
27256
|
+
} = rotateOut(this.target, this.params.options);
|
|
27257
|
+
this.props = to, this.propKeys = ["angle"], this.from = from, this.to = to;
|
|
24238
27258
|
}
|
|
24239
|
-
|
|
24240
|
-
|
|
27259
|
+
}
|
|
27260
|
+
|
|
27261
|
+
class MotionPath extends ACustomAnimate {
|
|
27262
|
+
constructor(from, to, duration, easing, params) {
|
|
27263
|
+
var _a;
|
|
27264
|
+
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);
|
|
24241
27265
|
}
|
|
24242
|
-
|
|
24243
|
-
|
|
24244
|
-
|
|
24245
|
-
|
|
24246
|
-
|
|
24247
|
-
return animate = isTimeline ? this.executeTimelineItem(parsedParams, graphic, index, count) : this.executeTypeConfigItem(parsedParams, graphic, index, count), animate && this._trackAnimation(animate), animate;
|
|
27266
|
+
onBind() {
|
|
27267
|
+
this.from = {
|
|
27268
|
+
x: 0,
|
|
27269
|
+
y: 0
|
|
27270
|
+
}, this.to = this.path.getAttrAt(this.totalLength).pos, this.props = this.to;
|
|
24248
27271
|
}
|
|
24249
|
-
|
|
24250
|
-
|
|
24251
|
-
|
|
24252
|
-
|
|
24253
|
-
|
|
24254
|
-
|
|
27272
|
+
onUpdate(end, ratio, out) {
|
|
27273
|
+
const attrs = {},
|
|
27274
|
+
at = this.totalLength * ratio,
|
|
27275
|
+
{
|
|
27276
|
+
pos: pos,
|
|
27277
|
+
angle: angle
|
|
27278
|
+
} = this.path.getAttrAt(at);
|
|
27279
|
+
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);
|
|
24255
27280
|
}
|
|
24256
27281
|
}
|
|
24257
|
-
AnimateExecutor.builtInAnimateMap = {};
|
|
24258
27282
|
|
|
24259
|
-
class
|
|
24260
|
-
constructor(
|
|
24261
|
-
super(
|
|
27283
|
+
class FromTo extends ACustomAnimate {
|
|
27284
|
+
constructor(from, to, duration, easing, params) {
|
|
27285
|
+
super(from, to, duration, easing, params), this.from = null != from ? from : {};
|
|
27286
|
+
}
|
|
27287
|
+
onBind() {
|
|
27288
|
+
var _a, _b;
|
|
27289
|
+
super.onBind(), Object.keys(this.from).forEach(key => {
|
|
27290
|
+
null == this.props[key] && (this.props[key] = this.target.getGraphicAttribute(key));
|
|
27291
|
+
});
|
|
27292
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
27293
|
+
"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);
|
|
27294
|
+
}
|
|
27295
|
+
onFirstRun() {
|
|
27296
|
+
this.from = Object.assign(Object.assign({}, this.getLastProps()), this.from);
|
|
27297
|
+
const startProps = this.animate.getStartProps();
|
|
27298
|
+
this.propKeys && this.propKeys.forEach(key => {
|
|
27299
|
+
var _a;
|
|
27300
|
+
this.from[key] = null !== (_a = this.from[key]) && void 0 !== _a ? _a : startProps[key];
|
|
27301
|
+
}), this.target.setAttributes(this.from);
|
|
27302
|
+
}
|
|
27303
|
+
deleteSelfAttr(key) {
|
|
27304
|
+
super.deleteSelfAttr(key), delete this.from[key];
|
|
24262
27305
|
}
|
|
24263
27306
|
update(end, ratio, out) {
|
|
24264
27307
|
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
24265
27308
|
const easedRatio = this.easing(ratio);
|
|
24266
|
-
this.
|
|
24267
|
-
|
|
24268
|
-
|
|
24269
|
-
|
|
27309
|
+
this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.from, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
|
|
27310
|
+
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
27311
|
+
const key = this.propKeys[index];
|
|
27312
|
+
func(key, this.from[key], this.props[key], easedRatio, this, this.target);
|
|
27313
|
+
}), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
24270
27314
|
}
|
|
24271
27315
|
}
|
|
24272
|
-
|
|
24273
|
-
|
|
24274
|
-
|
|
27316
|
+
|
|
27317
|
+
class StreamLight extends ACustomAnimate {
|
|
27318
|
+
constructor(from, to, duration, easing, params) {
|
|
27319
|
+
super(from, to, duration, easing, params);
|
|
24275
27320
|
}
|
|
24276
|
-
|
|
24277
|
-
|
|
27321
|
+
getEndProps() {
|
|
27322
|
+
return {};
|
|
24278
27323
|
}
|
|
24279
|
-
|
|
24280
|
-
|
|
24281
|
-
class ComponentAnimator {
|
|
24282
|
-
constructor(component) {
|
|
24283
|
-
this.tasks = [], this.started = !1, this.completed = 0, this.totalDuration = 0, this.onStartCallbacks = [], this.onEndCallbacks = [], this.onUpdateCallbacks = [], this.component = component;
|
|
27324
|
+
onStart() {
|
|
27325
|
+
this.target && ("rect" === this.target.type ? this.onStartRect() : "line" === this.target.type ? this.onStartLineOrArea("line") : "area" === this.target.type && this.onStartLineOrArea("area"));
|
|
24284
27326
|
}
|
|
24285
|
-
|
|
24286
|
-
|
|
24287
|
-
|
|
24288
|
-
|
|
24289
|
-
|
|
27327
|
+
onStartLineOrArea(type) {
|
|
27328
|
+
var _a;
|
|
27329
|
+
const root = this.target.attachShadow(),
|
|
27330
|
+
line = application.graphicService.creator[type](Object.assign({}, null === (_a = this.params) || void 0 === _a ? void 0 : _a.attribute));
|
|
27331
|
+
this[type] = line, line.pathProxy = new CustomPath2D(), root.add(line);
|
|
24290
27332
|
}
|
|
24291
|
-
|
|
24292
|
-
|
|
27333
|
+
onStartRect() {
|
|
27334
|
+
var _a, _b, _c;
|
|
27335
|
+
const root = this.target.attachShadow(),
|
|
27336
|
+
isHorizontal = null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.isHorizontal) || void 0 === _b || _b,
|
|
27337
|
+
sizeAttr = isHorizontal ? "height" : "width",
|
|
27338
|
+
otherSizeAttr = isHorizontal ? "width" : "height",
|
|
27339
|
+
size = this.target.AABBBounds[sizeAttr](),
|
|
27340
|
+
y = isHorizontal ? 0 : this.target.AABBBounds.y1,
|
|
27341
|
+
rect = application.graphicService.creator.rect(Object.assign(Object.assign({
|
|
27342
|
+
[sizeAttr]: size,
|
|
27343
|
+
fill: "#bcdeff",
|
|
27344
|
+
shadowBlur: 30,
|
|
27345
|
+
shadowColor: "#bcdeff"
|
|
27346
|
+
}, null === (_c = this.params) || void 0 === _c ? void 0 : _c.attribute), {
|
|
27347
|
+
x: 0,
|
|
27348
|
+
y: y,
|
|
27349
|
+
[otherSizeAttr]: 0
|
|
27350
|
+
}));
|
|
27351
|
+
this.rect = rect, root.add(rect);
|
|
24293
27352
|
}
|
|
24294
|
-
|
|
24295
|
-
|
|
27353
|
+
onBind() {}
|
|
27354
|
+
onEnd() {
|
|
27355
|
+
this.target.detachShadow();
|
|
24296
27356
|
}
|
|
24297
|
-
onUpdate(
|
|
24298
|
-
return this.
|
|
27357
|
+
onUpdate(end, ratio, out) {
|
|
27358
|
+
return this.rect ? this.onUpdateRect(end, ratio, out) : this.line || this.area ? this.onUpdateLineOrArea(end, ratio, out) : void 0;
|
|
24299
27359
|
}
|
|
24300
|
-
|
|
24301
|
-
|
|
24302
|
-
|
|
24303
|
-
|
|
24304
|
-
|
|
24305
|
-
|
|
24306
|
-
|
|
27360
|
+
onUpdateRect(end, ratio, out) {
|
|
27361
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
27362
|
+
const isHorizontal = null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.isHorizontal) || void 0 === _b || _b,
|
|
27363
|
+
parentAttr = this.target.attribute;
|
|
27364
|
+
if (isHorizontal) {
|
|
27365
|
+
const parentWidth = null !== (_d = null !== (_c = parentAttr.width) && void 0 !== _c ? _c : Math.abs(parentAttr.x1 - parentAttr.x)) && void 0 !== _d ? _d : 250,
|
|
27366
|
+
streamLength = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.streamLength) && void 0 !== _f ? _f : parentWidth,
|
|
27367
|
+
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,
|
|
27368
|
+
startX = -maxLength,
|
|
27369
|
+
currentX = startX + (streamLength - startX) * ratio,
|
|
27370
|
+
x = Math.max(currentX, 0),
|
|
27371
|
+
w = Math.min(Math.min(currentX + maxLength, maxLength), streamLength - currentX),
|
|
27372
|
+
width = w + x > parentWidth ? Math.max(parentWidth - x, 0) : w;
|
|
27373
|
+
this.rect.setAttributes({
|
|
27374
|
+
x: x,
|
|
27375
|
+
width: width,
|
|
27376
|
+
dx: Math.min(parentAttr.x1 - parentAttr.x, 0)
|
|
27377
|
+
}, !1, {
|
|
27378
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
27379
|
+
animationState: {
|
|
27380
|
+
ratio: ratio,
|
|
27381
|
+
end: end
|
|
27382
|
+
}
|
|
24307
27383
|
});
|
|
24308
|
-
|
|
24309
|
-
|
|
24310
|
-
|
|
27384
|
+
} else {
|
|
27385
|
+
const parentHeight = null !== (_l = null !== (_k = parentAttr.height) && void 0 !== _k ? _k : Math.abs(parentAttr.y1 - parentAttr.y)) && void 0 !== _l ? _l : 250,
|
|
27386
|
+
streamLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.streamLength) && void 0 !== _o ? _o : parentHeight,
|
|
27387
|
+
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,
|
|
27388
|
+
currentY = parentHeight - (streamLength + maxLength) * ratio;
|
|
27389
|
+
let y = Math.min(currentY, parentHeight);
|
|
27390
|
+
const h = Math.min(parentHeight - currentY, maxLength);
|
|
27391
|
+
let height;
|
|
27392
|
+
y <= 0 ? (height = Math.max(y + h, 0), y = 0) : height = h, this.rect.setAttributes({
|
|
27393
|
+
y: y,
|
|
27394
|
+
height: height,
|
|
27395
|
+
dy: Math.min(parentAttr.y1 - parentAttr.y, 0)
|
|
27396
|
+
}, !1, {
|
|
27397
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
27398
|
+
animationState: {
|
|
27399
|
+
ratio: ratio,
|
|
27400
|
+
end: end
|
|
27401
|
+
}
|
|
24311
27402
|
});
|
|
24312
|
-
}
|
|
27403
|
+
}
|
|
24313
27404
|
}
|
|
24314
|
-
|
|
24315
|
-
this.
|
|
24316
|
-
|
|
24317
|
-
|
|
27405
|
+
onUpdateLineOrArea(end, ratio, out) {
|
|
27406
|
+
const target = this.line || this.area;
|
|
27407
|
+
if (!target) return;
|
|
27408
|
+
const customPath = target.pathProxy,
|
|
27409
|
+
targetLine = this.target;
|
|
27410
|
+
targetLine.cache || targetLine.cacheArea ? this._onUpdateLineOrAreaWithCache(customPath, targetLine, end, ratio, out) : this._onUpdateLineWithoutCache(customPath, targetLine, end, ratio, out);
|
|
27411
|
+
const targetAttrs = targetLine.attribute;
|
|
27412
|
+
target.setAttributes(Object.assign({
|
|
27413
|
+
stroke: targetAttrs.stroke
|
|
27414
|
+
}, target.attribute)), target.addUpdateBoundTag();
|
|
24318
27415
|
}
|
|
24319
|
-
|
|
24320
|
-
|
|
24321
|
-
|
|
24322
|
-
|
|
27416
|
+
_onUpdateLineOrAreaWithCache(customPath, g, end, ratio, out) {
|
|
27417
|
+
var _a, _b;
|
|
27418
|
+
if (customPath.clear(), "line" === g.type) {
|
|
27419
|
+
let cache = g.cache;
|
|
27420
|
+
Array.isArray(cache) || (cache = [cache]);
|
|
27421
|
+
const totalLen = cache.reduce((l, c) => l + c.getLength(), 0),
|
|
27422
|
+
curves = [];
|
|
27423
|
+
return cache.forEach(c => {
|
|
27424
|
+
c.curves.forEach(ci => curves.push(ci));
|
|
27425
|
+
}), this._updateCurves(customPath, curves, totalLen, ratio);
|
|
27426
|
+
}
|
|
27427
|
+
if ("area" === g.type && (null === (_b = null === (_a = g.cacheArea) || void 0 === _a ? void 0 : _a.top) || void 0 === _b ? void 0 : _b.curves)) {
|
|
27428
|
+
const cache = g.cacheArea,
|
|
27429
|
+
totalLen = cache.top.curves.reduce((a, b) => a + b.getLength(), 0);
|
|
27430
|
+
return this._updateCurves(customPath, cache.top.curves, totalLen, ratio);
|
|
27431
|
+
}
|
|
27432
|
+
}
|
|
27433
|
+
_updateCurves(customPath, curves, totalLen, ratio) {
|
|
27434
|
+
var _a, _b;
|
|
27435
|
+
const startLen = totalLen * ratio,
|
|
27436
|
+
endLen = Math.min(startLen + (null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.streamLength) && void 0 !== _b ? _b : 10), totalLen);
|
|
27437
|
+
let lastLen = 0,
|
|
27438
|
+
start = !1;
|
|
27439
|
+
for (let i = 0; i < curves.length; i++) if (!1 !== curves[i].defined) {
|
|
27440
|
+
const curveItem = curves[i],
|
|
27441
|
+
len = curveItem.getLength(),
|
|
27442
|
+
startPercent = 1 - (lastLen + len - startLen) / len;
|
|
27443
|
+
let curveForStart,
|
|
27444
|
+
endPercent = 1 - (lastLen + len - endLen) / len;
|
|
27445
|
+
if (lastLen < startLen && lastLen + len > startLen) if (start = !0, curveItem.p2 && curveItem.p3) {
|
|
27446
|
+
const [_, curve2] = divideCubic(curveItem, startPercent);
|
|
27447
|
+
customPath.moveTo(curve2.p0.x, curve2.p0.y), curveForStart = curve2;
|
|
27448
|
+
} else {
|
|
27449
|
+
const p = curveItem.getPointAt(startPercent);
|
|
27450
|
+
customPath.moveTo(p.x, p.y);
|
|
27451
|
+
}
|
|
27452
|
+
if (lastLen < endLen && lastLen + len > endLen) {
|
|
27453
|
+
if (curveItem.p2 && curveItem.p3) {
|
|
27454
|
+
curveForStart && (endPercent = (endLen - startLen) / curveForStart.getLength());
|
|
27455
|
+
const [curve1] = divideCubic(curveForStart || curveItem, endPercent);
|
|
27456
|
+
customPath.bezierCurveTo(curve1.p1.x, curve1.p1.y, curve1.p2.x, curve1.p2.y, curve1.p3.x, curve1.p3.y);
|
|
27457
|
+
} else {
|
|
27458
|
+
const p = curveItem.getPointAt(endPercent);
|
|
27459
|
+
customPath.lineTo(p.x, p.y);
|
|
27460
|
+
}
|
|
27461
|
+
break;
|
|
27462
|
+
}
|
|
27463
|
+
if (start) if (curveItem.p2 && curveItem.p3) {
|
|
27464
|
+
const curve = curveForStart || curveItem;
|
|
27465
|
+
customPath.bezierCurveTo(curve.p1.x, curve.p1.y, curve.p2.x, curve.p2.y, curve.p3.x, curve.p3.y);
|
|
27466
|
+
} else customPath.lineTo(curveItem.p1.x, curveItem.p1.y);
|
|
27467
|
+
lastLen += len;
|
|
27468
|
+
}
|
|
24323
27469
|
}
|
|
24324
|
-
|
|
24325
|
-
|
|
27470
|
+
_onUpdateLineWithoutCache(customPath, line, end, ratio, out) {
|
|
27471
|
+
var _a, _b;
|
|
27472
|
+
const {
|
|
27473
|
+
points: points,
|
|
27474
|
+
curveType: curveType
|
|
27475
|
+
} = line.attribute;
|
|
27476
|
+
if (!points || points.length < 2 || "linear" !== curveType) return;
|
|
27477
|
+
let totalLen = 0;
|
|
27478
|
+
for (let i = 1; i < points.length; i++) totalLen += PointService.distancePP(points[i], points[i - 1]);
|
|
27479
|
+
const startLen = totalLen * ratio,
|
|
27480
|
+
endLen = Math.min(startLen + (null !== (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.streamLength) && void 0 !== _b ? _b : 10), totalLen),
|
|
27481
|
+
nextPoints = [];
|
|
27482
|
+
let lastLen = 0;
|
|
27483
|
+
for (let i = 1; i < points.length; i++) {
|
|
27484
|
+
const len = PointService.distancePP(points[i], points[i - 1]);
|
|
27485
|
+
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) {
|
|
27486
|
+
nextPoints.push(PointService.pointAtPP(points[i - 1], points[i], 1 - (lastLen + len - endLen) / len));
|
|
27487
|
+
break;
|
|
27488
|
+
}
|
|
27489
|
+
nextPoints.length && nextPoints.push(points[i]), lastLen += len;
|
|
27490
|
+
}
|
|
27491
|
+
if (nextPoints.length && !(nextPoints.length < 2)) {
|
|
27492
|
+
customPath.clear(), customPath.moveTo(nextPoints[0].x, nextPoints[0].y);
|
|
27493
|
+
for (let i = 1; i < nextPoints.length; i++) customPath.lineTo(nextPoints[i].x, nextPoints[i].y);
|
|
27494
|
+
}
|
|
24326
27495
|
}
|
|
24327
27496
|
}
|
|
24328
|
-
|
|
24329
|
-
|
|
24330
|
-
|
|
27497
|
+
|
|
27498
|
+
const registerCustomAnimate = () => {
|
|
27499
|
+
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);
|
|
27500
|
+
};
|
|
24331
27501
|
|
|
24332
27502
|
class AxisEnter extends AComponentAnimate {
|
|
24333
27503
|
onBind() {
|
|
@@ -30299,7 +33469,7 @@
|
|
|
30299
33469
|
}
|
|
30300
33470
|
|
|
30301
33471
|
let idCount = 1;
|
|
30302
|
-
class ResizeObserver {
|
|
33472
|
+
let ResizeObserver$1 = class ResizeObserver {
|
|
30303
33473
|
constructor(element, cb, resizeTime) {
|
|
30304
33474
|
var _a;
|
|
30305
33475
|
if (this.resizeTime = 100, this.lastSize = {
|
|
@@ -30339,7 +33509,7 @@
|
|
|
30339
33509
|
height: Math.floor(this.element.clientHeight)
|
|
30340
33510
|
} : Object.assign({}, this.lastSize);
|
|
30341
33511
|
}
|
|
30342
|
-
}
|
|
33512
|
+
};
|
|
30343
33513
|
class EventHandler {
|
|
30344
33514
|
constructor() {
|
|
30345
33515
|
this.listeners = {}, this.reseizeListeners = {};
|
|
@@ -30348,7 +33518,7 @@
|
|
|
30348
33518
|
if ("node" === Env.mode) return -1;
|
|
30349
33519
|
const id = idCount++;
|
|
30350
33520
|
if (null == target ? void 0 : target.addEventListener) if ("resize" !== type || target === window) null == target || target.addEventListener(type, listener, ...options);else {
|
|
30351
|
-
const resizeObserver = new ResizeObserver(target, listener, this.resizeTime);
|
|
33521
|
+
const resizeObserver = new ResizeObserver$1(target, listener, this.resizeTime);
|
|
30352
33522
|
this.reseizeListeners[id] = resizeObserver;
|
|
30353
33523
|
}
|
|
30354
33524
|
const obj = {
|
|
@@ -32670,6 +35840,24 @@
|
|
|
32670
35840
|
}
|
|
32671
35841
|
return childTotalLength;
|
|
32672
35842
|
}
|
|
35843
|
+
_setNodeStateRecursive(node, targetState) {
|
|
35844
|
+
var _a;
|
|
35845
|
+
if (!node) return;
|
|
35846
|
+
const children = null !== (_a = node.filteredChildren) && void 0 !== _a ? _a : node.children;
|
|
35847
|
+
if (children && (Array.isArray(children) ? children.length > 0 : !0 === children) && (node.hierarchyState = targetState), children && Array.isArray(children)) for (const child of children) this._setNodeStateRecursive(child, targetState);
|
|
35848
|
+
}
|
|
35849
|
+
expandAllNodes() {
|
|
35850
|
+
if (Array.isArray(this._source)) {
|
|
35851
|
+
for (const rootNode of this._source) this._setNodeStateRecursive(rootNode, HierarchyState.expand);
|
|
35852
|
+
this.hasHierarchyStateExpand = !0, this.clearSortedIndexMap(), this.restoreTreeHierarchyState(), this.lastSortStates && this.lastSortStates.length > 0 ? this.sort(this.lastSortStates) : this.updatePagerData();
|
|
35853
|
+
}
|
|
35854
|
+
}
|
|
35855
|
+
collapseAllNodes() {
|
|
35856
|
+
if (Array.isArray(this._source)) {
|
|
35857
|
+
for (const rootNode of this._source) this._setNodeStateRecursive(rootNode, HierarchyState.collapse);
|
|
35858
|
+
this.clearSortedIndexMap(), this.restoreTreeHierarchyState(), this.lastSortStates && this.lastSortStates.length > 0 ? this.sort(this.lastSortStates) : this.updatePagerData();
|
|
35859
|
+
}
|
|
35860
|
+
}
|
|
32673
35861
|
}
|
|
32674
35862
|
DataSource.EMPTY = new DataSource({
|
|
32675
35863
|
get() {},
|
|
@@ -40634,7 +43822,7 @@
|
|
|
40634
43822
|
}
|
|
40635
43823
|
}
|
|
40636
43824
|
|
|
40637
|
-
var __awaiter$
|
|
43825
|
+
var __awaiter$6 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
40638
43826
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40639
43827
|
function fulfilled(value) {
|
|
40640
43828
|
try {
|
|
@@ -40660,7 +43848,7 @@
|
|
|
40660
43848
|
});
|
|
40661
43849
|
};
|
|
40662
43850
|
function dynamicSetX(x, screenLeft, isEnd, proxy) {
|
|
40663
|
-
return __awaiter$
|
|
43851
|
+
return __awaiter$6(this, void 0, void 0, function* () {
|
|
40664
43852
|
if (!screenLeft) return;
|
|
40665
43853
|
const screenLeftCol = screenLeft.col,
|
|
40666
43854
|
screenLeftX = screenLeft.left;
|
|
@@ -40679,7 +43867,7 @@
|
|
|
40679
43867
|
deltaCol > 0 ? (moveColumn(deltaCol, "left", proxy.screenLeftCol, screenLeftX, x, proxy), proxy.updateDeltaX(x, screenLeftX, screenLeftCol), proxy.table.scenegraph.setBodyAndColHeaderX(-x + proxy.deltaX)) : deltaCol < 0 ? (moveColumn(-deltaCol, "right", proxy.screenLeftCol, screenLeftX, x, proxy), proxy.updateDeltaX(x, screenLeftX, screenLeftCol), proxy.table.scenegraph.setBodyAndColHeaderX(-x + proxy.deltaX)) : (proxy.updateDeltaX(x, screenLeftX, screenLeftCol), proxy.table.scenegraph.setBodyAndColHeaderX(-x + proxy.deltaX));
|
|
40680
43868
|
}
|
|
40681
43869
|
function moveColumn(count, direction, screenLeftCol, screenLeftX, x, proxy) {
|
|
40682
|
-
return __awaiter$
|
|
43870
|
+
return __awaiter$6(this, void 0, void 0, function* () {
|
|
40683
43871
|
if ("left" === direction && proxy.colEnd + count > proxy.bodyRightCol ? count = proxy.bodyRightCol - proxy.colEnd : "right" === direction && proxy.colStart - count < proxy.bodyLeftCol && (count = proxy.colStart - proxy.bodyLeftCol), 0 !== count) if (count < 0 && (direction = "left" === direction ? "right" : "left", count = -count), count < proxy.colEnd - proxy.colStart) {
|
|
40684
43872
|
const startCol = "left" === direction ? proxy.colStart : proxy.colEnd - count + 1,
|
|
40685
43873
|
endCol = "left" === direction ? proxy.colStart + count - 1 : proxy.colEnd,
|
|
@@ -40810,7 +43998,7 @@
|
|
|
40810
43998
|
return y = row < table.frozenRowCount ? table.getRowsHeight(0, row - 1) : row >= table.rowCount - table.bottomFrozenRowCount ? table.getRowsHeight(table.rowCount - table.bottomFrozenRowCount, row - 1) : table.getRowsHeight(table.frozenRowCount, row - 1), y;
|
|
40811
43999
|
}
|
|
40812
44000
|
|
|
40813
|
-
var __awaiter$
|
|
44001
|
+
var __awaiter$5 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
40814
44002
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40815
44003
|
function fulfilled(value) {
|
|
40816
44004
|
try {
|
|
@@ -40836,7 +44024,7 @@
|
|
|
40836
44024
|
});
|
|
40837
44025
|
};
|
|
40838
44026
|
function dynamicSetY(y, screenTop, isEnd, proxy) {
|
|
40839
|
-
return __awaiter$
|
|
44027
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
40840
44028
|
if (!screenTop) return;
|
|
40841
44029
|
const screenTopRow = screenTop.row,
|
|
40842
44030
|
screenTopY = screenTop.top;
|
|
@@ -40854,7 +44042,7 @@
|
|
|
40854
44042
|
deltaRow > 0 ? (moveCell(deltaRow, "up", screenTopRow, screenTopY, y, proxy), proxy.updateDeltaY(y, screenTopY, screenTopRow), proxy.updateBody(y - proxy.deltaY)) : deltaRow < 0 ? (moveCell(-deltaRow, "down", screenTopRow, screenTopY, y, proxy), proxy.updateDeltaY(y, screenTopY, screenTopRow), proxy.updateBody(y - proxy.deltaY)) : (proxy.updateDeltaY(y, screenTopY, screenTopRow), proxy.updateBody(y - proxy.deltaY));
|
|
40855
44043
|
}
|
|
40856
44044
|
function moveCell(count, direction, screenTopRow, screenTopY, y, proxy) {
|
|
40857
|
-
return __awaiter$
|
|
44045
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
40858
44046
|
if ("up" === direction && proxy.rowEnd + count > proxy.bodyBottomRow ? count = proxy.bodyBottomRow - proxy.rowEnd : "down" === direction && proxy.rowStart - count < proxy.bodyTopRow && (count = proxy.rowStart - proxy.bodyTopRow), 0 !== count) if (count < 0 && (direction = "up" === direction ? "down" : "up", count = -count), count < proxy.rowEnd - proxy.rowStart) {
|
|
40859
44047
|
const startRow = "up" === direction ? proxy.rowStart : proxy.rowEnd - count + 1,
|
|
40860
44048
|
endRow = "up" === direction ? proxy.rowStart + count - 1 : proxy.rowEnd,
|
|
@@ -40954,7 +44142,7 @@
|
|
|
40954
44142
|
}
|
|
40955
44143
|
}
|
|
40956
44144
|
|
|
40957
|
-
var __awaiter$
|
|
44145
|
+
var __awaiter$4 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
40958
44146
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40959
44147
|
function fulfilled(value) {
|
|
40960
44148
|
try {
|
|
@@ -40981,7 +44169,7 @@
|
|
|
40981
44169
|
};
|
|
40982
44170
|
function sortVertical(proxy) {
|
|
40983
44171
|
var _a;
|
|
40984
|
-
return __awaiter$
|
|
44172
|
+
return __awaiter$4(this, void 0, void 0, function* () {
|
|
40985
44173
|
let syncTopRow, syncBottomRow;
|
|
40986
44174
|
proxy.table.scenegraph.bodyGroup.forEachChildren((colGroup, index) => {
|
|
40987
44175
|
"group" === colGroup.type && (colGroup.needUpdate = !0, null == colGroup || colGroup.forEachChildren(cellGroup => {
|
|
@@ -41013,7 +44201,7 @@
|
|
|
41013
44201
|
});
|
|
41014
44202
|
}
|
|
41015
44203
|
|
|
41016
|
-
var __awaiter$
|
|
44204
|
+
var __awaiter$3 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
41017
44205
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41018
44206
|
function fulfilled(value) {
|
|
41019
44207
|
try {
|
|
@@ -41039,7 +44227,7 @@
|
|
|
41039
44227
|
});
|
|
41040
44228
|
};
|
|
41041
44229
|
function sortHorizontal(proxy) {
|
|
41042
|
-
return __awaiter$
|
|
44230
|
+
return __awaiter$3(this, void 0, void 0, function* () {
|
|
41043
44231
|
proxy.table.scenegraph.bodyGroup.forEachChildren((colGroup, index) => {
|
|
41044
44232
|
"group" === colGroup.type && (colGroup.needUpdate = !0, null == colGroup || colGroup.forEachChildren(cellGroup => {
|
|
41045
44233
|
cellGroup.needUpdate = !0;
|
|
@@ -41278,7 +44466,7 @@
|
|
|
41278
44466
|
return !!(table.theme.headerStyle.textStick || table.theme.rowHeaderStyle.textStick || table.theme.bodyStyle.textStick);
|
|
41279
44467
|
}
|
|
41280
44468
|
|
|
41281
|
-
var __awaiter$
|
|
44469
|
+
var __awaiter$2 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
41282
44470
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41283
44471
|
function fulfilled(value) {
|
|
41284
44472
|
try {
|
|
@@ -41361,21 +44549,21 @@
|
|
|
41361
44549
|
createGroupForFirstScreen(cornerHeaderGroup, colHeaderGroup, rowHeaderGroup, rightFrozenGroup, bottomFrozenGroup, bodyGroup, xOrigin, yOrigin, this);
|
|
41362
44550
|
}
|
|
41363
44551
|
progress() {
|
|
41364
|
-
return __awaiter$
|
|
44552
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41365
44553
|
if (!this.isProgressing) return this.isProgressing = !0, new Promise((resolve, reject) => {
|
|
41366
|
-
setTimeout(() => __awaiter$
|
|
44554
|
+
setTimeout(() => __awaiter$2(this, void 0, void 0, function* () {
|
|
41367
44555
|
this.isProgressing = !1, this.isRelease || (this.colUpdatePos <= this.colEnd ? (yield this.updateColCellGroupsAsync(), yield this.progress()) : this.rowUpdatePos <= this.rowEnd ? (yield this.updateRowCellGroupsAsync(), yield this.progress()) : this.currentCol < this.totalCol ? (yield this.createCol(), yield this.progress()) : this.currentRow < this.totalRow && (yield this.createRow(), yield this.progress()), handleTextStick(this.table), this.table.scenegraph.updateNextFrame(), resolve());
|
|
41368
44556
|
}), 16);
|
|
41369
44557
|
});
|
|
41370
44558
|
});
|
|
41371
44559
|
}
|
|
41372
44560
|
createRow() {
|
|
41373
|
-
return __awaiter$
|
|
44561
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41374
44562
|
this.taskRowCount && this.createRowCellGroup(this.taskRowCount);
|
|
41375
44563
|
});
|
|
41376
44564
|
}
|
|
41377
44565
|
createCol() {
|
|
41378
|
-
return __awaiter$
|
|
44566
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41379
44567
|
this.taskColCount && this.createColGroup(this.taskRowCount);
|
|
41380
44568
|
});
|
|
41381
44569
|
}
|
|
@@ -41439,7 +44627,7 @@
|
|
|
41439
44627
|
createColGroup(this.table.scenegraph.bodyGroup, xOrigin, yOrigin, this.currentCol + 1, endCol, this.rowStart, this.rowEnd, "body", this.table), this.currentCol = endCol, this.colUpdatePos = this.colEnd, this.table.scenegraph.updateContainer(), this.table.scenegraph.updateBorderSizeAndPosition();
|
|
41440
44628
|
}
|
|
41441
44629
|
setY(y, isEnd = !1) {
|
|
41442
|
-
return __awaiter$
|
|
44630
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41443
44631
|
const yLimitTop = this.table.getRowsHeight(this.bodyTopRow, this.bodyTopRow + (this.rowEnd - this.rowStart + 1)) / 2,
|
|
41444
44632
|
yLimitBottom = this.table.getAllRowsHeight() - yLimitTop,
|
|
41445
44633
|
screenTop = this.table.getTargetRowAt(y + this.table.scenegraph.colHeaderGroup.attribute.height);
|
|
@@ -41447,7 +44635,7 @@
|
|
|
41447
44635
|
});
|
|
41448
44636
|
}
|
|
41449
44637
|
setX(x, isEnd = !1) {
|
|
41450
|
-
return __awaiter$
|
|
44638
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41451
44639
|
const xLimitLeft = this.table.getColsWidth(this.bodyLeftCol, this.bodyLeftCol + (this.colEnd - this.colStart + 1)) / 2,
|
|
41452
44640
|
xLimitRight = this.table.getAllColsWidth() - xLimitLeft,
|
|
41453
44641
|
screenLeft = this.table.getTargetColAt(x + this.table.scenegraph.rowHeaderGroup.attribute.width);
|
|
@@ -41455,12 +44643,12 @@
|
|
|
41455
44643
|
});
|
|
41456
44644
|
}
|
|
41457
44645
|
dynamicSetY(y, screenTop, isEnd = !1) {
|
|
41458
|
-
return __awaiter$
|
|
44646
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41459
44647
|
dynamicSetY(y, screenTop, isEnd, this);
|
|
41460
44648
|
});
|
|
41461
44649
|
}
|
|
41462
44650
|
dynamicSetX(x, screenLeft, isEnd = !1) {
|
|
41463
|
-
return __awaiter$
|
|
44651
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41464
44652
|
dynamicSetX(x, screenLeft, isEnd, this);
|
|
41465
44653
|
});
|
|
41466
44654
|
}
|
|
@@ -41468,7 +44656,7 @@
|
|
|
41468
44656
|
this.table.scenegraph.setBodyAndRowHeaderY(-y);
|
|
41469
44657
|
}
|
|
41470
44658
|
updateRowCellGroupsAsync() {
|
|
41471
|
-
return __awaiter$
|
|
44659
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41472
44660
|
this.updateCellGroups(this.taskRowCount);
|
|
41473
44661
|
});
|
|
41474
44662
|
}
|
|
@@ -41487,7 +44675,7 @@
|
|
|
41487
44675
|
"autoWidth" === this.table.widthMode && computeColsWidth(this.table, startCol, endCol, !1), updateColContent(startCol, endCol, this), this.table.isAutoRowHeight(this.rowStart) && updateAutoColumn(startCol, endCol, this.table, this.colUpdateDirection);
|
|
41488
44676
|
}
|
|
41489
44677
|
updateColCellGroupsAsync() {
|
|
41490
|
-
return __awaiter$
|
|
44678
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41491
44679
|
this.updateColGroups(this.taskRowCount);
|
|
41492
44680
|
});
|
|
41493
44681
|
}
|
|
@@ -41504,12 +44692,12 @@
|
|
|
41504
44692
|
return cellGroup.needUpdate = !1, newCellGroup || cellGroup;
|
|
41505
44693
|
}
|
|
41506
44694
|
sortCellVertical() {
|
|
41507
|
-
return __awaiter$
|
|
44695
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41508
44696
|
yield sortVertical(this);
|
|
41509
44697
|
});
|
|
41510
44698
|
}
|
|
41511
44699
|
sortCellHorizontal() {
|
|
41512
|
-
return __awaiter$
|
|
44700
|
+
return __awaiter$2(this, void 0, void 0, function* () {
|
|
41513
44701
|
yield sortHorizontal(this);
|
|
41514
44702
|
});
|
|
41515
44703
|
}
|
|
@@ -45533,15 +48721,26 @@
|
|
|
45533
48721
|
var _a;
|
|
45534
48722
|
let originalFrozenColCount = this.table.options.frozenColCount ? this.table.options.frozenColCount : this.table.isPivotTable() || this.table.isListTable() && this.table.internalProps.transpose ? (null !== (_a = this.table.rowHeaderLevelCount) && void 0 !== _a ? _a : 0) + this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount : 0;
|
|
45535
48723
|
if (originalFrozenColCount) {
|
|
45536
|
-
originalFrozenColCount
|
|
45537
|
-
const
|
|
45538
|
-
if (
|
|
48724
|
+
originalFrozenColCount = Math.min(originalFrozenColCount, this.table.colCount);
|
|
48725
|
+
const container = this.table.getContainer();
|
|
48726
|
+
if (container && 0 === container.clientWidth) {
|
|
48727
|
+
if (this._frozenObserver) return;
|
|
48728
|
+
return this._frozenObserver = new ResizeObserver(entries => {
|
|
48729
|
+
for (const entry of entries) if (entry.contentRect.width > 0) return this.clearFrozenObserver(), this.table.resize(), void setTimeout(() => {
|
|
48730
|
+
this.checkFrozen();
|
|
48731
|
+
}, 0);
|
|
48732
|
+
}), void this._frozenObserver.observe(container);
|
|
48733
|
+
}
|
|
48734
|
+
if (this.table.getColsWidth(0, originalFrozenColCount - 1) > this.table._getMaxFrozenWidth()) {
|
|
45539
48735
|
if (this.table.internalProps.unfreezeAllOnExceedsMaxWidth) this.table._setFrozenColCount(0), this.setFrozenCol(-1);else {
|
|
45540
48736
|
const computedFrozenColCount = this.table._getComputedFrozenColCount(originalFrozenColCount);
|
|
45541
48737
|
this.table._setFrozenColCount(computedFrozenColCount), this.setFrozenCol(computedFrozenColCount);
|
|
45542
48738
|
}
|
|
45543
48739
|
} else this.table.frozenColCount !== originalFrozenColCount && (this.table._setFrozenColCount(originalFrozenColCount), this.setFrozenCol(originalFrozenColCount));
|
|
45544
|
-
}
|
|
48740
|
+
} else this.clearFrozenObserver();
|
|
48741
|
+
}
|
|
48742
|
+
clearFrozenObserver() {
|
|
48743
|
+
this._frozenObserver && (this._frozenObserver.disconnect(), this._frozenObserver = null);
|
|
45545
48744
|
}
|
|
45546
48745
|
setFrozenCol(col) {
|
|
45547
48746
|
col !== this.frozen.col ? (this.frozen.col = col, this.table.scenegraph.updateFrozen(), this.table.scenegraph.updateFrozenIcon(0, this.table.colCount - 1)) : this.table.scenegraph.updateFrozenIcon(0, this.table.colCount - 1);
|
|
@@ -46386,7 +49585,7 @@
|
|
|
46386
49585
|
}
|
|
46387
49586
|
});
|
|
46388
49587
|
}), table.scenegraph.tableGroup.addEventListener("pointerup", e => {
|
|
46389
|
-
var _a, _b, _c, _d;
|
|
49588
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
46390
49589
|
if (0 === e.button) {
|
|
46391
49590
|
if ("grabing" === stateManager.interactionState) {
|
|
46392
49591
|
if (stateManager.updateInteractionState(InteractionState.default), stateManager.isResizeCol()) endResizeCol(table);else if (stateManager.isResizeRow()) endResizeRow(table);else if (stateManager.isMoveCol()) {
|
|
@@ -46409,14 +49608,42 @@
|
|
|
46409
49608
|
}
|
|
46410
49609
|
}
|
|
46411
49610
|
} else stateManager.interactionState === InteractionState.scrolling && stateManager.updateInteractionState(InteractionState.default);
|
|
49611
|
+
if (!table.eventManager.isDraging) {
|
|
49612
|
+
const eventArgsSet = getCellEventArgsSet(e);
|
|
49613
|
+
if (!eventManager.isTouchMove && 0 === e.button && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
|
|
49614
|
+
const {
|
|
49615
|
+
col: col,
|
|
49616
|
+
row: row
|
|
49617
|
+
} = eventArgsSet.eventArgs,
|
|
49618
|
+
cellInfo = table.getCellInfo(col, row);
|
|
49619
|
+
let icon, position;
|
|
49620
|
+
if (null === (_c = eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target) {
|
|
49621
|
+
const iconInfo = getIconAndPositionFromTarget(null === (_d = eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.target);
|
|
49622
|
+
iconInfo && (icon = iconInfo.icon, position = iconInfo.position);
|
|
49623
|
+
}
|
|
49624
|
+
const cellsEvent = Object.assign(Object.assign({}, cellInfo), {
|
|
49625
|
+
event: e.nativeEvent,
|
|
49626
|
+
federatedEvent: e,
|
|
49627
|
+
cells: [],
|
|
49628
|
+
targetIcon: icon ? {
|
|
49629
|
+
name: icon.name,
|
|
49630
|
+
position: position,
|
|
49631
|
+
funcType: icon.attribute.funcType
|
|
49632
|
+
} : void 0,
|
|
49633
|
+
target: null === (_e = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _e ? void 0 : _e.target,
|
|
49634
|
+
mergeCellInfo: null === (_f = eventArgsSet.eventArgs) || void 0 === _f ? void 0 : _f.mergeInfo
|
|
49635
|
+
});
|
|
49636
|
+
table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
|
|
49637
|
+
}
|
|
49638
|
+
}
|
|
46412
49639
|
if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL)) {
|
|
46413
49640
|
const eventArgsSet = getCellEventArgsSet(e);
|
|
46414
49641
|
eventArgsSet.eventArgs && table.fireListeners(TABLE_EVENT_TYPE.MOUSEUP_CELL, {
|
|
46415
49642
|
col: eventArgsSet.eventArgs.col,
|
|
46416
49643
|
row: eventArgsSet.eventArgs.row,
|
|
46417
49644
|
event: e.nativeEvent,
|
|
46418
|
-
target: null === (
|
|
46419
|
-
mergeCellInfo: null === (
|
|
49645
|
+
target: null === (_g = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _g ? void 0 : _g.target,
|
|
49646
|
+
mergeCellInfo: null === (_h = eventArgsSet.eventArgs) || void 0 === _h ? void 0 : _h.mergeInfo
|
|
46420
49647
|
});
|
|
46421
49648
|
}
|
|
46422
49649
|
setTimeout(() => {
|
|
@@ -46424,7 +49651,7 @@
|
|
|
46424
49651
|
}, 0);
|
|
46425
49652
|
}
|
|
46426
49653
|
}), table.scenegraph.tableGroup.addEventListener("rightdown", e => {
|
|
46427
|
-
var _a, _b, _c, _d;
|
|
49654
|
+
var _a, _b, _c, _d, _e, _f;
|
|
46428
49655
|
const eventArgsSet = getCellEventArgsSet(e);
|
|
46429
49656
|
if (eventArgsSet.eventArgs) {
|
|
46430
49657
|
stateManager.triggerContextMenu(eventArgsSet.eventArgs.col, eventArgsSet.eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y);
|
|
@@ -46450,43 +49677,18 @@
|
|
|
46450
49677
|
target: null === (_c = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target,
|
|
46451
49678
|
mergeCellInfo: null === (_d = eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.mergeInfo
|
|
46452
49679
|
});
|
|
46453
|
-
cellInRanges(table.stateManager.select.ranges, col, row) ? cellsEvent.cells = table.getSelectedCellInfos() : cellsEvent.cells = [[cellInfo]], table.fireListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL, cellsEvent);
|
|
49680
|
+
(null === (_f = null === (_e = table.options.eventOptions) || void 0 === _e ? void 0 : _e.contextmenuReturnAllSelectedCells) || void 0 === _f || _f) && (cellInRanges(table.stateManager.select.ranges, col, row) ? cellsEvent.cells = table.getSelectedCellInfos() : cellsEvent.cells = [[cellInfo]]), table.fireListeners(TABLE_EVENT_TYPE.CONTEXTMENU_CELL, cellsEvent);
|
|
46454
49681
|
}
|
|
46455
49682
|
}
|
|
46456
49683
|
}), table.scenegraph.tableGroup.addEventListener("pointertap", e => {
|
|
46457
|
-
var _a
|
|
49684
|
+
var _a;
|
|
46458
49685
|
if (table.stateManager.columnResize.resizing) return;
|
|
46459
49686
|
const eventArgsSet = getCellEventArgsSet(e);
|
|
46460
|
-
if (!eventManager.isTouchMove && 0 === e.button && eventArgsSet.eventArgs && table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
|
|
46461
|
-
const {
|
|
46462
|
-
col: col,
|
|
46463
|
-
row: row
|
|
46464
|
-
} = eventArgsSet.eventArgs,
|
|
46465
|
-
cellInfo = table.getCellInfo(col, row);
|
|
46466
|
-
let icon, position;
|
|
46467
|
-
if (null === (_a = eventArgsSet.eventArgs) || void 0 === _a ? void 0 : _a.target) {
|
|
46468
|
-
const iconInfo = getIconAndPositionFromTarget(null === (_b = eventArgsSet.eventArgs) || void 0 === _b ? void 0 : _b.target);
|
|
46469
|
-
iconInfo && (icon = iconInfo.icon, position = iconInfo.position);
|
|
46470
|
-
}
|
|
46471
|
-
const cellsEvent = Object.assign(Object.assign({}, cellInfo), {
|
|
46472
|
-
event: e.nativeEvent,
|
|
46473
|
-
federatedEvent: e,
|
|
46474
|
-
cells: [],
|
|
46475
|
-
targetIcon: icon ? {
|
|
46476
|
-
name: icon.name,
|
|
46477
|
-
position: position,
|
|
46478
|
-
funcType: icon.attribute.funcType
|
|
46479
|
-
} : void 0,
|
|
46480
|
-
target: null === (_c = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _c ? void 0 : _c.target,
|
|
46481
|
-
mergeCellInfo: null === (_d = eventArgsSet.eventArgs) || void 0 === _d ? void 0 : _d.mergeInfo
|
|
46482
|
-
});
|
|
46483
|
-
table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
|
|
46484
|
-
}
|
|
46485
49687
|
if (!table.stateManager.columnResize.resizing && !table.stateManager.columnMove.moving && (eventManager.dealIconClick(e, eventArgsSet), (null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) && eventManager.touchSetTimeout && "touch" === e.pointerType)) {
|
|
46486
49688
|
const eventArgsSet = getCellEventArgsSet(e);
|
|
46487
49689
|
if (eventManager.touchSetTimeout) {
|
|
46488
49690
|
clearTimeout(eventManager.touchSetTimeout);
|
|
46489
|
-
const isHasSelected = !!(null === (
|
|
49691
|
+
const isHasSelected = !!(null === (_a = stateManager.select.ranges) || void 0 === _a ? void 0 : _a.length);
|
|
46490
49692
|
eventManager.dealTableSelect(eventArgsSet), stateManager.endSelectCells(!0, isHasSelected), eventManager.touchSetTimeout = void 0;
|
|
46491
49693
|
}
|
|
46492
49694
|
}
|
|
@@ -46767,7 +49969,7 @@
|
|
|
46767
49969
|
}
|
|
46768
49970
|
getPixelRatio();
|
|
46769
49971
|
|
|
46770
|
-
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
49972
|
+
var __awaiter$1 = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
46771
49973
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
46772
49974
|
function fulfilled(value) {
|
|
46773
49975
|
try {
|
|
@@ -46859,7 +50061,7 @@
|
|
|
46859
50061
|
}
|
|
46860
50062
|
}
|
|
46861
50063
|
handleKeydownListener(e);
|
|
46862
|
-
}), handler.on(table.getElement(), "copy", e => __awaiter(this, void 0, void 0, function* () {
|
|
50064
|
+
}), handler.on(table.getElement(), "copy", e => __awaiter$1(this, void 0, void 0, function* () {
|
|
46863
50065
|
var _a, _b;
|
|
46864
50066
|
if (null === (_a = table.keyboardOptions) || void 0 === _a ? void 0 : _a.copySelected) {
|
|
46865
50067
|
const data = table.getCopyValue();
|
|
@@ -46898,11 +50100,11 @@
|
|
|
46898
50100
|
});
|
|
46899
50101
|
}
|
|
46900
50102
|
}
|
|
46901
|
-
})), handler.on(table.getElement(), "paste", e => {
|
|
46902
|
-
var
|
|
46903
|
-
if ((null === (
|
|
46904
|
-
if (null === (
|
|
46905
|
-
if ((null === (
|
|
50103
|
+
})), handler.on(table.getElement(), "paste", e => __awaiter$1(this, void 0, void 0, function* () {
|
|
50104
|
+
var _c, _d, _e, _f;
|
|
50105
|
+
if ((null === (_c = table.keyboardOptions) || void 0 === _c ? void 0 : _c.pasteValueToCell) && table.changeCellValues) {
|
|
50106
|
+
if (null === (_d = table.editorManager) || void 0 === _d ? void 0 : _d.editingEditor) return;
|
|
50107
|
+
if ((null === (_e = table.stateManager.select.ranges) || void 0 === _e ? void 0 : _e.length) > 0) if (null === (_f = navigator.clipboard) || void 0 === _f ? void 0 : _f.read) navigator.clipboard.read().then(clipboardItems => {
|
|
46906
50108
|
for (const item of clipboardItems) item.types.includes("text/html") ? pasteHtmlToTable(item) : 1 === item.types.length && "text/plain" === item.types[0] && pasteTextToTable(item);
|
|
46907
50109
|
});else {
|
|
46908
50110
|
const ranges = table.stateManager.select.ranges,
|
|
@@ -46917,7 +50119,7 @@
|
|
|
46917
50119
|
cellIndex === cells.length - 1 && (cell = cell.trim()), rowValues.push(cell);
|
|
46918
50120
|
});
|
|
46919
50121
|
});
|
|
46920
|
-
const changedCellResults = table.changeCellValues(col, row, values);
|
|
50122
|
+
const changedCellResults = yield table.changeCellValues(col, row, values);
|
|
46921
50123
|
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
46922
50124
|
col: col,
|
|
46923
50125
|
row: row,
|
|
@@ -46926,7 +50128,7 @@
|
|
|
46926
50128
|
});
|
|
46927
50129
|
}
|
|
46928
50130
|
}
|
|
46929
|
-
}), handler.on(table.getElement(), "contextmenu", e => {
|
|
50131
|
+
})), handler.on(table.getElement(), "contextmenu", e => {
|
|
46930
50132
|
var _a;
|
|
46931
50133
|
!1 !== (null === (_a = table.eventOptions) || void 0 === _a ? void 0 : _a.preventDefaultContextMenu) ? e.preventDefault() : globalPointerupCallback(e);
|
|
46932
50134
|
}), table.options.canvas || handler.on(table.getContainer(), "resize", e => {
|
|
@@ -46946,7 +50148,7 @@
|
|
|
46946
50148
|
pasteValuesRowCount = 0,
|
|
46947
50149
|
values = [];
|
|
46948
50150
|
item.getType("text/html").then(blob => {
|
|
46949
|
-
blob.text().then(pastedData => {
|
|
50151
|
+
blob.text().then(pastedData => __awaiter$1(this, void 0, void 0, function* () {
|
|
46950
50152
|
var _a, _b;
|
|
46951
50153
|
if (pastedData && /(<table)|(<TABLE)/g.test(pastedData)) {
|
|
46952
50154
|
const matches = Array.from(pastedData.matchAll(regex));
|
|
@@ -46956,7 +50158,7 @@
|
|
|
46956
50158
|
values.push(rowValues), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
|
|
46957
50159
|
}
|
|
46958
50160
|
pasteValuesRowCount = null !== (_b = values.length) && void 0 !== _b ? _b : 0, values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
46959
|
-
const changedCellResults = table.changeCellValues(col, row, values, !0);
|
|
50161
|
+
const changedCellResults = yield table.changeCellValues(col, row, values, !0);
|
|
46960
50162
|
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
46961
50163
|
col: col,
|
|
46962
50164
|
row: row,
|
|
@@ -46968,34 +50170,36 @@
|
|
|
46968
50170
|
blob.text().then(_pasteValue);
|
|
46969
50171
|
});
|
|
46970
50172
|
});
|
|
46971
|
-
});
|
|
50173
|
+
}));
|
|
46972
50174
|
});
|
|
46973
50175
|
}
|
|
46974
50176
|
function _pasteValue(pastedData) {
|
|
46975
50177
|
var _a;
|
|
46976
|
-
|
|
46977
|
-
|
|
46978
|
-
|
|
46979
|
-
|
|
46980
|
-
|
|
46981
|
-
|
|
46982
|
-
|
|
46983
|
-
|
|
46984
|
-
|
|
46985
|
-
|
|
46986
|
-
|
|
46987
|
-
|
|
46988
|
-
|
|
46989
|
-
|
|
46990
|
-
|
|
46991
|
-
|
|
46992
|
-
|
|
46993
|
-
|
|
46994
|
-
|
|
46995
|
-
|
|
46996
|
-
|
|
46997
|
-
|
|
46998
|
-
|
|
50178
|
+
return __awaiter$1(this, void 0, void 0, function* () {
|
|
50179
|
+
const ranges = table.stateManager.select.ranges,
|
|
50180
|
+
selectRangeLength = ranges.length,
|
|
50181
|
+
col = Math.min(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
50182
|
+
row = Math.min(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row),
|
|
50183
|
+
maxCol = Math.max(ranges[selectRangeLength - 1].start.col, ranges[selectRangeLength - 1].end.col),
|
|
50184
|
+
maxRow = Math.max(ranges[selectRangeLength - 1].start.row, ranges[selectRangeLength - 1].end.row);
|
|
50185
|
+
let pasteValuesColCount = 0,
|
|
50186
|
+
pasteValuesRowCount = 0,
|
|
50187
|
+
values = [];
|
|
50188
|
+
pastedData.split("\n").forEach(function (rowCells, rowIndex) {
|
|
50189
|
+
var _a;
|
|
50190
|
+
const cells = rowCells.split("\t"),
|
|
50191
|
+
rowValues = [];
|
|
50192
|
+
values.push(rowValues), cells.forEach(function (cell, cellIndex) {
|
|
50193
|
+
cellIndex === cells.length - 1 && (cell = cell.trim()), rowValues.push(cell);
|
|
50194
|
+
}), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
|
|
50195
|
+
}), pasteValuesRowCount = null !== (_a = values.length) && void 0 !== _a ? _a : 0, values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
50196
|
+
const changedCellResults = yield table.changeCellValues(col, row, values, !0);
|
|
50197
|
+
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
50198
|
+
col: col,
|
|
50199
|
+
row: row,
|
|
50200
|
+
pasteData: values,
|
|
50201
|
+
changedCellResults: changedCellResults
|
|
50202
|
+
});
|
|
46999
50203
|
});
|
|
47000
50204
|
}
|
|
47001
50205
|
function pasteTextToTable(item) {
|
|
@@ -47008,7 +50212,7 @@
|
|
|
47008
50212
|
let pasteValuesColCount = 0,
|
|
47009
50213
|
pasteValuesRowCount = 0;
|
|
47010
50214
|
item.getType("text/plain").then(blob => {
|
|
47011
|
-
blob.text().then(pastedData => {
|
|
50215
|
+
blob.text().then(pastedData => __awaiter$1(this, void 0, void 0, function* () {
|
|
47012
50216
|
var _a;
|
|
47013
50217
|
const rows = pastedData.replace(/\r(?!\n)/g, "\r\n").split("\r\n");
|
|
47014
50218
|
let values = [];
|
|
@@ -47020,14 +50224,14 @@
|
|
|
47020
50224
|
cell.includes("\n") && (cell = cell.replace(/^"(.*)"$/, "$1").replace(/["]*/g, match => new Array(Math.floor(match.length / 2)).fill('"').join(""))), rowValues.push(cell);
|
|
47021
50225
|
}), pasteValuesColCount = Math.max(pasteValuesColCount, null !== (_a = null == rowValues ? void 0 : rowValues.length) && void 0 !== _a ? _a : 0);
|
|
47022
50226
|
}), pasteValuesRowCount = null !== (_a = values.length) && void 0 !== _a ? _a : 0, values = handlePasteValues(values, pasteValuesRowCount, pasteValuesColCount, maxRow - row + 1, maxCol - col + 1);
|
|
47023
|
-
const changedCellResults = table.changeCellValues(col, row, values, !0);
|
|
50227
|
+
const changedCellResults = yield table.changeCellValues(col, row, values, !0);
|
|
47024
50228
|
table.hasListeners(TABLE_EVENT_TYPE.PASTED_DATA) && table.fireListeners(TABLE_EVENT_TYPE.PASTED_DATA, {
|
|
47025
50229
|
col: col,
|
|
47026
50230
|
row: row,
|
|
47027
50231
|
pasteData: values,
|
|
47028
50232
|
changedCellResults: changedCellResults
|
|
47029
50233
|
});
|
|
47030
|
-
});
|
|
50234
|
+
}));
|
|
47031
50235
|
});
|
|
47032
50236
|
}
|
|
47033
50237
|
function handlePasteValues(values, rowCount, colCount, selectedRowCount, selectedColCount) {
|
|
@@ -49226,6 +52430,14 @@
|
|
|
49226
52430
|
const children = cloneDeep$1(this.tree.children);
|
|
49227
52431
|
return clearNode(children), children;
|
|
49228
52432
|
}
|
|
52433
|
+
setAllNodesState(state) {
|
|
52434
|
+
this._updateNodeHierarchyState(this.tree, state);
|
|
52435
|
+
}
|
|
52436
|
+
_updateNodeHierarchyState(node, hierarchyState) {
|
|
52437
|
+
node.children && node.children.length > 0 && node.children[0].dimensionKey ? (-1 !== node.level && (node.hierarchyState = hierarchyState), node.children.forEach(child => {
|
|
52438
|
+
this._updateNodeHierarchyState(child, hierarchyState);
|
|
52439
|
+
})) : node.hierarchyState = HierarchyState.none;
|
|
52440
|
+
}
|
|
49229
52441
|
}
|
|
49230
52442
|
function clearNode(children) {
|
|
49231
52443
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -50407,7 +53619,7 @@
|
|
|
50407
53619
|
}
|
|
50408
53620
|
constructor(container, options = {}) {
|
|
50409
53621
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
50410
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.19.
|
|
53622
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.19.3", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
50411
53623
|
this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
50412
53624
|
options: options,
|
|
50413
53625
|
container: container
|
|
@@ -54690,6 +57902,31 @@
|
|
|
54690
57902
|
return {};
|
|
54691
57903
|
}
|
|
54692
57904
|
|
|
57905
|
+
var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
57906
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
57907
|
+
function fulfilled(value) {
|
|
57908
|
+
try {
|
|
57909
|
+
step(generator.next(value));
|
|
57910
|
+
} catch (e) {
|
|
57911
|
+
reject(e);
|
|
57912
|
+
}
|
|
57913
|
+
}
|
|
57914
|
+
function rejected(value) {
|
|
57915
|
+
try {
|
|
57916
|
+
step(generator.throw(value));
|
|
57917
|
+
} catch (e) {
|
|
57918
|
+
reject(e);
|
|
57919
|
+
}
|
|
57920
|
+
}
|
|
57921
|
+
function step(result) {
|
|
57922
|
+
var value;
|
|
57923
|
+
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
57924
|
+
resolve(value);
|
|
57925
|
+
})).then(fulfilled, rejected);
|
|
57926
|
+
}
|
|
57927
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
57928
|
+
});
|
|
57929
|
+
};
|
|
54693
57930
|
function listTableChangeCellValue(col, row, value, workOnEditableCell, triggerEvent, table) {
|
|
54694
57931
|
if (workOnEditableCell && table.isHasEditorDefine(col, row) || !1 === workOnEditableCell) {
|
|
54695
57932
|
const recordIndex = table.getRecordShowIndexByCell(col, row),
|
|
@@ -54732,92 +57969,100 @@
|
|
|
54732
57969
|
}
|
|
54733
57970
|
function listTableChangeCellValues(startCol, startRow, values, workOnEditableCell, triggerEvent, table) {
|
|
54734
57971
|
var _a, _b;
|
|
54735
|
-
|
|
54736
|
-
|
|
54737
|
-
|
|
54738
|
-
|
|
54739
|
-
|
|
54740
|
-
|
|
54741
|
-
|
|
54742
|
-
|
|
54743
|
-
|
|
54744
|
-
|
|
54745
|
-
|
|
54746
|
-
|
|
54747
|
-
|
|
54748
|
-
|
|
54749
|
-
|
|
54750
|
-
|
|
54751
|
-
|
|
54752
|
-
|
|
54753
|
-
|
|
54754
|
-
|
|
54755
|
-
|
|
54756
|
-
|
|
54757
|
-
|
|
54758
|
-
|
|
54759
|
-
|
|
54760
|
-
|
|
54761
|
-
|
|
54762
|
-
|
|
54763
|
-
|
|
54764
|
-
|
|
54765
|
-
|
|
54766
|
-
|
|
54767
|
-
|
|
54768
|
-
|
|
54769
|
-
|
|
54770
|
-
|
|
54771
|
-
|
|
54772
|
-
|
|
54773
|
-
|
|
54774
|
-
|
|
54775
|
-
|
|
54776
|
-
|
|
54777
|
-
|
|
54778
|
-
|
|
54779
|
-
|
|
54780
|
-
|
|
54781
|
-
|
|
54782
|
-
|
|
54783
|
-
|
|
54784
|
-
|
|
54785
|
-
|
|
54786
|
-
|
|
57972
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57973
|
+
const changedCellResults = [];
|
|
57974
|
+
let pasteColEnd = startCol,
|
|
57975
|
+
pasteRowEnd = startRow;
|
|
57976
|
+
const beforeChangeValues = [],
|
|
57977
|
+
oldValues = [];
|
|
57978
|
+
let cellUpdateType;
|
|
57979
|
+
for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
|
|
57980
|
+
const rowValues = values[i],
|
|
57981
|
+
rawRowValues = [],
|
|
57982
|
+
oldRowValues = [];
|
|
57983
|
+
beforeChangeValues.push(rawRowValues), oldValues.push(oldRowValues);
|
|
57984
|
+
for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
|
|
57985
|
+
cellUpdateType = getCellUpdateType(startCol + j, startRow + i, table, cellUpdateType);
|
|
57986
|
+
const beforeChangeValue = table.getCellRawValue(startCol + j, startRow + i);
|
|
57987
|
+
rawRowValues.push(beforeChangeValue);
|
|
57988
|
+
const oldValue = table.getCellOriginValue(startCol + j, startRow + i);
|
|
57989
|
+
oldRowValues.push(oldValue);
|
|
57990
|
+
}
|
|
57991
|
+
}
|
|
57992
|
+
for (let i = 0; i < values.length && !(startRow + i > table.rowCount - 1); i++) {
|
|
57993
|
+
changedCellResults[i] = [], pasteRowEnd = startRow + i;
|
|
57994
|
+
const rowValues = values[i];
|
|
57995
|
+
let thisRowPasteColEnd = startCol;
|
|
57996
|
+
for (let j = 0; j < rowValues.length && !(startCol + j > table.colCount - 1); j++) {
|
|
57997
|
+
thisRowPasteColEnd = startCol + j;
|
|
57998
|
+
let isCanChange = !1;
|
|
57999
|
+
if (!1 === workOnEditableCell) isCanChange = !0;else if (table.isHasEditorDefine(startCol + j, startRow + i)) {
|
|
58000
|
+
const editor = table.getEditor(startCol + j, startRow + i),
|
|
58001
|
+
oldValue = oldValues[i][j],
|
|
58002
|
+
value = rowValues[j],
|
|
58003
|
+
maybePromiseOrValue = null === (_b = null === (_a = null == editor ? void 0 : editor.validateValue) || void 0 === _a ? void 0 : _a.call(editor, value, oldValue, {
|
|
58004
|
+
col: startCol + j,
|
|
58005
|
+
row: startRow + i
|
|
58006
|
+
}, table)) || void 0 === _b || _b;
|
|
58007
|
+
if (isPromise(maybePromiseOrValue)) {
|
|
58008
|
+
const validateResult = yield maybePromiseOrValue;
|
|
58009
|
+
isCanChange = !0 === validateResult || "validate-exit" === validateResult || "validate-not-exit" === validateResult;
|
|
58010
|
+
} else isCanChange = !0 === maybePromiseOrValue || "validate-exit" === maybePromiseOrValue || "validate-not-exit" === maybePromiseOrValue;
|
|
58011
|
+
}
|
|
58012
|
+
if (isCanChange) {
|
|
58013
|
+
changedCellResults[i][j] = !0;
|
|
58014
|
+
const value = rowValues[j],
|
|
58015
|
+
recordIndex = table.getRecordShowIndexByCell(startCol + j, startRow + i),
|
|
58016
|
+
{
|
|
58017
|
+
field: field
|
|
58018
|
+
} = table.internalProps.layoutMap.getBody(startCol + j, startRow + i),
|
|
58019
|
+
beforeChangeValue = beforeChangeValues[i][j],
|
|
58020
|
+
oldValue = oldValues[i][j];
|
|
58021
|
+
table.isHeader(startCol + j, startRow + i) ? table.internalProps.layoutMap.updateColumnTitle(startCol + j, startRow + i, value) : table.dataSource.changeFieldValue(value, recordIndex, field, startCol + j, startRow + i, table);
|
|
58022
|
+
const changedValue = table.getCellOriginValue(startCol + j, startRow + i);
|
|
58023
|
+
oldValue !== changedValue && triggerEvent && table.fireListeners(TABLE_EVENT_TYPE.CHANGE_CELL_VALUE, {
|
|
58024
|
+
col: startCol + j,
|
|
58025
|
+
row: startRow + i,
|
|
58026
|
+
rawValue: beforeChangeValue,
|
|
58027
|
+
currentValue: oldValue,
|
|
58028
|
+
changedValue: changedValue
|
|
58029
|
+
});
|
|
58030
|
+
} else changedCellResults[i][j] = !1;
|
|
58031
|
+
}
|
|
58032
|
+
pasteColEnd = Math.max(pasteColEnd, thisRowPasteColEnd);
|
|
54787
58033
|
}
|
|
54788
|
-
|
|
54789
|
-
|
|
54790
|
-
|
|
54791
|
-
|
|
54792
|
-
|
|
54793
|
-
|
|
54794
|
-
|
|
54795
|
-
|
|
54796
|
-
|
|
54797
|
-
|
|
54798
|
-
|
|
54799
|
-
for (let sCol = range.start.col; sCol <= range.end.col; sCol++) for (let sRow = range.start.row; sRow <= range.end.row; sRow++) table.scenegraph.updateCellContent(sCol, sRow);
|
|
58034
|
+
const startRange = table.getCellRange(startCol, startRow),
|
|
58035
|
+
range = table.getCellRange(pasteColEnd, pasteRowEnd),
|
|
58036
|
+
aggregators = table.internalProps.layoutMap.getAggregatorsByCellRange(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
|
|
58037
|
+
if (aggregators) {
|
|
58038
|
+
for (let i = 0; i < (null == aggregators ? void 0 : aggregators.length); i++) aggregators[i].recalculate();
|
|
58039
|
+
if ("normal" === cellUpdateType) {
|
|
58040
|
+
const aggregatorCells = table.internalProps.layoutMap.getAggregatorCellAddress(startRange.start.col, startRange.start.row, range.end.col, range.end.row);
|
|
58041
|
+
for (let i = 0; i < aggregatorCells.length; i++) {
|
|
58042
|
+
const range = table.getCellRange(aggregatorCells[i].col, aggregatorCells[i].row);
|
|
58043
|
+
for (let sCol = range.start.col; sCol <= range.end.col; sCol++) for (let sRow = range.start.row; sRow <= range.end.row; sRow++) table.scenegraph.updateCellContent(sCol, sRow);
|
|
58044
|
+
}
|
|
54800
58045
|
}
|
|
54801
58046
|
}
|
|
54802
|
-
|
|
54803
|
-
|
|
54804
|
-
|
|
54805
|
-
|
|
54806
|
-
|
|
54807
|
-
newWidth
|
|
54808
|
-
newWidth !== oldWidth && table.scenegraph.updateColWidth(sCol, newWidth - oldWidth);
|
|
54809
|
-
}
|
|
54810
|
-
if ("adaptive" === table.heightMode || table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight) table.scenegraph.recalculateRowHeights();else if (table.isAutoRowHeight(startRow)) {
|
|
54811
|
-
const rows = [],
|
|
54812
|
-
deltaYs = [];
|
|
54813
|
-
for (let sRow = startRow; sRow <= range.end.row; sRow++) if (table.rowHeightsMap.get(sRow)) {
|
|
54814
|
-
const oldHeight = table.getRowHeight(sRow),
|
|
54815
|
-
newHeight = computeRowHeight(sRow, 0, table.colCount - 1, table);
|
|
54816
|
-
rows.push(sRow), deltaYs.push(newHeight - oldHeight);
|
|
58047
|
+
if ("group" === cellUpdateType && table.dataSource.updateRecordsForGroup([], []), "sort" === cellUpdateType || "group" === cellUpdateType) return table.dataSource.sortedIndexMap.clear(), sortRecords(table), table.refreshRowColCount(), table.internalProps.layoutMap.clearCellRangeMap(), table.scenegraph.clearCells(), table.scenegraph.createSceneGraph(), changedCellResults;
|
|
58048
|
+
for (let sCol = startRange.start.col; sCol <= range.end.col; sCol++) for (let sRow = startRange.start.row; sRow <= range.end.row; sRow++) table.scenegraph.updateCellContent(sCol, sRow);
|
|
58049
|
+
if ("adaptive" === table.widthMode || table.autoFillWidth && table.getAllColsWidth() <= table.tableNoFrameWidth) 0 === table.internalProps._widthResizedColMap.size && table.scenegraph.recalculateColWidths();else for (let sCol = startCol; sCol <= range.end.col; sCol++) if (!table.internalProps._widthResizedColMap.has(sCol)) {
|
|
58050
|
+
const oldWidth = table.getColWidth(sCol),
|
|
58051
|
+
newWidth = computeColWidth(sCol, 0, table.rowCount - 1, table, !1);
|
|
58052
|
+
newWidth !== oldWidth && table.scenegraph.updateColWidth(sCol, newWidth - oldWidth);
|
|
54817
58053
|
}
|
|
54818
|
-
table.scenegraph.
|
|
54819
|
-
|
|
54820
|
-
|
|
58054
|
+
if ("adaptive" === table.heightMode || table.autoFillHeight && table.getAllRowsHeight() <= table.tableNoFrameHeight) table.scenegraph.recalculateRowHeights();else if (table.isAutoRowHeight(startRow)) {
|
|
58055
|
+
const rows = [],
|
|
58056
|
+
deltaYs = [];
|
|
58057
|
+
for (let sRow = startRow; sRow <= range.end.row; sRow++) if (table.rowHeightsMap.get(sRow)) {
|
|
58058
|
+
const oldHeight = table.getRowHeight(sRow),
|
|
58059
|
+
newHeight = computeRowHeight(sRow, 0, table.colCount - 1, table);
|
|
58060
|
+
rows.push(sRow), deltaYs.push(newHeight - oldHeight);
|
|
58061
|
+
}
|
|
58062
|
+
table.scenegraph.updateRowsHeight(rows, deltaYs);
|
|
58063
|
+
}
|
|
58064
|
+
return table.scenegraph.updateNextFrame(), changedCellResults;
|
|
58065
|
+
});
|
|
54821
58066
|
}
|
|
54822
58067
|
function getCellUpdateType(col, row, table, oldCellUpdateType) {
|
|
54823
58068
|
if ("group" === oldCellUpdateType) return oldCellUpdateType;
|
|
@@ -55230,6 +58475,15 @@
|
|
|
55230
58475
|
};
|
|
55231
58476
|
this.internalProps.columns = cloneDeepSpec(columns, ["children"]), generateAggregationForColumn(this), (null == options ? void 0 : options.clearColWidthCache) && this.internalProps._widthResizedColMap.clear(), this.options.columns = columns, this.internalProps.headerHelper.setTableColumnsEditor(), this._hasAutoImageColumn = void 0, this.refreshHeader(), null === (_b = (_a = this.dataSource).updateColumns) || void 0 === _b || _b.call(_a, this.internalProps.columns), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_d = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records) && void 0 !== _d ? _d : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
|
|
55232
58477
|
}
|
|
58478
|
+
_recreateSceneForStateChange() {
|
|
58479
|
+
var _a, _b;
|
|
58480
|
+
this.scenegraph.clearCells();
|
|
58481
|
+
const oldHoverState = {
|
|
58482
|
+
col: this.stateManager.hover.cellPos.col,
|
|
58483
|
+
row: this.stateManager.hover.cellPos.row
|
|
58484
|
+
};
|
|
58485
|
+
this._hasAutoImageColumn = void 0, this.refreshHeader(), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_b = null === (_a = this.dataSource.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
|
|
58486
|
+
}
|
|
55233
58487
|
addColumn(column) {
|
|
55234
58488
|
const columns = this.options.columns;
|
|
55235
58489
|
columns.push(column), this.updateColumns(columns);
|
|
@@ -55835,6 +59089,30 @@
|
|
|
55835
59089
|
release() {
|
|
55836
59090
|
this.editorManager.release(), super.release();
|
|
55837
59091
|
}
|
|
59092
|
+
expandAllTreeNode() {
|
|
59093
|
+
if (!this._hasHierarchyTreeHeader()) return;
|
|
59094
|
+
let stateChanged = !1;
|
|
59095
|
+
this.dataSource && "function" == typeof this.dataSource.expandAllNodes && (this.dataSource.expandAllNodes(), stateChanged = !0), stateChanged && (this._recreateSceneForStateChange(), this.fireListeners(TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
|
|
59096
|
+
col: -1,
|
|
59097
|
+
row: -1,
|
|
59098
|
+
hierarchyState: HierarchyState.expand,
|
|
59099
|
+
originData: {
|
|
59100
|
+
children: this.records
|
|
59101
|
+
}
|
|
59102
|
+
}));
|
|
59103
|
+
}
|
|
59104
|
+
collapseAllTreeNode() {
|
|
59105
|
+
if (!this._hasHierarchyTreeHeader()) return;
|
|
59106
|
+
let stateChanged = !1;
|
|
59107
|
+
this.dataSource && "function" == typeof this.dataSource.collapseAllNodes && (this.dataSource.collapseAllNodes(), stateChanged = !0), stateChanged && (this._recreateSceneForStateChange(), this.fireListeners(TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
|
|
59108
|
+
col: -1,
|
|
59109
|
+
row: -1,
|
|
59110
|
+
hierarchyState: HierarchyState.collapse,
|
|
59111
|
+
originData: {
|
|
59112
|
+
children: this.records
|
|
59113
|
+
}
|
|
59114
|
+
}));
|
|
59115
|
+
}
|
|
55838
59116
|
}
|
|
55839
59117
|
|
|
55840
59118
|
function isXAxis(orient) {
|
|
@@ -58649,6 +61927,9 @@
|
|
|
58649
61927
|
const registerTooltip = () => {
|
|
58650
61928
|
Factory.registerComponent("tooltipHandler", TooltipHandler);
|
|
58651
61929
|
};
|
|
61930
|
+
const registerAnimation = () => {
|
|
61931
|
+
registerCustomAnimate(), registerAnimate();
|
|
61932
|
+
};
|
|
58652
61933
|
|
|
58653
61934
|
class ListTreeStickCellPlugin {
|
|
58654
61935
|
constructor(table) {
|
|
@@ -60536,7 +63817,7 @@
|
|
|
60536
63817
|
Factory.registerFunction("createVideoCellGroup", createVideoCellGroup);
|
|
60537
63818
|
};
|
|
60538
63819
|
|
|
60539
|
-
registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(), registerTooltip(), registerListTreeStickCellPlugin(), registerCustomCellStylePlugin(), registerChartCell(), registerCheckboxCell(), registerImageCell(), registerProgressBarCell(), registerRadioCell(), registerSwitchCell(), registerButtonCell(), registerSparkLineCell(), registerTextCell(), registerVideoCell();
|
|
63820
|
+
registerAxis(), registerEmptyTip(), registerLegend(), registerMenu(), registerTitle(), registerTooltip(), registerListTreeStickCellPlugin(), registerCustomCellStylePlugin(), registerAnimation(), registerChartCell(), registerCheckboxCell(), registerImageCell(), registerProgressBarCell(), registerRadioCell(), registerSwitchCell(), registerButtonCell(), registerSparkLineCell(), registerTextCell(), registerVideoCell();
|
|
60540
63821
|
class ListTableAll extends ListTable {}
|
|
60541
63822
|
|
|
60542
63823
|
registerForVrender();
|