@visactor/vrender-components 0.16.17-alpha.2 → 0.16.17-alpha.3

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 (81) hide show
  1. package/cjs/axis/base.js +22 -11
  2. package/cjs/axis/base.js.map +1 -1
  3. package/cjs/axis/line.js +1 -1
  4. package/cjs/axis/line.js.map +1 -1
  5. package/cjs/axis/type.d.ts +6 -3
  6. package/cjs/axis/type.js.map +1 -1
  7. package/cjs/index.d.ts +1 -1
  8. package/cjs/index.js +1 -1
  9. package/cjs/index.js.map +1 -1
  10. package/cjs/indicator/indicator.js +50 -6
  11. package/cjs/indicator/indicator.js.map +1 -1
  12. package/cjs/indicator/type.d.ts +5 -2
  13. package/cjs/indicator/type.js.map +1 -1
  14. package/cjs/label/arc.d.ts +4 -3
  15. package/cjs/label/arc.js.map +1 -1
  16. package/cjs/label/base.d.ts +11 -11
  17. package/cjs/label/base.js +21 -3
  18. package/cjs/label/base.js.map +1 -1
  19. package/cjs/label/type.d.ts +8 -5
  20. package/cjs/label/type.js.map +1 -1
  21. package/cjs/marker/point.d.ts +1 -1
  22. package/cjs/marker/type.js.map +1 -1
  23. package/cjs/tag/tag.js +90 -40
  24. package/cjs/tag/tag.js.map +1 -1
  25. package/cjs/tag/type.d.ts +4 -3
  26. package/cjs/tag/type.js.map +1 -1
  27. package/cjs/title/title.js +111 -47
  28. package/cjs/title/title.js.map +1 -1
  29. package/cjs/title/type.d.ts +10 -5
  30. package/cjs/title/type.js.map +1 -1
  31. package/cjs/tooltip/tooltip.js +56 -11
  32. package/cjs/tooltip/tooltip.js.map +1 -1
  33. package/cjs/tooltip/type.d.ts +7 -2
  34. package/cjs/tooltip/type.js.map +1 -1
  35. package/cjs/tooltip/util.js +9 -1
  36. package/cjs/tooltip/util.js.map +1 -1
  37. package/cjs/util/label-smartInvert.d.ts +2 -2
  38. package/cjs/util/label-smartInvert.js +5 -9
  39. package/cjs/util/label-smartInvert.js.map +1 -1
  40. package/dist/index.js +293 -165
  41. package/dist/index.min.js +1 -1
  42. package/es/axis/base.js +23 -11
  43. package/es/axis/base.js.map +1 -1
  44. package/es/axis/line.js +1 -1
  45. package/es/axis/line.js.map +1 -1
  46. package/es/axis/type.d.ts +6 -3
  47. package/es/axis/type.js.map +1 -1
  48. package/es/index.d.ts +1 -1
  49. package/es/index.js +1 -1
  50. package/es/index.js.map +1 -1
  51. package/es/indicator/indicator.js +50 -6
  52. package/es/indicator/indicator.js.map +1 -1
  53. package/es/indicator/type.d.ts +5 -2
  54. package/es/indicator/type.js.map +1 -1
  55. package/es/label/arc.d.ts +4 -3
  56. package/es/label/arc.js.map +1 -1
  57. package/es/label/base.d.ts +11 -11
  58. package/es/label/base.js +22 -4
  59. package/es/label/base.js.map +1 -1
  60. package/es/label/type.d.ts +8 -5
  61. package/es/label/type.js.map +1 -1
  62. package/es/marker/point.d.ts +1 -1
  63. package/es/marker/type.js.map +1 -1
  64. package/es/tag/tag.js +88 -38
  65. package/es/tag/tag.js.map +1 -1
  66. package/es/tag/type.d.ts +4 -3
  67. package/es/tag/type.js.map +1 -1
  68. package/es/title/title.js +111 -45
  69. package/es/title/title.js.map +1 -1
  70. package/es/title/type.d.ts +10 -5
  71. package/es/title/type.js.map +1 -1
  72. package/es/tooltip/tooltip.js +56 -11
  73. package/es/tooltip/tooltip.js.map +1 -1
  74. package/es/tooltip/type.d.ts +7 -2
  75. package/es/tooltip/type.js.map +1 -1
  76. package/es/tooltip/util.js +9 -1
  77. package/es/tooltip/util.js.map +1 -1
  78. package/es/util/label-smartInvert.d.ts +2 -2
  79. package/es/util/label-smartInvert.js +5 -9
  80. package/es/util/label-smartInvert.js.map +1 -1
  81. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -20795,18 +20795,18 @@
20795
20795
 
20796
20796
  const defaultAlternativeColors = ['#ffffff', '#000000'];
20797
20797
  const { Color } = vutils.ColorUtil;
20798
- function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors, mode) {
20798
+ function labelSmartInvert(foregroundColorOrigin, backgroundColorOrogin, textType, contrastRatiosThreshold, alternativeColors) {
20799
20799
  if (typeof foregroundColorOrigin !== 'string' || typeof backgroundColorOrogin !== 'string') {
20800
20800
  return foregroundColorOrigin;
20801
20801
  }
20802
20802
  const foregroundColor = new Color(foregroundColorOrigin).toHex();
20803
20803
  const backgroundColor = new Color(backgroundColorOrogin).toHex();
20804
- if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, mode)) {
20805
- return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
20804
+ if (!contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold)) {
20805
+ return improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
20806
20806
  }
20807
20807
  return foregroundColor;
20808
20808
  }
