@visactor/vchart 2.0.0 → 2.0.1-alpha.1

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.
Files changed (108) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +178 -122
  3. package/build/index.js +178 -121
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/chart/base/base-chart.d.ts +1 -0
  7. package/cjs/chart/base/base-chart.js +3 -0
  8. package/cjs/chart/base/base-chart.js.map +1 -1
  9. package/cjs/chart/interface/chart.d.ts +1 -0
  10. package/cjs/chart/interface/chart.js.map +1 -1
  11. package/cjs/compile/compiler.js +6 -2
  12. package/cjs/compile/compiler.js.map +1 -1
  13. package/cjs/component/axis/base-axis.js.map +1 -1
  14. package/cjs/component/axis/interface/common.js.map +1 -1
  15. package/cjs/component/brush/brush.js +6 -6
  16. package/cjs/component/brush/brush.js.map +1 -1
  17. package/cjs/component/brush/interface.d.ts +1 -0
  18. package/cjs/component/brush/interface.js.map +1 -1
  19. package/cjs/component/crosshair/base.d.ts +1 -1
  20. package/cjs/component/crosshair/base.js +1 -1
  21. package/cjs/component/crosshair/base.js.map +1 -1
  22. package/cjs/component/crosshair/utils/cartesian.js +2 -2
  23. package/cjs/component/crosshair/utils/cartesian.js.map +1 -1
  24. package/cjs/core/index.d.ts +1 -1
  25. package/cjs/core/index.js +1 -1
  26. package/cjs/core/index.js.map +1 -1
  27. package/cjs/core/instance-manager.js +1 -1
  28. package/cjs/core/interface.js +1 -1
  29. package/cjs/core/vchart.js +7 -8
  30. package/cjs/core/vchart.js.map +1 -1
  31. package/cjs/data/initialize.js +1 -1
  32. package/cjs/data/register.js +1 -1
  33. package/cjs/mark/base/base-mark.d.ts +3 -1
  34. package/cjs/mark/base/base-mark.js +33 -31
  35. package/cjs/mark/base/base-mark.js.map +1 -1
  36. package/cjs/mark/group.d.ts +1 -1
  37. package/cjs/mark/group.js +14 -10
  38. package/cjs/mark/group.js.map +1 -1
  39. package/cjs/mark/interface/common.d.ts +1 -1
  40. package/cjs/mark/interface/common.js.map +1 -1
  41. package/cjs/model/base-model.d.ts +1 -0
  42. package/cjs/model/base-model.js +1 -0
  43. package/cjs/model/base-model.js.map +1 -1
  44. package/cjs/model/interface.d.ts +1 -0
  45. package/cjs/model/interface.js.map +1 -1
  46. package/cjs/series/base/base-series.js +2 -3
  47. package/cjs/series/base/base-series.js.map +1 -1
  48. package/cjs/series/funnel/funnel.js +0 -2
  49. package/cjs/series/funnel/funnel.js.map +1 -1
  50. package/cjs/series/map/map.js +1 -2
  51. package/cjs/series/map/map.js.map +1 -1
  52. package/cjs/series/pie/pie.js +0 -1
  53. package/cjs/series/pie/pie.js.map +1 -1
  54. package/cjs/util/mark.d.ts +1 -0
  55. package/cjs/util/mark.js +10 -1
  56. package/cjs/util/mark.js.map +1 -1
  57. package/esm/chart/base/base-chart.d.ts +1 -0
  58. package/esm/chart/base/base-chart.js +3 -0
  59. package/esm/chart/base/base-chart.js.map +1 -1
  60. package/esm/chart/interface/chart.d.ts +1 -0
  61. package/esm/chart/interface/chart.js.map +1 -1
  62. package/esm/compile/compiler.js +7 -4
  63. package/esm/compile/compiler.js.map +1 -1
  64. package/esm/component/axis/base-axis.js.map +1 -1
  65. package/esm/component/axis/interface/common.js.map +1 -1
  66. package/esm/component/brush/brush.js +6 -6
  67. package/esm/component/brush/brush.js.map +1 -1
  68. package/esm/component/brush/interface.d.ts +1 -0
  69. package/esm/component/brush/interface.js.map +1 -1
  70. package/esm/component/crosshair/base.d.ts +1 -1
  71. package/esm/component/crosshair/base.js +1 -1
  72. package/esm/component/crosshair/base.js.map +1 -1
  73. package/esm/component/crosshair/utils/cartesian.js +2 -2
  74. package/esm/component/crosshair/utils/cartesian.js.map +1 -1
  75. package/esm/core/index.d.ts +1 -1
  76. package/esm/core/index.js +1 -1
  77. package/esm/core/index.js.map +1 -1
  78. package/esm/core/instance-manager.js +1 -1
  79. package/esm/core/interface.js +1 -1
  80. package/esm/core/vchart.js +6 -7
  81. package/esm/core/vchart.js.map +1 -1
  82. package/esm/data/initialize.js +1 -1
  83. package/esm/data/register.js +1 -1
  84. package/esm/mark/base/base-mark.d.ts +3 -1
  85. package/esm/mark/base/base-mark.js +34 -30
  86. package/esm/mark/base/base-mark.js.map +1 -1
  87. package/esm/mark/group.d.ts +1 -1
  88. package/esm/mark/group.js +17 -9
  89. package/esm/mark/group.js.map +1 -1
  90. package/esm/mark/interface/common.d.ts +1 -1
  91. package/esm/mark/interface/common.js.map +1 -1
  92. package/esm/model/base-model.d.ts +1 -0
  93. package/esm/model/base-model.js +1 -0
  94. package/esm/model/base-model.js.map +1 -1
  95. package/esm/model/interface.d.ts +1 -0
  96. package/esm/model/interface.js.map +1 -1
  97. package/esm/series/base/base-series.js +2 -3
  98. package/esm/series/base/base-series.js.map +1 -1
  99. package/esm/series/funnel/funnel.js +0 -2
  100. package/esm/series/funnel/funnel.js.map +1 -1
  101. package/esm/series/map/map.js +1 -2
  102. package/esm/series/map/map.js.map +1 -1
  103. package/esm/series/pie/pie.js +0 -1
  104. package/esm/series/pie/pie.js.map +1 -1
  105. package/esm/util/mark.d.ts +1 -0
  106. package/esm/util/mark.js +7 -0
  107. package/esm/util/mark.js.map +1 -1
  108. package/package.json +8 -8
