@visactor/vchart 1.4.2-beta.0 → 1.4.2

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 (151) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +353 -274
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/base-chart.js +3 -1
  6. package/cjs/chart/base-chart.js.map +1 -1
  7. package/cjs/component/axis/base-axis.d.ts +2 -0
  8. package/cjs/component/axis/base-axis.js +7 -5
  9. package/cjs/component/axis/base-axis.js.map +1 -1
  10. package/cjs/component/brush/brush.d.ts +0 -1
  11. package/cjs/component/brush/brush.js +10 -7
  12. package/cjs/component/brush/brush.js.map +1 -1
  13. package/cjs/component/custom-mark/custom-mark.js +2 -1
  14. package/cjs/component/custom-mark/custom-mark.js.map +1 -1
  15. package/cjs/component/data-zoom/data-filter-base-component.js +6 -4
  16. package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
  17. package/cjs/component/marker/mark-area/mark-area.js +3 -3
  18. package/cjs/component/marker/mark-area/mark-area.js.map +1 -1
  19. package/cjs/component/marker/mark-line/mark-line.js +2 -2
  20. package/cjs/component/marker/mark-line/mark-line.js.map +1 -1
  21. package/cjs/component/marker/mark-point/mark-point.js +3 -3
  22. package/cjs/component/marker/mark-point/mark-point.js.map +1 -1
  23. package/cjs/component/tooltip/handler/base.d.ts +2 -4
  24. package/cjs/component/tooltip/handler/base.js +15 -38
  25. package/cjs/component/tooltip/handler/base.js.map +1 -1
  26. package/cjs/component/tooltip/handler/canvas/canvas-tooltip-handler.js +2 -2
  27. package/cjs/component/tooltip/handler/canvas/canvas-tooltip-handler.js.map +1 -1
  28. package/cjs/component/tooltip/handler/dom/dom-tooltip-handler.js +2 -2
  29. package/cjs/component/tooltip/handler/dom/dom-tooltip-handler.js.map +1 -1
  30. package/cjs/component/tooltip/handler/dom/util.d.ts +1 -2
  31. package/cjs/component/tooltip/handler/dom/util.js +14 -13
  32. package/cjs/component/tooltip/handler/dom/util.js.map +1 -1
  33. package/cjs/component/tooltip/handler/interface/style.d.ts +4 -23
  34. package/cjs/component/tooltip/handler/interface/style.js.map +1 -1
  35. package/cjs/component/tooltip/handler/utils/attribute.d.ts +9 -11
  36. package/cjs/component/tooltip/handler/utils/attribute.js +136 -126
  37. package/cjs/component/tooltip/handler/utils/attribute.js.map +1 -1
  38. package/cjs/component/tooltip/handler/utils/common.d.ts +8 -0
  39. package/cjs/component/tooltip/handler/utils/common.js +42 -2
  40. package/cjs/component/tooltip/handler/utils/common.js.map +1 -1
  41. package/cjs/component/tooltip/handler/utils/index.d.ts +0 -1
  42. package/cjs/component/tooltip/handler/utils/index.js +1 -2
  43. package/cjs/component/tooltip/handler/utils/index.js.map +1 -1
  44. package/cjs/component/tooltip/interface/common.d.ts +2 -2
  45. package/cjs/component/tooltip/interface/common.js.map +1 -1
  46. package/cjs/component/tooltip/interface/theme.d.ts +5 -3
  47. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  48. package/cjs/component/tooltip/tooltip.d.ts +1 -0
  49. package/cjs/component/tooltip/tooltip.js +7 -4
  50. package/cjs/component/tooltip/tooltip.js.map +1 -1
  51. package/cjs/core/index.d.ts +1 -1
  52. package/cjs/core/index.js +1 -1
  53. package/cjs/core/index.js.map +1 -1
  54. package/cjs/core/util.d.ts +3 -0
  55. package/cjs/core/util.js +12 -0
  56. package/cjs/core/util.js.map +1 -0
  57. package/cjs/core/vchart.d.ts +3 -0
  58. package/cjs/core/vchart.js +2 -2
  59. package/cjs/core/vchart.js.map +1 -1
  60. package/cjs/interaction/trigger.js +1 -2
  61. package/cjs/layout/base-layout.js +2 -1
  62. package/cjs/mark/box-plot.js +1 -1
  63. package/cjs/model/base-model.d.ts +1 -0
  64. package/cjs/model/base-model.js +1 -0
  65. package/cjs/model/base-model.js.map +1 -1
  66. package/cjs/model/interface.d.ts +2 -1
  67. package/cjs/model/interface.js.map +1 -1
  68. package/cjs/series/polar/polar.js +1 -1
  69. package/cjs/series/polar/polar.js.map +1 -1
  70. package/cjs/series/sankey/sankey.js +14 -7
  71. package/cjs/series/sankey/sankey.js.map +1 -1
  72. package/cjs/util/text.d.ts +3 -3
  73. package/cjs/util/text.js +5 -1
  74. package/cjs/util/text.js.map +1 -1
  75. package/esm/chart/base-chart.js +3 -1
  76. package/esm/chart/base-chart.js.map +1 -1
  77. package/esm/component/axis/base-axis.d.ts +2 -0
  78. package/esm/component/axis/base-axis.js +7 -5
  79. package/esm/component/axis/base-axis.js.map +1 -1
  80. package/esm/component/brush/brush.d.ts +0 -1
  81. package/esm/component/brush/brush.js +10 -6
  82. package/esm/component/brush/brush.js.map +1 -1
  83. package/esm/component/custom-mark/custom-mark.js +2 -1
  84. package/esm/component/custom-mark/custom-mark.js.map +1 -1
  85. package/esm/component/data-zoom/data-filter-base-component.js +6 -4
  86. package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
  87. package/esm/component/marker/mark-area/mark-area.js +5 -5
  88. package/esm/component/marker/mark-area/mark-area.js.map +1 -1
  89. package/esm/component/marker/mark-line/mark-line.js +4 -4
  90. package/esm/component/marker/mark-line/mark-line.js.map +1 -1
  91. package/esm/component/marker/mark-point/mark-point.js +5 -5
  92. package/esm/component/marker/mark-point/mark-point.js.map +1 -1
  93. package/esm/component/tooltip/handler/base.d.ts +2 -4
  94. package/esm/component/tooltip/handler/base.js +14 -39
  95. package/esm/component/tooltip/handler/base.js.map +1 -1
  96. package/esm/component/tooltip/handler/canvas/canvas-tooltip-handler.js +2 -2
  97. package/esm/component/tooltip/handler/canvas/canvas-tooltip-handler.js.map +1 -1
  98. package/esm/component/tooltip/handler/dom/dom-tooltip-handler.js +2 -2
  99. package/esm/component/tooltip/handler/dom/dom-tooltip-handler.js.map +1 -1
  100. package/esm/component/tooltip/handler/dom/util.d.ts +1 -2
  101. package/esm/component/tooltip/handler/dom/util.js +14 -14
  102. package/esm/component/tooltip/handler/dom/util.js.map +1 -1
  103. package/esm/component/tooltip/handler/interface/style.d.ts +4 -23
  104. package/esm/component/tooltip/handler/interface/style.js.map +1 -1
  105. package/esm/component/tooltip/handler/utils/attribute.d.ts +9 -11
  106. package/esm/component/tooltip/handler/utils/attribute.js +131 -123
  107. package/esm/component/tooltip/handler/utils/attribute.js.map +1 -1
  108. package/esm/component/tooltip/handler/utils/common.d.ts +8 -0
  109. package/esm/component/tooltip/handler/utils/common.js +41 -1
  110. package/esm/component/tooltip/handler/utils/common.js.map +1 -1
  111. package/esm/component/tooltip/handler/utils/index.d.ts +0 -1
  112. package/esm/component/tooltip/handler/utils/index.js +0 -2
  113. package/esm/component/tooltip/handler/utils/index.js.map +1 -1
  114. package/esm/component/tooltip/interface/common.d.ts +2 -2
  115. package/esm/component/tooltip/interface/common.js.map +1 -1
  116. package/esm/component/tooltip/interface/theme.d.ts +5 -3
  117. package/esm/component/tooltip/interface/theme.js.map +1 -1
  118. package/esm/component/tooltip/tooltip.d.ts +1 -0
  119. package/esm/component/tooltip/tooltip.js +7 -4
  120. package/esm/component/tooltip/tooltip.js.map +1 -1
  121. package/esm/core/index.d.ts +1 -1
  122. package/esm/core/index.js +1 -1
  123. package/esm/core/index.js.map +1 -1
  124. package/esm/core/util.d.ts +3 -0
  125. package/esm/core/util.js +6 -0
  126. package/esm/core/util.js.map +1 -0
  127. package/esm/core/vchart.d.ts +3 -0
  128. package/esm/core/vchart.js +3 -1
  129. package/esm/core/vchart.js.map +1 -1
  130. package/esm/interaction/trigger.js +1 -2
  131. package/esm/layout/base-layout.js +2 -1
  132. package/esm/mark/box-plot.js +1 -1
  133. package/esm/model/base-model.d.ts +1 -0
  134. package/esm/model/base-model.js +1 -0
  135. package/esm/model/base-model.js.map +1 -1
  136. package/esm/model/interface.d.ts +2 -1
  137. package/esm/model/interface.js.map +1 -1
  138. package/esm/series/polar/polar.js +1 -1
  139. package/esm/series/polar/polar.js.map +1 -1
  140. package/esm/series/sankey/sankey.js +12 -5
  141. package/esm/series/sankey/sankey.js.map +1 -1
  142. package/esm/util/text.d.ts +3 -3
  143. package/esm/util/text.js +2 -0
  144. package/esm/util/text.js.map +1 -1
  145. package/package.json +4 -4
  146. package/cjs/component/tooltip/handler/utils/style.d.ts +0 -4
  147. package/cjs/component/tooltip/handler/utils/style.js +0 -32
  148. package/cjs/component/tooltip/handler/utils/style.js.map +0 -1
  149. package/esm/component/tooltip/handler/utils/style.d.ts +0 -4
  150. package/esm/component/tooltip/handler/utils/style.js +0 -26
  151. package/esm/component/tooltip/handler/utils/style.js.map +0 -1
