@visactor/vrender-components 0.17.0-alpha.8 → 0.17.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 (449) hide show
  1. package/cjs/axis/base.d.ts +2 -1
  2. package/cjs/axis/base.js +23 -12
  3. package/cjs/axis/base.js.map +1 -1
  4. package/cjs/axis/circle.d.ts +9 -4
  5. package/cjs/axis/circle.js +8 -5
  6. package/cjs/axis/circle.js.map +1 -1
  7. package/cjs/axis/grid/base.js +2 -2
  8. package/cjs/axis/grid/base.js.map +1 -1
  9. package/cjs/axis/grid/circle.d.ts +2 -1
  10. package/cjs/axis/grid/circle.js +2 -2
  11. package/cjs/axis/grid/circle.js.map +1 -1
  12. package/cjs/axis/grid/line.d.ts +2 -1
  13. package/cjs/axis/grid/line.js +2 -3
  14. package/cjs/axis/grid/line.js.map +1 -1
  15. package/cjs/axis/line.d.ts +2 -1
  16. package/cjs/axis/line.js +39 -45
  17. package/cjs/axis/line.js.map +1 -1
  18. package/cjs/axis/overlap/auto-hide.js +8 -7
  19. package/cjs/axis/overlap/auto-hide.js.map +1 -1
  20. package/cjs/axis/overlap/auto-limit.js.map +1 -1
  21. package/cjs/axis/overlap/auto-rotate.js +3 -35
  22. package/cjs/axis/overlap/auto-rotate.js.map +1 -1
  23. package/cjs/axis/overlap/util.d.ts +3 -0
  24. package/cjs/axis/overlap/util.js +44 -0
  25. package/cjs/axis/overlap/util.js.map +1 -0
  26. package/cjs/axis/type.d.ts +6 -6
  27. package/cjs/axis/type.js.map +1 -1
  28. package/cjs/axis/util.d.ts +8 -0
  29. package/cjs/axis/util.js +34 -0
  30. package/cjs/axis/util.js.map +1 -0
  31. package/cjs/brush/brush.d.ts +2 -1
  32. package/cjs/brush/brush.js +8 -4
  33. package/cjs/brush/brush.js.map +1 -1
  34. package/cjs/brush/type.d.ts +2 -1
  35. package/cjs/brush/type.js.map +1 -1
  36. package/cjs/checkbox/checkbox.d.ts +4 -2
  37. package/cjs/checkbox/checkbox.js +26 -12
  38. package/cjs/checkbox/checkbox.js.map +1 -1
  39. package/cjs/checkbox/index.js +1 -2
  40. package/cjs/checkbox/type.d.ts +5 -1
  41. package/cjs/checkbox/type.js +2 -1
  42. package/cjs/checkbox/type.js.map +1 -1
  43. package/cjs/constant.d.ts +6 -0
  44. package/cjs/constant.js +6 -1
  45. package/cjs/constant.js.map +1 -1
  46. package/cjs/core/base.d.ts +4 -2
  47. package/cjs/core/base.js +9 -6
  48. package/cjs/core/base.js.map +1 -1
  49. package/cjs/core/type.d.ts +15 -0
  50. package/cjs/core/type.js.map +1 -1
  51. package/cjs/crosshair/circle.d.ts +2 -1
  52. package/cjs/crosshair/circle.js +2 -2
  53. package/cjs/crosshair/circle.js.map +1 -1
  54. package/cjs/crosshair/line.d.ts +2 -1
  55. package/cjs/crosshair/line.js +2 -2
  56. package/cjs/crosshair/line.js.map +1 -1
  57. package/cjs/crosshair/polygon.d.ts +2 -1
  58. package/cjs/crosshair/polygon.js +2 -2
  59. package/cjs/crosshair/polygon.js.map +1 -1
  60. package/cjs/crosshair/rect.d.ts +2 -1
  61. package/cjs/crosshair/rect.js +2 -2
  62. package/cjs/crosshair/rect.js.map +1 -1
  63. package/cjs/crosshair/sector.d.ts +2 -1
  64. package/cjs/crosshair/sector.js +2 -2
  65. package/cjs/crosshair/sector.js.map +1 -1
  66. package/cjs/data-zoom/config.d.ts +6 -6
  67. package/cjs/data-zoom/config.js +7 -7
  68. package/cjs/data-zoom/config.js.map +1 -1
  69. package/cjs/data-zoom/data-zoom.d.ts +21 -11
  70. package/cjs/data-zoom/data-zoom.js +80 -64
  71. package/cjs/data-zoom/data-zoom.js.map +1 -1
  72. package/cjs/data-zoom/type.d.ts +17 -5
  73. package/cjs/data-zoom/type.js +6 -1
  74. package/cjs/data-zoom/type.js.map +1 -1
  75. package/cjs/index.d.ts +1 -1
  76. package/cjs/index.js +1 -1
  77. package/cjs/index.js.map +1 -1
  78. package/cjs/indicator/config.js +1 -2
  79. package/cjs/indicator/index.js +2 -1
  80. package/cjs/indicator/indicator.js +43 -7
  81. package/cjs/indicator/indicator.js.map +1 -1
  82. package/cjs/indicator/type.d.ts +2 -1
  83. package/cjs/indicator/type.js.map +1 -1
  84. package/cjs/interface.d.ts +5 -0
  85. package/cjs/interface.js.map +1 -1
  86. package/cjs/label/animate/animate.d.ts +8 -2
  87. package/cjs/label/animate/animate.js +37 -3
  88. package/cjs/label/animate/animate.js.map +1 -1
  89. package/cjs/label/arc.d.ts +7 -6
  90. package/cjs/label/arc.js +5 -17
  91. package/cjs/label/arc.js.map +1 -1
  92. package/cjs/label/area.d.ts +15 -0
  93. package/cjs/label/area.js +41 -0
  94. package/cjs/label/area.js.map +1 -0
  95. package/cjs/label/base.d.ts +28 -18
  96. package/cjs/label/base.js +114 -61
  97. package/cjs/label/base.js.map +1 -1
  98. package/cjs/label/dataLabel.d.ts +2 -1
  99. package/cjs/label/dataLabel.js +13 -8
  100. package/cjs/label/dataLabel.js.map +1 -1
  101. package/cjs/label/index.d.ts +2 -0
  102. package/cjs/label/index.js +1 -0
  103. package/cjs/label/index.js.map +1 -1
  104. package/cjs/label/line-data.d.ts +13 -0
  105. package/cjs/label/line-data.js +31 -0
  106. package/cjs/label/line-data.js.map +1 -0
  107. package/cjs/label/line.d.ts +4 -3
  108. package/cjs/label/line.js +8 -14
  109. package/cjs/label/line.js.map +1 -1
  110. package/cjs/label/polygon.d.ts +2 -1
  111. package/cjs/label/polygon.js +3 -2
  112. package/cjs/label/polygon.js.map +1 -1
  113. package/cjs/label/rect.d.ts +2 -1
  114. package/cjs/label/rect.js +29 -3
  115. package/cjs/label/rect.js.map +1 -1
  116. package/cjs/label/symbol.d.ts +2 -1
  117. package/cjs/label/symbol.js +5 -44
  118. package/cjs/label/symbol.js.map +1 -1
  119. package/cjs/label/type.d.ts +42 -8
  120. package/cjs/label/type.js +1 -2
  121. package/cjs/label/type.js.map +1 -1
  122. package/cjs/label/util.d.ts +11 -1
  123. package/cjs/label/util.js +74 -1
  124. package/cjs/label/util.js.map +1 -1
  125. package/cjs/legend/color/color.d.ts +2 -1
  126. package/cjs/legend/color/color.js +6 -5
  127. package/cjs/legend/color/color.js.map +1 -1
  128. package/cjs/legend/constant.js +2 -1
  129. package/cjs/legend/discrete/discrete.d.ts +5 -1
  130. package/cjs/legend/discrete/discrete.js +74 -61
  131. package/cjs/legend/discrete/discrete.js.map +1 -1
  132. package/cjs/legend/discrete/type.d.ts +2 -0
  133. package/cjs/legend/discrete/type.js.map +1 -1
  134. package/cjs/legend/index.d.ts +1 -0
  135. package/cjs/legend/index.js +2 -1
  136. package/cjs/legend/index.js.map +1 -1
  137. package/cjs/legend/size/size.d.ts +2 -3
  138. package/cjs/legend/size/size.js +9 -17
  139. package/cjs/legend/size/size.js.map +1 -1
  140. package/cjs/legend/type.d.ts +1 -0
  141. package/cjs/legend/type.js.map +1 -1
  142. package/cjs/legend/util.d.ts +2 -0
  143. package/cjs/legend/util.js +13 -0
  144. package/cjs/legend/util.js.map +1 -0
  145. package/cjs/link-path/link-path.d.ts +2 -1
  146. package/cjs/link-path/link-path.js +3 -3
  147. package/cjs/link-path/link-path.js.map +1 -1
  148. package/cjs/link-path/type.js +1 -1
  149. package/cjs/marker/area.d.ts +8 -2
  150. package/cjs/marker/area.js +14 -3
  151. package/cjs/marker/area.js.map +1 -1
  152. package/cjs/marker/base.d.ts +1 -0
  153. package/cjs/marker/base.js +11 -7
  154. package/cjs/marker/base.js.map +1 -1
  155. package/cjs/marker/line.d.ts +8 -1
  156. package/cjs/marker/line.js +15 -3
  157. package/cjs/marker/line.js.map +1 -1
  158. package/cjs/marker/point.d.ts +7 -4
  159. package/cjs/marker/point.js +8 -3
  160. package/cjs/marker/point.js.map +1 -1
  161. package/cjs/marker/type.d.ts +16 -16
  162. package/cjs/marker/type.js.map +1 -1
  163. package/cjs/pager/pager.d.ts +2 -1
  164. package/cjs/pager/pager.js +5 -5
  165. package/cjs/pager/pager.js.map +1 -1
  166. package/cjs/pager/type.d.ts +1 -0
  167. package/cjs/pager/type.js.map +1 -1
  168. package/cjs/player/base-player.d.ts +2 -1
  169. package/cjs/player/base-player.js +7 -5
  170. package/cjs/player/base-player.js.map +1 -1
  171. package/cjs/player/continuous-player.js +2 -2
  172. package/cjs/player/continuous-player.js.map +1 -1
  173. package/cjs/player/controller/controller.d.ts +2 -1
  174. package/cjs/player/controller/controller.js +5 -5
  175. package/cjs/player/controller/controller.js.map +1 -1
  176. package/cjs/player/controller/type.d.ts +1 -0
  177. package/cjs/player/controller/type.js.map +1 -1
  178. package/cjs/player/discrete-player.d.ts +2 -1
  179. package/cjs/player/discrete-player.js +5 -5
  180. package/cjs/player/discrete-player.js.map +1 -1
  181. package/cjs/player/type/base.d.ts +1 -0
  182. package/cjs/player/type/base.js.map +1 -1
  183. package/cjs/poptip/poptip-plugin.d.ts +1 -0
  184. package/cjs/poptip/poptip-plugin.js +6 -3
  185. package/cjs/poptip/poptip-plugin.js.map +1 -1
  186. package/cjs/poptip/poptip.d.ts +2 -1
  187. package/cjs/poptip/poptip.js +3 -3
  188. package/cjs/poptip/poptip.js.map +1 -1
  189. package/cjs/scrollbar/scrollbar.d.ts +6 -1
  190. package/cjs/scrollbar/scrollbar.js +40 -20
  191. package/cjs/scrollbar/scrollbar.js.map +1 -1
  192. package/cjs/scrollbar/type.d.ts +5 -1
  193. package/cjs/scrollbar/type.js.map +1 -1
  194. package/cjs/segment/segment.d.ts +2 -1
  195. package/cjs/segment/segment.js +6 -4
  196. package/cjs/segment/segment.js.map +1 -1
  197. package/cjs/segment/type.d.ts +6 -2
  198. package/cjs/segment/type.js.map +1 -1
  199. package/cjs/slider/slider.d.ts +2 -1
  200. package/cjs/slider/slider.js +29 -23
  201. package/cjs/slider/slider.js.map +1 -1
  202. package/cjs/slider/type.d.ts +1 -0
  203. package/cjs/slider/type.js.map +1 -1
  204. package/cjs/tag/tag.d.ts +2 -1
  205. package/cjs/tag/tag.js +90 -43
  206. package/cjs/tag/tag.js.map +1 -1
  207. package/cjs/tag/type.d.ts +4 -5
  208. package/cjs/tag/type.js.map +1 -1
  209. package/cjs/title/title.d.ts +2 -1
  210. package/cjs/title/title.js +92 -59
  211. package/cjs/title/title.js.map +1 -1
  212. package/cjs/title/type.d.ts +10 -5
  213. package/cjs/title/type.js.map +1 -1
  214. package/cjs/tooltip/tooltip.d.ts +2 -1
  215. package/cjs/tooltip/tooltip.js +53 -15
  216. package/cjs/tooltip/tooltip.js.map +1 -1
  217. package/cjs/tooltip/type.d.ts +7 -2
  218. package/cjs/tooltip/type.js.map +1 -1
  219. package/cjs/tooltip/util.js +9 -1
  220. package/cjs/tooltip/util.js.map +1 -1
  221. package/cjs/util/label-smartInvert.d.ts +2 -2
  222. package/cjs/util/label-smartInvert.js +9 -5
  223. package/cjs/util/label-smartInvert.js.map +1 -1
  224. package/dist/index.js +10321 -8995
  225. package/dist/index.min.js +1 -1
  226. package/es/axis/base.d.ts +2 -1
  227. package/es/axis/base.js +25 -11
  228. package/es/axis/base.js.map +1 -1
  229. package/es/axis/circle.d.ts +9 -4
  230. package/es/axis/circle.js +9 -4
  231. package/es/axis/circle.js.map +1 -1
  232. package/es/axis/grid/base.js +2 -2
  233. package/es/axis/grid/base.js.map +1 -1
  234. package/es/axis/grid/circle.d.ts +2 -1
  235. package/es/axis/grid/circle.js +2 -2
  236. package/es/axis/grid/circle.js.map +1 -1
  237. package/es/axis/grid/line.d.ts +2 -1
  238. package/es/axis/grid/line.js +2 -2
  239. package/es/axis/grid/line.js.map +1 -1
  240. package/es/axis/line.d.ts +2 -1
  241. package/es/axis/line.js +39 -45
  242. package/es/axis/line.js.map +1 -1
  243. package/es/axis/overlap/auto-hide.js +9 -6
  244. package/es/axis/overlap/auto-hide.js.map +1 -1
  245. package/es/axis/overlap/auto-limit.js.map +1 -1
  246. package/es/axis/overlap/auto-rotate.js +3 -33
  247. package/es/axis/overlap/auto-rotate.js.map +1 -1
  248. package/es/axis/overlap/util.d.ts +3 -0
  249. package/es/axis/overlap/util.js +35 -0
  250. package/es/axis/overlap/util.js.map +1 -0
  251. package/es/axis/type.d.ts +6 -6
  252. package/es/axis/type.js.map +1 -1
  253. package/es/axis/util.d.ts +8 -0
  254. package/es/axis/util.js +28 -0
  255. package/es/axis/util.js.map +1 -0
  256. package/es/brush/brush.d.ts +2 -1
  257. package/es/brush/brush.js +11 -7
  258. package/es/brush/brush.js.map +1 -1
  259. package/es/brush/type.d.ts +2 -1
  260. package/es/brush/type.js.map +1 -1
  261. package/es/checkbox/checkbox.d.ts +4 -2
  262. package/es/checkbox/checkbox.js +25 -10
  263. package/es/checkbox/checkbox.js.map +1 -1
  264. package/es/checkbox/index.js +1 -2
  265. package/es/checkbox/type.d.ts +5 -1
  266. package/es/checkbox/type.js +2 -1
  267. package/es/checkbox/type.js.map +1 -1
  268. package/es/constant.d.ts +6 -0
  269. package/es/constant.js +7 -0
  270. package/es/constant.js.map +1 -1
  271. package/es/core/base.d.ts +4 -2
  272. package/es/core/base.js +6 -4
  273. package/es/core/base.js.map +1 -1
  274. package/es/core/type.d.ts +15 -0
  275. package/es/core/type.js.map +1 -1
  276. package/es/crosshair/circle.d.ts +2 -1
  277. package/es/crosshair/circle.js +2 -2
  278. package/es/crosshair/circle.js.map +1 -1
  279. package/es/crosshair/line.d.ts +2 -1
  280. package/es/crosshair/line.js +2 -2
  281. package/es/crosshair/line.js.map +1 -1
  282. package/es/crosshair/polygon.d.ts +2 -1
  283. package/es/crosshair/polygon.js +2 -2
  284. package/es/crosshair/polygon.js.map +1 -1
  285. package/es/crosshair/rect.d.ts +2 -1
  286. package/es/crosshair/rect.js +2 -2
  287. package/es/crosshair/rect.js.map +1 -1
  288. package/es/crosshair/sector.d.ts +2 -1
  289. package/es/crosshair/sector.js +2 -2
  290. package/es/crosshair/sector.js.map +1 -1
  291. package/es/data-zoom/config.d.ts +6 -6
  292. package/es/data-zoom/config.js +6 -7
  293. package/es/data-zoom/config.js.map +1 -1
  294. package/es/data-zoom/data-zoom.d.ts +21 -11
  295. package/es/data-zoom/data-zoom.js +77 -58
  296. package/es/data-zoom/data-zoom.js.map +1 -1
  297. package/es/data-zoom/type.d.ts +17 -5
  298. package/es/data-zoom/type.js +6 -1
  299. package/es/data-zoom/type.js.map +1 -1
  300. package/es/index.d.ts +1 -1
  301. package/es/index.js +1 -1
  302. package/es/index.js.map +1 -1
  303. package/es/indicator/config.js +1 -2
  304. package/es/indicator/index.js +2 -1
  305. package/es/indicator/indicator.js +44 -6
  306. package/es/indicator/indicator.js.map +1 -1
  307. package/es/indicator/type.d.ts +2 -1
  308. package/es/indicator/type.js.map +1 -1
  309. package/es/interface.d.ts +5 -0
  310. package/es/interface.js.map +1 -1
  311. package/es/label/animate/animate.d.ts +8 -2
  312. package/es/label/animate/animate.js +35 -0
  313. package/es/label/animate/animate.js.map +1 -1
  314. package/es/label/arc.d.ts +7 -6
  315. package/es/label/arc.js +5 -17
  316. package/es/label/arc.js.map +1 -1
  317. package/es/label/area.d.ts +15 -0
  318. package/es/label/area.js +39 -0
  319. package/es/label/area.js.map +1 -0
  320. package/es/label/base.d.ts +28 -18
  321. package/es/label/base.js +116 -61
  322. package/es/label/base.js.map +1 -1
  323. package/es/label/dataLabel.d.ts +2 -1
  324. package/es/label/dataLabel.js +18 -7
  325. package/es/label/dataLabel.js.map +1 -1
  326. package/es/label/index.d.ts +2 -0
  327. package/es/label/index.js +4 -0
  328. package/es/label/index.js.map +1 -1
  329. package/es/label/line-data.d.ts +13 -0
  330. package/es/label/line-data.js +29 -0
  331. package/es/label/line-data.js.map +1 -0
  332. package/es/label/line.d.ts +4 -3
  333. package/es/label/line.js +9 -13
  334. package/es/label/line.js.map +1 -1
  335. package/es/label/polygon.d.ts +2 -1
  336. package/es/label/polygon.js +3 -2
  337. package/es/label/polygon.js.map +1 -1
  338. package/es/label/rect.d.ts +2 -1
  339. package/es/label/rect.js +29 -3
  340. package/es/label/rect.js.map +1 -1
  341. package/es/label/symbol.d.ts +2 -1
  342. package/es/label/symbol.js +6 -43
  343. package/es/label/symbol.js.map +1 -1
  344. package/es/label/type.d.ts +42 -8
  345. package/es/label/type.js +1 -2
  346. package/es/label/type.js.map +1 -1
  347. package/es/label/util.d.ts +11 -1
  348. package/es/label/util.js +69 -0
  349. package/es/label/util.js.map +1 -1
  350. package/es/legend/color/color.d.ts +2 -1
  351. package/es/legend/color/color.js +7 -6
  352. package/es/legend/color/color.js.map +1 -1
  353. package/es/legend/constant.js +2 -1
  354. package/es/legend/discrete/discrete.d.ts +5 -1
  355. package/es/legend/discrete/discrete.js +73 -59
  356. package/es/legend/discrete/discrete.js.map +1 -1
  357. package/es/legend/discrete/type.d.ts +2 -0
  358. package/es/legend/discrete/type.js.map +1 -1
  359. package/es/legend/index.d.ts +1 -0
  360. package/es/legend/index.js +2 -0
  361. package/es/legend/index.js.map +1 -1
  362. package/es/legend/size/size.d.ts +2 -3
  363. package/es/legend/size/size.js +8 -12
  364. package/es/legend/size/size.js.map +1 -1
  365. package/es/legend/type.d.ts +1 -0
  366. package/es/legend/type.js.map +1 -1
  367. package/es/legend/util.d.ts +2 -0
  368. package/es/legend/util.js +7 -0
  369. package/es/legend/util.js.map +1 -0
  370. package/es/link-path/link-path.d.ts +2 -1
  371. package/es/link-path/link-path.js +3 -3
  372. package/es/link-path/link-path.js.map +1 -1
  373. package/es/link-path/type.js +1 -1
  374. package/es/marker/area.d.ts +8 -2
  375. package/es/marker/area.js +14 -3
  376. package/es/marker/area.js.map +1 -1
  377. package/es/marker/base.d.ts +1 -0
  378. package/es/marker/base.js +11 -7
  379. package/es/marker/base.js.map +1 -1
  380. package/es/marker/line.d.ts +8 -1
  381. package/es/marker/line.js +15 -3
  382. package/es/marker/line.js.map +1 -1
  383. package/es/marker/point.d.ts +7 -4
  384. package/es/marker/point.js +8 -3
  385. package/es/marker/point.js.map +1 -1
  386. package/es/marker/type.d.ts +16 -16
  387. package/es/marker/type.js.map +1 -1
  388. package/es/pager/pager.d.ts +2 -1
  389. package/es/pager/pager.js +5 -5
  390. package/es/pager/pager.js.map +1 -1
  391. package/es/pager/type.d.ts +1 -0
  392. package/es/pager/type.js.map +1 -1
  393. package/es/player/base-player.d.ts +2 -1
  394. package/es/player/base-player.js +7 -5
  395. package/es/player/base-player.js.map +1 -1
  396. package/es/player/continuous-player.js +2 -2
  397. package/es/player/continuous-player.js.map +1 -1
  398. package/es/player/controller/controller.d.ts +2 -1
  399. package/es/player/controller/controller.js +5 -5
  400. package/es/player/controller/controller.js.map +1 -1
  401. package/es/player/controller/type.d.ts +1 -0
  402. package/es/player/controller/type.js.map +1 -1
  403. package/es/player/discrete-player.d.ts +2 -1
  404. package/es/player/discrete-player.js +5 -4
  405. package/es/player/discrete-player.js.map +1 -1
  406. package/es/player/type/base.d.ts +1 -0
  407. package/es/player/type/base.js.map +1 -1
  408. package/es/poptip/poptip-plugin.d.ts +1 -0
  409. package/es/poptip/poptip-plugin.js +6 -3
  410. package/es/poptip/poptip-plugin.js.map +1 -1
  411. package/es/poptip/poptip.d.ts +2 -1
  412. package/es/poptip/poptip.js +3 -2
  413. package/es/poptip/poptip.js.map +1 -1
  414. package/es/scrollbar/scrollbar.d.ts +6 -1
  415. package/es/scrollbar/scrollbar.js +42 -20
  416. package/es/scrollbar/scrollbar.js.map +1 -1
  417. package/es/scrollbar/type.d.ts +5 -1
  418. package/es/scrollbar/type.js.map +1 -1
  419. package/es/segment/segment.d.ts +2 -1
  420. package/es/segment/segment.js +7 -5
  421. package/es/segment/segment.js.map +1 -1
  422. package/es/segment/type.d.ts +6 -2
  423. package/es/segment/type.js.map +1 -1
  424. package/es/slider/slider.d.ts +2 -1
  425. package/es/slider/slider.js +29 -23
  426. package/es/slider/slider.js.map +1 -1
  427. package/es/slider/type.d.ts +1 -0
  428. package/es/slider/type.js.map +1 -1
  429. package/es/tag/tag.d.ts +2 -1
  430. package/es/tag/tag.js +89 -40
  431. package/es/tag/tag.js.map +1 -1
  432. package/es/tag/type.d.ts +4 -5
  433. package/es/tag/type.js.map +1 -1
  434. package/es/title/title.d.ts +2 -1
  435. package/es/title/title.js +91 -55
  436. package/es/title/title.js.map +1 -1
  437. package/es/title/type.d.ts +10 -5
  438. package/es/title/type.js.map +1 -1
  439. package/es/tooltip/tooltip.d.ts +2 -1
  440. package/es/tooltip/tooltip.js +55 -15
  441. package/es/tooltip/tooltip.js.map +1 -1
  442. package/es/tooltip/type.d.ts +7 -2
  443. package/es/tooltip/type.js.map +1 -1
  444. package/es/tooltip/util.js +9 -1
  445. package/es/tooltip/util.js.map +1 -1
  446. package/es/util/label-smartInvert.d.ts +2 -2
  447. package/es/util/label-smartInvert.js +9 -5
  448. package/es/util/label-smartInvert.js.map +1 -1
  449. package/package.json +8 -8