package/build/index.js CHANGED
@@ -14173,9 +14173,9 @@
14173
14173
  setWidthHeightWithoutTransform(aabbBounds) {
14174
14174
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
14175
14175
  }
14176
- setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context) {
14176
+ setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
14177
14177
  this.setAttributes(params, forceUpdateTag, context), this.animates && this.animates.forEach(animate => {
14178
- Object.keys(params).forEach(key => {
14178
+ (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach(key => {
14179
14179
  animate.preventAttr(key);
14180
14180
  });
14181
14181
  });
@@ -14346,7 +14346,7 @@
14346
14346
  });
14347
14347
  } else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
14348
14348
  type: AttributeUpdateType.STATE
14349
- });
14349
+ }), this.finalAttribute && Object.assign(this.finalAttribute, attrs);
14350
14350
  this._emitCustomEvent("afterStateUpdate", {
14351
14351
  type: AttributeUpdateType.STATE
14352
14352
  });
@@ -31734,7 +31734,7 @@
31734
31734
  return this._animateCount;
31735
31735
  }
31736
31736
  constructor() {
31737
- super(), this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
31737
+ super(), this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this._animationEndFlag = !0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
31738
31738
  }
31739
31739
  isRunning() {
31740
31740
  return !this.paused && this._animateCount > 0;
@@ -31763,10 +31763,11 @@
31763
31763
  }
31764
31764
  tick(delta) {
31765
31765
  if (this.paused) return;
31766
+ this._animationEndFlag && (this._animationEndFlag = !1, this.emit("animationStart"));
31766
31767
  const scaledDelta = delta * this._playSpeed;
31767
31768
  this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
31768
31769
  animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0) : animate.status !== AnimateStatus.RUNNING && animate.status !== AnimateStatus.INITIAL || animate.advance(scaledDelta);
31769
- }), 0 === this._animateCount && this.emit("animationEnd");
31770
+ }), 0 === this._animateCount && (this._animationEndFlag = !0, this.emit("animationEnd"));
31770
31771
  }
31771
31772
  clear() {
31772
31773
  this.forEachAccessAnimate(animate => {
@@ -31830,7 +31831,9 @@
31830
31831
  return this._timeline;
31831
31832
  }
31832
31833
  bind(target) {
31833
- return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
31834
+ return this.target = target, this.target.animates || (this.target.animates = new Map()), this.target.animates.set(this.id, this), this.onRemove(() => {
31835
+ this.stop(), this.target.animates.delete(this.id);
31836
+ }), this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
31834
31837
  }
31835
31838
  to(props, duration = 300, easing = "linear") {
31836
31839
  const step = new Step(AnimateStepType.to, props, duration, easing);
@@ -32044,8 +32047,8 @@
32044
32047
  }
32045
32048
  init() {
32046
32049
  this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
32047
- this.initHandler();
32048
- }), application.global.env && this.initHandler();
32050
+ this.initHandler(!1);
32051
+ }), application.global.env && this.initHandler(!1);
32049
32052
  }
