@visactor/vchart 1.7.0-alpha.2 → 1.7.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 (73) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +35 -44
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/component/axis/base-axis.d.ts +1 -25
  6. package/cjs/component/axis/base-axis.js +2 -2
  7. package/cjs/component/axis/base-axis.js.map +1 -1
  8. package/cjs/component/axis/interface/spec.d.ts +5 -2
  9. package/cjs/component/axis/interface/spec.js.map +1 -1
  10. package/cjs/component/indicator/indicator.js.map +1 -1
  11. package/cjs/component/indicator/interface.d.ts +5 -1
  12. package/cjs/component/indicator/interface.js.map +1 -1
  13. package/cjs/component/label/interface.d.ts +3 -1
  14. package/cjs/component/label/interface.js.map +1 -1
  15. package/cjs/component/label/util.js +3 -1
  16. package/cjs/component/label/util.js.map +1 -1
  17. package/cjs/component/marker/interface.d.ts +4 -3
  18. package/cjs/component/marker/interface.js.map +1 -1
  19. package/cjs/component/marker/mark-point/interface/theme.js.map +1 -1
  20. package/cjs/component/title/interface/spec.d.ts +4 -2
  21. package/cjs/component/title/interface/spec.js.map +1 -1
  22. package/cjs/component/title/title.d.ts +3 -3
  23. package/cjs/component/title/title.js +12 -10
  24. package/cjs/component/title/title.js.map +1 -1
  25. package/cjs/component/tooltip/handler/base.d.ts +1 -1
  26. package/cjs/component/tooltip/handler/utils/common.d.ts +3 -2
  27. package/cjs/component/tooltip/handler/utils/common.js +7 -6
  28. package/cjs/component/tooltip/handler/utils/common.js.map +1 -1
  29. package/cjs/core/index.d.ts +1 -1
  30. package/cjs/core/index.js +1 -1
  31. package/cjs/core/index.js.map +1 -1
  32. package/cjs/mark/text.d.ts +3 -1
  33. package/cjs/mark/text.js +9 -3
  34. package/cjs/mark/text.js.map +1 -1
  35. package/cjs/typings/tooltip/line.d.ts +3 -2
  36. package/cjs/typings/tooltip/line.js.map +1 -1
  37. package/cjs/typings/visual.d.ts +3 -1
  38. package/cjs/typings/visual.js.map +1 -1
  39. package/esm/component/axis/base-axis.d.ts +1 -25
  40. package/esm/component/axis/base-axis.js +2 -2
  41. package/esm/component/axis/base-axis.js.map +1 -1
  42. package/esm/component/axis/interface/spec.d.ts +5 -2
  43. package/esm/component/axis/interface/spec.js.map +1 -1
  44. package/esm/component/indicator/indicator.js.map +1 -1
  45. package/esm/component/indicator/interface.d.ts +5 -1
  46. package/esm/component/indicator/interface.js.map +1 -1
  47. package/esm/component/label/interface.d.ts +3 -1
  48. package/esm/component/label/interface.js.map +1 -1
  49. package/esm/component/label/util.js +3 -1
  50. package/esm/component/label/util.js.map +1 -1
  51. package/esm/component/marker/interface.d.ts +4 -3
  52. package/esm/component/marker/interface.js.map +1 -1
  53. package/esm/component/marker/mark-point/interface/theme.js.map +1 -1
  54. package/esm/component/title/interface/spec.d.ts +4 -2
  55. package/esm/component/title/interface/spec.js.map +1 -1
  56. package/esm/component/title/title.d.ts +3 -3
  57. package/esm/component/title/title.js +17 -15
  58. package/esm/component/title/title.js.map +1 -1
  59. package/esm/component/tooltip/handler/base.d.ts +1 -1
  60. package/esm/component/tooltip/handler/utils/common.d.ts +3 -2
  61. package/esm/component/tooltip/handler/utils/common.js +7 -6
  62. package/esm/component/tooltip/handler/utils/common.js.map +1 -1
  63. package/esm/core/index.d.ts +1 -1
  64. package/esm/core/index.js +1 -1
  65. package/esm/core/index.js.map +1 -1
  66. package/esm/mark/text.d.ts +3 -1
  67. package/esm/mark/text.js +10 -2
  68. package/esm/mark/text.js.map +1 -1
  69. package/esm/typings/tooltip/line.d.ts +3 -2
  70. package/esm/typings/tooltip/line.js.map +1 -1
  71. package/esm/typings/visual.d.ts +3 -1
  72. package/esm/typings/visual.js.map +1 -1
  73. package/package.json +4 -4
package/build/index.js CHANGED
@@ -58630,7 +58630,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
58630
58630
  };
58631
58631
  registerVChartCore();
58632
58632
 
58633
- const version = "1.7.0-alpha.2";
58633
+ const version = "1.7.0";
58634
58634
 
