@antv/g6 5.0.0-beta.33 → 5.0.0-beta.35

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 (514) hide show
  1. package/dist/g6.min.js +2 -2
  2. package/dist/lib/animations/types.d.ts +3 -4
  3. package/dist/lib/behaviors/base-behavior.d.ts +2 -1
  4. package/dist/lib/behaviors/brush-select.d.ts +33 -16
  5. package/dist/lib/behaviors/click-element.d.ts +28 -5
  6. package/dist/lib/behaviors/collapse-expand.d.ts +3 -2
  7. package/dist/lib/behaviors/create-edge.d.ts +1 -2
  8. package/dist/lib/behaviors/drag-canvas.d.ts +7 -0
  9. package/dist/lib/behaviors/drag-element-force.d.ts +1 -2
  10. package/dist/lib/behaviors/drag-element.d.ts +4 -5
  11. package/dist/lib/behaviors/index.d.ts +2 -0
  12. package/dist/lib/behaviors/lasso-select.d.ts +4 -4
  13. package/dist/lib/behaviors/scroll-canvas.d.ts +64 -0
  14. package/dist/lib/behaviors/types.d.ts +2 -1
  15. package/dist/lib/behaviors/zoom-canvas.d.ts +1 -1
  16. package/dist/lib/constants/events/animation.d.ts +1 -4
  17. package/dist/lib/constants/events/graph.d.ts +5 -1
  18. package/dist/lib/elements/combos/base-combo.d.ts +1 -1
  19. package/dist/lib/elements/edges/base-edge.d.ts +0 -5
  20. package/dist/lib/elements/nodes/base-node.d.ts +3 -10
  21. package/dist/lib/elements/nodes/donut.d.ts +45 -0
  22. package/dist/lib/elements/nodes/html.d.ts +27 -0
  23. package/dist/lib/elements/nodes/index.d.ts +4 -0
  24. package/dist/lib/elements/shapes/badge.d.ts +1 -1
  25. package/dist/lib/{plugins/hull/shape.d.ts → elements/shapes/contour.d.ts} +17 -17
  26. package/dist/lib/elements/shapes/index.d.ts +2 -0
  27. package/dist/lib/exports.d.ts +15 -22
  28. package/dist/lib/plugins/bubble-sets.d.ts +45 -0
  29. package/dist/lib/plugins/camera-setting.d.ts +4 -2
  30. package/dist/lib/plugins/contextmenu.d.ts +1 -0
  31. package/dist/lib/plugins/grid-line.d.ts +51 -8
  32. package/dist/lib/plugins/hull/index.d.ts +44 -13
  33. package/dist/lib/plugins/index.d.ts +4 -0
  34. package/dist/lib/plugins/timebar.d.ts +225 -0
  35. package/dist/lib/plugins/tooltip.d.ts +2 -2
  36. package/dist/lib/registry/index.d.ts +1 -1
  37. package/dist/lib/runtime/data.d.ts +13 -7
  38. package/dist/lib/runtime/element.d.ts +6 -10
  39. package/dist/lib/runtime/graph.d.ts +532 -45
  40. package/dist/lib/runtime/types.d.ts +3 -3
  41. package/dist/lib/runtime/viewport.d.ts +3 -4
  42. package/dist/lib/spec/canvas.d.ts +6 -2
  43. package/dist/lib/spec/data.d.ts +74 -1
  44. package/dist/lib/spec/element/combo.d.ts +17 -6
  45. package/dist/lib/spec/element/edge.d.ts +14 -2
  46. package/dist/lib/spec/element/node.d.ts +19 -3
  47. package/{lib/spec/spec.d.ts → dist/lib/spec/graph.d.ts} +12 -4
  48. package/dist/lib/spec/index.d.ts +1 -1
  49. package/dist/lib/spec/theme.d.ts +1 -4
  50. package/dist/lib/spec/viewport.d.ts +1 -1
  51. package/dist/lib/themes/base.d.ts +1 -0
  52. package/dist/lib/themes/types.d.ts +0 -1
  53. package/dist/lib/transforms/process-parallel-edges.d.ts +2 -3
  54. package/dist/lib/transforms/types.d.ts +1 -1
  55. package/dist/lib/types/callable.d.ts +2 -2
  56. package/dist/lib/types/data.d.ts +3 -3
  57. package/dist/lib/types/id.d.ts +1 -0
  58. package/dist/lib/types/index.d.ts +1 -0
  59. package/dist/lib/types/style.d.ts +1 -3
  60. package/dist/lib/types/viewport.d.ts +4 -4
  61. package/dist/lib/utils/animation.d.ts +6 -6
  62. package/dist/lib/utils/behaviors/brush.d.ts +1 -2
  63. package/dist/lib/utils/behaviors/lasso.d.ts +1 -2
  64. package/dist/lib/utils/behaviors/utils.d.ts +1 -1
  65. package/dist/lib/utils/data.d.ts +2 -2
  66. package/dist/lib/utils/edge.d.ts +1 -2
  67. package/dist/lib/utils/element.d.ts +1 -1
  68. package/dist/lib/utils/event/events.d.ts +1 -1
  69. package/dist/lib/utils/event/index.d.ts +1 -1
  70. package/dist/lib/utils/id.d.ts +2 -3
  71. package/dist/lib/utils/palette.d.ts +2 -3
  72. package/dist/lib/utils/relation.d.ts +3 -4
  73. package/dist/lib/utils/visibility.d.ts +1 -1
  74. package/esm/animations/types.d.ts +3 -4
  75. package/esm/behaviors/base-behavior.d.ts +2 -1
  76. package/esm/behaviors/brush-select.d.ts +33 -16
  77. package/esm/behaviors/brush-select.js +7 -2
  78. package/esm/behaviors/brush-select.js.map +1 -1
  79. package/esm/behaviors/click-element.d.ts +28 -5
  80. package/esm/behaviors/click-element.js +11 -0
  81. package/esm/behaviors/click-element.js.map +1 -1
  82. package/esm/behaviors/collapse-expand.d.ts +3 -2
  83. package/esm/behaviors/collapse-expand.js +2 -2
  84. package/esm/behaviors/collapse-expand.js.map +1 -1
  85. package/esm/behaviors/create-edge.d.ts +1 -2
  86. package/esm/behaviors/create-edge.js.map +1 -1
  87. package/esm/behaviors/drag-canvas.d.ts +7 -0
  88. package/esm/behaviors/drag-canvas.js.map +1 -1
  89. package/esm/behaviors/drag-element-force.d.ts +1 -2
  90. package/esm/behaviors/drag-element-force.js.map +1 -1
  91. package/esm/behaviors/drag-element.d.ts +4 -5
  92. package/esm/behaviors/drag-element.js.map +1 -1
  93. package/esm/behaviors/focus-element.js.map +1 -1
  94. package/esm/behaviors/hover-element.js.map +1 -1
  95. package/esm/behaviors/index.d.ts +2 -0
  96. package/esm/behaviors/index.js +1 -0
  97. package/esm/behaviors/index.js.map +1 -1
  98. package/esm/behaviors/lasso-select.d.ts +4 -4
  99. package/esm/behaviors/lasso-select.js +1 -1
  100. package/esm/behaviors/lasso-select.js.map +1 -1
  101. package/esm/behaviors/scroll-canvas.d.ts +64 -0
  102. package/esm/behaviors/scroll-canvas.js +80 -0
  103. package/esm/behaviors/scroll-canvas.js.map +1 -0
  104. package/esm/behaviors/types.d.ts +2 -1
  105. package/esm/behaviors/zoom-canvas.d.ts +1 -1
  106. package/esm/constants/events/animation.d.ts +1 -4
  107. package/esm/constants/events/animation.js +0 -4
  108. package/esm/constants/events/animation.js.map +1 -1
  109. package/esm/constants/events/graph.d.ts +5 -1
  110. package/esm/constants/events/graph.js +4 -0
  111. package/esm/constants/events/graph.js.map +1 -1
  112. package/esm/elements/combos/base-combo.d.ts +1 -1
  113. package/esm/elements/edges/base-edge.d.ts +0 -5
  114. package/esm/elements/edges/base-edge.js +1 -2
  115. package/esm/elements/edges/base-edge.js.map +1 -1
  116. package/esm/elements/nodes/base-node.d.ts +3 -10
  117. package/esm/elements/nodes/base-node.js +2 -2
  118. package/esm/elements/nodes/base-node.js.map +1 -1
  119. package/esm/elements/nodes/donut.d.ts +45 -0
  120. package/esm/elements/nodes/donut.js +81 -0
  121. package/esm/elements/nodes/donut.js.map +1 -0
  122. package/esm/elements/nodes/html.d.ts +27 -0
  123. package/esm/elements/nodes/html.js +209 -0
  124. package/esm/elements/nodes/html.js.map +1 -0
  125. package/esm/elements/nodes/index.d.ts +4 -0
  126. package/esm/elements/nodes/index.js +2 -0
  127. package/esm/elements/nodes/index.js.map +1 -1
  128. package/esm/elements/shapes/badge.d.ts +1 -1
  129. package/esm/{plugins/hull/shape.d.ts → elements/shapes/contour.d.ts} +17 -17
  130. package/esm/{plugins/hull/shape.js → elements/shapes/contour.js} +12 -11
  131. package/esm/elements/shapes/contour.js.map +1 -0
  132. package/esm/elements/shapes/index.d.ts +2 -0
  133. package/esm/elements/shapes/index.js +1 -0
  134. package/esm/elements/shapes/index.js.map +1 -1
  135. package/esm/exports.d.ts +15 -22
  136. package/esm/exports.js +8 -18
  137. package/esm/exports.js.map +1 -1
  138. package/esm/plugins/bubble-sets.d.ts +45 -0
  139. package/esm/plugins/bubble-sets.js +212 -0
  140. package/esm/plugins/bubble-sets.js.map +1 -0
  141. package/esm/plugins/camera-setting.d.ts +4 -2
  142. package/esm/plugins/camera-setting.js.map +1 -1
  143. package/esm/plugins/contextmenu.d.ts +1 -0
  144. package/esm/plugins/contextmenu.js +1 -0
  145. package/esm/plugins/contextmenu.js.map +1 -1
  146. package/esm/plugins/grid-line.d.ts +51 -8
  147. package/esm/plugins/grid-line.js.map +1 -1
  148. package/esm/plugins/history/utils.js +6 -2
  149. package/esm/plugins/history/utils.js.map +1 -1
  150. package/esm/plugins/hull/index.d.ts +44 -13
  151. package/esm/plugins/hull/index.js +46 -16
  152. package/esm/plugins/hull/index.js.map +1 -1
  153. package/esm/plugins/index.d.ts +4 -0
  154. package/esm/plugins/index.js +2 -0
  155. package/esm/plugins/index.js.map +1 -1
  156. package/esm/plugins/legend.js +4 -2
  157. package/esm/plugins/legend.js.map +1 -1
  158. package/esm/plugins/timebar.d.ts +225 -0
  159. package/esm/plugins/timebar.js +253 -0
  160. package/esm/plugins/timebar.js.map +1 -0
  161. package/esm/plugins/tooltip.d.ts +2 -2
  162. package/esm/registry/build-in.js +15 -10
  163. package/esm/registry/build-in.js.map +1 -1
  164. package/esm/registry/index.d.ts +1 -1
  165. package/esm/registry/index.js +1 -1
  166. package/esm/runtime/canvas.js +7 -4
  167. package/esm/runtime/canvas.js.map +1 -1
  168. package/esm/runtime/data.d.ts +13 -7
  169. package/esm/runtime/data.js +20 -3
  170. package/esm/runtime/data.js.map +1 -1
  171. package/esm/runtime/element.d.ts +6 -10
  172. package/esm/runtime/element.js +65 -46
  173. package/esm/runtime/element.js.map +1 -1
  174. package/esm/runtime/graph.d.ts +532 -45
  175. package/esm/runtime/graph.js +418 -40
  176. package/esm/runtime/graph.js.map +1 -1
  177. package/esm/runtime/layout.js +2 -2
  178. package/esm/runtime/layout.js.map +1 -1
  179. package/esm/runtime/types.d.ts +3 -3
  180. package/esm/runtime/viewport.d.ts +3 -4
  181. package/esm/runtime/viewport.js +2 -2
  182. package/esm/runtime/viewport.js.map +1 -1
  183. package/esm/spec/canvas.d.ts +6 -2
  184. package/esm/spec/data.d.ts +74 -1
  185. package/esm/spec/element/combo.d.ts +17 -6
  186. package/esm/spec/element/edge.d.ts +14 -2
  187. package/esm/spec/element/node.d.ts +19 -3
  188. package/esm/spec/{spec.d.ts → graph.d.ts} +12 -4
  189. package/esm/spec/graph.js +2 -0
  190. package/esm/spec/graph.js.map +1 -0
  191. package/esm/spec/index.d.ts +1 -1
  192. package/esm/spec/theme.d.ts +1 -4
  193. package/esm/spec/viewport.d.ts +1 -1
  194. package/esm/themes/base.d.ts +1 -0
  195. package/esm/themes/base.js +11 -9
  196. package/esm/themes/base.js.map +1 -1
  197. package/esm/themes/types.d.ts +0 -1
  198. package/esm/transforms/process-parallel-edges.d.ts +2 -3
  199. package/esm/transforms/process-parallel-edges.js +2 -4
  200. package/esm/transforms/process-parallel-edges.js.map +1 -1
  201. package/esm/transforms/types.d.ts +1 -1
  202. package/esm/transforms/update-related-edge.js.map +1 -1
  203. package/esm/types/callable.d.ts +2 -2
  204. package/esm/types/data.d.ts +3 -3
  205. package/esm/types/id.d.ts +1 -0
  206. package/esm/types/id.js +2 -0
  207. package/esm/types/id.js.map +1 -0
  208. package/esm/types/index.d.ts +1 -0
  209. package/esm/types/style.d.ts +1 -3
  210. package/esm/types/viewport.d.ts +4 -4
  211. package/esm/utils/animation.d.ts +6 -6
  212. package/esm/utils/animation.js +3 -3
  213. package/esm/utils/animation.js.map +1 -1
  214. package/esm/utils/behaviors/brush.d.ts +1 -2
  215. package/esm/utils/behaviors/brush.js.map +1 -1
  216. package/esm/utils/behaviors/lasso.d.ts +1 -2
  217. package/esm/utils/behaviors/lasso.js.map +1 -1
  218. package/esm/utils/behaviors/utils.d.ts +1 -1
  219. package/esm/utils/change.js +8 -1
  220. package/esm/utils/change.js.map +1 -1
  221. package/esm/utils/data.d.ts +2 -2
  222. package/esm/utils/data.js +2 -2
  223. package/esm/utils/edge.d.ts +1 -2
  224. package/esm/utils/edge.js.map +1 -1
  225. package/esm/utils/element.d.ts +1 -1
  226. package/esm/utils/element.js +2 -2
  227. package/esm/utils/event/events.d.ts +1 -1
  228. package/esm/utils/event/events.js.map +1 -1
  229. package/esm/utils/event/index.d.ts +1 -1
  230. package/esm/utils/event/index.js +1 -1
  231. package/esm/utils/id.d.ts +2 -3
  232. package/esm/utils/id.js.map +1 -1
  233. package/esm/utils/palette.d.ts +2 -3
  234. package/esm/utils/palette.js +1 -1
  235. package/esm/utils/palette.js.map +1 -1
  236. package/esm/utils/relation.d.ts +3 -4
  237. package/esm/utils/relation.js +2 -2
  238. package/esm/utils/relation.js.map +1 -1
  239. package/esm/utils/style.js +3 -3
  240. package/esm/utils/style.js.map +1 -1
  241. package/esm/utils/visibility.d.ts +1 -1
  242. package/esm/utils/visibility.js +1 -1
  243. package/lib/animations/types.d.ts +3 -4
  244. package/lib/behaviors/base-behavior.d.ts +2 -1
  245. package/lib/behaviors/brush-select.d.ts +33 -16
  246. package/lib/behaviors/brush-select.js +7 -2
  247. package/lib/behaviors/brush-select.js.map +1 -1
  248. package/lib/behaviors/click-element.d.ts +28 -5
  249. package/lib/behaviors/click-element.js +11 -0
  250. package/lib/behaviors/click-element.js.map +1 -1
  251. package/lib/behaviors/collapse-expand.d.ts +3 -2
  252. package/lib/behaviors/collapse-expand.js +2 -2
  253. package/lib/behaviors/collapse-expand.js.map +1 -1
  254. package/lib/behaviors/create-edge.d.ts +1 -2
  255. package/lib/behaviors/create-edge.js.map +1 -1
  256. package/lib/behaviors/drag-canvas.d.ts +7 -0
  257. package/lib/behaviors/drag-canvas.js.map +1 -1
  258. package/lib/behaviors/drag-element-force.d.ts +1 -2
  259. package/lib/behaviors/drag-element-force.js.map +1 -1
  260. package/lib/behaviors/drag-element.d.ts +4 -5
  261. package/lib/behaviors/drag-element.js.map +1 -1
  262. package/lib/behaviors/focus-element.js.map +1 -1
  263. package/lib/behaviors/hover-element.js.map +1 -1
  264. package/lib/behaviors/index.d.ts +2 -0
  265. package/lib/behaviors/index.js +3 -1
  266. package/lib/behaviors/index.js.map +1 -1
  267. package/lib/behaviors/lasso-select.d.ts +4 -4
  268. package/lib/behaviors/lasso-select.js +1 -1
  269. package/lib/behaviors/lasso-select.js.map +1 -1
  270. package/lib/behaviors/scroll-canvas.d.ts +64 -0
  271. package/lib/behaviors/scroll-canvas.js +84 -0
  272. package/lib/behaviors/scroll-canvas.js.map +1 -0
  273. package/lib/behaviors/types.d.ts +2 -1
  274. package/lib/behaviors/zoom-canvas.d.ts +1 -1
  275. package/lib/constants/events/animation.d.ts +1 -4
  276. package/lib/constants/events/animation.js +0 -4
  277. package/lib/constants/events/animation.js.map +1 -1
  278. package/lib/constants/events/graph.d.ts +5 -1
  279. package/lib/constants/events/graph.js +4 -0
  280. package/lib/constants/events/graph.js.map +1 -1
  281. package/lib/elements/combos/base-combo.d.ts +1 -1
  282. package/lib/elements/edges/base-edge.d.ts +0 -5
  283. package/lib/elements/edges/base-edge.js +1 -2
  284. package/lib/elements/edges/base-edge.js.map +1 -1
  285. package/lib/elements/nodes/base-node.d.ts +3 -10
  286. package/lib/elements/nodes/base-node.js +2 -2
  287. package/lib/elements/nodes/base-node.js.map +1 -1
  288. package/lib/elements/nodes/donut.d.ts +45 -0
  289. package/lib/elements/nodes/donut.js +85 -0
  290. package/lib/elements/nodes/donut.js.map +1 -0
  291. package/lib/elements/nodes/html.d.ts +27 -0
  292. package/lib/elements/nodes/html.js +213 -0
  293. package/lib/elements/nodes/html.js.map +1 -0
  294. package/lib/elements/nodes/index.d.ts +4 -0
  295. package/lib/elements/nodes/index.js +5 -1
  296. package/lib/elements/nodes/index.js.map +1 -1
  297. package/lib/elements/shapes/badge.d.ts +1 -1
  298. package/lib/{plugins/hull/shape.d.ts → elements/shapes/contour.d.ts} +17 -17
  299. package/lib/{plugins/hull/shape.js → elements/shapes/contour.js} +15 -14
  300. package/lib/elements/shapes/contour.js.map +1 -0
  301. package/lib/elements/shapes/index.d.ts +2 -0
  302. package/lib/elements/shapes/index.js +3 -1
  303. package/lib/elements/shapes/index.js.map +1 -1
  304. package/lib/exports.d.ts +15 -22
  305. package/lib/exports.js +50 -17
  306. package/lib/exports.js.map +1 -1
  307. package/lib/plugins/bubble-sets.d.ts +45 -0
  308. package/lib/plugins/bubble-sets.js +216 -0
  309. package/lib/plugins/bubble-sets.js.map +1 -0
  310. package/lib/plugins/camera-setting.d.ts +4 -2
  311. package/lib/plugins/camera-setting.js.map +1 -1
  312. package/lib/plugins/contextmenu.d.ts +1 -0
  313. package/lib/plugins/contextmenu.js +1 -0
  314. package/lib/plugins/contextmenu.js.map +1 -1
  315. package/lib/plugins/grid-line.d.ts +51 -8
  316. package/lib/plugins/grid-line.js.map +1 -1
  317. package/lib/plugins/history/utils.js +6 -2
  318. package/lib/plugins/history/utils.js.map +1 -1
  319. package/lib/plugins/hull/index.d.ts +44 -13
  320. package/lib/plugins/hull/index.js +46 -16
  321. package/lib/plugins/hull/index.js.map +1 -1
  322. package/lib/plugins/index.d.ts +4 -0
  323. package/lib/plugins/index.js +5 -1
  324. package/lib/plugins/index.js.map +1 -1
  325. package/lib/plugins/legend.js +4 -2
  326. package/lib/plugins/legend.js.map +1 -1
  327. package/lib/plugins/timebar.d.ts +225 -0
  328. package/lib/plugins/timebar.js +257 -0
  329. package/lib/plugins/timebar.js.map +1 -0
  330. package/lib/plugins/tooltip.d.ts +2 -2
  331. package/lib/registry/build-in.js +12 -7
  332. package/lib/registry/build-in.js.map +1 -1
  333. package/lib/registry/index.d.ts +1 -1
  334. package/lib/registry/index.js +1 -1
  335. package/lib/runtime/canvas.js +7 -4
  336. package/lib/runtime/canvas.js.map +1 -1
  337. package/lib/runtime/data.d.ts +13 -7
  338. package/lib/runtime/data.js +20 -3
  339. package/lib/runtime/data.js.map +1 -1
  340. package/lib/runtime/element.d.ts +6 -10
  341. package/lib/runtime/element.js +64 -45
  342. package/lib/runtime/element.js.map +1 -1
  343. package/lib/runtime/graph.d.ts +532 -45
  344. package/lib/runtime/graph.js +417 -39
  345. package/lib/runtime/graph.js.map +1 -1
  346. package/lib/runtime/layout.js +2 -2
  347. package/lib/runtime/layout.js.map +1 -1
  348. package/lib/runtime/types.d.ts +3 -3
  349. package/lib/runtime/viewport.d.ts +3 -4
  350. package/lib/runtime/viewport.js +2 -2
  351. package/lib/runtime/viewport.js.map +1 -1
  352. package/lib/spec/canvas.d.ts +6 -2
  353. package/lib/spec/data.d.ts +74 -1
  354. package/lib/spec/element/combo.d.ts +17 -6
  355. package/lib/spec/element/edge.d.ts +14 -2
  356. package/lib/spec/element/node.d.ts +19 -3
  357. package/{dist/lib/spec/spec.d.ts → lib/spec/graph.d.ts} +12 -4
  358. package/lib/spec/{spec.js → graph.js} +1 -1
  359. package/lib/spec/graph.js.map +1 -0
  360. package/lib/spec/index.d.ts +1 -1
  361. package/lib/spec/theme.d.ts +1 -4
  362. package/lib/spec/viewport.d.ts +1 -1
  363. package/lib/themes/base.d.ts +1 -0
  364. package/lib/themes/base.js +11 -9
  365. package/lib/themes/base.js.map +1 -1
  366. package/lib/themes/types.d.ts +0 -1
  367. package/lib/transforms/process-parallel-edges.d.ts +2 -3
  368. package/lib/transforms/process-parallel-edges.js +2 -4
  369. package/lib/transforms/process-parallel-edges.js.map +1 -1
  370. package/lib/transforms/types.d.ts +1 -1
  371. package/lib/transforms/update-related-edge.js.map +1 -1
  372. package/lib/types/callable.d.ts +2 -2
  373. package/lib/types/data.d.ts +3 -3
  374. package/lib/types/id.d.ts +1 -0
  375. package/lib/{spec/element/base.js → types/id.js} +1 -1
  376. package/lib/types/id.js.map +1 -0
  377. package/lib/types/index.d.ts +1 -0
  378. package/lib/types/style.d.ts +1 -3
  379. package/lib/types/viewport.d.ts +4 -4
  380. package/lib/utils/animation.d.ts +6 -6
  381. package/lib/utils/animation.js +3 -3
  382. package/lib/utils/animation.js.map +1 -1
  383. package/lib/utils/behaviors/brush.d.ts +1 -2
  384. package/lib/utils/behaviors/brush.js.map +1 -1
  385. package/lib/utils/behaviors/lasso.d.ts +1 -2
  386. package/lib/utils/behaviors/lasso.js.map +1 -1
  387. package/lib/utils/behaviors/utils.d.ts +1 -1
  388. package/lib/utils/change.js +8 -1
  389. package/lib/utils/change.js.map +1 -1
  390. package/lib/utils/data.d.ts +2 -2
  391. package/lib/utils/data.js +2 -2
  392. package/lib/utils/edge.d.ts +1 -2
  393. package/lib/utils/edge.js.map +1 -1
  394. package/lib/utils/element.d.ts +1 -1
  395. package/lib/utils/element.js +2 -2
  396. package/lib/utils/event/events.d.ts +1 -1
  397. package/lib/utils/event/events.js.map +1 -1
  398. package/lib/utils/event/index.d.ts +1 -1
  399. package/lib/utils/event/index.js +1 -1
  400. package/lib/utils/id.d.ts +2 -3
  401. package/lib/utils/id.js.map +1 -1
  402. package/lib/utils/palette.d.ts +2 -3
  403. package/lib/utils/palette.js +1 -1
  404. package/lib/utils/palette.js.map +1 -1
  405. package/lib/utils/relation.d.ts +3 -4
  406. package/lib/utils/relation.js +2 -2
  407. package/lib/utils/relation.js.map +1 -1
  408. package/lib/utils/style.js +3 -3
  409. package/lib/utils/style.js.map +1 -1
  410. package/lib/utils/visibility.d.ts +1 -1
  411. package/lib/utils/visibility.js +1 -1
  412. package/package.json +2 -1
  413. package/src/animations/types.ts +3 -4
  414. package/src/behaviors/base-behavior.ts +1 -1
  415. package/src/behaviors/brush-select.ts +34 -16
  416. package/src/behaviors/click-element.ts +29 -7
  417. package/src/behaviors/collapse-expand.ts +5 -4
  418. package/src/behaviors/create-edge.ts +1 -2
  419. package/src/behaviors/drag-canvas.ts +7 -0
  420. package/src/behaviors/drag-element-force.ts +1 -2
  421. package/src/behaviors/drag-element.ts +3 -4
  422. package/src/behaviors/focus-element.ts +1 -2
  423. package/src/behaviors/hover-element.ts +1 -2
  424. package/src/behaviors/index.ts +2 -0
  425. package/src/behaviors/lasso-select.ts +3 -4
  426. package/src/behaviors/scroll-canvas.ts +143 -0
  427. package/src/behaviors/types.ts +2 -1
  428. package/src/behaviors/zoom-canvas.ts +1 -1
  429. package/src/constants/events/animation.ts +0 -4
  430. package/src/constants/events/graph.ts +4 -0
  431. package/src/elements/combos/base-combo.ts +1 -1
  432. package/src/elements/edges/base-edge.ts +1 -7
  433. package/src/elements/nodes/base-node.ts +6 -15
  434. package/src/elements/nodes/donut.ts +137 -0
  435. package/src/elements/nodes/html.ts +230 -0
  436. package/src/elements/nodes/index.ts +4 -0
  437. package/src/{plugins/hull/shape.ts → elements/shapes/contour.ts} +27 -34
  438. package/src/elements/shapes/index.ts +2 -0
  439. package/src/exports.ts +124 -25
  440. package/src/plugins/bubble-sets.ts +268 -0
  441. package/src/plugins/camera-setting.ts +4 -2
  442. package/src/plugins/contextmenu.ts +1 -0
  443. package/src/plugins/grid-line.ts +51 -8
  444. package/src/plugins/history/utils.ts +6 -2
  445. package/src/plugins/hull/index.ts +58 -22
  446. package/src/plugins/index.ts +4 -0
  447. package/src/plugins/legend.ts +6 -4
  448. package/src/plugins/timebar.ts +450 -0
  449. package/src/plugins/tooltip.ts +2 -2
  450. package/src/registry/build-in.ts +27 -8
  451. package/src/registry/index.ts +1 -1
  452. package/src/runtime/canvas.ts +7 -4
  453. package/src/runtime/data.ts +23 -4
  454. package/src/runtime/element.ts +67 -40
  455. package/src/runtime/graph.ts +554 -56
  456. package/src/runtime/layout.ts +4 -4
  457. package/src/runtime/types.ts +3 -3
  458. package/src/runtime/viewport.ts +3 -4
  459. package/src/spec/canvas.ts +6 -2
  460. package/src/spec/data.ts +74 -1
  461. package/src/spec/element/combo.ts +17 -6
  462. package/src/spec/element/edge.ts +14 -2
  463. package/src/spec/element/node.ts +19 -3
  464. package/src/spec/{spec.ts → graph.ts} +12 -4
  465. package/src/spec/index.ts +1 -1
  466. package/src/spec/theme.ts +1 -5
  467. package/src/spec/viewport.ts +1 -1
  468. package/src/themes/base.ts +12 -9
  469. package/src/themes/types.ts +0 -2
  470. package/src/transforms/arrange-draw-order.ts +1 -1
  471. package/src/transforms/process-parallel-edges.ts +5 -7
  472. package/src/transforms/types.ts +1 -1
  473. package/src/transforms/update-related-edge.ts +1 -2
  474. package/src/types/callable.ts +2 -2
  475. package/src/types/data.ts +3 -3
  476. package/src/types/id.ts +1 -0
  477. package/src/types/index.ts +1 -0
  478. package/src/types/style.ts +1 -3
  479. package/src/types/viewport.ts +4 -4
  480. package/src/utils/animation.ts +6 -6
  481. package/src/utils/behaviors/brush.ts +1 -2
  482. package/src/utils/behaviors/lasso.ts +1 -2
  483. package/src/utils/behaviors/utils.ts +1 -1
  484. package/src/utils/change.ts +7 -3
  485. package/src/utils/data.ts +2 -2
  486. package/src/utils/edge.ts +1 -1
  487. package/src/utils/element.ts +2 -2
  488. package/src/utils/event/events.ts +3 -1
  489. package/src/utils/event/index.ts +1 -1
  490. package/src/utils/id.ts +1 -2
  491. package/src/utils/palette.ts +2 -2
  492. package/src/utils/relation.ts +3 -4
  493. package/src/utils/style.ts +3 -3
  494. package/src/utils/visibility.ts +1 -1
  495. package/dist/lib/runtime/index.d.ts +0 -6
  496. package/dist/lib/spec/element/base.d.ts +0 -6
  497. package/esm/plugins/hull/shape.js.map +0 -1
  498. package/esm/runtime/index.d.ts +0 -6
  499. package/esm/runtime/index.js +0 -7
  500. package/esm/runtime/index.js.map +0 -1
  501. package/esm/spec/element/base.d.ts +0 -6
  502. package/esm/spec/element/base.js +0 -2
  503. package/esm/spec/element/base.js.map +0 -1
  504. package/esm/spec/spec.js +0 -2
  505. package/esm/spec/spec.js.map +0 -1
  506. package/lib/plugins/hull/shape.js.map +0 -1
  507. package/lib/runtime/index.d.ts +0 -6
  508. package/lib/runtime/index.js +0 -8
  509. package/lib/runtime/index.js.map +0 -1
  510. package/lib/spec/element/base.d.ts +0 -6
  511. package/lib/spec/element/base.js.map +0 -1
  512. package/lib/spec/spec.js.map +0 -1
  513. package/src/runtime/index.ts +0 -7
  514. package/src/spec/element/base.ts +0 -6
