added isValidConnection on Handle component

This commit is contained in:
peterkogo
2024-04-11 13:03:12 +02:00
parent 63aa0dd713
commit 7d24127e3f
2 changed files with 9 additions and 2 deletions
@@ -22,12 +22,15 @@
export let position: $$Props['position'] = Position.Top; export let position: $$Props['position'] = Position.Top;
export let style: $$Props['style'] = undefined; export let style: $$Props['style'] = undefined;
export let isConnectable: $$Props['isConnectable'] = undefined; export let isConnectable: $$Props['isConnectable'] = undefined;
export let isValidConnection: $$Props['isValidConnection'] = undefined;
export let onconnect: $$Props['onconnect'] = undefined; export let onconnect: $$Props['onconnect'] = undefined;
export let ondisconnect: $$Props['ondisconnect'] = undefined; export let ondisconnect: $$Props['ondisconnect'] = undefined;
// @todo implement connectablestart, connectableend // @todo implement connectablestart, connectableend
// export let isConnectableStart: $$Props['isConnectableStart'] = undefined; // export let isConnectableStart: $$Props['isConnectableStart'] = undefined;
// export let isConnectableEnd: $$Props['isConnectableEnd'] = undefined; // export let isConnectableEnd: $$Props['isConnectableEnd'] = undefined;
$: console.log(isValidConnection);
let className: $$Props['class'] = undefined; let className: $$Props['class'] = undefined;
export { className as class }; export { className as class };
@@ -45,7 +48,7 @@
nodeLookup, nodeLookup,
connectionRadius, connectionRadius,
viewport, viewport,
isValidConnection, isValidConnection: isValidConnectionStore,
lib, lib,
addEdge, addEdge,
onedgecreate, onedgecreate,
@@ -77,7 +80,7 @@
lib: $lib, lib: $lib,
autoPanOnConnect: $autoPanOnConnect, autoPanOnConnect: $autoPanOnConnect,
flowId: $flowId, flowId: $flowId,
isValidConnection: $isValidConnection, isValidConnection: isValidConnection ?? $isValidConnectionStore,
updateConnection, updateConnection,
cancelConnection, cancelConnection,
panBy, panBy,
+4
View File
@@ -45,6 +45,10 @@ export type HandleComponentProps = {
isConnectableStart?: boolean; isConnectableStart?: boolean;
/** Should you be able to connect to this handle */ /** Should you be able to connect to this handle */
isConnectableEnd?: boolean; isConnectableEnd?: boolean;
/** Function that is called when checking if connection is valid.
* Overrides the isValidConnection on the Flow component.
*/
isValidConnection?: IsValidConnection;
onconnect?: (connections: Connection[]) => void; onconnect?: (connections: Connection[]) => void;
ondisconnect?: (connections: Connection[]) => void; ondisconnect?: (connections: Connection[]) => void;
}; };