@logicflow/core 2.2.1 → 2.2.3
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.
- package/README.md +32 -0
- package/dist/docs/api/logicflow-constructor/index.en.md +106 -0
- package/dist/docs/api/logicflow-constructor/index.zh.md +106 -0
- package/dist/docs/api/logicflow-constructor/use.en.md +61 -0
- package/dist/docs/api/logicflow-constructor/use.zh.md +61 -0
- package/dist/docs/api/logicflow-instance/canvas.en.md +197 -0
- package/dist/docs/api/logicflow-instance/canvas.zh.md +199 -0
- package/dist/docs/api/logicflow-instance/edge.en.md +273 -0
- package/dist/docs/api/logicflow-instance/edge.zh.md +273 -0
- package/dist/docs/api/logicflow-instance/edit-config.en.md +59 -0
- package/dist/docs/api/logicflow-instance/edit-config.zh.md +59 -0
- package/dist/docs/api/logicflow-instance/element.en.md +375 -0
- package/dist/docs/api/logicflow-instance/element.zh.md +379 -0
- package/dist/docs/api/logicflow-instance/event.en.md +326 -0
- package/dist/docs/api/logicflow-instance/event.zh.md +406 -0
- package/dist/docs/api/logicflow-instance/history.en.md +38 -0
- package/dist/docs/api/logicflow-instance/history.zh.md +38 -0
- package/dist/docs/api/logicflow-instance/index.en.md +41 -0
- package/dist/docs/api/logicflow-instance/index.zh.md +41 -0
- package/dist/docs/api/logicflow-instance/node.en.md +308 -0
- package/dist/docs/api/logicflow-instance/node.zh.md +308 -0
- package/dist/docs/api/logicflow-instance/register.en.md +76 -0
- package/dist/docs/api/logicflow-instance/register.zh.md +76 -0
- package/dist/docs/api/logicflow-instance/render-and-data.en.md +179 -0
- package/dist/docs/api/logicflow-instance/render-and-data.zh.md +181 -0
- package/dist/docs/api/logicflow-instance/text.en.md +60 -0
- package/dist/docs/api/logicflow-instance/text.zh.md +60 -0
- package/dist/docs/api/logicflow-instance/theme.en.md +179 -0
- package/dist/docs/api/logicflow-instance/theme.zh.md +179 -0
- package/dist/docs/api/runtime-model/edgeModel.en.md +29 -0
- package/dist/docs/api/runtime-model/edgeModel.zh.md +325 -0
- package/dist/docs/api/runtime-model/graphModel.en.md +275 -0
- package/dist/docs/api/runtime-model/graphModel.zh.md +1153 -0
- package/dist/docs/api/runtime-model/nodeModel.en.md +37 -0
- package/dist/docs/api/runtime-model/nodeModel.zh.md +644 -0
- package/dist/docs/api/type/MainTypes.en.md +598 -0
- package/dist/docs/api/type/MainTypes.zh.md +867 -0
- package/dist/docs/api/type/Theme.en.md +187 -0
- package/dist/docs/api/type/Theme.zh.md +187 -0
- package/dist/docs/api/type/canvas-types.en.md +25 -0
- package/dist/docs/api/type/canvas-types.zh.md +25 -0
- package/dist/docs/api/type/index.en.md +96 -0
- package/dist/docs/api/type/index.zh.md +99 -0
- package/dist/docs/api/type/node-types.en.md +21 -0
- package/dist/docs/api/type/node-types.zh.md +21 -0
- package/dist/docs/api/type/plugin-types.en.md +24 -0
- package/dist/docs/api/type/plugin-types.zh.md +24 -0
- package/dist/docs/index.md +11 -0
- package/dist/docs/tutorial/about.en.md +38 -0
- package/dist/docs/tutorial/about.zh.md +65 -0
- package/dist/docs/tutorial/advanced/dnd.en.md +62 -0
- package/dist/docs/tutorial/advanced/dnd.zh.md +52 -0
- package/dist/docs/tutorial/advanced/edge.en.md +64 -0
- package/dist/docs/tutorial/advanced/edge.zh.md +66 -0
- package/dist/docs/tutorial/advanced/keyboard.en.md +70 -0
- package/dist/docs/tutorial/advanced/keyboard.zh.md +67 -0
- package/dist/docs/tutorial/advanced/node.en.md +338 -0
- package/dist/docs/tutorial/advanced/node.zh.md +338 -0
- package/dist/docs/tutorial/advanced/react.en.md +106 -0
- package/dist/docs/tutorial/advanced/react.zh.md +114 -0
- package/dist/docs/tutorial/advanced/silent-mode.en.md +75 -0
- package/dist/docs/tutorial/advanced/silent-mode.zh.md +71 -0
- package/dist/docs/tutorial/advanced/snapline.en.md +54 -0
- package/dist/docs/tutorial/advanced/vue.en.md +249 -0
- package/dist/docs/tutorial/advanced/vue.zh.md +248 -0
- package/dist/docs/tutorial/ai.en.md +64 -0
- package/dist/docs/tutorial/ai.zh.md +64 -0
- package/dist/docs/tutorial/basic/background.en.md +50 -0
- package/dist/docs/tutorial/basic/canvas.en.md +164 -0
- package/dist/docs/tutorial/basic/canvas.zh.md +183 -0
- package/dist/docs/tutorial/basic/class.en.md +106 -0
- package/dist/docs/tutorial/basic/class.zh.md +103 -0
- package/dist/docs/tutorial/basic/edge.en.md +151 -0
- package/dist/docs/tutorial/basic/edge.zh.md +152 -0
- package/dist/docs/tutorial/basic/event.en.md +70 -0
- package/dist/docs/tutorial/basic/event.zh.md +66 -0
- package/dist/docs/tutorial/basic/grid.en.md +77 -0
- package/dist/docs/tutorial/basic/node.en.md +358 -0
- package/dist/docs/tutorial/basic/node.zh.md +318 -0
- package/dist/docs/tutorial/basic/theme.en.md +154 -0
- package/dist/docs/tutorial/basic/theme.zh.md +157 -0
- package/dist/docs/tutorial/extension/adapter.en.md +446 -0
- package/dist/docs/tutorial/extension/adapter.zh.md +429 -0
- package/dist/docs/tutorial/extension/bpmn-element.en.md +1427 -0
- package/dist/docs/tutorial/extension/bpmn-element.zh.md +1472 -0
- package/dist/docs/tutorial/extension/control.en.md +117 -0
- package/dist/docs/tutorial/extension/control.zh.md +118 -0
- package/dist/docs/tutorial/extension/curved-edge.en.md +46 -0
- package/dist/docs/tutorial/extension/curved-edge.zh.md +46 -0
- package/dist/docs/tutorial/extension/custom.en.md +142 -0
- package/dist/docs/tutorial/extension/custom.zh.md +138 -0
- package/dist/docs/tutorial/extension/dnd-panel.en.md +109 -0
- package/dist/docs/tutorial/extension/dnd-panel.zh.md +109 -0
- package/dist/docs/tutorial/extension/dynamic-group.en.md +606 -0
- package/dist/docs/tutorial/extension/dynamic-group.zh.md +606 -0
- package/dist/docs/tutorial/extension/group.en.md +217 -0
- package/dist/docs/tutorial/extension/group.zh.md +209 -0
- package/dist/docs/tutorial/extension/highlight.en.md +50 -0
- package/dist/docs/tutorial/extension/highlight.zh.md +50 -0
- package/dist/docs/tutorial/extension/insert-node-in-polyline.en.md +52 -0
- package/dist/docs/tutorial/extension/insert-node-in-polyline.zh.md +47 -0
- package/dist/docs/tutorial/extension/intro.en.md +72 -0
- package/dist/docs/tutorial/extension/intro.zh.md +95 -0
- package/dist/docs/tutorial/extension/label.en.md +136 -0
- package/dist/docs/tutorial/extension/label.zh.md +135 -0
- package/dist/docs/tutorial/extension/layout.en.md +156 -0
- package/dist/docs/tutorial/extension/layout.zh.md +156 -0
- package/dist/docs/tutorial/extension/menu.en.md +319 -0
- package/dist/docs/tutorial/extension/menu.zh.md +377 -0
- package/dist/docs/tutorial/extension/minimap.en.md +164 -0
- package/dist/docs/tutorial/extension/minimap.zh.md +180 -0
- package/dist/docs/tutorial/extension/node-resize.en.md +199 -0
- package/dist/docs/tutorial/extension/node-resize.zh.md +221 -0
- package/dist/docs/tutorial/extension/pool.en.md +227 -0
- package/dist/docs/tutorial/extension/pool.zh.md +227 -0
- package/dist/docs/tutorial/extension/proximity-connect.en.md +104 -0
- package/dist/docs/tutorial/extension/proximity-connect.zh.md +107 -0
- package/dist/docs/tutorial/extension/selection.en.md +166 -0
- package/dist/docs/tutorial/extension/selection.zh.md +150 -0
- package/dist/docs/tutorial/extension/snapshot.en.md +276 -0
- package/dist/docs/tutorial/extension/snapshot.zh.md +276 -0
- package/dist/docs/tutorial/get-started.en.md +501 -0
- package/dist/docs/tutorial/get-started.zh.md +139 -0
- package/dist/docs/tutorial/update.en.md +213 -0
- package/dist/docs/tutorial/update.zh.md +212 -0
- package/package.json +5 -3
- package/scripts/postinstall-ai-prompt.js +67 -0
|
@@ -0,0 +1,598 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav: API
|
|
3
|
+
group:
|
|
4
|
+
title: 类型字典
|
|
5
|
+
order: 3
|
|
6
|
+
title: Core Types (MainTypes)
|
|
7
|
+
toc: content
|
|
8
|
+
order: 1
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## **Introduction**
|
|
12
|
+
|
|
13
|
+
This document mainly introduces the core types of `LogicFlow`, including the following types:
|
|
14
|
+
- **`Common`**: Basic configuration items for instances
|
|
15
|
+
- **`EdgeType`**: Types of edges
|
|
16
|
+
- **`BackgroundConfig`**: Background configuration
|
|
17
|
+
- **`AnimationConfig`**: Animation configuration
|
|
18
|
+
- **`EdgeGeneratorType`**: Custom edge generation function
|
|
19
|
+
- **`CustomTargetAnchorType`**: Custom anchor connection rules
|
|
20
|
+
- **`CustomAnchorLineProps`**: Custom properties for anchor lines
|
|
21
|
+
- **`GuardsConfig`**: Interceptors (permission control)
|
|
22
|
+
- **`Manual` & `Definition`**: Extended configuration
|
|
23
|
+
|
|
24
|
+
## **Detailed Description of Configuration Items**
|
|
25
|
+
|
|
26
|
+
## **Basic Configuration Items for Instances (Common)** {#common}
|
|
27
|
+
```ts
|
|
28
|
+
export interface Common {
|
|
29
|
+
container: HTMLElement
|
|
30
|
+
width?: number
|
|
31
|
+
height?: number
|
|
32
|
+
background?: false | BackgroundConfig
|
|
33
|
+
grid?: number | boolean | GridOptions
|
|
34
|
+
partial?: boolean
|
|
35
|
+
keyboard?: KeyboardDef
|
|
36
|
+
style?: Partial<LogicFlow.Theme>
|
|
37
|
+
edgeType?: EdgeType
|
|
38
|
+
adjustEdge?: boolean
|
|
39
|
+
textMode?: TextMode
|
|
40
|
+
edgeTextMode?: TextMode
|
|
41
|
+
nodeTextMode?: TextMode
|
|
42
|
+
allowRotate?: boolean
|
|
43
|
+
allowResize?: boolean
|
|
44
|
+
isSilentMode?: boolean
|
|
45
|
+
stopScrollGraph?: boolean
|
|
46
|
+
stopZoomGraph?: boolean
|
|
47
|
+
stopMoveGraph?: boolean | 'vertical' | 'horizontal' | [number, number, number, number]
|
|
48
|
+
animation?: boolean | Partial<AnimationConfig>
|
|
49
|
+
history?: boolean
|
|
50
|
+
outline?: boolean
|
|
51
|
+
snapline?: boolean
|
|
52
|
+
textEdit?: boolean
|
|
53
|
+
guards?: GuardsConfig
|
|
54
|
+
overlapMode?: OverlapMode
|
|
55
|
+
plugins?: ExtensionType[]
|
|
56
|
+
pluginsOptions?: Record<string, any>
|
|
57
|
+
disabledPlugins?: string[]
|
|
58
|
+
disabledTools?: string[]
|
|
59
|
+
idGenerator?: (type?: string) => string
|
|
60
|
+
edgeGenerator?: EdgeGeneratorType
|
|
61
|
+
customTrajectory?: (props: CustomAnchorLineProps) => h.JSX.Element
|
|
62
|
+
[key: string]: unknown
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- `container`: The DOM element used to mount the LogicFlow canvas.
|
|
67
|
+
- `width`: The width of the canvas.
|
|
68
|
+
- `height`: The height of the canvas.
|
|
69
|
+
- `background`: The background configuration of the canvas, which can be `false` or a `BackgroundConfig` object.
|
|
70
|
+
- `grid`: Grid configuration, which can be a number representing the grid size, a boolean, or a `GridOptions` object.
|
|
71
|
+
- `partial`: Whether to enable partial rendering.
|
|
72
|
+
- `keyboard`: Keyboard configuration.
|
|
73
|
+
- `style`: Theme style configuration.
|
|
74
|
+
- `edgeType`: The type of edges.
|
|
75
|
+
- `adjustEdge`: Whether to allow edge adjustment.
|
|
76
|
+
- `textMode`: Text mode.
|
|
77
|
+
- `edgeTextMode`: Edge text mode.
|
|
78
|
+
- `nodeTextMode`: Node text mode.
|
|
79
|
+
- `allowRotate`: Whether to allow node rotation.
|
|
80
|
+
- `allowResize`: Whether to allow node resizing.
|
|
81
|
+
- `isSilentMode`: Whether to enable silent mode. In silent mode, nodes and edges on the canvas cannot be moved, text cannot be edited, and there are no anchor points.
|
|
82
|
+
- `stopScrollGraph`: Whether to stop scrolling the canvas.
|
|
83
|
+
- `stopZoomGraph`: Whether to stop zooming the canvas.
|
|
84
|
+
- `stopMoveGraph`: Whether to stop moving the canvas, which can be a boolean, a string, or an array.
|
|
85
|
+
- `animation`: Animation configuration, which can be a boolean or an `AnimationConfig` object.
|
|
86
|
+
- `history`: Whether to enable history recording.
|
|
87
|
+
- `outline`: Whether to enable outlines.
|
|
88
|
+
- `snapline`: Whether to enable snaplines.
|
|
89
|
+
- `textEdit`: Whether to enable text editing.
|
|
90
|
+
- `guards`: Guards configuration.
|
|
91
|
+
- `overlapMode`: Overlap mode.
|
|
92
|
+
- `plugins`: List of plugins.
|
|
93
|
+
- `pluginsOptions`: Plugin options.
|
|
94
|
+
- `disabledPlugins`: List of disabled plugins.
|
|
95
|
+
- `disabledTools`: List of disabled tools.
|
|
96
|
+
- `idGenerator`: ID generator function.
|
|
97
|
+
- `edgeGenerator`: Edge generator function.
|
|
98
|
+
- `customTargetAnchor`: Custom anchor connection rules, which can be a function or `undefined`.
|
|
99
|
+
- `customTrajectory`: Custom trajectory function.
|
|
100
|
+
- `[key: string]`: Other custom properties.
|
|
101
|
+
|
|
102
|
+
### **EdgeType** {#edgetype}
|
|
103
|
+
```ts
|
|
104
|
+
export type EdgeType = 'line' | 'polyline' | 'bezier' | string
|
|
105
|
+
```
|
|
106
|
+
Defines the types of edges. Possible values are:
|
|
107
|
+
- `'line'`: Straight line
|
|
108
|
+
- `'polyline'`: Polyline
|
|
109
|
+
- `'bezier'`: Bezier curve
|
|
110
|
+
- `string`: Other custom types
|
|
111
|
+
|
|
112
|
+
### **BackgroundConfig** {#backgroundconfig}
|
|
113
|
+
```ts
|
|
114
|
+
export type BackgroundConfig = {
|
|
115
|
+
backgroundImage?: string
|
|
116
|
+
backgroundRepeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'initial' | 'inherit'
|
|
117
|
+
[key: string]: any
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
- `backgroundImage`: Background image URL.
|
|
121
|
+
- `backgroundRepeat`: Background repeat mode, similar to the CSS `background-repeat` property.
|
|
122
|
+
- Allows extending additional CSS styles.
|
|
123
|
+
|
|
124
|
+
This type is mainly used to constrain the `background` parameter passed in during initialization. The passed attributes will be directly applied to the `BackgroundOverlay` of the LogicFlow canvas.
|
|
125
|
+
|
|
126
|
+
### **AnimationConfig** {#animationconfig}
|
|
127
|
+
```ts
|
|
128
|
+
export type AnimationConfig = {
|
|
129
|
+
node: boolean
|
|
130
|
+
edge: boolean
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
- `node`: Whether to enable animation for nodes.
|
|
134
|
+
- `edge`: Whether to enable animation for edges.
|
|
135
|
+
|
|
136
|
+
### **EdgeGeneratorType** {#edgegeneratortype}
|
|
137
|
+
```ts
|
|
138
|
+
export type EdgeGeneratorType = (
|
|
139
|
+
sourceNode: LogicFlow.NodeData,
|
|
140
|
+
targetNode: LogicFlow.NodeData,
|
|
141
|
+
currentEdge?: Partial<LogicFlow.EdgeConfig>
|
|
142
|
+
) => any
|
|
143
|
+
```
|
|
144
|
+
- `sourceNode`: Source node data.
|
|
145
|
+
- `targetNode`: Target node data.
|
|
146
|
+
- `currentEdge` (optional): Partial configuration of the current edge.
|
|
147
|
+
|
|
148
|
+
This type is mainly used to constrain the `edgeGenerator` parameter passed in during initialization.
|
|
149
|
+
``` typescript
|
|
150
|
+
edgeGenerator: (sourceNode, targetNode, currentEdge) => {
|
|
151
|
+
// Use bezier when the source node type is rect
|
|
152
|
+
if (sourceNode.type === 'rect') return 'bezier'
|
|
153
|
+
if (currentEdge) return currentEdge.type
|
|
154
|
+
return 'polyline'
|
|
155
|
+
},
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Used to constrain the type of custom edge generation methods.
|
|
159
|
+
|
|
160
|
+
### **customTargetAnchorType (Custom Anchor Connection Rule)** {#customtargetanchortype}
|
|
161
|
+
```ts
|
|
162
|
+
export type customTargetAnchorType = (
|
|
163
|
+
nodeModel: BaseNodeModel,
|
|
164
|
+
position: LogicFlow.Point,
|
|
165
|
+
) => Model.AnchorInfo | undefined
|
|
166
|
+
```
|
|
167
|
+
| Field | Type | Description |
|
|
168
|
+
| ----- | ---- | ----------- |
|
|
169
|
+
| nodeModel | BaseNodeModel | The node model that acts as the target node. |
|
|
170
|
+
| position | LogicFlow.Point | The mouse release position (canvas coordinates). |
|
|
171
|
+
| Return | Model.AnchorInfo \| undefined | The anchor info to connect to; returning undefined falls back to the default behavior (connect to the anchor closest to position). |
|
|
172
|
+
|
|
173
|
+
This type constrains the `customTargetAnchor` parameter passed during initialization.
|
|
174
|
+
|
|
175
|
+
For example, adding the following code when creating the instance will always connect to the leftmost anchor, no matter where you drop on the node:
|
|
176
|
+
``` typescript
|
|
177
|
+
customTargetAnchor: (nodeModel) => {
|
|
178
|
+
const anchors = nodeModel?.anchors || []
|
|
179
|
+
if (!anchors.length) return
|
|
180
|
+
const left = anchors.reduce((min, a) => (a.x < min.x ? a : min), anchors[0])
|
|
181
|
+
return {
|
|
182
|
+
index: anchors.indexOf(left),
|
|
183
|
+
anchor: left,
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### **GuardsConfig** {#guardsconfig}
|
|
189
|
+
```ts
|
|
190
|
+
export interface GuardsConfig {
|
|
191
|
+
beforeClone?: (data: NodeData | GraphData) => boolean
|
|
192
|
+
beforeDelete?: (data: NodeData | EdgeData) => boolean
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
- `beforeClone`: Interceptor function before cloning nodes/graphs. Returning `false` will prevent cloning.
|
|
196
|
+
- `beforeDelete`: Interceptor function before deleting nodes/edges. Returning `false` will prevent deletion.
|
|
197
|
+
|
|
198
|
+
### **IEditConfigType (edit control configuration)** {#ieditconfigtype-edit-control}
|
|
199
|
+
|
|
200
|
+
`IEditConfigType` is the full runtime edit-control shape used by `updateEditConfig` and `getEditConfig`.
|
|
201
|
+
|
|
202
|
+
| Field | Type | Description |
|
|
203
|
+
| --- | --- | --- |
|
|
204
|
+
| `isSilentMode` | `boolean` | Silent (read-only) mode. |
|
|
205
|
+
| `stopZoomGraph` | `boolean` | Disable zooming the canvas. |
|
|
206
|
+
| `stopScrollGraph` | `boolean` | Disable wheel panning. |
|
|
207
|
+
| `stopMoveGraph` | `boolean \| 'vertical' \| 'horizontal' \| [number, number, number, number]` | Constrain or disable canvas panning. |
|
|
208
|
+
| `adjustEdge` | `boolean` | Allow edge adjustment. |
|
|
209
|
+
| `adjustEdgeMiddle` | `boolean` | Allow adjusting edge midpoints. |
|
|
210
|
+
| `adjustEdgeStartAndEnd` | `boolean` | Allow dragging edge endpoints. |
|
|
211
|
+
| `adjustNodePosition` | `boolean` | Allow moving nodes. |
|
|
212
|
+
| `hideAnchors` | `boolean` | Hide anchors. |
|
|
213
|
+
| `allowRotate` | `boolean` | Allow node rotation. |
|
|
214
|
+
| `allowResize` | `boolean` | Allow node resize. |
|
|
215
|
+
| `autoExpand` | `boolean` | Auto-expand canvas when elements exceed bounds. |
|
|
216
|
+
| `hoverOutline` | `boolean` | Show hover outline. |
|
|
217
|
+
| `nodeSelectedOutline` | `boolean` | Outline when node is selected. |
|
|
218
|
+
| `edgeSelectedOutline` | `boolean` | Outline when edge is selected. |
|
|
219
|
+
| `textEdit` | `boolean` | Allow text editing. |
|
|
220
|
+
| `nodeTextEdit` | `boolean` | Allow node text editing. |
|
|
221
|
+
| `edgeTextEdit` | `boolean` | Allow edge text editing. |
|
|
222
|
+
| `textDraggable` | `boolean` | Allow dragging text. |
|
|
223
|
+
| `nodeTextDraggable` | `boolean` | Allow dragging node text. |
|
|
224
|
+
| `edgeTextDraggable` | `boolean` | Allow dragging edge text. |
|
|
225
|
+
| `multipleSelectKey` | `string` | Multi-select modifier (`meta` / `shift` / `alt`). |
|
|
226
|
+
|
|
227
|
+
### **GridOptions** {#gridoptions}
|
|
228
|
+
|
|
229
|
+
| Field | Type | Description |
|
|
230
|
+
| ----- | ---- | ----------- |
|
|
231
|
+
| size | number (optional) | Grid cell spacing. |
|
|
232
|
+
| visible | boolean (optional) | Whether grid lines are visible. |
|
|
233
|
+
| type | `'dot' \| 'mesh'` (optional) | Grid pattern: dots or mesh lines. |
|
|
234
|
+
| config | `{ color?: string; thickness?: number }` (optional) | Line/dot styling. |
|
|
235
|
+
| config.color | string (optional) | Grid color. |
|
|
236
|
+
| config.thickness | number (optional) | Line thickness or dot size. |
|
|
237
|
+
|
|
238
|
+
### **KeyboardDef** {#keyboarddef}
|
|
239
|
+
|
|
240
|
+
| Field | Type | Description |
|
|
241
|
+
| ----- | ---- | ----------- |
|
|
242
|
+
| enabled | boolean | Master switch for keyboard shortcuts. |
|
|
243
|
+
| shortcuts | `Array<{ keys: string \| string[]; callback: Handler; action?: Action }>` (optional) | Custom shortcut definitions. |
|
|
244
|
+
| shortcuts.keys | string \| string[] | Key combination to listen for. |
|
|
245
|
+
| shortcuts.callback | Handler | Handler invoked when the shortcut fires. |
|
|
246
|
+
| shortcuts.action | Action (optional) | DOM keyboard event type (`keypress`, `keydown`, `keyup`). |
|
|
247
|
+
|
|
248
|
+
### **AppendConfig** {#appendconfig}
|
|
249
|
+
|
|
250
|
+
Polyline segment selection metadata when inserting nodes on an edge.
|
|
251
|
+
|
|
252
|
+
| Field | Type | Description |
|
|
253
|
+
| ----- | ---- | ----------- |
|
|
254
|
+
| startIndex | number | Segment start index for insertion. |
|
|
255
|
+
| endIndex | number | Segment end index / append position. |
|
|
256
|
+
| direction | Direction | Direction along the polyline. |
|
|
257
|
+
| draggable | boolean (optional) | Whether the segment can be dragged. |
|
|
258
|
+
| start | Point | Start coordinate of the selection. |
|
|
259
|
+
| end | Point | End coordinate of the selection. |
|
|
260
|
+
|
|
261
|
+
### **ArrowConfig** {#arrowconfig}
|
|
262
|
+
|
|
263
|
+
| Field | Type | Description |
|
|
264
|
+
| ----- | ---- | ----------- |
|
|
265
|
+
| markerStart | string | SVG marker id or definition for the arrow start. |
|
|
266
|
+
| markerEnd | string | SVG marker id or definition for the arrow end. |
|
|
267
|
+
|
|
268
|
+
### **AttributesType** {#attributestype}
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
export type AttributesType = Record<string, any>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Bag for arbitrary custom attributes on LogicFlow elements.
|
|
275
|
+
|
|
276
|
+
### **RegisterConfig** {#registerconfig}
|
|
277
|
+
|
|
278
|
+
| Field | Type | Description |
|
|
279
|
+
| ----- | ---- | ----------- |
|
|
280
|
+
| type | string | Element type name (required). |
|
|
281
|
+
| view | ComponentType<any> & { isObserved?: boolean } | View component for rendering. |
|
|
282
|
+
| model | GraphElementCtor | Model constructor (`BaseNodeModelCtor` or `BaseEdgeModelCtor`). |
|
|
283
|
+
| isObserverView | boolean (optional) | Whether the view observes model changes. |
|
|
284
|
+
|
|
285
|
+
### **RegisterElement** {#registerelement}
|
|
286
|
+
|
|
287
|
+
| Field | Type | Description |
|
|
288
|
+
| ----- | ---- | ----------- |
|
|
289
|
+
| view | React.ComponentType<any> | Visual component. |
|
|
290
|
+
| model | any | Data model implementation. |
|
|
291
|
+
|
|
292
|
+
### **RegisterElementFunc** {#registerelementfunc}
|
|
293
|
+
|
|
294
|
+
```ts
|
|
295
|
+
export type RegisterElementFunc = (params: RegisterParam) => RegisterElement
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### **RegisterParam** {#registerparam}
|
|
299
|
+
|
|
300
|
+
```ts
|
|
301
|
+
export type RegisterParam = {
|
|
302
|
+
h: typeof h
|
|
303
|
+
[key: string]: unknown
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
| Field | Type | Description |
|
|
308
|
+
| ----- | ---- | ----------- |
|
|
309
|
+
| h | Function | Hyperscript helper for virtual DOM. |
|
|
310
|
+
| [key: string] | any | Additional registration context. |
|
|
311
|
+
|
|
312
|
+
### **BaseNodeModelCtor** {#basenodemodelctor}
|
|
313
|
+
|
|
314
|
+
Constructor type for node models derived from `BaseNodeModel`.
|
|
315
|
+
|
|
316
|
+
### **BaseEdgeModelCtor** {#baseedgemodelctor}
|
|
317
|
+
|
|
318
|
+
Constructor type for edge models derived from `BaseEdgeModel`.
|
|
319
|
+
|
|
320
|
+
## **Canvas-related types** {#canvas-related}
|
|
321
|
+
|
|
322
|
+
### **GraphConfigData** {#graphconfigdata}
|
|
323
|
+
|
|
324
|
+
Input shape for `lf.render` when using LogicFlow graph configuration objects.
|
|
325
|
+
|
|
326
|
+
| Field | Type | Description |
|
|
327
|
+
| ----- | ---- | ----------- |
|
|
328
|
+
| nodes | `NodeConfig[] \| undefined` | Optional array of node configs (see [NodeConfig](#nodeconfig)). |
|
|
329
|
+
| edges | `EdgeConfig[] \| undefined` | Optional array of edge configs (see [EdgeConfig](#edgeconfig)). |
|
|
330
|
+
|
|
331
|
+
### **GraphData** {#graphdata}
|
|
332
|
+
|
|
333
|
+
Native graph snapshot returned by APIs such as `getGraphRawData`.
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
interface GraphData {
|
|
337
|
+
nodes: NodeData[]
|
|
338
|
+
edges: EdgeData[]
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
| Field | Type | Description |
|
|
343
|
+
| ----- | ---- | ----------- |
|
|
344
|
+
| nodes | NodeData[] | All node records. |
|
|
345
|
+
| edges | EdgeData[] | All edge records. |
|
|
346
|
+
|
|
347
|
+
### **GraphElement** {#graphelement}
|
|
348
|
+
|
|
349
|
+
Union of `BaseNodeModel | BaseEdgeModel` representing any element on the canvas.
|
|
350
|
+
|
|
351
|
+
### **GraphElementCtor** {#graphelementctor}
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
export type GraphElementCtor = BaseNodeModelCtor | BaseEdgeModelCtor
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### **Position** {#position}
|
|
358
|
+
|
|
359
|
+
| Field | Type | Description |
|
|
360
|
+
| ----- | ---- | ----------- |
|
|
361
|
+
| x | number | Horizontal coordinate. |
|
|
362
|
+
| y | number | Vertical coordinate. |
|
|
363
|
+
|
|
364
|
+
### **Point** {#point}
|
|
365
|
+
|
|
366
|
+
Extends `Position` with optional identifiers or extra fields.
|
|
367
|
+
|
|
368
|
+
| Field | Type | Description |
|
|
369
|
+
| ----- | ---- | ----------- |
|
|
370
|
+
| id | string (optional) | Stable point identifier. |
|
|
371
|
+
| x | number | X coordinate. |
|
|
372
|
+
| y | number | Y coordinate. |
|
|
373
|
+
| [key: string] | any | Additional metadata. |
|
|
374
|
+
|
|
375
|
+
### **PointTuple** {#pointtuple}
|
|
376
|
+
|
|
377
|
+
Tuple `[x, y]` representing a point in canvas space.
|
|
378
|
+
|
|
379
|
+
### **PropertiesType** {#propertiestype}
|
|
380
|
+
|
|
381
|
+
| Field | Type | Description |
|
|
382
|
+
| ----- | ---- | ----------- |
|
|
383
|
+
| width | number (optional) | Element width. |
|
|
384
|
+
| height | number (optional) | Element height. |
|
|
385
|
+
| rx | number (optional) | Horizontal corner radius. |
|
|
386
|
+
| ry | number (optional) | Vertical corner radius. |
|
|
387
|
+
| style | LogicFlow.CommonTheme (optional) | Theme snippet for the element. |
|
|
388
|
+
| textStyle | LogicFlow.CommonTheme (optional) | Theme snippet for nested text. |
|
|
389
|
+
| [key: string] | any (optional) | Arbitrary business fields. |
|
|
390
|
+
|
|
391
|
+
### **TextConfig** {#textconfig}
|
|
392
|
+
|
|
393
|
+
| Field | Type | Description |
|
|
394
|
+
| ----- | ---- | ----------- |
|
|
395
|
+
| value | string | Text body. |
|
|
396
|
+
| x | number | Canvas X coordinate. |
|
|
397
|
+
| y | number | Canvas Y coordinate. |
|
|
398
|
+
| editable | boolean (optional) | Whether users can edit inline. |
|
|
399
|
+
| draggable | boolean (optional) | Whether text can be dragged. |
|
|
400
|
+
| overflowMode | `'default' \| 'autoWrap' \| 'ellipsis'` (optional) | Overflow handling. |
|
|
401
|
+
|
|
402
|
+
### **ClientPosition** {#clientposition}
|
|
403
|
+
|
|
404
|
+
```ts
|
|
405
|
+
export type ClientPosition = {
|
|
406
|
+
domOverlayPosition: Position
|
|
407
|
+
canvasOverlayPosition: Position
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
Returned by pointer helpers and several interaction events.
|
|
412
|
+
|
|
413
|
+
### **ElementState** {#elementstate}
|
|
414
|
+
|
|
415
|
+
Numeric codes consumed by `graphModel.setElementStateById`.
|
|
416
|
+
|
|
417
|
+
| Name | Value | Meaning |
|
|
418
|
+
| ---- | ----- | ------- |
|
|
419
|
+
| DEFAULT | 1 | Normal display. |
|
|
420
|
+
| TEXT_EDIT | 2 | Text editing mode. |
|
|
421
|
+
| SHOW_MENU | 3 | Legacy menu state (prefer menu plugin). |
|
|
422
|
+
| ALLOW_CONNECT | 4 | Element may accept the active edge. |
|
|
423
|
+
| NOT_ALLOW_CONNECT | 5 | Element rejects the active edge. |
|
|
424
|
+
|
|
425
|
+
## **Node-related types** {#node-related}
|
|
426
|
+
|
|
427
|
+
### **NodeConfig** {#nodeconfig}
|
|
428
|
+
|
|
429
|
+
| Field | Type | Description |
|
|
430
|
+
| ----- | ---- | ----------- |
|
|
431
|
+
| id | string (optional) | Node identifier (auto-generated if omitted). |
|
|
432
|
+
| type | string | Registered node type (required). |
|
|
433
|
+
| x | number | Canvas X coordinate. |
|
|
434
|
+
| y | number | Canvas Y coordinate. |
|
|
435
|
+
| text | TextConfig \| string (optional) | Label configuration or plain string. |
|
|
436
|
+
| zIndex | number (optional) | Stack order. |
|
|
437
|
+
| properties | PropertiesType (optional) | Custom properties payload. |
|
|
438
|
+
| virtual | boolean (optional) | Marks transient / preview nodes. |
|
|
439
|
+
| rotate | number (optional) | Rotation in degrees. |
|
|
440
|
+
| rotatable | boolean (optional) | Allows interactive rotation. |
|
|
441
|
+
| resizable | boolean (optional) | Allows interactive resizing. |
|
|
442
|
+
|
|
443
|
+
### **OffsetData** {#offsetdata}
|
|
444
|
+
|
|
445
|
+
| Field | Type | Description |
|
|
446
|
+
| ----- | ---- | ----------- |
|
|
447
|
+
| dx | number | Horizontal drag delta. |
|
|
448
|
+
| dy | number | Vertical drag delta. |
|
|
449
|
+
|
|
450
|
+
### **FakeNodeConfig** {#fakenodeconfig}
|
|
451
|
+
|
|
452
|
+
Configuration for placeholder nodes while dragging from external sources.
|
|
453
|
+
|
|
454
|
+
| Field | Type | Description |
|
|
455
|
+
| ----- | ---- | ----------- |
|
|
456
|
+
| type | string | Target node type. |
|
|
457
|
+
| text | TextConfig \| string (optional) | Label while dragging. |
|
|
458
|
+
| properties | PropertiesType (optional) | Shape/style hints. |
|
|
459
|
+
| [key: string] | unknown | Additional transient fields. |
|
|
460
|
+
|
|
461
|
+
### **VectorData** {#vectordata}
|
|
462
|
+
|
|
463
|
+
| Field | Type | Description |
|
|
464
|
+
| ----- | ---- | ----------- |
|
|
465
|
+
| deltaX | number | Resize/move delta on X. |
|
|
466
|
+
| deltaY | number | Resize/move delta on Y. |
|
|
467
|
+
|
|
468
|
+
### **DomAttributes** {#domattributes}
|
|
469
|
+
|
|
470
|
+
SVG attributes returned from `getOuterGAttributes`.
|
|
471
|
+
|
|
472
|
+
| Field | Type | Description |
|
|
473
|
+
| ----- | ---- | ----------- |
|
|
474
|
+
| className | string | Optional CSS class on the outer `<g>`. |
|
|
475
|
+
| [key: string] | string \| undefined | Arbitrary SVG attributes. |
|
|
476
|
+
|
|
477
|
+
## **Edge-related types** {#edge-related}
|
|
478
|
+
|
|
479
|
+
### **EdgeConfig** {#edgeconfig}
|
|
480
|
+
|
|
481
|
+
| Field | Type | Description |
|
|
482
|
+
| ----- | ---- | ----------- |
|
|
483
|
+
| id | string (optional) | Edge identifier. |
|
|
484
|
+
| type | string (optional) | Edge type (`polyline` by default). |
|
|
485
|
+
| sourceNodeId | string | Source node id. |
|
|
486
|
+
| sourceAnchorId | string (optional) | Source anchor id. |
|
|
487
|
+
| targetNodeId | string | Target node id. |
|
|
488
|
+
| targetAnchorId | string (optional) | Target anchor id. |
|
|
489
|
+
| startPoint | Point (optional) | Manual start coordinate. |
|
|
490
|
+
| endPoint | Point (optional) | Manual end coordinate. |
|
|
491
|
+
| text | string \| TextConfig (optional) | Edge label. |
|
|
492
|
+
| pointsList | Point[] (optional) | Polyline bend points. |
|
|
493
|
+
| zIndex | number (optional) | Stack order. |
|
|
494
|
+
| properties | PropertiesType (optional) | Custom properties. |
|
|
495
|
+
|
|
496
|
+
### **EdgeData** {#edgedata}
|
|
497
|
+
|
|
498
|
+
Runtime edge snapshot extending `EdgeConfig` with resolved geometry.
|
|
499
|
+
|
|
500
|
+
| Field | Type | Description |
|
|
501
|
+
| ----- | ---- | ----------- |
|
|
502
|
+
| id | string | Edge identifier. |
|
|
503
|
+
| type | string | Edge type. |
|
|
504
|
+
| text | TextConfig \| string | Label payload. |
|
|
505
|
+
| startPoint | Point | Resolved start. |
|
|
506
|
+
| endPoint | Point | Resolved end. |
|
|
507
|
+
| pointsList | Point[] | Bend points for polylines. |
|
|
508
|
+
|
|
509
|
+
## **Plugin-related types** {#plugin-related}
|
|
510
|
+
|
|
511
|
+
### **Extension** {#extension}
|
|
512
|
+
|
|
513
|
+
| Field | Type | Description |
|
|
514
|
+
| ----- | ---- | ----------- |
|
|
515
|
+
| render | `(lf: LogicFlow, container: HTMLElement) => void` | Mount UI into the plugin container. |
|
|
516
|
+
| destroy | `() => void` (optional) | Cleanup hook. |
|
|
517
|
+
|
|
518
|
+
### **ExtensionRenderFunc** {#extensionrenderfunc}
|
|
519
|
+
|
|
520
|
+
```ts
|
|
521
|
+
export type ExtensionRenderFunc = (lf: LogicFlow, container: HTMLElement) => void
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### **ExtensionType** {#extensiontype}
|
|
525
|
+
|
|
526
|
+
```ts
|
|
527
|
+
export type ExtensionType = ExtensionConstructor | ExtensionDefinition
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### **ExtensionConfig** {#extensionconfig}
|
|
531
|
+
|
|
532
|
+
| Field | Type | Description |
|
|
533
|
+
| ----- | ---- | ----------- |
|
|
534
|
+
| pluginFlag | Symbol | Unique symbol identifying the plugin slot. |
|
|
535
|
+
| extension | ExtensionConstructor \| ExtensionDefinition | Plugin implementation. |
|
|
536
|
+
| props | Record<string, any> (optional) | Props forwarded to the plugin ctor. |
|
|
537
|
+
|
|
538
|
+
### **IExtensionProps** {#iextensionprops}
|
|
539
|
+
|
|
540
|
+
| Field | Type | Description |
|
|
541
|
+
| ----- | ---- | ----------- |
|
|
542
|
+
| lf | LogicFlow | Host instance. |
|
|
543
|
+
| LogicFlow | LogicFlowConstructor | Constructor reference for advanced usage. |
|
|
544
|
+
| props | Record<string, unknown> (optional) | Custom props from registration. |
|
|
545
|
+
| options | Record<string, unknown> | Plugin-specific options. |
|
|
546
|
+
|
|
547
|
+
### **ExtensionConstructor** {#extensionconstructor}
|
|
548
|
+
|
|
549
|
+
Class-based plugins must expose `pluginName` and accept `IExtensionProps` in the constructor.
|
|
550
|
+
|
|
551
|
+
### **ExtensionDefinition** {#extensiondefinition}
|
|
552
|
+
|
|
553
|
+
Object-style plugins with optional `install` and `render` hooks.
|
|
554
|
+
|
|
555
|
+
### **LabelConfig** {#labelconfig}
|
|
556
|
+
|
|
557
|
+
Rich configuration for Label plugin instances (positions, overflow, draggability, etc.).
|
|
558
|
+
|
|
559
|
+
### **LabelOption** {#labeloption}
|
|
560
|
+
|
|
561
|
+
Global Label plugin options (`isVertical`, `isMultiple`, `maxCount`, …).
|
|
562
|
+
|
|
563
|
+
### **MenuConfig** {#menuconfig}
|
|
564
|
+
|
|
565
|
+
Context-menu entry definition (`text`, `className`, `icon`, `callback`).
|
|
566
|
+
|
|
567
|
+
## **BPMN helper types** {#bpmn-elements}
|
|
568
|
+
|
|
569
|
+
### **DefinitionConfigType** {#definitionconfigtype}
|
|
570
|
+
|
|
571
|
+
| Field | Type | Description |
|
|
572
|
+
| ----- | ---- | ----------- |
|
|
573
|
+
| nodes | string[] | BPMN element types receiving the definition bundle. |
|
|
574
|
+
| definition | EventDefinitionType[] \| TaskDefinitionType[] | Associated BPMN definitions. |
|
|
575
|
+
|
|
576
|
+
### **DefinitionPropertiesType** {#definitionpropertiestype}
|
|
577
|
+
|
|
578
|
+
| Field | Type | Description |
|
|
579
|
+
| ----- | ---- | ----------- |
|
|
580
|
+
| definitionType | string | BPMN XML discriminator. |
|
|
581
|
+
| [key: string] | any | Additional serialized fields. |
|
|
582
|
+
|
|
583
|
+
### **EventDefinitionType** {#eventdefinitiontype}
|
|
584
|
+
|
|
585
|
+
| Field | Type | Description |
|
|
586
|
+
| ----- | ---- | ----------- |
|
|
587
|
+
| type | string | Definition name aligned with BPMN XML. |
|
|
588
|
+
| icon | string \| Record<string, any> | Icon payload for palette/rendering. |
|
|
589
|
+
| toJSON | `(data?: unknown) => unknown` | Serializer hook. |
|
|
590
|
+
| properties | DefinitionPropertiesType | Default properties for new nodes. |
|
|
591
|
+
| [key: string] | any | Extension slots. |
|
|
592
|
+
|
|
593
|
+
### **TaskDefinitionType** {#taskdefinitiontype}
|
|
594
|
+
|
|
595
|
+
| Field | Type | Description |
|
|
596
|
+
| ----- | ---- | ----------- |
|
|
597
|
+
| type | string | Task identifier. |
|
|
598
|
+
| [key: string] | any | Extension slots. |
|