@visactor/vchart 1.12.6 → 1.12.8

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 (365) hide show
  1. package/build/es5/index.js +2 -2
  2. package/build/index.js +2116 -2517
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/base/base-chart.d.ts +1 -0
  6. package/cjs/chart/base/base-chart.js +15 -9
  7. package/cjs/chart/base/base-chart.js.map +1 -1
  8. package/cjs/chart/chart-meta/data.d.ts +1 -2
  9. package/cjs/chart/chart-meta/data.js +11 -11
  10. package/cjs/chart/chart-meta/data.js.map +1 -1
  11. package/cjs/chart/gauge/interface.d.ts +1 -1
  12. package/cjs/chart/gauge/interface.js.map +1 -1
  13. package/cjs/chart/treemap/interface.d.ts +1 -1
  14. package/cjs/chart/treemap/interface.js.map +1 -1
  15. package/cjs/chart/venn/interface.d.ts +2 -2
  16. package/cjs/chart/venn/interface.js.map +1 -1
  17. package/cjs/component/axis/base-axis.js +1 -1
  18. package/cjs/component/axis/base-axis.js.map +1 -1
  19. package/cjs/component/axis/cartesian/axis.js +9 -6
  20. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  21. package/cjs/component/axis/cartesian/interface/common.d.ts +1 -0
  22. package/cjs/component/axis/cartesian/interface/common.js.map +1 -1
  23. package/cjs/component/axis/polar/axis.js.map +1 -1
  24. package/cjs/component/axis/polar/interface/spec.js.map +1 -1
  25. package/cjs/component/data-zoom/data-filter-base-component.js +10 -7
  26. package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
  27. package/cjs/component/data-zoom/util.js +11 -3
  28. package/cjs/component/data-zoom/util.js.map +1 -1
  29. package/cjs/component/geo/geo-coordinate.js +5 -2
  30. package/cjs/component/geo/geo-coordinate.js.map +1 -1
  31. package/cjs/component/interface/index.d.ts +0 -1
  32. package/cjs/component/interface/index.js +1 -1
  33. package/cjs/component/interface/index.js.map +1 -1
  34. package/cjs/component/label/util.js +1 -1
  35. package/cjs/component/label/util.js.map +1 -1
  36. package/cjs/component/title/interface/spec.d.ts +3 -3
  37. package/cjs/component/title/interface/spec.js.map +1 -1
  38. package/cjs/component/tooltip/constant.d.ts +5 -4
  39. package/cjs/component/tooltip/constant.js +7 -7
  40. package/cjs/component/tooltip/constant.js.map +1 -1
  41. package/cjs/component/tooltip/interface/common.d.ts +1 -1
  42. package/cjs/component/tooltip/interface/common.js.map +1 -1
  43. package/cjs/component/tooltip/interface/spec.d.ts +8 -0
  44. package/cjs/component/tooltip/interface/spec.js.map +1 -1
  45. package/cjs/component/tooltip/interface/theme.d.ts +2 -2
  46. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  47. package/cjs/component/tooltip/processor/base.d.ts +3 -5
  48. package/cjs/component/tooltip/processor/base.js +24 -27
  49. package/cjs/component/tooltip/processor/base.js.map +1 -1
  50. package/cjs/component/tooltip/processor/group-tooltip.js +1 -1
  51. package/cjs/component/tooltip/processor/group-tooltip.js.map +1 -1
  52. package/cjs/component/tooltip/processor/mark-tooltip.js +2 -2
  53. package/cjs/component/tooltip/processor/mark-tooltip.js.map +1 -1
  54. package/cjs/component/tooltip/tooltip-transformer.js +0 -1
  55. package/cjs/component/tooltip/tooltip-transformer.js.map +1 -1
  56. package/cjs/component/tooltip/tooltip.d.ts +9 -4
  57. package/cjs/component/tooltip/tooltip.js +64 -53
  58. package/cjs/component/tooltip/tooltip.js.map +1 -1
  59. package/cjs/component/tooltip/utils/common.d.ts +6 -4
  60. package/cjs/component/tooltip/utils/common.js +52 -7
  61. package/cjs/component/tooltip/utils/common.js.map +1 -1
  62. package/cjs/component/tooltip/utils/get-spec.d.ts +4 -4
  63. package/cjs/component/tooltip/utils/get-spec.js +20 -82
  64. package/cjs/component/tooltip/utils/get-spec.js.map +1 -1
  65. package/cjs/component/tooltip/utils/get-value.d.ts +1 -2
  66. package/cjs/component/tooltip/utils/get-value.js +2 -12
  67. package/cjs/component/tooltip/utils/get-value.js.map +1 -1
  68. package/cjs/component/tooltip/utils/index.d.ts +0 -1
  69. package/cjs/component/tooltip/utils/index.js +1 -2
  70. package/cjs/component/tooltip/utils/index.js.map +1 -1
  71. package/cjs/constant/correlation.js +2 -1
  72. package/cjs/constant/layout.js +1 -2
  73. package/cjs/core/index.d.ts +1 -1
  74. package/cjs/core/index.js +1 -1
  75. package/cjs/core/index.js.map +1 -1
  76. package/cjs/core/vchart.js +16 -16
  77. package/cjs/core/vchart.js.map +1 -1
  78. package/cjs/data/initialize.d.ts +1 -2
  79. package/cjs/data/initialize.js +5 -5
  80. package/cjs/data/initialize.js.map +1 -1
  81. package/cjs/data/transforms/pie.d.ts +3 -0
  82. package/cjs/data/transforms/pie.js +8 -3
  83. package/cjs/data/transforms/pie.js.map +1 -1
  84. package/cjs/model/interface.d.ts +14 -0
  85. package/cjs/model/interface.js.map +1 -1
  86. package/cjs/plugin/chart/media-query/media-query.d.ts +1 -0
  87. package/cjs/plugin/chart/media-query/media-query.js +3 -1
  88. package/cjs/plugin/chart/media-query/media-query.js.map +1 -1
  89. package/cjs/plugin/chart/plugin-service.d.ts +2 -0
  90. package/cjs/plugin/chart/plugin-service.js +5 -0
  91. package/cjs/plugin/chart/plugin-service.js.map +1 -1
  92. package/cjs/plugin/components/tooltip-handler/base.d.ts +1 -13
  93. package/cjs/plugin/components/tooltip-handler/base.js +83 -220
  94. package/cjs/plugin/components/tooltip-handler/base.js.map +1 -1
  95. package/cjs/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js +1 -1
  96. package/cjs/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +1 -1
  97. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.d.ts +0 -1
  98. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +7 -19
  99. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +1 -1
  100. package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.js +16 -14
  101. package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.js.map +1 -1
  102. package/cjs/plugin/components/tooltip-handler/dom/model/title-model.js +2 -2
  103. package/cjs/plugin/components/tooltip-handler/dom/model/title-model.js.map +1 -1
  104. package/cjs/plugin/components/tooltip-handler/interface/style.d.ts +1 -2
  105. package/cjs/plugin/components/tooltip-handler/interface/style.js.map +1 -1
  106. package/cjs/plugin/components/tooltip-handler/utils/attribute.js +7 -7
  107. package/cjs/plugin/components/tooltip-handler/utils/attribute.js.map +1 -1
  108. package/cjs/plugin/components/tooltip-handler/utils/common.js.map +1 -1
  109. package/cjs/plugin/components/tooltip-handler/utils/position.d.ts +3 -5
  110. package/cjs/plugin/components/tooltip-handler/utils/position.js +22 -29
  111. package/cjs/plugin/components/tooltip-handler/utils/position.js.map +1 -1
  112. package/cjs/region/interface.d.ts +3 -1
  113. package/cjs/region/interface.js.map +1 -1
  114. package/cjs/series/base/base-series.js +4 -5
  115. package/cjs/series/base/base-series.js.map +1 -1
  116. package/cjs/series/base/tooltip-helper.d.ts +30 -6
  117. package/cjs/series/base/tooltip-helper.js +80 -73
  118. package/cjs/series/base/tooltip-helper.js.map +1 -1
  119. package/cjs/series/box-plot/tooltip-helper.d.ts +2 -2
  120. package/cjs/series/box-plot/tooltip-helper.js +26 -67
  121. package/cjs/series/box-plot/tooltip-helper.js.map +1 -1
  122. package/cjs/series/cartesian/cartesian.d.ts +1 -1
  123. package/cjs/series/circle-packing/circle-packing.js +1 -2
  124. package/cjs/series/circle-packing/circle-packing.js.map +1 -1
  125. package/cjs/series/dot/tooltip-helper.d.ts +8 -2
  126. package/cjs/series/dot/tooltip-helper.js +42 -41
  127. package/cjs/series/dot/tooltip-helper.js.map +1 -1
  128. package/cjs/series/funnel/funnel.d.ts +1 -0
  129. package/cjs/series/funnel/funnel.js +7 -6
  130. package/cjs/series/funnel/funnel.js.map +1 -1
  131. package/cjs/series/funnel/interface.d.ts +3 -1
  132. package/cjs/series/funnel/interface.js.map +1 -1
  133. package/cjs/series/gauge/pointer-tooltip-helper.d.ts +2 -1
  134. package/cjs/series/gauge/pointer-tooltip-helper.js +3 -8
  135. package/cjs/series/gauge/pointer-tooltip-helper.js.map +1 -1
  136. package/cjs/series/heatmap/tooltip-helper.d.ts +2 -3
  137. package/cjs/series/heatmap/tooltip-helper.js +3 -5
  138. package/cjs/series/heatmap/tooltip-helper.js.map +1 -1
  139. package/cjs/series/interface/tooltip-helper.d.ts +5 -4
  140. package/cjs/series/interface/tooltip-helper.js.map +1 -1
  141. package/cjs/series/link/tooltip-helper.d.ts +5 -2
  142. package/cjs/series/link/tooltip-helper.js +26 -27
  143. package/cjs/series/link/tooltip-helper.js.map +1 -1
  144. package/cjs/series/liquid/tooltip-helper.d.ts +4 -5
  145. package/cjs/series/liquid/tooltip-helper.js +2 -22
  146. package/cjs/series/liquid/tooltip-helper.js.map +1 -1
  147. package/cjs/series/pie/pie.js +6 -2
  148. package/cjs/series/pie/pie.js.map +1 -1
  149. package/cjs/series/progress/linear/tooltip-helper.d.ts +2 -3
  150. package/cjs/series/progress/linear/tooltip-helper.js +2 -11
  151. package/cjs/series/progress/linear/tooltip-helper.js.map +1 -1
  152. package/cjs/series/range-area/tooltip-helper.d.ts +1 -3
  153. package/cjs/series/range-area/tooltip-helper.js +2 -50
  154. package/cjs/series/range-area/tooltip-helper.js.map +1 -1
  155. package/cjs/series/range-column/tooltip-helper.d.ts +1 -2
  156. package/cjs/series/range-column/tooltip-helper.js +2 -19
  157. package/cjs/series/range-column/tooltip-helper.js.map +1 -1
  158. package/cjs/series/sankey/sankey.d.ts +1 -1
  159. package/cjs/series/sankey/tooltip-helper.d.ts +3 -3
  160. package/cjs/series/sankey/tooltip-helper.js +10 -57
  161. package/cjs/series/sankey/tooltip-helper.js.map +1 -1
  162. package/cjs/theme/builtin/common/series/linear-progress.js +4 -1
  163. package/cjs/theme/builtin/common/series/linear-progress.js.map +1 -1
  164. package/cjs/theme/builtin/dark/color-scheme.js +2 -1
  165. package/cjs/theme/builtin/dark/color-scheme.js.map +1 -1
  166. package/cjs/theme/builtin/light/color-scheme.js +2 -1
  167. package/cjs/theme/builtin/light/color-scheme.js.map +1 -1
  168. package/cjs/typings/spec/common.d.ts +3 -3
  169. package/cjs/typings/spec/common.js.map +1 -1
  170. package/cjs/typings/tooltip/position.d.ts +1 -0
  171. package/cjs/typings/tooltip/position.js.map +1 -1
  172. package/cjs/typings/tooltip/shape.d.ts +0 -1
  173. package/cjs/typings/tooltip/shape.js.map +1 -1
  174. package/cjs/typings/tooltip/tooltip.d.ts +7 -0
  175. package/cjs/typings/tooltip/tooltip.js.map +1 -1
  176. package/esm/chart/base/base-chart.d.ts +1 -0
  177. package/esm/chart/base/base-chart.js +16 -10
  178. package/esm/chart/base/base-chart.js.map +1 -1
  179. package/esm/chart/chart-meta/data.d.ts +1 -2
  180. package/esm/chart/chart-meta/data.js +12 -10
  181. package/esm/chart/chart-meta/data.js.map +1 -1
  182. package/esm/chart/gauge/interface.d.ts +1 -1
  183. package/esm/chart/gauge/interface.js.map +1 -1
  184. package/esm/chart/treemap/interface.d.ts +1 -1
  185. package/esm/chart/treemap/interface.js.map +1 -1
  186. package/esm/chart/venn/interface.d.ts +2 -2
  187. package/esm/chart/venn/interface.js.map +1 -1
  188. package/esm/component/axis/base-axis.js +1 -1
  189. package/esm/component/axis/base-axis.js.map +1 -1
  190. package/esm/component/axis/cartesian/axis.js +10 -7
  191. package/esm/component/axis/cartesian/axis.js.map +1 -1
  192. package/esm/component/axis/cartesian/interface/common.d.ts +1 -0
  193. package/esm/component/axis/cartesian/interface/common.js.map +1 -1
  194. package/esm/component/axis/polar/axis.js.map +1 -1
  195. package/esm/component/axis/polar/interface/spec.js.map +1 -1
  196. package/esm/component/data-zoom/data-filter-base-component.js +7 -6
  197. package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
  198. package/esm/component/data-zoom/util.js +11 -2
  199. package/esm/component/data-zoom/util.js.map +1 -1
  200. package/esm/component/geo/geo-coordinate.js +5 -2
  201. package/esm/component/geo/geo-coordinate.js.map +1 -1
  202. package/esm/component/interface/index.d.ts +0 -1
  203. package/esm/component/interface/index.js +0 -2
  204. package/esm/component/interface/index.js.map +1 -1
  205. package/esm/component/label/util.js +1 -1
  206. package/esm/component/label/util.js.map +1 -1
  207. package/esm/component/title/interface/spec.d.ts +3 -3
  208. package/esm/component/title/interface/spec.js.map +1 -1
  209. package/esm/component/tooltip/constant.d.ts +5 -4
  210. package/esm/component/tooltip/constant.js +6 -3
  211. package/esm/component/tooltip/constant.js.map +1 -1
  212. package/esm/component/tooltip/interface/common.d.ts +1 -1
  213. package/esm/component/tooltip/interface/common.js.map +1 -1
  214. package/esm/component/tooltip/interface/spec.d.ts +8 -0
  215. package/esm/component/tooltip/interface/spec.js.map +1 -1
  216. package/esm/component/tooltip/interface/theme.d.ts +2 -2
  217. package/esm/component/tooltip/interface/theme.js.map +1 -1
  218. package/esm/component/tooltip/processor/base.d.ts +3 -5
  219. package/esm/component/tooltip/processor/base.js +24 -28
  220. package/esm/component/tooltip/processor/base.js.map +1 -1
  221. package/esm/component/tooltip/processor/group-tooltip.js +1 -1
  222. package/esm/component/tooltip/processor/group-tooltip.js.map +1 -1
  223. package/esm/component/tooltip/processor/mark-tooltip.js +2 -2
  224. package/esm/component/tooltip/processor/mark-tooltip.js.map +1 -1
  225. package/esm/component/tooltip/tooltip-transformer.js +0 -1
  226. package/esm/component/tooltip/tooltip-transformer.js.map +1 -1
  227. package/esm/component/tooltip/tooltip.d.ts +9 -4
  228. package/esm/component/tooltip/tooltip.js +66 -54
  229. package/esm/component/tooltip/tooltip.js.map +1 -1
  230. package/esm/component/tooltip/utils/common.d.ts +6 -4
  231. package/esm/component/tooltip/utils/common.js +46 -5
  232. package/esm/component/tooltip/utils/common.js.map +1 -1
  233. package/esm/component/tooltip/utils/get-spec.d.ts +4 -4
  234. package/esm/component/tooltip/utils/get-spec.js +24 -80
  235. package/esm/component/tooltip/utils/get-spec.js.map +1 -1
  236. package/esm/component/tooltip/utils/get-value.d.ts +1 -2
  237. package/esm/component/tooltip/utils/get-value.js +1 -9
  238. package/esm/component/tooltip/utils/get-value.js.map +1 -1
  239. package/esm/component/tooltip/utils/index.d.ts +0 -1
  240. package/esm/component/tooltip/utils/index.js +0 -2
  241. package/esm/component/tooltip/utils/index.js.map +1 -1
  242. package/esm/constant/correlation.js +2 -1
  243. package/esm/constant/layout.js +1 -2
  244. package/esm/core/index.d.ts +1 -1
  245. package/esm/core/index.js +1 -1
  246. package/esm/core/index.js.map +1 -1
  247. package/esm/core/vchart.js +16 -15
  248. package/esm/core/vchart.js.map +1 -1
  249. package/esm/data/initialize.d.ts +1 -2
  250. package/esm/data/initialize.js +6 -7
  251. package/esm/data/initialize.js.map +1 -1
  252. package/esm/data/transforms/pie.d.ts +3 -0
  253. package/esm/data/transforms/pie.js +6 -3
  254. package/esm/data/transforms/pie.js.map +1 -1
  255. package/esm/model/interface.d.ts +14 -0
  256. package/esm/model/interface.js.map +1 -1
  257. package/esm/plugin/chart/media-query/media-query.d.ts +1 -0
  258. package/esm/plugin/chart/media-query/media-query.js +3 -1
  259. package/esm/plugin/chart/media-query/media-query.js.map +1 -1
  260. package/esm/plugin/chart/plugin-service.d.ts +2 -0
  261. package/esm/plugin/chart/plugin-service.js +5 -0
  262. package/esm/plugin/chart/plugin-service.js.map +1 -1
  263. package/esm/plugin/components/tooltip-handler/base.d.ts +1 -13
  264. package/esm/plugin/components/tooltip-handler/base.js +79 -212
  265. package/esm/plugin/components/tooltip-handler/base.js.map +1 -1
  266. package/esm/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js +1 -1
  267. package/esm/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +1 -1
  268. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.d.ts +0 -1
  269. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +6 -19
  270. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +1 -1
  271. package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.js +16 -14
  272. package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.js.map +1 -1
  273. package/esm/plugin/components/tooltip-handler/dom/model/title-model.js +2 -2
  274. package/esm/plugin/components/tooltip-handler/dom/model/title-model.js.map +1 -1
  275. package/esm/plugin/components/tooltip-handler/interface/style.d.ts +1 -2
  276. package/esm/plugin/components/tooltip-handler/interface/style.js.map +1 -1
  277. package/esm/plugin/components/tooltip-handler/utils/attribute.js +7 -7
  278. package/esm/plugin/components/tooltip-handler/utils/attribute.js.map +1 -1
  279. package/esm/plugin/components/tooltip-handler/utils/common.js.map +1 -1
  280. package/esm/plugin/components/tooltip-handler/utils/position.d.ts +3 -5
  281. package/esm/plugin/components/tooltip-handler/utils/position.js +20 -25
  282. package/esm/plugin/components/tooltip-handler/utils/position.js.map +1 -1
  283. package/esm/region/interface.d.ts +3 -1
  284. package/esm/region/interface.js.map +1 -1
  285. package/esm/series/base/base-series.js +4 -5
  286. package/esm/series/base/base-series.js.map +1 -1
  287. package/esm/series/base/tooltip-helper.d.ts +30 -6
  288. package/esm/series/base/tooltip-helper.js +85 -74
  289. package/esm/series/base/tooltip-helper.js.map +1 -1
  290. package/esm/series/box-plot/tooltip-helper.d.ts +2 -2
  291. package/esm/series/box-plot/tooltip-helper.js +26 -67
  292. package/esm/series/box-plot/tooltip-helper.js.map +1 -1
  293. package/esm/series/cartesian/cartesian.d.ts +1 -1
  294. package/esm/series/circle-packing/circle-packing.js +1 -2
  295. package/esm/series/circle-packing/circle-packing.js.map +1 -1
  296. package/esm/series/dot/tooltip-helper.d.ts +8 -2
  297. package/esm/series/dot/tooltip-helper.js +42 -41
  298. package/esm/series/dot/tooltip-helper.js.map +1 -1
  299. package/esm/series/funnel/funnel.d.ts +1 -0
  300. package/esm/series/funnel/funnel.js +7 -6
  301. package/esm/series/funnel/funnel.js.map +1 -1
  302. package/esm/series/funnel/interface.d.ts +3 -1
  303. package/esm/series/funnel/interface.js.map +1 -1
  304. package/esm/series/gauge/pointer-tooltip-helper.d.ts +2 -1
  305. package/esm/series/gauge/pointer-tooltip-helper.js +2 -9
  306. package/esm/series/gauge/pointer-tooltip-helper.js.map +1 -1
  307. package/esm/series/heatmap/tooltip-helper.d.ts +2 -3
  308. package/esm/series/heatmap/tooltip-helper.js +2 -6
  309. package/esm/series/heatmap/tooltip-helper.js.map +1 -1
  310. package/esm/series/interface/tooltip-helper.d.ts +5 -4
  311. package/esm/series/interface/tooltip-helper.js.map +1 -1
  312. package/esm/series/link/tooltip-helper.d.ts +5 -2
  313. package/esm/series/link/tooltip-helper.js +26 -27
  314. package/esm/series/link/tooltip-helper.js.map +1 -1
  315. package/esm/series/liquid/tooltip-helper.d.ts +4 -5
  316. package/esm/series/liquid/tooltip-helper.js +2 -22
  317. package/esm/series/liquid/tooltip-helper.js.map +1 -1
  318. package/esm/series/pie/pie.js +7 -3
  319. package/esm/series/pie/pie.js.map +1 -1
  320. package/esm/series/progress/linear/tooltip-helper.d.ts +2 -3
  321. package/esm/series/progress/linear/tooltip-helper.js +2 -11
  322. package/esm/series/progress/linear/tooltip-helper.js.map +1 -1
  323. package/esm/series/range-area/tooltip-helper.d.ts +1 -3
  324. package/esm/series/range-area/tooltip-helper.js +2 -50
  325. package/esm/series/range-area/tooltip-helper.js.map +1 -1
  326. package/esm/series/range-column/tooltip-helper.d.ts +1 -2
  327. package/esm/series/range-column/tooltip-helper.js +2 -19
  328. package/esm/series/range-column/tooltip-helper.js.map +1 -1
  329. package/esm/series/sankey/sankey.d.ts +1 -1
  330. package/esm/series/sankey/tooltip-helper.d.ts +3 -3
  331. package/esm/series/sankey/tooltip-helper.js +10 -57
  332. package/esm/series/sankey/tooltip-helper.js.map +1 -1
  333. package/esm/theme/builtin/common/series/linear-progress.js +4 -1
  334. package/esm/theme/builtin/common/series/linear-progress.js.map +1 -1
  335. package/esm/theme/builtin/dark/color-scheme.js +2 -1
  336. package/esm/theme/builtin/dark/color-scheme.js.map +1 -1
  337. package/esm/theme/builtin/light/color-scheme.js +2 -1
  338. package/esm/theme/builtin/light/color-scheme.js.map +1 -1
  339. package/esm/typings/spec/common.d.ts +3 -3
  340. package/esm/typings/spec/common.js.map +1 -1
  341. package/esm/typings/tooltip/position.d.ts +1 -0
  342. package/esm/typings/tooltip/position.js.map +1 -1
  343. package/esm/typings/tooltip/shape.d.ts +0 -1
  344. package/esm/typings/tooltip/shape.js.map +1 -1
  345. package/esm/typings/tooltip/tooltip.d.ts +7 -0
  346. package/esm/typings/tooltip/tooltip.js.map +1 -1
  347. package/package.json +17 -17
  348. package/cjs/component/interface/tooltip-helper.d.ts +0 -5
  349. package/cjs/component/interface/tooltip-helper.js +0 -6
  350. package/cjs/component/interface/tooltip-helper.js.map +0 -1
  351. package/cjs/component/tooltip/utils/compose.d.ts +0 -4
  352. package/cjs/component/tooltip/utils/compose.js +0 -120
  353. package/cjs/component/tooltip/utils/compose.js.map +0 -1
  354. package/cjs/model/tooltip-helper.d.ts +0 -29
  355. package/cjs/model/tooltip-helper.js +0 -19
  356. package/cjs/model/tooltip-helper.js.map +0 -1
  357. package/esm/component/interface/tooltip-helper.d.ts +0 -5
  358. package/esm/component/interface/tooltip-helper.js +0 -2
  359. package/esm/component/interface/tooltip-helper.js.map +0 -1
  360. package/esm/component/tooltip/utils/compose.d.ts +0 -4
  361. package/esm/component/tooltip/utils/compose.js +0 -105
  362. package/esm/component/tooltip/utils/compose.js.map +0 -1
  363. package/esm/model/tooltip-helper.d.ts +0 -29
  364. package/esm/model/tooltip-helper.js +0 -11
  365. package/esm/model/tooltip-helper.js.map +0 -1
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.registerDomTooltipHandler = exports.DomTooltipHandler = void 0;
6
6
 