32050
32053
  addTimeline(timeline) {
32051
32054
  this.timelines.push(timeline);
@@ -32056,10 +32059,11 @@
32056
32059
  getTimelines() {
32057
32060
  return this.timelines;
32058
32061
  }
32059
- initHandler() {
32060
- this.setupTickHandler();
32062
+ initHandler(force = !1) {
32063
+ this.setupTickHandler(force);
32061
32064
  }
32062
- setupTickHandler() {
32065
+ setupTickHandler(force = !1) {
32066
+ if (!force && this.tickerHandler) return !0;
32063
32067
  const handler = new RAFTickHandler();
32064
32068
  return this.tickerHandler && this.tickerHandler.release(), this.tickerHandler = handler, !0;
32065
32069
  }
@@ -32110,7 +32114,7 @@
32110
32114
  return this.status = STATUS$1.RUNNING, this.tickerHandler.tick(0, this.handleTick), !0;
32111
32115
  }
32112
32116
  stop() {
32113
- this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
32117
+ this.status = STATUS$1.INITIAL, this.setupTickHandler(!0), this.lastFrameTime = -1;
32114
32118
  }
32115
32119
  trySyncTickStatus() {
32116
32120
  this.status === STATUS$1.INITIAL && this.timelines.some(timeline => timeline.isRunning()) ? this.start() : this.status === STATUS$1.RUNNING && this.timelines.every(timeline => !timeline.isRunning()) && this.stop();
@@ -32418,10 +32422,11 @@
32418
32422
  _handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
32419
32423
  var _a, _b, _c, _d;
32420
32424
  if (custom && customType) {
32421
- const customParams = this.resolveValue(customParameters, graphic, {
32425
+ const customParams = Object.assign({
32422
32426
  width: graphic.stage.width,
32423
- height: graphic.stage.height
32424
- }),
32427
+ height: graphic.stage.height,
32428
+ group: this._target.parent
32429
+ }, this.resolveValue(customParameters, graphic)),
32425
32430
  objOptions = isFunction$1(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParams) : options;
32426
32431
  customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
32427
32432
  } else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
@@ -32686,7 +32691,6 @@
32686
32691
  }
32687
32692
  animate(params) {
32688
32693
  var _a, _b, _c;
32689
- this.animates || (this.animates = new Map());
32690
32694
  const animate = new Animate(null == params ? void 0 : params.id, null !== (_b = null !== (_a = null == params ? void 0 : params.timeline) && void 0 !== _a ? _a : this.stage && this.stage.getTimeline()) && void 0 !== _b ? _b : defaultTimeline, null == params ? void 0 : params.slience);
32691
32695
  if (animate.bind(this), params) {
32692
32696
  const {
@@ -32696,9 +32700,7 @@
32696
32700
  } = params;
32697
32701
  null != onStart && animate.onStart(onStart), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove);
32698
32702
  }
32699
- return this.animates.set(animate.id, animate), animate.onRemove(() => {
32700
- animate.stop(), this.animates.delete(animate.id);
32701
- }), null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
32703
+ return null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
32702
32704
  }
32703
32705
  createTimeline() {
32704
32706
  return new DefaultTimeline();
@@ -32737,7 +32739,7 @@
32737
32739
 
32738
32740
  class ACustomAnimate extends Step {
32739
32741
  constructor(customFrom, customTo, duration, easing, params) {
32740
- super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params;
32742
+ super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params, this.from = customFrom, this.to = customTo;
32741
32743
  }
32742
32744
  update(end, ratio, out) {
32743
32745
  if (this.onStart(), !this.props || !this.propKeys) return;
@@ -35814,18 +35816,19 @@
35814
35816
  }
35815
35817
  };
35816
35818
  const moveOut = (graphic, options, animationParameters) => {
35817
- var _a, _b, _c, _d, _e, _f;
35819
+ var _a, _b, _c, _d;
35818
35820
  const {
35819
35821
  offset = 0,
35820
35822
  orient: orient,
35821
35823
  direction: direction,
35822
35824
  point: pointOpt
35823
35825
  } = null != options ? options : {},
35824
- groupWidth = null !== (_b = null === (_a = options.layoutRect) || void 0 === _a ? void 0 : _a.width) && void 0 !== _b ? _b : graphic.stage.viewWidth,
35825
- groupHeight = null !== (_d = null === (_c = options.layoutRect) || void 0 === _c ? void 0 : _c.height) && void 0 !== _d ? _d : graphic.stage.viewHeight,
35826
+ groupBounds = animationParameters.group ? animationParameters.group.AABBBounds : null,
35827
+ groupWidth = null !== (_a = groupBounds.width()) && void 0 !== _a ? _a : animationParameters.width,
35828
+ groupHeight = null !== (_b = groupBounds.height()) && void 0 !== _b ? _b : animationParameters.height,
35826
35829
  changedX = ("negative" === orient ? groupWidth : 0) + offset,
35827
35830
  changedY = ("negative" === orient ? groupHeight : 0) + offset,
35828
- point = isFunction$1(pointOpt) ? pointOpt.call(null, null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, animationParameters) : pointOpt,
35831
+ point = isFunction$1(pointOpt) ? pointOpt.call(null, null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, animationParameters) : pointOpt,
35829
35832
  fromX = point && isValidNumber$1(point.x) ? point.x : changedX,
35830
35833
  fromY = point && isValidNumber$1(point.y) ? point.y : changedY;
35831
35834
  switch (direction) {
@@ -35998,6 +36001,9 @@
35998
36001
  this.from[key] = null !== (_a = this.from[key]) && void 0 !== _a ? _a : startProps[key];
35999
36002
  }), this.target.setAttributes(this.from);
36000
36003
  }
36004
+ deleteSelfAttr(key) {
36005
+ super.deleteSelfAttr(key), delete this.from[key];
36006
+ }
36001
36007
  update(end, ratio, out) {
36002
36008
  if (this.onStart(), !this.props || !this.propKeys) return;
36003
36009
  const easedRatio = this.easing(ratio);
@@ -49110,6 +49116,16 @@
49110
49116
  }
49111
49117
  return null;
49112
49118
  };
49119
+ const getDiffAttributesOfGraphic = (g, newAttrs) => {
49120
+ const prevAttrs = g.getAttributes(true);
49121
+ const diffAttrs = {};
49122
+ Object.keys(newAttrs).forEach(key => {
49123
+ if (prevAttrs[key] !== newAttrs[key]) {
49124
+ diffAttrs[key] = newAttrs[key];
49125
+ }
49126
+ });
49127
+ return diffAttrs;
49128
+ };
49113
49129
 
