refactor(core): add HandleConnectableFunc type

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2022-12-06 17:08:11 +01:00
committed by Braks
parent 4be318807e
commit 9cab0257d6
+3 -1
View File
@@ -22,6 +22,8 @@ export type ValidConnectionFunc = (
elements: { edges: GraphEdge[]; sourceNode: GraphNode; targetNode: GraphNode }, elements: { edges: GraphEdge[]; sourceNode: GraphNode; targetNode: GraphNode },
) => boolean ) => boolean
export type HandleConnectableFunc = (node: GraphNode, connectedEdges: GraphEdge[]) => boolean
/** /**
* set to true to allow unlimited connections, * set to true to allow unlimited connections,
* single for only one connection * single for only one connection
@@ -29,7 +31,7 @@ export type ValidConnectionFunc = (
* *
* if set to single and the handle already has more than one connection, it will act the same as setting it to false * if set to single and the handle already has more than one connection, it will act the same as setting it to false
*/ */
export type HandleConnectable = boolean | 'single' | ((node: GraphNode, connectedEdges: GraphEdge[]) => boolean) export type HandleConnectable = boolean | 'single' | HandleConnectableFunc
export interface HandleProps { export interface HandleProps {
/** Unique id of handle element */ /** Unique id of handle element */