@antv/g6 5.0.33 → 5.0.34

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 (99) hide show
  1. package/dist/g6.min.js +3 -3
  2. package/dist/lib/behaviors/optimize-viewport-transform.d.ts +1 -1
  3. package/dist/lib/elements/edges/base-edge.d.ts +5 -5
  4. package/dist/lib/elements/nodes/base-node.d.ts +2 -0
  5. package/dist/lib/elements/shapes/base-shape.d.ts +2 -2
  6. package/dist/lib/exports.d.ts +2 -2
  7. package/dist/lib/layouts/fishbone.d.ts +2 -1
  8. package/dist/lib/layouts/index.d.ts +2 -0
  9. package/dist/lib/layouts/snake.d.ts +80 -0
  10. package/dist/lib/layouts/types.d.ts +3 -1
  11. package/dist/lib/plugins/minimap/index.d.ts +1 -1
  12. package/dist/lib/spec/canvas.d.ts +26 -2
  13. package/dist/lib/spec/graph.d.ts +60 -12
  14. package/dist/lib/spec/viewport.d.ts +4 -0
  15. package/dist/lib/utils/cache.d.ts +5 -5
  16. package/dist/lib/utils/style.d.ts +5 -5
  17. package/dist/lib/version.d.ts +1 -1
  18. package/esm/behaviors/optimize-viewport-transform.d.ts +1 -1
  19. package/esm/elements/edges/base-edge.d.ts +5 -5
  20. package/esm/elements/nodes/base-node.d.ts +2 -0
  21. package/esm/elements/nodes/base-node.js +2 -2
  22. package/esm/elements/nodes/base-node.js.map +1 -1
  23. package/esm/elements/shapes/base-shape.d.ts +2 -2
  24. package/esm/elements/shapes/base-shape.js +2 -2
  25. package/esm/exports.d.ts +2 -2
  26. package/esm/exports.js +1 -1
  27. package/esm/exports.js.map +1 -1
  28. package/esm/layouts/fishbone.d.ts +2 -1
  29. package/esm/layouts/fishbone.js +1 -1
  30. package/esm/layouts/fishbone.js.map +1 -1
  31. package/esm/layouts/index.d.ts +2 -0
  32. package/esm/layouts/index.js +1 -0
  33. package/esm/layouts/index.js.map +1 -1
  34. package/esm/layouts/snake.d.ts +80 -0
  35. package/esm/layouts/snake.js +162 -0
  36. package/esm/layouts/snake.js.map +1 -0
  37. package/esm/layouts/types.d.ts +3 -1
  38. package/esm/plugins/minimap/index.d.ts +1 -1
  39. package/esm/registry/build-in.js +2 -1
  40. package/esm/registry/build-in.js.map +1 -1
  41. package/esm/spec/canvas.d.ts +26 -2
  42. package/esm/spec/graph.d.ts +60 -12
  43. package/esm/spec/viewport.d.ts +4 -0
  44. package/esm/utils/cache.d.ts +5 -5
  45. package/esm/utils/cache.js +5 -5
  46. package/esm/utils/style.d.ts +5 -5
  47. package/esm/utils/style.js +5 -5
  48. package/esm/version.d.ts +1 -1
  49. package/esm/version.js +1 -1
  50. package/lib/behaviors/optimize-viewport-transform.d.ts +1 -1
  51. package/lib/elements/edges/base-edge.d.ts +5 -5
  52. package/lib/elements/nodes/base-node.d.ts +2 -0
  53. package/lib/elements/nodes/base-node.js +2 -2
  54. package/lib/elements/nodes/base-node.js.map +1 -1
  55. package/lib/elements/shapes/base-shape.d.ts +2 -2
  56. package/lib/elements/shapes/base-shape.js +2 -2
  57. package/lib/exports.d.ts +2 -2
  58. package/lib/exports.js +3 -2
  59. package/lib/exports.js.map +1 -1
  60. package/lib/layouts/fishbone.d.ts +2 -1
  61. package/lib/layouts/fishbone.js +2 -2
  62. package/lib/layouts/fishbone.js.map +1 -1
  63. package/lib/layouts/index.d.ts +2 -0
  64. package/lib/layouts/index.js +3 -1
  65. package/lib/layouts/index.js.map +1 -1
  66. package/lib/layouts/snake.d.ts +80 -0
  67. package/lib/layouts/snake.js +166 -0
  68. package/lib/layouts/snake.js.map +1 -0
  69. package/lib/layouts/types.d.ts +3 -1
  70. package/lib/plugins/minimap/index.d.ts +1 -1
  71. package/lib/registry/build-in.js +1 -0
  72. package/lib/registry/build-in.js.map +1 -1
  73. package/lib/spec/canvas.d.ts +26 -2
  74. package/lib/spec/graph.d.ts +60 -12
  75. package/lib/spec/viewport.d.ts +4 -0
  76. package/lib/utils/cache.d.ts +5 -5
  77. package/lib/utils/cache.js +5 -5
  78. package/lib/utils/style.d.ts +5 -5
  79. package/lib/utils/style.js +5 -5
  80. package/lib/version.d.ts +1 -1
  81. package/lib/version.js +1 -1
  82. package/package.json +1 -1
  83. package/src/behaviors/optimize-viewport-transform.ts +1 -1
  84. package/src/elements/edges/base-edge.ts +5 -5
  85. package/src/elements/nodes/base-node.ts +4 -2
  86. package/src/elements/shapes/base-shape.ts +2 -2
  87. package/src/exports.ts +2 -1
  88. package/src/layouts/fishbone.ts +3 -2
  89. package/src/layouts/index.ts +3 -0
  90. package/src/layouts/snake.ts +235 -0
  91. package/src/layouts/types.ts +5 -1
  92. package/src/plugins/minimap/index.ts +1 -1
  93. package/src/registry/build-in.ts +2 -0
  94. package/src/spec/canvas.ts +26 -2
  95. package/src/spec/graph.ts +60 -12
  96. package/src/spec/viewport.ts +4 -0
  97. package/src/utils/cache.ts +5 -5
  98. package/src/utils/style.ts +5 -5
  99. package/src/version.ts +1 -1