49114
49130
  let Event$1 = class Event {
49115
49131
  getComposedEventMap() {
@@ -50011,6 +50027,28 @@
50011
50027
  return attrs;
50012
50028
  };
50013
50029
 
50030
+ function toRenderMode(mode) {
50031
+ switch (mode) {
50032
+ case exports.RenderModeEnum['desktop-browser']:
50033
+ case exports.RenderModeEnum['mobile-browser']:
50034
+ return 'browser';
50035
+ case exports.RenderModeEnum.node:
50036
+ case exports.RenderModeEnum.worker:
50037
+ return 'node';
50038
+ case exports.RenderModeEnum.miniApp:
50039
+ case exports.RenderModeEnum['desktop-miniApp']:
50040
+ return 'feishu';
50041
+ case exports.RenderModeEnum.lynx:
50042
+ return 'lynx';
50043
+ case exports.RenderModeEnum.wx:
50044
+ return 'wx';
50045
+ case exports.RenderModeEnum.tt:
50046
+ return 'tt';
50047
+ case exports.RenderModeEnum.harmony:
50048
+ return 'harmony';
50049
+ }
50050
+ return 'browser';
50051
+ }
50014
50052
  function traverseGroupMark(group, apply, filter, leafFirst, stop) {
50015
50053
  const traverse = (mark) => {
50016
50054
  if (!leafFirst) {
@@ -50200,7 +50238,8 @@
50200
50238
  if (this._stage) {
50201
50239
  return;
50202
50240
  }
50203
- const { autoRefreshDpr, dpr, mode, gestureConfig, interactive, clickInterval, autoPreventDefault, background } = this._option;
50241
+ const { autoRefreshDpr, dpr, mode, modeParams, gestureConfig, interactive, clickInterval, autoPreventDefault, background } = this._option;
50242
+ vglobal.setEnv(toRenderMode(mode), modeParams !== null && modeParams !== void 0 ? modeParams : {});
50204
50243
  this._stage =
50205
50244
  (_a = this._option.stage) !== null && _a !== void 0 ? _a : new Stage({
50206
50245
  background,
@@ -50211,7 +50250,11 @@
50211
50250
  dpr,
50212
50251
  viewBox: this._option.viewBox,
50213
50252
  canvasControled: this._option.canvasControled,
50214
- beforeRender: this._option.beforeRender,
50253
+ beforeRender: (stage) => {
50254
+ var _a, _b, _c;
50255
+ (_a = this._compileChart) === null || _a === void 0 ? void 0 : _a.onBeforeRender();
50256
+ (_c = (_b = this._option).beforeRender) === null || _c === void 0 ? void 0 : _c.call(_b, stage);
50257
+ },
50215
50258
  afterRender: this._option.afterRender,
50216
50259
  disableDirtyBounds: true,
50217
50260
  autoRender: true,
@@ -51058,6 +51101,8 @@
51058
51101
  }
51059
51102
  onEvaluateEnd(ctx) {
51060
51103
  }
51104
+ onBeforeRender() {
51105
+ }
51061
51106
  onDataUpdate() {
51062
51107
  }
51063
51108
  beforeRelease() {
@@ -53852,6 +53897,7 @@
53852
53897
  this._dataByGroup = groupData(data, this._groupKeyGetter);
53853
53898
  }
53854
53899
  createAnimationStateList(type, animationConfig) {
53900
+ var _a;
53855
53901
  let config = animationConfig[type];
53856
53902
  if (config && Array.isArray(config)) {
53857
53903
  config = config.length === 1 ? config[0] : config;
@@ -53862,7 +53908,8 @@
53862
53908
  return (Object.assign(Object.assign({}, item), { priority: (_a = item.priority) !== null && _a !== void 0 ? _a : Infinity }));
53863
53909
  });
53864
53910
  }
53865
- return config;
53911
+ return config
53912
+ ? Object.assign(Object.assign({}, config), { priority: type === 'normal' ? (_a = config.priority) !== null && _a !== void 0 ? _a : Infinity : config.priority }) : config;
53866
53913
  }
53867
53914
  tryRunMorphing(graphics) {
53868
53915
  if (this._lastMark) {
@@ -53946,13 +53993,21 @@
53946
53993
  this._product.applyAnimationState(['normal'], [normalConfig]);
53947
53994
  }
53948
53995
  }
53996
+ _setAnimationState(g) {
53997
+ const customizedState = this._aniamtionStateCallback ? this._aniamtionStateCallback(g) : undefined;
53998
+ g.context.animationState = customizedState !== null && customizedState !== void 0 ? customizedState : g.context.diffState;
53999
+ if (g.context.animationState === DiffState.exit) {
54000
+ g.context.reusing = true;
54001
+ g.animates && g.animates.forEach((a) => a.stop());
54002
+ }
54003
+ }
53949
54004
  _runJoin(data) {
53950
54005
  const newGroupedData = this._getDataByKey(data);
53951
54006
  const prevGroupedData = this._prevDataByKey;
53952
- const newGraphics = [];
54007
+ const allGraphics = [];
53953
54008
  const enterGraphics = new Set(this._graphics.filter(g => g.context.diffState === DiffState.enter));
53954
54009
  const callback = (key, newData, prevData) => {
53955
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
54010
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
53956
54011
  let g;
53957
54012
  let diffState;
53958
54013
  if (isNil$1(newData)) {
@@ -53970,23 +54025,20 @@
53970
54025
  }
53971
54026
  diffState = DiffState.enter;
53972
54027
  g.isExiting = false;
53973
- if (((_a = g.context) === null || _a === void 0 ? void 0 : _a.diffState) === DiffState.exit) {
53974
- g.context.reusing = true;
53975
- g.animates && g.animates.forEach((a) => a.stop());
53976
- }
53977
54028
  this._graphicMap.set(key, g);
53978
- newGraphics.push(g);
54029
+ allGraphics.push(g);
53979
54030
  }
53980
54031
  else {
53981
54032
  g = this._graphicMap.get(key);
53982
54033
  if (g) {
53983
54034
  diffState = DiffState.update;
53984
- newGraphics.push(g);
54035
+ allGraphics.push(g);
53985
54036
  }
53986
54037
  }
53987
54038
  if (g) {
53988
- g.context = Object.assign(Object.assign({}, this._getCommonContext()), { diffState, reusing: (_b = g.context) === null || _b === void 0 ? void 0 : _b.reusing, originalFieldX: (_c = g.context) === null || _c === void 0 ? void 0 : _c.originalFieldX, originalFieldY: (_d = g.context) === null || _d === void 0 ? void 0 : _d.originalFieldY, fieldX: (_e = g.context) === null || _e === void 0 ? void 0 : _e.fieldX, fieldY: (_f = g.context) === null || _f === void 0 ? void 0 : _f.fieldY, animationState: diffState, data: newData !== null && newData !== void 0 ? newData : (_g = g.context) === null || _g === void 0 ? void 0 : _g.data, uniqueKey: key, key: newData ? this._keyGetter(newData[0]) : (_h = g.context) === null || _h === void 0 ? void 0 : _h.key, groupKey: newData ? this._groupKeyGetter(newData[0]) : (_j = g.context) === null || _j === void 0 ? void 0 : _j.groupKey, indexKey: '__VCHART_DEFAULT_DATA_INDEX', stateAnimateConfig: (_k = this.getAnimationConfig()) === null || _k === void 0 ? void 0 : _k.state });
53989
54039
  enterGraphics.delete(g);
54040
+ g.context = Object.assign(Object.assign({}, this._getCommonContext()), { diffState, reusing: (_a = g.context) === null || _a === void 0 ? void 0 : _a.reusing, originalFieldX: (_b = g.context) === null || _b === void 0 ? void 0 : _b.originalFieldX, originalFieldY: (_c = g.context) === null || _c === void 0 ? void 0 : _c.originalFieldY, fieldX: (_d = g.context) === null || _d === void 0 ? void 0 : _d.fieldX, fieldY: (_e = g.context) === null || _e === void 0 ? void 0 : _e.fieldY, data: newData !== null && newData !== void 0 ? newData : (_f = g.context) === null || _f === void 0 ? void 0 : _f.data, uniqueKey: key, key: newData ? this._keyGetter(newData[0]) : (_g = g.context) === null || _g === void 0 ? void 0 : _g.key, groupKey: newData ? this._groupKeyGetter(newData[0]) : (_h = g.context) === null || _h === void 0 ? void 0 : _h.groupKey, indexKey: '__VCHART_DEFAULT_DATA_INDEX', stateAnimateConfig: (_j = this.getAnimationConfig()) === null || _j === void 0 ? void 0 : _j.state });
54041
+ this._setAnimationState(g);
53990
54042
  }
53991
54043
  return g;
53992
54044
  };
@@ -54024,13 +54076,13 @@
54024
54076
  }
54025
54077
  g.release();
54026
54078
  });