20809
- function improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode) {
20809
+ function improveContrastReverse(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors) {
20810
20810
  const alternativeColorPalletes = [];
20811
20811
  if (alternativeColors) {
20812
20812
  if (alternativeColors instanceof Array) {
@@ -20821,27 +20821,13 @@
20821
20821
  if (foregroundColor === alternativeColor) {
20822
20822
  continue;
20823
20823
  }
20824
- if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold, mode)) {
20824
+ if (contrastAccessibilityChecker(alternativeColor, backgroundColor, textType, contrastRatiosThreshold)) {
20825
20825
  return alternativeColor;
20826
20826
  }
20827
20827
  }
20828
20828
  return undefined;
20829
20829
  }
20830
- function contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, mode) {
20831
- if (mode === 'lightness') {
20832
- const backgroundColorLightness = Color.getColorBrightness(new Color(backgroundColor));
20833
- const foregroundColorLightness = Color.getColorBrightness(new Color(foregroundColor));
20834
- if (foregroundColorLightness < 0.5) {
20835
- if (backgroundColorLightness >= 0.5) {
20836
- return true;
20837
- }
20838
- return false;
20839
- }
20840
- if (backgroundColorLightness < 0.5) {
20841
- return true;
20842
- }
20843
- return false;
20844
- }
20830
+ function contrastAccessibilityChecker(foregroundColor, backgroundColor, textType, contrastRatiosThreshold) {
20845
20831
  if (contrastRatiosThreshold) {
20846
20832
  if (contrastRatios(foregroundColor, backgroundColor) > contrastRatiosThreshold) {
20847
20833
  return true;
@@ -21000,8 +20986,8 @@
21000
20986
  this.name = 'tag';
21001
20987
  }
21002
20988
  render() {
21003
- var _a;
21004
- const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state } = this.attribute;
20989
+ var _a, _b, _c;
20990
+ const { text = '', textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type = 'text' } = this.attribute;
21005
20991
  const parsedPadding = vutils.normalizePadding(padding);
21006
20992
  const group = this.createOrUpdateChild('tag-content', { x: 0, y: 0, zIndex: 1 }, 'group');
21007
20993
  let symbol;
@@ -21023,75 +21009,100 @@
21023
21009
  }
21024
21010
  tagWidth += symbolPlaceWidth;
21025
21011
  textX += symbolPlaceWidth;
21026
- const textAttrs = Object.assign(Object.assign({ text, visible: vutils.isValid(text) && visible !== false, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize }, textStyle), { x: textX, y: 0 });
21027
- if (vutils.isNil(textAttrs.lineHeight)) {
21028
- textAttrs.lineHeight = textAttrs.fontSize;
21029
- }
21030
- const textShape = group.createOrUpdateChild('tag-text', textAttrs, 'text');
21031
- if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.text)) {
21032
- textShape.states = state.text;
21033
- }
21034
- const textBounds = measureTextSize(textAttrs.text, textStyle);
21035
- const textWidth = textBounds.width;
21036
- const textHeight = textBounds.height;
21037
- tagWidth += textWidth;
21038
- const size = (_a = shape.size) !== null && _a !== void 0 ? _a : 10;
21039
- const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
21040
- tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
21041
- const { textAlign, textBaseline } = textStyle;
21042
- if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
21043
- if (vutils.isValid(minWidth) && tagWidth < minWidth) {
21044
- tagWidth = minWidth;
21045
- }
21046
- if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
21047
- tagWidth = maxWidth;
21048
- textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
21049
- }
21050
- }
21051
- let x = 0;
21052
- let y = 0;
21053
- if (textAlign === 'center') {
21054
- x -= tagWidth / 2;
21055
- if (symbol) {
21056
- symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
21012
+ let textShape;
21013
+ if (type === 'rich') {
21014
+ const richTextAttrs = Object.assign(Object.assign({ textConfig: text, visible: vutils.isValid(text) && visible !== false }, textStyle), { x: textX, y: 0, width: (_a = textStyle.width) !== null && _a !== void 0 ? _a : 0, height: (_b = textStyle.height) !== null && _b !== void 0 ? _b : 0 });
21015
+ textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
21016
+ const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
21017
+ if (visible && vutils.isBoolean(bgVisible)) {
21018
+ const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x: textShape.AABBBounds.x1, y: textShape.AABBBounds.y1, width: textShape.AABBBounds.width(), height: textShape.AABBBounds.height() }), 'rect');
21019
+ if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
21020
+ bgRect.states = state.panel;
21021
+ }
21057
21022
  }
21058
- group.setAttribute('x', -symbolPlaceWidth / 2);
21059
21023
  }
21060
- else if (textAlign === 'right' || textAlign === 'end') {
21061
- x -= tagWidth;
21062
- if (symbol) {
21063
- symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
21024
+ else if (type === 'html') {
21025
+ const richTextAttrs = Object.assign(Object.assign({ textConfig: [], visible: vutils.isValid(text) && visible !== false, html: Object.assign({ dom: text, container: '', width: 30, height: 30, style: {} }, textStyle) }, textStyle), { x: textX, y: 0 });
21026
+ textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
21027
+ const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
21028
+ if (visible && vutils.isBoolean(bgVisible)) {
21029
+ const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x: textShape.AABBBounds.x1, y: textShape.AABBBounds.y1, width: textShape.AABBBounds.width(), height: textShape.AABBBounds.height() }), 'rect');
21030
+ if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
21031
+ bgRect.states = state.panel;
21032
+ }
21064
21033
  }
21065
- group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
21066
- }
21067
- else if (textAlign === 'left' || textAlign === 'start') {
21068
- group.setAttribute('x', parsedPadding[3]);
21069
21034
  }
21070
- if (textBaseline === 'middle') {
21071
- y -= tagHeight / 2;
21072
- if (symbol) {
21073
- symbol.setAttribute('y', 0);
21035
+ else {
21036
+ const textAttrs = Object.assign(Object.assign({ text: text, visible: vutils.isValid(text) && visible !== false, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize }, textStyle), { x: textX, y: 0 });
21037
+ if (vutils.isNil(textAttrs.lineHeight)) {
21038
+ textAttrs.lineHeight = textStyle.fontSize;
21039
+ }
21040
+ textShape = group.createOrUpdateChild('tag-text', textAttrs, 'text');
21041
+ if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.text)) {
21042
+ textShape.states = state.text;
21043
+ }
21044
+ const textBounds = measureTextSize(textAttrs.text, textStyle);
21045
+ const textWidth = textBounds.width;
21046
+ const textHeight = textBounds.height;
21047
+ tagWidth += textWidth;
21048
+ const size = (_c = shape.size) !== null && _c !== void 0 ? _c : 10;
21049
+ const maxSize = vutils.isNumber(size) ? size : Math.max(size[0], size[1]);
21050
+ tagHeight += Math.max(textHeight, (shape === null || shape === void 0 ? void 0 : shape.visible) ? maxSize : 0);
21051
+ const { textAlign, textBaseline } = textStyle;
21052
+ if (vutils.isValid(minWidth) || vutils.isValid(maxWidth)) {
21053
+ if (vutils.isValid(minWidth) && tagWidth < minWidth) {
21054
+ tagWidth = minWidth;
21055
+ }
21056
+ if (vutils.isValid(maxWidth) && tagWidth > maxWidth) {
21057
+ tagWidth = maxWidth;
21058
+ textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
21059
+ }
21074
21060
  }
21075
- }
21076
- else if (textBaseline === 'bottom') {
21077
- y -= tagHeight;
21078
- if (symbol) {
21079
- symbol.setAttribute('y', -textHeight / 2);
21061
+ let x = 0;
21062
+ let y = 0;
21063
+ if (textAlign === 'center') {
21064
+ x -= tagWidth / 2;
21065
+ if (symbol) {
21066
+ symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
21067
+ }
21068
+ group.setAttribute('x', -symbolPlaceWidth / 2);
21080
21069
  }
21081
- group.setAttribute('y', -parsedPadding[2]);
21082
- }
21083
- else if (textBaseline === 'top') {
21084
- group.setAttribute('y', parsedPadding[0]);
21085
- if (symbol) {
21086
- symbol.setAttribute('y', textHeight / 2);
21070
+ else if (textAlign === 'right' || textAlign === 'end') {
21071
+ x -= tagWidth;
21072
+ if (symbol) {
21073
+ symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
21074
+ }
21075
+ group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
21087
21076
  }
21088
- }
21089
- const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
21090
- if (visible && vutils.isBoolean(bgVisible)) {
21091
- const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x,
21092
- y, width: tagWidth, height: tagHeight }), 'rect');
21093
- if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
21094
- bgRect.states = state.panel;
21077
+ else if (textAlign === 'left' || textAlign === 'start') {
21078
+ group.setAttribute('x', parsedPadding[3]);
21079
+ }
21080
+ if (textBaseline === 'middle') {
21081
+ y -= tagHeight / 2;
21082
+ if (symbol) {
21083
+ symbol.setAttribute('y', 0);
21084
+ }
21085
+ }
21086
+ else if (textBaseline === 'bottom') {
21087
+ y -= tagHeight;
21088
+ if (symbol) {
21089
+ symbol.setAttribute('y', -textHeight / 2);
21090
+ }
21091
+ group.setAttribute('y', -parsedPadding[2]);
21092
+ }
21093
+ else if (textBaseline === 'top') {
21094
+ group.setAttribute('y', parsedPadding[0]);
21095
+ if (symbol) {
21096
+ symbol.setAttribute('y', textHeight / 2);
21097
+ }
21098
+ }
21099
+ const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
21100
+ if (visible && vutils.isBoolean(bgVisible)) {
21101
+ const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, x,
21102
+ y, width: tagWidth, height: tagHeight }), 'rect');
21103
+ if (!vutils.isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
21104
+ bgRect.states = state.panel;
21105
+ }
21095
21106
  }
21096
21107
  }
21097
21108
  }
