@visactor/vchart 1.11.14 → 1.11.15-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 (73) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +92 -27
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/base/base-chart.d.ts +1 -0
  6. package/cjs/chart/base/base-chart.js +5 -0
  7. package/cjs/chart/base/base-chart.js.map +1 -1
  8. package/cjs/chart/interface/chart.d.ts +1 -0
  9. package/cjs/chart/interface/chart.js.map +1 -1
  10. package/cjs/compile/compilable-base.js +2 -1
  11. package/cjs/compile/grammar-item.js +1 -2
  12. package/cjs/component/axis/cartesian/axis.js +13 -5
  13. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  14. package/cjs/component/axis/cartesian/time-axis.js +4 -1
  15. package/cjs/component/axis/cartesian/time-axis.js.map +1 -1
  16. package/cjs/component/axis/polar/axis.js +8 -2
  17. package/cjs/component/axis/polar/axis.js.map +1 -1
  18. package/cjs/component/axis/util.d.ts +3 -0
  19. package/cjs/component/axis/util.js +6 -2
  20. package/cjs/component/axis/util.js.map +1 -1
  21. package/cjs/core/index.d.ts +1 -1
  22. package/cjs/core/index.js +1 -1
  23. package/cjs/core/index.js.map +1 -1
  24. package/cjs/core/vchart.d.ts +1 -0
  25. package/cjs/core/vchart.js +3 -0
  26. package/cjs/core/vchart.js.map +1 -1
  27. package/cjs/interaction/interaction.d.ts +2 -0
  28. package/cjs/interaction/interaction.js +10 -0
  29. package/cjs/interaction/interaction.js.map +1 -1
  30. package/cjs/interaction/interface.d.ts +2 -0
  31. package/cjs/interaction/interface.js.map +1 -1
  32. package/cjs/series/base/base-series.d.ts +1 -1
  33. package/cjs/series/cartesian/cartesian.js.map +1 -1
  34. package/cjs/series/polar/polar.d.ts +1 -1
  35. package/cjs/series/polar/polar.js +1 -1
  36. package/cjs/series/polar/polar.js.map +1 -1
  37. package/cjs/series/sankey/sankey.js +12 -8
  38. package/cjs/series/sankey/sankey.js.map +1 -1
  39. package/esm/chart/base/base-chart.d.ts +1 -0
  40. package/esm/chart/base/base-chart.js +5 -0
  41. package/esm/chart/base/base-chart.js.map +1 -1
  42. package/esm/chart/interface/chart.d.ts +1 -0
  43. package/esm/chart/interface/chart.js.map +1 -1
  44. package/esm/compile/compilable-base.js +2 -1
  45. package/esm/compile/grammar-item.js +1 -2
  46. package/esm/component/axis/cartesian/axis.js +5 -4
  47. package/esm/component/axis/cartesian/axis.js.map +1 -1
  48. package/esm/component/axis/cartesian/time-axis.js +3 -3
  49. package/esm/component/axis/cartesian/time-axis.js.map +1 -1
  50. package/esm/component/axis/polar/axis.js +4 -3
  51. package/esm/component/axis/polar/axis.js.map +1 -1
  52. package/esm/component/axis/util.d.ts +3 -0
  53. package/esm/component/axis/util.js +4 -0
  54. package/esm/component/axis/util.js.map +1 -1
  55. package/esm/core/index.d.ts +1 -1
  56. package/esm/core/index.js +1 -1
  57. package/esm/core/index.js.map +1 -1
  58. package/esm/core/vchart.d.ts +1 -0
  59. package/esm/core/vchart.js +3 -0
  60. package/esm/core/vchart.js.map +1 -1
  61. package/esm/interaction/interaction.d.ts +2 -0
  62. package/esm/interaction/interaction.js +10 -0
  63. package/esm/interaction/interaction.js.map +1 -1
  64. package/esm/interaction/interface.d.ts +2 -0
  65. package/esm/interaction/interface.js.map +1 -1
  66. package/esm/series/base/base-series.d.ts +1 -1
  67. package/esm/series/cartesian/cartesian.js.map +1 -1
  68. package/esm/series/polar/polar.d.ts +1 -1
  69. package/esm/series/polar/polar.js +1 -1
  70. package/esm/series/polar/polar.js.map +1 -1
  71. package/esm/series/sankey/sankey.js +11 -8
  72. package/esm/series/sankey/sankey.js.map +1 -1
  73. package/package.json +14 -14