54027
- const graphicCount = newGraphics.length;
54028
- newGraphics.forEach((g, index) => {
54079
+ const graphicCount = allGraphics.length;
54080
+ allGraphics.forEach((g, index) => {
54029
54081
  g.context.graphicCount = graphicCount;
54030
54082
  g.context.graphicIndex = index;
54031
54083
  });
54032
54084
  this._dataByKey = newGroupedData;
54033
- this._graphics = newGraphics;
54085
+ this._graphics = allGraphics;
54034
54086
  this.needClear = true;
54035
54087
  }
54036
54088
  _runEncoderOfGraphic(styles, g, attrs = {}) {
@@ -54113,13 +54165,7 @@
54113
54165
  }
54114
54166
  }
54115
54167
  else {
54116
- const prevAttrs = g.getAttributes(true);
54117
- const diffAttrs = {};
54118
- Object.keys(finalAttrs).forEach(key => {
54119
- if (prevAttrs[key] !== finalAttrs[key]) {
54120
- diffAttrs[key] = finalAttrs[key];
54121
- }
54122
- });
54168
+ const diffAttrs = getDiffAttributesOfGraphic(g, finalAttrs);
54123
54169
  g.context.diffAttrs = diffAttrs;
54124
54170
  if (g.context.reusing) {
54125
54171
  g.context.lastAttrs = g.attribute;
@@ -54288,24 +54334,25 @@
54288
54334
  }
54289
54335
  };
54290
54336
  this._graphicMap.forEach((g, key) => {
54291
- if (g.context.diffState === DiffState.exit && !g.isExiting) {
54292
- if (this.hasAnimationByState('exit')) {
54293
- g.isExiting = true;
54294
- const animationConfig = this.getAnimationConfig();
54295
- if (animationConfig.exit && animationConfig.exit.length) {
54296
- const exitConfigList = animationConfig.exit.map((item, index) => ({
54297
- name: `exit_${index}`,
54298
- animation: Object.assign(Object.assign({}, item), { customParameters: g.context })
54299
- }));
54300
- g.applyAnimationState(['exit'], [exitConfigList.length === 1 ? exitConfigList[0] : exitConfigList], () => {
54301
- doRemove(g, key);
54302
- });
54303
- }
54304
- }
54305
- else {
54306
- doRemove(g, key);
54337
+ if (g.context.diffState !== DiffState.exit || g.isExiting) {
54338
+ return;
54339
+ }
54340
+ if (g.context.animationState === DiffState.exit && this.hasAnimationByState('exit')) {
54341
+ g.isExiting = true;
54342
+ const animationConfig = this.getAnimationConfig();
54343
+ if (animationConfig.exit && animationConfig.exit.length) {
54344
+ const exitConfigList = animationConfig.exit.map((item, index) => ({
54345
+ name: `exit_${index}`,
54346
+ animation: Object.assign(Object.assign({}, item), { customParameters: g.context })
54347
+ }));
54348
+ g.applyAnimationState(['exit'], [exitConfigList.length === 1 ? exitConfigList[0] : exitConfigList], () => {
54349
+ doRemove(g, key);
54350
+ });
54307
54351
  }
54308
54352
  }
54353
+ else {
54354
+ doRemove(g, key);
54355
+ }
54309
54356
  });
54310
54357
  }
54311
54358
  isProgressive() {
@@ -54451,11 +54498,7 @@
54451
54498
  }
54452
54499
  }
