@next-bricks/diagram 0.68.7 → 0.68.9

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 (35) hide show
  1. package/dist/bricks.json +3 -3
  2. package/dist/chunks/1265.177053f1.js +3 -0
  3. package/dist/chunks/1265.177053f1.js.map +1 -0
  4. package/dist/chunks/577.c9c65352.js.map +1 -1
  5. package/dist/chunks/editable-label.667b04d5.js.map +1 -1
  6. package/dist/chunks/eo-diagram.78450578.js.map +1 -1
  7. package/dist/chunks/eo-display-canvas.2a43ce91.js.map +1 -1
  8. package/dist/chunks/eo-draw-canvas.e01342d6.js.map +1 -1
  9. package/dist/chunks/experimental-node.2f4d802a.js.map +1 -1
  10. package/dist/chunks/{main.57e2b94a.js → main.9ba966bb.js} +2 -2
  11. package/dist/chunks/{main.57e2b94a.js.map → main.9ba966bb.js.map} +1 -1
  12. package/dist/examples.json +9 -6
  13. package/dist/{index.cfc9b630.js → index.31ee50ee.js} +2 -2
  14. package/dist/{index.cfc9b630.js.map → index.31ee50ee.js.map} +1 -1
  15. package/dist/manifest.json +220 -81
  16. package/dist/types.json +78 -78
  17. package/dist-types/diagram/index.d.ts +64 -1
  18. package/dist-types/display-canvas/index.d.ts +48 -4
  19. package/dist-types/draw-canvas/index.d.ts +119 -5
  20. package/dist-types/editable-label/index.d.ts +22 -1
  21. package/dist-types/experimental-node/index.d.ts +21 -1
  22. package/docs/editable-label.md +71 -1
  23. package/docs/editable-label.react.md +100 -0
  24. package/docs/eo-diagram.md +54 -87
  25. package/docs/eo-diagram.react.md +399 -0
  26. package/docs/eo-display-canvas.md +60 -21
  27. package/docs/eo-display-canvas.react.md +376 -0
  28. package/docs/eo-draw-canvas.md +95 -40
  29. package/docs/eo-draw-canvas.react.md +989 -0
  30. package/docs/experimental-node.md +156 -0
  31. package/docs/experimental-node.react.md +157 -0
  32. package/package.json +2 -2
  33. package/dist/chunks/1265.55a02b5a.js +0 -3
  34. package/dist/chunks/1265.55a02b5a.js.map +0 -1
  35. /package/dist/chunks/{1265.55a02b5a.js.LICENSE.txt → 1265.177053f1.js.LICENSE.txt} +0 -0
