@visactor/vchart 1.11.13 → 1.11.15-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.
Files changed (61) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +75 -37
  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/chart/stack.js +2 -1
  11. package/cjs/compile/grammar-item.js +1 -2
  12. package/cjs/component/indicator/indicator.js +29 -16
  13. package/cjs/component/indicator/indicator.js.map +1 -1
  14. package/cjs/core/index.d.ts +1 -1
  15. package/cjs/core/index.js +1 -1
  16. package/cjs/core/index.js.map +1 -1
  17. package/cjs/core/vchart.d.ts +1 -0
  18. package/cjs/core/vchart.js +3 -0
  19. package/cjs/core/vchart.js.map +1 -1
  20. package/cjs/event/event-dispatcher.js +1 -2
  21. package/cjs/event/index.js +2 -1
  22. package/cjs/interaction/interaction.d.ts +2 -0
  23. package/cjs/interaction/interaction.js +10 -0
  24. package/cjs/interaction/interaction.js.map +1 -1
  25. package/cjs/interaction/interface.d.ts +2 -0
  26. package/cjs/interaction/interface.js.map +1 -1
  27. package/cjs/scale/global-scale.js +2 -0
  28. package/cjs/scale/global-scale.js.map +1 -1
  29. package/cjs/series/sankey/sankey.js +12 -8
  30. package/cjs/series/sankey/sankey.js.map +1 -1
  31. package/cjs/series/word-cloud/base.js +3 -3
  32. package/cjs/series/word-cloud/base.js.map +1 -1
  33. package/esm/chart/base/base-chart.d.ts +1 -0
  34. package/esm/chart/base/base-chart.js +5 -0
  35. package/esm/chart/base/base-chart.js.map +1 -1
  36. package/esm/chart/interface/chart.d.ts +1 -0
  37. package/esm/chart/interface/chart.js.map +1 -1
  38. package/esm/chart/stack.js +2 -1
  39. package/esm/compile/grammar-item.js +1 -2
  40. package/esm/component/indicator/indicator.js +29 -16
  41. package/esm/component/indicator/indicator.js.map +1 -1
  42. package/esm/core/index.d.ts +1 -1
  43. package/esm/core/index.js +1 -1
  44. package/esm/core/index.js.map +1 -1
  45. package/esm/core/vchart.d.ts +1 -0
  46. package/esm/core/vchart.js +3 -0
  47. package/esm/core/vchart.js.map +1 -1
  48. package/esm/event/event-dispatcher.js +1 -2
  49. package/esm/event/index.js +2 -1
  50. package/esm/interaction/interaction.d.ts +2 -0
  51. package/esm/interaction/interaction.js +10 -0
  52. package/esm/interaction/interaction.js.map +1 -1
  53. package/esm/interaction/interface.d.ts +2 -0
  54. package/esm/interaction/interface.js.map +1 -1
  55. package/esm/scale/global-scale.js +1 -0
  56. package/esm/scale/global-scale.js.map +1 -1
  57. package/esm/series/sankey/sankey.js +11 -8
  58. package/esm/series/sankey/sankey.js.map +1 -1
  59. package/esm/series/word-cloud/base.js +3 -3
  60. package/esm/series/word-cloud/base.js.map +1 -1
  61. package/package.json +15 -15
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;
@@ -42266,7 +42266,7 @@
42266
42266
  }
42267
42267
  }
42268
42268
  render() {
42269
- var _a;
42269
+ var _a, _b;
42270
42270
  if (this.removeAllChild(!0), !0 !== this.attribute.visible) return;
42271
42271
  const {
42272
42272
  title = {},
@@ -42278,7 +42278,8 @@
42278
42278
  group = this.createOrUpdateChild("indicator-container", {
42279
42279
  x: 0,
42280
42280
  y: 0,
42281
- zIndex: 1
42281
+ zIndex: 1,
42282
+ pickable: null === (_a = this.attribute.pickable) || void 0 === _a || _a
42282
42283
  }, "group");
42283
42284
  if (isValid$1(title) && (this._title = this._renderText(group, title, limit, limitRatio, "title.style", "indicator-title")), isValid$1(content)) {
42284
42285
  const contents = array(content),
@@ -42288,7 +42289,7 @@
42288
42289
  }), this._content = contentComponents;
42289
42290
  }
42290
42291
  this._setGlobalAutoFit(limit), this._setYPosition();
42291
- const totalHeight = null !== (_a = null == group ? void 0 : group.AABBBounds.height()) && void 0 !== _a ? _a : 0;
42292
+ const totalHeight = null !== (_b = null == group ? void 0 : group.AABBBounds.height()) && void 0 !== _b ? _b : 0;
42292
42293
  group.setAttribute("y", size.height / 2 - totalHeight / 2), group.setAttribute("x", size.width / 2);
42293
42294
  }
42294
42295
  _setLocalAutoFit(limit, indicatorItem, indicatorItemSpec) {
@@ -57907,6 +57908,17 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
57907
57908
  }