54453
54500
  updateAnimationState(callback) {
54454
- if (this._graphics && this._graphics.length) {
54455
- this._graphics.forEach(g => {
54456
- g.context.animationState = callback(g);
54457
- });
54458
- }
54501
+ this._aniamtionStateCallback = callback;
54459
54502
  }
54460
54503
  hasAnimationByState(state) {
54461
54504
  if (!state || !this._animationConfig || !this._animationConfig[state]) {
@@ -54475,6 +54518,30 @@
54475
54518
  }
54476
54519
  }
54477
54520
 
54521
+ exports.MarkTypeEnum = void 0;
54522
+ (function (MarkTypeEnum) {
54523
+ MarkTypeEnum["group"] = "group";
54524
+ MarkTypeEnum["symbol"] = "symbol";
54525
+ MarkTypeEnum["rule"] = "rule";
54526
+ MarkTypeEnum["line"] = "line";
54527
+ MarkTypeEnum["text"] = "text";
54528
+ MarkTypeEnum["rect"] = "rect";
54529
+ MarkTypeEnum["image"] = "image";
54530
+ MarkTypeEnum["path"] = "path";
54531
+ MarkTypeEnum["area"] = "area";
54532
+ MarkTypeEnum["arc"] = "arc";
54533
+ MarkTypeEnum["polygon"] = "polygon";
54534
+ MarkTypeEnum["boxPlot"] = "boxPlot";
54535
+ MarkTypeEnum["linkPath"] = "linkPath";
54536
+ MarkTypeEnum["cell"] = "cell";
54537
+ MarkTypeEnum["ripple"] = "ripple";
54538
+ MarkTypeEnum["liquid"] = "liquid";
54539
+ MarkTypeEnum["component"] = "component";
54540
+ MarkTypeEnum["dataLabel"] = "dataLabel";
54541
+ MarkTypeEnum["label"] = "label";
54542
+ MarkTypeEnum["pictogram"] = "pictogram";
54543
+ })(exports.MarkTypeEnum || (exports.MarkTypeEnum = {}));
54544
+
54478
54545
  class GroupMark extends BaseMark {
54479
54546
  constructor() {
54480
54547
  super(...arguments);
@@ -54537,13 +54604,29 @@
54537
54604
  return [this._product];
54538
54605
  }
54539
54606
  renderInner() {
54540
- var _a;
54607
+ var _a, _b;
54541
54608
  if (!this._product) {
54542
54609
  return;
54543
54610
  }
54544
54611
  const style = (_a = this._simpleStyle) !== null && _a !== void 0 ? _a : this.getAttributesOfState({});
54545
- this._product.context = Object.assign(Object.assign({}, this._product.context), this._getCommonContext());
54546
- this._product.setAttributes(this._getAttrsFromConfig(style));
54612
+ const prevState = (_b = this._product.context) === null || _b === void 0 ? void 0 : _b.diffState;
54613
+ this._product.context = Object.assign(Object.assign(Object.assign({}, this._product.context), this._getCommonContext()), { diffState: prevState ? DiffState.update : DiffState.enter });
54614
+ this._setAnimationState(this._product);
54615
+ const newAttrs = this._getAttrsFromConfig(style);
54616
+ if (this._product.context.diffState === DiffState.update) {
54617
+ const hasAnimation = this.hasAnimation();
54618
+ const diffAttrs = getDiffAttributesOfGraphic(this._product, newAttrs);
54619
+ this._product.context.diffAttrs = diffAttrs;
54620
+ if (!this.hasAnimationByState(this._product.context.animationState)) {
54621
+ hasAnimation ? this._product.setAttributesAndPreventAnimate(diffAttrs) : this._product.setAttributes(diffAttrs);
54622
+ }
54623
+ if (hasAnimation) {
54624
+ this._product.setFinalAttributes(newAttrs);
54625
+ }
54626
+ }
54627
+ else {
54628
+ this._product.setAttributes(newAttrs);
54629
+ }
54547
54630
  this.needClear = true;
54548
54631
  }
54549
54632
  render() {
@@ -54557,11 +54640,7 @@
54557
54640
  });
54558
54641
  }
54559
54642
  updateAnimationState(callback) {
54560
- this.getGraphics().forEach(g => {
54561
- if (g) {
54562
- g.context = Object.assign(Object.assign({}, g.context), { animationState: callback(g) });
54563
- }
54564
- });
54643
+ super.updateAnimationState(callback);
54565
54644
  this.getMarks().forEach(mark => {
54566
54645
  mark.updateAnimationState(callback);
54567
54646
  });
@@ -55463,7 +55542,6 @@
55463
55542
  if (!this._beforeRender(option)) {
55464
55543
  return self;
55465
55544
  }
55466
- this._updateAnimateState(true);
55467
55545
  (_a = this._compiler) === null || _a === void 0 ? void 0 : _a.render(option.morphConfig);
55468
55546
  this._updateAnimateState(false);
55469
55547
  this._afterRender();
@@ -55857,7 +55935,7 @@
55857
55935
  var _a;
55858
55936
  const diffState = (_a = graphic.context) === null || _a === void 0 ? void 0 : _a.diffState;
55859
55937
  if (initial) {
55860
- return diffState === 'exit' ? undefined : AnimationStateEnum.appear;
55938
+ return diffState === 'exit' ? AnimationStateEnum.none : AnimationStateEnum.appear;
55861
55939
  }
55862
55940
  return diffState;
55863
55941
  };
@@ -55946,11 +56024,11 @@
55946
56024
  }
55947
56025
  if (this._chart) {
55948
56026
  this._chart.updateData(id, data, true, parserOptions);
55949
- this._compiler.render();
55950
56027
  if (userUpdateOptions === null || userUpdateOptions === void 0 ? void 0 : userUpdateOptions.reAnimate) {
55951
56028
  this.stopAnimation();
55952
56029
  this._updateAnimateState(true);
55953
56030
  }
56031
+ this._compiler.render();
55954
56032
  return this;
55955
56033
  }