@@ -27,7 +27,7 @@ class CanvasTooltipHandler extends base_1.BaseTooltipHandler {
27
27
  layerCanvas.style.pointerEvents = "none"), this._layer;
28
28
  }
29
29
  _removeTooltip() {
30
- this._layer && this._layer.removeAllChild(), this._attributeCache = null;
30
+ this._layer && this._layer.removeAllChild(), this._attributes = null;
31
31
  }
32
32
  _updateTooltip(visible, params, actualTooltip) {
33
33
  this._visible = visible;
@@ -39,7 +39,7 @@ class CanvasTooltipHandler extends base_1.BaseTooltipHandler {
39
39
  })));
40
40
  this._tooltipComponent || this._initTooltipComponent(stage);
41
41
  const pos = null == actualTooltip ? void 0 : actualTooltip.position;
42
- params.changePositionOnly ? (0, vutils_1.isValid)(pos) && this._tooltipComponent.setAttributes(pos) : this._tooltipComponent.setAttributes(Object.assign(Object.assign({}, this._attributeCache), pos)),
42
+ params.changePositionOnly ? (0, vutils_1.isValid)(pos) && this._tooltipComponent.setAttributes(pos) : this._tooltipComponent.setAttributes(Object.assign(Object.assign({}, this._attributes), pos)),
43
43
  this._tooltipComponent.attribute.visible || (this._tooltipComponent.showAll(), this._tooltipComponent.setAttributes({
44
44
  visibleAll: !0
45
45
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/canvas/canvas-tooltip-handler.ts"],"names":[],"mappings":";;;AAGA,kCAA6C;AAC7C,qEAA2E;AAC3E,6CAA2C;AAC3C,4CAAkD;AAMlD,MAAa,oBAAqB,SAAQ,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,MAAA,IAAI,CAAC,MAAM,0CAAE,OAAO,EAAE,CAAC;IACzB,CAAC;CACF;AAhGD,oDAgGC","file":"canvas-tooltip-handler.js","sourcesContent":["import type { ILayer, INode, Stage } from '@visactor/vrender';\nimport type { IToolTipActual } from '../../../../typings/tooltip';\nimport type { TooltipHandlerParams } from '../../interface';\nimport { BaseTooltipHandler } from '../base';\nimport { Tooltip as TooltipComponent } from '@visactor/vrender-components';\nimport { isValid } from '@visactor/vutils';\nimport { TooltipHandlerType } from '../constants';\nimport type { Tooltip } from '../../tooltip';\n\n/**\n * The tooltip handler class.\n */\nexport class CanvasTooltipHandler extends BaseTooltipHandler {\n type = TooltipHandlerType.canvas;\n\n private _layer: ILayer;\n protected _el?: HTMLCanvasElement;\n protected _tooltipCanvasId?: string;\n protected _tooltipComponent: TooltipComponent;\n\n constructor(tooltipId: string, component: Tooltip) {\n super(tooltipId, component);\n this._tooltipCanvasId = (this._chartOption.modeParams as any)?.tooltipCanvasId;\n }\n\n private _initTooltipComponent(stage: Stage) {\n const layer = this._getLayer(stage);\n this._tooltipComponent = new TooltipComponent({\n autoCalculatePosition: false,\n autoMeasure: false\n });\n layer.add(this._tooltipComponent as unknown as INode);\n }\n\n private _getLayer(stage: Stage) {\n if (this._layer) {\n return this._layer;\n }\n\n this._layer = stage.createLayer(this._tooltipCanvasId);\n\n // 需要关闭 layer 对应的 canvas 的事件\n const layerCanvas = this._layer.layerHandler.canvas.nativeCanvas as HTMLCanvasElement;\n // TODO:待 vrender 支持\n if (layerCanvas && layerCanvas.style) {\n layerCanvas.style.touchAction = 'none';\n layerCanvas.style.pointerEvents = 'none';\n }\n\n return this._layer;\n }\n\n protected _removeTooltip() {\n if (this._layer) {\n this._layer.removeAllChild();\n // this._layer.render();\n }\n this._attributeCache = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams, actualTooltip: IToolTipActual) {\n this._visible = visible;\n\n const stage = this._compiler.getStage();\n if (!stage) {\n return;\n }\n\n if (!visible) {\n if (this._tooltipComponent && this._tooltipComponent.attribute.visible) {\n this._tooltipComponent.hideAll();\n this._tooltipComponent.setAttributes({\n visibleAll: false\n });\n }\n return;\n }\n\n if (!this._tooltipComponent) {\n this._initTooltipComponent(stage);\n }\n\n const pos = actualTooltip?.position;\n if (!params.changePositionOnly) {\n this._tooltipComponent.setAttributes({\n ...this._attributeCache,\n ...pos\n });\n } else if (isValid(pos)) {\n this._tooltipComponent.setAttributes(pos);\n }\n\n if (!this._tooltipComponent.attribute.visible) {\n this._tooltipComponent.showAll();\n this._tooltipComponent.setAttributes({\n visibleAll: true\n });\n }\n }\n\n isTooltipShown() {\n return this._tooltipComponent?.attribute.visibleAll;\n }\n\n release() {\n super.release();\n this._layer?.release();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/canvas/canvas-tooltip-handler.ts"],"names":[],"mappings":";;;AAGA,kCAA6C;AAC7C,qEAA2E;AAC3E,6CAA2C;AAC3C,4CAAkD;AAMlD,MAAa,oBAAqB,SAAQ,yBAAkB;IAQ1D,YAAY,SAAiB,EAAE,SAAkB;;QAC/C,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAR9B,SAAI,GAAG,8BAAkB,CAAC,MAAM,CAAC;QAS/B,IAAI,CAAC,gBAAgB,GAAG,MAAC,IAAI,CAAC,YAAY,CAAC,UAAkB,0CAAE,eAAe,CAAC;IACjF,CAAC;IAEO,qBAAqB,CAAC,KAAY;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,iBAAiB,GAAG,IAAI,4BAAgB,CAAC;YAC5C,qBAAqB,EAAE,KAAK;YAC5B,WAAW,EAAE,KAAK;SACnB,CAAC,CAAC;QACH,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAqC,CAAC,CAAC;IACxD,CAAC;IAEO,SAAS,CAAC,KAAY;QAC5B,IAAI,IAAI,CAAC,MAAM,EAAE;YAC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,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE;YAC9B,IAAI,CAAC,iBAAiB,CAAC,aAAa,iCAC/B,IAAI,CAAC,WAAW,GAChB,GAAG,EACN,CAAC;SACJ;aAAM,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC,EAAE;YACvB,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;SAC3C;QAED,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,OAAO,EAAE;YAC7C,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;YACjC,IAAI,CAAC,iBAAiB,CAAC,aAAa,CAAC;gBACnC,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;SACJ;IACH,CAAC;IAED,cAAc;;QACZ,OAAO,MAAA,IAAI,CAAC,iBAAiB,0CAAE,SAAS,CAAC,UAAU,CAAC;IACtD,CAAC;IAED,OAAO;;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,MAAA,IAAI,CAAC,MAAM,0CAAE,OAAO,EAAE,CAAC;IACzB,CAAC;CACF;AAhGD,oDAgGC","file":"canvas-tooltip-handler.js","sourcesContent":["import type { ILayer, INode, Stage } from '@visactor/vrender';\nimport type { IToolTipActual } from '../../../../typings/tooltip';\nimport type { TooltipHandlerParams } from '../../interface';\nimport { BaseTooltipHandler } from '../base';\nimport { Tooltip as TooltipComponent } from '@visactor/vrender-components';\nimport { isValid } from '@visactor/vutils';\nimport { TooltipHandlerType } from '../constants';\nimport type { Tooltip } from '../../tooltip';\n\n/**\n * The tooltip handler class.\n */\nexport class CanvasTooltipHandler extends BaseTooltipHandler {\n type = TooltipHandlerType.canvas;\n\n private _layer: ILayer;\n protected _el?: HTMLCanvasElement;\n protected _tooltipCanvasId?: string;\n protected _tooltipComponent: TooltipComponent;\n\n constructor(tooltipId: string, component: Tooltip) {\n super(tooltipId, component);\n this._tooltipCanvasId = (this._chartOption.modeParams as any)?.tooltipCanvasId;\n }\n\n private _initTooltipComponent(stage: Stage) {\n const layer = this._getLayer(stage);\n this._tooltipComponent = new TooltipComponent({\n autoCalculatePosition: false,\n autoMeasure: false\n });\n layer.add(this._tooltipComponent as unknown as INode);\n }\n\n private _getLayer(stage: Stage) {\n if (this._layer) {\n return this._layer;\n }\n\n this._layer = stage.createLayer(this._tooltipCanvasId);\n\n // 需要关闭 layer 对应的 canvas 的事件\n const layerCanvas = this._layer.layerHandler.canvas.nativeCanvas as HTMLCanvasElement;\n // TODO:待 vrender 支持\n if (layerCanvas && layerCanvas.style) {\n layerCanvas.style.touchAction = 'none';\n layerCanvas.style.pointerEvents = 'none';\n }\n\n return this._layer;\n }\n\n protected _removeTooltip() {\n if (this._layer) {\n this._layer.removeAllChild();\n // this._layer.render();\n }\n this._attributes = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams, actualTooltip: IToolTipActual) {\n this._visible = visible;\n\n const stage = this._compiler.getStage();\n if (!stage) {\n return;\n }\n\n if (!visible) {\n if (this._tooltipComponent && this._tooltipComponent.attribute.visible) {\n this._tooltipComponent.hideAll();\n this._tooltipComponent.setAttributes({\n visibleAll: false\n });\n }\n return;\n }\n\n if (!this._tooltipComponent) {\n this._initTooltipComponent(stage);\n }\n\n const pos = actualTooltip?.position;\n if (!params.changePositionOnly) {\n this._tooltipComponent.setAttributes({\n ...this._attributes,\n ...pos\n });\n } else if (isValid(pos)) {\n this._tooltipComponent.setAttributes(pos);\n }\n\n if (!this._tooltipComponent.attribute.visible) {\n this._tooltipComponent.showAll();\n this._tooltipComponent.setAttributes({\n visibleAll: true\n });\n }\n }\n\n isTooltipShown() {\n return this._tooltipComponent?.attribute.visibleAll;\n }\n\n release() {\n super.release();\n this._layer?.release();\n }\n}\n"]}
@@ -32,7 +32,7 @@ class DomTooltipHandler extends base_1.BaseTooltipHandler {
32
32
  valueToHtml: this._option.sanitize,
33
33
  getTooltipStyle: () => this._domStyle,
34
34
  getTooltipActual: () => this._tooltipActual,
35
- getTooltipAttributes: () => this._attributeCache
35
+ getTooltipAttributes: () => this._attributes
36
36
  }, [ tooltipSpec.className ], this.id);
37
37
  }
38
38
  }
@@ -50,7 +50,7 @@ class DomTooltipHandler extends base_1.BaseTooltipHandler {
50
50
  } else this.setVisibility(visible);
51
51
  }
52
52
  _initStyle() {
53
- this._domStyle = (0, util_1.getDomStyles)(this._style, this._attributeCache);
53
+ this._domStyle = (0, util_1.getDomStyles)(this._attributes);
54
54
  }
55
55
  _getParentElement(spec) {
56
56
  var _a;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/dom/dom-tooltip-handler.ts"],"names":[],"mappings":";;;AAEA,kCAA6C;AAC7C,iCAAsC;AAEtC,yDAAqD;AACrD,4CAAmF;AAGnF,8CAAmD;AAKnD,MAAa,iBAAkB,SAAQ,yBAAkB;IAUvD,aAAa;;QACX,OAAO,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,aAAa,EAAE,CAAA,CAAC;IACvC,CAAC;IAED,aAAa,CAAC,MAAe;;QAE3B,IAAI,MAAM,KAAK,IAAI,CAAC,aAAa,EAAE,EAAE;YACnC,MAAA,IAAI,CAAC,KAAK,0CAAE,aAAa,CAAC,MAAM,CAAC,CAAC;SACnC;IACH,CAAC;IAED,YAAY,SAAiB,EAAE,SAAkB;QAC/C,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QArB9B,SAAI,GAAG,8BAAkB,CAAC,GAAG,CAAC;QAEpB,sBAAiB,GAAG,iBAAW,aAAX,iBAAW,uBAAX,iBAAW,CAAE,IAAI,CAAC;QAoB9C,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,MAAM;QACJ,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;QAC9C,MAAM,aAAa,GAAG,WAAW,CAAC,aAAgD,CAAC;QACnF,I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ual } from '../../../../typings/tooltip';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../interface';\nimport { BaseTooltipHandler } from '../base';\nimport { getDomStyles } from './util';\nimport type { IDomTooltipStyle } from './interface';\nimport { TooltipModel } from './model/tooltip-model';\nimport { TOOLTIP_CONTAINER_EL_CLASS_NAME, TooltipHandlerType } from '../constants';\nimport type { Tooltip } from '../../tooltip';\nimport type { Maybe } from '@visactor/vutils';\nimport { domDocument } from '../../../../util/env';\n\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n type = TooltipHandlerType.dom;\n\n protected _tooltipContainer = domDocument?.body;\n protected _domStyle: IDomTooltipStyle;\n protected _tooltipActual?: IToolTipActual;\n protected declare _container: Maybe<HTMLDivElement>;\n\n protected model: TooltipModel;\n\n getVisibility() {\n return !!this.model?.getVisibility();\n }\n\n setVisibility(_value: boolean) {\n // 这里做个节流\n if (_value !== this.getVisibility()) {\n this.model?.setVisibility(_value);\n }\n }\n\n constructor(tooltipId: string, component: Tooltip) {\n super(tooltipId, component);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec();\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement) {\n for (let i = 0; i < parentElement.children.length; i++) {\n if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {\n this._container = parentElement.children[i] as HTMLDivElement;\n break;\n }\n }\n if (!this._container) {\n this._container = domDocument.createElement('div');\n this._container.style.position = 'relative';\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n this.model = new TooltipModel(\n this._container,\n {\n valueToHtml: this._option.sanitize,\n getTooltipStyle: () => this._domStyle,\n getTooltipActual: () => this._tooltipActual,\n getTooltipAttributes: () => this._attributeCache\n },\n [tooltipSpec.className],\n this.id\n );\n }\n }\n\n protected _removeTooltip() {\n this.model?.release();\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams, actualTooltip: IToolTipActual) {\n if (!visible || !this.model) {\n this.setVisibility(visible);\n } else {\n if (!params.changePositionOnly) {\n this._tooltipActual = actualTooltip;\n this._initStyle();\n\n this.model.initAll();\n this.model.setStyle();\n this.model.setContent();\n }\n this.setVisibility(visible);\n\n // 位置\n const { x = 0, y = 0 } = actualTooltip.position ?? {};\n const el = this.model.product;\n if (el) {\n // https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n el.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n }\n\n protected _initStyle() {\n this._domStyle = getDomStyles(this._style, this._attributeCache);\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return this._container ?? super._getParentElement(spec);\n }\n\n isTooltipShown() {\n return this.getVisibility();\n }\n\n reInit() {\n super.reInit();\n this._initStyle();\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/dom/dom-tooltip-handler.ts"],"names":[],"mappings":";;;AAEA,kCAA6C;AAC7C,iCAAsC;AAEtC,yDAAqD;AACrD,4CAAmF;AAGnF,8CAAmD;AAKnD,MAAa,iBAAkB,SAAQ,yBAAkB;IAUvD,aAAa;;QACX,OAAO,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,aAAa,EAAE,CAAA,CAAC;IACvC,CAAC;IAED,aAAa,CAAC,MAAe;;QAE3B,IAAI,MAAM,KAAK,IAAI,CAAC,aAAa,EAAE,EAAE;YACnC,MAAA,IAAI,CAAC,KAAK,0CAAE,aAAa,CAAC,MAAM,CAAC,CAAC;SACnC;IACH,CAAC;IAED,YAAY,SAAiB,EAAE,SAAkB;QAC/C,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QArB9B,SAAI,GAAG,8BAAkB,CAAC,GAAG,CAAC;QAEpB,sBAAiB,GAAG,iBAAW,aAAX,iBAAW,uBAAX,iBAAW,CAAE,IAAI,CAAC;QAoB9C,IA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C,aAAa,EAAE,CAAC;IAC9B,CAAC;IAED,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;CACF;AAtGD,8CAsGC","file":"dom-tooltip-handler.js","sourcesContent":["import type { IToolTipActual } from '../../../../typings/tooltip';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../interface';\nimport { BaseTooltipHandler } from '../base';\nimport { getDomStyles } from './util';\nimport type { IDomTooltipStyle } from './interface';\nimport { TooltipModel } from './model/tooltip-model';\nimport { TOOLTIP_CONTAINER_EL_CLASS_NAME, TooltipHandlerType } from '../constants';\nimport type { Tooltip } from '../../tooltip';\nimport type { Maybe } from '@visactor/vutils';\nimport { domDocument } from '../../../../util/env';\n\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n type = TooltipHandlerType.dom;\n\n protected _tooltipContainer = domDocument?.body;\n protected _domStyle: IDomTooltipStyle;\n protected _tooltipActual?: IToolTipActual;\n protected declare _container: Maybe<HTMLDivElement>;\n\n protected model: TooltipModel;\n\n getVisibility() {\n return !!this.model?.getVisibility();\n }\n\n setVisibility(_value: boolean) {\n // 这里做个节流\n if (_value !== this.getVisibility()) {\n this.model?.setVisibility(_value);\n }\n }\n\n constructor(tooltipId: string, component: Tooltip) {\n super(tooltipId, component);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec();\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement) {\n for (let i = 0; i < parentElement.children.length; i++) {\n if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {\n this._container = parentElement.children[i] as HTMLDivElement;\n break;\n }\n }\n if (!this._container) {\n this._container = domDocument.createElement('div');\n this._container.style.position = 'relative';\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n this.model = new TooltipModel(\n this._container,\n {\n valueToHtml: this._option.sanitize,\n getTooltipStyle: () => this._domStyle,\n getTooltipActual: () => this._tooltipActual,\n getTooltipAttributes: () => this._attributes\n },\n [tooltipSpec.className],\n this.id\n );\n }\n }\n\n protected _removeTooltip() {\n this.model?.release();\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams, actualTooltip: IToolTipActual) {\n if (!visible || !this.model) {\n this.setVisibility(visible);\n } else {\n if (!params.changePositionOnly) {\n this._tooltipActual = actualTooltip;\n this._initStyle();\n\n this.model.initAll();\n this.model.setStyle();\n this.model.setContent();\n }\n this.setVisibility(visible);\n\n // 位置\n const { x = 0, y = 0 } = actualTooltip.position ?? {};\n const el = this.model.product;\n if (el) {\n // https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n el.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n }\n\n protected _initStyle() {\n this._domStyle = getDomStyles(this._attributes);\n }\n\n protected _getParentElement(spec: ITooltipSpec): HTMLElement {\n return this._container ?? super._getParentElement(spec);\n }\n\n isTooltipShown() {\n return this.getVisibility();\n }\n\n reInit() {\n super.reInit();\n this._initStyle();\n }\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  import type { Maybe } from '@visactor/vutils';
2
- import type { ITooltipStyle } from '../interface';
3
2
  import type { IDomTooltipStyle } from './interface';
4
3
  import type { TooltipAttributes } from '@visactor/vrender-components';
5
4
  export declare const getPixelPropertyStr: (num?: number | number[], defaultStr?: string) => string;
6
5
  export declare const pixelPropertyStrToNumber: (str: string) => number | number[];
7
- export declare function getDomStyles(style: Partial<ITooltipStyle>, attributeCache?: Maybe<TooltipAttributes>): IDomTooltipStyle;
6
+ export declare function getDomStyles(attributes?: Maybe<TooltipAttributes>): IDomTooltipStyle;
@@ -14,17 +14,18 @@ const pixelPropertyStrToNumber = str => {
14
14
  return 1 === numArr.length ? numArr[0] : numArr;
15
15
  };
16
16
 
17
- function getDomStyles(style, attributeCache) {
18
- var _a, _b, _c, _d, _e, _f, _g;
19
- const {panel: {fill: fillColor, shadow: shadow, shadowBlur: shadowBlur, shadowColor: shadowColor, shadowOffsetX: shadowOffsetX, shadowOffsetY: shadowOffsetY, shadowSpread: shadowSpread, cornerRadius: cornerRadius, stroke: strokeColor, lineWidth: lineWidth = 0}, padding: padding, key: key, value: value, title: title, shape: shape, enterable: enterable, transitionDuration: transitionDuration} = style, {panel: panelAttribute, title: titleAttribute, content: contentAttribute, keyWidth: keyWidth, valueWidth: valueWidth} = null != attributeCache ? attributeCache : {}, backgroundColor = fillColor, shapeStyle = getShapeStyle(shape), keyStyle = getLabelStyle(key), valueStyle = getLabelStyle(value);
17
+ function getDomStyles(attributes) {
18
+ var _a, _b, _c, _d, _e;
19
+ const {panel: panel = {}, title: titleAttribute, content: contentAttribute, titleStyle: titleStyle = {}, contentStyle: contentStyle = {}, padding: padding, keyWidth: keyWidth, valueWidth: valueWidth, enterable: enterable, transitionDuration: transitionDuration} = null != attributes ? attributes : {}, {fill: backgroundColor, shadow: shadow, shadowBlur: shadowBlur, shadowColor: shadowColor, shadowOffsetX: shadowOffsetX, shadowOffsetY: shadowOffsetY, shadowSpread: shadowSpread, cornerRadius: cornerRadius, stroke: strokeColor, lineWidth: lineWidth = 0, width: width = 0, height: height = 0} = panel, {value: title = {}} = titleStyle, {shape: shape = {}, key: key = {}, value: value = {}} = contentStyle, shapeStyle = getShapeStyle(shape), keyStyle = getLabelStyle(key), valueStyle = getLabelStyle(value), {bottom: bottom, left: left, right: right, top: top} = (0,
20
+ util_1.normalizeLayoutPaddingSpec)(padding);
20
21
  return {
21
22
  panel: {
22
- width: (0, exports.getPixelPropertyStr)((null !== (_a = null == panelAttribute ? void 0 : panelAttribute.width) && void 0 !== _a ? _a : 0) + 2 * lineWidth),
23
- minHeight: (0, exports.getPixelPropertyStr)((null !== (_b = null == panelAttribute ? void 0 : panelAttribute.height) && void 0 !== _b ? _b : 0) + 2 * lineWidth),
24
- paddingBottom: (0, exports.getPixelPropertyStr)(padding.bottom),
25
- paddingLeft: (0, exports.getPixelPropertyStr)(padding.left),
26
- paddingRight: (0, exports.getPixelPropertyStr)(padding.right),
27
- paddingTop: (0, exports.getPixelPropertyStr)(padding.top),
23
+ width: (0, exports.getPixelPropertyStr)(width + 2 * lineWidth),
24
+ minHeight: (0, exports.getPixelPropertyStr)(height + 2 * lineWidth),
25
+ paddingBottom: (0, exports.getPixelPropertyStr)(bottom),
26
+ paddingLeft: (0, exports.getPixelPropertyStr)(left),
27
+ paddingRight: (0, exports.getPixelPropertyStr)(right),
28
+ paddingTop: (0, exports.getPixelPropertyStr)(top),
28
29
  borderColor: strokeColor,
29
30
  borderWidth: (0, exports.getPixelPropertyStr)(lineWidth),
30
31
  borderRadius: (0, exports.getPixelPropertyStr)(cornerRadius),
@@ -45,8 +46,8 @@ function getDomStyles(style, attributeCache) {
45
46
  common: shapeStyle,
46
47
  items: [],
47
48
  width: (0, exports.getPixelPropertyStr)(shape.size),
48
- marginRight: (0, exports.getPixelPropertyStr)(null !== (_c = shape.spacing) && void 0 !== _c ? _c : 8),
49
- marginBottom: (0, exports.getPixelPropertyStr)(-(null !== (_e = null === (_d = null == contentAttribute ? void 0 : contentAttribute[(null == contentAttribute ? void 0 : contentAttribute.length) - 1]) || void 0 === _d ? void 0 : _d.spaceRow) && void 0 !== _e ? _e : 0))
49
+ marginRight: (0, exports.getPixelPropertyStr)(null !== (_a = shape.spacing) && void 0 !== _a ? _a : 8),
50
+ marginBottom: (0, exports.getPixelPropertyStr)(-(null !== (_c = null === (_b = null == contentAttribute ? void 0 : contentAttribute[(null == contentAttribute ? void 0 : contentAttribute.length) - 1]) || void 0 === _b ? void 0 : _b.spaceRow) && void 0 !== _c ? _c : 0))
50
51
  },
51
52
  keyColumn: {
52
53
  common: keyStyle,
@@ -57,7 +58,7 @@ function getDomStyles(style, attributeCache) {
57
58
  width: (0, exports.getPixelPropertyStr)(Math.ceil(key.width))
58
59
  } : void 0))),
59
60
  width: (0, exports.getPixelPropertyStr)(keyWidth),
60
- marginRight: (0, exports.getPixelPropertyStr)(null !== (_f = key.spacing) && void 0 !== _f ? _f : 26)
61
+ marginRight: (0, exports.getPixelPropertyStr)(null !== (_d = key.spacing) && void 0 !== _d ? _d : 26)
61
62
  },
62
63
  valueColumn: {
63
64
  common: valueStyle,
@@ -68,7 +69,7 @@ function getDomStyles(style, attributeCache) {
68
69
  width: (0, exports.getPixelPropertyStr)(Math.ceil(value.width))
69
70
  } : void 0))),
70
71
  width: (0, exports.getPixelPropertyStr)(valueWidth),
71
- marginRight: (0, exports.getPixelPropertyStr)(null !== (_g = value.spacing) && void 0 !== _g ? _g : 0)
72
+ marginRight: (0, exports.getPixelPropertyStr)(null !== (_e = value.spacing) && void 0 !== _e ? _e : 0)
72
73
  }
