@visactor/vchart 1.6.4 → 1.6.6

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 (49) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +46 -27
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/compile/compiler.d.ts +2 -2
  6. package/cjs/compile/compiler.js +6 -5
  7. package/cjs/compile/compiler.js.map +1 -1
  8. package/cjs/compile/grammar-item.js +1 -2
  9. package/cjs/constant/polar.js +2 -1
  10. package/cjs/constant/scroll-bar.js +1 -2
  11. package/cjs/core/factory.js +2 -1
  12. package/cjs/core/index.d.ts +1 -1
  13. package/cjs/core/index.js +1 -1
  14. package/cjs/core/index.js.map +1 -1
  15. package/cjs/core/vchart.js +5 -5
  16. package/cjs/core/vchart.js.map +1 -1
  17. package/cjs/event/event.js +1 -2
  18. package/cjs/event/events/dimension/base.d.ts +1 -0
  19. package/cjs/event/events/dimension/base.js +10 -6
  20. package/cjs/event/events/dimension/base.js.map +1 -1
  21. package/cjs/interaction/config.d.ts +2 -2
  22. package/cjs/interaction/config.js +2 -2
  23. package/cjs/interaction/config.js.map +1 -1
  24. package/cjs/interaction/interaction.js +2 -1
  25. package/cjs/interaction/trigger.js +1 -1
  26. package/cjs/interaction/trigger.js.map +1 -1
  27. package/esm/compile/compiler.d.ts +2 -2
  28. package/esm/compile/compiler.js +6 -5
  29. package/esm/compile/compiler.js.map +1 -1
  30. package/esm/compile/grammar-item.js +1 -2
  31. package/esm/constant/polar.js +2 -1
  32. package/esm/constant/scroll-bar.js +1 -2
  33. package/esm/core/factory.js +2 -1
  34. package/esm/core/index.d.ts +1 -1
  35. package/esm/core/index.js +1 -1
  36. package/esm/core/index.js.map +1 -1
  37. package/esm/core/vchart.js +5 -5
  38. package/esm/core/vchart.js.map +1 -1
  39. package/esm/event/event.js +1 -2
  40. package/esm/event/events/dimension/base.d.ts +1 -0
  41. package/esm/event/events/dimension/base.js +10 -6
  42. package/esm/event/events/dimension/base.js.map +1 -1
  43. package/esm/interaction/config.d.ts +2 -2
  44. package/esm/interaction/config.js +2 -2
  45. package/esm/interaction/config.js.map +1 -1
  46. package/esm/interaction/interaction.js +2 -1
  47. package/esm/interaction/trigger.js +1 -1
  48. package/esm/interaction/trigger.js.map +1 -1
  49. package/package.json +12 -12
package/build/index.js CHANGED
@@ -647,17 +647,17 @@
647
647
  function objectKeys(obj) {
648
648
  return Object.keys(obj);
649
649
  }
650
- function isEqual$1(a, b) {
650
+ function isEqual$1(a, b, options) {
651
651
  if (a === b) return !0;
652
652
  if (typeof a != typeof b) return !1;
653
653
  if (null == a || null == b) return !1;
654
654
  if (Number.isNaN(a) && Number.isNaN(b)) return !0;
655
655
  if (objToString(a) !== objToString(b)) return !1;
656
- if (isFunction$1(a)) return !1;
656
+ if (isFunction$1(a)) return !!(null == options ? void 0 : options.skipFunction);
657
657
  if ("object" != typeof a) return !1;
658
658
  if (isArray$1(a)) {
659
659
  if (a.length !== b.length) return !1;
660
- for (let i = a.length - 1; i >= 0; i--) if (!isEqual$1(a[i], b[i])) return !1;
660
+ for (let i = a.length - 1; i >= 0; i--) if (!isEqual$1(a[i], b[i], options)) return !1;
661
661
  return !0;
662
662
  }
663
663
  if (!isPlainObject$1(a)) return !1;
@@ -668,7 +668,7 @@
668
668
  for (let i = ka.length - 1; i >= 0; i--) if (ka[i] != kb[i]) return !1;
669
669
  for (let i = ka.length - 1; i >= 0; i--) {
670
670
  const key = ka[i];
671
- if (!isEqual$1(a[key], b[key])) return !1;
671
+ if (!isEqual$1(a[key], b[key], options)) return !1;
672
672
  }
673
673
  return !0;
674
674
  }
@@ -26460,6 +26460,13 @@
26460
26460
  getGraphicItem() {
26461
26461
  return this.graphicItem;
26462
26462
  }
26463
+ removeGraphicItem() {
26464
+ var _a, _b;
26465
+ this.graphicItem && (null === (_b = null === (_a = this.graphicItem.animates) || void 0 === _a ? void 0 : _a.forEach) || void 0 === _b || _b.call(_a, animate => animate.stop())), this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem[BridgeElementKey] = null, this.graphicItem = null);
26466
+ }
26467
+ resetGraphicItem() {
26468
+ this.graphicItem && (this.graphicItem = null);
26469
+ }
26463
26470
  getBounds() {
26464
26471
  var _a;
26465
26472
  return null === (_a = this.graphicItem) || void 0 === _a ? void 0 : _a.AABBBounds;
@@ -26669,8 +26676,7 @@
26669
26676
  this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem = null);