58635
58635
  class ChartData {
58636
58636
  get dataList() {
@@ -62706,9 +62706,20 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
62706
62706
  this.type = TextMark.type;
62707
62707
  }
62708
62708
  _getDefaultStyle() {
62709
- const defaultStyle = Object.assign(Object.assign({}, super._getDefaultStyle()), { angle: 0, textAlign: 'center', lineWidth: 0 });
62709
+ const defaultStyle = Object.assign(Object.assign({}, super._getDefaultStyle()), { angle: 0, textAlign: 'center', lineWidth: 0, textConfig: [] });
62710
62710
  return defaultStyle;
62711
62711
  }
62712
+ _initProduct(group) {
62713
+ const view = this.getVGrammarView();
62714
+ const id = this.getProductId();
62715
+ if (this.getStyle('textType') === 'rich') {
62716
+ this._product = view.mark(GrammarMarkType.richtext, group !== null && group !== void 0 ? group : view.rootMark).id(id);
62717
+ }
62718
+ else {
62719
+ this._product = view.mark(GrammarMarkType.text, group !== null && group !== void 0 ? group : view.rootMark).id(id);
62720
+ }
62721
+ this._compiledProductId = id;
62722
+ }
62712
62723
  }
62713
62724
  TextMark.type = MarkTypeEnum.text;
62714
62725
 
@@ -76420,9 +76431,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
76420
76431
  LabelRule["line"] = "line";
76421
76432
  })(LabelRule || (LabelRule = {}));
