@visactor/vchart 2.0.23-alpha.6 → 2.1.0-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 +3 -3
- package/build/index.es.js +21465 -16956
- package/build/index.js +21467 -16958
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/compile/compiler.d.ts +4 -0
- package/cjs/compile/compiler.js +66 -41
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/interface/compiler.d.ts +2 -1
- package/cjs/compile/interface/compiler.js.map +1 -1
- package/cjs/compile/stage-app.d.ts +9 -0
- package/cjs/compile/stage-app.js +39 -0
- package/cjs/compile/stage-app.js.map +1 -0
- package/cjs/component/brush/brush.js +13 -12
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/marker/mark-line/cartesian-mark-line.js +7 -18
- package/cjs/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
- package/cjs/component/marker/mark-line/interface/spec.d.ts +2 -9
- package/cjs/component/marker/mark-line/interface/spec.js.map +1 -1
- package/cjs/component/util.js +2 -1
- package/cjs/constant/attribute.js +1 -2
- package/cjs/constant/scroll-bar.js +2 -1
- package/cjs/constant/waterfall.js +1 -2
- package/cjs/core/factory.js +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/instance-manager.js +1 -1
- package/cjs/env/env.js +1 -1
- package/cjs/env/index.js +1 -1
- package/cjs/interaction/interaction.js +11 -8
- package/cjs/interaction/interaction.js.map +1 -1
- package/cjs/interaction/triggers/element-active-by-legend.js +3 -2
- package/cjs/interaction/triggers/element-active-by-legend.js.map +1 -1
- package/cjs/interaction/triggers/element-active.js +4 -3
- package/cjs/interaction/triggers/element-active.js.map +1 -1
- package/cjs/interaction/triggers/element-highlight-by-group.js +3 -2
- package/cjs/interaction/triggers/element-highlight-by-group.js.map +1 -1
- package/cjs/interaction/triggers/element-highlight-by-legend.js +2 -2
- package/cjs/interaction/triggers/element-highlight-by-legend.js.map +1 -1
- package/cjs/interaction/triggers/element-highlight-by-name.js +2 -2
- package/cjs/interaction/triggers/element-highlight-by-name.js.map +1 -1
- package/cjs/interaction/triggers/element-highlight.js +2 -2
- package/cjs/interaction/triggers/element-highlight.js.map +1 -1
- package/cjs/interaction/triggers/element-select.js +3 -3
- package/cjs/interaction/triggers/element-select.js.map +1 -1
- package/cjs/mark/base/base-mark.d.ts +1 -0
- package/cjs/mark/base/base-mark.js +29 -15
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/utils/glyph.js +3 -2
- package/cjs/mark/utils/glyph.js.map +1 -1
- package/cjs/series/sankey/sankey.js +32 -24
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/cjs/util/graphic-state.d.ts +3 -0
- package/cjs/util/graphic-state.js +25 -0
- package/cjs/util/graphic-state.js.map +1 -0
- package/esm/compile/compiler.d.ts +4 -0
- package/esm/compile/compiler.js +68 -40
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/interface/compiler.d.ts +2 -1
- package/esm/compile/interface/compiler.js.map +1 -1
- package/esm/compile/stage-app.d.ts +9 -0
- package/esm/compile/stage-app.js +35 -0
- package/esm/compile/stage-app.js.map +1 -0
- package/esm/component/brush/brush.js +9 -7
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/marker/mark-line/cartesian-mark-line.js +8 -18
- package/esm/component/marker/mark-line/cartesian-mark-line.js.map +1 -1
- package/esm/component/marker/mark-line/interface/spec.d.ts +2 -9
- package/esm/component/marker/mark-line/interface/spec.js.map +1 -1
- package/esm/component/util.js +2 -1
- package/esm/constant/attribute.js +1 -2
- package/esm/constant/scroll-bar.js +2 -1
- package/esm/constant/waterfall.js +1 -2
- package/esm/core/factory.js +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/instance-manager.js +1 -1
- package/esm/env/env.js +1 -1
- package/esm/env/index.js +1 -1
- package/esm/interaction/interaction.js +10 -8
- package/esm/interaction/interaction.js.map +1 -1
- package/esm/interaction/triggers/element-active-by-legend.js +3 -1
- package/esm/interaction/triggers/element-active-by-legend.js.map +1 -1
- package/esm/interaction/triggers/element-active.js +4 -2
- package/esm/interaction/triggers/element-active.js.map +1 -1
- package/esm/interaction/triggers/element-highlight-by-group.js +4 -1
- package/esm/interaction/triggers/element-highlight-by-group.js.map +1 -1
- package/esm/interaction/triggers/element-highlight-by-legend.js +3 -1
- package/esm/interaction/triggers/element-highlight-by-legend.js.map +1 -1
- package/esm/interaction/triggers/element-highlight-by-name.js +3 -1
- package/esm/interaction/triggers/element-highlight-by-name.js.map +1 -1
- package/esm/interaction/triggers/element-highlight.js +3 -1
- package/esm/interaction/triggers/element-highlight.js.map +1 -1
- package/esm/interaction/triggers/element-select.js +4 -2
- package/esm/interaction/triggers/element-select.js.map +1 -1
- package/esm/mark/base/base-mark.d.ts +1 -0
- package/esm/mark/base/base-mark.js +29 -14
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/utils/glyph.js +3 -1
- package/esm/mark/utils/glyph.js.map +1 -1
- package/esm/series/sankey/sankey.js +25 -21
- package/esm/series/sankey/sankey.js.map +1 -1
- package/esm/util/graphic-state.d.ts +3 -0
- package/esm/util/graphic-state.js +17 -0
- package/esm/util/graphic-state.js.map +1 -0
- package/package.json +8 -7
|
@@ -56,6 +56,8 @@ import { log } from "../../util/debug";
|
|
|
56
56
|
|
|
57
57
|
import { morph as runMorph } from "../../compile/morph";
|
|
58
58
|
|
|
59
|
+
import { addGraphicState, removeGraphicState } from "../../util/graphic-state";
|
|
60
|
+
|
|
59
61
|
export class BaseMark extends GrammarItem {
|
|
60
62
|
commit(render, recursion) {
|
|
61
63
|
recursion && this.getMarks().length > 0 && this.getMarks().forEach((m => m.commit(!1, recursion))),
|
|
@@ -241,10 +243,7 @@ export class BaseMark extends GrammarItem {
|
|
|
241
243
|
setCustomizedShape && (g.pathProxy = attrs => setCustomizedShape(g.context.data, attrs, new CustomPath2D)),
|
|
242
244
|
graphicName && (isFunction(graphicName) ? g.name = graphicName(g) : g.name = graphicName);
|
|
243
245
|
}, this._setStateOfGraphic = (g, hasAnimation) => {
|
|
244
|
-
g.clearStates(), g.stateProxy = null, g.context.diffState !== DiffState.enter && g.context.diffState !== DiffState.update ||
|
|
245
|
-
var _a;
|
|
246
|
-
return this._runEncoderOfGraphic(null === (_a = this._encoderOfState) || void 0 === _a ? void 0 : _a[stateName], g);
|
|
247
|
-
}, g.context.states && g.useStates(g.context.states, hasAnimation));
|
|
246
|
+
g.clearStates(), g.stateProxy = null, g.context.diffState !== DiffState.enter && g.context.diffState !== DiffState.update || g.context.states && g.useStates(g.context.states, hasAnimation);
|
|
248
247
|
}, this.name = name, this.model = option.model, this.key = option.key, this.state = new MarkStateManager(option, this),
|
|
249
248
|
this._attributeContext = option.attributeContext, null === (_a = option.map) || void 0 === _a || _a.set(this.id, this);
|
|
250
249
|
}
|
|
@@ -676,20 +675,36 @@ export class BaseMark extends GrammarItem {
|
|
|
676
675
|
groupStyles: groupStyles
|
|
677
676
|
};
|
|
678
677
|
}
|
|
678
|
+
_applySharedStateDefinitions() {
|
|
679
|
+
var _a;
|
|
680
|
+
if (!this._product) return;
|
|
681
|
+
const stateNames = Object.keys(null !== (_a = this._encoderOfState) && void 0 !== _a ? _a : {}).filter((stateName => "group" !== stateName && "update" !== stateName));
|
|
682
|
+
if (!stateNames.length) return void (this._product.sharedStateDefinitions = void 0);
|
|
683
|
+
const sortedStateNames = this._stateSort ? stateNames.slice().sort(this._stateSort) : stateNames, statePriority = new Map;
|
|
684
|
+
sortedStateNames.forEach(((stateName, index) => {
|
|
685
|
+
statePriority.set(stateName, index);
|
|
686
|
+
}));
|
|
687
|
+
const sharedStateDefinitions = {};
|
|
688
|
+
stateNames.forEach((stateName => {
|
|
689
|
+
var _a;
|
|
690
|
+
const encoder = this._encoderOfState[stateName];
|
|
691
|
+
sharedStateDefinitions[stateName] = {
|
|
692
|
+
priority: null !== (_a = statePriority.get(stateName)) && void 0 !== _a ? _a : 0,
|
|
693
|
+
declaredAffectedKeys: Object.keys(null != encoder ? encoder : {}),
|
|
694
|
+
resolver: ({graphic: graphic}) => this._runEncoderOfGraphic(encoder, graphic)
|
|
695
|
+
};
|
|
696
|
+
})), this._product.sharedStateDefinitions = sharedStateDefinitions;
|
|
697
|
+
}
|
|
679
698
|
_addProgressiveGraphic(parent, g) {
|
|
680
699
|
parent.incrementalAppendChild(g);
|
|
681
700
|
}
|
|
682
701
|
_runEncoder(graphics, noGroupEncode) {
|
|
683
702
|
var _a;
|
|
684
703
|
const attrsByGroup = noGroupEncode ? null : this._runGroupEncoder(null === (_a = this._encoderOfState) || void 0 === _a ? void 0 : _a.group);
|
|
685
|
-
graphics.forEach((
|
|
686
|
-
var _a
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
var _a;
|
|
690
|
-
const stateAttr = this._runEncoderOfGraphic(null === (_a = this._encoderOfState) || void 0 === _a ? void 0 : _a[_state], g);
|
|
691
|
-
attrs = Object.assign(Object.assign({}, attrs), stateAttr);
|
|
692
|
-
})), isNil(this._markConfig.interactive) || (attrs.pickable = this._markConfig.interactive);
|
|
704
|
+
graphics.forEach((g => {
|
|
705
|
+
var _a;
|
|
706
|
+
const attrs = this._runEncoderOfGraphic(null === (_a = this._encoderOfState) || void 0 === _a ? void 0 : _a.update, g);
|
|
707
|
+
isNil(this._markConfig.interactive) || (attrs.pickable = this._markConfig.interactive);
|
|
693
708
|
const finalAttrs = this._transformGraphicAttributes(g, attrs, null == attrsByGroup ? void 0 : attrsByGroup[g.context.groupKey]);
|
|
694
709
|
g.context.finalAttrs = finalAttrs;
|
|
695
710
|
}));
|
|
@@ -773,7 +788,7 @@ export class BaseMark extends GrammarItem {
|
|
|
773
788
|
}
|
|
774
789
|
renderInner() {
|
|
775
790
|
var _a, _b, _c;
|
|
776
|
-
this._updateEncoderByState();
|
|
791
|
+
this._updateEncoderByState(), this._applySharedStateDefinitions();
|
|
777
792
|
const data = null !== (_b = null === (_a = this._data) || void 0 === _a ? void 0 : _a.getProduct()) && void 0 !== _b ? _b : [ {} ], transformData = this._runBeforeTransform(data);
|
|
778
793
|
let markData;
|
|
779
794
|
if (null == transformData ? void 0 : transformData.progressive) {
|
|
@@ -798,7 +813,7 @@ export class BaseMark extends GrammarItem {
|
|
|
798
813
|
if (!this._product) return;
|
|
799
814
|
const stateInfo = this.state.getStateInfo(key);
|
|
800
815
|
this._graphics.forEach((g => {
|
|
801
|
-
"in" === this.state.checkOneState(g, g.context.data, stateInfo) ? g
|
|
816
|
+
"in" === this.state.checkOneState(g, g.context.data, stateInfo) ? addGraphicState(g, key, !0, this.hasAnimationByState("state")) : removeGraphicState(g, key, this.hasAnimationByState("state"));
|
|
802
817
|
}));
|
|
803
818
|
}
|
|
804
819
|
clearExitGraphics() {
|