package/build/index.js CHANGED
@@ -31600,10 +31600,10 @@
31600
31600
  if (visible && isBoolean$1(bgVisible)) {
31601
31601
  const bgRect = this.createOrUpdateChild("tag-panel", Object.assign(Object.assign({}, backgroundStyle), {
31602
31602
  visible: bgVisible && !!text,
31603
- x: textShape.AABBBounds.x1,
31604
- y: textShape.AABBBounds.y1,
31605
- width: textShape.AABBBounds.width(),
31606
- height: textShape.AABBBounds.height()
31603
+ x: textShape.AABBBounds.x1 - parsedPadding[1],
31604
+ y: textShape.AABBBounds.y1 - parsedPadding[0],
31605
+ width: textShape.AABBBounds.width() + (parsedPadding[1] + parsedPadding[3]),
31606
+ height: textShape.AABBBounds.height() + (parsedPadding[0] + parsedPadding[2])
31607
31607
  }), "rect");
31608
31608
  if (isEmpty(null == state ? void 0 : state.panel) || (bgRect.states = state.panel), backgroundStyle.customShape) {
31609
31609
  const customShape = backgroundStyle.customShape;
@@ -57908,6 +57908,17 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
57908
57908
  }
57909
57909
  }
57910
57910
  }
57911
+ clearAllEventElement() {
57912
+ if (this._disableTriggerEvent) {
57913
+ return;
57914
+ }
57915
+ for (const [stateValue, elements] of this._stateElements) {
57916
+ elements.forEach(e => {
57917
+ e.clearStates();
57918
+ });
57919
+ this._stateElements.set(stateValue, []);
57920
+ }
57921
+ }
57911
57922
  reverseEventElement(stateValue) {
57912
57923
  if (this._disableTriggerEvent) {
57913
57924
  return;
@@ -57962,6 +57973,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
57962
57973
  });
57963
57974
  }
57964
57975
  }
57976
+ resetAllInteraction() {
57977
+ for (const [stateValue, interactions] of this._vgrammarInteractions) {
57978
+ if (interactions) {
57979
+ interactions.forEach(vgInteraction => {
57980
+ vgInteraction.reset(null);
57981
+ });
57982
+ }
57983
+ }
57984
+ }
57965
57985
  }
57966
57986
 
57967
57987
  class CompilableBase {
@@ -62108,6 +62128,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62108
62128
  }
62109
62129
  this._chart.clearState(state);
62110
62130
  }
62131
+ clearAllStates() {
62132
+ if (!this._chart) {
62133
+ return;
62134
+ }
62135
+ this._chart.clearAllStates();
62136
+ }
62111
62137
  clearSelected() {
62112
62138
  if (!this._chart) {
62113
62139
  return;
@@ -63580,6 +63606,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
63580
63606
  rawValue: value
63581
63607
  };
63582
63608
  }
63609
+ function shouldUpdateAxis(preHelper, curHelper, forceUpdate) {
63610
+ return forceUpdate || !preHelper || preHelper.getAxisId() === curHelper.getAxisId();
63611
+ }
63583
63612
 
63584
63613
  function limitTagInBounds(shape, bounds) {
63585
63614
  const { x1: regionMinX, y1: regionMinY, x2: regionMaxX, y2: regionMaxY } = bounds;
@@ -66855,7 +66884,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
66855
66884
  registerComponentPlugin(CanvasTooltipHandler);
66856
66885
  };
66857
66886
 
66858
- const version = "1.11.14";
66887
+ const version = "1.11.15-alpha.1";
66859
66888
 
