@antv/component 1.0.3 → 2.0.1

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 (313) hide show
  1. package/dist/component.min.js +1 -1
  2. package/esm/animation/fadeIn.d.ts +1 -1
  3. package/esm/animation/fadeOut.d.ts +1 -1
  4. package/esm/animation/utils.d.ts +3 -3
  5. package/esm/animation/utils.js +10 -14
  6. package/esm/animation/utils.js.map +1 -1
  7. package/esm/index.js +0 -2
  8. package/esm/index.js.map +1 -1
  9. package/esm/ui/axis/axis.d.ts +1 -1
  10. package/esm/ui/axis/constant.js +1 -2
  11. package/esm/ui/axis/constant.js.map +1 -1
  12. package/esm/ui/axis/guides/grid.d.ts +1 -1
  13. package/esm/ui/axis/guides/labels.d.ts +1 -1
  14. package/esm/ui/axis/guides/labels.js +17 -11
  15. package/esm/ui/axis/guides/labels.js.map +1 -1
  16. package/esm/ui/axis/guides/line.js +3 -3
  17. package/esm/ui/axis/guides/line.js.map +1 -1
  18. package/esm/ui/axis/guides/ticks.d.ts +1 -1
  19. package/esm/ui/axis/guides/ticks.js +1 -1
  20. package/esm/ui/axis/guides/ticks.js.map +1 -1
  21. package/esm/ui/axis/guides/title.d.ts +1 -1
  22. package/esm/ui/axis/guides/title.js +8 -11
  23. package/esm/ui/axis/guides/title.js.map +1 -1
  24. package/esm/ui/axis/overlap/autoEllipsis.js +1 -2
  25. package/esm/ui/axis/overlap/autoEllipsis.js.map +1 -1
  26. package/esm/ui/axis/overlap/autoHide.js +1 -2
  27. package/esm/ui/axis/overlap/autoHide.js.map +1 -1
  28. package/esm/ui/axis/utils/bounds.d.ts +3 -1
  29. package/esm/ui/axis/utils/bounds.js +5 -8
  30. package/esm/ui/axis/utils/bounds.js.map +1 -1
  31. package/esm/ui/axis/utils/test.js +4 -2
  32. package/esm/ui/axis/utils/test.js.map +1 -1
  33. package/esm/ui/breadcrumb/index.js +2 -2
  34. package/esm/ui/breadcrumb/index.js.map +1 -1
  35. package/esm/ui/button/index.js +8 -6
  36. package/esm/ui/button/index.js.map +1 -1
  37. package/esm/ui/button/types.d.ts +2 -0
  38. package/esm/ui/checkbox/constant.d.ts +4 -4
  39. package/esm/ui/checkbox/constant.js +1 -1
  40. package/esm/ui/checkbox/constant.js.map +1 -1
  41. package/esm/ui/checkbox/index.js +1 -1
  42. package/esm/ui/checkbox/index.js.map +1 -1
  43. package/esm/ui/crosshair/base.js +1 -1
  44. package/esm/ui/crosshair/base.js.map +1 -1
  45. package/esm/ui/crosshair/circle.js +1 -1
  46. package/esm/ui/crosshair/circle.js.map +1 -1
  47. package/esm/ui/crosshair/polygon.js +1 -1
  48. package/esm/ui/crosshair/polygon.js.map +1 -1
  49. package/esm/ui/grid/index.d.ts +1 -1
  50. package/esm/ui/grid/index.js +4 -4
  51. package/esm/ui/grid/index.js.map +1 -1
  52. package/esm/ui/indicator/indicator.js +3 -2
  53. package/esm/ui/indicator/indicator.js.map +1 -1
  54. package/esm/ui/indicator/types.d.ts +2 -0
  55. package/esm/ui/layout/layout.js +3 -1
  56. package/esm/ui/layout/layout.js.map +1 -1
  57. package/esm/ui/layout/types.d.ts +2 -0
  58. package/esm/ui/legend/base.d.ts +1 -1
  59. package/esm/ui/legend/category/item.d.ts +2 -0
  60. package/esm/ui/legend/category/item.js +10 -4
  61. package/esm/ui/legend/category/item.js.map +1 -1
  62. package/esm/ui/legend/category/items.d.ts +2 -0
  63. package/esm/ui/legend/category/items.js.map +1 -1
  64. package/esm/ui/legend/category.js +4 -3
  65. package/esm/ui/legend/category.js.map +1 -1
  66. package/esm/ui/legend/continuous/ribbon.js +4 -4
  67. package/esm/ui/legend/continuous/ribbon.js.map +1 -1
  68. package/esm/ui/legend/continuous.d.ts +2 -2
  69. package/esm/ui/legend/continuous.js +35 -25
  70. package/esm/ui/legend/continuous.js.map +1 -1
  71. package/esm/ui/marker/index.js +5 -4
  72. package/esm/ui/marker/index.js.map +1 -1
  73. package/esm/ui/marker/types.d.ts +2 -0
  74. package/esm/ui/navigator/index.js +6 -1
  75. package/esm/ui/navigator/index.js.map +1 -1
  76. package/esm/ui/navigator/types.d.ts +2 -0
  77. package/esm/ui/scrollbar/index.js +4 -2
  78. package/esm/ui/scrollbar/index.js.map +1 -1
  79. package/esm/ui/scrollbar/types.d.ts +2 -0
  80. package/esm/ui/select/option.js +1 -1
  81. package/esm/ui/select/option.js.map +1 -1
  82. package/esm/ui/select/select.js +11 -9
  83. package/esm/ui/select/select.js.map +1 -1
  84. package/esm/ui/select/types.d.ts +4 -0
  85. package/esm/ui/slider/constant.d.ts +2 -0
  86. package/esm/ui/slider/constant.js +2 -0
  87. package/esm/ui/slider/constant.js.map +1 -1
  88. package/esm/ui/slider/handle.d.ts +4 -0
  89. package/esm/ui/slider/handle.js +14 -17
  90. package/esm/ui/slider/handle.js.map +1 -1
  91. package/esm/ui/slider/index.js +17 -16
  92. package/esm/ui/slider/index.js.map +1 -1
  93. package/esm/ui/slider/types.d.ts +2 -0
  94. package/esm/ui/sparkline/columns.d.ts +2 -0
  95. package/esm/ui/sparkline/columns.js +2 -1
  96. package/esm/ui/sparkline/columns.js.map +1 -1
  97. package/esm/ui/sparkline/index.js +6 -4
  98. package/esm/ui/sparkline/index.js.map +1 -1
  99. package/esm/ui/sparkline/lines.d.ts +2 -0
  100. package/esm/ui/sparkline/lines.js +2 -1
  101. package/esm/ui/sparkline/lines.js.map +1 -1
  102. package/esm/ui/sparkline/types.d.ts +2 -0
  103. package/esm/ui/switch/index.js +1 -0
  104. package/esm/ui/switch/index.js.map +1 -1
  105. package/esm/ui/switch/types.d.ts +2 -0
  106. package/esm/ui/tag/index.js +1 -4
  107. package/esm/ui/tag/index.js.map +1 -1
  108. package/esm/ui/tag/types.d.ts +2 -0
  109. package/esm/ui/timebar/controller.js +8 -8
  110. package/esm/ui/timebar/controller.js.map +1 -1
  111. package/esm/ui/timebar/handle.d.ts +4 -0
  112. package/esm/ui/timebar/handle.js +9 -7
  113. package/esm/ui/timebar/handle.js.map +1 -1
  114. package/esm/ui/timebar/icons.d.ts +2 -2
  115. package/esm/ui/timebar/icons.js +104 -91
  116. package/esm/ui/timebar/icons.js.map +1 -1
  117. package/esm/ui/timebar/timebar.js +14 -6
  118. package/esm/ui/timebar/timebar.js.map +1 -1
  119. package/esm/ui/timebar/types.d.ts +4 -0
  120. package/esm/ui/tooltip/types.d.ts +2 -0
  121. package/esm/util/keyframe-interpolate.d.ts +1 -1
  122. package/esm/util/offscreen.js +1 -0
  123. package/esm/util/offscreen.js.map +1 -1
  124. package/esm/util/primitive.js +0 -3
  125. package/esm/util/primitive.js.map +1 -1
  126. package/esm/util/scale-to-pixel.js +3 -2
  127. package/esm/util/scale-to-pixel.js.map +1 -1
  128. package/lib/animation/fadeIn.d.ts +1 -1
  129. package/lib/animation/fadeOut.d.ts +1 -1
  130. package/lib/animation/utils.d.ts +3 -3
  131. package/lib/animation/utils.js +10 -14
  132. package/lib/animation/utils.js.map +1 -1
  133. package/lib/index.js +0 -2
  134. package/lib/index.js.map +1 -1
  135. package/lib/ui/axis/axis.d.ts +1 -1
  136. package/lib/ui/axis/constant.js +1 -2
  137. package/lib/ui/axis/constant.js.map +1 -1
  138. package/lib/ui/axis/guides/grid.d.ts +1 -1
  139. package/lib/ui/axis/guides/labels.d.ts +1 -1
  140. package/lib/ui/axis/guides/labels.js +17 -11
  141. package/lib/ui/axis/guides/labels.js.map +1 -1
  142. package/lib/ui/axis/guides/line.js +3 -3
  143. package/lib/ui/axis/guides/line.js.map +1 -1
  144. package/lib/ui/axis/guides/ticks.d.ts +1 -1
  145. package/lib/ui/axis/guides/ticks.js +1 -1
  146. package/lib/ui/axis/guides/ticks.js.map +1 -1
  147. package/lib/ui/axis/guides/title.d.ts +1 -1
  148. package/lib/ui/axis/guides/title.js +7 -10
  149. package/lib/ui/axis/guides/title.js.map +1 -1
  150. package/lib/ui/axis/overlap/autoEllipsis.js +1 -2
  151. package/lib/ui/axis/overlap/autoEllipsis.js.map +1 -1
  152. package/lib/ui/axis/overlap/autoHide.js +1 -2
  153. package/lib/ui/axis/overlap/autoHide.js.map +1 -1
  154. package/lib/ui/axis/utils/bounds.d.ts +3 -1
  155. package/lib/ui/axis/utils/bounds.js +6 -10
  156. package/lib/ui/axis/utils/bounds.js.map +1 -1
  157. package/lib/ui/axis/utils/test.js +4 -2
  158. package/lib/ui/axis/utils/test.js.map +1 -1
  159. package/lib/ui/breadcrumb/index.js +2 -2
  160. package/lib/ui/breadcrumb/index.js.map +1 -1
  161. package/lib/ui/button/index.js +8 -6
  162. package/lib/ui/button/index.js.map +1 -1
  163. package/lib/ui/button/types.d.ts +2 -0
  164. package/lib/ui/checkbox/constant.d.ts +4 -4
  165. package/lib/ui/checkbox/constant.js +1 -1
  166. package/lib/ui/checkbox/constant.js.map +1 -1
  167. package/lib/ui/checkbox/index.js +1 -1
  168. package/lib/ui/checkbox/index.js.map +1 -1
  169. package/lib/ui/crosshair/base.js +1 -1
  170. package/lib/ui/crosshair/base.js.map +1 -1
  171. package/lib/ui/crosshair/circle.js +1 -1
  172. package/lib/ui/crosshair/circle.js.map +1 -1
  173. package/lib/ui/crosshair/polygon.js +1 -1
  174. package/lib/ui/crosshair/polygon.js.map +1 -1
  175. package/lib/ui/grid/index.d.ts +1 -1
  176. package/lib/ui/grid/index.js +4 -4
  177. package/lib/ui/grid/index.js.map +1 -1
  178. package/lib/ui/indicator/indicator.js +3 -2
  179. package/lib/ui/indicator/indicator.js.map +1 -1
  180. package/lib/ui/indicator/types.d.ts +2 -0
  181. package/lib/ui/layout/layout.js +3 -1
  182. package/lib/ui/layout/layout.js.map +1 -1
  183. package/lib/ui/layout/types.d.ts +2 -0
  184. package/lib/ui/legend/base.d.ts +1 -1
  185. package/lib/ui/legend/category/item.d.ts +2 -0
  186. package/lib/ui/legend/category/item.js +10 -4
  187. package/lib/ui/legend/category/item.js.map +1 -1
  188. package/lib/ui/legend/category/items.d.ts +2 -0
  189. package/lib/ui/legend/category/items.js.map +1 -1
  190. package/lib/ui/legend/category.js +4 -3
  191. package/lib/ui/legend/category.js.map +1 -1
  192. package/lib/ui/legend/continuous/ribbon.js +4 -4
  193. package/lib/ui/legend/continuous/ribbon.js.map +1 -1
  194. package/lib/ui/legend/continuous.d.ts +2 -2
  195. package/lib/ui/legend/continuous.js +35 -25
  196. package/lib/ui/legend/continuous.js.map +1 -1
  197. package/lib/ui/marker/index.js +5 -4
  198. package/lib/ui/marker/index.js.map +1 -1
  199. package/lib/ui/marker/types.d.ts +2 -0
  200. package/lib/ui/navigator/index.js +6 -1
  201. package/lib/ui/navigator/index.js.map +1 -1
  202. package/lib/ui/navigator/types.d.ts +2 -0
  203. package/lib/ui/scrollbar/index.js +4 -2
  204. package/lib/ui/scrollbar/index.js.map +1 -1
  205. package/lib/ui/scrollbar/types.d.ts +2 -0
  206. package/lib/ui/select/option.js +1 -1
  207. package/lib/ui/select/option.js.map +1 -1
  208. package/lib/ui/select/select.js +11 -9
  209. package/lib/ui/select/select.js.map +1 -1
  210. package/lib/ui/select/types.d.ts +4 -0
  211. package/lib/ui/slider/constant.d.ts +2 -0
  212. package/lib/ui/slider/constant.js +2 -0
  213. package/lib/ui/slider/constant.js.map +1 -1
  214. package/lib/ui/slider/handle.d.ts +4 -0
  215. package/lib/ui/slider/handle.js +14 -17
  216. package/lib/ui/slider/handle.js.map +1 -1
  217. package/lib/ui/slider/index.js +17 -16
  218. package/lib/ui/slider/index.js.map +1 -1
  219. package/lib/ui/slider/types.d.ts +2 -0
  220. package/lib/ui/sparkline/columns.d.ts +2 -0
  221. package/lib/ui/sparkline/columns.js +2 -1
  222. package/lib/ui/sparkline/columns.js.map +1 -1
  223. package/lib/ui/sparkline/index.js +6 -4
  224. package/lib/ui/sparkline/index.js.map +1 -1
  225. package/lib/ui/sparkline/lines.d.ts +2 -0
  226. package/lib/ui/sparkline/lines.js +2 -1
  227. package/lib/ui/sparkline/lines.js.map +1 -1
  228. package/lib/ui/sparkline/types.d.ts +2 -0
  229. package/lib/ui/switch/index.js +1 -0
  230. package/lib/ui/switch/index.js.map +1 -1
  231. package/lib/ui/switch/types.d.ts +2 -0
  232. package/lib/ui/tag/index.js +1 -4
  233. package/lib/ui/tag/index.js.map +1 -1
  234. package/lib/ui/tag/types.d.ts +2 -0
  235. package/lib/ui/timebar/controller.js +8 -8
  236. package/lib/ui/timebar/controller.js.map +1 -1
  237. package/lib/ui/timebar/handle.d.ts +4 -0
  238. package/lib/ui/timebar/handle.js +9 -7
  239. package/lib/ui/timebar/handle.js.map +1 -1
  240. package/lib/ui/timebar/icons.d.ts +2 -2
  241. package/lib/ui/timebar/icons.js +104 -91
  242. package/lib/ui/timebar/icons.js.map +1 -1
  243. package/lib/ui/timebar/timebar.js +14 -6
  244. package/lib/ui/timebar/timebar.js.map +1 -1
  245. package/lib/ui/timebar/types.d.ts +4 -0
  246. package/lib/ui/tooltip/types.d.ts +2 -0
  247. package/lib/util/keyframe-interpolate.d.ts +1 -1
  248. package/lib/util/offscreen.js +1 -0
  249. package/lib/util/offscreen.js.map +1 -1
  250. package/lib/util/primitive.js +0 -3
  251. package/lib/util/primitive.js.map +1 -1
  252. package/lib/util/scale-to-pixel.js +3 -2
  253. package/lib/util/scale-to-pixel.js.map +1 -1
  254. package/package.json +6 -6
  255. package/src/animation/utils.ts +16 -15
  256. package/src/index.ts +0 -4
  257. package/src/ui/axis/constant.ts +1 -2
  258. package/src/ui/axis/guides/labels.ts +24 -12
  259. package/src/ui/axis/guides/line.ts +3 -3
  260. package/src/ui/axis/guides/ticks.ts +1 -1
  261. package/src/ui/axis/guides/title.ts +11 -11
  262. package/src/ui/axis/overlap/autoEllipsis.ts +1 -2
  263. package/src/ui/axis/overlap/autoHide.ts +1 -2
  264. package/src/ui/axis/utils/bounds.ts +6 -8
  265. package/src/ui/axis/utils/test.ts +4 -2
  266. package/src/ui/breadcrumb/index.ts +2 -3
  267. package/src/ui/button/index.ts +10 -6
  268. package/src/ui/button/types.ts +2 -0
  269. package/src/ui/checkbox/constant.ts +1 -1
  270. package/src/ui/checkbox/index.ts +0 -2
  271. package/src/ui/crosshair/base.ts +1 -1
  272. package/src/ui/crosshair/circle.ts +1 -1
  273. package/src/ui/crosshair/polygon.ts +1 -1
  274. package/src/ui/grid/index.ts +4 -4
  275. package/src/ui/indicator/indicator.ts +3 -2
  276. package/src/ui/indicator/types.ts +2 -0
  277. package/src/ui/layout/layout.ts +4 -1
  278. package/src/ui/layout/types.ts +2 -0
  279. package/src/ui/legend/category/item.ts +14 -4
  280. package/src/ui/legend/category/items.ts +2 -0
  281. package/src/ui/legend/category.ts +4 -3
  282. package/src/ui/legend/continuous/ribbon.ts +4 -4
  283. package/src/ui/legend/continuous.ts +48 -29
  284. package/src/ui/marker/index.ts +5 -3
  285. package/src/ui/marker/types.ts +2 -0
  286. package/src/ui/navigator/index.ts +8 -1
  287. package/src/ui/navigator/types.ts +2 -0
  288. package/src/ui/scrollbar/index.ts +5 -1
  289. package/src/ui/scrollbar/types.ts +2 -0
  290. package/src/ui/select/option.ts +1 -1
  291. package/src/ui/select/select.ts +11 -9
  292. package/src/ui/select/types.ts +4 -0
  293. package/src/ui/slider/constant.ts +2 -0
  294. package/src/ui/slider/handle.ts +26 -14
  295. package/src/ui/slider/index.ts +20 -12
  296. package/src/ui/slider/types.ts +2 -0
  297. package/src/ui/sparkline/columns.ts +4 -1
  298. package/src/ui/sparkline/index.ts +10 -4
  299. package/src/ui/sparkline/lines.ts +4 -1
  300. package/src/ui/sparkline/types.ts +2 -0
  301. package/src/ui/switch/index.ts +1 -0
  302. package/src/ui/switch/types.ts +2 -0
  303. package/src/ui/tag/index.ts +1 -5
  304. package/src/ui/tag/types.ts +2 -0
  305. package/src/ui/timebar/controller.ts +8 -8
  306. package/src/ui/timebar/handle.ts +16 -10
  307. package/src/ui/timebar/icons.ts +94 -87
  308. package/src/ui/timebar/timebar.ts +13 -9
  309. package/src/ui/timebar/types.ts +4 -0
  310. package/src/ui/tooltip/types.ts +2 -0
  311. package/src/util/offscreen.ts +1 -0
  312. package/src/util/primitive.ts +0 -3
  313. package/src/util/scale-to-pixel.ts +3 -1
