@uipath/apollo-react 4.23.0 → 4.23.2-pr663.59ff0c2
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/LoopNode/LoopNode.cjs +50 -7
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +3 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +3 -1
- package/dist/canvas/components/LoopNode/LoopNode.js +51 -8
- package/dist/canvas/styles/reactflow-reset.css +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/container.cjs +52 -1
- package/dist/canvas/utils/container.d.ts +12 -0
- package/dist/canvas/utils/container.d.ts.map +1 -1
- package/dist/canvas/utils/container.js +50 -2
- package/package.json +3 -3
|
@@ -30,6 +30,7 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
|
30
30
|
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
31
31
|
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
32
32
|
const external_react_namespaceObject = require("react");
|
|
33
|
+
const shallow_namespaceObject = require("zustand/shallow");
|
|
33
34
|
const index_cjs_namespaceObject = require("../../core/index.cjs");
|
|
34
35
|
const external_hooks_index_cjs_namespaceObject = require("../../hooks/index.cjs");
|
|
35
36
|
const adornment_resolver_cjs_namespaceObject = require("../../utils/adornment-resolver.cjs");
|
|
@@ -53,21 +54,29 @@ const EMPTY_DATA = {};
|
|
|
53
54
|
const RESIZE_CONTROLS = [
|
|
54
55
|
{
|
|
55
56
|
position: 'top-left',
|
|
57
|
+
widthSide: 'left',
|
|
58
|
+
heightSide: 'top',
|
|
56
59
|
cursor: 'nwse-resize',
|
|
57
60
|
indicatorClassName: 'top-[-4px] left-[-4px]'
|
|
58
61
|
},
|
|
59
62
|
{
|
|
60
63
|
position: 'top-right',
|
|
64
|
+
widthSide: 'right',
|
|
65
|
+
heightSide: 'top',
|
|
61
66
|
cursor: 'nesw-resize',
|
|
62
67
|
indicatorClassName: 'top-[-4px] right-[-4px]'
|
|
63
68
|
},
|
|
64
69
|
{
|
|
65
70
|
position: 'bottom-left',
|
|
71
|
+
widthSide: 'left',
|
|
72
|
+
heightSide: 'bottom',
|
|
66
73
|
cursor: 'nesw-resize',
|
|
67
74
|
indicatorClassName: 'bottom-[-4px] left-[-4px]'
|
|
68
75
|
},
|
|
69
76
|
{
|
|
70
77
|
position: 'bottom-right',
|
|
78
|
+
widthSide: 'right',
|
|
79
|
+
heightSide: 'bottom',
|
|
71
80
|
cursor: 'nwse-resize',
|
|
72
81
|
indicatorClassName: 'bottom-[-4px] right-[-4px]'
|
|
73
82
|
}
|
|
@@ -77,6 +86,12 @@ const RESIZE_CONTROL_STYLE = {
|
|
|
77
86
|
border: 'none',
|
|
78
87
|
zIndex: 100
|
|
79
88
|
};
|
|
89
|
+
const DEFAULT_RESIZE_MINIMUMS = {
|
|
90
|
+
left: container_cjs_namespaceObject.DEFAULT_CONTAINER_MIN_WIDTH,
|
|
91
|
+
right: container_cjs_namespaceObject.DEFAULT_CONTAINER_MIN_WIDTH,
|
|
92
|
+
top: container_cjs_namespaceObject.DEFAULT_CONTAINER_MIN_HEIGHT,
|
|
93
|
+
bottom: container_cjs_namespaceObject.DEFAULT_CONTAINER_MIN_HEIGHT
|
|
94
|
+
};
|
|
80
95
|
const ADORNMENT_SLOT_POSITIONS = [
|
|
81
96
|
'topLeft',
|
|
82
97
|
'topRight',
|
|
@@ -101,6 +116,21 @@ function useHasChildNodes(id, enabled) {
|
|
|
101
116
|
enabled
|
|
102
117
|
]));
|
|
103
118
|
}
|
|
119
|
+
function useContainerResizeMinimums(id, width, height, enabled) {
|
|
120
|
+
return (0, react_cjs_namespaceObject.useStore)((0, external_react_namespaceObject.useCallback)((state)=>{
|
|
121
|
+
if (!enabled) return DEFAULT_RESIZE_MINIMUMS;
|
|
122
|
+
return (0, container_cjs_namespaceObject.getContainerResizeMinimums)({
|
|
123
|
+
id,
|
|
124
|
+
width,
|
|
125
|
+
height
|
|
126
|
+
}, Array.from(state.parentLookup.get(id)?.values() ?? []));
|
|
127
|
+
}, [
|
|
128
|
+
enabled,
|
|
129
|
+
height,
|
|
130
|
+
id,
|
|
131
|
+
width
|
|
132
|
+
]), shallow_namespaceObject.shallow);
|
|
133
|
+
}
|
|
104
134
|
function useContainerNodeInternalsRefresh(id, handleGroups, width, height) {
|
|
105
135
|
const updateNodeInternals = (0, react_cjs_namespaceObject.useUpdateNodeInternals)();
|
|
106
136
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
@@ -118,6 +148,10 @@ function useContainerNodeInternalsRefresh(id, handleGroups, width, height) {
|
|
|
118
148
|
height
|
|
119
149
|
]);
|
|
120
150
|
}
|
|
151
|
+
function resolveLoopHandleConfigurations(manifestHandleConfigurations, data) {
|
|
152
|
+
if (Array.isArray(data.handleConfigurations)) return data.handleConfigurations;
|
|
153
|
+
return manifestHandleConfigurations ?? [];
|
|
154
|
+
}
|
|
121
155
|
function LoopNodeComponent(props) {
|
|
122
156
|
const { id, type, data, selected = false, dragging = false, width = 0, height = 0, onAddFirstChild, onResize, toolbarConfig: toolbarConfigProp, adornments: adornmentsProp, executionStatusOverride, suggestionType: suggestionTypeProp } = props;
|
|
123
157
|
const nodeTypeRegistry = (0, index_cjs_namespaceObject.useOptionalNodeTypeRegistry)();
|
|
@@ -170,6 +204,8 @@ function LoopNodeComponent(props) {
|
|
|
170
204
|
const isDropTarget = true === resolvedData.isDropTarget;
|
|
171
205
|
const containerWidth = width || container_cjs_namespaceObject.DEFAULT_CONTAINER_WIDTH;
|
|
172
206
|
const containerHeight = height || container_cjs_namespaceObject.DEFAULT_CONTAINER_HEIGHT;
|
|
207
|
+
const showResizeControls = selected && !dragging && isDesignMode;
|
|
208
|
+
const resizeMinimums = useContainerResizeMinimums(id, containerWidth, containerHeight, showResizeControls);
|
|
173
209
|
const nodeSizeStyle = {
|
|
174
210
|
width: containerWidth,
|
|
175
211
|
height: containerHeight,
|
|
@@ -192,8 +228,15 @@ function LoopNodeComponent(props) {
|
|
|
192
228
|
adornmentsProp,
|
|
193
229
|
statusContext
|
|
194
230
|
]);
|
|
195
|
-
const resolvedHandleGroups = (0, external_react_namespaceObject.useMemo)(()=>
|
|
196
|
-
manifest,
|
|
231
|
+
const resolvedHandleGroups = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
232
|
+
const handleConfigurations = resolveLoopHandleConfigurations(manifest?.handleConfiguration, resolvedData);
|
|
233
|
+
return (0, manifest_resolver_cjs_namespaceObject.resolveHandles)(handleConfigurations, {
|
|
234
|
+
...resolvedData,
|
|
235
|
+
nodeId: id
|
|
236
|
+
});
|
|
237
|
+
}, [
|
|
238
|
+
manifest?.handleConfiguration,
|
|
239
|
+
id,
|
|
197
240
|
resolvedData
|
|
198
241
|
]);
|
|
199
242
|
const containerHandleGroups = (0, external_react_namespaceObject.useMemo)(()=>(0, external_LoopNode_helpers_cjs_namespaceObject.resolveContainerHandleGroups)(resolvedHandleGroups), [
|
|
@@ -220,7 +263,6 @@ function LoopNodeComponent(props) {
|
|
|
220
263
|
}, []);
|
|
221
264
|
const shouldShowHandles = (isConnecting || selected || isHovered) && !dragging;
|
|
222
265
|
const showHandleAddButtons = isDesignMode && !multipleNodesSelected && !isConnecting && !dragging;
|
|
223
|
-
const showResizeControls = selected && !dragging && isDesignMode;
|
|
224
266
|
const showEmptyStateButton = isDesignMode && !hasChildNodes && !!onAddFirstChild;
|
|
225
267
|
const interactionState = resolveInteractionState(dragging, selected, isHovered);
|
|
226
268
|
if (!manifest) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
@@ -262,6 +304,7 @@ function LoopNodeComponent(props) {
|
|
|
262
304
|
visible: showResizeControls
|
|
263
305
|
}),
|
|
264
306
|
showResizeControls ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ResizeControls, {
|
|
307
|
+
minimums: resizeMinimums,
|
|
265
308
|
onResize: handleResize
|
|
266
309
|
}) : null,
|
|
267
310
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Header, {
|
|
@@ -371,13 +414,13 @@ function BodyFrame({ isEmpty, isLoading }) {
|
|
|
371
414
|
}) : null
|
|
372
415
|
});
|
|
373
416
|
}
|
|
374
|
-
function ResizeControls({ onResize }) {
|
|
417
|
+
function ResizeControls({ minimums = DEFAULT_RESIZE_MINIMUMS, onResize }) {
|
|
375
418
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
376
|
-
children: RESIZE_CONTROLS.map(({ position, cursor })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.NodeResizeControl, {
|
|
419
|
+
children: RESIZE_CONTROLS.map(({ position, widthSide, heightSide, cursor })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.NodeResizeControl, {
|
|
377
420
|
style: RESIZE_CONTROL_STYLE,
|
|
378
421
|
position: position,
|
|
379
|
-
minWidth:
|
|
380
|
-
minHeight:
|
|
422
|
+
minWidth: minimums[widthSide],
|
|
423
|
+
minHeight: minimums[heightSide],
|
|
381
424
|
onResize: onResize,
|
|
382
425
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
383
426
|
className: "absolute bottom-0 right-0 h-5 w-5 pointer-events-auto",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoopNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LoopNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.tsx"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmItD,iBAAS,iBAAiB,CAAC,KAAK,EAAE,aAAa,2CA2O9C;AAED,eAAO,MAAM,QAAQ,+DAA0B,CAAC"}
|
|
@@ -132,12 +132,14 @@ function resolveContainerAddNodePreview({ source, sourceHandleType, reactFlowIns
|
|
|
132
132
|
if (clickedHandle?.handleType !== 'output') return null;
|
|
133
133
|
const sourceNode = reactFlowInstance.getNode(source.nodeId);
|
|
134
134
|
const sourceIsContainer = void 0 !== sourceNode && (0, container_cjs_namespaceObject.isContainerNodeManifest)(getManifestForNode(sourceNode));
|
|
135
|
-
|
|
135
|
+
const allowedContainerId = sourceIsContainer && 'inner' !== clickedHandle.boundary ? sourceNode?.parentId : void 0;
|
|
136
|
+
if (sourceIsContainer && 'inner' !== clickedHandle.boundary && !allowedContainerId) return null;
|
|
136
137
|
return (0, container_cjs_namespaceObject.resolveContainerPreview)({
|
|
137
138
|
source,
|
|
138
139
|
sourceHandleType,
|
|
139
140
|
reactFlowInstance,
|
|
140
141
|
replacedEdge,
|
|
142
|
+
allowedContainerId,
|
|
141
143
|
isContainerNode: (node)=>(0, container_cjs_namespaceObject.isContainerNodeManifest)(getManifestForNode(node)),
|
|
142
144
|
getContainerSafeArea: container_cjs_namespaceObject.getContainerSafeArea,
|
|
143
145
|
getContainerContinuationTarget: ({ containerNode })=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoopNode.helpers.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,IAAI,EACT,QAAQ,EACR,KAAK,iBAAiB,EACvB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAuB,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAOtF,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAE7F,OAAO,KAAK,EAAE,iBAAiB,EAAE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AAiB,EACjB,kBAAkB,EAClB,YAAY,GACb,EAAE;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,gBAAgB,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACtC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kBAAkB,EAAE,gCAAgC,CAAC;IACrD,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB,GAAG,qBAAqB,GAAG,IAAI,CAmD/B;AAMD,wBAAgB,yBAAyB,CAAC,EACxC,MAAM,EACN,iBAAiB,EACjB,kBAAkB,GACnB,EAAE;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kBAAkB,EAAE,gCAAgC,CAAC;CACtD,GAAG,MAAM,GAAG,SAAS,CAarB"}
|
|
@@ -100,12 +100,14 @@ function resolveContainerAddNodePreview({ source, sourceHandleType, reactFlowIns
|
|
|
100
100
|
if (clickedHandle?.handleType !== 'output') return null;
|
|
101
101
|
const sourceNode = reactFlowInstance.getNode(source.nodeId);
|
|
102
102
|
const sourceIsContainer = void 0 !== sourceNode && isContainerNodeManifest(getManifestForNode(sourceNode));
|
|
103
|
-
|
|
103
|
+
const allowedContainerId = sourceIsContainer && 'inner' !== clickedHandle.boundary ? sourceNode?.parentId : void 0;
|
|
104
|
+
if (sourceIsContainer && 'inner' !== clickedHandle.boundary && !allowedContainerId) return null;
|
|
104
105
|
return resolveContainerPreview({
|
|
105
106
|
source,
|
|
106
107
|
sourceHandleType,
|
|
107
108
|
reactFlowInstance,
|
|
108
109
|
replacedEdge,
|
|
110
|
+
allowedContainerId,
|
|
109
111
|
isContainerNode: (node)=>isContainerNodeManifest(getManifestForNode(node)),
|
|
110
112
|
getContainerSafeArea: getContainerSafeArea,
|
|
111
113
|
getContainerContinuationTarget: ({ containerNode })=>{
|
|
@@ -2,10 +2,11 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { NodeResizeControl, useStore, useUpdateNodeInternals } from "../../xyflow/react.js";
|
|
3
3
|
import { cn } from "@uipath/apollo-wind";
|
|
4
4
|
import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
5
|
+
import { shallow } from "zustand/shallow";
|
|
5
6
|
import { useOptionalNodeTypeRegistry } from "../../core/index.js";
|
|
6
7
|
import { useElementValidationStatus, useNodeExecutionState } from "../../hooks/index.js";
|
|
7
8
|
import { resolveAdornments } from "../../utils/adornment-resolver.js";
|
|
8
|
-
import { DEFAULT_CONTAINER_HEIGHT, DEFAULT_CONTAINER_MIN_HEIGHT, DEFAULT_CONTAINER_MIN_WIDTH, DEFAULT_CONTAINER_WIDTH } from "../../utils/container.js";
|
|
9
|
+
import { DEFAULT_CONTAINER_HEIGHT, DEFAULT_CONTAINER_MIN_HEIGHT, DEFAULT_CONTAINER_MIN_WIDTH, DEFAULT_CONTAINER_WIDTH, getContainerResizeMinimums } from "../../utils/container.js";
|
|
9
10
|
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
10
11
|
import { resolveDisplay, resolveHandles } from "../../utils/manifest-resolver.js";
|
|
11
12
|
import { selectIsConnecting, snapToGrid } from "../../utils/NodeUtils.js";
|
|
@@ -25,21 +26,29 @@ const EMPTY_DATA = {};
|
|
|
25
26
|
const RESIZE_CONTROLS = [
|
|
26
27
|
{
|
|
27
28
|
position: 'top-left',
|
|
29
|
+
widthSide: 'left',
|
|
30
|
+
heightSide: 'top',
|
|
28
31
|
cursor: 'nwse-resize',
|
|
29
32
|
indicatorClassName: 'top-[-4px] left-[-4px]'
|
|
30
33
|
},
|
|
31
34
|
{
|
|
32
35
|
position: 'top-right',
|
|
36
|
+
widthSide: 'right',
|
|
37
|
+
heightSide: 'top',
|
|
33
38
|
cursor: 'nesw-resize',
|
|
34
39
|
indicatorClassName: 'top-[-4px] right-[-4px]'
|
|
35
40
|
},
|
|
36
41
|
{
|
|
37
42
|
position: 'bottom-left',
|
|
43
|
+
widthSide: 'left',
|
|
44
|
+
heightSide: 'bottom',
|
|
38
45
|
cursor: 'nesw-resize',
|
|
39
46
|
indicatorClassName: 'bottom-[-4px] left-[-4px]'
|
|
40
47
|
},
|
|
41
48
|
{
|
|
42
49
|
position: 'bottom-right',
|
|
50
|
+
widthSide: 'right',
|
|
51
|
+
heightSide: 'bottom',
|
|
43
52
|
cursor: 'nwse-resize',
|
|
44
53
|
indicatorClassName: 'bottom-[-4px] right-[-4px]'
|
|
45
54
|
}
|
|
@@ -49,6 +58,12 @@ const RESIZE_CONTROL_STYLE = {
|
|
|
49
58
|
border: 'none',
|
|
50
59
|
zIndex: 100
|
|
51
60
|
};
|
|
61
|
+
const DEFAULT_RESIZE_MINIMUMS = {
|
|
62
|
+
left: DEFAULT_CONTAINER_MIN_WIDTH,
|
|
63
|
+
right: DEFAULT_CONTAINER_MIN_WIDTH,
|
|
64
|
+
top: DEFAULT_CONTAINER_MIN_HEIGHT,
|
|
65
|
+
bottom: DEFAULT_CONTAINER_MIN_HEIGHT
|
|
66
|
+
};
|
|
52
67
|
const ADORNMENT_SLOT_POSITIONS = [
|
|
53
68
|
'topLeft',
|
|
54
69
|
'topRight',
|
|
@@ -73,6 +88,21 @@ function useHasChildNodes(id, enabled) {
|
|
|
73
88
|
enabled
|
|
74
89
|
]));
|
|
75
90
|
}
|
|
91
|
+
function useContainerResizeMinimums(id, width, height, enabled) {
|
|
92
|
+
return useStore(useCallback((state)=>{
|
|
93
|
+
if (!enabled) return DEFAULT_RESIZE_MINIMUMS;
|
|
94
|
+
return getContainerResizeMinimums({
|
|
95
|
+
id,
|
|
96
|
+
width,
|
|
97
|
+
height
|
|
98
|
+
}, Array.from(state.parentLookup.get(id)?.values() ?? []));
|
|
99
|
+
}, [
|
|
100
|
+
enabled,
|
|
101
|
+
height,
|
|
102
|
+
id,
|
|
103
|
+
width
|
|
104
|
+
]), shallow);
|
|
105
|
+
}
|
|
76
106
|
function useContainerNodeInternalsRefresh(id, handleGroups, width, height) {
|
|
77
107
|
const updateNodeInternals = useUpdateNodeInternals();
|
|
78
108
|
useEffect(()=>{
|
|
@@ -90,6 +120,10 @@ function useContainerNodeInternalsRefresh(id, handleGroups, width, height) {
|
|
|
90
120
|
height
|
|
91
121
|
]);
|
|
92
122
|
}
|
|
123
|
+
function resolveLoopHandleConfigurations(manifestHandleConfigurations, data) {
|
|
124
|
+
if (Array.isArray(data.handleConfigurations)) return data.handleConfigurations;
|
|
125
|
+
return manifestHandleConfigurations ?? [];
|
|
126
|
+
}
|
|
93
127
|
function LoopNodeComponent(props) {
|
|
94
128
|
const { id, type, data, selected = false, dragging = false, width = 0, height = 0, onAddFirstChild, onResize, toolbarConfig: toolbarConfigProp, adornments: adornmentsProp, executionStatusOverride, suggestionType: suggestionTypeProp } = props;
|
|
95
129
|
const nodeTypeRegistry = useOptionalNodeTypeRegistry();
|
|
@@ -142,6 +176,8 @@ function LoopNodeComponent(props) {
|
|
|
142
176
|
const isDropTarget = true === resolvedData.isDropTarget;
|
|
143
177
|
const containerWidth = width || DEFAULT_CONTAINER_WIDTH;
|
|
144
178
|
const containerHeight = height || DEFAULT_CONTAINER_HEIGHT;
|
|
179
|
+
const showResizeControls = selected && !dragging && isDesignMode;
|
|
180
|
+
const resizeMinimums = useContainerResizeMinimums(id, containerWidth, containerHeight, showResizeControls);
|
|
145
181
|
const nodeSizeStyle = {
|
|
146
182
|
width: containerWidth,
|
|
147
183
|
height: containerHeight,
|
|
@@ -164,8 +200,15 @@ function LoopNodeComponent(props) {
|
|
|
164
200
|
adornmentsProp,
|
|
165
201
|
statusContext
|
|
166
202
|
]);
|
|
167
|
-
const resolvedHandleGroups = useMemo(()=>
|
|
168
|
-
manifest,
|
|
203
|
+
const resolvedHandleGroups = useMemo(()=>{
|
|
204
|
+
const handleConfigurations = resolveLoopHandleConfigurations(manifest?.handleConfiguration, resolvedData);
|
|
205
|
+
return resolveHandles(handleConfigurations, {
|
|
206
|
+
...resolvedData,
|
|
207
|
+
nodeId: id
|
|
208
|
+
});
|
|
209
|
+
}, [
|
|
210
|
+
manifest?.handleConfiguration,
|
|
211
|
+
id,
|
|
169
212
|
resolvedData
|
|
170
213
|
]);
|
|
171
214
|
const containerHandleGroups = useMemo(()=>resolveContainerHandleGroups(resolvedHandleGroups), [
|
|
@@ -192,7 +235,6 @@ function LoopNodeComponent(props) {
|
|
|
192
235
|
}, []);
|
|
193
236
|
const shouldShowHandles = (isConnecting || selected || isHovered) && !dragging;
|
|
194
237
|
const showHandleAddButtons = isDesignMode && !multipleNodesSelected && !isConnecting && !dragging;
|
|
195
|
-
const showResizeControls = selected && !dragging && isDesignMode;
|
|
196
238
|
const showEmptyStateButton = isDesignMode && !hasChildNodes && !!onAddFirstChild;
|
|
197
239
|
const interactionState = resolveInteractionState(dragging, selected, isHovered);
|
|
198
240
|
if (!manifest) return /*#__PURE__*/ jsx("div", {
|
|
@@ -234,6 +276,7 @@ function LoopNodeComponent(props) {
|
|
|
234
276
|
visible: showResizeControls
|
|
235
277
|
}),
|
|
236
278
|
showResizeControls ? /*#__PURE__*/ jsx(ResizeControls, {
|
|
279
|
+
minimums: resizeMinimums,
|
|
237
280
|
onResize: handleResize
|
|
238
281
|
}) : null,
|
|
239
282
|
/*#__PURE__*/ jsx(Header, {
|
|
@@ -343,13 +386,13 @@ function BodyFrame({ isEmpty, isLoading }) {
|
|
|
343
386
|
}) : null
|
|
344
387
|
});
|
|
345
388
|
}
|
|
346
|
-
function ResizeControls({ onResize }) {
|
|
389
|
+
function ResizeControls({ minimums = DEFAULT_RESIZE_MINIMUMS, onResize }) {
|
|
347
390
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
348
|
-
children: RESIZE_CONTROLS.map(({ position, cursor })=>/*#__PURE__*/ jsx(NodeResizeControl, {
|
|
391
|
+
children: RESIZE_CONTROLS.map(({ position, widthSide, heightSide, cursor })=>/*#__PURE__*/ jsx(NodeResizeControl, {
|
|
349
392
|
style: RESIZE_CONTROL_STYLE,
|
|
350
393
|
position: position,
|
|
351
|
-
minWidth:
|
|
352
|
-
minHeight:
|
|
394
|
+
minWidth: minimums[widthSide],
|
|
395
|
+
minHeight: minimums[heightSide],
|
|
353
396
|
onResize: onResize,
|
|
354
397
|
children: /*#__PURE__*/ jsx("div", {
|
|
355
398
|
className: "absolute bottom-0 right-0 h-5 w-5 pointer-events-auto",
|