chore(core): deprecate some node props

This commit is contained in:
braks
2024-02-05 07:51:12 +01:00
committed by Braks
parent 3220e20c0e
commit daff22f3cf
+32 -13
View File
@@ -32,7 +32,10 @@ export type HeightFunc = (node: GraphNode) => number | string | void
export interface Node<Data = ElementData, CustomEvents extends Record<string, CustomEvent> = any, Type extends string = string> { export interface Node<Data = ElementData, CustomEvents extends Record<string, CustomEvent> = any, Type extends string = string> {
/** Unique node id */ /** Unique node id */
id: string id: string
/** A node label */ /**
* @deprecated - will be removed in next major release and replaced with `{ data: { label: string | VNode | Component } }`
* A node label
*/
label?: string | VNode | Component label?: string | VNode | Component
/** initial node position x, y */ /** initial node position x, y */
position: XYPosition position: XYPosition
@@ -54,11 +57,15 @@ export interface Node<Data = ElementData, CustomEvents extends Record<string, Cu
deletable?: boolean deletable?: boolean
/** element selector as drag handle for node (can only be dragged from the dragHandle el) */ /** element selector as drag handle for node (can only be dragged from the dragHandle el) */
dragHandle?: string dragHandle?: string
/** @deprecated will be removed in next major release */ /**
/** called when used as target for new connection */ * @deprecated will be removed in next major release
* called when used as target for new connection
*/
isValidTargetPos?: ValidConnectionFunc isValidTargetPos?: ValidConnectionFunc
/** @deprecated will be removed in next major release */ /**
/** called when used as source for new connection */ * @deprecated will be removed in next major release
* called when used as source for new connection
*/
isValidSourcePos?: ValidConnectionFunc isValidSourcePos?: ValidConnectionFunc
/** define node extent, i.e. area in which node can be moved */ /** define node extent, i.e. area in which node can be moved */
extent?: CoordinateExtent | CoordinateExtentRange | 'parent' extent?: CoordinateExtent | CoordinateExtentRange | 'parent'
@@ -86,13 +93,16 @@ export interface Node<Data = ElementData, CustomEvents extends Record<string, Cu
/** Is node hidden */ /** Is node hidden */
hidden?: boolean hidden?: boolean
/** /**
* @deprecated will be removed in the next major release * @deprecated - will be removed in the next major release
* overwrites current node type * overwrites current node type
*/ */
template?: NodeComponent template?: NodeComponent
/** Additional data that is passed to your custom components */ /** Additional data that is passed to your custom components */
data?: Data data?: Data
/** contextual and custom events that are passed to your custom components */ /**
* @deprecated - will be removed in the next major release
* contextual and custom events that are passed to your custom components
*/
events?: Partial<NodeEventsHandler<CustomEvents>> events?: Partial<NodeEventsHandler<CustomEvents>>
zIndex?: number zIndex?: number
ariaLabel?: string ariaLabel?: string
@@ -127,33 +137,39 @@ export interface NodeProps<Data = ElementData, CustomEvents = object, Type exten
type: Type type: Type
/** is node selected */ /** is node selected */
selected: boolean selected: boolean
/** can node handles be connected */ /** can node handles be connected, you need to forward this to your handles for this prop to have any effect */
connectable: HandleConnectable connectable: HandleConnectable
/** node x, y (relative) position on graph */ /**
* @deprecated - will be removed in next major release and replaced with `computedPosition`
* node x, y (relative) position on graph
*/
position: XYPosition position: XYPosition
/** dom element dimensions (width, height) */ /** dom element dimensions (width, height) */
dimensions: Dimensions dimensions: Dimensions
/** /**
* @deprecated - will be removed in next major release and replaced with `{ data: { label: string | VNode | Component } }`
* node label, either pass a string or a VNode * node label, either pass a string or a VNode
* For example like this: `h('div', props, children)`) * For example like this: `h('div', props, children)`)
* Object is just a type-hack for Vue, ignore that * Object is just a type-hack for Vue, ignore that
*/ */
label?: string | VNode | Component | object label?: string | VNode | Component | object
/** /**
* @deprecated will be removed in next major release and replaced by just `isValidConnection` prop * @deprecated will be removed in next major release
* called when used as target for new connection * called when used as target for new connection
*/ */
isValidTargetPos?: ValidConnectionFunc isValidTargetPos?: ValidConnectionFunc
/** /**
* @deprecated will be removed in next major release and replaced by just `isValidConnection` prop * @deprecated will be removed in next major release
* called when used as source for new connection * called when used as source for new connection
*/ */
isValidSourcePos?: ValidConnectionFunc isValidSourcePos?: ValidConnectionFunc
/** /**
* todo: rename to `parentNodeId` * @deprecated - will be removed in next major release. Use `parentNodeId` instead
* parent node id * parent node id
*/ */
parent?: string parent?: string
/** parent node id */
parentNodeId?: string
/** is node currently dragging */ /** is node currently dragging */
dragging: boolean dragging: boolean
/** is node currently resizing */ /** is node currently resizing */
@@ -169,7 +185,10 @@ export interface NodeProps<Data = ElementData, CustomEvents = object, Type exten
/** additional data of node */ /** additional data of node */
data: Data data: Data
/** contextual and custom events of node */ /**
* @deprecated - will be removed in next major release
* contextual and custom events of node
*/
events: NodeEventsOn<CustomEvents> events: NodeEventsOn<CustomEvents>
} }