@visactor/vchart 2.0.0-alpha.4 → 2.0.1-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 +2 -2
- package/build/index.es.js +401 -237
- package/build/index.js +401 -236
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/interface.d.ts +1 -0
- package/cjs/animation/interface.js.map +1 -1
- package/cjs/chart/base/base-chart.d.ts +1 -0
- package/cjs/chart/base/base-chart.js +3 -0
- package/cjs/chart/base/base-chart.js.map +1 -1
- package/cjs/chart/histogram/base/histogram-base-transformer.js +1 -1
- package/cjs/chart/histogram/base/histogram-base-transformer.js.map +1 -1
- package/cjs/chart/interface/chart.d.ts +1 -0
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/compile/compiler.js +6 -2
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/component/axis/interface/common.js.map +1 -1
- package/cjs/component/brush/brush.d.ts +1 -1
- package/cjs/component/brush/brush.js +24 -20
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/brush/interface.d.ts +1 -0
- package/cjs/component/brush/interface.js.map +1 -1
- package/cjs/component/crosshair/base.d.ts +1 -1
- package/cjs/component/crosshair/base.js +5 -4
- package/cjs/component/crosshair/base.js.map +1 -1
- package/cjs/component/crosshair/cartesian.js +3 -2
- package/cjs/component/crosshair/cartesian.js.map +1 -1
- package/cjs/component/crosshair/interface/common.d.ts +3 -1
- package/cjs/component/crosshair/interface/common.js.map +1 -1
- package/cjs/component/crosshair/interface/spec.d.ts +1 -0
- package/cjs/component/crosshair/interface/spec.js.map +1 -1
- package/cjs/component/crosshair/interface/theme.d.ts +2 -0
- package/cjs/component/crosshair/interface/theme.js.map +1 -1
- package/cjs/component/crosshair/utils/cartesian.js +15 -13
- package/cjs/component/crosshair/utils/cartesian.js.map +1 -1
- package/cjs/component/crosshair/utils/common.js +8 -4
- package/cjs/component/crosshair/utils/common.js.map +1 -1
- package/cjs/component/marker/utils.js +14 -9
- package/cjs/component/marker/utils.js.map +1 -1
- package/cjs/component/tooltip/interface/theme.d.ts +3 -0
- package/cjs/component/tooltip/interface/theme.js.map +1 -1
- package/cjs/component/tooltip/tooltip-transformer.js +3 -1
- package/cjs/component/tooltip/tooltip-transformer.js.map +1 -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/vchart.js +6 -7
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +3 -1
- package/cjs/mark/base/base-mark.js +49 -43
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/group.d.ts +1 -1
- package/cjs/mark/group.js +14 -10
- package/cjs/mark/group.js.map +1 -1
- package/cjs/mark/interface/common.d.ts +1 -1
- package/cjs/mark/interface/common.js.map +1 -1
- package/cjs/model/base-model.d.ts +1 -0
- package/cjs/model/base-model.js +1 -0
- package/cjs/model/base-model.js.map +1 -1
- package/cjs/model/interface.d.ts +1 -0
- package/cjs/model/interface.js.map +1 -1
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js +2 -3
- package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
- package/cjs/series/bar/bar.d.ts +3 -0
- package/cjs/series/bar/bar.js +28 -7
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/bar/interface.d.ts +1 -0
- package/cjs/series/bar/interface.js.map +1 -1
- package/cjs/series/base/base-series.js +2 -3
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/funnel/funnel.js +0 -2
- package/cjs/series/funnel/funnel.js.map +1 -1
- package/cjs/series/map/map.js +1 -2
- package/cjs/series/map/map.js.map +1 -1
- package/cjs/series/pie/pie.js +0 -1
- package/cjs/series/pie/pie.js.map +1 -1
- package/cjs/util/mark.d.ts +1 -0
- package/cjs/util/mark.js +10 -1
- package/cjs/util/mark.js.map +1 -1
- package/esm/animation/interface.d.ts +1 -0
- package/esm/animation/interface.js.map +1 -1
- package/esm/chart/base/base-chart.d.ts +1 -0
- package/esm/chart/base/base-chart.js +3 -0
- package/esm/chart/base/base-chart.js.map +1 -1
- package/esm/chart/histogram/base/histogram-base-transformer.js +1 -1
- package/esm/chart/histogram/base/histogram-base-transformer.js.map +1 -1
- package/esm/chart/interface/chart.d.ts +1 -0
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/compile/compiler.js +7 -4
- package/esm/compile/compiler.js.map +1 -1
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/component/axis/interface/common.js.map +1 -1
- package/esm/component/brush/brush.d.ts +1 -1
- package/esm/component/brush/brush.js +24 -20
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/brush/interface.d.ts +1 -0
- package/esm/component/brush/interface.js.map +1 -1
- package/esm/component/crosshair/base.d.ts +1 -1
- package/esm/component/crosshair/base.js +5 -4
- package/esm/component/crosshair/base.js.map +1 -1
- package/esm/component/crosshair/cartesian.js +3 -2
- package/esm/component/crosshair/cartesian.js.map +1 -1
- package/esm/component/crosshair/interface/common.d.ts +3 -1
- package/esm/component/crosshair/interface/common.js.map +1 -1
- package/esm/component/crosshair/interface/spec.d.ts +1 -0
- package/esm/component/crosshair/interface/spec.js.map +1 -1
- package/esm/component/crosshair/interface/theme.d.ts +2 -0
- package/esm/component/crosshair/interface/theme.js.map +1 -1
- package/esm/component/crosshair/utils/cartesian.js +15 -13
- package/esm/component/crosshair/utils/cartesian.js.map +1 -1
- package/esm/component/crosshair/utils/common.js +8 -4
- package/esm/component/crosshair/utils/common.js.map +1 -1
- package/esm/component/marker/utils.js +15 -8
- package/esm/component/marker/utils.js.map +1 -1
- package/esm/component/tooltip/interface/theme.d.ts +3 -0
- package/esm/component/tooltip/interface/theme.js.map +1 -1
- package/esm/component/tooltip/tooltip-transformer.js +3 -1
- package/esm/component/tooltip/tooltip-transformer.js.map +1 -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/vchart.js +5 -6
- package/esm/core/vchart.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +3 -1
- package/esm/mark/base/base-mark.js +50 -42
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/group.d.ts +1 -1
- package/esm/mark/group.js +17 -9
- package/esm/mark/group.js.map +1 -1
- package/esm/mark/interface/common.d.ts +1 -1
- package/esm/mark/interface/common.js.map +1 -1
- package/esm/model/base-model.d.ts +1 -0
- package/esm/model/base-model.js +1 -0
- package/esm/model/base-model.js.map +1 -1
- package/esm/model/interface.d.ts +1 -0
- package/esm/model/interface.js.map +1 -1
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js +2 -3
- package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -1
- package/esm/series/bar/bar.d.ts +3 -0
- package/esm/series/bar/bar.js +26 -7
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/bar/interface.d.ts +1 -0
- package/esm/series/bar/interface.js.map +1 -1
- package/esm/series/base/base-series.js +2 -3
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/funnel/funnel.js +0 -2
- package/esm/series/funnel/funnel.js.map +1 -1
- package/esm/series/map/map.js +1 -2
- package/esm/series/map/map.js.map +1 -1
- package/esm/series/pie/pie.js +0 -1
- package/esm/series/pie/pie.js.map +1 -1
- package/esm/util/mark.d.ts +1 -0
- package/esm/util/mark.js +7 -0
- package/esm/util/mark.js.map +1 -1
- package/package.json +6 -6
|
@@ -50,7 +50,9 @@ import { AnimationStateEnum } from "../../animation/interface";
|
|
|
50
50
|
|
|
51
51
|
import { CompilableData } from "../../compile/data/compilable-data";
|
|
52
52
|
|
|
53
|
-
import {
|
|
53
|
+
import { getDiffAttributesOfGraphic } from "../../util/mark";
|
|
54
|
+
|
|
55
|
+
import { log } from "../../util/debug";
|
|
54
56
|
|
|
55
57
|
import { morph as runMorph } from "../../compile/morph";
|
|
56
58
|
|
|
@@ -108,20 +110,24 @@ export class BaseMark extends GrammarItem {
|
|
|
108
110
|
return this._animationConfig;
|
|
109
111
|
}
|
|
110
112
|
setAnimationConfig(config) {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
const defaultPrams = "group" === this.type ? {
|
|
114
|
+
selfOnly: !0
|
|
115
|
+
} : {}, animationConfig = {};
|
|
116
|
+
Object.keys(config).forEach((key => {
|
|
117
|
+
const value = config[key];
|
|
118
|
+
isArray(value) ? animationConfig[key] = value.map((item => {
|
|
115
119
|
var _a;
|
|
116
120
|
const options = null !== (_a = item.options) && void 0 !== _a ? _a : {};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
return Object.assign(Object.assign(Object.assign({}, defaultPrams), item), {
|
|
122
|
+
options: (...args) => {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
const _options = "function" == typeof options ? options(...args) : options;
|
|
125
|
+
return Object.assign(Object.assign({}, _options), {
|
|
126
|
+
layoutRect: null === (_b = (_a = this.model).getLayoutRect) || void 0 === _b ? void 0 : _b.call(_a)
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
})) : animationConfig[key] = Object.assign(Object.assign({}, defaultPrams), config[key]);
|
|
125
131
|
})), this._animationConfig = animationConfig;
|
|
126
132
|
}
|
|
127
133
|
setSkipBeforeLayouted(skip) {
|
|
@@ -505,6 +511,7 @@ export class BaseMark extends GrammarItem {
|
|
|
505
511
|
this._dataByGroup = groupData(data, this._groupKeyGetter);
|
|
506
512
|
}
|
|
507
513
|
createAnimationStateList(type, animationConfig) {
|
|
514
|
+
var _a;
|
|
508
515
|
let config = animationConfig[type];
|
|
509
516
|
return config && Array.isArray(config) && (config = 1 === config.length ? config[0] : config),
|
|
510
517
|
Array.isArray(config) && (config = config.map(((item, index) => {
|
|
@@ -512,7 +519,9 @@ export class BaseMark extends GrammarItem {
|
|
|
512
519
|
return Object.assign(Object.assign({}, item), {
|
|
513
520
|
priority: null !== (_a = item.priority) && void 0 !== _a ? _a : 1 / 0
|
|
514
521
|
});
|
|
515
|
-
}))), config
|
|
522
|
+
}))), config ? Object.assign(Object.assign({}, config), {
|
|
523
|
+
priority: "normal" === type ? null !== (_a = config.priority) && void 0 !== _a ? _a : 1 / 0 : config.priority
|
|
524
|
+
}) : config;
|
|
516
525
|
}
|
|
517
526
|
tryRunMorphing(graphics) {
|
|
518
527
|
if (this._lastMark) {
|
|
@@ -571,29 +580,32 @@ export class BaseMark extends GrammarItem {
|
|
|
571
580
|
this._product.applyAnimationState([ "normal" ], [ normalConfig ]);
|
|
572
581
|
}
|
|
573
582
|
}
|
|
583
|
+
_setAnimationState(g) {
|
|
584
|
+
const customizedState = this._aniamtionStateCallback ? this._aniamtionStateCallback(g) : void 0;
|
|
585
|
+
g.context.animationState = null != customizedState ? customizedState : g.context.diffState,
|
|
586
|
+
g.context.animationState === DiffState.exit && (g.context.reusing = !0, g.animates && g.animates.forEach((a => a.stop())));
|
|
587
|
+
}
|
|
574
588
|
_runJoin(data) {
|
|
575
|
-
const newGroupedData = this._getDataByKey(data), prevGroupedData = this._prevDataByKey,
|
|
576
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
589
|
+
const newGroupedData = this._getDataByKey(data), prevGroupedData = this._prevDataByKey, allGraphics = [], enterGraphics = new Set(this._graphics.filter((g => g.context.diffState === DiffState.enter))), callback = (key, newData, prevData) => {
|
|
590
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
577
591
|
let g, diffState;
|
|
578
592
|
return isNil(newData) ? (g = this._graphicMap.get(key), g && (diffState = DiffState.exit)) : isNil(prevData) ? (g = this._graphicMap.has(key) ? this._graphicMap.get(key) : {},
|
|
579
|
-
diffState = DiffState.enter, g.isExiting = !1, (
|
|
580
|
-
g
|
|
581
|
-
|
|
582
|
-
newGraphics.push(g))), g && (g.context = Object.assign(Object.assign({}, this._getCommonContext()), {
|
|
593
|
+
diffState = DiffState.enter, g.isExiting = !1, this._graphicMap.set(key, g), allGraphics.push(g)) : (g = this._graphicMap.get(key),
|
|
594
|
+
g && (diffState = DiffState.update, allGraphics.push(g))), g && (enterGraphics.delete(g),
|
|
595
|
+
g.context = Object.assign(Object.assign({}, this._getCommonContext()), {
|
|
583
596
|
diffState: diffState,
|
|
584
|
-
reusing: null === (
|
|
585
|
-
originalFieldX: null === (
|
|
586
|
-
originalFieldY: null === (
|
|
587
|
-
fieldX: null === (
|
|
588
|
-
fieldY: null === (
|
|
589
|
-
|
|
590
|
-
data: null != newData ? newData : null === (_g = g.context) || void 0 === _g ? void 0 : _g.data,
|
|
597
|
+
reusing: null === (_a = g.context) || void 0 === _a ? void 0 : _a.reusing,
|
|
598
|
+
originalFieldX: null === (_b = g.context) || void 0 === _b ? void 0 : _b.originalFieldX,
|
|
599
|
+
originalFieldY: null === (_c = g.context) || void 0 === _c ? void 0 : _c.originalFieldY,
|
|
600
|
+
fieldX: null === (_d = g.context) || void 0 === _d ? void 0 : _d.fieldX,
|
|
601
|
+
fieldY: null === (_e = g.context) || void 0 === _e ? void 0 : _e.fieldY,
|
|
602
|
+
data: null != newData ? newData : null === (_f = g.context) || void 0 === _f ? void 0 : _f.data,
|
|
591
603
|
uniqueKey: key,
|
|
592
|
-
key: newData ? this._keyGetter(newData[0]) : null === (
|
|
593
|
-
groupKey: newData ? this._groupKeyGetter(newData[0]) : null === (
|
|
604
|
+
key: newData ? this._keyGetter(newData[0]) : null === (_g = g.context) || void 0 === _g ? void 0 : _g.key,
|
|
605
|
+
groupKey: newData ? this._groupKeyGetter(newData[0]) : null === (_h = g.context) || void 0 === _h ? void 0 : _h.groupKey,
|
|
594
606
|
indexKey: "__VCHART_DEFAULT_DATA_INDEX",
|
|
595
|
-
stateAnimateConfig: null === (
|
|
596
|
-
}),
|
|
607
|
+
stateAnimateConfig: null === (_j = this.getAnimationConfig()) || void 0 === _j ? void 0 : _j.state
|
|
608
|
+
}), this._setAnimationState(g)), g;
|
|
597
609
|
};
|
|
598
610
|
if (prevGroupedData && newGroupedData) {
|
|
599
611
|
const prevMap = new Map(prevGroupedData.data);
|
|
@@ -612,10 +624,10 @@ export class BaseMark extends GrammarItem {
|
|
|
612
624
|
this._graphicMap.delete(g.context.uniqueKey), g.parent && g.parent.removeChild(g),
|
|
613
625
|
g.release();
|
|
614
626
|
}));
|
|
615
|
-
const graphicCount =
|
|
616
|
-
|
|
627
|
+
const graphicCount = allGraphics.length;
|
|
628
|
+
allGraphics.forEach(((g, index) => {
|
|
617
629
|
g.context.graphicCount = graphicCount, g.context.graphicIndex = index;
|
|
618
|
-
})), this._dataByKey = newGroupedData, this._graphics =
|
|
630
|
+
})), this._dataByKey = newGroupedData, this._graphics = allGraphics, this.needClear = !0;
|
|
619
631
|
}
|
|
620
632
|
_runEncoderOfGraphic(styles, g, attrs = {}) {
|
|
621
633
|
return runEncoder(styles, g.context.data[0], attrs);
|
|
@@ -659,10 +671,8 @@ export class BaseMark extends GrammarItem {
|
|
|
659
671
|
var _a;
|
|
660
672
|
const finalAttrs = g.context.finalAttrs, hasStateAnimation = this.hasAnimationByState(g.context.animationState);
|
|
661
673
|
if (g.setAttributes) {
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
prevAttrs[key] !== finalAttrs[key] && (diffAttrs[key] = finalAttrs[key]);
|
|
665
|
-
})), g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute,
|
|
674
|
+
const diffAttrs = getDiffAttributesOfGraphic(g, finalAttrs);
|
|
675
|
+
g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute,
|
|
666
676
|
g.initAttributes({}), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs)),
|
|
667
677
|
hasAnimation && g.setFinalAttributes(finalAttrs);
|
|
668
678
|
} else {
|
|
@@ -766,7 +776,7 @@ export class BaseMark extends GrammarItem {
|
|
|
766
776
|
this._graphicMap.delete(key), g.parent && g.parent.removeChild(g), g.release && g.release();
|
|
767
777
|
};
|
|
768
778
|
this._graphicMap.forEach(((g, key) => {
|
|
769
|
-
if (g.context.diffState === DiffState.exit && !g.isExiting) if (this.hasAnimationByState("exit")) {
|
|
779
|
+
if (g.context.diffState === DiffState.exit && !g.isExiting) if (g.context.animationState === DiffState.exit && this.hasAnimationByState("exit")) {
|
|
770
780
|
g.isExiting = !0;
|
|
771
781
|
const animationConfig = this.getAnimationConfig();
|
|
772
782
|
if (animationConfig.exit && animationConfig.exit.length) {
|
|
@@ -876,9 +886,7 @@ export class BaseMark extends GrammarItem {
|
|
|
876
886
|
(null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.beforeTransformProgressive) ? this._runBeforeProgressive() : this.renderContext.progressive && this._runProgressiveStep();
|
|
877
887
|
}
|
|
878
888
|
updateAnimationState(callback) {
|
|
879
|
-
this.
|
|
880
|
-
g.context.animationState = callback(g);
|
|
881
|
-
}));
|
|
889
|
+
this._aniamtionStateCallback = callback;
|
|
882
890
|
}
|
|
883
891
|
hasAnimationByState(state) {
|
|
884
892
|
if (!state || !this._animationConfig || !this._animationConfig[state]) return !1;
|