Merge pull request #4144 from xyflow/svelte-handle-valid-connection

Svelte: isValidConnection on <Handle />
This commit is contained in:
Moritz Klack
2024-05-02 11:26:38 +02:00
committed by GitHub
2 changed files with 7 additions and 2 deletions
@@ -22,6 +22,7 @@
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
@@ -45,7 +46,7 @@
nodeLookup, nodeLookup,
connectionRadius, connectionRadius,
viewport, viewport,
isValidConnection, isValidConnection: isValidConnectionStore,
lib, lib,
addEdge, addEdge,
onedgecreate, onedgecreate,
@@ -77,7 +78,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;
}; };