76422
76433
  function textAttribute(labelInfo, datum, formatMethod, formatter) {
76434
+ var _a;
76423
76435
  const { labelMark, series } = labelInfo;
76424
76436
  const field = series.getMeasureField()[0];
76425
- const textAttribute = { text: datum[field], data: datum };
76437
+ const textAttribute = { text: datum[field], data: datum, textType: (_a = labelInfo.labelSpec.textType) !== null && _a !== void 0 ? _a : 'text' };
76426
76438
  const attributes = Object.keys(labelMark.stateStyle.normal);
76427
76439
  for (const key of attributes) {
76428
76440
  const attr = labelMark.getAttribute(key, datum);
@@ -80729,31 +80741,18 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
80729
80741
  : transformToGraphic(spec.subTick.style),
80730
80742
  state: transformStateStyle(spec.subTick.state)
80731
80743
  },
80732
- title: {
80733
- visible: spec.title.visible,
80734
- position: spec.title.position,
80735
- space: spec.title.space,
80736
- autoRotate: false,
80737
- angle: titleAngle ? degreeToRadian(titleAngle) : null,
80738
- textStyle: mergeSpec({}, titleTextStyle, transformToGraphic(spec.title.style)),
80739
- padding: spec.title.padding,
80740
- shape: {
80744
+ title: Object.assign({ visible: spec.title.visible, position: spec.title.position, space: spec.title.space, autoRotate: false, angle: titleAngle ? degreeToRadian(titleAngle) : null, textStyle: mergeSpec({}, titleTextStyle, transformToGraphic(spec.title.style)), padding: spec.title.padding, shape: {
80741
80745
  visible: (_b = spec.title.shape) === null || _b === void 0 ? void 0 : _b.visible,
80742
80746
  space: (_c = spec.title.shape) === null || _c === void 0 ? void 0 : _c.space,
80743
80747
  style: transformToGraphic((_d = spec.title.shape) === null || _d === void 0 ? void 0 : _d.style)
80744
- },
80745
- background: {
80748
+ }, background: {
80746
80749
  visible: (_e = spec.title.background) === null || _e === void 0 ? void 0 : _e.visible,
80747
80750
  style: transformToGraphic((_f = spec.title.background) === null || _f === void 0 ? void 0 : _f.style)
80748
- },
80749
- state: {
80751
+ }, state: {
80750
80752
  text: transformStateStyle(spec.title.state),
80751
80753
  shape: transformStateStyle((_g = spec.title.shape) === null || _g === void 0 ? void 0 : _g.state),
80752
80754
  background: transformStateStyle((_h = spec.title.background) === null || _h === void 0 ? void 0 : _h.state)
80753
- },
80754
- pickable: ((_j = spec.title.style) === null || _j === void 0 ? void 0 : _j.pickable) !== false,
80755
- childrenPickable: ((_k = spec.title.style) === null || _k === void 0 ? void 0 : _k.pickable) !== false
80756
- },
80755
+ }, pickable: ((_j = spec.title.style) === null || _j === void 0 ? void 0 : _j.pickable) !== false, childrenPickable: ((_k = spec.title.style) === null || _k === void 0 ? void 0 : _k.pickable) !== false }, spec.title),
80757
80756
  panel: {
80758
80757
  visible: (_l = spec.background) === null || _l === void 0 ? void 0 : _l.visible,
80759
80758
  style: transformToGraphic((_m = spec.background) === null || _m === void 0 ? void 0 : _m.style),
@@ -83399,21 +83398,29 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
83399
83398
  };
83400
83399
  const measureTooltipText = (text, style) => {
83401
83400
  var _a;
83402
- text = (text !== null && text !== void 0 ? text : '').toString();
83403
83401
  let textLines;
83404
- if (style.multiLine) {
83405
- textLines = text.split('\n');
83406
- textLines = textLines.map((line, i) => (i < textLines.length - 1 ? line + '\n' : line));
83402
+ let textConfig;
83403
+ if (!((text === null || text === void 0 ? void 0 : text.type) === 'rich' || (text === null || text === void 0 ? void 0 : text.type) === 'html')) {
83404
+ text = (text !== null && text !== void 0 ? text : '').toString();
83405
+ if (style.multiLine) {
83406
+ textLines = text.split('\n');
83407
+ textLines = textLines.map((line, i) => (i < textLines.length - 1 ? line + '\n' : line));
83408
+ }
83409
+ else {
83410
+ textLines = [text];
83411
+ }
83412
+ textConfig = textLines.map(line => (Object.assign(Object.assign({}, style), { text: line })));
83407
83413
  }
83408
83414
  else {
83409
- textLines = [text];
83415
+ textConfig = text.text;
83416
+ textLines = text;
83410
83417
  }
83411
83418
  const bound = getRichTextBounds({
83412
83419
  wordBreak: (_a = style.wordBreak) !== null && _a !== void 0 ? _a : 'break-word',
83413
83420
  maxWidth: style.maxWidth ? style.maxWidth : undefined,
83414
83421
  width: 0,
83415
83422
  height: 0,
83416
- textConfig: textLines.map(line => (Object.assign(Object.assign({}, style), { text: line })))
83423
+ textConfig: textConfig
83417
83424
  });
83418
83425
  return {
83419
83426
  width: bound.width(),
@@ -89589,25 +89596,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
89589
89596
  };
89590
89597
  }
89591
89598
  _getTitleAttrs() {
89592
- var _a, _b, _c, _d, _e, _f, _g;
89599
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
89593
89600
  const realWidth = Math.max(0, (_a = this._spec.width) !== null && _a !== void 0 ? _a : this.getLayoutRect().width);
89594
- return {
89595
- text: (_b = this._spec.text) !== null && _b !== void 0 ? _b : '',
89596
- subtext: (_c = this._spec.subtext) !== null && _c !== void 0 ? _c : '',
89597
- x: (_d = this._spec.x) !== null && _d !== void 0 ? _d : 0,
89598
- y: (_e = this._spec.y) !== null && _e !== void 0 ? _e : 0,
89599
- width: realWidth,
89600
- height: this._spec.height,
89601
- minWidth: this._spec.minWidth,
89602
- maxWidth: this._spec.maxWidth,
89603
- minHeight: this._spec.minHeight,
89604
- maxHeight: this._spec.maxHeight,
89605
- padding: this._spec.innerPadding,
89606
- align: (_f = this._spec.align) !== null && _f !== void 0 ? _f : 'left',
89607
- verticalAlign: (_g = this._spec.verticalAlign) !== null && _g !== void 0 ? _g : 'top',
89608
- textStyle: Object.assign({ width: realWidth }, this._spec.textStyle),
89609
- subtextStyle: Object.assign({ width: realWidth }, this._spec.subtextStyle)
89610
- };
89601
+ return Object.assign(Object.assign({}, pickWithout(this._spec, ['padding'])), { textType: (_b = this._spec.textType) !== null && _b !== void 0 ? _b : 'text', text: (_c = this._spec.text) !== null && _c !== void 0 ? _c : '', subtextType: (_d = this._spec.subtextType) !== null && _d !== void 0 ? _d : 'text', subtext: (_e = this._spec.subtext) !== null && _e !== void 0 ? _e : '', x: (_f = this._spec.x) !== null && _f !== void 0 ? _f : 0, y: (_g = this._spec.y) !== null && _g !== void 0 ? _g : 0, width: realWidth, height: this._spec.height, minWidth: this._spec.minWidth, maxWidth: this._spec.maxWidth, minHeight: this._spec.minHeight, maxHeight: this._spec.maxHeight, padding: this._spec.innerPadding, align: (_h = this._spec.align) !== null && _h !== void 0 ? _h : 'left', verticalAlign: (_j = this._spec.verticalAlign) !== null && _j !== void 0 ? _j : 'top', textStyle: Object.assign({ width: realWidth }, this._spec.textStyle), subtextStyle: Object.assign({ width: realWidth }, this._spec.subtextStyle) });
89611
89602
  }
89612
89603
  _createOrUpdateTitleComponent(attrs) {
89613
89604
  if (this._titleComponent) {