@uipath/apollo-react 6.68.0 → 6.70.0
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/createAddNodePreview.cjs +2 -2
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +1 -1
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +1 -1
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +11 -0
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/NodeLabel.cjs +4 -85
- package/dist/canvas/components/BaseNode/NodeLabel.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/NodeLabel.js +5 -86
- package/dist/canvas/components/BaseNode/useInlineLabelEditing.cjs +141 -0
- package/dist/canvas/components/BaseNode/useInlineLabelEditing.d.ts +28 -0
- package/dist/canvas/components/BaseNode/useInlineLabelEditing.d.ts.map +1 -0
- package/dist/canvas/components/BaseNode/useInlineLabelEditing.js +107 -0
- package/dist/canvas/components/CaseFlow/case-flow.manifest.d.ts +11 -0
- package/dist/canvas/components/CaseFlow/case-flow.manifest.d.ts.map +1 -1
- package/dist/canvas/components/ContainerNode/ContainerBadge.cjs +45 -0
- package/dist/canvas/components/ContainerNode/ContainerBadge.d.ts +6 -0
- package/dist/canvas/components/ContainerNode/ContainerBadge.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerBadge.js +11 -0
- package/dist/canvas/components/ContainerNode/ContainerCanvasNode.cjs +83 -0
- package/dist/canvas/components/ContainerNode/ContainerCanvasNode.d.ts +6 -0
- package/dist/canvas/components/ContainerNode/ContainerCanvasNode.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerCanvasNode.js +49 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.cjs +375 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.config.cjs +65 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.config.d.ts +20 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.config.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.config.js +28 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.constants.cjs +173 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.constants.d.ts +50 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.constants.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.constants.js +100 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.d.ts +5 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.helpers.cjs +183 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.helpers.d.ts +34 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.helpers.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.helpers.js +137 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.cjs +100 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.d.ts +9 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.hooks.js +54 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.js +341 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.types.cjs +18 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.types.d.ts +69 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.types.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerNode.types.js +0 -0
- package/dist/canvas/components/ContainerNode/ContainerNodeHeader.cjs +144 -0
- package/dist/canvas/components/ContainerNode/ContainerNodeHeader.d.ts +32 -0
- package/dist/canvas/components/ContainerNode/ContainerNodeHeader.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerNodeHeader.js +110 -0
- package/dist/canvas/components/ContainerNode/ContainerNodeParts.cjs +167 -0
- package/dist/canvas/components/ContainerNode/ContainerNodeParts.d.ts +51 -0
- package/dist/canvas/components/ContainerNode/ContainerNodeParts.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/ContainerNodeParts.js +118 -0
- package/dist/canvas/components/{LoopNode/LoopNodePreview.cjs → ContainerNode/ContainerNodePreview.cjs} +4 -4
- package/dist/canvas/components/{LoopNode/LoopNodePreview.d.ts → ContainerNode/ContainerNodePreview.d.ts} +2 -2
- package/dist/canvas/components/ContainerNode/ContainerNodePreview.d.ts.map +1 -0
- package/dist/canvas/components/{LoopNode/LoopNodePreview.js → ContainerNode/ContainerNodePreview.js} +3 -3
- package/dist/canvas/components/ContainerNode/index.cjs +86 -0
- package/dist/canvas/components/ContainerNode/index.d.ts +6 -0
- package/dist/canvas/components/ContainerNode/index.d.ts.map +1 -0
- package/dist/canvas/components/ContainerNode/index.js +5 -0
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +2 -2
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +2 -2
- package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +2 -41
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +1 -5
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopCanvasNode.js +2 -41
- package/dist/canvas/components/LoopNode/LoopNode.cjs +49 -525
- package/dist/canvas/components/LoopNode/LoopNode.d.ts +5 -1
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +32 -155
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +1 -33
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +1 -135
- package/dist/canvas/components/LoopNode/LoopNode.js +50 -529
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +3 -12
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +2 -2
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +1 -1
- package/dist/canvas/components/index.cjs +51 -44
- 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/hooks/useAddNodeOnConnectEnd.cjs +2 -2
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +1 -1
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/schema/node-definition/index.cjs +3 -0
- package/dist/canvas/schema/node-definition/index.d.ts +2 -2
- 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.cjs +37 -2
- package/dist/canvas/schema/node-definition/node-manifest.d.ts +85 -0
- package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/node-manifest.js +34 -2
- package/dist/canvas/storybook-utils/hooks/useCanvasStory.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts +11 -0
- package/dist/canvas/storybook-utils/manifests/index.d.ts.map +1 -1
- package/dist/canvas/styles/reactflow-reset.css +2 -2
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +3 -3
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Position } from "../../xyflow/react.js";
|
|
2
|
+
import { CONTAINER_FRAME_INSET_PX, getContainerSafeArea, isContainerNodeManifest, resolveContainerPreview } from "../../utils/container.js";
|
|
3
|
+
import { getOppositePosition } from "../../utils/createPreviewNode.js";
|
|
4
|
+
import { resolveHandles } from "../../utils/manifest-resolver.js";
|
|
5
|
+
import { snapToGrid } from "../../utils/NodeUtils.js";
|
|
6
|
+
function resolveContainerHandleGroups(groups) {
|
|
7
|
+
return groups.map((group)=>{
|
|
8
|
+
const boundary = group.boundary ?? 'outer';
|
|
9
|
+
const position = group.position;
|
|
10
|
+
return {
|
|
11
|
+
...group,
|
|
12
|
+
boundary,
|
|
13
|
+
connectionPosition: 'inner' === boundary ? getOppositePosition(position) : position,
|
|
14
|
+
customPositionAndOffsets: 'inner' === boundary ? insetInnerGroup(group) : group.customPositionAndOffsets
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function getContainerRelativeBodyCenter(containerNode) {
|
|
19
|
+
const safeArea = getContainerSafeArea(containerNode);
|
|
20
|
+
return {
|
|
21
|
+
x: snapToGrid(safeArea.x + safeArea.width / 2),
|
|
22
|
+
y: snapToGrid(safeArea.y + safeArea.height / 2)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function insetInnerGroup(group) {
|
|
26
|
+
const offsets = group.customPositionAndOffsets ?? {};
|
|
27
|
+
switch(group.position){
|
|
28
|
+
case Position.Left:
|
|
29
|
+
return {
|
|
30
|
+
...offsets,
|
|
31
|
+
left: (offsets.left ?? 0) + CONTAINER_FRAME_INSET_PX
|
|
32
|
+
};
|
|
33
|
+
case Position.Right:
|
|
34
|
+
return {
|
|
35
|
+
...offsets,
|
|
36
|
+
right: (offsets.right ?? 0) + CONTAINER_FRAME_INSET_PX
|
|
37
|
+
};
|
|
38
|
+
case Position.Top:
|
|
39
|
+
return {
|
|
40
|
+
...offsets,
|
|
41
|
+
top: (offsets.top ?? 0) + CONTAINER_FRAME_INSET_PX
|
|
42
|
+
};
|
|
43
|
+
case Position.Bottom:
|
|
44
|
+
return {
|
|
45
|
+
...offsets,
|
|
46
|
+
bottom: (offsets.bottom ?? 0) + CONTAINER_FRAME_INSET_PX
|
|
47
|
+
};
|
|
48
|
+
default:
|
|
49
|
+
return offsets;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function resolveContainerPreviewConnectionHandles(manifest, context) {
|
|
53
|
+
if (!manifest) return null;
|
|
54
|
+
const innerGroups = resolveHandles(manifest.handleConfiguration, context).filter((group)=>'inner' === group.boundary && (group.visible ?? true));
|
|
55
|
+
const sourceHandle = pickPreferredInnerHandle(innerGroups, 'source');
|
|
56
|
+
const targetHandle = pickPreferredInnerHandle(innerGroups, 'target');
|
|
57
|
+
if (!sourceHandle) return null;
|
|
58
|
+
return {
|
|
59
|
+
sourceHandleId: sourceHandle.handle.id,
|
|
60
|
+
sourceHandlePosition: getOppositePosition(sourceHandle.group.position),
|
|
61
|
+
...targetHandle ? {
|
|
62
|
+
targetHandleId: targetHandle.handle.id
|
|
63
|
+
} : {}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function pickPreferredInnerHandle(groups, type) {
|
|
67
|
+
for (const group of groups){
|
|
68
|
+
const handle = group.handles.find((candidate)=>candidate.type === type && candidate.visible);
|
|
69
|
+
if (handle) return {
|
|
70
|
+
group,
|
|
71
|
+
handle
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
function resolveClickedHandle({ source, reactFlowInstance, getManifestForNode }) {
|
|
77
|
+
if (!source.handleId) return;
|
|
78
|
+
const sourceNode = reactFlowInstance.getNode(source.nodeId);
|
|
79
|
+
if (!sourceNode) return;
|
|
80
|
+
const sourceManifest = getManifestForNode(sourceNode);
|
|
81
|
+
const dataHandleConfiguration = sourceNode.data?.handleConfigurations;
|
|
82
|
+
const handleConfiguration = Array.isArray(dataHandleConfiguration) ? dataHandleConfiguration : sourceManifest?.handleConfiguration;
|
|
83
|
+
if (!handleConfiguration) return;
|
|
84
|
+
const sourceHandles = resolveHandles(handleConfiguration, {
|
|
85
|
+
...sourceNode.data,
|
|
86
|
+
nodeId: sourceNode.id
|
|
87
|
+
});
|
|
88
|
+
for (const group of sourceHandles){
|
|
89
|
+
const handle = group.handles.find((candidate)=>candidate.id === source.handleId);
|
|
90
|
+
if (handle) return {
|
|
91
|
+
boundary: group.boundary ?? 'outer',
|
|
92
|
+
handleType: handle.handleType
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function resolveContainerAddNodePreview({ source, sourceHandleType, reactFlowInstance, getManifestForNode, replacedEdge }) {
|
|
97
|
+
const clickedHandle = resolveClickedHandle({
|
|
98
|
+
source,
|
|
99
|
+
reactFlowInstance,
|
|
100
|
+
getManifestForNode
|
|
101
|
+
});
|
|
102
|
+
if (clickedHandle?.handleType !== 'output') return null;
|
|
103
|
+
const sourceNode = reactFlowInstance.getNode(source.nodeId);
|
|
104
|
+
const sourceIsContainer = void 0 !== sourceNode && isContainerNodeManifest(getManifestForNode(sourceNode));
|
|
105
|
+
const allowedContainerId = sourceIsContainer && 'inner' !== clickedHandle.boundary ? sourceNode?.parentId : void 0;
|
|
106
|
+
if (sourceIsContainer && 'inner' !== clickedHandle.boundary && !allowedContainerId) return null;
|
|
107
|
+
return resolveContainerPreview({
|
|
108
|
+
source,
|
|
109
|
+
sourceHandleType,
|
|
110
|
+
reactFlowInstance,
|
|
111
|
+
replacedEdge,
|
|
112
|
+
allowedContainerId,
|
|
113
|
+
isContainerNode: (node)=>isContainerNodeManifest(getManifestForNode(node)),
|
|
114
|
+
getContainerSafeArea: getContainerSafeArea,
|
|
115
|
+
getContainerContinuationTarget: ({ containerNode })=>{
|
|
116
|
+
const previewHandles = resolveContainerPreviewConnectionHandles(getManifestForNode(containerNode), {
|
|
117
|
+
...containerNode.data,
|
|
118
|
+
nodeId: containerNode.id
|
|
119
|
+
});
|
|
120
|
+
return previewHandles?.targetHandleId ? {
|
|
121
|
+
nodeId: containerNode.id,
|
|
122
|
+
handleId: previewHandles.targetHandleId
|
|
123
|
+
} : null;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function getInnerHandleContainerId({ source, reactFlowInstance, getManifestForNode }) {
|
|
128
|
+
const sourceNode = reactFlowInstance.getNode(source.nodeId);
|
|
129
|
+
if (!sourceNode || !isContainerNodeManifest(getManifestForNode(sourceNode))) return;
|
|
130
|
+
const clickedHandle = resolveClickedHandle({
|
|
131
|
+
source,
|
|
132
|
+
reactFlowInstance,
|
|
133
|
+
getManifestForNode
|
|
134
|
+
});
|
|
135
|
+
return clickedHandle?.boundary === 'inner' ? sourceNode.id : void 0;
|
|
136
|
+
}
|
|
137
|
+
export { getContainerRelativeBodyCenter, getInnerHandleContainerId, resolveContainerAddNodePreview, resolveContainerHandleGroups, resolveContainerPreviewConnectionHandles };
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
useContainerResizeMinimums: ()=>useContainerResizeMinimums,
|
|
28
|
+
useHasChildNodes: ()=>useHasChildNodes,
|
|
29
|
+
useContainerNodeInternalsRefresh: ()=>useContainerNodeInternalsRefresh,
|
|
30
|
+
resolveContainerHandleConfigurations: ()=>resolveContainerHandleConfigurations,
|
|
31
|
+
resolveInteractionState: ()=>resolveInteractionState
|
|
32
|
+
});
|
|
33
|
+
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
34
|
+
const external_react_namespaceObject = require("react");
|
|
35
|
+
const shallow_namespaceObject = require("zustand/shallow");
|
|
36
|
+
const container_cjs_namespaceObject = require("../../utils/container.cjs");
|
|
37
|
+
const external_ContainerNode_constants_cjs_namespaceObject = require("./ContainerNode.constants.cjs");
|
|
38
|
+
function resolveInteractionState(dragging, selected, isHovered) {
|
|
39
|
+
if (dragging) return 'drag';
|
|
40
|
+
if (selected) return 'selected';
|
|
41
|
+
if (isHovered) return 'hover';
|
|
42
|
+
return 'default';
|
|
43
|
+
}
|
|
44
|
+
function useHasChildNodes(id, enabled) {
|
|
45
|
+
return (0, react_cjs_namespaceObject.useStore)((0, external_react_namespaceObject.useCallback)((state)=>!enabled || (state.parentLookup.get(id)?.size ?? 0) > 0, [
|
|
46
|
+
id,
|
|
47
|
+
enabled
|
|
48
|
+
]));
|
|
49
|
+
}
|
|
50
|
+
function useContainerResizeMinimums(id, width, height, enabled) {
|
|
51
|
+
return (0, react_cjs_namespaceObject.useStore)((0, external_react_namespaceObject.useCallback)((state)=>{
|
|
52
|
+
if (!enabled) return external_ContainerNode_constants_cjs_namespaceObject.DEFAULT_RESIZE_MINIMUMS;
|
|
53
|
+
return (0, container_cjs_namespaceObject.getContainerResizeMinimums)({
|
|
54
|
+
id,
|
|
55
|
+
width,
|
|
56
|
+
height
|
|
57
|
+
}, Array.from(state.parentLookup.get(id)?.values() ?? []));
|
|
58
|
+
}, [
|
|
59
|
+
enabled,
|
|
60
|
+
height,
|
|
61
|
+
id,
|
|
62
|
+
width
|
|
63
|
+
]), shallow_namespaceObject.shallow);
|
|
64
|
+
}
|
|
65
|
+
function useContainerNodeInternalsRefresh(id, handleGroups, width, height) {
|
|
66
|
+
const updateNodeInternals = (0, react_cjs_namespaceObject.useUpdateNodeInternals)();
|
|
67
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
68
|
+
const frameId = requestAnimationFrame(()=>{
|
|
69
|
+
updateNodeInternals(id);
|
|
70
|
+
});
|
|
71
|
+
return ()=>{
|
|
72
|
+
cancelAnimationFrame(frameId);
|
|
73
|
+
};
|
|
74
|
+
}, [
|
|
75
|
+
id,
|
|
76
|
+
handleGroups,
|
|
77
|
+
updateNodeInternals,
|
|
78
|
+
width,
|
|
79
|
+
height
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
function resolveContainerHandleConfigurations(manifestHandleConfigurations, data) {
|
|
83
|
+
if (Array.isArray(data.handleConfigurations)) return data.handleConfigurations;
|
|
84
|
+
return manifestHandleConfigurations ?? [];
|
|
85
|
+
}
|
|
86
|
+
exports.resolveContainerHandleConfigurations = __webpack_exports__.resolveContainerHandleConfigurations;
|
|
87
|
+
exports.resolveInteractionState = __webpack_exports__.resolveInteractionState;
|
|
88
|
+
exports.useContainerNodeInternalsRefresh = __webpack_exports__.useContainerNodeInternalsRefresh;
|
|
89
|
+
exports.useContainerResizeMinimums = __webpack_exports__.useContainerResizeMinimums;
|
|
90
|
+
exports.useHasChildNodes = __webpack_exports__.useHasChildNodes;
|
|
91
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
92
|
+
"resolveContainerHandleConfigurations",
|
|
93
|
+
"resolveInteractionState",
|
|
94
|
+
"useContainerNodeInternalsRefresh",
|
|
95
|
+
"useContainerResizeMinimums",
|
|
96
|
+
"useHasChildNodes"
|
|
97
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
98
|
+
Object.defineProperty(exports, '__esModule', {
|
|
99
|
+
value: true
|
|
100
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HandleGroupManifest } from '../../schema/node-definition';
|
|
2
|
+
import { type ContainerResizeMinimums } from '../../utils/container';
|
|
3
|
+
import type { ContainerHandleGroup } from './ContainerNode.helpers';
|
|
4
|
+
export declare function resolveInteractionState(dragging: boolean, selected: boolean, isHovered: boolean): 'drag' | 'selected' | 'hover' | 'default';
|
|
5
|
+
export declare function useHasChildNodes(id: string, enabled: boolean): boolean;
|
|
6
|
+
export declare function useContainerResizeMinimums(id: string, width: number, height: number, enabled: boolean): ContainerResizeMinimums;
|
|
7
|
+
export declare function useContainerNodeInternalsRefresh(id: string, handleGroups: ContainerHandleGroup[], width: number, height: number): void;
|
|
8
|
+
export declare function resolveContainerHandleConfigurations(manifestHandleConfigurations: HandleGroupManifest[] | undefined, data: Record<string, unknown>): HandleGroupManifest[];
|
|
9
|
+
//# sourceMappingURL=ContainerNode.hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContainerNode.hooks.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ContainerNode/ContainerNode.hooks.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,KAAK,uBAAuB,EAA8B,MAAM,uBAAuB,CAAC;AAEjG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,OAAO,GACjB,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAK3C;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAOtE;AAED,wBAAgB,0BAA0B,CACxC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,GACf,uBAAuB,CAiBzB;AAED,wBAAgB,gCAAgC,CAC9C,EAAE,EAAE,MAAM,EACV,YAAY,EAAE,oBAAoB,EAAE,EACpC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,QAcf;AAGD,wBAAgB,oCAAoC,CAClD,4BAA4B,EAAE,mBAAmB,EAAE,GAAG,SAAS,EAC/D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,mBAAmB,EAAE,CAMvB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useStore, useUpdateNodeInternals } from "../../xyflow/react.js";
|
|
2
|
+
import { useCallback, useEffect } from "react";
|
|
3
|
+
import { shallow } from "zustand/shallow";
|
|
4
|
+
import { getContainerResizeMinimums } from "../../utils/container.js";
|
|
5
|
+
import { DEFAULT_RESIZE_MINIMUMS } from "./ContainerNode.constants.js";
|
|
6
|
+
function resolveInteractionState(dragging, selected, isHovered) {
|
|
7
|
+
if (dragging) return 'drag';
|
|
8
|
+
if (selected) return 'selected';
|
|
9
|
+
if (isHovered) return 'hover';
|
|
10
|
+
return 'default';
|
|
11
|
+
}
|
|
12
|
+
function useHasChildNodes(id, enabled) {
|
|
13
|
+
return useStore(useCallback((state)=>!enabled || (state.parentLookup.get(id)?.size ?? 0) > 0, [
|
|
14
|
+
id,
|
|
15
|
+
enabled
|
|
16
|
+
]));
|
|
17
|
+
}
|
|
18
|
+
function useContainerResizeMinimums(id, width, height, enabled) {
|
|
19
|
+
return useStore(useCallback((state)=>{
|
|
20
|
+
if (!enabled) return DEFAULT_RESIZE_MINIMUMS;
|
|
21
|
+
return getContainerResizeMinimums({
|
|
22
|
+
id,
|
|
23
|
+
width,
|
|
24
|
+
height
|
|
25
|
+
}, Array.from(state.parentLookup.get(id)?.values() ?? []));
|
|
26
|
+
}, [
|
|
27
|
+
enabled,
|
|
28
|
+
height,
|
|
29
|
+
id,
|
|
30
|
+
width
|
|
31
|
+
]), shallow);
|
|
32
|
+
}
|
|
33
|
+
function useContainerNodeInternalsRefresh(id, handleGroups, width, height) {
|
|
34
|
+
const updateNodeInternals = useUpdateNodeInternals();
|
|
35
|
+
useEffect(()=>{
|
|
36
|
+
const frameId = requestAnimationFrame(()=>{
|
|
37
|
+
updateNodeInternals(id);
|
|
38
|
+
});
|
|
39
|
+
return ()=>{
|
|
40
|
+
cancelAnimationFrame(frameId);
|
|
41
|
+
};
|
|
42
|
+
}, [
|
|
43
|
+
id,
|
|
44
|
+
handleGroups,
|
|
45
|
+
updateNodeInternals,
|
|
46
|
+
width,
|
|
47
|
+
height
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
function resolveContainerHandleConfigurations(manifestHandleConfigurations, data) {
|
|
51
|
+
if (Array.isArray(data.handleConfigurations)) return data.handleConfigurations;
|
|
52
|
+
return manifestHandleConfigurations ?? [];
|
|
53
|
+
}
|
|
54
|
+
export { resolveContainerHandleConfigurations, resolveInteractionState, useContainerNodeInternalsRefresh, useContainerResizeMinimums, useHasChildNodes };
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useReactFlow, useStore } from "../../xyflow/react.js";
|
|
3
|
+
import { cn } from "@uipath/apollo-wind";
|
|
4
|
+
import { memo, useCallback, useMemo, useState } from "react";
|
|
5
|
+
import { useSafeLingui } from "../../../i18n/index.js";
|
|
6
|
+
import { useOptionalNodeTypeRegistry } from "../../core/index.js";
|
|
7
|
+
import { useElementValidationStatus, useNodeExecutionState } from "../../hooks/index.js";
|
|
8
|
+
import { resolveAdornments } from "../../utils/adornment-resolver.js";
|
|
9
|
+
import { DEFAULT_CONTAINER_HEIGHT, DEFAULT_CONTAINER_MIN_HEIGHT, DEFAULT_CONTAINER_MIN_WIDTH, DEFAULT_CONTAINER_WIDTH } from "../../utils/container.js";
|
|
10
|
+
import { resolveDisplay, resolveHandles } from "../../utils/manifest-resolver.js";
|
|
11
|
+
import { selectIsConnecting, snapToGrid } from "../../utils/NodeUtils.js";
|
|
12
|
+
import { areNodePropsEqualIgnoringPosition } from "../../utils/nodePropsEqual.js";
|
|
13
|
+
import { resolveToolbar } from "../../utils/toolbar-resolver.js";
|
|
14
|
+
import { useBaseCanvasMode } from "../BaseCanvas/BaseCanvasModeProvider.js";
|
|
15
|
+
import { useConnectedHandles } from "../BaseCanvas/ConnectedHandlesContext.js";
|
|
16
|
+
import { useIsNodeReadOnly } from "../BaseCanvas/ReadOnlyNodesContext.js";
|
|
17
|
+
import { useSelectionState } from "../BaseCanvas/SelectionStateContext.js";
|
|
18
|
+
import { BaseBadgeSlot } from "../BaseNode/BaseNodeBadgeSlot.js";
|
|
19
|
+
import { getStatusBorder } from "../BaseNode/BaseNodeContainer.js";
|
|
20
|
+
import { MissingManifestNode } from "../BaseNode/BaseNodeMissingManifest.js";
|
|
21
|
+
import { NodeToolbar } from "../Toolbar/index.js";
|
|
22
|
+
import { lockToolbarConfig } from "../Toolbar/NodeToolbar/NodeToolbar.utils.js";
|
|
23
|
+
import { resolveContainerNodeConfig } from "./ContainerNode.config.js";
|
|
24
|
+
import { ACCENT_BORDER_CLASSES, ACCENT_ICON_CLASSES, ADORNMENT_SLOT_POSITIONS, ADORNMENT_SLOT_SHAPES, DEFAULT_CONTAINER_ICON, EMPTY_DATA, LOOP_KIND, RADIUS_CLASSES } from "./ContainerNode.constants.js";
|
|
25
|
+
import { resolveContainerHandleGroups } from "./ContainerNode.helpers.js";
|
|
26
|
+
import { resolveContainerHandleConfigurations, resolveInteractionState, useContainerNodeInternalsRefresh, useContainerResizeMinimums, useHasChildNodes } from "./ContainerNode.hooks.js";
|
|
27
|
+
import { Header } from "./ContainerNodeHeader.js";
|
|
28
|
+
import { BodyFrame, EmptyState, EmptyStateRender, HandleGroups, ResizeControls, ResizeCornerIndicators } from "./ContainerNodeParts.js";
|
|
29
|
+
function ContainerNodeComponent(props) {
|
|
30
|
+
const { id, type, data, selected = false, dragging = false, width = 0, height = 0, onAddFirstChild, onResize, onResizeStart, onResizeEnd, toolbarConfig: toolbarConfigProp, adornments: adornmentsProp, executionStatusOverride, suggestionType: suggestionTypeProp, renderHeader, renderEmptyState, className, defaults } = props;
|
|
31
|
+
const { updateNodeData } = useReactFlow();
|
|
32
|
+
const nodeTypeRegistry = useOptionalNodeTypeRegistry();
|
|
33
|
+
const { _ } = useSafeLingui();
|
|
34
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
35
|
+
const [isResizing, setIsResizing] = useState(false);
|
|
36
|
+
const resolvedData = data ?? EMPTY_DATA;
|
|
37
|
+
const isLoading = !!resolvedData.loading;
|
|
38
|
+
const suggestionType = suggestionTypeProp ?? resolvedData.suggestionType;
|
|
39
|
+
const manifest = useMemo(()=>nodeTypeRegistry?.getManifest(type), [
|
|
40
|
+
nodeTypeRegistry,
|
|
41
|
+
type
|
|
42
|
+
]);
|
|
43
|
+
const { mode } = useBaseCanvasMode();
|
|
44
|
+
const isDesignMode = 'design' === mode;
|
|
45
|
+
const isNodeReadOnly = useIsNodeReadOnly(id);
|
|
46
|
+
const canEditNode = isDesignMode && !isNodeReadOnly;
|
|
47
|
+
const connectedHandleIds = useConnectedHandles(id);
|
|
48
|
+
const { multipleNodesSelected } = useSelectionState();
|
|
49
|
+
const isConnecting = useStore(selectIsConnecting);
|
|
50
|
+
const hasEmptyState = !!onAddFirstChild || !!renderEmptyState;
|
|
51
|
+
const hasChildNodes = useHasChildNodes(id, isDesignMode && hasEmptyState);
|
|
52
|
+
const executionState = useNodeExecutionState(id);
|
|
53
|
+
const validationState = useElementValidationStatus(id);
|
|
54
|
+
const statusContext = useMemo(()=>({
|
|
55
|
+
nodeId: id,
|
|
56
|
+
executionState: executionStatusOverride ?? executionState,
|
|
57
|
+
validationState,
|
|
58
|
+
isConnecting,
|
|
59
|
+
isSelected: selected,
|
|
60
|
+
isDragging: dragging,
|
|
61
|
+
mode
|
|
62
|
+
}), [
|
|
63
|
+
dragging,
|
|
64
|
+
executionStatusOverride,
|
|
65
|
+
executionState,
|
|
66
|
+
id,
|
|
67
|
+
isConnecting,
|
|
68
|
+
mode,
|
|
69
|
+
selected,
|
|
70
|
+
validationState
|
|
71
|
+
]);
|
|
72
|
+
const executionStatus = executionStatusOverride ?? ('string' == typeof executionState ? executionState : executionState?.status);
|
|
73
|
+
const display = useMemo(()=>resolveDisplay(manifest?.display, {
|
|
74
|
+
...resolvedData,
|
|
75
|
+
nodeId: id
|
|
76
|
+
}), [
|
|
77
|
+
manifest?.display,
|
|
78
|
+
id,
|
|
79
|
+
resolvedData
|
|
80
|
+
]);
|
|
81
|
+
const instanceDisplay = resolvedData.display;
|
|
82
|
+
const instanceSubLabel = 'string' == typeof instanceDisplay?.subLabel ? instanceDisplay.subLabel : void 0;
|
|
83
|
+
const config = resolveContainerNodeConfig(props, manifest?.display?.container, instanceSubLabel);
|
|
84
|
+
const isLoop = config.kind === LOOP_KIND;
|
|
85
|
+
const displayTitle = display.label ?? defaults?.title ?? _({
|
|
86
|
+
id: 'container-node.title',
|
|
87
|
+
message: 'Container'
|
|
88
|
+
});
|
|
89
|
+
const displayIcon = display.icon || defaults?.icon || DEFAULT_CONTAINER_ICON;
|
|
90
|
+
const emptyStateLabel = config.emptyStateLabel ?? _({
|
|
91
|
+
id: 'container-node.add-node',
|
|
92
|
+
message: 'Add node to container'
|
|
93
|
+
});
|
|
94
|
+
const labelEditing = useMemo(()=>({
|
|
95
|
+
titlePlaceholder: _({
|
|
96
|
+
id: 'container-node.edit.title-placeholder',
|
|
97
|
+
message: 'Name'
|
|
98
|
+
}),
|
|
99
|
+
subtitlePlaceholder: _({
|
|
100
|
+
id: 'container-node.edit.subtitle-placeholder',
|
|
101
|
+
message: "Description"
|
|
102
|
+
}),
|
|
103
|
+
titleAriaLabel: _({
|
|
104
|
+
id: 'container-node.edit.title',
|
|
105
|
+
message: 'Edit container name'
|
|
106
|
+
}),
|
|
107
|
+
subtitleAriaLabel: _({
|
|
108
|
+
id: 'container-node.edit.subtitle',
|
|
109
|
+
message: "Edit container description"
|
|
110
|
+
})
|
|
111
|
+
}), [
|
|
112
|
+
_
|
|
113
|
+
]);
|
|
114
|
+
const handleLabelChange = useCallback((values)=>{
|
|
115
|
+
const nextDisplay = {
|
|
116
|
+
...resolvedData.display ?? {}
|
|
117
|
+
};
|
|
118
|
+
for (const key of Object.keys(values))if (values[key]) nextDisplay[key] = values[key];
|
|
119
|
+
else delete nextDisplay[key];
|
|
120
|
+
updateNodeData(id, {
|
|
121
|
+
display: nextDisplay
|
|
122
|
+
});
|
|
123
|
+
}, [
|
|
124
|
+
id,
|
|
125
|
+
resolvedData.display,
|
|
126
|
+
updateNodeData
|
|
127
|
+
]);
|
|
128
|
+
const radiusClasses = RADIUS_CLASSES[config.radius];
|
|
129
|
+
const hasAccent = 'default' !== config.accent;
|
|
130
|
+
const isDropTarget = true === resolvedData.isDropTarget;
|
|
131
|
+
const containerWidth = width || DEFAULT_CONTAINER_WIDTH;
|
|
132
|
+
const containerHeight = height || DEFAULT_CONTAINER_HEIGHT;
|
|
133
|
+
const resizeControlsMounted = isDesignMode && !dragging;
|
|
134
|
+
const resizeControlsVisible = resizeControlsMounted && (selected || isResizing);
|
|
135
|
+
const resizeMinimumsEnabled = resizeControlsMounted && (selected || isHovered || isResizing);
|
|
136
|
+
const resizeMinimums = useContainerResizeMinimums(id, containerWidth, containerHeight, resizeMinimumsEnabled);
|
|
137
|
+
const nodeSizeStyle = {
|
|
138
|
+
width: containerWidth,
|
|
139
|
+
height: containerHeight,
|
|
140
|
+
minWidth: DEFAULT_CONTAINER_MIN_WIDTH,
|
|
141
|
+
minHeight: DEFAULT_CONTAINER_MIN_HEIGHT
|
|
142
|
+
};
|
|
143
|
+
const toolbarConfig = useMemo(()=>{
|
|
144
|
+
if (void 0 !== toolbarConfigProp) return null === toolbarConfigProp ? void 0 : toolbarConfigProp;
|
|
145
|
+
return manifest ? resolveToolbar(manifest, statusContext, data) : void 0;
|
|
146
|
+
}, [
|
|
147
|
+
data,
|
|
148
|
+
manifest,
|
|
149
|
+
statusContext,
|
|
150
|
+
toolbarConfigProp
|
|
151
|
+
]);
|
|
152
|
+
const effectiveToolbarConfig = useMemo(()=>toolbarConfig && isNodeReadOnly ? lockToolbarConfig(toolbarConfig) : toolbarConfig, [
|
|
153
|
+
toolbarConfig,
|
|
154
|
+
isNodeReadOnly
|
|
155
|
+
]);
|
|
156
|
+
const adornments = useMemo(()=>({
|
|
157
|
+
...resolveAdornments(statusContext, {
|
|
158
|
+
hideExecutionStatusAdornment: true
|
|
159
|
+
}),
|
|
160
|
+
...adornmentsProp ?? {}
|
|
161
|
+
}), [
|
|
162
|
+
adornmentsProp,
|
|
163
|
+
statusContext
|
|
164
|
+
]);
|
|
165
|
+
const hasTopLeftAdornment = !!adornments.topLeft;
|
|
166
|
+
const hasTopRightAdornment = !!adornments.topRight;
|
|
167
|
+
const resolvedHandleGroups = useMemo(()=>{
|
|
168
|
+
const handleConfigurations = resolveContainerHandleConfigurations(manifest?.handleConfiguration, resolvedData);
|
|
169
|
+
return resolveHandles(handleConfigurations, {
|
|
170
|
+
...resolvedData,
|
|
171
|
+
nodeId: id
|
|
172
|
+
});
|
|
173
|
+
}, [
|
|
174
|
+
manifest?.handleConfiguration,
|
|
175
|
+
id,
|
|
176
|
+
resolvedData
|
|
177
|
+
]);
|
|
178
|
+
const containerHandleGroups = useMemo(()=>resolveContainerHandleGroups(resolvedHandleGroups), [
|
|
179
|
+
resolvedHandleGroups
|
|
180
|
+
]);
|
|
181
|
+
useContainerNodeInternalsRefresh(id, containerHandleGroups, containerWidth, containerHeight);
|
|
182
|
+
const handleResize = useCallback((_event, params)=>{
|
|
183
|
+
onResize?.({
|
|
184
|
+
width: snapToGrid(params.width),
|
|
185
|
+
height: snapToGrid(params.height)
|
|
186
|
+
});
|
|
187
|
+
}, [
|
|
188
|
+
onResize
|
|
189
|
+
]);
|
|
190
|
+
const handleResizeStart = useCallback(()=>{
|
|
191
|
+
setIsResizing(true);
|
|
192
|
+
onResizeStart?.();
|
|
193
|
+
}, [
|
|
194
|
+
onResizeStart
|
|
195
|
+
]);
|
|
196
|
+
const handleResizeEnd = useCallback(()=>{
|
|
197
|
+
setIsResizing(false);
|
|
198
|
+
if (onResizeEnd) queueMicrotask(onResizeEnd);
|
|
199
|
+
}, [
|
|
200
|
+
onResizeEnd
|
|
201
|
+
]);
|
|
202
|
+
const handleEmptyClick = useCallback(()=>{
|
|
203
|
+
onAddFirstChild?.();
|
|
204
|
+
}, [
|
|
205
|
+
onAddFirstChild
|
|
206
|
+
]);
|
|
207
|
+
const handleMouseEnter = useCallback(()=>setIsHovered(true), []);
|
|
208
|
+
const handleMouseLeave = useCallback(()=>setIsHovered(false), []);
|
|
209
|
+
const handleHandleAction = useCallback((_event)=>{
|
|
210
|
+
setIsHovered(false);
|
|
211
|
+
}, []);
|
|
212
|
+
const shouldShowHandles = (isConnecting || selected || isHovered) && !dragging;
|
|
213
|
+
const showHandleAddButtons = canEditNode && !multipleNodesSelected && !isConnecting && !dragging;
|
|
214
|
+
const showEmptyState = canEditNode && !hasChildNodes && hasEmptyState;
|
|
215
|
+
const interactionState = resolveInteractionState(dragging, selected, isHovered);
|
|
216
|
+
const activeStatus = suggestionType ?? validationState?.validationStatus ?? executionStatus;
|
|
217
|
+
const statusBorder = getStatusBorder(activeStatus);
|
|
218
|
+
const hasStatusBorder = statusBorder.length > 0;
|
|
219
|
+
if (!manifest) return /*#__PURE__*/ jsx("div", {
|
|
220
|
+
className: "relative",
|
|
221
|
+
style: nodeSizeStyle,
|
|
222
|
+
onMouseEnter: handleMouseEnter,
|
|
223
|
+
onMouseLeave: handleMouseLeave,
|
|
224
|
+
children: /*#__PURE__*/ jsx(MissingManifestNode, {
|
|
225
|
+
type: type,
|
|
226
|
+
isSelected: selected,
|
|
227
|
+
isHovered: isHovered,
|
|
228
|
+
interactionState: interactionState
|
|
229
|
+
})
|
|
230
|
+
});
|
|
231
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
232
|
+
role: "group",
|
|
233
|
+
"aria-label": displayTitle,
|
|
234
|
+
"data-container": true,
|
|
235
|
+
"data-container-kind": config.kind,
|
|
236
|
+
"data-loop-container": isLoop ? '' : void 0,
|
|
237
|
+
"data-selected": selected ? 'true' : 'false',
|
|
238
|
+
"data-execution-status": executionStatus,
|
|
239
|
+
"data-interaction-state": interactionState,
|
|
240
|
+
"data-suggestion-type": suggestionType,
|
|
241
|
+
"data-validation-status": validationState?.validationStatus,
|
|
242
|
+
"aria-busy": resolvedData.loading || void 0,
|
|
243
|
+
className: cn('group/loop-shell relative box-border flex h-full w-full flex-col overflow-visible border bg-transparent', radiusClasses.root, 'transition-[border-color,box-shadow,opacity] shadow-(--canvas-node-shadow-rest)', 'dashed' === config.borderStyle && 'border-dashed', ACCENT_BORDER_CLASSES[config.accent], statusBorder, isHovered && 'shadow-(--canvas-node-shadow-hover)', isHovered && !hasStatusBorder && !hasAccent && 'border-border-hover', selected && 'outline-2 outline-foreground-accent-muted', isDropTarget && 'bg-surface-hover outline-2 outline-brand', 'drag' === interactionState && 'cursor-grabbing shadow-(--canvas-node-shadow-lifted)', className),
|
|
244
|
+
style: {
|
|
245
|
+
...nodeSizeStyle,
|
|
246
|
+
...display.background ? {
|
|
247
|
+
background: display.background
|
|
248
|
+
} : {}
|
|
249
|
+
},
|
|
250
|
+
onMouseEnter: handleMouseEnter,
|
|
251
|
+
onMouseLeave: handleMouseLeave,
|
|
252
|
+
children: [
|
|
253
|
+
/*#__PURE__*/ jsxs("div", {
|
|
254
|
+
className: cn('absolute inset-0 isolate flex flex-col overflow-hidden', radiusClasses.clip),
|
|
255
|
+
children: [
|
|
256
|
+
/*#__PURE__*/ jsx(Header, {
|
|
257
|
+
testId: isLoop ? 'loop-node-header' : 'container-node-header',
|
|
258
|
+
title: displayTitle,
|
|
259
|
+
icon: displayIcon,
|
|
260
|
+
iconClassName: ACCENT_ICON_CLASSES[config.accent],
|
|
261
|
+
subtitle: config.subtitle,
|
|
262
|
+
badges: config.headerBadges,
|
|
263
|
+
end: config.headerEnd,
|
|
264
|
+
renderHeader: renderHeader,
|
|
265
|
+
loading: isLoading,
|
|
266
|
+
editable: config.labelEditable && canEditNode && !isLoading,
|
|
267
|
+
subtitleEditable: void 0 === props.subtitle,
|
|
268
|
+
editSubLabel: 'string' == typeof config.subtitle ? config.subtitle : '',
|
|
269
|
+
editingStrings: labelEditing,
|
|
270
|
+
selected: selected,
|
|
271
|
+
dragging: dragging,
|
|
272
|
+
discardDraftOnReadonly: isNodeReadOnly,
|
|
273
|
+
onLabelChange: handleLabelChange,
|
|
274
|
+
radiusClassName: radiusClasses.header,
|
|
275
|
+
hasTopLeftAdornment: hasTopLeftAdornment,
|
|
276
|
+
hasTopRightAdornment: hasTopRightAdornment
|
|
277
|
+
}),
|
|
278
|
+
/*#__PURE__*/ jsx(BodyFrame, {
|
|
279
|
+
testId: isLoop ? 'loop-body-frame' : 'container-body-frame',
|
|
280
|
+
frame: config.bodyFrame,
|
|
281
|
+
radiusClassName: radiusClasses.body,
|
|
282
|
+
isEmpty: showEmptyState,
|
|
283
|
+
isLoading: isLoading
|
|
284
|
+
})
|
|
285
|
+
]
|
|
286
|
+
}),
|
|
287
|
+
ADORNMENT_SLOT_POSITIONS.map((slot)=>adornments?.[slot] ? /*#__PURE__*/ jsx(BaseBadgeSlot, {
|
|
288
|
+
position: ADORNMENT_SLOT_SHAPES[slot],
|
|
289
|
+
shape: "rectangle",
|
|
290
|
+
children: adornments[slot]
|
|
291
|
+
}, slot) : null),
|
|
292
|
+
/*#__PURE__*/ jsx(ResizeCornerIndicators, {
|
|
293
|
+
testIdPrefix: isLoop ? 'loop' : 'container',
|
|
294
|
+
visible: resizeControlsVisible
|
|
295
|
+
}),
|
|
296
|
+
resizeControlsMounted ? /*#__PURE__*/ jsx(ResizeControls, {
|
|
297
|
+
minimums: resizeMinimums,
|
|
298
|
+
onResize: handleResize,
|
|
299
|
+
onResizeStart: handleResizeStart,
|
|
300
|
+
onResizeEnd: handleResizeEnd
|
|
301
|
+
}) : null,
|
|
302
|
+
showEmptyState ? /*#__PURE__*/ jsx("div", {
|
|
303
|
+
className: cn('pointer-events-none absolute left-1/2 top-1/2', '-translate-x-1/2 -translate-y-1/2'),
|
|
304
|
+
children: renderEmptyState ? /*#__PURE__*/ jsx("div", {
|
|
305
|
+
className: "pointer-events-auto",
|
|
306
|
+
children: /*#__PURE__*/ jsx(EmptyStateRender, {
|
|
307
|
+
render: renderEmptyState,
|
|
308
|
+
onAddFirstChild: onAddFirstChild ? handleEmptyClick : void 0,
|
|
309
|
+
isLoading: isLoading
|
|
310
|
+
})
|
|
311
|
+
}) : /*#__PURE__*/ jsx(EmptyState, {
|
|
312
|
+
label: emptyStateLabel,
|
|
313
|
+
onAddFirstChild: handleEmptyClick
|
|
314
|
+
})
|
|
315
|
+
}) : null,
|
|
316
|
+
effectiveToolbarConfig && /*#__PURE__*/ jsx(NodeToolbar, {
|
|
317
|
+
nodeId: id,
|
|
318
|
+
config: effectiveToolbarConfig,
|
|
319
|
+
expanded: selected || isHovered,
|
|
320
|
+
hidden: dragging || multipleNodesSelected,
|
|
321
|
+
portalToNodeOverlay: true
|
|
322
|
+
}),
|
|
323
|
+
/*#__PURE__*/ jsx(HandleGroups, {
|
|
324
|
+
nodeId: id,
|
|
325
|
+
groups: containerHandleGroups,
|
|
326
|
+
selected: selected,
|
|
327
|
+
hovered: isHovered,
|
|
328
|
+
shouldShowHandles: shouldShowHandles,
|
|
329
|
+
showAddButton: showHandleAddButtons,
|
|
330
|
+
isLocked: !canEditNode,
|
|
331
|
+
showNotches: shouldShowHandles,
|
|
332
|
+
nodeWidth: containerWidth,
|
|
333
|
+
nodeHeight: containerHeight,
|
|
334
|
+
connectedHandleIds: connectedHandleIds,
|
|
335
|
+
onHandleAction: handleHandleAction
|
|
336
|
+
})
|
|
337
|
+
]
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
const ContainerNode = /*#__PURE__*/ memo(ContainerNodeComponent, areNodePropsEqualIgnoringPosition);
|
|
341
|
+
export { ContainerNode };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.r = (exports1)=>{
|
|
5
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
+
value: 'Module'
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
})();
|
|
13
|
+
var __webpack_exports__ = {};
|
|
14
|
+
__webpack_require__.r(__webpack_exports__);
|
|
15
|
+
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
+
Object.defineProperty(exports, '__esModule', {
|
|
17
|
+
value: true
|
|
18
|
+
});
|