7
- const base_1 = require("../base"), utils_1 = require("./utils"), tooltip_model_1 = require("./model/tooltip-model"), constants_1 = require("../constants"), vutils_1 = require("@visactor/vutils"), env_1 = require("../../../../util/env"), register_1 = require("../../register"), constant_1 = require("./constant"), constant_2 = require("../../../../component/tooltip/constant");
7
+ const base_1 = require("../base"), utils_1 = require("./utils"), tooltip_model_1 = require("./model/tooltip-model"), constants_1 = require("../constants"), env_1 = require("../../../../util/env"), register_1 = require("../../register"), constant_1 = require("./constant"), constant_2 = require("../../../../component/tooltip/constant");
8
8
 
9
9
  class DomTooltipHandler extends base_1.BaseTooltipHandler {
10
10
  getVisibility() {
@@ -45,24 +45,19 @@ class DomTooltipHandler extends base_1.BaseTooltipHandler {
45
45
  }
46
46
  _updateTooltip(visible, params) {
47
47
  var _a, _b;
48
- const {tooltipActual: tooltipActual, tooltipSpec: tooltipSpec} = params;
49
48
  if (visible && this.model) {
50
- if (!params.changePositionOnly) {
51
- this._tooltipActual = tooltipActual, this._initStyle();
52
- const firstInit = !this.model.product;
53
- this.model.initAll(), firstInit && this._initEvent(this.model.product), this.model.setStyle(),
54
- this.model.setContent();
55
- }
56
- this.setVisibility(visible);
49
+ const {tooltipSpec: tooltipSpec, activeTooltipSpec: activeTooltipSpec} = params;
50
+ params.changePositionOnly || (this._tooltipActual = activeTooltipSpec, this._initStyle(),
51
+ this.model.initAll(), this.model.setStyle(), this.model.setContent()), this.setVisibility(visible);
57
52
  const el = this.model.product;
58
53
  if (el) {
59
- const {x: x = 0, y: y = 0} = null !== (_a = tooltipActual.position) && void 0 !== _a ? _a : {};
54
+ const {x: x = 0, y: y = 0} = null !== (_a = activeTooltipSpec.position) && void 0 !== _a ? _a : {};
60
55
  if (tooltipSpec.updateElement) {
61
56
  this._updatePosition(null !== (_b = this._cacheCustomTooltipPosition) && void 0 !== _b ? _b : {
62
57
  x: x,
63
58
  y: y
64
- }), tooltipSpec.updateElement(el, tooltipActual, params);
65
- const position = this._getActualTooltipPosition(tooltipActual, params, {
59
+ }), tooltipSpec.updateElement(el, activeTooltipSpec, params);
60
+ const position = this._getActualTooltipPosition(activeTooltipSpec, params, {
66
61
  width: el.offsetWidth,
67
62
  height: el.offsetHeight
68
63
  });
@@ -91,13 +86,6 @@ class DomTooltipHandler extends base_1.BaseTooltipHandler {
91
86
  const el = this.model.product;
92
87
  el && (el.style.transform = `translate3d(${x}px, ${y}px, 0)`);
93
88
  }
94
- _initEvent(el) {
95
- el.addEventListener("pointerleave", (event => {
96
- const {renderMode: renderMode, enterable: enterable} = this._component.getSpec(), relatedTarget = event.relatedTarget;
97
- "html" === renderMode && enterable && ((0, vutils_1.isNil)(relatedTarget) || relatedTarget !== this._compiler.getCanvas() && !(0,
98
- vutils_1.hasParentElement)(relatedTarget, this.getTooltipContainer())) && this._component.hideTooltip();
99
- }));
100
- }
101
89
  }
102
90
 
103
91
  exports.DomTooltipHandler = DomTooltipHandler, DomTooltipHandler.type = constant_2.TooltipHandlerType.dom;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/dom-tooltip-handler.ts"],"names":[],"mappings":";;;AACA,kCAA6C;AAC7C,mCAAuC;AAEvC,yDAAqD;AACrD,4CAA+D;AAC/D,6CAAuE;AACvE,8CAAmD;AAGnD,6CAAyD;AACzD,yCAAqD;AAErD,qEAA4E;AAK5E,MAAa,iBAAkB,SAAQ,yBAAkB;IAcvD,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;QACE,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAxBvB,SAAI,GAAG,6BAAkB,CAAC,GAAG,CAAC;QAE7B,sBAAiB,GAAG,iBAAW,aAAX,iBAAW,uBAAX,iBAAW,CAAE,IAAI,CAAC;IAuBhD,CAAC;IAED,KAAK,CAAC,OAAqC;QACzC,KAAK,CAAC,KAA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AEN,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;SACvD;IACH,CAAC;IAES,UAAU,CAAC,EAAe;QAClC,EAAE,CAAC,gBAAgB,CAAC,cAAc,EAAE,KAAK,CAAC,EAAE;YAC1C,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC5D,MAAM,aAAa,GAAG,KAAK,CAAC,aAA4B,CAAC;YACzD,IAAI,UAAU,KAAK,MAAM,IAAI,SAAS,EAAE;gBACtC,IAEE,IAAA,cAAK,EAAC,aAAa,CAAC;oBACpB,CAAC,aAAa,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;wBAC3C,CAAC,IAAA,yBAAgB,EAAC,aAAa,EAAE,IAAI,CAAC,mBAAmB,EAAiB,CAAC,CAAC,EAC9E;oBACA,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;iBAC/B;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC;;AA5JH,8CA6JC;AA5JiB,sBAAI,GAAG,6BAAkB,CAAC,GAAG,CAAC;AA8JzC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,IAAA,kCAAuB,EAAC,iBAAiB,CAAC,CAAC;AAC7C,CAAC,CAAC;AAFW,QAAA,yBAAyB,6BAEpC","file":"dom-tooltip-handler.js","sourcesContent":["import type { ITooltipActual, ITooltipPositionActual } from '../../../../typings/tooltip';\nimport { BaseTooltipHandler } from '../base';\nimport { getDomStyles } from './utils';\nimport type { IDomTooltipStyle } from './interface';\nimport { TooltipModel } from './model/tooltip-model';\nimport { TOOLTIP_CONTAINER_EL_CLASS_NAME } from '../constants';\nimport { hasParentElement, isNil, type Maybe } from '@visactor/vutils';\nimport { domDocument } from '../../../../util/env';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../../../component/tooltip';\nimport type { IComponentPluginService } from '../../interface';\nimport { registerComponentPlugin } from '../../register';\nimport { DEFAULT_TOOLTIP_Z_INDEX } from './constant';\nimport type { ILayoutPoint } from '../../../../typings';\nimport { TooltipHandlerType } from '../../../../component/tooltip/constant';\n\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n static readonly type = TooltipHandlerType.dom;\n readonly 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 /** 自定义 tooltip 的位置缓存 */\n protected _cacheCustomTooltipPosition: ILayoutPoint;\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() {\n super(DomTooltipHandler.type);\n }\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement && parentElement.children && parentElement.children.length) {\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.style.zIndex = DEFAULT_TOOLTIP_Z_INDEX;\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n this.model = new TooltipModel(\n {\n valueToHtml: this._option.sanitize,\n getTooltipStyle: () => this._domStyle,\n getTooltipActual: () => this._tooltipActual,\n getTooltipAttributes: () => this._attributes,\n getContainer: () => this._container\n },\n [tooltipSpec.className],\n this.name\n );\n }\n }\n\n protected _removeTooltip() {\n this.model?.release();\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n const { tooltipActual, tooltipSpec } = params;\n if (!visible || !this.model) {\n this.setVisibility(visible);\n this._cacheCustomTooltipPosition = undefined;\n } else {\n if (!params.changePositionOnly) {\n this._tooltipActual = tooltipActual;\n this._initStyle();\n\n const firstInit = !this.model.product;\n this.model.initAll();\n if (firstInit) {\n this._initEvent(this.model.product);\n }\n this.model.setStyle();\n this.model.setContent();\n }\n this.setVisibility(visible);\n\n // 位置\n const el = this.model.product;\n if (el) {\n const { x = 0, y = 0 } = tooltipActual.position ?? {};\n if (tooltipSpec.updateElement) {\n // 此处先设定一次位置,防止页面暂时出现滚动条(优先设置上次的位置)\n this._updatePosition(this._cacheCustomTooltipPosition ?? { x, y });\n // 更新 tooltip dom\n tooltipSpec.updateElement(el, tooltipActual, params);\n // 重新计算 tooltip 位置\n const position = this._getActualTooltipPosition(tooltipActual, params, {\n width: el.offsetWidth,\n height: el.offsetHeight\n });\n // 更新位置\n this._updatePosition(position);\n // 更新缓存\n this._cacheCustomTooltipPosition = position;\n } else {\n this._updatePosition({ x, y });\n }\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 protected _updatePosition({ x, y }: ITooltipPositionActual) {\n const el = this.model.product;\n if (el) {\n // translate3d 性能较好:https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n el.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n\n protected _initEvent(el: HTMLElement) {\n el.addEventListener('pointerleave', event => {\n const { renderMode, enterable } = this._component.getSpec();\n const relatedTarget = event.relatedTarget as HTMLElement;\n if (renderMode === 'html' && enterable) {\n if (\n // 判断用户鼠标是否从 tooltip 内部直接滑入非图表区域\n isNil(relatedTarget) ||\n (relatedTarget !== this._compiler.getCanvas() &&\n !hasParentElement(relatedTarget, this.getTooltipContainer() as HTMLElement))\n ) {\n this._component.hideTooltip();\n }\n }\n });\n }\n}\n\nexport const registerDomTooltipHandler = () => {\n registerComponentPlugin(DomTooltipHandler);\n};\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/dom-tooltip-handler.ts"],"names":[],"mappings":";;;AACA,kCAA6C;AAC7C,mCAAuC;AAEvC,yDAAqD;AACrD,4CAA+D;AAE/D,8CAAmD;AAGnD,6CAAyD;AACzD,yCAAqD;AAErD,qEAA4E;AAK5E,MAAa,iBAAkB,SAAQ,yBAAkB;IAcvD,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;QACE,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAxBvB,SAAI,GAAG,6BAAkB,CAAC,GAAG,CAAC;QAE7B,sBAAiB,GAAG,iBAAW,aAAX,iBAAW,uBAAX,iBAAW,CAAE,IAAI,CAAC;IAuBhD,CAAC;IAED,KAAK,CAAC,OAAqC;QACzC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAED,MAAM;QACJ,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAkB,CAAC;QAC9D,MAAM,aAAa,GAAG,WAAW,CAAC,aAAgD,CAAC;QACnF,IAAI,iBAAW,IAAI,aAAa,IAAI,aAAa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B,MAAM,EAAE,EAAE,CAAC,YAAY;qBACxB,CAAC,CAAC;oBAEH,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;oBAE/B,IAAI,CAAC,2BAA2B,GAAG,QAAQ,CAAC;iBAC7C;qBAAM;oBACL,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;iBAChC;aACF;SACF;IACH,CAAC;IAES,UAAU;QAClB,IAAI,CAAC,SAAS,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;IAES,iBAAiB,CAAC,IAAkB;;QAC5C,OAAO,MAAA,IAAI,CAAC,UAAU,mCAAI,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;IAC9B,CAAC;IAED,MAAM;QACJ,KAAK,CAAC,MAAM,EAAE,CAAC;QACf,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAES,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,EAA0B;QACxD,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,EAAE,EAAE;YAEN,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;SACvD;IACH,CAAC;;AAxIH,8CAyIC;AAxIiB,sBAAI,GAAG,6BAAkB,CAAC,GAAG,CAAC;AA0IzC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,IAAA,kCAAuB,EAAC,iBAAiB,CAAC,CAAC;AAC7C,CAAC,CAAC;AAFW,QAAA,yBAAyB,6BAEpC","file":"dom-tooltip-handler.js","sourcesContent":["import type { ITooltipActual, ITooltipPositionActual } from '../../../../typings/tooltip';\nimport { BaseTooltipHandler } from '../base';\nimport { getDomStyles } from './utils';\nimport type { IDomTooltipStyle } from './interface';\nimport { TooltipModel } from './model/tooltip-model';\nimport { TOOLTIP_CONTAINER_EL_CLASS_NAME } from '../constants';\nimport { type Maybe } from '@visactor/vutils';\nimport { domDocument } from '../../../../util/env';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../../../component/tooltip';\nimport type { IComponentPluginService } from '../../interface';\nimport { registerComponentPlugin } from '../../register';\nimport { DEFAULT_TOOLTIP_Z_INDEX } from './constant';\nimport type { ILayoutPoint } from '../../../../typings';\nimport { TooltipHandlerType } from '../../../../component/tooltip/constant';\n\n/**\n * The tooltip handler class.\n */\nexport class DomTooltipHandler extends BaseTooltipHandler {\n static readonly type = TooltipHandlerType.dom;\n readonly 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 /** 自定义 tooltip 的位置缓存 */\n protected _cacheCustomTooltipPosition: ILayoutPoint;\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() {\n super(DomTooltipHandler.type);\n }\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n this._initStyle();\n this.initEl();\n }\n\n initEl() {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const parentElement = tooltipSpec.parentElement as HTMLElement | HTMLCanvasElement;\n if (domDocument && parentElement && parentElement.children && parentElement.children.length) {\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.style.zIndex = DEFAULT_TOOLTIP_Z_INDEX;\n this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME);\n parentElement.appendChild(this._container);\n }\n this.model = new TooltipModel(\n {\n valueToHtml: this._option.sanitize,\n getTooltipStyle: () => this._domStyle,\n getTooltipActual: () => this._tooltipActual,\n getTooltipAttributes: () => this._attributes,\n getContainer: () => this._container\n },\n [tooltipSpec.className],\n this.name\n );\n }\n }\n\n protected _removeTooltip() {\n this.model?.release();\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n if (!visible || !this.model) {\n this.setVisibility(visible);\n this._cacheCustomTooltipPosition = undefined;\n } else {\n const { tooltipSpec, activeTooltipSpec } = params;\n\n if (!params.changePositionOnly) {\n this._tooltipActual = activeTooltipSpec;\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 el = this.model.product;\n if (el) {\n const { x = 0, y = 0 } = activeTooltipSpec.position ?? {};\n if (tooltipSpec.updateElement) {\n // 此处先设定一次位置,防止页面暂时出现滚动条(优先设置上次的位置)\n this._updatePosition(this._cacheCustomTooltipPosition ?? { x, y });\n // 更新 tooltip dom\n tooltipSpec.updateElement(el, activeTooltipSpec, params);\n // 重新计算 tooltip 位置\n const position = this._getActualTooltipPosition(activeTooltipSpec, params, {\n width: el.offsetWidth,\n height: el.offsetHeight\n });\n // 更新位置\n this._updatePosition(position);\n // 更新缓存\n this._cacheCustomTooltipPosition = position;\n } else {\n this._updatePosition({ x, y });\n }\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 protected _updatePosition({ x, y }: ITooltipPositionActual) {\n const el = this.model.product;\n if (el) {\n // translate3d 性能较好:https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n el.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n}\n\nexport const registerDomTooltipHandler = () => {\n registerComponentPlugin(DomTooltipHandler);\n};\n"]}
@@ -39,9 +39,9 @@ class ContentColumnModel extends base_tooltip_model_1.BaseTooltipModel {
39
39
  var _a, _b, _c, _d;
40
40
  const tooltipStyle = this._option.getTooltipStyle();
41
41
  super.setStyle((0, vutils_extension_1.mergeSpec)({}, style_constants_1.defaultContentColumnStyle, tooltipStyle.content, this._getContentColumnStyle()));
42
- const renderContent = null !== (_b = null === (_a = this._option.getTooltipActual()) || void 0 === _a ? void 0 : _a.content) && void 0 !== _b ? _b : [], contentAttributes = null !== (_d = null === (_c = this._option.getTooltipAttributes()) || void 0 === _c ? void 0 : _c.content) && void 0 !== _d ? _d : [], getKeyItemStyle = (line, i) => {
42
+ const renderContent = null !== (_b = null === (_a = this._option.getTooltipActual()) || void 0 === _a ? void 0 : _a.content) && void 0 !== _b ? _b : [], contentAttributes = null !== (_d = null === (_c = this._option.getTooltipAttributes()) || void 0 === _c ? void 0 : _c.content) && void 0 !== _d ? _d : [], getKeyItemStyle = (line, attrs, i) => {
43
43
  var _a, _b;
44
- const {key: key, isKeyAdaptive: isKeyAdaptive} = line, {height: height} = contentAttributes[i], {keyColumn: keyColumn} = tooltipStyle, style = (0,
44
+ const {key: key, isKeyAdaptive: isKeyAdaptive} = line, {height: height} = attrs, {keyColumn: keyColumn} = tooltipStyle, style = (0,
45
45
  vutils_extension_1.mergeSpec)({}, isKeyAdaptive ? style_constants_1.defaultAdaptiveKeyStyle : style_constants_1.defaultKeyStyle, Object.assign(Object.assign(Object.assign({
46
46
  height: (0, utils_1.getPixelPropertyStr)(height)
47
47
  }, defaultLabelStyle), keyColumn.common), null === (_a = keyColumn.items) || void 0 === _a ? void 0 : _a[i]));
@@ -49,40 +49,42 @@ class ContentColumnModel extends base_tooltip_model_1.BaseTooltipModel {
49
49
  vutils_1.isNumber)(key) || style.visibility ? style.visibility = "visible" : style.visibility = "hidden",
50
50
  style;
51
51
  };
52
- renderContent.forEach(((line, i) => {
52
+ contentAttributes.forEach(((attrs, i) => {
53
53
  var _a;
54
- "key-box" === this.className ? this.children[i].setStyle(getKeyItemStyle(line, i)) : "value-box" === this.className ? this.children[i].setStyle(((line, i) => {
54
+ const line = renderContent[i];
55
+ "key-box" === this.className ? this.children[i].setStyle(getKeyItemStyle(line, attrs, i)) : "value-box" === this.className ? this.children[i].setStyle(((line, attrs, i) => {
55
56
  var _a;
56
- const {height: height} = contentAttributes[i], {valueColumn: valueColumn} = tooltipStyle;
57
+ const {height: height} = attrs, {valueColumn: valueColumn} = tooltipStyle;
57
58
  return (0, vutils_extension_1.mergeSpec)({}, style_constants_1.defaultValueStyle, Object.assign(Object.assign(Object.assign({
58
59
  height: (0, utils_1.getPixelPropertyStr)(height)
59
60
  }, defaultLabelStyle), valueColumn.common), null === (_a = valueColumn.items) || void 0 === _a ? void 0 : _a[i]));
60
- })(0, i)) : "shape-box" === this.className && (null === (_a = this.children[i]) || void 0 === _a || _a.setStyle(((line, i) => {
61
+ })(0, attrs, i)) : "shape-box" === this.className && (null === (_a = this.children[i]) || void 0 === _a || _a.setStyle(((line, attrs, i) => {
61
62
  var _a, _b, _c, _d;
62
- const {height: height} = contentAttributes[i], {shapeColumn: shapeColumn} = tooltipStyle, keyStyle = getKeyItemStyle(line, i), paddingTop = `calc((${null !== (_b = null !== (_a = keyStyle.lineHeight) && void 0 !== _a ? _a : keyStyle.fontSize) && void 0 !== _b ? _b : "18px"} - ${null !== (_c = shapeColumn.width) && void 0 !== _c ? _c : "8px"}) / 2)`;
63
+ const {height: height} = attrs, {shapeColumn: shapeColumn} = tooltipStyle, keyStyle = getKeyItemStyle(line, attrs, i), paddingTop = `calc((${null !== (_b = null !== (_a = keyStyle.lineHeight) && void 0 !== _a ? _a : keyStyle.fontSize) && void 0 !== _b ? _b : "18px"} - ${null !== (_c = shapeColumn.width) && void 0 !== _c ? _c : "8px"}) / 2)`;
63
64
  return (0, vutils_extension_1.mergeSpec)({}, style_constants_1.defaultShapeStyle, Object.assign(Object.assign({
64
65
  height: (0, utils_1.getPixelPropertyStr)(height),
65
66
  paddingTop: paddingTop
66
67
  }, shapeColumn.common), null === (_d = shapeColumn.items) || void 0 === _d ? void 0 : _d[i]));
67
- })(line, i), this._getShapeSvgOption(line, i)));
68
+ })(line, attrs, i), this._getShapeSvgOption(line, i)));
68
69
  }));
69
70
  }
70
71
  setContent() {
71
72
  var _a, _b, _c, _d;
72
- const renderContent = null !== (_b = null === (_a = this._option.getTooltipActual()) || void 0 === _a ? void 0 : _a.content) && void 0 !== _b ? _b : [], contentAttributes = null !== (_d = null === (_c = this._option.getTooltipAttributes()) || void 0 === _c ? void 0 : _c.content) && void 0 !== _d ? _d : [];
73
- renderContent.forEach(((line, i) => {
73
+ const renderContent = null !== (_b = null === (_a = this._option.getTooltipActual()) || void 0 === _a ? void 0 : _a.content) && void 0 !== _b ? _b : [];
74
+ (null !== (_d = null === (_c = this._option.getTooltipAttributes()) || void 0 === _c ? void 0 : _c.content) && void 0 !== _d ? _d : []).forEach(((attributes, i) => {
74
75
  var _a, _b, _c, _d, _e, _f, _g;
75
76
  let childContent;
77
+ const line = renderContent[i];
76
78
  if ("key-box" === this.className) {
77
79
  const keyContent = line.key;
78
80
  childContent = (0, vutils_1.isString)(keyContent) && "" !== (null === (_a = null == keyContent ? void 0 : keyContent.trim) || void 0 === _a ? void 0 : _a.call(keyContent)) || (0,
79
81
  vutils_1.isNumber)(keyContent) ? keyContent : constants_1.TOOLTIP_EMPTY_STRING,
80
- null === (_b = this.children[i]) || void 0 === _b || _b.setContent(childContent, null === (_c = contentAttributes[i].key) || void 0 === _c ? void 0 : _c.multiLine);
82
+ null === (_b = this.children[i]) || void 0 === _b || _b.setContent(childContent, null === (_c = attributes.key) || void 0 === _c ? void 0 : _c.multiLine);
81
83
  } else if ("value-box" === this.className) {
82
84
  const valueContent = line.value;
83
85
  childContent = (0, vutils_1.isString)(valueContent) && "" !== (null === (_d = null == valueContent ? void 0 : valueContent.trim) || void 0 === _d ? void 0 : _d.call(valueContent)) || (0,
84
86
  vutils_1.isNumber)(valueContent) ? valueContent : constants_1.TOOLTIP_EMPTY_STRING,
85
- null === (_e = this.children[i]) || void 0 === _e || _e.setContent(childContent, null === (_f = contentAttributes[i].value) || void 0 === _f ? void 0 : _f.multiLine);
87
+ null === (_e = this.children[i]) || void 0 === _e || _e.setContent(childContent, null === (_f = attributes.value) || void 0 === _f ? void 0 : _f.multiLine);
86
88
  } else "shape-box" === this.className && (childContent = this._getShapeSvgOption(line, i),
87
89
  null === (_g = this.children[i]) || void 0 === _g || _g.setContent(childContent));
88
90
  }));
@@ -105,13 +107,13 @@ class ContentColumnModel extends base_tooltip_model_1.BaseTooltipModel {
105
107
  }
106
108
  }
107
109
  _getShapeSvgOption(line, index) {
108
- var _a, _b;
110
+ var _a;
109
111
  const tooltipStyle = this._option.getTooltipStyle(), shapeColumn = Object.assign(Object.assign({}, tooltipStyle.shapeColumn), null === (_a = tooltipStyle.shapeColumn.items) || void 0 === _a ? void 0 : _a[index]);
110
112
  return {
111
113
  hasShape: line.hasShape,
112
114
  symbolType: line.shapeType,
113
115
  size: shapeColumn.width,
114
- fill: null !== (_b = line.shapeFill) && void 0 !== _b ? _b : line.shapeColor,
116
+ fill: line.shapeFill,
115
117
  stroke: line.shapeStroke,
116
118
  lineWidth: line.shapeLineWidth,
117
119
  hollow: line.shapeHollow,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/model/content-column-model.ts"],"names":[],"mappings":";;;AAAA,6CAAgE;AAChE,uDAM2B;AAC3B,6DAAwD;AAIxD,+CAA2C;AAC3C,6CAAyC;AACzC,+CAAuD;AACvD,oCAA+C;AAE/C,iEAAuD;AAKvD,MAAM,iBAAiB,GAAiC;IACtD,YAAY,EAAE,QAAQ;IACtB,QAAQ,EAAE,QAAQ;CACnB,CAAC;AAEF,MAAa,kBAAmB,SAAQ,qCAAgB;IAGtD,YACE,MAAsC,EACtC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AAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,SAAS,CAAC;oBACvF,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE;oBACrB,CAAC,CAAC,EAAE,CAAC,EACP;YACJ,KAAK,SAAS;gBACZ,OAAO,YAAY,CAAC,SAAS,CAAC;YAChC,KAAK,WAAW;gBACd,OAAO,YAAY,CAAC,WAAW,CAAC;SACnC;IACH,CAAC;IAES,kBAAkB,CAAC,IAAwB,EAAE,KAAa;;QAClE,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;QACpD,MAAM,WAAW,mCACZ,YAAY,CAAC,WAAW,GACxB,MAAA,YAAY,CAAC,WAAW,CAAC,KAAK,0CAAG,KAAK,CAAC,CAC3C,CAAC;QACF,OAAO;YACL,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,IAAI,EAAE,WAAW,CAAC,KAAK;YACvB,IAAI,EAAE,MAAA,IAAI,CAAC,SAAS,mCAAI,IAAI,CAAC,UAAU;YACvC,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,SAAS,EAAE,IAAI,CAAC,cAAc;YAC9B,MAAM,EAAE,IAAI,CAAC,WAAW;YACxB,KAAK;SACa,CAAC;IACvB,CAAC;CACF;AA1LD,gDA0LC","file":"content-column-model.js","sourcesContent":["import { isNumber, isString, toNumber } from '@visactor/vutils';\nimport {\n defaultKeyStyle,\n defaultContentColumnStyle,\n defaultValueStyle,\n defaultAdaptiveKeyStyle,\n defaultShapeStyle\n} from './style-constants';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport type { ITooltipModelOption } from './interface';\nimport type { IShapeSvgOption } from './shape-model';\n// eslint-disable-next-line no-duplicate-imports\nimport { ShapeModel } from './shape-model';\nimport { TextModel } from './text-model';\nimport { TOOLTIP_EMPTY_STRING } from '../../constants';\nimport { getPixelPropertyStr } from '../utils';\nimport type { ITooltipLineActual } from '../../../../../typings';\nimport { mergeSpec } from '@visactor/vutils-extension';\n\nexport type ContentColumnType = 'shape-box' | 'key-box' | 'value-box';\n\n/** 默认的标签样式,覆盖外界对这些属性的预先配置 */\nconst defaultLabelStyle: Partial<CSSStyleDeclaration> = {\n overflowWrap: 'normal',\n wordWrap: 'normal'\n};\n\nexport class ContentColumnModel extends BaseTooltipModel {\n readonly className: ContentColumnType;\n\n constructor(\n parent: BaseTooltipModel | HTMLElement,\n option: ITooltipModelOption,\n className: ContentColumnType,\n childIndex?: number\n ) {\n super(parent, option, childIndex);\n this.className = className;\n }\n\n init(): void {\n if (!this.product) {\n this.product = this.createElement('div', [this.className]);\n }\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n\n if (this.className === 'shape-box' && !renderContent.some(c => c.hasShape && c.shapeType)) {\n // 当有一行配有形状的时候,其他行要对齐。如果没有一行配有形状,则删除所有的行\n Object.keys(this.children).forEach(key => {\n const i = toNumber(key);\n this.children[i].release();\n delete this.children[i];\n });\n } else {\n // 删除多余的行\n Object.keys(this.children).forEach(key => {\n const i = toNumber(key);\n if (i >= renderContent.length) {\n this.children[i].release();\n delete this.children[i];\n }\n });\n // 新增没有的行\n for (let i = 0; i < renderContent.length; i++) {\n if (!this.children[i]) {\n if (this.className === 'key-box' || this.className === 'value-box') {\n const text = new TextModel(this.product!, this._option, i);\n text.init([this.className.substring(0, this.className.indexOf('-'))], undefined, 'div');\n this.children[i] = text;\n } else if (this.className === 'shape-box') {\n const shape = new ShapeModel(this.product!, this._option, i);\n shape.init(['shape'], undefined, 'div');\n this.children[i] = shape;\n }\n }\n }\n }\n }\n\n setStyle() {\n const tooltipStyle = this._option.getTooltipStyle();\n\n super.setStyle(mergeSpec({}, defaultContentColumnStyle, tooltipStyle.content, this._getContentColumnStyle()));\n\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];\n\n const getKeyItemStyle = (line: ITooltipLineActual, i: number): Partial<CSSStyleDeclaration> => {\n const { key, isKeyAdaptive } = line;\n const { height } = contentAttributes[i];\n const { keyColumn } = tooltipStyle;\n const style: Partial<CSSStyleDeclaration> = mergeSpec(\n {},\n isKeyAdaptive ? defaultAdaptiveKeyStyle : defaultKeyStyle,\n {\n height: getPixelPropertyStr(height),\n ...defaultLabelStyle,\n ...keyColumn.common,\n ...keyColumn.items?.[i]\n } as Partial<CSSStyleDeclaration>\n );\n const hasContent = (isString(key) && key?.trim?.() !== '') || isNumber(key);\n if (!hasContent && !style.visibility) {\n style.visibility = 'hidden';\n } else {\n style.visibility = 'visible';\n }\n return style;\n };\n\n const getValueItemStyle = (line: ITooltipLineActual, i: number): Partial<CSSStyleDeclaration> => {\n const { height } = contentAttributes[i];\n const { valueColumn } = tooltipStyle;\n const style: Partial<CSSStyleDeclaration> = mergeSpec({}, defaultValueStyle, {\n height: getPixelPropertyStr(height),\n ...defaultLabelStyle,\n ...valueColumn.common,\n ...valueColumn.items?.[i]\n } as Partial<CSSStyleDeclaration>);\n return style;\n };\n\n const getShapeItemStyle = (line: ITooltipLineActual, i: number): Partial<CSSStyleDeclaration> => {\n const { height } = contentAttributes[i];\n const { shapeColumn } = tooltipStyle;\n const keyStyle = getKeyItemStyle(line, i);\n const paddingTop = `calc((${keyStyle.lineHeight ?? keyStyle.fontSize ?? '18px'} - ${\n shapeColumn.width ?? '8px'\n }) / 2)`; // shape 和 key 的第一行文字对齐\n const style: Partial<CSSStyleDeclaration> = mergeSpec({}, defaultShapeStyle, {\n height: getPixelPropertyStr(height),\n paddingTop,\n ...shapeColumn.common,\n ...shapeColumn.items?.[i]\n } as Partial<CSSStyleDeclaration>);\n return style;\n };\n\n renderContent.forEach((line, i) => {\n if (this.className === 'key-box') {\n (this.children[i] as TextModel).setStyle(getKeyItemStyle(line, i));\n } else if (this.className === 'value-box') {\n (this.children[i] as TextModel).setStyle(getValueItemStyle(line, i));\n } else if (this.className === 'shape-box') {\n (this.children[i] as ShapeModel)?.setStyle(getShapeItemStyle(line, i), this._getShapeSvgOption(line, i));\n }\n });\n }\n\n setContent(): void {\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];\n renderContent.forEach((line, i) => {\n let childContent: any;\n if (this.className === 'key-box') {\n const keyContent = line.key;\n if ((isString(keyContent) && keyContent?.trim?.() !== '') || isNumber(keyContent)) {\n childContent = keyContent;\n } else {\n childContent = TOOLTIP_EMPTY_STRING;\n }\n (this.children[i] as TextModel)?.setContent(childContent, contentAttributes[i].key?.multiLine);\n } else if (this.className === 'value-box') {\n const valueContent = line.value;\n if ((isString(valueContent) && valueContent?.trim?.() !== '') || isNumber(valueContent)) {\n childContent = valueContent;\n } else {\n childContent = TOOLTIP_EMPTY_STRING;\n }\n (this.children[i] as TextModel)?.setContent(childContent, contentAttributes[i].value?.multiLine);\n } else if (this.className === 'shape-box') {\n childContent = this._getShapeSvgOption(line, i);\n this.children[i]?.setContent(childContent);\n }\n });\n }\n\n protected _getContentColumnStyle() {\n const tooltipStyle = this._option.getTooltipStyle();\n\n switch (this.className) {\n case 'shape-box':\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n return {\n ...tooltipStyle.shapeColumn,\n ...(this.className === 'shape-box' && !renderContent.some(c => c.hasShape && c.shapeType)\n ? { display: 'none' }\n : {})\n };\n case 'key-box':\n return tooltipStyle.keyColumn;\n case 'value-box':\n return tooltipStyle.valueColumn;\n }\n }\n\n protected _getShapeSvgOption(line: ITooltipLineActual, index: number): IShapeSvgOption {\n const tooltipStyle = this._option.getTooltipStyle();\n const shapeColumn = {\n ...tooltipStyle.shapeColumn,\n ...tooltipStyle.shapeColumn.items?.[index]\n };\n return {\n hasShape: line.hasShape,\n symbolType: line.shapeType,\n size: shapeColumn.width,\n fill: line.shapeFill ?? line.shapeColor,\n stroke: line.shapeStroke,\n lineWidth: line.shapeLineWidth,\n hollow: line.shapeHollow,\n index\n } as IShapeSvgOption;\n }\n}\n"]}
1
+ {"version":3,"sources":["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0MC","file":"content-column-model.js","sourcesContent":["import { isNumber, isString, toNumber } from '@visactor/vutils';\nimport {\n defaultKeyStyle,\n defaultContentColumnStyle,\n defaultValueStyle,\n defaultAdaptiveKeyStyle,\n defaultShapeStyle\n} from './style-constants';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport type { ITooltipModelOption } from './interface';\nimport type { IShapeSvgOption } from './shape-model';\n// eslint-disable-next-line no-duplicate-imports\nimport { ShapeModel } from './shape-model';\nimport { TextModel } from './text-model';\nimport { TOOLTIP_EMPTY_STRING } from '../../constants';\nimport { getPixelPropertyStr } from '../utils';\nimport type { ITooltipLineActual } from '../../../../../typings';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport type { TooltipRowAttrs } from '@visactor/vrender-components';\n\nexport type ContentColumnType = 'shape-box' | 'key-box' | 'value-box';\n\n/** 默认的标签样式,覆盖外界对这些属性的预先配置 */\nconst defaultLabelStyle: Partial<CSSStyleDeclaration> = {\n overflowWrap: 'normal',\n wordWrap: 'normal'\n};\n\nexport class ContentColumnModel extends BaseTooltipModel {\n readonly className: ContentColumnType;\n\n constructor(\n parent: BaseTooltipModel | HTMLElement,\n option: ITooltipModelOption,\n className: ContentColumnType,\n childIndex?: number\n ) {\n super(parent, option, childIndex);\n this.className = className;\n }\n\n init(): void {\n if (!this.product) {\n this.product = this.createElement('div', [this.className]);\n }\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n\n if (this.className === 'shape-box' && !renderContent.some(c => c.hasShape && c.shapeType)) {\n // 当有一行配有形状的时候,其他行要对齐。如果没有一行配有形状,则删除所有的行\n Object.keys(this.children).forEach(key => {\n const i = toNumber(key);\n this.children[i].release();\n delete this.children[i];\n });\n } else {\n // 删除多余的行\n Object.keys(this.children).forEach(key => {\n const i = toNumber(key);\n if (i >= renderContent.length) {\n this.children[i].release();\n delete this.children[i];\n }\n });\n // 新增没有的行\n for (let i = 0; i < renderContent.length; i++) {\n if (!this.children[i]) {\n if (this.className === 'key-box' || this.className === 'value-box') {\n const text = new TextModel(this.product!, this._option, i);\n text.init([this.className.substring(0, this.className.indexOf('-'))], undefined, 'div');\n this.children[i] = text;\n } else if (this.className === 'shape-box') {\n const shape = new ShapeModel(this.product!, this._option, i);\n shape.init(['shape'], undefined, 'div');\n this.children[i] = shape;\n }\n }\n }\n }\n }\n\n setStyle() {\n const tooltipStyle = this._option.getTooltipStyle();\n\n super.setStyle(mergeSpec({}, defaultContentColumnStyle, tooltipStyle.content, this._getContentColumnStyle()));\n\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];\n\n const getKeyItemStyle = (\n line: ITooltipLineActual,\n attrs: TooltipRowAttrs,\n i: number\n ): Partial<CSSStyleDeclaration> => {\n const { key, isKeyAdaptive } = line;\n const { height } = attrs;\n const { keyColumn } = tooltipStyle;\n const style: Partial<CSSStyleDeclaration> = mergeSpec(\n {},\n isKeyAdaptive ? defaultAdaptiveKeyStyle : defaultKeyStyle,\n {\n height: getPixelPropertyStr(height),\n ...defaultLabelStyle,\n ...keyColumn.common,\n ...keyColumn.items?.[i]\n } as Partial<CSSStyleDeclaration>\n );\n const hasContent = (isString(key) && key?.trim?.() !== '') || isNumber(key);\n if (!hasContent && !style.visibility) {\n style.visibility = 'hidden';\n } else {\n style.visibility = 'visible';\n }\n return style;\n };\n\n const getValueItemStyle = (\n line: ITooltipLineActual,\n attrs: TooltipRowAttrs,\n i: number\n ): Partial<CSSStyleDeclaration> => {\n const { height } = attrs;\n const { valueColumn } = tooltipStyle;\n const style: Partial<CSSStyleDeclaration> = mergeSpec({}, defaultValueStyle, {\n height: getPixelPropertyStr(height),\n ...defaultLabelStyle,\n ...valueColumn.common,\n ...valueColumn.items?.[i]\n } as Partial<CSSStyleDeclaration>);\n return style;\n };\n\n const getShapeItemStyle = (\n line: ITooltipLineActual,\n attrs: TooltipRowAttrs,\n i: number\n ): Partial<CSSStyleDeclaration> => {\n const { height } = attrs;\n const { shapeColumn } = tooltipStyle;\n const keyStyle = getKeyItemStyle(line, attrs, i);\n const paddingTop = `calc((${keyStyle.lineHeight ?? keyStyle.fontSize ?? '18px'} - ${\n shapeColumn.width ?? '8px'\n }) / 2)`; // shape 和 key 的第一行文字对齐\n const style: Partial<CSSStyleDeclaration> = mergeSpec({}, defaultShapeStyle, {\n height: getPixelPropertyStr(height),\n paddingTop,\n ...shapeColumn.common,\n ...shapeColumn.items?.[i]\n } as Partial<CSSStyleDeclaration>);\n return style;\n };\n\n contentAttributes.forEach((attrs: TooltipRowAttrs, i: number) => {\n const line = renderContent[i];\n\n if (this.className === 'key-box') {\n (this.children[i] as TextModel).setStyle(getKeyItemStyle(line, attrs, i));\n } else if (this.className === 'value-box') {\n (this.children[i] as TextModel).setStyle(getValueItemStyle(line, attrs, i));\n } else if (this.className === 'shape-box') {\n (this.children[i] as ShapeModel)?.setStyle(getShapeItemStyle(line, attrs, i), this._getShapeSvgOption(line, i));\n }\n });\n }\n\n setContent(): void {\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n const contentAttributes = this._option.getTooltipAttributes()?.content ?? [];\n\n contentAttributes.forEach((attributes: TooltipRowAttrs, i: number) => {\n let childContent: any;\n const line = renderContent[i];\n if (this.className === 'key-box') {\n const keyContent = line.key;\n if ((isString(keyContent) && keyContent?.trim?.() !== '') || isNumber(keyContent)) {\n childContent = keyContent;\n } else {\n childContent = TOOLTIP_EMPTY_STRING;\n }\n (this.children[i] as TextModel)?.setContent(childContent, attributes.key?.multiLine);\n } else if (this.className === 'value-box') {\n const valueContent = line.value;\n if ((isString(valueContent) && valueContent?.trim?.() !== '') || isNumber(valueContent)) {\n childContent = valueContent;\n } else {\n childContent = TOOLTIP_EMPTY_STRING;\n }\n (this.children[i] as TextModel)?.setContent(childContent, attributes.value?.multiLine);\n } else if (this.className === 'shape-box') {\n childContent = this._getShapeSvgOption(line, i);\n this.children[i]?.setContent(childContent);\n }\n });\n }\n\n protected _getContentColumnStyle() {\n const tooltipStyle = this._option.getTooltipStyle();\n\n switch (this.className) {\n case 'shape-box':\n const renderContent = this._option.getTooltipActual()?.content ?? [];\n return {\n ...tooltipStyle.shapeColumn,\n ...(this.className === 'shape-box' && !renderContent.some(c => c.hasShape && c.shapeType)\n ? { display: 'none' }\n : {})\n };\n case 'key-box':\n return tooltipStyle.keyColumn;\n case 'value-box':\n return tooltipStyle.valueColumn;\n }\n }\n\n protected _getShapeSvgOption(line: ITooltipLineActual, index: number): IShapeSvgOption {\n const tooltipStyle = this._option.getTooltipStyle();\n const shapeColumn = {\n ...tooltipStyle.shapeColumn,\n ...tooltipStyle.shapeColumn.items?.[index]\n };\n return {\n hasShape: line.hasShape,\n symbolType: line.shapeType,\n size: shapeColumn.width,\n fill: line.shapeFill,\n stroke: line.shapeStroke,\n lineWidth: line.shapeLineWidth,\n hollow: line.shapeHollow,\n index\n } as IShapeSvgOption;\n }\n}\n"]}
@@ -38,7 +38,7 @@ class TitleModel extends base_tooltip_model_1.BaseTooltipModel {
38
38
  hasShape: null == title ? void 0 : title.hasShape,
39
39
  symbolType: null == title ? void 0 : title.shapeType,
40
40
  size: null === (_c = tooltipStyle.shapeColumn.common) || void 0 === _c ? void 0 : _c.width,
41
- fill: null == title ? void 0 : title.shapeColor,
41
+ fill: null == title ? void 0 : title.shapeFill,
42
42
  hollow: null == title ? void 0 : title.shapeHollow
43
43
  }), null === (_d = this.textSpan) || void 0 === _d || _d.setStyle({
44
44
  color: "inherit"
@@ -51,7 +51,7 @@ class TitleModel extends base_tooltip_model_1.BaseTooltipModel {
51
51
  hasShape: null == title ? void 0 : title.hasShape,
52
52
  symbolType: null == title ? void 0 : title.shapeType,
53
53
  size: null === (_b = tooltipStyle.shapeColumn.common) || void 0 === _b ? void 0 : _b.width,
54
- fill: null == title ? void 0 : title.shapeColor,
54
+ fill: null == title ? void 0 : title.shapeFill,
55
55
  hollow: null == title ? void 0 : title.shapeHollow
56
56
  }), null === (_c = this.textSpan) || void 0 === _c || _c.setStyle({
57
57
  color: "inherit"
@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C,CAAC;QACH,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,EAAE,MAAA,MAAA,iBAAiB,CAAC,KAAK,0CAAE,KAAK,0CAAE,SAAS,CAAC,CAAC;IACrF,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF;AAtGD,gCAsGC","file":"title-model.js","sourcesContent":["import type { Maybe } from '@visactor/vutils';\nimport { defaultH2Style } from './style-constants';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport { ShapeModel } from './shape-model';\nimport { TextModel } from './text-model';\nimport { mergeSpec } from '@visactor/vutils-extension';\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 const { align } = this._option.getTooltipAttributes();\n\n if (align === 'right' && !this.textSpan) {\n this._initTextSpan(0);\n }\n\n const { title } = tooltipActual;\n if (title?.hasShape && title?.shapeType) {\n if (!this.shape) {\n this._initShape(align === 'right' ? 1 : 0);\n }\n } else if (this.shape) {\n this._releaseShape();\n }\n\n if (align !== 'right' && !this.textSpan) {\n this._initTextSpan(1);\n }\n }\n\n private _initShape(index: number = 0) {\n const shape = new ShapeModel(this.product!, this._option, index);\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(index: number = 1) {\n const textSpan = new TextModel(this.product!, this._option, index);\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(mergeSpec({}, defaultH2Style, tooltipStyle.title, style));\n\n this.shape?.setStyle(\n {\n paddingRight: tooltipStyle.shapeColumn.common?.marginRight\n },\n {\n hasShape: title?.hasShape,\n symbolType: title?.shapeType,\n size: tooltipStyle.shapeColumn.common?.width,\n fill: title?.shapeColor,\n hollow: title?.shapeHollow\n }\n );\n this.textSpan?.setStyle({\n color: 'inherit'\n });\n }\n\n setContent(): void {\n const tooltipStyle = this._option.getTooltipStyle();\n const tooltipActual = this._option.getTooltipActual();\n const tooltipAttributes = this._option.getTooltipAttributes();\n\n const { title } = tooltipActual;\n this.init();\n this.shape?.setStyle(undefined, {\n hasShape: title?.hasShape,\n symbolType: title?.shapeType,\n size: tooltipStyle.shapeColumn.common?.width,\n fill: title?.shapeColor,\n hollow: title?.shapeHollow\n });\n this.textSpan?.setStyle({\n color: 'inherit'\n });\n this.textSpan?.setContent(title?.value, tooltipAttributes.title?.value?.multiLine);\n }\n\n release(): void {\n super.release();\n this.shape = null;\n this.textSpan = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/dom/model/title-model.ts"],"names":[],"mappings":";;;AACA,uDAAmD;AACnD,6DAAwD;AACxD,+CAA2C;AAC3C,6CAAyC;AACzC,iEAAuD;AAEvD,MAAa,UAAW,SAAQ,qCAAgB;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;QACD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;QAEtD,IAAI,KAAK,KAAK,OAAO,IAAI,CA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EAAE,CAAC;QACpD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACtD,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC;QAE9D,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC;QAChC,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,MAAA,IAAI,CAAC,KAAK,0CAAE,QAAQ,CAAC,SAAS,EAAE;YAC9B,QAAQ,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ;YACzB,UAAU,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS;YAC5B,IAAI,EAAE,MAAA,YAAY,CAAC,WAAW,CAAC,MAAM,0CAAE,KAAK;YAC5C,IAAI,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS;YACtB,MAAM,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW;SAC3B,CAAC,CAAC;QACH,MAAA,IAAI,CAAC,QAAQ,0CAAE,QAAQ,CAAC;YACtB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QACH,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,EAAE,MAAA,MAAA,iBAAiB,CAAC,KAAK,0CAAE,KAAK,0CAAE,SAAS,CAAC,CAAC;IACrF,CAAC;IAED,OAAO;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF;AAtGD,gCAsGC","file":"title-model.js","sourcesContent":["import type { Maybe } from '@visactor/vutils';\nimport { defaultH2Style } from './style-constants';\nimport { BaseTooltipModel } from './base-tooltip-model';\nimport { ShapeModel } from './shape-model';\nimport { TextModel } from './text-model';\nimport { mergeSpec } from '@visactor/vutils-extension';\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 const { align } = this._option.getTooltipAttributes();\n\n if (align === 'right' && !this.textSpan) {\n this._initTextSpan(0);\n }\n\n const { title } = tooltipActual;\n if (title?.hasShape && title?.shapeType) {\n if (!this.shape) {\n this._initShape(align === 'right' ? 1 : 0);\n }\n } else if (this.shape) {\n this._releaseShape();\n }\n\n if (align !== 'right' && !this.textSpan) {\n this._initTextSpan(1);\n }\n }\n\n private _initShape(index: number = 0) {\n const shape = new ShapeModel(this.product!, this._option, index);\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(index: number = 1) {\n const textSpan = new TextModel(this.product!, this._option, index);\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(mergeSpec({}, defaultH2Style, tooltipStyle.title, style));\n\n this.shape?.setStyle(\n {\n paddingRight: tooltipStyle.shapeColumn.common?.marginRight\n },\n {\n hasShape: title?.hasShape,\n symbolType: title?.shapeType,\n size: tooltipStyle.shapeColumn.common?.width,\n fill: title?.shapeFill,\n hollow: title?.shapeHollow\n }\n );\n this.textSpan?.setStyle({\n color: 'inherit'\n });\n }\n\n setContent(): void {\n const tooltipStyle = this._option.getTooltipStyle();\n const tooltipActual = this._option.getTooltipActual();\n const tooltipAttributes = this._option.getTooltipAttributes();\n\n const { title } = tooltipActual;\n this.init();\n this.shape?.setStyle(undefined, {\n hasShape: title?.hasShape,\n symbolType: title?.shapeType,\n size: tooltipStyle.shapeColumn.common?.width,\n fill: title?.shapeFill,\n hollow: title?.shapeHollow\n });\n this.textSpan?.setStyle({\n color: 'inherit'\n });\n this.textSpan?.setContent(title?.value, tooltipAttributes.title?.value?.multiLine);\n }\n\n release(): void {\n super.release();\n this.shape = null;\n this.textSpan = null;\n }\n}\n"]}
@@ -1,10 +1,9 @@
1
1
  import type { TooltipAttributes } from '@visactor/vrender-components';
2
- import type { ITextAttribute, IFillStyle, RichTextWordBreak } from '@visactor/vrender-core';
2
+ import type { ITextAttribute, IFillStyle } from '@visactor/vrender-core';
3
3
  export interface ITooltipTextStyle extends Partial<ITextAttribute & IFillStyle> {
4
4
  spacing?: number;
5
5
  multiLine?: boolean;
6
6
  maxWidth?: number;
7
- wordBreak?: RichTextWordBreak;
8
7
  autoWidth?: boolean;
9
8
  }
10
9
  export interface ITooltipAttributes extends TooltipAttributes {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/interface/style.ts"],"names":[],"mappings":"","file":"style.js","sourcesContent":["import type { TooltipAttributes } from '@visactor/vrender-components';\nimport type { ITextAttribute, IFillStyle, RichTextWordBreak } from '@visactor/vrender-core';\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\nexport interface ITooltipAttributes extends TooltipAttributes {\n /** dom tooltip 的高度。由于 canvas tooltip 不支持滚动条,dom tooltip 单独计算高度 */\n panelDomHeight?: number;\n /** dom tooltip 内容区的最大高度,canvas tooltip 不支持 */\n maxContentHeight?: number;\n /**\n * @since 1.11.5\n *\n * shape、key、value的对齐方式,可选项如下:\n * 'left': 从左到右对齐\n * 'right': 从右到左对齐\n */\n align?: 'left' | 'right';\n}\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/interface/style.ts"],"names":[],"mappings":"","file":"style.js","sourcesContent":["import type { TooltipAttributes } from '@visactor/vrender-components';\nimport type { ITextAttribute, IFillStyle } from '@visactor/vrender-core';\n\nexport interface ITooltipTextStyle extends Partial<ITextAttribute & IFillStyle> {\n /** 和相邻元素的水平间距 */\n spacing?: number;\n /** 是否支持换行 */\n multiLine?: boolean;\n /** 文本元素的最大宽度 */\n maxWidth?: number;\n /** 是否开启自动宽度 */\n autoWidth?: boolean;\n}\n\nexport interface ITooltipAttributes extends TooltipAttributes {\n /** dom tooltip 的高度。由于 canvas tooltip 不支持滚动条,dom tooltip 单独计算高度 */\n panelDomHeight?: number;\n /** dom tooltip 内容区的最大高度,canvas tooltip 不支持 */\n maxContentHeight?: number;\n /**\n * @since 1.11.5\n *\n * shape、key、value的对齐方式,可选项如下:\n * 'left': 从左到右对齐\n * 'right': 从右到左对齐\n */\n align?: 'left' | 'right';\n}\n"]}
@@ -82,14 +82,14 @@ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
82
82
  align: align
83
83
  }, {title: title = {}, content: content = []} = actualTooltip;
84
84
  let panelWidth = paddingSpec.left + paddingSpec.right, panelHeight = paddingSpec.top + paddingSpec.bottom, panelDomHeight = paddingSpec.top + paddingSpec.bottom, contentMaxWidth = 0;
85
- const filteredContent = content.filter((item => (item.key || item.value) && !1 !== item.visible)), hasContent = !!filteredContent.length;
85
+ const hasContent = !!content.length;
86
86
  let maxKeyWidth = 0, maxAdaptiveKeyWidth = 0, maxValueWidth = 0, maxShapeWidth = 0;
87
87
  if (hasContent) {
88
88
  const keyWidths = [], adaptiveKeyWidths = [], valueWidths = [], shapeWidths = [];
89
89
  let contentHeight = 0;
90
- attributes.content = filteredContent.map(((item, i) => {
90
+ attributes.content = content.map(((item, i) => {
91
91
  let itemHeight = 0;
92
- 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, shapeHollow: actualShapeHollow, shapeColor: actualShapeColor} = item, itemAttrs = {
92
+ 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, shapeHollow: actualShapeHollow} = item, itemAttrs = {
93
93
  height: 0,
94
94
  spaceRow: null != actualSpaceRow ? actualSpaceRow : commonSpaceRow
95
95
  };
@@ -118,16 +118,16 @@ const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
118
118
  const shape = {
119
119
  visible: !0,
120
120
  symbolType: actualShapeType
121
- }, adaptiveShapeFill = null != actualShapeFill ? actualShapeFill : actualShapeColor;
122
- actualShapeHollow ? shape.stroke = adaptiveShapeFill : shape.fill = adaptiveShapeFill,
123
- shape.stroke = null != actualShapeStroke ? actualShapeStroke : adaptiveShapeFill,
121
+ };
122
+ actualShapeHollow ? shape.stroke = actualShapeFill : shape.fill = actualShapeFill,
123
+ shape.stroke = null != actualShapeStroke ? actualShapeStroke : actualShapeFill,
124
124
  shape.lineWidth = actualShapeLineWidth, itemAttrs.shape = shape;
125
125
  const shapeWidth = null != actualShapeSize ? actualShapeSize : shapeStyle.size;
126
126
  itemHeight = Math.max(shapeWidth, itemHeight), shapeWidths.push(shapeWidth);
127
127
  } else itemAttrs.shape = {
128
128
  visible: !1
129
129
  };
130
- return itemAttrs.height = itemHeight, contentHeight += itemHeight, i < filteredContent.length - 1 && (contentHeight += itemAttrs.spaceRow),
130
+ return itemAttrs.height = itemHeight, contentHeight += itemHeight, i < content.length - 1 && (contentHeight += itemAttrs.spaceRow),
131
131
  itemAttrs;
132
132
  })), panelHeight += contentHeight, panelDomHeight += Math.min(contentHeight, null != maxContentHeight ? maxContentHeight : 1 / 0),
133
133
  maxKeyWidth = keyWidths.length ? (0, vutils_1.maxInArray)(keyWidths) : 0, maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? (0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/attribute.ts"],"names":[],"mappings":";;;AASA,6CAAyE;AACzE,iEAAuD;AACvD,kDAAoE;AACpE,qCAA8C;AAG9C,mDAAgD;AAEhD,MAAM,uBAAuB,GAA+B;IAC1D,UAAU,EAAE,aAAK,CAAC,UAAU;IAC5B,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,QAA2B,EAAE,EAC7B,WAAoB,EACpB,iBAA8C;;IAE9C,MAAM,KAAK,mCACN,CAAC,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,uBAAuB,CAAC,KACjD,IAAI,EAAE,CAAC,MAAA,KAAK,CAAC,IAAI,mCAAI,KAAK,CAAC,SAAS,CAAW,EAC/C,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,UAAU,EAAE,MAAA,KAAK,CAAC,UAAU,mCAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,UAAqB,EACnE,QAAQ,EAAE,KAAK,CAAC,QAAkB,EAClC,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,UAAU,EAAE,KAAK,CAAC,UAAoB,EACtC,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,GAC3B,CAAC;IACF,OAAO,KAAK,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,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBACzC;gBACD,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;aACtE;QACH,CAAC,CAAC,CAAC;KACJ;IAED,UAAU,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;IACpC,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;IACtC,UAAU,CAAC,cAAc,GAAG,cAAc,CAAC;IAC3C,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AA/QW,QAAA,oBAAoB,wBA+Q/B","file":"attribute.js","sourcesContent":["import type {\n TooltipPanelAttrs,\n TooltipRowAttrs,\n TooltipRowStyleAttrs,\n TooltipSymbolAttrs,\n TooltipTextAttrs\n} from '@visactor/vrender-components';\nimport type { IPadding, ITooltipActual } from '../../../../typings';\nimport type { ITooltipAttributes, ITooltipTextStyle } from '../interface';\nimport { isValid, maxInArray, normalizePadding } from '@visactor/vutils';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport { normalizeLayoutPaddingSpec } from '../../../../util/space';\nimport { measureTooltipText } from './common';\nimport type { ITheme } from '../../../../theme';\nimport type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';\nimport { token } from '../../../../theme/token';\n\nconst DEFAULT_TEXT_ATTRIBUTES: Partial<ITooltipTextStyle> = {\n fontFamily: token.fontFamily,\n spacing: 10,\n wordBreak: 'break-word'\n};\n\nexport function getTextAttributes(\n style: ITooltipTextTheme = {},\n globalTheme?: ITheme,\n defaultAttributes?: Partial<ITooltipTextStyle>\n): ITooltipTextStyle {\n const attrs: ITooltipTextStyle = {\n ...(defaultAttributes ?? DEFAULT_TEXT_ATTRIBUTES),\n fill: (style.fill ?? style.fontColor) as string,\n textAlign: style.textAlign,\n textBaseline: style.textBaseline,\n fontFamily: style.fontFamily ?? (globalTheme?.fontFamily as string),\n fontSize: style.fontSize as number,\n fontWeight: style.fontWeight,\n lineHeight: style.lineHeight as number,\n spacing: style.spacing,\n multiLine: style.multiLine,\n maxWidth: style.maxWidth,\n wordBreak: style.wordBreak,\n autoWidth: style.autoWidth\n };\n return attrs;\n}\n\nexport const getPanelAttributes = (style: ITooltipTheme['panel']): TooltipPanelAttrs => {\n const { backgroundColor, border, shadow } = style;\n const panelAttrs: TooltipPanelAttrs = {\n lineWidth: border?.width ?? 0,\n shadow: !!shadow\n };\n if (border?.color) {\n panelAttrs.stroke = border.color as string;\n }\n if (backgroundColor) {\n panelAttrs.fill = backgroundColor as string;\n }\n if (shadow) {\n panelAttrs.shadowColor = shadow.color as string;\n panelAttrs.shadowBlur = shadow.blur;\n panelAttrs.shadowOffsetX = shadow.x;\n panelAttrs.shadowOffsetY = shadow.y;\n panelAttrs.shadowSpread = shadow.spread;\n }\n const { radius } = border ?? {};\n if (isValid(radius)) {\n panelAttrs.cornerRadius = [radius, radius, radius, radius];\n }\n return panelAttrs;\n};\n\nexport const getTooltipAttributes = (\n actualTooltip: ITooltipActual,\n spec: ITooltipSpec,\n globalTheme: ITheme\n): ITooltipAttributes => {\n const { style = {}, enterable, transitionDuration } = spec;\n const {\n panel = {},\n titleLabel,\n shape,\n keyLabel,\n valueLabel,\n spaceRow: commonSpaceRow,\n maxContentHeight,\n align\n } = style;\n const padding = normalizePadding(panel.padding);\n const paddingSpec = normalizeLayoutPaddingSpec(panel.padding) as IPadding;\n\n const titleStyle = getTextAttributes(\n {\n textAlign: align === 'right' ? 'right' : 'left',\n ...titleLabel\n },\n globalTheme\n );\n const keyStyle = getTextAttributes(\n {\n textAlign: align === 'right' ? 'right' : 'left',\n ...keyLabel\n },\n globalTheme\n );\n const valueStyle = getTextAttributes(valueLabel, globalTheme);\n const shapeStyle: TooltipRowStyleAttrs['shape'] = {\n fill: true,\n size: shape?.size ?? 8,\n spacing: shape?.spacing ?? 6\n };\n\n const attributes: ITooltipAttributes = {\n panel: getPanelAttributes(panel),\n padding,\n\n title: {},\n content: [],\n\n titleStyle: {\n value: titleStyle,\n spaceRow: commonSpaceRow\n },\n contentStyle: {\n shape: shapeStyle,\n key: keyStyle,\n value: valueStyle,\n spaceRow: commonSpaceRow\n },\n hasContentShape: false,\n keyWidth: 0,\n valueWidth: 0,\n\n maxContentHeight,\n\n enterable,\n transitionDuration,\n align\n };\n\n const { title = {}, content = [] } = actualTooltip;\n\n let panelWidth = paddingSpec.left + paddingSpec.right;\n let panelHeight = paddingSpec.top + paddingSpec.bottom;\n /** dom tooltip 的高度。由于 canvas tooltip 不支持滚动条,dom tooltip 单独计算高度 */\n let panelDomHeight = paddingSpec.top + paddingSpec.bottom;\n\n // calculate content\n let contentMaxWidth = 0;\n // filter content\n const filteredContent = content.filter(item => {\n return (item.key || item.value) && item.visible !== false;\n });\n const hasContent = !!filteredContent.length;\n let maxKeyWidth = 0;\n let maxAdaptiveKeyWidth = 0;\n let maxValueWidth = 0;\n let maxShapeWidth = 0;\n\n if (hasContent) {\n const keyWidths: number[] = [];\n const adaptiveKeyWidths: number[] = [];\n const valueWidths: number[] = [];\n const shapeWidths: number[] = [];\n\n let contentHeight = 0;\n attributes.content = filteredContent.map((item, i) => {\n let itemHeight = 0;\n const {\n hasShape: actualHasShape,\n key: actualKey,\n shapeType: actualShapeType = '',\n shapeFill: actualShapeFill,\n shapeStroke: actualShapeStroke,\n shapeLineWidth: actualShapeLineWidth,\n shapeSize: actualShapeSize,\n value: actualValue,\n isKeyAdaptive: actualIsKeyAdaptive,\n spaceRow: actualSpaceRow,\n keyStyle: actualKeyStyle,\n valueStyle: actualValueStyle,\n shapeHollow: actualShapeHollow,\n // 弃用的属性,做下兼容\n shapeColor: actualShapeColor\n } = item;\n const itemAttrs: TooltipRowAttrs = { height: 0, spaceRow: actualSpaceRow ?? commonSpaceRow };\n if (isValid(actualKey)) {\n const itemKeyStyle: ITooltipTextStyle = mergeSpec(\n {},\n keyStyle,\n getTextAttributes(actualKeyStyle, undefined, {})\n );\n const { width, height, text } = measureTooltipText(actualKey, itemKeyStyle);\n itemAttrs.key = {\n width,\n height,\n ...itemKeyStyle,\n text\n };\n if (!actualIsKeyAdaptive) {\n keyWidths.push(width);\n } else {\n adaptiveKeyWidths.push(width);\n }\n itemHeight = Math.max(itemHeight, height);\n }\n if (isValid(actualValue)) {\n const itemValueStyle: ITooltipTextStyle = mergeSpec(\n {},\n valueStyle,\n getTextAttributes(actualValueStyle, undefined, {})\n );\n const { width, height, text } = measureTooltipText(actualValue, itemValueStyle);\n itemAttrs.value = {\n width,\n height,\n ...itemValueStyle,\n text\n };\n valueWidths.push(width);\n itemHeight = Math.max(itemHeight, height);\n }\n if (actualHasShape) {\n const shape: TooltipSymbolAttrs = {\n visible: true,\n symbolType: actualShapeType\n };\n const adaptiveShapeFill = actualShapeFill ?? actualShapeColor;\n if (actualShapeHollow) {\n shape.stroke = adaptiveShapeFill;\n } else {\n shape.fill = adaptiveShapeFill;\n }\n shape.stroke = actualShapeStroke ?? adaptiveShapeFill;\n shape.lineWidth = actualShapeLineWidth;\n itemAttrs.shape = shape;\n\n const shapeWidth = actualShapeSize ?? shapeStyle.size;\n itemHeight = Math.max(shapeWidth, itemHeight);\n shapeWidths.push(shapeWidth);\n } else {\n itemAttrs.shape = { visible: false };\n }\n\n itemAttrs.height = itemHeight;\n contentHeight += itemHeight;\n if (i < filteredContent.length - 1) {\n contentHeight += itemAttrs.spaceRow;\n }\n\n return itemAttrs;\n });\n panelHeight += contentHeight;\n panelDomHeight += Math.min(contentHeight, maxContentHeight ?? Infinity);\n\n maxKeyWidth = keyWidths.length ? maxInArray(keyWidths) : 0; // name 需要对齐\n maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? maxInArray(adaptiveKeyWidths) : 0;\n maxValueWidth = valueWidths.length ? maxInArray(valueWidths) : 0; // value 需要对齐\n maxShapeWidth = shapeWidths.length ? maxInArray(shapeWidths) + shapeStyle.spacing : 0; // shape 列宽度\n contentMaxWidth = Math.max(\n maxShapeWidth + maxKeyWidth + keyStyle.spacing + maxValueWidth + valueStyle.spacing,\n maxShapeWidth + maxAdaptiveKeyWidth,\n contentMaxWidth\n );\n attributes.hasContentShape = !!shapeWidths.length;\n attributes.keyWidth = maxKeyWidth;\n attributes.valueWidth = maxValueWidth;\n }\n\n // calculate title\n let titleMaxWidth = 0;\n let titleMaxHeight = 0;\n let titleHeightWithSpace = 0;\n const {\n visible: actualTitleVisible = true,\n value: actualTitleValue = '',\n valueStyle: actualTitleValueStyle,\n spaceRow: actualTitleSpaceRow\n } = title;\n attributes.title.visible = actualTitleVisible;\n attributes.title.spaceRow = actualTitleSpaceRow ?? commonSpaceRow;\n\n let titleValueStyle: ITooltipTextStyle = {};\n // 当前是否处于自适应宽度模式\n const isAutoWidthMode = () => titleValueStyle.autoWidth && titleValueStyle.multiLine !== false;\n if (actualTitleVisible) {\n titleValueStyle = mergeSpec({}, titleStyle, getTextAttributes(actualTitleValueStyle, undefined, {}));\n // 标题默认优化策略:如果 autoWidth 为 true,则宽度默认跟随 content 宽度并开启自动换行\n if (isAutoWidthMode()) {\n titleValueStyle.multiLine = titleValueStyle.multiLine ?? true;\n titleValueStyle.maxWidth = titleValueStyle.maxWidth ?? (hasContent ? Math.ceil(contentMaxWidth) : undefined);\n }\n\n const { text, width, height } = measureTooltipText(actualTitleValue, titleValueStyle);\n attributes.title.value = {\n width: isAutoWidthMode() ? Math.min(width, titleValueStyle.maxWidth ?? Number.MAX_VALUE) : width,\n height,\n ...titleValueStyle,\n text\n };\n titleMaxWidth = attributes.title.value.width;\n titleMaxHeight = attributes.title.value.height;\n\n titleHeightWithSpace = titleMaxHeight + (hasContent ? attributes.title.spaceRow : 0);\n }\n panelHeight += titleHeightWithSpace;\n panelDomHeight += titleHeightWithSpace;\n attributes.title.width = titleMaxWidth;\n attributes.title.height = titleMaxHeight;\n\n if (isAutoWidthMode()) {\n panelWidth += contentMaxWidth ? contentMaxWidth : titleMaxWidth;\n } else {\n panelWidth += Math.max(titleMaxWidth, contentMaxWidth);\n }\n\n // 处理 content 的自动宽度模式\n if (hasContent) {\n attributes.content.forEach(item => {\n const value = item.value as ITooltipTextStyle & TooltipTextAttrs;\n // 最后一列默认自适应宽度\n if (value && (value.autoWidth ?? true)) {\n value.width =\n panelWidth -\n paddingSpec.left -\n paddingSpec.right -\n maxShapeWidth -\n maxKeyWidth -\n keyStyle.spacing -\n valueStyle.spacing;\n //value.multiLine = true; multiLine 需要用户手动开启,不会自动开启\n if (!value.maxWidth) {\n value.maxWidth = Math.ceil(value.width);\n }\n attributes.valueWidth = Math.max(attributes.valueWidth, value.width);\n }\n });\n }\n\n attributes.panel.width = panelWidth;\n attributes.panel.height = panelHeight;\n attributes.panelDomHeight = panelDomHeight;\n return attributes;\n};\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/attribute.ts"],"names":[],"mappings":";;;AASA,6CAAyE;AACzE,iEAAuD;AACvD,kDAAoE;AACpE,qCAA8C;AAG9C,mDAAgD;AAEhD,MAAM,uBAAuB,GAA+B;IAC1D,UAAU,EAAE,aAAK,CAAC,UAAU;IAC5B,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,SAAgB,iBAAiB,CAC/B,QAA2B,EAAE,EAC7B,WAAoB,EACpB,iBAA8C;;IAE9C,MAAM,KAAK,mCACN,CAAC,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,uBAAuB,CAAC,KACjD,IAAI,EAAE,CAAC,MAAA,KAAK,CAAC,IAAI,mCAAI,KAAK,CAAC,SAAS,CAAW,EAC/C,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,UAAU,EAAE,MAAA,KAAK,CAAC,UAAU,mCAAK,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,UAAqB,EACnE,QAAQ,EAAE,KAAK,CAAC,QAAkB,EAClC,UAAU,EAAE,KAAK,CAAC,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AC;iBACzC;gBACD,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;aACtE;QACH,CAAC,CAAC,CAAC;KACJ;IAED,UAAU,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC;IACpC,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC;IACtC,UAAU,CAAC,cAAc,GAAG,cAAc,CAAC;IAC3C,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAzQW,QAAA,oBAAoB,wBAyQ/B","file":"attribute.js","sourcesContent":["import type {\n TooltipPanelAttrs,\n TooltipRowAttrs,\n TooltipRowStyleAttrs,\n TooltipSymbolAttrs,\n TooltipTextAttrs\n} from '@visactor/vrender-components';\nimport type { IPadding, ITooltipActual } from '../../../../typings';\nimport type { ITooltipAttributes, ITooltipTextStyle } from '../interface';\nimport { isValid, maxInArray, normalizePadding } from '@visactor/vutils';\nimport { mergeSpec } from '@visactor/vutils-extension';\nimport { normalizeLayoutPaddingSpec } from '../../../../util/space';\nimport { measureTooltipText } from './common';\nimport type { ITheme } from '../../../../theme';\nimport type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';\nimport { token } from '../../../../theme/token';\n\nconst DEFAULT_TEXT_ATTRIBUTES: Partial<ITooltipTextStyle> = {\n fontFamily: token.fontFamily,\n spacing: 10,\n wordBreak: 'break-word'\n};\n\nexport function getTextAttributes(\n style: ITooltipTextTheme = {},\n globalTheme?: ITheme,\n defaultAttributes?: Partial<ITooltipTextStyle>\n): ITooltipTextStyle {\n const attrs: ITooltipTextStyle = {\n ...(defaultAttributes ?? DEFAULT_TEXT_ATTRIBUTES),\n fill: (style.fill ?? style.fontColor) as string,\n textAlign: style.textAlign,\n textBaseline: style.textBaseline,\n fontFamily: style.fontFamily ?? (globalTheme?.fontFamily as string),\n fontSize: style.fontSize as number,\n fontWeight: style.fontWeight,\n lineHeight: style.lineHeight as number,\n spacing: style.spacing,\n multiLine: style.multiLine,\n maxWidth: style.maxWidth,\n wordBreak: style.wordBreak,\n autoWidth: style.autoWidth\n };\n return attrs;\n}\n\nexport const getPanelAttributes = (style: ITooltipTheme['panel']): TooltipPanelAttrs => {\n const { backgroundColor, border, shadow } = style;\n const panelAttrs: TooltipPanelAttrs = {\n lineWidth: border?.width ?? 0,\n shadow: !!shadow\n };\n if (border?.color) {\n panelAttrs.stroke = border.color as string;\n }\n if (backgroundColor) {\n panelAttrs.fill = backgroundColor as string;\n }\n if (shadow) {\n panelAttrs.shadowColor = shadow.color as string;\n panelAttrs.shadowBlur = shadow.blur;\n panelAttrs.shadowOffsetX = shadow.x;\n panelAttrs.shadowOffsetY = shadow.y;\n panelAttrs.shadowSpread = shadow.spread;\n }\n const { radius } = border ?? {};\n if (isValid(radius)) {\n panelAttrs.cornerRadius = [radius, radius, radius, radius];\n }\n return panelAttrs;\n};\n\nexport const getTooltipAttributes = (\n actualTooltip: ITooltipActual,\n spec: ITooltipSpec,\n globalTheme: ITheme\n): ITooltipAttributes => {\n const { style = {}, enterable, transitionDuration } = spec;\n const {\n panel = {},\n titleLabel,\n shape,\n keyLabel,\n valueLabel,\n spaceRow: commonSpaceRow,\n maxContentHeight,\n align\n } = style;\n const padding = normalizePadding(panel.padding);\n const paddingSpec = normalizeLayoutPaddingSpec(panel.padding) as IPadding;\n\n const titleStyle = getTextAttributes(\n {\n textAlign: align === 'right' ? 'right' : 'left',\n ...titleLabel\n },\n globalTheme\n );\n const keyStyle = getTextAttributes(\n {\n textAlign: align === 'right' ? 'right' : 'left',\n ...keyLabel\n },\n globalTheme\n );\n const valueStyle = getTextAttributes(valueLabel, globalTheme);\n const shapeStyle: TooltipRowStyleAttrs['shape'] = {\n fill: true,\n size: shape?.size ?? 8,\n spacing: shape?.spacing ?? 6\n };\n\n const attributes: ITooltipAttributes = {\n panel: getPanelAttributes(panel),\n padding,\n\n title: {},\n content: [],\n\n titleStyle: {\n value: titleStyle,\n spaceRow: commonSpaceRow\n },\n contentStyle: {\n shape: shapeStyle,\n key: keyStyle,\n value: valueStyle,\n spaceRow: commonSpaceRow\n },\n hasContentShape: false,\n keyWidth: 0,\n valueWidth: 0,\n\n maxContentHeight,\n\n enterable,\n transitionDuration,\n align\n };\n\n const { title = {}, content = [] } = actualTooltip;\n\n let panelWidth = paddingSpec.left + paddingSpec.right;\n let panelHeight = paddingSpec.top + paddingSpec.bottom;\n /** dom tooltip 的高度。由于 canvas tooltip 不支持滚动条,dom tooltip 单独计算高度 */\n let panelDomHeight = paddingSpec.top + paddingSpec.bottom;\n\n // calculate content\n let contentMaxWidth = 0;\n\n const hasContent = !!content.length;\n let maxKeyWidth = 0;\n let maxAdaptiveKeyWidth = 0;\n let maxValueWidth = 0;\n let maxShapeWidth = 0;\n\n if (hasContent) {\n const keyWidths: number[] = [];\n const adaptiveKeyWidths: number[] = [];\n const valueWidths: number[] = [];\n const shapeWidths: number[] = [];\n\n let contentHeight = 0;\n attributes.content = content.map((item, i) => {\n let itemHeight = 0;\n const {\n hasShape: actualHasShape,\n key: actualKey,\n shapeType: actualShapeType = '',\n shapeFill: actualShapeFill,\n shapeStroke: actualShapeStroke,\n shapeLineWidth: actualShapeLineWidth,\n shapeSize: actualShapeSize,\n value: actualValue,\n isKeyAdaptive: actualIsKeyAdaptive,\n spaceRow: actualSpaceRow,\n keyStyle: actualKeyStyle,\n valueStyle: actualValueStyle,\n shapeHollow: actualShapeHollow\n } = item;\n const itemAttrs: TooltipRowAttrs = { height: 0, spaceRow: actualSpaceRow ?? commonSpaceRow };\n if (isValid(actualKey)) {\n const itemKeyStyle: ITooltipTextStyle = mergeSpec(\n {},\n keyStyle,\n getTextAttributes(actualKeyStyle, undefined, {})\n );\n const { width, height, text } = measureTooltipText(actualKey, itemKeyStyle);\n itemAttrs.key = {\n width,\n height,\n ...itemKeyStyle,\n text\n };\n if (!actualIsKeyAdaptive) {\n keyWidths.push(width);\n } else {\n adaptiveKeyWidths.push(width);\n }\n itemHeight = Math.max(itemHeight, height);\n }\n if (isValid(actualValue)) {\n const itemValueStyle: ITooltipTextStyle = mergeSpec(\n {},\n valueStyle,\n getTextAttributes(actualValueStyle, undefined, {})\n );\n const { width, height, text } = measureTooltipText(actualValue, itemValueStyle);\n itemAttrs.value = {\n width,\n height,\n ...itemValueStyle,\n text\n };\n valueWidths.push(width);\n itemHeight = Math.max(itemHeight, height);\n }\n if (actualHasShape) {\n const shape: TooltipSymbolAttrs = {\n visible: true,\n symbolType: actualShapeType\n };\n if (actualShapeHollow) {\n shape.stroke = actualShapeFill;\n } else {\n shape.fill = actualShapeFill;\n }\n shape.stroke = actualShapeStroke ?? actualShapeFill;\n shape.lineWidth = actualShapeLineWidth;\n itemAttrs.shape = shape;\n\n const shapeWidth = actualShapeSize ?? shapeStyle.size;\n itemHeight = Math.max(shapeWidth, itemHeight);\n shapeWidths.push(shapeWidth);\n } else {\n itemAttrs.shape = { visible: false };\n }\n\n itemAttrs.height = itemHeight;\n contentHeight += itemHeight;\n if (i < content.length - 1) {\n contentHeight += itemAttrs.spaceRow;\n }\n\n return itemAttrs;\n });\n panelHeight += contentHeight;\n panelDomHeight += Math.min(contentHeight, maxContentHeight ?? Infinity);\n\n maxKeyWidth = keyWidths.length ? maxInArray(keyWidths) : 0; // name 需要对齐\n maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? maxInArray(adaptiveKeyWidths) : 0;\n maxValueWidth = valueWidths.length ? maxInArray(valueWidths) : 0; // value 需要对齐\n maxShapeWidth = shapeWidths.length ? maxInArray(shapeWidths) + shapeStyle.spacing : 0; // shape 列宽度\n contentMaxWidth = Math.max(\n maxShapeWidth + maxKeyWidth + keyStyle.spacing + maxValueWidth + valueStyle.spacing,\n maxShapeWidth + maxAdaptiveKeyWidth,\n contentMaxWidth\n );\n attributes.hasContentShape = !!shapeWidths.length;\n attributes.keyWidth = maxKeyWidth;\n attributes.valueWidth = maxValueWidth;\n }\n\n // calculate title\n let titleMaxWidth = 0;\n let titleMaxHeight = 0;\n let titleHeightWithSpace = 0;\n const {\n visible: actualTitleVisible = true,\n value: actualTitleValue = '',\n valueStyle: actualTitleValueStyle,\n spaceRow: actualTitleSpaceRow\n } = title;\n attributes.title.visible = actualTitleVisible;\n attributes.title.spaceRow = actualTitleSpaceRow ?? commonSpaceRow;\n\n let titleValueStyle: ITooltipTextStyle = {};\n // 当前是否处于自适应宽度模式\n const isAutoWidthMode = () => titleValueStyle.autoWidth && titleValueStyle.multiLine !== false;\n if (actualTitleVisible) {\n titleValueStyle = mergeSpec({}, titleStyle, getTextAttributes(actualTitleValueStyle, undefined, {}));\n // 标题默认优化策略:如果 autoWidth 为 true,则宽度默认跟随 content 宽度并开启自动换行\n if (isAutoWidthMode()) {\n titleValueStyle.multiLine = titleValueStyle.multiLine ?? true;\n titleValueStyle.maxWidth = titleValueStyle.maxWidth ?? (hasContent ? Math.ceil(contentMaxWidth) : undefined);\n }\n\n const { text, width, height } = measureTooltipText(actualTitleValue, titleValueStyle);\n attributes.title.value = {\n width: isAutoWidthMode() ? Math.min(width, titleValueStyle.maxWidth ?? Number.MAX_VALUE) : width,\n height,\n ...titleValueStyle,\n text\n };\n titleMaxWidth = attributes.title.value.width;\n titleMaxHeight = attributes.title.value.height;\n\n titleHeightWithSpace = titleMaxHeight + (hasContent ? attributes.title.spaceRow : 0);\n }\n panelHeight += titleHeightWithSpace;\n panelDomHeight += titleHeightWithSpace;\n attributes.title.width = titleMaxWidth;\n attributes.title.height = titleMaxHeight;\n\n if (isAutoWidthMode()) {\n panelWidth += contentMaxWidth ? contentMaxWidth : titleMaxWidth;\n } else {\n panelWidth += Math.max(titleMaxWidth, contentMaxWidth);\n }\n\n // 处理 content 的自动宽度模式\n if (hasContent) {\n attributes.content.forEach(item => {\n const value = item.value as ITooltipTextStyle & TooltipTextAttrs;\n // 最后一列默认自适应宽度\n if (value && (value.autoWidth ?? true)) {\n value.width =\n panelWidth -\n paddingSpec.left -\n paddingSpec.right -\n maxShapeWidth -\n maxKeyWidth -\n keyStyle.spacing -\n valueStyle.spacing;\n //value.multiLine = true; multiLine 需要用户手动开启,不会自动开启\n if (!value.maxWidth) {\n value.maxWidth = Math.ceil(value.width);\n }\n attributes.valueWidth = Math.max(attributes.valueWidth, value.width);\n }\n });\n }\n\n attributes.panel.width = panelWidth;\n attributes.panel.height = panelHeight;\n attributes.panelDomHeight = panelDomHeight;\n return attributes;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/common.ts"],"names":[],"mappings":";;;AACA,6CAAsD;AAGtD,yDAA2D;AAmB3D,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC;SACjB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;SACvB,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC/B,CAAC;AAPD,gCAOC;AAED,SAAgB,mBAAmB,CAAI,OAA6B,EAAE,GAAG,QAAa;IACpF,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;QAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;YAChB,OAAO,GAAG,CAAC;SACZ;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAPD,kDAOC;AAGD,SAAgB,oBAAoB,CAAC,KAAU,EAAE,eAAuB,MAAM;IAC5E,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,YAAY,CAAC;KACrB;IACD,IAAI,IAAA,iBAAQ,EAAC,KAAK,CAAC,EAAE;QACnB,OAAO,KAAK,CAAC;KACd;IAED,IAAI,IAAA,iBAAQ,EAAC,KAAK,CAAC,IAAK,KAAwB,CAAC,KAAK,IAAK,KAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAC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CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;SACvG;aAAM;YACL,SAAS,GAAG,CAAC,IAAI,CAAC,CAAC;SACpB;QACD,UAAU,GAAG,SAAS,CAAC,GAAG,CACxB,IAAI,CAAC,EAAE,CACL,CAAC,gCACI,KAAK,KACR,IAAI,EAAE,IAAI,GACgC,CAAA,CAC/C,CAAC;KACH;SAAM;QACL,UAAU,GAAI,IAA6B,CAAC,IAA4B,CAAC;QACzE,SAAS,GAAG,IAA4B,CAAC;KAC1C;IAED,MAAM,KAAK,GAAG,IAAA,gCAAiB,EAAC;QAC9B,SAAS,EAAE,MAAA,KAAK,CAAC,SAAS,mCAAI,YAAY;QAC1C,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QACrD,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,UAAU,EAAE,UAAU;KACvB,CAAC,CAAC;IACH,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;QACtB,IAAI,EAAE,SAAS;KAChB,CAAC;AACJ,CAAC,CAAC;AAnCW,QAAA,kBAAkB,sBAmC7B","file":"common.js","sourcesContent":["import type { MaybeArray } from '../../../../typings';\nimport { isObject, isString } from '@visactor/vutils';\nimport type { IRichTextParagraphCharacter } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { getRichTextBounds } from '@visactor/vrender-core';\nimport type { ITooltipTextStyle } from '../interface/style';\nimport type { TooltipRichTextAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IRichTextCharacter } from '@visactor/vrender-core';\n\ninterface IGradientColor {\n [key: string]: any;\n stops: {\n offset: number;\n color: string;\n }[];\n}\n\n/**\n * Escape special HTML characters.\n *\n * @param value A value to convert to string and HTML-escape.\n */\nexport function escapeHTML(value: any): string {\n return String(value)\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\\(/g, '&#40;')\n .replace(/ /g, ' &nbsp;'); // 转义符和真空格夹杂,在转义和正常换行之间取得平衡\n}\n\nexport function pickFirstValidValue<T>(isValid: (element?: T) => any, ...elements: T[]): T | undefined {\n for (const ele of elements) {\n if (isValid(ele)) {\n return ele;\n }\n }\n return undefined;\n}\n\n// 针对渐变色,受底层渲染引擎影响,不一定都能绘制正确,所以这里取 colorStop 的第一个颜色作为 color\nexport function convertToColorString(color: any, defaultColor: string = '#000') {\n if (!color) {\n return defaultColor;\n }\n if (isString(color)) {\n return color;\n }\n\n if (isObject(color) && (color as IGradientColor).stops && (color as IGradientColor).stops[0]) {\n return (color as IGradientColor).stops[0].color || defaultColor;\n }\n\n return defaultColor;\n}\n\n/** 获取元素的绝对缩放因数(支持外部传入 boundingClientRect 提升性能) */\nexport const getScale = (element: HTMLElement, boundingClientRect?: DOMRect) => {\n if (!element) {\n return 1;\n }\n if (!boundingClientRect) {\n boundingClientRect = element.getBoundingClientRect();\n }\n if (element.offsetWidth > 0) {\n return boundingClientRect.width / element.offsetWidth;\n }\n return boundingClientRect.height / element.offsetHeight;\n};\n\ninterface ITooltipTextInfo {\n width: number;\n height: number;\n text: MaybeArray<number> | MaybeArray<string> | TooltipRichTextAttrs;\n}\n\n/** 测量 tooltip 标签文本 */\nexport const measureTooltipText = (text: string | TooltipRichTextAttrs, style: ITooltipTextStyle): ITooltipTextInfo => {\n let textLines: string[] | TooltipRichTextAttrs;\n let textConfig: IRichTextCharacter[];\n if (!((text as TooltipRichTextAttrs)?.type === 'rich' || (text as TooltipRichTextAttrs)?.type === 'html')) {\n text = (text ?? '').toString();\n if (style.multiLine) {\n textLines = text.split('\\n');\n textLines = textLines.map((line, i) => (i < (textLines as string[]).length - 1 ? line + '\\n' : line));\n } else {\n textLines = [text];\n }\n textConfig = textLines.map(\n line =>\n ({\n ...style,\n text: line\n } as unknown as IRichTextParagraphCharacter)\n );\n } else {\n textConfig = (text as TooltipRichTextAttrs).text as IRichTextCharacter[];\n textLines = text as TooltipRichTextAttrs;\n }\n\n const bound = getRichTextBounds({\n wordBreak: style.wordBreak ?? 'break-word',\n maxWidth: style.maxWidth ? style.maxWidth : undefined,\n width: 0,\n height: 0,\n textConfig: textConfig\n });\n return {\n width: bound.width(),\n height: bound.height(),\n text: textLines\n };\n};\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/common.ts"],"names":[],"mappings":";;;AACA,6CAAsD;AAGtD,yDAA2D;AAmB3D,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC;SACjB,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;SACvB,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC/B,CAAC;AAPD,gCAOC;AAED,SAAgB,mBAAmB,CAAI,OAA6B,EAAE,GAAG,QAAa;IACpF,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;QAC1B,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;YAChB,OAAO,GAAG,CAAC;SACZ;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAPD,kDAOC;AAGD,SAAgB,oBAAoB,CAAC,KAAU,EAAE,eAAuB,MAAM;IAC5E,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,YAAY,CAAC;KACrB;IACD,IAAI,IAAA,iBAAQ,EAAC,KAAK,CAAC,EAAE;QACnB,OAAO,KAAK,CAAC;KACd;IAED,IAAI,IAAA,iBAAQ,EAAC,KAAK,CAAC,IAAK,KAAwB,CAAC,KAAK,IAAK,KAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAC5F,OAAQ,KAAwB,CAAC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,CAAC,CAAC,CAAC;SACvG;aAAM;YACL,SAAS,GAAG,CAAC,IAAI,CAAC,CAAC;SACpB;QACD,UAAU,GAAG,SAAS,CAAC,GAAG,CACxB,IAAI,CAAC,EAAE,CACL,CAAC,gCACI,KAAK,KACR,IAAI,EAAE,IAAI,GACgC,CAAA,CAC/C,CAAC;KACH;SAAM;QACL,UAAU,GAAI,IAA6B,CAAC,IAA4B,CAAC;QACzE,SAAS,GAAG,IAA4B,CAAC;KAC1C;IAED,MAAM,KAAK,GAAG,IAAA,gCAAiB,EAAC;QAC9B,SAAS,EAAE,MAAC,KAAa,CAAC,SAAS,mCAAI,YAAY;QACnD,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;QACrD,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,UAAU,EAAE,UAAU;KACvB,CAAC,CAAC;IACH,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;QACpB,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE;QACtB,IAAI,EAAE,SAAS;KAChB,CAAC;AACJ,CAAC,CAAC;AAnCW,QAAA,kBAAkB,sBAmC7B","file":"common.js","sourcesContent":["import type { MaybeArray } from '../../../../typings';\nimport { isObject, isString } from '@visactor/vutils';\nimport type { IRichTextParagraphCharacter } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { getRichTextBounds } from '@visactor/vrender-core';\nimport type { ITooltipTextStyle } from '../interface/style';\nimport type { TooltipRichTextAttrs } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport type { IRichTextCharacter } from '@visactor/vrender-core';\n\ninterface IGradientColor {\n [key: string]: any;\n stops: {\n offset: number;\n color: string;\n }[];\n}\n\n/**\n * Escape special HTML characters.\n *\n * @param value A value to convert to string and HTML-escape.\n */\nexport function escapeHTML(value: any): string {\n return String(value)\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\\(/g, '&#40;')\n .replace(/ /g, ' &nbsp;'); // 转义符和真空格夹杂,在转义和正常换行之间取得平衡\n}\n\nexport function pickFirstValidValue<T>(isValid: (element?: T) => any, ...elements: T[]): T | undefined {\n for (const ele of elements) {\n if (isValid(ele)) {\n return ele;\n }\n }\n return undefined;\n}\n\n// 针对渐变色,受底层渲染引擎影响,不一定都能绘制正确,所以这里取 colorStop 的第一个颜色作为 color\nexport function convertToColorString(color: any, defaultColor: string = '#000') {\n if (!color) {\n return defaultColor;\n }\n if (isString(color)) {\n return color;\n }\n\n if (isObject(color) && (color as IGradientColor).stops && (color as IGradientColor).stops[0]) {\n return (color as IGradientColor).stops[0].color || defaultColor;\n }\n\n return defaultColor;\n}\n\n/** 获取元素的绝对缩放因数(支持外部传入 boundingClientRect 提升性能) */\nexport const getScale = (element: HTMLElement, boundingClientRect?: DOMRect) => {\n if (!element) {\n return 1;\n }\n if (!boundingClientRect) {\n boundingClientRect = element.getBoundingClientRect();\n }\n if (element.offsetWidth > 0) {\n return boundingClientRect.width / element.offsetWidth;\n }\n return boundingClientRect.height / element.offsetHeight;\n};\n\ninterface ITooltipTextInfo {\n width: number;\n height: number;\n text: MaybeArray<number> | MaybeArray<string> | TooltipRichTextAttrs;\n}\n\n/** 测量 tooltip 标签文本 */\nexport const measureTooltipText = (text: string | TooltipRichTextAttrs, style: ITooltipTextStyle): ITooltipTextInfo => {\n let textLines: string[] | TooltipRichTextAttrs;\n let textConfig: IRichTextCharacter[];\n if (!((text as TooltipRichTextAttrs)?.type === 'rich' || (text as TooltipRichTextAttrs)?.type === 'html')) {\n text = (text ?? '').toString();\n if (style.multiLine) {\n textLines = text.split('\\n');\n textLines = textLines.map((line, i) => (i < (textLines as string[]).length - 1 ? line + '\\n' : line));\n } else {\n textLines = [text];\n }\n textConfig = textLines.map(\n line =>\n ({\n ...style,\n text: line\n } as unknown as IRichTextParagraphCharacter)\n );\n } else {\n textConfig = (text as TooltipRichTextAttrs).text as IRichTextCharacter[];\n textLines = text as TooltipRichTextAttrs;\n }\n\n const bound = getRichTextBounds({\n wordBreak: (style as any).wordBreak ?? 'break-word',\n maxWidth: style.maxWidth ? style.maxWidth : undefined,\n width: 0,\n height: 0,\n textConfig: textConfig\n });\n return {\n width: bound.width(),\n height: bound.height(),\n text: textLines\n };\n};\n"]}
@@ -2,11 +2,9 @@ import type { IDimensionData } from '../../../../event';
2
2
  import { type ILayoutPoint } from '../../../../typings';
3
3
  import type { IFixedTooltipPositionPattern, IGlobalTooltipPositionPattern, TooltipFixedPosition } from '../../../../typings/tooltip/position';
4
4
  export declare const getActualTooltipPositionValue: (position: number | ((event: MouseEvent) => number), event: MouseEvent) => number;
5
- export type TooltipHorizontalPositionType = 'left' | 'right' | 'center' | 'centerLeft' | 'centerRight';
6
- export type TooltipVerticalPositionType = 'top' | 'bottom' | 'center' | 'centerTop' | 'centerBottom';
7
- export declare const positionType: Record<TooltipFixedPosition, [TooltipHorizontalPositionType, TooltipVerticalPositionType]>;
8
- export declare const getHorizontalPositionType: (position: TooltipFixedPosition, defaultCase?: TooltipHorizontalPositionType) => TooltipHorizontalPositionType;
9
- export declare const getVerticalPositionType: (position: TooltipFixedPosition, defaultCase?: TooltipVerticalPositionType) => TooltipVerticalPositionType;
5
+ export type TooltipPositionType = -2 | -1 | 0 | 1 | 2;
6
+ export declare const positionType: Record<TooltipFixedPosition, [TooltipPositionType, TooltipPositionType]>;
7
+ export declare const getPositionType: (position: TooltipFixedPosition, dim: 'x' | 'y', defaultCase?: TooltipPositionType) => TooltipPositionType;
10
8
  export declare const getCartesianCrosshairRect: (dimensionData: IDimensionData, layoutStartPoint: ILayoutPoint) => {
11
9
  visible: boolean;
12
10
  start: {