@visactor/vchart 2.0.0 → 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 +1 -1
- package/build/index.es.js +178 -121
- package/build/index.js +178 -120
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +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/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.js +6 -6
- 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 +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/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 +33 -31
- 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/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/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/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.js +6 -6
- 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 +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/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 +34 -30
- 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/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
|
|
|
@@ -509,6 +511,7 @@ export class BaseMark extends GrammarItem {
|
|
|
509
511
|
this._dataByGroup = groupData(data, this._groupKeyGetter);
|
|
510
512
|
}
|
|
511
513
|
createAnimationStateList(type, animationConfig) {
|
|
514
|
+
var _a;
|
|
512
515
|
let config = animationConfig[type];
|
|
513
516
|
return config && Array.isArray(config) && (config = 1 === config.length ? config[0] : config),
|
|
514
517
|
Array.isArray(config) && (config = config.map(((item, index) => {
|
|
@@ -516,7 +519,9 @@ export class BaseMark extends GrammarItem {
|
|
|
516
519
|
return Object.assign(Object.assign({}, item), {
|
|
517
520
|
priority: null !== (_a = item.priority) && void 0 !== _a ? _a : 1 / 0
|
|
518
521
|
});
|
|
519
|
-
}))), 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;
|
|
520
525
|
}
|
|
521
526
|
tryRunMorphing(graphics) {
|
|
522
527
|
if (this._lastMark) {
|
|
@@ -575,29 +580,32 @@ export class BaseMark extends GrammarItem {
|
|
|
575
580
|
this._product.applyAnimationState([ "normal" ], [ normalConfig ]);
|
|
576
581
|
}
|
|
577
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
|
+
}
|
|
578
588
|
_runJoin(data) {
|
|
579
|
-
const newGroupedData = this._getDataByKey(data), prevGroupedData = this._prevDataByKey,
|
|
580
|
-
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;
|
|
581
591
|
let g, diffState;
|
|
582
592
|
return isNil(newData) ? (g = this._graphicMap.get(key), g && (diffState = DiffState.exit)) : isNil(prevData) ? (g = this._graphicMap.has(key) ? this._graphicMap.get(key) : {},
|
|
583
|
-
diffState = DiffState.enter, g.isExiting = !1, (
|
|
584
|
-
g
|
|
585
|
-
|
|
586
|
-
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()), {
|
|
587
596
|
diffState: diffState,
|
|
588
|
-
reusing: null === (
|
|
589
|
-
originalFieldX: null === (
|
|
590
|
-
originalFieldY: null === (
|
|
591
|
-
fieldX: null === (
|
|
592
|
-
fieldY: null === (
|
|
593
|
-
|
|
594
|
-
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,
|
|
595
603
|
uniqueKey: key,
|
|
596
|
-
key: newData ? this._keyGetter(newData[0]) : null === (
|
|
597
|
-
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,
|
|
598
606
|
indexKey: "__VCHART_DEFAULT_DATA_INDEX",
|
|
599
|
-
stateAnimateConfig: null === (
|
|
600
|
-
}),
|
|
607
|
+
stateAnimateConfig: null === (_j = this.getAnimationConfig()) || void 0 === _j ? void 0 : _j.state
|
|
608
|
+
}), this._setAnimationState(g)), g;
|
|
601
609
|
};
|
|
602
610
|
if (prevGroupedData && newGroupedData) {
|
|
603
611
|
const prevMap = new Map(prevGroupedData.data);
|
|
@@ -616,10 +624,10 @@ export class BaseMark extends GrammarItem {
|
|
|
616
624
|
this._graphicMap.delete(g.context.uniqueKey), g.parent && g.parent.removeChild(g),
|
|
617
625
|
g.release();
|
|
618
626
|
}));
|
|
619
|
-
const graphicCount =
|
|
620
|
-
|
|
627
|
+
const graphicCount = allGraphics.length;
|
|
628
|
+
allGraphics.forEach(((g, index) => {
|
|
621
629
|
g.context.graphicCount = graphicCount, g.context.graphicIndex = index;
|
|
622
|
-
})), this._dataByKey = newGroupedData, this._graphics =
|
|
630
|
+
})), this._dataByKey = newGroupedData, this._graphics = allGraphics, this.needClear = !0;
|
|
623
631
|
}
|
|
624
632
|
_runEncoderOfGraphic(styles, g, attrs = {}) {
|
|
625
633
|
return runEncoder(styles, g.context.data[0], attrs);
|
|
@@ -663,10 +671,8 @@ export class BaseMark extends GrammarItem {
|
|
|
663
671
|
var _a;
|
|
664
672
|
const finalAttrs = g.context.finalAttrs, hasStateAnimation = this.hasAnimationByState(g.context.animationState);
|
|
665
673
|
if (g.setAttributes) {
|
|
666
|
-
const
|
|
667
|
-
|
|
668
|
-
prevAttrs[key] !== finalAttrs[key] && (diffAttrs[key] = finalAttrs[key]);
|
|
669
|
-
})), 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,
|
|
670
676
|
g.initAttributes({}), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs)),
|
|
671
677
|
hasAnimation && g.setFinalAttributes(finalAttrs);
|
|
672
678
|
} else {
|
|
@@ -770,7 +776,7 @@ export class BaseMark extends GrammarItem {
|
|
|
770
776
|
this._graphicMap.delete(key), g.parent && g.parent.removeChild(g), g.release && g.release();
|
|
771
777
|
};
|
|
772
778
|
this._graphicMap.forEach(((g, key) => {
|
|
773
|
-
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")) {
|
|
774
780
|
g.isExiting = !0;
|
|
775
781
|
const animationConfig = this.getAnimationConfig();
|
|
776
782
|
if (animationConfig.exit && animationConfig.exit.length) {
|
|
@@ -880,9 +886,7 @@ export class BaseMark extends GrammarItem {
|
|
|
880
886
|
(null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.beforeTransformProgressive) ? this._runBeforeProgressive() : this.renderContext.progressive && this._runProgressiveStep();
|
|
881
887
|
}
|
|
882
888
|
updateAnimationState(callback) {
|
|
883
|
-
this.
|
|
884
|
-
g.context.animationState = callback(g);
|
|
885
|
-
}));
|
|
889
|
+
this._aniamtionStateCallback = callback;
|
|
886
890
|
}
|
|
887
891
|
hasAnimationByState(state) {
|
|
888
892
|
if (!state || !this._animationConfig || !this._animationConfig[state]) return !1;
|