@visactor/vchart 2.0.1-alpha.2 → 2.0.1-alpha.4
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 +176 -76
- package/build/index.js +176 -76
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/index.js +2 -1
- package/cjs/animation/interface.js +1 -2
- package/cjs/chart/base/base-chart.js +2 -8
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/compile/compiler.d.ts +1 -0
- package/cjs/compile/compiler.js +3 -0
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/interface/compilable-item.d.ts +1 -0
- package/cjs/compile/interface/compilable-item.js.map +1 -1
- package/cjs/component/axis/cartesian/band-axis.d.ts +8 -0
- package/cjs/component/axis/cartesian/band-axis.js +9 -0
- package/cjs/component/axis/cartesian/band-axis.js.map +1 -1
- package/cjs/component/axis/mixin/band-axis-mixin.d.ts +2 -0
- package/cjs/component/axis/mixin/band-axis-mixin.js +15 -1
- package/cjs/component/axis/mixin/band-axis-mixin.js.map +1 -1
- package/cjs/component/tooltip/tooltip.js +2 -1
- package/cjs/component/tooltip/tooltip.js.map +1 -1
- package/cjs/component/util.js +2 -1
- package/cjs/constant/attribute.js +1 -2
- package/cjs/constant/sunburst.js +2 -1
- package/cjs/constant/waterfall.js +1 -2
- 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 +1 -0
- package/cjs/core/vchart.js +29 -9
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +4 -2
- package/cjs/mark/base/base-mark.js +38 -22
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/group.d.ts +3 -2
- package/cjs/mark/group.js +7 -9
- package/cjs/mark/group.js.map +1 -1
- package/cjs/mark/interface/common.d.ts +4 -1
- package/cjs/mark/interface/common.js.map +1 -1
- package/cjs/model/base-model.d.ts +4 -1
- package/cjs/model/base-model.js +6 -0
- package/cjs/model/base-model.js.map +1 -1
- package/cjs/model/interface.d.ts +3 -1
- 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/esm/animation/index.js +2 -1
- package/esm/animation/interface.js +1 -2
- package/esm/chart/base/base-chart.js +2 -8
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/compile/compiler.d.ts +1 -0
- package/esm/compile/compiler.js +3 -0
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/interface/compilable-item.d.ts +1 -0
- package/esm/compile/interface/compilable-item.js.map +1 -1
- package/esm/component/axis/cartesian/band-axis.d.ts +8 -0
- package/esm/component/axis/cartesian/band-axis.js +9 -1
- package/esm/component/axis/cartesian/band-axis.js.map +1 -1
- package/esm/component/axis/mixin/band-axis-mixin.d.ts +2 -0
- package/esm/component/axis/mixin/band-axis-mixin.js +15 -1
- package/esm/component/axis/mixin/band-axis-mixin.js.map +1 -1
- package/esm/component/tooltip/tooltip.js +2 -1
- package/esm/component/tooltip/tooltip.js.map +1 -1
- package/esm/component/util.js +2 -1
- package/esm/constant/attribute.js +1 -2
- package/esm/constant/sunburst.js +2 -1
- package/esm/constant/waterfall.js +1 -2
- 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 +1 -0
- package/esm/core/vchart.js +29 -9
- package/esm/core/vchart.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +4 -2
- package/esm/mark/base/base-mark.js +37 -22
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/group.d.ts +3 -2
- package/esm/mark/group.js +7 -9
- package/esm/mark/group.js.map +1 -1
- package/esm/mark/interface/common.d.ts +4 -1
- package/esm/mark/interface/common.js.map +1 -1
- package/esm/model/base-model.d.ts +4 -1
- package/esm/model/base-model.js +6 -0
- package/esm/model/base-model.js.map +1 -1
- package/esm/model/interface.d.ts +3 -1
- package/esm/model/interface.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/utils/style.js +5 -4
- package/esm/plugin/components/tooltip-handler/utils/style.js.map +1 -1
- package/esm/region/region.js.map +1 -1
- package/package.json +8 -8
- package/cjs/animation/animate-manager.d.ts +0 -1
- package/cjs/animation/animate-manager.js +0 -2
- package/cjs/animation/animate-manager.js.map +0 -1
- package/esm/animation/animate-manager.d.ts +0 -1
- package/esm/animation/animate-manager.js +0 -2
- package/esm/animation/animate-manager.js.map +0 -1
|
@@ -112,24 +112,36 @@ export class BaseMark extends GrammarItem {
|
|
|
112
112
|
setAnimationConfig(config) {
|
|
113
113
|
const defaultPrams = "group" === this.type ? {
|
|
114
114
|
selfOnly: !0
|
|
115
|
-
} : {},
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const _options = "function" == typeof options ? options(...args) : options;
|
|
115
|
+
} : {}, formatAnimationCfg = cfg => {
|
|
116
|
+
var _a;
|
|
117
|
+
const options = null !== (_a = cfg.options) && void 0 !== _a ? _a : {};
|
|
118
|
+
return Object.assign(Object.assign(Object.assign({}, defaultPrams), cfg), {
|
|
119
|
+
options: (datum, graphic, customParams) => {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
const _options = "function" == typeof options ? options(datum, graphic, customParams) : options;
|
|
122
|
+
if (graphic && graphic.context && graphic.context.compiler && isValid(graphic.context.modelId)) {
|
|
123
|
+
const model = null === (_a = graphic.context.compiler.getChart()) || void 0 === _a ? void 0 : _a.getModelById(graphic.context.modelId);
|
|
125
124
|
return Object.assign(Object.assign({}, _options), {
|
|
126
|
-
layoutRect: null === (_b =
|
|
125
|
+
layoutRect: null === (_b = null == model ? void 0 : model.getLayoutRect) || void 0 === _b ? void 0 : _b.call(model)
|
|
127
126
|
});
|
|
128
127
|
}
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
return Object.assign({}, _options);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}, animationConfig = {};
|
|
132
|
+
Object.keys(config).forEach((key => {
|
|
133
|
+
const value = config[key];
|
|
134
|
+
isArray(value) ? animationConfig[key] = value.map(formatAnimationCfg) : isValid(value) && (animationConfig[key] = formatAnimationCfg(value));
|
|
131
135
|
})), this._animationConfig = animationConfig;
|
|
132
136
|
}
|
|
137
|
+
disableAnimationByState(state) {
|
|
138
|
+
const states = array(state);
|
|
139
|
+
this._disabledAnimationStates = [ ...new Set([ ...this._disabledAnimationStates, ...states ]) ];
|
|
140
|
+
}
|
|
141
|
+
enableAnimationByState(state) {
|
|
142
|
+
const states = array(state);
|
|
143
|
+
this._disabledAnimationStates = this._disabledAnimationStates.filter((s => !states.includes(s)));
|
|
144
|
+
}
|
|
133
145
|
setSkipBeforeLayouted(skip) {
|
|
134
146
|
this._skipBeforeLayouted = skip;
|
|
135
147
|
}
|
|
@@ -214,9 +226,9 @@ export class BaseMark extends GrammarItem {
|
|
|
214
226
|
super(option), this.type = void 0, this.name = "mark", this._markConfig = {
|
|
215
227
|
zIndex: LayoutZIndex.Mark,
|
|
216
228
|
morph: !1
|
|
217
|
-
}, this._visible = !0, this.stateStyle = {}, this._unCompileChannel = {}, this.
|
|
218
|
-
this.
|
|
219
|
-
this._graphics = [], this._getEncoderOfStyle = (stateName, style) => {
|
|
229
|
+
}, this._visible = !0, this.stateStyle = {}, this._unCompileChannel = {}, this._disabledAnimationStates = [],
|
|
230
|
+
this._skipBeforeLayouted = !1, this._extensionChannel = {}, this._computeExChannel = {},
|
|
231
|
+
this._graphicMap = new Map, this._graphics = [], this._getEncoderOfStyle = (stateName, style) => {
|
|
220
232
|
if (style && stateName) {
|
|
221
233
|
const validEncoder = {};
|
|
222
234
|
return Object.keys(style).forEach((key => {
|
|
@@ -461,6 +473,7 @@ export class BaseMark extends GrammarItem {
|
|
|
461
473
|
}
|
|
462
474
|
_getCommonContext() {
|
|
463
475
|
return {
|
|
476
|
+
compiler: this.getCompiler(),
|
|
464
477
|
markType: this.type,
|
|
465
478
|
markId: this.id,
|
|
466
479
|
modelId: this.model.id,
|
|
@@ -476,7 +489,7 @@ export class BaseMark extends GrammarItem {
|
|
|
476
489
|
this._graphicMap = mark._graphicMap, this._graphicMap.forEach((g => {
|
|
477
490
|
g.context = Object.assign(Object.assign({}, g.context), this._getCommonContext());
|
|
478
491
|
})), this._dataByKey = mark._dataByKey, this._prevDataByKey = mark._prevDataByKey,
|
|
479
|
-
this.needClear = mark.needClear
|
|
492
|
+
this.needClear = mark.needClear);
|
|
480
493
|
}
|
|
481
494
|
_parseProgressiveContext(data) {
|
|
482
495
|
const enableProgressive = this._markConfig.progressiveStep > 0 && this._markConfig.progressiveThreshold > 0 && this._markConfig.progressiveStep < this._markConfig.progressiveThreshold, large = this._markConfig.large && this._markConfig.largeThreshold > 0 && data.length >= this._markConfig.largeThreshold;
|
|
@@ -581,7 +594,12 @@ export class BaseMark extends GrammarItem {
|
|
|
581
594
|
}
|
|
582
595
|
}
|
|
583
596
|
_setAnimationState(g) {
|
|
584
|
-
|
|
597
|
+
var _a, _b, _c;
|
|
598
|
+
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 => {
|
|
599
|
+
var _a;
|
|
600
|
+
const diffState = null === (_a = g.context) || void 0 === _a ? void 0 : _a.diffState;
|
|
601
|
+
return diffState === AnimationStateEnum.exit ? AnimationStateEnum.exit : diffState === AnimationStateEnum.update ? AnimationStateEnum.update : AnimationStateEnum.appear;
|
|
602
|
+
}), customizedState = callback(g);
|
|
585
603
|
g.context.animationState = null != customizedState ? customizedState : g.context.diffState,
|
|
586
604
|
g.context.animationState === DiffState.exit && (g.context.reusing = !0, g.animates && g.animates.forEach((a => a.stop())));
|
|
587
605
|
}
|
|
@@ -885,11 +903,8 @@ export class BaseMark extends GrammarItem {
|
|
|
885
903
|
var _a;
|
|
886
904
|
(null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.beforeTransformProgressive) ? this._runBeforeProgressive() : this.renderContext.progressive && this._runProgressiveStep();
|
|
887
905
|
}
|
|
888
|
-
updateAnimationState(callback) {
|
|
889
|
-
this._aniamtionStateCallback = callback;
|
|
890
|
-
}
|
|
891
906
|
hasAnimationByState(state) {
|
|
892
|
-
if (!state || !this._animationConfig || !this._animationConfig[state]) return !1;
|
|
907
|
+
if (!state || !this._animationConfig || !this._animationConfig[state] || this._disabledAnimationStates.includes(state)) return !1;
|
|
893
908
|
const stateAnimationConfig = this._animationConfig[state];
|
|
894
909
|
return stateAnimationConfig.length > 0 || isObject(stateAnimationConfig);
|
|
895
910
|
}
|