@@ -22360,6 +22371,24 @@
22360
22371
  target.states = state;
22361
22372
  }
22362
22373
  _createLabelText(attributes) {
22374
+ var _a, _b;
22375
+ if (attributes.textType === 'rich') {
22376
+ attributes.textConfig = attributes.text;
22377
+ attributes.width = (_a = attributes.width) !== null && _a !== void 0 ? _a : 0;
22378
+ attributes.height = (_b = attributes.height) !== null && _b !== void 0 ? _b : 0;
22379
+ const text = createRichText(attributes);
22380
+ this._bindEvent(text);
22381
+ this._setStatesOfText(text);
22382
+ return text;
22383
+ }
22384
+ else if (attributes.textType === 'html') {
22385
+ attributes.textConfig = [];
22386
+ attributes.html = Object.assign({ dom: attributes.text, container: '', width: 30, height: 30, style: {} }, attributes);
22387
+ const text = createRichText(attributes);
22388
+ this._bindEvent(text);
22389
+ this._setStatesOfText(text);
22390
+ return text;
22391
+ }
22363
22392
  const text = createText(attributes);
22364
22393
  this._bindEvent(text);
22365
22394
  this._setStatesOfText(text);
@@ -22739,7 +22768,7 @@
22739
22768
  _smartInvert(labels) {
22740
22769
  var _a, _b, _c, _d, _e;
22741
22770
  const option = (this.attribute.smartInvert || {});
22742
- const { textType, contrastRatiosThreshold, alternativeColors, mode } = option;
22771
+ const { textType, contrastRatiosThreshold, alternativeColors } = option;
22743
22772
  const fillStrategy = (_a = option.fillStrategy) !== null && _a !== void 0 ? _a : 'invertBase';
22744
22773
  const strokeStrategy = (_b = option.strokeStrategy) !== null && _b !== void 0 ? _b : 'base';
22745
22774
  const brightColor = (_c = option.brightColor) !== null && _c !== void 0 ? _c : '#ffffff';
@@ -22757,7 +22786,7 @@
22757
22786
  const backgroundColor = baseMark.attribute.fill;
22758
22787
  const foregroundColor = label.attribute.fill;
22759
22788
  const baseColor = backgroundColor;
22760
- const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode);
22789
+ const invertColor = labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors);
22761
22790
  const similarColor = contrastAccessibilityChecker(invertColor, brightColor) ? brightColor : darkColor;
22762
22791
  if (outsideEnable) {
22763
22792
  const fill = smartInvertStrategy(fillStrategy, baseColor, invertColor, similarColor);
@@ -22785,7 +22814,7 @@
22785
22814
  }
22786
22815
  if (label.attribute.stroke) {
22787
22816
  label.setAttributes({
22788
- fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors, mode)
22817
+ fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
22789
22818
  });
22790
22819
  continue;
22791
22820
  }
@@ -24322,12 +24351,26 @@
24322
24351
  let textAlign = 'center';
24323
24352
  let textBaseline = 'middle';
24324
24353
  data.forEach((item, index) => {
24325
- var _a, _b;
24354
+ var _a, _b, _c, _d;
24326
24355
  const labelStyle = this._getLabelAttribute(item, index, data, layer);
24327
- const text = createText(labelStyle);
24356
+ let text;
24357
+ if ((labelStyle === null || labelStyle === void 0 ? void 0 : labelStyle.type) === 'rich') {
24358
+ labelStyle.textConfig = labelStyle.text;
24359
+ labelStyle.width = (_a = labelStyle.width) !== null && _a !== void 0 ? _a : 0;
24360
+ labelStyle.height = (_b = labelStyle.height) !== null && _b !== void 0 ? _b : 0;
24361
+ text = createRichText(labelStyle);
24362
+ }
24363
+ else if ((labelStyle === null || labelStyle === void 0 ? void 0 : labelStyle.type) === 'html') {
24364
+ labelStyle.textConfig = [];
24365
+ labelStyle.html = Object.assign({ dom: labelStyle.text, container: '', width: 30, height: 30, style: {} }, labelStyle);
24366
+ text = createRichText(labelStyle);
24367
+ }
24368
+ else {
24369
+ text = createText(labelStyle);
24370
+ }
24328
24371
  text.name = exports.AXIS_ELEMENT_NAME.label;
24329
24372
  text.id = this._getNodeId(`layer${layer}-label-${item.id}`);
24330
- if (vutils.isEmpty((_a = this.attribute.label) === null || _a === void 0 ? void 0 : _a.state)) {
24373
+ if (vutils.isEmpty((_c = this.attribute.label) === null || _c === void 0 ? void 0 : _c.state)) {
24331
24374
  text.states = DEFAULT_STATES$2;
24332
24375
  }
24333
24376
  else {
@@ -24340,7 +24383,7 @@
24340
24383
  text.states = labelState;
24341
24384
  }
24342
24385
  labelGroup.add(text);
24343
- const angle = (_b = labelStyle.angle) !== null && _b !== void 0 ? _b : 0;
24386
+ const angle = (_d = labelStyle.angle) !== null && _d !== void 0 ? _d : 0;
24344
24387
  maxTextWidth = Math.max(maxTextWidth, text.AABBBounds.width());
24345
24388
  maxTextHeight = Math.max(maxTextHeight, text.AABBBounds.height());
24346
24389
  if (angle) {
@@ -24489,7 +24532,7 @@
24489
24532
  }
24490
24533
  _getLabelAttribute(tickDatum, index, tickData, layer) {
24491
24534
  var _a, _b, _c, _d, _e, _f;
24492
- const _g = this.attribute.label, { space = 4, inside = false, formatMethod } = _g, tagAttributes = __rest(_g, ["space", "inside", "formatMethod"]);
24535
+ const _g = this.attribute.label, { space = 4, inside = false, formatMethod, type = 'text', text } = _g, tagAttributes = __rest(_g, ["space", "inside", "formatMethod", "type", "text"]);
24493
24536
  let offset = space;
24494
24537
  let tickLength = 0;
24495
24538
  if (((_a = this.attribute.tick) === null || _a === void 0 ? void 0 : _a.visible) && ((_b = this.attribute.tick) === null || _b === void 0 ? void 0 : _b.inside) === inside) {
@@ -24510,7 +24553,9 @@
24510
24553
  }
24511
24554
  const point = this.getVerticalCoord(tickDatum.point, offset, inside);
24512
24555
  const vector = this.getVerticalVector(offset, inside, point);
24513
- const text = formatMethod ? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer) : tickDatum.label;
24556
+ const textContent = formatMethod
24557
+ ? formatMethod(`${tickDatum.label}`, tickDatum, index, tickData, layer)
24558
+ : tickDatum.label;
24514
24559
  let { style: textStyle } = tagAttributes;
24515
24560
  textStyle = vutils.isFunction(textStyle)
24516
24561
  ? vutils.merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))
@@ -24525,7 +24570,7 @@
24525
24570
  layer
24526
24571
  });
24527
24572
  }
24528
- return Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, text, textStyle)), { text, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize }), textStyle);
24573
+ return Object.assign(Object.assign(Object.assign({}, this.getLabelPosition(point, vector, textContent, textStyle)), { text: text !== null && text !== void 0 ? text : textContent, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize, type }), textStyle);
24529
24574
  }
