@antv/g6 5.0.1 → 5.0.2

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 (281) hide show
  1. package/dist/g6.min.js +2 -2
  2. package/dist/lib/behaviors/click-select.d.ts +4 -5
  3. package/dist/lib/elements/base-element.d.ts +1 -22
  4. package/dist/lib/elements/combos/base-combo.d.ts +4 -4
  5. package/dist/lib/elements/edges/base-edge.d.ts +4 -2
  6. package/dist/lib/elements/effect.d.ts +17 -0
  7. package/dist/lib/elements/nodes/base-node.d.ts +5 -4
  8. package/dist/lib/elements/nodes/diamond.d.ts +0 -1
  9. package/dist/lib/elements/shapes/badge.d.ts +17 -6
  10. package/dist/lib/elements/shapes/base-shape.d.ts +9 -3
  11. package/dist/lib/elements/shapes/icon.d.ts +15 -3
  12. package/dist/lib/elements/shapes/label.d.ts +18 -7
  13. package/dist/lib/exports.d.ts +3 -2
  14. package/dist/lib/index.d.ts +5 -1
  15. package/dist/lib/layouts/base-layout.d.ts +3 -1
  16. package/dist/lib/plugins/bubble-sets.d.ts +2 -2
  17. package/dist/lib/plugins/hull/index.d.ts +2 -2
  18. package/dist/lib/runtime/canvas.d.ts +15 -2
  19. package/dist/lib/runtime/data.d.ts +7 -16
  20. package/dist/lib/runtime/element.d.ts +18 -2
  21. package/dist/lib/runtime/graph.d.ts +372 -108
  22. package/dist/lib/spec/element/edge.d.ts +1 -1
  23. package/dist/lib/spec/element/node.d.ts +1 -1
  24. package/dist/lib/transforms/process-parallel-edges.d.ts +2 -2
  25. package/dist/lib/types/callable.d.ts +0 -11
  26. package/dist/lib/types/data.d.ts +12 -0
  27. package/dist/lib/types/edge.d.ts +11 -0
  28. package/dist/lib/types/element.d.ts +100 -9
  29. package/dist/lib/types/index.d.ts +0 -1
  30. package/dist/lib/types/point.d.ts +0 -1
  31. package/dist/lib/utils/element.d.ts +2 -2
  32. package/dist/lib/utils/layout.d.ts +2 -2
  33. package/dist/lib/utils/path.d.ts +3 -3
  34. package/dist/lib/utils/position.d.ts +8 -8
  35. package/dist/lib/utils/style.d.ts +13 -8
  36. package/esm/behaviors/click-select.d.ts +4 -5
  37. package/esm/behaviors/click-select.js +59 -50
  38. package/esm/behaviors/click-select.js.map +1 -1
  39. package/esm/behaviors/lasso-select.js.map +1 -1
  40. package/esm/elements/base-element.d.ts +1 -22
  41. package/esm/elements/base-element.js +0 -21
  42. package/esm/elements/base-element.js.map +1 -1
  43. package/esm/elements/combos/base-combo.d.ts +4 -4
  44. package/esm/elements/combos/base-combo.js +27 -4
  45. package/esm/elements/combos/base-combo.js.map +1 -1
  46. package/esm/elements/edges/base-edge.d.ts +4 -2
  47. package/esm/elements/edges/base-edge.js +41 -7
  48. package/esm/elements/edges/base-edge.js.map +1 -1
  49. package/esm/elements/effect.d.ts +17 -0
  50. package/esm/elements/effect.js +70 -0
  51. package/esm/elements/effect.js.map +1 -0
  52. package/esm/elements/nodes/base-node.d.ts +5 -4
  53. package/esm/elements/nodes/base-node.js +33 -14
  54. package/esm/elements/nodes/base-node.js.map +1 -1
  55. package/esm/elements/nodes/circle.js +1 -1
  56. package/esm/elements/nodes/circle.js.map +1 -1
  57. package/esm/elements/nodes/diamond.d.ts +0 -1
  58. package/esm/elements/nodes/diamond.js +0 -6
  59. package/esm/elements/nodes/diamond.js.map +1 -1
  60. package/esm/elements/nodes/ellipse.js +1 -1
  61. package/esm/elements/nodes/ellipse.js.map +1 -1
  62. package/esm/elements/nodes/image.js +2 -2
  63. package/esm/elements/nodes/image.js.map +1 -1
  64. package/esm/elements/nodes/rect.js +1 -1
  65. package/esm/elements/nodes/rect.js.map +1 -1
  66. package/esm/elements/shapes/badge.d.ts +17 -6
  67. package/esm/elements/shapes/badge.js +9 -0
  68. package/esm/elements/shapes/badge.js.map +1 -1
  69. package/esm/elements/shapes/base-shape.d.ts +9 -3
  70. package/esm/elements/shapes/base-shape.js +33 -15
  71. package/esm/elements/shapes/base-shape.js.map +1 -1
  72. package/esm/elements/shapes/icon.d.ts +15 -3
  73. package/esm/elements/shapes/icon.js +12 -4
  74. package/esm/elements/shapes/icon.js.map +1 -1
  75. package/esm/elements/shapes/label.d.ts +18 -7
  76. package/esm/elements/shapes/label.js +10 -0
  77. package/esm/elements/shapes/label.js.map +1 -1
  78. package/esm/elements/shapes/polygon.js +1 -1
  79. package/esm/elements/shapes/polygon.js.map +1 -1
  80. package/esm/exports.d.ts +3 -2
  81. package/esm/exports.js +1 -1
  82. package/esm/exports.js.map +1 -1
  83. package/esm/index.d.ts +5 -1
  84. package/esm/index.js +5 -1
  85. package/esm/index.js.map +1 -1
  86. package/esm/layouts/base-layout.d.ts +3 -1
  87. package/esm/layouts/base-layout.js +3 -1
  88. package/esm/layouts/base-layout.js.map +1 -1
  89. package/esm/plugins/bubble-sets.d.ts +2 -2
  90. package/esm/plugins/bubble-sets.js.map +1 -1
  91. package/esm/plugins/hull/index.d.ts +2 -2
  92. package/esm/plugins/hull/index.js.map +1 -1
  93. package/esm/runtime/canvas.d.ts +15 -2
  94. package/esm/runtime/canvas.js.map +1 -1
  95. package/esm/runtime/data.d.ts +7 -16
  96. package/esm/runtime/data.js +14 -34
  97. package/esm/runtime/data.js.map +1 -1
  98. package/esm/runtime/element.d.ts +18 -2
  99. package/esm/runtime/element.js +68 -20
  100. package/esm/runtime/element.js.map +1 -1
  101. package/esm/runtime/graph.d.ts +372 -108
  102. package/esm/runtime/graph.js +271 -76
  103. package/esm/runtime/graph.js.map +1 -1
  104. package/esm/runtime/layout.js +1 -1
  105. package/esm/runtime/layout.js.map +1 -1
  106. package/esm/spec/element/edge.d.ts +1 -1
  107. package/esm/spec/element/node.d.ts +1 -1
  108. package/esm/themes/base.js +2 -0
  109. package/esm/themes/base.js.map +1 -1
  110. package/esm/transforms/collapse-expand-node.js +14 -4
  111. package/esm/transforms/collapse-expand-node.js.map +1 -1
  112. package/esm/transforms/process-parallel-edges.d.ts +2 -2
  113. package/esm/types/callable.d.ts +0 -11
  114. package/esm/types/data.d.ts +12 -0
  115. package/esm/types/edge.d.ts +11 -0
  116. package/esm/types/element.d.ts +100 -9
  117. package/esm/types/index.d.ts +0 -1
  118. package/esm/types/point.d.ts +0 -1
  119. package/esm/utils/element.d.ts +2 -2
  120. package/esm/utils/element.js.map +1 -1
  121. package/esm/utils/layout.d.ts +2 -2
  122. package/esm/utils/layout.js +4 -4
  123. package/esm/utils/layout.js.map +1 -1
  124. package/esm/utils/path.d.ts +3 -3
  125. package/esm/utils/path.js +1 -1
  126. package/esm/utils/path.js.map +1 -1
  127. package/esm/utils/position.d.ts +8 -8
  128. package/esm/utils/position.js +2 -2
  129. package/esm/utils/position.js.map +1 -1
  130. package/esm/utils/style.d.ts +13 -8
  131. package/esm/utils/style.js +16 -11
  132. package/esm/utils/style.js.map +1 -1
  133. package/lib/behaviors/click-select.d.ts +4 -5
  134. package/lib/behaviors/click-select.js +59 -50
  135. package/lib/behaviors/click-select.js.map +1 -1
  136. package/lib/behaviors/lasso-select.js.map +1 -1
  137. package/lib/elements/base-element.d.ts +1 -22
  138. package/lib/elements/base-element.js +0 -21
  139. package/lib/elements/base-element.js.map +1 -1
  140. package/lib/elements/combos/base-combo.d.ts +4 -4
  141. package/lib/elements/combos/base-combo.js +27 -4
  142. package/lib/elements/combos/base-combo.js.map +1 -1
  143. package/lib/elements/edges/base-edge.d.ts +4 -2
  144. package/lib/elements/edges/base-edge.js +41 -7
  145. package/lib/elements/edges/base-edge.js.map +1 -1
  146. package/lib/elements/effect.d.ts +17 -0
  147. package/lib/elements/effect.js +74 -0
  148. package/lib/elements/effect.js.map +1 -0
  149. package/lib/elements/nodes/base-node.d.ts +5 -4
  150. package/lib/elements/nodes/base-node.js +33 -14
  151. package/lib/elements/nodes/base-node.js.map +1 -1
  152. package/lib/elements/nodes/circle.js +1 -1
  153. package/lib/elements/nodes/circle.js.map +1 -1
  154. package/lib/elements/nodes/diamond.d.ts +0 -1
  155. package/lib/elements/nodes/diamond.js +0 -6
  156. package/lib/elements/nodes/diamond.js.map +1 -1
  157. package/lib/elements/nodes/ellipse.js +1 -1
  158. package/lib/elements/nodes/ellipse.js.map +1 -1
  159. package/lib/elements/nodes/image.js +2 -2
  160. package/lib/elements/nodes/image.js.map +1 -1
  161. package/lib/elements/nodes/rect.js +1 -1
  162. package/lib/elements/nodes/rect.js.map +1 -1
  163. package/lib/elements/shapes/badge.d.ts +17 -6
  164. package/lib/elements/shapes/badge.js +9 -0
  165. package/lib/elements/shapes/badge.js.map +1 -1
  166. package/lib/elements/shapes/base-shape.d.ts +9 -3
  167. package/lib/elements/shapes/base-shape.js +33 -15
  168. package/lib/elements/shapes/base-shape.js.map +1 -1
  169. package/lib/elements/shapes/icon.d.ts +15 -3
  170. package/lib/elements/shapes/icon.js +12 -4
  171. package/lib/elements/shapes/icon.js.map +1 -1
  172. package/lib/elements/shapes/label.d.ts +18 -7
  173. package/lib/elements/shapes/label.js +10 -0
  174. package/lib/elements/shapes/label.js.map +1 -1
  175. package/lib/elements/shapes/polygon.js +1 -1
  176. package/lib/elements/shapes/polygon.js.map +1 -1
  177. package/lib/exports.d.ts +3 -2
  178. package/lib/exports.js +5 -2
  179. package/lib/exports.js.map +1 -1
  180. package/lib/index.d.ts +5 -1
  181. package/lib/index.js +6 -2
  182. package/lib/index.js.map +1 -1
  183. package/lib/layouts/base-layout.d.ts +3 -1
  184. package/lib/layouts/base-layout.js +3 -1
  185. package/lib/layouts/base-layout.js.map +1 -1
  186. package/lib/plugins/bubble-sets.d.ts +2 -2
  187. package/lib/plugins/bubble-sets.js.map +1 -1
  188. package/lib/plugins/hull/index.d.ts +2 -2
  189. package/lib/plugins/hull/index.js.map +1 -1
  190. package/lib/runtime/canvas.d.ts +15 -2
  191. package/lib/runtime/canvas.js.map +1 -1
  192. package/lib/runtime/data.d.ts +7 -16
  193. package/lib/runtime/data.js +14 -34
  194. package/lib/runtime/data.js.map +1 -1
  195. package/lib/runtime/element.d.ts +18 -2
  196. package/lib/runtime/element.js +68 -20
  197. package/lib/runtime/element.js.map +1 -1
  198. package/lib/runtime/graph.d.ts +372 -108
  199. package/lib/runtime/graph.js +271 -76
  200. package/lib/runtime/graph.js.map +1 -1
  201. package/lib/runtime/layout.js +1 -1
  202. package/lib/runtime/layout.js.map +1 -1
  203. package/lib/spec/element/edge.d.ts +1 -1
  204. package/lib/spec/element/node.d.ts +1 -1
  205. package/lib/themes/base.js +2 -0
  206. package/lib/themes/base.js.map +1 -1
  207. package/lib/transforms/collapse-expand-node.js +14 -4
  208. package/lib/transforms/collapse-expand-node.js.map +1 -1
  209. package/lib/transforms/process-parallel-edges.d.ts +2 -2
  210. package/lib/types/callable.d.ts +0 -11
  211. package/lib/types/data.d.ts +12 -0
  212. package/lib/types/edge.d.ts +11 -0
  213. package/lib/types/element.d.ts +100 -9
  214. package/lib/types/index.d.ts +0 -1
  215. package/lib/types/point.d.ts +0 -1
  216. package/lib/utils/element.d.ts +2 -2
  217. package/lib/utils/element.js.map +1 -1
  218. package/lib/utils/layout.d.ts +2 -2
  219. package/lib/utils/layout.js +4 -4
  220. package/lib/utils/layout.js.map +1 -1
  221. package/lib/utils/path.d.ts +3 -3
  222. package/lib/utils/path.js +1 -1
  223. package/lib/utils/path.js.map +1 -1
  224. package/lib/utils/position.d.ts +8 -8
  225. package/lib/utils/position.js +2 -2
  226. package/lib/utils/position.js.map +1 -1
  227. package/lib/utils/style.d.ts +13 -8
  228. package/lib/utils/style.js +18 -13
  229. package/lib/utils/style.js.map +1 -1
  230. package/package.json +9 -9
  231. package/src/behaviors/click-select.ts +59 -60
  232. package/src/behaviors/lasso-select.ts +2 -2
  233. package/src/elements/base-element.ts +1 -25
  234. package/src/elements/combos/base-combo.ts +27 -11
  235. package/src/elements/edges/base-edge.ts +28 -8
  236. package/src/elements/effect.ts +74 -0
  237. package/src/elements/nodes/base-node.ts +23 -18
  238. package/src/elements/nodes/circle.ts +1 -1
  239. package/src/elements/nodes/diamond.ts +0 -7
  240. package/src/elements/nodes/ellipse.ts +1 -1
  241. package/src/elements/nodes/image.ts +2 -2
  242. package/src/elements/nodes/rect.ts +1 -1
  243. package/src/elements/shapes/badge.ts +17 -5
  244. package/src/elements/shapes/base-shape.ts +35 -15
  245. package/src/elements/shapes/icon.ts +18 -7
  246. package/src/elements/shapes/label.ts +19 -6
  247. package/src/elements/shapes/polygon.ts +1 -1
  248. package/src/exports.ts +6 -2
  249. package/src/index.ts +6 -2
  250. package/src/layouts/base-layout.ts +5 -1
  251. package/src/plugins/bubble-sets.ts +2 -2
  252. package/src/plugins/hull/index.ts +2 -2
  253. package/src/runtime/canvas.ts +15 -10
  254. package/src/runtime/data.ts +22 -44
  255. package/src/runtime/element.ts +80 -26
  256. package/src/runtime/graph.ts +398 -126
  257. package/src/runtime/layout.ts +2 -2
  258. package/src/spec/element/edge.ts +1 -1
  259. package/src/spec/element/node.ts +1 -1
  260. package/src/themes/base.ts +2 -0
  261. package/src/transforms/collapse-expand-node.ts +13 -4
  262. package/src/transforms/process-parallel-edges.ts +2 -2
  263. package/src/types/callable.ts +0 -12
  264. package/src/types/data.ts +13 -0
  265. package/src/types/edge.ts +11 -0
  266. package/src/types/element.ts +106 -10
  267. package/src/types/index.ts +0 -1
  268. package/src/types/point.ts +0 -1
  269. package/src/utils/element.ts +3 -13
  270. package/src/utils/layout.ts +6 -6
  271. package/src/utils/path.ts +3 -3
  272. package/src/utils/position.ts +8 -8
  273. package/src/utils/style.ts +19 -12
  274. package/dist/lib/types/position.d.ts +0 -2
  275. package/esm/types/position.d.ts +0 -2
  276. package/esm/types/position.js +0 -2
  277. package/esm/types/position.js.map +0 -1
  278. package/lib/types/position.d.ts +0 -2
  279. package/lib/types/position.js +0 -3
  280. package/lib/types/position.js.map +0 -1
  281. package/src/types/position.ts +0 -3