@@ -1,5 +1,5 @@
1
1
  import EventEmitter from '@antv/event-emitter';
2
- import { debounce, isEqual, isFunction, isNumber, isObject, isString, omit } from '@antv/util';
2
+ import { debounce, isArray, isEqual, isFunction, isNumber, isObject, isString, omit } from '@antv/util';
3
3
  import { COMBO_KEY, GraphEvent } from '../constants';
4
4
  import { getExtension } from '../registry';
5
5
  import { sizeOf } from '../utils/dom';
@@ -19,15 +19,21 @@ import { TransformController } from './transform';
19
19
  import { ViewportController } from './viewport';
20
20
  export class Graph extends EventEmitter {
21
21
  options;
22
+ /**
23
+ * @internal
24
+ */
22
25
  static defaultOptions = {
23
26
  autoResize: false,
24
- width: 800,
25
- height: 600,
26
27
  theme: 'light',
27
28
  rotation: 0,
28
29
  zoom: 1,
29
30
  zoomRange: [0.01, 10],
30
31
  };
32
+ /**
33
+ * <zh/> 当前图实例是否已经被销毁
34
+ *
35
+ * <en/> Whether the current graph instance has been destroyed
36
+ */
31
37
  destroyed = false;
32
38
  // @ts-expect-error will be initialized in createRuntime
33
39
  context = {
@@ -46,6 +52,7 @@ export class Graph extends EventEmitter {
46
52
  *
47
53
  * <en/> Get options
48
54
  * @returns <zh/> 配置项 | <en/> options
55
+ * @apiCategory option
49
56
  */
50
57
  getOptions() {
51
58
  return this.options;
@@ -55,10 +62,11 @@ export class Graph extends EventEmitter {
55
62
  *
56
63
  * <en/> Set options
57
64
  * @param options - <zh/> 配置项 | <en/> options
58
- * @description
65
+ * @remarks
59
66
  * <zh/> 要更新 devicePixelRatio、container 属性请销毁后重新创建实例
60
67
  *
61
68
  * <en/> To update devicePixelRatio and container properties, please destroy and recreate the instance
69
+ * @apiCategory option
62
70
  */
63
71
  setOptions(options) {
64
72
  const { animation, background, behaviors, combo, container, data, edge, height, layout, node, padding, plugins, theme, transforms, width, zoom, zoomRange, } = options;
@@ -88,43 +96,124 @@ export class Graph extends EventEmitter {
88
96
  this.options.zoomRange = zoomRange;
89
97
  if (isNumber(zoom))
90
98
  this.options.zoom = zoom;
91
- if (isNumber(padding))
99
+ if (isNumber(padding) || isArray(padding))
92
100
  this.options.padding = padding;
93
101
  }
102
+ /**
103
+ * <zh/> 设置画布背景色
104
+ *
105
+ * <en/> Set canvas background color
106
+ * @param background - <zh/> 背景色 | <en/> background color
107
+ * @apiCategory canvas
108
+ */
94
109
  setBackground(background) {
95
110
  this.options.background = background;
96
111
  this.context.canvas?.setBackground(background);
97
112
  }
113
+ /**
114
+ * <zh/> 获取画布背景色
115
+ *
116
+ * <en/> Get canvas background color
117
+ * @returns <zh/> 背景色 | <en/> background color
118
+ * @apiCategory canvas
119
+ */
98
120
  getBackground() {
99
121
  return this.options.background;
100
122
  }
123
+ /**
124
+ * <zh/> 获取当前图容器的大小
125
+ *
126
+ * <en/> Get the size of the current canvas container
127
+ * @returns <zh/> 画布尺寸 | <en/> canvas size
128
+ * @apiCategory canvas
129
+ */
101
130
  getSize() {
102
131
  if (this.context.canvas)
103
132
  return this.context.canvas.getSize();
104
133
  return [this.options.width || 0, this.options.height || 0];
105
134
  }
135
+ /**
136
+ * <zh/> 获取当前图容器的大小
137
+ *
138
+ * <en/> Get the size of the current canvas container
139
+ * @param width - <zh/> 画布宽度 | <en/> canvas width
140
+ * @param height - <zh/> 画布高度 | <en/> canvas height
141
+ * @apiCategory canvas
142
+ */
106
143
  setSize(width, height) {
107
144
  this.options.width = width;
108
145
  this.options.height = height;
109
146
  }
147
+ /**
148
+ * <zh/> 获取当前图的缩放区间
149
+ *
150
+ * <en/> Get the zoom range of the current graph
151
+ * @param zoomRange - <zh/> 缩放区间 | <en/> zoom range
152
+ * @apiCategory viewport
153
+ */
110
154
  setZoomRange(zoomRange) {
111
155
  this.options.zoomRange = zoomRange;
112
156
  }
157
+ /**
158
+ * <zh/> 获取当前图的缩放区间
159
+ *
160
+ * <en/> Get the zoom range of the current graph
161
+ * @returns <zh/> 缩放区间 | <en/> zoom range
162
+ * @apiCategory viewport
163
+ */
113
164
  getZoomRange() {
114
165
  return this.options.zoomRange;
115
166
  }
167
+ /**
168
+ * <zh/> 设置节点样式映射
169
+ *
170
+ * <en/> Set node mapper
171
+ * @param node - <zh/> 节点配置 | <en/> node configuration
172
+ * @apiCategory element
173
+ */
116
174
  setNode(node) {
117
175
  this.options.node = node;
176
+ this.context.model.refreshData();
118
177
  }
178
+ /**
179
+ * <zh/> 设置边样式映射
180
+ *
181
+ * <en/> Set edge mapper
182
+ * @param edge - <zh/> 边配置 | <en/> edge configuration
183
+ * @apiCategory element
184
+ */
119
185
  setEdge(edge) {
120
186
  this.options.edge = edge;
187
+ this.context.model.refreshData();
121
188
  }
189
+ /**
190
+ * <zh/> 设置组合样式映射
191
+ *
192
+ * <en/> Set combo mapper
193
+ * @param combo - <zh/> 组合配置 | <en/> combo configuration
194
+ * @apiCategory element
195
+ */
122
196
  setCombo(combo) {
123
197
  this.options.combo = combo;
198
+ this.context.model.refreshData();
124
199
  }
200
+ /**
201
+ * <zh/> 获取主题
202
+ *
203
+ * <en/> Get theme
204
+ * @returns <zh/> 主题配置 | <en/> theme configuration
205
+ * @apiCategory theme
206
+ */
125
207
  getTheme() {
126
208
  return this.options.theme;
127
209
  }
210
+ /**
211
+ * <zh/> 设置主题
212
+ *
213
+ * <en/> Set theme
214
+ * @param theme - <zh/> 主题配置 | <en/> theme configuration
215
+ * @apiCategory theme
216
+ */
128
217
  setTheme(theme) {
129
218
  this.options.theme = isFunction(theme) ? theme(this.getTheme()) : theme;
130
219
  const { background } = getExtension('theme', this.options.theme) || {};
@@ -132,9 +221,23 @@ export class Graph extends EventEmitter {
132
221
  this.setBackground(background);
133
222
  }
134
223
  }
224
+ /**
225
+ * <zh/> 设置布局
226
+ *
227
+ * <en/> Set layout
228
+ * @param layout - <zh/> 布局配置 | <en/> layout configuration
229
+ * @apiCategory layout
230
+ */
135
231
  setLayout(layout) {
136
232
  this.options.layout = isFunction(layout) ? layout(this.getLayout()) : layout;
137
233
  }
234
+ /**
235
+ * <zh/> 获取布局
236
+ *
237
+ * <en/> Get layout
238
+ * @returns <zh/> 布局配置 | <en/> layout configuration
239
+ * @apiCategory layout
240
+ */
138
241
  getLayout() {
139
242
  return this.options.layout;
140
243
  }
@@ -143,6 +246,7 @@ export class Graph extends EventEmitter {
143
246
  *
144
247
  * <en/> Set behaviors
145
248
  * @param behaviors - <zh/> 交互配置 | <en/> behavior configuration
249
+ * @apiCategory behavior
146
250
  */
147
251
  setBehaviors(behaviors) {
148
252
  this.options.behaviors = isFunction(behaviors) ? behaviors(this.getBehaviors()) : behaviors;
@@ -153,6 +257,7 @@ export class Graph extends EventEmitter {
153
257
  *
154
258
  * <en/> Update behavior
155
259
  * @param behavior - <zh/> 交互配置 | <en/> behavior configuration
260
+ * @apiCategory behavior
156
261
  */
157
262
  updateBehavior(behavior) {
158
263
  this.setBehaviors((behaviors) => behaviors.map((_behavior) => {
@@ -167,6 +272,7 @@ export class Graph extends EventEmitter {
167
272
  *
168
273
  * <en/> Get behaviors
169
274
  * @returns <zh/> 交互配置 | <en/> behavior configuration
275
+ * @apiCategory behavior
170
276
  */
171
277
  getBehaviors() {
172
278
  return this.options.behaviors || [];
@@ -176,6 +282,7 @@ export class Graph extends EventEmitter {
176
282
  *
177
283
  * <en/> Set plugins
178
284
  * @param plugins - <zh/> 插件配置 | <en/> plugin configuration
285
+ * @apiCategory plugin
179
286
  */
180
287
  setPlugins(plugins) {
181
288
  this.options.plugins = isFunction(plugins) ? plugins(this.getPlugins()) : plugins;
@@ -186,6 +293,7 @@ export class Graph extends EventEmitter {
186
293
  *
187
294
  * <en/> Update plugin
188
295
  * @param plugin - <zh/> 插件配置 | <en/> plugin configuration
296
+ * @apiCategory plugin
189
297
  */
190
298
  updatePlugin(plugin) {
191
299
  this.setPlugins((plugins) => plugins.map((_plugin) => {
@@ -200,6 +308,7 @@ export class Graph extends EventEmitter {
200
308
  *
201
309
  * <en/> Get plugins
202
310
  * @returns <zh/> 插件配置 | <en/> plugin configuration
311
+ * @apiCategory plugin
203
312
  */
204
313
  getPlugins() {
205
314
  return this.options.plugins || [];
@@ -210,6 +319,7 @@ export class Graph extends EventEmitter {
210
319
  * <en/> Get plugin instance
211
320
  * @param key - <zh/> 插件 key | <en/> plugin key
212
321
  * @returns <zh/> 插件实例 | <en/> plugin instance
322
+ * @apiCategory plugin
213
323
  */
214
324
  getPluginInstance(key) {
215
325
  return this.context.plugin.getPluginInstance(key);
@@ -219,6 +329,7 @@ export class Graph extends EventEmitter {
219
329
  *
220
330
  * <en/> Set data transforms
221
331
  * @param transforms - <zh/> 数据转换配置 | <en/> data transform configuration
332
+ * @apiCategory transform
222
333
  */
223
334
  setTransforms(transforms) {
224
335
  this.options.transforms = isFunction(transforms) ? transforms(this.getTransforms()) : transforms;
@@ -229,6 +340,7 @@ export class Graph extends EventEmitter {
229
340
  *
230
341
  * <en/> Update data transform
231
342
  * @param transform - <zh/> 数据转换配置 | <en/> data transform configuration
343
+ * @apiCategory transform
232
344
  */
233
345
  updateTransform(transform) {
234
346
  this.setTransforms((transforms) => transforms.map((_transform) => {
@@ -243,10 +355,18 @@ export class Graph extends EventEmitter {
243
355
  *
244
356
  * <en/> Get data transforms
245
357
  * @returns <zh/> 数据转换器实例 | <en/> data transform instance
358
+ * @apiCategory transform
246
359
  */
247
360
  getTransforms() {
248
361
  return this.options.transforms || [];
249
362
  }
363
+ /**
364
+ * <zh/> 获取数据
365
+ *
366
+ * <en/> Get data
367
+ * @returns <zh/> 数据 | <en/> data
368
+ * @apiCategory data
369
+ */
250
370
  getData() {
251
371
  return this.context.model.getData();
252
372
  }
@@ -271,86 +391,205 @@ export class Graph extends EventEmitter {
271
391
  return this.context.model.getComboData(id);
272
392
  return this.context.model.getComboData([id])?.[0];
273
393
  }
394
+ /**
395
+ * <zh/> 设置全量数据
396
+ *
397
+ * <en/> Set full data
398
+ * @param data - <zh/> 数据 | <en/> data
399
+ * @apiCategory data
400
+ */
274
401
  setData(data) {
275
402
  this.context.model.setData(isFunction(data) ? data(this.getData()) : data);
276
403
  }
404
+ /**
405
+ * <zh/> 新增元素数据
406
+ *
407
+ * <en/> Add element data
408
+ * @param data - <zh/> 元素数据 | <en/> element data
409
+ * @apiCategory data
410
+ */
277
411
  addData(data) {
278
412
  this.context.model.addData(isFunction(data) ? data(this.getData()) : data);
279
413
  }
414
+ /**
415
+ * <zh/> 新增节点数据
416
+ *
417
+ * <en/> Add node data
418
+ * @param data - <zh/> 节点数据 | <en/> node data
419
+ * @apiCategory data
420
+ */
280
421
  addNodeData(data) {
281
422
  this.context.model.addNodeData(isFunction(data) ? data(this.getNodeData()) : data);
282
423
  }
424
+ /**
425
+ * <zh/> 新增边数据
426
+ *
427
+ * <en/> Add edge data
428
+ * @param data - <zh/> 边数据 | <en/> edge data
429
+ * @apiCategory data
430
+ */
283
431
  addEdgeData(data) {
284
432
  this.context.model.addEdgeData(isFunction(data) ? data(this.getEdgeData()) : data);
285
433
  }
434
+ /**
435
+ * <zh/> 新增组合数据
436
+ *
437
+ * <en/> Add combo data
438
+ * @param data - <zh/> 组合数据 | <en/> combo data
439
+ * @apiCategory data
440
+ */
286
441
  addComboData(data) {
287
442
  this.context.model.addComboData(isFunction(data) ? data(this.getComboData()) : data);
288
443
  }
444
+ /**
445
+ * <zh/> 更新元素数据
446
+ *
447
+ * <en/> Update element data
448
+ * @param data - <zh/> 元素数据 | <en/> element data
449
+ * @apiCategory data
450
+ */
289
451
  updateData(data) {
290
452
  this.context.model.updateData(isFunction(data) ? data(this.getData()) : data);
291
453
  }
454
+ /**
455
+ * <zh/> 更新节点数据
456
+ *
457
+ * <en/> Update node data
458
+ * @param data - <zh/> 节点数据 | <en/> node data
459
+ * @apiCategory data
460
+ */
292
461
  updateNodeData(data) {
293
462
  this.context.model.updateNodeData(isFunction(data) ? data(this.getNodeData()) : data);
294
463
  }
464
+ /**
465
+ * <zh/> 更新边数据
466
+ *
467
+ * <en/> Update edge data
468
+ * @param data - <zh/> 边数据 | <en/> edge data
469
+ * @apiCategory data
470
+ */
295
471
  updateEdgeData(data) {
296
472
  this.context.model.updateEdgeData(isFunction(data) ? data(this.getEdgeData()) : data);
297
473
  }
474
+ /**
475
+ * <zh/> 更新 组合数据
476
+ *
477
+ * <en/> Update combo data
478
+ * @param data - <zh/> 组合数据 | <en/> combo data
479
+ * @apiCategory data
480
+ */
298
481
  updateComboData(data) {
299
482
  this.context.model.updateComboData(isFunction(data) ? data(this.getComboData()) : data);
300
483
  }
301
- removeData(id) {
302
- this.context.model.removeData(isFunction(id) ? id(this.getData()) : id);
484
+ /**
485
+ * <zh/> 删除多条元素数据
486
+ *
487
+ * <en/> Remove multiple element data
488
+ * @param ids - <zh/> 元素 ID 数组 | <en/> element ID array
489
+ * @apiCategory data
490
+ */
491
+ removeData(ids) {
492
+ this.context.model.removeData(isFunction(ids) ? ids(this.getData()) : ids);
303
493
  }
494
+ /**
495
+ * <zh/> 删除多条节点数据
496
+ *
497
+ * <en/> Remove multiple node data
498
+ * @param ids - <zh/> 节点 ID 数组 | <en/> node ID array
499
+ * @apiCategory data
500
+ */
304
501
  removeNodeData(ids) {
305
502
  this.context.model.removeNodeData(isFunction(ids) ? ids(this.getNodeData()) : ids);
306
503
  }
504
+ /**
505
+ * <zh/> 删除多条边数据
506
+ *
507
+ * <en/> Remove multiple edge data
508
+ * @param ids - <zh/> 边 ID 数组 | <en/> edge ID array
509
+ * @apiCategory data
510
+ */
307
511
  removeEdgeData(ids) {
308
512
  this.context.model.removeEdgeData(isFunction(ids) ? ids(this.getEdgeData()) : ids);
309
513
  }
514
+ /**
515
+ * <zh/> 删除多条组合数据
516
+ *
517
+ * <en/> Remove multiple combo data
518
+ * @param ids - <zh/> 组合 ID 数组 | <en/> 组合 ID array
519
+ * @apiCategory data
520
+ */
310
521
  removeComboData(ids) {
311
522
  this.context.model.removeComboData(isFunction(ids) ? ids(this.getComboData()) : ids);
312
523
  }
524
+ /**
525
+ * <zh/> 获取元素类型
526
+ *
527
+ * <en/> Get element type
528
+ * @param id - <zh/> 元素 ID | <en/> element ID
529
+ * @returns <zh/> 元素类型 | <en/> element type
530
+ * @apiCategory element
531
+ */
313
532
  getElementType(id) {
314
533
  return this.context.model.getElementType(id);
315
534
  }
535
+ /**
536
+ * <zh/> 获取节点或组合相关的边数据
537
+ *
538
+ * <en/> Get the edge data related to the node or combo
539
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
540
+ * @param direction - <zh/> 边的方向 | <en/> edge direction
541
+ * @returns <zh/> 边数据 | <en/> edge data
542
+ * @apiCategory data
543
+ */
316
544
  getRelatedEdgesData(id, direction = 'both') {
317
545
  return this.context.model.getRelatedEdgesData(id, direction);
318
546
  }
547
+ /**
548
+ * <zh/> 获取节点或组合的一跳邻居节点数据
549
+ *
550
+ * <en/> Get the one-hop neighbor node data of the node or combo
551
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
552
+ * @returns <zh/> 邻居节点数据 | <en/> neighbor node data
553
+ * @apiCategory data
554
+ */
319
555
  getNeighborNodesData(id) {
320
556
  return this.context.model.getNeighborNodesData(id);
321
557
  }
322
558
  /**
323
- * <zh/> 获取节点或 combo 的祖先元素数据
559
+ * <zh/> 获取节点或组合的祖先元素数据
324
560
  *
325
561
  * <en/> Get the ancestor element data of the node or combo
326
- * @param id - <zh/> 节点或 combo ID | <en/> node or combo ID
327
- * @param hierarchy - <zh/> 指定树图层级关系还是 combo 层级关系 | <en/> specify tree or combo hierarchy relationship
562
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
563
+ * @param hierarchy - <zh/> 指定树图层级关系还是组合层级关系 | <en/> specify tree or combo hierarchy relationship
328
564
  * @returns <zh/> 祖先元素数据 | <en/> ancestor element data
329
- * @description
565
+ * @remarks
330
566
  * <zh/> 数组中的顺序是从父节点到祖先节点
331
567
  *
332
568
  * <en/> The order in the array is from the parent node to the ancestor node
569
+ * @apiCategory data
333
570
  */
334
571
  getAncestorsData(id, hierarchy) {
335
572
  return this.context.model.getAncestorsData(id, hierarchy);
336
573
  }
337
574
  /**
338
- * <zh/> 获取节点或 combo 的父元素数据
575
+ * <zh/> 获取节点或组合的父元素数据
339
576
  *
340
577
  * <en/> Get the parent element data of the node or combo
341
- * @param id - <zh/> 节点或 combo ID | <en/> node or combo ID
342
- * @param hierarchy - <zh/> 指定树图层级关系还是 combo 层级关系 | <en/> specify tree or combo hierarchy relationship
578
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
579
+ * @param hierarchy - <zh/> 指定树图层级关系还是组合层级关系 | <en/> specify tree or combo hierarchy relationship
343
580
  * @returns <zh/> 父元素数据 | <en/> parent element data
581
+ * @apiCategory data
344
582
  */
345
583
  getParentData(id, hierarchy) {
346
584
  return this.context.model.getParentData(id, hierarchy);
347
585
  }
348
586
  /**
349
- * <zh/> 获取节点或 combo 的子元素数据
587
+ * <zh/> 获取节点或组合的子元素数据
350
588
  *
351
589
  * <en/> Get the child element data of the node or combo
352
- * @param id - <zh/> 节点或 combo ID | <en/> node or combo ID
590
+ * @param id - <zh/> 节点或组合ID | <en/> node or combo ID
353
591
  * @returns <zh/> 子元素数据 | <en/> child element data
592
+ * @apiCategory data
354
593
  */
355
594
  getChildrenData(id) {
356
595
  return this.context.model.getChildrenData(id);
@@ -369,11 +608,12 @@ export class Graph extends EventEmitter {
369
608
  }
370
609
  else {
371
610
  const $container = isString(container) ? document.getElementById(container) : container;
611
+ const containerSize = sizeOf($container);
372
612
  this.emit(GraphEvent.BEFORE_CANVAS_INIT, { container: $container, width, height });
373
613
  const canvas = new Canvas({
374
614
  container: $container,
375
- width,
376
- height,
615
+ width: width || containerSize[0],
616
+ height: height || containerSize[1],
377
617
  renderer,
378
618
  });
379
619
  this.context.canvas = canvas;
@@ -381,7 +621,7 @@ export class Graph extends EventEmitter {
381
621
  this.emit(GraphEvent.AFTER_CANVAS_INIT, { canvas });
382
622
  }
383
623
  }
384
- createRuntime() {
624
+ initRuntime() {
385
625
  this.context.options = this.options;
386
626
  if (!this.context.batch)
387
627
  this.context.batch = new BatchController(this.context);
@@ -399,23 +639,27 @@ export class Graph extends EventEmitter {
399
639
  this.context.behavior = new BehaviorController(this.context);
400
640
  }
401
641
  async prepare() {
642
+ // 等待同步任务执行完成,避免 render 后立即调用 destroy 导致的问题
643
+ // Wait for synchronous tasks to complete, to avoid problems caused by calling destroy immediately after render
644
+ await Promise.resolve();
402
645
  if (this.destroyed)
403
646
  throw new Error('Graph has been destroyed');
404
647
  await this.initCanvas();
405
- this.createRuntime();
648
+ this.initRuntime();
406
649
  }
407
650
  /**
408
651
  * <zh/> 执行渲染
409
652
  *
410
653
  * <en/> Render
411
- * @description
654
+ * @remarks
412
655
  * <zh/> 此过程会执行数据更新、绘制元素、执行布局
413
656
  *
414
657
  * <en/> This process will execute data update, element rendering, and layout execution
658
+ * @apiCategory render
415
659
  */
416
660
  async render() {
417
- emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_RENDER));
418
661
  await this.prepare();
662
+ emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_RENDER));
419
663
  await Promise.all([this.context.element?.draw(), this.context.layout?.layout()]);
420
664
  await this.autoFit();
421
665
  emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_RENDER));
@@ -425,27 +669,52 @@ export class Graph extends EventEmitter {
425
669
  *
426
670
  * <en/> Draw elements
427
671
  * @returns <zh/> 渲染结果 | <en/> draw result
672
+ * @apiCategory element
428
673
  */
429
674
  async draw() {
430
675
  await this.prepare();
431
676
  return this.context.element.draw();
432
677
  }
678
+ /**
679
+ * <zh/> 执行布局
680
+ *
681
+ * <en/> Execute layout
682
+ * @apiCategory layout
683
+ */
433
684
  layout() {
434
- return this.context.layout.layout();
685
+ this.context.layout.layout();
435
686
  }
687
+ /**
688
+ * <zh/> 停止布局
689
+ *
690
+ * <en/> Stop layout
691
+ * @remarks
692
+ * <zh/> 适用于带有迭代动画的布局,目前有 `force` 属于此类布局,即停止力导布局的迭代,一般用于布局迭代时间过长情况下的手动停止迭代动画,例如在点击画布/节点的监听中调用
693
+ *
694
+ * <en/> Suitable for layouts with iterative animations. Currently, `force` belongs to this type of layout, that is, stop the iteration of the force-directed layout. It is generally used to manually stop the iteration animation when the layout iteration time is too long, such as calling in the click canvas/node listener
695
+ * @apiCategory layout
696
+ */
436
697
  stopLayout() {
437
- return this.context.layout.stopLayout();
698
+ this.context.layout.stopLayout();
438
699
  }
439
700
  /**
440
701
  * <zh/> 清空画布元素
441
702
  *
442
703
  * <en/> Clear canvas elements
704
+ * @apiCategory canvas
443
705
  */
444
706
  async clear() {
445
707
  this.context.model.setData({});
446
708
  await this.draw();
447
709
  }
710
+ /**
711
+ * <zh/> 销毁当前图实例
712
+ *
713
+ * <en/> Destroy the current graph instance
714
+ * @apiCategory instance
715
+ */
448
716
  destroy() {
717
+ emit(this, new GraphLifeCycleEvent(GraphEvent.BEFORE_DESTROY));
449
718
  const { layout, element, model, canvas, behavior, plugin } = this.context;
450
719
  plugin?.destroy();
451
720
  behavior?.destroy();
@@ -459,7 +728,15 @@ export class Graph extends EventEmitter {
459
728
  this.off();
460
729
  window.removeEventListener('resize', this.onResize);
461
730
  this.destroyed = true;
731
+ emit(this, new GraphLifeCycleEvent(GraphEvent.AFTER_DESTROY));
462
732
  }
733
+ /**
734
+ * <zh/> 获取画布实例
735
+ *
736
+ * <en/> Get canvas instance
737
+ * @returns - <zh/> 画布实例 | <en/> canvas instance
738
+ * @apiCategory canvas
739
+ */
463
740
  getCanvas() {
464
741
  return this.context.canvas;
465
742
  }
@@ -477,6 +754,7 @@ export class Graph extends EventEmitter {
477
754
  * <en/> Zoom the graph to fit the viewport and move it to the center of the viewport
478
755
  * @param options - <zh/> 适配配置 | <en/> fit options
479
756
  * @param animation - <zh/> 动画配置 | <en/> animation configuration
757
+ * @apiCategory viewport
480
758
  */
481
759
  async fitView(options, animation) {
482
760
  await this.context.viewport?.fitView(options, animation);
@@ -486,6 +764,7 @@ export class Graph extends EventEmitter {
486
764
  *
487
765
  * <en/> Move the graph to the center of the viewport
488
766
  * @param animation - <zh/> 动画配置 | <en/> animation configuration
767
+ * @apiCategory viewport
489
768
  */
490
769
  async fitCenter(animation) {
491
770
  await this.context.viewport?.fitCenter(animation);
@@ -508,6 +787,14 @@ export class Graph extends EventEmitter {
508
787
  await this.fitCenter(animation);
509
788
  }
510
789
  }
790
+ /**
791
+ * <zh/> 移动图,使得元素对齐到视口中心
792
+ *
793
+ * <en/> Move the graph so that the element is aligned to the center of the viewport
794
+ * @param id - <zh/> 元素 ID | <en/> element ID
795
+ * @param animation - <zh/> 动画配置 | <en/> animation configuration
796
+ * @apiCategory viewport
797
+ */
511
798
  async focusElement(id, animation) {
512
799
  await this.context.viewport?.focusElements(Array.isArray(id) ? id : [id], animation);
513
800
  }
@@ -518,13 +805,15 @@ export class Graph extends EventEmitter {
518
805
  * @param ratio - <zh/> 缩放比例 | <en/> zoom ratio
519
806
  * @param animation - <zh/> 动画配置 | <en/> animation configuration
520
807
  * @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
521
- * @description
808
+ * @remarks
522
809
  * <zh/>
523
810
  * - ratio > 1 放大
524
811
  * - ratio < 1 缩小
812
+ *
525
813
  * <en/>
526
814
  * - ratio > 1 zoom in
527
815
  * - ratio < 1 zoom out
816
+ * @apiCategory viewport
528
817
  */
529
818
  async zoomBy(ratio, animation, origin) {
530
819
  await this.context.viewport.transform({ mode: 'relative', scale: ratio, origin }, animation);
@@ -536,15 +825,17 @@ export class Graph extends EventEmitter {
536
825
  * @param zoom - <zh/> 指定缩放比例 | <en/> specified zoom ratio
537
826
  * @param animation - <zh/> 动画配置 | <en/> animation configuration
538
827
  * @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
539
- * @description
828
+ * @remarks
540
829
  * <zh/>
541
830
  * - zoom = 1 默认大小
542
831
  * - zoom > 1 放大
543
832
  * - zoom < 1 缩小
833
+ *
544
834
  * <en/>
545
835
  * - zoom = 1 default size
546
836
  * - zoom > 1 zoom in
547
837
  * - zoom < 1 zoom out
838
+ * @apiCategory viewport
548
839
  */
549
840
  async zoomTo(zoom, animation, origin) {
550
841
  this.context.viewport.transform({ mode: 'absolute', scale: zoom, origin }, animation);
@@ -554,6 +845,7 @@ export class Graph extends EventEmitter {
554
845
  *
555
846
  * <en/> Get the current zoom ratio
556
847
  * @returns <zh/> 缩放比例 | <en/> zoom ratio
848
+ * @apiCategory viewport
557
849
  */
558
850
  getZoom() {
559
851
  return this.context.viewport.getZoom();
@@ -565,6 +857,7 @@ export class Graph extends EventEmitter {
565
857
  * @param angle - <zh/> 旋转角度 | <en/> rotation angle
566
858
  * @param animation - <zh/> 动画配置 | <en/> animation configuration
567
859
  * @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
860
+ * @apiCategory viewport
568
861
  */
569
862
  async rotateBy(angle, animation, origin) {
570
863
  await this.context.viewport.transform({ mode: 'relative', rotate: angle, origin }, animation);
@@ -576,6 +869,7 @@ export class Graph extends EventEmitter {
576
869
  * @param angle - <zh/> 目标角度 | <en/> target angle
577
870
  * @param animation - <zh/> 动画配置 | <en/> animation configuration
578
871
  * @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
872
+ * @apiCategory viewport
579
873
  */
580
874
  async rotateTo(angle, animation, origin) {
581
875
  await this.context.viewport.transform({ mode: 'absolute', rotate: angle, origin }, animation);
@@ -585,6 +879,7 @@ export class Graph extends EventEmitter {
585
879
  *
586
880
  * <en/> Get the current rotation angle
587
881
  * @returns <zh/> 旋转角度 | <en/> rotation angle
882
+ * @apiCategory viewport
588
883
  */
589
884
  getRotation() {
590
885
  return this.context.viewport.getRotation();
@@ -595,6 +890,7 @@ export class Graph extends EventEmitter {
595
890
  * <en/> Translate the graph by the specified distance
596
891
  * @param offset - <zh/> 偏移量 | <en/> offset
597
892
  * @param animation - <zh/> 动画配置 | <en/> animation configuration
893
+ * @apiCategory viewport
598
894
  */
599
895
  async translateBy(offset, animation) {
600
896
  await this.context.viewport.transform({ mode: 'relative', translate: offset }, animation);
@@ -605,7 +901,7 @@ export class Graph extends EventEmitter {
605
901
  * <en/> Translate the graph to the specified position
606
902
  * @param position - <zh/> 指定位置 | <en/> specified position
607
903
  * @param animation - <zh/> 动画配置 | <en/> animation configuration
608
- * @description
904
+ * @apiCategory viewport
609
905
  */
610
906
  async translateTo(position, animation) {
611
907
  await this.context.viewport.transform({ mode: 'absolute', translate: position }, animation);
@@ -615,10 +911,11 @@ export class Graph extends EventEmitter {
615
911
  *
616
912
  * <en/> Get the position of the graph
617
913
  * @returns <zh/> 图的位置 | <en/> position of the graph
618
- * @description
914
+ * @remarks
619
915
  * <zh/> 默认状态下,图的位置为 [0, 0]
620
916
  *
621
917
  * <en/> By default, the position of the graph is [0, 0]
918
+ * @apiCategory viewport
622
919
  */
623
920
  getPosition() {
624
921
  return subtract([0, 0], this.getCanvasByViewport([0, 0]));
@@ -637,9 +934,25 @@ export class Graph extends EventEmitter {
637
934
  Object.entries(config).forEach(([id, position]) => this.context.model.translateNodeTo(id, position));
638
935
  await this.context.element.draw({ animation });
639
936
  }
937
+ /**
938
+ * <zh/> 获取元素位置
939
+ *
940
+ * <en/> Get element position
941
+ * @param id - <zh/> 元素 ID | <en/> element ID
942
+ * @returns <zh/> 元素位置 | <en/> element position
943
+ * @apiCategory element
944
+ */
640
945
  getElementPosition(id) {
641
946
  return this.context.model.getElementPosition(id);
642
947
  }
948
+ /**
949
+ * <zh/> 获取元素渲染样式
950
+ *
951
+ * <en/> Get element rendering style
952
+ * @param id - <zh/> 元素 ID | <en/> element ID
953
+ * @returns <zh/> 元素渲染样式 | <en/> element rendering style
954
+ * @apiCategory element
955
+ */
643
956
  getElementRenderStyle(id) {
644
957
  return omit(this.context.element.getElement(id).attributes, ['context']);
645
958
  }
@@ -660,7 +973,8 @@ export class Graph extends EventEmitter {
660
973
  *
661
974
  * <en/> Show element
662
975
  * @param id - <zh/> 元素 ID | <en/> element ID
663
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
976
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
977
+ * @apiCategory element
664
978
  */
665
979
  async showElement(id, animation) {
666
980
  const ids = Array.isArray(id) ? id : [id];
@@ -671,7 +985,8 @@ export class Graph extends EventEmitter {
671
985
  *
672
986
  * <en/> Hide element
673
987
  * @param id - <zh/> 元素 ID | <en/> element ID
674
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
988
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
989
+ * @apiCategory element
675
990
  */
676
991
  async hideElement(id, animation) {
677
992
  const ids = Array.isArray(id) ? id : [id];
@@ -683,6 +998,7 @@ export class Graph extends EventEmitter {
683
998
  * <en/> Get element visibility
684
999
  * @param id - <zh/> 元素 ID | <en/> element ID
685
1000
  * @returns <zh/> 元素可见性 | <en/> element visibility
1001
+ * @apiCategory element
686
1002
  */
687
1003
  getElementVisibility(id) {
688
1004
  const element = this.context.element.getElement(id);
@@ -704,6 +1020,7 @@ export class Graph extends EventEmitter {
704
1020
  *
705
1021
  * <en/> Bring the element to the front
706
1022
  * @param id - <zh/> 元素 ID | <en/> element ID
1023
+ * @apiCategory element
707
1024
  */
708
1025
  async frontElement(id) {
709
1026
  const ids = Array.isArray(id) ? id : [id];
@@ -731,6 +1048,7 @@ export class Graph extends EventEmitter {
731
1048
  * <en/> Get element z-index
732
1049
  * @param id - <zh/> 元素 ID | <en/> element ID
733
1050
  * @returns <zh/> 元素层级 | <en/> element z-index
1051
+ * @apiCategory element
734
1052
  */
735
1053
  getElementZIndex(id) {
736
1054
  return zIndexOf(this.context.model.getElementsData([id])[0]);
@@ -758,18 +1076,43 @@ export class Graph extends EventEmitter {
758
1076
  * <en/> Get element state
759
1077
  * @param id - <zh/> 元素 ID | <en/> element ID
760
1078
  * @returns <zh/> 元素状态 | <en/> element state
1079
+ * @apiCategory element
761
1080
  */
762
1081
  getElementState(id) {
763
1082
  return this.context.model.getElementState(id);
764
1083
  }
1084
+ /**
1085
+ * <zh/> 获取元素自身以及子节点在世界坐标系下的渲染包围盒
1086
+ *
1087
+ * <en/> Get the rendering bounding box of the element itself and its child nodes in the world coordinate system
1088
+ * @param id - <zh/> 元素 ID | <en/> element ID
1089
+ * @returns <zh/> 渲染包围盒 | <en/> render bounding box
1090
+ * @apiCategory element
1091
+ */
765
1092
  getElementRenderBounds(id) {
766
1093
  return this.context.element.getElement(id).getRenderBounds();
767
1094
  }
768
- async collapse(id, animation = true) {
1095
+ /**
1096
+ * <zh/> 收起 Combo
1097
+ *
1098
+ * <en/> Collapse Combo
1099
+ * @param id - <zh/> 元素 ID | <en/> element ID
1100
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1101
+ * @apiCategory element
1102
+ */
1103
+ async collapseElement(id, animation = true) {
769
1104
  this.setElementCollapsibility(id, true);
770
1105
  await this.context.element.draw({ animation, stage: 'collapse' });
771
1106
  }
772
- async expand(id, animation = true) {
1107
+ /**
1108
+ * <zh/> 展开 Combo
1109
+ *
1110
+ * <en/> Expand Combo
1111
+ * @param id - <zh/> 元素 ID | <en/> element ID
1112
+ * @param animation - <zh/> 是否启用动画 | <en/> whether to enable animation
1113
+ * @apiCategory element
1114
+ */
1115
+ async expandElement(id, animation = true) {
773
1116
  this.setElementCollapsibility(id, false);
774
1117
  await this.context.element.draw({ animation, stage: 'expand' });
775
1118
  }
@@ -785,29 +1128,54 @@ export class Graph extends EventEmitter {
785
1128
  *
786
1129
  * <en/> Export canvas content as DataURL
787
1130
  * @param options - <zh/> 导出配置 | <en/> export configuration
788
- * @param mode
789
- * <zh/> 导出模式
790
- * - viewport: 导出视口内容
791
- * - overall: 导出整个画布
792
- *
793
- * <en/> export mode
794
- * - viewport: export the content of the viewport
795
- * - overall: export the entire canvas
796
1131
  * @returns <zh/> DataURL | <en/> DataURL
1132
+ * @apiCategory exportImage
797
1133
  */
798
1134
  async toDataURL(options = {}) {
799
1135
  return this.context.canvas.toDataURL(options);
800
1136
  }
1137
+ /**
1138
+ * <zh/> 给定的视窗 DOM 坐标,转换为画布上的绘制坐标
1139
+ *
1140
+ * <en/> Convert the given viewport DOM coordinates to the drawing coordinates on the canvas
1141
+ * @param point - <zh/> 视窗坐标 | <en/> viewport coordinates
1142
+ * @returns <zh/> 画布上的绘制坐标 | <en/> drawing coordinates on the canvas
1143
+ * @apiCategory viewport
1144
+ */
801
1145
  getCanvasByViewport(point) {
802
1146
  return parsePoint(this.context.canvas.viewport2Canvas(toPointObject(point)));
803
1147
  }
1148
+ /**
1149
+ * <zh/> 给定画布上的绘制坐标,转换为视窗 DOM 的坐标
1150
+ *
1151
+ * <en/> Convert the given drawing coordinates on the canvas to the coordinates of the viewport DOM
1152
+ * @param point - <zh/> 画布坐标 | <en/> canvas coordinates
1153
+ * @returns <zh/> 视窗 DOM 的坐标 | <en/> coordinates of the viewport DOM
1154
+ * @apiCategory viewport
1155
+ */
804
1156
  getViewportByCanvas(point) {
805
1157
  return parsePoint(this.context.canvas.canvas2Viewport(toPointObject(point)));
806
1158
  }
1159
+ /**
1160
+ * <zh/> 给定画布上的绘制坐标,转换为浏览器坐标
1161
+ *
1162
+ * <en/> Convert the given drawing coordinates on the canvas to browser coordinates
1163
+ * @param point - <zh/> 画布坐标 | <en/> canvas coordinates
1164
+ * @returns <zh/> 浏览器坐标 | <en/> browser coordinates
1165
+ * @apiCategory viewport
1166
+ */
807
1167
  getClientByCanvas(point) {
808
1168
  const viewportPoint = this.context.canvas.canvas2Viewport(toPointObject(point));
809
1169
  return parsePoint(this.context.canvas.viewport2Canvas(viewportPoint));
810
1170
  }
1171
+ /**
1172
+ * <zh/> 给定的浏览器坐标,转换为画布上的绘制坐标
1173
+ *
1174
+ * <en/> Convert the given browser coordinates to drawing coordinates on the canvas
1175
+ * @param point - <zh/> 浏览器坐标 | <en/> browser coordinates
1176
+ * @returns <zh/> 画布上的绘制坐标 | <en/> drawing coordinates on the canvas
1177
+ * @apiCategory viewport
1178
+ */
811
1179
  getCanvasByClient(point) {
812
1180
  const viewportPoint = this.context.canvas.client2Viewport(toPointObject(point));
813
1181
  return parsePoint(this.context.canvas.viewport2Canvas(viewportPoint));
@@ -817,10 +1185,18 @@ export class Graph extends EventEmitter {
817
1185
  *
818
1186
  * <en/> Get the canvas coordinates of the viewport center
819
1187
  * @returns <zh/> 视口中心的画布坐标 | <en/> Canvas coordinates of the viewport center
1188
+ * @apiCategory viewport
820
1189
  */
821
1190
  getViewportCenter() {
822
1191
  return this.context.viewport.getViewportCenter();
823
1192
  }
1193
+ /**
1194
+ * <zh/> 获取画布中心的画布坐标
1195
+ *
1196
+ * <en/> Get the canvas coordinates of the canvas center
1197
+ * @returns <zh/> 画布中心的画布坐标 | <en/> Canvas coordinates of the canvas center
1198
+ * @apiCategory viewport
1199
+ */
824
1200
  getCanvasCenter() {
825
1201
  return this.context.viewport.getCanvasCenter();
826
1202
  }
@@ -834,6 +1210,7 @@ export class Graph extends EventEmitter {
834
1210
  * @param eventName - <zh/> 事件名称 | <en/> event name
835
1211
  * @param callback - <zh/> 回调函数 | <en/> callback function
836
1212
  * @returns <zh/> Graph 实例 | <en/> Graph instance
1213
+ * @apiCategory event
837
1214
  */
838
1215
  on(eventName, callback) {
839
1216
  return super.on(eventName, callback);
@@ -845,6 +1222,7 @@ export class Graph extends EventEmitter {
845
1222
  * @param eventName - <zh/> 事件名称 | <en/> event name
846
1223
  * @param callback - <zh/> 回调函数 | <en/> callback function
847
1224
  * @returns <zh/> Graph 实例 | <en/> Graph instance
1225
+ * @apiCategory event
848
1226
  */
849
1227
  once(eventName, callback) {
850
1228
  return super.once(eventName, callback);