57908
57909
  }
57909
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
+ }
57910
57922
  reverseEventElement(stateValue) {
57911
57923
  if (this._disableTriggerEvent) {
57912
57924
  return;
@@ -57961,6 +57973,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
57961
57973
  });
57962
57974
  }
57963
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
+ }
57964
57985
  }
57965
57986
 
57966
57987
  class CompilableBase {
@@ -62107,6 +62128,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62107
62128
  }
62108
62129
  this._chart.clearState(state);
62109
62130
  }
62131
+ clearAllStates() {
62132
+ if (!this._chart) {
62133
+ return;
62134
+ }
62135
+ this._chart.clearAllStates();
62136
+ }
62110
62137
  clearSelected() {
62111
62138
  if (!this._chart) {
62112
62139
  return;
@@ -66854,7 +66881,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
66854
66881
  registerComponentPlugin(CanvasTooltipHandler);
66855
66882
  };
66856
66883
 
66857
- const version = "1.11.13";
66884
+ const version = "1.11.15-alpha.0";
66858
66885
 
66859
66886
  const addVChartProperty = (data, op) => {
66860
66887
  const context = op.beforeCall();
@@ -71786,6 +71813,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
71786
71813
  result.reMake = true;
71787
71814
  return result;
71788
71815
  }
71816
+ if (!isEqual$1(lastSpec.specified, s.specified)) {
71817
+ result.reMake = true;
71818
+ return result;
71819
+ }
71789
71820
  if (s.range && !isEqual$1(s.range, scale.range())) {
71790
71821
  scale.range(s.range);
71791
71822
  result.reRender = true;
@@ -72798,6 +72829,13 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
72798
72829
  return;
72799
72830
  });
72800
72831
  }
72832
+ clearAllStates() {
72833
+ this.getAllRegions().forEach(r => {
72834
+ r.interaction.clearAllEventElement();
72835
+ r.interaction.resetAllInteraction();
72836
+ return;
72837
+ });
72838
+ }
72801
72839
  clearSelected() {
72802
72840
  this.clearState(STATE_VALUE_ENUM.STATE_SELECTED);
72803
72841
  }
@@ -81808,12 +81846,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
81808
81846
  });
81809
81847
  }
81810
81848
  initMarkStyle() {
81811
- var _a, _b, _c;
81849
+ var _a, _b, _c, _d, _e;
81812
81850
  const wordMark = this._wordMark;
81813
81851
  const wordSpec = (_a = this._spec.word) !== null && _a !== void 0 ? _a : {};
81814
81852
  if (wordMark) {
81815
81853
  this.setMarkStyle(wordMark, {
81816
- fill: this.getWordColor,
81817
81854
  text: (datum) => datum[this._textField],
81818
81855
  x: (datum) => datum.x,
81819
81856
  y: (datum) => datum.y,
@@ -81825,7 +81862,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
81825
81862
  visible: (datum) => datum.visible
81826
81863
  }, 'normal', exports.AttributeLevel.Series);
81827
81864
  this.setMarkStyle(wordMark, {
81828
- fontFamily: (_c = (_b = wordSpec.style) === null || _b === void 0 ? void 0 : _b.fontFamily) !== null && _c !== void 0 ? _c : this._defaultFontFamily
81865
+ fontFamily: (_c = (_b = wordSpec.style) === null || _b === void 0 ? void 0 : _b.fontFamily) !== null && _c !== void 0 ? _c : this._defaultFontFamily,
81866
+ fill: (_e = (_d = wordSpec === null || wordSpec === void 0 ? void 0 : wordSpec.style) === null || _d === void 0 ? void 0 : _d.fill) !== null && _e !== void 0 ? _e : this.getWordColor
81829
81867
  }, 'normal', exports.AttributeLevel.User_Mark);
81830
81868
  }
81831
81869
  }
@@ -87981,6 +88019,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
87981
88019
  this._initLabelMarkStyle();
87982
88020
  }
87983
88021
  _initNodeMarkStyle() {
88022
+ var _a, _b;
87984
88023
  const nodeMark = this._nodeMark;
87985
88024
  if (!nodeMark) {
87986
88025
  return;
@@ -87991,12 +88030,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
87991
88030
  },
87992
88031
  x1: (datum) => datum.x1,
87993
88032
  y: (datum) => datum.y0,
87994
- y1: (datum) => datum.y1,
87995
- fill: this._fillByNode
88033
+ y1: (datum) => datum.y1
87996
88034
  }, STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Mark);
88035
+ this.setMarkStyle(nodeMark, {
88036
+ fill: (_b = (_a = this._spec.node.style) === null || _a === void 0 ? void 0 : _a.fill) !== null && _b !== void 0 ? _b : this._fillByNode
88037
+ }, 'normal', exports.AttributeLevel.User_Mark);
87997
88038
  }