@@ -13,7 +13,6 @@ const dom_1 = require("../utils/dom");
13
13
  const event_1 = require("../utils/event");
14
14
  const id_1 = require("../utils/id");
15
15
  const point_1 = require("../utils/point");
16
- const style_1 = require("../utils/style");
17
16
  const vector_1 = require("../utils/vector");
18
17
  const animation_1 = require("./animation");
19
18
  const batch_1 = require("./batch");
@@ -124,7 +123,7 @@ class Graph extends event_emitter_1.default {
124
123
  return this.options.background;
125
124
  }
126
125
  /**
127
- * <zh/> 获取当前图容器的大小
126
+ * <zh/> 获取当前画布容器的尺寸
128
127
  *
129
128
  * <en/> Get the size of the current canvas container
130
129
  * @returns <zh/> 画布尺寸 | <en/> canvas size
@@ -136,7 +135,7 @@ class Graph extends event_emitter_1.default {
136
135
  return [this.options.width || 0, this.options.height || 0];
137
136
  }
138
137
  /**
139
- * <zh/> 获取当前图容器的大小
138
+ * <zh/> 获取当前画布容器的尺寸
140
139
  *
141
140
  * <en/> Get the size of the current canvas container
142
141
  * @param width - <zh/> 画布宽度 | <en/> canvas width
@@ -171,7 +170,11 @@ class Graph extends event_emitter_1.default {
171
170
  * <zh/> 设置节点样式映射
172
171
  *
173
172
  * <en/> Set node mapper
174
- * @param node - <zh/> 节点配置 | <en/> node configuration
173
+ * @param node - <zh/> 节点配置 | <en/> node options
174
+ * @remarks
175
+ * <zh/> 即 `options.node` 的值
176
+ *
177
+ * <en/> The value of `options.node`
175
178
  * @apiCategory element
176
179
  */
