feat: Extend options to pass custom nodes / edges
* Accept either a Record<string, Component | boolean> or string[] as nodetypes option * If bool / string is used a slot will be expected, otherwise no node/edge will be rendered Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
+1
-1
@@ -63,7 +63,7 @@ export interface EdgeSmoothStepProps<T = any> extends EdgeProps<T> {
|
||||
borderRadius?: number
|
||||
}
|
||||
|
||||
export type EdgeType = DefineComponent<EdgeSmoothStepProps, any, any, any, any, any>
|
||||
export type EdgeType = DefineComponent<EdgeSmoothStepProps, any, any, any, any, any> | boolean
|
||||
|
||||
export type OnEdgeUpdateFunc<T = any> = (oldEdge: Edge<T>, newConnection: Connection) => void
|
||||
|
||||
|
||||
+1
-1
@@ -58,4 +58,4 @@ export interface NodeProps<T = any> {
|
||||
dragging?: boolean
|
||||
}
|
||||
|
||||
export type NodeType = DefineComponent<NodeProps, any, any, any, any>
|
||||
export type NodeType = DefineComponent<NodeProps, any, any, any, any> | boolean
|
||||
|
||||
+2
-2
@@ -93,8 +93,8 @@ export type OnLoadFunc<T = any> = (params: FlowInstance<T>) => void
|
||||
|
||||
export interface FlowOptions extends Omit<HTMLAttributes, 'onLoad'> {
|
||||
elements: Elements
|
||||
nodeTypes?: Record<string, NodeType>
|
||||
edgeTypes?: Record<string, EdgeType>
|
||||
nodeTypes?: Record<string, NodeType> | string[]
|
||||
edgeTypes?: Record<string, EdgeType> | string[]
|
||||
connectionMode?: ConnectionMode
|
||||
connectionLineType?: ConnectionLineType
|
||||
connectionLineStyle?: CSSProperties
|
||||
|
||||
Reference in New Issue
Block a user