24530
24575
  getLabelPosition(point, vector, text, style) {
24531
24576
  return point;
@@ -25263,7 +25308,7 @@
25263
25308
  let titleSpacing = 0;
25264
25309
  const axisLineWidth = (line === null || line === void 0 ? void 0 : line.visible) ? (_b = line.style.lineWidth) !== null && _b !== void 0 ? _b : 1 : 0;
25265
25310
  const tickLength = (tick === null || tick === void 0 ? void 0 : tick.visible) ? (_c = tick.length) !== null && _c !== void 0 ? _c : 4 : 0;
25266
- if (title === null || title === void 0 ? void 0 : title.visible) {
25311
+ if ((title === null || title === void 0 ? void 0 : title.visible) && typeof title.text === 'string') {
25267
25312
  titleHeight = measureTextSize(title.text, title.textStyle).height;
25268
25313
  const padding = vutils.normalizePadding(title.padding);
25269
25314
  titleSpacing = title.space + padding[0] + padding[2];
@@ -29494,19 +29539,27 @@
29494
29539
  this.name = 'title';
29495
29540
  }
29496
29541
  render() {
29497
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37;
29498
- const { text, textStyle, subtext, subtextStyle, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
29542
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69;
29543
+ const { textType, text, subtextType, textStyle, subtext, subtextStyle, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute;
29499
29544
  const parsedPadding = vutils.normalizePadding(padding);
29500
29545
  const group = this.createOrUpdateChild('title-container', { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 }, 'group');
29501
29546
  if (((_a = this.attribute) === null || _a === void 0 ? void 0 : _a.visible) !== false && (textStyle === null || textStyle === void 0 ? void 0 : textStyle.visible) !== false) {
29502
- if (textStyle && vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.character)) {
29547
+ if (textType === 'rich') {
29548
+ const attr = Object.assign({ x: (_b = textStyle.x) !== null && _b !== void 0 ? _b : 0, y: (_c = textStyle.y) !== null && _c !== void 0 ? _c : 0, width: (_e = (_d = textStyle.width) !== null && _d !== void 0 ? _d : width) !== null && _e !== void 0 ? _e : 0, height: (_g = (_f = textStyle.height) !== null && _f !== void 0 ? _f : height) !== null && _g !== void 0 ? _g : 0, ellipsis: (_h = textStyle.ellipsis) !== null && _h !== void 0 ? _h : true, wordBreak: (_j = textStyle.wordBreak) !== null && _j !== void 0 ? _j : 'break-word', maxHeight: textStyle.maxHeight, maxWidth: textStyle.maxWidth, textConfig: text }, textStyle);
29549
+ this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
29550
+ }
29551
+ else if (textType === 'html') {
29552
+ const attr = Object.assign({ html: Object.assign({ dom: text, container: '', width: 30, height: 30, style: '' }, textStyle), x: (_k = textStyle.x) !== null && _k !== void 0 ? _k : 0, y: (_l = textStyle.y) !== null && _l !== void 0 ? _l : 0, width: (_o = (_m = textStyle.width) !== null && _m !== void 0 ? _m : width) !== null && _o !== void 0 ? _o : 0, height: (_q = (_p = textStyle.height) !== null && _p !== void 0 ? _p : height) !== null && _q !== void 0 ? _q : 0, ellipsis: (_r = textStyle.ellipsis) !== null && _r !== void 0 ? _r : true, wordBreak: (_s = textStyle.wordBreak) !== null && _s !== void 0 ? _s : 'break-word', maxHeight: textStyle.maxHeight, maxWidth: textStyle.maxWidth, textConfig: [] }, textStyle);
29553
+ this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
29554
+ }
29555
+ else if (textStyle && vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.character)) {
29503
29556
  const attr = {
29504
- x: (_b = textStyle.x) !== null && _b !== void 0 ? _b : 0,
29505
- y: (_c = textStyle.y) !== null && _c !== void 0 ? _c : 0,
29506
- width: (_e = (_d = textStyle.width) !== null && _d !== void 0 ? _d : width) !== null && _e !== void 0 ? _e : 0,
29507
- height: (_g = (_f = textStyle.height) !== null && _f !== void 0 ? _f : height) !== null && _g !== void 0 ? _g : 0,
29508
- ellipsis: (_h = textStyle.ellipsis) !== null && _h !== void 0 ? _h : true,
29509
- wordBreak: (_j = textStyle.wordBreak) !== null && _j !== void 0 ? _j : 'break-word',
29557
+ x: (_t = textStyle.x) !== null && _t !== void 0 ? _t : 0,
29558
+ y: (_u = textStyle.y) !== null && _u !== void 0 ? _u : 0,
29559
+ width: (_w = (_v = textStyle.width) !== null && _v !== void 0 ? _v : width) !== null && _w !== void 0 ? _w : 0,
29560
+ height: (_y = (_x = textStyle.height) !== null && _x !== void 0 ? _x : height) !== null && _y !== void 0 ? _y : 0,
29561
+ ellipsis: (_z = textStyle.ellipsis) !== null && _z !== void 0 ? _z : true,
29562
+ wordBreak: (_0 = textStyle.wordBreak) !== null && _0 !== void 0 ? _0 : 'break-word',
29510
29563
  maxHeight: textStyle.maxHeight,
29511
29564
  maxWidth: textStyle.maxWidth,
29512
29565
  textConfig: textStyle.character
@@ -29514,20 +29567,28 @@
29514
29567
  this._mainTitle = group.createOrUpdateChild('mainTitle', attr, 'richtext');
29515
29568
  }
29516
29569
  else if (vutils.isValid(text)) {
29517
- this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (_k = textStyle === null || textStyle === void 0 ? void 0 : textStyle.maxLineWidth) !== null && _k !== void 0 ? _k : width, heightLimit: textStyle === null || textStyle === void 0 ? void 0 : textStyle.heightLimit, lineClamp: textStyle === null || textStyle === void 0 ? void 0 : textStyle.lineClamp, ellipsis: (_l = textStyle === null || textStyle === void 0 ? void 0 : textStyle.ellipsis) !== null && _l !== void 0 ? _l : true, x: 0, y: 0 }), 'wrapText');
29570
+ this._mainTitle = group.createOrUpdateChild('mainTitle', Object.assign(Object.assign({ text: [text] }, textStyle), { maxLineWidth: (_1 = textStyle === null || textStyle === void 0 ? void 0 : textStyle.maxLineWidth) !== null && _1 !== void 0 ? _1 : width, heightLimit: textStyle === null || textStyle === void 0 ? void 0 : textStyle.heightLimit, lineClamp: textStyle === null || textStyle === void 0 ? void 0 : textStyle.lineClamp, ellipsis: (_2 = textStyle === null || textStyle === void 0 ? void 0 : textStyle.ellipsis) !== null && _2 !== void 0 ? _2 : true, x: 0, y: 0 }), 'wrapText');
29518
29571
  }
29519
29572
  }
29520
- const maintextHeight = this._mainTitle ? (_m = this._mainTitle) === null || _m === void 0 ? void 0 : _m.AABBBounds.height() : 0;
29521
- const maintextWidth = this._mainTitle ? (_o = this._mainTitle) === null || _o === void 0 ? void 0 : _o.AABBBounds.width() : 0;
29522
- if (((_p = this.attribute) === null || _p === void 0 ? void 0 : _p.visible) !== false && (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.visible) !== false) {
29523
- if (subtextStyle && vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.character)) {
29573
+ const maintextHeight = this._mainTitle ? (_3 = this._mainTitle) === null || _3 === void 0 ? void 0 : _3.AABBBounds.height() : 0;
29574
+ const maintextWidth = this._mainTitle ? (_4 = this._mainTitle) === null || _4 === void 0 ? void 0 : _4.AABBBounds.width() : 0;
29575
+ if (((_5 = this.attribute) === null || _5 === void 0 ? void 0 : _5.visible) !== false && (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.visible) !== false) {
29576
+ if (subtextType === 'rich') {
29577
+ const attr = Object.assign({ x: (_6 = subtextStyle.x) !== null && _6 !== void 0 ? _6 : 0, y: (_7 = subtextStyle.y) !== null && _7 !== void 0 ? _7 : 0, width: (_9 = (_8 = subtextStyle.width) !== null && _8 !== void 0 ? _8 : width) !== null && _9 !== void 0 ? _9 : 0, height: (_11 = (_10 = subtextStyle.height) !== null && _10 !== void 0 ? _10 : height) !== null && _11 !== void 0 ? _11 : 0, ellipsis: (_12 = subtextStyle.ellipsis) !== null && _12 !== void 0 ? _12 : true, wordBreak: (_13 = subtextStyle.wordBreak) !== null && _13 !== void 0 ? _13 : 'break-word', maxHeight: subtextStyle.maxHeight, maxWidth: subtextStyle.maxWidth, textConfig: subtext }, subtextStyle);
29578
+ this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
29579
+ }
29580
+ else if (textType === 'html') {
29581
+ const attr = Object.assign({ html: Object.assign({ dom: subtext, container: '', width: 30, height: 30, style: {} }, subtextStyle), x: (_14 = subtextStyle.x) !== null && _14 !== void 0 ? _14 : 0, y: (_15 = subtextStyle.y) !== null && _15 !== void 0 ? _15 : 0, width: (_17 = (_16 = subtextStyle.width) !== null && _16 !== void 0 ? _16 : width) !== null && _17 !== void 0 ? _17 : 0, height: (_19 = (_18 = subtextStyle.height) !== null && _18 !== void 0 ? _18 : height) !== null && _19 !== void 0 ? _19 : 0, ellipsis: (_20 = subtextStyle.ellipsis) !== null && _20 !== void 0 ? _20 : true, wordBreak: (_21 = subtextStyle.wordBreak) !== null && _21 !== void 0 ? _21 : 'break-word', maxHeight: subtextStyle.maxHeight, maxWidth: subtextStyle.maxWidth, textConfig: [] }, subtextStyle);
29582
+ this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
29583
+ }
29584
+ else if (subtextStyle && vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.character)) {
29524
29585
  const attr = {
29525
- x: (_q = subtextStyle.x) !== null && _q !== void 0 ? _q : 0,
29526
- y: (_r = subtextStyle.y) !== null && _r !== void 0 ? _r : maintextHeight,
29527
- width: (_t = (_s = subtextStyle.width) !== null && _s !== void 0 ? _s : width) !== null && _t !== void 0 ? _t : 0,
29528
- height: (_v = (_u = subtextStyle.height) !== null && _u !== void 0 ? _u : height) !== null && _v !== void 0 ? _v : 0,
29529
- ellipsis: (_w = subtextStyle.ellipsis) !== null && _w !== void 0 ? _w : true,
29530
- wordBreak: (_x = subtextStyle.wordBreak) !== null && _x !== void 0 ? _x : 'break-word',
29586
+ x: (_22 = subtextStyle.x) !== null && _22 !== void 0 ? _22 : 0,
29587
+ y: (_23 = subtextStyle.y) !== null && _23 !== void 0 ? _23 : maintextHeight,
29588
+ width: (_25 = (_24 = subtextStyle.width) !== null && _24 !== void 0 ? _24 : width) !== null && _25 !== void 0 ? _25 : 0,
29589
+ height: (_27 = (_26 = subtextStyle.height) !== null && _26 !== void 0 ? _26 : height) !== null && _27 !== void 0 ? _27 : 0,
29590
+ ellipsis: (_28 = subtextStyle.ellipsis) !== null && _28 !== void 0 ? _28 : true,
29591
+ wordBreak: (_29 = subtextStyle.wordBreak) !== null && _29 !== void 0 ? _29 : 'break-word',
29531
29592
  maxHeight: subtextStyle.maxHeight,
29532
29593
  maxWidth: subtextStyle.maxWidth,
29533
29594
  textConfig: subtextStyle.character
@@ -29535,17 +29596,17 @@
29535
29596
  this._subTitle = group.createOrUpdateChild('subTitle', attr, 'richtext');
29536
29597
  }
29537
29598
  else if (vutils.isValid(subtext)) {
29538
- this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: [subtext] }, subtextStyle), { maxLineWidth: (_y = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.maxLineWidth) !== null && _y !== void 0 ? _y : width, heightLimit: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.heightLimit, lineClamp: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.lineClamp, ellipsis: (_z = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.ellipsis) !== null && _z !== void 0 ? _z : true, x: 0, y: maintextHeight }), 'wrapText');
29599
+ this._subTitle = group.createOrUpdateChild('subTitle', Object.assign(Object.assign({ text: [subtext] }, subtextStyle), { maxLineWidth: (_30 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.maxLineWidth) !== null && _30 !== void 0 ? _30 : width, heightLimit: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.heightLimit, lineClamp: subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.lineClamp, ellipsis: (_31 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.ellipsis) !== null && _31 !== void 0 ? _31 : true, x: 0, y: maintextHeight }), 'wrapText');
29539
29600
  }
