@uipath/apollo-react 4.12.2 → 4.13.0-pr556.bec268e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/components/AddNodePanel/AddNodeManager.cjs +26 -7
- package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodeManager.js +26 -7
- package/dist/canvas/components/AddNodePanel/index.cjs +2 -6
- package/dist/canvas/components/AddNodePanel/index.d.ts +0 -1
- package/dist/canvas/components/AddNodePanel/index.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/index.js +1 -2
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +1 -0
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.cjs +10 -3
- package/dist/canvas/components/BaseNode/BaseNode.d.ts +2 -1
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +7 -3
- package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +4 -2
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +2 -1
- package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNodeContainer.js +4 -2
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +115 -34
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +4 -2
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +117 -36
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +48 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +4 -0
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +36 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.cjs +3 -2
- package/dist/canvas/components/Edges/SequenceEdge.d.ts +11 -2
- package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.js +4 -3
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +23 -15
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +2 -0
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +24 -16
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +11 -8
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +11 -8
- package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +112 -0
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +6 -0
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopCanvasNode.js +78 -0
- package/dist/canvas/components/LoopNode/LoopNode.cjs +430 -0
- package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +77 -0
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +12 -0
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNode.constants.js +13 -0
- package/dist/canvas/components/LoopNode/LoopNode.d.ts +5 -0
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +137 -0
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +26 -0
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +94 -0
- package/dist/canvas/components/LoopNode/LoopNode.js +396 -0
- package/dist/canvas/components/LoopNode/LoopNode.types.cjs +18 -0
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +11 -0
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNode.types.js +0 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +61 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts +9 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.js +27 -0
- package/dist/canvas/components/LoopNode/index.cjs +72 -0
- package/dist/canvas/components/LoopNode/index.d.ts +4 -0
- package/dist/canvas/components/LoopNode/index.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/index.js +3 -0
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +27 -24
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts +2 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +28 -25
- package/dist/canvas/components/index.cjs +27 -20
- package/dist/canvas/components/index.d.ts +1 -0
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +1 -0
- package/dist/canvas/constants.cjs +8 -0
- package/dist/canvas/constants.d.ts +2 -0
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +3 -1
- package/dist/canvas/core/NodeTypeRegistry.cjs +39 -23
- package/dist/canvas/core/NodeTypeRegistry.d.ts +8 -4
- package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/NodeTypeRegistry.js +39 -23
- package/dist/canvas/core/useNodeTypeRegistry.cjs +4 -3
- package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.js +4 -3
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +10 -3
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +10 -3
- package/dist/canvas/hooks/usePreviewNode.cjs +4 -2
- package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
- package/dist/canvas/hooks/usePreviewNode.js +4 -2
- package/dist/canvas/schema/node-definition/handle.cjs +10 -2
- package/dist/canvas/schema/node-definition/handle.d.ts +9 -0
- package/dist/canvas/schema/node-definition/handle.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/handle.js +6 -1
- package/dist/canvas/schema/node-definition/index.cjs +4 -1
- package/dist/canvas/schema/node-definition/index.d.ts +3 -3
- package/dist/canvas/schema/node-definition/index.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/index.js +2 -2
- package/dist/canvas/schema/node-definition/node-manifest.d.ts +4 -0
- package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts +1 -0
- package/dist/canvas/storybook-utils/manifests/index.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/{createPreviewNode.cjs → createPreviewGraph.cjs} +115 -41
- package/dist/canvas/utils/createPreviewGraph.d.ts +43 -0
- package/dist/canvas/utils/createPreviewGraph.d.ts.map +1 -0
- package/dist/canvas/utils/{createPreviewNode.js → createPreviewGraph.js} +95 -36
- package/dist/canvas/utils/index.cjs +10 -10
- package/dist/canvas/utils/index.d.ts +2 -2
- package/dist/canvas/utils/index.d.ts.map +1 -1
- package/dist/canvas/utils/index.js +2 -2
- package/package.json +1 -1
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +0 -41
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +0 -3
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +0 -1
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +0 -7
- package/dist/canvas/utils/createPreviewNode.d.ts +0 -17
- package/dist/canvas/utils/createPreviewNode.d.ts.map +0 -1
|
@@ -80,7 +80,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
|
|
|
80
80
|
const pathElementRef = (0, external_react_namespaceObject.useRef)(null);
|
|
81
81
|
const { mode } = (0, BaseCanvasModeProvider_cjs_namespaceObject.useBaseCanvasMode)();
|
|
82
82
|
const isReadOnly = 'readonly' === mode;
|
|
83
|
-
const isPreviewEdge = id === external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID;
|
|
83
|
+
const isPreviewEdge = id === external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID || source === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID || target === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID;
|
|
84
84
|
const executionStatus = (0, index_cjs_namespaceObject.useEdgeExecutionState)(id, target);
|
|
85
85
|
const { validationStatus } = (0, index_cjs_namespaceObject.useElementValidationStatus)(id) ?? {
|
|
86
86
|
validationStatus: void 0
|
|
@@ -111,7 +111,8 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
|
|
|
111
111
|
sourcePosition,
|
|
112
112
|
targetPosition,
|
|
113
113
|
source,
|
|
114
|
-
target
|
|
114
|
+
target,
|
|
115
|
+
parentId: data?.parentId
|
|
115
116
|
});
|
|
116
117
|
const getEdgeColor = ()=>{
|
|
117
118
|
if (isDiffAdded) return 'var(--canvas-success-icon)';
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import { type EdgeProps } from '../../xyflow/react.ts';
|
|
2
|
-
|
|
1
|
+
import { type Edge, type EdgeProps } from '../../xyflow/react.ts';
|
|
2
|
+
interface SequenceEdgeData extends Record<string, unknown> {
|
|
3
|
+
isDiffAdded?: boolean;
|
|
4
|
+
isDiffRemoved?: boolean;
|
|
5
|
+
label?: string;
|
|
6
|
+
parentId?: string;
|
|
7
|
+
}
|
|
8
|
+
type SequenceEdgeType = Edge<SequenceEdgeData>;
|
|
9
|
+
type SequenceEdgeProps = EdgeProps<SequenceEdgeType>;
|
|
10
|
+
export declare const SequenceEdge: import("react").NamedExoticComponent<SequenceEdgeProps>;
|
|
11
|
+
export {};
|
|
3
12
|
//# sourceMappingURL=SequenceEdge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SequenceEdge.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Edges/SequenceEdge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"SequenceEdge.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Edges/SequenceEdge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAY,MAAM,0CAA0C,CAAC;AAW/F,UAAU,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAC/C,KAAK,iBAAiB,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC;AA2CrD,eAAO,MAAM,YAAY,yDAyMJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Position } from "../../xyflow/react.js";
|
|
3
3
|
import { memo, useRef, useState } from "react";
|
|
4
|
-
import { PREVIEW_EDGE_ID } from "../../constants.js";
|
|
4
|
+
import { PREVIEW_EDGE_ID, PREVIEW_NODE_ID } from "../../constants.js";
|
|
5
5
|
import { useEdgeExecutionState, useEdgePath, useElementValidationStatus } from "../../hooks/index.js";
|
|
6
6
|
import { useBaseCanvasMode } from "../BaseCanvas/BaseCanvasModeProvider.js";
|
|
7
7
|
import { EdgeToolbar, useEdgeToolbarState } from "../Toolbar/index.js";
|
|
@@ -52,7 +52,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
|
|
|
52
52
|
const pathElementRef = useRef(null);
|
|
53
53
|
const { mode } = useBaseCanvasMode();
|
|
54
54
|
const isReadOnly = 'readonly' === mode;
|
|
55
|
-
const isPreviewEdge = id === PREVIEW_EDGE_ID;
|
|
55
|
+
const isPreviewEdge = id === PREVIEW_EDGE_ID || source === PREVIEW_NODE_ID || target === PREVIEW_NODE_ID;
|
|
56
56
|
const executionStatus = useEdgeExecutionState(id, target);
|
|
57
57
|
const { validationStatus } = useElementValidationStatus(id) ?? {
|
|
58
58
|
validationStatus: void 0
|
|
@@ -83,7 +83,8 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
|
|
|
83
83
|
sourcePosition,
|
|
84
84
|
targetPosition,
|
|
85
85
|
source,
|
|
86
|
-
target
|
|
86
|
+
target,
|
|
87
|
+
parentId: data?.parentId
|
|
87
88
|
});
|
|
88
89
|
const getEdgeColor = ()=>{
|
|
89
90
|
if (isDiffAdded) return 'var(--canvas-success-icon)';
|
|
@@ -38,6 +38,7 @@ const animatedViewportManager_cjs_namespaceObject = require("../../stores/animat
|
|
|
38
38
|
const canvasStore_cjs_namespaceObject = require("../../stores/canvasStore.cjs");
|
|
39
39
|
const viewportManager_cjs_namespaceObject = require("../../stores/viewportManager.cjs");
|
|
40
40
|
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
41
|
+
const createPreviewGraph_cjs_namespaceObject = require("../../utils/createPreviewGraph.cjs");
|
|
41
42
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
42
43
|
const transitions_cjs_namespaceObject = require("../../utils/transitions.cjs");
|
|
43
44
|
const AddNodeManager_cjs_namespaceObject = require("../AddNodePanel/AddNodeManager.cjs");
|
|
@@ -52,7 +53,7 @@ const DEFAULT_NODE_TYPES = {
|
|
|
52
53
|
'blank-canvas-node': external_BlankCanvasNode_index_cjs_namespaceObject.BlankCanvasNode,
|
|
53
54
|
preview: AddNodePreview_cjs_namespaceObject.AddNodePreview
|
|
54
55
|
};
|
|
55
|
-
const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
56
|
+
const HierarchicalCanvas = ({ additionalNodeTypes, mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
56
57
|
const canvasRef = (0, external_react_namespaceObject.useRef)(null);
|
|
57
58
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
58
59
|
const [reactFlowInstance, setReactFlowInstance] = (0, external_react_namespaceObject.useState)(null);
|
|
@@ -65,14 +66,17 @@ const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onC
|
|
|
65
66
|
const shouldAnimate = 'design' === mode && !(0, transitions_cjs_namespaceObject.prefersReducedMotion)();
|
|
66
67
|
const nodeManifests = (0, external_core_index_cjs_namespaceObject.useNodeManifests)();
|
|
67
68
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
const manifestNodeTypes = Object.fromEntries(nodeManifests.map(({ nodeType })=>nodeType).filter((nodeType)=>!Object.hasOwn(DEFAULT_NODE_TYPES, nodeType)).map((nodeType)=>[
|
|
70
|
+
nodeType,
|
|
71
|
+
external_BaseNode_index_cjs_namespaceObject.BaseNode
|
|
72
|
+
]));
|
|
73
|
+
return {
|
|
74
|
+
...DEFAULT_NODE_TYPES,
|
|
75
|
+
...manifestNodeTypes,
|
|
76
|
+
...additionalNodeTypes
|
|
77
|
+
};
|
|
75
78
|
}, [
|
|
79
|
+
additionalNodeTypes,
|
|
76
80
|
nodeManifests
|
|
77
81
|
]);
|
|
78
82
|
const currentCanvas = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectCurrentCanvas);
|
|
@@ -206,22 +210,26 @@ const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onC
|
|
|
206
210
|
const canvas = currentCanvasRef.current;
|
|
207
211
|
if (!connection.source || !connection.target || !canvas) return;
|
|
208
212
|
if (connection.target === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID || connection.source === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID) return;
|
|
213
|
+
const parentId = (0, createPreviewGraph_cjs_namespaceObject.inferParentId)(connection.source, connection.target, canvas.nodes);
|
|
209
214
|
const newEdge = {
|
|
210
215
|
id: `${connection.source}-${connection.target}-${Date.now()}`,
|
|
211
216
|
source: connection.source,
|
|
212
217
|
target: connection.target,
|
|
213
218
|
sourceHandle: connection.sourceHandle || void 0,
|
|
214
|
-
targetHandle: connection.targetHandle || void 0
|
|
219
|
+
targetHandle: connection.targetHandle || void 0,
|
|
220
|
+
...parentId ? {
|
|
221
|
+
data: {
|
|
222
|
+
parentId
|
|
223
|
+
}
|
|
224
|
+
} : {}
|
|
215
225
|
};
|
|
226
|
+
const hasPreview = canvas.nodes.some((n)=>n.id === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID);
|
|
227
|
+
const baseEdges = hasPreview ? canvas.edges.filter((edge)=>edge.source !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID && edge.target !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID) : canvas.edges;
|
|
216
228
|
updateEdges([
|
|
217
|
-
...
|
|
229
|
+
...baseEdges,
|
|
218
230
|
newEdge
|
|
219
231
|
]);
|
|
220
|
-
|
|
221
|
-
if (hasPreview) {
|
|
222
|
-
updateNodes(canvas.nodes.filter((n)=>n.id !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID));
|
|
223
|
-
updateEdges(canvas.edges.filter((e)=>e.id !== external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID));
|
|
224
|
-
}
|
|
232
|
+
if (hasPreview) updateNodes(canvas.nodes.filter((n)=>n.id !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID));
|
|
225
233
|
}, [
|
|
226
234
|
updateNodes,
|
|
227
235
|
updateEdges
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type NodeTypes } from '../../xyflow/react.ts';
|
|
1
2
|
import type React from 'react';
|
|
2
3
|
import type { CanvasLevel } from '../../types/canvas.types';
|
|
3
4
|
interface HierarchicalCanvasProps {
|
|
5
|
+
additionalNodeTypes?: NodeTypes;
|
|
4
6
|
mode?: 'view' | 'design' | 'readonly';
|
|
5
7
|
initialCanvases?: Record<string, CanvasLevel>;
|
|
6
8
|
initialPath?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchicalCanvas.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvas.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HierarchicalCanvas.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EAUf,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAY5D,UAAU,uBAAuB;IAC/B,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;IAKtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAK9C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAMvB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC;IAInE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACzC;AASD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAqZhE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Panel, applyEdgeChanges, applyNodeChanges } from "../../xyflow/react.js";
|
|
3
3
|
import { Spinner } from "@uipath/apollo-wind";
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { PREVIEW_NODE_ID } from "../../constants.js";
|
|
6
6
|
import { Breadcrumb } from "../../controls/index.js";
|
|
7
7
|
import { useNodeManifests } from "../../core/index.js";
|
|
8
8
|
import { useAddNodeOnConnectEnd } from "../../hooks/useAddNodeOnConnectEnd.js";
|
|
@@ -10,6 +10,7 @@ import { animatedViewportManager } from "../../stores/animatedViewportManager.js
|
|
|
10
10
|
import { selectBreadcrumbs, selectCanvasStack, selectCurrentCanvas, selectCurrentPath, selectDrillIntoNode, selectInitializeCanvas, selectInitializeWithData, selectNavigateToDepth, selectNavigateToSiblingCanvas, selectPreviousCanvas, selectTransitionState, selectUpdateEdges, selectUpdateNodes, selectUpdateSelection, selectUpdateViewport, useCanvasStore } from "../../stores/canvasStore.js";
|
|
11
11
|
import { viewportManager } from "../../stores/viewportManager.js";
|
|
12
12
|
import { DefaultCanvasTranslations } from "../../types.js";
|
|
13
|
+
import { inferParentId } from "../../utils/createPreviewGraph.js";
|
|
13
14
|
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
14
15
|
import { prefersReducedMotion } from "../../utils/transitions.js";
|
|
15
16
|
import { AddNodeManager } from "../AddNodePanel/AddNodeManager.js";
|
|
@@ -24,7 +25,7 @@ const DEFAULT_NODE_TYPES = {
|
|
|
24
25
|
'blank-canvas-node': BlankCanvasNode,
|
|
25
26
|
preview: AddNodePreview
|
|
26
27
|
};
|
|
27
|
-
const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
28
|
+
const HierarchicalCanvas = ({ additionalNodeTypes, mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
28
29
|
const canvasRef = useRef(null);
|
|
29
30
|
const containerRef = useRef(null);
|
|
30
31
|
const [reactFlowInstance, setReactFlowInstance] = useState(null);
|
|
@@ -37,14 +38,17 @@ const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onC
|
|
|
37
38
|
const shouldAnimate = 'design' === mode && !prefersReducedMotion();
|
|
38
39
|
const nodeManifests = useNodeManifests();
|
|
39
40
|
const nodeTypes = useMemo(()=>{
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
const manifestNodeTypes = Object.fromEntries(nodeManifests.map(({ nodeType })=>nodeType).filter((nodeType)=>!Object.hasOwn(DEFAULT_NODE_TYPES, nodeType)).map((nodeType)=>[
|
|
42
|
+
nodeType,
|
|
43
|
+
BaseNode
|
|
44
|
+
]));
|
|
45
|
+
return {
|
|
46
|
+
...DEFAULT_NODE_TYPES,
|
|
47
|
+
...manifestNodeTypes,
|
|
48
|
+
...additionalNodeTypes
|
|
49
|
+
};
|
|
47
50
|
}, [
|
|
51
|
+
additionalNodeTypes,
|
|
48
52
|
nodeManifests
|
|
49
53
|
]);
|
|
50
54
|
const currentCanvas = useCanvasStore(selectCurrentCanvas);
|
|
@@ -178,22 +182,26 @@ const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onC
|
|
|
178
182
|
const canvas = currentCanvasRef.current;
|
|
179
183
|
if (!connection.source || !connection.target || !canvas) return;
|
|
180
184
|
if (connection.target === PREVIEW_NODE_ID || connection.source === PREVIEW_NODE_ID) return;
|
|
185
|
+
const parentId = inferParentId(connection.source, connection.target, canvas.nodes);
|
|
181
186
|
const newEdge = {
|
|
182
187
|
id: `${connection.source}-${connection.target}-${Date.now()}`,
|
|
183
188
|
source: connection.source,
|
|
184
189
|
target: connection.target,
|
|
185
190
|
sourceHandle: connection.sourceHandle || void 0,
|
|
186
|
-
targetHandle: connection.targetHandle || void 0
|
|
191
|
+
targetHandle: connection.targetHandle || void 0,
|
|
192
|
+
...parentId ? {
|
|
193
|
+
data: {
|
|
194
|
+
parentId
|
|
195
|
+
}
|
|
196
|
+
} : {}
|
|
187
197
|
};
|
|
198
|
+
const hasPreview = canvas.nodes.some((n)=>n.id === PREVIEW_NODE_ID);
|
|
199
|
+
const baseEdges = hasPreview ? canvas.edges.filter((edge)=>edge.source !== PREVIEW_NODE_ID && edge.target !== PREVIEW_NODE_ID) : canvas.edges;
|
|
188
200
|
updateEdges([
|
|
189
|
-
...
|
|
201
|
+
...baseEdges,
|
|
190
202
|
newEdge
|
|
191
203
|
]);
|
|
192
|
-
|
|
193
|
-
if (hasPreview) {
|
|
194
|
-
updateNodes(canvas.nodes.filter((n)=>n.id !== PREVIEW_NODE_ID));
|
|
195
|
-
updateEdges(canvas.edges.filter((e)=>e.id !== PREVIEW_EDGE_ID));
|
|
196
|
-
}
|
|
204
|
+
if (hasPreview) updateNodes(canvas.nodes.filter((n)=>n.id !== PREVIEW_NODE_ID));
|
|
197
205
|
}, [
|
|
198
206
|
updateNodes,
|
|
199
207
|
updateEdges
|
|
@@ -33,8 +33,8 @@ const external_react_namespaceObject = require("react");
|
|
|
33
33
|
const index_cjs_namespaceObject = require("../../core/index.cjs");
|
|
34
34
|
const canvasStore_cjs_namespaceObject = require("../../stores/canvasStore.cjs");
|
|
35
35
|
const CanvasEventBus_cjs_namespaceObject = require("../../utils/CanvasEventBus.cjs");
|
|
36
|
+
const createPreviewGraph_cjs_namespaceObject = require("../../utils/createPreviewGraph.cjs");
|
|
36
37
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
37
|
-
const createAddNodePreview_cjs_namespaceObject = require("../AddNodePanel/createAddNodePreview.cjs");
|
|
38
38
|
const external_HierarchicalCanvas_cjs_namespaceObject = require("./HierarchicalCanvas.cjs");
|
|
39
39
|
const createDemoCanvases = ()=>{
|
|
40
40
|
const rootCanvas = {
|
|
@@ -332,13 +332,16 @@ const CanvasWithControlsContent = ({ initialCanvases, initialPath, onCanvasesCha
|
|
|
332
332
|
const removeEdge = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectRemoveEdge);
|
|
333
333
|
const updateNodes = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectUpdateNodes);
|
|
334
334
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
335
|
+
const unsubscribe = CanvasEventBus_cjs_namespaceObject.canvasEventBus.on('handle:action', (event)=>{
|
|
336
|
+
(0, createPreviewGraph_cjs_namespaceObject.showPreviewGraph)({
|
|
337
|
+
sourceNodeId: event.nodeId,
|
|
338
|
+
sourceHandleId: event.handleId,
|
|
339
|
+
reactFlowInstance,
|
|
340
|
+
sourceHandleType: 'input' === event.handleType ? 'target' : 'source',
|
|
341
|
+
handlePosition: event.position
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
return unsubscribe;
|
|
342
345
|
}, [
|
|
343
346
|
reactFlowInstance
|
|
344
347
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchicalCanvasWithControls.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HierarchicalCanvasWithControls.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8d/B,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,EA8BlD,CAAC"}
|
|
@@ -5,8 +5,8 @@ import { useCallback, useEffect, useState } from "react";
|
|
|
5
5
|
import { NodeRegistryProvider } from "../../core/index.js";
|
|
6
6
|
import { selectAddNode, selectCurrentCanvas, selectCurrentPathLength, selectRemoveEdge, selectRemoveNode, selectUpdateNodes, useCanvasStore } from "../../stores/canvasStore.js";
|
|
7
7
|
import { canvasEventBus } from "../../utils/CanvasEventBus.js";
|
|
8
|
+
import { showPreviewGraph } from "../../utils/createPreviewGraph.js";
|
|
8
9
|
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
9
|
-
import { createAddNodePreview } from "../AddNodePanel/createAddNodePreview.js";
|
|
10
10
|
import { HierarchicalCanvas } from "./HierarchicalCanvas.js";
|
|
11
11
|
const createDemoCanvases = ()=>{
|
|
12
12
|
const rootCanvas = {
|
|
@@ -304,13 +304,16 @@ const CanvasWithControlsContent = ({ initialCanvases, initialPath, onCanvasesCha
|
|
|
304
304
|
const removeEdge = useCanvasStore(selectRemoveEdge);
|
|
305
305
|
const updateNodes = useCanvasStore(selectUpdateNodes);
|
|
306
306
|
useEffect(()=>{
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
307
|
+
const unsubscribe = canvasEventBus.on('handle:action', (event)=>{
|
|
308
|
+
showPreviewGraph({
|
|
309
|
+
sourceNodeId: event.nodeId,
|
|
310
|
+
sourceHandleId: event.handleId,
|
|
311
|
+
reactFlowInstance,
|
|
312
|
+
sourceHandleType: 'input' === event.handleType ? 'target' : 'source',
|
|
313
|
+
handlePosition: event.position
|
|
314
|
+
});
|
|
315
|
+
});
|
|
316
|
+
return unsubscribe;
|
|
314
317
|
}, [
|
|
315
318
|
reactFlowInstance
|
|
316
319
|
]);
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
LoopCanvasNode: ()=>LoopCanvasNode
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
const index_cjs_namespaceObject = require("../../core/index.cjs");
|
|
33
|
+
const canvasStore_cjs_namespaceObject = require("../../stores/canvasStore.cjs");
|
|
34
|
+
const NodeUtils_cjs_namespaceObject = require("../../utils/NodeUtils.cjs");
|
|
35
|
+
const external_BaseNode_index_cjs_namespaceObject = require("../BaseNode/index.cjs");
|
|
36
|
+
const external_LoopNode_cjs_namespaceObject = require("./LoopNode.cjs");
|
|
37
|
+
const external_LoopNode_constants_cjs_namespaceObject = require("./LoopNode.constants.cjs");
|
|
38
|
+
const external_LoopNode_helpers_cjs_namespaceObject = require("./LoopNode.helpers.cjs");
|
|
39
|
+
const external_LoopNodePreview_cjs_namespaceObject = require("./LoopNodePreview.cjs");
|
|
40
|
+
function shouldRenderLoopContainer(manifest) {
|
|
41
|
+
return manifest?.handleConfiguration.some((group)=>'inner' === group.boundary) ?? false;
|
|
42
|
+
}
|
|
43
|
+
function LoopCanvasNodeComponent(props) {
|
|
44
|
+
const reactFlow = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
45
|
+
const nodeTypeRegistry = (0, index_cjs_namespaceObject.useOptionalNodeTypeRegistry)();
|
|
46
|
+
const updateNodes = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectUpdateNodes);
|
|
47
|
+
const nodeVersion = 'string' == typeof props.data?.version ? props.data.version : void 0;
|
|
48
|
+
const loopManifest = (0, external_react_namespaceObject.useMemo)(()=>nodeTypeRegistry?.getManifest(props.type ?? external_LoopNode_constants_cjs_namespaceObject.DEFAULT_LOOP_NODE_TYPE, nodeVersion), [
|
|
49
|
+
nodeTypeRegistry,
|
|
50
|
+
props.type,
|
|
51
|
+
nodeVersion
|
|
52
|
+
]);
|
|
53
|
+
const shouldUseLoopContainer = (0, external_react_namespaceObject.useMemo)(()=>shouldRenderLoopContainer(loopManifest), [
|
|
54
|
+
loopManifest
|
|
55
|
+
]);
|
|
56
|
+
const loopPreviewHandles = (0, external_react_namespaceObject.useMemo)(()=>shouldUseLoopContainer ? (0, external_LoopNode_helpers_cjs_namespaceObject.resolveLoopPreviewConnectionHandles)(loopManifest, {
|
|
57
|
+
...props.data ?? {},
|
|
58
|
+
nodeId: props.id
|
|
59
|
+
}) : null, [
|
|
60
|
+
shouldUseLoopContainer,
|
|
61
|
+
loopManifest,
|
|
62
|
+
props.data,
|
|
63
|
+
props.id
|
|
64
|
+
]);
|
|
65
|
+
const handleAddFirstChild = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
66
|
+
if (!loopPreviewHandles) return;
|
|
67
|
+
(0, external_LoopNodePreview_cjs_namespaceObject.showCenteredContainerPreview)({
|
|
68
|
+
containerId: props.id,
|
|
69
|
+
reactFlowInstance: reactFlow,
|
|
70
|
+
previewHandles: loopPreviewHandles
|
|
71
|
+
});
|
|
72
|
+
}, [
|
|
73
|
+
loopPreviewHandles,
|
|
74
|
+
props.id,
|
|
75
|
+
reactFlow
|
|
76
|
+
]);
|
|
77
|
+
const handleResize = (0, external_react_namespaceObject.useCallback)(({ width, height })=>{
|
|
78
|
+
const currentCanvas = (0, canvasStore_cjs_namespaceObject.selectCurrentCanvas)(canvasStore_cjs_namespaceObject.useCanvasStore.getState());
|
|
79
|
+
if (!currentCanvas) return;
|
|
80
|
+
const nextWidth = (0, NodeUtils_cjs_namespaceObject.snapToGrid)(width);
|
|
81
|
+
const nextHeight = (0, NodeUtils_cjs_namespaceObject.snapToGrid)(height);
|
|
82
|
+
updateNodes(currentCanvas.nodes.map((node)=>node.id !== props.id ? node : {
|
|
83
|
+
...node,
|
|
84
|
+
width: nextWidth,
|
|
85
|
+
height: nextHeight,
|
|
86
|
+
style: {
|
|
87
|
+
...node.style ?? {},
|
|
88
|
+
width: nextWidth,
|
|
89
|
+
height: nextHeight
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
}, [
|
|
93
|
+
props.id,
|
|
94
|
+
updateNodes
|
|
95
|
+
]);
|
|
96
|
+
if (loopManifest && !shouldUseLoopContainer) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseNode_index_cjs_namespaceObject.BaseNode, {
|
|
97
|
+
...props
|
|
98
|
+
});
|
|
99
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_LoopNode_cjs_namespaceObject.LoopNode, {
|
|
100
|
+
...props,
|
|
101
|
+
onAddFirstChild: loopPreviewHandles ? handleAddFirstChild : void 0,
|
|
102
|
+
onResize: handleResize
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const LoopCanvasNode = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(LoopCanvasNodeComponent);
|
|
106
|
+
exports.LoopCanvasNode = __webpack_exports__.LoopCanvasNode;
|
|
107
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
108
|
+
"LoopCanvasNode"
|
|
109
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
110
|
+
Object.defineProperty(exports, '__esModule', {
|
|
111
|
+
value: true
|
|
112
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Node, NodeProps } from '../../xyflow/react.ts';
|
|
2
|
+
import type { LoopNodeData } from './LoopNode.types';
|
|
3
|
+
declare function LoopCanvasNodeComponent(props: NodeProps<Node<LoopNodeData>>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const LoopCanvasNode: import("react").MemoExoticComponent<typeof LoopCanvasNodeComponent>;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=LoopCanvasNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoopCanvasNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopCanvasNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAWhF,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,kBAAkB,CAAC;AAQpE,iBAAS,uBAAuB,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,2CA4EpE;AAED,eAAO,MAAM,cAAc,qEAAgC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useReactFlow } from "../../xyflow/react.js";
|
|
3
|
+
import { memo, useCallback, useMemo } from "react";
|
|
4
|
+
import { useOptionalNodeTypeRegistry } from "../../core/index.js";
|
|
5
|
+
import { selectCurrentCanvas, selectUpdateNodes, useCanvasStore } from "../../stores/canvasStore.js";
|
|
6
|
+
import { snapToGrid } from "../../utils/NodeUtils.js";
|
|
7
|
+
import { BaseNode } from "../BaseNode/index.js";
|
|
8
|
+
import { LoopNode } from "./LoopNode.js";
|
|
9
|
+
import { DEFAULT_LOOP_NODE_TYPE } from "./LoopNode.constants.js";
|
|
10
|
+
import { resolveLoopPreviewConnectionHandles } from "./LoopNode.helpers.js";
|
|
11
|
+
import { showCenteredContainerPreview } from "./LoopNodePreview.js";
|
|
12
|
+
function shouldRenderLoopContainer(manifest) {
|
|
13
|
+
return manifest?.handleConfiguration.some((group)=>'inner' === group.boundary) ?? false;
|
|
14
|
+
}
|
|
15
|
+
function LoopCanvasNodeComponent(props) {
|
|
16
|
+
const reactFlow = useReactFlow();
|
|
17
|
+
const nodeTypeRegistry = useOptionalNodeTypeRegistry();
|
|
18
|
+
const updateNodes = useCanvasStore(selectUpdateNodes);
|
|
19
|
+
const nodeVersion = 'string' == typeof props.data?.version ? props.data.version : void 0;
|
|
20
|
+
const loopManifest = useMemo(()=>nodeTypeRegistry?.getManifest(props.type ?? DEFAULT_LOOP_NODE_TYPE, nodeVersion), [
|
|
21
|
+
nodeTypeRegistry,
|
|
22
|
+
props.type,
|
|
23
|
+
nodeVersion
|
|
24
|
+
]);
|
|
25
|
+
const shouldUseLoopContainer = useMemo(()=>shouldRenderLoopContainer(loopManifest), [
|
|
26
|
+
loopManifest
|
|
27
|
+
]);
|
|
28
|
+
const loopPreviewHandles = useMemo(()=>shouldUseLoopContainer ? resolveLoopPreviewConnectionHandles(loopManifest, {
|
|
29
|
+
...props.data ?? {},
|
|
30
|
+
nodeId: props.id
|
|
31
|
+
}) : null, [
|
|
32
|
+
shouldUseLoopContainer,
|
|
33
|
+
loopManifest,
|
|
34
|
+
props.data,
|
|
35
|
+
props.id
|
|
36
|
+
]);
|
|
37
|
+
const handleAddFirstChild = useCallback(()=>{
|
|
38
|
+
if (!loopPreviewHandles) return;
|
|
39
|
+
showCenteredContainerPreview({
|
|
40
|
+
containerId: props.id,
|
|
41
|
+
reactFlowInstance: reactFlow,
|
|
42
|
+
previewHandles: loopPreviewHandles
|
|
43
|
+
});
|
|
44
|
+
}, [
|
|
45
|
+
loopPreviewHandles,
|
|
46
|
+
props.id,
|
|
47
|
+
reactFlow
|
|
48
|
+
]);
|
|
49
|
+
const handleResize = useCallback(({ width, height })=>{
|
|
50
|
+
const currentCanvas = selectCurrentCanvas(useCanvasStore.getState());
|
|
51
|
+
if (!currentCanvas) return;
|
|
52
|
+
const nextWidth = snapToGrid(width);
|
|
53
|
+
const nextHeight = snapToGrid(height);
|
|
54
|
+
updateNodes(currentCanvas.nodes.map((node)=>node.id !== props.id ? node : {
|
|
55
|
+
...node,
|
|
56
|
+
width: nextWidth,
|
|
57
|
+
height: nextHeight,
|
|
58
|
+
style: {
|
|
59
|
+
...node.style ?? {},
|
|
60
|
+
width: nextWidth,
|
|
61
|
+
height: nextHeight
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
}, [
|
|
65
|
+
props.id,
|
|
66
|
+
updateNodes
|
|
67
|
+
]);
|
|
68
|
+
if (loopManifest && !shouldUseLoopContainer) return /*#__PURE__*/ jsx(BaseNode, {
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
return /*#__PURE__*/ jsx(LoopNode, {
|
|
72
|
+
...props,
|
|
73
|
+
onAddFirstChild: loopPreviewHandles ? handleAddFirstChild : void 0,
|
|
74
|
+
onResize: handleResize
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const LoopCanvasNode = /*#__PURE__*/ memo(LoopCanvasNodeComponent);
|
|
78
|
+
export { LoopCanvasNode };
|