NodeChange
onNodesChange 回调采用 NodeChange 对象数组,你应使用这些对象来更新流的状态。NodeChange 类型是六种不同对象类型的联合,表示节点在流中可以改变的各种方式。
¥The onNodesChange callback takes
an array of NodeChange objects that you should use to update your flow’s state.
The NodeChange type is a union of six different object types that represent that
various ways an node can change in a flow.
export type NodeChange =
| NodeDimensionChange
| NodePositionChange
| NodeSelectionChange
| NodeRemoveChange
| NodeAddChange
| NodeReplaceChange;变体类型
¥Variant types
NodeDimensionChange
| Name | Type | Default |
|---|---|---|
id | string | |
type | "dimensions" | |
dimensions | Dimensions | |
resizing | boolean | |
setAttributes | boolean | "width" | "height" |
NodePositionChange
| Name | Type | Default |
|---|---|---|
id | string | |
type | "position" | |
position | XYPosition | |
positionAbsolute | XYPosition | |
dragging | boolean |
NodeSelectionChange
| Name | Type | Default |
|---|---|---|
id | string | |
type | "select" | |
selected | boolean |
NodeRemoveChange
| Name | Type | Default |
|---|---|---|
id | string | |
type | "remove" |
NodeAddChange
| Name | Type | Default |
|---|---|---|
item | NodeType | |
type | "add" | |
index | number |
NodeReplaceChange
| Name | Type | Default |
|---|---|---|
id | string | |
item | NodeType | |
type | "replace" |
Last updated on