29540
29601
  }
29541
- const subtextHeight = this._subTitle ? (_0 = this._subTitle) === null || _0 === void 0 ? void 0 : _0.AABBBounds.height() : 0;
29542
- const subtextWidth = this._subTitle ? (_1 = this._subTitle) === null || _1 === void 0 ? void 0 : _1.AABBBounds.width() : 0;
29602
+ const subtextHeight = this._subTitle ? (_32 = this._subTitle) === null || _32 === void 0 ? void 0 : _32.AABBBounds.height() : 0;
29603
+ const subtextWidth = this._subTitle ? (_33 = this._subTitle) === null || _33 === void 0 ? void 0 : _33.AABBBounds.width() : 0;
29543
29604
  let titleWidth = Math.max(maintextWidth, subtextWidth);
29544
- let titleHeight = maintextHeight + ((_2 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _2 !== void 0 ? _2 : subtextHeight);
29605
+ let titleHeight = maintextHeight + ((_34 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _34 !== void 0 ? _34 : subtextHeight);
29545
29606
  if (vutils.isValid(width)) {
29546
29607
  titleWidth = width;
29547
- (_3 = this._mainTitle) === null || _3 === void 0 ? void 0 : _3.setAttribute('maxLineWidth', width);
29548
- (_4 = this._subTitle) === null || _4 === void 0 ? void 0 : _4.setAttribute('maxLineWidth', width);
29608
+ (_35 = this._mainTitle) === null || _35 === void 0 ? void 0 : _35.setAttribute('maxLineWidth', width);
29609
+ (_36 = this._subTitle) === null || _36 === void 0 ? void 0 : _36.setAttribute('maxLineWidth', width);
29549
29610
  }
29550
29611
  if (vutils.isValid(height)) {
29551
29612
  titleHeight = height;
@@ -29554,10 +29615,10 @@
29554
29615
  titleWidth = minWidth;
29555
29616
  }
29556
29617
  if (vutils.isValid(maxWidth)) {
29557
- (_5 = this._mainTitle) === null || _5 === void 0 ? void 0 : _5.setAttribute('maxLineWidth', maxWidth);
29558
- (_6 = this._subTitle) === null || _6 === void 0 ? void 0 : _6.setAttribute('maxLineWidth', maxWidth);
29559
- (_7 = this._mainTitle) === null || _7 === void 0 ? void 0 : _7.setAttribute('maxWidth', maxWidth);
29560
- (_8 = this._subTitle) === null || _8 === void 0 ? void 0 : _8.setAttribute('maxWidth', maxWidth);
29618
+ (_37 = this._mainTitle) === null || _37 === void 0 ? void 0 : _37.setAttribute('maxLineWidth', maxWidth);
29619
+ (_38 = this._subTitle) === null || _38 === void 0 ? void 0 : _38.setAttribute('maxLineWidth', maxWidth);
29620
+ (_39 = this._mainTitle) === null || _39 === void 0 ? void 0 : _39.setAttribute('maxWidth', maxWidth);
29621
+ (_40 = this._subTitle) === null || _40 === void 0 ? void 0 : _40.setAttribute('maxWidth', maxWidth);
29561
29622
  if (titleWidth > maxWidth) {
29562
29623
  titleWidth = maxWidth;
29563
29624
  }
@@ -29566,8 +29627,8 @@
29566
29627
  titleHeight = minHeight;
29567
29628
  }
29568
29629
  if (vutils.isValid(maxHeight)) {
29569
- (_9 = this._mainTitle) === null || _9 === void 0 ? void 0 : _9.setAttribute('maxHeight', maxHeight);
29570
- (_10 = this._subTitle) === null || _10 === void 0 ? void 0 : _10.setAttribute('maxHeight', maxHeight - maintextHeight);
29630
+ (_41 = this._mainTitle) === null || _41 === void 0 ? void 0 : _41.setAttribute('maxHeight', maxHeight);
29631
+ (_42 = this._subTitle) === null || _42 === void 0 ? void 0 : _42.setAttribute('maxHeight', maxHeight - maintextHeight);
29571
29632
  if (titleHeight > maxHeight) {
29572
29633
  titleHeight = maxHeight;
29573
29634
  }
@@ -29577,67 +29638,67 @@
29577
29638
  group.attribute.boundsPadding = parsedPadding;
29578
29639
  if (vutils.isValid(align) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.align)) {
29579
29640
  const mainTitleAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.align) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.align : align;
29580
- const mainTitleWidth = (_11 = textStyle === null || textStyle === void 0 ? void 0 : textStyle.width) !== null && _11 !== void 0 ? _11 : maintextWidth;
29641
+ const mainTitleWidth = (_43 = textStyle === null || textStyle === void 0 ? void 0 : textStyle.width) !== null && _43 !== void 0 ? _43 : maintextWidth;
29581
29642
  if (mainTitleAlign === 'left') {
29582
- (_12 = this._mainTitle) === null || _12 === void 0 ? void 0 : _12.setAttribute('x', 0);
29583
- (_13 = this._mainTitle) === null || _13 === void 0 ? void 0 : _13.setAttribute('textAlign', 'left');
29643
+ (_44 = this._mainTitle) === null || _44 === void 0 ? void 0 : _44.setAttribute('x', 0);
29644
+ (_45 = this._mainTitle) === null || _45 === void 0 ? void 0 : _45.setAttribute('textAlign', 'left');
29584
29645
  }
29585
29646
  else if (mainTitleAlign === 'center') {
29586
- (_14 = this._mainTitle) === null || _14 === void 0 ? void 0 : _14.setAttribute('x', mainTitleWidth / 2);
29587
- (_15 = this._mainTitle) === null || _15 === void 0 ? void 0 : _15.setAttribute('textAlign', 'center');
29647
+ (_46 = this._mainTitle) === null || _46 === void 0 ? void 0 : _46.setAttribute('x', mainTitleWidth / 2);
29648
+ (_47 = this._mainTitle) === null || _47 === void 0 ? void 0 : _47.setAttribute('textAlign', 'center');
29588
29649
  }
29589
29650
  else if (mainTitleAlign === 'right') {
29590
- (_16 = this._mainTitle) === null || _16 === void 0 ? void 0 : _16.setAttribute('x', mainTitleWidth);
29591
- (_17 = this._mainTitle) === null || _17 === void 0 ? void 0 : _17.setAttribute('textAlign', 'right');
29651
+ (_48 = this._mainTitle) === null || _48 === void 0 ? void 0 : _48.setAttribute('x', mainTitleWidth);
29652
+ (_49 = this._mainTitle) === null || _49 === void 0 ? void 0 : _49.setAttribute('textAlign', 'right');
29592
29653
  }
29593
29654
  }
29594
29655
  if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
29595
29656
  const mainTitleVerticalAlign = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign : verticalAlign;
29596
29657
  const mainTitleHeight = (textStyle === null || textStyle === void 0 ? void 0 : textStyle.height) ? textStyle === null || textStyle === void 0 ? void 0 : textStyle.height : titleHeight;
29597
29658
  if (mainTitleVerticalAlign === 'top') {
29598
- (_18 = this._mainTitle) === null || _18 === void 0 ? void 0 : _18.setAttribute('y', 0);
29599
- (_19 = this._mainTitle) === null || _19 === void 0 ? void 0 : _19.setAttribute('textBaseline', 'top');
29659
+ (_50 = this._mainTitle) === null || _50 === void 0 ? void 0 : _50.setAttribute('y', 0);
29660
+ (_51 = this._mainTitle) === null || _51 === void 0 ? void 0 : _51.setAttribute('textBaseline', 'top');
29600
29661
  }
29601
29662
  else if (mainTitleVerticalAlign === 'middle') {
29602
- (_20 = this._mainTitle) === null || _20 === void 0 ? void 0 : _20.setAttribute('y', mainTitleHeight / 2);
29603
- (_21 = this._mainTitle) === null || _21 === void 0 ? void 0 : _21.setAttribute('textBaseline', 'middle');
29663
+ (_52 = this._mainTitle) === null || _52 === void 0 ? void 0 : _52.setAttribute('y', mainTitleHeight / 2);
29664
+ (_53 = this._mainTitle) === null || _53 === void 0 ? void 0 : _53.setAttribute('textBaseline', 'middle');
29604
29665
  }
29605
29666
  else if (mainTitleVerticalAlign === 'bottom') {
29606
- (_22 = this._mainTitle) === null || _22 === void 0 ? void 0 : _22.setAttribute('y', mainTitleHeight);
29607
- (_23 = this._mainTitle) === null || _23 === void 0 ? void 0 : _23.setAttribute('textBaseline', 'bottom');
29667
+ (_54 = this._mainTitle) === null || _54 === void 0 ? void 0 : _54.setAttribute('y', mainTitleHeight);
29668
+ (_55 = this._mainTitle) === null || _55 === void 0 ? void 0 : _55.setAttribute('textBaseline', 'bottom');
29608
29669
  }
29609
29670
  }
