@visactor/vrender-components 1.1.0-alpha.8 → 1.1.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 (283) hide show
  1. package/README.md +9 -1
  2. package/cjs/animation/axis-animate.d.ts +2 -1
  3. package/cjs/animation/axis-animate.js +11 -8
  4. package/cjs/animation/axis-animate.js.map +1 -1
  5. package/cjs/animation/exit-release.d.ts +13 -0
  6. package/cjs/animation/exit-release.js +39 -0
  7. package/cjs/animation/exit-release.js.map +1 -0
  8. package/cjs/animation/label-animate.d.ts +1 -1
  9. package/cjs/animation/label-animate.js +10 -20
  10. package/cjs/animation/label-animate.js.map +1 -1
  11. package/cjs/animation/static-truth.js +1 -5
  12. package/cjs/animation/static-truth.js.map +1 -1
  13. package/cjs/axis/animate/group-transition.d.ts +3 -2
  14. package/cjs/axis/animate/group-transition.js +3 -3
  15. package/cjs/axis/animate/group-transition.js.map +1 -1
  16. package/cjs/axis/base.d.ts +6 -2
  17. package/cjs/axis/base.js +61 -7
  18. package/cjs/axis/base.js.map +1 -1
  19. package/cjs/axis/constant.js +1 -2
  20. package/cjs/axis/index.js +2 -1
  21. package/cjs/axis/line.d.ts +1 -1
  22. package/cjs/axis/line.js +2 -2
  23. package/cjs/axis/line.js.map +1 -1
  24. package/cjs/axis/overlap/auto-hide.d.ts +1 -1
  25. package/cjs/axis/overlap/auto-hide.js.map +1 -1
  26. package/cjs/axis/register.js +8 -7
  27. package/cjs/axis/register.js.map +1 -1
  28. package/cjs/brush/brush.d.ts +4 -0
  29. package/cjs/brush/brush.js +30 -13
  30. package/cjs/brush/brush.js.map +1 -1
  31. package/cjs/brush/register.js +2 -2
  32. package/cjs/brush/register.js.map +1 -1
  33. package/cjs/checkbox/register.js +3 -3
  34. package/cjs/checkbox/register.js.map +1 -1
  35. package/cjs/core/base.d.ts +2 -2
  36. package/cjs/core/base.js +3 -3
  37. package/cjs/core/base.js.map +1 -1
  38. package/cjs/core/type.d.ts +7 -0
  39. package/cjs/core/type.js.map +1 -1
  40. package/cjs/crosshair/polygon-sector.js +1 -2
  41. package/cjs/crosshair/polygon.js +2 -1
  42. package/cjs/crosshair/register.js +7 -7
  43. package/cjs/crosshair/register.js.map +1 -1
  44. package/cjs/data-zoom/index.js +2 -1
  45. package/cjs/data-zoom/register.js +3 -3
  46. package/cjs/data-zoom/register.js.map +1 -1
  47. package/cjs/empty-tip/register.js +4 -4
  48. package/cjs/empty-tip/register.js.map +1 -1
  49. package/cjs/index.d.ts +1 -1
  50. package/cjs/index.js +1 -1
  51. package/cjs/index.js.map +1 -1
  52. package/cjs/indicator/register.js +3 -2
  53. package/cjs/indicator/register.js.map +1 -1
  54. package/cjs/jsx/component-type.d.ts +2 -3
  55. package/cjs/jsx/component-type.js.map +1 -1
  56. package/cjs/jsx/index.js +1 -1
  57. package/cjs/label/arc.js +13 -8
  58. package/cjs/label/arc.js.map +1 -1
  59. package/cjs/label/base.d.ts +12 -2
  60. package/cjs/label/base.js +113 -40
  61. package/cjs/label/base.js.map +1 -1
  62. package/cjs/label/dataLabel.d.ts +5 -1
  63. package/cjs/label/dataLabel.js +46 -1
  64. package/cjs/label/dataLabel.js.map +1 -1
  65. package/cjs/label/register.js +4 -3
  66. package/cjs/label/register.js.map +1 -1
  67. package/cjs/label-item/register.js +3 -3
  68. package/cjs/label-item/register.js.map +1 -1
  69. package/cjs/legend/discrete/discrete.js +4 -2
  70. package/cjs/legend/discrete/discrete.js.map +1 -1
  71. package/cjs/legend/register.js +3 -3
  72. package/cjs/legend/register.js.map +1 -1
  73. package/cjs/link-path/register.js +2 -2
  74. package/cjs/link-path/register.js.map +1 -1
  75. package/cjs/marker/animate/animate.d.ts +1 -1
  76. package/cjs/marker/animate/animate.js.map +1 -1
  77. package/cjs/marker/animate/call-in.d.ts +2 -2
  78. package/cjs/marker/animate/call-in.js +5 -4
  79. package/cjs/marker/animate/call-in.js.map +1 -1
  80. package/cjs/marker/animate/clip-in.js +5 -4
  81. package/cjs/marker/animate/clip-in.js.map +1 -1
  82. package/cjs/marker/animate/common.d.ts +1 -0
  83. package/cjs/marker/animate/common.js +13 -8
  84. package/cjs/marker/animate/common.js.map +1 -1
  85. package/cjs/marker/animate/fade-in.d.ts +1 -1
  86. package/cjs/marker/animate/fade-in.js.map +1 -1
  87. package/cjs/marker/animate/fade-out.d.ts +1 -1
  88. package/cjs/marker/animate/fade-out.js.map +1 -1
  89. package/cjs/marker/arc-area.d.ts +1 -1
  90. package/cjs/marker/area.d.ts +1 -1
  91. package/cjs/marker/base.d.ts +6 -2
  92. package/cjs/marker/base.js +51 -9
  93. package/cjs/marker/base.js.map +1 -1
  94. package/cjs/marker/common-line.d.ts +1 -1
  95. package/cjs/marker/point.d.ts +1 -1
  96. package/cjs/marker/register.js +8 -8
  97. package/cjs/marker/register.js.map +1 -1
  98. package/cjs/marker/type.d.ts +8 -5
  99. package/cjs/marker/type.js.map +1 -1
  100. package/cjs/pager/register.js +3 -2
  101. package/cjs/pager/register.js.map +1 -1
  102. package/cjs/player/register.js +3 -3
  103. package/cjs/player/register.js.map +1 -1
  104. package/cjs/poptip/module.js +3 -1
  105. package/cjs/poptip/module.js.map +1 -1
  106. package/cjs/poptip/register.js +3 -3
  107. package/cjs/poptip/register.js.map +1 -1
  108. package/cjs/radio/register.js +3 -3
  109. package/cjs/radio/register.js.map +1 -1
  110. package/cjs/scrollbar/register.js +2 -2
  111. package/cjs/scrollbar/register.js.map +1 -1
  112. package/cjs/segment/register.js +5 -5
  113. package/cjs/segment/register.js.map +1 -1
  114. package/cjs/slider/register.js +3 -3
  115. package/cjs/slider/register.js.map +1 -1
  116. package/cjs/switch/register.js +3 -3
  117. package/cjs/switch/register.js.map +1 -1
  118. package/cjs/table-series-number/register.js +3 -2
  119. package/cjs/table-series-number/register.js.map +1 -1
  120. package/cjs/tag/register.js +4 -3
  121. package/cjs/tag/register.js.map +1 -1
  122. package/cjs/timeline/register.js +3 -3
  123. package/cjs/timeline/register.js.map +1 -1
  124. package/cjs/title/register.js +3 -2
  125. package/cjs/title/register.js.map +1 -1
  126. package/cjs/title/title.js +5 -2
  127. package/cjs/title/title.js.map +1 -1
  128. package/cjs/tooltip/register.js +3 -3
  129. package/cjs/tooltip/register.js.map +1 -1
  130. package/cjs/tooltip/tooltip.js +8 -8
  131. package/cjs/tooltip/tooltip.js.map +1 -1
  132. package/cjs/util/event.js +2 -2
  133. package/cjs/util/event.js.map +1 -1
  134. package/cjs/util/graphic-creator.js +1 -1
  135. package/cjs/util/graphic-creator.js.map +1 -1
  136. package/cjs/util/text.js +3 -3
  137. package/cjs/util/text.js.map +1 -1
  138. package/cjs/weather/register.js +2 -2
  139. package/cjs/weather/register.js.map +1 -1
  140. package/cjs/weather/weather-box.js +5 -5
  141. package/cjs/weather/weather-box.js.map +1 -1
  142. package/dist/index.es.js +6758 -6002
  143. package/es/animation/axis-animate.d.ts +2 -1
  144. package/es/animation/axis-animate.js +9 -2
  145. package/es/animation/axis-animate.js.map +1 -1
  146. package/es/animation/exit-release.d.ts +13 -0
  147. package/es/animation/exit-release.js +31 -0
  148. package/es/animation/exit-release.js.map +1 -0
  149. package/es/animation/label-animate.d.ts +1 -1
  150. package/es/animation/label-animate.js +8 -12
  151. package/es/animation/label-animate.js.map +1 -1
  152. package/es/animation/static-truth.js +1 -5
  153. package/es/animation/static-truth.js.map +1 -1
  154. package/es/axis/animate/group-transition.d.ts +3 -2
  155. package/es/axis/animate/group-transition.js +2 -2
  156. package/es/axis/animate/group-transition.js.map +1 -1
  157. package/es/axis/base.d.ts +6 -2
  158. package/es/axis/base.js +60 -5
  159. package/es/axis/base.js.map +1 -1
  160. package/es/axis/constant.js +1 -2
  161. package/es/axis/index.js +2 -1
  162. package/es/axis/line.d.ts +1 -1
  163. package/es/axis/line.js +2 -2
  164. package/es/axis/line.js.map +1 -1
  165. package/es/axis/overlap/auto-hide.d.ts +1 -1
  166. package/es/axis/overlap/auto-hide.js.map +1 -1
  167. package/es/axis/register.js +13 -1
  168. package/es/axis/register.js.map +1 -1
  169. package/es/brush/brush.d.ts +4 -0
  170. package/es/brush/brush.js +30 -14
  171. package/es/brush/brush.js.map +1 -1
  172. package/es/brush/register.js +3 -1
  173. package/es/brush/register.js.map +1 -1
  174. package/es/checkbox/register.js +7 -1
  175. package/es/checkbox/register.js.map +1 -1
  176. package/es/core/base.d.ts +2 -2
  177. package/es/core/base.js +3 -1
  178. package/es/core/base.js.map +1 -1
  179. package/es/core/type.d.ts +7 -0
  180. package/es/core/type.js.map +1 -1
  181. package/es/crosshair/polygon-sector.js +1 -2
  182. package/es/crosshair/polygon.js +2 -1
  183. package/es/crosshair/register.js +9 -1
  184. package/es/crosshair/register.js.map +1 -1
  185. package/es/data-zoom/index.js +2 -1
  186. package/es/data-zoom/register.js +7 -1
  187. package/es/data-zoom/register.js.map +1 -1
  188. package/es/empty-tip/register.js +6 -3
  189. package/es/empty-tip/register.js.map +1 -1
  190. package/es/index.d.ts +1 -1
  191. package/es/index.js +1 -1
  192. package/es/index.js.map +1 -1
  193. package/es/indicator/register.js +5 -1
  194. package/es/indicator/register.js.map +1 -1
  195. package/es/jsx/component-type.d.ts +2 -3
  196. package/es/jsx/component-type.js.map +1 -1
  197. package/es/jsx/index.js +1 -1
  198. package/es/label/arc.js +13 -8
  199. package/es/label/arc.js.map +1 -1
  200. package/es/label/base.d.ts +12 -2
  201. package/es/label/base.js +106 -30
  202. package/es/label/base.js.map +1 -1
  203. package/es/label/dataLabel.d.ts +5 -1
  204. package/es/label/dataLabel.js +46 -0
  205. package/es/label/dataLabel.js.map +1 -1
  206. package/es/label/register.js +7 -1
  207. package/es/label/register.js.map +1 -1
  208. package/es/label-item/register.js +7 -1
  209. package/es/label-item/register.js.map +1 -1
  210. package/es/legend/discrete/discrete.js +4 -2
  211. package/es/legend/discrete/discrete.js.map +1 -1
  212. package/es/legend/register.js +3 -1
  213. package/es/legend/register.js.map +1 -1
  214. package/es/link-path/register.js +3 -1
  215. package/es/link-path/register.js.map +1 -1
  216. package/es/marker/animate/animate.d.ts +1 -1
  217. package/es/marker/animate/animate.js.map +1 -1
  218. package/es/marker/animate/call-in.d.ts +2 -2
  219. package/es/marker/animate/call-in.js +6 -4
  220. package/es/marker/animate/call-in.js.map +1 -1
  221. package/es/marker/animate/clip-in.js +6 -4
  222. package/es/marker/animate/clip-in.js.map +1 -1
  223. package/es/marker/animate/common.d.ts +1 -0
  224. package/es/marker/animate/common.js +9 -4
  225. package/es/marker/animate/common.js.map +1 -1
  226. package/es/marker/animate/fade-in.d.ts +1 -1
  227. package/es/marker/animate/fade-in.js.map +1 -1
  228. package/es/marker/animate/fade-out.d.ts +1 -1
  229. package/es/marker/animate/fade-out.js.map +1 -1
  230. package/es/marker/arc-area.d.ts +1 -1
  231. package/es/marker/area.d.ts +1 -1
  232. package/es/marker/base.d.ts +6 -2
  233. package/es/marker/base.js +51 -8
  234. package/es/marker/base.js.map +1 -1
  235. package/es/marker/common-line.d.ts +1 -1
  236. package/es/marker/point.d.ts +1 -1
  237. package/es/marker/register.js +12 -2
  238. package/es/marker/register.js.map +1 -1
  239. package/es/marker/type.d.ts +8 -5
  240. package/es/marker/type.js.map +1 -1
  241. package/es/pager/register.js +5 -1
  242. package/es/pager/register.js.map +1 -1
  243. package/es/player/register.js +3 -1
  244. package/es/player/register.js.map +1 -1
  245. package/es/poptip/module.js +3 -1
  246. package/es/poptip/module.js.map +1 -1
  247. package/es/poptip/register.js +7 -1
  248. package/es/poptip/register.js.map +1 -1
  249. package/es/radio/register.js +7 -1
  250. package/es/radio/register.js.map +1 -1
  251. package/es/scrollbar/register.js +3 -1
  252. package/es/scrollbar/register.js.map +1 -1
  253. package/es/segment/register.js +9 -1
  254. package/es/segment/register.js.map +1 -1
  255. package/es/slider/register.js +7 -1
  256. package/es/slider/register.js.map +1 -1
  257. package/es/switch/register.js +7 -1
  258. package/es/switch/register.js.map +1 -1
  259. package/es/table-series-number/register.js +5 -1
  260. package/es/table-series-number/register.js.map +1 -1
  261. package/es/tag/register.js +9 -1
  262. package/es/tag/register.js.map +1 -1
  263. package/es/timeline/register.js +7 -1
  264. package/es/timeline/register.js.map +1 -1
  265. package/es/title/register.js +5 -1
  266. package/es/title/register.js.map +1 -1
  267. package/es/title/title.js +5 -2
  268. package/es/title/title.js.map +1 -1
  269. package/es/tooltip/register.js +9 -1
  270. package/es/tooltip/register.js.map +1 -1
  271. package/es/tooltip/tooltip.js +3 -1
  272. package/es/tooltip/tooltip.js.map +1 -1
  273. package/es/util/event.js +1 -1
  274. package/es/util/event.js.map +1 -1
  275. package/es/util/graphic-creator.js +1 -1
  276. package/es/util/graphic-creator.js.map +1 -1
  277. package/es/util/text.js +1 -1
  278. package/es/util/text.js.map +1 -1
  279. package/es/weather/register.js +3 -1
  280. package/es/weather/register.js.map +1 -1
  281. package/es/weather/weather-box.js +3 -1
  282. package/es/weather/weather-box.js.map +1 -1
  283. package/package.json +486 -6
