@visactor/vchart 1.0.0-alpha.0 → 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +1 -1
  2. package/build/index.js +1053 -1006
  3. package/build/index.min.js +2 -2
  4. package/cjs/component/axis/cartesian/axis.js +3 -3
  5. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  6. package/cjs/component/tooltip/handler/base.d.ts +5 -4
  7. package/cjs/component/tooltip/handler/base.js +44 -34
  8. package/cjs/component/tooltip/handler/base.js.map +1 -1
  9. package/cjs/component/tooltip/handler/canvas/canvas-tooltip-handler.d.ts +2 -2
  10. package/cjs/component/tooltip/handler/canvas/canvas-tooltip-handler.js +2 -2
  11. package/cjs/component/tooltip/handler/canvas/canvas-tooltip-handler.js.map +1 -1
  12. package/cjs/component/tooltip/handler/dom/constants.d.ts +2 -0
  13. package/cjs/component/tooltip/handler/dom/constants.js +7 -0
  14. package/cjs/component/tooltip/handler/dom/constants.js.map +1 -0
  15. package/cjs/component/tooltip/handler/dom/dom-tooltip-handler.d.ts +9 -3
  16. package/cjs/component/tooltip/handler/dom/dom-tooltip-handler.js +30 -13
  17. package/cjs/component/tooltip/handler/dom/dom-tooltip-handler.js.map +1 -1
  18. package/cjs/component/tooltip/handler/dom/interface.d.ts +16 -5
  19. package/cjs/component/tooltip/handler/dom/interface.js.map +1 -1
  20. package/cjs/component/tooltip/handler/dom/model/base-tooltip-model.d.ts +7 -13
  21. package/cjs/component/tooltip/handler/dom/model/base-tooltip-model.js +12 -27
  22. package/cjs/component/tooltip/handler/dom/model/base-tooltip-model.js.map +1 -1
  23. package/cjs/component/tooltip/handler/dom/model/content-column-model.d.ts +13 -3
  24. package/cjs/component/tooltip/handler/dom/model/content-column-model.js +42 -26
  25. package/cjs/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
  26. package/cjs/component/tooltip/handler/dom/model/content-model.d.ts +4 -3
  27. package/cjs/component/tooltip/handler/dom/model/content-model.js +4 -4
  28. package/cjs/component/tooltip/handler/dom/model/content-model.js.map +1 -1
  29. package/cjs/component/tooltip/handler/dom/model/interface.d.ts +5 -0
  30. package/cjs/component/tooltip/handler/dom/model/interface.js.map +1 -1
  31. package/cjs/component/tooltip/handler/dom/model/shape-model.d.ts +5 -5
  32. package/cjs/component/tooltip/handler/dom/model/shape-model.js +4 -4
  33. package/cjs/component/tooltip/handler/dom/model/shape-model.js.map +1 -1
  34. package/cjs/component/tooltip/handler/dom/model/style-constants.d.ts +4 -4
  35. package/cjs/component/tooltip/handler/dom/model/style-constants.js +16 -15
  36. package/cjs/component/tooltip/handler/dom/model/style-constants.js.map +1 -1
  37. package/cjs/component/tooltip/handler/dom/model/text-model.js +1 -0
  38. package/cjs/component/tooltip/handler/dom/model/text-model.js.map +1 -1
  39. package/cjs/component/tooltip/handler/dom/model/title-model.d.ts +3 -2
  40. package/cjs/component/tooltip/handler/dom/model/title-model.js +15 -19
  41. package/cjs/component/tooltip/handler/dom/model/title-model.js.map +1 -1
  42. package/cjs/component/tooltip/handler/dom/model/tooltip-model.d.ts +1 -2
  43. package/cjs/component/tooltip/handler/dom/model/tooltip-model.js +20 -16
  44. package/cjs/component/tooltip/handler/dom/model/tooltip-model.js.map +1 -1
  45. package/cjs/component/tooltip/handler/dom/util.d.ts +5 -0
  46. package/cjs/component/tooltip/handler/dom/{utils/style.js → util.js} +31 -19
  47. package/cjs/component/tooltip/handler/dom/util.js.map +1 -0
  48. package/cjs/component/tooltip/handler/interface/index.d.ts +0 -1
  49. package/cjs/component/tooltip/handler/interface/index.js +1 -1
  50. package/cjs/component/tooltip/handler/interface/index.js.map +1 -1
  51. package/cjs/component/tooltip/handler/utils/attribute.js +10 -7
  52. package/cjs/component/tooltip/handler/utils/attribute.js.map +1 -1
  53. package/cjs/component/tooltip/handler/utils/common.d.ts +6 -2
  54. package/cjs/component/tooltip/handler/utils/common.js +19 -5
  55. package/cjs/component/tooltip/handler/utils/common.js.map +1 -1
  56. package/cjs/component/tooltip/handler/utils/compose.d.ts +3 -2
  57. package/cjs/component/tooltip/handler/utils/compose.js +27 -37
  58. package/cjs/component/tooltip/handler/utils/compose.js.map +1 -1
  59. package/cjs/component/tooltip/handler/utils/get-spec.js +26 -20
  60. package/cjs/component/tooltip/handler/utils/get-spec.js.map +1 -1
  61. package/cjs/component/tooltip/handler/utils/style.d.ts +2 -1
  62. package/cjs/component/tooltip/handler/utils/style.js +4 -4
  63. package/cjs/component/tooltip/handler/utils/style.js.map +1 -1
  64. package/cjs/component/tooltip/tooltip.d.ts +3 -1
  65. package/cjs/component/tooltip/tooltip.js +33 -18
  66. package/cjs/component/tooltip/tooltip.js.map +1 -1
  67. package/cjs/constant/box-plot.js +2 -1
  68. package/cjs/constant/scroll-bar.js +1 -2
  69. package/cjs/core/instance-manager.d.ts +1 -1
  70. package/cjs/core/instance-manager.js.map +1 -1
  71. package/cjs/core/vchart.d.ts +1 -0
  72. package/cjs/core/vchart.js +6 -0
  73. package/cjs/core/vchart.js.map +1 -1
  74. package/cjs/index.d.ts +1 -1
  75. package/cjs/index.js +1 -1
  76. package/cjs/index.js.map +1 -1
  77. package/cjs/layout/layout3d/index.js +2 -2
  78. package/cjs/layout/layout3d/index.js.map +1 -1
  79. package/cjs/mark/area.js +2 -1
  80. package/cjs/mark/cell.js +1 -1
  81. package/cjs/mark/component.js +1 -1
  82. package/cjs/mark/group.js +1 -1
  83. package/cjs/mark/line.js +1 -1
  84. package/cjs/mark/linkPath.js +1 -1
  85. package/cjs/mark/path.js +1 -1
  86. package/cjs/model/base-model.js +1 -1
  87. package/cjs/model/interface.js +1 -1
  88. package/cjs/model/layout-item.js +1 -1
  89. package/cjs/model/model-state-manager.js +1 -2
  90. package/cjs/model/tooltip-helper.js +1 -1
  91. package/cjs/plugin/interface.js +1 -1
  92. package/cjs/series/base/tooltip-helper.d.ts +8 -7
  93. package/cjs/series/base/tooltip-helper.js +4 -4
  94. package/cjs/series/base/tooltip-helper.js.map +1 -1
  95. package/cjs/series/dot/tooltip-helper.js +2 -2
  96. package/cjs/series/dot/tooltip-helper.js.map +1 -1
  97. package/cjs/series/funnel/tooltip-helper.d.ts +5 -3
  98. package/cjs/series/funnel/tooltip-helper.js +8 -7
  99. package/cjs/series/funnel/tooltip-helper.js.map +1 -1
  100. package/cjs/series/interface/tooltip-helper.d.ts +6 -6
  101. package/cjs/series/interface/tooltip-helper.js.map +1 -1
  102. package/cjs/theme/buildin-theme/light/component/tooltip.js +1 -0
  103. package/cjs/theme/buildin-theme/light/component/tooltip.js.map +1 -1
  104. package/cjs/typings/tooltip/common.d.ts +7 -1
  105. package/cjs/typings/tooltip/common.js.map +1 -1
  106. package/cjs/typings/tooltip/handler.d.ts +1 -1
  107. package/cjs/typings/tooltip/handler.js.map +1 -1
  108. package/cjs/typings/tooltip/line.d.ts +6 -4
  109. package/cjs/typings/tooltip/line.js.map +1 -1
  110. package/cjs/typings/tooltip/shape.d.ts +3 -3
  111. package/cjs/typings/tooltip/shape.js.map +1 -1
  112. package/cjs/typings/tooltip/tooltip.d.ts +9 -8
  113. package/cjs/typings/tooltip/tooltip.js.map +1 -1
  114. package/esm/component/axis/cartesian/axis.js +3 -3
  115. package/esm/component/axis/cartesian/axis.js.map +1 -1
  116. package/esm/component/tooltip/handler/base.d.ts +5 -4
  117. package/esm/component/tooltip/handler/base.js +45 -35
  118. package/esm/component/tooltip/handler/base.js.map +1 -1
  119. package/esm/component/tooltip/handler/canvas/canvas-tooltip-handler.d.ts +2 -2
  120. package/esm/component/tooltip/handler/canvas/canvas-tooltip-handler.js +2 -3
  121. package/esm/component/tooltip/handler/canvas/canvas-tooltip-handler.js.map +1 -1
  122. package/esm/component/tooltip/handler/dom/constants.d.ts +2 -0
  123. package/esm/component/tooltip/handler/dom/constants.js +4 -0
  124. package/esm/component/tooltip/handler/dom/constants.js.map +1 -0
  125. package/esm/component/tooltip/handler/dom/dom-tooltip-handler.d.ts +9 -3
  126. package/esm/component/tooltip/handler/dom/dom-tooltip-handler.js +32 -12
  127. package/esm/component/tooltip/handler/dom/dom-tooltip-handler.js.map +1 -1
  128. package/esm/component/tooltip/handler/dom/interface.d.ts +16 -5
  129. package/esm/component/tooltip/handler/dom/interface.js.map +1 -1
  130. package/esm/component/tooltip/handler/dom/model/base-tooltip-model.d.ts +7 -13
  131. package/esm/component/tooltip/handler/dom/model/base-tooltip-model.js +11 -29
  132. package/esm/component/tooltip/handler/dom/model/base-tooltip-model.js.map +1 -1
  133. package/esm/component/tooltip/handler/dom/model/content-column-model.d.ts +13 -3
  134. package/esm/component/tooltip/handler/dom/model/content-column-model.js +42 -24
  135. package/esm/component/tooltip/handler/dom/model/content-column-model.js.map +1 -1
  136. package/esm/component/tooltip/handler/dom/model/content-model.d.ts +4 -3
  137. package/esm/component/tooltip/handler/dom/model/content-model.js +5 -5
  138. package/esm/component/tooltip/handler/dom/model/content-model.js.map +1 -1
  139. package/esm/component/tooltip/handler/dom/model/interface.d.ts +5 -0
  140. package/esm/component/tooltip/handler/dom/model/interface.js.map +1 -1
  141. package/esm/component/tooltip/handler/dom/model/shape-model.d.ts +5 -5
  142. package/esm/component/tooltip/handler/dom/model/shape-model.js +4 -4
  143. package/esm/component/tooltip/handler/dom/model/shape-model.js.map +1 -1
  144. package/esm/component/tooltip/handler/dom/model/style-constants.d.ts +4 -4
  145. package/esm/component/tooltip/handler/dom/model/style-constants.js +19 -18
  146. package/esm/component/tooltip/handler/dom/model/style-constants.js.map +1 -1
  147. package/esm/component/tooltip/handler/dom/model/text-model.js +1 -0
  148. package/esm/component/tooltip/handler/dom/model/text-model.js.map +1 -1
  149. package/esm/component/tooltip/handler/dom/model/title-model.d.ts +3 -2
  150. package/esm/component/tooltip/handler/dom/model/title-model.js +15 -19
  151. package/esm/component/tooltip/handler/dom/model/title-model.js.map +1 -1
  152. package/esm/component/tooltip/handler/dom/model/tooltip-model.d.ts +1 -2
  153. package/esm/component/tooltip/handler/dom/model/tooltip-model.js +21 -16
  154. package/esm/component/tooltip/handler/dom/model/tooltip-model.js.map +1 -1
  155. package/esm/component/tooltip/handler/dom/util.d.ts +5 -0
  156. package/esm/component/tooltip/handler/dom/util.js +71 -0
  157. package/esm/component/tooltip/handler/dom/util.js.map +1 -0
  158. package/esm/component/tooltip/handler/interface/index.d.ts +0 -1
  159. package/esm/component/tooltip/handler/interface/index.js +0 -2
  160. package/esm/component/tooltip/handler/interface/index.js.map +1 -1
  161. package/esm/component/tooltip/handler/utils/attribute.js +9 -6
  162. package/esm/component/tooltip/handler/utils/attribute.js.map +1 -1
  163. package/esm/component/tooltip/handler/utils/common.d.ts +6 -2
  164. package/esm/component/tooltip/handler/utils/common.js +12 -1
  165. package/esm/component/tooltip/handler/utils/common.js.map +1 -1
  166. package/esm/component/tooltip/handler/utils/compose.d.ts +3 -2
  167. package/esm/component/tooltip/handler/utils/compose.js +22 -35
  168. package/esm/component/tooltip/handler/utils/compose.js.map +1 -1
  169. package/esm/component/tooltip/handler/utils/get-spec.js +25 -19
  170. package/esm/component/tooltip/handler/utils/get-spec.js.map +1 -1
  171. package/esm/component/tooltip/handler/utils/style.d.ts +2 -1
  172. package/esm/component/tooltip/handler/utils/style.js +4 -4
  173. package/esm/component/tooltip/handler/utils/style.js.map +1 -1
  174. package/esm/component/tooltip/tooltip.d.ts +3 -1
  175. package/esm/component/tooltip/tooltip.js +33 -18
  176. package/esm/component/tooltip/tooltip.js.map +1 -1
  177. package/esm/constant/box-plot.js +2 -1
  178. package/esm/constant/scroll-bar.js +1 -2
  179. package/esm/core/instance-manager.d.ts +1 -1
  180. package/esm/core/instance-manager.js.map +1 -1
  181. package/esm/core/vchart.d.ts +1 -0
  182. package/esm/core/vchart.js +6 -0
  183. package/esm/core/vchart.js.map +1 -1
  184. package/esm/index.d.ts +1 -1
  185. package/esm/index.js +1 -1
  186. package/esm/index.js.map +1 -1
  187. package/esm/layout/layout3d/index.js +2 -2
  188. package/esm/layout/layout3d/index.js.map +1 -1
  189. package/esm/mark/area.js +2 -1
  190. package/esm/mark/cell.js +1 -1
  191. package/esm/mark/component.js +1 -1
  192. package/esm/mark/group.js +1 -1
  193. package/esm/mark/line.js +1 -1
  194. package/esm/mark/linkPath.js +1 -1
  195. package/esm/mark/path.js +1 -1
  196. package/esm/model/base-model.js +1 -1
  197. package/esm/model/interface.js +1 -1
  198. package/esm/model/layout-item.js +1 -1
  199. package/esm/model/model-state-manager.js +1 -2
  200. package/esm/model/tooltip-helper.js +1 -1
  201. package/esm/plugin/interface.js +1 -1
  202. package/esm/series/base/tooltip-helper.d.ts +8 -7
  203. package/esm/series/base/tooltip-helper.js +4 -4
  204. package/esm/series/base/tooltip-helper.js.map +1 -1
  205. package/esm/series/dot/tooltip-helper.js +2 -2
  206. package/esm/series/dot/tooltip-helper.js.map +1 -1
  207. package/esm/series/funnel/tooltip-helper.d.ts +5 -3
  208. package/esm/series/funnel/tooltip-helper.js +8 -5
  209. package/esm/series/funnel/tooltip-helper.js.map +1 -1
  210. package/esm/series/interface/tooltip-helper.d.ts +6 -6
  211. package/esm/series/interface/tooltip-helper.js.map +1 -1
  212. package/esm/theme/buildin-theme/light/component/tooltip.js +1 -0
  213. package/esm/theme/buildin-theme/light/component/tooltip.js.map +1 -1
  214. package/esm/typings/tooltip/common.d.ts +7 -1
  215. package/esm/typings/tooltip/common.js.map +1 -1
  216. package/esm/typings/tooltip/handler.d.ts +1 -1
  217. package/esm/typings/tooltip/handler.js.map +1 -1
  218. package/esm/typings/tooltip/line.d.ts +6 -4
  219. package/esm/typings/tooltip/line.js.map +1 -1
  220. package/esm/typings/tooltip/shape.d.ts +3 -3
  221. package/esm/typings/tooltip/shape.js.map +1 -1
  222. package/esm/typings/tooltip/tooltip.d.ts +9 -8
  223. package/esm/typings/tooltip/tooltip.js.map +1 -1
  224. package/package.json +3 -3
  225. package/README.zh-CN.md +0 -1
  226. package/cjs/component/tooltip/handler/dom/utils/style.d.ts +0 -3
  227. package/cjs/component/tooltip/handler/dom/utils/style.js.map +0 -1
  228. package/cjs/component/tooltip/handler/interface/cache.d.ts +0 -28
  229. package/cjs/component/tooltip/handler/interface/cache.js +0 -6
  230. package/cjs/component/tooltip/handler/interface/cache.js.map +0 -1
  231. package/esm/component/tooltip/handler/dom/utils/style.d.ts +0 -3
  232. package/esm/component/tooltip/handler/dom/utils/style.js +0 -59
  233. package/esm/component/tooltip/handler/dom/utils/style.js.map +0 -1
  234. package/esm/component/tooltip/handler/interface/cache.d.ts +0 -28
  235. package/esm/component/tooltip/handler/interface/cache.js +0 -2
  236. package/esm/component/tooltip/handler/interface/cache.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/dom/model/shape-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAUxD,MAAM,OAAO,UAAW,SAAQ,gBAAgB;IAK9C,IAAI,CAAC,SAAoB,EAAE,EAAW,EAAE,GAAiC;QACvE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,KAAK,EAAE,CAAC,GAAG,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YACnG,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;SAC1B;IACH,CAAC;IAED,QAAQ,CAAC,KAAoC,EAAE,MAAwB;QACrE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAED,UAAU,CAAC,MAAuB;QAChC,IAAI,CAAC,MAAM,CAAC,MAAM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tB,CAAC,MAAE,KAAwB,CAAC,KAAe,mCAAI,EAAE,CAAC,CAAC,GAAG,CACtD,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,MAAM,iBAAiB,CAAC,CAAC,KAAK,KAAK,CAC5D;;OAEF,CAAC;SACH;aAAM,IAAK,KAAwB,CAAC,QAAQ,KAAK,QAAQ,EAAE;YAC1D,QAAQ,GAAG;4BACW,IAAI,SAAS,CAAC,MAAE,KAAyB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GAAG,UACvF,CAAC,MAAE,KAAyB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GACrD,UAAU,CAAC,MAAE,KAAyB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GAAG,UAC9D,CAAC,MAAE,KAAyB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GACrD;UACI,CAAC,MAAC,KAAyB,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,MAAM,iBAAiB,CAAC,CAAC,KAAK,KAAK,CAAC;;OAE5G,CAAC;SACH;QACD,OAAO;kBACO,IAAI,aAAa,IAAI;;QAE/B,QAAQ;yBACS,IAAI,SAAS,IAAI,uBAAuB,IAAI;;WAE1D,CAAC;KACT;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","file":"shape-model.js","sourcesContent":["import type { IGradientColor, ILinearGradient } from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { builtinSymbolsMap } from '@visactor/vrender';\n\nimport { isObject, isString } from '../../../../../util';\nimport type { ShapeType } from '../../../../../typings';\nimport { BaseTooltipModel } from './base-tooltip-model';\n\nexport interface IShapeSvgOption {\n hasShape: boolean;\n shapeType: ShapeType;\n size: string;\n color: string | IGradientColor;\n hollow?: boolean;\n}\n\nexport class ShapeModel extends BaseTooltipModel {\n svg: SVGElement;\n\n private _svgHtmlCache: string;\n\n init(classList?: string[], id?: string, tag?: keyof HTMLElementTagNameMap): void {\n if (!this.product) {\n const container = this.createElement(tag ?? 'div', [...(classList ?? []), 'shape'], undefined, id);\n this.product = container;\n }\n }\n\n setStyle(style?: Partial<CSSStyleDeclaration>, option?: IShapeSvgOption): void {\n super.setStyle(style);\n this.setSvg(option);\n }\n\n setContent(option: IShapeSvgOption) {\n this.setSvg(option);\n }\n\n setSvg(option: IShapeSvgOption) {\n const html = getSvgHtml(option);\n if (html !== this._svgHtmlCache) {\n this._svgHtmlCache = html;\n this.product.innerHTML = html;\n }\n }\n\n release(): void {\n super.release();\n this._svgHtmlCache = '';\n }\n}\n\nfunction getSvgHtml(option: IShapeSvgOption) {\n if (!option?.hasShape || !builtinSymbolsMap[option.shapeType]) {\n return '';\n }\n\n const { shapeType, size, color, hollow = false } = option;\n\n // FIXME 通过 VRender 获取symbol path\n const path = builtinSymbolsMap[shapeType].pathStr;\n let fill: string = 'currentColor';\n if (!color || isString(color) || hollow) {\n fill = hollow ? 'none' : (color as string) ?? 'currentColor';\n return `\n <svg width=\"${size}\"\n height=\"${size}\" viewBox=\"-0.8 -0.8 1.5 1.5\" style=\"display: inline-block; vertical-align: middle;\">\n <path fill=\"${fill}\" d=\"${path}\" style=\"fill: ${fill};\">\n </path>\n </svg>`;\n }\n if (isObject(color)) {\n fill = 'gradientColor';\n let gradient = '';\n if ((color as IGradientColor).gradient === 'radial') {\n gradient = `\n <radialGradient id=\"${fill}\" cx=\"50%\" cy=\"50%\" r=\"50%\" fx=\"0%\" fy=\"0%\">\n ${(((color as IGradientColor).stops as any[]) ?? []).map(\n s => `<stop offset=\"${s.offset}\" stop-color=\"${s.color}\"/>`\n )}\n \t</radialGradient>\n `;\n } else if ((color as IGradientColor).gradient === 'linear') {\n gradient = `\n <linearGradient id=\"${fill}\" x1=\"${(((color as ILinearGradient).x0 as number) ?? 0) * 100}%\" y1=\"${\n (((color as ILinearGradient).y0 as number) ?? 0) * 100\n }%\" x2=\"${(((color as ILinearGradient).x1 as number) ?? 0) * 100}%\" y2=\"${\n (((color as ILinearGradient).y1 as number) ?? 0) * 100\n }%\">\n ${((color as ILinearGradient).stops ?? []).map(s => `<stop offset=\"${s.offset}\" stop-color=\"${s.color}\"/>`)}\n </linearGradient>\n `;\n }\n return `\n <svg width=\"${size}\" height=\"${size}\"\n viewBox=\"-0.8 -0.8 1.5 1.5\" style=\"display: inline-block; vertical-align: middle;\">\n ${gradient}\n <path fill=\"url(#${fill})\" d=\"${path}\" style=\"fill: url(#${fill});\">\n </path>\n </svg>`;\n }\n\n return '';\n}\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/dom/model/shape-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAUxD,MAAM,OAAO,UAAW,SAAQ,gBAAgB;IAK9C,IAAI,CAAC,SAAoB,EAAE,EAAW,EAAE,GAAiC;QACvE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,KAAK,EAAE,CAAC,GAAG,CAAC,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YACnG,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;SAC1B;IACH,CAAC;IAED,QAAQ,CAAC,KAAoC,EAAE,MAAwB;QACrE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAED,UAAU,CAAC,MAAuB;QAChC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACtB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E;YACnD,QAAQ,GAAG;4BACW,IAAI;UACtB,CAAC,MAAE,KAAwB,CAAC,KAAe,mCAAI,EAAE,CAAC,CAAC,GAAG,CACtD,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,MAAM,iBAAiB,CAAC,CAAC,KAAK,KAAK,CAC5D;;OAEF,CAAC;SACH;aAAM,IAAK,KAAwB,CAAC,QAAQ,KAAK,QAAQ,EAAE;YAC1D,QAAQ,GAAG;4BACW,IAAI,SAAS,CAAC,MAAE,KAAyB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GAAG,UACvF,CAAC,MAAE,KAAyB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GACrD,UAAU,CAAC,MAAE,KAAyB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GAAG,UAC9D,CAAC,MAAE,KAAyB,CAAC,EAAa,mCAAI,CAAC,CAAC,GAAG,GACrD;UACI,CAAC,MAAC,KAAyB,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,MAAM,iBAAiB,CAAC,CAAC,KAAK,KAAK,CAAC;;OAE5G,CAAC;SACH;QACD,OAAO;kBACO,IAAI,aAAa,IAAI;;QAE/B,QAAQ;yBACS,IAAI,SAAS,IAAI,uBAAuB,IAAI;;WAE1D,CAAC;KACT;IAED,OAAO,EAAE,CAAC;AACZ,CAAC","file":"shape-model.js","sourcesContent":["import type { IGradientColor, ILinearGradient } from '@visactor/vrender';\n// eslint-disable-next-line no-duplicate-imports\nimport { builtinSymbolsMap } from '@visactor/vrender';\n\nimport { isObject, isString } from '../../../../../util';\nimport type { ShapeType } from '../../../../../typings';\nimport { BaseTooltipModel } from './base-tooltip-model';\n\nexport interface IShapeSvgOption {\n hasShape?: boolean;\n shapeType?: ShapeType;\n size?: string;\n color?: string | IGradientColor;\n hollow?: boolean;\n}\n\nexport class ShapeModel extends BaseTooltipModel {\n svg: SVGElement;\n\n private _svgHtmlCache: string;\n\n init(classList?: string[], id?: string, tag?: keyof HTMLElementTagNameMap): void {\n if (!this.product) {\n const container = this.createElement(tag ?? 'div', [...(classList ?? []), 'shape'], undefined, id);\n this.product = container;\n }\n }\n\n setStyle(style?: Partial<CSSStyleDeclaration>, option?: IShapeSvgOption): void {\n super.setStyle(style);\n this.setSvg(option);\n }\n\n setContent(option: IShapeSvgOption) {\n this.setSvg(option);\n }\n\n setSvg(option?: IShapeSvgOption) {\n const html = getSvgHtml(option);\n if (this.product && html !== this._svgHtmlCache) {\n this._svgHtmlCache = html;\n this.product.innerHTML = html;\n }\n }\n\n release(): void {\n super.release();\n this._svgHtmlCache = '';\n }\n}\n\nfunction getSvgHtml(option?: IShapeSvgOption) {\n if (!option?.hasShape || !option.shapeType || !builtinSymbolsMap[option.shapeType]) {\n return '';\n }\n\n const { shapeType, size, color, hollow = false } = option;\n\n // FIXME 通过 VRender 获取symbol path\n const path = builtinSymbolsMap[shapeType].pathStr;\n let fill: string = 'currentColor';\n if (!color || isString(color) || hollow) {\n fill = hollow ? 'none' : (color as string) ?? 'currentColor';\n return `\n <svg width=\"${size}\"\n height=\"${size}\" viewBox=\"-0.5 -0.5 1 1\" style=\"display: inline-block; vertical-align: middle;\">\n <path fill=\"${fill}\" d=\"${path}\" style=\"fill: ${fill};\">\n </path>\n </svg>`;\n }\n if (isObject(color)) {\n fill = 'gradientColor';\n let gradient = '';\n if ((color as IGradientColor).gradient === 'radial') {\n gradient = `\n <radialGradient id=\"${fill}\" cx=\"50%\" cy=\"50%\" r=\"50%\" fx=\"0%\" fy=\"0%\">\n ${(((color as IGradientColor).stops as any[]) ?? []).map(\n s => `<stop offset=\"${s.offset}\" stop-color=\"${s.color}\"/>`\n )}\n \t</radialGradient>\n `;\n } else if ((color as IGradientColor).gradient === 'linear') {\n gradient = `\n <linearGradient id=\"${fill}\" x1=\"${(((color as ILinearGradient).x0 as number) ?? 0) * 100}%\" y1=\"${\n (((color as ILinearGradient).y0 as number) ?? 0) * 100\n }%\" x2=\"${(((color as ILinearGradient).x1 as number) ?? 0) * 100}%\" y2=\"${\n (((color as ILinearGradient).y1 as number) ?? 0) * 100\n }%\">\n ${((color as ILinearGradient).stops ?? []).map(s => `<stop offset=\"${s.offset}\" stop-color=\"${s.color}\"/>`)}\n </linearGradient>\n `;\n }\n return `\n <svg width=\"${size}\" height=\"${size}\"\n viewBox=\"-0.5 -0.5 1 1\" style=\"display: inline-block; vertical-align: middle;\">\n ${gradient}\n <path fill=\"url(#${fill})\" d=\"${path}\" style=\"fill: url(#${fill});\">\n </path>\n </svg>`;\n }\n\n return '';\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  export declare const defaultH2Style: Partial<CSSStyleDeclaration>;
2
- export declare const defaultContainerBoxStyle: Partial<CSSStyleDeclaration>;
3
- export declare const defaultShapeBoxStyle: Partial<CSSStyleDeclaration>;
4
- export declare const defaultKeyBoxStyle: Partial<CSSStyleDeclaration>;
5
- export declare const defaultValueBoxStyle: Partial<CSSStyleDeclaration>;
2
+ export declare const defaultContainerStyle: Partial<CSSStyleDeclaration>;
3
+ export declare const defaultContentContainerStyle: Partial<CSSStyleDeclaration>;
4
+ export declare const defaultContentColumnStyle: Partial<CSSStyleDeclaration>;
6
5
  export declare const defaultKeyStyle: Partial<CSSStyleDeclaration>;
6
+ export declare const defaultAdaptiveKeyStyle: Partial<CSSStyleDeclaration>;
7
7
  export declare const defaultValueStyle: Partial<CSSStyleDeclaration>;
@@ -1,45 +1,46 @@
1
1
  export const defaultH2Style = {
2
2
  fontSize: "13px",
3
- marginBottom: "0px"
3
+ marginBottom: "0px",
4
+ fontWeight: "normal"
4
5
  };
5
6
 
6
- export const defaultContainerBoxStyle = {
7
+ export const defaultContainerStyle = {
8
+ boxSizing: "border-box"
9
+ };
10
+
11
+ export const defaultContentContainerStyle = {
7
12
  display: "flex",
8
- maxWidth: "440px",
9
13
  whiteSpace: "nowrap"
10
14
  };
11
15
 
12
- export const defaultShapeBoxStyle = {
16
+ export const defaultContentColumnStyle = {
13
17
  display: "flex",
14
18
  flexDirection: "column",
15
19
  justifyContent: "space-around",
16
20
  fontSize: "0"
17
21
  };
18
22
 
19
- export const defaultKeyBoxStyle = {
20
- flex: "1",
21
- display: "flex",
22
- flexDirection: "column",
23
- overflow: "hidden"
24
- };
25
-
26
- export const defaultValueBoxStyle = {
27
- display: "flex",
28
- flexDirection: "column"
29
- };
30
-
31
23
  export const defaultKeyStyle = {
32
24
  paddingTop: "0px",
33
25
  paddingBottom: "0px",
34
26
  overflow: "hidden",
35
27
  textOverflow: "ellipsis",
36
- textAlign: "left"
28
+ textAlign: "left",
29
+ fontWeight: "normal"
30
+ };
31
+
32
+ export const defaultAdaptiveKeyStyle = {
33
+ paddingTop: "0px",
34
+ paddingBottom: "0px",
35
+ textAlign: "left",
36
+ fontWeight: "normal"
37
37
  };
38
38
 
39
39
  export const defaultValueStyle = {
40
40
  paddingTop: "0px",
41
41
  paddingBottom: "0px",
42
42
  overflow: "hidden",
43
- textAlign: "right"
43
+ textAlign: "right",
44
+ fontWeight: "normal"
44
45
  };
45
46
  //# sourceMappingURL=style-constants.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/dom/model/style-constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAiC;IAC1D,QAAQ,EAAE,MAAM;IAChB,YAAY,EAAE,KAAK;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAiC;IACpE,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAiC;IAChE,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,cAAc,EAAE,cAAc;IAC9B,QAAQ,EAAE,GAAG;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAiC;IAC9D,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAiC;IAChE,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAiC;IAC3D,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,QAAQ;IAClB,YAAY,EAAE,UAAU;IACxB,SAAS,EAAE,MAAM;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAiC;IAC7D,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,OAAO;CACnB,CAAC","file":"style-constants.js","sourcesContent":["export const defaultH2Style: Partial<CSSStyleDeclaration> = {\n fontSize: '13px',\n marginBottom: '0px'\n};\n\nexport const defaultContainerBoxStyle: Partial<CSSStyleDeclaration> = {\n display: 'flex',\n maxWidth: '440px',\n whiteSpace: 'nowrap'\n};\n\nexport const defaultShapeBoxStyle: Partial<CSSStyleDeclaration> = {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-around',\n fontSize: '0'\n};\n\nexport const defaultKeyBoxStyle: Partial<CSSStyleDeclaration> = {\n flex: '1',\n display: 'flex',\n flexDirection: 'column',\n overflow: 'hidden'\n};\n\nexport const defaultValueBoxStyle: Partial<CSSStyleDeclaration> = {\n display: 'flex',\n flexDirection: 'column'\n};\n\nexport const defaultKeyStyle: Partial<CSSStyleDeclaration> = {\n paddingTop: '0px',\n paddingBottom: '0px',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n textAlign: 'left'\n};\n\nexport const defaultValueStyle: Partial<CSSStyleDeclaration> = {\n paddingTop: '0px',\n paddingBottom: '0px',\n overflow: 'hidden',\n textAlign: 'right'\n};\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/dom/model/style-constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAiC;IAC1D,QAAQ,EAAE,MAAM;IAChB,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAiC;IACjE,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAiC;IACxE,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAiC;IACrE,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,cAAc,EAAE,cAAc;IAC9B,QAAQ,EAAE,GAAG;CACd,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAiC;IAC3D,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,QAAQ;IAClB,YAAY,EAAE,UAAU;IACxB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAiC;IACnE,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,QAAQ;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAiC;IAC7D,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IACpB,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,OAAO;IAClB,UAAU,EAAE,QAAQ;CACrB,CAAC","file":"style-constants.js","sourcesContent":["export const defaultH2Style: Partial<CSSStyleDeclaration> = {\n fontSize: '13px',\n marginBottom: '0px',\n fontWeight: 'normal'\n};\n\nexport const defaultContainerStyle: Partial<CSSStyleDeclaration> = {\n boxSizing: 'border-box'\n};\n\nexport const defaultContentContainerStyle: Partial<CSSStyleDeclaration> = {\n display: 'flex',\n whiteSpace: 'nowrap'\n};\n\nexport const defaultContentColumnStyle: Partial<CSSStyleDeclaration> = {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-around',\n fontSize: '0'\n};\n\nexport const defaultKeyStyle: Partial<CSSStyleDeclaration> = {\n paddingTop: '0px',\n paddingBottom: '0px',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n textAlign: 'left',\n fontWeight: 'normal'\n};\n\nexport const defaultAdaptiveKeyStyle: Partial<CSSStyleDeclaration> = {\n paddingTop: '0px',\n paddingBottom: '0px',\n textAlign: 'left',\n fontWeight: 'normal'\n};\n\nexport const defaultValueStyle: Partial<CSSStyleDeclaration> = {\n paddingTop: '0px',\n paddingBottom: '0px',\n overflow: 'hidden',\n textAlign: 'right',\n fontWeight: 'normal'\n};\n"]}
@@ -5,6 +5,7 @@ export class TextModel extends BaseTooltipModel {
5
5
  this.product || (this.product = this.createElement(null != tag ? tag : "span", classList, void 0, id));
6
6
  }
7
7
  setContent(content) {
8
+ if (!this.product) return;
8
9
  this._option.valueToHtml(content) !== this.product.innerHTML && (this.product.innerHTML = this._option.valueToHtml(content));
9
10
  }
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/dom/model/text-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IAC7C,IAAI,CAAC,SAAoB,EAAE,EAAW,EAAE,GAAiC;QACvE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;SAC5E;IACH,CAAC;IAED,UAAU,CAAC,OAAa;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACnC,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SAC5D;IACH,CAAC;CACF","file":"text-model.js","sourcesContent":["import { BaseTooltipModel } from './base-tooltip-model';\n\nexport class TextModel extends BaseTooltipModel {\n init(classList?: string[], id?: string, tag?: keyof HTMLElementTagNameMap): void {\n if (!this.product) {\n this.product = this.createElement(tag ?? 'span', classList, undefined, id);\n }\n }\n\n setContent(content?: any): void {\n const html = this._option.valueToHtml(content);\n if (html !== this.product.innerHTML) {\n this.product.innerHTML = this._option.valueToHtml(content);\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/dom/model/text-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IAC7C,IAAI,CAAC,SAAoB,EAAE,EAAW,EAAE,GAAiC;QACvE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;SAC5E;IACH,CAAC;IAED,UAAU,CAAC,OAAa;QACtB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,OAAO;SACR;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,IAAI,KAAK,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;YACnC,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;SAC5D;IACH,CAAC;CACF","file":"text-model.js","sourcesContent":["import { BaseTooltipModel } from './base-tooltip-model';\n\nexport class TextModel extends BaseTooltipModel {\n init(classList?: string[], id?: string, tag?: keyof HTMLElementTagNameMap): void {\n if (!this.product) {\n this.product = this.createElement(tag ?? 'span', classList, undefined, id);\n }\n }\n\n setContent(content?: any): void {\n if (!this.product) {\n return;\n }\n const html = this._option.valueToHtml(content);\n if (html !== this.product.innerHTML) {\n this.product.innerHTML = this._option.valueToHtml(content);\n }\n }\n}\n"]}
@@ -1,9 +1,10 @@
1
+ import type { Maybe } from '@visactor/vutils';
1
2
  import { BaseTooltipModel } from './base-tooltip-model';
2
3
  import { ShapeModel } from './shape-model';
3
4
  import { TextModel } from './text-model';
4
5
  export declare class TitleModel extends BaseTooltipModel {
5
- shape: ShapeModel | null;
6
- textSpan: TextModel;
6
+ shape: Maybe<ShapeModel>;
7
+ textSpan: Maybe<TextModel>;
7
8
  init(): void;
8
9
  private _initShape;
9
10
  private _releaseShape;
@@ -9,52 +9,48 @@ import { ShapeModel } from "./shape-model";
9
9
  import { TextModel } from "./text-model";
10
10
 
11
11
  export class TitleModel extends BaseTooltipModel {
12
- constructor() {
13
- super(...arguments), this.shape = null;
14
- }
15
12
  init() {
16
- if (!this._tooltipActual) return;
13
+ const tooltipActual = this._option.getTooltipActual();
17
14
  this.product || (this.product = this.createElement("h2"));
18
- const {title: title} = this._tooltipActual;
15
+ const {title: title} = tooltipActual;
19
16
  (null == title ? void 0 : title.hasShape) && (null == title ? void 0 : title.shapeType) ? this.shape || this._initShape() : this.shape && this._releaseShape(),
20
17
  this.textSpan || this._initTextSpan();
21
18
  }
22
19
  _initShape() {
23
- const shape = new ShapeModel(this.product, this._option, 0, this._tooltipStyle, this._tooltipActual);
20
+ const shape = new ShapeModel(this.product, this._option, 0);
24
21
  shape.init(), this.shape = shape, this.children[shape.childIndex] = shape;
25
22
  }
26
23
  _releaseShape() {
27
- this.shape.release(), delete this.children[this.shape.childIndex], this.shape = null;
24
+ this.shape && (this.shape.release(), delete this.children[this.shape.childIndex],
25
+ this.shape = null);
28
26
  }
29
27
  _initTextSpan() {
30
- const textSpan = new TextModel(this.product, this._option, 1, this._tooltipStyle, this._tooltipActual);
28
+ const textSpan = new TextModel(this.product, this._option, 1);
31
29
  textSpan.init(), this.textSpan = textSpan, this.children[textSpan.childIndex] = textSpan;
32
30
  }
33
31
  setStyle(style) {
34
- var _a;
35
- if (!this._tooltipActual || !this._tooltipStyle) return;
36
- const {title: title} = this._tooltipActual;
37
- super.setStyle(merge({}, defaultH2Style, this._tooltipStyle.title, style)), null === (_a = this.shape) || void 0 === _a || _a.setStyle({
38
- paddingRight: this._tooltipStyle.content.shape.marginRight
32
+ var _a, _b, _c;
33
+ const tooltipStyle = this._option.getTooltipStyle(), tooltipActual = this._option.getTooltipActual(), {title: title} = tooltipActual;
34
+ super.setStyle(merge({}, defaultH2Style, tooltipStyle.title, style)), null === (_a = this.shape) || void 0 === _a || _a.setStyle({
35
+ paddingRight: null === (_b = tooltipStyle.shapeColumn.item) || void 0 === _b ? void 0 : _b.marginRight
39
36
  }, {
40
37
  hasShape: null == title ? void 0 : title.hasShape,
41
38
  shapeType: null == title ? void 0 : title.shapeType,
42
- size: this._tooltipStyle.content.shape.width,
39
+ size: null === (_c = tooltipStyle.shapeColumn.item) || void 0 === _c ? void 0 : _c.width,
43
40
  color: null == title ? void 0 : title.shapeColor,
44
41
  hollow: null == title ? void 0 : title.shapeHollow
45
42
  });
46
43
  }
47
44
  setContent() {
48
- var _a;
49
- if (!this._tooltipActual || !this._tooltipStyle) return;
50
- const {title: title} = this._tooltipActual;
45
+ var _a, _b, _c;
46
+ const tooltipStyle = this._option.getTooltipStyle(), tooltipActual = this._option.getTooltipActual(), {title: title} = tooltipActual;
51
47
  this.init(), null === (_a = this.shape) || void 0 === _a || _a.setStyle(void 0, {
52
48
  hasShape: null == title ? void 0 : title.hasShape,
53
49
  shapeType: null == title ? void 0 : title.shapeType,
54
- size: this._tooltipStyle.content.shape.width,
50
+ size: null === (_b = tooltipStyle.shapeColumn.item) || void 0 === _b ? void 0 : _b.width,
55
51
  color: null == title ? void 0 : title.shapeColor,
56
52
  hollow: null == title ? void 0 : title.shapeHollow
57
- }), this.textSpan.setContent(title.value);
53
+ }), null === (_c = this.textSpan) || void 0 === _c || _c.setContent(null == title ? void 0 : title.value);
58
54
  }
59
55
  release() {
60
56
  super.release(), this.shape = null, this.textSpan = null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/dom/model/title-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,OAAO,UAAW,SAAQ,gBAAgB;IAAhD;;QACE,UAAK,GAAsB,IAAI,CAAC;IA0FlC,CAAC;IAvFC,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SACzC;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;QACtC,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAA,EAAE;YACvC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;gBACf,IAAI,CAAC,UAAU,EAAE,CAAC;aACnB;SACF;aAAM,IAAI,IAAI,CAAC,KAAK,EAAE;YACrB,IAAI,CAAC,aAAa,EAAE,CAAC;SACtB;QAED,IAAI,CAAC,IA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QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF","file":"title-model.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { defaultH2Style } from './style-constants';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport { ShapeModel } from './shape-model';\nimport { TextModel } from './text-model';\n\nexport class TitleModel extends BaseTooltipModel {\n shape: ShapeModel | null = null;\n textSpan: TextModel;\n\n init(): void {\n if (!this._tooltipActual) {\n return;\n }\n\n if (!this.product) {\n this.product = this.createElement('h2');\n }\n\n const { title } = this._tooltipActual;\n if (title?.hasShape && title?.shapeType) {\n if (!this.shape) {\n this._initShape();\n }\n } else if (this.shape) {\n this._releaseShape();\n }\n\n if (!this.textSpan) {\n this._initTextSpan();\n }\n }\n\n private _initShape() {\n const shape = new ShapeModel(this.product, this._option, 0, this._tooltipStyle, this._tooltipActual);\n shape.init();\n this.shape = shape;\n this.children[shape.childIndex] = shape;\n }\n\n private _releaseShape() {\n this.shape.release();\n delete this.children[this.shape.childIndex];\n this.shape = null;\n }\n\n private _initTextSpan() {\n const textSpan = new TextModel(this.product, this._option, 1, this._tooltipStyle, this._tooltipActual);\n textSpan.init();\n this.textSpan = textSpan;\n this.children[textSpan.childIndex] = textSpan;\n }\n\n setStyle(style?: Partial<CSSStyleDeclaration>): void {\n if (!this._tooltipActual || !this._tooltipStyle) {\n return;\n }\n\n const { title } = this._tooltipActual;\n super.setStyle(merge({}, defaultH2Style, this._tooltipStyle.title, style));\n\n this.shape?.setStyle(\n {\n paddingRight: this._tooltipStyle.content.shape.marginRight\n },\n {\n hasShape: title?.hasShape,\n shapeType: title?.shapeType,\n size: this._tooltipStyle.content.shape.width,\n color: title?.shapeColor,\n hollow: title?.shapeHollow\n }\n );\n }\n\n setContent(): void {\n if (!this._tooltipActual || !this._tooltipStyle) {\n return;\n }\n\n const { title } = this._tooltipActual;\n this.init();\n this.shape?.setStyle(undefined, {\n hasShape: title?.hasShape,\n shapeType: title?.shapeType,\n size: this._tooltipStyle.content.shape.width,\n color: title?.shapeColor,\n hollow: title?.shapeHollow\n });\n this.textSpan.setContent(title.value);\n }\n\n release(): void {\n super.release();\n this.shape = null;\n this.textSpan = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/dom/model/title-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,OAAO,UAAW,SAAQ,gBAAgB;IAI9C,IAAI;QACF,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAEtD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;SACzC;QAED,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC;QAChC,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAA,EAAE;YACvC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;gBACf,IAAI,CAAC,UAAU,EAAE,CAAC;aACnB;SACF;aAAM,IAAI,IAAI,CAAC,KAAK,EAAE;YACrB,IAAI,CAAC,aAAa,EAAE,CAAC;SACtB;QAED,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,aAAa,EAAE,CAAC;SACtB;IACH,CAAC;IAEO,UAAU;QAChB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CA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ACF","file":"title-model.js","sourcesContent":["import type { Maybe } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport { merge } from '@visactor/vutils';\nimport { defaultH2Style } from './style-constants';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport { ShapeModel } from './shape-model';\nimport { TextModel } from './text-model';\n\nexport class TitleModel extends BaseTooltipModel {\n shape: Maybe<ShapeModel>;\n textSpan: Maybe<TextModel>;\n\n init(): void {\n const tooltipActual = this._option.getTooltipActual();\n\n if (!this.product) {\n this.product = this.createElement('h2');\n }\n\n const { title } = tooltipActual;\n if (title?.hasShape && title?.shapeType) {\n if (!this.shape) {\n this._initShape();\n }\n } else if (this.shape) {\n this._releaseShape();\n }\n\n if (!this.textSpan) {\n this._initTextSpan();\n }\n }\n\n private _initShape() {\n const shape = new ShapeModel(this.product!, this._option, 0);\n shape.init();\n this.shape = shape;\n this.children[shape.childIndex] = shape;\n }\n\n private _releaseShape() {\n if (!this.shape) {\n return;\n }\n this.shape.release();\n delete this.children[this.shape.childIndex];\n this.shape = null;\n }\n\n private _initTextSpan() {\n const textSpan = new TextModel(this.product!, this._option, 1);\n textSpan.init();\n this.textSpan = textSpan;\n this.children[textSpan.childIndex] = textSpan;\n }\n\n setStyle(style?: Partial<CSSStyleDeclaration>): void {\n const tooltipStyle = this._option.getTooltipStyle();\n const tooltipActual = this._option.getTooltipActual();\n\n const { title } = tooltipActual;\n super.setStyle(merge({}, defaultH2Style, tooltipStyle.title, style));\n\n this.shape?.setStyle(\n {\n paddingRight: tooltipStyle.shapeColumn.item?.marginRight\n },\n {\n hasShape: title?.hasShape,\n shapeType: title?.shapeType,\n size: tooltipStyle.shapeColumn.item?.width,\n color: title?.shapeColor,\n hollow: title?.shapeHollow\n }\n );\n }\n\n setContent(): void {\n const tooltipStyle = this._option.getTooltipStyle();\n const tooltipActual = this._option.getTooltipActual();\n\n const { title } = tooltipActual;\n this.init();\n this.shape?.setStyle(undefined, {\n hasShape: title?.hasShape,\n shapeType: title?.shapeType,\n size: tooltipStyle.shapeColumn.item?.width,\n color: title?.shapeColor,\n hollow: title?.shapeHollow\n });\n this.textSpan?.setContent(title?.value);\n }\n\n release(): void {\n super.release();\n this.shape = null;\n this.textSpan = null;\n }\n}\n"]}
@@ -1,4 +1,3 @@
1
- import type { IDomTooltipStyle } from '../interface';
2
1
  import { BaseTooltipModel } from './base-tooltip-model';
3
2
  import { ContentModel } from './content-model';
4
3
  import type { ITooltipModelOption } from './interface';
@@ -8,7 +7,7 @@ export declare class TooltipModel extends BaseTooltipModel {
8
7
  content: ContentModel | null;
9
8
  private _classList;
10
9
  private _id;
11
- constructor(parent: BaseTooltipModel | HTMLElement, option: ITooltipModelOption, classList: string[], id: string, style: IDomTooltipStyle);
10
+ constructor(parent: BaseTooltipModel | HTMLElement, option: ITooltipModelOption, classList: string[], id: string);
12
11
  setVisibility(visibility: boolean): void;
13
12
  init(): void;
14
13
  private _initPanel;
@@ -1,4 +1,4 @@
1
- import { isValid } from "@visactor/vutils";
1
+ import { isValid, merge } from "@visactor/vutils";
2
2
 
3
3
  import { BaseTooltipModel } from "./base-tooltip-model";
4
4
 
@@ -6,22 +6,24 @@ import { ContentModel } from "./content-model";
6
6
 
7
7
  import { TitleModel } from "./title-model";
8
8
 
9
+ import { defaultContainerStyle } from "./style-constants";
10
+
9
11
  export class TooltipModel extends BaseTooltipModel {
10
- constructor(parent, option, classList, id, style) {
11
- super(parent, option, 0, style), this.title = null, this.content = null, this._classList = classList,
12
- this._id = id, this._tooltipStyle = style;
12
+ constructor(parent, option, classList, id) {
13
+ super(parent, option, 0), this.title = null, this.content = null, this._classList = classList,
14
+ this._id = id;
13
15
  }
14
16
  setVisibility(visibility) {
15
- super.setVisibility(visibility);
17
+ if (super.setVisibility(visibility), !this.product) return;
16
18
  const {classList: classList} = this.product;
17
19
  visibility ? classList.add("visible") : classList.remove("visible");
18
20
  }
19
21
  init() {
20
- if (!this._tooltipActual) return;
22
+ const tooltipActual = this._option.getTooltipActual();
21
23
  this.product || this._initPanel(this._classList, this._id);
22
- const {title: title} = this._tooltipActual;
23
- !1 !== title.visible && isValid(title.value) ? this.title || this._initTitle() : this.title && this._releaseTitle();
24
- this.getRenderContent().length > 0 ? this.content || this._initContent() : this.content && this._releaseContent();
24
+ const {title: title} = tooltipActual;
25
+ !1 !== (null == title ? void 0 : title.visible) && isValid(null == title ? void 0 : title.value) ? this.title || this._initTitle() : this.title && this._releaseTitle();
26
+ this._option.getRenderContent().length > 0 ? this.content || this._initContent() : this.content && this._releaseContent();
25
27
  }
26
28
  _initPanel(classList, id) {
27
29
  const panel = this.createElement("div", classList, {
@@ -44,27 +46,30 @@ export class TooltipModel extends BaseTooltipModel {
44
46
  this.product = panel;
45
47
  }
46
48
  _initTitle() {
47
- const title = new TitleModel(this.product, this._option, 0, this._tooltipStyle, this._tooltipActual);
49
+ const title = new TitleModel(this.product, this._option, 0);
48
50
  title.init(), this.title = title, this.children[title.childIndex] = title;
49
51
  }
50
52
  _releaseTitle() {
51
- this.title.release(), delete this.children[this.title.childIndex], this.title = null;
53
+ this.title && (this.title.release(), delete this.children[this.title.childIndex],
54
+ this.title = null);
52
55
  }
53
56
  _initContent() {
54
- const content = new ContentModel(this.product, this._option, 1, this._tooltipStyle, this._tooltipActual);
57
+ const content = new ContentModel(this.product, this._option, 1);
55
58
  content.init(), this.content = content, this.children[content.childIndex] = content;
56
59
  }
57
60
  _releaseContent() {
58
- this.content.release(), delete this.children[this.content.childIndex], this.content = null;
61
+ this.content && (this.content.release(), delete this.children[this.content.childIndex],
62
+ this.content = null);
59
63
  }
60
64
  setStyle() {
61
- this._tooltipStyle && (super.setStyle(this._tooltipStyle.panel), Object.values(this.children).forEach(((c, i) => {
65
+ const tooltipStyle = this._option.getTooltipStyle();
66
+ super.setStyle(merge({}, defaultContainerStyle, tooltipStyle.panel)), Object.values(this.children).forEach(((c, i) => {
62
67
  c.setStyle(i > 0 ? {
63
- marginTop: "10px"
68
+ marginTop: tooltipStyle.spaceRow
64
69
  } : {
65
70
  marginTop: "0px"
66
71
  });
67
- })));
72
+ }));
68
73
  }
69
74
  setContent() {
70
75
  Object.values(this.children).forEach((c => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/dom/model/tooltip-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IAOhD,YACE,MAAsC,EACtC,MAA2B,EAC3B,SAAmB,EACnB,EAAU,EACV,KAAuB;QAEvB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAblC,UAAK,GAAsB,IAAI,CAAC;QAChC,YAAO,GAAwB,IAAI,CAAC;QAalC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;QACd,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC7B,CAAC;IAED,aAAa,CAAC,UAAmB;QAC/B,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAChC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACnC,IAAI,UAAU,EAAE;YACd,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;SAC1B;aAAM;YACL,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;SAC7B;IACH,CAAC;IAED,IAAI;QACF,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,OAAO;SACR;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACjB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,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AAC,EAAE,EAAE;YAC5C,CAAC,CAAC,QAAQ,CACR,CAAC,GAAG,CAAC;gBACH,CAAC,CAAC;oBACE,SAAS,EAAE,MAAM;iBAClB;gBACH,CAAC,CAAC;oBACE,SAAS,EAAE,KAAK;iBACjB,CACN,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACvC,CAAC,CAAC,UAAU,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;CACF","file":"tooltip-model.js","sourcesContent":["import { isValid } from '@visactor/vutils';\nimport type { IDomTooltipStyle } from '../interface';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport { ContentModel } from './content-model';\nimport type { ITooltipModelOption } from './interface';\nimport { TitleModel } from './title-model';\n\nexport class TooltipModel extends BaseTooltipModel {\n title: TitleModel | null = null;\n content: ContentModel | null = null;\n\n private _classList: string[];\n private _id: string;\n\n constructor(\n parent: BaseTooltipModel | HTMLElement,\n option: ITooltipModelOption,\n classList: string[],\n id: string,\n style: IDomTooltipStyle\n ) {\n super(parent, option, 0, style);\n this._classList = classList;\n this._id = id;\n this._tooltipStyle = style;\n }\n\n setVisibility(visibility: boolean) {\n super.setVisibility(visibility);\n const { classList } = this.product;\n if (visibility) {\n classList.add('visible');\n } else {\n classList.remove('visible');\n }\n }\n\n init(): void {\n if (!this._tooltipActual) {\n return;\n }\n\n if (!this.product) {\n this._initPanel(this._classList, this._id);\n }\n\n const { title } = this._tooltipActual;\n if (title.visible !== false && isValid(title.value)) {\n if (!this.title) {\n this._initTitle();\n }\n } else if (this.title) {\n this._releaseTitle();\n }\n\n const renderContent = this.getRenderContent();\n if (renderContent.length > 0) {\n if (!this.content) {\n this._initContent();\n }\n } else if (this.content) {\n this._releaseContent();\n }\n }\n\n private _initPanel(classList?: string[], id?: string) {\n const panel = this.createElement(\n 'div',\n classList,\n {\n left: '0',\n top: '0',\n pointerEvents: 'none',\n padding: '12px',\n position: 'absolute',\n zIndex: '99999999999999',\n fontFamily: 'sans-serif',\n fontSize: '11px',\n borderRadius: '3px',\n borderStyle: 'solid',\n lineHeight: 'initial',\n background: '#fff',\n boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.1)',\n maxWidth: '100wh',\n maxHeight: '100vh'\n },\n id\n );\n this.product = panel;\n }\n\n private _initTitle() {\n const title = new TitleModel(this.product, this._option, 0, this._tooltipStyle, this._tooltipActual);\n title.init();\n this.title = title;\n this.children[title.childIndex] = title;\n }\n\n private _releaseTitle() {\n this.title.release();\n delete this.children[this.title.childIndex];\n this.title = null;\n }\n\n private _initContent() {\n const content = new ContentModel(this.product, this._option, 1, this._tooltipStyle, this._tooltipActual);\n content.init();\n this.content = content;\n this.children[content.childIndex] = content;\n }\n\n private _releaseContent() {\n this.content.release();\n delete this.children[this.content.childIndex];\n this.content = null;\n }\n\n setStyle(): void {\n if (!this._tooltipStyle) {\n return;\n }\n super.setStyle(this._tooltipStyle.panel as any);\n Object.values(this.children).forEach((c, i) => {\n c.setStyle(\n i > 0\n ? {\n marginTop: '10px'\n }\n : {\n marginTop: '0px'\n }\n );\n });\n }\n\n setContent() {\n Object.values(this.children).forEach(c => {\n c.setContent();\n });\n }\n\n release(): void {\n super.release();\n this.title = null;\n this.content = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/dom/model/tooltip-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAi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AC;oBACE,SAAS,EAAE,KAAK;iBACjB,CACN,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IAED,UAAU;QACR,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YACvC,CAAC,CAAC,UAAU,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;CACF","file":"tooltip-model.js","sourcesContent":["import { isValid, merge } from '@visactor/vutils';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport { ContentModel } from './content-model';\nimport type { ITooltipModelOption } from './interface';\nimport { TitleModel } from './title-model';\nimport { defaultContainerStyle } from './style-constants';\n\nexport class TooltipModel extends BaseTooltipModel {\n title: TitleModel | null = null;\n content: ContentModel | null = null;\n\n private _classList: string[];\n private _id: string;\n\n constructor(parent: BaseTooltipModel | HTMLElement, option: ITooltipModelOption, classList: string[], id: string) {\n super(parent, option, 0);\n this._classList = classList;\n this._id = id;\n }\n\n setVisibility(visibility: boolean) {\n super.setVisibility(visibility);\n if (!this.product) {\n return;\n }\n const { classList } = this.product;\n if (visibility) {\n classList.add('visible');\n } else {\n classList.remove('visible');\n }\n }\n\n init(): void {\n const tooltipActual = this._option.getTooltipActual();\n\n if (!this.product) {\n this._initPanel(this._classList, this._id);\n }\n\n const { title } = tooltipActual;\n if (title?.visible !== false && isValid(title?.value)) {\n if (!this.title) {\n this._initTitle();\n }\n } else if (this.title) {\n this._releaseTitle();\n }\n\n const renderContent = this._option.getRenderContent();\n if (renderContent.length > 0) {\n if (!this.content) {\n this._initContent();\n }\n } else if (this.content) {\n this._releaseContent();\n }\n }\n\n private _initPanel(classList?: string[], id?: string) {\n const panel = this.createElement(\n 'div',\n classList,\n {\n left: '0',\n top: '0',\n pointerEvents: 'none',\n padding: '12px',\n position: 'absolute',\n zIndex: '99999999999999',\n fontFamily: 'sans-serif',\n fontSize: '11px',\n borderRadius: '3px',\n borderStyle: 'solid',\n lineHeight: 'initial',\n background: '#fff',\n boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.1)',\n maxWidth: '100wh',\n maxHeight: '100vh'\n },\n id\n );\n this.product = panel;\n }\n\n private _initTitle() {\n const title = new TitleModel(this.product!, this._option, 0);\n title.init();\n this.title = title;\n this.children[title.childIndex] = title;\n }\n\n private _releaseTitle() {\n if (!this.title) {\n return;\n }\n this.title.release();\n delete this.children[this.title.childIndex];\n this.title = null;\n }\n\n private _initContent() {\n const content = new ContentModel(this.product!, this._option, 1);\n content.init();\n this.content = content;\n this.children[content.childIndex] = content;\n }\n\n private _releaseContent() {\n if (!this.content) {\n return;\n }\n this.content.release();\n delete this.children[this.content.childIndex];\n this.content = null;\n }\n\n setStyle(): void {\n const tooltipStyle = this._option.getTooltipStyle();\n\n super.setStyle(merge({}, defaultContainerStyle, tooltipStyle.panel));\n Object.values(this.children).forEach((c, i) => {\n c.setStyle(\n i > 0\n ? {\n marginTop: tooltipStyle.spaceRow\n }\n : {\n marginTop: '0px'\n }\n );\n });\n }\n\n setContent() {\n Object.values(this.children).forEach(c => {\n c.setContent();\n });\n }\n\n release(): void {\n super.release();\n this.title = null;\n this.content = null;\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { Maybe } from '@visactor/vutils';
2
+ import type { ITooltipStyle } from '../interface';
3
+ import type { IDomTooltipStyle } from './interface';
4
+ import type { TooltipAttributes } from '@visactor/vrender-components';
5
+ export declare function getDomStyles(style: ITooltipStyle, attributeCache?: Maybe<TooltipAttributes>): IDomTooltipStyle;
@@ -0,0 +1,71 @@
1
+ import { isValid, merge, isArray } from "../../../../util";
2
+
3
+ const DEFAULT_SHAPE_SPACING = 8, DEFAULT_KEY_SPACING = 26, DEFAULT_VALUE_SPACING = 0, getPixelPropertyStr = (num, defaultStr) => isValid(num) ? isArray(num) ? num.map((n => `${n}px`)).join(" ") : `${num}px` : null != defaultStr ? defaultStr : "initial";
4
+
5
+ export function getDomStyles(style, attributeCache) {
6
+ var _a, _b, _c, _d, _e;
7
+ const {panel: {fill: fillColor, shadow: shadow, shadowBlur: shadowBlur, shadowColor: shadowColor, shadowOffsetX: shadowOffsetX, shadowOffsetY: shadowOffsetY, shadowSpread: shadowSpread, borderRadius: borderRadius, stroke: strokeColor, lineWidth: lineWidth}, padding: padding, key: key, value: value, title: title, shape: shape, maxWidth: maxWidth, minWidth: minWidth, enterable: enterable, spaceRow: spaceRow, transitionDuration: transitionDuration} = style, backgroundColor = fillColor, styles = {
8
+ panel: {
9
+ width: getPixelPropertyStr(null === (_a = null == attributeCache ? void 0 : attributeCache.panel) || void 0 === _a ? void 0 : _a.width),
10
+ height: getPixelPropertyStr(null === (_b = null == attributeCache ? void 0 : attributeCache.panel) || void 0 === _b ? void 0 : _b.height),
11
+ paddingBottom: getPixelPropertyStr(padding.bottom),
12
+ paddingLeft: getPixelPropertyStr(padding.left),
13
+ paddingRight: getPixelPropertyStr(padding.right),
14
+ paddingTop: getPixelPropertyStr(padding.top),
15
+ borderColor: strokeColor,
16
+ borderWidth: getPixelPropertyStr(lineWidth),
17
+ borderRadius: getPixelPropertyStr(borderRadius),
18
+ backgroundColor: backgroundColor ? `${backgroundColor}` : "transparent",
19
+ boxShadow: shadow ? `${shadowOffsetX}px ${shadowOffsetY}px ${shadowBlur}px ${shadowSpread}px ${shadowColor}` : "initial",
20
+ maxWidth: getPixelPropertyStr(maxWidth),
21
+ minWidth: getPixelPropertyStr(minWidth),
22
+ pointerEvents: enterable ? "auto" : "none",
23
+ transitionDuration: transitionDuration ? `${transitionDuration}ms` : "initial",
24
+ transitionProperty: transitionDuration ? "transform" : "initial",
25
+ transitionTimingFunction: transitionDuration ? "ease-out" : "initial"
26
+ },
27
+ title: getLabelStyle(title),
28
+ content: {},
29
+ shapeColumn: {
30
+ item: getShapeStyle(shape),
31
+ width: getPixelPropertyStr(shape.size),
32
+ marginRight: getPixelPropertyStr(null !== (_c = shape.spacing) && void 0 !== _c ? _c : 8)
33
+ },
34
+ keyColumn: {
35
+ item: getLabelStyle(key),
36
+ width: getPixelPropertyStr(null == attributeCache ? void 0 : attributeCache.keyWidth),
37
+ marginRight: getPixelPropertyStr(null !== (_d = key.spacing) && void 0 !== _d ? _d : 26)
38
+ },
39
+ valueColumn: {
40
+ item: getLabelStyle(value),
41
+ width: getPixelPropertyStr(null == attributeCache ? void 0 : attributeCache.valueWidth),
42
+ marginRight: getPixelPropertyStr(null !== (_e = value.spacing) && void 0 !== _e ? _e : 0)
43
+ },
44
+ spaceRow: getPixelPropertyStr(spaceRow)
45
+ };
46
+ if (isValid(spaceRow)) {
47
+ const gapUnit = spaceRow / 2;
48
+ [ styles.shapeColumn.item, styles.keyColumn.item, styles.valueColumn.item ].forEach((obj => {
49
+ obj.marginTop = getPixelPropertyStr(gapUnit), obj.marginBottom = obj.marginTop;
50
+ })), styles.content.marginTop = getPixelPropertyStr(-gapUnit), styles.content.marginBottom = styles.content.marginTop;
51
+ } else [ styles.content, styles.shapeColumn.item, styles.keyColumn.item, styles.valueColumn.item ].forEach((obj => {
52
+ obj.marginTop = "initial", obj.marginBottom = "initial";
53
+ }));
54
+ return styles;
55
+ }
56
+
57
+ function getLabelStyle(labelStyle, defaultStyle) {
58
+ if (!labelStyle) return;
59
+ const {fontFamily: labelFont, fontSize: labelFontSize, fill: labelColor, textAlign: textAlign, lineHeight: lineHeight, fontWeight: fontWeight} = merge({}, defaultStyle, labelStyle), styleObj = {};
60
+ return styleObj.fontFamily = labelFont, styleObj.fontSize = getPixelPropertyStr(labelFontSize),
61
+ styleObj.color = labelColor, styleObj.textAlign = textAlign, styleObj.lineHeight = getPixelPropertyStr(lineHeight),
62
+ styleObj.fontWeight = fontWeight, styleObj;
63
+ }
64
+
65
+ function getShapeStyle(shapeStyle, defaultStyle) {
66
+ if (!shapeStyle) return;
67
+ const {size: size} = merge({}, defaultStyle, shapeStyle), styleObj = {};
68
+ return styleObj.width = getPixelPropertyStr(size), styleObj.height = styleObj.width,
69
+ styleObj;
70
+ }
71
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/component/tooltip/handler/dom/util.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAM3D,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,MAAM,mBAAmB,GAAG,CAAC,GAAuB,EAAE,UAAmB,EAAE,EAAE;IAC3E,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;QAChB,IAAI,OAAO,CAAC,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;AAEF,MAAM,UAAU,YAAY,CAAC,KAAoB,EAAE,cAAyC;;IAC1F,MAAM,EACJ,KAAK,EAAE,EACL,IAAI,EAAE,SAAS,EACf,MAAM,EACN,UAAU,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,MAAM,EAAE,WAAW,EACnB,SAAS,EACV,EACD,OAAO,EACP,GAAG,EACH,KAAK,EACL,KAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,kBAAkB,EACnB,GAAG,KAAK,CAAC;IAEV,MAAM,eAAe,GAAG,SAAmB,CAAC;IAE5C,MAAM,MAAM,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AAE,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAgB,EAAE,CAAC;IAEjC,QAAQ,CAAC,KAAK,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC3C,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC;IACjC,OAAO,QAAQ,CAAC;AAClB,CAAC","file":"util.js","sourcesContent":["import type { Maybe } from '@visactor/vutils';\nimport type { FontWeight, TextAlign } from '../../../../typings';\nimport { isValid, merge, isArray } from '../../../../util';\nimport type { ITooltipTheme } from '../../interface';\nimport type { ITextStyle, ITooltipStyle } from '../interface';\nimport type { ILabelStyle, IMargin, 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\nconst 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 function getDomStyles(style: ITooltipStyle, attributeCache?: Maybe<TooltipAttributes>): IDomTooltipStyle {\n const {\n panel: {\n fill: fillColor,\n shadow,\n shadowBlur,\n shadowColor,\n shadowOffsetX,\n shadowOffsetY,\n shadowSpread,\n borderRadius,\n stroke: strokeColor,\n lineWidth\n },\n padding,\n key,\n value,\n title,\n shape,\n maxWidth,\n minWidth,\n enterable,\n spaceRow,\n transitionDuration\n } = style;\n\n const backgroundColor = fillColor as string;\n\n const styles = {\n panel: {\n width: getPixelPropertyStr(attributeCache?.panel?.width),\n height: getPixelPropertyStr(attributeCache?.panel?.height),\n paddingBottom: getPixelPropertyStr(padding.bottom),\n paddingLeft: getPixelPropertyStr(padding.left),\n paddingRight: getPixelPropertyStr(padding.right),\n paddingTop: getPixelPropertyStr(padding.top),\n borderColor: strokeColor,\n borderWidth: getPixelPropertyStr(lineWidth),\n borderRadius: getPixelPropertyStr(borderRadius),\n backgroundColor: backgroundColor ? `${backgroundColor}` : 'transparent',\n boxShadow: shadow\n ? `${shadowOffsetX}px ${shadowOffsetY}px ${shadowBlur}px ${shadowSpread}px ${shadowColor}`\n : 'initial',\n maxWidth: getPixelPropertyStr(maxWidth),\n minWidth: getPixelPropertyStr(minWidth),\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: getLabelStyle(title),\n content: {},\n shapeColumn: {\n item: getShapeStyle(shape),\n width: getPixelPropertyStr(shape.size),\n marginRight: getPixelPropertyStr(shape.spacing ?? DEFAULT_SHAPE_SPACING)\n },\n keyColumn: {\n item: getLabelStyle(key),\n width: getPixelPropertyStr(attributeCache?.keyWidth),\n marginRight: getPixelPropertyStr(key.spacing ?? DEFAULT_KEY_SPACING)\n },\n valueColumn: {\n item: getLabelStyle(value),\n width: getPixelPropertyStr(attributeCache?.valueWidth),\n marginRight: getPixelPropertyStr(value.spacing ?? DEFAULT_VALUE_SPACING)\n },\n spaceRow: getPixelPropertyStr(spaceRow)\n } as IDomTooltipStyle;\n\n if (isValid(spaceRow)) {\n const gapUnit = spaceRow / 2;\n ([styles.shapeColumn.item, styles.keyColumn.item, styles.valueColumn.item] as IMargin[]).forEach(obj => {\n obj.marginTop = getPixelPropertyStr(gapUnit);\n obj.marginBottom = obj.marginTop;\n });\n styles.content.marginTop = getPixelPropertyStr(-gapUnit);\n styles.content.marginBottom = styles.content.marginTop;\n } else {\n ([styles.content, styles.shapeColumn.item, styles.keyColumn.item, styles.valueColumn.item] as IMargin[]).forEach(\n obj => {\n obj.marginTop = 'initial';\n obj.marginBottom = 'initial';\n }\n );\n }\n return styles;\n}\n\nfunction getLabelStyle(labelStyle?: ITextStyle, defaultStyle?: Partial<ITextStyle>): 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 } = merge({}, defaultStyle, labelStyle) as ITextStyle;\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 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 } = merge({}, defaultStyle, shapeStyle);\n const styleObj: IShapeStyle = {};\n\n styleObj.width = getPixelPropertyStr(size);\n styleObj.height = styleObj.width;\n return styleObj;\n}\n"]}
@@ -1,2 +1 @@
1
1
  export * from './style';
2
- export * from './cache';
@@ -1,4 +1,2 @@
1
1
  export * from "./style";
2
-
3
- export * from "./cache";
4
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/component/tooltip/handler/interface/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC","file":"index.js","sourcesContent":["export * from './style';\nexport * from './cache';\n"]}
1
+ {"version":3,"sources":["../src/component/tooltip/handler/interface/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC","file":"index.js","sourcesContent":["export * from './style';\n"]}
@@ -46,19 +46,19 @@ export const getTooltipAttributes = (actualTooltip, style) => {
46
46
  const filteredContent = content.filter((item => (item.key || item.value) && !1 !== item.visible));
47
47
  if (filteredContent.length) {
48
48
  let hasContentShape = !1;
49
- const keyWidths = [], valueWidths = [], keyTextMeasure = initTextMeasure(keyStyle), valueTextMeasure = initTextMeasure(valueStyle);
49
+ const keyWidths = [], adaptiveKeyWidths = [], valueWidths = [], keyTextMeasure = initTextMeasure(keyStyle), valueTextMeasure = initTextMeasure(valueStyle);
50
50
  attribute.content = filteredContent.map(((item, i) => {
51
51
  const itemAttrs = {
52
52
  height: 0,
53
53
  spaceRow: spaceRow
54
54
  };
55
55
  let itemHeight = 0;
56
- const {hasShape: hasShape, key: key, shapeColor: shapeColor, shapeHollow: shapeHollow, shapeType: shapeType = "", value: value} = item;
56
+ const {hasShape: hasShape, key: key, shapeColor: shapeColor, shapeHollow: shapeHollow, shapeType: shapeType = "", value: value, isKeyAdaptive: isKeyAdaptive} = item;
57
57
  if (isValid(key)) {
58
58
  const {width: width, height: height} = keyTextMeasure.quickMeasure(key);
59
59
  itemAttrs.key = {
60
60
  text: key
61
- }, keyWidths.push(width), itemHeight = Math.max(itemHeight, height);
61
+ }, isKeyAdaptive ? adaptiveKeyWidths.push(width) : keyWidths.push(width), itemHeight = Math.max(itemHeight, height);
62
62
  }
63
63
  if (isValid(value)) {
64
64
  const {width: width, height: height} = valueTextMeasure.quickMeasure(value);
@@ -69,16 +69,19 @@ export const getTooltipAttributes = (actualTooltip, style) => {
69
69
  if (hasShape && builtinSymbolsMap[shapeType]) {
70
70
  hasContentShape = !0;
71
71
  const shape = {
72
+ visible: !0,
72
73
  symbolType: shapeType
73
74
  };
74
75
  shapeHollow ? shape.stroke = shapeColor : shape.fill = shapeColor, itemHeight = Math.max(shapeStyle.size, itemHeight),
75
76
  itemAttrs.shape = shape;
76
- }
77
+ } else itemAttrs.shape = {
78
+ visible: !1
79
+ };
77
80
  return itemAttrs.height = itemHeight, containerHeight += itemHeight, i < filteredContent.length - 1 && (containerHeight += spaceRow),
78
81
  itemAttrs;
79
82
  }));
80
- const maxKeyWidth = keyWidths.length ? Math.max(...keyWidths) : 0, maxValueWidth = valueWidths.length ? Math.max(...valueWidths) : 0;
81
- maxWidth = Math.max(maxKeyWidth + maxValueWidth + keyStyle.spacing + valueStyle.spacing + (hasContentShape ? shapeStyle.size + shapeStyle.spacing : 0), maxWidth),
83
+ const maxKeyWidth = keyWidths.length ? Math.max(...keyWidths) : 0, maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? Math.max(...adaptiveKeyWidths) : 0, maxValueWidth = valueWidths.length ? Math.max(...valueWidths) : 0, shapeWidth = hasContentShape ? shapeStyle.size + shapeStyle.spacing : 0;
84
+ maxWidth = Math.max(maxKeyWidth + maxValueWidth + keyStyle.spacing + valueStyle.spacing + shapeWidth, maxAdaptiveKeyWidth + shapeWidth, maxWidth),
82
85
  attribute.hasContentShape = hasContentShape, attribute.keyWidth = maxKeyWidth, attribute.valueWidth = maxValueWidth;
83
86
  }
84
87
  }