29610
29671
  if (vutils.isValid(align) || vutils.isValid(subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align)) {
29611
29672
  const subTitleAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.align : align;
29612
- const subTitleWidth = (_24 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.width) !== null && _24 !== void 0 ? _24 : subtextWidth;
29673
+ const subTitleWidth = (_56 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.width) !== null && _56 !== void 0 ? _56 : subtextWidth;
29613
29674
  if (subTitleAlign === 'left') {
29614
- (_25 = this._subTitle) === null || _25 === void 0 ? void 0 : _25.setAttribute('x', 0);
29615
- (_26 = this._subTitle) === null || _26 === void 0 ? void 0 : _26.setAttribute('textAlign', 'left');
29675
+ (_57 = this._subTitle) === null || _57 === void 0 ? void 0 : _57.setAttribute('x', 0);
29676
+ (_58 = this._subTitle) === null || _58 === void 0 ? void 0 : _58.setAttribute('textAlign', 'left');
29616
29677
  }
29617
29678
  else if (subTitleAlign === 'center') {
29618
- (_27 = this._subTitle) === null || _27 === void 0 ? void 0 : _27.setAttribute('x', subTitleWidth / 2);
29619
- (_28 = this._subTitle) === null || _28 === void 0 ? void 0 : _28.setAttribute('textAlign', 'center');
29679
+ (_59 = this._subTitle) === null || _59 === void 0 ? void 0 : _59.setAttribute('x', subTitleWidth / 2);
29680
+ (_60 = this._subTitle) === null || _60 === void 0 ? void 0 : _60.setAttribute('textAlign', 'center');
29620
29681
  }
29621
29682
  else if (subTitleAlign === 'right') {
29622
- (_29 = this._subTitle) === null || _29 === void 0 ? void 0 : _29.setAttribute('x', subTitleWidth);
29623
- (_30 = this._subTitle) === null || _30 === void 0 ? void 0 : _30.setAttribute('textAlign', 'right');
29683
+ (_61 = this._subTitle) === null || _61 === void 0 ? void 0 : _61.setAttribute('x', subTitleWidth);
29684
+ (_62 = this._subTitle) === null || _62 === void 0 ? void 0 : _62.setAttribute('textAlign', 'right');
29624
29685
  }
29625
29686
  }
