@visactor/vrender-components 1.1.0-alpha.8 → 1.1.0
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/README.md +9 -1
- package/cjs/animation/axis-animate.d.ts +2 -1
- package/cjs/animation/axis-animate.js +11 -8
- package/cjs/animation/axis-animate.js.map +1 -1
- package/cjs/animation/exit-release.d.ts +13 -0
- package/cjs/animation/exit-release.js +39 -0
- package/cjs/animation/exit-release.js.map +1 -0
- package/cjs/animation/label-animate.d.ts +1 -1
- package/cjs/animation/label-animate.js +10 -20
- package/cjs/animation/label-animate.js.map +1 -1
- package/cjs/animation/static-truth.js +1 -5
- package/cjs/animation/static-truth.js.map +1 -1
- package/cjs/axis/animate/group-transition.d.ts +3 -2
- package/cjs/axis/animate/group-transition.js +3 -3
- package/cjs/axis/animate/group-transition.js.map +1 -1
- package/cjs/axis/base.d.ts +6 -2
- package/cjs/axis/base.js +61 -7
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/constant.js +1 -2
- package/cjs/axis/index.js +2 -1
- package/cjs/axis/line.d.ts +1 -1
- package/cjs/axis/line.js +2 -2
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-hide.d.ts +1 -1
- package/cjs/axis/overlap/auto-hide.js.map +1 -1
- package/cjs/axis/register.js +8 -7
- package/cjs/axis/register.js.map +1 -1
- package/cjs/brush/brush.d.ts +4 -0
- package/cjs/brush/brush.js +30 -13
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/brush/register.js +2 -2
- package/cjs/brush/register.js.map +1 -1
- package/cjs/checkbox/register.js +3 -3
- package/cjs/checkbox/register.js.map +1 -1
- package/cjs/core/base.d.ts +2 -2
- package/cjs/core/base.js +3 -3
- package/cjs/core/base.js.map +1 -1
- package/cjs/core/type.d.ts +7 -0
- package/cjs/core/type.js.map +1 -1
- package/cjs/crosshair/polygon-sector.js +1 -2
- package/cjs/crosshair/polygon.js +2 -1
- package/cjs/crosshair/register.js +7 -7
- package/cjs/crosshair/register.js.map +1 -1
- package/cjs/data-zoom/index.js +2 -1
- package/cjs/data-zoom/register.js +3 -3
- package/cjs/data-zoom/register.js.map +1 -1
- package/cjs/empty-tip/register.js +4 -4
- package/cjs/empty-tip/register.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/register.js +3 -2
- package/cjs/indicator/register.js.map +1 -1
- package/cjs/jsx/component-type.d.ts +2 -3
- package/cjs/jsx/component-type.js.map +1 -1
- package/cjs/jsx/index.js +1 -1
- package/cjs/label/arc.js +13 -8
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +12 -2
- package/cjs/label/base.js +113 -40
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.d.ts +5 -1
- package/cjs/label/dataLabel.js +46 -1
- package/cjs/label/dataLabel.js.map +1 -1
- package/cjs/label/register.js +4 -3
- package/cjs/label/register.js.map +1 -1
- package/cjs/label-item/register.js +3 -3
- package/cjs/label-item/register.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +4 -2
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/register.js +3 -3
- package/cjs/legend/register.js.map +1 -1
- package/cjs/link-path/register.js +2 -2
- package/cjs/link-path/register.js.map +1 -1
- package/cjs/marker/animate/animate.d.ts +1 -1
- package/cjs/marker/animate/animate.js.map +1 -1
- package/cjs/marker/animate/call-in.d.ts +2 -2
- package/cjs/marker/animate/call-in.js +5 -4
- package/cjs/marker/animate/call-in.js.map +1 -1
- package/cjs/marker/animate/clip-in.js +5 -4
- package/cjs/marker/animate/clip-in.js.map +1 -1
- package/cjs/marker/animate/common.d.ts +1 -0
- package/cjs/marker/animate/common.js +13 -8
- package/cjs/marker/animate/common.js.map +1 -1
- package/cjs/marker/animate/fade-in.d.ts +1 -1
- package/cjs/marker/animate/fade-in.js.map +1 -1
- package/cjs/marker/animate/fade-out.d.ts +1 -1
- package/cjs/marker/animate/fade-out.js.map +1 -1
- package/cjs/marker/arc-area.d.ts +1 -1
- package/cjs/marker/area.d.ts +1 -1
- package/cjs/marker/base.d.ts +6 -2
- package/cjs/marker/base.js +51 -9
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/common-line.d.ts +1 -1
- package/cjs/marker/point.d.ts +1 -1
- package/cjs/marker/register.js +8 -8
- package/cjs/marker/register.js.map +1 -1
- package/cjs/marker/type.d.ts +8 -5
- package/cjs/marker/type.js.map +1 -1
- package/cjs/pager/register.js +3 -2
- package/cjs/pager/register.js.map +1 -1
- package/cjs/player/register.js +3 -3
- package/cjs/player/register.js.map +1 -1
- package/cjs/poptip/module.js +3 -1
- package/cjs/poptip/module.js.map +1 -1
- package/cjs/poptip/register.js +3 -3
- package/cjs/poptip/register.js.map +1 -1
- package/cjs/radio/register.js +3 -3
- package/cjs/radio/register.js.map +1 -1
- package/cjs/scrollbar/register.js +2 -2
- package/cjs/scrollbar/register.js.map +1 -1
- package/cjs/segment/register.js +5 -5
- package/cjs/segment/register.js.map +1 -1
- package/cjs/slider/register.js +3 -3
- package/cjs/slider/register.js.map +1 -1
- package/cjs/switch/register.js +3 -3
- package/cjs/switch/register.js.map +1 -1
- package/cjs/table-series-number/register.js +3 -2
- package/cjs/table-series-number/register.js.map +1 -1
- package/cjs/tag/register.js +4 -3
- package/cjs/tag/register.js.map +1 -1
- package/cjs/timeline/register.js +3 -3
- package/cjs/timeline/register.js.map +1 -1
- package/cjs/title/register.js +3 -2
- package/cjs/title/register.js.map +1 -1
- package/cjs/title/title.js +5 -2
- package/cjs/title/title.js.map +1 -1
- package/cjs/tooltip/register.js +3 -3
- package/cjs/tooltip/register.js.map +1 -1
- package/cjs/tooltip/tooltip.js +8 -8
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/util/event.js +2 -2
- package/cjs/util/event.js.map +1 -1
- package/cjs/util/graphic-creator.js +1 -1
- package/cjs/util/graphic-creator.js.map +1 -1
- package/cjs/util/text.js +3 -3
- package/cjs/util/text.js.map +1 -1
- package/cjs/weather/register.js +2 -2
- package/cjs/weather/register.js.map +1 -1
- package/cjs/weather/weather-box.js +5 -5
- package/cjs/weather/weather-box.js.map +1 -1
- package/dist/index.es.js +6758 -6002
- package/es/animation/axis-animate.d.ts +2 -1
- package/es/animation/axis-animate.js +9 -2
- package/es/animation/axis-animate.js.map +1 -1
- package/es/animation/exit-release.d.ts +13 -0
- package/es/animation/exit-release.js +31 -0
- package/es/animation/exit-release.js.map +1 -0
- package/es/animation/label-animate.d.ts +1 -1
- package/es/animation/label-animate.js +8 -12
- package/es/animation/label-animate.js.map +1 -1
- package/es/animation/static-truth.js +1 -5
- package/es/animation/static-truth.js.map +1 -1
- package/es/axis/animate/group-transition.d.ts +3 -2
- package/es/axis/animate/group-transition.js +2 -2
- package/es/axis/animate/group-transition.js.map +1 -1
- package/es/axis/base.d.ts +6 -2
- package/es/axis/base.js +60 -5
- package/es/axis/base.js.map +1 -1
- package/es/axis/constant.js +1 -2
- package/es/axis/index.js +2 -1
- package/es/axis/line.d.ts +1 -1
- package/es/axis/line.js +2 -2
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-hide.d.ts +1 -1
- package/es/axis/overlap/auto-hide.js.map +1 -1
- package/es/axis/register.js +13 -1
- package/es/axis/register.js.map +1 -1
- package/es/brush/brush.d.ts +4 -0
- package/es/brush/brush.js +30 -14
- package/es/brush/brush.js.map +1 -1
- package/es/brush/register.js +3 -1
- package/es/brush/register.js.map +1 -1
- package/es/checkbox/register.js +7 -1
- package/es/checkbox/register.js.map +1 -1
- package/es/core/base.d.ts +2 -2
- package/es/core/base.js +3 -1
- package/es/core/base.js.map +1 -1
- package/es/core/type.d.ts +7 -0
- package/es/core/type.js.map +1 -1
- package/es/crosshair/polygon-sector.js +1 -2
- package/es/crosshair/polygon.js +2 -1
- package/es/crosshair/register.js +9 -1
- package/es/crosshair/register.js.map +1 -1
- package/es/data-zoom/index.js +2 -1
- package/es/data-zoom/register.js +7 -1
- package/es/data-zoom/register.js.map +1 -1
- package/es/empty-tip/register.js +6 -3
- package/es/empty-tip/register.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/register.js +5 -1
- package/es/indicator/register.js.map +1 -1
- package/es/jsx/component-type.d.ts +2 -3
- package/es/jsx/component-type.js.map +1 -1
- package/es/jsx/index.js +1 -1
- package/es/label/arc.js +13 -8
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +12 -2
- package/es/label/base.js +106 -30
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.d.ts +5 -1
- package/es/label/dataLabel.js +46 -0
- package/es/label/dataLabel.js.map +1 -1
- package/es/label/register.js +7 -1
- package/es/label/register.js.map +1 -1
- package/es/label-item/register.js +7 -1
- package/es/label-item/register.js.map +1 -1
- package/es/legend/discrete/discrete.js +4 -2
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/register.js +3 -1
- package/es/legend/register.js.map +1 -1
- package/es/link-path/register.js +3 -1
- package/es/link-path/register.js.map +1 -1
- package/es/marker/animate/animate.d.ts +1 -1
- package/es/marker/animate/animate.js.map +1 -1
- package/es/marker/animate/call-in.d.ts +2 -2
- package/es/marker/animate/call-in.js +6 -4
- package/es/marker/animate/call-in.js.map +1 -1
- package/es/marker/animate/clip-in.js +6 -4
- package/es/marker/animate/clip-in.js.map +1 -1
- package/es/marker/animate/common.d.ts +1 -0
- package/es/marker/animate/common.js +9 -4
- package/es/marker/animate/common.js.map +1 -1
- package/es/marker/animate/fade-in.d.ts +1 -1
- package/es/marker/animate/fade-in.js.map +1 -1
- package/es/marker/animate/fade-out.d.ts +1 -1
- package/es/marker/animate/fade-out.js.map +1 -1
- package/es/marker/arc-area.d.ts +1 -1
- package/es/marker/area.d.ts +1 -1
- package/es/marker/base.d.ts +6 -2
- package/es/marker/base.js +51 -8
- package/es/marker/base.js.map +1 -1
- package/es/marker/common-line.d.ts +1 -1
- package/es/marker/point.d.ts +1 -1
- package/es/marker/register.js +12 -2
- package/es/marker/register.js.map +1 -1
- package/es/marker/type.d.ts +8 -5
- package/es/marker/type.js.map +1 -1
- package/es/pager/register.js +5 -1
- package/es/pager/register.js.map +1 -1
- package/es/player/register.js +3 -1
- package/es/player/register.js.map +1 -1
- package/es/poptip/module.js +3 -1
- package/es/poptip/module.js.map +1 -1
- package/es/poptip/register.js +7 -1
- package/es/poptip/register.js.map +1 -1
- package/es/radio/register.js +7 -1
- package/es/radio/register.js.map +1 -1
- package/es/scrollbar/register.js +3 -1
- package/es/scrollbar/register.js.map +1 -1
- package/es/segment/register.js +9 -1
- package/es/segment/register.js.map +1 -1
- package/es/slider/register.js +7 -1
- package/es/slider/register.js.map +1 -1
- package/es/switch/register.js +7 -1
- package/es/switch/register.js.map +1 -1
- package/es/table-series-number/register.js +5 -1
- package/es/table-series-number/register.js.map +1 -1
- package/es/tag/register.js +9 -1
- package/es/tag/register.js.map +1 -1
- package/es/timeline/register.js +7 -1
- package/es/timeline/register.js.map +1 -1
- package/es/title/register.js +5 -1
- package/es/title/register.js.map +1 -1
- package/es/title/title.js +5 -2
- package/es/title/title.js.map +1 -1
- package/es/tooltip/register.js +9 -1
- package/es/tooltip/register.js.map +1 -1
- package/es/tooltip/tooltip.js +3 -1
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/util/event.js +1 -1
- package/es/util/event.js.map +1 -1
- package/es/util/graphic-creator.js +1 -1
- package/es/util/graphic-creator.js.map +1 -1
- package/es/util/text.js +1 -1
- package/es/util/text.js.map +1 -1
- package/es/weather/register.js +3 -1
- package/es/weather/register.js.map +1 -1
- package/es/weather/weather-box.js +3 -1
- package/es/weather/weather-box.js.map +1 -1
- package/package.json +486 -6
package/README.md
CHANGED
|
@@ -5,7 +5,15 @@
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
|
-
import {
|
|
8
|
+
import { Tooltip } from '@visactor/vrender-components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For bundle-size-sensitive profiles, prefer public component subpaths instead of the package root:
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { DataZoom } from '@visactor/vrender-components/data-zoom';
|
|
15
|
+
import { MarkLine } from '@visactor/vrender-components/marker/line';
|
|
16
|
+
import { ScrollBar } from '@visactor/vrender-components/scrollbar';
|
|
9
17
|
```
|
|
10
18
|
|
|
11
19
|
## Develop
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AComponentAnimate } from '@visactor/vrender-animate';
|
|
1
|
+
import { AComponentAnimate } from '@visactor/vrender-animate/custom/custom-animate';
|
|
2
2
|
export declare class AxisEnter extends AComponentAnimate<any> {
|
|
3
3
|
onBind(): void;
|
|
4
4
|
}
|
|
5
5
|
export declare class AxisUpdate extends AComponentAnimate<any> {
|
|
6
6
|
onBind(): void;
|
|
7
7
|
deleteSelfAttr(key: string): void;
|
|
8
|
+
deleteSelfAttrs(keys: string[]): void;
|
|
8
9
|
protected tryPreventConflict(): void;
|
|
9
10
|
}
|
|
10
11
|
export declare function registerAxisAnimate(): void;
|
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.registerAxisAnimate = exports.AxisUpdate = exports.AxisEnter = void 0;
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const component_1 = require("@visactor/vrender-animate/component"), custom_animate_1 = require("@visactor/vrender-animate/custom/custom-animate"), animate_executor_1 = require("@visactor/vrender-animate/executor/animate-executor"), static_truth_1 = require("./static-truth");
|
|
8
8
|
|
|
9
|
-
class AxisEnter extends
|
|
9
|
+
class AxisEnter extends custom_animate_1.AComponentAnimate {
|
|
10
10
|
onBind() {
|
|
11
11
|
var _a;
|
|
12
|
-
const animator = (0,
|
|
12
|
+
const animator = (0, component_1.createComponentAnimator)(this.target);
|
|
13
13
|
this._animator = animator;
|
|
14
14
|
const duration = this.duration, easing = this.easing, {config: config, lastScale: lastScale, getTickCoord: getTickCoord} = this.params;
|
|
15
15
|
let ratio = 1;
|
|
@@ -44,9 +44,9 @@ class AxisEnter extends vrender_animate_1.AComponentAnimate {
|
|
|
44
44
|
|
|
45
45
|
exports.AxisEnter = AxisEnter;
|
|
46
46
|
|
|
47
|
-
class AxisUpdate extends
|
|
47
|
+
class AxisUpdate extends custom_animate_1.AComponentAnimate {
|
|
48
48
|
onBind() {
|
|
49
|
-
const animator = (0,
|
|
49
|
+
const animator = (0, component_1.createComponentAnimator)(this.target);
|
|
50
50
|
this._animator = animator;
|
|
51
51
|
const duration = this.duration, easing = this.easing, {diffAttrs: diffAttrs} = this.params;
|
|
52
52
|
(0, static_truth_1.commitUpdateAnimationTarget)(this.target, Object.assign({}, diffAttrs)),
|
|
@@ -61,14 +61,17 @@ class AxisUpdate extends vrender_animate_1.AComponentAnimate {
|
|
|
61
61
|
}), this.completeBind(animator);
|
|
62
62
|
}
|
|
63
63
|
deleteSelfAttr(key) {
|
|
64
|
-
|
|
64
|
+
this.deleteSelfAttrs([ key ]);
|
|
65
|
+
}
|
|
66
|
+
deleteSelfAttrs(keys) {
|
|
67
|
+
super.deleteSelfAttrs(keys), this._animator.deleteSelfAttrs(keys);
|
|
65
68
|
}
|
|
66
69
|
tryPreventConflict() {}
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
function registerAxisAnimate() {
|
|
70
|
-
|
|
71
|
-
|
|
73
|
+
animate_executor_1.AnimateExecutor.registerBuiltInAnimate("axisEnter", AxisEnter),
|
|
74
|
+
animate_executor_1.AnimateExecutor.registerBuiltInAnimate("axisUpdate", AxisUpdate);
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
exports.AxisUpdate = AxisUpdate, exports.registerAxisAnimate = registerAxisAnimate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/animation/axis-animate.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"sources":["../src/anim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AC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAGS,kBAAkB;QAC1B,OAAO;IACT,CAAC;CACF;AApDD,gCAoDC;AAED,SAAgB,mBAAmB;IAEjC,kCAAe,CAAC,sBAAsB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/D,kCAAe,CAAC,sBAAsB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACnE,CAAC;AAJD,kDAIC","file":"axis-animate.js","sourcesContent":["import { createComponentAnimator } from '@visactor/vrender-animate/component';\nimport { AComponentAnimate } from '@visactor/vrender-animate/custom/custom-animate';\nimport { AnimateExecutor } from '@visactor/vrender-animate/executor/animate-executor';\nimport { commitUpdateAnimationTarget } from './static-truth';\n\n/**\n * AxisEnter class handles the enter animation for Axis components\n */\nexport class AxisEnter extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n const { config, lastScale, getTickCoord } = this.params;\n\n let ratio = 1;\n const currData = this.target.data;\n if (lastScale && getTickCoord && currData) {\n ratio = 0.7;\n\n const oldValue = lastScale.scale(currData.rawValue);\n const point = getTickCoord(oldValue);\n const newX = this.target.attribute.x;\n const newY = this.target.attribute.y;\n\n commitUpdateAnimationTarget(this.target, { x: newX, y: newY }, { x: point.x, y: point.y });\n animator.animate(this.target, {\n type: 'to',\n to: { x: newX, y: newY },\n duration,\n easing\n });\n }\n\n // if (updateEls && updateEls.length > 1) {\n // ratio = 0.5;\n // const oldData1 = updateEls[0].oldEl.data;\n // const { rawValue: oldRawValue1, value: oldValue1 } = oldData1;\n // const oldData2 = updateEls[1].oldEl.data;\n // const { rawValue: oldRawValue2, value: oldValue2 } = oldData2;\n // const data = this.target.data;\n // const { rawValue: newRawValue } = data;\n // // rawValue 是原始值,value是映射出来的值,假设是线性映射,计算一下newRawValue在old阶段的value是什么值\n // const oldValue =\n // oldValue1 + ((oldValue2 - oldValue1) * (newRawValue - oldRawValue1)) / (oldRawValue2 - oldRawValue1);\n // // 将 x 和 y 做映射\n // const oldX1 = updateEls[0].oldEl.attribute.x;\n // const oldY1 = updateEls[0].oldEl.attribute.y;\n // const oldX2 = updateEls[1].oldEl.attribute.x;\n // const oldY2 = updateEls[1].oldEl.attribute.y;\n // const oldX = oldX1 + ((oldX2 - oldX1) * (oldValue - oldValue1)) / (oldValue2 - oldValue1);\n // const oldY = oldY1 + ((oldY2 - oldY1) * (oldValue - oldValue1)) / (oldValue2 - oldValue1);\n // const newX = this.target.attribute.x;\n // const newY = this.target.attribute.y;\n\n // this.target.setAttributes({ x: oldX, y: oldY });\n // animator.animate(this.target, {\n // type: 'to',\n // to: { x: newX, y: newY },\n // duration,\n // easing\n // });\n // }\n\n animator.animate(this.target, {\n type: config.type ?? 'fadeIn',\n to: config.to,\n duration: duration * ratio,\n easing\n });\n this.completeBind(animator);\n }\n}\n\n/**\n * AxisUpdate class handles the update animation for Axis components\n */\nexport class AxisUpdate extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n const { diffAttrs } = this.params;\n // this.target.applyAnimationState(\n // ['update'],\n // [\n // {\n // name: 'update',\n // animation: {\n // type: 'to',\n // to: { ...this.props },\n // duration,\n // easing,\n // customParameters: {\n // diffAttrs: { ...this.props }\n // }\n // }\n // }\n // ]\n // );\n // console.log('this.props', this.props, { ...this.target.attribute });\n commitUpdateAnimationTarget(this.target, { ...diffAttrs });\n animator.animate(this.target, {\n type: 'to',\n to: { ...diffAttrs },\n duration,\n easing,\n customParameters: {\n diffAttrs: { ...diffAttrs }\n }\n });\n this.completeBind(animator);\n }\n\n // 轴动画本身没有逻辑,具体通过animator中执行,所以当需要屏蔽自身属性时,需要通过animator中执行\n deleteSelfAttr(key: string): void {\n this.deleteSelfAttrs([key]);\n }\n\n deleteSelfAttrs(keys: string[]): void {\n super.deleteSelfAttrs(keys);\n this._animator.deleteSelfAttrs(keys);\n }\n\n // 轴动画本身没有逻辑,具体通过animator中执行,所以本身不需要屏蔽冲突\n protected tryPreventConflict(): void {\n return;\n }\n}\n\nexport function registerAxisAnimate() {\n // Label update animation\n AnimateExecutor.registerBuiltInAnimate('axisEnter', AxisEnter);\n AnimateExecutor.registerBuiltInAnimate('axisUpdate', AxisUpdate);\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IAnimate, IGraphic } from '@visactor/vrender-core';
|
|
2
|
+
export type ExitReleaseCallbackState = {
|
|
3
|
+
finalized: boolean;
|
|
4
|
+
removeFromParent: boolean;
|
|
5
|
+
onComplete: (() => void)[];
|
|
6
|
+
};
|
|
7
|
+
export type AnimateExitReleaseState = ExitReleaseCallbackState & {
|
|
8
|
+
pendingAnimates: Set<IAnimate>;
|
|
9
|
+
};
|
|
10
|
+
export declare function collectTrackedAnimates(graphic: IGraphic, animates?: IAnimate[], visited?: Set<IAnimate>): IAnimate[];
|
|
11
|
+
export declare function appendExitReleaseCallback(state: ExitReleaseCallbackState | undefined, callback?: () => void): void;
|
|
12
|
+
export declare function runExitReleaseCallbacks(callbacks: (() => void)[]): void;
|
|
13
|
+
export declare function bindExitReleaseAnimates<T extends AnimateExitReleaseState>(exitAnimates: IAnimate[], getState: () => T | undefined, finalize: () => void): void;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function collectTrackedAnimates(graphic, animates = [], visited = new Set) {
|
|
4
|
+
var _a, _b, _c, _d, _e;
|
|
5
|
+
const trackedAnimates = null !== (_c = null === (_b = (_a = graphic).getTrackedAnimates) || void 0 === _b ? void 0 : _b.call(_a)) && void 0 !== _c ? _c : graphic.animates;
|
|
6
|
+
return null == trackedAnimates || trackedAnimates.forEach((animate => {
|
|
7
|
+
animate && !visited.has(animate) && (visited.add(animate), animates.push(animate));
|
|
8
|
+
})), null === (_e = (_d = graphic).forEachChildren) || void 0 === _e || _e.call(_d, (child => {
|
|
9
|
+
collectTrackedAnimates(child, animates, visited);
|
|
10
|
+
})), animates;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function appendExitReleaseCallback(state, callback) {
|
|
14
|
+
callback && (null == state || state.onComplete.push(callback));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function runExitReleaseCallbacks(callbacks) {
|
|
18
|
+
callbacks.forEach((callback => {
|
|
19
|
+
callback();
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function bindExitReleaseAnimates(exitAnimates, getState, finalize) {
|
|
24
|
+
const finish = animate => {
|
|
25
|
+
const state = getState();
|
|
26
|
+
state && !state.finalized && state.pendingAnimates.has(animate) && (state.pendingAnimates.delete(animate),
|
|
27
|
+
state.pendingAnimates.size || finalize());
|
|
28
|
+
};
|
|
29
|
+
exitAnimates.forEach((animate => {
|
|
30
|
+
animate.onEnd((() => finish(animate))), animate.onRemove((() => finish(animate)));
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: !0
|
|
36
|
+
}), exports.bindExitReleaseAnimates = exports.runExitReleaseCallbacks = exports.appendExitReleaseCallback = exports.collectTrackedAnimates = void 0,
|
|
37
|
+
exports.collectTrackedAnimates = collectTrackedAnimates, exports.appendExitReleaseCallback = appendExitReleaseCallback,
|
|
38
|
+
exports.runExitReleaseCallbacks = runExitReleaseCallbacks, exports.bindExitReleaseAnimates = bindExitReleaseAnimates;
|
|
39
|
+
//# sourceMappingURL=exit-release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animation/exit-release.ts"],"names":[],"mappings":";;;AAYA,SAAgB,sBAAsB,CACpC,OAAiB,EACjB,WAAuB,EAAE,EACzB,UAAyB,IAAI,GAAG,EAAE;;IAElC,MAAM,eAAe,GAAG,MAAA,MAAA,MAAC,OAAe,EAAC,kBAAkB,kDAAI,mCAAK,O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CAAC,eAAe,CAAC,IAAI,EAAE;YAC/B,QAAQ,EAAE,CAAC;SACZ;IACH,CAAC,CAAC;IAEF,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC;AArBD,0DAqBC","file":"exit-release.js","sourcesContent":["import type { IAnimate, IGraphic, IGroup } from '@visactor/vrender-core';\n\nexport type ExitReleaseCallbackState = {\n finalized: boolean;\n removeFromParent: boolean;\n onComplete: (() => void)[];\n};\n\nexport type AnimateExitReleaseState = ExitReleaseCallbackState & {\n pendingAnimates: Set<IAnimate>;\n};\n\nexport function collectTrackedAnimates(\n graphic: IGraphic,\n animates: IAnimate[] = [],\n visited: Set<IAnimate> = new Set()\n): IAnimate[] {\n const trackedAnimates = (graphic as any).getTrackedAnimates?.() ?? (graphic as any).animates;\n\n trackedAnimates?.forEach((animate: IAnimate) => {\n if (animate && !visited.has(animate)) {\n visited.add(animate);\n animates.push(animate);\n }\n });\n\n (graphic as IGroup).forEachChildren?.((child: IGraphic) => {\n collectTrackedAnimates(child, animates, visited);\n });\n\n return animates;\n}\n\nexport function appendExitReleaseCallback(state: ExitReleaseCallbackState | undefined, callback?: () => void) {\n if (callback) {\n state?.onComplete.push(callback);\n }\n}\n\nexport function runExitReleaseCallbacks(callbacks: (() => void)[]) {\n callbacks.forEach(callback => {\n callback();\n });\n}\n\nexport function bindExitReleaseAnimates<T extends AnimateExitReleaseState>(\n exitAnimates: IAnimate[],\n getState: () => T | undefined,\n finalize: () => void\n) {\n const finish = (animate: IAnimate) => {\n const state = getState();\n if (!state || state.finalized || !state.pendingAnimates.has(animate)) {\n return;\n }\n\n state.pendingAnimates.delete(animate);\n if (!state.pendingAnimates.size) {\n finalize();\n }\n };\n\n exitAnimates.forEach(animate => {\n animate.onEnd(() => finish(animate));\n animate.onRemove(() => finish(animate));\n });\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AComponentAnimate } from '@visactor/vrender-animate';
|
|
1
|
+
import { AComponentAnimate } from '@visactor/vrender-animate/custom/custom-animate';
|
|
2
2
|
export declare class LabelUpdate extends AComponentAnimate<any> {
|
|
3
3
|
onBind(): void;
|
|
4
4
|
protected tryPreventConflict(): void;
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var __rest = this && this.__rest || function(s, e) {
|
|
4
|
-
var t = {};
|
|
5
|
-
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
6
|
-
if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
|
|
7
|
-
var i = 0;
|
|
8
|
-
for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
3
|
Object.defineProperty(exports, "__esModule", {
|
|
14
4
|
value: !0
|
|
15
5
|
}), exports.registerLabelAnimate = exports.LabelEnter = exports.LabelUpdate = void 0;
|
|
16
6
|
|
|
17
|
-
const
|
|
7
|
+
const component_1 = require("@visactor/vrender-animate/component"), custom_animate_1 = require("@visactor/vrender-animate/custom/custom-animate"), number_1 = require("@visactor/vrender-animate/custom/number"), animate_executor_1 = require("@visactor/vrender-animate/executor/animate-executor");
|
|
18
8
|
|
|
19
|
-
class LabelUpdate extends
|
|
9
|
+
class LabelUpdate extends custom_animate_1.AComponentAnimate {
|
|
20
10
|
onBind() {
|
|
21
|
-
const animator = (0,
|
|
11
|
+
const animator = (0, component_1.createComponentAnimator)(this.target);
|
|
22
12
|
this._animator = animator;
|
|
23
13
|
const duration = this.duration, easing = this.easing, {prevText: prevText, curText: curText, prevLabelLine: prevLabelLine, curLabelLine: curLabelLine, increaseEffect: increaseEffect = !0} = this.params, diff = {};
|
|
24
14
|
for (const key in curText.attribute) prevText.attribute[key] !== curText.attribute[key] && (diff[key] = curText.attribute[key]);
|
|
25
|
-
const
|
|
26
|
-
animator.animate(prevText, {
|
|
15
|
+
const rest = Object.assign({}, diff);
|
|
16
|
+
delete rest.text, animator.animate(prevText, {
|
|
27
17
|
type: "to",
|
|
28
18
|
to: rest,
|
|
29
19
|
duration: duration,
|
|
@@ -47,9 +37,9 @@ class LabelUpdate extends vrender_animate_1.AComponentAnimate {
|
|
|
47
37
|
|
|
48
38
|
exports.LabelUpdate = LabelUpdate;
|
|
49
39
|
|
|
50
|
-
class LabelEnter extends
|
|
40
|
+
class LabelEnter extends custom_animate_1.AComponentAnimate {
|
|
51
41
|
onBind() {
|
|
52
|
-
const animator = (0,
|
|
42
|
+
const animator = (0, component_1.createComponentAnimator)(this.target);
|
|
53
43
|
this._animator = animator;
|
|
54
44
|
const duration = this.duration, easing = this.easing, {relatedGraphic: relatedGraphic, relatedGraphics: relatedGraphics, config: config} = this.params, {mode: mode, type: type = "fadeIn"} = config, target = this.target;
|
|
55
45
|
let startTime = 0;
|
|
@@ -72,9 +62,9 @@ class LabelEnter extends vrender_animate_1.AComponentAnimate {
|
|
|
72
62
|
}
|
|
73
63
|
|
|
74
64
|
function registerLabelAnimate() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
65
|
+
animate_executor_1.AnimateExecutor.registerBuiltInAnimate("increaseCount", number_1.IncreaseCount),
|
|
66
|
+
animate_executor_1.AnimateExecutor.registerBuiltInAnimate("labelUpdate", LabelUpdate),
|
|
67
|
+
animate_executor_1.AnimateExecutor.registerBuiltInAnimate("labelEnter", LabelEnter);
|
|
78
68
|
}
|
|
79
69
|
|
|
80
70
|
exports.LabelEnter = LabelEnter, exports.registerLabelAnimate = registerLabelAnimate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/animation/label-animate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/animation/label-animate.ts"],"names":[],"mappings":";;;AAAA,mEAA8E;AAC9E,oFAAoF;AACpF,oEAAwE;AACxE,0FAAsF;AAKtF,MAAa,WAAY,SAAQ,kCAAsB;IACrD,MAAM;QACJ,MAAM,QAAQ,GAAG,IAAA,mCAAuB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAE3B,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAC9F,MAAM,IAAI,GAAwB,EAAE,CAAC;QAErC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,SAAS,EAAE;YACnC,IAAI,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;gBACtD,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;aACpC;SACF;QAED,MAAM,IAAI,qBAAQ,IAAI,CAAE,CAAC;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC;QAEjB,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE;YACzB,IAAI,EAAE,IAAI;YACV,EAAE,EAAE,IAAI;YACR,QAAQ;YACR,MAAM;SACP,CAAC,CAAC;QAEH,IAAI,cAAc,KAAK,KAAK,EAAE;YAC5B,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACzB,IAAI,EAAE,eAAe;gBACrB,EAAE,EAAE;oBACF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C/B,eAAe;gBACb,eAAe,CAAC,OAAO,CAAC,CAAC,OAAY,EAAE,EAAE;oBACvC,OAAO,CAAC,QAAQ;wBACd,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAY,EAAE,EAAE;4BACxC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;wBACvF,CAAC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;SACN;aAAM;YAEL,cAAc,CAAC,QAAQ;gBACrB,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAY,EAAE,EAAE;oBAC/C,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;gBAC1D,CAAC,CAAC,CAAC;SACN;QAED,QAAQ,CAAC,OAAO,CAAC,MAAM,kCAClB,MAAM,KACT,QAAQ;YACR,MAAM;YACN,SAAS;YACT,IAAI,IACJ,CAAC;QAEH,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAGS,kBAAkB;QAC1B,OAAO;IACT,CAAC;CACF;AAlDD,gCAkDC;AAED,SAAgB,oBAAoB;IAClC,kCAAe,CAAC,sBAAsB,CAAC,eAAe,EAAE,sBAAa,CAAC,CAAC;IAEvE,kCAAe,CAAC,sBAAsB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IACnE,kCAAe,CAAC,sBAAsB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACnE,CAAC;AALD,oDAKC","file":"label-animate.js","sourcesContent":["import { createComponentAnimator } from '@visactor/vrender-animate/component';\nimport { AComponentAnimate } from '@visactor/vrender-animate/custom/custom-animate';\nimport { IncreaseCount } from '@visactor/vrender-animate/custom/number';\nimport { AnimateExecutor } from '@visactor/vrender-animate/executor/animate-executor';\n\n/**\n * LabelUpdate class handles the update animation for Label components\n */\nexport class LabelUpdate extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n\n const { prevText, curText, prevLabelLine, curLabelLine, increaseEffect = true } = this.params;\n const diff: Record<string, any> = {};\n\n for (const key in curText.attribute) {\n if (prevText.attribute[key] !== curText.attribute[key]) {\n diff[key] = curText.attribute[key];\n }\n }\n\n const rest = { ...diff };\n delete rest.text;\n\n animator.animate(prevText, {\n type: 'to',\n to: rest,\n duration,\n easing\n });\n\n if (increaseEffect !== false) {\n animator.animate(prevText, {\n type: 'increaseCount',\n to: {\n text: curText.attribute.text\n },\n duration,\n easing\n });\n }\n\n if (prevLabelLine) {\n animator.animate(prevLabelLine, {\n type: 'to',\n to: curLabelLine.attribute,\n duration,\n easing\n });\n }\n\n this.completeBind(animator);\n }\n\n // 标签动画本身没有逻辑,具体通过animator中执行,所以本身不需要屏蔽冲突\n protected tryPreventConflict(): void {\n return;\n }\n}\n\nexport class LabelEnter extends AComponentAnimate<any> {\n onBind(): void {\n const animator = createComponentAnimator(this.target);\n this._animator = animator;\n const duration = this.duration;\n const easing = this.easing;\n\n const { relatedGraphic, relatedGraphics, config } = this.params;\n const { mode, type = 'fadeIn' } = config;\n\n const target = this.target;\n\n let startTime = 0;\n\n if (mode === 'after') {\n relatedGraphic.animates &&\n relatedGraphic.animates.forEach((animate: any) => {\n startTime = Math.max(startTime, animate.getStartTime() + animate.getTotalDuration());\n });\n } else if (mode === 'after-all') {\n relatedGraphics &&\n relatedGraphics.forEach((graphic: any) => {\n graphic.animates &&\n graphic.animates.forEach((animate: any) => {\n startTime = Math.max(startTime, animate.getStartTime() + animate.getTotalDuration());\n });\n });\n } else {\n // 'same-time'\n relatedGraphic.animates &&\n relatedGraphic.animates.forEach((animate: any) => {\n startTime = Math.max(startTime, animate.getStartTime());\n });\n }\n\n animator.animate(target, {\n ...config,\n duration,\n easing,\n startTime,\n type\n });\n\n this.completeBind(animator);\n }\n\n // 标签动画本身没有逻辑,具体通过animator中执行,所以本身不需要屏蔽冲突\n protected tryPreventConflict(): void {\n return;\n }\n}\n\nexport function registerLabelAnimate() {\n AnimateExecutor.registerBuiltInAnimate('increaseCount', IncreaseCount);\n // Label update animation\n AnimateExecutor.registerBuiltInAnimate('labelUpdate', LabelUpdate);\n AnimateExecutor.registerBuiltInAnimate('labelEnter', LabelEnter);\n}\n"]}
|
|
@@ -11,11 +11,7 @@ function commitUpdateAnimationTarget(graphic, targetAttrs, startAttrs) {
|
|
|
11
11
|
if (!graphic || !targetAttrs) return;
|
|
12
12
|
const committedTargetAttrs = (0, vutils_1.cloneDeep)(targetAttrs), transientStartAttrs = (0,
|
|
13
13
|
vutils_1.cloneDeep)(null != startAttrs ? startAttrs : graphic.attribute);
|
|
14
|
-
graphic.setAttributes(committedTargetAttrs)
|
|
15
|
-
const baseAttributes = graphic.baseAttributes;
|
|
16
|
-
baseAttributes && "object" == typeof baseAttributes && Object.keys(committedTargetAttrs).forEach((key => {
|
|
17
|
-
baseAttributes[key] = (0, vutils_1.cloneDeep)(committedTargetAttrs[key]);
|
|
18
|
-
})), null === (_b = (_a = graphic).setFinalAttributes) || void 0 === _b || _b.call(_a, committedTargetAttrs),
|
|
14
|
+
graphic.setAttributes(committedTargetAttrs), null === (_b = (_a = graphic).setFinalAttributes) || void 0 === _b || _b.call(_a, committedTargetAttrs),
|
|
19
15
|
null === (_d = (_c = graphic).setAttributesAndPreventAnimate) || void 0 === _d || _d.call(_c, transientStartAttrs, !1, {
|
|
20
16
|
type: vrender_core_1.AttributeUpdateType.ANIMATE_BIND
|
|
21
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/animation/static-truth.ts"],"names":[],"mappings":";;;AAAA,yDAA4E;AAC5E,6CAA6C;AAE7C,SAAgB,2BAA2B,CACzC,OAAkB,EAClB,WAAiC,EACjC,UAAgC;;IAEhC,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,EAAE;QAC5B,OAAO;KACR;IAED,MAAM,oBAAoB,GAAG,IAAA,kBAAS,EAAC,WAAW,CAAC,CAAC;IACpD,MAAM,mBAAmB,GAAG,IAAA,kBAAS,EAAC,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAEvE,OAAO,CAAC,aAAa,CAAC,oBAA2B,CAAC,CAAC;IACnD,
|
|
1
|
+
{"version":3,"sources":["../src/animation/static-truth.ts"],"names":[],"mappings":";;;AAAA,yDAA4E;AAC5E,6CAA6C;AAE7C,SAAgB,2BAA2B,CACzC,OAAkB,EAClB,WAAiC,EACjC,UAAgC;;IAEhC,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW,EAAE;QAC5B,OAAO;KACR;IAED,MAAM,oBAAoB,GAAG,IAAA,kBAAS,EAAC,WAAW,CAAC,CAAC;IACpD,MAAM,mBAAmB,GAAG,IAAA,kBAAS,EAAC,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,OAAO,CAAC,SAAS,CAAC,CAAC;IAEvE,OAAO,CAAC,aAAa,CAAC,oBAA2B,CAAC,CAAC;IACnD,MAAA,MAAC,OAAe,EAAC,kBAAkB,mDAAG,oBAAoB,CAAC,CAAC;IAC5D,MAAA,MAAC,OAAe,EAAC,8BAA8B,mDAAG,mBAA0B,EAAE,KAAK,EAAE;QACnF,IAAI,EAAE,kCAAmB,CAAC,YAAY;KACvC,CAAC,CAAC;AACL,CAAC;AAjBD,kEAiBC","file":"static-truth.js","sourcesContent":["import { AttributeUpdateType, type IGraphic } from '@visactor/vrender-core';\nimport { cloneDeep } from '@visactor/vutils';\n\nexport function commitUpdateAnimationTarget(\n graphic?: IGraphic,\n targetAttrs?: Record<string, any>,\n startAttrs?: Record<string, any>\n) {\n if (!graphic || !targetAttrs) {\n return;\n }\n\n const committedTargetAttrs = cloneDeep(targetAttrs);\n const transientStartAttrs = cloneDeep(startAttrs ?? graphic.attribute);\n\n graphic.setAttributes(committedTargetAttrs as any);\n (graphic as any).setFinalAttributes?.(committedTargetAttrs);\n (graphic as any).setAttributesAndPreventAnimate?.(transientStartAttrs as any, false, {\n type: AttributeUpdateType.ANIMATE_BIND\n });\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { IGroup } from '@visactor/vrender-core';
|
|
2
|
+
import { AnimateMode } from '@visactor/vrender-core/event/constant';
|
|
3
|
+
import { ACustomAnimate } from '@visactor/vrender-animate/custom/custom-animate';
|
|
3
4
|
export declare class GroupTransition extends ACustomAnimate<any> {
|
|
4
5
|
target: IGroup;
|
|
5
6
|
private _newElementAttrMap;
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.GroupTransition = void 0;
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const constant_1 = require("@visactor/vrender-core/event/constant"), custom_animate_1 = require("@visactor/vrender-animate/custom/custom-animate"), vutils_1 = require("@visactor/vutils"), util_1 = require("../../util"), static_truth_1 = require("../../animation/static-truth");
|
|
8
8
|
|
|
9
|
-
class GroupTransition extends
|
|
9
|
+
class GroupTransition extends custom_animate_1.ACustomAnimate {
|
|
10
10
|
constructor() {
|
|
11
|
-
super(...arguments), this.mode =
|
|
11
|
+
super(...arguments), this.mode = constant_1.AnimateMode.NORMAL;
|
|
12
12
|
}
|
|
13
13
|
onBind() {
|
|
14
14
|
this._started = !1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/axis/animate/group-transition.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/axis/animate/group-transition.ts"],"names":[],"mappings":";;;AACA,oEAAoE;AACpE,oFAAiF;AACjF,6CAAmG;AACnG,qCAA2C;AAC3C,+DAA2E;AAE3E,MAAa,eAAgB,SAAQ,+BAAmB;IAAxD;;QAKE,SAAI,GAAG,sBAAW,CAAC,MAA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C,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;oBACrE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;iBAC/C;gBACD,IAAK,IAAiB,CAAC,IAAI,KAAK,MAAM,EAAE;oBACrC,IAAiB;yBACf,OAAO,CAAC;wBACP,WAAW,CAAC,GAAW,EAAE,KAAa,EAAE,IAAS,EAAE,EAAO,EAAE,cAAmB;4BAC7E,IAAI,GAAG,KAAK,MAAM,EAAE;gCAClB,cAAc,CAAC,IAAI,GAAG,IAAA,0BAAiB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;gCACzD,OAAO,IAAI,CAAC;6BACb;4BAED,OAAO,KAAK,CAAC;wBACf,CAAC;qBACF,CAAC;yBAED,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAoB,CAAC,CAAC;iBAC9C;qBAAM;oBACJ,IAAiB;yBACf,OAAO,EAAE;yBAET,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAoB,CAAC,CAAC;iBAC9C;YACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED,QAAQ,CAAC,GAAY,EAAE,KAAa,EAAE,GAAwB;IAE9D,CAAC;CACF;AA/GD,0CA+GC","file":"group-transition.js","sourcesContent":["import type { EasingType, IGraphic, IGroup } from '@visactor/vrender-core';\nimport { AnimateMode } from '@visactor/vrender-core/event/constant';\nimport { ACustomAnimate } from '@visactor/vrender-animate/custom/custom-animate';\nimport { cloneDeep, interpolateString, isEqual, isValidNumber, type Dict } from '@visactor/vutils';\nimport { traverseGroup } from '../../util';\nimport { commitUpdateAnimationTarget } from '../../animation/static-truth';\n\nexport class GroupTransition extends ACustomAnimate<any> {\n declare target: IGroup;\n\n private _newElementAttrMap: Dict<any>;\n private _started: boolean;\n mode = AnimateMode.NORMAL; // 组件的群组动画不需要设置走 AnimateMode.SET_ATTR_IMMEDIATELY\n\n onBind(): void {\n this._started = false;\n // @ts-ignore\n const currentInnerView = this.target.getInnerView();\n // @ts-ignore\n const prevInnerView = this.target.getPrevInnerView();\n if (!prevInnerView) {\n return;\n }\n\n this._newElementAttrMap = {};\n\n // 遍历新的场景树,将新节点属性更新为旧节点\n // TODO: 目前只处理更新场景\n traverseGroup(currentInnerView, (el: IGraphic) => {\n if ((el as IGraphic).type !== 'group' && el.id) {\n const oldEl = prevInnerView[el.id];\n if (oldEl) {\n if (!isEqual((el as IGraphic).attribute, (oldEl as IGraphic).attribute)) {\n // 更新\n const newProps = cloneDeep((el as IGraphic).attribute);\n this._newElementAttrMap[el.id] = {\n state: 'update',\n node: el,\n attrs: {\n ...newProps,\n opacity: newProps.opacity ?? 1,\n fillOpacity: newProps.fillOpacity ?? 1,\n strokeOpacity: newProps.strokeOpacity ?? 1\n }\n };\n\n commitUpdateAnimationTarget(\n el as IGraphic,\n this._newElementAttrMap[el.id].attrs,\n cloneDeep((oldEl as IGraphic).attribute)\n );\n }\n } else {\n // 新入场元素,进行 fadeIn 动画\n const finalOpacityAttrs = {\n opacity: el.attribute.opacity ?? 1,\n fillOpacity: el.attribute.fillOpacity ?? 1,\n strokeOpacity: el.attribute.strokeOpacity ?? 1\n };\n this._newElementAttrMap[el.id] = {\n state: 'enter',\n node: el,\n attrs: finalOpacityAttrs\n };\n commitUpdateAnimationTarget(el as IGraphic, finalOpacityAttrs, {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n });\n }\n }\n });\n }\n\n onStart(): void {\n if (this._started) {\n return;\n }\n this._started = true;\n\n let duration = this.duration;\n let easing = this.easing;\n\n // 新的场景树\n this._newElementAttrMap &&\n Object.keys(this._newElementAttrMap).forEach(id => {\n const { node, attrs, state } = this._newElementAttrMap[id];\n if (state === 'enter') {\n const { enter = {} } = this.params ?? {};\n duration = isValidNumber(enter.duration) ? enter.duration : duration;\n easing = enter.easing ? enter.easing : easing;\n }\n if ((node as IGraphic).type === 'path') {\n (node as IGraphic)\n .animate({\n interpolate(key: string, ratio: number, from: any, to: any, nextAttributes: any) {\n if (key === 'path') {\n nextAttributes.path = interpolateString(from, to)(ratio);\n return true;\n }\n\n return false;\n }\n })\n // .wait(delay)\n .to(attrs, duration, easing as EasingType);\n } else {\n (node as IGraphic)\n .animate()\n // .wait(delay)\n .to(attrs, duration, easing as EasingType);\n }\n });\n }\n\n onUpdate(end: boolean, ratio: number, out: Record<string, any>): void {\n // do nothing\n }\n}\n"]}
|
package/cjs/axis/base.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IGroup, ITextGraphicAttribute, TextAlignType, TextBaselineType, IGraphic, IText } from '@visactor/vrender-core';
|
|
2
2
|
import type { Dict } from '@visactor/vutils';
|
|
3
|
-
import type { Point } from '../core/type';
|
|
3
|
+
import type { ComponentExitReleaseOptions, Point } from '../core/type';
|
|
4
4
|
import type { TagAttributes } from '../tag';
|
|
5
5
|
import type { AxisBaseAttributes, AxisItem, TransformedAxisItem, TickLineItem } from './type';
|
|
6
6
|
import { AnimateComponent } from '../animation/animate-component';
|
|
@@ -30,6 +30,7 @@ export declare abstract class AxisBase<T extends AxisBaseAttributes> extends Ani
|
|
|
30
30
|
protected axisContainer: IGroup;
|
|
31
31
|
private _lastHover;
|
|
32
32
|
private _lastSelect;
|
|
33
|
+
private _exitReleaseState?;
|
|
33
34
|
protected _newElementAttrMap: Dict<any>;
|
|
34
35
|
protected abstract renderLine(container: IGroup): void;
|
|
35
36
|
abstract isInValidValue(value: number): boolean;
|
|
@@ -45,6 +46,9 @@ export declare abstract class AxisBase<T extends AxisBaseAttributes> extends Ani
|
|
|
45
46
|
textBaseline: TextBaselineType;
|
|
46
47
|
};
|
|
47
48
|
getBoundsWithoutRender(attributes: Partial<T>): import("@visactor/vutils").IBounds;
|
|
49
|
+
private _finalizeExitRelease;
|
|
50
|
+
private _runExitAnimationBeforeRelease;
|
|
51
|
+
releaseWithExitAnimation(options?: ComponentExitReleaseOptions): boolean;
|
|
48
52
|
protected render(): void;
|
|
49
53
|
protected _prepare(): void;
|
|
50
54
|
private _bindEvent;
|
|
@@ -63,5 +67,5 @@ export declare abstract class AxisBase<T extends AxisBaseAttributes> extends Ani
|
|
|
63
67
|
protected getLabelPosition(point: Point, vector: [number, number], text: string | number, style: Partial<ITextGraphicAttribute>): Point;
|
|
64
68
|
private _transformItems;
|
|
65
69
|
protected runAnimation(): void;
|
|
66
|
-
release(): void;
|
|
70
|
+
release(all?: boolean): void;
|
|
67
71
|
}
|
package/cjs/axis/base.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.AxisBase = void 0;
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const diff_1 = require("@visactor/vrender-core/common/diff"), graphic_creator_1 = require("../util/graphic-creator"), vutils_1 = require("@visactor/vutils"), util_1 = require("../util"), constant_1 = require("../constant"), constant_2 = require("./constant"), config_1 = require("./config"), tag_1 = require("../tag/tag"), util_2 = require("./util"), interaction_1 = require("../util/interaction"), animate_component_1 = require("../animation/animate-component"), static_truth_1 = require("../animation/static-truth"), exit_release_1 = require("../animation/exit-release"), config_2 = require("./animate/config");
|
|
8
8
|
|
|
9
9
|
class AxisBase extends animate_component_1.AnimateComponent {
|
|
10
10
|
constructor() {
|
|
@@ -34,14 +34,66 @@ class AxisBase extends animate_component_1.AnimateComponent {
|
|
|
34
34
|
return this.add(offscreenGroup), this._renderInner(offscreenGroup), this.removeChild(offscreenGroup),
|
|
35
35
|
this.attribute = currentAttribute, offscreenGroup.AABBBounds;
|
|
36
36
|
}
|
|
37
|
+
_finalizeExitRelease() {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
const state = this._exitReleaseState;
|
|
40
|
+
if (null == state ? void 0 : state.finalized) return;
|
|
41
|
+
state && (state.finalized = !0);
|
|
42
|
+
const parent = this.parent, removeFromParent = !!(null == state ? void 0 : state.removeFromParent), callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
|
|
43
|
+
this._exitReleaseState = void 0, this._prevInnerView = null, this._innerView = null,
|
|
44
|
+
this.axisLabelsContainer = null, this.axisContainer = null, this.removeAllChild(!0),
|
|
45
|
+
super.release(!0), removeFromParent && (null === (_b = null != parent ? parent : this.parent) || void 0 === _b || _b.removeChild(this)),
|
|
46
|
+
(0, exit_release_1.runExitReleaseCallbacks)(callbacks);
|
|
47
|
+
}
|
|
48
|
+
_runExitAnimationBeforeRelease(options = {}) {
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent,
|
|
51
|
+
(0, exit_release_1.appendExitReleaseCallback)(this._exitReleaseState, options.onComplete),
|
|
52
|
+
!0;
|
|
53
|
+
if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !this._innerView) return !1;
|
|
54
|
+
if (this._prepare(), !(null === (_a = this._animationConfig) || void 0 === _a ? void 0 : _a.exit)) return !1;
|
|
55
|
+
const exitTargets = new Set;
|
|
56
|
+
if ((0, util_1.traverseGroup)(this._innerView, (el => {
|
|
57
|
+
"group" !== el.type && exitTargets.add(el);
|
|
58
|
+
})), !exitTargets.size) return !1;
|
|
59
|
+
const existingAnimates = (0, exit_release_1.collectTrackedAnimates)(this), {delay: delay = 0, duration: duration = config_2.DefaultAxisAnimation.duration, easing: easing = config_2.DefaultAxisAnimation.easing} = this._animationConfig.exit;
|
|
60
|
+
exitTargets.forEach((target => {
|
|
61
|
+
var _a, _b, _c;
|
|
62
|
+
const startAttrs = {
|
|
63
|
+
opacity: null !== (_a = target.attribute.opacity) && void 0 !== _a ? _a : 1,
|
|
64
|
+
fillOpacity: null !== (_b = target.attribute.fillOpacity) && void 0 !== _b ? _b : 1,
|
|
65
|
+
strokeOpacity: null !== (_c = target.attribute.strokeOpacity) && void 0 !== _c ? _c : 1
|
|
66
|
+
}, endAttrs = {
|
|
67
|
+
opacity: 0,
|
|
68
|
+
fillOpacity: 0,
|
|
69
|
+
strokeOpacity: 0
|
|
70
|
+
};
|
|
71
|
+
(0, static_truth_1.commitUpdateAnimationTarget)(target, endAttrs, startAttrs), target.animate().wait(delay).to(endAttrs, duration, easing);
|
|
72
|
+
}));
|
|
73
|
+
const exitAnimates = (0, exit_release_1.collectTrackedAnimates)(this).filter((animate => !existingAnimates.includes(animate)));
|
|
74
|
+
if (!exitAnimates.length) return !1;
|
|
75
|
+
this.setAttribute("childrenPickable", !1), null === (_c = (_b = this._innerView).removeAllEventListeners) || void 0 === _c || _c.call(_b),
|
|
76
|
+
this.releaseStatus = "willRelease";
|
|
77
|
+
const pendingAnimates = new Set(exitAnimates);
|
|
78
|
+
return this._exitReleaseState = {
|
|
79
|
+
pendingAnimates: pendingAnimates,
|
|
80
|
+
finalized: !1,
|
|
81
|
+
removeFromParent: !!options.removeFromParent,
|
|
82
|
+
onComplete: options.onComplete ? [ options.onComplete ] : []
|
|
83
|
+
}, (0, exit_release_1.bindExitReleaseAnimates)(exitAnimates, (() => this._exitReleaseState), (() => this._finalizeExitRelease())),
|
|
84
|
+
!0;
|
|
85
|
+
}
|
|
86
|
+
releaseWithExitAnimation(options = {}) {
|
|
87
|
+
return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
|
|
88
|
+
}
|
|
37
89
|
render() {
|
|
38
|
-
this._prepare(), this._prevInnerView = this._innerView && (0,
|
|
39
|
-
this.removeAllChild(!0), this._innerView = graphic_creator_1.graphicCreator.group({
|
|
90
|
+
this._exitReleaseState || (this._prepare(), this._prevInnerView = this._innerView && (0,
|
|
91
|
+
util_2.getElMap)(this._innerView), this.removeAllChild(!0), this._innerView = graphic_creator_1.graphicCreator.group({
|
|
40
92
|
x: 0,
|
|
41
93
|
y: 0,
|
|
42
94
|
pickable: !1
|
|
43
95
|
}), this.add(this._innerView), this._renderInner(this._innerView), this._bindEvent(),
|
|
44
|
-
this.runAnimation();
|
|
96
|
+
this.runAnimation());
|
|
45
97
|
}
|
|
46
98
|
_prepare() {
|
|
47
99
|
this._prepareAnimate(config_2.DefaultAxisAnimation);
|
|
@@ -286,7 +338,7 @@ class AxisBase extends animate_component_1.AnimateComponent {
|
|
|
286
338
|
if (oldEl) {
|
|
287
339
|
oldEl.release();
|
|
288
340
|
const oldAttrs = (0, vutils_1.cloneDeep)(oldEl.attribute), finalAttrs = (0, vutils_1.cloneDeep)(el.attribute), diffAttrs = (0,
|
|
289
|
-
|
|
341
|
+
diff_1.diff)(oldAttrs, finalAttrs);
|
|
290
342
|
let hasDiff = Object.keys(diffAttrs).length > 0;
|
|
291
343
|
"opacity" in oldAttrs && finalAttrs.opacity !== oldAttrs.opacity && (diffAttrs.opacity = null !== (_a = finalAttrs.opacity) && void 0 !== _a ? _a : 1,
|
|
292
344
|
hasDiff = !0), animationConfig.update && hasDiff && (this._newElementAttrMap[el.id] = {
|
|
@@ -326,8 +378,10 @@ class AxisBase extends animate_component_1.AnimateComponent {
|
|
|
326
378
|
}));
|
|
327
379
|
}
|
|
328
380
|
}
|
|
329
|
-
release() {
|
|
330
|
-
|
|
381
|
+
release(all) {
|
|
382
|
+
this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0),
|
|
383
|
+
super.release(all), all && this.removeAllChild(!0), this._prevInnerView = null,
|
|
384
|
+
this._innerView = null);
|
|
331
385
|
}
|
|
332
386
|
}
|
|
333
387
|
|