66860
66889
  const addVChartProperty = (data, op) => {
66861
66890
  const context = op.beforeCall();
@@ -70069,13 +70098,19 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
70069
70098
  eachSeries(this._regions, s => {
70070
70099
  const orient = this.getOrient();
70071
70100
  if (isXAxis(orient)) {
70072
- s.setXAxisHelper(this.axisHelper());
70101
+ if (shouldUpdateAxis(s.getXAxisHelper(), this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
70102
+ s.setXAxisHelper(this.axisHelper());
70103
+ }
70073
70104
  }
70074
70105
  else if (isYAxis(orient)) {
70075
- s.setYAxisHelper(this.axisHelper());
70106
+ if (shouldUpdateAxis(s.getYAxisHelper(), this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
70107
+ s.setYAxisHelper(this.axisHelper());
70108
+ }
70076
70109
  }
70077
70110
  else if (isZAxis(orient)) {
70078
- s.setZAxisHelper(this.axisHelper());
70111
+ if (shouldUpdateAxis(s.getZAxisHelper(), this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
70112
+ s.setZAxisHelper(this.axisHelper());
70113
+ }
70079
70114
  }
70080
70115
  }, {
70081
70116
  userId: this._seriesUserId,
@@ -70445,16 +70480,22 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
70445
70480
  const orient = this.getOrient();
70446
70481
  eachSeries(this._regions, s => {
70447
70482
  if (isXAxis(orient)) {
70448
- s.setScaleX(this._scale);
70449
- s.setXAxisHelper(this.axisHelper());
70483
+ if (shouldUpdateAxis(s.getXAxisHelper(), this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
70484
+ s.setScaleX(this._scale);
70485
+ s.setXAxisHelper(this.axisHelper());
70486
+ }
70450
70487
  }
70451
70488
  else if (isYAxis(orient)) {
70452
- s.setScaleY(this._scale);
70453
- s.setYAxisHelper(this.axisHelper());
70489
+ if (shouldUpdateAxis(s.getYAxisHelper(), this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
70490
+ s.setScaleY(this._scale);
70491
+ s.setYAxisHelper(this.axisHelper());
70492
+ }
70454
70493
  }
70455
70494
  else if (isZAxis(orient)) {
70456
- s.setScaleZ(this._scale);
70457
- s.setZAxisHelper(this.axisHelper());
70495
+ if (shouldUpdateAxis(s.getZAxisHelper(), this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
70496
+ s.setScaleZ(this._scale);
70497
+ s.setZAxisHelper(this.axisHelper());
70498
+ }
70458
70499
  }
70459
70500
  }, {
70460
70501
  userId: this._seriesUserId,
@@ -71368,10 +71409,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
71368
71409
  this.computeData(params === null || params === void 0 ? void 0 : params.value);
71369
71410
  eachSeries(this._regions, s => {
71370
71411
  if (isXAxis(this.getOrient())) {
71371
- s.setXAxisHelper(this.axisHelper());
71412
+ if (shouldUpdateAxis(s.getXAxisHelper(), this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
71413
+ s.setXAxisHelper(this.axisHelper());
71414
+ }
71372
71415
  }
71373
71416
  else {
71374
- s.setYAxisHelper(this.axisHelper());
71417
+ if (shouldUpdateAxis(s.getYAxisHelper(), this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
71418
+ s.setYAxisHelper(this.axisHelper());
71419
+ }
71375
71420
  }
71376
71421
  }, {
71377
71422
  userId: this._seriesUserId,
@@ -72803,6 +72848,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
72803
72848
  return;
72804
72849
  });
72805
72850
  }
72851
+ clearAllStates() {
72852
+ this.getAllRegions().forEach(r => {
72853
+ r.interaction.clearAllEventElement();
72854
+ r.interaction.resetAllInteraction();
72855
+ return;
72856
+ });
72857
+ }
72806
72858
  clearSelected() {
72807
72859
  this.clearState(STATE_VALUE_ENUM.STATE_SELECTED);
72808
72860
  }
@@ -78257,7 +78309,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
78257
78309
  this._angleScale = s;
78258
78310
  return s;
78259
78311
  }
78260
- get angleAxisHelper() {
78312
+ getAngleAxisHelper() {
78261
78313
  return this._angleAxisHelper;
78262
78314
  }
78263
78315
  set angleAxisHelper(h) {
@@ -79377,10 +79429,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
79377
79429
  this.computeData(param === null || param === void 0 ? void 0 : param.value);
79378
79430
  eachSeries(this._regions, s => {
79379
79431
  if (this.getOrient() === 'radius') {
79380
- s.radiusAxisHelper = this.axisHelper();
79432
+ if (shouldUpdateAxis(s.radiusAxisHelper, this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
79433
+ s.radiusAxisHelper = this.axisHelper();
79434
+ }
79381
79435
  }
79382
79436
  else {
79383
- s.angleAxisHelper = this.axisHelper();
79437
+ if (shouldUpdateAxis(s.angleAxisHelper, this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
79438
+ s.angleAxisHelper = this.axisHelper();
79439
+ }
79384
79440
  }
79385
79441
  }, {
79386
79442
  userId: this._seriesUserId,
@@ -79470,12 +79526,16 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
79470
79526
  updateSeriesScale() {
79471
79527
  eachSeries(this._regions, s => {
79472
79528
  if (this.getOrient() === 'radius') {
79473
- s.setRadiusScale(this._scale);
79474
- s.radiusAxisHelper = this.axisHelper();
79529
+ if (shouldUpdateAxis(s.radiusAxisHelper, this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
79530
+ s.setRadiusScale(this._scale);
79531
+ s.radiusAxisHelper = this.axisHelper();
79532
+ }
79475
79533
  }
79476
79534
  else {
79477
- s.setAngleScale(this._scale);
79478
- s.angleAxisHelper = this.axisHelper();
79535
+ if (shouldUpdateAxis(s.angleAxisHelper, this.axisHelper(), isValid$1(this._seriesUserId) || isValid$1(this._seriesIndex))) {
79536
+ s.setAngleScale(this._scale);
79537
+ s.angleAxisHelper = this.axisHelper();
79538
+ }
79479
79539
  }
79480
79540
  }, {
79481
79541
  userId: this._seriesUserId,
@@ -87986,6 +88046,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
87986
88046
  this._initLabelMarkStyle();
87987
88047
  }
87988
88048
  _initNodeMarkStyle() {
88049
+ var _a, _b;
87989
88050
  const nodeMark = this._nodeMark;
87990
88051
  if (!nodeMark) {
87991
88052
  return;
@@ -87996,12 +88057,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
87996
88057
  },
87997
88058
  x1: (datum) => datum.x1,
87998
88059
  y: (datum) => datum.y0,
87999
- y1: (datum) => datum.y1,
88000
- fill: this._fillByNode
88060
+ y1: (datum) => datum.y1
88001
88061
  }, STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Mark);
88062
+ this.setMarkStyle(nodeMark, {
88063
+ fill: (_b = (_a = this._spec.node.style) === null || _a === void 0 ? void 0 : _a.fill) !== null && _b !== void 0 ? _b : this._fillByNode
88064
+ }, 'normal', exports.AttributeLevel.User_Mark);
88002
88065
  }
88003
88066
  _initLinkMarkStyle() {
88004
- var _a;
88067
+ var _a, _b, _c;
88005
88068
  const linkMark = this._linkMark;
88006
88069
  if (!linkMark) {
88007
88070
  return;
@@ -88012,9 +88075,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
88012
88075
  y0: (datum) => datum.y0,
88013
88076
  y1: (datum) => datum.y1,
88014
88077
  thickness: (datum) => datum.thickness,
88015
- fill: this._fillByLink,
88016
88078
  direction: (_a = this._spec.direction) !== null && _a !== void 0 ? _a : 'horizontal'
88017
88079
  }, STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
88080
+ this.setMarkStyle(linkMark, {
88081
+ fill: (_c = (_b = this._spec.link.style) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : this._fillByLink
88082
+ }, 'normal', exports.AttributeLevel.User_Mark);
88018
88083
  }
88019
88084
  _initLabelMarkStyle() {
88020
88085
  if (!this._labelMark) {