29626
29687
  if (vutils.isValid(verticalAlign) || vutils.isValid(textStyle === null || textStyle === void 0 ? void 0 : textStyle.verticalAlign)) {
29627
29688
  const subTitleVerticalAlign = (subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign) ? subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.verticalAlign : verticalAlign;
29628
29689
  const subTitleYStart = maintextHeight;
29629
- const subTitleHeight = (_31 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _31 !== void 0 ? _31 : 0;
29690
+ const subTitleHeight = (_63 = subtextStyle === null || subtextStyle === void 0 ? void 0 : subtextStyle.height) !== null && _63 !== void 0 ? _63 : 0;
29630
29691
  if (subTitleVerticalAlign === 'top') {
29631
- (_32 = this._subTitle) === null || _32 === void 0 ? void 0 : _32.setAttribute('y', subTitleYStart);
29632
- (_33 = this._subTitle) === null || _33 === void 0 ? void 0 : _33.setAttribute('textBaseline', 'top');
29692
+ (_64 = this._subTitle) === null || _64 === void 0 ? void 0 : _64.setAttribute('y', subTitleYStart);
29693
+ (_65 = this._subTitle) === null || _65 === void 0 ? void 0 : _65.setAttribute('textBaseline', 'top');
29633
29694
  }
29634
29695
  else if (subTitleVerticalAlign === 'middle') {
29635
- (_34 = this._subTitle) === null || _34 === void 0 ? void 0 : _34.setAttribute('y', subTitleYStart + subTitleHeight / 2);
29636
- (_35 = this._subTitle) === null || _35 === void 0 ? void 0 : _35.setAttribute('textBaseline', 'middle');
29696
+ (_66 = this._subTitle) === null || _66 === void 0 ? void 0 : _66.setAttribute('y', subTitleYStart + subTitleHeight / 2);
29697
+ (_67 = this._subTitle) === null || _67 === void 0 ? void 0 : _67.setAttribute('textBaseline', 'middle');
29637
29698
  }
29638
29699
  else if (subTitleVerticalAlign === 'bottom') {
29639
- (_36 = this._subTitle) === null || _36 === void 0 ? void 0 : _36.setAttribute('y', subTitleYStart + subTitleHeight);
29640
- (_37 = this._subTitle) === null || _37 === void 0 ? void 0 : _37.setAttribute('textBaseline', 'bottom');
29700
+ (_68 = this._subTitle) === null || _68 === void 0 ? void 0 : _68.setAttribute('y', subTitleYStart + subTitleHeight);
29701
+ (_69 = this._subTitle) === null || _69 === void 0 ? void 0 : _69.setAttribute('textBaseline', 'bottom');
29641
29702
  }
29642
29703
  }
29643
29704
  }
@@ -29692,7 +29753,7 @@
29692
29753
  this.name = 'indicator';
29693
29754
  }
29694
29755
  render() {
29695
- var _a;
29756
+ var _a, _b, _c;
29696
29757
  const { visible, title, content, size, limitRatio = Infinity } = this.attribute;
29697
29758
  const limit = Math.min(size.width, size.height) * limitRatio;
29698
29759
  const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group');
@@ -29703,7 +29764,15 @@
29703
29764
  if (vutils.isValid(title)) {
29704
29765
  if (title.visible !== false) {
29705
29766
  const titleStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);
29706
- this._title = group.createOrUpdateChild('indicator-title', Object.assign(Object.assign({}, titleStyle), { lineHeight: vutils.isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize, visible: title.visible, x: 0, y: 0 }), 'text');
29767
+ if (titleStyle.type === 'rich') {
29768
+ this._title = group.createOrUpdateChild('indicator-title', Object.assign(Object.assign({ textConfig: titleStyle.text }, titleStyle), { visible: title.visible, x: 0, y: 0, width: (_a = titleStyle.width) !== null && _a !== void 0 ? _a : 0, height: (_b = titleStyle.height) !== null && _b !== void 0 ? _b : 0 }), 'richtext');
29769
+ }
29770
+ else if (titleStyle.type === 'html') {
29771
+ this._title = group.createOrUpdateChild('indicator-title', Object.assign(Object.assign({ textConfig: [], html: Object.assign({ dom: titleStyle.text, container: '', width: 30, height: 30, style: {} }, titleStyle) }, titleStyle), { visible: title.visible, x: 0, y: 0 }), 'richtext');
29772
+ }
29773
+ else {
29774
+ this._title = group.createOrUpdateChild('indicator-title', Object.assign(Object.assign({}, titleStyle), { lineHeight: vutils.isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize, visible: title.visible, x: 0, y: 0 }), 'text');
29775
+ }
29707
29776
  if (title.autoFit && vutils.isValidNumber(limit)) {
29708
29777
  this._setAutoFit(limit, this._title, title);
29709
29778
  }
@@ -29724,9 +29793,19 @@
29724
29793
  const contentComponents = [];
29725
29794
  let lastContentHeight = 0;
29726
29795
  contents.forEach((contentItem, i) => {
29796
+ var _a, _b;
29727
29797
  if (contentItem.visible !== false) {
29728
29798
  const contentStyle = vutils.merge({}, vutils.get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);
29729
- const contentComponent = group.createOrUpdateChild('indicator-content-' + i, Object.assign(Object.assign({}, contentStyle), { lineHeight: vutils.isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize, visible: contentItem.visible, x: 0, y: titleHeight + titleSpace + lastContentHeight }), 'text');
29799
+ let contentComponent;
29800
+ if (contentStyle.type === 'rich') {
29801
+ contentComponent = group.createOrUpdateChild('indicator-content-' + i, Object.assign(Object.assign({ textConfig: contentStyle.text }, contentStyle), { visible: title.visible, x: 0, y: titleHeight + titleSpace + lastContentHeight, width: (_a = contentStyle.width) !== null && _a !== void 0 ? _a : 0, height: (_b = contentStyle.height) !== null && _b !== void 0 ? _b : 0 }), 'richtext');
29802
+ }
29803
+ else if (contentStyle.type === 'html') {
29804
+ contentComponent = group.createOrUpdateChild('indicator-content-' + i, Object.assign(Object.assign({ textConfig: [], html: Object.assign({ dom: contentStyle.text, container: '', width: 30, height: 30, style: {} }, contentStyle) }, contentStyle), { visible: title.visible, x: 0, y: titleHeight + titleSpace + lastContentHeight }), 'richtext');
29805
+ }
29806
+ else {
29807
+ contentComponent = group.createOrUpdateChild('indicator-content-' + i, Object.assign(Object.assign({}, contentStyle), { lineHeight: vutils.isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize, visible: contentItem.visible, x: 0, y: titleHeight + titleSpace + lastContentHeight }), 'text');
29808
+ }
29730
29809
  if (contentItem.autoFit && vutils.isValidNumber(limit)) {
29731
29810
  this._setAutoFit(limit, contentComponent, contentItem);
29732
29811
  }
@@ -29744,7 +29823,7 @@
29744
29823
  });
29745
29824
  this._content = contentComponents;
29746
29825
  }
29747
- const totalHeight = (_a = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _a !== void 0 ? _a : 0;
29826
+ const totalHeight = (_c = group === null || group === void 0 ? void 0 : group.AABBBounds.height()) !== null && _c !== void 0 ? _c : 0;
29748
29827
  group.setAttribute('y', size.height / 2 - totalHeight / 2);
29749
29828
  group.setAttribute('x', size.width / 2);
29750
29829
  }
@@ -30989,6 +31068,17 @@
30989
31068
  };
30990
31069
  const getRichTextAttribute = (attr) => {
30991
31070
  const { width, height, wordBreak = 'break-word', textAlign, textBaseline, text } = attr;
31071
+ if (typeof text === 'object') {
31072
+ return {
31073
+ width,
31074
+ height,
31075
+ wordBreak: wordBreak,
31076
+ textAlign: textAlign,
31077
+ textBaseline: textBaseline,
31078
+ singleLine: false,
31079
+ textConfig: text.text
31080
+ };
31081
+ }
30992
31082
  return {
30993
31083
  width,
30994
31084
  height,
@@ -31085,6 +31175,7 @@
31085
31175
  this.name = 'tooltip';
31086
31176
  }
31087
31177
  render() {
31178
+ var _a;
31088
31179
  const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure } = this.attribute;
31089
31180
  if (!visible) {
31090
31181
  this.hideAll();
@@ -31103,11 +31194,22 @@
31103
31194
  this._tooltipTitleSymbol = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_SHAPE_NAME_SUFFIX}`, vutils.merge({ symbolType: 'circle' }, titleAttr.shape, {
31104
31195
  visible: isVisible(titleAttr) && isVisible(titleAttr.shape)
31105
31196
  }), 'symbol');
31106
- if (titleAttr.value.multiLine) {
31197
+ if (typeof titleAttr.value.text === 'object' &&
31198
+ titleAttr.value.text !== null &&
31199
+ (titleAttr.value.text.type === 'rich' ||
31200
+ titleAttr.value.text.type === 'html')) {
31201
+ if (titleAttr.value.text.type === 'rich') {
31202
+ this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, getRichTextAttribute(titleAttr.value)), 'richtext');
31203
+ }
31204
+ else if (titleAttr.value.text.type === 'html') {
31205
+ this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ html: Object.assign({ dom: titleAttr.value.text.text, container: '', width: 30, height: 30, style: {} }, titleAttr.value), visible: isVisible(titleAttr) && isVisible(titleAttr.value), width: titleAttr.value.width, height: titleAttr.value.height, wordBreak: titleAttr.value.wordBreak, textAlign: titleAttr.value.textAlign, textBaseline: titleAttr.value.textBaseline, singleLine: false, textConfig: [] }, titleAttr.value), 'richtext');
31206
+ }
31207
+ }
31208
+ else if (titleAttr.value.multiLine) {
31107
31209
  this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, getRichTextAttribute(titleAttr.value)), 'richtext');
31108
31210
  }
31109
31211
  else {
31110
- this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ text: '', visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, titleAttr.value), 'text');
31212
+ this._tooltipTitle = this._tooltipTitleContainer.createOrUpdateChild(`${TOOLTIP_TITLE_NAME}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign({ text: ((_a = titleAttr.value.text) !== null && _a !== void 0 ? _a : ''), visible: isVisible(titleAttr) && isVisible(titleAttr.value) }, titleAttr.value), 'text');
31111
31213
  }