55956
56034
  this._spec.data = array(this._spec.data);
@@ -55961,11 +56039,11 @@
55961
56039
  if (this._chart) {
55962
56040
  this._chart.updateFullData(data);
55963
56041
  if (reRender) {
55964
- this._compiler.render();
55965
56042
  if (userUpdateOptions === null || userUpdateOptions === void 0 ? void 0 : userUpdateOptions.reAnimate) {
55966
56043
  this.stopAnimation();
55967
56044
  this._updateAnimateState(true);
55968
56045
  }
56046
+ this._compiler.render();
55969
56047
  }
55970
56048
  return this;
55971
56049
  }
@@ -56772,7 +56850,7 @@
56772
56850
  });
56773
56851
  };
56774
56852
 
56775
- const version = "2.0.0";
56853
+ const version = "2.0.1-alpha.1";
56776
56854
 
56777
56855
  const addVChartProperty = (data, op) => {
56778
56856
  const context = op.beforeCall();
@@ -58585,14 +58663,11 @@
58585
58663
  }
58586
58664
  if (isNil$1(dataView)) {
58587
58665
  m.setData(this._data);
58588
- m.setSkipBeforeLayouted(true);
58589
58666
  }
58590
58667
  else if (dataView !== false) {
58591
58668
  m.setDataView(dataView);
58592
58669
  }
58593
- if (isBoolean$1(skipBeforeLayouted)) {
58594
- m.setSkipBeforeLayouted(skipBeforeLayouted);
58595
- }
58670
+ m.setSkipBeforeLayouted(skipBeforeLayouted !== false);
58596
58671
  if (!isNil$1(groupKey)) {
58597
58672
  m.setGroupKey(groupKey);
58598
58673
  }
@@ -59817,30 +59892,6 @@
59817
59892
 
59818
59893
  const lineSeriesMark = Object.assign(Object.assign({}, baseSeriesMark), lineLikeSeriesMark);
59819
59894
 