package/dist/types.json CHANGED
@@ -1,4 +1,78 @@
1
1
  {
2
+ "diagram.editable-label": {
3
+ "properties": [
4
+ {
5
+ "name": "label",
6
+ "annotation": {
7
+ "type": "keyword",
8
+ "value": "string"
9
+ }
10
+ },
11
+ {
12
+ "name": "type",
13
+ "annotation": {
14
+ "type": "reference",
15
+ "typeName": {
16
+ "type": "identifier",
17
+ "name": "LabelType"
18
+ }
19
+ }
20
+ },
21
+ {
22
+ "name": "readOnly",
23
+ "annotation": {
24
+ "type": "keyword",
25
+ "value": "boolean"
26
+ }
27
+ }
28
+ ],
29
+ "events": [
30
+ {
31
+ "name": "label.editing.change",
32
+ "detail": {
33
+ "annotation": {
34
+ "type": "keyword",
35
+ "value": "boolean"
36
+ }
37
+ }
38
+ },
39
+ {
40
+ "name": "label.change",
41
+ "detail": {
42
+ "annotation": {
43
+ "type": "keyword",
44
+ "value": "string"
45
+ }
46
+ }
47
+ }
48
+ ],
49
+ "methods": [
50
+ {
51
+ "name": "enableEditing",
52
+ "params": [],
53
+ "returns": {}
54
+ }
55
+ ],
56
+ "types": [
57
+ {
58
+ "type": "typeAlias",
59
+ "name": "LabelType",
60
+ "annotation": {
61
+ "type": "union",
62
+ "types": [
63
+ {
64
+ "type": "jsLiteral",
65
+ "value": "line"
66
+ },
67
+ {
68
+ "type": "jsLiteral",
69
+ "value": "default"
70
+ }
71
+ ]
72
+ }
73
+ }
74
+ ]
75
+ },
2
76
  "diagram.experimental-node": {
3
77
  "properties": [
4
78
  {
@@ -3167,80 +3241,6 @@
3167
3241
  }
3168
3242
  ]
3169
3243
  },
3170
- "diagram.editable-label": {
3171
- "properties": [
3172
- {
3173
- "name": "label",
3174
- "annotation": {
3175
- "type": "keyword",
3176
- "value": "string"
3177
- }
3178
- },
3179
- {
3180
- "name": "type",
3181
- "annotation": {
3182
- "type": "reference",
3183
- "typeName": {
3184
- "type": "identifier",
3185
- "name": "LabelType"
3186
- }
3187
- }
3188
- },
3189
- {
3190
- "name": "readOnly",
3191
- "annotation": {
3192
- "type": "keyword",
3193
- "value": "boolean"
3194
- }
3195
- }
3196
- ],
3197
- "events": [
3198
- {
3199
- "name": "label.editing.change",
3200
- "detail": {
3201
- "annotation": {
3202
- "type": "keyword",
3203
- "value": "boolean"
3204
- }
3205
- }
3206
- },
3207
- {
3208
- "name": "label.change",
3209
- "detail": {
3210
- "annotation": {
3211
- "type": "keyword",
3212
- "value": "string"
3213
- }
3214
- }
3215
- }
3216
- ],
3217
- "methods": [
3218
- {
3219
- "name": "enableEditing",
3220
- "params": [],
3221
- "returns": {}
3222
- }
3223
- ],
3224
- "types": [
3225
- {
3226
- "type": "typeAlias",
3227
- "name": "LabelType",
3228
- "annotation": {
3229
- "type": "union",
3230
- "types": [
3231
- {
3232
- "type": "jsLiteral",
3233
- "value": "line"
3234
- },
3235
- {
3236
- "type": "jsLiteral",
3237
- "value": "default"
3238
- }
3239
- ]
3240
- }
3241
- }
3242
- ]
3243
- },
3244
3244
  "eo-diagram": {
3245
3245
  "properties": [
3246
3246
  {
@@ -3501,7 +3501,7 @@
3501
3501
  }
3502
3502
  },
3503
3503
  {
3504
- "name": "param_3",
3504
+ "name": "args",
3505
3505
  "annotation": {
3506
3506
  "type": "array",
3507
3507
  "elementType": {
@@ -5545,7 +5545,7 @@
5545
5545
  "name": "dropNode",
5546
5546
  "params": [
5547
5547
  {
5548
- "name": "param_1",
5548
+ "name": "info",
5549
5549
  "annotation": {
5550
5550
  "type": "reference",
5551
5551
  "typeName": {
@@ -5590,7 +5590,7 @@
5590
5590
  "name": "dropDecorator",
5591
5591
  "params": [
5592
5592
  {
5593
- "name": "param_1",
5593
+ "name": "info",
5594
5594
  "annotation": {
5595
5595
  "type": "reference",
5596
5596
  "typeName": {
@@ -5677,7 +5677,7 @@
5677
5677
  "name": "addEdge",
5678
5678
  "params": [
5679
5679
  {
5680
- "name": "param_1",
5680
+ "name": "info",
5681
5681
  "annotation": {
5682
5682
  "type": "reference",
5683
5683
  "typeName": {
@@ -22,28 +22,91 @@ export interface DiagramRef {
22
22
  callOnLineLabel(id: string, method: string, ...args: unknown[]): void;
23
23
  }
24
24
  export declare const EoDiagramComponent: React.ForwardRefExoticComponent<EoDiagramComponentProps & React.RefAttributes<DiagramRef>>;
25
+ export interface EoDiagramEventsMap {
26
+ "activeTarget.change": CustomEvent<ActiveTarget | null>;
27
+ "node.delete": CustomEvent<DiagramNode>;
28
+ "edge.delete": CustomEvent<DiagramEdge>;
29
+ "line.click": CustomEvent<LineTarget>;
30
+ "line.dblclick": CustomEvent<LineTarget>;
31
+ "nodes.connect": CustomEvent<ConnectLineDetail>;
32
+ }
33
+ export interface EoDiagramEventsMapping {
34
+ onActiveTargetChange: "activeTarget.change";
35
+ onNodeDelete: "node.delete";
36
+ onEdgeDelete: "edge.delete";
37
+ onLineClick: "line.click";
38
+ onLineDblclick: "line.dblclick";
39
+ onNodesConnect: "nodes.connect";
40
+ }
25
41
  /**
26
- * 构件 `eo-diagram`
42
+ * @description 图表构件,支持 dagre(有向无环图)和 force(力导向图)两种布局,可渲染节点和连线,支持缩放、平移、拖拽节点、连线交互等功能。
43
+ * @category diagram
27
44
  */
28
45
  export declare class EoDiagram extends ReactNextElement implements EoDiagramProps {
29
46
  #private;
30
47
  /**
48
+ * @description 图表布局类型,支持 `dagre`(层次有向图)和 `force`(力导向图)。
31
49
  * @required
32
50
  */
33
51
  accessor layout: "dagre" | "force" | undefined;
52
+ /**
53
+ * @description 节点数据列表,每个节点需包含唯一 `id` 字段。
54
+ */
34
55
  accessor nodes: DiagramNode[] | undefined;
56
+ /**
57
+ * @description 边(连线)数据列表,每条边需包含 `source` 和 `target` 字段,指向节点 id。
58
+ */
35
59
  accessor edges: DiagramEdge[] | undefined;
60
+ /**
61
+ * @description 节点砖块配置,指定渲染节点使用的自定义构件,可按节点类型匹配不同配置。
62
+ */
36
63
  accessor nodeBricks: NodeBrickConf[] | undefined;
64
+ /**
65
+ * @description 连线样式配置,支持箭头、颜色、标签、交互等多种选项。
66
+ */
37
67
  accessor lines: LineConf[] | undefined;
68
+ /**
69
+ * @description 布局算法选项,dagre 布局支持 rankdir、ranksep、nodesep 等,force 布局支持 dummyNodesOnEdges、collide 等。
70
+ */
38
71
  accessor layoutOptions: LayoutOptions | undefined;
72
+ /**
73
+ * @description 当前激活目标,可以是节点(`{ type: "node", nodeId }`) 或边(`{ type: "edge", edge }`),为 null 表示无激活目标。
74
+ */
39
75
  accessor activeTarget: ActiveTarget | null | undefined;
76
+ /**
77
+ * @description 是否禁用键盘操作(删除节点/边、切换激活节点),当有标签正在编辑时可临时禁用以避免冲突。
78
+ */
40
79
  accessor disableKeyboardAction: boolean | undefined;
80
+ /**
81
+ * @description 连线交互配置,启用后支持从节点拖拽出新的连线,可配置连线样式和源节点过滤条件。
82
+ */
41
83
  accessor connectNodes: ConnectNodesOptions | undefined;
84
+ /**
85
+ * @description 拖拽节点配置,启用后支持手动拖拽节点调整位置,可配置是否保存用户视图。
86
+ */
42
87
  accessor dragNodes: DragNodesOptions | undefined;
88
+ /**
89
+ * @description 是否允许通过鼠标滚轮或触控板捏合手势缩放图表,默认为 true。
90
+ */
43
91
  accessor zoomable: boolean | undefined;
92
+ /**
93
+ * @description 是否允许通过滚轮平移图表(非捏合手势),默认为 true。
94
+ */
44
95
  accessor scrollable: boolean | undefined;
96
+ /**
97
+ * @description 是否允许通过鼠标拖拽平移图表,默认为 true。
98
+ */
45
99
  accessor pannable: boolean | undefined;
100
+ /**
101
+ * @description 缩放比例范围,格式为 `[min, max]`,默认范围由内部常量决定。
102
+ */
46
103
  accessor scaleRange: RangeTuple | undefined;
104
+ /**
105
+ * @description 调用指定 id 的连线标签构件上的方法,常用于触发标签编辑(如 `callOnLineLabel(id, "enableEditing")`)。
106
+ * @param id 连线标签的 id(格式通常为 `${lineId}-${placement}`)
107
+ * @param method 要调用的方法名
108
+ * @param args 传递给方法的参数列表
109
+ */
47
110
  callOnLineLabel(id: string, method: string, ...args: unknown[]): void;
48
111
  render(): React.JSX.Element;
49
112
  }
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { ReactNextElement } from "@next-core/react-element";
3
3
  import "@next-core/theme";
4
4
  import type { RangeTuple, SizeTuple } from "../diagram/interfaces";
5
- import type { ActiveTarget, InitialCell, NodeBrickConf, EdgeLineConf, LayoutType, LayoutOptions, AutoSize } from "../draw-canvas/interfaces";
5
+ import type { ActiveTarget, InitialCell, NodeBrickConf, CellContextMenuDetail, EdgeLineConf, LayoutType, LayoutOptions, AutoSize } from "../draw-canvas/interfaces";
6
6
  export interface EoDisplayCanvasProps {
7
7
  cells: InitialCell[] | undefined;
8
8
  layout: LayoutType;
@@ -25,19 +25,45 @@ export interface EoDisplayCanvasProps {
25
25
  doNotResetActiveTargetOutsideCanvas?: boolean;
26
26
  extraStyleTexts?: string[];
27
27
  }
28
+ export interface EoDisplayCanvasEventsMap {
29
+ "activeTarget.change": CustomEvent<ActiveTarget | null>;
30
+ "cell.contextmenu": CustomEvent<CellContextMenuDetail>;
31
+ "cell.click": CustomEvent<CellContextMenuDetail>;
32
+ }
33
+ export interface EoDisplayCanvasEventsMapping {
34
+ onActiveTargetChange: "activeTarget.change";
35
+ onCellContextmenu: "cell.contextmenu";
36
+ onCellClick: "cell.click";
37
+ }
28
38
  /**
29
- * 用于展示查看的画布。
39
+ * @description 用于展示查看的画布构件,支持 manual、force、dagre 多种布局,可展示节点、边和装饰器,支持缩放、平移、激活目标高亮、淡化无关元素等功能。
40
+ * @category diagram
30
41
  */
31
42
  export declare class EoDisplayCanvas extends ReactNextElement implements EoDisplayCanvasProps {
32
43
  #private;
33
44
  /**
34
- * 用于查看的画布可以更新 `cells` 属性。
45
+ * @description 画布中的单元格数据,包含节点(node)、边(edge)和装饰器(decorator)。
35
46
  */
36
47
  accessor cells: InitialCell[] | undefined;
48
+ /**
49
+ * @description 画布布局类型,支持 `manual`(手动定位)、`force`(力导向)、`dagre`(层次有向图)。
50
+ */
37
51
  accessor layout: LayoutType;
52
+ /**
53
+ * @description 布局算法选项,根据 layout 类型不同,支持不同参数(如 dagre 的 ranksep/nodesep,force 的碰撞参数等)。
54
+ */
38
55
  accessor layoutOptions: LayoutOptions | undefined;
56
+ /**
57
+ * @description 是否自动计算节点尺寸,启用后画布会根据节点内容自动调整节点大小。
58
+ */
39
59
  accessor autoSize: AutoSize | undefined;
60
+ /**
61
+ * @description 节点默认尺寸,格式为 `[width, height]`,在节点未指定尺寸时使用。
62
+ */
40
63
  accessor defaultNodeSize: SizeTuple;
64
+ /**
65
+ * @description 节点默认砖块配置,指定渲染节点的自定义构件,可按节点类型匹配不同配置。
66
+ */
41
67
  accessor defaultNodeBricks: NodeBrickConf[] | undefined;
42
68
  /**
43
69
  * 当节点数量达到或超过 `degradedThreshold` 时,节点将被降级展示。
@@ -61,14 +87,29 @@ export declare class EoDisplayCanvas extends ReactNextElement implements EoDispl
61
87
  * ```
62
88
  */
63
89
  accessor defaultEdgeLines: EdgeLineConf[] | undefined;
90
+ /**
91
+ * @description 当前激活目标,可以是节点(`{ type: "node", id }`)或边(`{ type: "edge", id }`)等,为 null 表示无激活目标。
92
+ */
64
93
  accessor activeTarget: ActiveTarget | null | undefined;
65
94
  /**
66
- * 当鼠标悬浮到某节点上时,隐藏其他跟该节点无关的元素。
95
+ * @description 当鼠标悬浮到某节点上时,隐藏其他跟该节点无关的元素,高亮相关节点和边。
67
96
  */
68
97
  accessor fadeUnrelatedCells: boolean | undefined;
98
+ /**
99
+ * @description 是否允许通过鼠标滚轮或触控板捏合手势缩放画布,默认为 true。
100
+ */
69
101
  accessor zoomable: boolean | undefined;
102
+ /**
103
+ * @description 是否允许通过滚轮平移画布(非捏合手势),默认为 true。
104
+ */
70
105
  accessor scrollable: boolean | undefined;
106
+ /**
107
+ * @description 是否允许通过鼠标拖拽平移画布,默认为 true。
108
+ */
71
109
  accessor pannable: boolean | undefined;
110
+ /**
111
+ * @description 缩放比例范围,格式为 `[min, max]`,默认范围由内部常量决定。
112
+ */
72
113
  accessor scaleRange: RangeTuple | undefined;
73
114
  /**
74
115
  * 隐藏右下角放大缩小的控制栏
@@ -87,6 +128,9 @@ export declare class EoDisplayCanvas extends ReactNextElement implements EoDispl
87
128
  */
88
129
  accessor doNotResetActiveTargetOutsideCanvas: boolean | undefined;
89
130
  accessor extraStyleTexts: string[] | undefined;
131
+ /**
132
+ * @description 将画布视图重置并居中,使所有单元格重新显示在视口中央。
133
+ */
90
134
  center(): void;
91
135
  render(): React.JSX.Element;
92
136
  }
@@ -85,23 +85,79 @@ export interface CanvasContextMenuDetail {
85
85
  y: number;
86
86
  };
87
87
  }
88
+ export interface EoDrawCanvasEventsMap {
89
+ "activeTarget.change": CustomEvent<ActiveTarget | null>;
90
+ "node.move": CustomEvent<MoveCellPayload>;
91
+ "cell.move": CustomEvent<MoveCellPayload>;
92
+ "cells.move": CustomEvent<MoveCellPayload[]>;
93
+ "cell.resize": CustomEvent<ResizeCellPayload>;
94
+ "node.delete": CustomEvent<Cell>;
95
+ "cell.delete": CustomEvent<Cell>;
96
+ "cells.delete": CustomEvent<Cell[]>;
97
+ "cell.contextmenu": CustomEvent<CellContextMenuDetail>;
98
+ "edge.add": CustomEvent<ConnectNodesDetail>;
99
+ "edge.view.change": CustomEvent<EdgeViewChangePayload>;
100
+ "decorator.view.change": CustomEvent<DecoratorViewChangePayload>;
101
+ "decorator.text.change": CustomEvent<DecoratorTextChangeDetail>;
102
+ "node.container.change": CustomEvent<MoveCellPayload[]>;
103
+ "decorator.group.plus.click": CustomEvent<DecoratorCell>;
104
+ "scale.change": CustomEvent<number>;
105
+ "canvas.contextmenu": CustomEvent<CanvasContextMenuDetail>;
106
+ "canvas.copy": CustomEvent<void>;
107
+ "canvas.paste": CustomEvent<void>;
108
+ "canvas.group": CustomEvent<void>;
109
+ "canvas.ungroup": CustomEvent<void>;
110
+ }
111
+ export interface EoDrawCanvasEventsMapping {
112
+ onActiveTargetChange: "activeTarget.change";
113
+ onNodeMove: "node.move";
114
+ onCellMove: "cell.move";
115
+ onCellsMove: "cells.move";
116
+ onCellResize: "cell.resize";
117
+ onNodeDelete: "node.delete";
118
+ onCellDelete: "cell.delete";
119
+ onCellsDelete: "cells.delete";
120
+ onCellContextmenu: "cell.contextmenu";
121
+ onEdgeAdd: "edge.add";
122
+ onEdgeViewChange: "edge.view.change";
123
+ onDecoratorViewChange: "decorator.view.change";
124
+ onDecoratorTextChange: "decorator.text.change";
125
+ onNodeContainerChange: "node.container.change";
126
+ onDecoratorGroupPlusClick: "decorator.group.plus.click";
127
+ onScaleChange: "scale.change";
128
+ onCanvasContextmenu: "canvas.contextmenu";
129
+ onCanvasCopy: "canvas.copy";
130
+ onCanvasPaste: "canvas.paste";
131
+ onCanvasGroup: "canvas.group";
132
+ onCanvasUngroup: "canvas.ungroup";
133
+ }
88
134
  /**
89
- * 用于手工绘图的画布。
90
- *
91
- * 注意:将配套另外一个用于展示的画布构件。
135
+ * @description 用于手工绘图的画布构件,支持节点拖放、连线绘制、元素移动/缩放/删除等交互操作,配合展示画布(eo-display-canvas)使用。
136
+ * @category diagram
92
137
  */
93
138
  export declare class EoDrawCanvas extends ReactNextElement implements EoDrawCanvasProps {
94
139
  #private;
95
140
  /**
96
- * 仅当初始化时使用,渲染后重新设置 `cells` 将无效。
141
+ * @description 初始化画布单元格数据,包含节点(node)、边(edge)和装饰器(decorator)。仅当初始化时使用,渲染后重新设置 `cells` 将无效,请使用 `updateCells` 方法代替。
97
142
  */
98
143
  accessor cells: InitialCell[] | undefined;
144
+ /**
145
+ * @description 画布布局类型,支持 `manual`(手动定位)、`force`(力导向)、`dagre`(层次有向图)。
146
+ */
99
147
  accessor layout: LayoutType;
148
+ /**
149
+ * @description 布局算法选项,根据 layout 类型不同,支持不同参数(如 dagre 的 ranksep/nodesep 等)。
150
+ */
100
151
  accessor layoutOptions: LayoutOptions | undefined;
101
152
  /**
153
+ * @description 节点默认尺寸,格式为 `[width, height]`,在节点未指定尺寸时使用。
154
+ *
102
155
  * @default [100,20]
103
156
  */
104
157
  accessor defaultNodeSize: SizeTuple;
158
+ /**
159
+ * @description 节点默认砖块配置,指定渲染节点的自定义构件,可按节点类型匹配不同配置。
160
+ */
105
161
  accessor defaultNodeBricks: NodeBrickConf[] | undefined;
106
162
  /**
107
163
  * 当节点数量达到或超过 `degradedThreshold` 时,节点将被降级展示。
@@ -125,14 +181,29 @@ export declare class EoDrawCanvas extends ReactNextElement implements EoDrawCanv
125
181
  * ```
126
182
  */
127
183
  accessor defaultEdgeLines: EdgeLineConf[] | undefined;
184
+ /**
185
+ * @description 当前激活目标,可以是节点、边或装饰器,为 null 表示无激活目标。
186
+ */
128
187
  accessor activeTarget: ActiveTarget | null | undefined;
129
188
  /**
130
- * 当 `activeTarget` 不为 `null` 时,隐藏其他跟该 `activeTarget` 无关的元素。
189
+ * @description 当 `activeTarget` 不为 `null` 时,隐藏其他跟该 `activeTarget` 无关的元素,高亮相关节点和边。
131
190
  */
132
191
  accessor fadeUnrelatedCells: boolean | undefined;
192
+ /**
193
+ * @description 是否允许通过鼠标滚轮或触控板捏合手势缩放画布,默认为 true。
194
+ */
133
195
  accessor zoomable: boolean | undefined;
196
+ /**
197
+ * @description 是否允许通过滚轮平移画布(非捏合手势),默认为 true。
198
+ */
134
199
  accessor scrollable: boolean | undefined;
200
+ /**
201
+ * @description 是否允许通过鼠标拖拽平移画布,默认为 true。
202
+ */
135
203
  accessor pannable: boolean | undefined;
204
+ /**
205
+ * @description 是否允许将边连接到区域(area)装饰器,默认为 false。
206
+ */
136
207
  accessor allowEdgeToArea: boolean | undefined;
137
208
  /**
138
209
  * 按住鼠标拖动时的行为:
@@ -151,8 +222,17 @@ export declare class EoDrawCanvas extends ReactNextElement implements EoDrawCanv
151
222
  * @default "none"
152
223
  */
153
224
  accessor ctrlDragBehavior: CtrlDragBehavior | undefined;
225
+ /**
226
+ * @description 缩放比例范围,格式为 `[min, max]`,默认范围由内部常量决定。
227
+ */
154
228
  accessor scaleRange: RangeTuple | undefined;
229
+ /**
230
+ * @description 连线设置,包含连线类型、箭头等属性,用于新建连线时的默认样式。
231
+ */
155
232
  accessor lineSettings: LineSettings | undefined;
233
+ /**
234
+ * @description 连线连接器配置,设置为 `true` 或配置对象以启用智能连线功能,允许从节点边缘拖出连线。
235
+ */
156
236
  accessor lineConnector: LineConnecterConf | boolean | undefined;
157
237
  /**
158
238
  * 选择器,点击该选择器对应的元素时不重置 `activeTarget`。
@@ -162,14 +242,48 @@ export declare class EoDrawCanvas extends ReactNextElement implements EoDrawCanv
162
242
  * 在画布外点击时不重置 `activeTarget`。
163
243
  */
164
244
  accessor doNotResetActiveTargetOutsideCanvas: boolean | undefined;
245
+ /**
246
+ * @description 将一个节点拖放到画布中指定位置。如果放置位置不在画布内,则返回 null。
247
+ * @param info 拖放节点信息,包含节点 id、拖放位置(clientX/clientY)、尺寸和数据
248
+ * @returns 成功时返回创建的 NodeCell,否则返回 null
249
+ */
165
250
  dropNode({ id, position, size, data, useBrick, }: DropNodeInfo): Promise<NodeCell | null>;
251
+ /**
252
+ * @description 将一个装饰器(area、container、text、line 等)拖放到画布中指定位置。如果放置位置不在画布内,则返回 null。
253
+ * @param info 拖放装饰器信息,包含装饰器类型、拖放位置、文本和方向等
254
+ * @returns 成功时返回创建的 DecoratorCell,否则返回 null
255
+ */
166
256
  dropDecorator({ position, decorator, text, direction, source, target, view, }: DropDecoratorInfo): Promise<DecoratorCell | null>;
257
+ /**
258
+ * @description 批量添加节点到画布,节点位置由布局算法自动计算。
259
+ * @param nodes 要添加的节点信息列表,每项包含 id、数据、尺寸等
260
+ * @returns 创建的 NodeCell 列表
261
+ */
167
262
  addNodes(nodes: AddNodeInfo[]): Promise<NodeCell[]>;
263
+ /**
264
+ * @description 以编程方式添加一条边(连线)到画布。注意:此方法不会触发 `edge.add` 事件。
265
+ * @param info 边信息,包含 source(起始节点 id)、target(目标节点 id)和可选的 data
266
+ * @returns 创建的 EdgeCell 对象
267
+ */
168
268
  addEdge({ source, target, data }: AddEdgeInfo): Promise<EdgeCell>;
269
+ /**
270
+ * @description 以编程方式启动从指定源节点到目标节点的手动连线流程,等待用户在画布上点击目标节点后返回连线详情。
271
+ * @param source 起始节点的 id
272
+ * @returns Promise,解析为 ConnectNodesDetail 包含 source 和 target 节点信息
273
+ */
169
274
  manuallyConnectNodes(source: NodeId): Promise<ConnectNodesDetail>;
275
+ /**
276
+ * @description 更新画布中的单元格数据,支持增量更新(新增、修改),已渲染的画布使用此方法代替直接设置 `cells` 属性。
277
+ * @param cells 新的单元格数据列表
278
+ * @param ctx 可选的更新上下文,用于指定更新原因和位置参考节点
279
+ * @returns 返回实际被更新的单元格列表
280
+ */
170
281
  updateCells(cells: InitialCell[], ctx?: UpdateCellsContext): Promise<{
171
282
  updated: Cell[];
172
283
  }>;
284
+ /**
285
+ * @description 将画布视图重置并居中,使所有单元格重新显示在视口中央。
286
+ */
173
287
  reCenter(): Promise<void>;
174
288
  /**
175
289
  * 切换锁定状态。
@@ -11,14 +11,35 @@ export interface EditableLabelRef {
11
11
  enableEditing(): void;
12
12
  }
13
13
  export declare const EditableLabelComponent: React.ForwardRefExoticComponent<EditableLabelComponentProps & React.RefAttributes<EditableLabelRef>>;
14
+ export interface EditableLabelEventsMap {
15
+ "label.editing.change": CustomEvent<boolean>;
16
+ "label.change": CustomEvent<string>;
17
+ }
18
+ export interface EditableLabelEventsMapping {
19
+ onLabelEditingChange: "label.editing.change";
20
+ onLabelChange: "label.change";
21
+ }
14
22
  /**
15
- * 构件 `diagram.editable-label`
23
+ * @description 可编辑标签构件,用于在图表连线或节点上展示可双击编辑的文本标签,支持只读模式,常配合 `eo-draw-canvas` 和 `eo-diagram` 使用。
24
+ * @category diagram
16
25
  */
17
26
  export declare class EditableLabel extends ReactNextElement implements EditableLabelProps {
18
27
  #private;
28
+ /**
29
+ * @description 标签文本内容。
30
+ */
19
31
  accessor label: string | undefined;
32
+ /**
33
+ * @description 标签类型,`line` 用于连线标签样式,`default` 为默认节点标签样式,影响外观渲染(使用 `render: false` 仅更新属性不触发重渲染)。
34
+ */
20
35
  accessor type: LabelType | undefined;
36
+ /**
37
+ * @description 是否为只读模式,启用后双击不会进入编辑状态,`enableEditing` 方法调用也不会生效。
38
+ */
21
39
  accessor readOnly: boolean | undefined;
40
+ /**
41
+ * @description 以编程方式启用标签的编辑状态(相当于用户双击),只读模式下不生效。
42
+ */
22
43
  enableEditing(): void;
23
44
  render(): React.JSX.Element;
24
45
  }
@@ -9,13 +9,33 @@ export interface ExperimentalNodeProps {
9
9
  usage?: ExperimentalUsage;
10
10
  status?: NodeStatus;
11
11
  }
12
+ export interface ExperimentalNodeEventsMap {
13
+ "drag.start": CustomEvent<PositionTuple>;
14
+ "drag.move": CustomEvent<PositionTuple>;
15
+ "drag.end": CustomEvent<PositionTuple>;
16
+ }
17
+ export interface ExperimentalNodeEventsMapping {
18
+ onDragStart: "drag.start";
19
+ onDragMove: "drag.move";
20
+ onDragEnd: "drag.end";
21
+ }
12
22
  /**
13
- * 构件 `diagram.experimental-node`
23
+ * @description 实验性图表节点构件,支持从素材库拖拽到画布(`usage: "library"`)和画布内节点渲染(`usage: "default"`),支持高亮、淡化等状态样式,常配合 `eo-draw-canvas` 和 `eo-display-canvas` 使用。
24
+ * @category diagram
14
25
  */
15
26
  export declare class ExperimentalNode extends ReactNextElement implements ExperimentalNodeProps {
16
27
  #private;
28
+ /**
29
+ * @description 节点使用场景:`library` 表示素材库中的拖拽源,`dragging` 表示正在拖拽中的幽灵节点,`default` 表示画布内正常渲染的节点。
30
+ */
17
31
  accessor usage: ExperimentalUsage | undefined;
32
+ /**
33
+ * @description 节点状态,影响外观样式:`highlighted` 高亮、`faded` 淡化、`default` 默认(使用 `render: false` 仅更新属性不触发重渲染)。
34
+ */
18
35
  accessor status: NodeStatus | undefined;
36
+ /**
37
+ * @description 装饰器类型,用于渲染不同类型的装饰器外观(area、container、text 等),与 `usage: "dragging"` 配合使用。
38
+ */
19
39
  accessor decorator: DecoratorType | undefined;
20
40
  render(): React.JSX.Element;
21
41
  }