@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
|
@@ -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"), mark_2 = require("../../util/mark"), debug_1 = require("../../util/debug"), morph_1 = require("../../compile/morph");
|
|
18
18
|
|
|
19
19
|
class BaseMark extends grammar_item_1.GrammarItem {
|
|
20
20
|
commit(render, recursion) {
|
|
@@ -70,20 +70,24 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
70
70
|
return this._animationConfig;
|
|
71
71
|
}
|
|
72
72
|
setAnimationConfig(config) {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
const defaultPrams = "group" === this.type ? {
|
|
74
|
+
selfOnly: !0
|
|
75
|
+
} : {}, animationConfig = {};
|
|
76
|
+
Object.keys(config).forEach((key => {
|
|
77
|
+
const value = config[key];
|
|
78
|
+
(0, vutils_1.isArray)(value) ? animationConfig[key] = value.map((item => {
|
|
77
79
|
var _a;
|
|
78
80
|
const options = null !== (_a = item.options) && void 0 !== _a ? _a : {};
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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;
|
|
85
|
+
return Object.assign(Object.assign({}, _options), {
|
|
86
|
+
layoutRect: null === (_b = (_a = this.model).getLayoutRect) || void 0 === _b ? void 0 : _b.call(_a)
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
})) : animationConfig[key] = Object.assign(Object.assign({}, defaultPrams), config[key]);
|
|
87
91
|
})), this._animationConfig = animationConfig;
|
|
88
92
|
}
|
|
89
93
|
setSkipBeforeLayouted(skip) {
|
|
@@ -472,6 +476,7 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
472
476
|
this._dataByGroup = (0, common_1.groupData)(data, this._groupKeyGetter);
|
|
473
477
|
}
|
|
474
478
|
createAnimationStateList(type, animationConfig) {
|
|
479
|
+
var _a;
|
|
475
480
|
let config = animationConfig[type];
|
|
476
481
|
return config && Array.isArray(config) && (config = 1 === config.length ? config[0] : config),
|
|
477
482
|
Array.isArray(config) && (config = config.map(((item, index) => {
|
|
@@ -479,7 +484,9 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
479
484
|
return Object.assign(Object.assign({}, item), {
|
|
480
485
|
priority: null !== (_a = item.priority) && void 0 !== _a ? _a : 1 / 0
|
|
481
486
|
});
|
|
482
|
-
}))), config
|
|
487
|
+
}))), config ? Object.assign(Object.assign({}, config), {
|
|
488
|
+
priority: "normal" === type ? null !== (_a = config.priority) && void 0 !== _a ? _a : 1 / 0 : config.priority
|
|
489
|
+
}) : config;
|
|
483
490
|
}
|
|
484
491
|
tryRunMorphing(graphics) {
|
|
485
492
|
if (this._lastMark) {
|
|
@@ -538,30 +545,33 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
538
545
|
this._product.applyAnimationState([ "normal" ], [ normalConfig ]);
|
|
539
546
|
}
|
|
540
547
|
}
|
|
548
|
+
_setAnimationState(g) {
|
|
549
|
+
const customizedState = this._aniamtionStateCallback ? this._aniamtionStateCallback(g) : void 0;
|
|
550
|
+
g.context.animationState = null != customizedState ? customizedState : g.context.diffState,
|
|
551
|
+
g.context.animationState === enum_1.DiffState.exit && (g.context.reusing = !0, g.animates && g.animates.forEach((a => a.stop())));
|
|
552
|
+
}
|
|
541
553
|
_runJoin(data) {
|
|
542
|
-
const newGroupedData = this._getDataByKey(data), prevGroupedData = this._prevDataByKey,
|
|
543
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
554
|
+
const newGroupedData = this._getDataByKey(data), prevGroupedData = this._prevDataByKey, allGraphics = [], enterGraphics = new Set(this._graphics.filter((g => g.context.diffState === enum_1.DiffState.enter))), callback = (key, newData, prevData) => {
|
|
555
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
544
556
|
let g, diffState;
|
|
545
557
|
return (0, vutils_1.isNil)(newData) ? (g = this._graphicMap.get(key), g && (diffState = enum_1.DiffState.exit)) : (0,
|
|
546
558
|
vutils_1.isNil)(prevData) ? (g = this._graphicMap.has(key) ? this._graphicMap.get(key) : {},
|
|
547
|
-
diffState = enum_1.DiffState.enter, g.isExiting = !1, (
|
|
548
|
-
g
|
|
549
|
-
|
|
550
|
-
newGraphics.push(g))), g && (g.context = Object.assign(Object.assign({}, this._getCommonContext()), {
|
|
559
|
+
diffState = enum_1.DiffState.enter, g.isExiting = !1, this._graphicMap.set(key, g),
|
|
560
|
+
allGraphics.push(g)) : (g = this._graphicMap.get(key), g && (diffState = enum_1.DiffState.update,
|
|
561
|
+
allGraphics.push(g))), g && (enterGraphics.delete(g), g.context = Object.assign(Object.assign({}, this._getCommonContext()), {
|
|
551
562
|
diffState: diffState,
|
|
552
|
-
reusing: null === (
|
|
553
|
-
originalFieldX: null === (
|
|
554
|
-
originalFieldY: null === (
|
|
555
|
-
fieldX: null === (
|
|
556
|
-
fieldY: null === (
|
|
557
|
-
|
|
558
|
-
data: null != newData ? newData : null === (_g = g.context) || void 0 === _g ? void 0 : _g.data,
|
|
563
|
+
reusing: null === (_a = g.context) || void 0 === _a ? void 0 : _a.reusing,
|
|
564
|
+
originalFieldX: null === (_b = g.context) || void 0 === _b ? void 0 : _b.originalFieldX,
|
|
565
|
+
originalFieldY: null === (_c = g.context) || void 0 === _c ? void 0 : _c.originalFieldY,
|
|
566
|
+
fieldX: null === (_d = g.context) || void 0 === _d ? void 0 : _d.fieldX,
|
|
567
|
+
fieldY: null === (_e = g.context) || void 0 === _e ? void 0 : _e.fieldY,
|
|
568
|
+
data: null != newData ? newData : null === (_f = g.context) || void 0 === _f ? void 0 : _f.data,
|
|
559
569
|
uniqueKey: key,
|
|
560
|
-
key: newData ? this._keyGetter(newData[0]) : null === (
|
|
561
|
-
groupKey: newData ? this._groupKeyGetter(newData[0]) : null === (
|
|
570
|
+
key: newData ? this._keyGetter(newData[0]) : null === (_g = g.context) || void 0 === _g ? void 0 : _g.key,
|
|
571
|
+
groupKey: newData ? this._groupKeyGetter(newData[0]) : null === (_h = g.context) || void 0 === _h ? void 0 : _h.groupKey,
|
|
562
572
|
indexKey: "__VCHART_DEFAULT_DATA_INDEX",
|
|
563
|
-
stateAnimateConfig: null === (
|
|
564
|
-
}),
|
|
573
|
+
stateAnimateConfig: null === (_j = this.getAnimationConfig()) || void 0 === _j ? void 0 : _j.state
|
|
574
|
+
}), this._setAnimationState(g)), g;
|
|
565
575
|
};
|
|
566
576
|
if (prevGroupedData && newGroupedData) {
|
|
567
577
|
const prevMap = new Map(prevGroupedData.data);
|
|
@@ -580,10 +590,10 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
580
590
|
this._graphicMap.delete(g.context.uniqueKey), g.parent && g.parent.removeChild(g),
|
|
581
591
|
g.release();
|
|
582
592
|
}));
|
|
583
|
-
const graphicCount =
|
|
584
|
-
|
|
593
|
+
const graphicCount = allGraphics.length;
|
|
594
|
+
allGraphics.forEach(((g, index) => {
|
|
585
595
|
g.context.graphicCount = graphicCount, g.context.graphicIndex = index;
|
|
586
|
-
})), this._dataByKey = newGroupedData, this._graphics =
|
|
596
|
+
})), this._dataByKey = newGroupedData, this._graphics = allGraphics, this.needClear = !0;
|
|
587
597
|
}
|
|
588
598
|
_runEncoderOfGraphic(styles, g, attrs = {}) {
|
|
589
599
|
return (0, common_1.runEncoder)(styles, g.context.data[0], attrs);
|
|
@@ -627,10 +637,8 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
627
637
|
var _a;
|
|
628
638
|
const finalAttrs = g.context.finalAttrs, hasStateAnimation = this.hasAnimationByState(g.context.animationState);
|
|
629
639
|
if (g.setAttributes) {
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
prevAttrs[key] !== finalAttrs[key] && (diffAttrs[key] = finalAttrs[key]);
|
|
633
|
-
})), g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute,
|
|
640
|
+
const diffAttrs = (0, mark_2.getDiffAttributesOfGraphic)(g, finalAttrs);
|
|
641
|
+
g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute,
|
|
634
642
|
g.initAttributes({}), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs)),
|
|
635
643
|
hasAnimation && g.setFinalAttributes(finalAttrs);
|
|
636
644
|
} else {
|
|
@@ -720,7 +728,7 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
720
728
|
}
|
|
721
729
|
render() {
|
|
722
730
|
this.isCommited() && (!this.getVisible() || this._skipBeforeLayouted && this.getCompiler().getLayoutState() === interface_2.LayoutState.before || ((0,
|
|
723
|
-
|
|
731
|
+
debug_1.log)(`render mark: ${this.getProductId()}, type is ${this.type}`), this.renderInner()),
|
|
724
732
|
this.uncommit());
|
|
725
733
|
}
|
|
726
734
|
updateMarkState(key) {
|
|
@@ -736,7 +744,7 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
736
744
|
this._graphicMap.delete(key), g.parent && g.parent.removeChild(g), g.release && g.release();
|
|
737
745
|
};
|
|
738
746
|
this._graphicMap.forEach(((g, key) => {
|
|
739
|
-
if (g.context.diffState === enum_1.DiffState.exit && !g.isExiting) if (this.hasAnimationByState("exit")) {
|
|
747
|
+
if (g.context.diffState === enum_1.DiffState.exit && !g.isExiting) if (g.context.animationState === enum_1.DiffState.exit && this.hasAnimationByState("exit")) {
|
|
740
748
|
g.isExiting = !0;
|
|
741
749
|
const animationConfig = this.getAnimationConfig();
|
|
742
750
|
if (animationConfig.exit && animationConfig.exit.length) {
|
|
@@ -846,9 +854,7 @@ class BaseMark extends grammar_item_1.GrammarItem {
|
|
|
846
854
|
(null === (_a = this.renderContext) || void 0 === _a ? void 0 : _a.beforeTransformProgressive) ? this._runBeforeProgressive() : this.renderContext.progressive && this._runProgressiveStep();
|
|
847
855
|
}
|
|
848
856
|
updateAnimationState(callback) {
|
|
849
|
-
this.
|
|
850
|
-
g.context.animationState = callback(g);
|
|
851
|
-
}));
|
|
857
|
+
this._aniamtionStateCallback = callback;
|
|
852
858
|
}
|
|
853
859
|
hasAnimationByState(state) {
|
|
854
860
|
if (!state || !this._animationConfig || !this._animationConfig[state]) return !1;
|