59820
- exports.MarkTypeEnum = void 0;
59821
- (function (MarkTypeEnum) {
59822
- MarkTypeEnum["group"] = "group";
59823
- MarkTypeEnum["symbol"] = "symbol";
59824
- MarkTypeEnum["rule"] = "rule";
59825
- MarkTypeEnum["line"] = "line";
59826
- MarkTypeEnum["text"] = "text";
59827
- MarkTypeEnum["rect"] = "rect";
59828
- MarkTypeEnum["image"] = "image";
59829
- MarkTypeEnum["path"] = "path";
59830
- MarkTypeEnum["area"] = "area";
59831
- MarkTypeEnum["arc"] = "arc";
59832
- MarkTypeEnum["polygon"] = "polygon";
59833
- MarkTypeEnum["boxPlot"] = "boxPlot";
59834
- MarkTypeEnum["linkPath"] = "linkPath";
59835
- MarkTypeEnum["cell"] = "cell";
59836
- MarkTypeEnum["ripple"] = "ripple";
59837
- MarkTypeEnum["liquid"] = "liquid";
59838
- MarkTypeEnum["component"] = "component";
59839
- MarkTypeEnum["dataLabel"] = "dataLabel";
59840
- MarkTypeEnum["label"] = "label";
59841
- MarkTypeEnum["pictogram"] = "pictogram";
59842
- })(exports.MarkTypeEnum || (exports.MarkTypeEnum = {}));
59843
-
59844
59895
  const isStopsEqual = (prev, next) => {
59845
59896
  var _a, _b;
59846
59897
  if (prev === next) {
@@ -64923,6 +64974,10 @@
64923
64974
  const elements = [...this._components, ...this._regions, ...this._series];
64924
64975
  elements.forEach(element => element.onEvaluateEnd(option));
64925
64976
  }
64977
+ onBeforeRender() {
64978
+ const elements = [...this._components, ...this._regions, ...this._series];
64979
+ elements.forEach(element => element.onBeforeRender());
64980
+ }
64926
64981
  getLayoutElements() {
64927
64982
  return this.getAllModels()
64928
64983
  .map(i => i.layout)
@@ -66281,7 +66336,7 @@
66281
66336
  layoutStartPoint = { x: 0, y: 0 };
66282
66337
  }
66283
66338
  Object.keys(stateByField).forEach(field => {
66284
- var _a, _b, _c, _d, _e;
66339
+ var _a, _b, _c, _d, _e, _f;
66285
66340
  const { currentValue, cacheInfo, labelsComp, attributes, coordKey } = stateByField[field];
66286
66341
  let axis = null;
66287
66342
  let coord = 0;
@@ -66293,8 +66348,8 @@
66293
66348
  item.axis.getLayoutStartPoint()[coordKey] -
66294
66349
  layoutStartPoint[coordKey];
66295
66350
  axis = item.axis;
66296
- axisLabel = (_e = (_d = (_c = (_b = (_a = axis
66297
- .getVRenderComponents()[0]) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.getChildByName('axis-label-container')) === null || _d === void 0 ? void 0 : _d.getChildByName('axis-label-container-layer-0')) === null || _e === void 0 ? void 0 : _e.children[0];
66351
+ axisLabel = (_f = (_e = (_d = (_c = (_b = (_a = axis
66352
+ .getVRenderComponents()[0]) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.children[0]) === null || _d === void 0 ? void 0 : _d.getChildByName('axis-label-container')) === null || _e === void 0 ? void 0 : _e.getChildByName('axis-label-container-layer-0')) === null || _f === void 0 ? void 0 : _f.children[0];
66298
66353
  }
66299
66354
  const isVisible = !!currentValue.size && Number.isFinite(coord) && !Number.isNaN(coord);
66300
66355
  const useCache = enableRemain && !isVisible && isValid$1(cacheInfo);
@@ -69672,8 +69727,7 @@
69672
69727
  initMark() {
69673
69728
  this._pathMark = this._createMark(MapSeries.mark.area, {
69674
69729
  groupKey: this.getDimensionField()[0],
69675
- isSeriesMark: true,
69676
- skipBeforeLayouted: true
69730
+ isSeriesMark: true
69677
69731
  }, {
69678
69732
  morph: shouldMarkDoMorph(this._spec, MapSeries.mark.area.name),
69679
69733
  morphElementKey: this.getDimensionField()[0]
@@ -73159,7 +73213,6 @@
73159
73213
  this._pieMark = this._createMark(Object.assign(Object.assign({}, BasePieSeries.mark.pie), { name: this._pieMarkName, type: this._pieMarkType }), {
73160
73214
  key: DEFAULT_DATA_KEY,
73161
73215
  groupKey: this._seriesField,
73162
- skipBeforeLayouted: true,
73163
73216
  isSeriesMark: true
73164
73217
  }, {
73165
73218
  morph: shouldMarkDoMorph(this._spec, this._pieMarkName),
@@ -80818,7 +80871,6 @@
80818
80871
  if (this._spec.isTransform) {
80819
80872
  this._funnelTransformMark = this._createMark(Object.assign(Object.assign({}, FunnelSeries.mark.transform), { name: this._transformMarkName, type: this._transformMarkType }), {
80820
80873
  themeSpec: (_b = this._theme) === null || _b === void 0 ? void 0 : _b.transform,
80821
- skipBeforeLayouted: true,
80822
80874
  noSeparateStyle: true
80823
80875
  });
80824
80876
  if (this._funnelTransformMark) {
@@ -80831,7 +80883,6 @@
80831
80883
  this._funnelOuterLabelMark.label = this._createMark(FunnelSeries.mark.outerLabel, {
80832
80884
  themeSpec: (_h = this._theme) === null || _h === void 0 ? void 0 : _h.outerLabel,
80833
80885
  markSpec: this._spec.outerLabel,
80834
- skipBeforeLayouted: true,
80835
80886
  noSeparateStyle: true,
80836
80887
  parent: false
80837
80888
  });
@@ -90319,7 +90370,7 @@
90319
90370
  this.event.off(eventName, handler);
90320
90371
  }
90321
90372
  }
90322
- updateLayoutAttribute() {
90373
+ onBeforeRender() {
90323
90374
  this._limitBounds = null;
90324
90375
  this._showDefaultCrosshair();
90325
90376
  }
@@ -96421,6 +96472,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96421
96472
  var _a;
96422
96473
  this._setRegionMarkPickable(region, true);
96423
96474
  const { operateMask } = e.detail;
96475
+ const { updateElementsState = true } = this._spec;
96424
96476
  if ((_a = this._spec) === null || _a === void 0 ? void 0 : _a.onBrushEnd) {
96425
96477
  if (this._spec.onBrushEnd(e) === true) {
96426
96478
  this.clearGraphic();
@@ -96434,7 +96486,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96434
96486
  }
96435
96487
  else {
96436
96488
  const inBrushData = this._extendDataInBrush(this._inBrushElementsMap);
96437
- if (!this._spec.zoomWhenEmpty && inBrushData.length > 0) {
96489
+ if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || !updateElementsState) {
96438
96490
  this._setAxisAndDataZoom(operateMask, region);
96439
96491
  }
96440
96492
  this._emitEvent(exports.ChartEvent.brushEnd, region);
@@ -96443,8 +96495,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96443
96495
  brush.addEventListener(IOperateType.moveEnd, (e) => {
96444
96496
  this._setRegionMarkPickable(region, true);
96445
96497
  const { operateMask } = e.detail;
96498
+ const { updateElementsState = true } = this._spec;
96446
96499
  const inBrushData = this._extendDataInBrush(this._inBrushElementsMap);
96447
- if (!this._spec.zoomWhenEmpty && inBrushData.length > 0) {
96500
+ if ((!this._spec.zoomWhenEmpty && inBrushData.length > 0) || updateElementsState) {
96448
96501
  this._setAxisAndDataZoom(operateMask, region);
96449
96502
  }
96450
96503
  this._emitEvent(exports.ChartEvent.brushEnd, region);
@@ -96486,8 +96539,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
96486
96539
  }
96487
96540
  _handleBrushChange(region, e) {
96488
96541
  const { operateMask } = e.detail;
96489
- this._reconfigItem(operateMask, region);
96490
- this._reconfigLinkedItem(operateMask, region);
96542
+ const { updateElementsState = true } = this._spec;
96543
+ if (updateElementsState) {
96544
+ this._reconfigItem(operateMask, region);
96545
+ this._reconfigLinkedItem(operateMask, region);
96546
+ }
96491
96547
  }
96492
96548
  _extendDataInBrush(elementsMap) {
96493
96549
  var _a, _b;
@@ -100291,6 +100347,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
100291
100347
  exports.getCombinedSizeOfRegions = getCombinedSizeOfRegions;
100292
100348
  exports.getDataScheme = getDataScheme;
100293
100349
  exports.getDatumOfGraphic = getDatumOfGraphic;
100350
+ exports.getDiffAttributesOfGraphic = getDiffAttributesOfGraphic;
100294
100351
  exports.getDimensionInfoByValue = getDimensionInfoByValue;
100295
100352
  exports.getFieldAlias = getFieldAlias;
100296
100353
  exports.getFunnelTheme = getFunnelTheme;