@@ -9,6 +9,8 @@ export type TooltipItem = {
9
9
  [key: string]: any;
10
10
  };
11
11
  export type TooltipStyleProps = GroupStyleProps & {
12
+ x?: number;
13
+ y?: number;
12
14
  data?: TooltipItem[];
13
15
  /** 标题 */
14
16
  title?: string;
@@ -1,4 +1,4 @@
1
1
  import type { GenericAnimation } from '../animation';
2
2
  import type { DisplayObject } from '../shapes';
3
3
  import type { Interpolatable } from './interpolate';
4
- export declare function keyframeInterpolate<T extends Interpolatable>(element: DisplayObject, from: T, to: T, options: GenericAnimation): import("@antv/g").IAnimation | null;
4
+ export declare function keyframeInterpolate<T extends Interpolatable>(element: DisplayObject, from: T, to: T, options: GenericAnimation): import("_@antv_g-lite@2.0.4@@antv/g-lite").IAnimation | null;
@@ -13,6 +13,7 @@ var OffscreenGroup = /** @class */ (function (_super) {
13
13
  args[_i] = arguments[_i];
14
14
  }
15
15
  var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(args), false)) || this;
16
+ _this.isMutationObserved = true;
16
17
  _this.addEventListener(g_1.ElementEvent.INSERTED, function () {
17
18
  (0, visibility_1.hide)(_this);
18
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"offscreen.js","sourceRoot":"src/","sources":["util/offscreen.ts"],"names":[],"mappings":";;;;AAAA,6BAAuC;AACvC,yCAAwC;AAExC,2CAAoC;AAEpC;IAA6B,0CAAK;IAChC;QAAY,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACxB,YAAA,MAAK,sDAAI,IAAI,mBAAE;QACf,KAAI,CAAC,gBAAgB,CAAC,gBAAY,CAAC,QAAQ,EAAE;YAC3C,IAAA,iBAAI,EAAC,KAAI,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;;IACL,CAAC;IACH,qBAAC;AAAD,CAAC,AAPD,CAA6B,aAAK,GAOjC;AAED,SAAgB,oBAAoB,CAAC,SAAwB;IAC3D,IAAM,KAAK,GAAG,SAAS,CAAC,WAAW,CACjC,IAAI,cAAc,CAAC;QACjB,KAAK,EAAE,WAAW;KACnB,CAAC,CACH,CAAC;IACF,IAAA,iBAAI,EAAC,KAAK,CAAC,CAAC;IACZ,OAAO,KAAK,CAAC;AACf,CAAC;AARD,oDAQC;AAED,SAAgB,kBAAkB,CAAC,KAAY;IAC7C,IAAI,QAAQ,GAAQ,KAAK,CAAC;IAC1B,OAAO,QAAQ,EAAE,CAAC;QAChB,IAAI,QAAQ,CAAC,SAAS,KAAK,WAAW,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AATD,gDASC"}
1
+ {"version":3,"file":"offscreen.js","sourceRoot":"src/","sources":["util/offscreen.ts"],"names":[],"mappings":";;;;AAAA,6BAAuC;AACvC,yCAAwC;AAExC,2CAAoC;AAEpC;IAA6B,0CAAK;IAChC;QAAY,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACxB,YAAA,MAAK,sDAAI,IAAI,mBAAE;QACf,KAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,KAAI,CAAC,gBAAgB,CAAC,gBAAY,CAAC,QAAQ,EAAE;YAC3C,IAAA,iBAAI,EAAC,KAAI,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;;IACL,CAAC;IACH,qBAAC;AAAD,CAAC,AARD,CAA6B,aAAK,GAQjC;AAED,SAAgB,oBAAoB,CAAC,SAAwB;IAC3D,IAAM,KAAK,GAAG,SAAS,CAAC,WAAW,CACjC,IAAI,cAAc,CAAC;QACjB,KAAK,EAAE,WAAW;KACnB,CAAC,CACH,CAAC;IACF,IAAA,iBAAI,EAAC,KAAK,CAAC,CAAC;IACZ,OAAO,KAAK,CAAC;AACf,CAAC;AARD,oDAQC;AAED,SAAgB,kBAAkB,CAAC,KAAY;IAC7C,IAAI,QAAQ,GAAQ,KAAK,CAAC;IAC1B,OAAO,QAAQ,EAAE,CAAC;QAChB,IAAI,QAAQ,CAAC,SAAS,KAAK,WAAW,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC7B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AATD,gDASC"}
@@ -3,12 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPrimitiveAttributes = exports.isPrimitiveAttribute = exports.PRIMILTIVE_ATTRIBUTES = void 0;
4
4
  exports.PRIMILTIVE_ATTRIBUTES = [
5
5
  '$el',
6
- 'anchor',
7
6
  'cx',
8
7
  'cy',
9
8
  'd',
10
- 'defX',
11
- 'defY',
12
9
  'dx',
13
10
  'dy',
14
11
  'fill',
@@ -1 +1 @@
1
- {"version":3,"file":"primitive.js","sourceRoot":"src/","sources":["util/primitive.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG;IACnC,KAAK;IACL,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,MAAM;IACN,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,aAAa;IACb,YAAY;IACZ,QAAQ;IACR,KAAK;IACL,iCAAiC;IACjC,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,UAAU;IACV,eAAe;IACf,SAAS;IACT,eAAe;IACf,UAAU;IACV,YAAY;IACZ,WAAW;IACX,WAAW;IACX,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,UAAU;IACV,SAAS;IACT,YAAY;IACZ,SAAS;IACT,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,GAAG;IACH,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,aAAa;IACb,KAAK;IACL,QAAQ;IACR,eAAe;IACf,MAAM;IACN,WAAW;IACX,cAAc;IACd,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;IACrB,cAAc;IACd,UAAU;IACV,cAAc;IACd,qBAAqB;IACrB,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,OAAO;IACP,UAAU;IACV,eAAe;IACf,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;CACT,CAAC;AAEF,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,OAAO,6BAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAFD,oDAEC;AAED,SAAgB,sBAAsB,CAAC,UAA+B;IACpE,IAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,KAAK,IAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,oBAAoB,CAAC,GAAG,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,wDAMC"}
1
+ {"version":3,"file":"primitive.js","sourceRoot":"src/","sources":["util/primitive.ts"],"names":[],"mappings":";;;AAAa,QAAA,qBAAqB,GAAG;IACnC,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,WAAW;IACX,aAAa;IACb,YAAY;IACZ,QAAQ;IACR,KAAK;IACL,iCAAiC;IACjC,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,UAAU;IACV,eAAe;IACf,SAAS;IACT,eAAe;IACf,UAAU;IACV,YAAY;IACZ,WAAW;IACX,WAAW;IACX,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,mBAAmB;IACnB,UAAU;IACV,SAAS;IACT,YAAY;IACZ,SAAS;IACT,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,GAAG;IACH,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,aAAa;IACb,KAAK;IACL,QAAQ;IACR,eAAe;IACf,MAAM;IACN,WAAW;IACX,cAAc;IACd,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;IACrB,cAAc;IACd,UAAU;IACV,cAAc;IACd,qBAAqB;IACrB,WAAW;IACX,iBAAiB;IACjB,YAAY;IACZ,OAAO;IACP,UAAU;IACV,eAAe;IACf,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,QAAQ;CACT,CAAC;AAEF,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,OAAO,6BAAqB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC7C,CAAC;AAFD,oDAEC;AAED,SAAgB,sBAAsB,CAAC,UAA+B;IACpE,IAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,KAAK,IAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,IAAI,oBAAoB,CAAC,GAAG,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAND,wDAMC"}
@@ -8,8 +8,9 @@ function scaleToPixel(el, size, applyScale) {
8
8
  if (applyScale === void 0) { applyScale = false; }
9
9
  var _a = el.getBBox(), width = _a.width, height = _a.height;
10
10
  var scale = size / Math.max(width, height);
11
- if (applyScale)
12
- el.scale(scale);
11
+ if (applyScale) {
12
+ el.style.transform = "scale(".concat(scale, ")");
13
+ }
13
14
  return scale;
14
15
  }
15
16
  exports.scaleToPixel = scaleToPixel;
@@ -1 +1 @@
1
- {"version":3,"file":"scale-to-pixel.js","sourceRoot":"src/","sources":["util/scale-to-pixel.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,YAAY,CAAC,EAAiB,EAAE,IAAY,EAAE,UAAkB;IAAlB,2BAAA,EAAA,kBAAkB;IACxE,IAAA,KAAoB,EAAE,CAAC,OAAO,EAAE,EAA9B,KAAK,WAAA,EAAE,MAAM,YAAiB,CAAC;IACvC,IAAM,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAI,UAAU;QAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,KAAK,CAAC;AACf,CAAC;AALD,oCAKC"}
1
+ {"version":3,"file":"scale-to-pixel.js","sourceRoot":"src/","sources":["util/scale-to-pixel.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,SAAgB,YAAY,CAAC,EAAiB,EAAE,IAAY,EAAE,UAAkB;IAAlB,2BAAA,EAAA,kBAAkB;IACxE,IAAA,KAAoB,EAAE,CAAC,OAAO,EAAE,EAA9B,KAAK,WAAA,EAAE,MAAM,YAAiB,CAAC;IACvC,IAAM,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAI,UAAU,EAAE,CAAC;QACf,EAAE,CAAC,KAAK,CAAC,SAAS,GAAG,gBAAS,KAAK,MAAG,CAAC;IACzC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAPD,oCAOC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/component",
3
- "version": "1.0.3",
3
+ "version": "2.0.1",
4
4
  "description": "Visualization components for AntV, based on G.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -44,16 +44,16 @@
44
44
  "component"
45
45
  ],
46
46
  "dependencies": {
47
- "@antv/g": "^5.18.6",
47
+ "@antv/g": "^6.0.5",
48
48
  "@antv/scale": "^0.4.3",
49
49
  "@antv/util": "^3.3.5",
50
50
  "svg-path-parser": "^1.1.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@antv/g-canvas": "^1.11.5",
54
- "@antv/g-plugin-control": "^1.9.6",
55
- "@antv/g-svg": "^1.10.20",
56
- "@antv/g-webgl": "^1.9.8",
53
+ "@antv/g-canvas": "^2.0.3",
54
+ "@antv/g-plugin-control": "^2.0.0",
55
+ "@antv/g-svg": "^2.0.3",
56
+ "@antv/g-webgl": "^2.0.3",
57
57
  "@babel/plugin-proposal-decorators": "^7.20.5",
58
58
  "@babel/plugin-transform-runtime": "^7.17.0",
59
59
  "@babel/preset-env": "^7.16.11",
@@ -96,25 +96,26 @@ export function transitionShape(
96
96
  const middle = Math.ceil(+duration / 2);
97
97
  const offset = +duration / 4;
98
98
 
99
- const getPosition = (shape: DisplayObject) => {
100
- if (shape.nodeName === 'circle') {
101
- const [cx, cy] = shape.getLocalPosition();
102
- const r = shape.attr('r');
103
- return [cx - r, cy - r];
104
- }
105
- return shape.getLocalPosition();
106
- };
107
-
108
- const [sx, sy] = getPosition(source);
109
- const [ex, ey] = getPosition(target);
99
+ const {
100
+ center: [sx, sy],
101
+ } = source.getGeometryBounds();
102
+ const {
103
+ center: [ex, ey],
104
+ } = target.getGeometryBounds();
110
105
  const [mx, my] = [(sx + ex) / 2 - sx, (sy + ey) / 2 - sy];
111
106
 
112
107
  const { opacity: so = 1 } = source.style;
113
108
  const { opacity: to = 1 } = target.style;
109
+
110
+ const st = source.style.transform || '';
111
+ const tt = target.style.transform || '';
112
+ // const st = source.style._transform || '';
113
+ // const tt = target.style._transform || '';
114
+
114
115
  const sourceAnimation = source.animate(
115
116
  [
116
- { opacity: so, transform: 'translate(0, 0)' },
117
- { opacity: 0, transform: `translate(${mx}, ${my})` },
117
+ { opacity: so, transform: `translate(0, 0) ${st}` },
118
+ { opacity: 0, transform: `translate(${mx}, ${my}) ${st}` },
118
119
  ],
119
120
  {
120
121
  fill: 'both',
@@ -124,8 +125,8 @@ export function transitionShape(
124
125
  );
125
126
  const targetAnimation = target.animate(
126
127
  [
127
- { opacity: 0, transform: `translate(${-mx}, ${-my})`, offset: 0.01 },
128
- { opacity: to, transform: 'translate(0, 0)' },
128
+ { opacity: 0, transform: `translate(${-mx}, ${-my}) ${tt}`, offset: 0.01 },
129
+ { opacity: to, transform: `translate(0, 0) ${tt}` },
129
130
  ],
130
131
  {
131
132
  fill: 'both',
package/src/index.ts CHANGED
@@ -1,7 +1,3 @@
1
- import { runtime } from '@antv/g';
2
-
3
- runtime.enableCSSParsing = false;
4
-
5
1
  // ui
6
2
  export * from './ui';
7
3
 
@@ -37,8 +37,7 @@ export const AXIS_BASE_DEFAULT_ATTR: Partial<AxisBaseStyleProps> = {
37
37
  lineArrow: () =>
38
38
  new Path({
39
39
  style: {
40
- path: [['M', 10, 10], ['L', -10, 0], ['L', 10, -10], ['L', 0, 0], ['L', 10, 10], ['Z']],
41
- anchor: '0.5 0.5',
40
+ d: [['M', 10, 10], ['L', -10, 0], ['L', 10, -10], ['L', 0, 0], ['L', 10, 10], ['Z']],
42
41
  fill: 'black',
43
42
  transformOrigin: 'center',
44
43
  },
@@ -187,24 +187,30 @@ function overlapHandler(attr: Required<AxisStyleProps>) {
187
187
  });
188
188
  }
189
189
 
190
- function renderLabel(container: DisplayObject, datum: any, data: any[], style: any, attr: Required<AxisStyleProps>) {
190
+ function renderLabel(
191
+ container: DisplayObject,
192
+ datum: any,
193
+ data: any[],
194
+ style: any,
195
+ attr: Required<AxisStyleProps>
196
+ ): DisplayObject {
191
197
  const index = data.indexOf(datum);
192
198
  const label = select(container)
193
199
  .append(formatter(datum, index, data, attr))
194
200
  .attr('className', CLASS_NAMES.labelItem.name)
195
201
  .node();
196
202
  const [labelStyle, { transform, ...groupStyle }] = splitStyle(getCallbackStyle(style, [datum, index, data]));
197
- percentTransform(container, transform);
198
203
 
199
- const rotate = getLabelRotation(datum, container, attr);
200
- container.setLocalEulerAngles(+rotate);
204
+ percentTransform(label, transform);
205
+ const rotate = getLabelRotation(datum, label, attr);
206
+ if (!label.getLocalEulerAngles()) {
207
+ label.setLocalEulerAngles(rotate);
208
+ }
201
209
 
202
210
  applyTextStyle(label, {
203
211
  ...getLabelStyle(datum.value, rotate, attr),
204
212
  ...labelStyle,
205
213
  });
206
- // todo G transform 存在问题,需要二次设置
207
- percentTransform(container, transform);
208
214
  container.attr(groupStyle);
209
215
  return label;
210
216
  }
@@ -227,24 +233,30 @@ export function renderLabels(
227
233
  .attr('className', CLASS_NAMES.label.name)
228
234
  .transition(function (datum) {
229
235
  renderLabel(this, datum, data, style, attr);
230
- this.attr(getLabelPos(datum, data, attr));
231
- this.__bbox__ = datum.bbox;
236
+ const { x, y } = getLabelPos(datum, data, attr);
237
+ // .axis-label
238
+ this.style.transform = `translate(${x}, ${y})`;
232
239
  return null;
233
240
  })
234
- .call(() => overlapHandler.call(container, attr)),
241
+ .call(() => {
242
+ overlapHandler.call(container, attr);
243
+ }),
235
244
  (update) =>
236
245
  update
237
246
  .transition(function (datum) {
238
247
  const prevLabel = this.querySelector(CLASS_NAMES.labelItem.class);
239
248
  const label = renderLabel(this, datum, data, style, attr);
240
249
  const shapeAnimation = transitionShape(prevLabel, label, animate.update);
241
- const animation = transition(this, getLabelPos(datum, data, attr), animate.update);
242
- this.__bbox__ = datum.bbox;
250
+ const { x, y } = getLabelPos(datum, data, attr);
251
+ const animation = transition(this, { transform: `translate(${x}, ${y})` }, animate.update);
243
252
  return [...shapeAnimation, animation];
253
+ // return [animation];
244
254
  })
245
255
  .call((selection) => {
246
256
  const transitions = get(selection, '_transitions').flat().filter(defined) as IAnimation[];
247
- onAnimatesFinished(transitions, () => overlapHandler.call(container, attr));
257
+ onAnimatesFinished(transitions, () => {
258
+ overlapHandler.call(container, attr);
259
+ });
248
260
  }),
249
261
  (exit) =>
250
262
  exit.transition(function () {
@@ -101,14 +101,14 @@ function renderArc(
101
101
 
102
102
  return container
103
103
  .selectAll(CLASS_NAMES.line.class)
104
- .data([{ path: getArcPath(startAngle, endAngle, ...center, radius) }], (d, i) => i)
104
+ .data([{ d: getArcPath(startAngle, endAngle, ...center, radius) }], (d, i) => i)
105
105
  .join(
106
106
  (enter) =>
107
107
  enter
108
108
  .append('path')
109
109
  .attr('className', CLASS_NAMES.line.name)
110
110
  .styles(attr)
111
- .styles({ path: (d: any) => d.path }),
111
+ .styles({ d: (d: any) => d.d }),
112
112
  (update) =>
113
113
  update
114
114
  .transition(function () {
@@ -121,7 +121,7 @@ function renderArc(
121
121
  if (animation) {
122
122
  const layout = () => {
123
123
  const data = get(this.attributes, '__keyframe_data__') as Parameters<typeof getArcPath>;
124
- this.style.path = getArcPath(...data);
124
+ this.style.d = getArcPath(...data);
125
125
  };
126
126
  animation.onframe = layout;
127
127
  animation.onfinish = layout;
@@ -77,7 +77,7 @@ function createTick(
77
77
  const tick = createTickEl(select(this), datum, index, data, attr);
78
78
  applyTickStyle(datum, index, data, tick, this, attr, tickAttr);
79
79
  const [x, y] = getValuePos(datum.value, attr);
80
- return transition(this, { x, y }, animate);
80
+ return transition(this, { transform: `translate(${x}, ${y})` }, animate);
81
81
  }
82
82
 
83
83
  export function renderTicks(
@@ -32,7 +32,9 @@ function getTitlePosition(
32
32
  halfExtents: [mainHalfWidth, mainHalfHeight],
33
33
  } = mainGroup.node().getLocalBounds();
34
34
 
35
- const [titleHalfWidth, titleHalfHeight] = titleGroup.node().getLocalBounds().halfExtents;
35
+ const {
36
+ halfExtents: [titleHalfWidth, titleHalfHeight],
37
+ } = titleGroup.node().getLocalBounds();
36
38
 
37
39
  let [x, y] = [mainX + mainHalfWidth, mainY + mainHalfHeight];
38
40
 
@@ -49,17 +51,16 @@ function getTitlePosition(
49
51
 
50
52
  if (pos.includes('t')) y -= mainHalfHeight + titleHalfHeight + spacingTop;
51
53
  if (pos.includes('r')) x += mainHalfWidth + titleHalfWidth + spacingRight;
52
- if (pos.includes('l')) x -= mainHalfWidth + titleHalfWidth * 2 + spacingLeft;
53
- if (pos.includes('b')) y += mainHalfHeight + titleHalfHeight * 2 + spacingBottom;
54
+ if (pos.includes('l')) x -= mainHalfWidth + titleHalfWidth + spacingLeft;
55
+ if (pos.includes('b')) y += mainHalfHeight + titleHalfHeight + spacingBottom;
54
56
 
55
57
  return { x, y };
56
58
  }
57
59
 
58
60
  function inferTransform(n: DisplayObject, direction: string, position: string): string {
59
- const node = n.cloneNode(true);
60
- node.style.transform = 'scale(1, 1)';
61
- node.style.transform = 'none';
62
- const { height } = node.getBBox();
61
+ const { halfExtents } = n.getGeometryBounds();
62
+ const height = halfExtents[1] * 2;
63
+
63
64
  if (direction === 'vertical') {
64
65
  if (position === 'left') return `rotate(-90) translate(0, ${height / 2})`;
65
66
  if (position === 'right') return `rotate(-90) translate(0, -${height / 2})`;
@@ -75,12 +76,12 @@ function applyTitleStyle(
75
76
  animate: GenericAnimation
76
77
  ) {
77
78
  const style = subStyleProps(attr, 'title');
78
- const [titleStyle, { transform: specified, ...groupStyle }] = splitStyle(style);
79
+ const [titleStyle, { transform: specified, transformOrigin, ...groupStyle }] = splitStyle(style);
79
80
 
80
- title.styles(titleStyle);
81
81
  group.styles(groupStyle);
82
82
 
83
83
  const transform = specified || inferTransform(title.node(), titleStyle.direction, titleStyle.position);
84
+ title.styles({ ...titleStyle, transformOrigin });
84
85
  percentTransform(title.node(), transform);
85
86
 
86
87
  const { x, y } = getTitlePosition(
@@ -90,8 +91,7 @@ function applyTitleStyle(
90
91
  attr
91
92
  );
92
93
 
93
- const animation = transition(group.node(), { x, y }, animate);
94
- percentTransform(title.node(), transform);
94
+ const animation = transition(group.node(), { transform: `translate(${x}, ${y})` }, animate);
95
95
  return animation;
96
96
  }
97
97
 
@@ -3,7 +3,6 @@ import type { DisplayObject } from '../../../shapes';
3
3
  import { Text } from '../../../shapes';
4
4
  import { getFont, measureTextWidth } from '../../../util';
5
5
  import { AxisStyleProps, EllipsisOverlapCfg } from '../types';
6
- import { getBBox } from '../utils/bounds';
7
6
  import { boundTest } from '../utils/test';
8
7
 
9
8
  export type Utils = {
@@ -40,7 +39,7 @@ export default function ellipseLabels(
40
39
  if (isNil(max) || max === Infinity) {
41
40
  max = Math.max.apply(
42
41
  null,
43
- labels.map((d) => getBBox(d).width)
42
+ labels.map((d) => d.getBBox().width)
44
43
  );
45
44
  }
46
45
  // Generally, 100 ticks cost less than 300ms. If cost time exceed, means ticks count is too large to see.
@@ -3,7 +3,6 @@ import { defined, getLocalBBox, hide } from '../../../util';
3
3
  import { isAxisHorizontal, isAxisVertical } from '../guides/line';
4
4
  import type { AxisStyleProps, HideOverlapCfg } from '../types';
5
5
  import { boundTest } from '../utils/test';
6
- import { getBBox } from '../utils/bounds';
7
6
 
8
7
  type Hide = (item: DisplayObject) => void;
9
8
  type Show = (item: DisplayObject) => void;
@@ -32,7 +31,7 @@ export default function hideLabels(
32
31
  const source = labels.slice();
33
32
  let target = labels.slice();
34
33
 
35
- const minLabelWidth = Math.min(1, ...labels.map((d) => getBBox(d).width));
34
+ const minLabelWidth = Math.min(1, ...labels.map((d) => d.getBBox().width));
36
35
 
37
36
  if (attr.type === 'linear' && (isAxisHorizontal(attr) || isAxisVertical(attr))) {
38
37
  const minX = getLocalBBox(labels[0]).left;
@@ -78,6 +78,9 @@ export class Bounds {
78
78
  }
79
79
  }
80
80
 
81
+ /**
82
+ * Can't use getBounds directly since we should not use AABB here.
83
+ */
81
84
  export function getBounds(item: DisplayObject<any>, margin?: SeriesAttr) {
82
85
  const angle = item.getEulerAngles() || 0;
83
86
  item.setEulerAngles(0);
@@ -85,8 +88,8 @@ export function getBounds(item: DisplayObject<any>, margin?: SeriesAttr) {
85
88
  const {
86
89
  min: [x, y],
87
90
  max: [right, bottom],
88
- } = item.getLocalBounds();
89
- const { width: w, height: h } = getBBox(item);
91
+ } = item.getBounds();
92
+ const { width: w, height: h } = item.getBBox();
90
93
 
91
94
  let height = h;
92
95
  let dx = 0;
@@ -122,11 +125,6 @@ export function getBounds(item: DisplayObject<any>, margin?: SeriesAttr) {
122
125
  const [t = 0, r = 0, b = t, l = r] = parseSeriesAttr(margin);
123
126
  const bounds = new Bounds((dx += x) - l, (dy += y) - t, dx + w + r, dy + height + b);
124
127
  item.setEulerAngles(angle);
125
- return bounds.rotatedPoints(degToRad(angle), anchorX, anchorY);
126
- }
127
128
 
128
- export function getBBox(shape: DisplayObject): DOMRect {
129
- // @ts-ignore
130
- if (shape.__bbox__) return shape.__bbox__;
131
- return shape.getBBox();
129
+ return bounds.rotatedPoints(degToRad(angle), anchorX, anchorY);
132
130
  }
@@ -57,8 +57,10 @@ export function boundTest<T extends DisplayObject>(items: T[], attr: AxisStylePr
57
57
  };
58
58
 
59
59
  const testIntersect = (prevItem: T, currItem: T) => {
60
- if (!prevItem) return true;
61
- return !intersect(prevItem, currItem, parseSeriesAttr(margin));
60
+ if (!prevItem || !prevItem.firstChild) return true;
61
+ // Get the first child of the item(Text).
62
+ // @ts-ignore
63
+ return !intersect(prevItem.firstChild, currItem.firstChild, parseSeriesAttr(margin));
62
64
  };
63
65
 
64
66
  for (const curr of items) {
@@ -69,8 +69,7 @@ export class Breadcrumb extends Component<BreadcrumbStyleProps> {
69
69
  const shape = new Tag({
70
70
  className: 'breadcrumb-item',
71
71
  style: {
72
- x: cursorX,
73
- y: cursorY,
72
+ transform: `translate(${cursorX}, ${cursorY})`,
74
73
  ...tagStyle,
75
74
  text: isNil(datum.text) ? datum.id : datum.text,
76
75
  ...pick(datum, ['marker']),
@@ -88,7 +87,7 @@ export class Breadcrumb extends Component<BreadcrumbStyleProps> {
88
87
  if (!isNil(width)) {
89
88
  const avaliableWidth = width! - right;
90
89
  if (cursorX > avaliableWidth) {
91
- shape.attr({ x: 0, y: cursorY + shapeH });
90
+ shape.attr({ transform: `translateY(${cursorY + shapeH})` });
92
91
  // 更新光标
93
92
  cursorX = shapeW;
94
93
  cursorY += shapeH;
@@ -95,8 +95,10 @@ export class Button extends Component<ButtonStyleProps> {
95
95
 
96
96
  // @todo 处理 markerAlign='right' 的场景. 方案: left marker & right marker 处理为两个 shape, 互相不干扰
97
97
  public render(attributes: Required<ButtonStyleProps>, container: Group) {
98
- const { text = '', padding = 0, markerSymbol, markerSpacing = 0 } = attributes;
99
- container.attr('cursor', this.state === 'disabled' ? 'not-allowed' : 'pointer');
98
+ const { text = '', padding = 0, markerSymbol, markerSpacing = 0, x = 0, y = 0 } = attributes;
99
+ container.attr({
100
+ cursor: this.state === 'disabled' ? 'not-allowed' : 'pointer',
101
+ });
100
102
  const [pt, pr, pb, pl] = parseSeriesAttr(padding);
101
103
  const height = this.buttonHeight;
102
104
 
@@ -106,8 +108,8 @@ export class Button extends Component<ButtonStyleProps> {
106
108
  const style = {
107
109
  ...markerStyle,
108
110
  symbol: markerSymbol,
109
- x: pl + markerSize / 2,
110
- y: height / 2,
111
+ x: x + pl + markerSize / 2,
112
+ y: y + height / 2,
111
113
  size: markerSize,
112
114
  };
113
115
  const markerShape = maybeAppend(container, '.marker', () => new Marker({ className: 'marker', style }))
@@ -120,8 +122,8 @@ export class Button extends Component<ButtonStyleProps> {
120
122
  this.textShape = maybeAppend(container, '.text', 'text')
121
123
  .attr('className', 'text')
122
124
  .styles({
123
- x: markerSize ? bounds.max[0] + markerSpacing : pl,
124
- y: height / 2,
125
+ x: x + (markerSize ? bounds.max[0] + markerSpacing : pl),
126
+ y: y + height / 2,
125
127
  ...textStyle,
126
128
  text,
127
129
  textAlign: 'left',
@@ -141,6 +143,8 @@ export class Button extends Component<ButtonStyleProps> {
141
143
  .styles({
142
144
  zIndex: -1,
143
145
  ...buttonStyle,
146
+ x,
147
+ y,
144
148
  height,
145
149
  width: pl + (markerSize ? markerSize + markerSpacing : 0) + textBounds.halfExtents[0] * 2 + pr,
146
150
  });
@@ -13,6 +13,8 @@ export type ButtonStyleProps = GroupStyleProps &
13
13
  Partial<PrefixStyleProps<RectStyleProps, 'button'>> &
14
14
  Partial<PrefixStyleProps<Omit<MarkerStyleProps, 'symbol'>, 'marker'>>
15
15
  > & {
16
+ x?: number;
17
+ y?: number;
16
18
  type?: 'primary' | 'dashed' | 'link' | 'text' | 'default';
17
19
  /**
18
20
  * @title 大小
@@ -42,7 +42,7 @@ const CHECKED_SHAPE_PATH = [
42
42
  ] as any;
43
43
 
44
44
  export const CHECKED_SHAPE_STYLE = {
45
- path: CHECKED_SHAPE_PATH,
45
+ d: CHECKED_SHAPE_PATH,
46
46
  lineWidth: 1,
47
47
  cursor: 'pointer',
48
48
  };
@@ -30,8 +30,6 @@ export class Checkbox extends Component<CheckboxStyleProps> {
30
30
 
31
31
  constructor(options: CheckboxOptions) {
32
32
  super(options, {
33
- x: 0,
34
- y: 0,
35
33
  labelText: '',
36
34
  spacing: 4,
37
35
  checked: false,
@@ -43,7 +43,7 @@ export abstract class CrosshairBase<T extends CrosshairBaseStyleProps> extends C
43
43
  const style = subStyleProps(this.attributes, 'line');
44
44
  return {
45
45
  ...style,
46
- path: this.crosshairPath,
46
+ d: this.crosshairPath,
47
47
  };
48
48
  }
49
49
 
@@ -34,7 +34,7 @@ export class CircleCrosshair extends CrosshairBase<Required<CircleCrosshairStyle
34
34
  } = this.attributes;
35
35
 
36
36
  const path = this.createCirclePath(((lx - cx) ** 2 + (ly - cy) ** 2) ** 0.5) as any;
37
- this.crosshairShape.attr({ path });
37
+ this.crosshairShape.attr({ d: path });
38
38
  }
39
39
 
40
40
  protected adjustLayout() {
@@ -54,7 +54,7 @@ export class PolygonCrosshair extends CrosshairBase<Required<PolygonCrosshairSty
54
54
  if (!ix || !iy) return;
55
55
  const equivalentRadius = lineLen(center, [lx, ly]) / lineLen(center, [ix, iy]);
56
56
  const path = this.createPolygonPath(equivalentRadius) as any;
57
- this.crosshairShape.attr({ path });
57
+ this.crosshairShape.attr({ d: path });
58
58
  }
59
59
 
60
60
  protected adjustLayout() {
@@ -79,7 +79,7 @@ function renderGridLine(
79
79
  const lines = data.map((item, idx) => {
80
80
  return {
81
81
  id: item.id || `grid-line-${idx}`,
82
- path: getLinePath(item.points, attr),
82
+ d: getLinePath(item.points, attr),
83
83
  };
84
84
  });
85
85
  return container
@@ -90,7 +90,7 @@ function renderGridLine(
90
90
  enter.append('path').each(function (datum, index) {
91
91
  const lineStyle = getCallbackValue(
92
92
  getPrimitiveAttributes({
93
- path: datum.path,
93
+ d: datum.d,
94
94
  ...style,
95
95
  }),
96
96
  [datum, index, lines]
@@ -108,7 +108,7 @@ function renderGridLine(
108
108
  update.transition(function (datum, index) {
109
109
  const lineStyle = getCallbackValue(
110
110
  getPrimitiveAttributes({
111
- path: datum.path,
111
+ d: datum.d,
112
112
  ...style,
113
113
  }),
114
114
  [datum, index, lines]
@@ -134,7 +134,7 @@ function renderAlternateRegion(container: Selection<Group>, data: GridStyleProps
134
134
  for (let idx = 0; idx < data.length - 1; idx++) {
135
135
  const [prev, curr] = [data[idx].points, data[idx + 1].points];
136
136
  const path = connectPaths(prev, curr, style);
137
- regions.push({ path, fill: getColor(idx) });
137
+ regions.push({ d: path, fill: getColor(idx) });
138
138
  }
139
139
 
140
140
  return container
@@ -58,7 +58,7 @@ export class Indicator extends Component<IndicatorStyleProps> {
58
58
 
59
59
  this.background = select(this.group)
60
60
  .maybeAppendByClassName(CLASS_NAMES.background, 'path')
61
- .styles({ ...style, path });
61
+ .styles({ ...style, d: path });
62
62
  this.group.appendChild(this.label.node());
63
63
  }
64
64
 
@@ -78,7 +78,8 @@ export class Indicator extends Component<IndicatorStyleProps> {
78
78
 
79
79
  private adjustLayout() {
80
80
  const [dx, dy] = this.point;
81
- this.group.attr('x', -dx).attr('y', -dy);
81
+ const { x, y } = this.attributes;
82
+ this.group.attr('transform', `translate(${x - dx}, ${y - dy})`);
82
83
  }
83
84
 
84
85
  private getPath(position: Position, bbox: BBox) {
@@ -8,6 +8,8 @@ export type Position = 'top' | 'right' | 'bottom' | 'left';
8
8
  export type IndicatorStyleProps<T = any> = GroupStyleProps &
9
9
  PrefixObject<PathStyleProps, 'background'> &
10
10
  PrefixObject<Omit<TextStyleProps, 'text'>, 'label'> & {
11
+ x: number;
12
+ y: number;
11
13
  labelText?: T;
12
14
  /** position of indicator related to pointer */
13
15
  position?: Position;
@@ -71,6 +71,9 @@ export class Layout extends Group {
71
71
  if (!this.attributes.display || !this.isConnected) return;
72
72
  if (this.children.some((child) => !child.isConnected)) return;
73
73
  try {
74
+ const { x, y } = this.attributes;
75
+ this.style.transform = `translate(${x}, ${y})`;
76
+
74
77
  const bboxes = calcLayout(
75
78
  this.getAvailableSpace(),
76
79
  this.children.map((child) => (child as DisplayObject).getBBox()),
@@ -79,7 +82,7 @@ export class Layout extends Group {
79
82
 
80
83
  this.children.forEach((child, index) => {
81
84
  const { x, y } = bboxes[index];
82
- (child as DisplayObject).attr({ x, y });
85
+ child.style.transform = `translate(${x}, ${y})`;
83
86
  });
84
87
  } catch (e) {
85
88
  // do nothing