@visactor/vchart 1.12.15 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +2381 -1727
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/animation/utils.js +8 -6
  6. package/cjs/animation/utils.js.map +1 -1
  7. package/cjs/chart/base/base-chart.d.ts +1 -0
  8. package/cjs/chart/base/base-chart.js +3 -0
  9. package/cjs/chart/base/base-chart.js.map +1 -1
  10. package/cjs/chart/index.d.ts +5 -3
  11. package/cjs/chart/index.js +16 -2
  12. package/cjs/chart/index.js.map +1 -1
  13. package/cjs/chart/interface/chart.d.ts +1 -0
  14. package/cjs/chart/interface/chart.js.map +1 -1
  15. package/cjs/chart/interface/type.d.ts +2 -1
  16. package/cjs/chart/interface/type.js +1 -1
  17. package/cjs/chart/interface/type.js.map +1 -1
  18. package/cjs/chart/pictogram/index.d.ts +3 -0
  19. package/cjs/{plugin/components/tooltip-handler/canvas → chart/pictogram}/index.js +2 -1
  20. package/cjs/chart/pictogram/index.js.map +1 -0
  21. package/cjs/chart/pictogram/interface.d.ts +6 -0
  22. package/cjs/chart/pictogram/interface.js.map +1 -0
  23. package/cjs/chart/pictogram/pictogram-transformer.d.ts +8 -0
  24. package/cjs/chart/pictogram/pictogram-transformer.js +38 -0
  25. package/cjs/chart/pictogram/pictogram-transformer.js.map +1 -0
  26. package/cjs/chart/pictogram/pictogram.d.ts +12 -0
  27. package/cjs/chart/pictogram/pictogram.js +24 -0
  28. package/cjs/chart/pictogram/pictogram.js.map +1 -0
  29. package/cjs/chart/sankey/sankey-transformer.js +2 -1
  30. package/cjs/chart/sankey/sankey-transformer.js.map +1 -1
  31. package/cjs/chart/sankey/sankey.js +3 -2
  32. package/cjs/chart/sankey/sankey.js.map +1 -1
  33. package/cjs/compile/mark/compilable-mark.js +1 -1
  34. package/cjs/compile/mark/compilable-mark.js.map +1 -1
  35. package/cjs/component/custom-mark/custom-mark.js +7 -1
  36. package/cjs/component/custom-mark/custom-mark.js.map +1 -1
  37. package/cjs/component/geo/geo-coordinate.js +6 -6
  38. package/cjs/component/geo/geo-coordinate.js.map +1 -1
  39. package/cjs/component/tooltip/interface/theme.d.ts +2 -2
  40. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  41. package/cjs/component/tooltip/utils/get-value.js +3 -1
  42. package/cjs/component/tooltip/utils/get-value.js.map +1 -1
  43. package/cjs/core/index.d.ts +1 -1
  44. package/cjs/core/index.js +1 -1
  45. package/cjs/core/index.js.map +1 -1
  46. package/cjs/core/vchart.d.ts +4 -1
  47. package/cjs/core/vchart.js +21 -7
  48. package/cjs/core/vchart.js.map +1 -1
  49. package/cjs/data/transforms/pictogram.d.ts +84 -0
  50. package/cjs/data/transforms/pictogram.js +149 -0
  51. package/cjs/data/transforms/pictogram.js.map +1 -0
  52. package/cjs/mark/group.d.ts +3 -2
  53. package/cjs/mark/group.js +12 -2
  54. package/cjs/mark/group.js.map +1 -1
  55. package/cjs/mark/interface/type.d.ts +2 -1
  56. package/cjs/mark/interface/type.js +2 -1
  57. package/cjs/mark/interface/type.js.map +1 -1
  58. package/cjs/plugin/components/tooltip-handler/base.d.ts +4 -6
  59. package/cjs/plugin/components/tooltip-handler/base.js +3 -20
  60. package/cjs/plugin/components/tooltip-handler/base.js.map +1 -1
  61. package/cjs/plugin/components/tooltip-handler/{canvas/canvas-tooltip-handler.d.ts → canvas-tooltip-handler.d.ts} +8 -3
  62. package/cjs/plugin/components/tooltip-handler/{canvas/canvas-tooltip-handler.js → canvas-tooltip-handler.js} +15 -2
  63. package/cjs/plugin/components/tooltip-handler/canvas-tooltip-handler.js.map +1 -0
  64. package/cjs/plugin/components/tooltip-handler/constants.d.ts +7 -8
  65. package/cjs/plugin/components/tooltip-handler/constants.js +6 -9
  66. package/cjs/plugin/components/tooltip-handler/constants.js.map +1 -1
  67. package/cjs/plugin/components/tooltip-handler/{dom/dom-tooltip-handler.d.ts → dom-tooltip-handler.d.ts} +20 -9
  68. package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js +187 -0
  69. package/cjs/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -0
  70. package/cjs/plugin/components/tooltip-handler/index.d.ts +2 -2
  71. package/cjs/plugin/components/tooltip-handler/index.js +1 -1
  72. package/cjs/plugin/components/tooltip-handler/index.js.map +1 -1
  73. package/cjs/plugin/components/tooltip-handler/interface/index.d.ts +15 -2
  74. package/cjs/plugin/components/tooltip-handler/interface/index.js +1 -16
  75. package/cjs/plugin/components/tooltip-handler/interface/index.js.map +1 -1
  76. package/cjs/plugin/components/tooltip-handler/utils/attribute.d.ts +9 -2
  77. package/cjs/plugin/components/tooltip-handler/utils/attribute.js +36 -18
  78. package/cjs/plugin/components/tooltip-handler/utils/attribute.js.map +1 -1
  79. package/cjs/plugin/components/tooltip-handler/utils/common.d.ts +1 -12
  80. package/cjs/plugin/components/tooltip-handler/utils/common.js +7 -35
  81. package/cjs/plugin/components/tooltip-handler/utils/common.js.map +1 -1
  82. package/cjs/plugin/components/tooltip-handler/utils/style.d.ts +18 -0
  83. package/cjs/plugin/components/tooltip-handler/utils/style.js +94 -0
  84. package/cjs/plugin/components/tooltip-handler/utils/style.js.map +1 -0
  85. package/cjs/plugin/components/tooltip-handler/utils/svg.d.ts +2 -0
  86. package/cjs/plugin/components/tooltip-handler/utils/svg.js +48 -0
  87. package/cjs/plugin/components/tooltip-handler/utils/svg.js.map +1 -0
  88. package/cjs/series/base/base-series.d.ts +22 -6
  89. package/cjs/series/base/base-series.js +33 -24
  90. package/cjs/series/base/base-series.js.map +1 -1
  91. package/cjs/series/interface/type.d.ts +4 -2
  92. package/cjs/series/interface/type.js +4 -2
  93. package/cjs/series/interface/type.js.map +1 -1
  94. package/cjs/series/pictogram/constant.d.ts +2 -0
  95. package/cjs/series/pictogram/constant.js +15 -0
  96. package/cjs/series/pictogram/constant.js.map +1 -0
  97. package/cjs/series/pictogram/interface.d.ts +15 -0
  98. package/cjs/series/pictogram/interface.js.map +1 -0
  99. package/cjs/series/pictogram/pictogram-transformer.d.ts +5 -0
  100. package/cjs/series/pictogram/pictogram-transformer.js +23 -0
  101. package/cjs/series/pictogram/pictogram-transformer.js.map +1 -0
  102. package/cjs/series/pictogram/pictogram.d.ts +77 -0
  103. package/cjs/series/pictogram/pictogram.js +303 -0
  104. package/cjs/series/pictogram/pictogram.js.map +1 -0
  105. package/cjs/series/pictogram/svg-source.d.ts +7 -0
  106. package/cjs/series/pictogram/svg-source.js +38 -0
  107. package/cjs/series/pictogram/svg-source.js.map +1 -0
  108. package/cjs/series/pictogram/tooltip-helper.d.ts +9 -0
  109. package/cjs/series/pictogram/tooltip-helper.js +26 -0
  110. package/cjs/series/pictogram/tooltip-helper.js.map +1 -0
  111. package/cjs/series/sankey/interface.d.ts +1 -0
  112. package/cjs/series/sankey/interface.js.map +1 -1
  113. package/cjs/series/sankey/sankey.js +4 -0
  114. package/cjs/series/sankey/sankey.js.map +1 -1
  115. package/cjs/typings/spec/common.d.ts +1 -0
  116. package/cjs/typings/spec/common.js.map +1 -1
  117. package/cjs/typings/tooltip/common.d.ts +3 -1
  118. package/cjs/typings/tooltip/common.js.map +1 -1
  119. package/esm/animation/utils.js +8 -6
  120. package/esm/animation/utils.js.map +1 -1
  121. package/esm/chart/base/base-chart.d.ts +1 -0
  122. package/esm/chart/base/base-chart.js +3 -0
  123. package/esm/chart/base/base-chart.js.map +1 -1
  124. package/esm/chart/index.d.ts +5 -3
  125. package/esm/chart/index.js +4 -2
  126. package/esm/chart/index.js.map +1 -1
  127. package/esm/chart/interface/chart.d.ts +1 -0
  128. package/esm/chart/interface/chart.js.map +1 -1
  129. package/esm/chart/interface/type.d.ts +2 -1
  130. package/esm/chart/interface/type.js +1 -1
  131. package/esm/chart/interface/type.js.map +1 -1
  132. package/esm/chart/pictogram/index.d.ts +3 -0
  133. package/esm/chart/pictogram/index.js +6 -0
  134. package/esm/chart/pictogram/index.js.map +1 -0
  135. package/esm/chart/pictogram/interface.d.ts +6 -0
  136. package/esm/chart/pictogram/interface.js.map +1 -0
  137. package/esm/chart/pictogram/pictogram-transformer.d.ts +8 -0
  138. package/esm/chart/pictogram/pictogram-transformer.js +32 -0
  139. package/esm/chart/pictogram/pictogram-transformer.js.map +1 -0
  140. package/esm/chart/pictogram/pictogram.d.ts +12 -0
  141. package/esm/chart/pictogram/pictogram.js +24 -0
  142. package/esm/chart/pictogram/pictogram.js.map +1 -0
  143. package/esm/chart/sankey/sankey-transformer.js +2 -1
  144. package/esm/chart/sankey/sankey-transformer.js.map +1 -1
  145. package/esm/chart/sankey/sankey.js +3 -1
  146. package/esm/chart/sankey/sankey.js.map +1 -1
  147. package/esm/compile/mark/compilable-mark.js +1 -1
  148. package/esm/compile/mark/compilable-mark.js.map +1 -1
  149. package/esm/component/custom-mark/custom-mark.js +7 -1
  150. package/esm/component/custom-mark/custom-mark.js.map +1 -1
  151. package/esm/component/geo/geo-coordinate.js +6 -6
  152. package/esm/component/geo/geo-coordinate.js.map +1 -1
  153. package/esm/component/tooltip/interface/theme.d.ts +2 -2
  154. package/esm/component/tooltip/interface/theme.js.map +1 -1
  155. package/esm/component/tooltip/utils/get-value.js +3 -2
  156. package/esm/component/tooltip/utils/get-value.js.map +1 -1
  157. package/esm/core/index.d.ts +1 -1
  158. package/esm/core/index.js +1 -1
  159. package/esm/core/index.js.map +1 -1
  160. package/esm/core/vchart.d.ts +4 -1
  161. package/esm/core/vchart.js +23 -6
  162. package/esm/core/vchart.js.map +1 -1
  163. package/esm/data/transforms/pictogram.d.ts +84 -0
  164. package/esm/data/transforms/pictogram.js +145 -0
  165. package/esm/data/transforms/pictogram.js.map +1 -0
  166. package/esm/mark/group.d.ts +3 -2
  167. package/esm/mark/group.js +12 -2
  168. package/esm/mark/group.js.map +1 -1
  169. package/esm/mark/interface/type.d.ts +2 -1
  170. package/esm/mark/interface/type.js +2 -1
  171. package/esm/mark/interface/type.js.map +1 -1
  172. package/esm/plugin/components/tooltip-handler/base.d.ts +4 -6
  173. package/esm/plugin/components/tooltip-handler/base.js +3 -22
  174. package/esm/plugin/components/tooltip-handler/base.js.map +1 -1
  175. package/esm/plugin/components/tooltip-handler/{canvas/canvas-tooltip-handler.d.ts → canvas-tooltip-handler.d.ts} +8 -3
  176. package/esm/plugin/components/tooltip-handler/{canvas/canvas-tooltip-handler.js → canvas-tooltip-handler.js} +19 -5
  177. package/esm/plugin/components/tooltip-handler/canvas-tooltip-handler.js.map +1 -0
  178. package/esm/plugin/components/tooltip-handler/constants.d.ts +7 -8
  179. package/esm/plugin/components/tooltip-handler/constants.js +9 -4
  180. package/esm/plugin/components/tooltip-handler/constants.js.map +1 -1
  181. package/esm/plugin/components/tooltip-handler/{dom/dom-tooltip-handler.d.ts → dom-tooltip-handler.d.ts} +20 -9
  182. package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js +191 -0
  183. package/esm/plugin/components/tooltip-handler/dom-tooltip-handler.js.map +1 -0
  184. package/esm/plugin/components/tooltip-handler/index.d.ts +2 -2
  185. package/esm/plugin/components/tooltip-handler/index.js +2 -2
  186. package/esm/plugin/components/tooltip-handler/index.js.map +1 -1
  187. package/esm/plugin/components/tooltip-handler/interface/index.d.ts +15 -2
  188. package/esm/plugin/components/tooltip-handler/interface/index.js +1 -3
  189. package/esm/plugin/components/tooltip-handler/interface/index.js.map +1 -1
  190. package/esm/plugin/components/tooltip-handler/utils/attribute.d.ts +9 -2
  191. package/esm/plugin/components/tooltip-handler/utils/attribute.js +31 -11
  192. package/esm/plugin/components/tooltip-handler/utils/attribute.js.map +1 -1
  193. package/esm/plugin/components/tooltip-handler/utils/common.d.ts +1 -12
  194. package/esm/plugin/components/tooltip-handler/utils/common.js +3 -31
  195. package/esm/plugin/components/tooltip-handler/utils/common.js.map +1 -1
  196. package/esm/plugin/components/tooltip-handler/utils/style.d.ts +18 -0
  197. package/esm/plugin/components/tooltip-handler/utils/style.js +80 -0
  198. package/esm/plugin/components/tooltip-handler/utils/style.js.map +1 -0
  199. package/esm/plugin/components/tooltip-handler/utils/svg.d.ts +2 -0
  200. package/esm/plugin/components/tooltip-handler/utils/svg.js +42 -0
  201. package/esm/plugin/components/tooltip-handler/utils/svg.js.map +1 -0
  202. package/esm/series/base/base-series.d.ts +22 -6
  203. package/esm/series/base/base-series.js +33 -23
  204. package/esm/series/base/base-series.js.map +1 -1
  205. package/esm/series/interface/type.d.ts +4 -2
  206. package/esm/series/interface/type.js +4 -2
  207. package/esm/series/interface/type.js.map +1 -1
  208. package/esm/series/pictogram/constant.d.ts +2 -0
  209. package/esm/series/pictogram/constant.js +9 -0
  210. package/esm/series/pictogram/constant.js.map +1 -0
  211. package/esm/series/pictogram/interface.d.ts +15 -0
  212. package/esm/series/pictogram/interface.js.map +1 -0
  213. package/esm/series/pictogram/pictogram-transformer.d.ts +5 -0
  214. package/esm/series/pictogram/pictogram-transformer.js +19 -0
  215. package/esm/series/pictogram/pictogram-transformer.js.map +1 -0
  216. package/esm/series/pictogram/pictogram.d.ts +77 -0
  217. package/esm/series/pictogram/pictogram.js +329 -0
  218. package/esm/series/pictogram/pictogram.js.map +1 -0
  219. package/esm/series/pictogram/svg-source.d.ts +7 -0
  220. package/esm/series/pictogram/svg-source.js +35 -0
  221. package/esm/series/pictogram/svg-source.js.map +1 -0
  222. package/esm/series/pictogram/tooltip-helper.d.ts +9 -0
  223. package/esm/series/pictogram/tooltip-helper.js +18 -0
  224. package/esm/series/pictogram/tooltip-helper.js.map +1 -0
  225. package/esm/series/sankey/interface.d.ts +1 -0
  226. package/esm/series/sankey/interface.js.map +1 -1
  227. package/esm/series/sankey/sankey.js +4 -0
  228. package/esm/series/sankey/sankey.js.map +1 -1
  229. package/esm/typings/spec/common.d.ts +1 -0
  230. package/esm/typings/spec/common.js.map +1 -1
  231. package/esm/typings/tooltip/common.d.ts +3 -1
  232. package/esm/typings/tooltip/common.js.map +1 -1
  233. package/package.json +15 -15
  234. package/cjs/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +0 -1
  235. package/cjs/plugin/components/tooltip-handler/canvas/index.d.ts +0 -1
  236. package/cjs/plugin/components/tooltip-handler/canvas/index.js.map +0 -1
  237. package/cjs/plugin/components/tooltip-handler/dom/constant.d.ts +0 -1
  238. package/cjs/plugin/components/tooltip-handler/dom/constant.js +0 -6
  239. package/cjs/plugin/components/tooltip-handler/dom/constant.js.map +0 -1
  240. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +0 -98
  241. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +0 -1
  242. package/cjs/plugin/components/tooltip-handler/dom/index.d.ts +0 -1
  243. package/cjs/plugin/components/tooltip-handler/dom/index.js +0 -21
  244. package/cjs/plugin/components/tooltip-handler/dom/index.js.map +0 -1
  245. package/cjs/plugin/components/tooltip-handler/dom/interface.d.ts +0 -58
  246. package/cjs/plugin/components/tooltip-handler/dom/interface.js.map +0 -1
  247. package/cjs/plugin/components/tooltip-handler/dom/model/base-tooltip-model.d.ts +0 -25
  248. package/cjs/plugin/components/tooltip-handler/dom/model/base-tooltip-model.js +0 -73
  249. package/cjs/plugin/components/tooltip-handler/dom/model/base-tooltip-model.js.map +0 -1
  250. package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.d.ts +0 -23
  251. package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.js +0 -126
  252. package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.js.map +0 -1
  253. package/cjs/plugin/components/tooltip-handler/dom/model/content-model.d.ts +0 -14
  254. package/cjs/plugin/components/tooltip-handler/dom/model/content-model.js +0 -54
  255. package/cjs/plugin/components/tooltip-handler/dom/model/content-model.js.map +0 -1
  256. package/cjs/plugin/components/tooltip-handler/dom/model/interface.d.ts +0 -10
  257. package/cjs/plugin/components/tooltip-handler/dom/model/interface.js.map +0 -1
  258. package/cjs/plugin/components/tooltip-handler/dom/model/shape-model.d.ts +0 -23
  259. package/cjs/plugin/components/tooltip-handler/dom/model/shape-model.js +0 -69
  260. package/cjs/plugin/components/tooltip-handler/dom/model/shape-model.js.map +0 -1
  261. package/cjs/plugin/components/tooltip-handler/dom/model/style-constants.d.ts +0 -7
  262. package/cjs/plugin/components/tooltip-handler/dom/model/style-constants.js +0 -34
  263. package/cjs/plugin/components/tooltip-handler/dom/model/style-constants.js.map +0 -1
  264. package/cjs/plugin/components/tooltip-handler/dom/model/text-model.d.ts +0 -5
  265. package/cjs/plugin/components/tooltip-handler/dom/model/text-model.js +0 -21
  266. package/cjs/plugin/components/tooltip-handler/dom/model/text-model.js.map +0 -1
  267. package/cjs/plugin/components/tooltip-handler/dom/model/title-model.d.ts +0 -15
  268. package/cjs/plugin/components/tooltip-handler/dom/model/title-model.js +0 -66
  269. package/cjs/plugin/components/tooltip-handler/dom/model/title-model.js.map +0 -1
  270. package/cjs/plugin/components/tooltip-handler/dom/model/tooltip-model.d.ts +0 -21
  271. package/cjs/plugin/components/tooltip-handler/dom/model/tooltip-model.js +0 -79
  272. package/cjs/plugin/components/tooltip-handler/dom/model/tooltip-model.js.map +0 -1
  273. package/cjs/plugin/components/tooltip-handler/dom/utils/common.d.ts +0 -3
  274. package/cjs/plugin/components/tooltip-handler/dom/utils/common.js +0 -33
  275. package/cjs/plugin/components/tooltip-handler/dom/utils/common.js.map +0 -1
  276. package/cjs/plugin/components/tooltip-handler/dom/utils/index.d.ts +0 -2
  277. package/cjs/plugin/components/tooltip-handler/dom/utils/index.js +0 -21
  278. package/cjs/plugin/components/tooltip-handler/dom/utils/index.js.map +0 -1
  279. package/cjs/plugin/components/tooltip-handler/dom/utils/style.d.ts +0 -4
  280. package/cjs/plugin/components/tooltip-handler/dom/utils/style.js +0 -91
  281. package/cjs/plugin/components/tooltip-handler/dom/utils/style.js.map +0 -1
  282. package/cjs/plugin/components/tooltip-handler/interface/common.d.ts +0 -4
  283. package/cjs/plugin/components/tooltip-handler/interface/common.js +0 -6
  284. package/cjs/plugin/components/tooltip-handler/interface/common.js.map +0 -1
  285. package/cjs/plugin/components/tooltip-handler/interface/style.d.ts +0 -13
  286. package/cjs/plugin/components/tooltip-handler/interface/style.js +0 -6
  287. package/cjs/plugin/components/tooltip-handler/interface/style.js.map +0 -1
  288. package/cjs/plugin/components/tooltip-handler/utils/index.d.ts +0 -3
  289. package/cjs/plugin/components/tooltip-handler/utils/index.js +0 -22
  290. package/cjs/plugin/components/tooltip-handler/utils/index.js.map +0 -1
  291. package/esm/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +0 -1
  292. package/esm/plugin/components/tooltip-handler/canvas/index.d.ts +0 -1
  293. package/esm/plugin/components/tooltip-handler/canvas/index.js +0 -2
  294. package/esm/plugin/components/tooltip-handler/canvas/index.js.map +0 -1
  295. package/esm/plugin/components/tooltip-handler/dom/constant.d.ts +0 -1
  296. package/esm/plugin/components/tooltip-handler/dom/constant.js +0 -2
  297. package/esm/plugin/components/tooltip-handler/dom/constant.js.map +0 -1
  298. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +0 -104
  299. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +0 -1
  300. package/esm/plugin/components/tooltip-handler/dom/index.d.ts +0 -1
  301. package/esm/plugin/components/tooltip-handler/dom/index.js +0 -2
  302. package/esm/plugin/components/tooltip-handler/dom/index.js.map +0 -1
  303. package/esm/plugin/components/tooltip-handler/dom/interface.d.ts +0 -58
  304. package/esm/plugin/components/tooltip-handler/dom/interface.js.map +0 -1
  305. package/esm/plugin/components/tooltip-handler/dom/model/base-tooltip-model.d.ts +0 -25
  306. package/esm/plugin/components/tooltip-handler/dom/model/base-tooltip-model.js +0 -67
  307. package/esm/plugin/components/tooltip-handler/dom/model/base-tooltip-model.js.map +0 -1
  308. package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.d.ts +0 -23
  309. package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.js +0 -130
  310. package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.js.map +0 -1
  311. package/esm/plugin/components/tooltip-handler/dom/model/content-model.d.ts +0 -14
  312. package/esm/plugin/components/tooltip-handler/dom/model/content-model.js +0 -52
  313. package/esm/plugin/components/tooltip-handler/dom/model/content-model.js.map +0 -1
  314. package/esm/plugin/components/tooltip-handler/dom/model/interface.d.ts +0 -10
  315. package/esm/plugin/components/tooltip-handler/dom/model/interface.js.map +0 -1
  316. package/esm/plugin/components/tooltip-handler/dom/model/shape-model.d.ts +0 -23
  317. package/esm/plugin/components/tooltip-handler/dom/model/shape-model.js +0 -66
  318. package/esm/plugin/components/tooltip-handler/dom/model/shape-model.js.map +0 -1
  319. package/esm/plugin/components/tooltip-handler/dom/model/style-constants.d.ts +0 -7
  320. package/esm/plugin/components/tooltip-handler/dom/model/style-constants.js +0 -41
  321. package/esm/plugin/components/tooltip-handler/dom/model/style-constants.js.map +0 -1
  322. package/esm/plugin/components/tooltip-handler/dom/model/text-model.d.ts +0 -5
  323. package/esm/plugin/components/tooltip-handler/dom/model/text-model.js +0 -13
  324. package/esm/plugin/components/tooltip-handler/dom/model/text-model.js.map +0 -1
  325. package/esm/plugin/components/tooltip-handler/dom/model/title-model.d.ts +0 -15
  326. package/esm/plugin/components/tooltip-handler/dom/model/title-model.js +0 -65
  327. package/esm/plugin/components/tooltip-handler/dom/model/title-model.js.map +0 -1
  328. package/esm/plugin/components/tooltip-handler/dom/model/tooltip-model.d.ts +0 -21
  329. package/esm/plugin/components/tooltip-handler/dom/model/tooltip-model.js +0 -82
  330. package/esm/plugin/components/tooltip-handler/dom/model/tooltip-model.js.map +0 -1
  331. package/esm/plugin/components/tooltip-handler/dom/utils/common.d.ts +0 -3
  332. package/esm/plugin/components/tooltip-handler/dom/utils/common.js +0 -22
  333. package/esm/plugin/components/tooltip-handler/dom/utils/common.js.map +0 -1
  334. package/esm/plugin/components/tooltip-handler/dom/utils/index.d.ts +0 -2
  335. package/esm/plugin/components/tooltip-handler/dom/utils/index.js +0 -4
  336. package/esm/plugin/components/tooltip-handler/dom/utils/index.js.map +0 -1
  337. package/esm/plugin/components/tooltip-handler/dom/utils/style.d.ts +0 -4
  338. package/esm/plugin/components/tooltip-handler/dom/utils/style.js +0 -87
  339. package/esm/plugin/components/tooltip-handler/dom/utils/style.js.map +0 -1
  340. package/esm/plugin/components/tooltip-handler/interface/common.d.ts +0 -4
  341. package/esm/plugin/components/tooltip-handler/interface/common.js +0 -2
  342. package/esm/plugin/components/tooltip-handler/interface/common.js.map +0 -1
  343. package/esm/plugin/components/tooltip-handler/interface/style.d.ts +0 -13
  344. package/esm/plugin/components/tooltip-handler/interface/style.js +0 -2
  345. package/esm/plugin/components/tooltip-handler/interface/style.js.map +0 -1
  346. package/esm/plugin/components/tooltip-handler/utils/index.d.ts +0 -3
  347. package/esm/plugin/components/tooltip-handler/utils/index.js +0 -6
  348. package/esm/plugin/components/tooltip-handler/utils/index.js.map +0 -1
  349. /package/cjs/{plugin/components/tooltip-handler/dom → chart/pictogram}/interface.js +0 -0
  350. /package/cjs/{plugin/components/tooltip-handler/dom/model → series/pictogram}/interface.js +0 -0
  351. /package/esm/{plugin/components/tooltip-handler/dom → chart/pictogram}/interface.js +0 -0
  352. /package/esm/{plugin/components/tooltip-handler/dom/model → series/pictogram}/interface.js +0 -0
