InternalNode<NodeType>
内部节点是用户节点的扩展。它在内部使用,并包含一些未直接向用户公开的额外信息,例如 positionAbsolute
和 handleBounds
。
export type InternalNode<NodeType extends Node = Node> = {
id: string;
position: XYPosition;
data: Node['data'];
type?: Node['type'];
sourcePosition?: Position;
targetPosition?: Position;
hidden?: boolean;
selected?: boolean;
dragging?: boolean;
draggable?: boolean;
selectable?: boolean;
connectable?: boolean;
resizing?: boolean;
deletable?: boolean;
dragHandle?: string;
width?: number | null;
height?: number | null;
parentId?: string;
zIndex?: number;
extent?: 'parent' | CoordinateExtent;
expandParent?: boolean;
ariaLabel?: string;
origin?: NodeOrigin;
style?: string;
class?: string;
measured: {
width?: number;
height?: number;
};
internals: {
positionAbsolute: XYPosition;
z: number;
/** Holds a reference to the original node object provided by the user.
* Used as an optimization to avoid certain operations. */
userNode: NodeType;
handleBounds?: NodeHandleBounds;
};
};
字段
名称 | 类型 |
---|---|
# id | string |
# position | XYPosition |
# data | T |
# type? | U |
# sourcePosition? | Position |
# targetPosition? | Position |
# hidden? | boolean |
# selected? | boolean |
# dragging? | boolean |
# draggable? | boolean |
# selectable? | boolean |
# connectable? | boolean |
# resizing? | boolean |
# deletable? | boolean |
# dragHandle? | string |
# width? | number | null |
# height? | number | null |
# parentId? | string |
# zIndex? | number |
# extent? | "parent" | CoordinateExtent |
# expandParent? | boolean |
# ariaLabel? | string |
# origin? | NodeOrigin |
# style? | string |
# class? | string |
说明
- 可以使用
useInternalNode
钩子或getInternalNode
访问内部节点。