@@ -1,7 +1,13 @@
1
1
  import type { IAreaGraphicAttribute, ICurveType, IGroupGraphicAttribute, ILineGraphicAttribute, IRectGraphicAttribute, ISymbolGraphicAttribute } from '@visactor/vrender-core';
2
2
  import type { IPointLike } from '@visactor/vutils';
3
- import type { OrientType } from '../interface';
3
+ import type { IDelayType, OrientType } from '../interface';
4
4
  import type { TagAttributes } from '../tag';
5
+ export declare enum DataZoomActiveTag {
6
+ startHandler = "startHandler",
7
+ endHandler = "endHandler",
8
+ middleHandler = "middleHandler",
9
+ background = "background"
10
+ }
5
11
  export interface DataZoomAttributes extends IGroupGraphicAttribute {
6
12
  position: IPointLike;
7
13
  size: {
@@ -51,10 +57,16 @@ export interface DataZoomAttributes extends IGroupGraphicAttribute {
51
57
  showDetail?: 'auto' | boolean;
52
58
  brushSelect?: boolean;
53
59
  zoomLock?: boolean;
60
+ minSpan?: number;
61
+ maxSpan?: number;
62
+ delayType?: IDelayType;
63
+ delayTime?: number;
64
+ realTime?: boolean;
54
65
  previewData?: any[];
55
- previewCallbackX?: (datum: any) => number;
56
- previewCallbackY?: (datum: any) => number;
57
- previewCallbackX1?: (datum: any) => number;
58
- previewCallbackY1?: (datum: any) => number;
66
+ previewPointsX?: (datum: any) => number;
67
+ previewPointsY?: (datum: any) => number;
68
+ previewPointsX1?: (datum: any) => number;
69
+ previewPointsY1?: (datum: any) => number;
59
70
  updateStateCallback?: (start: number, end: number) => any;
71
+ disableTriggerEvent?: boolean;
60
72
  }
@@ -1,2 +1,7 @@
1
- export { };
1
+ export var DataZoomActiveTag;
2
+
3
+ !function(DataZoomActiveTag) {
4
+ DataZoomActiveTag.startHandler = "startHandler", DataZoomActiveTag.endHandler = "endHandler",
5
+ DataZoomActiveTag.middleHandler = "middleHandler", DataZoomActiveTag.background = "background";
6
+ }(DataZoomActiveTag || (DataZoomActiveTag = {}));
2
7
  //# sourceMappingURL=type.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data-zoom/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type {\n IAreaGraphicAttribute,\n ICurveType,\n IGroupGraphicAttribute,\n ILineGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { OrientType } from '../interface';\nimport type { TagAttributes } from '../tag';\n\nexport interface DataZoomAttributes extends IGroupGraphicAttribute {\n /**\n * DataZoom位置\n */\n position: IPointLike;\n /**\n * DataZoom 尺寸\n */\n size: {\n width: number;\n height: number;\n };\n /**\n * DataZoom方向\n * @default 'bottom'\n */\n orient?: OrientType;\n\n /**\n * 起点配置(比例):范围[0, 1]\n * @default 0\n */\n start?: number;\n\n /**\n * 终点配置(比例):范围[0, 1]\n * @default 1\n */\n end?: number;\n\n /**\n * 背景样式\n */\n backgroundStyle?: IRectGraphicAttribute;\n\n /**\n * 起点手柄样式\n */\n startHandlerStyle?: ISymbolGraphicAttribute;\n\n /**\n * 中间手柄样式\n */\n middleHandlerStyle?: {\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 中间手柄的中间symbol样式\n */\n icon?: ISymbolGraphicAttribute;\n /**\n * 中间手柄的背景rect样式\n */\n background?: {\n style?: IRectGraphicAttribute;\n size?: number;\n };\n };\n\n /**\n * 终点手柄样式\n */\n endHandlerStyle?: ISymbolGraphicAttribute;\n\n /**\n * 起点文字样式\n */\n startTextStyle?: {\n formatMethod?: (text: string | number) => (string | number) | (string | number)[];\n } & Partial<TagAttributes>;\n\n /**\n * 终点文字样式\n */\n endTextStyle?: {\n formatMethod?: (text: string | number) => (string | number) | (string | number)[];\n } & Partial<TagAttributes>;\n\n /**\n * 选中背景样式\n */\n selectedBackgroundStyle?: IRectGraphicAttribute;\n\n /**\n * 拖拽进行中的选中背景样式\n */\n dragMaskStyle?: IRectGraphicAttribute;\n\n /**\n * 背景图表样式\n */\n backgroundChartStyle?: {\n line?: {\n visible?: boolean;\n } & ILineGraphicAttribute;\n area?: {\n /**\n * @default true\n */\n visible?: boolean;\n curveType?: ICurveType;\n } & Omit<IAreaGraphicAttribute, 'curveType'>;\n };\n\n /**\n * 选中的背景图表样式\n */\n selectedBackgroundChartStyle?: {\n line?: {\n /**\n * @default true\n */\n visible?: boolean;\n } & ILineGraphicAttribute;\n area?: {\n /**\n * @default true\n */\n visible?: boolean;\n curveType?: ICurveType;\n } & Omit<IAreaGraphicAttribute, 'curveType'>;\n };\n\n /**\n * 是否显示startText和endText\n * @default 'auto' 鼠标hover在选中区域时才显示startText和endText\n */\n showDetail?: 'auto' | boolean;\n\n /**\n * 是否开启框选, 如果不开启则支持selectedBackground拖拽(框选和拖拽两者互斥)\n * @default true\n */\n brushSelect?: boolean;\n\n /**\n * todo: 是否锁定选择区域(或叫做数据窗口)的大小\n */\n zoomLock?: boolean;\n\n /**\n * 绘制背景图表的数据 & 映射函数\n */\n previewData?: any[];\n previewCallbackX?: (datum: any) => number;\n previewCallbackY?: (datum: any) => number;\n previewCallbackX1?: (datum: any) => number;\n previewCallbackY1?: (datum: any) => number;\n updateStateCallback?: (start: number, end: number) => any;\n}\n"]}
1
+ {"version":3,"sources":["../src/data-zoom/type.ts"],"names":[],"mappings":"AAYA,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,kDAA6B,CAAA;IAC7B,8CAAyB,CAAA;IACzB,oDAA+B,CAAA;IAC/B,8CAAyB,CAAA;AAC3B,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B","file":"type.js","sourcesContent":["import type {\n IAreaGraphicAttribute,\n ICurveType,\n IGroupGraphicAttribute,\n ILineGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { IDelayType, OrientType } from '../interface';\nimport type { TagAttributes } from '../tag';\n\nexport enum DataZoomActiveTag {\n startHandler = 'startHandler',\n endHandler = 'endHandler',\n middleHandler = 'middleHandler',\n background = 'background'\n}\n\nexport interface DataZoomAttributes extends IGroupGraphicAttribute {\n /**\n * DataZoom位置\n */\n position: IPointLike;\n /**\n * DataZoom 尺寸\n */\n size: {\n width: number;\n height: number;\n };\n /**\n * DataZoom方向\n * @default 'bottom'\n */\n orient?: OrientType;\n\n /**\n * 起点配置(比例):范围[0, 1]\n * @default 0\n */\n start?: number;\n\n /**\n * 终点配置(比例):范围[0, 1]\n * @default 1\n */\n end?: number;\n\n /**\n * 背景样式\n */\n backgroundStyle?: IRectGraphicAttribute;\n\n /**\n * 起点手柄样式\n */\n startHandlerStyle?: ISymbolGraphicAttribute;\n\n /**\n * 中间手柄样式\n */\n middleHandlerStyle?: {\n /**\n * 是否显示\n * @default false\n */\n visible?: boolean;\n /**\n * 中间手柄的中间symbol样式\n */\n icon?: ISymbolGraphicAttribute;\n /**\n * 中间手柄的背景rect样式\n */\n background?: {\n style?: IRectGraphicAttribute;\n size?: number;\n };\n };\n\n /**\n * 终点手柄样式\n */\n endHandlerStyle?: ISymbolGraphicAttribute;\n\n /**\n * 起点文字样式\n */\n startTextStyle?: {\n formatMethod?: (text: string | number) => (string | number) | (string | number)[];\n } & Partial<TagAttributes>;\n\n /**\n * 终点文字样式\n */\n endTextStyle?: {\n formatMethod?: (text: string | number) => (string | number) | (string | number)[];\n } & Partial<TagAttributes>;\n\n /**\n * 选中背景样式\n */\n selectedBackgroundStyle?: IRectGraphicAttribute;\n\n /**\n * 拖拽进行中的选中背景样式\n */\n dragMaskStyle?: IRectGraphicAttribute;\n\n /**\n * 背景图表样式\n */\n backgroundChartStyle?: {\n line?: {\n visible?: boolean;\n } & ILineGraphicAttribute;\n area?: {\n /**\n * @default true\n */\n visible?: boolean;\n curveType?: ICurveType;\n } & Omit<IAreaGraphicAttribute, 'curveType'>;\n };\n\n /**\n * 选中的背景图表样式\n */\n selectedBackgroundChartStyle?: {\n line?: {\n /**\n * @default true\n */\n visible?: boolean;\n } & ILineGraphicAttribute;\n area?: {\n /**\n * @default true\n */\n visible?: boolean;\n curveType?: ICurveType;\n } & Omit<IAreaGraphicAttribute, 'curveType'>;\n };\n\n /**\n * 是否显示startText和endText\n * @default 'auto' 鼠标hover在选中区域时才显示startText和endText\n */\n showDetail?: 'auto' | boolean;\n\n /**\n * 是否开启框选, 如果不开启则支持selectedBackground拖拽(框选和拖拽两者互斥)\n * @default true\n */\n brushSelect?: boolean;\n\n /**\n * 是否锁定选择区域(或叫做数据窗口)的大小\n */\n zoomLock?: boolean;\n\n /**\n * 用于限制窗口大小的最小值, [0, 1]\n * @default 0\n */\n minSpan?: number;\n\n /**\n * 用于限制窗口大小的最大值, [0, 1]\n * @default 1\n */\n maxSpan?: number;\n\n /**\n * 事件触发延迟类型\n * @default 'throttle'\n */\n delayType?: IDelayType;\n\n /**\n * 事件触发延迟时长\n * @default 0\n */\n delayTime?: number;\n /**\n * 是否在操作时动态更新视图\n * @default true\n */\n realTime?: boolean;\n\n /**\n * 绘制背景图表的数据 & 映射函数\n */\n previewData?: any[];\n previewPointsX?: (datum: any) => number;\n previewPointsY?: (datum: any) => number;\n previewPointsX1?: (datum: any) => number;\n previewPointsY1?: (datum: any) => number;\n updateStateCallback?: (start: number, end: number) => any;\n /**\n * 关闭交互效果\n * @default false\n */\n disableTriggerEvent?: boolean;\n}\n"]}
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.17.0-alpha.8";
1
+ export declare const version = "0.17.0";
2
2
  export * from './core/base';
3
3
  export * from './scrollbar';
4
4
  export * from './tag';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.17.0-alpha.8";
1
+ export const version = "0.17.0";
2
2
 
3
3
  export * from "./core/base";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.17.0-alpha.8\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.17.0\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\n"]}
@@ -21,5 +21,4 @@ export const DEFAULT_INDICATOR_THEME = {
21
21
  textAlign: "center"
22
22
  }
23
23
  }
24
- };
25
- //# sourceMappingURL=config.js.map
24
+ };
@@ -1,3 +1,4 @@
1
1
  export * from "./indicator";
