@visactor/vchart 2.0.1 → 2.0.3-alpha.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/build/es5/index.js +1 -1
- package/build/index.es.js +384 -427
- package/build/index.js +383 -427
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/animate-manager.d.ts +1 -0
- package/cjs/animation/animate-manager.js +2 -0
- package/cjs/animation/animate-manager.js.map +1 -0
- package/cjs/animation/index.js +1 -2
- package/cjs/animation/interface.js +2 -1
- package/cjs/chart/base/base-chart.d.ts +0 -1
- package/cjs/chart/base/base-chart.js +8 -5
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/interface/chart.d.ts +0 -1
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/chart/util.js +1 -2
- package/cjs/compile/compiler.d.ts +0 -1
- package/cjs/compile/compiler.js +2 -10
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/interface/compilable-item.d.ts +0 -1
- package/cjs/compile/interface/compilable-item.js.map +1 -1
- package/cjs/compile/interface/compiler.d.ts +0 -1
- package/cjs/compile/interface/compiler.js.map +1 -1
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/component/axis/cartesian/band-axis.d.ts +0 -8
- package/cjs/component/axis/cartesian/band-axis.js +0 -9
- package/cjs/component/axis/cartesian/band-axis.js.map +1 -1
- package/cjs/component/axis/interface/common.js.map +1 -1
- package/cjs/component/axis/mixin/band-axis-mixin.d.ts +0 -2
- package/cjs/component/axis/mixin/band-axis-mixin.js +1 -15
- package/cjs/component/axis/mixin/band-axis-mixin.js.map +1 -1
- package/cjs/component/brush/brush.js +6 -6
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/brush/interface.d.ts +0 -1
- package/cjs/component/brush/interface.js.map +1 -1
- package/cjs/component/crosshair/base.d.ts +1 -1
- package/cjs/component/crosshair/base.js +1 -1
- package/cjs/component/crosshair/base.js.map +1 -1
- package/cjs/component/crosshair/utils/cartesian.js +2 -2
- package/cjs/component/crosshair/utils/cartesian.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.d.ts +1 -0
- package/cjs/component/data-zoom/data-filter-base-component.js +19 -13
- package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/cjs/component/data-zoom/interface.d.ts +3 -0
- package/cjs/component/data-zoom/interface.js.map +1 -1
- package/cjs/component/data-zoom/util.d.ts +1 -0
- package/cjs/component/data-zoom/util.js +4 -3
- package/cjs/component/data-zoom/util.js.map +1 -1
- package/cjs/component/player/player.js +1 -2
- package/cjs/component/player/player.js.map +1 -1
- package/cjs/component/tooltip/tooltip.js +3 -8
- package/cjs/component/tooltip/tooltip.js.map +1 -1
- package/cjs/constant/attribute.js +2 -1
- package/cjs/constant/sunburst.js +1 -2
- package/cjs/constant/waterfall.js +2 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/core/util.js +1 -1
- package/cjs/core/vchart.d.ts +0 -1
- package/cjs/core/vchart.js +17 -36
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/transforms/obj-flat.js +4 -1
- package/cjs/data/transforms/obj-flat.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +2 -6
- package/cjs/mark/base/base-mark.js +51 -69
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/group.d.ts +2 -3
- package/cjs/mark/group.js +13 -15
- package/cjs/mark/group.js.map +1 -1
- package/cjs/mark/interface/common.d.ts +2 -5
- package/cjs/mark/interface/common.js.map +1 -1
- package/cjs/model/base-model.d.ts +1 -5
- package/cjs/model/base-model.js +0 -7
- package/cjs/model/base-model.js.map +1 -1
- package/cjs/model/interface.d.ts +1 -4
- package/cjs/model/interface.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/utils/style.js +4 -4
- package/cjs/plugin/components/tooltip-handler/utils/style.js.map +1 -1
- package/cjs/region/region.js.map +1 -1
- package/cjs/series/base/base-series.js +3 -2
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/dot/dot.d.ts +1 -0
- package/cjs/series/dot/dot.js +29 -6
- package/cjs/series/dot/dot.js.map +1 -1
- package/cjs/series/dot/interface.d.ts +1 -0
- package/cjs/series/dot/interface.js.map +1 -1
- package/cjs/series/dot/tooltip-helper.js +3 -2
- package/cjs/series/dot/tooltip-helper.js.map +1 -1
- package/cjs/series/funnel/funnel.js +2 -0
- package/cjs/series/funnel/funnel.js.map +1 -1
- package/cjs/series/interface/type.d.ts +3 -0
- package/cjs/series/interface/type.js +5 -3
- package/cjs/series/interface/type.js.map +1 -1
- package/cjs/series/link/constant.js +8 -0
- package/cjs/series/link/constant.js.map +1 -1
- package/cjs/series/link/interface.d.ts +10 -1
- package/cjs/series/link/interface.js +5 -1
- package/cjs/series/link/interface.js.map +1 -1
- package/cjs/series/link/link.d.ts +3 -1
- package/cjs/series/link/link.js +46 -16
- package/cjs/series/link/link.js.map +1 -1
- package/cjs/series/map/map.js +2 -1
- package/cjs/series/map/map.js.map +1 -1
- package/cjs/series/pie/pie.js +1 -0
- package/cjs/series/pie/pie.js.map +1 -1
- package/cjs/util/mark.d.ts +0 -1
- package/cjs/util/mark.js +1 -10
- package/cjs/util/mark.js.map +1 -1
- package/esm/animation/animate-manager.d.ts +1 -0
- package/esm/animation/animate-manager.js +2 -0
- package/esm/animation/animate-manager.js.map +1 -0
- package/esm/animation/index.js +1 -2
- package/esm/animation/interface.js +2 -1
- package/esm/chart/base/base-chart.d.ts +0 -1
- package/esm/chart/base/base-chart.js +8 -5
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/interface/chart.d.ts +0 -1
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/chart/util.js +1 -2
- package/esm/compile/compiler.d.ts +0 -1
- package/esm/compile/compiler.js +4 -11
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/interface/compilable-item.d.ts +0 -1
- package/esm/compile/interface/compilable-item.js.map +1 -1
- package/esm/compile/interface/compiler.d.ts +0 -1
- package/esm/compile/interface/compiler.js.map +1 -1
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/component/axis/cartesian/band-axis.d.ts +0 -8
- package/esm/component/axis/cartesian/band-axis.js +1 -9
- package/esm/component/axis/cartesian/band-axis.js.map +1 -1
- package/esm/component/axis/interface/common.js.map +1 -1
- package/esm/component/axis/mixin/band-axis-mixin.d.ts +0 -2
- package/esm/component/axis/mixin/band-axis-mixin.js +1 -15
- package/esm/component/axis/mixin/band-axis-mixin.js.map +1 -1
- package/esm/component/brush/brush.js +6 -6
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/brush/interface.d.ts +0 -1
- package/esm/component/brush/interface.js.map +1 -1
- package/esm/component/crosshair/base.d.ts +1 -1
- package/esm/component/crosshair/base.js +1 -1
- package/esm/component/crosshair/base.js.map +1 -1
- package/esm/component/crosshair/utils/cartesian.js +2 -2
- package/esm/component/crosshair/utils/cartesian.js.map +1 -1
- package/esm/component/data-zoom/data-filter-base-component.d.ts +1 -0
- package/esm/component/data-zoom/data-filter-base-component.js +18 -13
- package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/esm/component/data-zoom/interface.d.ts +3 -0
- package/esm/component/data-zoom/interface.js.map +1 -1
- package/esm/component/data-zoom/util.d.ts +1 -0
- package/esm/component/data-zoom/util.js +5 -2
- package/esm/component/data-zoom/util.js.map +1 -1
- package/esm/component/player/player.js +1 -2
- package/esm/component/player/player.js.map +1 -1
- package/esm/component/tooltip/tooltip.js +3 -8
- package/esm/component/tooltip/tooltip.js.map +1 -1
- package/esm/constant/attribute.js +2 -1
- package/esm/constant/sunburst.js +1 -2
- package/esm/constant/waterfall.js +2 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/core/util.js +1 -1
- package/esm/core/vchart.d.ts +0 -1
- package/esm/core/vchart.js +16 -35
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/transforms/obj-flat.js +4 -1
- package/esm/data/transforms/obj-flat.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +2 -6
- package/esm/mark/base/base-mark.js +50 -69
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/group.d.ts +2 -3
- package/esm/mark/group.js +12 -18
- package/esm/mark/group.js.map +1 -1
- package/esm/mark/interface/common.d.ts +2 -5
- package/esm/mark/interface/common.js.map +1 -1
- package/esm/model/base-model.d.ts +1 -5
- package/esm/model/base-model.js +0 -7
- package/esm/model/base-model.js.map +1 -1
- package/esm/model/interface.d.ts +1 -4
- package/esm/model/interface.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/utils/style.js +4 -5
- package/esm/plugin/components/tooltip-handler/utils/style.js.map +1 -1
- package/esm/region/region.js.map +1 -1
- package/esm/series/base/base-series.js +3 -2
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/dot/dot.d.ts +1 -0
- package/esm/series/dot/dot.js +29 -6
- package/esm/series/dot/dot.js.map +1 -1
- package/esm/series/dot/interface.d.ts +1 -0
- package/esm/series/dot/interface.js.map +1 -1
- package/esm/series/dot/tooltip-helper.js +3 -2
- package/esm/series/dot/tooltip-helper.js.map +1 -1
- package/esm/series/funnel/funnel.js +2 -0
- package/esm/series/funnel/funnel.js.map +1 -1
- package/esm/series/interface/type.d.ts +3 -0
- package/esm/series/interface/type.js +5 -3
- package/esm/series/interface/type.js.map +1 -1
- package/esm/series/link/constant.js +8 -0
- package/esm/series/link/constant.js.map +1 -1
- package/esm/series/link/interface.d.ts +10 -1
- package/esm/series/link/interface.js +5 -1
- package/esm/series/link/interface.js.map +1 -1
- package/esm/series/link/link.d.ts +3 -1
- package/esm/series/link/link.js +48 -16
- package/esm/series/link/link.js.map +1 -1
- package/esm/series/map/map.js +2 -1
- package/esm/series/map/map.js.map +1 -1
- package/esm/series/pie/pie.js +1 -0
- package/esm/series/pie/pie.js.map +1 -1
- package/esm/util/mark.d.ts +0 -1
- package/esm/util/mark.js +0 -7
- package/esm/util/mark.js.map +1 -1
- package/package.json +8 -8
|
@@ -44,9 +44,6 @@ export declare class BaseMark<T extends ICommonSpec> extends GrammarItem impleme
|
|
|
44
44
|
protected _animationConfig: Partial<MarkAnimationSpec>;
|
|
45
45
|
getAnimationConfig(): Partial<MarkAnimationSpec>;
|
|
46
46
|
setAnimationConfig(config: Partial<MarkAnimationSpec>): void;
|
|
47
|
-
protected _disabledAnimationStates?: string[];
|
|
48
|
-
disableAnimationByState(state: string | string[]): void;
|
|
49
|
-
enableAnimationByState(state: string | string[]): void;
|
|
50
47
|
private _skipBeforeLayouted;
|
|
51
48
|
setSkipBeforeLayouted(skip: boolean): void;
|
|
52
49
|
protected _groupKey?: string;
|
|
@@ -126,7 +123,6 @@ export declare class BaseMark<T extends ICommonSpec> extends GrammarItem impleme
|
|
|
126
123
|
protected _attrsByGroup?: Record<string, T>;
|
|
127
124
|
protected _getDataByKey(data: Datum[]): GroupedData<Datum>;
|
|
128
125
|
protected _getCommonContext(): {
|
|
129
|
-
compiler: import("../../compile/interface").ICompiler;
|
|
130
126
|
markType: MarkTypeEnum;
|
|
131
127
|
markId: number;
|
|
132
128
|
modelId: number;
|
|
@@ -142,7 +138,6 @@ export declare class BaseMark<T extends ICommonSpec> extends GrammarItem impleme
|
|
|
142
138
|
protected createAnimationStateList(type: string, animationConfig: Partial<MarkAnimationSpec>): any;
|
|
143
139
|
protected tryRunMorphing(graphics: IMarkGraphic[]): boolean;
|
|
144
140
|
protected _runStateAnimation(graphics: IMarkGraphic[]): void;
|
|
145
|
-
protected _setAnimationState(g: IMarkGraphic): void;
|
|
146
141
|
protected _runJoin(data: Datum[]): void;
|
|
147
142
|
_runEncoderOfGraphic(styles: Record<string, (datum: Datum) => any>, g: IMarkGraphic, attrs?: any): any;
|
|
148
143
|
_runGroupEncoder(groupStyles: Record<string, (datum: Datum) => any>): any;
|
|
@@ -184,7 +179,8 @@ export declare class BaseMark<T extends ICommonSpec> extends GrammarItem impleme
|
|
|
184
179
|
protected _runProgressiveApplyGraphic(graphics: IMarkGraphic[]): void;
|
|
185
180
|
protected _runProgressiveStep(): void;
|
|
186
181
|
renderProgressive(): void;
|
|
187
|
-
|
|
182
|
+
updateAnimationState(callback: (graphic: IMarkGraphic) => AnimationStateValues): void;
|
|
183
|
+
hasAnimationByState(state: keyof MarkAnimationSpec): boolean;
|
|
188
184
|
hasAnimation(): boolean;
|
|
189
185
|
runAnimation(): void;
|
|
190
186
|
}
|
|
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
14
14
|
value: !0
|
|
15
15
|
}), exports.BaseMark = void 0;
|
|
16
16
|
|
|
17
|
-
const enum_1 = require("../interface/enum"), interface_1 = require("../../compile/mark/interface"), vutils_extension_1 = require("@visactor/vutils-extension"), color_1 = require("../../util/color"), scale_1 = require("../../util/scale"), gradient_1 = require("../../constant/gradient"), attribute_1 = require("../../constant/attribute"), vscale_1 = require("@visactor/vscale"), util_1 = require("../../theme/color-scheme/util"), mark_1 = require("../../compile/mark"), vutils_1 = require("@visactor/vutils"), common_1 = require("../utils/common"), interface_2 = require("../../compile/interface"), vrender_core_1 = require("@visactor/vrender-core"), util_2 = require("../../compile/mark/util"), factory_1 = require("../../core/factory"), data_1 = require("../../constant/data"), grammar_item_1 = require("../../compile/grammar-item"), layout_1 = require("../../constant/layout"), interface_3 = require("../../animation/interface"), compilable_data_1 = require("../../compile/data/compilable-data"),
|
|
17
|
+
const enum_1 = require("../interface/enum"), interface_1 = require("../../compile/mark/interface"), vutils_extension_1 = require("@visactor/vutils-extension"), color_1 = require("../../util/color"), scale_1 = require("../../util/scale"), gradient_1 = require("../../constant/gradient"), attribute_1 = require("../../constant/attribute"), vscale_1 = require("@visactor/vscale"), util_1 = require("../../theme/color-scheme/util"), mark_1 = require("../../compile/mark"), vutils_1 = require("@visactor/vutils"), common_1 = require("../utils/common"), interface_2 = require("../../compile/interface"), vrender_core_1 = require("@visactor/vrender-core"), util_2 = require("../../compile/mark/util"), factory_1 = require("../../core/factory"), data_1 = require("../../constant/data"), grammar_item_1 = require("../../compile/grammar-item"), layout_1 = require("../../constant/layout"), interface_3 = require("../../animation/interface"), compilable_data_1 = require("../../compile/data/compilable-data"), util_3 = require("../../util"), morph_1 = require("../../compile/morph");
|
|
18
18
|
|
|
19
19
|
class BaseMark extends grammar_item_1.GrammarItem {
|
|
20
20
|
commit(render, recursion) {
|
|
@@ -72,37 +72,24 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
72
72
|
setAnimationConfig(config) {
|
|
73
73
|
const defaultPrams = "group" === this.type ? {
|
|
74
74
|
selfOnly: !0
|
|
75
|
-
} : {},
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
} : {}, animationConfig = {};
|
|
76
|
+
Object.keys(config).forEach((key => {
|
|
77
|
+
const value = config[key];
|
|
78
|
+
(0, vutils_1.isArray)(value) ? animationConfig[key] = value.map((item => {
|
|
79
|
+
var _a;
|
|
80
|
+
const options = null !== (_a = item.options) && void 0 !== _a ? _a : {};
|
|
81
|
+
return Object.assign(Object.assign(Object.assign({}, defaultPrams), item), {
|
|
82
|
+
options: (...args) => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
const _options = "function" == typeof options ? options(...args) : options;
|
|
84
85
|
return Object.assign(Object.assign({}, _options), {
|
|
85
|
-
layoutRect: null === (_b =
|
|
86
|
+
layoutRect: null === (_b = (_a = this.model).getLayoutRect) || void 0 === _b ? void 0 : _b.call(_a)
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
}, animationConfig = {};
|
|
92
|
-
Object.keys(config).forEach((key => {
|
|
93
|
-
const value = config[key];
|
|
94
|
-
(0, vutils_1.isArray)(value) ? animationConfig[key] = value.map(formatAnimationCfg) : (0,
|
|
95
|
-
vutils_1.isValid)(value) && (animationConfig[key] = formatAnimationCfg(value));
|
|
89
|
+
});
|
|
90
|
+
})) : animationConfig[key] = Object.assign(Object.assign({}, defaultPrams), config[key]);
|
|
96
91
|
})), this._animationConfig = animationConfig;
|
|
97
92
|
}
|
|
98
|
-
disableAnimationByState(state) {
|
|
99
|
-
const states = (0, vutils_1.array)(state);
|
|
100
|
-
this._disabledAnimationStates = [ ...new Set([ ...this._disabledAnimationStates, ...states ]) ];
|
|
101
|
-
}
|
|
102
|
-
enableAnimationByState(state) {
|
|
103
|
-
const states = (0, vutils_1.array)(state);
|
|
104
|
-
this._disabledAnimationStates = this._disabledAnimationStates.filter((s => !states.includes(s)));
|
|
105
|
-
}
|
|
106
93
|
setSkipBeforeLayouted(skip) {
|
|
107
94
|
this._skipBeforeLayouted = skip;
|
|
108
95
|
}
|
|
@@ -188,9 +175,9 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
188
175
|
super(option), this.type = void 0, this.name = "mark", this._markConfig = {
|
|
189
176
|
zIndex: layout_1.LayoutZIndex.Mark,
|
|
190
177
|
morph: !1
|
|
191
|
-
}, this._visible = !0, this.stateStyle = {}, this._unCompileChannel = {}, this.
|
|
192
|
-
this.
|
|
193
|
-
this.
|
|
178
|
+
}, this._visible = !0, this.stateStyle = {}, this._unCompileChannel = {}, this._skipBeforeLayouted = !1,
|
|
179
|
+
this._extensionChannel = {}, this._computeExChannel = {}, this._graphicMap = new Map,
|
|
180
|
+
this._graphics = [], this._getEncoderOfStyle = (stateName, style) => {
|
|
194
181
|
if (style && stateName) {
|
|
195
182
|
const validEncoder = {};
|
|
196
183
|
return Object.keys(style).forEach((key => {
|
|
@@ -439,7 +426,6 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
439
426
|
}
|
|
440
427
|
_getCommonContext() {
|
|
441
428
|
return {
|
|
442
|
-
compiler: this.getCompiler(),
|
|
443
429
|
markType: this.type,
|
|
444
430
|
markId: this.id,
|
|
445
431
|
modelId: this.model.id,
|
|
@@ -490,17 +476,14 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
490
476
|
this._dataByGroup = (0, common_1.groupData)(data, this._groupKeyGetter);
|
|
491
477
|
}
|
|
492
478
|
createAnimationStateList(type, animationConfig) {
|
|
493
|
-
var _a;
|
|
494
479
|
let config = animationConfig[type];
|
|
495
480
|
return config && Array.isArray(config) && (config = 1 === config.length ? config[0] : config),
|
|
496
|
-
Array.isArray(config)
|
|
481
|
+
Array.isArray(config) && (config = config.map(((item, index) => {
|
|
497
482
|
var _a;
|
|
498
483
|
return Object.assign(Object.assign({}, item), {
|
|
499
484
|
priority: null !== (_a = item.priority) && void 0 !== _a ? _a : 1 / 0
|
|
500
485
|
});
|
|
501
|
-
}))
|
|
502
|
-
priority: "normal" === type ? null !== (_a = config.priority) && void 0 !== _a ? _a : 1 / 0 : config.priority
|
|
503
|
-
}) : config;
|
|
486
|
+
}))), config;
|
|
504
487
|
}
|
|
505
488
|
tryRunMorphing(graphics) {
|
|
506
489
|
if (this._lastMark) {
|
|
@@ -559,38 +542,30 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
559
542
|
this._product.applyAnimationState([ "normal" ], [ normalConfig ]);
|
|
560
543
|
}
|
|
561
544
|
}
|
|
562
|
-
_setAnimationState(g) {
|
|
563
|
-
var _a, _b, _c;
|
|
564
|
-
const callback = ("component" === this.type ? this.model.getAnimationStateCallback() : null === (_c = null === (_b = (_a = this.model).getRegion) || void 0 === _b ? void 0 : _b.call(_a)) || void 0 === _c ? void 0 : _c.getAnimationStateCallback()) || (g => {
|
|
565
|
-
var _a;
|
|
566
|
-
const diffState = null === (_a = g.context) || void 0 === _a ? void 0 : _a.diffState;
|
|
567
|
-
return diffState === interface_3.AnimationStateEnum.exit ? interface_3.AnimationStateEnum.exit : diffState === interface_3.AnimationStateEnum.update ? interface_3.AnimationStateEnum.update : interface_3.AnimationStateEnum.appear;
|
|
568
|
-
}), customizedState = callback(g);
|
|
569
|
-
g.context.animationState = null != customizedState ? customizedState : g.context.diffState,
|
|
570
|
-
g.context.animationState === enum_1.DiffState.exit && (g.context.reusing = !0, g.animates && g.animates.forEach((a => a.stop())));
|
|
571
|
-
}
|
|
572
545
|
_runJoin(data) {
|
|
573
|
-
const newGroupedData = this._getDataByKey(data), prevGroupedData = this._prevDataByKey,
|
|
574
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
546
|
+
const newGroupedData = this._getDataByKey(data), prevGroupedData = this._prevDataByKey, newGraphics = [], enterGraphics = new Set(this._graphics.filter((g => g.context.diffState === enum_1.DiffState.enter))), callback = (key, newData, prevData) => {
|
|
547
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
575
548
|
let g, diffState;
|
|
576
549
|
return (0, vutils_1.isNil)(newData) ? (g = this._graphicMap.get(key), g && (diffState = enum_1.DiffState.exit)) : (0,
|
|
577
550
|
vutils_1.isNil)(prevData) ? (g = this._graphicMap.has(key) ? this._graphicMap.get(key) : {},
|
|
578
|
-
diffState = enum_1.DiffState.enter, g.isExiting = !1,
|
|
579
|
-
|
|
580
|
-
|
|
551
|
+
diffState = enum_1.DiffState.enter, g.isExiting = !1, (null === (_a = g.context) || void 0 === _a ? void 0 : _a.diffState) === enum_1.DiffState.exit && (g.context.reusing = !0,
|
|
552
|
+
g.animates && g.animates.forEach((a => a.stop()))), this._graphicMap.set(key, g),
|
|
553
|
+
newGraphics.push(g)) : (g = this._graphicMap.get(key), g && (diffState = enum_1.DiffState.update,
|
|
554
|
+
newGraphics.push(g))), g && (g.context = Object.assign(Object.assign({}, this._getCommonContext()), {
|
|
581
555
|
diffState: diffState,
|
|
582
|
-
reusing: null === (
|
|
583
|
-
originalFieldX: null === (
|
|
584
|
-
originalFieldY: null === (
|
|
585
|
-
fieldX: null === (
|
|
586
|
-
fieldY: null === (
|
|
587
|
-
|
|
556
|
+
reusing: null === (_b = g.context) || void 0 === _b ? void 0 : _b.reusing,
|
|
557
|
+
originalFieldX: null === (_c = g.context) || void 0 === _c ? void 0 : _c.originalFieldX,
|
|
558
|
+
originalFieldY: null === (_d = g.context) || void 0 === _d ? void 0 : _d.originalFieldY,
|
|
559
|
+
fieldX: null === (_e = g.context) || void 0 === _e ? void 0 : _e.fieldX,
|
|
560
|
+
fieldY: null === (_f = g.context) || void 0 === _f ? void 0 : _f.fieldY,
|
|
561
|
+
animationState: diffState,
|
|
562
|
+
data: null != newData ? newData : null === (_g = g.context) || void 0 === _g ? void 0 : _g.data,
|
|
588
563
|
uniqueKey: key,
|
|
589
|
-
key: newData ? this._keyGetter(newData[0]) : null === (
|
|
590
|
-
groupKey: newData ? this._groupKeyGetter(newData[0]) : null === (
|
|
564
|
+
key: newData ? this._keyGetter(newData[0]) : null === (_h = g.context) || void 0 === _h ? void 0 : _h.key,
|
|
565
|
+
groupKey: newData ? this._groupKeyGetter(newData[0]) : null === (_j = g.context) || void 0 === _j ? void 0 : _j.groupKey,
|
|
591
566
|
indexKey: "__VCHART_DEFAULT_DATA_INDEX",
|
|
592
|
-
stateAnimateConfig: null === (
|
|
593
|
-
}),
|
|
567
|
+
stateAnimateConfig: null === (_k = this.getAnimationConfig()) || void 0 === _k ? void 0 : _k.state
|
|
568
|
+
}), enterGraphics.delete(g)), g;
|
|
594
569
|
};
|
|
595
570
|
if (prevGroupedData && newGroupedData) {
|
|
596
571
|
const prevMap = new Map(prevGroupedData.data);
|
|
@@ -609,10 +584,10 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
609
584
|
this._graphicMap.delete(g.context.uniqueKey), g.parent && g.parent.removeChild(g),
|
|
610
585
|
g.release();
|
|
611
586
|
}));
|
|
612
|
-
const graphicCount =
|
|
613
|
-
|
|
587
|
+
const graphicCount = newGraphics.length;
|
|
588
|
+
newGraphics.forEach(((g, index) => {
|
|
614
589
|
g.context.graphicCount = graphicCount, g.context.graphicIndex = index;
|
|
615
|
-
})), this._dataByKey = newGroupedData, this._graphics =
|
|
590
|
+
})), this._dataByKey = newGroupedData, this._graphics = newGraphics, this.needClear = !0;
|
|
616
591
|
}
|
|
617
592
|
_runEncoderOfGraphic(styles, g, attrs = {}) {
|
|
618
593
|
return (0, common_1.runEncoder)(styles, g.context.data[0], attrs);
|
|
@@ -656,8 +631,10 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
656
631
|
var _a;
|
|
657
632
|
const finalAttrs = g.context.finalAttrs, hasStateAnimation = this.hasAnimationByState(g.context.animationState);
|
|
658
633
|
if (g.setAttributes) {
|
|
659
|
-
const
|
|
660
|
-
|
|
634
|
+
const prevAttrs = g.getAttributes(!0), diffAttrs = {};
|
|
635
|
+
Object.keys(finalAttrs).forEach((key => {
|
|
636
|
+
prevAttrs[key] !== finalAttrs[key] && (diffAttrs[key] = finalAttrs[key]);
|
|
637
|
+
})), g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute,
|
|
661
638
|
g.initAttributes({}), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs)),
|
|
662
639
|
hasAnimation && g.setFinalAttributes(finalAttrs);
|
|
663
640
|
} else {
|
|
@@ -747,7 +724,7 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
747
724
|
}
|
|
748
725
|
render() {
|
|
749
726
|
this.isCommited() && (!this.getVisible() || this._skipBeforeLayouted && this.getCompiler().getLayoutState() === interface_2.LayoutState.before || ((0,
|
|
750
|
-
|
|
727
|
+
util_3.log)(`render mark: ${this.getProductId()}, type is ${this.type}`), this.renderInner()),
|
|
751
728
|
this.uncommit());
|
|
752
729
|
}
|
|
753
730
|
updateMarkState(key) {
|
|
@@ -763,7 +740,7 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
763
740
|
this._graphicMap.delete(key), g.parent && g.parent.removeChild(g), g.release && g.release();
|
|
764
741
|
};
|
|
765
742
|
this._graphicMap.forEach(((g, key) => {
|
|
766
|
-
if (g.context.diffState === enum_1.DiffState.exit && !g.isExiting) if (
|
|
743
|
+
if (g.context.diffState === enum_1.DiffState.exit && !g.isExiting) if (this.hasAnimationByState("exit")) {
|
|
767
744
|
g.isExiting = !0;
|
|
768
745
|
const animationConfig = this.getAnimationConfig();
|
|
769
746
|
if (animationConfig.exit && animationConfig.exit.length) {
|
|
@@ -872,8 +849,13 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
872
849
|
var _a;
|
|
873
850
|
(null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.beforeTransformProgressive) ? this._runBeforeProgressive() : this.renderContext.progressive && this._runProgressiveStep();
|
|
874
851
|
}
|
|
852
|
+
updateAnimationState(callback) {
|
|
853
|
+
this._graphics && this._graphics.length && this._graphics.forEach((g => {
|
|
854
|
+
g.context.animationState = callback(g);
|
|
855
|
+
}));
|
|
856
|
+
}
|
|
875
857
|
hasAnimationByState(state) {
|
|
876
|
-
if (!state || !this._animationConfig || !this._animationConfig[state]
|
|
858
|
+
if (!state || !this._animationConfig || !this._animationConfig[state]) return !1;
|
|
877
859
|
const stateAnimationConfig = this._animationConfig[state];
|
|
878
860
|
return stateAnimationConfig.length > 0 || (0, vutils_1.isObject)(stateAnimationConfig);
|
|
879
861
|
}
|