87998
88039
  _initLinkMarkStyle() {
87999
- var _a;
88040
+ var _a, _b, _c;
88000
88041
  const linkMark = this._linkMark;
88001
88042
  if (!linkMark) {
88002
88043
  return;
@@ -88007,9 +88048,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
88007
88048
  y0: (datum) => datum.y0,
88008
88049
  y1: (datum) => datum.y1,
88009
88050
  thickness: (datum) => datum.thickness,
88010
- fill: this._fillByLink,
88011
88051
  direction: (_a = this._spec.direction) !== null && _a !== void 0 ? _a : 'horizontal'
88012
88052
  }, STATE_VALUE_ENUM.STATE_NORMAL, exports.AttributeLevel.Series);
88053
+ this.setMarkStyle(linkMark, {
88054
+ fill: (_c = (_b = this._spec.link.style) === null || _b === void 0 ? void 0 : _b.fill) !== null && _c !== void 0 ? _c : this._fillByLink
88055
+ }, 'normal', exports.AttributeLevel.User_Mark);
88013
88056
  }
88014
88057
  _initLabelMarkStyle() {
88015
88058
  if (!this._labelMark) {
@@ -97268,11 +97311,17 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97268
97311
  super.updateLayoutAttribute();
97269
97312
  }
97270
97313
  _getIndicatorAttrs() {
97314
+ if (this._spec.visible === false || (this._spec.fixed === false && this._activeDatum === null)) {
97315
+ return {
97316
+ visible: false
97317
+ };
97318
+ }
97271
97319
  const region = this._regions[0];
97272
97320
  const { width, height } = region.getLayoutRect();
97273
97321
  const { x, y } = region.getLayoutStartPoint();
97322
+ const _a = this._spec, { content, offsetX, offsetY, limitRatio, title } = _a, restSpec = __rest$7(_a, ["content", "offsetX", "offsetY", "limitRatio", "title"]);
97274
97323
  const contentComponentSpec = [];
97275
- array(this._spec.content).forEach((eachItem) => {
97324
+ array(content).forEach((eachItem) => {
97276
97325
  const contentSpec = mergeSpec({}, this._theme.content, eachItem);
97277
97326
  contentComponentSpec.push({
97278
97327
  visible: contentSpec.visible !== false && (contentSpec.field ? this._activeDatum !== null : true),
@@ -97284,29 +97333,18 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
97284
97333
  style: Object.assign(Object.assign({}, transformIndicatorStyle(pickWithout(contentSpec.style, ['text']), this._activeDatum)), { text: this._createText(contentSpec.field, contentSpec.style.text) })
97285
97334
  });
97286
97335
  });
97287
- return {
97288
- visible: this._spec.visible !== false && (this._spec.fixed !== false || this._activeDatum !== null),
97289
- size: {
97336
+ return Object.assign({ visible: true, size: {
97290
97337
  width: width,
97291
97338
  height: height
97292
- },
97293
- zIndex: this.layoutZIndex,
97294
- x: x,
97295
- y: y,
97296
- dx: this._spec.offsetX ? getActualNumValue(this._spec.offsetX, this._computeLayoutRadius()) : 0,
97297
- dy: this._spec.offsetY ? getActualNumValue(this._spec.offsetY, this._computeLayoutRadius()) : 0,
97298
- limitRatio: this._spec.limitRatio || Infinity,
97299
- title: {
97300
- visible: this._spec.title.visible !== false && (!isValid$1(this._spec.title.field) || this._activeDatum !== null),
97301
- space: this._spec.title.space || this._gap,
97302
- autoLimit: this._spec.title.autoLimit,
97303
- autoFit: this._spec.title.autoFit,
97304
- fitPercent: this._spec.title.fitPercent,
97305
- fitStrategy: this._spec.title.fitStrategy,
97306
- style: Object.assign(Object.assign({}, transformIndicatorStyle(pickWithout(this._spec.title.style, ['text']), this._activeDatum)), { text: this._createText(this._spec.title.field, this._spec.title.style.text) })
97307
- },
97308
- content: contentComponentSpec
97309
- };
97339
+ }, zIndex: this.layoutZIndex, x: x, y: y, dx: offsetX ? getActualNumValue(offsetX, this._computeLayoutRadius()) : 0, dy: offsetY ? getActualNumValue(offsetY, this._computeLayoutRadius()) : 0, limitRatio: limitRatio || Infinity, title: {
97340
+ visible: title.visible !== false && (!isValid$1(title.field) || this._activeDatum !== null),
97341
+ space: title.space || this._gap,
97342
+ autoLimit: title.autoLimit,
97343
+ autoFit: title.autoFit,
97344
+ fitPercent: title.fitPercent,
97345
+ fitStrategy: title.fitStrategy,
97346
+ style: Object.assign(Object.assign({}, transformIndicatorStyle(pickWithout(title.style, ['text']), this._activeDatum)), { text: this._createText(title.field, title.style.text) })
97347
+ }, content: contentComponentSpec }, restSpec);
97310
97348
  }
97311
97349
  _createOrUpdateIndicatorComponent(attrs) {
97312
97350
  if (this._indicatorComponent) {