31112
31214
  const titlePaddingLeft = isVisible(titleAttr.shape) ? titleAttr.shape.size + titleAttr.shape.spacing : 0;
31113
31215
  const { textAlign, textBaseline } = titleAttr.value;
@@ -31138,7 +31240,7 @@
31138
31240
  this._tooltipContent.setAttribute('y', padding[0] + titleHeight);
31139
31241
  let lastYPos = 0;
31140
31242
  content.forEach((item, i) => {
31141
- var _a;
31243
+ var _a, _b, _c;
31142
31244
  const itemAttr = Tooltip.getContentAttr(this.attribute, i);
31143
31245
  if (!isVisible(itemAttr)) {
31144
31246
  return;
@@ -31160,8 +31262,21 @@
31160
31262
  if (itemAttr.key.multiLine) {
31161
31263
  element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.key)), { textBaseline: 'top' }), 'richtext');
31162
31264
  }
31265
+ else if (typeof itemAttr.key.text === 'object' &&
31266
+ itemAttr.key.text !== null &&
31267
+ (itemAttr.key.text.type === 'rich' ||
31268
+ itemAttr.key.text.type === 'html')) {
31269
+ if (itemAttr.key.text.type === 'rich') {
31270
+ element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.key)), { textBaseline: 'top' }), 'richtext');
31271
+ }
31272
+ else {
31273
+ element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, {
31274
+ html: Object.assign({ dom: itemAttr.key.text.text, container: '', width: 30, height: 30, style: {} }, itemAttr.key)
31275
+ }, 'richtext');
31276
+ }
31277
+ }
31163
31278
  else {
31164
- element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, itemAttr.key), { textBaseline: 'top' }), 'text');
31279
+ element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_KEY_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true, text: ((_b = itemAttr.key.text) !== null && _b !== void 0 ? _b : '') }, itemAttr.key), { textBaseline: 'top' }), 'text');
31165
31280
  }
31166
31281
  const { textAlign } = itemAttr.key;
31167
31282
  if (textAlign === 'center') {
@@ -31181,8 +31296,21 @@
31181
31296
  if (itemAttr.value.multiLine) {
31182
31297
  element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.value)), { textBaseline: 'top' }), 'richtext');
31183
31298
  }
31299
+ else if (typeof itemAttr.value.text === 'object' &&
31300
+ itemAttr.value.text !== null &&
31301
+ (itemAttr.value.text.type === 'rich' ||
31302
+ itemAttr.value.text.type === 'html')) {
31303
+ if (itemAttr.value.text.type === 'rich') {
31304
+ element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, getRichTextAttribute(itemAttr.value)), { textBaseline: 'top' }), 'richtext');
31305
+ }
31306
+ else {
31307
+ element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, {
31308
+ html: Object.assign({ dom: itemAttr.value.text.text, container: '', width: 30, height: 30, style: {} }, itemAttr.value)
31309
+ }, 'richtext');
31310
+ }
31311
+ }
31184
31312
  else {
31185
- element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true }, itemAttr.value), { textBaseline: 'top' }), 'text');
31313
+ element = itemGroup.createOrUpdateChild(`${itemGroupName}-${TOOLTIP_VALUE_NAME_SUFFIX}`, Object.assign(Object.assign({ visible: true, text: ((_c = itemAttr.value.text) !== null && _c !== void 0 ? _c : '') }, itemAttr.value), { textBaseline: 'top' }), 'text');
31186
31314
  }
31187
31315
  let textAlign = 'right';
31188
31316
  if (vutils.isValid(itemAttr.value.textAlign)) {
@@ -31274,7 +31402,7 @@
31274
31402
  let titleMaxHeight = 0;
31275
31403
  const { value: titleValue, shape: titleShape } = titleAttr;
31276
31404
  const { visible: titleHasShape = false, symbolType: titleShapeType = '' } = titleShape !== null && titleShape !== void 0 ? titleShape : {};
31277
- if (vutils.isValid(titleValue)) {
31405
+ if (vutils.isValid(titleValue) && typeof titleAttr.value.text !== 'object') {
31278
31406
  const { width, height } = initTextMeasure(titleValue).quickMeasure(titleValue.text);
31279
31407
  maxWidth = width;
31280
31408
  titleMaxHeight = height;
@@ -31531,7 +31659,7 @@
31531
31659
  }
31532
31660
  };
31533
31661
 
31534
- const version = "0.16.17-alpha.2";
31662
+ const version = "0.16.17-alpha.3";
31535
31663
 
31536
31664
  exports.AbstractComponent = AbstractComponent;
31537
31665
  exports.ArcInfo = ArcInfo;