package/cjs/label/base.js CHANGED
@@ -14,7 +14,7 @@ Object.defineProperty(exports, "__esModule", {
14
14
  value: !0
15
15
  }), exports.LabelBase = void 0;
16
16
 
17
- const vrender_core_1 = require("@visactor/vrender-core"), graphic_creator_1 = require("../util/graphic-creator"), vutils_1 = require("@visactor/vutils"), label_smartInvert_1 = require("../util/label-smartInvert"), util_1 = require("../util"), constant_1 = require("../constant"), overlap_1 = require("./overlap"), animate_1 = require("./animate/animate"), util_2 = require("./util"), register_1 = require("./register"), shiftY_1 = require("./overlap/shiftY"), animate_component_1 = require("../animation/animate-component"), static_truth_1 = require("../animation/static-truth");
17
+ const constant_1 = require("@visactor/vrender-core/event/constant"), path_1 = require("@visactor/vrender-core/path"), graphic_creator_1 = require("../util/graphic-creator"), vutils_1 = require("@visactor/vutils"), label_smartInvert_1 = require("../util/label-smartInvert"), util_1 = require("../util"), constant_2 = require("../constant"), overlap_1 = require("./overlap"), animate_1 = require("./animate/animate"), util_2 = require("./util"), register_1 = require("./register"), shiftY_1 = require("./overlap/shiftY"), animate_component_1 = require("../animation/animate-component"), static_truth_1 = require("../animation/static-truth"), exit_release_1 = require("../animation/exit-release");
18
18
 