@@ -1,7 +1,10 @@
1
- import { BaseTooltipHandler } from '../base';
1
+ import { BaseTooltipHandler } from './base';
2
2
  import { Tooltip as TooltipComponent } from '@visactor/vrender-components';
3
- import type { TooltipHandlerParams } from '../../../../component/tooltip';
4
- import type { IComponentPluginService } from '../../interface';
3
+ import type { TooltipHandlerParams } from '../../../component/tooltip';
4
+ import type { IComponentPluginService } from '../interface';
5
+ import type { ITooltipActual } from '../../../typings';
6
+ import type { IContainerSize } from '@visactor/vrender-components';
7
+ import type { ITooltipAttributes } from './interface';
5
8
  export declare class CanvasTooltipHandler extends BaseTooltipHandler {
6
9
  static readonly type: string;
7
10
  readonly type: string;
@@ -9,10 +12,12 @@ export declare class CanvasTooltipHandler extends BaseTooltipHandler {
9
12
  protected _el?: HTMLCanvasElement;
10
13
  protected _tooltipCanvasId?: string;
11
14
  protected _tooltipComponent: TooltipComponent;
15
+ protected _attributes?: ITooltipAttributes | null;
12
16
  constructor();
13
17
  onAdd(service: IComponentPluginService<any>): void;
14
18
  private _initTooltipComponent;
15
19
  private _getLayer;
20
+ protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined;
16
21
  protected _removeTooltip(): void;
17
22
  protected _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;
18
23
  isTooltipShown(): boolean;
@@ -1,16 +1,18 @@
1
- import { BaseTooltipHandler } from "../base";
1
+ import { BaseTooltipHandler } from "./base";
2
2
 
3
3
  import { Tooltip as TooltipComponent } from "@visactor/vrender-components";
4
4
 
5
- import { isValid } from "@visactor/vutils";
5
+ import { isValid, isNil } from "@visactor/vutils";
6
6
 
7
- import { registerComponentPlugin } from "../../register";
7
+ import { registerComponentPlugin } from "../register";
8
8
 
9
- import { TooltipHandlerType } from "../../../../component/tooltip/constant";
9
+ import { TooltipHandlerType } from "../../../component/tooltip/constant";
10
+
11
+ import { getTooltipAttributes } from "./utils/attribute";
10
12
 
11
13
  export class CanvasTooltipHandler extends BaseTooltipHandler {
12
14
  constructor() {
13
- super(CanvasTooltipHandler.type), this.type = TooltipHandlerType.canvas;
15
+ super(CanvasTooltipHandler.type), this.type = TooltipHandlerType.canvas, this._attributes = null;
14
16
  }
15
17
  onAdd(service) {
16
18
  var _a;
@@ -30,6 +32,18 @@ export class CanvasTooltipHandler extends BaseTooltipHandler {
30
32
  return layerCanvas && layerCanvas.style && (layerCanvas.style.touchAction = "none",
31
33
  layerCanvas.style.pointerEvents = "none"), this._layer;
32
34
  }
35
+ _getTooltipBoxSize(actualTooltip, changePositionOnly) {
36
+ var _a, _b, _c;
37
+ if (!changePositionOnly || isNil(this._attributes)) {
38
+ const chartTheme = null !== (_b = null === (_a = this._chartOption) || void 0 === _a ? void 0 : _a.getTheme()) && void 0 !== _b ? _b : {};
39
+ this._attributes = getTooltipAttributes(actualTooltip, this._component.getSpec(), chartTheme);
40
+ }
41
+ const {panel: panel} = null !== (_c = this._attributes) && void 0 !== _c ? _c : {};
42
+ return {
43
+ width: panel.width + panel.lineWidth,
44
+ height: panel.height + panel.lineWidth
45
+ };
46
+ }
33
47
  _removeTooltip() {
34
48
  this._layer && this._layer.removeAllChild(), this._attributes = null;
35
49
  }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/canvas-tooltip-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAMzD,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;IAU1D;QACE,KAAK,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAT1B,SAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC;QAMhC,gBAAW,GAA+B,IAAI,CAAC;IAIzD,CAAC;IAED,KAAK,CAAC,OAAqC;;QACzC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrB,IAAI,CAAC,gBAAgB,GAAG,MAAC,IAAI,CAAC,YAAY,CAAC,UAAkB,0CAAE,eAAe,CAAC;IACjF,CAAC;IAEO,qBAAqB,CAAC,KAAY;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACpC,IAAI,CAAC,iBAAiB,GAAG,IAAI,gBAAgB,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AU,EAAE,IAAI;aACjB,CAAC,CAAC;SACJ;IACH,CAAC;IAED,cAAc;;QACZ,OAAO,MAAA,IAAI,CAAC,iBAAiB,0CAAE,SAAS,CAAC,UAAU,CAAC;IACtD,CAAC;IAED,OAAO;;QACL,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,MAAA,IAAI,CAAC,MAAM,0CAAE,OAAO,EAAE,CAAC;IACzB,CAAC;;AArHe,yBAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC;AAwHnD,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,EAAE;IAC/C,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;AAChD,CAAC,CAAC","file":"canvas-tooltip-handler.js","sourcesContent":["import type { ILayer, INode, Stage } from '@visactor/vrender-core';\nimport { BaseTooltipHandler } from './base';\nimport { Tooltip as TooltipComponent } from '@visactor/vrender-components';\nimport { isValid, isNil } from '@visactor/vutils';\nimport type { TooltipHandlerParams } from '../../../component/tooltip';\nimport type { IComponentPluginService } from '../interface';\nimport { registerComponentPlugin } from '../register';\nimport { TooltipHandlerType } from '../../../component/tooltip/constant';\nimport type { ITooltipActual } from '../../../typings';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport { getTooltipAttributes } from './utils/attribute';\nimport type { ITooltipAttributes } from './interface';\n\n/**\n * The tooltip handler class.\n */\nexport class CanvasTooltipHandler extends BaseTooltipHandler {\n static readonly type = TooltipHandlerType.canvas;\n readonly type = TooltipHandlerType.canvas;\n\n private _layer: ILayer;\n protected _el?: HTMLCanvasElement;\n protected _tooltipCanvasId?: string;\n protected _tooltipComponent: TooltipComponent;\n protected _attributes?: ITooltipAttributes | null = null;\n\n constructor() {\n super(CanvasTooltipHandler.type);\n }\n\n onAdd(service: IComponentPluginService<any>): void {\n super.onAdd(service);\n this._tooltipCanvasId = (this._chartOption.modeParams as any)?.tooltipCanvasId;\n }\n\n private _initTooltipComponent(stage: Stage) {\n const layer = this._getLayer(stage);\n this._tooltipComponent = new TooltipComponent({\n autoCalculatePosition: false,\n autoMeasure: false\n });\n layer.add(this._tooltipComponent as unknown as INode);\n }\n\n private _getLayer(stage: Stage) {\n if (this._layer) {\n return this._layer;\n }\n\n this._layer = stage.createLayer(this._tooltipCanvasId);\n\n // 需要关闭 layer 对应的 canvas 的事件\n const layerCanvas = this._layer.layerHandler.canvas.nativeCanvas as HTMLCanvasElement;\n // TODO:待 vrender 支持\n if (layerCanvas && layerCanvas.style) {\n layerCanvas.style.touchAction = 'none';\n layerCanvas.style.pointerEvents = 'none';\n }\n\n return this._layer;\n }\n\n // 计算 tooltip 内容区域的宽高,并缓存结果\n protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined {\n if (!changePositionOnly || isNil(this._attributes)) {\n const chartTheme = this._chartOption?.getTheme() ?? {};\n this._attributes = getTooltipAttributes(actualTooltip, this._component.getSpec(), chartTheme);\n }\n const { panel } = this._attributes ?? {};\n // canvas模式下, size需要考虑border size, 目的是为了精准判断边界是否超出画布,达到confine效果\n // html模式不提供confine, 所以不考虑精准计算size\n\n return {\n width: panel.width + panel.lineWidth,\n height: panel.height + panel.lineWidth\n };\n }\n\n protected _removeTooltip() {\n if (this._layer) {\n this._layer.removeAllChild();\n // this._layer.render();\n }\n this._attributes = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n this._visible = visible;\n\n const stage = this._compiler.getStage();\n if (!stage) {\n return;\n }\n\n if (!visible) {\n if (this._tooltipComponent && this._tooltipComponent.attribute.visible) {\n this._tooltipComponent.hideAll();\n this._tooltipComponent.setAttributes({\n visibleAll: false\n });\n }\n return;\n }\n\n if (!this._tooltipComponent) {\n this._initTooltipComponent(stage);\n }\n\n const { activeTooltipSpec } = params;\n const pos = activeTooltipSpec.position;\n if (!params.changePositionOnly) {\n this._tooltipComponent.setAttributes({\n ...this._attributes,\n ...pos\n });\n } else if (isValid(pos)) {\n this._tooltipComponent.setAttributes(pos);\n }\n\n if (!this._tooltipComponent.attribute.visible) {\n this._tooltipComponent.showAll();\n this._tooltipComponent.setAttributes({\n visibleAll: true\n });\n }\n }\n\n isTooltipShown() {\n return this._tooltipComponent?.attribute.visibleAll;\n }\n\n release() {\n super.release();\n this._layer?.release();\n }\n}\n\nexport const registerCanvasTooltipHandler = () => {\n registerComponentPlugin(CanvasTooltipHandler);\n};\n"]}
@@ -1,9 +1,8 @@
1
- import { escapeHTML } from './utils/common';
2
- export declare const TOOLTIP_CONTAINER_EL_CLASS_NAME = "vchart-tooltip-container";
1
+ import type { ITooltipHandlerOptions } from './interface';
2
+ export declare const TOOLTIP_PREFIX = "vchart-tooltip";
3
+ export declare const TOOLTIP_CONTAINER_EL_CLASS_NAME: string;
4
+ export declare const TOOLTIP_TITLE_CLASS_NAME: string;
5
+ export declare const TOOLTIP_CONTENT_BOX_CLASS_NAME: string;
3
6
  export declare const TOOLTIP_EMPTY_STRING = "";
4
- export declare const DEFAULT_OPTIONS: {
5
- offsetX: number;
6
- offsetY: number;
7
- sanitize: typeof escapeHTML;
8
- };
9
- export type Options = typeof DEFAULT_OPTIONS;
7
+ export declare const DEFAULT_OPTIONS: ITooltipHandlerOptions;
8
+ export declare const DEFAULT_TOOLTIP_Z_INDEX = "99999999999999";
@@ -1,12 +1,17 @@
1
- import { escapeHTML } from "./utils/common";
1
+ export const TOOLTIP_PREFIX = "vchart-tooltip";
2
2
 
3
- export const TOOLTIP_CONTAINER_EL_CLASS_NAME = "vchart-tooltip-container";
3
+ export const TOOLTIP_CONTAINER_EL_CLASS_NAME = `${TOOLTIP_PREFIX}-container`;
4
+
5
+ export const TOOLTIP_TITLE_CLASS_NAME = `${TOOLTIP_PREFIX}-title`;
6
+
7
+ export const TOOLTIP_CONTENT_BOX_CLASS_NAME = `${TOOLTIP_PREFIX}-content-box`;
4
8
 
5
9
  export const TOOLTIP_EMPTY_STRING = "";
6
10
 
7
11
  export const DEFAULT_OPTIONS = {
8
12
  offsetX: 10,
9
- offsetY: 10,
10
- sanitize: escapeHTML
13
+ offsetY: 10
11
14
  };
15
+
16
+ export const DEFAULT_TOOLTIP_Z_INDEX = "99999999999999";
12
17
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,+BAA+B,GAAG,0BAA0B,CAAC;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,MAAM,CAAC,MAAM,eAAe,GAAG;IAI7B,OAAO,EAAE,EAAE;IAKX,OAAO,EAAE,EAAE;IAOX,QAAQ,EAAE,UAAU;CACrB,CAAC","file":"constants.js","sourcesContent":["import { escapeHTML } from './utils/common';\n\nexport const TOOLTIP_CONTAINER_EL_CLASS_NAME = 'vchart-tooltip-container';\nexport const TOOLTIP_EMPTY_STRING = '';\n\nexport const DEFAULT_OPTIONS = {\n /**\n * X offset.\n */\n offsetX: 10,\n\n /**\n * Y offset.\n */\n offsetY: 10,\n\n /**\n * HTML sanitizer function that removes dangerous HTML to prevent XSS.\n *\n * This should be a function from string to string. You may replace it with a formatter such as a markdown formatter.\n */\n sanitize: escapeHTML\n};\n\n// FIXME: 命名规范\nexport type Options = typeof DEFAULT_OPTIONS;\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,cAAc,YAAY,CAAC;AAC7E,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,cAAc,QAAQ,CAAC;AAClE,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,cAAc,cAAc,CAAC;AAC9E,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,MAAM,CAAC,MAAM,eAAe,GAA2B;IAIrD,OAAO,EAAE,EAAE;IAKX,OAAO,EAAE,EAAE;CACZ,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAgB,CAAC","file":"constants.js","sourcesContent":["import type { ITooltipHandlerOptions } from './interface';\n\nexport const TOOLTIP_PREFIX = 'vchart-tooltip';\nexport const TOOLTIP_CONTAINER_EL_CLASS_NAME = `${TOOLTIP_PREFIX}-container`;\nexport const TOOLTIP_TITLE_CLASS_NAME = `${TOOLTIP_PREFIX}-title`;\nexport const TOOLTIP_CONTENT_BOX_CLASS_NAME = `${TOOLTIP_PREFIX}-content-box`;\nexport const TOOLTIP_EMPTY_STRING = '';\n\nexport const DEFAULT_OPTIONS: ITooltipHandlerOptions = {\n /**\n * X offset.\n */\n offsetX: 10,\n\n /**\n * Y offset.\n */\n offsetY: 10\n};\nexport const DEFAULT_TOOLTIP_Z_INDEX = '99999999999999';\n"]}
@@ -1,28 +1,39 @@
1
- import type { ITooltipActual, ITooltipPositionActual } from '../../../../typings/tooltip';
2
- import { BaseTooltipHandler } from '../base';
3
- import type { IDomTooltipStyle } from './interface';
4
- import { TooltipModel } from './model/tooltip-model';
1
+ import type { ITooltipActual, ITooltipPositionActual } from '../../../typings/tooltip';
2
+ import { BaseTooltipHandler } from './base';
5
3
  import { type Maybe } from '@visactor/vutils';
6
- import type { ITooltipSpec, TooltipHandlerParams } from '../../../../component/tooltip';
7
- import type { IComponentPluginService } from '../../interface';
8
- import type { ILayoutPoint } from '../../../../typings';
4
+ import type { IContainerSize } from '@visactor/vrender-components';
5
+ import type { ITooltipSpec, TooltipHandlerParams } from '../../../component/tooltip';
6
+ import type { IComponentPluginService } from '../interface';
7
+ import type { ILayoutPoint } from '../../../typings';
9
8
  export declare class DomTooltipHandler extends BaseTooltipHandler {
10
9
  static readonly type: string;
11
10
  readonly type: string;
12
11
  protected _tooltipContainer: HTMLElement;
13
- protected _domStyle: IDomTooltipStyle;
12
+ protected _domStyle: {
13
+ panelPadding?: number[];
14
+ panel: Partial<CSSStyleDeclaration>;
15
+ row: Partial<CSSStyleDeclaration>;
16
+ title: Partial<CSSStyleDeclaration>;
17
+ shape: Partial<CSSStyleDeclaration>;
18
+ key: Partial<CSSStyleDeclaration>;
19
+ value: Partial<CSSStyleDeclaration>;
20
+ };
21
+ protected _rootDom?: HTMLElement;
14
22
  protected _tooltipActual?: ITooltipActual;
15
23
  protected _container: Maybe<HTMLDivElement>;
24
+ protected _domString?: string;
16
25
  protected _cacheCustomTooltipPosition: ILayoutPoint;
17
- protected model: TooltipModel;
18
26
  getVisibility(): boolean;
19
27
  setVisibility(_value: boolean): void;
20
28
  constructor();
21
29
  onAdd(service: IComponentPluginService<any>): void;
22
30
  initEl(): void;
31
+ protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined;
23
32
  protected _removeTooltip(): void;
24
33
  protected _updateTooltip(visible: boolean, params: TooltipHandlerParams): void;
25
34
  protected _initStyle(): void;
35
+ protected _updateDomStringByCol(actualTooltip?: ITooltipActual): void;
36
+ protected _updateDomStyle(sizeKey?: 'width' | 'height'): void;
26
37
  protected _getParentElement(spec: ITooltipSpec): HTMLElement;
27
38
  isTooltipShown(): boolean;
28
39
  reInit(): void;
@@ -0,0 +1,191 @@
1
+ import { BaseTooltipHandler } from "./base";
2
+
3
+ import { cssToStyleString, getDomStyle, getTextStyle, setStyleToDom } from "./utils/style";
4
+
5
+ import { TOOLTIP_CONTAINER_EL_CLASS_NAME, DEFAULT_TOOLTIP_Z_INDEX, TOOLTIP_PREFIX, TOOLTIP_CONTENT_BOX_CLASS_NAME, TOOLTIP_TITLE_CLASS_NAME } from "./constants";
6
+
7
+ import { isNil, isValid } from "@visactor/vutils";
8
+
9
+ import { domDocument } from "../../../util/env";
10
+
11
+ import { registerComponentPlugin } from "../register";
12
+
13
+ import { TooltipHandlerType } from "../../../component/tooltip/constant";
14
+
15
+ import { getSvgHtml } from "./utils/svg";
16
+
17
+ import { formatContent } from "./utils/common";
18
+
19
+ import { token } from "../../../theme/token";
20
+
21
+ import { calcLayoutNumber } from "../../../util/space";
22
+
23
+ export class DomTooltipHandler extends BaseTooltipHandler {
24
+ getVisibility() {
25
+ return !!this._rootDom && "visible" === this._rootDom.style.visibility;
26
+ }
27
+ setVisibility(_value) {
28
+ _value !== this.getVisibility() && this._rootDom && (this._rootDom.style.visibility = _value ? "visible" : "hidden");
29
+ }
30
+ constructor() {
31
+ super(DomTooltipHandler.type), this.type = TooltipHandlerType.dom, this._tooltipContainer = null == domDocument ? void 0 : domDocument.body;
32
+ }
33
+ onAdd(service) {
34
+ super.onAdd(service), this._initStyle(), this.initEl();
35
+ }
36
+ initEl() {
37
+ var _a, _b, _c, _d;
38
+ const parentElement = this._component.getSpec().parentElement;
39
+ if (domDocument && parentElement && parentElement.children && parentElement.children.length) {
40
+ for (let i = 0; i < parentElement.children.length; i++) if (parentElement.children[i].classList.contains(TOOLTIP_CONTAINER_EL_CLASS_NAME)) {
41
+ this._container = parentElement.children[i];
42
+ break;
43
+ }
44
+ this._container || (this._container = domDocument.createElement("div"), this._container.style.position = "relative",
45
+ this._container.style.zIndex = DEFAULT_TOOLTIP_Z_INDEX, this._container.classList.add(TOOLTIP_CONTAINER_EL_CLASS_NAME),
46
+ parentElement.appendChild(this._container));
47
+ const tooltipElement = document.createElement("div"), globalTheme = null !== (_b = null === (_a = this._chartOption) || void 0 === _a ? void 0 : _a.getTheme()) && void 0 !== _b ? _b : {};
48
+ setStyleToDom(tooltipElement, Object.assign({
49
+ left: "0",
50
+ top: "0",
51
+ pointerEvents: "none",
52
+ padding: "12px",
53
+ position: "absolute",
54
+ zIndex: DEFAULT_TOOLTIP_Z_INDEX,
55
+ fontFamily: null !== (_c = null == globalTheme ? void 0 : globalTheme.fontFamily) && void 0 !== _c ? _c : token.fontFamily,
56
+ fontSize: "11px",
57
+ borderRadius: "3px",
58
+ borderStyle: "solid",
59
+ lineHeight: "initial",
60
+ background: "#fff",
61
+ boxShadow: "2px 2px 4px rgba(0, 0, 0, 0.1)",
62
+ maxWidth: "100wh",
63
+ maxHeight: "100vh"
64
+ }, null === (_d = this._domStyle) || void 0 === _d ? void 0 : _d.panel)), this._container.appendChild(tooltipElement),
65
+ this._rootDom = tooltipElement;
66
+ }
67
+ }
68
+ _getTooltipBoxSize(actualTooltip, changePositionOnly) {
69
+ var _a, _b;
70
+ changePositionOnly && !isNil(this._domString) || this._updateDomStringByCol(actualTooltip),
71
+ this._rootDom.innerHTML = null !== (_a = this._domString) && void 0 !== _a ? _a : "",
72
+ this._updateDomStyle("height");
73
+ const rect = null === (_b = this._rootDom) || void 0 === _b ? void 0 : _b.getBoundingClientRect();
74
+ return {
75
+ width: null == rect ? void 0 : rect.width,
76
+ height: null == rect ? void 0 : rect.height
77
+ };
78
+ }
79
+ _removeTooltip() {
80
+ this._rootDom && this._rootDom.parentNode && (this._rootDom.parentNode.removeChild(this._rootDom),
81
+ this._rootDom = null), this._container = null;
82
+ }
83
+ _updateTooltip(visible, params) {
84
+ var _a, _b;
85
+ if (visible && this._rootDom) {
86
+ const {tooltipSpec: tooltipSpec, activeTooltipSpec: activeTooltipSpec} = params;
87
+ params.changePositionOnly || (this._tooltipActual = activeTooltipSpec), this.setVisibility(visible);
88
+ const el = this._rootDom;
89
+ if (el) {
90
+ const {x: x = 0, y: y = 0} = null !== (_a = activeTooltipSpec.position) && void 0 !== _a ? _a : {};
91
+ if (tooltipSpec.updateElement) {
92
+ this._updatePosition(null !== (_b = this._cacheCustomTooltipPosition) && void 0 !== _b ? _b : {
93
+ x: x,
94
+ y: y
95
+ }), tooltipSpec.updateElement(el, activeTooltipSpec, params);
96
+ const position = this._getActualTooltipPosition(activeTooltipSpec, params, {
97
+ width: el.offsetWidth,
98
+ height: el.offsetHeight
99
+ });
100
+ this._updatePosition(position), this._cacheCustomTooltipPosition = position;
101
+ } else this._updatePosition({
102
+ x: x,
103
+ y: y
104
+ });
105
+ }
106
+ } else this.setVisibility(visible), this._cacheCustomTooltipPosition = void 0;
107
+ }
108
+ _initStyle() {
109
+ const tooltipSpec = this._component.getSpec();
110
+ this._domStyle = getDomStyle(tooltipSpec);
111
+ }
112
+ _updateDomStringByCol(actualTooltip) {
113
+ var _a;
114
+ let domString = "";
115
+ const {title: title = {}, content: content} = actualTooltip, hasContent = content && content.length, rowStyle = this._domStyle.row;
116
+ if (!1 !== title.visible && (domString += `<h2 class="${TOOLTIP_TITLE_CLASS_NAME}" style="${cssToStyleString(Object.assign(Object.assign(Object.assign({}, this._domStyle.title), hasContent ? rowStyle : {
117
+ marginBottom: "0px"
118
+ }), {
119
+ marginTop: "0px"
120
+ }))}"><span>${null !== (_a = title.value) && void 0 !== _a ? _a : ""}</span></h2>`),
121
+ hasContent) {
122
+ let shapeItems = "", keyItems = "", valueItems = "";
123
+ content.forEach(((entry, index) => {
124
+ const styleByRow = index === content.length - 1 ? null : rowStyle;
125
+ shapeItems += `<div class="${TOOLTIP_PREFIX}-shape" style="${cssToStyleString(styleByRow)}">${getSvgHtml(entry)}</div>`,
126
+ keyItems += `<div class="${TOOLTIP_PREFIX}-key" style="${cssToStyleString(Object.assign(Object.assign({}, styleByRow), entry.keyStyle ? getTextStyle(entry.keyStyle) : null))}">${formatContent(entry.key)}</div>`,
127
+ valueItems += `<div class="${TOOLTIP_PREFIX}-value" style="${cssToStyleString(Object.assign(Object.assign({}, styleByRow), entry.valueStyle ? getTextStyle(entry.valueStyle) : null))}">${formatContent(entry.value)}</div>`;
128
+ })), domString += `<div class="${TOOLTIP_CONTENT_BOX_CLASS_NAME}">\n <div class="${TOOLTIP_PREFIX}-shape-column" style="${cssToStyleString(Object.assign(Object.assign({}, this._domStyle.shape), {
129
+ display: "inline-block",
130
+ verticalAlign: "top"
131
+ }))}">\n ${shapeItems}\n </div>\n <div class="${TOOLTIP_PREFIX}-key-column" style="${cssToStyleString(Object.assign(Object.assign({}, this._domStyle.key), {
132
+ display: "inline-block",
133
+ verticalAlign: "top"
134
+ }))}">\n ${keyItems}\n </div>\n <div class="${TOOLTIP_PREFIX}-value-column" style="${cssToStyleString(Object.assign(Object.assign({}, this._domStyle.value), {
135
+ display: "inline-block",
136
+ verticalAlign: "top"
137
+ }))}">\n ${valueItems}\n </div>\n </div>`;
138
+ }
139
+ this._domString = domString;
140
+ }
141
+ _updateDomStyle(sizeKey = "width") {
142
+ var _a, _b, _c, _d;
143
+ const rootDom = this._rootDom;
144
+ if (rootDom) {
145
+ const contentDom = rootDom.children[rootDom.children.length - 1];
146
+ if (contentDom.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME)) {
147
+ const tooltipSpec = this._component.getSpec(), contentStyle = {};
148
+ if (isValid(null === (_a = null == tooltipSpec ? void 0 : tooltipSpec.style) || void 0 === _a ? void 0 : _a.maxContentHeight)) {
149
+ const titleDom = rootDom.children[0], titleHeight = titleDom && titleDom.className.includes(TOOLTIP_TITLE_CLASS_NAME) ? titleDom.getBoundingClientRect().height + (null !== (_b = tooltipSpec.style.spaceRow) && void 0 !== _b ? _b : 0) : 0, viewRect = this._chartOption.getChartViewRect(), maxHeight = calcLayoutNumber(tooltipSpec.style.maxContentHeight, Math.min(viewRect.height, document.body.clientHeight) - titleHeight - (this._domStyle.panelPadding ? this._domStyle.panelPadding[0] + this._domStyle.panelPadding[1] : 0));
150
+ maxHeight > 0 && (contentStyle.maxHeight = `${maxHeight}px`, contentStyle.overflowY = "auto",
151
+ contentStyle.width = `calc(100% + ${this._domStyle.panelPadding ? this._domStyle.panelPadding[1] + "px" : "10px"})`,
152
+ setStyleToDom(contentDom, contentStyle));
153
+ }
154
+ const rows = contentDom.children, widthByCol = [];
155
+ if (rows) {
156
+ for (let i = 0; i < rows.length; i++) {
157
+ const cols = null !== (_c = rows[i].children) && void 0 !== _c ? _c : [];
158
+ for (let j = 0; j < cols.length; j++) {
159
+ const width = cols[j].getBoundingClientRect()[sizeKey];
160
+ (void 0 === widthByCol[j] || widthByCol[j] < width) && (widthByCol[j] = width);
161
+ }
162
+ }
163
+ for (let i = 0; i < rows.length; i++) {
164
+ const cols = null !== (_d = rows[i].children) && void 0 !== _d ? _d : [];
165
+ for (let j = 0; j < cols.length; j++) cols[j].style[sizeKey] = `${widthByCol[j]}px`;
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+ _getParentElement(spec) {
172
+ var _a;
173
+ return null !== (_a = this._container) && void 0 !== _a ? _a : super._getParentElement(spec);
174
+ }
175
+ isTooltipShown() {
176
+ return this.getVisibility();
177
+ }
178
+ reInit() {
179
+ super.reInit(), this._initStyle();
180
+ }
181
+ _updatePosition({x: x, y: y}) {
182
+ this._rootDom && (this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`);
183
+ }
184
+ }
185
+
186
+ DomTooltipHandler.type = TooltipHandlerType.dom;
187
+
188
+ export const registerDomTooltipHandler = () => {
189
+ registerComponentPlugin(DomTooltipHandler);
190
+ };
191
+ //# sourceMappingURL=dom-tooltip-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/dom-tooltip-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,cAAc,EACd,8BAA8B,EAC9B,wBAAwB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAc,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,O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,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,IAAI,IAAI,CAAC,QAAQ,EAAE;YAEjB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,GAAG,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;SAClE;IACH,CAAC;;AA1Se,sBAAI,GAAG,kBAAkB,CAAC,GAAG,CAAC;AA6ShD,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,uBAAuB,CAAC,iBAAiB,CAAC,CAAC;AAC7C,CAAC,CAAC","file":"dom-tooltip-handler.js","sourcesContent":["import type { ITooltipActual, ITooltipPositionActual } from '../../../typings/tooltip';\nimport { BaseTooltipHandler } from './base';\nimport { cssToStyleString, getDomStyle, getTextStyle, setStyleToDom } from './utils/style';\nimport {\n TOOLTIP_CONTAINER_EL_CLASS_NAME,\n DEFAULT_TOOLTIP_Z_INDEX,\n TOOLTIP_PREFIX,\n TOOLTIP_CONTENT_BOX_CLASS_NAME,\n TOOLTIP_TITLE_CLASS_NAME\n} from './constants';\nimport { type Maybe, isNil, isValid } from '@visactor/vutils';\nimport type { IContainerSize } from '@visactor/vrender-components';\nimport { domDocument } from '../../../util/env';\nimport type { ITooltipSpec, TooltipHandlerParams } from '../../../component/tooltip';\nimport type { IComponentPluginService } from '../interface';\nimport { registerComponentPlugin } from '../register';\nimport type { ILayoutPoint } from '../../../typings';\nimport { TooltipHandlerType } from '../../../component/tooltip/constant';\nimport { getSvgHtml } from './utils/svg';\nimport { formatContent } from './utils/common';\nimport { token } from '../../../theme/token';\nimport { calcLayoutNumber } from '../../../util/space';\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: {\n panelPadding?: number[];\n panel: Partial<CSSStyleDeclaration>;\n row: Partial<CSSStyleDeclaration>;\n title: Partial<CSSStyleDeclaration>;\n shape: Partial<CSSStyleDeclaration>;\n key: Partial<CSSStyleDeclaration>;\n value: Partial<CSSStyleDeclaration>;\n };\n protected _rootDom?: HTMLElement;\n protected _tooltipActual?: ITooltipActual;\n protected declare _container: Maybe<HTMLDivElement>;\n protected _domString?: string;\n\n /** 自定义 tooltip 的位置缓存 */\n protected _cacheCustomTooltipPosition: ILayoutPoint;\n\n getVisibility() {\n return this._rootDom ? this._rootDom.style.visibility === 'visible' : false;\n }\n\n setVisibility(_value: boolean) {\n // 这里做个节流\n if (_value !== this.getVisibility() && this._rootDom) {\n this._rootDom.style.visibility = _value ? 'visible' : 'hidden';\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 const tooltipElement = document.createElement('div');\n const globalTheme = this._chartOption?.getTheme() ?? {};\n\n setStyleToDom(tooltipElement, {\n left: '0',\n top: '0',\n pointerEvents: 'none',\n padding: '12px',\n position: 'absolute',\n zIndex: DEFAULT_TOOLTIP_Z_INDEX,\n fontFamily: (globalTheme?.fontFamily ?? token.fontFamily) as string,\n fontSize: '11px',\n borderRadius: '3px',\n borderStyle: 'solid',\n lineHeight: 'initial',\n background: '#fff',\n boxShadow: '2px 2px 4px rgba(0, 0, 0, 0.1)',\n maxWidth: '100wh',\n maxHeight: '100vh',\n ...this._domStyle?.panel\n } as CSSStyleDeclaration);\n\n this._container.appendChild(tooltipElement);\n this._rootDom = tooltipElement;\n }\n }\n\n // 计算 tooltip 内容区域的宽高,并缓存结果\n protected _getTooltipBoxSize(actualTooltip: ITooltipActual, changePositionOnly: boolean): IContainerSize | undefined {\n if (!changePositionOnly || isNil(this._domString)) {\n this._updateDomStringByCol(actualTooltip);\n }\n this._rootDom.innerHTML = this._domString ?? '';\n\n this._updateDomStyle('height');\n\n const rect = this._rootDom?.getBoundingClientRect();\n\n return {\n width: rect?.width,\n height: rect?.height\n };\n }\n\n protected _removeTooltip() {\n if (this._rootDom && this._rootDom.parentNode) {\n this._rootDom.parentNode.removeChild(this._rootDom);\n this._rootDom = null;\n }\n this._container = null;\n }\n\n protected _updateTooltip(visible: boolean, params: TooltipHandlerParams) {\n if (!visible || !this._rootDom) {\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 }\n this.setVisibility(visible);\n\n // 位置\n const el = this._rootDom;\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 const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n\n this._domStyle = getDomStyle(tooltipSpec);\n }\n\n protected _updateDomStringByCol(actualTooltip?: ITooltipActual) {\n let domString = '';\n const { title = {}, content } = actualTooltip;\n const hasContent = content && content.length;\n const rowStyle = this._domStyle.row;\n\n if (title.visible !== false) {\n domString += `<h2 class=\"${TOOLTIP_TITLE_CLASS_NAME}\" style=\"${cssToStyleString({\n ...this._domStyle.title,\n ...(hasContent ? rowStyle : { marginBottom: '0px' }),\n marginTop: '0px'\n })}\"><span>${title.value ?? ''}</span></h2>`;\n }\n if (hasContent) {\n let shapeItems = '';\n let keyItems = '';\n let valueItems = '';\n content.forEach((entry, index) => {\n const styleByRow = index === content.length - 1 ? null : rowStyle;\n\n shapeItems += `<div class=\"${TOOLTIP_PREFIX}-shape\" style=\"${cssToStyleString(styleByRow)}\">${getSvgHtml(\n entry\n )}</div>`;\n\n keyItems += `<div class=\"${TOOLTIP_PREFIX}-key\" style=\"${cssToStyleString({\n ...styleByRow,\n ...(entry.keyStyle ? getTextStyle(entry.keyStyle) : null)\n })}\">${formatContent(entry.key)}</div>`;\n\n valueItems += `<div class=\"${TOOLTIP_PREFIX}-value\" style=\"${cssToStyleString({\n ...styleByRow,\n ...(entry.valueStyle ? getTextStyle(entry.valueStyle) : null)\n })}\">${formatContent(entry.value)}</div>`;\n });\n\n domString += `<div class=\"${TOOLTIP_CONTENT_BOX_CLASS_NAME}\">\n <div class=\"${TOOLTIP_PREFIX}-shape-column\" style=\"${cssToStyleString({\n ...this._domStyle.shape,\n display: 'inline-block',\n verticalAlign: 'top'\n })}\">\n ${shapeItems}\n </div>\n <div class=\"${TOOLTIP_PREFIX}-key-column\" style=\"${cssToStyleString({\n ...this._domStyle.key,\n display: 'inline-block',\n verticalAlign: 'top'\n })}\">\n ${keyItems}\n </div>\n <div class=\"${TOOLTIP_PREFIX}-value-column\" style=\"${cssToStyleString({\n ...this._domStyle.value,\n display: 'inline-block',\n verticalAlign: 'top'\n })}\">\n ${valueItems}\n </div>\n </div>`;\n }\n\n this._domString = domString;\n }\n protected _updateDomStyle(sizeKey: 'width' | 'height' = 'width') {\n const rootDom = this._rootDom;\n\n if (rootDom) {\n const contentDom = rootDom.children[rootDom.children.length - 1];\n\n if (contentDom.className.includes(TOOLTIP_CONTENT_BOX_CLASS_NAME)) {\n const tooltipSpec = this._component.getSpec() as ITooltipSpec;\n const contentStyle: Partial<CSSStyleDeclaration> = {};\n\n if (isValid(tooltipSpec?.style?.maxContentHeight)) {\n const titleDom = rootDom.children[0];\n const titleHeight =\n titleDom && titleDom.className.includes(TOOLTIP_TITLE_CLASS_NAME)\n ? titleDom.getBoundingClientRect().height + (tooltipSpec.style.spaceRow ?? 0)\n : 0;\n const viewRect = (this._chartOption as any).getChartViewRect();\n const maxHeight = calcLayoutNumber(\n tooltipSpec.style.maxContentHeight,\n Math.min(viewRect.height, document.body.clientHeight) -\n titleHeight -\n (this._domStyle.panelPadding ? this._domStyle.panelPadding[0] + this._domStyle.panelPadding[1] : 0)\n );\n\n if (maxHeight > 0) {\n contentStyle.maxHeight = `${maxHeight}px`;\n contentStyle.overflowY = 'auto';\n // todo 让内容宽度往外阔一点,给滚动条留出位置\n contentStyle.width = `calc(100% + ${\n this._domStyle.panelPadding ? this._domStyle.panelPadding[1] + 'px' : '10px'\n })`;\n\n setStyleToDom(contentDom as HTMLElement, contentStyle);\n }\n }\n\n const rows = contentDom.children;\n const widthByCol: number[] = [];\n if (rows) {\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n const width = cols[j].getBoundingClientRect()[sizeKey];\n if (widthByCol[j] === undefined || widthByCol[j] < width) {\n widthByCol[j] = width;\n }\n }\n }\n\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n const cols = row.children ?? ([] as HTMLElement[]);\n\n for (let j = 0; j < cols.length; j++) {\n (cols[j] as HTMLElement).style[sizeKey] = `${widthByCol[j]}px`;\n }\n }\n }\n }\n }\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 if (this._rootDom) {\n // translate3d 性能较好:https://stackoverflow.com/questions/22111256/translate3d-vs-translate-performance\n this._rootDom.style.transform = `translate3d(${x}px, ${y}px, 0)`;\n }\n }\n}\n\nexport const registerDomTooltipHandler = () => {\n registerComponentPlugin(DomTooltipHandler);\n};\n"]}
@@ -1,2 +1,2 @@
1
- export * from './dom';
2
- export * from './canvas';
1
+ export * from './dom-tooltip-handler';
2
+ export * from './canvas-tooltip-handler';
@@ -1,4 +1,4 @@
1
- export * from "./dom";
1
+ export * from "./dom-tooltip-handler";
2
2
 
3
- export * from "./canvas";
3
+ export * from "./canvas-tooltip-handler";
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC","file":"index.js","sourcesContent":["export * from './dom';\nexport * from './canvas';\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC","file":"index.js","sourcesContent":["export * from './dom-tooltip-handler';\nexport * from './canvas-tooltip-handler';\n"]}
@@ -1,2 +1,15 @@
1
- export * from './style';
2
- export * from './common';
1
+ import type { TooltipAttributes } from '@visactor/vrender-components';
2
+ import type { ITextAttribute, IFillStyle } from '@visactor/vrender-core';
3
+ export interface ITooltipTextStyle extends Partial<ITextAttribute & IFillStyle> {
4
+ spacing?: number;
5
+ multiLine?: boolean;
6
+ maxWidth?: number;
7
+ autoWidth?: boolean;
8
+ }
9
+ export interface ITooltipAttributes extends TooltipAttributes {
10
+ align?: 'left' | 'right';
11
+ }
12
+ export interface ITooltipHandlerOptions {
13
+ offsetX?: number;
14
+ offsetY?: number;
15
+ }
@@ -1,4 +1,2 @@
1
- export * from "./style";
2
-
3
- export * from "./common";
1
+ export { };
4
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/interface/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC","file":"index.js","sourcesContent":["export * from './style';\nexport * from './common';\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/interface/index.ts"],"names":[],"mappings":"","file":"index.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 /**\n * @since 1.11.5\n *\n * shape、key、value的对齐方式,可选项如下:\n * 'left': 从左到右对齐\n * 'right': 从右到左对齐\n */\n align?: 'left' | 'right';\n}\n\nexport interface ITooltipHandlerOptions {\n offsetX?: number;\n offsetY?: number;\n}\n"]}
@@ -1,8 +1,15 @@
1
- import type { TooltipPanelAttrs } from '@visactor/vrender-components';
2
- import type { ITooltipActual } from '../../../../typings';
1
+ import type { TooltipPanelAttrs, TooltipRichTextAttrs } from '@visactor/vrender-components';
2
+ import type { ITooltipActual, MaybeArray } from '../../../../typings';
3
3
  import type { ITooltipAttributes, ITooltipTextStyle } from '../interface';
4
4
  import type { ITheme } from '../../../../theme';
5
5
  import type { ITooltipSpec, ITooltipTextTheme, ITooltipTheme } from '../../../../component/tooltip';
6
+ interface ITooltipTextInfo {
7
+ width: number;
8
+ height: number;
9
+ text: MaybeArray<number> | MaybeArray<string> | TooltipRichTextAttrs;
10
+ }
11
+ export declare const measureTooltipText: (text: string | TooltipRichTextAttrs, style: ITooltipTextStyle) => ITooltipTextInfo;
6
12
  export declare function getTextAttributes(style?: ITooltipTextTheme, globalTheme?: ITheme, defaultAttributes?: Partial<ITooltipTextStyle>): ITooltipTextStyle;
7
13
  export declare const getPanelAttributes: (style: ITooltipTheme['panel']) => TooltipPanelAttrs;
8
14
  export declare const getTooltipAttributes: (actualTooltip: ITooltipActual, spec: ITooltipSpec, globalTheme: ITheme) => ITooltipAttributes;
15
+ export {};
@@ -4,16 +4,38 @@ import { mergeSpec } from "@visactor/vutils-extension";
4
4
 
5
5
  import { normalizeLayoutPaddingSpec } from "../../../../util/space";
6
6
 
7
- import { measureTooltipText } from "./common";
8
-
9
7
  import { token } from "../../../../theme/token";
10
8
 
9
+ import { getRichTextBounds } from "@visactor/vrender-core";
10
+
11
11
  const DEFAULT_TEXT_ATTRIBUTES = {
12
12
  fontFamily: token.fontFamily,
13
13
  spacing: 10,
14
14
  wordBreak: "break-word"
15
15
  };
16
16
 
17
+ export const measureTooltipText = (text, style) => {
18
+ var _a;
19
+ let textLines, textConfig;
20
+ "rich" !== (null == text ? void 0 : text.type) && "html" !== (null == text ? void 0 : text.type) ? (text = (null != text ? text : "").toString(),
21
+ style.multiLine ? (textLines = text.split("\n"), textLines = textLines.map(((line, i) => i < textLines.length - 1 ? line + "\n" : line))) : textLines = [ text ],
22
+ textConfig = textLines.map((line => Object.assign(Object.assign({}, style), {
23
+ text: line
24
+ })))) : (textConfig = text.text, textLines = text);
25
+ const bound = getRichTextBounds({
26
+ wordBreak: null !== (_a = style.wordBreak) && void 0 !== _a ? _a : "break-word",
27
+ maxWidth: style.maxWidth ? style.maxWidth : void 0,
28
+ width: 0,
29
+ height: 0,
30
+ textConfig: textConfig
31
+ });
32
+ return {
33
+ width: bound.width(),
34
+ height: bound.height(),
35
+ text: textLines
36
+ };
37
+ };
38
+
17
39
  export function getTextAttributes(style = {}, globalTheme, defaultAttributes) {
18
40
  var _a, _b;
19
41
  return Object.assign(Object.assign({}, null != defaultAttributes ? defaultAttributes : DEFAULT_TEXT_ATTRIBUTES), {
@@ -49,7 +71,7 @@ export const getPanelAttributes = style => {
49
71
 
50
72
  export const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
51
73
  var _a, _b, _c, _d, _e;
52
- const {style: style = {}, enterable: enterable, transitionDuration: transitionDuration} = spec, {panel: panel = {}, titleLabel: titleLabel, shape: shape, keyLabel: keyLabel, valueLabel: valueLabel, spaceRow: commonSpaceRow, maxContentHeight: maxContentHeight, align: align} = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({
74
+ const {style: style = {}, enterable: enterable, transitionDuration: transitionDuration} = spec, {panel: panel = {}, titleLabel: titleLabel, shape: shape, keyLabel: keyLabel, valueLabel: valueLabel, spaceRow: commonSpaceRow, align: align} = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({
53
75
  textAlign: "right" === align ? "right" : "left"
54
76
  }, titleLabel), globalTheme), keyStyle = getTextAttributes(Object.assign({
55
77
  textAlign: "right" === align ? "right" : "left"
@@ -75,12 +97,11 @@ export const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
75
97
  hasContentShape: !1,
76
98
  keyWidth: 0,
77
99
  valueWidth: 0,
78
- maxContentHeight: maxContentHeight,
79
100
  enterable: enterable,
80
101
  transitionDuration: transitionDuration,
81
102
  align: align
82
103
  }, {title: title = {}, content: content = []} = actualTooltip;
83
- let panelWidth = paddingSpec.left + paddingSpec.right, panelHeight = paddingSpec.top + paddingSpec.bottom, panelDomHeight = paddingSpec.top + paddingSpec.bottom, contentMaxWidth = 0;
104
+ let panelWidth = paddingSpec.left + paddingSpec.right, panelHeight = paddingSpec.top + paddingSpec.bottom, contentMaxWidth = 0;
84
105
  const hasContent = !!content.length;
85
106
  let maxKeyWidth = 0, maxAdaptiveKeyWidth = 0, maxValueWidth = 0, maxShapeWidth = 0;
86
107
  if (hasContent) {
@@ -126,8 +147,8 @@ export const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
126
147
  };
127
148
  return itemAttrs.height = itemHeight, contentHeight += itemHeight, i < content.length - 1 && (contentHeight += itemAttrs.spaceRow),
128
149
  itemAttrs;
129
- })), panelHeight += contentHeight, panelDomHeight += Math.min(contentHeight, null != maxContentHeight ? maxContentHeight : 1 / 0),
130
- maxKeyWidth = keyWidths.length ? maxInArray(keyWidths) : 0, maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? maxInArray(adaptiveKeyWidths) : 0,
150
+ })), panelHeight += contentHeight, maxKeyWidth = keyWidths.length ? maxInArray(keyWidths) : 0,
151
+ maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? maxInArray(adaptiveKeyWidths) : 0,
131
152
  maxValueWidth = valueWidths.length ? maxInArray(valueWidths) : 0, maxShapeWidth = shapeWidths.length ? maxInArray(shapeWidths) + shapeStyle.spacing : 0,
132
153
  contentMaxWidth = Math.max(maxShapeWidth + maxKeyWidth + keyStyle.spacing + maxValueWidth + valueStyle.spacing, maxShapeWidth + maxAdaptiveKeyWidth, contentMaxWidth),
133
154
  attributes.hasContentShape = !!shapeWidths.length, attributes.keyWidth = maxKeyWidth,
@@ -151,15 +172,14 @@ export const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
151
172
  }), titleMaxWidth = attributes.title.value.width, titleMaxHeight = attributes.title.value.height,
152
173
  titleHeightWithSpace = titleMaxHeight + (hasContent ? attributes.title.spaceRow : 0);
153
174
  }
154
- return panelHeight += titleHeightWithSpace, panelDomHeight += titleHeightWithSpace,
155
- attributes.title.width = titleMaxWidth, attributes.title.height = titleMaxHeight,
156
- isAutoWidthMode() ? panelWidth += contentMaxWidth || titleMaxWidth : panelWidth += Math.max(titleMaxWidth, contentMaxWidth),
175
+ return panelHeight += titleHeightWithSpace, attributes.title.width = titleMaxWidth,
176
+ attributes.title.height = titleMaxHeight, isAutoWidthMode() ? panelWidth += contentMaxWidth || titleMaxWidth : panelWidth += Math.max(titleMaxWidth, contentMaxWidth),
157
177
  hasContent && attributes.content.forEach((item => {
158
178
  var _a;
159
179
  const value = item.value;
160
180
  value && (null === (_a = value.autoWidth) || void 0 === _a || _a) && (value.width = panelWidth - paddingSpec.left - paddingSpec.right - maxShapeWidth - maxKeyWidth - keyStyle.spacing - valueStyle.spacing,
161
181
  value.maxWidth || (value.maxWidth = Math.ceil(value.width)), attributes.valueWidth = Math.max(attributes.valueWidth, value.width));
162
182
  })), attributes.panel.width = panelWidth, attributes.panel.height = panelHeight,
163
- attributes.panelDomHeight = panelDomHeight, attributes;
183
+ attributes;
164
184
  };
165
185
  //# sourceMappingURL=attribute.js.map