feat(workflow): improve group node interaction handling

- Enhanced `useNodesInteractions` to better manage group node handlers and connections, ensuring accurate identification of leaf nodes and their branches.
- Updated logic to create handlers based on node connections, differentiating between internal and external connections.
- Refined initial node setup to include target branches for group nodes, improving the overall interaction model for grouped elements.
This commit is contained in:
zhsama
2026-01-05 17:42:31 +08:00
parent 50bed78d7a
commit 9012dced6a
3 changed files with 68 additions and 42 deletions

View File

@ -380,6 +380,16 @@ export const initialNodes = (originNodes: Node[], originEdges: Edge[]) => {
})
}
if (node.data.type === BlockEnum.Group) {
const groupData = node.data as GroupNodeData
if (groupData.handlers?.length) {
node.data._targetBranches = groupData.handlers.map(handler => ({
id: handler.id,
name: handler.label || handler.id,
}))
}
}
if (node.data.type === BlockEnum.Iteration) {
const iterationNodeData = node.data as IterationNodeType
iterationNodeData._children = iterationOrLoopNodeMap[node.id] || []