@visactor/vchart 1.12.7 → 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 (309) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +1117 -1665
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/chart/base/base-chart.js.map +1 -1
  6. package/cjs/chart/gauge/interface.d.ts +1 -1
  7. package/cjs/chart/gauge/interface.js.map +1 -1
  8. package/cjs/chart/treemap/interface.d.ts +1 -1
  9. package/cjs/chart/treemap/interface.js.map +1 -1
  10. package/cjs/chart/venn/interface.d.ts +2 -2
  11. package/cjs/chart/venn/interface.js.map +1 -1
  12. package/cjs/compile/compilable-base.js +1 -2
  13. package/cjs/compile/util.js +2 -1
  14. package/cjs/component/axis/base-axis.js +1 -1
  15. package/cjs/component/axis/base-axis.js.map +1 -1
  16. package/cjs/component/axis/cartesian/axis.js +5 -4
  17. package/cjs/component/axis/cartesian/axis.js.map +1 -1
  18. package/cjs/component/axis/cartesian/interface/common.d.ts +1 -0
  19. package/cjs/component/axis/cartesian/interface/common.js.map +1 -1
  20. package/cjs/component/axis/polar/axis.js.map +1 -1
  21. package/cjs/component/geo/geo-coordinate.js +5 -2
  22. package/cjs/component/geo/geo-coordinate.js.map +1 -1
  23. package/cjs/component/interface/index.d.ts +0 -1
  24. package/cjs/component/interface/index.js +1 -1
  25. package/cjs/component/interface/index.js.map +1 -1
  26. package/cjs/component/label/util.js +1 -1
  27. package/cjs/component/label/util.js.map +1 -1
  28. package/cjs/component/title/interface/spec.d.ts +3 -3
  29. package/cjs/component/title/interface/spec.js.map +1 -1
  30. package/cjs/component/tooltip/constant.d.ts +5 -4
  31. package/cjs/component/tooltip/constant.js +7 -7
  32. package/cjs/component/tooltip/constant.js.map +1 -1
  33. package/cjs/component/tooltip/interface/common.d.ts +1 -1
  34. package/cjs/component/tooltip/interface/common.js.map +1 -1
  35. package/cjs/component/tooltip/interface/spec.d.ts +8 -0
  36. package/cjs/component/tooltip/interface/spec.js.map +1 -1
  37. package/cjs/component/tooltip/interface/theme.d.ts +2 -2
  38. package/cjs/component/tooltip/interface/theme.js.map +1 -1
  39. package/cjs/component/tooltip/processor/base.d.ts +3 -5
  40. package/cjs/component/tooltip/processor/base.js +24 -27
  41. package/cjs/component/tooltip/processor/base.js.map +1 -1
  42. package/cjs/component/tooltip/processor/group-tooltip.js +1 -1
  43. package/cjs/component/tooltip/processor/group-tooltip.js.map +1 -1
  44. package/cjs/component/tooltip/processor/mark-tooltip.js +2 -2
  45. package/cjs/component/tooltip/processor/mark-tooltip.js.map +1 -1
  46. package/cjs/component/tooltip/tooltip-transformer.js +0 -1
  47. package/cjs/component/tooltip/tooltip-transformer.js.map +1 -1
  48. package/cjs/component/tooltip/tooltip.d.ts +9 -4
  49. package/cjs/component/tooltip/tooltip.js +64 -53
  50. package/cjs/component/tooltip/tooltip.js.map +1 -1
  51. package/cjs/component/tooltip/utils/common.d.ts +6 -4
  52. package/cjs/component/tooltip/utils/common.js +52 -7
  53. package/cjs/component/tooltip/utils/common.js.map +1 -1
  54. package/cjs/component/tooltip/utils/get-spec.d.ts +4 -4
  55. package/cjs/component/tooltip/utils/get-spec.js +20 -82
  56. package/cjs/component/tooltip/utils/get-spec.js.map +1 -1
  57. package/cjs/component/tooltip/utils/get-value.d.ts +1 -2
  58. package/cjs/component/tooltip/utils/get-value.js +2 -12
  59. package/cjs/component/tooltip/utils/get-value.js.map +1 -1
  60. package/cjs/component/tooltip/utils/index.d.ts +0 -1
  61. package/cjs/component/tooltip/utils/index.js +1 -2
  62. package/cjs/component/tooltip/utils/index.js.map +1 -1
  63. package/cjs/constant/correlation.js +2 -1
  64. package/cjs/constant/layout.js +1 -2
  65. package/cjs/core/index.d.ts +1 -1
  66. package/cjs/core/index.js +1 -1
  67. package/cjs/core/index.js.map +1 -1
  68. package/cjs/core/vchart.js +14 -11
  69. package/cjs/core/vchart.js.map +1 -1
  70. package/cjs/data/transforms/pie.d.ts +3 -0
  71. package/cjs/data/transforms/pie.js +8 -3
  72. package/cjs/data/transforms/pie.js.map +1 -1
  73. package/cjs/model/interface.d.ts +14 -0
  74. package/cjs/model/interface.js.map +1 -1
  75. package/cjs/plugin/components/tooltip-handler/base.d.ts +1 -13
  76. package/cjs/plugin/components/tooltip-handler/base.js +83 -220
  77. package/cjs/plugin/components/tooltip-handler/base.js.map +1 -1
  78. package/cjs/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js +1 -1
  79. package/cjs/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +1 -1
  80. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.d.ts +0 -1
  81. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +7 -19
  82. package/cjs/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +1 -1
  83. package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.js +16 -14
  84. package/cjs/plugin/components/tooltip-handler/dom/model/content-column-model.js.map +1 -1
  85. package/cjs/plugin/components/tooltip-handler/dom/model/title-model.js +2 -2
  86. package/cjs/plugin/components/tooltip-handler/dom/model/title-model.js.map +1 -1
  87. package/cjs/plugin/components/tooltip-handler/interface/style.d.ts +1 -2
  88. package/cjs/plugin/components/tooltip-handler/interface/style.js.map +1 -1
  89. package/cjs/plugin/components/tooltip-handler/utils/attribute.js +7 -7
  90. package/cjs/plugin/components/tooltip-handler/utils/attribute.js.map +1 -1
  91. package/cjs/plugin/components/tooltip-handler/utils/common.js.map +1 -1
  92. package/cjs/plugin/components/tooltip-handler/utils/position.d.ts +3 -5
  93. package/cjs/plugin/components/tooltip-handler/utils/position.js +22 -29
  94. package/cjs/plugin/components/tooltip-handler/utils/position.js.map +1 -1
  95. package/cjs/region/interface.d.ts +3 -1
  96. package/cjs/region/interface.js.map +1 -1
  97. package/cjs/series/base/base-series.js +1 -1
  98. package/cjs/series/base/base-series.js.map +1 -1
  99. package/cjs/series/base/tooltip-helper.d.ts +30 -6
  100. package/cjs/series/base/tooltip-helper.js +80 -73
  101. package/cjs/series/base/tooltip-helper.js.map +1 -1
  102. package/cjs/series/box-plot/tooltip-helper.d.ts +2 -2
  103. package/cjs/series/box-plot/tooltip-helper.js +26 -67
  104. package/cjs/series/box-plot/tooltip-helper.js.map +1 -1
  105. package/cjs/series/cartesian/cartesian.d.ts +1 -1
  106. package/cjs/series/circle-packing/circle-packing.js +1 -2
  107. package/cjs/series/circle-packing/circle-packing.js.map +1 -1
  108. package/cjs/series/dot/tooltip-helper.d.ts +8 -2
  109. package/cjs/series/dot/tooltip-helper.js +42 -41
  110. package/cjs/series/dot/tooltip-helper.js.map +1 -1
  111. package/cjs/series/gauge/pointer-tooltip-helper.d.ts +2 -1
  112. package/cjs/series/gauge/pointer-tooltip-helper.js +3 -8
  113. package/cjs/series/gauge/pointer-tooltip-helper.js.map +1 -1
  114. package/cjs/series/heatmap/tooltip-helper.d.ts +2 -3
  115. package/cjs/series/heatmap/tooltip-helper.js +3 -5
  116. package/cjs/series/heatmap/tooltip-helper.js.map +1 -1
  117. package/cjs/series/interface/tooltip-helper.d.ts +5 -4
  118. package/cjs/series/interface/tooltip-helper.js.map +1 -1
  119. package/cjs/series/link/tooltip-helper.d.ts +5 -2
  120. package/cjs/series/link/tooltip-helper.js +26 -27
  121. package/cjs/series/link/tooltip-helper.js.map +1 -1
  122. package/cjs/series/liquid/tooltip-helper.d.ts +4 -5
  123. package/cjs/series/liquid/tooltip-helper.js +2 -22
  124. package/cjs/series/liquid/tooltip-helper.js.map +1 -1
  125. package/cjs/series/pie/pie.js +6 -2
  126. package/cjs/series/pie/pie.js.map +1 -1
  127. package/cjs/series/progress/linear/tooltip-helper.d.ts +2 -3
  128. package/cjs/series/progress/linear/tooltip-helper.js +2 -11
  129. package/cjs/series/progress/linear/tooltip-helper.js.map +1 -1
  130. package/cjs/series/range-area/tooltip-helper.d.ts +1 -3
  131. package/cjs/series/range-area/tooltip-helper.js +2 -50
  132. package/cjs/series/range-area/tooltip-helper.js.map +1 -1
  133. package/cjs/series/range-column/tooltip-helper.d.ts +1 -2
  134. package/cjs/series/range-column/tooltip-helper.js +2 -19
  135. package/cjs/series/range-column/tooltip-helper.js.map +1 -1
  136. package/cjs/series/sankey/sankey.d.ts +1 -1
  137. package/cjs/series/sankey/tooltip-helper.d.ts +3 -3
  138. package/cjs/series/sankey/tooltip-helper.js +10 -57
  139. package/cjs/series/sankey/tooltip-helper.js.map +1 -1
  140. package/cjs/typings/spec/common.d.ts +3 -3
  141. package/cjs/typings/spec/common.js.map +1 -1
  142. package/cjs/typings/tooltip/position.d.ts +1 -0
  143. package/cjs/typings/tooltip/position.js.map +1 -1
  144. package/cjs/typings/tooltip/shape.d.ts +0 -1
  145. package/cjs/typings/tooltip/shape.js.map +1 -1
  146. package/cjs/typings/tooltip/tooltip.d.ts +7 -0
  147. package/cjs/typings/tooltip/tooltip.js.map +1 -1
  148. package/esm/chart/base/base-chart.js.map +1 -1
  149. package/esm/chart/gauge/interface.d.ts +1 -1
  150. package/esm/chart/gauge/interface.js.map +1 -1
  151. package/esm/chart/treemap/interface.d.ts +1 -1
  152. package/esm/chart/treemap/interface.js.map +1 -1
  153. package/esm/chart/venn/interface.d.ts +2 -2
  154. package/esm/chart/venn/interface.js.map +1 -1
  155. package/esm/compile/compilable-base.js +1 -2
  156. package/esm/compile/util.js +2 -1
  157. package/esm/component/axis/base-axis.js +1 -1
  158. package/esm/component/axis/base-axis.js.map +1 -1
  159. package/esm/component/axis/cartesian/axis.js +5 -4
  160. package/esm/component/axis/cartesian/axis.js.map +1 -1
  161. package/esm/component/axis/cartesian/interface/common.d.ts +1 -0
  162. package/esm/component/axis/cartesian/interface/common.js.map +1 -1
  163. package/esm/component/axis/polar/axis.js.map +1 -1
  164. package/esm/component/geo/geo-coordinate.js +5 -2
  165. package/esm/component/geo/geo-coordinate.js.map +1 -1
  166. package/esm/component/interface/index.d.ts +0 -1
  167. package/esm/component/interface/index.js +0 -2
  168. package/esm/component/interface/index.js.map +1 -1
  169. package/esm/component/label/util.js +1 -1
  170. package/esm/component/label/util.js.map +1 -1
  171. package/esm/component/title/interface/spec.d.ts +3 -3
  172. package/esm/component/title/interface/spec.js.map +1 -1
  173. package/esm/component/tooltip/constant.d.ts +5 -4
  174. package/esm/component/tooltip/constant.js +6 -3
  175. package/esm/component/tooltip/constant.js.map +1 -1
  176. package/esm/component/tooltip/interface/common.d.ts +1 -1
  177. package/esm/component/tooltip/interface/common.js.map +1 -1
  178. package/esm/component/tooltip/interface/spec.d.ts +8 -0
  179. package/esm/component/tooltip/interface/spec.js.map +1 -1
  180. package/esm/component/tooltip/interface/theme.d.ts +2 -2
  181. package/esm/component/tooltip/interface/theme.js.map +1 -1
  182. package/esm/component/tooltip/processor/base.d.ts +3 -5
  183. package/esm/component/tooltip/processor/base.js +24 -28
  184. package/esm/component/tooltip/processor/base.js.map +1 -1
  185. package/esm/component/tooltip/processor/group-tooltip.js +1 -1
  186. package/esm/component/tooltip/processor/group-tooltip.js.map +1 -1
  187. package/esm/component/tooltip/processor/mark-tooltip.js +2 -2
  188. package/esm/component/tooltip/processor/mark-tooltip.js.map +1 -1
  189. package/esm/component/tooltip/tooltip-transformer.js +0 -1
  190. package/esm/component/tooltip/tooltip-transformer.js.map +1 -1
  191. package/esm/component/tooltip/tooltip.d.ts +9 -4
  192. package/esm/component/tooltip/tooltip.js +66 -54
  193. package/esm/component/tooltip/tooltip.js.map +1 -1
  194. package/esm/component/tooltip/utils/common.d.ts +6 -4
  195. package/esm/component/tooltip/utils/common.js +46 -5
  196. package/esm/component/tooltip/utils/common.js.map +1 -1
  197. package/esm/component/tooltip/utils/get-spec.d.ts +4 -4
  198. package/esm/component/tooltip/utils/get-spec.js +24 -80
  199. package/esm/component/tooltip/utils/get-spec.js.map +1 -1
  200. package/esm/component/tooltip/utils/get-value.d.ts +1 -2
  201. package/esm/component/tooltip/utils/get-value.js +1 -9
  202. package/esm/component/tooltip/utils/get-value.js.map +1 -1
  203. package/esm/component/tooltip/utils/index.d.ts +0 -1
  204. package/esm/component/tooltip/utils/index.js +0 -2
  205. package/esm/component/tooltip/utils/index.js.map +1 -1
  206. package/esm/constant/correlation.js +2 -1
  207. package/esm/constant/layout.js +1 -2
  208. package/esm/core/index.d.ts +1 -1
  209. package/esm/core/index.js +1 -1
  210. package/esm/core/index.js.map +1 -1
  211. package/esm/core/vchart.js +14 -10
  212. package/esm/core/vchart.js.map +1 -1
  213. package/esm/data/transforms/pie.d.ts +3 -0
  214. package/esm/data/transforms/pie.js +6 -3
  215. package/esm/data/transforms/pie.js.map +1 -1
  216. package/esm/model/interface.d.ts +14 -0
  217. package/esm/model/interface.js.map +1 -1
  218. package/esm/plugin/components/tooltip-handler/base.d.ts +1 -13
  219. package/esm/plugin/components/tooltip-handler/base.js +79 -212
  220. package/esm/plugin/components/tooltip-handler/base.js.map +1 -1
  221. package/esm/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js +1 -1
  222. package/esm/plugin/components/tooltip-handler/canvas/canvas-tooltip-handler.js.map +1 -1
  223. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.d.ts +0 -1
  224. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js +6 -19
  225. package/esm/plugin/components/tooltip-handler/dom/dom-tooltip-handler.js.map +1 -1
  226. package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.js +16 -14
  227. package/esm/plugin/components/tooltip-handler/dom/model/content-column-model.js.map +1 -1
  228. package/esm/plugin/components/tooltip-handler/dom/model/title-model.js +2 -2
  229. package/esm/plugin/components/tooltip-handler/dom/model/title-model.js.map +1 -1
  230. package/esm/plugin/components/tooltip-handler/interface/style.d.ts +1 -2
  231. package/esm/plugin/components/tooltip-handler/interface/style.js.map +1 -1
  232. package/esm/plugin/components/tooltip-handler/utils/attribute.js +7 -7
  233. package/esm/plugin/components/tooltip-handler/utils/attribute.js.map +1 -1
  234. package/esm/plugin/components/tooltip-handler/utils/common.js.map +1 -1
  235. package/esm/plugin/components/tooltip-handler/utils/position.d.ts +3 -5
  236. package/esm/plugin/components/tooltip-handler/utils/position.js +20 -25
  237. package/esm/plugin/components/tooltip-handler/utils/position.js.map +1 -1
  238. package/esm/region/interface.d.ts +3 -1
  239. package/esm/region/interface.js.map +1 -1
  240. package/esm/series/base/base-series.js +1 -1
  241. package/esm/series/base/base-series.js.map +1 -1
  242. package/esm/series/base/tooltip-helper.d.ts +30 -6
  243. package/esm/series/base/tooltip-helper.js +85 -74
  244. package/esm/series/base/tooltip-helper.js.map +1 -1
  245. package/esm/series/box-plot/tooltip-helper.d.ts +2 -2
  246. package/esm/series/box-plot/tooltip-helper.js +26 -67
  247. package/esm/series/box-plot/tooltip-helper.js.map +1 -1
  248. package/esm/series/cartesian/cartesian.d.ts +1 -1
  249. package/esm/series/circle-packing/circle-packing.js +1 -2
  250. package/esm/series/circle-packing/circle-packing.js.map +1 -1
  251. package/esm/series/dot/tooltip-helper.d.ts +8 -2
  252. package/esm/series/dot/tooltip-helper.js +42 -41
  253. package/esm/series/dot/tooltip-helper.js.map +1 -1
  254. package/esm/series/gauge/pointer-tooltip-helper.d.ts +2 -1
  255. package/esm/series/gauge/pointer-tooltip-helper.js +2 -9
  256. package/esm/series/gauge/pointer-tooltip-helper.js.map +1 -1
  257. package/esm/series/heatmap/tooltip-helper.d.ts +2 -3
  258. package/esm/series/heatmap/tooltip-helper.js +2 -6
  259. package/esm/series/heatmap/tooltip-helper.js.map +1 -1
  260. package/esm/series/interface/tooltip-helper.d.ts +5 -4
  261. package/esm/series/interface/tooltip-helper.js.map +1 -1
  262. package/esm/series/link/tooltip-helper.d.ts +5 -2
  263. package/esm/series/link/tooltip-helper.js +26 -27
  264. package/esm/series/link/tooltip-helper.js.map +1 -1
  265. package/esm/series/liquid/tooltip-helper.d.ts +4 -5
  266. package/esm/series/liquid/tooltip-helper.js +2 -22
  267. package/esm/series/liquid/tooltip-helper.js.map +1 -1
  268. package/esm/series/pie/pie.js +7 -3
  269. package/esm/series/pie/pie.js.map +1 -1
  270. package/esm/series/progress/linear/tooltip-helper.d.ts +2 -3
  271. package/esm/series/progress/linear/tooltip-helper.js +2 -11
  272. package/esm/series/progress/linear/tooltip-helper.js.map +1 -1
  273. package/esm/series/range-area/tooltip-helper.d.ts +1 -3
  274. package/esm/series/range-area/tooltip-helper.js +2 -50
  275. package/esm/series/range-area/tooltip-helper.js.map +1 -1
  276. package/esm/series/range-column/tooltip-helper.d.ts +1 -2
  277. package/esm/series/range-column/tooltip-helper.js +2 -19
  278. package/esm/series/range-column/tooltip-helper.js.map +1 -1
  279. package/esm/series/sankey/sankey.d.ts +1 -1
  280. package/esm/series/sankey/tooltip-helper.d.ts +3 -3
  281. package/esm/series/sankey/tooltip-helper.js +10 -57
  282. package/esm/series/sankey/tooltip-helper.js.map +1 -1
  283. package/esm/typings/spec/common.d.ts +3 -3
  284. package/esm/typings/spec/common.js.map +1 -1
  285. package/esm/typings/tooltip/position.d.ts +1 -0
  286. package/esm/typings/tooltip/position.js.map +1 -1
  287. package/esm/typings/tooltip/shape.d.ts +0 -1
  288. package/esm/typings/tooltip/shape.js.map +1 -1
  289. package/esm/typings/tooltip/tooltip.d.ts +7 -0
  290. package/esm/typings/tooltip/tooltip.js.map +1 -1
  291. package/package.json +13 -13
  292. package/cjs/component/interface/tooltip-helper.d.ts +0 -5
  293. package/cjs/component/interface/tooltip-helper.js +0 -6
  294. package/cjs/component/interface/tooltip-helper.js.map +0 -1
  295. package/cjs/component/tooltip/utils/compose.d.ts +0 -4
  296. package/cjs/component/tooltip/utils/compose.js +0 -120
  297. package/cjs/component/tooltip/utils/compose.js.map +0 -1
  298. package/cjs/model/tooltip-helper.d.ts +0 -29
  299. package/cjs/model/tooltip-helper.js +0 -19
  300. package/cjs/model/tooltip-helper.js.map +0 -1
  301. package/esm/component/interface/tooltip-helper.d.ts +0 -5
  302. package/esm/component/interface/tooltip-helper.js +0 -2
  303. package/esm/component/interface/tooltip-helper.js.map +0 -1
  304. package/esm/component/tooltip/utils/compose.d.ts +0 -4
  305. package/esm/component/tooltip/utils/compose.js +0 -105
  306. package/esm/component/tooltip/utils/compose.js.map +0 -1
  307. package/esm/model/tooltip-helper.d.ts +0 -29
  308. package/esm/model/tooltip-helper.js +0 -11
  309. package/esm/model/tooltip-helper.js.map +0 -1