73
74
  };
74
75
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/dom/util.ts"],"names":[],"mappings":";;;AAEA,2CAA+D;AAM/D,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,GAAuB,EAAE,UAAmB,EAAE,EAAE;IAClF,IAAI,IAAA,cAAO,EAAC,GAAG,CAAC,EAAE;QAChB,IAAI,IAAA,cAAO,EAAC,GAAG,CAAC,EAAE;YAChB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACzC;QACD,OAAO,GAAG,GAAG,IAAI,CAAC;KACnB;IACD,OAAO,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,SAAS,CAAC;AACjC,CAAC,CAAC;AARW,QAAA,mBAAmB,uBAQ9B;AAEK,MAAM,wBAAwB,GAAG,CAAC,GAAW,EAAqB,EAAE;IACzE,MAAM,MAAM,GAAG,GAAG,CAA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AQ,CAAC;AAClB,CAAC","file":"util.js","sourcesContent":["import type { Maybe } from '@visactor/vutils';\nimport type { FontWeight, TextAlign } from '../../../../typings';\nimport { isValid, mergeSpec, isArray } from '../../../../util';\nimport type { ITooltipTheme } from '../../interface';\nimport type { ITooltipTextStyle, ITooltipStyle } from '../interface';\nimport type { ILabelStyle, IShapeStyle, IDomTooltipStyle } from './interface';\nimport type { TooltipAttributes } from '@visactor/vrender-components';\n\nconst DEFAULT_SHAPE_SPACING = 8;\nconst DEFAULT_KEY_SPACING = 26;\nconst DEFAULT_VALUE_SPACING = 0;\n\nexport const getPixelPropertyStr = (num?: number | number[], defaultStr?: string) => {\n if (isValid(num)) {\n if (isArray(num)) {\n return num.map(n => `${n}px`).join(' ');\n }\n return `${num}px`;\n }\n return defaultStr ?? 'initial';\n};\n\nexport const pixelPropertyStrToNumber = (str: string): number | number[] => {\n const strArr = str.split(' ');\n const numArr = strArr.map(n => {\n if (!Number.isNaN(n)) {\n return Number.parseFloat(n);\n }\n return Number.parseFloat(n.substring(0, n.length - 2));\n });\n if (numArr.length === 1) {\n return numArr[0];\n }\n return numArr;\n};\n\nexport function getDomStyles(\n style: Partial<ITooltipStyle>,\n attributeCache?: Maybe<TooltipAttributes>\n): IDomTooltipStyle {\n const {\n panel: {\n fill: fillColor,\n shadow,\n shadowBlur,\n shadowColor,\n shadowOffsetX,\n shadowOffsetY,\n shadowSpread,\n cornerRadius,\n stroke: strokeColor,\n lineWidth = 0\n },\n padding,\n key,\n value,\n title,\n shape,\n enterable,\n transitionDuration\n } = style;\n\n const {\n panel: panelAttribute,\n title: titleAttribute,\n content: contentAttribute,\n keyWidth,\n valueWidth\n } = attributeCache ?? {};\n\n const backgroundColor = fillColor as string;\n\n const shapeStyle = getShapeStyle(shape);\n const keyStyle = getLabelStyle(key);\n const valueStyle = getLabelStyle(value);\n\n const styles: IDomTooltipStyle = {\n panel: {\n width: getPixelPropertyStr((panelAttribute?.width ?? 0) + lineWidth * 2),\n minHeight: getPixelPropertyStr((panelAttribute?.height ?? 0) + lineWidth * 2),\n paddingBottom: getPixelPropertyStr(padding.bottom),\n paddingLeft: getPixelPropertyStr(padding.left),\n paddingRight: getPixelPropertyStr(padding.right),\n paddingTop: getPixelPropertyStr(padding.top),\n borderColor: strokeColor as string,\n borderWidth: getPixelPropertyStr(lineWidth),\n borderRadius: getPixelPropertyStr(cornerRadius),\n backgroundColor: backgroundColor ? `${backgroundColor}` : 'transparent',\n boxShadow: shadow\n ? `${shadowOffsetX}px ${shadowOffsetY}px ${shadowBlur}px ${shadowSpread}px ${shadowColor}`\n : 'initial',\n pointerEvents: enterable ? 'auto' : 'none',\n transitionDuration: transitionDuration ? `${transitionDuration}ms` : 'initial',\n transitionProperty: transitionDuration ? 'transform' : 'initial',\n transitionTimingFunction: transitionDuration ? 'ease-out' : 'initial'\n },\n title: {\n marginTop: '0px',\n marginBottom: contentAttribute?.length ? getPixelPropertyStr(titleAttribute?.spaceRow) : '0px',\n ...getLabelStyle(mergeSpec({}, title, titleAttribute?.value))\n },\n content: {},\n shapeColumn: {\n common: shapeStyle,\n items: [],\n width: getPixelPropertyStr(shape.size),\n marginRight: getPixelPropertyStr(shape.spacing ?? DEFAULT_SHAPE_SPACING),\n marginBottom: getPixelPropertyStr(-(contentAttribute?.[contentAttribute?.length - 1]?.spaceRow ?? 0))\n },\n keyColumn: {\n common: keyStyle,\n items: contentAttribute?.map(\n ({ key, spaceRow }, i) =>\n ({\n marginTop: '0px',\n marginBottom: i < contentAttribute.length - 1 ? getPixelPropertyStr(spaceRow) : '0px',\n ...keyStyle,\n ...getLabelStyle(key as ITooltipTextStyle),\n ...(key?.multiLine ? { width: getPixelPropertyStr(Math.ceil(key.width)) } : undefined) // 对多行文本使用定宽\n } as ILabelStyle)\n ),\n width: getPixelPropertyStr(keyWidth),\n marginRight: getPixelPropertyStr(key.spacing ?? DEFAULT_KEY_SPACING)\n },\n valueColumn: {\n common: valueStyle,\n items: contentAttribute?.map(\n ({ value, spaceRow }, i) =>\n ({\n marginTop: '0px',\n marginBottom: i < contentAttribute.length - 1 ? getPixelPropertyStr(spaceRow) : '0px',\n ...valueStyle,\n ...getLabelStyle(value as ITooltipTextStyle),\n ...(value?.multiLine ? { width: getPixelPropertyStr(Math.ceil(value.width)) } : undefined) // 对多行文本使用定宽\n } as ILabelStyle)\n ),\n width: getPixelPropertyStr(valueWidth),\n marginRight: getPixelPropertyStr(value.spacing ?? DEFAULT_VALUE_SPACING)\n }\n };\n return styles;\n}\n\nfunction getLabelStyle(\n labelStyle?: ITooltipTextStyle,\n defaultStyle?: Partial<ITooltipTextStyle>\n): ILabelStyle | undefined {\n if (!labelStyle) {\n return undefined;\n }\n const {\n fontFamily: labelFont,\n fontSize: labelFontSize,\n fill: labelColor,\n textAlign,\n lineHeight,\n fontWeight,\n multiLine,\n wordBreak,\n maxWidth\n } = mergeSpec({}, defaultStyle, labelStyle) as ITooltipTextStyle;\n const styleObj: ILabelStyle = {};\n\n styleObj.fontFamily = labelFont;\n styleObj.fontSize = getPixelPropertyStr(labelFontSize);\n styleObj.color = labelColor as string;\n styleObj.textAlign = textAlign as TextAlign;\n styleObj.lineHeight = getPixelPropertyStr(lineHeight);\n styleObj.fontWeight = fontWeight as FontWeight;\n styleObj.whiteSpace = multiLine ? 'initial' : 'nowrap';\n styleObj.wordBreak = wordBreak;\n styleObj.maxWidth = getPixelPropertyStr(maxWidth);\n return styleObj;\n}\n\nfunction getShapeStyle(\n shapeStyle?: ITooltipTheme['shape'],\n defaultStyle?: Partial<ITooltipTheme['shape']>\n): IShapeStyle | undefined {\n if (!shapeStyle) {\n return undefined;\n }\n const { size } = mergeSpec({}, defaultStyle, shapeStyle);\n const styleObj: IShapeStyle = {};\n\n styleObj.width = getPixelPropertyStr(size);\n return styleObj;\n}\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/dom/util.ts"],"names":[],"mappings":";;;AAEA,2CAA2F;AAM3F,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,M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C,UAAU,GAAG,IAAA,2BAAmB,EAAC,UAAU,CAAC,CAAC;IACtD,QAAQ,CAAC,UAAU,GAAG,UAAwB,CAAC;IAC/C,QAAQ,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;IACvD,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,QAAQ,GAAG,IAAA,2BAAmB,EAAC,QAAQ,CAAC,CAAC;IAClD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,aAAa,CACpB,UAAmC,EACnC,YAA8C;IAE9C,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,gBAAS,EAAC,EAAE,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;IACzD,MAAM,QAAQ,GAAgB,EAAE,CAAC;IAEjC,QAAQ,CAAC,KAAK,GAAG,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,QAAQ,CAAC;AAClB,CAAC","file":"util.js","sourcesContent":["import type { Maybe } from '@visactor/vutils';\nimport type { FontWeight, TextAlign } from '../../../../typings';\nimport { isValid, mergeSpec, isArray, normalizeLayoutPaddingSpec } from '../../../../util';\nimport type { ITooltipTheme } from '../../interface';\nimport type { ITooltipTextStyle } from '../interface';\nimport type { ILabelStyle, IShapeStyle, IDomTooltipStyle } from './interface';\nimport type { TooltipAttributes } from '@visactor/vrender-components';\n\nconst DEFAULT_SHAPE_SPACING = 8;\nconst DEFAULT_KEY_SPACING = 26;\nconst DEFAULT_VALUE_SPACING = 0;\n\nexport const getPixelPropertyStr = (num?: number | number[], defaultStr?: string) => {\n if (isValid(num)) {\n if (isArray(num)) {\n return num.map(n => `${n}px`).join(' ');\n }\n return `${num}px`;\n }\n return defaultStr ?? 'initial';\n};\n\nexport const pixelPropertyStrToNumber = (str: string): number | number[] => {\n const strArr = str.split(' ');\n const numArr = strArr.map(n => {\n if (!Number.isNaN(n)) {\n return Number.parseFloat(n);\n }\n return Number.parseFloat(n.substring(0, n.length - 2));\n });\n if (numArr.length === 1) {\n return numArr[0];\n }\n return numArr;\n};\n\nexport function getDomStyles(attributes?: Maybe<TooltipAttributes>): IDomTooltipStyle {\n const {\n panel = {},\n title: titleAttribute,\n content: contentAttribute,\n titleStyle = {},\n contentStyle = {},\n padding,\n keyWidth,\n valueWidth,\n enterable,\n transitionDuration\n } = attributes ?? {};\n\n const {\n fill: backgroundColor,\n shadow,\n shadowBlur,\n shadowColor,\n shadowOffsetX,\n shadowOffsetY,\n shadowSpread,\n cornerRadius,\n stroke: strokeColor,\n lineWidth = 0,\n width = 0,\n height = 0\n } = panel;\n\n const { value: title = {} } = titleStyle;\n const { shape = {}, key = {}, value = {} } = contentStyle;\n\n const shapeStyle = getShapeStyle(shape);\n const keyStyle = getLabelStyle(key);\n const valueStyle = getLabelStyle(value);\n const { bottom, left, right, top } = normalizeLayoutPaddingSpec(padding);\n\n const styles: IDomTooltipStyle = {\n panel: {\n width: getPixelPropertyStr(width + lineWidth * 2),\n minHeight: getPixelPropertyStr(height + lineWidth * 2),\n paddingBottom: getPixelPropertyStr(bottom as number),\n paddingLeft: getPixelPropertyStr(left as number),\n paddingRight: getPixelPropertyStr(right as number),\n paddingTop: getPixelPropertyStr(top as number),\n borderColor: strokeColor as string,\n borderWidth: getPixelPropertyStr(lineWidth),\n borderRadius: getPixelPropertyStr(cornerRadius),\n backgroundColor: backgroundColor ? `${backgroundColor}` : 'transparent',\n boxShadow: shadow\n ? `${shadowOffsetX}px ${shadowOffsetY}px ${shadowBlur}px ${shadowSpread}px ${shadowColor}`\n : 'initial',\n pointerEvents: enterable ? 'auto' : 'none',\n transitionDuration: transitionDuration ? `${transitionDuration}ms` : 'initial',\n transitionProperty: transitionDuration ? 'transform' : 'initial',\n transitionTimingFunction: transitionDuration ? 'ease-out' : 'initial'\n },\n title: {\n marginTop: '0px',\n marginBottom: contentAttribute?.length ? getPixelPropertyStr(titleAttribute?.spaceRow) : '0px',\n ...getLabelStyle(mergeSpec({}, title, titleAttribute?.value))\n },\n content: {},\n shapeColumn: {\n common: shapeStyle,\n items: [],\n width: getPixelPropertyStr(shape.size),\n marginRight: getPixelPropertyStr(shape.spacing ?? DEFAULT_SHAPE_SPACING),\n marginBottom: getPixelPropertyStr(-(contentAttribute?.[contentAttribute?.length - 1]?.spaceRow ?? 0))\n },\n keyColumn: {\n common: keyStyle,\n items: contentAttribute?.map(\n ({ key, spaceRow }, i) =>\n ({\n marginTop: '0px',\n marginBottom: i < contentAttribute.length - 1 ? getPixelPropertyStr(spaceRow) : '0px',\n ...keyStyle,\n ...getLabelStyle(key as ITooltipTextStyle),\n ...(key?.multiLine ? { width: getPixelPropertyStr(Math.ceil(key.width)) } : undefined) // 对多行文本使用定宽\n } as ILabelStyle)\n ),\n width: getPixelPropertyStr(keyWidth),\n marginRight: getPixelPropertyStr(key.spacing ?? DEFAULT_KEY_SPACING)\n },\n valueColumn: {\n common: valueStyle,\n items: contentAttribute?.map(\n ({ value, spaceRow }, i) =>\n ({\n marginTop: '0px',\n marginBottom: i < contentAttribute.length - 1 ? getPixelPropertyStr(spaceRow) : '0px',\n ...valueStyle,\n ...getLabelStyle(value as ITooltipTextStyle),\n ...(value?.multiLine ? { width: getPixelPropertyStr(Math.ceil(value.width)) } : undefined) // 对多行文本使用定宽\n } as ILabelStyle)\n ),\n width: getPixelPropertyStr(valueWidth),\n marginRight: getPixelPropertyStr(value.spacing ?? DEFAULT_VALUE_SPACING)\n }\n };\n return styles;\n}\n\nfunction getLabelStyle(\n labelStyle?: ITooltipTextStyle,\n defaultStyle?: Partial<ITooltipTextStyle>\n): ILabelStyle | undefined {\n if (!labelStyle) {\n return undefined;\n }\n const {\n fontFamily: labelFont,\n fontSize: labelFontSize,\n fill: labelColor,\n textAlign,\n lineHeight,\n fontWeight,\n multiLine,\n wordBreak,\n maxWidth\n } = mergeSpec({}, defaultStyle, labelStyle) as ITooltipTextStyle;\n const styleObj: ILabelStyle = {};\n\n styleObj.fontFamily = labelFont;\n styleObj.fontSize = getPixelPropertyStr(labelFontSize);\n styleObj.color = labelColor as string;\n styleObj.textAlign = textAlign as TextAlign;\n styleObj.lineHeight = getPixelPropertyStr(lineHeight);\n styleObj.fontWeight = fontWeight as FontWeight;\n styleObj.whiteSpace = multiLine ? 'initial' : 'nowrap';\n styleObj.wordBreak = wordBreak;\n styleObj.maxWidth = getPixelPropertyStr(maxWidth);\n return styleObj;\n}\n\nfunction getShapeStyle(\n shapeStyle?: ITooltipTheme['shape'],\n defaultStyle?: Partial<ITooltipTheme['shape']>\n): IShapeStyle | undefined {\n if (!shapeStyle) {\n return undefined;\n }\n const { size } = mergeSpec({}, defaultStyle, shapeStyle);\n const styleObj: IShapeStyle = {};\n\n styleObj.width = getPixelPropertyStr(size);\n return styleObj;\n}\n"]}
@@ -1,27 +1,8 @@
1
- import type { ITextAttribute, IFillStyle, IRectGraphicAttribute, RichTextWordBreak } from '@visactor/vrender';
2
- import type { IPadding } from '../../../../typings';
1
+ import type { ITextAttribute, IFillStyle, RichTextWordBreak } from '@visactor/vrender';
3
2
  export interface ITooltipTextStyle extends Partial<ITextAttribute & IFillStyle> {
4
- spacing: number;
5
- multiLine: boolean;
3
+ spacing?: number;
4
+ multiLine?: boolean;
6
5
  maxWidth?: number;
7
6
  wordBreak?: RichTextWordBreak;
8
- }
9
- export interface ITooltipPanelStyle extends Partial<IRectGraphicAttribute> {
10
- shadow: boolean;
11
- shadowSpread?: number;
12
- }
13
- export interface ITooltipStyle {
14
- panel: ITooltipPanelStyle;
15
- title: ITooltipTextStyle;
16
- shape: {
17
- fill: boolean;
18
- size: number;
19
- spacing: number;
20
- };
21
- key: ITooltipTextStyle;
22
- value: ITooltipTextStyle;
23
- padding: IPadding;
24
- spaceRow: number;
25
- enterable: boolean;
26
- transitionDuration: number;
7
+ autoWidth?: boolean;
27
8
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/interface/style.ts"],"names":[],"mappings":"","file":"style.js","sourcesContent":["import type { ITextAttribute, IFillStyle, IRectGraphicAttribute, RichTextWordBreak } from '@visactor/vrender';\nimport type { IPadding } from '../../../../typings';\n\nexport interface ITooltipTextStyle extends Partial<ITextAttribute & IFillStyle> {\n /** 和相邻元素的水平间距 */\n spacing: number;\n /** 是否支持换行 */\n multiLine: boolean;\n /** 文本元素的最大宽度 */\n maxWidth?: number;\n /** 换行模式 */\n wordBreak?: RichTextWordBreak;\n}\n\nexport interface ITooltipPanelStyle extends Partial<IRectGraphicAttribute> {\n shadow: boolean;\n shadowSpread?: number;\n}\n\nexport interface ITooltipStyle {\n panel: ITooltipPanelStyle;\n title: ITooltipTextStyle;\n shape: {\n fill: boolean;\n size: number;\n spacing: number;\n };\n key: ITooltipTextStyle;\n value: ITooltipTextStyle;\n padding: IPadding;\n spaceRow: number;\n enterable: boolean;\n transitionDuration: number;\n}\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/interface/style.ts"],"names":[],"mappings":"","file":"style.js","sourcesContent":["import type { ITextAttribute, IFillStyle, RichTextWordBreak } from '@visactor/vrender';\n\nexport interface ITooltipTextStyle extends Partial<ITextAttribute & IFillStyle> {\n /** 和相邻元素的水平间距 */\n spacing?: number;\n /** 是否支持换行 */\n multiLine?: boolean;\n /** 文本元素的最大宽度 */\n maxWidth?: number;\n /** 换行模式 */\n wordBreak?: RichTextWordBreak;\n /** 是否开启自动宽度 */\n autoWidth?: boolean;\n}\n"]}
@@ -1,11 +1,9 @@
1
- import type { TooltipAttributes } from '@visactor/vrender-components';
2
- import type { IToolTipActual, MaybeArray } from '../../../../typings';
3
- import type { ITooltipStyle, ITooltipTextStyle } from '../interface';
4
- export declare const getTooltipAttributes: (actualTooltip: IToolTipActual, style: Partial<ITooltipStyle>) => TooltipAttributes;
5
- interface ITooltipTextInfo {
6
- width: number;
7
- height: number;
8
- text: MaybeArray<number> | MaybeArray<string>;
9
- }
10
- export declare const measureTooltipText: (text: string, style: ITooltipTextStyle) => ITooltipTextInfo;
11
- export {};
1
+ import type { TooltipAttributes, TooltipPanelAttrs } from '@visactor/vrender-components';
2
+ import type { IToolTipActual } from '../../../../typings';
3
+ import type { ITooltipTextStyle } from '../interface';
4
+ import type { ITooltipSpec } from '../../interface/spec';
5
+ import type { ITheme } from '../../../../theme';
6
+ import type { ITooltipTextTheme, ITooltipTheme } from '../../interface/theme';
7
+ export declare function getTextAttributes(style?: ITooltipTextTheme, globalTheme?: ITheme, defaultAttributes?: Partial<ITooltipTextStyle>): ITooltipTextStyle;
8
+ export declare const getPanelAttributes: (style: ITooltipTheme['panel']) => TooltipPanelAttrs;
9
+ export declare const getTooltipAttributes: (actualTooltip: IToolTipActual, spec: ITooltipSpec, globalTheme: ITheme) => TooltipAttributes;
@@ -2,10 +2,61 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.measureTooltipText = exports.getTooltipAttributes = void 0;
5
+ }), exports.getTooltipAttributes = exports.getPanelAttributes = exports.getTextAttributes = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), util_1 = require("../../../../util"), vrender_1 = require("@visactor/vrender"), style_1 = require("./style"), getTooltipAttributes = (actualTooltip, style) => {
8
- const {spaceRow: commonSpaceRow, padding: padding, title: titleStyle, shape: shapeStyle, key: keyStyle, value: valueStyle} = style, attribute = Object.assign(Object.assign({}, style), {
7
+ const vutils_1 = require("@visactor/vutils"), util_1 = require("../../../../util"), constants_1 = require("../../../../theme/builtin/common/constants"), common_1 = require("./common"), DEFAULT_TEXT_ATTRIBUTES = {
8
+ fontFamily: constants_1.THEME_CONSTANTS.defaultFontFamily,
9
+ spacing: 10,
10
+ wordBreak: "break-word"
11
+ };
12
+
13
+ function getTextAttributes(style = {}, globalTheme, defaultAttributes) {
14
+ var _a, _b;
15
+ return Object.assign(Object.assign({}, null != defaultAttributes ? defaultAttributes : DEFAULT_TEXT_ATTRIBUTES), {
16
+ fill: null !== (_a = style.fill) && void 0 !== _a ? _a : style.fontColor,
17
+ textAlign: style.textAlign,
18
+ textBaseline: style.textBaseline,
19
+ fontFamily: null !== (_b = style.fontFamily) && void 0 !== _b ? _b : null == globalTheme ? void 0 : globalTheme.fontFamily,
20
+ fontSize: style.fontSize,
21
+ fontWeight: style.fontWeight,
22
+ lineHeight: style.lineHeight,
23
+ spacing: style.spacing,
24
+ multiLine: style.multiLine,
25
+ maxWidth: style.maxWidth,
26
+ wordBreak: style.wordBreak,
27
+ autoWidth: style.autoWidth
28
+ });
29
+ }
30
+
31
+ exports.getTextAttributes = getTextAttributes;
32
+
33
+ const getPanelAttributes = style => {
34
+ var _a;
35
+ const {backgroundColor: backgroundColor, border: border, shadow: shadow} = style, panelAttrs = {
36
+ lineWidth: null !== (_a = null == border ? void 0 : border.width) && void 0 !== _a ? _a : 0,
37
+ shadow: !!shadow
38
+ };
39
+ (null == border ? void 0 : border.color) && (panelAttrs.stroke = border.color),
40
+ backgroundColor && (panelAttrs.fill = backgroundColor), shadow && (panelAttrs.shadowColor = shadow.color,
41
+ panelAttrs.shadowBlur = shadow.blur, panelAttrs.shadowOffsetX = shadow.x, panelAttrs.shadowOffsetY = shadow.y,
42
+ panelAttrs.shadowSpread = shadow.spread);
43
+ const {radius: radius} = null != border ? border : {};
44
+ return (0, vutils_1.isValid)(radius) && (panelAttrs.cornerRadius = [ radius, radius, radius, radius ]),
45
+ panelAttrs;
46
+ };
47
+
48
+ exports.getPanelAttributes = getPanelAttributes;
49
+
50
+ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
51
+ var _a, _b, _c, _d, _e;
52
+ const {style: style = {}, enterable: enterable, transitionDuration: transitionDuration} = spec, {panel: panel = {}, titleLabel: titleLabel, shape: shape, keyLabel: keyLabel, valueLabel: valueLabel, spaceRow: commonSpaceRow} = style, padding = (0,
53
+ vutils_1.normalizePadding)(panel.padding), paddingSpec = (0, util_1.normalizeLayoutPaddingSpec)(panel.padding), titleStyle = getTextAttributes(titleLabel, globalTheme), keyStyle = getTextAttributes(keyLabel, globalTheme), valueStyle = getTextAttributes(valueLabel, globalTheme), shapeStyle = {
54
+ fill: !0,
55
+ size: null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8,
56
+ spacing: null !== (_b = null == shape ? void 0 : shape.spacing) && void 0 !== _b ? _b : 6
57
+ }, attributes = {
58
+ panel: (0, exports.getPanelAttributes)(panel),
59
+ padding: padding,
9
60
  title: {},
10
61
  content: [],
11
62
  titleStyle: {
@@ -20,133 +71,92 @@ const vutils_1 = require("@visactor/vutils"), util_1 = require("../../../../util
20
71
  },
21
72
  hasContentShape: !1,
22
73
  keyWidth: 0,
23
- valueWidth: 0
24
- });
25
- [ "key", "value", "shape" ].forEach((key => {
26
- delete attribute[key];
27
- }));
28
- const {title: title = {}, content: content = []} = actualTooltip;
29
- let maxWidth = 0, containerHeight = padding.top + padding.bottom, titleMaxHeight = 0;
30
- const {visible: titleVisible = !0, value: titleValue = "", valueStyle: titleValueStyle, hasShape: titleHasShape, shapeType: titleShapeType = "", shapeHollow: titleShapeHollow, shapeColor: titleShapeColor, spaceRow: titleSpaceRow} = title;
31
- if (attribute.title.visible = titleVisible, attribute.title.spaceRow = null != titleSpaceRow ? titleSpaceRow : commonSpaceRow,
32
- titleVisible) {
33
- const lineTitleStyle = (0, util_1.mergeSpec)({}, titleStyle, (0, style_1.getTextAttributes)(titleValueStyle, void 0, {})), {text: text, width: width, height: height} = (0,
34
- exports.measureTooltipText)(titleValue, lineTitleStyle);
35
- if (attribute.title.value = Object.assign(Object.assign({
36
- width: width,
37
- height: height
38
- }, lineTitleStyle), {
39
- text: text
40
- }), maxWidth = width, titleMaxHeight = height, titleHasShape && vrender_1.builtinSymbolsMap[titleShapeType]) {
41
- const titleShapeAttrs = {
42
- symbolType: titleShapeType
74
+ valueWidth: 0,
75
+ enterable: enterable,
76
+ transitionDuration: transitionDuration
77
+ }, {title: title = {}, content: content = []} = actualTooltip;
78
+ let containerWidth = paddingSpec.left + paddingSpec.right, containerHeight = paddingSpec.top + paddingSpec.bottom, contentMaxWidth = 0;
79
+ const filteredContent = content.filter((item => (item.key || item.value) && !1 !== item.visible)), hasContent = !!filteredContent.length;
80
+ let maxKeyWidth = 0, maxAdaptiveKeyWidth = 0, maxValueWidth = 0, maxShapeWidth = 0;
81
+ if (hasContent) {
82
+ const keyWidths = [], adaptiveKeyWidths = [], valueWidths = [], shapeWidths = [];
83
+ attributes.content = filteredContent.map(((item, i) => {
84
+ let itemHeight = 0;
85
+ const {hasShape: actualHasShape, key: actualKey, shapeType: actualShapeType = "", shapeFill: actualShapeFill, shapeStroke: actualShapeStroke, shapeLineWidth: actualShapeLineWidth, shapeSize: actualShapeSize, value: actualValue, isKeyAdaptive: actualIsKeyAdaptive, spaceRow: actualSpaceRow, keyStyle: actualKeyStyle, valueStyle: actualValueStyle, shapeColor: actualShapeColor, shapeHollow: actualShapeHollow} = item, itemAttrs = {
86
+ height: 0,
87
+ spaceRow: null != actualSpaceRow ? actualSpaceRow : commonSpaceRow
43
88
  };
44
- titleShapeHollow ? titleShapeAttrs.stroke = titleShapeColor : titleShapeAttrs.fill = titleShapeColor,
45
- attribute.title.shape = titleShapeAttrs, maxWidth += shapeStyle.size + shapeStyle.spacing,
46
- titleMaxHeight = Math.max(shapeStyle.size, titleMaxHeight);
47
- }
48
- attribute.title.width = maxWidth, attribute.title.height = titleMaxHeight, containerHeight += titleMaxHeight;
49
- }
50
- if (content.length) {
51
- const filteredContent = content.filter((item => (item.key || item.value) && !1 !== item.visible));
52
- if (filteredContent.length) {
53
- titleVisible && (containerHeight += attribute.title.spaceRow);
54
- const keyWidths = [], adaptiveKeyWidths = [], valueWidths = [], shapeWidths = [];
55
- attribute.content = filteredContent.map(((item, i) => {
56
- let itemHeight = 0;
57
- const {hasShape: hasShape, key: key, shapeColor: shapeColor, shapeHollow: shapeHollow, shapeType: shapeType = "", shapeFill: shapeFill, shapeStroke: shapeStroke, shapeLineWidth: shapeLineWidth, shapeSize: shapeSize, value: value, isKeyAdaptive: isKeyAdaptive, spaceRow: lineSpaceRow} = item, itemAttrs = {
58
- height: 0,
59
- spaceRow: null != lineSpaceRow ? lineSpaceRow : commonSpaceRow
60
- };
61
- if ((0, vutils_1.isValid)(key)) {
62
- const lineKeyStyle = (0, util_1.mergeSpec)({}, keyStyle, (0, style_1.getTextAttributes)(item.keyStyle, void 0, {})), {width: width, height: height, text: text} = (0,
63
- exports.measureTooltipText)(key, lineKeyStyle);
64
- itemAttrs.key = Object.assign(Object.assign({
65
- width: width,
66
- height: height
67
- }, lineKeyStyle), {
68
- text: text
69
- }), isKeyAdaptive ? adaptiveKeyWidths.push(width) : keyWidths.push(width), itemHeight = Math.max(itemHeight, height);
70
- }
71
- if ((0, vutils_1.isValid)(value)) {
72
- const lineValueStyle = (0, util_1.mergeSpec)({}, valueStyle, (0, style_1.getTextAttributes)(item.valueStyle, void 0, {})), {width: width, height: height, text: text} = (0,
73
- exports.measureTooltipText)(value, lineValueStyle);
74
- itemAttrs.value = Object.assign(Object.assign({
75
- width: width,
76
- height: height
77
- }, lineValueStyle), {
78
- text: text
79
- }), valueWidths.push(width), itemHeight = Math.max(itemHeight, height);
80
- }
81
- if (hasShape) {
82
- const shape = {
83
- visible: !0,
84
- symbolType: shapeType
85
- }, adaptiveShapeFill = null != shapeFill ? shapeFill : shapeColor;
86
- shapeHollow ? shape.stroke = adaptiveShapeFill : shape.fill = adaptiveShapeFill,
87
- shape.stroke = null != shapeStroke ? shapeStroke : adaptiveShapeFill, shape.lineWidth = shapeLineWidth,
88
- itemAttrs.shape = shape;
89
- const shapeWidth = null != shapeSize ? shapeSize : shapeStyle.size;
90
- itemHeight = Math.max(shapeWidth, itemHeight), shapeWidths.push(shapeWidth);
91
- } else itemAttrs.shape = {
92
- visible: !1
93
- };
94
- return itemAttrs.height = itemHeight, containerHeight += itemHeight, i < filteredContent.length - 1 && (containerHeight += itemAttrs.spaceRow),
95
- itemAttrs;
96
- }));
97
- const maxKeyWidth = keyWidths.length ? Math.max(...keyWidths) : 0, maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? Math.max(...adaptiveKeyWidths) : 0, maxValueWidth = valueWidths.length ? Math.max(...valueWidths) : 0, shapeWidth = shapeWidths.length ? Math.max(...shapeWidths) + shapeStyle.spacing : 0;
98
- maxWidth = Math.max(maxKeyWidth + maxValueWidth + keyStyle.spacing + valueStyle.spacing + shapeWidth, maxAdaptiveKeyWidth + shapeWidth, maxWidth),
99
- attribute.hasContentShape = !!shapeWidths.length, attribute.keyWidth = maxKeyWidth,
100
- attribute.valueWidth = maxValueWidth;
101
- }
89
+ if ((0, vutils_1.isValid)(actualKey)) {
90
+ const itemKeyStyle = (0, util_1.mergeSpec)({}, keyStyle, getTextAttributes(actualKeyStyle, void 0, {})), {width: width, height: height, text: text} = (0,
91
+ common_1.measureTooltipText)(actualKey, itemKeyStyle);
92
+ itemAttrs.key = Object.assign(Object.assign({
93
+ width: width,
94
+ height: height
95
+ }, itemKeyStyle), {
96
+ text: text
97
+ }), actualIsKeyAdaptive ? adaptiveKeyWidths.push(width) : keyWidths.push(width),
98
+ itemHeight = Math.max(itemHeight, height);
99
+ }
100
+ if ((0, vutils_1.isValid)(actualValue)) {
101
+ const itemValueStyle = (0, util_1.mergeSpec)({}, valueStyle, getTextAttributes(actualValueStyle, void 0, {})), {width: width, height: height, text: text} = (0,
102
+ common_1.measureTooltipText)(actualValue, itemValueStyle);
103
+ itemAttrs.value = Object.assign(Object.assign({
104
+ width: width,
105
+ height: height
106
+ }, itemValueStyle), {
107
+ text: text
108
+ }), valueWidths.push(width), itemHeight = Math.max(itemHeight, height);
109
+ }
110
+ if (actualHasShape) {
111
+ const shape = {
112
+ visible: !0,
113
+ symbolType: actualShapeType
114
+ }, adaptiveShapeFill = null != actualShapeFill ? actualShapeFill : actualShapeColor;
115
+ actualShapeHollow ? shape.stroke = adaptiveShapeFill : shape.fill = adaptiveShapeFill,
116
+ shape.stroke = null != actualShapeStroke ? actualShapeStroke : adaptiveShapeFill,
117
+ shape.lineWidth = actualShapeLineWidth, itemAttrs.shape = shape;
118
+ const shapeWidth = null != actualShapeSize ? actualShapeSize : shapeStyle.size;
119
+ itemHeight = Math.max(shapeWidth, itemHeight), shapeWidths.push(shapeWidth);
120
+ } else itemAttrs.shape = {
121
+ visible: !1
122
+ };
123
+ return itemAttrs.height = itemHeight, containerHeight += itemHeight, i < filteredContent.length - 1 && (containerHeight += itemAttrs.spaceRow),
124
+ itemAttrs;
125
+ })), maxKeyWidth = keyWidths.length ? Math.max(...keyWidths) : 0, maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? Math.max(...adaptiveKeyWidths) : 0,
126
+ maxValueWidth = valueWidths.length ? Math.max(...valueWidths) : 0, maxShapeWidth = shapeWidths.length ? Math.max(...shapeWidths) + shapeStyle.spacing : 0,
127
+ contentMaxWidth = Math.max(maxShapeWidth + maxKeyWidth + keyStyle.spacing + maxValueWidth + valueStyle.spacing, maxShapeWidth + maxAdaptiveKeyWidth, contentMaxWidth),
128
+ attributes.hasContentShape = !!shapeWidths.length, attributes.keyWidth = maxKeyWidth,
129
+ attributes.valueWidth = maxValueWidth;
102
130
  }
103
- const containerSize = {
104
- width: maxWidth + padding.left + padding.right,
105
- height: containerHeight
106
- };
107
- return attribute.panel.width = containerSize.width, attribute.panel.height = containerSize.height,
108
- attribute;
109
- };
110
-
111
- exports.getTooltipAttributes = getTooltipAttributes;
112
-
113
- const measureTooltipText = (text, style) => {
114
- var _a;
115
- text = (null != text ? text : "").toString();
116
- const measure = (0, util_1.initTextMeasure)(style);
117
- if (!style.multiLine) {
118
- const {width: width, height: height} = measure.fullMeasure(text);
119
- return {
120
- width: width,
121
- height: height,
131
+ let titleMaxWidth = 0, titleMaxHeight = 0;
132
+ const {visible: actualTitleVisible = !0, value: actualTitleValue = "", valueStyle: actualTitleValueStyle, spaceRow: actualTitleSpaceRow} = title;
133
+ attributes.title.visible = actualTitleVisible, attributes.title.spaceRow = null != actualTitleSpaceRow ? actualTitleSpaceRow : commonSpaceRow;
134
+ let titleValueStyle = {};
135
+ const isAutoWidthMode = () => titleValueStyle.autoWidth && !1 !== titleValueStyle.multiLine;
136
+ if (actualTitleVisible) {
137
+ titleValueStyle = (0, util_1.mergeSpec)({}, titleStyle, getTextAttributes(actualTitleValueStyle, void 0, {})),
138
+ isAutoWidthMode() && (titleValueStyle.multiLine = null === (_c = titleValueStyle.multiLine) || void 0 === _c || _c,
139
+ titleValueStyle.maxWidth = null !== (_d = titleValueStyle.maxWidth) && void 0 !== _d ? _d : hasContent ? Math.ceil(contentMaxWidth) : void 0);
140
+ const {text: text, width: width, height: height} = (0, common_1.measureTooltipText)(actualTitleValue, titleValueStyle);
141
+ attributes.title.value = Object.assign(Object.assign({
142
+ width: isAutoWidthMode() ? Math.min(width, null !== (_e = titleValueStyle.maxWidth) && void 0 !== _e ? _e : Number.MAX_VALUE) : width,
143
+ height: height
144
+ }, titleValueStyle), {
122
145
  text: text
123
- };
146
+ }), titleMaxWidth = attributes.title.value.width, titleMaxHeight = attributes.title.value.height,
147
+ containerHeight += titleMaxHeight + (hasContent ? attributes.title.spaceRow : 0);
124
148
  }
125
- let textLines = text.split("\n");
126
- textLines = textLines.map(((line, i) => i < textLines.length - 1 ? line + "\n" : line));
127
- const {width: width, height: height} = measure.fullMeasure(textLines);
128
- if (style.maxWidth && style.maxWidth <= width) {
129
- const bound = (0, vrender_1.getRichTextBounds)({
130
- wordBreak: null !== (_a = style.wordBreak) && void 0 !== _a ? _a : "break-word",
131
- maxWidth: style.maxWidth,
132
- width: 0,
133
- height: 0,
134
- textConfig: textLines.map(((line, i) => Object.assign(Object.assign({}, style), {
135
- text: line
136
- })))
137
- });
138
- return {
139
- width: bound.width(),
140
- height: bound.height(),
141
- text: textLines
142
- };
143
- }
144
- return {
145
- width: width,
146
- height: height,
147
- text: textLines
148
- };
149
+ return attributes.title.width = titleMaxWidth, attributes.title.height = titleMaxHeight,
150
+ isAutoWidthMode() ? containerWidth += contentMaxWidth || titleMaxWidth : containerWidth += Math.max(titleMaxWidth, contentMaxWidth),
151
+ hasContent && attributes.content.forEach((item => {
152
+ var _a;
153
+ const value = item.value;
154
+ value && (null === (_a = value.autoWidth) || void 0 === _a || _a) && (value.width = containerWidth - paddingSpec.left - paddingSpec.right - maxShapeWidth - maxKeyWidth - keyStyle.spacing - valueStyle.spacing,
155
+ value.multiLine = !0, value.maxWidth || (value.maxWidth = Math.ceil(value.width)),
156
+ attributes.valueWidth = Math.max(attributes.valueWidth, value.width));
157
+ })), attributes.panel.width = containerWidth, attributes.panel.height = containerHeight,
158
+ attributes;
149
159
  };
150
160
 
151
- exports.measureTooltipText = measureTooltipText;
161
+ exports.getTooltipAttributes = getTooltipAttributes;
152
162
  //# sourceMappingURL=attribute.js.map