177
180
  setNode(node) {
@@ -182,7 +185,11 @@ class Graph extends event_emitter_1.default {
182
185
  * <zh/> 设置边样式映射
183
186
  *
184
187
  * <en/> Set edge mapper
185
- * @param edge - <zh/> 边配置 | <en/> edge configuration
188
+ * @param edge - <zh/> 边配置 | <en/> edge options
189
+ * @remarks
190
+ * <zh/> 即 `options.edge` 的值
191
+ *
192
+ * <en/> The value of `options.edge`
186
193
  * @apiCategory element
187
194
  */
188
195
  setEdge(edge) {
@@ -193,7 +200,11 @@ class Graph extends event_emitter_1.default {
193
200
  * <zh/> 设置组合样式映射
194
201
  *
195
202
  * <en/> Set combo mapper
196
- * @param combo - <zh/> 组合配置 | <en/> combo configuration
203
+ * @param combo - <zh/> 组合配置 | <en/> combo options
204
+ * @remarks
205
+ * <zh/> 即 `options.combo` 的值
206
+ *
207
+ * <en/> The value of `options.combo`
197
208
  * @apiCategory element
198
209
  */
199
210
  setCombo(combo) {
@@ -204,7 +215,7 @@ class Graph extends event_emitter_1.default {
204
215
  * <zh/> 获取主题
205
216
  *
206
217
  * <en/> Get theme
207
- * @returns <zh/> 主题配置 | <en/> theme configuration
218
+ * @returns <zh/> 当前主题 | <en/> current theme
208
219
  * @apiCategory theme
209
220
  */
210
221
  getTheme() {
@@ -214,7 +225,11 @@ class Graph extends event_emitter_1.default {
214
225
  * <zh/> 设置主题
215
226
  *
216
227
  * <en/> Set theme
217
- * @param theme - <zh/> 主题配置 | <en/> theme configuration
228
+ * @param theme - <zh/> 主题名 | <en/> theme name
229
+ * @example
230
+ * ```ts
231
+ * graph.setTheme('dark');
232
+ * ```
218
233
  * @apiCategory theme
219
234
  */
220
235
  setTheme(theme) {
@@ -228,17 +243,23 @@ class Graph extends event_emitter_1.default {
228
243
  * <zh/> 设置布局
229
244
  *
230
245
  * <en/> Set layout
231
- * @param layout - <zh/> 布局配置 | <en/> layout configuration
246
+ * @param layout - <zh/> 布局配置 | <en/> layout options
247
+ * @example
248
+ * ```ts
249
+ * graph.setLayout({
250
+ * type: 'dagre',
251
+ * })
252
+ * ```
232
253
  * @apiCategory layout
233
254
  */
234
255
  setLayout(layout) {
235
256
  this.options.layout = (0, util_1.isFunction)(layout) ? layout(this.getLayout()) : layout;
236
257
  }
237
258
  /**
238
- * <zh/> 获取布局
259
+ * <zh/> 获取布局配置
239
260
  *
240
- * <en/> Get layout
241
- * @returns <zh/> 布局配置 | <en/> layout configuration
261
+ * <en/> Get layout options
262
+ * @returns <zh/> 布局配置 | <en/> layout options
242
263
  * @apiCategory layout
243
264
  */
244
265
  getLayout() {
@@ -248,7 +269,15 @@ class Graph extends event_emitter_1.default {
248
269
  * <zh/> 设置交互
249
270
  *
250
271
  * <en/> Set behaviors
251
- * @param behaviors - <zh/> 交互配置 | <en/> behavior configuration
272
+ * @param behaviors - <zh/> 交互配置 | <en/> behavior options
273
+ * @remarks
274
+ * <zh/> 设置的交互会全量替换原有的交互,如果需要新增交互可以使用如下方式:
275
+ *
276
+ * <en/> The set behavior will completely replace the original behavior. If you need to add behavior, you can use the following method:
277
+ *
278
+ * ```ts
279
+ * graph.setBehaviors((behaviors) => [...behaviors, { type: 'zoom-canvas' }])
280
+ * ```
252
281
  * @apiCategory behavior
253
282
  */
254
283
  setBehaviors(behaviors) {
@@ -256,10 +285,21 @@ class Graph extends event_emitter_1.default {
256
285
  this.context.behavior?.setBehaviors(this.options.behaviors);
257
286
  }
258
287
  /**
259
- * <zh/> 更新交互
288
+ * <zh/> 更新指定的交互配置
289
+ *
290
+ * <en/> Update specified behavior options
291
+ * @param behavior - <zh/> 交互配置 | <en/> behavior options
292
+ * @remarks
293
+ * <zh/> 如果要更新一个交互,那么必须在交互配置中指定 key 字段,例如:
294
+ *
295
+ * <en/> If you want to update a behavior, you must specify the key field in the behavior options, for example:
296
+ * ```ts
297
+ * {
298
+ * behaviors: [{ type: 'zoom-canvas', key: 'zoom-canvas' }]
299
+ * }
260
300
  *
261
- * <en/> Update behavior
262
- * @param behavior - <zh/> 交互配置 | <en/> behavior configuration
301
+ * graph.updateBehavior({ key: 'zoom-canvas', enable: false })
302
+ * ```
263
303
  * @apiCategory behavior
264
304
  */
265
305
  updateBehavior(behavior) {
@@ -271,20 +311,27 @@ class Graph extends event_emitter_1.default {
271
311
  }));
272
312
  }
273
313
  /**
274
- * <zh/> 获取交互
314
+ * <zh/> 获取交互配置
275
315
  *
276
- * <en/> Get behaviors
277
- * @returns <zh/> 交互配置 | <en/> behavior configuration
316
+ * <en/> Get behaviors options
317
+ * @returns <zh/> 交互配置 | <en/> behavior options
278
318
  * @apiCategory behavior
279
319
  */
280
320
  getBehaviors() {
281
321
  return this.options.behaviors || [];
282
322
  }
283
323
  /**
284
- * <zh/> 设置插件
324
+ * <zh/> 设置插件配置
285
325
  *
286
- * <en/> Set plugins
287
- * @param plugins - <zh/> 插件配置 | <en/> plugin configuration
326
+ * <en/> Set plugins options
327
+ * @param plugins - <zh/> 插件配置 | <en/> plugin options
328
+ * @remarks
329
+ * <zh/> 设置的插件会全量替换原有的插件配置,如果需要新增插件可以使用如下方式:
330
+ *
331
+ * <en/> The set plugin will completely replace the original plugin configuration. If you need to add a plugin, you can use the following method:
332
+ * ```ts
333
+ * graph.setPlugins((plugins) => [...plugins, { key: 'grid-line' }])
334
+ * ```
288
335
  * @apiCategory plugin
289
336
  */
290
337
  setPlugins(plugins) {
@@ -292,10 +339,21 @@ class Graph extends event_emitter_1.default {
292
339
  this.context.plugin?.setPlugins(this.options.plugins);
293
340
  }
294
341
  /**
295
- * <zh/> 更新插件
342
+ * <zh/> 更新插件配置
296
343
  *
297
- * <en/> Update plugin
298
- * @param plugin - <zh/> 插件配置 | <en/> plugin configuration
344
+ * <en/> Update plugin options
345
+ * @param plugin - <zh/> 插件配置 | <en/> plugin options
346
+ * @remarks
347
+ * <zh/> 如果要更新一个插件,那么必须在插件配置中指定 key 字段,例如:
348
+ *
349
+ * <en/> If you want to update a plugin, you must specify the key field in the plugin options, for example:
350
+ * ```ts
351
+ * {
352
+ * plugins: [{ key: 'grid-line' }]
353
+ * }
354
+ *
355
+ * graph.updatePlugin({ key: 'grid-line', follow: true })
356
+ * ```
299
357
  * @apiCategory plugin
300
358
  */
301
359
  updatePlugin(plugin) {
@@ -307,10 +365,10 @@ class Graph extends event_emitter_1.default {
307
365
  }));
308
366
  }
309
367
  /**
310
- * <zh/> 获取插件
368
+ * <zh/> 获取插件配置
311
369
  *
312
- * <en/> Get plugins
313
- * @returns <zh/> 插件配置 | <en/> plugin configuration
370
+ * <en/> Get plugins options
371
+ * @returns <zh/> 插件配置 | <en/> plugin options
314
372
  * @apiCategory plugin
315
373
  */
316
374
  getPlugins() {
@@ -322,6 +380,17 @@ class Graph extends event_emitter_1.default {
322
380
  * <en/> Get plugin instance
323
381
  * @param key - <zh/> 插件 key | <en/> plugin key
324
382
  * @returns <zh/> 插件实例 | <en/> plugin instance
383
+ * @remarks
384
+ * <zh/> 一些插件提供了 API 方法可供调用,例如全屏插件可以调用 `request` 和 `exit` 方法来请求和退出全屏
385
+ *
386
+ * <en/> Some plugins provide API methods for calling, such as the full-screen plugin can call the `request` and `exit` methods to request and exit full-screen
387
+ * ```ts
388
+ * const fullscreen = graph.getPluginInstance('fullscreen');
389
+ *
390
+ * fullscreen.request();
391
+ *
392
+ * fullscreen.exit();
393
+ * ```
325
394
  * @apiCategory plugin
326
395
  */
327
396
  getPluginInstance(key) {
@@ -331,7 +400,11 @@ class Graph extends event_emitter_1.default {
331
400
  * <zh/> 设置数据转换器
332
401
  *
333
402
  * <en/> Set data transforms
334
- * @param transforms - <zh/> 数据转换配置 | <en/> data transform configuration
403
+ * @param transforms - <zh/> 数据转换配置 | <en/> data transform options
404
+ * @remarks
405
+ * <zh/> 数据转换器能够在图渲染过程中执行数据转换,目前支持在渲染前对绘制数据进行转化。
406
+ *
407
+ * <en/> Data transforms can perform data transformation during the rendering process of the graph. Currently, it supports transforming the drawing data before rendering.
335
408
  * @apiCategory transform
336
409
  */
337
410
  setTransforms(transforms) {
@@ -342,7 +415,7 @@ class Graph extends event_emitter_1.default {
342
415
  * <zh/> 更新数据转换器
343
416
  *
344
417
  * <en/> Update data transform
345
- * @param transform - <zh/> 数据转换配置 | <en/> data transform configuration
418
+ * @param transform - <zh/> 数据转换器配置 | <en/> data transform options
346
419
  * @apiCategory transform
347
420
  */
348
421
  updateTransform(transform) {
@@ -355,20 +428,23 @@ class Graph extends event_emitter_1.default {
355
428
  this.context.model.refreshData();
356
429
  }
357
430
  /**
358
- * <zh/> 获取数据转换器
431
+ * <zh/> 获取数据转换器配置
359
432
  *
360
- * <en/> Get data transforms
361
- * @returns <zh/> 数据转换器实例 | <en/> data transform instance
433
+ * <en/> Get data transforms options
434
+ * @returns <zh/> 数据转换配置 | <en/> data transform options
362
435
  * @apiCategory transform
363
436
  */
364
437
  getTransforms() {
365
438
  return this.options.transforms || [];
366
439
  }
367
440
  /**
368
- * <zh/> 获取数据
441
+ * <zh/> 获取图数据
442
+ *
443
+ * <en/> Get graph data
444
+ * @returns <zh/> 图数据 | <en/> Graph data
445
+ * <zh/> 获取当前图的数据,包括节点、边、组合数据
369
446
  *
370
- * <en/> Get data
371
- * @returns <zh/> 数据 | <en/> data
447
+ * <en/> Get the data of the current graph, including node, edge, and combo data
372
448
  * @apiCategory data
373
449
  */
374
450
  getData() {
@@ -405,6 +481,10 @@ class Graph extends event_emitter_1.default {
405
481
  *
406
482
  * <en/> Set full data
407
483
  * @param data - <zh/> 数据 | <en/> data
484
+ * @remarks
485
+ * <zh/> 设置全量数据会替换当前图中的所有数据,G6 会自动进行数据差异计算
486
+ *
487
+ * <en/> Setting full data will replace all data in the current graph, and G6 will automatically calculate the data difference
408
488
  * @apiCategory data
409
489
  */
410
490
  setData(data) {
@@ -415,6 +495,13 @@ class Graph extends event_emitter_1.default {
415
495
  *
416
496
  * <en/> Add element data
417
497
  * @param data - <zh/> 元素数据 | <en/> element data
498
+ * @example
499
+ * ```ts
500
+ * graph.addData({
501
+ * nodes: [{ id: 'node-1' }, { id: 'node-2' }],
502
+ * edges: [{ source: 'node-1', target: 'node-2' }],
503
+ * });
504
+ * ```
418
505
  * @apiCategory data
419
506
  */
420
507
  addData(data) {
@@ -425,6 +512,10 @@ class Graph extends event_emitter_1.default {
425
512
  *
426
513
  * <en/> Add node data
427
514
  * @param data - <zh/> 节点数据 | <en/> node data
515
+ * @example
516
+ * ```ts
517
+ * graph.addNodeData([{ id: 'node-1' }, { id: 'node-2' }]);
518
+ * ```
428
519
  * @apiCategory data
429
520
  */
430
521
  addNodeData(data) {
@@ -435,6 +526,10 @@ class Graph extends event_emitter_1.default {
435
526
  *
436
527
  * <en/> Add edge data
437
528
  * @param data - <zh/> 边数据 | <en/> edge data
529
+ * @example
530
+ * ```ts
531
+ * graph.addEdgeData([{ source: 'node-1', target: 'node-2' }]);
532
+ * ```
438
533
  * @apiCategory data
439
534
  */
440
535
  addEdgeData(data) {
@@ -445,16 +540,45 @@ class Graph extends event_emitter_1.default {
445
540
  *
446
541
  * <en/> Add combo data
447
542
  * @param data - <zh/> 组合数据 | <en/> combo data
543
+ * @example
544
+ * ```ts
545
+ * graph.addComboData([{ id: 'combo-1' }]);
546
+ * ```
448
547
  * @apiCategory data
449
548
  */
450
549
  addComboData(data) {
451
550
  this.context.model.addComboData((0, util_1.isFunction)(data) ? data(this.getComboData()) : data);
452
551
  }
552
+ /**
553
+ * <zh/> 为树图节点添加子节点数据
554
+ *
555
+ * <en/> Add child node data to the tree node
556
+ * @param parentId - <zh/> 父节点 ID | <en/> parent node ID
557
+ * @param childrenData - <zh/> 子节点数据 | <en/> child node data
558
+ * @remarks
559
+ * <zh/> 为组合添加子节点使用 addNodeData / addComboData 方法
560
+ *
561
+ * <en/> Use addNodeData / addComboData method to add child nodes to the combo
562
+ */
563
+ addChildrenData(parentId, childrenData) {
564
+ this.context.model.addChildrenData(parentId, childrenData);
565
+ }
453
566
  /**
454
567
  * <zh/> 更新元素数据
455
568
  *
456
569
  * <en/> Update element data
457
570
  * @param data - <zh/> 元素数据 | <en/> element data
571
+ * @remarks
572
+ * <zh/> 只需要传入需要更新的数据即可,不必传入完整的数据
573
+ *
574
+ * <en/> Just pass in the data that needs to be updated, no need to pass in the complete data
575
+ * @example
576
+ * ```ts
577
+ * graph.updateData({
578
+ * nodes: [{ id: 'node-1', style: { x: 100, y: 100 } }],
579
+ * edges: [{ id: 'edge-1', style: { lineWidth: 2 } }]
580
+ * });
581
+ * ```
458
582
  * @apiCategory data
459
583
  */
460
584
  updateData(data) {
@@ -465,6 +589,14 @@ class Graph extends event_emitter_1.default {
465
589
  *
466
590
  * <en/> Update node data
467
591
  * @param data - <zh/> 节点数据 | <en/> node data
592
+ * @remarks
593
+ * <zh/> 只需要传入需要更新的数据即可,不必传入完整的数据
594
+ *
595
+ * <en/> Just pass in the data that needs to be updated, no need to pass in the complete data
596
+ * @example
597
+ * ```ts
598
+ * graph.updateNodeData([{ id: 'node-1', style: { x: 100, y: 100 } }]);
599
+ * ```
468
600
  * @apiCategory data
469
601
  */
470
602
  updateNodeData(data) {
@@ -475,6 +607,14 @@ class Graph extends event_emitter_1.default {
475
607
  *
476
608
  * <en/> Update edge data
477
609
  * @param data - <zh/> 边数据 | <en/> edge data
610
+ * @remarks
611
+ * <zh/> 只需要传入需要更新的数据即可,不必传入完整的数据
612
+ *
613
+ * <en/> Just pass in the data that needs to be updated, no need to pass in the complete data
614
+ * @example
615
+ * ```ts
616
+ * graph.updateEdgeData([{ id: 'edge-1', style: { lineWidth: 2 } }]);
617
+ * ```
478
618
  * @apiCategory data
479
619
  */
480
620
  updateEdgeData(data) {
@@ -485,46 +625,77 @@ class Graph extends event_emitter_1.default {
485
625
  *
486
626
  * <en/> Update combo data
487
627
  * @param data - <zh/> 组合数据 | <en/> combo data
628
+ * @remarks
629
+ * <zh/> 只需要传入需要更新的数据即可,不必传入完整的数据
630
+ *
631
+ * <en/> Just pass in the data that needs to be updated, no need to pass in the complete data
632
+ * @example
633
+ * ```ts
634
+ * graph.updateComboData([{ id: 'combo-1', style: { x: 100, y: 100 } }]);
635
+ * ```
488
636
  * @apiCategory data
489
637
  */
490
638
  updateComboData(data) {
491
639
  this.context.model.updateComboData((0, util_1.isFunction)(data) ? data(this.getComboData()) : data);
492
640
  }
493
641
  /**
494
- * <zh/> 删除多条元素数据
642
+ * <zh/> 删除元素数据
495
643
  *
496
- * <en/> Remove multiple element data
644
+ * <en/> Remove element data
497
645
  * @param ids - <zh/> 元素 ID 数组 | <en/> element ID array
646
+ * @example
647
+ * ```ts
648
+ * graph.removeData({
649
+ * nodes: ['node-1', 'node-2'],
650
+ * edges: ['edge-1'],
651
+ * });
652
+ * ```
498
653
  * @apiCategory data
499
654
  */
500
655
  removeData(ids) {
501
656
  this.context.model.removeData((0, util_1.isFunction)(ids) ? ids(this.getData()) : ids);
502
657
  }
503
658
  /**
504
- * <zh/> 删除多条节点数据
659
+ * <zh/> 删除节点数据
505
660
  *
506
- * <en/> Remove multiple node data
661
+ * <en/> Remove node data
507
662
  * @param ids - <zh/> 节点 ID 数组 | <en/> node ID array
663
+ * @example
664
+ * ```ts
665
+ * graph.removeNodeData(['node-1', 'node-2']);
666
+ * ```
508
667
  * @apiCategory data
509
668
  */
510
669
  removeNodeData(ids) {
511
670
  this.context.model.removeNodeData((0, util_1.isFunction)(ids) ? ids(this.getNodeData()) : ids);
512
671
  }
513
672
  /**
514
- * <zh/> 删除多条边数据
673
+ * <zh/> 删除边数据
515
674
  *
516
- * <en/> Remove multiple edge data
675
+ * <en/> Remove edge data
517
676
  * @param ids - <zh/> 边 ID 数组 | <en/> edge ID array
677
+ * @remarks
678
+ * <zh/> 如果传入边数据时仅提供了 source 和 target,那么需要通过 `idOf` 方法获取边的实际 ID
679
+ *
680
+ * <en/> If only the source and target are provided when passing in the edge data, you need to get the actual ID of the edge through the `idOf` method
681
+ * @example
682
+ * ```ts
683
+ * graph.removeEdgeData(['edge-1']);
684
+ * ```
518
685
  * @apiCategory data
519
686
  */
520
687
  removeEdgeData(ids) {
521
688
  this.context.model.removeEdgeData((0, util_1.isFunction)(ids) ? ids(this.getEdgeData()) : ids);
522
689
  }
523
690
  /**
524
- * <zh/> 删除多条组合数据
691
+ * <zh/> 删除组合数据
525
692
  *
526
- * <en/> Remove multiple combo data
693
+ * <en/> Remove combo data
527
694
  * @param ids - <zh/> 组合 ID 数组 | <en/> 组合 ID array
695
+ * @example
696
+ * ```ts
697
+ * graph.removeComboData(['combo-1']);
698
+ * ```
528
699
  * @apiCategory data
529
700
  */
530
701
  removeComboData(ids) {
@@ -666,7 +837,11 @@ class Graph extends event_emitter_1.default {
666
837
  * @remarks
667
838
  * <zh/> 此过程会执行数据更新、绘制元素、执行布局
668
839
  *
840
+ * > ⚠️ render 为异步方法,如果需要在 render 后执行一些操作,可以使用 `await graph.render()` 或者监听 GraphEvent.AFTER_RENDER 事件
841
+ *
669
842
  * <en/> This process will execute data update, element rendering, and layout execution
843
+ *
844
+ * > ⚠️ render is an asynchronous method. If you need to perform some operations after render, you can use `await graph.render()` or listen to the GraphEvent.AFTER_RENDER event
670
845
  * @apiCategory render
671
846
  */
672
847
  async render() {
@@ -682,7 +857,15 @@ class Graph extends event_emitter_1.default {
682
857
  *
683
858
  * <en/> Draw elements
684
859
  * @returns <zh/> 渲染结果 | <en/> draw result
685
- * @apiCategory element
860
+ * @remarks
861
+ * <zh/> 仅执行元素绘制,不会重新布局
862
+ *
863
+ * <zh/> ⚠️ draw 为异步方法,如果需要在 draw 后执行一些操作,可以使用 `await graph.draw()` 或者监听 GraphEvent.AFTER_DRAW 事件
864
+ *
865
+ * <en/> Only execute element drawing, no re-layout
866
+ *
867
+ * <en/> ⚠️ draw is an asynchronous method. If you need to perform some operations after draw, you can use `await graph.draw()` or listen to the GraphEvent.AFTER_DRAW event
868
+ * @apiCategory render
686
869
  */
687
870
  async draw() {
688
871
  await this.prepare();
@@ -725,6 +908,10 @@ class Graph extends event_emitter_1.default {
725
908
  * <zh/> 销毁当前图实例
726
909
  *
727
910
  * <en/> Destroy the current graph instance
911
+ * @remarks
912
+ * <zh/> 销毁后无法进行任何操作,如果需要重新使用,需要重新创建一个新的图实例
913
+ *
914
+ * <en/> After destruction, no operations can be performed. If you need to reuse it, you need to create a new graph instance
728
915
  * @apiCategory instance
729
916
  */
730
917
  destroy() {
@@ -768,7 +955,7 @@ class Graph extends event_emitter_1.default {
768
955
  *
769
956
  * <en/> Zoom the graph to fit the viewport and move it to the center of the viewport
770
957
  * @param options - <zh/> 适配配置 | <en/> fit options
771
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
958
+ * @param animation - <zh/> 动画配置 | <en/> animation options
772
959
  * @apiCategory viewport
773
960
  */
774
961
  async fitView(options, animation) {
@@ -778,7 +965,7 @@ class Graph extends event_emitter_1.default {
778
965
  * <zh/> 将图平移至视口中心
779
966
  *
780
967
  * <en/> Move the graph to the center of the viewport
781
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
968
+ * @param animation - <zh/> 动画配置 | <en/> animation options
782
969
  * @apiCategory viewport
783
970
  */
784
971
  async fitCenter(animation) {
@@ -803,22 +990,26 @@ class Graph extends event_emitter_1.default {
803
990
  }
804
991
  }
805
992
  /**
993
+ * <zh/> 聚焦元素
994
+ *
995
+ * <en/> Focus on element
996
+ * @param id - <zh/> 元素 ID | <en/> element ID
997
+ * @param animation - <zh/> 动画配置 | <en/> animation options
998
+ * @remarks
806
999
  * <zh/> 移动图,使得元素对齐到视口中心
807
1000
  *
808
1001
  * <en/> Move the graph so that the element is aligned to the center of the viewport
809
- * @param id - <zh/> 元素 ID | <en/> element ID
810
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
811
1002
  * @apiCategory viewport
812
1003
  */
813
1004
  async focusElement(id, animation) {
814
1005
  await this.context.viewport?.focusElements(Array.isArray(id) ? id : [id], animation);
815
1006
  }
816
1007
  /**
817
- * <zh/> 基于当前缩放比例进行缩放
1008
+ * <zh/> 基于当前缩放比例进行缩放(相对缩放)
818
1009
  *
819
- * <en/> Zoom based on the current zoom ratio
1010
+ * <en/> Zoom based on the current zoom ratio (relative zoom)
820
1011
  * @param ratio - <zh/> 缩放比例 | <en/> zoom ratio
821
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
1012
+ * @param animation - <zh/> 动画配置 | <en/> animation options
822
1013
  * @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
823
1014
  * @remarks
824
1015
  * <zh/>
@@ -834,11 +1025,11 @@ class Graph extends event_emitter_1.default {
834
1025
  await this.context.viewport.transform({ mode: 'relative', scale: ratio, origin }, animation);
835
1026
  }
836
1027
  /**
837
- * <zh/> 缩放画布至指定比例
1028
+ * <zh/> 缩放画布至指定比例(绝对缩放)
838
1029
  *
839
- * <en/> Zoom the canvas to the specified ratio
1030
+ * <en/> Zoom the canvas to the specified ratio (absolute zoom)
840
1031
  * @param zoom - <zh/> 指定缩放比例 | <en/> specified zoom ratio
841
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
1032
+ * @param animation - <zh/> 动画配置 | <en/> animation options
842
1033
  * @param origin - <zh/> 缩放中心(视口坐标) | <en/> zoom center(viewport coordinates)
843
1034
  * @remarks
844
1035
  * <zh/>
@@ -866,11 +1057,11 @@ class Graph extends event_emitter_1.default {
866
1057
  return this.context.viewport.getZoom();
867
1058
  }
868
1059
  /**
869
- * <zh/> 基于当前旋转角度进行旋转
1060
+ * <zh/> 基于当前旋转角度进行旋转(相对旋转)
870
1061
  *
871
- * <en/> Rotate based on the current rotation angle
1062
+ * <en/> Rotate based on the current rotation angle (relative rotation)
872
1063
  * @param angle - <zh/> 旋转角度 | <en/> rotation angle
873
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
1064
+ * @param animation - <zh/> 动画配置 | <en/> animation options
874
1065
  * @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
875
1066
  * @apiCategory viewport
876
1067
  */
@@ -878,11 +1069,11 @@ class Graph extends event_emitter_1.default {
878
1069
  await this.context.viewport.transform({ mode: 'relative', rotate: angle, origin }, animation);
879
1070
  }
880
1071
  /**
881
- * <zh/> 旋转画布至指定角度
1072
+ * <zh/> 旋转画布至指定角度 (绝对旋转)
882
1073
  *
883
- * <en/> Rotate the canvas to the specified angle
1074
+ * <en/> Rotate the canvas to the specified angle (absolute rotation)
884
1075
  * @param angle - <zh/> 目标角度 | <en/> target angle
885
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
1076
+ * @param animation - <zh/> 动画配置 | <en/> animation options
886
1077
  * @param origin - <zh/> 旋转中心(视口坐标) | <en/> rotation center(viewport coordinates)
887
1078
  * @apiCategory viewport
888
1079
  */
@@ -900,22 +1091,22 @@ class Graph extends event_emitter_1.default {
900
1091
  return this.context.viewport.getRotation();
901
1092
  }
902
1093
  /**
903
- * <zh/> 将图平移指定距离
1094
+ * <zh/> 将图平移指定距离 (相对平移)
904
1095
  *
905
- * <en/> Translate the graph by the specified distance
1096
+ * <en/> Translate the graph by the specified distance (relative translation)
906
1097
  * @param offset - <zh/> 偏移量 | <en/> offset
907
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
1098
+ * @param animation - <zh/> 动画配置 | <en/> animation options
908
1099
  * @apiCategory viewport
909
1100
  */
910
1101
  async translateBy(offset, animation) {
911
1102
  await this.context.viewport.transform({ mode: 'relative', translate: offset }, animation);
912
1103
  }
913
1104
  /**
914
- * <zh/> 将图平移至指定位置
1105
+ * <zh/> 将图平移至指定位置 (绝对平移)
915
1106
  *
916
- * <en/> Translate the graph to the specified position
1107
+ * <en/> Translate the graph to the specified position (absolute translation)
917
1108
  * @param position - <zh/> 指定位置 | <en/> specified position
918
- * @param animation - <zh/> 动画配置 | <en/> animation configuration
1109
+ * @param animation - <zh/> 动画配置 | <en/> animation options
919
1110
  * @apiCategory viewport
920
1111
  */
921
1112
  async translateTo(position, animation) {
@@ -1042,17 +1233,17 @@ class Graph extends event_emitter_1.default {
1042
1233
  */
1043
1234
  async frontElement(id) {
1044
1235
  const ids = Array.isArray(id) ? id : [id];
1045
- const { model } = this.context;
1236
+ const { model, element } = this.context;
1046
1237
  const config = {};
1047
1238
  ids.map((_id) => {
1048
- const zIndex = model.getFrontZIndex(_id);
1239
+ const zIndex = element.getFrontZIndex(_id);
1049
1240
  const elementType = model.getElementType(_id);
1050
1241
  if (elementType === 'combo') {
1051
1242
  const ancestor = model.getAncestorsData(_id, constants_1.COMBO_KEY).at(-1) || this.getComboData(_id);
1052
- const combos = [ancestor, ...model.getDescendantsData((0, id_1.idOf)(ancestor))].filter((datum) => model.isCombo((0, id_1.idOf)(datum)));
1053
- const delta = zIndex - (0, style_1.zIndexOf)(ancestor);
1243
+ const combos = [ancestor, ...model.getDescendantsData((0, id_1.idOf)(ancestor))];
1244
+ const delta = zIndex - element.getElementZIndex(_id);
1054
1245
  combos.forEach((combo) => {
1055
- config[(0, id_1.idOf)(combo)] = (0, style_1.zIndexOf)(combo) + delta;
1246
+ config[(0, id_1.idOf)(combo)] = this.getElementZIndex((0, id_1.idOf)(combo)) + delta;
1056
1247
  });
1057
1248
  }
1058
1249
  else
@@ -1069,7 +1260,8 @@ class Graph extends event_emitter_1.default {
1069
1260
  * @apiCategory element
1070
1261
  */
1071
1262
  getElementZIndex(id) {
1072
- return (0, style_1.zIndexOf)(this.context.model.getElementDataById(id));
1263
+ const { model, element } = this.context;
1264
+ return model.getElementDataById(id)?.style?.zIndex ?? element.getElementZIndex(id);
1073
1265
  }
1074
1266
  async setElementState(args1, args2, args3 = true) {
1075
1267
  const [config, animation] = (0, util_1.isObject)(args1)
@@ -1112,7 +1304,7 @@ class Graph extends event_emitter_1.default {
1112
1304
  }
1113
1305
  isCollapsingExpanding = false;
1114
1306
  /**
1115
- * <zh/> 收起 Combo
1307
+ * <zh/> 收起组合
1116
1308
  *
1117
1309
  * <en/> Collapse Combo
1118
1310
  * @param id - <zh/> 元素 ID | <en/> element ID
@@ -1135,7 +1327,7 @@ class Graph extends event_emitter_1.default {
1135
1327
  this.isCollapsingExpanding = false;
1136
1328
  }
1137
1329
  /**
1138
- * <zh/> 展开 Combo
1330
+ * <zh/> 展开组合
1139
1331
  *
1140
1332
  * <en/> Expand Combo
1141
1333
  * @param id - <zh/> 元素 ID | <en/> element ID
@@ -1168,7 +1360,7 @@ class Graph extends event_emitter_1.default {
1168
1360
  * <zh/> 导出画布内容为 DataURL
1169
1361
  *
1170
1362
  * <en/> Export canvas content as DataURL
1171
- * @param options - <zh/> 导出配置 | <en/> export configuration
1363
+ * @param options - <zh/> 导出配置 | <en/> export options
1172
1364
  * @returns <zh/> DataURL | <en/> DataURL
1173
1365
  * @apiCategory exportImage
1174
1366
  */
@@ -1268,6 +1460,9 @@ class Graph extends event_emitter_1.default {
1268
1460
  once(eventName, callback) {
1269
1461
  return super.once(eventName, callback);
1270
1462
  }
1463
+ off(eventName, callback) {
1464
+ return super.off(eventName, callback);
1465
+ }
1271
1466
  }
1272
1467
  exports.Graph = Graph;
1273
1468
  //# sourceMappingURL=graph.js.map