@@ -0,0 +1,80 @@
1
+ import type { GraphData, NodeData } from '../spec';
2
+ import type { Padding, Size } from '../types';
3
+ import { BaseLayout } from './base-layout';
4
+ import type { BaseLayoutOptions } from './types';
5
+ export interface SnakeLayoutOptions extends BaseLayoutOptions {
6
+ /**
7
+ * <zh/> 节点尺寸
8
+ *
9
+ * <en/> Node size
10
+ */
11
+ nodeSize?: Size | ((node: NodeData) => Size);
12
+ /**
13
+ * <zh/> 内边距,即布局区域与画布边界的距离
14
+ *
15
+ * <en/> Padding, the distance between the layout area and the canvas boundary
16
+ * @defaultValue 0
17
+ */
18
+ padding?: Padding;
19
+ /**
20
+ * <zh/> 节点排序方法。默认按照在图中的路径顺序进行展示
21
+ *
22
+ * <en/> Node sorting method
23
+ */
24
+ sortBy?: (nodeA: NodeData, nodeB: NodeData) => -1 | 0 | 1;
25
+ /**
26
+ * <zh/> 节点列数
27
+ *
28
+ * <en/> Number of node columns
29
+ * @defaultValue 5
30
+ */
31
+ cols?: number;
32
+ /**
33
+ * <zh/> 节点行之间的间隙大小。默认将根据画布高度和节点总行数自动计算
34
+ *
35
+ * <en/> The size of the gap between a node's rows
36
+ */
37
+ rowGap?: number;
38
+ /**
39
+ * <zh/> 节点列之间的间隙大小。默认将根据画布宽度和节点总列数自动计算
40
+ *
41
+ * <en/> The size of the gap between a node's columns
42
+ */
43
+ colGap?: number;
44
+ /**
45
+ * <zh/> 节点排布方向是否顺时针
46
+ *
47
+ * <en/> Whether the node arrangement direction is clockwise
48
+ * @defaultValue true
49
+ * @remarks
50
+ * <zh/> 在顺时针排布时,节点从左上角开始,第一行从左到右排列,第二行从右到左排列,依次类推,形成 S 型路径。在逆时针排布时,节点从右上角开始,第一行从右到左排列,第二行从左到右排列,依次类推,形成反向 S 型路径。
51
+ *
52
+ * <en/> When arranged clockwise, the nodes start from the upper left corner, the first row is arranged from left to right, the second row is arranged from right to left, and so on, forming an S-shaped path. When arranged counterclockwise, the nodes start from the upper right corner, the first row is arranged from right to left, the second row is arranged from left to right, and so on, forming a reverse S-shaped path.
53
+ */
54
+ clockwise?: boolean;
55
+ }
56
+ /**
57
+ * <zh/> 蛇形布局
58
+ *
59
+ * <en/> Snake layout
60
+ * @remarks
61
+ * <zh/> 蛇形布局(Snake Layout)是一种特殊的图形布局方式,能够在较小的空间内更有效地展示长链结构。需要注意的是,其图数据需要确保节点按照从源节点到汇节点的顺序进行线性排列,形成一条明确的路径。
62
+ *
63
+ * <zh/> 节点按 S 字型排列,第一个节点位于第一行的起始位置,接下来的节点在第一行向右排列,直到行末尾。到达行末尾后,下一行的节点从右向左反向排列。这个过程重复进行,直到所有节点排列完毕。
64
+ *
65
+ * <en/> The Snake layout is a special way of graph layout that can more effectively display long chain structures in a smaller space. Note that the graph data needs to ensure that the nodes are linearly arranged in the order from the source node to the sink node to form a clear path.
66
+ *
67
+ * <en/> The nodes are arranged in an S-shaped pattern, with the first node at the beginning of the first row, and the following nodes arranged to the right until the end of the row. After reaching the end of the row, the nodes in the next row are arranged in reverse from right to left. This process is repeated until all nodes are arranged.
68
+ */
69
+ export declare class SnakeLayout extends BaseLayout {
70
+ id: string;
71
+ static defaultOptions: Partial<SnakeLayoutOptions>;
72
+ private formatSize;
73
+ /**
74
+ * Validates the graph data to ensure it meets the requirements for linear arrangement.
75
+ * @param data - Graph data
76
+ * @returns false if the graph is not connected, has more than one source or sink node, or contains cycles.
77
+ */
78
+ private validate;
79
+ execute(model: GraphData, options?: SnakeLayoutOptions): Promise<GraphData>;
80
+ }
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SnakeLayout = void 0;
13
+ const padding_1 = require("../utils/padding");
14
+ const size_1 = require("../utils/size");
15
+ const base_layout_1 = require("./base-layout");
16
+ /**
17
+ * <zh/> 蛇形布局
18
+ *
19
+ * <en/> Snake layout
20
+ * @remarks
21
+ * <zh/> 蛇形布局(Snake Layout)是一种特殊的图形布局方式,能够在较小的空间内更有效地展示长链结构。需要注意的是,其图数据需要确保节点按照从源节点到汇节点的顺序进行线性排列,形成一条明确的路径。
22
+ *
23
+ * <zh/> 节点按 S 字型排列,第一个节点位于第一行的起始位置,接下来的节点在第一行向右排列,直到行末尾。到达行末尾后,下一行的节点从右向左反向排列。这个过程重复进行,直到所有节点排列完毕。
24
+ *
25
+ * <en/> The Snake layout is a special way of graph layout that can more effectively display long chain structures in a smaller space. Note that the graph data needs to ensure that the nodes are linearly arranged in the order from the source node to the sink node to form a clear path.
26
+ *
27
+ * <en/> The nodes are arranged in an S-shaped pattern, with the first node at the beginning of the first row, and the following nodes arranged to the right until the end of the row. After reaching the end of the row, the nodes in the next row are arranged in reverse from right to left. This process is repeated until all nodes are arranged.
28
+ */
29
+ class SnakeLayout extends base_layout_1.BaseLayout {
30
+ constructor() {
31
+ super(...arguments);
32
+ this.id = 'snake';
33
+ }
34
+ formatSize(nodes, size) {
35
+ const sizeFn = typeof size === 'function' ? size : (() => size);
36
+ return nodes.reduce((acc, node) => {
37
+ const [w, h] = (0, size_1.parseSize)(sizeFn(node)) || [0, 0];
38
+ return [Math.max(acc[0], w), Math.max(acc[1], h)];
39
+ }, [0, 0]);
40
+ }
41
+ /**
42
+ * Validates the graph data to ensure it meets the requirements for linear arrangement.
43
+ * @param data - Graph data
44
+ * @returns false if the graph is not connected, has more than one source or sink node, or contains cycles.
45
+ */
46
+ validate(data) {
47
+ const { nodes = [], edges = [] } = data;
48
+ const inDegree = {};
49
+ const outDegree = {};
50
+ const adjList = {};
51
+ nodes.forEach((node) => {
52
+ inDegree[node.id] = 0;
53
+ outDegree[node.id] = 0;
54
+ adjList[node.id] = [];
55
+ });
56
+ edges.forEach((edge) => {
57
+ inDegree[edge.target]++;
58
+ outDegree[edge.source]++;
59
+ adjList[edge.source].push(edge.target);
60
+ });
61
+ // 检查图是否连通
62
+ // Check if the graph is connected
63
+ const visited = new Set();
64
+ const dfs = (nodeId) => {
65
+ if (visited.has(nodeId))
66
+ return;
67
+ visited.add(nodeId);
68
+ adjList[nodeId].forEach(dfs);
69
+ };
70
+ dfs(nodes[0].id);
71
+ if (visited.size !== nodes.length)
72
+ return false;
73
+ // 检查是否有且仅有一个源节点和一个汇节点
74
+ // Check if there is exactly one source node and one sink node
75
+ const sourceNodes = nodes.filter((node) => inDegree[node.id] === 0);
76
+ const sinkNodes = nodes.filter((node) => outDegree[node.id] === 0);
77
+ if (sourceNodes.length !== 1 || sinkNodes.length !== 1)
78
+ return false;
79
+ // 检查中间节点是否只有一个前驱和一个后继
80
+ // Check if the middle nodes have only one predecessor and one successor
81
+ const middleNodes = nodes.filter((node) => inDegree[node.id] === 1 && outDegree[node.id] === 1);
82
+ if (middleNodes.length !== nodes.length - 2)
83
+ return false;
84
+ return true;
85
+ }
86
+ execute(model, options) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ var _a;
89
+ if (!this.validate(model))
90
+ return model;
91
+ const { nodeSize: propNodeSize, padding: propPadding, sortBy, cols, colGap: propColSep, rowGap: propRowSep, clockwise, width, height, } = Object.assign({}, SnakeLayout.defaultOptions, this.options, options);
92
+ const [top, right, bottom, left] = (0, padding_1.parsePadding)(propPadding);
93
+ const nodeSize = this.formatSize(model.nodes || [], propNodeSize);
94
+ const rows = Math.ceil((model.nodes || []).length / cols);
95
+ let colSep = propColSep ? propColSep : (width - left - right - cols * nodeSize[0]) / (cols - 1);
96
+ let rowSep = propRowSep ? propRowSep : (height - top - bottom - rows * nodeSize[1]) / (rows - 1);
97
+ if (rowSep === Infinity || rowSep < 0)
98
+ rowSep = 0;
99
+ if (colSep === Infinity || colSep < 0)
100
+ colSep = 0;
101
+ const sortedNodes = sortBy ? (_a = model.nodes) === null || _a === void 0 ? void 0 : _a.sort(sortBy) : topologicalSort(model);
102
+ const nodes = (sortedNodes || []).map((node, index) => {
103
+ const rowIndex = Math.floor(index / cols);
104
+ const colIndex = index % cols;
105
+ const actualColIndex = clockwise
106
+ ? rowIndex % 2 === 0
107
+ ? colIndex
108
+ : cols - 1 - colIndex
109
+ : rowIndex % 2 === 0
110
+ ? cols - 1 - colIndex
111
+ : colIndex;
112
+ const x = left + actualColIndex * (nodeSize[0] + colSep) + nodeSize[0] / 2;
113
+ const y = top + rowIndex * (nodeSize[1] + rowSep) + nodeSize[1] / 2;
114
+ return {
115
+ id: node.id,
116
+ style: { x, y },
117
+ };
118
+ });
119
+ return { nodes };
120
+ });
121
+ }
122
+ }
123
+ exports.SnakeLayout = SnakeLayout;
124
+ SnakeLayout.defaultOptions = {
125
+ padding: 0,
126
+ cols: 5,
127
+ clockwise: true,
128
+ };
129
+ /**
130
+ * Topological sorting. The nodes are sorted according to the order of the paths(from the start node to the end node).
131
+ * @param data - Graph data
132
+ * @returns Sorted nodes
133
+ */
134
+ function topologicalSort(data) {
135
+ const { nodes = [], edges = [] } = data;
136
+ const inDegree = {};
137
+ const adjList = {};
138
+ nodes.forEach((node) => {
139
+ inDegree[node.id] = 0;
140
+ adjList[node.id] = [];
141
+ });
142
+ edges.forEach((edge) => {
143
+ inDegree[edge.target]++;
144
+ adjList[edge.source].push(edge.target);
145
+ });
146
+ const queue = [];
147
+ const sortedNodes = [];
148
+ nodes.forEach((node) => {
149
+ if (inDegree[node.id] === 0) {
150
+ queue.push(node.id);
151
+ }
152
+ });
153
+ while (queue.length > 0) {
154
+ const nodeId = queue.shift();
155
+ const node = nodes.find((n) => n.id === nodeId);
156
+ sortedNodes.push(node);
157
+ adjList[nodeId].forEach((neighbor) => {
158
+ inDegree[neighbor]--;
159
+ if (inDegree[neighbor] === 0) {
160
+ queue.push(neighbor);
161
+ }
162
+ });
163
+ }
164
+ return sortedNodes;
165
+ }
166
+ //# sourceMappingURL=snake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snake.js","sourceRoot":"src/","sources":["layouts/snake.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,8CAAgD;AAChD,wCAA0C;AAC1C,+CAA2C;AAuD3C;;;;;;;;;;;;GAYG;AACH,MAAa,WAAY,SAAQ,wBAAU;IAA3C;;QACS,OAAE,GAAG,OAAO,CAAC;IAoHtB,CAAC;IA5GS,UAAU,CAAC,KAAiB,EAAE,IAAwC;QAC5E,MAAM,MAAM,GAAG,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAA8B,CAAC;QAC9F,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACZ,MAAM,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,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvB,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrB,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import type { AntVDagreLayoutOptions, LayoutWithIterations as AntVIterativeLayout, Layout as AntVNonIterativeLayout, CircularLayoutOptions, ConcentricLayoutOptions, D3Force3DLayoutOptions, D3ForceLayoutOptions, DagreLayoutOptions, ForceAtlas2LayoutOptions, ForceLayoutOptions, FruchtermanLayoutOptions, GridLayoutOptions, MDSLayoutOptions, RadialLayoutOptions, RandomLayoutOptions } from '@antv/layout';
2
2
  import type { NodeData } from '../spec/data';