19
19
  (0, register_1.loadLabelComponent)();
20
20
 
@@ -32,29 +32,29 @@ class LabelBase extends animate_component_1.AnimateComponent {
32
32
  }, (0, vutils_1.merge)({}, LabelBase.defaultAttributes, restAttributes))), this.name = "label",
33
33
  this._onHover = e => {
34
34
  const target = e.target;
35
- target === this._lastHover || (0, vutils_1.isEmpty)(target.states) || (target.addState(constant_1.StateValue.hover, !0),
35
+ target === this._lastHover || (0, vutils_1.isEmpty)(target.states) || (target.addState(constant_2.StateValue.hover, !0),
36
36
  (0, util_1.traverseGroup)(this, (node => {
37
- node === target || (0, vutils_1.isEmpty)(node.states) || node.addState(constant_1.StateValue.hoverReverse, !0);
37
+ node === target || (0, vutils_1.isEmpty)(node.states) || node.addState(constant_2.StateValue.hoverReverse, !0);
38
38
  })), this._lastHover = target);
39
39
  }, this._onUnHover = e => {
40
40
  this._lastHover && ((0, util_1.traverseGroup)(this, (node => {
41
- (0, vutils_1.isEmpty)(node.states) || (node.removeState(constant_1.StateValue.hoverReverse),
42
- node.removeState(constant_1.StateValue.hover));
41
+ (0, vutils_1.isEmpty)(node.states) || (node.removeState(constant_2.StateValue.hoverReverse),
42
+ node.removeState(constant_2.StateValue.hover));
43
43
  })), this._lastHover = null);
44
44
  }, this._onClick = e => {
45
45
  const target = e.target;
46
46
  if (this._lastSelect === target && target.hasState("selected")) return this._lastSelect = null,
47
47
  void (0, util_1.traverseGroup)(this, (node => {
48
- (0, vutils_1.isEmpty)(node.states) || (node.removeState(constant_1.StateValue.selectedReverse),
49
- node.removeState(constant_1.StateValue.selected));
48
+ (0, vutils_1.isEmpty)(node.states) || (node.removeState(constant_2.StateValue.selectedReverse),
49
+ node.removeState(constant_2.StateValue.selected));
50
50
  }));
51
- (0, vutils_1.isEmpty)(target.states) || (target.addState(constant_1.StateValue.selected, !0),
51
+ (0, vutils_1.isEmpty)(target.states) || (target.addState(constant_2.StateValue.selected, !0),
52
52
  (0, util_1.traverseGroup)(this, (node => {
53
- node === target || (0, vutils_1.isEmpty)(node.states) || node.addState(constant_1.StateValue.selectedReverse, !0);
53
+ node === target || (0, vutils_1.isEmpty)(node.states) || node.addState(constant_2.StateValue.selectedReverse, !0);
54
54
  })), this._lastSelect = target);
55
55
  }, this._handleRelatedGraphicSetState = e => {
56
56
  var _a, _b, _c, _d, _e;
57
- if ((null === (_a = e.detail) || void 0 === _a ? void 0 : _a.type) === vrender_core_1.AttributeUpdateType.STATE || (null === (_b = e.detail) || void 0 === _b ? void 0 : _b.type) === vrender_core_1.AttributeUpdateType.ANIMATE_UPDATE && (null === (_c = e.detail.animationState) || void 0 === _c ? void 0 : _c.isFirstFrameOfStep)) {
57
+ if ((null === (_a = e.detail) || void 0 === _a ? void 0 : _a.type) === constant_1.AttributeUpdateType.STATE || (null === (_b = e.detail) || void 0 === _b ? void 0 : _b.type) === constant_1.AttributeUpdateType.ANIMATE_UPDATE && (null === (_c = e.detail.animationState) || void 0 === _c ? void 0 : _c.isFirstFrameOfStep)) {
58
58
  const currentStates = null !== (_e = null === (_d = e.target) || void 0 === _d ? void 0 : _d.currentStates) && void 0 !== _e ? _e : [], labels = this._isCollectionBase ? [ ...this._graphicToText.values() ] : [ this._graphicToText.get(e.target) ];
59
59
  this.updateStatesOfLabels(labels, currentStates);
60
60
  }
@@ -62,7 +62,7 @@ class LabelBase extends animate_component_1.AnimateComponent {
62
62
  }
63
63
  labeling(textBounds, graphicBounds, position, offset) {}
64
64
  _getLabelLinePoints(text, baseMark) {
65
- return (0, util_2.connectLineBetweenBounds)(text.AABBBounds, null == baseMark ? void 0 : baseMark.AABBBounds);
65
+ return (0, util_2.connectLineBetweenBounds)(text.AABBBounds, this.getGraphicFinalLayoutBounds(baseMark));
66
66
  }
67
67
  _createLabelLine(text, baseMark) {
68
68
  const points = this._getLabelLinePoints(text, baseMark);
@@ -75,20 +75,67 @@ class LabelBase extends animate_component_1.AnimateComponent {
75
75
  lineGraphic.pathProxy = attrs => customShape({
76
76
  text: text,
77
77
  baseMark: baseMark
78
- }, attrs, new vrender_core_1.CustomPath2D);
78
+ }, attrs, new path_1.CustomPath2D);
79
79
  }
80
- return baseMark && baseMark.getAttributes(!0).fill && lineGraphic.setAttribute("stroke", baseMark.getAttributes(!0).fill),
80
+ const baseMarkAttrs = baseMark && this.getGraphicFinalLayoutAttributes(baseMark);
81
+ return (null == baseMarkAttrs ? void 0 : baseMarkAttrs.fill) && lineGraphic.setAttribute("stroke", baseMarkAttrs.fill),
81
82
  this.attribute.line && !(0, vutils_1.isEmpty)(this.attribute.line.style) && lineGraphic.setAttributes(this.attribute.line.style),
82
83
  this._setStatesOfLabelLine(lineGraphic), lineGraphic;
83
84
  }
84
85
  }
86
+ _finalizeExitRelease() {
87
+ var _a, _b, _c, _d;
88
+ const state = this._exitReleaseState;
89
+ if (null == state ? void 0 : state.finalized) return;
90
+ state && (state.finalized = !0);
91
+ const parent = this.parent, removeFromParent = !!(null == state ? void 0 : state.removeFromParent), callbacks = null !== (_a = null == state ? void 0 : state.onComplete) && void 0 !== _a ? _a : [];
92
+ this._exitReleaseState = void 0, this._graphicToText = new Map, null === (_b = this._idToGraphic) || void 0 === _b || _b.clear(),
93
+ null === (_c = this._idToPoint) || void 0 === _c || _c.clear(), this._baseMarks = void 0,
94
+ this.removeAllChild(!0), super.release(!0), removeFromParent && (null === (_d = null != parent ? parent : this.parent) || void 0 === _d || _d.removeChild(this)),
95
+ (0, exit_release_1.runExitReleaseCallbacks)(callbacks);
96
+ }
97
+ _runExitAnimationBeforeRelease(options = {}) {
98
+ var _a, _b;
99
+ if (this._exitReleaseState && !this._exitReleaseState.finalized) return this._exitReleaseState.removeFromParent = this._exitReleaseState.removeFromParent || !!options.removeFromParent,
100
+ (0, exit_release_1.appendExitReleaseCallback)(this._exitReleaseState, options.onComplete),
101
+ !0;
102
+ if (!this.stage || !1 === this.attribute.animation || !1 === this.attribute.animationExit || !(null === (_a = this._graphicToText) || void 0 === _a ? void 0 : _a.size)) return !1;
103
+ if (this._prepareAnimate(animate_1.DefaultLabelAnimation), !(null === (_b = this._animationConfig) || void 0 === _b ? void 0 : _b.exit)) return !1;
104
+ const exitTargets = new Set;
105
+ if (this._graphicToText.forEach((label => {
106
+ (null == label ? void 0 : label.text) && exitTargets.add(label.text), (null == label ? void 0 : label.labelLine) && exitTargets.add(label.labelLine);
107
+ })), !exitTargets.size) return !1;
108
+ const existingAnimates = (0, exit_release_1.collectTrackedAnimates)(this);
109
+ exitTargets.forEach((target => {
110
+ var _a;
111
+ target.applyAnimationState([ "exit" ], [ {
112
+ name: "exit",
113
+ animation: Object.assign(Object.assign({}, this._animationConfig.exit), {
114
+ type: null !== (_a = this._animationConfig.exit.type) && void 0 !== _a ? _a : "fadeOut",
115
+ selfOnly: !0
116
+ })
117
+ } ]);
118
+ }));
119
+ const exitAnimates = (0, exit_release_1.collectTrackedAnimates)(this).filter((animate => !existingAnimates.includes(animate)));
120
+ if (!exitAnimates.length) return !1;
121
+ this.setAttribute("childrenPickable", !1), this.releaseStatus = "willRelease";
122
+ const pendingAnimates = new Set(exitAnimates);
123
+ return this._exitReleaseState = {
124
+ pendingAnimates: pendingAnimates,
125
+ finalized: !1,
126
+ removeFromParent: !!options.removeFromParent,
127
+ onComplete: options.onComplete ? [ options.onComplete ] : []
128
+ }, (0, exit_release_1.bindExitReleaseAnimates)(exitAnimates, (() => this._exitReleaseState), (() => this._finalizeExitRelease())),
129
+ !0;
130
+ }
131
+ releaseWithExitAnimation(options = {}) {
132
+ return "released" !== this.releaseStatus && this._runExitAnimationBeforeRelease(options);
133
+ }
85
134
  render() {
86
- if (this._prepare(), (0, vutils_1.isNil)(this._idToGraphic) || this._isCollectionBase && (0,
135
+ if (this._exitReleaseState) return;
136
+ if (this._finalLayoutBoundsCache = void 0, this._prepare(), (0, vutils_1.isNil)(this._idToGraphic) || this._isCollectionBase && (0,
87
137
  vutils_1.isNil)(this._idToPoint)) return;
88
- const markAttributeList = [];
89
- !1 !== this._enableAnimation && this._baseMarks.forEach((mark => {
90
- markAttributeList.push(mark.attribute), mark.initAttributes(mark.getAttributes(!0));
91
- }));
138
+ this._finalLayoutBoundsCache = new Map;
92
139
  const {overlap: overlap, smartInvert: smartInvert, dataFilter: dataFilter, customLayoutFunc: customLayoutFunc, customOverlapFunc: customOverlapFunc} = this.attribute;
93
140
  let data = this.attribute.data;
94
141
  if ((0, vutils_1.isFunction)(dataFilter) && (data = dataFilter(data)), data && data.length) {
@@ -109,9 +156,7 @@ class LabelBase extends animate_component_1.AnimateComponent {
109
156
  labels && labels.length && labels.forEach((label => {
110
157
  this._bindEvent(label), this._setStatesOfText(label);
111
158
  })), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels),
112
- !1 !== this._enableAnimation && this._baseMarks.forEach(((mark, index) => {
113
- mark.initAttributes(markAttributeList[index]);
114
- }));
159
+ this._finalLayoutBoundsCache = void 0;
115
160
  }
116
161
  _bindEvent(target) {
117
162
  if (this.attribute.disableTriggerEvent) return;
@@ -170,12 +215,38 @@ class LabelBase extends animate_component_1.AnimateComponent {
170
215
  getRelatedGraphic(item) {
171
216
  return this._idToGraphic.get(item.id);
172
217
  }
218
+ getGraphicFinalLayoutAttributes(graphic) {
219
+ var _a, _b;
220
+ return null !== (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.finalAttrs) && void 0 !== _b ? _b : graphic.getAttributes(!0);
221
+ }
222
+ hasGraphicContextFinalLayoutAttributes(graphic) {
223
+ var _a;
224
+ return !!(null === (_a = null == graphic ? void 0 : graphic.context) || void 0 === _a ? void 0 : _a.finalAttrs);
225
+ }
226
+ shouldUseGraphicFinalLayoutAttributes(graphic) {
227
+ var _a;
228
+ return !!graphic && (!!(null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.animationState) || this.hasGraphicContextFinalLayoutAttributes(graphic));
229
+ }
230
+ getGraphicFinalLayoutBounds(graphic) {
231
+ var _a, _b;
232
+ if (!graphic) return;
233
+ const useFinalAttrs = this.shouldUseGraphicFinalLayoutAttributes(graphic), graphicAttrs = useFinalAttrs ? this.getGraphicFinalLayoutAttributes(graphic) : graphic.attribute;
234
+ if (!1 === (null == graphicAttrs ? void 0 : graphicAttrs.visible)) return;
235
+ if (!useFinalAttrs) return graphic.AABBBounds;
236
+ const cachedBounds = null === (_a = this._finalLayoutBoundsCache) || void 0 === _a ? void 0 : _a.get(graphic);
237
+ if (cachedBounds) return cachedBounds;
238
+ const clonedGraphic = graphic.clone();
239
+ clonedGraphic.initAttributes(Object.assign(Object.assign({}, clonedGraphic.attribute), graphicAttrs));
240
+ const bounds = clonedGraphic.AABBBounds;
241
+ return null === (_b = this._finalLayoutBoundsCache) || void 0 === _b || _b.set(graphic, bounds),
242
+ bounds;
243
+ }
173
244
  _initText(data = []) {
174
245
  const {textStyle: textStyle = {}} = this.attribute, labels = [];
175
246
  for (let i = 0; i < data.length; i++) {
176
247
  const textData = data[i], baseMark = this.getRelatedGraphic(textData);
177
248
  if (!baseMark) continue;
178
- const graphicAttribute = baseMark.getAttributes(!0), labelAttribute = Object.assign(Object.assign({
249
+ const graphicAttribute = this.getGraphicFinalLayoutAttributes(baseMark), labelAttribute = Object.assign(Object.assign({
179
250
  fill: this._isCollectionBase ? (0, vutils_1.isArray)(graphicAttribute.stroke) ? graphicAttribute.stroke.find((entry => !!entry && !0 !== entry)) : graphicAttribute.stroke : graphicAttribute.fill
180
251
  }, textStyle), textData), text = this._createLabelText(labelAttribute);
181
252
  labels.push(text);
@@ -273,7 +344,8 @@ class LabelBase extends animate_component_1.AnimateComponent {
273
344
  var _a;
274
345
  const {avoidBaseMark: avoidBaseMark, strategy: strategy = [], hideOnHit: hideOnHit = !0, clampForce: clampForce = !0, avoidMarks: avoidMarks = [], overlapPadding: overlapPadding, hideOnOverflow: hideOnOverflow = !1} = option, result = [], checkBounds = strategy.some((s => "bound" === s.type));
275
346
  avoidBaseMark && (null === (_a = this._baseMarks) || void 0 === _a || _a.forEach((mark => {
276
- mark.AABBBounds && bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, mark.AABBBounds, !0));
347
+ const markBounds = this.getGraphicFinalLayoutBounds(mark);
348
+ markBounds && bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, markBounds, !0));
277
349
  }))), avoidMarks.length > 0 && avoidMarks.forEach((avoid => {
278
350
  (0, vutils_1.isString)(avoid) ? (0, util_1.getNoneGroupMarksByName)(this.getRootNode(), avoid).forEach((avoidMark => {
279
351
  avoidMark.AABBBounds && bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, avoidMark.AABBBounds, !0));
@@ -288,7 +360,7 @@ class LabelBase extends animate_component_1.AnimateComponent {
288
360
  bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, text.AABBBounds, !0)), result.push(text);
289
361
  continue;
290
362
  }
291
- if (checkBounds && baseMark && baseMark.AABBBounds && this._canPlaceInside(text.AABBBounds, baseMark.AABBBounds)) {
363
+ if (checkBounds && baseMark && this._canPlaceInside(text.AABBBounds, this.getGraphicFinalLayoutBounds(baseMark))) {
292
364
  bitmap.setRange((0, overlap_1.boundToRange)(bmpTool, text.AABBBounds, !0)), result.push(text);
293
365
  continue;
294
366
  }
@@ -314,14 +386,15 @@ class LabelBase extends animate_component_1.AnimateComponent {
314
386
  return result;
315
387
  }
316
388
  isMarkInsideRect(baseMark, bmpTool) {
389
+ if (!baseMark) return !1;
317
390
  const {left: left, right: right, top: top, bottom: bottom} = bmpTool.padding, rect = {
318
391
  x1: -left,
319
392
  x2: bmpTool.width + right,
320
393
  y1: -top,
321
394
  y2: bmpTool.height + bottom
322
- }, bounds = baseMark.AABBBounds;
323
- if (0 !== bounds.width() && 0 !== bounds.height()) return (0, vutils_1.isRectIntersect)(baseMark.AABBBounds, rect, !0);
324
- const {attribute: attribute} = baseMark;
395
+ }, bounds = this.getGraphicFinalLayoutBounds(baseMark);
396
+ if (bounds && 0 !== bounds.width() && 0 !== bounds.height()) return (0, vutils_1.isRectIntersect)(bounds, rect, !0);
397
+ const attribute = this.shouldUseGraphicFinalLayoutAttributes(baseMark) ? this.getGraphicFinalLayoutAttributes(baseMark) : baseMark.attribute;
325
398
  if ("rect" === baseMark.type) {
326
399
  const {x: x, x1: x1, y: y, y1: y1} = attribute;
327
400
  return (0, vutils_1.pointInRect)({
@@ -339,16 +412,10 @@ class LabelBase extends animate_component_1.AnimateComponent {
339
412
  if (baseMarkGroupName) return this.getRootNode().find((node => node.name === baseMarkGroupName), !0);
340
413
  }
341
414
  getGraphicBounds(graphic, point = {}, position) {
342
- var _a;
343
415
  if (graphic) {
344
- if (!1 !== graphic.attribute.visible) {
345
- if (null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.animationState) {
346
- const clonedGraphic = graphic.clone();
347
- return Object.assign(clonedGraphic.attribute, graphic.getAttributes(!0)), clonedGraphic.AABBBounds;
348
- }
349
- return graphic.AABBBounds;
350
- }
351
- const {x: x, y: y} = graphic.attribute;
416
+ const graphicAttrs = this.shouldUseGraphicFinalLayoutAttributes(graphic) ? this.getGraphicFinalLayoutAttributes(graphic) : graphic.attribute;
417
+ if (!1 !== graphicAttrs.visible) return this.getGraphicFinalLayoutBounds(graphic);
418
+ const {x: x, y: y} = graphicAttrs;
352
419
  return {
353
420
  x1: x,
354
421
  x2: x,
@@ -481,16 +548,16 @@ class LabelBase extends animate_component_1.AnimateComponent {
481
548
  if ("null" !== fillStrategy || "null" !== strokeStrategy) for (let i = 0; i < labels.length; i++) {
482
549
  const label = labels[i];
483
550
  if (!label) continue;
484
- const baseMark = this.getRelatedGraphic(label.attribute);
485
- let backgroundColor = baseMark.getAttributes(!0).fill;
486
- const backgroundOpacity = baseMark.getAttributes(!0).fillOpacity;
551
+ const baseMark = this.getRelatedGraphic(label.attribute), baseMarkAttrs = this.getGraphicFinalLayoutAttributes(baseMark);
552
+ let backgroundColor = baseMarkAttrs.fill;
553
+ const backgroundOpacity = baseMarkAttrs.fillOpacity;
487
554
  let foregroundColor = label.attribute.fill;
488
555
  if ((0, vutils_1.isObject)(backgroundColor) && backgroundColor.gradient) {
489
556
  const firstStopColor = null === (_g = null === (_f = backgroundColor.stops) || void 0 === _f ? void 0 : _f[0]) || void 0 === _g ? void 0 : _g.color;
490
557
  firstStopColor && (backgroundColor = firstStopColor, foregroundColor = firstStopColor);
491
558
  }
492
559
  const invertColor = (0, label_smartInvert_1.labelSmartInvert)(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors, mode), similarColor = (0,
493
- label_smartInvert_1.contrastAccessibilityChecker)(invertColor, brightColor) ? brightColor : darkColor, isInside = this._canPlaceInside(label.AABBBounds, baseMark.AABBBounds), isIntersect = !isInside && label.AABBBounds && baseMark.AABBBounds && baseMark.AABBBounds.intersects(label.AABBBounds);
560
+ label_smartInvert_1.contrastAccessibilityChecker)(invertColor, brightColor) ? brightColor : darkColor, baseMarkBounds = this.getGraphicFinalLayoutBounds(baseMark), isInside = this._canPlaceInside(label.AABBBounds, baseMarkBounds), isIntersect = !isInside && label.AABBBounds && baseMarkBounds && baseMarkBounds.intersects(label.AABBBounds);
494
561
  if (isInside || outsideEnable || isIntersect && "inside" === interactInvertType) {
495
562
  const fill = (0, label_smartInvert_1.smartInvertStrategy)(fillStrategy, backgroundColor, invertColor, similarColor);
496
563
  if (fill && label.setAttributes({
@@ -540,6 +607,12 @@ class LabelBase extends animate_component_1.AnimateComponent {
540
607
  _canPlaceInside(textBound, shapeBound) {
541
608
  return !(!textBound || !shapeBound) && shapeBound.encloses(textBound);
542
609
  }
610
+ release(all) {
611
+ var _a, _b;
612
+ this._exitReleaseState ? this._finalizeExitRelease() : (all && this.removeAllChild(!0),
613
+ super.release(all), this._graphicToText = new Map, null === (_a = this._idToGraphic) || void 0 === _a || _a.clear(),
614
+ null === (_b = this._idToPoint) || void 0 === _b || _b.clear(), this._baseMarks = void 0);
615
+ }
543
616
  setLocation(point) {
544
617
  this.translateTo(point.x, point.y);
545
618
  }