refactor(handles): prefix with flow id for handling nested flows #3196

This commit is contained in:
moklick
2024-01-16 16:57:50 +01:00
parent 9e2c907526
commit bc69a6adb4
4 changed files with 18 additions and 6 deletions
+6 -1
View File
@@ -27,6 +27,7 @@ export type OnPointerDownParams = {
isTarget: boolean;
nodes: NodeBase[];
lib: string;
flowId: string | null;
edgeUpdaterType?: HandleType;
updateConnection: UpdateConnection;
panBy: PanBy;
@@ -48,6 +49,7 @@ export type IsValidParams = {
isValidConnection?: IsValidConnection;
doc: Document | ShadowRoot;
lib: string;
flowId: string | null;
};
export type XYHandleInstance = {
@@ -79,6 +81,7 @@ function onPointerDown(
nodes,
lib,
autoPanOnConnect,
flowId,
panBy,
cancelConnection,
onConnectStart,
@@ -169,6 +172,7 @@ function onPointerDown(
isValidConnection,
doc,
lib,
flowId,
});
handleDomNode = result.handleDomNode;
@@ -251,12 +255,13 @@ function isValidHandle(
fromType,
doc,
lib,
flowId,
isValidConnection = alwaysValid,
}: IsValidParams
) {
const isTarget = fromType === 'target';
const handleDomNode = doc.querySelector(
`.${lib}-flow__handle[data-id="${handle?.nodeId}-${handle?.id}-${handle?.type}"]`
`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`
);
const { x, y } = getEventPosition(event);
const handleBelow = doc.elementFromPoint(x, y);