26670
26677
  }
26671
26678
  release() {
26672
- var _a, _b;
26673
- this.graphicItem && (null === (_b = null === (_a = this.graphicItem.animates) || void 0 === _a ? void 0 : _a.forEach) || void 0 === _b || _b.call(_a, animate => animate.stop())), this.mark = null, this.data = null, this.graphicItem && (removeGraphicItem(this.graphicItem), this.graphicItem[BridgeElementKey] = null, this.graphicItem = null), this.items = null;
26679
+ this.removeGraphicItem(), this.mark = null, this.data = null, this.items = null;
26674
26680
  }
26675
26681
  getItemAttribute(channel) {
26676
26682
  var _a, _b;
@@ -45723,7 +45729,9 @@
45723
45729
  }
45724
45730
  removeAllGraphicItems() {
45725
45731
  return this.traverseMarkTree(mark => {
45726
- mark.graphicItem && removeGraphicItem(mark.graphicItem), mark.graphicItem = null;
45732
+ mark.graphicItem && (removeGraphicItem(mark.graphicItem), mark.elementMap.forEach(element => {
45733
+ element.resetGraphicItem();
45734
+ }), mark.graphicItem = null);
45727
45735
  }), this;
45728
45736
  }
45729
45737
  parseSpec(spec) {
@@ -51594,23 +51602,28 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
51594
51602
 
51595
51603
  class DimensionEvent {
51596
51604
  constructor(eventDispatcher, mode) {
51597
- var _a, _b;
51598
51605
  this._eventDispatcher = eventDispatcher;
51599
51606
  this._mode = mode;
51600
- this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
51607
+ }
51608
+ get chart() {
51609
+ var _a, _b;
51610
+ if (!this._chart) {
51611
+ this._chart = (_b = (_a = this._eventDispatcher.globalInstance).getChart) === null || _b === void 0 ? void 0 : _b.call(_a);
51612
+ }
51613
+ return this._chart;
51601
51614
  }
51602
51615
  register(eType, handler) {
51603
51616
  var _a, _b;
51604
- ((_b = (_a = this._chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error$1)('Method not implemented.');
51617
+ ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error$1)('Method not implemented.');
51605
51618
  }
51606
51619
  unregister() {
51607
51620
  var _a, _b;
51608
- ((_b = (_a = this._chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error$1)('Method not implemented.');
51621
+ ((_b = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getOption().onError) !== null && _b !== void 0 ? _b : error$1)('Method not implemented.');
51609
51622
  }
51610
51623
  getTargetDimensionInfo(x, y) {
51611
51624
  var _a, _b;
51612
- const cartesianInfo = (_a = getCartesianDimensionInfo(this._chart, { x, y })) !== null && _a !== void 0 ? _a : [];
51613
- const polarInfo = (_b = getPolarDimensionInfo(this._chart, { x, y })) !== null && _b !== void 0 ? _b : [];
51625
+ const cartesianInfo = (_a = getCartesianDimensionInfo(this.chart, { x, y })) !== null && _a !== void 0 ? _a : [];
51626
+ const polarInfo = (_b = getPolarDimensionInfo(this.chart, { x, y })) !== null && _b !== void 0 ? _b : [];
51614
51627
  const result = [].concat(cartesianInfo, polarInfo);
51615
51628
  if (result.length === 0) {
51616
51629
  return null;
@@ -51619,7 +51632,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
51619
51632
  }
51620
51633
  dispatch(v, opt) {
51621
51634
  var _a;
51622
- const axis = (_a = this._chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
51635
+ const axis = (_a = this.chart) === null || _a === void 0 ? void 0 : _a.getAllComponents().filter(c => {
51623
51636
  if (c.specKey !== 'axes') {
51624
51637
  return false;
51625
51638
  }
@@ -52521,10 +52534,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
52521
52534
  chart.afterCompile();
52522
52535
  this.updateDepend();
52523
52536
  }
52524
- clear(ctx) {
52537
+ clear(ctx, removeGraphicItems = false) {
52525
52538
  const { chart } = ctx;
52526
52539
  chart.clear();
52527
- this.releaseGrammar();
52540
+ this.releaseGrammar(removeGraphicItems);
52528
52541
  }
52529
52542
  renderAsync(morphConfig) {
52530
52543
  var _a;
@@ -52688,10 +52701,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
52688
52701
  this.isInited = false;
52689
52702
  this.isReleased = true;
52690
52703
  }
52691
- releaseGrammar() {
52692
- var _a;
52704
+ releaseGrammar(removeGraphicItems = false) {
52705
+ var _a, _b;
52693
52706
  this._releaseModel();
52694
- (_a = this._view) === null || _a === void 0 ? void 0 : _a.removeAllGrammars();
52707
+ if (removeGraphicItems) {
52708
+ (_a = this._view) === null || _a === void 0 ? void 0 : _a.removeAllGraphicItems();
52709
+ }
52710
+ (_b = this._view) === null || _b === void 0 ? void 0 : _b.removeAllGrammars();
52695
52711
  }
52696
52712
  _releaseModel() {
52697
52713
  Object.keys(this._model).forEach(type => {
@@ -57274,13 +57290,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
57274
57290
  return this;
57275
57291
  }
57276
57292
  _reCompile(updateResult) {
57277
- var _a, _b, _c, _d, _e;
57293
+ var _a, _b, _c, _d, _e, _f, _g;
57278
57294
  if (updateResult.reMake) {
57279
57295
  this._releaseData();
57280
57296
  this._initDataSet();
57281
57297
  this._chart.release();
57282
57298
  this._chart = null;
57283
- (_a = this._compiler) === null || _a === void 0 ? void 0 : _a.releaseGrammar();
57299
+ (_a = this._compiler) === null || _a === void 0 ? void 0 : _a.releaseGrammar(((_b = this._option) === null || _b === void 0 ? void 0 : _b.animation) === false || ((_c = this._spec) === null || _c === void 0 ? void 0 : _c.animation) === false);
57284
57300
  this._userEvents.forEach(e => { var _a; return (_a = this._event) === null || _a === void 0 ? void 0 : _a.on(e.eType, e.query, e.handler); });
57285
57301
  if (updateResult.reSize) {
57286
57302
  this._doResize();
@@ -57288,13 +57304,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
57288
57304
  }
57289
57305
  else {
57290
57306
  if (updateResult.reCompile) {
57291
- (_b = this._compiler) === null || _b === void 0 ? void 0 : _b.clear({ chart: this._chart, vChart: this });
57292
- (_c = this._compiler) === null || _c === void 0 ? void 0 : _c.compile({ chart: this._chart, vChart: this }, {});
57307
+ (_d = this._compiler) === null || _d === void 0 ? void 0 : _d.clear({ chart: this._chart, vChart: this }, !this._option.animation || !this._spec.animation);
57308
+ (_e = this._compiler) === null || _e === void 0 ? void 0 : _e.compile({ chart: this._chart, vChart: this }, {});
57293
57309
  }
57294
57310
  if (updateResult.reSize) {
57295
57311
  const { width, height } = this._getCurSize();
57296
57312
  this._chart.onResize(width, height);
57297
- (_e = (_d = this._compiler).resize) === null || _e === void 0 ? void 0 : _e.call(_d, width, height, false);
57313
+ (_g = (_f = this._compiler).resize) === null || _g === void 0 ? void 0 : _g.call(_f, width, height, false);
57298
57314
  }
57299
57315
  }
57300
57316
  }
@@ -58076,7 +58092,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
58076
58092
  };
58077
58093
  registerVChartCore();
58078
58094
 
58079
- const version = "1.6.4";
58095
+ const version = "1.6.6";
58080
58096
 
58081
58097
  class ChartData {
58082
58098
  get dataList() {
@@ -59638,7 +59654,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
59638
59654
  hover: {
59639
59655
  enable: true,
59640
59656
  trigger: 'pointermove',
59641
- triggerOff: ['pointermove', 'pointerleave']
59657
+ triggerOff: 'pointerleave'
59642
59658
  },
59643
59659
  select: {
59644
59660
  enable: true,
@@ -59651,7 +59667,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
59651
59667
  hover: {
59652
59668
  enable: true,
59653
59669
  trigger: ['pointerdown', 'pointermove'],
59654
- triggerOff: ['pointermove', 'pointerleave']
59670
+ triggerOff: 'pointerleave'
59655
59671
  },
59656
59672
  select: {
59657
59673
  enable: true,
@@ -59677,6 +59693,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
59677
59693
  if (this.filterEventMark(params)) {
59678
59694
  this.hoverItem(params);
59679
59695
  }
59696
+ else {
59697
+ this.unhoverItem();
59698
+ }
59680
59699
  };
59681
59700
  this.onUnHover = (params) => {
59682
59701
  if (this.filterEventMark(params) || this.interaction.filterEventMark(params, STATE_VALUE_ENUM.STATE_HOVER)) {