3
3
  import type { BaseLayout } from './base-layout';
4
- export type BuiltInLayoutOptions = AntVDagreLayout | CircularLayout | ConcentricLayout | D3ForceLayout | D3Force3DLayout | DagreLayout | ForceAtlas2 | ForceLayout | FruchtermanLayout | GridLayout | MDSLayout | RadialLayout | RandomLayout;
4
+ import type { FishboneLayoutOptions } from './fishbone';
5
+ import type { SnakeLayoutOptions } from './snake';
6
+ export type BuiltInLayoutOptions = AntVDagreLayout | CircularLayout | ConcentricLayout | D3ForceLayout | D3Force3DLayout | DagreLayout | ForceAtlas2 | ForceLayout | FruchtermanLayout | GridLayout | MDSLayout | RadialLayout | RandomLayout | SnakeLayoutOptions | FishboneLayoutOptions;
5
7
  export interface BaseLayoutOptions extends AnimationOptions, WebWorkerLayoutOptions, Record<string, any> {
6
8
  /**
7
9
  * <zh/> 布局类型
@@ -50,7 +50,7 @@ export interface MinimapOptions extends BasePluginOptions {
50
50
  * - 也可以传入一个函数,接收元素的 id 和类型,返回一个图形
51
51
  *
52
52
  * <en/>
53
- * - 'key' uses the key shape of the element as the thumbnail graphic
53
+ * - 'key' uses the key shape of the element as the thumbnail shape
54
54
  * - You can also pass in a function that receives the id and type of the element and returns a shape
55
55
  */
56
56
  shape?: 'key' | ((id: string, elementType: ElementType) => DisplayObject);
@@ -75,6 +75,7 @@ const BUILT_IN_EXTENSIONS = {
75
75
  mindmap: layouts_1.mindmap,
76
76
  radial: layouts_1.RadialLayout,
77
77
  random: layouts_1.RandomLayout,
78
+ snake: layouts_1.SnakeLayout,
78
79
  },
79
80
  node: {
80
81
  circle: elements_1.Circle,
@@ -1 +1 @@
1
- {"version":3,"file":"build-in.js","sourceRoot":"src/","sources":["registry/build-in.ts"],"names":[],"mappings":";;AAuPA,8DAMC;AA7PD,+BAWiB;AACjB,8CAAuH;AACvH,4CAgBsB;AACtB,0CAoBqB;AACrB,+CAAmG;AACnG,wCAmBoB;AACpB,0CAAwE;AACxE,wCAkBoB;AACpB,sCAAwC;AACxC,8CASuB;AAGvB;;;GAGG;AACH,MAAM,mBAAmB,GAAsB;IAC7C,SAAS,EAAE;QACT,gBAAgB,EAAE,0BAAa;QAC/B,cAAc,EAAE,wBAAW;QAC3B,eAAe,EAAE,yBAAY;QAC7B,aAAa,EAAE,uBAAU;QACzB,SAAS,EAAE,mBAAM;QACjB,UAAU,EAAE,oBAAO;QACnB,IAAI,EAAE,iBAAI;QACV,SAAS,EAAE,sBAAS;KACrB;IACD,QAAQ,EAAE;QACR,cAAc,EAAE,uBAAW;QAC3B,cAAc,EAAE,uBAAW;QAC3B,iBAAiB,EAAE,0BAAc;QACjC,aAAa,EAAE,sBAAU;QACzB,aAAa,EAAE,sBAAU;QACzB,oBAAoB,EAAE,4BAAgB;QACtC,cAAc,EAAE,uBAAW;QAC3B,kBAAkB,EAAE,0BAAc;QAClC,eAAe,EAAE,wBAAY;QAC7B,gBAAgB,EAAE,yBAAa;QAC/B,cAAc,EAAE,uBAAW;QAC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AmB,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,EAAE;QACrE,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE;YACvD,IAAA,mBAAQ,EAAC,QAA6B,EAAE,IAAI,EAAE,SAAgB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -17,18 +17,30 @@ export interface CanvasOptions {
17
17
  * <zh/> 画布宽度
18
18
  *
19
19
  * <en/> canvas width
20
+ * @remarks
21
+ * <zh/> 如果未设置,则会自动获取容器宽度
22
+ *
23
+ * <en/> If not set, the container width will be automatically obtained
20
24
  */
21
25
  width?: number;
22
26
  /**
23
27
  * <zh/> 画布高度
24
28
  *
25
29
  * <en/> canvas height
30
+ * @remarks
31
+ * <zh/> 如果未设置,则会自动获取容器高度
32
+ *
33
+ * <en/> If not set, the container height will be automatically obtained
26
34
  */
27
35
  height?: number;
28
36
  /**
29
- * <zh/> 获取渲染器
37
+ * <zh/> 手动置顶渲染器
38
+ *
39
+ * <en/> manually set renderer
40
+ * @remarks
41
+ * <zh/> G6 采用了分层渲染的方式,分为 background、main、label、transient 四层,用户可以通过该配置项分别设置每层画布的渲染器
30
42
  *
31
- * <en/> get renderer
43
+ * <en/> G6 adopts a layered rendering method, divided into four layers: background, main, label, transient. Users can set the renderer of each layer canvas separately through this configuration item
32
44
  */
33
45
  renderer?: (layer: 'background' | 'main' | 'label' | 'transient') => IRenderer;
34
46
  /**
@@ -36,18 +48,30 @@ export interface CanvasOptions {
36
48
  *
37
49
  * <en/> whether to auto resize canvas
38
50
  * @defaultValue false
51
+ * @remarks
52
+ * <zh/> 基于 window.onresize 事件自动调整画布大小
53
+ *
54
+ * <en/> Automatically adjust the canvas size based on the window.onresize event
39
55
  */
40
56
  autoResize?: boolean;
41
57
  /**
42
58
  * <zh/> 画布背景色
43
59
  *
44
60
  * <en/> canvas background color
61
+ * @remarks
62
+ * <zh/> 该颜色作为导出图片时的背景色
63
+ *
64
+ * <en/> This color is used as the background color when exporting images
45
65
  */
46
66
  background?: string;
47
67
  /**
48
68
  * <zh/> 设备像素比
49
69
  *
50
70
  * <en/> device pixel ratio
71
+ * @remarks
72
+ * <zh/> 用于高清屏的设备像素比,默认为 [window.devicePixelRatio](https://developer.mozilla.org/zh-CN/docs/Web/API/Window/devicePixelRatio)
73
+ *
74
+ * <en/> Device pixel ratio for high-definition screens, default is [window.devicePixelRatio](https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio)
51
75
  */
52
76
  devicePixelRatio?: number;
53
77
  /**
@@ -38,30 +38,50 @@ export interface GraphOptions extends CanvasOptions, ViewportOptions {
38
38
  * <zh/> 数据
39
39
  *
40
40
  * <en/> Data
41
+ * @remarks
42
+ * <zh/> 详见 [Data](/api/data/graph-data)
43
+ *
44
+ * <en/> See [Data](/en/api/data/graph-data)
41
45
  */
42
46
  data?: GraphData;
43
47
  /**
44
- * <zh/> 布局
48
+ * <zh/> 布局配置项
49
+ *
50
+ * <en/> Layout options
51
+ * @remarks
52
+ * <zh/> 详见 [Layout](/api/layouts/antv-dagre-layout)
45
53
  *
46
- * <en/> Layout
54
+ * <en/> See [Layout](/en/api/layouts/antv-dagre-layout)
47
55
  */
48
56
  layout?: LayoutOptions;
49
57
  /**
50
- * <zh/> 节点
58
+ * <zh/> 节点配置项
59
+ *
60
+ * <en/> Node options
61
+ * @remarks
62
+ * <zh/> 详见 [Node](/api/elements/nodes/base-node)
51
63
  *
52
- * <en/> Node
64
+ * <en/> See [Node](/en/api/elements/nodes/base-node)
53
65
  */
54
66
  node?: NodeOptions;
55
67
  /**
56
- * <zh/> 边
68
+ * <zh/> 边配置项
57
69
  *
58
- * <en/> Edge
70
+ * <en/> Edge options
71
+ * @remarks
72
+ * <zh/> 详见 [Edge](/api/elements/edges/base-edge)
73
+ *
74
+ * <en/> See [Edge](/en/api/elements/edges/base-edge)
59
75
  */
60
76
  edge?: EdgeOptions;
61
77
  /**
62
- * <zh/> Combo
78
+ * <zh/> 组合配置项
63
79
  *
64
- * <en/> Combo
80
+ * <en/> Combo options
81
+ * @remarks
82
+ * <zh/> 详见 [Combo](/api/elements/combos/base-combo)
83
+ *
84
+ * <en/> See [Combo](/en/api/elements/combos/base-combo)
65
85
  */
66
86
  combo?: ComboOptions;
67
87
  /**
@@ -71,15 +91,43 @@ export interface GraphOptions extends CanvasOptions, ViewportOptions {
71
91
  */
72
92
  theme?: ThemeOptions;
73
93
  /**
74
- * <zh/> 交互
94
+ * <zh/> 启用交互
95
+ *
96
+ * <en/> Enable interactions
97
+ * @remarks
98
+ * <zh/>
99
+ * - 概念:[核心概念 - 交互](/manual/core-concept/behavior)
100
+ *
101
+ * - 内置交互: [交互](/api/behaviors/auto-adapt-label)
102
+ *
103
+ * - 自定义交互: [自定义扩展 - 自定义交互](/manual/advanced/custom-behavior)
75
104
  *
76
- * <en/> Behaviors
105
+ * <en/>
106
+ * - Concept: [Concepts - Behavior](/en/manual/core-concept/behavior)
107
+ *
108
+ * - Built-in behaviors: [Behavior](/en/api/behaviors/auto-adapt-label)
109
+ *
110
+ * - Custom behaviors: [Custom Extension - Custom Behavior](/en/manual/advanced/custom-behavior)
77
111
  */
78
112
  behaviors?: BehaviorOptions;
79
113
  /**
80
- * <zh/> 画布插件
114
+ * <zh/> 启用插件
115
+ *
116
+ * <en/> Enable plugins
117
+ * @remarks
118
+ * <zh/>
119
+ * - 概念:[核心概念 - 插件](/manual/core-concept/plugin)
120
+ *
121
+ * - 内置插件: [插件](/en/api/plugins/background)
122
+ *
123
+ * - 自定义插件: [自定义扩展 - 自定义插件](/manual/advanced/custom-plugin)
124
+ *
125
+ * <en/>
126
+ * - Concept: [Concepts - Plugin](/en/manual/core-concept/plugin)
127
+ *
128
+ * - Built-in plugins: [Plugin](/en/api/plugins/background)
81
129
  *
82
- * <en/> Canvas plugins
130
+ * - Custom plugins: [Custom Extension - Custom Plugin](/en/manual/advanced/custom-plugin)
83
131
  */
84
132
  plugins?: PluginOptions;
85
133
  /**
@@ -23,6 +23,10 @@ export interface ViewportOptions {
23
23
  * <zh/> 是否自动适应
24
24
  *
25
25
  * <en/> whether to auto fit
26
+ * @remarks
27
+ * <zh/> 每次执行 `render` 时,都会根据 `autoFit` 进行自适应
28
+ *
29
+ * <en/> Every time `render` is executed, it will be adapted according to `autoFit`
26
30
  */
27
31
  autoFit?: {
28
32
  type: 'view';
@@ -2,8 +2,8 @@ import type { DisplayObject } from '@antv/g';
2
2
  /**
3
3
  * <zh/> 缓存图形样式
4
4
  *
5
- * <en/> Cache graphic style
6
- * @param element - <zh/> 图形元素 | <en/> graphic element
5
+ * <en/> Cache shape style
6
+ * @param element - <zh/> 图形元素 | <en/> shape element
7
7
  * @param name - <zh/> 样式名 | <en/> style name
8
8
  */
9
9
  export declare function cacheStyle(element: DisplayObject, name: string | string[]): void;
@@ -11,7 +11,7 @@ export declare function cacheStyle(element: DisplayObject, name: string | string
11
11
  * <zh/> 获取缓存的样式
12
12
  *
13
13
  * <en/> Get cached style
14
- * @param element - <zh/> 图形元素 | <en/> graphic element
14
+ * @param element - <zh/> 图形元素 | <en/> shape element
15
15
  * @param name - <zh/> 样式名 | <en/> style name
16
16
  * @returns <zh/> 样式值 | <en/> style value
17
17
  */
@@ -20,7 +20,7 @@ export declare function getCachedStyle(element: DisplayObject, name: string): an
20
20
  * <zh/> 是否有缓存的样式
21
21
  *
22
22
  * <en/> Whether there is a cached style
23
- * @param element - <zh/> 图形元素 | <en/> graphic element
23
+ * @param element - <zh/> 图形元素 | <en/> shape element
24
24
  * @param name - <zh/> 样式名 | <en/> style name
25
25
  * @returns <zh/> 是否有缓存的样式 | <en/> Whether there is a cached style
26
26
  */
@@ -29,7 +29,7 @@ export declare function hasCachedStyle(element: DisplayObject, name: string): bo
29
29
  * <zh/> 设置缓存的样式
30
30
  *
31
31
  * <en/> Set cached style
32
- * @param element - <zh/> 图形元素 | <en/> graphic element
32
+ * @param element - <zh/> 图形元素 | <en/> shape element
33
33
  * @param name - <zh/> 样式名 | <en/> style name
34
34
  * @param value - <zh/> 样式值 | <en/> style value
35
35
  */
@@ -10,8 +10,8 @@ const getStyleCacheKey = (name) => `__${name}__`;
10
10
  /**
11
11
  * <zh/> 缓存图形样式
12
12
  *
13
- * <en/> Cache graphic style
14
- * @param element - <zh/> 图形元素 | <en/> graphic element
13
+ * <en/> Cache shape style
14
+ * @param element - <zh/> 图形元素 | <en/> shape element
15
15
  * @param name - <zh/> 样式名 | <en/> style name
16
16
  */
17
17
  function cacheStyle(element, name) {
@@ -26,7 +26,7 @@ function cacheStyle(element, name) {
26
26
  * <zh/> 获取缓存的样式
27
27
  *
28
28
  * <en/> Get cached style
29
- * @param element - <zh/> 图形元素 | <en/> graphic element
29
+ * @param element - <zh/> 图形元素 | <en/> shape element
30
30
  * @param name - <zh/> 样式名 | <en/> style name
31
31
  * @returns <zh/> 样式值 | <en/> style value
32
32
  */
@@ -37,7 +37,7 @@ function getCachedStyle(element, name) {
37
37
  * <zh/> 是否有缓存的样式
38
38
  *
39
39
  * <en/> Whether there is a cached style
40
- * @param element - <zh/> 图形元素 | <en/> graphic element
40
+ * @param element - <zh/> 图形元素 | <en/> shape element
41
41
  * @param name - <zh/> 样式名 | <en/> style name
42
42
  * @returns <zh/> 是否有缓存的样式 | <en/> Whether there is a cached style
43
43
  */
@@ -48,7 +48,7 @@ function hasCachedStyle(element, name) {
48
48
  * <zh/> 设置缓存的样式
49
49
  *
50
50
  * <en/> Set cached style
51
- * @param element - <zh/> 图形元素 | <en/> graphic element
51
+ * @param element - <zh/> 图形元素 | <en/> shape element
52
52
  * @param name - <zh/> 样式名 | <en/> style name
53
53
  * @param value - <zh/> 样式值 | <en/> style value
54
54
  */
@@ -17,7 +17,7 @@ export declare function computeElementCallbackStyle(callableStyle: Record<string
17
17
  /**
18
18
  * <zh/> 合并图形配置项
19
19
  *
20
- * <en/> Merge graphic configuration
20
+ * <en/> Merge shape configuration
21
21
  * @param opt1 - <zh/> 配置项1 | <en/> configuration 1
22
22
  * @param opt2 - <zh/> 配置项2 | <en/> configuration 2
23
23
  * @returns <zh/> 合并后的配置项 | <en/> merged configuration
@@ -26,13 +26,13 @@ export declare function mergeOptions(opt1: DisplayObjectConfig<any>, opt2: Displ
26
26
  /**
27
27
  * <zh/> 获取图形子图形样式
28
28
  *
29
- * <en/> Get the style of the sub-shape of the graphic
30
- * @param style - <zh/> 图形样式 | <en/> graphic style
29
+ * <en/> Get the style of the sub-shape of the shape
30
+ * @param style - <zh/> 图形样式 | <en/> shape style
31
31
  * @returns <zh/> 子图形样式 | <en/> sub-shape style
32
32
  * @remarks
33
33
  * <zh/> 从给定的属性对象中提取图形样式属性。删除特定的属性,如位置、变换和类名
34
34
  *
35
- * <en/> Extracts the graphic style properties from a given attribute object.
36
- * Removes specific properties like position, transformation, and class name.
35
+ * <en/> Extracts the shape styles from a given attribute object.
36
+ * Removes specific styles like position, transformation, and class name.
37
37
  */
38
38
  export declare function getSubShapeStyle<T extends Record<string, any>>(style: T): Omit<T, 'x' | 'y' | 'z' | 'transform' | 'transformOrigin' | 'className' | 'class' | 'zIndex' | 'visibility'>;
@@ -35,7 +35,7 @@ function computeElementCallbackStyle(callableStyle, context) {
35
35
  /**
36
36
  * <zh/> 合并图形配置项
37
37
  *
38
- * <en/> Merge graphic configuration
38
+ * <en/> Merge shape configuration
39
39
  * @param opt1 - <zh/> 配置项1 | <en/> configuration 1
40
40
  * @param opt2 - <zh/> 配置项2 | <en/> configuration 2
41
41
  * @returns <zh/> 合并后的配置项 | <en/> merged configuration
@@ -50,14 +50,14 @@ function mergeOptions(opt1, opt2) {
50
50
  /**
51
51
  * <zh/> 获取图形子图形样式
52
52
  *
53
- * <en/> Get the style of the sub-shape of the graphic
54
- * @param style - <zh/> 图形样式 | <en/> graphic style
53
+ * <en/> Get the style of the sub-shape of the shape
54
+ * @param style - <zh/> 图形样式 | <en/> shape style
55
55
  * @returns <zh/> 子图形样式 | <en/> sub-shape style
56
56
  * @remarks
57
57
  * <zh/> 从给定的属性对象中提取图形样式属性。删除特定的属性,如位置、变换和类名
58
58
  *
59
- * <en/> Extracts the graphic style properties from a given attribute object.
60
- * Removes specific properties like position, transformation, and class name.
59
+ * <en/> Extracts the shape styles from a given attribute object.
60
+ * Removes specific styles like position, transformation, and class name.
61
61
  */
62
62
  function getSubShapeStyle(style) {
63
63
  const { x, y, z, class: cls, className, transform, transformOrigin, zIndex, visibility } = style, rest = __rest(style, ["x", "y", "z", "class", "className", "transform", "transformOrigin", "zIndex", "visibility"]);
package/lib/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.0.33";
1
+ export declare const version = "5.0.34";
package/lib/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- exports.version = '5.0.33';
4
+ exports.version = '5.0.34';
5
5
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g6",
3
- "version": "5.0.33",
3
+ "version": "5.0.34",
4
4
  "description": "A Graph Visualization Framework in JavaScript",
5
5
  "keywords": [
6
6
  "antv",