@@ -81,14 +81,14 @@ export const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
81
81
  align: align
82
82
  }, {title: title = {}, content: content = []} = actualTooltip;
83
83
  let panelWidth = paddingSpec.left + paddingSpec.right, panelHeight = paddingSpec.top + paddingSpec.bottom, panelDomHeight = paddingSpec.top + paddingSpec.bottom, contentMaxWidth = 0;
84
- const filteredContent = content.filter((item => (item.key || item.value) && !1 !== item.visible)), hasContent = !!filteredContent.length;
84
+ const hasContent = !!content.length;
85
85
  let maxKeyWidth = 0, maxAdaptiveKeyWidth = 0, maxValueWidth = 0, maxShapeWidth = 0;
86
86
  if (hasContent) {
87
87
  const keyWidths = [], adaptiveKeyWidths = [], valueWidths = [], shapeWidths = [];
88
88
  let contentHeight = 0;
89
- attributes.content = filteredContent.map(((item, i) => {
89
+ attributes.content = content.map(((item, i) => {
90
90
  let itemHeight = 0;
91
- 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 = {
91
+ 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 = {
92
92
  height: 0,
93
93
  spaceRow: null != actualSpaceRow ? actualSpaceRow : commonSpaceRow
94
94
  };
@@ -115,16 +115,16 @@ export const getTooltipAttributes = (actualTooltip, spec, globalTheme) => {
115
115
  const shape = {
116
116
  visible: !0,
117
117
  symbolType: actualShapeType
118
- }, adaptiveShapeFill = null != actualShapeFill ? actualShapeFill : actualShapeColor;
119
- actualShapeHollow ? shape.stroke = adaptiveShapeFill : shape.fill = adaptiveShapeFill,
120
- shape.stroke = null != actualShapeStroke ? actualShapeStroke : adaptiveShapeFill,
118
+ };
119
+ actualShapeHollow ? shape.stroke = actualShapeFill : shape.fill = actualShapeFill,
120
+ shape.stroke = null != actualShapeStroke ? actualShapeStroke : actualShapeFill,
121
121
  shape.lineWidth = actualShapeLineWidth, itemAttrs.shape = shape;
122
122
  const shapeWidth = null != actualShapeSize ? actualShapeSize : shapeStyle.size;
123
123
  itemHeight = Math.max(shapeWidth, itemHeight), shapeWidths.push(shapeWidth);
124
124
  } else itemAttrs.shape = {
125
125
  visible: !1
126
126
  };
127
- return itemAttrs.height = itemHeight, contentHeight += itemHeight, i < filteredContent.length - 1 && (contentHeight += itemAttrs.spaceRow),
127
+ return itemAttrs.height = itemHeight, contentHeight += itemHeight, i < content.length - 1 && (contentHeight += itemAttrs.spaceRow),
128
128
  itemAttrs;
129
129
  })), panelHeight += contentHeight, panelDomHeight += Math.min(contentHeight, null != maxContentHeight ? maxContentHeight : 1 / 0),
130
130
  maxKeyWidth = keyWidths.length ? maxInArray(keyWidths) : 0, maxAdaptiveKeyWidth = adaptiveKeyWidths.length ? maxInArray(adaptiveKeyWidths) : 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/attribute.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,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C,UAAU,CAAC,cAAc,GAAG,cAAc,CAAC;IAC3C,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","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,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,MAAM,uBAAuB,GAA+B;IAC1D,UAAU,EAAE,KAAK,CAAC,UAAU;IAC5B,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,YAAY;CACxB,CAAC;AAEF,MAAM,UAAU,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,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AAU,CAAC,cAAc,GAAG,cAAc,CAAC;IAC3C,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC","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":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I,IAA6B,CAAC,IAA4B,CAAC;QACzE,SAAS,GAAG,IAA4B,CAAC;KAC1C;IAED,MAAM,KAAK,GAAG,iBAAiB,CAAC;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","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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IAA4B,CAAC;QACzE,SAAS,GAAG,IAA4B,CAAC;KAC1C;IAED,MAAM,KAAK,GAAG,iBAAiB,CAAC;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","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: {
@@ -12,34 +12,29 @@ export const getActualTooltipPositionValue = (position, event) => {
12
12
  };
13
13
 
14
14
  export const positionType = {
15
- left: [ "left", "center" ],
16
- right: [ "right", "center" ],
17
- top: [ "center", "top" ],
18
- lt: [ "left", "top" ],
19
- tl: [ "left", "top" ],
20
- rt: [ "right", "top" ],
21
- tr: [ "right", "top" ],
22
- bottom: [ "center", "bottom" ],
23
- bl: [ "left", "bottom" ],
24
- lb: [ "left", "bottom" ],
25
- br: [ "right", "bottom" ],
26
- rb: [ "right", "bottom" ],
27
- inside: [ "center", "center" ],
28
- center: [ "center", "center" ],
29
- centerBottom: [ "center", "centerBottom" ],
30
- centerTop: [ "center", "centerTop" ],
31
- centerLeft: [ "centerLeft", "center" ],
32
- centerRight: [ "centerRight", "center" ]
15
+ left: [ -2, 0 ],
16
+ right: [ 2, 0 ],
17
+ top: [ 0, -2 ],
18
+ lt: [ -2, -2 ],
19
+ tl: [ -2, -2 ],
20
+ rt: [ 2, -2 ],
21
+ tr: [ 2, -2 ],
22
+ bottom: [ 0, 2 ],
23
+ bl: [ -2, 2 ],
24
+ lb: [ -2, 2 ],
25
+ br: [ 2, 2 ],
26
+ rb: [ 2, 2 ],
27
+ inside: [ 0, 0 ],
28
+ center: [ 0, 0 ],
29
+ centerBottom: [ 0, 1 ],
30
+ centerTop: [ 0, -1 ],
31
+ centerLeft: [ -1, 0 ],
32
+ centerRight: [ 1, 0 ]
33
33
  };
34
34
 
35
- export const getHorizontalPositionType = (position, defaultCase) => {
35
+ export const getPositionType = (position, dim, defaultCase = 2) => {
36
36
  var _a, _b;
37
- return null !== (_b = null === (_a = positionType[position]) || void 0 === _a ? void 0 : _a[0]) && void 0 !== _b ? _b : defaultCase;
38
- };
39
-
40
- export const getVerticalPositionType = (position, defaultCase) => {
41
- var _a, _b;
42
- return null !== (_b = null === (_a = positionType[position]) || void 0 === _a ? void 0 : _a[1]) && void 0 !== _b ? _b : defaultCase;
37
+ return null !== (_b = null === (_a = positionType[position]) || void 0 === _a ? void 0 : _a["x" === dim ? 0 : 1]) && void 0 !== _b ? _b : defaultCase;
43
38
  };
44
39
 
45
40
  export const getCartesianCrosshairRect = (dimensionData, layoutStartPoint) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/position.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,iDAAiD,CAAC;AASzD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,QAAqE,EACr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;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,GAAQ,EAAuC,EAAE;IAC7F,OAAO,CACL,QAAQ,CAAC,GAAG,CAAC;QACb,CAAC,OAAO,CAAE,GAAoC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAE,GAAoC,CAAC,CAAC,CAAC,CAAC,CACvG,CAAC;AACJ,CAAC,CAAC","file":"position.js","sourcesContent":["import type { IAxis } from '../../../../component/axis';\nimport type { AxisCurrentValueMap } from '../../../../component/crosshair';\nimport type { IHair } from '../../../../component/crosshair/base';\nimport { LayoutType } from '../../../../component/crosshair/config';\nimport {\n layoutByValue,\n layoutHorizontalCrosshair,\n layoutVerticalCrosshair\n} from '../../../../component/crosshair/utils/cartesian';\nimport type { IDimensionData } from '../../../../event';\nimport type { ICartesianSeries } from '../../../../series';\nimport { Direction, type ILayoutPoint } from '../../../../typings';\nimport type {\n IFixedTooltipPositionPattern,\n IGlobalTooltipPositionPattern,\n TooltipFixedPosition\n} from '../../../../typings/tooltip/position';\nimport { isFunction, isNumber, isObject, isValid } from '@visactor/vutils';\n\nexport const getActualTooltipPositionValue = (\n position: number | ((event: MouseEvent) => number) | null | undefined,\n event: MouseEvent\n) => {\n let result;\n if (isValid(position)) {\n if (isNumber(position)) {\n result = position;\n } else if (isFunction(position)) {\n // 这里额外判断下是否合法\n const tooltipPosition = position(event);\n\n if (isNumber(tooltipPosition)) {\n result = tooltipPosition;\n }\n }\n }\n return result;\n};\n\nexport type TooltipHorizontalPositionType = 'left' | 'right' | 'center' | 'centerLeft' | 'centerRight';\nexport type TooltipVerticalPositionType = 'top' | 'bottom' | 'center' | 'centerTop' | 'centerBottom';\n\n/** position 对齐方式在 x、y 分量下的分解 */\nexport const positionType: Record<TooltipFixedPosition, [TooltipHorizontalPositionType, TooltipVerticalPositionType]> =\n {\n left: ['left', 'center'],\n right: ['right', 'center'],\n top: ['center', 'top'],\n lt: ['left', 'top'],\n tl: ['left', 'top'],\n rt: ['right', 'top'],\n tr: ['right', 'top'],\n bottom: ['center', 'bottom'],\n bl: ['left', 'bottom'],\n lb: ['left', 'bottom'],\n br: ['right', 'bottom'],\n rb: ['right', 'bottom'],\n inside: ['center', 'center'], // 旧版兼容\n center: ['center', 'center'],\n centerBottom: ['center', 'centerBottom'],\n centerTop: ['center', 'centerTop'],\n centerLeft: ['centerLeft', 'center'],\n centerRight: ['centerRight', 'center']\n };\n\nexport const getHorizontalPositionType = (\n position: TooltipFixedPosition,\n defaultCase?: TooltipHorizontalPositionType\n): TooltipHorizontalPositionType => positionType[position]?.[0] ?? defaultCase;\n\nexport const getVerticalPositionType = (\n position: TooltipFixedPosition,\n defaultCase?: TooltipVerticalPositionType\n): TooltipVerticalPositionType => positionType[position]?.[1] ?? defaultCase;\n\nexport const getCartesianCrosshairRect = (dimensionData: IDimensionData, layoutStartPoint: ILayoutPoint) => {\n const currValueX: AxisCurrentValueMap = new Map();\n const currValueY: AxisCurrentValueMap = new Map();\n const { series, datum } = dimensionData;\n const isHorizontal = (series as ICartesianSeries).direction === Direction.horizontal;\n const axisHelper = isHorizontal\n ? (series as ICartesianSeries).getYAxisHelper()\n : (series as ICartesianSeries).getXAxisHelper();\n const axisId = axisHelper.getAxisId();\n const axis = series\n .getChart()\n .getComponentsByKey('axes')\n .find(axis => axis.id === axisId) as IAxis;\n\n if (!axis) {\n return undefined;\n }\n (isHorizontal ? currValueY : currValueX).set(axis.getSpecIndex(), {\n value: series.getDatumPositionValues(datum[0], series.getDimensionField())?.[0],\n axis\n });\n\n const xHair: IHair = {\n visible: !!currValueX.size,\n type: 'rect'\n };\n const yHair: IHair = {\n visible: !!currValueY.size,\n type: 'rect'\n };\n\n const {\n x: crosshairInfoX,\n y: crosshairInfoY,\n offsetWidth,\n offsetHeight,\n bandWidth,\n bandHeight\n } = layoutByValue(LayoutType.ALL, series as ICartesianSeries, layoutStartPoint, currValueX, currValueY, xHair, yHair);\n\n if (crosshairInfoX) {\n return layoutVerticalCrosshair(xHair, crosshairInfoX, bandWidth, offsetWidth);\n }\n if (crosshairInfoY) {\n return layoutHorizontalCrosshair(yHair, crosshairInfoY, bandHeight, offsetHeight);\n }\n return undefined;\n};\n\nexport const isGlobalTooltipPositionPattern = (obj: any): obj is IGlobalTooltipPositionPattern => {\n return (\n isObject(obj) &&\n (isValid((obj as IGlobalTooltipPositionPattern).left) ||\n isValid((obj as IGlobalTooltipPositionPattern).right) ||\n isValid((obj as IGlobalTooltipPositionPattern).top) ||\n isValid((obj as IGlobalTooltipPositionPattern).bottom))\n );\n};\n\nexport const isFixedTooltipPositionPattern = (obj: any): obj is IFixedTooltipPositionPattern => {\n return (\n isObject(obj) &&\n (isValid((obj as IFixedTooltipPositionPattern).x) || isValid((obj as IFixedTooltipPositionPattern).y))\n );\n};\n"]}
1
+ {"version":3,"sources":["../src/plugin/components/tooltip-handler/utils/position.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,iDAAiD,CAAC;AASzD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,QAAqE,EACrE,KAAiB,EACT,EAAE;IACV,IAAI,MAAc,CAAC;IACnB,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE;QACrB,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtB,MAAM,GAAG,QAAkB,CAAC;SAC7B;aAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;YAE/B,MAAM,eAAe,GAAI,QAA0C,CAAC,KAAK,CAAC,CAAC;YAE3E,IAAI,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC7B,MAAM,GAAG,eAAe,CAAC;aAC1B;SACF;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAOF,MAAM,CAAC,MAAM,YAAY,GAA6E;IACpG,IAAI,EAAE,CAAC,C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UAAU,EACX,GAAG,aAAa,IAAiB,MAA0B,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAEtH,IAAI,cAAc,EAAE;QAClB,OAAO,uBAAuB,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;KAC/E;IACD,IAAI,cAAc,EAAE;QAClB,OAAO,yBAAyB,CAAC,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;KACnF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,GAAQ,EAAwC,EAAE;IAC/F,OAAO,CACL,QAAQ,CAAC,GAAG,CAAC;QACb,CAAC,OAAO,CAAE,GAAqC,CAAC,IAAI,CAAC;YACnD,OAAO,CAAE,GAAqC,CAAC,KAAK,CAAC;YACrD,OAAO,CAAE,GAAqC,CAAC,GAAG,CAAC;YACnD,OAAO,CAAE,GAAqC,CAAC,MAAM,CAAC,CAAC,CAC1D,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,GAAQ,EAAuC,EAAE;IAC7F,OAAO,CACL,QAAQ,CAAC,GAAG,CAAC;QACb,CAAC,OAAO,CAAE,GAAoC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAE,GAAoC,CAAC,CAAC,CAAC,CAAC,CACvG,CAAC;AACJ,CAAC,CAAC","file":"position.js","sourcesContent":["import type { IAxis } from '../../../../component/axis';\nimport type { AxisCurrentValueMap } from '../../../../component/crosshair';\nimport type { IHair } from '../../../../component/crosshair/base';\nimport { LayoutType } from '../../../../component/crosshair/config';\nimport {\n layoutByValue,\n layoutHorizontalCrosshair,\n layoutVerticalCrosshair\n} from '../../../../component/crosshair/utils/cartesian';\nimport type { IDimensionData } from '../../../../event';\nimport type { ICartesianSeries } from '../../../../series';\nimport { Direction, type ILayoutPoint } from '../../../../typings';\nimport type {\n IFixedTooltipPositionPattern,\n IGlobalTooltipPositionPattern,\n TooltipFixedPosition\n} from '../../../../typings/tooltip/position';\nimport { isFunction, isNumber, isObject, isValid } from '@visactor/vutils';\n\nexport const getActualTooltipPositionValue = (\n position: number | ((event: MouseEvent) => number) | null | undefined,\n event: MouseEvent\n): number => {\n let result: number;\n if (isValid(position)) {\n if (isNumber(position)) {\n result = position as number;\n } else if (isFunction(position)) {\n // 这里额外判断下是否合法\n const tooltipPosition = (position as (event: MouseEvent) => number)(event);\n\n if (isNumber(tooltipPosition)) {\n result = tooltipPosition;\n }\n }\n }\n return result;\n};\n\n// 'left' | 'centerLeft' | 'center' | 'centerRight' | 'right'\n// 'top' | 'centerTop' | 'center' | 'centerBottom' | 'bottom'\nexport type TooltipPositionType = -2 | -1 | 0 | 1 | 2;\n\n/** position 对齐方式在 x、y 分量下的分解 */\nexport const positionType: Record<TooltipFixedPosition, [TooltipPositionType, TooltipPositionType]> = {\n left: [-2, 0],\n right: [2, 0],\n top: [0, -2],\n lt: [-2, -2],\n tl: [-2, -2],\n rt: [2, -2],\n tr: [2, -2],\n bottom: [0, 2],\n bl: [-2, 2],\n lb: [-2, 2],\n br: [2, 2],\n rb: [2, 2],\n inside: [0, 0], // 旧版兼容\n center: [0, 0],\n centerBottom: [0, 1],\n centerTop: [0, -1],\n centerLeft: [-1, 0],\n centerRight: [1, 0]\n};\n\nexport const getPositionType = (\n position: TooltipFixedPosition,\n dim: 'x' | 'y',\n defaultCase: TooltipPositionType = 2\n): TooltipPositionType => positionType[position]?.[dim === 'x' ? 0 : 1] ?? defaultCase;\n\nexport const getCartesianCrosshairRect = (dimensionData: IDimensionData, layoutStartPoint: ILayoutPoint) => {\n const currValueX: AxisCurrentValueMap = new Map();\n const currValueY: AxisCurrentValueMap = new Map();\n const { series, datum } = dimensionData;\n const isHorizontal = (series as ICartesianSeries).direction === Direction.horizontal;\n const axisHelper = isHorizontal\n ? (series as ICartesianSeries).getYAxisHelper()\n : (series as ICartesianSeries).getXAxisHelper();\n const axisId = axisHelper.getAxisId();\n const axis = series\n .getChart()\n .getComponentsByKey('axes')\n .find(axis => axis.id === axisId) as IAxis;\n\n if (!axis) {\n return undefined;\n }\n (isHorizontal ? currValueY : currValueX).set(axis.getSpecIndex(), {\n value: series.getDatumPositionValues(datum[0], series.getDimensionField())?.[0],\n axis\n });\n\n const xHair: IHair = {\n visible: !!currValueX.size,\n type: 'rect'\n };\n const yHair: IHair = {\n visible: !!currValueY.size,\n type: 'rect'\n };\n\n const {\n x: crosshairInfoX,\n y: crosshairInfoY,\n offsetWidth,\n offsetHeight,\n bandWidth,\n bandHeight\n } = layoutByValue(LayoutType.ALL, series as ICartesianSeries, layoutStartPoint, currValueX, currValueY, xHair, yHair);\n\n if (crosshairInfoX) {\n return layoutVerticalCrosshair(xHair, crosshairInfoX, bandWidth, offsetWidth);\n }\n if (crosshairInfoY) {\n return layoutHorizontalCrosshair(yHair, crosshairInfoY, bandHeight, offsetHeight);\n }\n return undefined;\n};\n\nexport const isGlobalTooltipPositionPattern = (obj: any): obj is IGlobalTooltipPositionPattern => {\n return (\n isObject(obj) &&\n (isValid((obj as IGlobalTooltipPositionPattern).left) ||\n isValid((obj as IGlobalTooltipPositionPattern).right) ||\n isValid((obj as IGlobalTooltipPositionPattern).top) ||\n isValid((obj as IGlobalTooltipPositionPattern).bottom))\n );\n};\n\nexport const isFixedTooltipPositionPattern = (obj: any): obj is IFixedTooltipPositionPattern => {\n return (\n isObject(obj) &&\n (isValid((obj as IFixedTooltipPositionPattern).x) || isValid((obj as IFixedTooltipPositionPattern).y))\n );\n};\n"]}
@@ -53,7 +53,9 @@ export interface IRegionSpec extends ILayoutItemSpec {
53
53
  }
54
54
  export interface IGeoRegionSpec extends IRegionSpec {
55
55
  coordinate?: 'geo';
56
- roam?: boolean;
56
+ roam?: boolean | {
57
+ blank?: boolean;
58
+ };
57
59
  longitudeField?: string;
58
60
  latitudeField?: string;
59
61
  projection?: Partial<Omit<IProjectionSpec, 'name'>>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/region/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IMark } from '../mark/interface';\nimport type { ILayoutModel, IModelConstructor, IModelOption, IModelSpecInfo } from '../model/interface';\nimport type { ISeries, SeriesType } from '../series/interface';\nimport type { CoordinateType } from '../typings/coordinate';\nimport type { IInteraction } from '../interaction/interface';\nimport type { IProjectionSpec } from '../component/geo/interface';\nimport type { ConvertToMarkStyleSpec, IRectMarkSpec } from '../typings/visual';\nimport type { IAnimate } from '../animation/interface';\nimport type { IGroupMark } from '../mark/group';\nimport type { StringOrNumber } from '../typings';\nimport type { ILayoutItemSpec } from '../layout/interface';\n\nexport interface IRegion extends ILayoutModel {\n animate?: IAnimate;\n interaction: IInteraction;\n\n //stack\n getStackInverse: () => boolean;\n getStackSort: () => boolean;\n\n getMaxWidth: () => number | undefined;\n setMaxWidth: (value: number) => void;\n getMaxHeight: () => number | undefined;\n setMaxHeight: (value: number) => void;\n\n // 系列\n addSeries: (series: ISeries) => void;\n removeSeries: (series: ISeries) => void;\n\n getSeries: (opt?: ISeriesFilter) => ISeries[];\n getSeriesInName: (name: string) => ISeries;\n getSeriesInUserId: (userId: string) => ISeries;\n getSeriesInId: (id: number) => ISeries;\n getSeriesInType: (type: SeriesType) => ISeries[];\n getSeriesInCoordinateType: (type: CoordinateType) => ISeries[];\n getSeriesInDataName: (dataName: string) => ISeries[];\n\n getMarks: () => IMark[];\n getGroupMark: () => IGroupMark;\n getInteractionMark: () => IGroupMark;\n\n getSpecInfo: () => IRegionSpecInfo;\n}\n\nexport type ISeriesFilter = {\n name?: string;\n userId?: StringOrNumber | StringOrNumber[];\n specIndex?: number | number[];\n id?: number;\n type?: string;\n coordinateType?: CoordinateType;\n dataName?: string;\n};\n\nexport interface IRegionConstructor extends IModelConstructor {\n new (spec: IRegionSpec, ctx: IModelOption): IRegion;\n}\n\nexport interface IRegionSpec extends ILayoutItemSpec {\n id?: StringOrNumber;\n coordinate?: CoordinateType;\n style?: ConvertToMarkStyleSpec<IRectMarkSpec>;\n /**\n * 堆积时是否逆序\n * @default false\n * @since 1.4.0\n */\n stackInverse?: boolean;\n /**\n * 堆积时是否排序\n * @default false\n * @since 1.10.4\n */\n stackSort?: boolean;\n}\n\nexport interface IGeoRegionSpec extends IRegionSpec {\n coordinate?: 'geo';\n /**\n * 是否可以拖拽\n * @default false\n */\n roam?: boolean;\n /**\n * 数据中的经度字段名\n */\n longitudeField?: string;\n /**\n * 数据中的纬度字段名\n */\n latitudeField?: string;\n /**\n * 地理映射配置\n */\n projection?: Partial<Omit<IProjectionSpec, 'name'>>;\n /**\n * 缩放最大最小倍数限制\n */\n zoomLimit?: {\n min?: number;\n max?: number;\n };\n}\n\nexport type RegionSpec = IRegionSpec | IGeoRegionSpec;\n\nexport interface IRegionSpecInfo<T extends RegionSpec = IRegionSpec> extends IModelSpecInfo {\n /** model 具体类型 */\n type: 'region';\n /** model spec */\n spec: T;\n}\n"]}
1
+ {"version":3,"sources":["../src/region/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IMark } from '../mark/interface';\nimport type { ILayoutModel, IModelConstructor, IModelOption, IModelSpecInfo } from '../model/interface';\nimport type { ISeries, SeriesType } from '../series/interface';\nimport type { CoordinateType } from '../typings/coordinate';\nimport type { IInteraction } from '../interaction/interface';\nimport type { IProjectionSpec } from '../component/geo/interface';\nimport type { ConvertToMarkStyleSpec, IRectMarkSpec } from '../typings/visual';\nimport type { IAnimate } from '../animation/interface';\nimport type { IGroupMark } from '../mark/group';\nimport type { StringOrNumber } from '../typings';\nimport type { ILayoutItemSpec } from '../layout/interface';\n\nexport interface IRegion extends ILayoutModel {\n animate?: IAnimate;\n interaction: IInteraction;\n\n //stack\n getStackInverse: () => boolean;\n getStackSort: () => boolean;\n\n getMaxWidth: () => number | undefined;\n setMaxWidth: (value: number) => void;\n getMaxHeight: () => number | undefined;\n setMaxHeight: (value: number) => void;\n\n // 系列\n addSeries: (series: ISeries) => void;\n removeSeries: (series: ISeries) => void;\n\n getSeries: (opt?: ISeriesFilter) => ISeries[];\n getSeriesInName: (name: string) => ISeries;\n getSeriesInUserId: (userId: string) => ISeries;\n getSeriesInId: (id: number) => ISeries;\n getSeriesInType: (type: SeriesType) => ISeries[];\n getSeriesInCoordinateType: (type: CoordinateType) => ISeries[];\n getSeriesInDataName: (dataName: string) => ISeries[];\n\n getMarks: () => IMark[];\n getGroupMark: () => IGroupMark;\n getInteractionMark: () => IGroupMark;\n\n getSpecInfo: () => IRegionSpecInfo;\n}\n\nexport type ISeriesFilter = {\n name?: string;\n userId?: StringOrNumber | StringOrNumber[];\n specIndex?: number | number[];\n id?: number;\n type?: string;\n coordinateType?: CoordinateType;\n dataName?: string;\n};\n\nexport interface IRegionConstructor extends IModelConstructor {\n new (spec: IRegionSpec, ctx: IModelOption): IRegion;\n}\n\nexport interface IRegionSpec extends ILayoutItemSpec {\n id?: StringOrNumber;\n coordinate?: CoordinateType;\n style?: ConvertToMarkStyleSpec<IRectMarkSpec>;\n /**\n * 堆积时是否逆序\n * @default false\n * @since 1.4.0\n */\n stackInverse?: boolean;\n /**\n * 堆积时是否排序\n * @default false\n * @since 1.10.4\n */\n stackSort?: boolean;\n}\n\nexport interface IGeoRegionSpec extends IRegionSpec {\n coordinate?: 'geo';\n /**\n * 是否可以拖拽\n * @default false\n * @since 1.12.8 支持 blank 配置,在 region 空白区域也能触发拖拽\n */\n roam?: boolean | { blank?: boolean };\n /**\n * 数据中的经度字段名\n */\n longitudeField?: string;\n /**\n * 数据中的纬度字段名\n */\n latitudeField?: string;\n /**\n * 地理映射配置\n */\n projection?: Partial<Omit<IProjectionSpec, 'name'>>;\n /**\n * 缩放最大最小倍数限制\n */\n zoomLimit?: {\n min?: number;\n max?: number;\n };\n}\n\nexport type RegionSpec = IRegionSpec | IGeoRegionSpec;\n\nexport interface IRegionSpecInfo<T extends RegionSpec = IRegionSpec> extends IModelSpecInfo {\n /** model 具体类型 */\n type: 'region';\n /** model spec */\n spec: T;\n}\n"]}
@@ -558,7 +558,7 @@ export class BaseSeries extends BaseModel {
558
558
  newMarks.length !== prevMarks.length || prevMarks.some(((prev, index) => prev.type !== newMarks[index].type || prev.id !== newMarks[index].id)) ? compareResult.reMake = !0 : prevMarks.some(((prev, index) => prev.visible !== newMarks[index].visible)) && (compareResult.reCompile = !0);
559
559
  }
560
560
  _compareLabelSpec(newLabels, prevLabels, compareResult) {
561
- newLabels.length !== prevLabels.length || prevLabels.some(((prev, index) => prev.labelLayout !== newLabels[index].labelLayout)) ? compareResult.reMake = !0 : !compareResult.reCompile && prevLabels.some(((prev, index) => !isEqual(prev, newLabels[index]))) && (compareResult.reCompile = !0);
561
+ newLabels.length !== prevLabels.length || prevLabels.some(((prev, index) => prev.labelLayout !== newLabels[index].labelLayout || prev.visible !== newLabels[index].visible)) ? compareResult.reMake = !0 : !compareResult.reCompile && prevLabels.some(((prev, index) => !isEqual(prev, newLabels[index]))) && (compareResult.reCompile = !0);
562
562
  }
563
563
  _compareSpec(spec, prevSpec, ignoreCheckKeys) {
564
564
  const result = super._compareSpec(spec, prevSpec), currentKeys = Object.keys(prevSpec || {}).sort(), nextKeys = Object.keys(spec || {}).sort();