@uipath/apollo-react 4.15.0-pr605.6f11404 → 4.15.1
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 +11 -116
- package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodeManager.js +12 -117
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +4 -28
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +1 -2
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +4 -28
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +0 -1
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.cjs +5 -11
- package/dist/canvas/components/BaseNode/BaseNode.d.ts +1 -2
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +6 -9
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts +0 -3
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +13 -222
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +5 -10
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +14 -223
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +2 -10
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +0 -2
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +3 -5
- package/dist/canvas/components/ButtonHandle/HandleButton.cjs +2 -17
- package/dist/canvas/components/ButtonHandle/HandleButton.d.ts +1 -10
- package/dist/canvas/components/ButtonHandle/HandleButton.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/HandleButton.js +2 -17
- package/dist/canvas/components/ButtonHandle/useButtonHandles.cjs +2 -4
- package/dist/canvas/components/ButtonHandle/useButtonHandles.d.ts +1 -2
- package/dist/canvas/components/ButtonHandle/useButtonHandles.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/useButtonHandles.js +2 -4
- package/dist/canvas/components/Edges/SequenceEdge.cjs +4 -8
- package/dist/canvas/components/Edges/SequenceEdge.js +4 -8
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +25 -34
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +2 -8
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +27 -36
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +2 -9
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +3 -10
- package/dist/canvas/components/HierarchicalCanvas/index.d.ts +1 -1
- package/dist/canvas/components/HierarchicalCanvas/index.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNodeHeader.cjs +3 -1
- package/dist/canvas/components/StageNode/StageNodeHeader.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNodeHeader.js +3 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/EdgeToolbar.cjs +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/EdgeToolbar.js +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +24 -41
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +26 -43
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.cjs +3 -10
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.d.ts +1 -1
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.js +3 -10
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.d.ts +0 -1
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.d.ts.map +1 -1
- package/dist/canvas/components/index.cjs +20 -27
- package/dist/canvas/components/index.d.ts +0 -1
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +0 -1
- package/dist/canvas/constants.cjs +0 -4
- package/dist/canvas/constants.d.ts +0 -1
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +1 -2
- package/dist/canvas/core/NodeTypeRegistry.cjs +27 -56
- package/dist/canvas/core/NodeTypeRegistry.d.ts +5 -10
- package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/NodeTypeRegistry.js +28 -57
- package/dist/canvas/core/useNodeTypeRegistry.cjs +3 -13
- package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -2
- package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.js +4 -11
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +23 -22
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +24 -23
- package/dist/canvas/hooks/usePreviewNode.cjs +3 -7
- package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
- package/dist/canvas/hooks/usePreviewNode.js +3 -7
- package/dist/canvas/schema/node-definition/handle.cjs +2 -10
- package/dist/canvas/schema/node-definition/handle.d.ts +0 -9
- package/dist/canvas/schema/node-definition/handle.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/handle.js +1 -6
- package/dist/canvas/schema/node-definition/index.cjs +1 -4
- 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 +0 -4
- package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/hooks/useCanvasStory.d.ts +0 -6
- package/dist/canvas/storybook-utils/hooks/useCanvasStory.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts +0 -1
- 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/storybook-utils/mocks/nodes.d.ts +1 -1
- package/dist/canvas/storybook-utils/mocks/nodes.d.ts.map +1 -1
- package/dist/canvas/styles/reactflow-reset.css +2 -2
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/NodeUtils.cjs +9 -25
- package/dist/canvas/utils/NodeUtils.d.ts +0 -7
- package/dist/canvas/utils/NodeUtils.d.ts.map +1 -1
- package/dist/canvas/utils/NodeUtils.js +6 -13
- package/dist/canvas/utils/collapse.cjs +6 -13
- package/dist/canvas/utils/collapse.d.ts +2 -2
- package/dist/canvas/utils/collapse.d.ts.map +1 -1
- package/dist/canvas/utils/collapse.js +2 -9
- package/dist/canvas/utils/createPreviewNode.cjs +12 -59
- package/dist/canvas/utils/createPreviewNode.d.ts +2 -10
- package/dist/canvas/utils/createPreviewNode.d.ts.map +1 -1
- package/dist/canvas/utils/createPreviewNode.js +12 -50
- package/dist/canvas/utils/index.cjs +26 -47
- package/dist/canvas/utils/index.d.ts +1 -4
- package/dist/canvas/utils/index.d.ts.map +1 -1
- package/dist/canvas/utils/index.js +1 -4
- package/dist/canvas/utils/manifest-resolver.cjs +0 -8
- package/dist/canvas/utils/manifest-resolver.d.ts +0 -1
- package/dist/canvas/utils/manifest-resolver.d.ts.map +1 -1
- package/dist/canvas/utils/manifest-resolver.js +1 -6
- package/package.json +1 -1
- package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +0 -86
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +0 -6
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopCanvasNode.js +0 -52
- package/dist/canvas/components/LoopNode/LoopNode.cjs +0 -434
- package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +0 -93
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +0 -16
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.constants.js +0 -17
- package/dist/canvas/components/LoopNode/LoopNode.d.ts +0 -5
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +0 -185
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +0 -58
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +0 -124
- package/dist/canvas/components/LoopNode/LoopNode.js +0 -400
- package/dist/canvas/components/LoopNode/LoopNode.sequence.cjs +0 -433
- package/dist/canvas/components/LoopNode/LoopNode.sequence.d.ts +0 -57
- package/dist/canvas/components/LoopNode/LoopNode.sequence.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.sequence.js +0 -387
- package/dist/canvas/components/LoopNode/LoopNode.types.cjs +0 -18
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +0 -22
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.types.js +0 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +0 -60
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts +0 -9
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNodePreview.js +0 -26
- package/dist/canvas/components/LoopNode/index.cjs +0 -79
- package/dist/canvas/components/LoopNode/index.d.ts +0 -5
- package/dist/canvas/components/LoopNode/index.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/index.js +0 -4
- package/dist/canvas/components/NodeViewportOverlay.cjs +0 -63
- package/dist/canvas/components/NodeViewportOverlay.d.ts +0 -22
- package/dist/canvas/components/NodeViewportOverlay.d.ts.map +0 -1
- package/dist/canvas/components/NodeViewportOverlay.js +0 -29
- package/dist/canvas/utils/container-sizing.cjs +0 -169
- package/dist/canvas/utils/container-sizing.d.ts +0 -23
- package/dist/canvas/utils/container-sizing.d.ts.map +0 -1
- package/dist/canvas/utils/container-sizing.js +0 -132
- package/dist/canvas/utils/createPreviewGraph.cjs +0 -126
- package/dist/canvas/utils/createPreviewGraph.d.ts +0 -37
- package/dist/canvas/utils/createPreviewGraph.d.ts.map +0 -1
- package/dist/canvas/utils/createPreviewGraph.js +0 -83
- package/dist/canvas/utils/preview-connection-handles.cjs +0 -55
- package/dist/canvas/utils/preview-connection-handles.d.ts +0 -14
- package/dist/canvas/utils/preview-connection-handles.d.ts.map +0 -1
- package/dist/canvas/utils/preview-connection-handles.js +0 -15
|
@@ -29,8 +29,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
30
|
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
31
31
|
const external_react_namespaceObject = require("react");
|
|
32
|
+
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
32
33
|
const index_cjs_namespaceObject = require("../../hooks/index.cjs");
|
|
33
|
-
const createPreviewNode_cjs_namespaceObject = require("../../utils/createPreviewNode.cjs");
|
|
34
34
|
const BaseCanvasModeProvider_cjs_namespaceObject = require("../BaseCanvas/BaseCanvasModeProvider.cjs");
|
|
35
35
|
const external_Toolbar_index_cjs_namespaceObject = require("../Toolbar/index.cjs");
|
|
36
36
|
const external_EdgeUtils_cjs_namespaceObject = require("./EdgeUtils.cjs");
|
|
@@ -80,11 +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
|
|
84
|
-
id,
|
|
85
|
-
source,
|
|
86
|
-
target
|
|
87
|
-
});
|
|
83
|
+
const isPreviewEdge = id === external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID;
|
|
88
84
|
const executionStatus = (0, index_cjs_namespaceObject.useEdgeExecutionState)(id, target);
|
|
89
85
|
const { validationStatus } = (0, index_cjs_namespaceObject.useElementValidationStatus)(id) ?? {
|
|
90
86
|
validationStatus: void 0
|
|
@@ -122,7 +118,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
|
|
|
122
118
|
const getEdgeColor = ()=>{
|
|
123
119
|
if (isDiffAdded) return 'var(--canvas-success-icon)';
|
|
124
120
|
if (isDiffRemoved) return 'var(--canvas-error-icon)';
|
|
125
|
-
if (
|
|
121
|
+
if (isPreviewEdge) return 'var(--canvas-primary)';
|
|
126
122
|
if (selected) return 'var(--canvas-primary)';
|
|
127
123
|
if (isHovered) return 'var(--canvas-primary-hover)';
|
|
128
124
|
if (status) return external_EdgeUtils_cjs_namespaceObject.edgeTargetStatusToEdgeColor[status] ?? 'var(--canvas-border)';
|
|
@@ -166,7 +162,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
|
|
|
166
162
|
strokeWidth: style?.strokeWidth || 2,
|
|
167
163
|
style: {
|
|
168
164
|
stroke: edgeColor,
|
|
169
|
-
strokeDasharray: isDiffRemoved ? style?.strokeDasharray || '5,5' :
|
|
165
|
+
strokeDasharray: isDiffRemoved ? style?.strokeDasharray || '5,5' : isPreviewEdge ? '5,5' : '0',
|
|
170
166
|
opacity: style?.opacity !== void 0 ? style.opacity : 1,
|
|
171
167
|
transition: 'stroke 0.2s ease, opacity 0.2s ease'
|
|
172
168
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
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
5
|
import { useEdgeExecutionState, useEdgePath, useElementValidationStatus } from "../../hooks/index.js";
|
|
5
|
-
import { isPreviewEdge } from "../../utils/createPreviewNode.js";
|
|
6
6
|
import { useBaseCanvasMode } from "../BaseCanvas/BaseCanvasModeProvider.js";
|
|
7
7
|
import { EdgeToolbar, useEdgeToolbarState } from "../Toolbar/index.js";
|
|
8
8
|
import { edgeTargetStatusToEdgeColor, getStatusAnimation } from "./EdgeUtils.js";
|
|
@@ -52,11 +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
|
|
56
|
-
id,
|
|
57
|
-
source,
|
|
58
|
-
target
|
|
59
|
-
});
|
|
55
|
+
const isPreviewEdge = id === PREVIEW_EDGE_ID;
|
|
60
56
|
const executionStatus = useEdgeExecutionState(id, target);
|
|
61
57
|
const { validationStatus } = useElementValidationStatus(id) ?? {
|
|
62
58
|
validationStatus: void 0
|
|
@@ -94,7 +90,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
|
|
|
94
90
|
const getEdgeColor = ()=>{
|
|
95
91
|
if (isDiffAdded) return 'var(--canvas-success-icon)';
|
|
96
92
|
if (isDiffRemoved) return 'var(--canvas-error-icon)';
|
|
97
|
-
if (
|
|
93
|
+
if (isPreviewEdge) return 'var(--canvas-primary)';
|
|
98
94
|
if (selected) return 'var(--canvas-primary)';
|
|
99
95
|
if (isHovered) return 'var(--canvas-primary-hover)';
|
|
100
96
|
if (status) return edgeTargetStatusToEdgeColor[status] ?? 'var(--canvas-border)';
|
|
@@ -138,7 +134,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
|
|
|
138
134
|
strokeWidth: style?.strokeWidth || 2,
|
|
139
135
|
style: {
|
|
140
136
|
stroke: edgeColor,
|
|
141
|
-
strokeDasharray: isDiffRemoved ? style?.strokeDasharray || '5,5' :
|
|
137
|
+
strokeDasharray: isDiffRemoved ? style?.strokeDasharray || '5,5' : isPreviewEdge ? '5,5' : '0',
|
|
142
138
|
opacity: style?.opacity !== void 0 ? style.opacity : 1,
|
|
143
139
|
transition: 'stroke 0.2s ease, opacity 0.2s ease'
|
|
144
140
|
},
|
|
@@ -38,7 +38,6 @@ 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 createPreviewNode_cjs_namespaceObject = require("../../utils/createPreviewNode.cjs");
|
|
42
41
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
43
42
|
const transitions_cjs_namespaceObject = require("../../utils/transitions.cjs");
|
|
44
43
|
const AddNodeManager_cjs_namespaceObject = require("../AddNodePanel/AddNodeManager.cjs");
|
|
@@ -53,15 +52,7 @@ const DEFAULT_NODE_TYPES = {
|
|
|
53
52
|
'blank-canvas-node': external_BlankCanvasNode_index_cjs_namespaceObject.BlankCanvasNode,
|
|
54
53
|
preview: AddNodePreview_cjs_namespaceObject.AddNodePreview
|
|
55
54
|
};
|
|
56
|
-
|
|
57
|
-
if ('position' === change.type) return !!change.dragging;
|
|
58
|
-
if ('dimensions' === change.type) return !!change.setAttributes;
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
function isDefaultViewport(viewport) {
|
|
62
|
-
return 0 === viewport.x && 0 === viewport.y && 1 === viewport.zoom;
|
|
63
|
-
}
|
|
64
|
-
const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
55
|
+
const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
65
56
|
const canvasRef = (0, external_react_namespaceObject.useRef)(null);
|
|
66
57
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
67
58
|
const [reactFlowInstance, setReactFlowInstance] = (0, external_react_namespaceObject.useState)(null);
|
|
@@ -72,22 +63,17 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
72
63
|
});
|
|
73
64
|
const lastCanvasIdRef = (0, external_react_namespaceObject.useRef)(null);
|
|
74
65
|
const shouldAnimate = 'design' === mode && !(0, transitions_cjs_namespaceObject.prefersReducedMotion)();
|
|
75
|
-
const nodeManifests = (0, external_core_index_cjs_namespaceObject.
|
|
76
|
-
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const resolvedRenderer = resolveNodeRenderer?.({
|
|
80
|
-
manifest,
|
|
81
|
-
defaultRenderer
|
|
82
|
-
});
|
|
83
|
-
acc[manifest.nodeType] = resolvedRenderer ?? defaultRenderer;
|
|
84
|
-
}
|
|
66
|
+
const nodeManifests = (0, external_core_index_cjs_namespaceObject.useNodeManifests)();
|
|
67
|
+
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
68
|
+
const types = nodeManifests.reduce((acc, manifest)=>{
|
|
69
|
+
if (!acc[manifest.nodeType]) acc[manifest.nodeType] = external_BaseNode_index_cjs_namespaceObject.BaseNode;
|
|
85
70
|
return acc;
|
|
86
71
|
}, {
|
|
87
72
|
...DEFAULT_NODE_TYPES
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
|
|
73
|
+
});
|
|
74
|
+
return types;
|
|
75
|
+
}, [
|
|
76
|
+
nodeManifests
|
|
91
77
|
]);
|
|
92
78
|
const currentCanvas = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectCurrentCanvas);
|
|
93
79
|
const previousCanvas = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectPreviousCanvas);
|
|
@@ -162,14 +148,15 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
162
148
|
if (currentCanvasId && lastCanvasIdRef.current && currentCanvasId !== lastCanvasIdRef.current) {
|
|
163
149
|
if (reactFlowInstance && currentCanvas?.viewport) {
|
|
164
150
|
const viewport = currentCanvas.viewport;
|
|
165
|
-
if (
|
|
166
|
-
currentViewportRef.current = viewport;
|
|
167
|
-
viewportManager_cjs_namespaceObject.viewportManager.setCurrentViewport(viewport);
|
|
168
|
-
} else setTimeout(()=>{
|
|
151
|
+
if (0 !== viewport.x || 0 !== viewport.y || 1 !== viewport.zoom) setTimeout(()=>{
|
|
169
152
|
reactFlowInstance.setViewport(viewport);
|
|
170
153
|
currentViewportRef.current = viewport;
|
|
171
154
|
viewportManager_cjs_namespaceObject.viewportManager.setCurrentViewport(viewport);
|
|
172
155
|
}, 0);
|
|
156
|
+
else {
|
|
157
|
+
currentViewportRef.current = viewport;
|
|
158
|
+
viewportManager_cjs_namespaceObject.viewportManager.setCurrentViewport(viewport);
|
|
159
|
+
}
|
|
173
160
|
}
|
|
174
161
|
}
|
|
175
162
|
lastCanvasIdRef.current = currentCanvasId || null;
|
|
@@ -184,7 +171,9 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
184
171
|
const handleNodesChange = (0, external_react_namespaceObject.useCallback)((changes)=>{
|
|
185
172
|
const canvas = currentCanvasRef.current;
|
|
186
173
|
if (!canvas) return;
|
|
187
|
-
|
|
174
|
+
const hasMeaningfulChanges = changes.some((change)=>'dimensions' !== change.type && 'position' !== change.type);
|
|
175
|
+
const hasPositionChanges = changes.some((change)=>'position' === change.type && change.dragging);
|
|
176
|
+
if (!hasMeaningfulChanges && !hasPositionChanges) return;
|
|
188
177
|
const updatedNodes = (0, react_cjs_namespaceObject.applyNodeChanges)(changes, canvas.nodes ?? []);
|
|
189
178
|
updateNodes(updatedNodes);
|
|
190
179
|
}, [
|
|
@@ -216,7 +205,7 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
216
205
|
const handleConnect = (0, external_react_namespaceObject.useCallback)((connection)=>{
|
|
217
206
|
const canvas = currentCanvasRef.current;
|
|
218
207
|
if (!connection.source || !connection.target || !canvas) return;
|
|
219
|
-
if (
|
|
208
|
+
if (connection.target === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID || connection.source === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID) return;
|
|
220
209
|
const newEdge = {
|
|
221
210
|
id: `${connection.source}-${connection.target}-${Date.now()}`,
|
|
222
211
|
source: connection.source,
|
|
@@ -224,13 +213,15 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
224
213
|
sourceHandle: connection.sourceHandle || void 0,
|
|
225
214
|
targetHandle: connection.targetHandle || void 0
|
|
226
215
|
};
|
|
227
|
-
const hasPreview = canvas.nodes.some((n)=>n.id === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID);
|
|
228
|
-
const baseEdges = hasPreview ? canvas.edges.filter((edge)=>!(0, createPreviewNode_cjs_namespaceObject.isPreviewEdge)(edge)) : canvas.edges;
|
|
229
216
|
updateEdges([
|
|
230
|
-
...
|
|
217
|
+
...canvas.edges,
|
|
231
218
|
newEdge
|
|
232
219
|
]);
|
|
233
|
-
|
|
220
|
+
const hasPreview = canvas.nodes.some((n)=>n.id === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID);
|
|
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
|
+
}
|
|
234
225
|
}, [
|
|
235
226
|
updateNodes,
|
|
236
227
|
updateEdges
|
|
@@ -264,7 +255,7 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
264
255
|
]);
|
|
265
256
|
const shouldFitView = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
266
257
|
const viewport = currentCanvas?.viewport;
|
|
267
|
-
return viewport ?
|
|
258
|
+
return viewport ? 0 === viewport.x && 0 === viewport.y && 1 === viewport.zoom : false;
|
|
268
259
|
}, [
|
|
269
260
|
currentCanvas?.viewport
|
|
270
261
|
]);
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import { type NodeTypes } from '../../xyflow/react.ts';
|
|
2
1
|
import type React from 'react';
|
|
3
|
-
import type { NodeManifest } from '../../schema/node-definition';
|
|
4
2
|
import type { CanvasLevel } from '../../types/canvas.types';
|
|
5
|
-
|
|
6
|
-
manifest: NodeManifest;
|
|
7
|
-
defaultRenderer: NodeTypes[string];
|
|
8
|
-
}) => NodeTypes[string] | undefined;
|
|
9
|
-
export interface HierarchicalCanvasProps {
|
|
10
|
-
resolveNodeRenderer?: NodeRendererResolver;
|
|
3
|
+
interface HierarchicalCanvasProps {
|
|
11
4
|
mode?: 'view' | 'design' | 'readonly';
|
|
12
5
|
initialCanvases?: Record<string, CanvasLevel>;
|
|
13
6
|
initialPath?: string[];
|
|
@@ -15,4 +8,5 @@ export interface HierarchicalCanvasProps {
|
|
|
15
8
|
onPathChange?: (path: string[]) => void;
|
|
16
9
|
}
|
|
17
10
|
export declare const HierarchicalCanvas: React.FC<HierarchicalCanvasProps>;
|
|
11
|
+
export {};
|
|
18
12
|
//# sourceMappingURL=HierarchicalCanvas.d.ts.map
|
|
@@ -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":"AAoBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAW5D,UAAU,uBAAuB;IAC/B,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,CA2YhE,CAAC"}
|
|
@@ -2,15 +2,14 @@ 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 { PREVIEW_NODE_ID } from "../../constants.js";
|
|
5
|
+
import { PREVIEW_EDGE_ID, PREVIEW_NODE_ID } from "../../constants.js";
|
|
6
6
|
import { Breadcrumb } from "../../controls/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { useNodeManifests } from "../../core/index.js";
|
|
8
8
|
import { useAddNodeOnConnectEnd } from "../../hooks/useAddNodeOnConnectEnd.js";
|
|
9
9
|
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 { isPreviewEdge } from "../../utils/createPreviewNode.js";
|
|
14
13
|
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
15
14
|
import { prefersReducedMotion } from "../../utils/transitions.js";
|
|
16
15
|
import { AddNodeManager } from "../AddNodePanel/AddNodeManager.js";
|
|
@@ -25,15 +24,7 @@ const DEFAULT_NODE_TYPES = {
|
|
|
25
24
|
'blank-canvas-node': BlankCanvasNode,
|
|
26
25
|
preview: AddNodePreview
|
|
27
26
|
};
|
|
28
|
-
|
|
29
|
-
if ('position' === change.type) return !!change.dragging;
|
|
30
|
-
if ('dimensions' === change.type) return !!change.setAttributes;
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
function isDefaultViewport(viewport) {
|
|
34
|
-
return 0 === viewport.x && 0 === viewport.y && 1 === viewport.zoom;
|
|
35
|
-
}
|
|
36
|
-
const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
27
|
+
const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
37
28
|
const canvasRef = useRef(null);
|
|
38
29
|
const containerRef = useRef(null);
|
|
39
30
|
const [reactFlowInstance, setReactFlowInstance] = useState(null);
|
|
@@ -44,22 +35,17 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
44
35
|
});
|
|
45
36
|
const lastCanvasIdRef = useRef(null);
|
|
46
37
|
const shouldAnimate = 'design' === mode && !prefersReducedMotion();
|
|
47
|
-
const nodeManifests =
|
|
48
|
-
const nodeTypes = useMemo(()=>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const resolvedRenderer = resolveNodeRenderer?.({
|
|
52
|
-
manifest,
|
|
53
|
-
defaultRenderer
|
|
54
|
-
});
|
|
55
|
-
acc[manifest.nodeType] = resolvedRenderer ?? defaultRenderer;
|
|
56
|
-
}
|
|
38
|
+
const nodeManifests = useNodeManifests();
|
|
39
|
+
const nodeTypes = useMemo(()=>{
|
|
40
|
+
const types = nodeManifests.reduce((acc, manifest)=>{
|
|
41
|
+
if (!acc[manifest.nodeType]) acc[manifest.nodeType] = BaseNode;
|
|
57
42
|
return acc;
|
|
58
43
|
}, {
|
|
59
44
|
...DEFAULT_NODE_TYPES
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
|
|
45
|
+
});
|
|
46
|
+
return types;
|
|
47
|
+
}, [
|
|
48
|
+
nodeManifests
|
|
63
49
|
]);
|
|
64
50
|
const currentCanvas = useCanvasStore(selectCurrentCanvas);
|
|
65
51
|
const previousCanvas = useCanvasStore(selectPreviousCanvas);
|
|
@@ -134,14 +120,15 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
134
120
|
if (currentCanvasId && lastCanvasIdRef.current && currentCanvasId !== lastCanvasIdRef.current) {
|
|
135
121
|
if (reactFlowInstance && currentCanvas?.viewport) {
|
|
136
122
|
const viewport = currentCanvas.viewport;
|
|
137
|
-
if (
|
|
138
|
-
currentViewportRef.current = viewport;
|
|
139
|
-
viewportManager.setCurrentViewport(viewport);
|
|
140
|
-
} else setTimeout(()=>{
|
|
123
|
+
if (0 !== viewport.x || 0 !== viewport.y || 1 !== viewport.zoom) setTimeout(()=>{
|
|
141
124
|
reactFlowInstance.setViewport(viewport);
|
|
142
125
|
currentViewportRef.current = viewport;
|
|
143
126
|
viewportManager.setCurrentViewport(viewport);
|
|
144
127
|
}, 0);
|
|
128
|
+
else {
|
|
129
|
+
currentViewportRef.current = viewport;
|
|
130
|
+
viewportManager.setCurrentViewport(viewport);
|
|
131
|
+
}
|
|
145
132
|
}
|
|
146
133
|
}
|
|
147
134
|
lastCanvasIdRef.current = currentCanvasId || null;
|
|
@@ -156,7 +143,9 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
156
143
|
const handleNodesChange = useCallback((changes)=>{
|
|
157
144
|
const canvas = currentCanvasRef.current;
|
|
158
145
|
if (!canvas) return;
|
|
159
|
-
|
|
146
|
+
const hasMeaningfulChanges = changes.some((change)=>'dimensions' !== change.type && 'position' !== change.type);
|
|
147
|
+
const hasPositionChanges = changes.some((change)=>'position' === change.type && change.dragging);
|
|
148
|
+
if (!hasMeaningfulChanges && !hasPositionChanges) return;
|
|
160
149
|
const updatedNodes = applyNodeChanges(changes, canvas.nodes ?? []);
|
|
161
150
|
updateNodes(updatedNodes);
|
|
162
151
|
}, [
|
|
@@ -188,7 +177,7 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
188
177
|
const handleConnect = useCallback((connection)=>{
|
|
189
178
|
const canvas = currentCanvasRef.current;
|
|
190
179
|
if (!connection.source || !connection.target || !canvas) return;
|
|
191
|
-
if (
|
|
180
|
+
if (connection.target === PREVIEW_NODE_ID || connection.source === PREVIEW_NODE_ID) return;
|
|
192
181
|
const newEdge = {
|
|
193
182
|
id: `${connection.source}-${connection.target}-${Date.now()}`,
|
|
194
183
|
source: connection.source,
|
|
@@ -196,13 +185,15 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
196
185
|
sourceHandle: connection.sourceHandle || void 0,
|
|
197
186
|
targetHandle: connection.targetHandle || void 0
|
|
198
187
|
};
|
|
199
|
-
const hasPreview = canvas.nodes.some((n)=>n.id === PREVIEW_NODE_ID);
|
|
200
|
-
const baseEdges = hasPreview ? canvas.edges.filter((edge)=>!isPreviewEdge(edge)) : canvas.edges;
|
|
201
188
|
updateEdges([
|
|
202
|
-
...
|
|
189
|
+
...canvas.edges,
|
|
203
190
|
newEdge
|
|
204
191
|
]);
|
|
205
|
-
|
|
192
|
+
const hasPreview = canvas.nodes.some((n)=>n.id === PREVIEW_NODE_ID);
|
|
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
|
+
}
|
|
206
197
|
}, [
|
|
207
198
|
updateNodes,
|
|
208
199
|
updateEdges
|
|
@@ -236,7 +227,7 @@ const HierarchicalCanvas = ({ resolveNodeRenderer, mode = 'design', initialCanva
|
|
|
236
227
|
]);
|
|
237
228
|
const shouldFitView = useMemo(()=>{
|
|
238
229
|
const viewport = currentCanvas?.viewport;
|
|
239
|
-
return viewport ?
|
|
230
|
+
return viewport ? 0 === viewport.x && 0 === viewport.y && 1 === viewport.zoom : false;
|
|
240
231
|
}, [
|
|
241
232
|
currentCanvas?.viewport
|
|
242
233
|
]);
|
|
@@ -35,7 +35,6 @@ const canvasStore_cjs_namespaceObject = require("../../stores/canvasStore.cjs");
|
|
|
35
35
|
const CanvasEventBus_cjs_namespaceObject = require("../../utils/CanvasEventBus.cjs");
|
|
36
36
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
37
37
|
const createAddNodePreview_cjs_namespaceObject = require("../AddNodePanel/createAddNodePreview.cjs");
|
|
38
|
-
const LoopNode_sequence_cjs_namespaceObject = require("../LoopNode/LoopNode.sequence.cjs");
|
|
39
38
|
const external_HierarchicalCanvas_cjs_namespaceObject = require("./HierarchicalCanvas.cjs");
|
|
40
39
|
const createDemoCanvases = ()=>{
|
|
41
40
|
const rootCanvas = {
|
|
@@ -326,7 +325,6 @@ const workflowManifest = {
|
|
|
326
325
|
};
|
|
327
326
|
const CanvasWithControlsContent = ({ initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
328
327
|
const reactFlowInstance = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
329
|
-
const registry = (0, index_cjs_namespaceObject.useOptionalNodeTypeRegistry)();
|
|
330
328
|
const currentCanvas = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectCurrentCanvas);
|
|
331
329
|
const currentPathLength = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectCurrentPathLength);
|
|
332
330
|
const addNode = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectAddNode);
|
|
@@ -334,20 +332,15 @@ const CanvasWithControlsContent = ({ initialCanvases, initialPath, onCanvasesCha
|
|
|
334
332
|
const removeEdge = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectRemoveEdge);
|
|
335
333
|
const updateNodes = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectUpdateNodes);
|
|
336
334
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
337
|
-
const resolverOptions = (0, LoopNode_sequence_cjs_namespaceObject.createLoopSequenceResolverOptions)(registry);
|
|
338
335
|
const handleAction = (event)=>{
|
|
339
|
-
if (reactFlowInstance)
|
|
340
|
-
const sourceHandleType = 'input' === event.handleType ? 'target' : 'source';
|
|
341
|
-
(0, createAddNodePreview_cjs_namespaceObject.createAddNodePreview)(event.nodeId, event.handleId, reactFlowInstance, event.position, sourceHandleType, [], resolverOptions);
|
|
342
|
-
}
|
|
336
|
+
if (reactFlowInstance) (0, createAddNodePreview_cjs_namespaceObject.createAddNodePreview)(event.nodeId, event.handleId, reactFlowInstance);
|
|
343
337
|
};
|
|
344
338
|
CanvasEventBus_cjs_namespaceObject.canvasEventBus.on('handle:action', handleAction);
|
|
345
339
|
return ()=>{
|
|
346
340
|
CanvasEventBus_cjs_namespaceObject.canvasEventBus.off('handle:action', handleAction);
|
|
347
341
|
};
|
|
348
342
|
}, [
|
|
349
|
-
reactFlowInstance
|
|
350
|
-
registry
|
|
343
|
+
reactFlowInstance
|
|
351
344
|
]);
|
|
352
345
|
const handleAddNode = (0, external_react_namespaceObject.useCallback)((nodeType)=>{
|
|
353
346
|
const existingNodes = currentCanvas?.nodes.filter((n)=>'blank-canvas-node' !== n.id).length || 0;
|
|
@@ -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":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA6d/B,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,EA8BlD,CAAC"}
|
|
@@ -2,12 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Panel, ReactFlowProvider, useReactFlow } from "../../xyflow/react.js";
|
|
3
3
|
import { Button } from "@uipath/apollo-wind";
|
|
4
4
|
import { useCallback, useEffect, useState } from "react";
|
|
5
|
-
import { NodeRegistryProvider
|
|
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
8
|
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
9
9
|
import { createAddNodePreview } from "../AddNodePanel/createAddNodePreview.js";
|
|
10
|
-
import { createLoopSequenceResolverOptions } from "../LoopNode/LoopNode.sequence.js";
|
|
11
10
|
import { HierarchicalCanvas } from "./HierarchicalCanvas.js";
|
|
12
11
|
const createDemoCanvases = ()=>{
|
|
13
12
|
const rootCanvas = {
|
|
@@ -298,7 +297,6 @@ const workflowManifest = {
|
|
|
298
297
|
};
|
|
299
298
|
const CanvasWithControlsContent = ({ initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
300
299
|
const reactFlowInstance = useReactFlow();
|
|
301
|
-
const registry = useOptionalNodeTypeRegistry();
|
|
302
300
|
const currentCanvas = useCanvasStore(selectCurrentCanvas);
|
|
303
301
|
const currentPathLength = useCanvasStore(selectCurrentPathLength);
|
|
304
302
|
const addNode = useCanvasStore(selectAddNode);
|
|
@@ -306,20 +304,15 @@ const CanvasWithControlsContent = ({ initialCanvases, initialPath, onCanvasesCha
|
|
|
306
304
|
const removeEdge = useCanvasStore(selectRemoveEdge);
|
|
307
305
|
const updateNodes = useCanvasStore(selectUpdateNodes);
|
|
308
306
|
useEffect(()=>{
|
|
309
|
-
const resolverOptions = createLoopSequenceResolverOptions(registry);
|
|
310
307
|
const handleAction = (event)=>{
|
|
311
|
-
if (reactFlowInstance)
|
|
312
|
-
const sourceHandleType = 'input' === event.handleType ? 'target' : 'source';
|
|
313
|
-
createAddNodePreview(event.nodeId, event.handleId, reactFlowInstance, event.position, sourceHandleType, [], resolverOptions);
|
|
314
|
-
}
|
|
308
|
+
if (reactFlowInstance) createAddNodePreview(event.nodeId, event.handleId, reactFlowInstance);
|
|
315
309
|
};
|
|
316
310
|
canvasEventBus.on('handle:action', handleAction);
|
|
317
311
|
return ()=>{
|
|
318
312
|
canvasEventBus.off('handle:action', handleAction);
|
|
319
313
|
};
|
|
320
314
|
}, [
|
|
321
|
-
reactFlowInstance
|
|
322
|
-
registry
|
|
315
|
+
reactFlowInstance
|
|
323
316
|
]);
|
|
324
317
|
const handleAddNode = useCallback((nodeType)=>{
|
|
325
318
|
const existingNodes = currentCanvas?.nodes.filter((n)=>'blank-canvas-node' !== n.id).length || 0;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { HierarchicalCanvas
|
|
1
|
+
export { HierarchicalCanvas } from './HierarchicalCanvas';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -61,7 +61,8 @@ const CHIP_ICONS = {
|
|
|
61
61
|
})
|
|
62
62
|
};
|
|
63
63
|
const StageNodeHeaderInner = ({ props, isReadOnly, isException, status, handleTaskAddClick })=>{
|
|
64
|
-
const { id, stageDetails, execution, addTaskLabel = 'Add task', onTaskAdd, onAddTaskFromToolbox, onStageTitleChange } = props;
|
|
64
|
+
const { id, stageDetails, execution, addTaskLabel = 'Add task', onTaskAdd, onAddTaskFromToolbox, onStageTitleChange, loadingTaskIds } = props;
|
|
65
|
+
const isAddTaskDisabled = (loadingTaskIds?.size ?? 0) > 0;
|
|
65
66
|
const icon = stageDetails?.icon;
|
|
66
67
|
const statusLabel = execution?.stageStatus?.label;
|
|
67
68
|
const stageDuration = execution?.stageStatus?.duration;
|
|
@@ -229,6 +230,7 @@ const StageNodeHeaderInner = ({ props, isReadOnly, isException, status, handleTa
|
|
|
229
230
|
className: "h-6 w-6",
|
|
230
231
|
onClick: handleTaskAddClick,
|
|
231
232
|
"aria-label": addTaskLabel,
|
|
233
|
+
disabled: isAddTaskDisabled,
|
|
232
234
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icon_registry_cjs_namespaceObject.CanvasIcon, {
|
|
233
235
|
icon: "plus",
|
|
234
236
|
size: 20
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StageNodeHeader.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNodeHeader.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"StageNodeHeader.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNodeHeader.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAoMrE,eAAO,MAAM,eAAe,wGAnLzB;IACD,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,kBAAkB,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACvD,6CA6KwD,CAAC"}
|
|
@@ -33,7 +33,8 @@ const CHIP_ICONS = {
|
|
|
33
33
|
})
|
|
34
34
|
};
|
|
35
35
|
const StageNodeHeaderInner = ({ props, isReadOnly, isException, status, handleTaskAddClick })=>{
|
|
36
|
-
const { id, stageDetails, execution, addTaskLabel = 'Add task', onTaskAdd, onAddTaskFromToolbox, onStageTitleChange } = props;
|
|
36
|
+
const { id, stageDetails, execution, addTaskLabel = 'Add task', onTaskAdd, onAddTaskFromToolbox, onStageTitleChange, loadingTaskIds } = props;
|
|
37
|
+
const isAddTaskDisabled = (loadingTaskIds?.size ?? 0) > 0;
|
|
37
38
|
const icon = stageDetails?.icon;
|
|
38
39
|
const statusLabel = execution?.stageStatus?.label;
|
|
39
40
|
const stageDuration = execution?.stageStatus?.duration;
|
|
@@ -201,6 +202,7 @@ const StageNodeHeaderInner = ({ props, isReadOnly, isException, status, handleTa
|
|
|
201
202
|
className: "h-6 w-6",
|
|
202
203
|
onClick: handleTaskAddClick,
|
|
203
204
|
"aria-label": addTaskLabel,
|
|
205
|
+
disabled: isAddTaskDisabled,
|
|
204
206
|
children: /*#__PURE__*/ jsx(CanvasIcon, {
|
|
205
207
|
icon: "plus",
|
|
206
208
|
size: 20
|
|
@@ -38,7 +38,7 @@ const EdgeToolbarComponent = ({ edgeId, visible, positioning, config, onMouseEnt
|
|
|
38
38
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.EdgeLabelRenderer, {
|
|
39
39
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.AnimatePresence, {
|
|
40
40
|
children: visible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.motion.div, {
|
|
41
|
-
className: "nodrag nopan absolute top-0 left-0
|
|
41
|
+
className: "nodrag nopan absolute top-0 left-0 pointer-events-auto z-[1000] flex flex-row items-center gap-1",
|
|
42
42
|
initial: {
|
|
43
43
|
opacity: 0
|
|
44
44
|
},
|
|
@@ -10,7 +10,7 @@ const EdgeToolbarComponent = ({ edgeId, visible, positioning, config, onMouseEnt
|
|
|
10
10
|
return /*#__PURE__*/ jsx(EdgeLabelRenderer, {
|
|
11
11
|
children: /*#__PURE__*/ jsx(AnimatePresence, {
|
|
12
12
|
children: visible && /*#__PURE__*/ jsx(motion.div, {
|
|
13
|
-
className: "nodrag nopan absolute top-0 left-0
|
|
13
|
+
className: "nodrag nopan absolute top-0 left-0 pointer-events-auto z-[1000] flex flex-row items-center gap-1",
|
|
14
14
|
initial: {
|
|
15
15
|
opacity: 0
|
|
16
16
|
},
|