2
2
 
3
- export * from "./type";
3
+ export * from "./type";
4
+ //# sourceMappingURL=index.js.map
@@ -6,12 +6,14 @@ import { measureTextSize } from "../util";
6
6
 
7
7
  import { DEFAULT_INDICATOR_THEME } from "./config";
8
8
 
9
+ import { DEFAULT_HTML_TEXT_SPEC } from "../constant";
10
+
9
11
  export class Indicator extends AbstractComponent {
10
12
  constructor() {
11
13
  super(...arguments), this.name = "indicator";
12
14
  }
13
15
  render() {
14
- var _a;
16
+ var _a, _b, _c;
15
17
  const {visible: visible, title: title, content: content, size: size, limitRatio: limitRatio = 1 / 0} = this.attribute, limit = Math.min(size.width, size.height) * limitRatio, group = this.createOrUpdateChild("indicator-container", {
16
18
  x: 0,
17
19
  y: 0,
@@ -20,7 +22,24 @@ export class Indicator extends AbstractComponent {
20
22
  if (!0 !== visible) return void (group && group.hideAll());
21
23
  if (isValid(title)) if (!1 !== title.visible) {
22
24
  const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, "title.style"), title.style);
23
- this._title = group.createOrUpdateChild("indicator-title", Object.assign(Object.assign({}, titleStyle), {
25
+ "rich" === titleStyle.type ? this._title = group.createOrUpdateChild("indicator-title", Object.assign(Object.assign({
26
+ textConfig: titleStyle.text
27
+ }, titleStyle), {
28
+ visible: title.visible,
29
+ x: 0,
30
+ y: 0,
31
+ width: null !== (_a = titleStyle.width) && void 0 !== _a ? _a : 0,
32
+ height: null !== (_b = titleStyle.height) && void 0 !== _b ? _b : 0
33
+ }), "richtext") : "html" === titleStyle.type ? this._title = group.createOrUpdateChild("indicator-title", Object.assign(Object.assign({
34
+ textConfig: [],
35
+ html: Object.assign(Object.assign({
36
+ dom: titleStyle.text
37
+ }, DEFAULT_HTML_TEXT_SPEC), titleStyle)
38
+ }, titleStyle), {
39
+ visible: title.visible,
40
+ x: 0,
41
+ y: 0
42
+ }), "richtext") : this._title = group.createOrUpdateChild("indicator-title", Object.assign(Object.assign({}, titleStyle), {
24
43
  lineHeight: isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize,
25
44
  visible: title.visible,
26
45
  x: 0,
@@ -36,14 +55,33 @@ export class Indicator extends AbstractComponent {
36
55
  const titleSpace = this._title && (null == title ? void 0 : title.space) ? title.space : 0, contents = array(content), contentComponents = [];
37
56
  let lastContentHeight = 0;
38
57
  contents.forEach(((contentItem, i) => {
58
+ var _a, _b;
39
59
  if (!1 !== contentItem.visible) {
40
- const contentStyle = merge({}, get(DEFAULT_INDICATOR_THEME, "content.style"), contentItem.style), contentComponent = group.createOrUpdateChild("indicator-content-" + i, Object.assign(Object.assign({}, contentStyle), {
60
+ const contentStyle = merge({}, get(DEFAULT_INDICATOR_THEME, "content.style"), contentItem.style);
61
+ let contentComponent;
62
+ contentComponent = "rich" === contentStyle.type ? group.createOrUpdateChild("indicator-content-" + i, Object.assign(Object.assign({
63
+ textConfig: contentStyle.text
64
+ }, contentStyle), {
65
+ visible: title.visible,
66
+ x: 0,
67
+ y: titleHeight + titleSpace + lastContentHeight,
68
+ width: null !== (_a = contentStyle.width) && void 0 !== _a ? _a : 0,
69
+ height: null !== (_b = contentStyle.height) && void 0 !== _b ? _b : 0
70
+ }), "richtext") : "html" === contentStyle.type ? group.createOrUpdateChild("indicator-content-" + i, Object.assign(Object.assign({
71
+ textConfig: [],
72
+ html: Object.assign(Object.assign({
73
+ dom: contentStyle.text
74
+ }, DEFAULT_HTML_TEXT_SPEC), contentStyle)
75
+ }, contentStyle), {
76
+ visible: title.visible,
77
+ x: 0,
78
+ y: titleHeight + titleSpace + lastContentHeight
79
+ }), "richtext") : group.createOrUpdateChild("indicator-content-" + i, Object.assign(Object.assign({}, contentStyle), {
41
80
  lineHeight: isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize,
42
81
  visible: contentItem.visible,
43
82
  x: 0,
44
83
  y: titleHeight + titleSpace + lastContentHeight
45
- }), "text");
46
- contentItem.autoFit && isValidNumber(limit) && this._setAutoFit(limit, contentComponent, contentItem),
84
+ }), "text"), contentItem.autoFit && isValidNumber(limit) && this._setAutoFit(limit, contentComponent, contentItem),
47
85
  contentItem.autoLimit && isValidNumber(limitRatio) && contentComponent.setAttribute("maxLineWidth", limit),
48
86
  contentComponents.push(contentComponent);
49
87
  const contentSpace = (null == contentItem ? void 0 : contentItem.space) ? contentItem.space : 0;
@@ -54,7 +92,7 @@ export class Indicator extends AbstractComponent {
54
92
  }
55
93
  })), this._content = contentComponents;
56
94
  }
57
- const totalHeight = null !== (_a = null == group ? void 0 : group.AABBBounds.height()) && void 0 !== _a ? _a : 0;
95
+ const totalHeight = null !== (_c = null == group ? void 0 : group.AABBBounds.height()) && void 0 !== _c ? _c : 0;
58
96
  group.setAttribute("y", size.height / 2 - totalHeight / 2), group.setAttribute("x", size.width / 2);
59
97
  }
60
98
  _setAutoFit(limit, indicatorItem, indicatorItemSpec) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/indicator/indicator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,MAAM,OAAO,SAAU,SAAQ,iBAAgD;IAA/E;;QACE,SAAI,GAAG,WAAW,CAAC;IA0HrB,CAAC;IArHW,MAAM;;QACd,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAgC,CAAC;QAEvG,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC;QAE7D,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,qBAAqB,EAAE,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A,MAAA,iBAAiB,CAAC,KAAK,0CAAE,IAAI,mCAAI,EAAE,EAAE,MAAA,iBAAiB,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,KAAK,CAAC;QAC9G,IAAI,WAAW,GAAG,CAAC,EAAE;YACnB,MAAM,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,MAAA,iBAAiB,CAAC,UAAU,mCAAI,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC;YAC5E,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,MAAA,MAAA,iBAAiB,CAAC,KAAK,0CAAE,QAAQ,mCAAI,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;YAC/E,aAAa,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YACjD,aAAa,CAAC,YAAY,CACxB,YAAY,EACZ,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAC5F,CAAC;SACH;IACH,CAAC;CACF","file":"indicator.js","sourcesContent":["/**\n * @description 指标卡组件\n */\nimport type { IGroup, INode, IText } from '@visactor/vrender-core';\nimport { merge, isValid, array, isValidNumber, get } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { measureTextSize } from '../util';\nimport type { IndicatorAttributes, IndicatorItemSpec } from './type';\nimport { DEFAULT_INDICATOR_THEME } from './config';\n\nexport class Indicator extends AbstractComponent<Required<IndicatorAttributes>> {\n name = 'indicator';\n\n private _title?: IText;\n private _content?: IText | IText[];\n\n protected render() {\n const { visible, title, content, size, limitRatio = Infinity } = this.attribute as IndicatorAttributes;\n\n const limit = Math.min(size.width, size.height) * limitRatio;\n\n const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n // 指标卡全部隐藏\n if (visible !== true) {\n group && group.hideAll();\n return;\n }\n\n if (isValid(title)) {\n if (title.visible !== false) {\n const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n ...titleStyle,\n /**\n * 加入以下逻辑:如果没有声明lineHeight,默认 lineHeight 等于 fontSize\n * 因为如果不声明 vrender 底层会默认给文本加上 2px 的高度,会影响布局计算\n * 注意:在autoFit改变fontsize时,lineHeight也要同步修改\n */\n lineHeight: isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize,\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'text'\n ) as IText;\n\n // auto-fit\n if (title.autoFit && isValidNumber(limit)) {\n this._setAutoFit(limit, this._title, title);\n }\n\n //auto-limit\n if (title.autoLimit && isValidNumber(limitRatio)) {\n this._title.setAttribute('maxLineWidth', limit);\n }\n } else {\n /**\n * indicator部分隐藏\n * 例如title隐藏了,content还保留。直接设置visible:false 计算group.AABBounts是错的,影响上下居中。\n * 这里把隐藏的nodes删除后,group.AABBounts计算才正确。\n */\n const titleNode = group.find(node => node.name === 'indicator-title', false);\n titleNode && group.removeChild(titleNode as INode);\n this._title = undefined;\n }\n }\n\n const titleHeight = this._title ? this._title.AABBBounds.height() : 0;\n\n if (isValid(content)) {\n const titleSpace = this._title ? (title?.space ? title.space : 0) : 0;\n const contents: IndicatorItemSpec[] = array(content);\n const contentComponents: IText[] = [];\n let lastContentHeight = 0;\n contents.forEach((contentItem, i) => {\n if (contentItem.visible !== false) {\n const contentStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);\n const contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n ...contentStyle,\n lineHeight: isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize,\n visible: contentItem.visible,\n x: 0,\n y: titleHeight + titleSpace + lastContentHeight\n },\n 'text'\n ) as IText;\n\n // auto-fit\n if (contentItem.autoFit && isValidNumber(limit)) {\n this._setAutoFit(limit, contentComponent, contentItem);\n }\n\n //auto-limit\n if (contentItem.autoLimit && isValidNumber(limitRatio)) {\n contentComponent.setAttribute('maxLineWidth', limit);\n }\n\n contentComponents.push(contentComponent);\n const contentSpace = contentItem?.space ? contentItem.space : 0;\n lastContentHeight += contentComponent.AABBBounds.height() + contentSpace;\n } else {\n /**\n * indicator部分隐藏\n */\n const contentItemNode = group.find(node => node.name === 'indicator-content-' + i, false);\n contentItemNode && group.removeChild(contentItemNode as INode);\n }\n });\n this._content = contentComponents;\n }\n\n const totalHeight = group?.AABBBounds.height() ?? 0;\n group.setAttribute('y', size.height / 2 - totalHeight / 2);\n group.setAttribute('x', size.width / 2);\n }\n\n private _setAutoFit(limit: number, indicatorItem: IText, indicatorItemSpec: IndicatorItemSpec) {\n const originWidth = measureTextSize(indicatorItemSpec.style?.text ?? '', indicatorItemSpec.style ?? {}).width;\n if (originWidth > 0) {\n const ratio = (limit * (indicatorItemSpec.fitPercent ?? 0.5)) / originWidth;\n const fontSize = Math.floor((indicatorItemSpec.style?.fontSize ?? 20) * ratio);\n indicatorItem.setAttribute('fontSize', fontSize);\n indicatorItem.setAttribute(\n 'lineHeight',\n isValid(indicatorItemSpec.style.lineHeight) ? indicatorItemSpec.style.lineHeight : fontSize\n );\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/indicator/indicator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,OAAO,SAAU,SAAQ,iBAAgD;IAA/E;;QACE,SAAI,GAAG,WAAW,CAAC;IAgMrB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AAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAC5F,CAAC;SACH;IACH,CAAC;CACF","file":"indicator.js","sourcesContent":["/**\n * @description 指标卡组件\n */\nimport type { IGroup, INode, IText, ITextGraphicAttribute } from '@visactor/vrender-core';\nimport { merge, isValid, array, isValidNumber, get } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport { measureTextSize } from '../util';\nimport type { IndicatorAttributes, IndicatorItemSpec } from './type';\nimport { DEFAULT_INDICATOR_THEME } from './config';\nimport { DEFAULT_HTML_TEXT_SPEC } from '../constant';\n\nexport class Indicator extends AbstractComponent<Required<IndicatorAttributes>> {\n name = 'indicator';\n\n private _title?: IText;\n private _content?: IText | IText[];\n\n protected render() {\n const { visible, title, content, size, limitRatio = Infinity } = this.attribute as IndicatorAttributes;\n\n const limit = Math.min(size.width, size.height) * limitRatio;\n\n const group = this.createOrUpdateChild('indicator-container', { x: 0, y: 0, zIndex: 1 }, 'group') as IGroup;\n\n // 指标卡全部隐藏\n if (visible !== true) {\n group && group.hideAll();\n return;\n }\n\n if (isValid(title)) {\n if (title.visible !== false) {\n const titleStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'title.style'), title.style);\n if (titleStyle.type === 'rich') {\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n textConfig: titleStyle.text,\n ...titleStyle,\n visible: title.visible,\n x: 0,\n y: 0,\n width: titleStyle.width ?? 0,\n height: titleStyle.height ?? 0\n },\n 'richtext'\n ) as IText;\n } else if (titleStyle.type === 'html') {\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n textConfig: [],\n html: {\n dom: titleStyle.text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...titleStyle\n },\n ...titleStyle,\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'richtext'\n ) as IText;\n } else {\n this._title = group.createOrUpdateChild(\n 'indicator-title',\n {\n ...titleStyle,\n /**\n * 加入以下逻辑:如果没有声明lineHeight,默认 lineHeight 等于 fontSize\n * 因为如果不声明 vrender 底层会默认给文本加上 2px 的高度,会影响布局计算\n * 注意:在autoFit改变fontsize时,lineHeight也要同步修改\n */\n lineHeight: isValid(titleStyle.lineHeight) ? titleStyle.lineHeight : titleStyle.fontSize,\n visible: title.visible,\n x: 0,\n y: 0\n },\n 'text'\n ) as IText;\n }\n\n // auto-fit\n if (title.autoFit && isValidNumber(limit)) {\n this._setAutoFit(limit, this._title, title);\n }\n\n //auto-limit\n if (title.autoLimit && isValidNumber(limitRatio)) {\n this._title.setAttribute('maxLineWidth', limit);\n }\n } else {\n /**\n * indicator部分隐藏\n * 例如title隐藏了,content还保留。直接设置visible:false 计算group.AABBounts是错的,影响上下居中。\n * 这里把隐藏的nodes删除后,group.AABBounts计算才正确。\n */\n const titleNode = group.find(node => node.name === 'indicator-title', false);\n titleNode && group.removeChild(titleNode as INode);\n this._title = undefined;\n }\n }\n\n const titleHeight = this._title ? this._title.AABBBounds.height() : 0;\n\n if (isValid(content)) {\n const titleSpace = this._title ? (title?.space ? title.space : 0) : 0;\n const contents: IndicatorItemSpec[] = array(content);\n const contentComponents: IText[] = [];\n let lastContentHeight = 0;\n contents.forEach((contentItem, i) => {\n if (contentItem.visible !== false) {\n const contentStyle = merge({}, get(DEFAULT_INDICATOR_THEME, 'content.style'), contentItem.style);\n let contentComponent;\n if (contentStyle.type === 'rich') {\n contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n textConfig: contentStyle.text,\n ...contentStyle,\n visible: title.visible,\n x: 0,\n y: titleHeight + titleSpace + lastContentHeight,\n width: contentStyle.width ?? 0,\n height: contentStyle.height ?? 0\n },\n 'richtext'\n ) as IText;\n } else if (contentStyle.type === 'html') {\n contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n textConfig: [],\n html: {\n dom: contentStyle.text as string,\n ...DEFAULT_HTML_TEXT_SPEC,\n ...contentStyle\n },\n ...contentStyle,\n visible: title.visible,\n x: 0,\n y: titleHeight + titleSpace + lastContentHeight\n },\n 'richtext'\n ) as IText;\n } else {\n contentComponent = group.createOrUpdateChild(\n 'indicator-content-' + i,\n {\n ...contentStyle,\n lineHeight: isValid(contentStyle.lineHeight) ? contentStyle.lineHeight : contentStyle.fontSize,\n visible: contentItem.visible,\n x: 0,\n y: titleHeight + titleSpace + lastContentHeight\n },\n 'text'\n ) as IText;\n }\n\n // auto-fit\n if (contentItem.autoFit && isValidNumber(limit)) {\n this._setAutoFit(limit, contentComponent, contentItem);\n }\n\n //auto-limit\n if (contentItem.autoLimit && isValidNumber(limitRatio)) {\n contentComponent.setAttribute('maxLineWidth', limit);\n }\n\n contentComponents.push(contentComponent);\n const contentSpace = contentItem?.space ? contentItem.space : 0;\n lastContentHeight += contentComponent.AABBBounds.height() + contentSpace;\n } else {\n /**\n * indicator部分隐藏\n */\n const contentItemNode = group.find(node => node.name === 'indicator-content-' + i, false);\n contentItemNode && group.removeChild(contentItemNode as INode);\n }\n });\n this._content = contentComponents;\n }\n\n const totalHeight = group?.AABBBounds.height() ?? 0;\n group.setAttribute('y', size.height / 2 - totalHeight / 2);\n group.setAttribute('x', size.width / 2);\n }\n\n private _setAutoFit(limit: number, indicatorItem: IText, indicatorItemSpec: IndicatorItemSpec) {\n const originWidth = measureTextSize(\n (indicatorItemSpec.style?.text ?? '') as string | number | number[] | string[],\n (indicatorItemSpec.style ?? {}) as Partial<ITextGraphicAttribute>\n ).width;\n if (originWidth > 0) {\n const ratio = (limit * (indicatorItemSpec.fitPercent ?? 0.5)) / originWidth;\n const fontSize = Math.floor((indicatorItemSpec.style?.fontSize ?? 20) * ratio);\n indicatorItem.setAttribute('fontSize', fontSize);\n indicatorItem.setAttribute(\n 'lineHeight',\n isValid(indicatorItemSpec.style.lineHeight) ? indicatorItemSpec.style.lineHeight : fontSize\n );\n }\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { IGroupGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';
2
+ import type { TextContent } from '../core/type';
2
3
  export interface IndicatorAttributes extends IGroupGraphicAttribute {
3
4
  visible?: boolean;
4
5
  size: {
@@ -17,5 +18,5 @@ export interface IndicatorItemSpec {
17
18
  autoLimit?: boolean;
18
19
  autoFit?: boolean;
19
20
  fitPercent?: number;
20
- style?: ITextGraphicAttribute;
21
+ style?: Omit<ITextGraphicAttribute, 'text'> & TextContent;
21
22
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/indicator/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IGroupGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender-core';\n\nexport interface IndicatorAttributes extends IGroupGraphicAttribute {\n /**\n * 是否显示指标卡组件\n * @default true\n */\n visible?: boolean;\n /**\n * 内容尺寸\n */\n size: { width: number; height: number };\n /**\n * 指标卡 x 方向偏移\n * @default 0\n */\n dx?: number;\n /**\n * 指标卡 y 方向偏移\n * @default 0\n */\n dy?: number;\n /**\n * 指标卡宽度占内容区域的最大比值(从0到1)\n */\n limitRatio?: number;\n /**\n * 指标卡标题文字配置\n */\n title?: IndicatorItemSpec;\n /**\n * 指标卡内容文字配置\n */\n content?: IndicatorItemSpec[] | IndicatorItemSpec;\n}\n\nexport interface IndicatorItemSpec {\n /**\n * 是否显示当前项\n * @default true\n */\n visible?: boolean;\n /**\n * title.space: title 和 content 之间的间距\n * contentItem.space: content 之间的间距\n */\n space?: number;\n /**\n * 是否自适应文字空间进行缩略\n * 按照原字体大小,根据空间大小缩略文字\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 是否自适应文字空间缩放文字大小\n * 不缩略文字,改变字体大小以适应空间\n * @default false\n */\n autoFit?: boolean;\n /**\n * 自适应文字宽度与可用空间的比例\n * @default 0.5\n */\n fitPercent?: number;\n /**\n * 文字样式\n */\n style?: ITextGraphicAttribute;\n}\n"]}
1
+ {"version":3,"sources":["../src/indicator/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { IGroupGraphicAttribute, ITextGraphicAttribute, IRichTextCharacter } from '@visactor/vrender-core';\nimport type { TextContent } from '../core/type';\n\nexport interface IndicatorAttributes extends IGroupGraphicAttribute {\n /**\n * 是否显示指标卡组件\n * @default true\n */\n visible?: boolean;\n /**\n * 内容尺寸\n */\n size: { width: number; height: number };\n /**\n * 指标卡 x 方向偏移\n * @default 0\n */\n dx?: number;\n /**\n * 指标卡 y 方向偏移\n * @default 0\n */\n dy?: number;\n /**\n * 指标卡宽度占内容区域的最大比值(从0到1)\n */\n limitRatio?: number;\n /**\n * 指标卡标题文字配置\n */\n title?: IndicatorItemSpec;\n /**\n * 指标卡内容文字配置\n */\n content?: IndicatorItemSpec[] | IndicatorItemSpec;\n}\n\nexport interface IndicatorItemSpec {\n /**\n * 是否显示当前项\n * @default true\n */\n visible?: boolean;\n /**\n * title.space: title 和 content 之间的间距\n * contentItem.space: content 之间的间距\n */\n space?: number;\n /**\n * 是否自适应文字空间进行缩略\n * 按照原字体大小,根据空间大小缩略文字\n * @default false\n */\n autoLimit?: boolean;\n /**\n * 是否自适应文字空间缩放文字大小\n * 不缩略文字,改变字体大小以适应空间\n * @default false\n */\n autoFit?: boolean;\n /**\n * 自适应文字宽度与可用空间的比例\n * @default 0.5\n */\n fitPercent?: number;\n /**\n * 文字样式\n */\n style?: Omit<ITextGraphicAttribute, 'text'> & TextContent;\n}\n"]}
package/es/interface.d.ts CHANGED
@@ -4,3 +4,8 @@ export type OrientType = 'top' | 'right' | 'bottom' | 'left';
4
4
  export type BackgroundAttributes = {
5
5
  visible: boolean;
6
6
  } & Partial<IRectGraphicAttribute>;
7
+ export type IDelayType = 'debounce' | 'throttle';
8
+ export interface ComponentOptions {
9
+ skipDefault?: boolean;
10
+ mode?: '2d' | '3d';
11
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IRectGraphicAttribute } from '@visactor/vrender-core';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type OrientType = 'top' | 'right' | 'bottom' | 'left';\n\nexport type BackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n} & Partial<IRectGraphicAttribute>;\n"]}
1
+ {"version":3,"sources":["../src/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IRectGraphicAttribute } from '@visactor/vrender-core';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type OrientType = 'top' | 'right' | 'bottom' | 'left';\n\nexport type BackgroundAttributes = {\n /**\n * 是否绘制背景层\n */\n visible: boolean;\n} & Partial<IRectGraphicAttribute>;\n\nexport type IDelayType = 'debounce' | 'throttle';\n\nexport interface ComponentOptions {\n /** skip default attributes of component */\n skipDefault?: boolean;\n /** the mode of component, only axis support 3d mode now */\n mode?: '2d' | '3d';\n}\n"]}
@@ -1,7 +1,13 @@
1
- import type { ITextGraphicAttribute } from '@visactor/vrender-core';
2
- import type { ILabelAnimation } from '../type';
1
+ import type { IText, ITextGraphicAttribute, EasingType } from '@visactor/vrender-core';
2
+ import type { BaseLabelAttrs, ILabelAnimation, ILabelUpdateChannelAnimation } from '../type';
3
3
  export declare function getAnimationAttributes(textAttribute: ITextGraphicAttribute, type: 'fadeIn' | 'fadeOut'): {
4
4
  from: any;
5
5
  to: any;
6
6
  };
7
+ export declare function updateAnimation(prev: IText, next: IText, animationConfig: BaseLabelAttrs['animationUpdate']): void;
8
+ export declare const update: (prev: IText, next: IText, channel?: string[], options?: ILabelUpdateChannelAnimation['options']) => {
9
+ from: Partial<ITextGraphicAttribute>;
10
+ to: Partial<ITextGraphicAttribute>;
11
+ };
12
+ export declare function playIncreaseCount(prev: IText, next: IText, duration: number, easing: EasingType): void;
7
13
  export declare const DefaultLabelAnimation: ILabelAnimation;
@@ -1,3 +1,7 @@
1
+ import { IncreaseCount } from "@visactor/vrender-core";
2
+
3
+ import { array, isArray, isEmpty, isValidNumber } from "@visactor/vutils";
4
+
1
5
  const fadeIn = (textAttribute = {}) => {
2
6
  var _a, _b, _c;
3
7
  return {
@@ -39,6 +43,37 @@ export function getAnimationAttributes(textAttribute, type) {
39
43
  };
40
44
  }
41
45
 
46
+ export function updateAnimation(prev, next, animationConfig) {
47
+ if (!isArray(animationConfig)) {
48
+ const {duration: duration, easing: easing, increaseEffect: increaseEffect = !0} = animationConfig;
49
+ return prev.animate().to(next.attribute, duration, easing), void (increaseEffect && playIncreaseCount(prev, next, duration, easing));
50
+ }
51
+ animationConfig.forEach(((cfg, i) => {
52
+ const {duration: duration, easing: easing, increaseEffect: increaseEffect = !0, channel: channel} = cfg, {from: from, to: to} = update(prev, next, channel, cfg.options);
53
+ isEmpty(to) || prev.animate().to(to, duration, easing), "text" in from && "text" in to && increaseEffect && playIncreaseCount(prev, next, duration, easing);
54
+ }));
55
+ }
56
+
57
+ export const update = (prev, next, channel, options) => {
58
+ const from = Object.assign({}, prev.attribute), to = Object.assign({}, next.attribute);
59
+ return array(null == options ? void 0 : options.excludeChannels).forEach((key => {
60
+ delete to[key];
61
+ })), Object.keys(to).forEach((key => {
62
+ channel && !channel.includes(key) && delete to[key];
63
+ })), {
64
+ from: from,
65
+ to: to
66
+ };
67
+ };
68
+
69
+ export function playIncreaseCount(prev, next, duration, easing) {
70
+ prev.attribute.text !== next.attribute.text && isValidNumber(Number(prev.attribute.text) * Number(next.attribute.text)) && prev.animate().play(new IncreaseCount({
71
+ text: prev.attribute.text
72
+ }, {
73
+ text: next.attribute.text
74
+ }, duration, easing));
75
+ }
76
+
42
77
  export const DefaultLabelAnimation = {
43
78
  mode: "same-time",
44
79
  duration: 300,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/label/animate/animate.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,GAAG,CAAC,gBAAuC,EAAE,EAAE,EAAE;;IAC3D,OAAO;QACL,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;SACjB;QACD,EAAE,EAAE;YACF,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,CAAC;YACnC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,CAAC;YAC3C,aAAa,EAAE,MAAA,aAAa,CAAC,aAAa,mCAAI,CAAC;SAChD;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,gBAAuC,EAAE,EAAE,EAAE;;IAC5D,OAAO;QACL,IAAI,EAAE;YACJ,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,CAAC;YACnC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,CAAC;YAC3C,aAAa,EAAE,MAAA,aAAa,CAAC,aAAa,mCAAI,CAAC;SAChD;QACD,EAAE,EAAE;YACF,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;SACjB;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAE7C,MAAM,UAAU,sBAAsB,CACpC,aAAoC,EACpC,IAA0B;;IAK1B,OAAO,MAAA,MAAA,gBAAgB,CAAC,IAAI,CAAC,iEAAG,aAAa,CAAC,mCAAI,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAoB;IACpD,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAsB;CAC/B,CAAC","file":"animate.js","sourcesContent":["import type { EasingType, ITextGraphicAttribute } from '@visactor/vrender-core';\nimport type { ILabelAnimation } from '../type';\n\nconst fadeIn = (textAttribute: ITextGraphicAttribute = {}) => {\n return {\n from: {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n },\n to: {\n opacity: textAttribute.opacity ?? 1,\n fillOpacity: textAttribute.fillOpacity ?? 1,\n strokeOpacity: textAttribute.strokeOpacity ?? 1\n }\n };\n};\n\nconst fadeOut = (textAttribute: ITextGraphicAttribute = {}) => {\n return {\n from: {\n opacity: textAttribute.opacity ?? 1,\n fillOpacity: textAttribute.fillOpacity ?? 1,\n strokeOpacity: textAttribute.strokeOpacity ?? 1\n },\n to: {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n }\n };\n};\n\nconst animationEffects = { fadeIn, fadeOut };\n\nexport function getAnimationAttributes(\n textAttribute: ITextGraphicAttribute,\n type: 'fadeIn' | 'fadeOut'\n): {\n from: any;\n to: any;\n} {\n return animationEffects[type]?.(textAttribute) ?? { from: {}, to: {} };\n}\n\nexport const DefaultLabelAnimation: ILabelAnimation = {\n mode: 'same-time',\n duration: 300,\n easing: 'linear' as EasingType\n};\n"]}
1
+ {"version":3,"sources":["../src/label/animate/animate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE1E,MAAM,MAAM,GAAG,CAAC,gBAAuC,EAAE,EAAE,EAAE;;IAC3D,OAAO;QACL,IAAI,EAAE;YACJ,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;SACjB;QACD,EAAE,EAAE;YACF,OAAO,EAAE,MAAA,aAAa,CAAC,OAAO,mCAAI,CAAC;YACnC,WAAW,EAAE,MAAA,aAAa,CAAC,WAAW,mCAAI,CAAC;YAC3C,aAAa,EAAE,MAAA,aAAa,CAAC,aAAa,mCAAI,CAAC;SAChD;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,gBAAuC,EAAE,EAAE,EAAE;;IAC5D,OAAO;QACL,IAAI,EAAE;YACJ,OAAO,EAAE,MAAA,aAAa,CAAC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AAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EACxE;QACA,IAAI;aACD,OAAO,EAAE;aACT,IAAI,CACH,IAAI,aAAa,CACf,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAc,EAAE,EACvC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAc,EAAE,EACvC,QAAQ,EACR,MAAM,CACP,CACF,CAAC;KACL;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAoB;IACpD,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,QAAsB;CAC/B,CAAC","file":"animate.js","sourcesContent":["import type { IText, ITextGraphicAttribute, EasingType } from '@visactor/vrender-core';\nimport { IncreaseCount } from '@visactor/vrender-core';\nimport type { BaseLabelAttrs, ILabelAnimation, ILabelUpdateChannelAnimation } from '../type';\nimport { array, isArray, isEmpty, isValidNumber } from '@visactor/vutils';\n\nconst fadeIn = (textAttribute: ITextGraphicAttribute = {}) => {\n return {\n from: {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n },\n to: {\n opacity: textAttribute.opacity ?? 1,\n fillOpacity: textAttribute.fillOpacity ?? 1,\n strokeOpacity: textAttribute.strokeOpacity ?? 1\n }\n };\n};\n\nconst fadeOut = (textAttribute: ITextGraphicAttribute = {}) => {\n return {\n from: {\n opacity: textAttribute.opacity ?? 1,\n fillOpacity: textAttribute.fillOpacity ?? 1,\n strokeOpacity: textAttribute.strokeOpacity ?? 1\n },\n to: {\n opacity: 0,\n fillOpacity: 0,\n strokeOpacity: 0\n }\n };\n};\n\nconst animationEffects = { fadeIn, fadeOut };\n\nexport function getAnimationAttributes(\n textAttribute: ITextGraphicAttribute,\n type: 'fadeIn' | 'fadeOut'\n): {\n from: any;\n to: any;\n} {\n return animationEffects[type]?.(textAttribute) ?? { from: {}, to: {} };\n}\n\nexport function updateAnimation(prev: IText, next: IText, animationConfig: BaseLabelAttrs['animationUpdate']) {\n if (!isArray(animationConfig)) {\n const { duration, easing, increaseEffect = true } = animationConfig;\n prev.animate().to(next.attribute, duration, easing);\n increaseEffect && playIncreaseCount(prev, next, duration, easing);\n return;\n }\n\n animationConfig.forEach((cfg, i) => {\n const { duration, easing, increaseEffect = true, channel } = cfg;\n const { from, to } = update(prev, next, channel, cfg.options);\n if (!isEmpty(to)) {\n prev.animate().to(to, duration, easing);\n }\n\n if ('text' in from && 'text' in to && increaseEffect) {\n playIncreaseCount(prev, next, duration, easing);\n }\n });\n}\n\nexport const update = (\n prev: IText,\n next: IText,\n channel?: string[],\n options?: ILabelUpdateChannelAnimation['options']\n) => {\n const from = Object.assign({}, prev.attribute);\n const to = Object.assign({}, next.attribute);\n array(options?.excludeChannels).forEach(key => {\n delete to[key];\n });\n Object.keys(to).forEach(key => {\n if (channel && !channel.includes(key)) {\n delete to[key];\n }\n });\n return { from, to };\n};\n\nexport function playIncreaseCount(prev: IText, next: IText, duration: number, easing: EasingType) {\n if (\n prev.attribute.text !== next.attribute.text &&\n isValidNumber(Number(prev.attribute.text) * Number(next.attribute.text))\n ) {\n prev\n .animate()\n .play(\n new IncreaseCount(\n { text: prev.attribute.text as string },\n { text: next.attribute.text as string },\n duration,\n easing\n )\n );\n }\n}\n\nexport const DefaultLabelAnimation: ILabelAnimation = {\n mode: 'same-time',\n duration: 300,\n easing: 'linear' as EasingType\n};\n"]}
package/es/label/arc.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { IAABBBounds, IBoundsLike } from '@visactor/vutils';
2
2
  import { LabelBase } from './base';
3
3
  import type { ArcLabelAttrs, IPoint, Quadrant, BaseLabelAttrs, LabelItem, IArcLabelLineSpec } from './type';
4
+ import type { IRichText } from '@visactor/vrender-core';
4
5
  import { type IText, type IGraphic, type ILine } from '@visactor/vrender-core';
6
+ import type { ComponentOptions } from '../interface';
5
7
  export declare class ArcInfo {
6
8
  key: string;
7
9
  refDatum: any;
@@ -38,18 +40,17 @@ export declare class ArcLabel extends LabelBase<ArcLabelAttrs> {
38
40
  private _ellipsisWidth;
39
41
  private _arcLeft;
40
42
  private _arcRight;
41
- constructor(attributes: ArcLabelAttrs);
42
- protected _overlapping(labels: IText[]): IText[];
43
+ constructor(attributes: ArcLabelAttrs, options?: ComponentOptions);
44
+ protected _overlapping(labels: (IText | IRichText)[]): (IRichText | IText)[];
43
45
  protected labeling(textBounds: IBoundsLike, graphicBounds: IBoundsLike, position?: string, offset?: number): {
44
46
  x: number;
45
47
  y: number;
46
48
  } | undefined;
47
- protected _layout(data?: LabelItem[]): IText[];
48
- protected layoutArcLabels(position: BaseLabelAttrs['position'], attribute: any, currentMarks?: IGraphic[], data?: any, textBoundsArray?: any, ellipsisWidth?: number): ArcInfo[];
49
+ protected _layout(data?: LabelItem[]): (IRichText | IText)[];
50
+ protected layoutArcLabels(position: BaseLabelAttrs['position'], attribute: any, currentMarks?: IGraphic[], data?: LabelItem[], textBoundsArray?: any, ellipsisWidth?: number): ArcInfo[];
49
51
  private _layoutInsideLabels;
50
52
  private _layoutOutsideLabels;
51
53
  private _computeX;
52
- private _computeAlignOffset;
53
54
  private _computeAlign;
54
55
  private _getFormatLabelText;
55
56
  private _adjustY;
@@ -64,7 +65,7 @@ export declare class ArcLabel extends LabelBase<ArcLabelAttrs> {
64
65
  private _restoreY;
65
66
  private _checkYRange;
66
67
  private _coverLabels;
67
- protected _labelLine(text: IText): ILine;
68
+ protected _labelLine(text: LabelItem): ILine;
68
69
  protected computeRadius(r: number, width?: number, height?: number, k?: number): number;
69
70
  protected computeLayoutRadius(width: number, height: number): number;
70
71
  protected _canPlaceInside(textBound: IBoundsLike, shapeBound: IAABBBounds): boolean;
package/es/label/arc.js CHANGED
@@ -29,9 +29,9 @@ export class ArcInfo {
29
29
  }
30
30
 
31
31
  export class ArcLabel extends LabelBase {
32
- constructor(attributes) {
33
- super(merge({}, ArcLabel.defaultAttributes, attributes)), this.name = "arc-label",
34
- this._ellipsisWidth = 0, this._arcLeft = new Map, this._arcRight = new Map;
32
+ constructor(attributes, options) {
33
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, ArcLabel.defaultAttributes, attributes)),
34
+ this.name = "arc-label", this._ellipsisWidth = 0, this._arcLeft = new Map, this._arcRight = new Map;
35
35
  }
36
36
  _overlapping(labels) {
37
37
  return labels;
@@ -68,9 +68,9 @@ export class ArcLabel extends LabelBase {
68
68
  let maxRadius = 0;
69
69
  currentMarks.forEach((currentMarks => {
70
70
  currentMarks.attribute.outerRadius > maxRadius && (maxRadius = currentMarks.attribute.outerRadius);
71
- })), currentMarks.forEach(((currentMark, index) => {
71
+ })), data.forEach(((d, index) => {
72
72
  var _a, _b;
73
- const graphicAttribute = currentMark.attribute, center = {
73
+ const graphicAttribute = this._idToGraphic.get(d.id).attribute, center = {
74
74
  x: null !== (_a = null == graphicAttribute ? void 0 : graphicAttribute.x) && void 0 !== _a ? _a : 0,
75
75
  y: null !== (_b = null == graphicAttribute ? void 0 : graphicAttribute.y) && void 0 !== _b ? _b : 0
76
76
  };
@@ -217,18 +217,6 @@ export class ArcLabel extends LabelBase {
217
217
  labelPosition.x = cx + alignOffset + flag * (spaceWidth + targetCenterOffset);
218
218
  }
219
219
  }
220
- _computeAlignOffset(align, labelWidth, alignFlag) {
221
- switch (align) {
222
- case "left":
223
- return alignFlag < 0 ? -labelWidth : 0;
224
-
225
- case "right":
226
- return alignFlag < 0 ? 0 : labelWidth;
227
-
228
- default:
229
- return labelWidth / 2 * alignFlag;
230
- }
231
- }
232
220
  _computeAlign(arc, attribute) {
233
221
  var _a, _b, _c, _d, _e, _f;
234
222
  const labelConfig = attribute, textAlign = null !== (_b = null === (_a = labelConfig.textStyle) || void 0 === _a ? void 0 : _a.textAlign) && void 0 !== _b ? _b : null === (_c = labelConfig.textStyle) || void 0 === _c ? void 0 : _c.align, layoutAlign = null !== (_e = null === (_d = labelConfig.layout) || void 0 === _d ? void 0 : _d.textAlign) && void 0 !== _e ? _e : null === (_f = labelConfig.layout) || void 0 === _f ? void 0 : _f.align;