@uipath/apollo-react 3.68.1 → 3.68.3-pr431.62acd9a
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/CanvasPerformance.stories.cjs +361 -0
- package/dist/canvas/components/CanvasPerformance.stories.d.ts +6 -0
- package/dist/canvas/components/CanvasPerformance.stories.d.ts.map +1 -0
- package/dist/canvas/components/CanvasPerformance.stories.js +324 -0
- package/dist/canvas/components/NodePropertiesPanel/hooks/index.cjs +4 -1
- package/dist/canvas/components/NodePropertiesPanel/hooks/index.d.ts +1 -1
- package/dist/canvas/components/NodePropertiesPanel/hooks/index.d.ts.map +1 -1
- package/dist/canvas/components/NodePropertiesPanel/hooks/index.js +2 -2
- package/dist/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.cjs +27 -6
- package/dist/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.d.ts +3 -0
- package/dist/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.d.ts.map +1 -1
- package/dist/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.js +23 -5
- package/dist/canvas/components/StageNode/AdhocTask.cjs +148 -0
- package/dist/canvas/components/StageNode/AdhocTask.d.ts +13 -0
- package/dist/canvas/components/StageNode/AdhocTask.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/AdhocTask.js +104 -0
- package/dist/canvas/components/StageNode/DraggableTask.cjs +14 -5
- package/dist/canvas/components/StageNode/DraggableTask.d.ts +1 -1
- package/dist/canvas/components/StageNode/DraggableTask.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/DraggableTask.js +14 -5
- package/dist/canvas/components/StageNode/DraggableTask.types.d.ts +3 -3
- package/dist/canvas/components/StageNode/DraggableTask.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageEdge.cjs +34 -11
- package/dist/canvas/components/StageNode/StageEdge.d.ts +2 -1
- package/dist/canvas/components/StageNode/StageEdge.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageEdge.js +35 -12
- package/dist/canvas/components/StageNode/StageNode.cjs +91 -122
- package/dist/canvas/components/StageNode/StageNode.d.ts +1 -1
- package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.js +98 -119
- package/dist/canvas/components/StageNode/StageNode.stories.cjs +123 -158
- package/dist/canvas/components/StageNode/StageNode.stories.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.stories.js +119 -154
- package/dist/canvas/components/StageNode/StageNode.stories.utils.cjs +42 -0
- package/dist/canvas/components/StageNode/StageNode.stories.utils.d.ts +4 -0
- package/dist/canvas/components/StageNode/StageNode.stories.utils.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageNode.stories.utils.js +8 -0
- package/dist/canvas/components/StageNode/StageNode.styles.cjs +1 -1
- package/dist/canvas/components/StageNode/StageNode.styles.js +1 -1
- package/dist/canvas/components/StageNode/StageNode.types.d.ts +9 -1
- package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageTaskDragOverlay.cjs +68 -0
- package/dist/canvas/components/StageNode/StageTaskDragOverlay.d.ts +3 -0
- package/dist/canvas/components/StageNode/StageTaskDragOverlay.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageTaskDragOverlay.js +34 -0
- package/dist/canvas/components/StageNode/TaskMenu.cjs +13 -17
- package/dist/canvas/components/StageNode/TaskMenu.d.ts +1 -2
- package/dist/canvas/components/StageNode/TaskMenu.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/TaskMenu.js +14 -18
- package/dist/canvas/components/StageNode/index.d.ts +1 -1
- package/dist/canvas/components/StageNode/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ConnectionMode, Panel, ReactFlowProvider, addEdge, useEdgesState, useNodesState } from "../xyflow/react.js";
|
|
3
|
+
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
import { DefaultCanvasTranslations } from "../types.js";
|
|
5
|
+
import { BaseCanvas } from "./BaseCanvas/index.js";
|
|
6
|
+
import { CanvasPositionControls } from "./CanvasPositionControls.js";
|
|
7
|
+
import { StageConnectionEdge } from "./StageNode/StageConnectionEdge.js";
|
|
8
|
+
import { StageEdge } from "./StageNode/StageEdge.js";
|
|
9
|
+
import { StageNodeWrapper } from "./StageNode/StageNode.stories.utils.js";
|
|
10
|
+
const meta = {
|
|
11
|
+
title: 'Canvas/Performance',
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: 'fullscreen'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const CanvasPerformance_stories = meta;
|
|
17
|
+
const PERFORMANCE_STAGE_NODE_WIDTH = 304;
|
|
18
|
+
const PERFORMANCE_STAGE_SPACING_X = 400;
|
|
19
|
+
const PERFORMANCE_STAGE_SPACING_Y = 384;
|
|
20
|
+
const DEFAULT_STAGE_COUNT = 48;
|
|
21
|
+
const MIN_STAGE_COUNT = 1;
|
|
22
|
+
const MAX_STAGE_COUNT = 200;
|
|
23
|
+
const VerificationIcon = ()=>/*#__PURE__*/ jsxs("svg", {
|
|
24
|
+
viewBox: "0 0 24 24",
|
|
25
|
+
fill: "none",
|
|
26
|
+
stroke: "currentColor",
|
|
27
|
+
strokeWidth: "1.5",
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ jsx("path", {
|
|
30
|
+
d: "M9 11L12 14L20 6"
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ jsx("path", {
|
|
33
|
+
d: "M20 12V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18V6C4 4.89543 4.89543 4 6 4H13"
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
const DocumentIcon = ()=>/*#__PURE__*/ jsxs("svg", {
|
|
38
|
+
viewBox: "0 0 24 24",
|
|
39
|
+
fill: "none",
|
|
40
|
+
stroke: "currentColor",
|
|
41
|
+
strokeWidth: "1.5",
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx("path", {
|
|
44
|
+
d: "M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2Z"
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ jsx("path", {
|
|
47
|
+
d: "M14 2V8H20"
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ jsx("path", {
|
|
50
|
+
d: "M8 12H16"
|
|
51
|
+
}),
|
|
52
|
+
/*#__PURE__*/ jsx("path", {
|
|
53
|
+
d: "M8 16H16"
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
const ProcessIcon = ()=>/*#__PURE__*/ jsxs("svg", {
|
|
58
|
+
viewBox: "0 0 24 24",
|
|
59
|
+
fill: "none",
|
|
60
|
+
stroke: "currentColor",
|
|
61
|
+
strokeWidth: "1.5",
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ jsx("rect", {
|
|
64
|
+
x: "3",
|
|
65
|
+
y: "3",
|
|
66
|
+
width: "7",
|
|
67
|
+
height: "7",
|
|
68
|
+
rx: "1"
|
|
69
|
+
}),
|
|
70
|
+
/*#__PURE__*/ jsx("rect", {
|
|
71
|
+
x: "14",
|
|
72
|
+
y: "3",
|
|
73
|
+
width: "7",
|
|
74
|
+
height: "7",
|
|
75
|
+
rx: "1"
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ jsx("rect", {
|
|
78
|
+
x: "3",
|
|
79
|
+
y: "14",
|
|
80
|
+
width: "7",
|
|
81
|
+
height: "7",
|
|
82
|
+
rx: "1"
|
|
83
|
+
}),
|
|
84
|
+
/*#__PURE__*/ jsx("rect", {
|
|
85
|
+
x: "14",
|
|
86
|
+
y: "14",
|
|
87
|
+
width: "7",
|
|
88
|
+
height: "7",
|
|
89
|
+
rx: "1"
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
function createPerformanceStageTasks(index) {
|
|
94
|
+
return [
|
|
95
|
+
[
|
|
96
|
+
{
|
|
97
|
+
id: `stage-${index}-task-intake`,
|
|
98
|
+
label: 'Intake Review',
|
|
99
|
+
icon: /*#__PURE__*/ jsx(VerificationIcon, {})
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
{
|
|
104
|
+
id: `stage-${index}-task-documents`,
|
|
105
|
+
label: 'Document Processing',
|
|
106
|
+
icon: /*#__PURE__*/ jsx(DocumentIcon, {})
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
{
|
|
111
|
+
id: `stage-${index}-task-risk`,
|
|
112
|
+
label: 'Risk Assessment',
|
|
113
|
+
icon: /*#__PURE__*/ jsx(VerificationIcon, {})
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: `stage-${index}-task-policy`,
|
|
117
|
+
label: 'Policy Validation',
|
|
118
|
+
icon: /*#__PURE__*/ jsx(VerificationIcon, {})
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
{
|
|
123
|
+
id: `stage-${index}-task-review`,
|
|
124
|
+
label: 'Final Review',
|
|
125
|
+
icon: /*#__PURE__*/ jsx(ProcessIcon, {})
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
function createPerformanceStageNodes(stageCount) {
|
|
131
|
+
const columns = Math.ceil(Math.sqrt(stageCount));
|
|
132
|
+
return Array.from({
|
|
133
|
+
length: stageCount
|
|
134
|
+
}, (_, index)=>{
|
|
135
|
+
const row = Math.floor(index / columns);
|
|
136
|
+
const col = index % columns;
|
|
137
|
+
const stageId = `performance-stage-${index}`;
|
|
138
|
+
return {
|
|
139
|
+
id: stageId,
|
|
140
|
+
type: 'stage',
|
|
141
|
+
position: {
|
|
142
|
+
x: col * PERFORMANCE_STAGE_SPACING_X,
|
|
143
|
+
y: row * PERFORMANCE_STAGE_SPACING_Y
|
|
144
|
+
},
|
|
145
|
+
width: PERFORMANCE_STAGE_NODE_WIDTH,
|
|
146
|
+
data: {
|
|
147
|
+
stageDetails: {
|
|
148
|
+
label: `Performance Stage ${index + 1}`,
|
|
149
|
+
tasks: createPerformanceStageTasks(index)
|
|
150
|
+
},
|
|
151
|
+
execution: {
|
|
152
|
+
stageStatus: {
|
|
153
|
+
duration: `SLA: ${30 + index % 5 * 15}m`
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function createPerformanceStageEdges(stageCount) {
|
|
161
|
+
const columns = Math.ceil(Math.sqrt(stageCount));
|
|
162
|
+
const edges = [];
|
|
163
|
+
for(let index = 0; index < stageCount; index++){
|
|
164
|
+
const col = index % columns;
|
|
165
|
+
const sourceId = `performance-stage-${index}`;
|
|
166
|
+
const rightIndex = index + 1;
|
|
167
|
+
if (col < columns - 1 && rightIndex < stageCount) {
|
|
168
|
+
const targetId = `performance-stage-${rightIndex}`;
|
|
169
|
+
edges.push({
|
|
170
|
+
id: `performance-edge-right-${index}`,
|
|
171
|
+
type: 'stage',
|
|
172
|
+
source: sourceId,
|
|
173
|
+
sourceHandle: `${sourceId}____source____right`,
|
|
174
|
+
target: targetId,
|
|
175
|
+
targetHandle: `${targetId}____target____left`
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const downIndex = index + columns;
|
|
179
|
+
if (downIndex < stageCount) {
|
|
180
|
+
const targetId = `performance-stage-${downIndex}`;
|
|
181
|
+
edges.push({
|
|
182
|
+
id: `performance-edge-down-${index}`,
|
|
183
|
+
type: 'stage',
|
|
184
|
+
source: sourceId,
|
|
185
|
+
sourceHandle: `${sourceId}____source____bottom`,
|
|
186
|
+
target: targetId,
|
|
187
|
+
targetHandle: `${targetId}____target____top`
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return edges;
|
|
192
|
+
}
|
|
193
|
+
const CanvasPerformanceStory = ()=>{
|
|
194
|
+
const nodeTypes = useMemo(()=>({
|
|
195
|
+
stage: StageNodeWrapper
|
|
196
|
+
}), []);
|
|
197
|
+
const edgeTypes = useMemo(()=>({
|
|
198
|
+
stage: StageEdge
|
|
199
|
+
}), []);
|
|
200
|
+
const defaultEdgeOptions = useMemo(()=>({
|
|
201
|
+
type: 'stage'
|
|
202
|
+
}), []);
|
|
203
|
+
const [stageCount, setStageCount] = useState(DEFAULT_STAGE_COUNT);
|
|
204
|
+
const [nodes, setNodes, onNodesChange] = useNodesState(createPerformanceStageNodes(DEFAULT_STAGE_COUNT));
|
|
205
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState(createPerformanceStageEdges(DEFAULT_STAGE_COUNT));
|
|
206
|
+
const onConnect = useCallback((connection)=>setEdges((eds)=>addEdge(connection, eds)), [
|
|
207
|
+
setEdges
|
|
208
|
+
]);
|
|
209
|
+
const handleStageCountChange = useCallback((e)=>{
|
|
210
|
+
const nextCount = Number.parseInt(e.target.value, 10);
|
|
211
|
+
setStageCount(nextCount);
|
|
212
|
+
setNodes(createPerformanceStageNodes(nextCount));
|
|
213
|
+
setEdges(createPerformanceStageEdges(nextCount));
|
|
214
|
+
}, [
|
|
215
|
+
setEdges,
|
|
216
|
+
setNodes
|
|
217
|
+
]);
|
|
218
|
+
return /*#__PURE__*/ jsx("div", {
|
|
219
|
+
style: {
|
|
220
|
+
width: '100vw',
|
|
221
|
+
height: '100vh'
|
|
222
|
+
},
|
|
223
|
+
children: /*#__PURE__*/ jsx(ReactFlowProvider, {
|
|
224
|
+
children: /*#__PURE__*/ jsxs(BaseCanvas, {
|
|
225
|
+
nodes: nodes,
|
|
226
|
+
edges: edges,
|
|
227
|
+
onNodesChange: onNodesChange,
|
|
228
|
+
onEdgesChange: onEdgesChange,
|
|
229
|
+
onConnect: onConnect,
|
|
230
|
+
nodeTypes: nodeTypes,
|
|
231
|
+
edgeTypes: edgeTypes,
|
|
232
|
+
mode: "design",
|
|
233
|
+
connectionMode: ConnectionMode.Strict,
|
|
234
|
+
defaultEdgeOptions: defaultEdgeOptions,
|
|
235
|
+
connectionLineComponent: StageConnectionEdge,
|
|
236
|
+
elevateEdgesOnSelect: true,
|
|
237
|
+
children: [
|
|
238
|
+
/*#__PURE__*/ jsx(Panel, {
|
|
239
|
+
position: "top-left",
|
|
240
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
241
|
+
className: "nodrag nopan nowheel",
|
|
242
|
+
style: {
|
|
243
|
+
width: 240,
|
|
244
|
+
background: 'var(--uix-canvas-background)',
|
|
245
|
+
border: '1px solid var(--uix-canvas-border-de-emp)',
|
|
246
|
+
borderRadius: 16,
|
|
247
|
+
padding: 16,
|
|
248
|
+
boxShadow: '0 8px 32px rgba(15, 23, 42, 0.08)'
|
|
249
|
+
},
|
|
250
|
+
children: [
|
|
251
|
+
/*#__PURE__*/ jsx("div", {
|
|
252
|
+
style: {
|
|
253
|
+
fontWeight: 600,
|
|
254
|
+
fontSize: 14
|
|
255
|
+
},
|
|
256
|
+
children: "Performance Test"
|
|
257
|
+
}),
|
|
258
|
+
/*#__PURE__*/ jsx("div", {
|
|
259
|
+
style: {
|
|
260
|
+
marginTop: 6,
|
|
261
|
+
color: 'var(--uix-canvas-foreground-de-emp)',
|
|
262
|
+
fontSize: 12,
|
|
263
|
+
lineHeight: 1.4
|
|
264
|
+
},
|
|
265
|
+
children: "Adjust the number of stage nodes to profile drag and pan performance."
|
|
266
|
+
}),
|
|
267
|
+
/*#__PURE__*/ jsxs("div", {
|
|
268
|
+
style: {
|
|
269
|
+
display: 'flex',
|
|
270
|
+
justifyContent: 'space-between',
|
|
271
|
+
alignItems: 'center',
|
|
272
|
+
marginTop: 12,
|
|
273
|
+
marginBottom: 8,
|
|
274
|
+
fontSize: 12
|
|
275
|
+
},
|
|
276
|
+
children: [
|
|
277
|
+
/*#__PURE__*/ jsx("span", {
|
|
278
|
+
children: "Stage Count"
|
|
279
|
+
}),
|
|
280
|
+
/*#__PURE__*/ jsx("strong", {
|
|
281
|
+
style: {
|
|
282
|
+
fontSize: 14
|
|
283
|
+
},
|
|
284
|
+
children: stageCount
|
|
285
|
+
})
|
|
286
|
+
]
|
|
287
|
+
}),
|
|
288
|
+
/*#__PURE__*/ jsx("input", {
|
|
289
|
+
type: "range",
|
|
290
|
+
min: MIN_STAGE_COUNT,
|
|
291
|
+
max: MAX_STAGE_COUNT,
|
|
292
|
+
value: stageCount,
|
|
293
|
+
onChange: handleStageCountChange,
|
|
294
|
+
style: {
|
|
295
|
+
width: '100%',
|
|
296
|
+
cursor: 'pointer'
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
]
|
|
300
|
+
})
|
|
301
|
+
}),
|
|
302
|
+
/*#__PURE__*/ jsx(Panel, {
|
|
303
|
+
position: "bottom-right",
|
|
304
|
+
children: /*#__PURE__*/ jsx(CanvasPositionControls, {
|
|
305
|
+
translations: DefaultCanvasTranslations
|
|
306
|
+
})
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
})
|
|
310
|
+
})
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
const StageWorkflow = {
|
|
314
|
+
name: 'Stage Workflow',
|
|
315
|
+
parameters: {
|
|
316
|
+
docs: {
|
|
317
|
+
description: {
|
|
318
|
+
story: 'Standalone performance story with adjustable stage count. Use this to profile stage workflow drag and pan behavior under load.'
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
render: ()=>/*#__PURE__*/ jsx(CanvasPerformanceStory, {})
|
|
323
|
+
};
|
|
324
|
+
export { StageWorkflow, CanvasPerformance_stories as default };
|
|
@@ -24,6 +24,7 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useSetNodeSelection: ()=>external_useNodeSelection_cjs_namespaceObject.useSetNodeSelection,
|
|
27
28
|
useNodeSelection: ()=>external_useNodeSelection_cjs_namespaceObject.useNodeSelection,
|
|
28
29
|
useNodeConfiguration: ()=>external_useNodeConfiguration_cjs_namespaceObject.useNodeConfiguration
|
|
29
30
|
});
|
|
@@ -31,9 +32,11 @@ const external_useNodeConfiguration_cjs_namespaceObject = require("./useNodeConf
|
|
|
31
32
|
const external_useNodeSelection_cjs_namespaceObject = require("./useNodeSelection.cjs");
|
|
32
33
|
exports.useNodeConfiguration = __webpack_exports__.useNodeConfiguration;
|
|
33
34
|
exports.useNodeSelection = __webpack_exports__.useNodeSelection;
|
|
35
|
+
exports.useSetNodeSelection = __webpack_exports__.useSetNodeSelection;
|
|
34
36
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
35
37
|
"useNodeConfiguration",
|
|
36
|
-
"useNodeSelection"
|
|
38
|
+
"useNodeSelection",
|
|
39
|
+
"useSetNodeSelection"
|
|
37
40
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
38
41
|
Object.defineProperty(exports, '__esModule', {
|
|
39
42
|
value: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/NodePropertiesPanel/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/NodePropertiesPanel/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { useNodeConfiguration } from "./useNodeConfiguration.js";
|
|
2
|
-
import { useNodeSelection } from "./useNodeSelection.js";
|
|
3
|
-
export { useNodeConfiguration, useNodeSelection };
|
|
2
|
+
import { useNodeSelection, useSetNodeSelection } from "./useNodeSelection.js";
|
|
3
|
+
export { useNodeConfiguration, useNodeSelection, useSetNodeSelection };
|
|
@@ -24,10 +24,21 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
useNodeSelection: ()=>useNodeSelection
|
|
27
|
+
useNodeSelection: ()=>useNodeSelection,
|
|
28
|
+
useSetNodeSelection: ()=>useSetNodeSelection
|
|
28
29
|
});
|
|
29
30
|
const react_cjs_namespaceObject = require("../../../xyflow/react.cjs");
|
|
30
31
|
const external_react_namespaceObject = require("react");
|
|
32
|
+
function applySelection(nodes, nodeId) {
|
|
33
|
+
return nodes.map((node)=>{
|
|
34
|
+
const shouldBeSelected = node.id === nodeId;
|
|
35
|
+
if (node.selected === shouldBeSelected) return node;
|
|
36
|
+
return {
|
|
37
|
+
...node,
|
|
38
|
+
selected: shouldBeSelected
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}
|
|
31
42
|
function useNodeSelection(nodeId, maintainSelection = true) {
|
|
32
43
|
const nodes = (0, react_cjs_namespaceObject.useNodes)();
|
|
33
44
|
const { setNodes } = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
@@ -40,10 +51,7 @@ function useNodeSelection(nodeId, maintainSelection = true) {
|
|
|
40
51
|
])
|
|
41
52
|
});
|
|
42
53
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
43
|
-
if (maintainSelection && selectedNodeId) setNodes((nds)=>nds
|
|
44
|
-
...node,
|
|
45
|
-
selected: node.id === selectedNodeId
|
|
46
|
-
})));
|
|
54
|
+
if (maintainSelection && selectedNodeId) setNodes((nds)=>applySelection(nds, selectedNodeId));
|
|
47
55
|
}, [
|
|
48
56
|
selectedNodeId,
|
|
49
57
|
maintainSelection,
|
|
@@ -56,9 +64,22 @@ function useNodeSelection(nodeId, maintainSelection = true) {
|
|
|
56
64
|
selectedNode
|
|
57
65
|
};
|
|
58
66
|
}
|
|
67
|
+
function useSetNodeSelection() {
|
|
68
|
+
const { setNodes } = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
69
|
+
const setSelectedNodeId = (0, external_react_namespaceObject.useCallback)((nodeId)=>{
|
|
70
|
+
setNodes((nds)=>applySelection(nds, nodeId));
|
|
71
|
+
}, [
|
|
72
|
+
setNodes
|
|
73
|
+
]);
|
|
74
|
+
return {
|
|
75
|
+
setSelectedNodeId
|
|
76
|
+
};
|
|
77
|
+
}
|
|
59
78
|
exports.useNodeSelection = __webpack_exports__.useNodeSelection;
|
|
79
|
+
exports.useSetNodeSelection = __webpack_exports__.useSetNodeSelection;
|
|
60
80
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
61
|
-
"useNodeSelection"
|
|
81
|
+
"useNodeSelection",
|
|
82
|
+
"useSetNodeSelection"
|
|
62
83
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
63
84
|
Object.defineProperty(exports, '__esModule', {
|
|
64
85
|
value: true
|
|
@@ -4,4 +4,7 @@ export declare function useNodeSelection(nodeId?: string, maintainSelection?: bo
|
|
|
4
4
|
setSelectedNodeId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
5
5
|
selectedNode: ConfigurableNode | undefined;
|
|
6
6
|
};
|
|
7
|
+
export declare function useSetNodeSelection(): {
|
|
8
|
+
setSelectedNodeId: (nodeId: string) => void;
|
|
9
|
+
};
|
|
7
10
|
//# sourceMappingURL=useNodeSelection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNodeSelection.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNodeSelection.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAUrE,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,iBAAiB,UAAO;;;;EAmCzE;AAOD,wBAAgB,mBAAmB;gCAItB,MAAM;EAOlB"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { useNodes, useOnSelectionChange, useReactFlow } from "../../../xyflow/react.js";
|
|
2
2
|
import { useCallback, useEffect, useState } from "react";
|
|
3
|
+
function applySelection(nodes, nodeId) {
|
|
4
|
+
return nodes.map((node)=>{
|
|
5
|
+
const shouldBeSelected = node.id === nodeId;
|
|
6
|
+
if (node.selected === shouldBeSelected) return node;
|
|
7
|
+
return {
|
|
8
|
+
...node,
|
|
9
|
+
selected: shouldBeSelected
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
}
|
|
3
13
|
function useNodeSelection(nodeId, maintainSelection = true) {
|
|
4
14
|
const nodes = useNodes();
|
|
5
15
|
const { setNodes } = useReactFlow();
|
|
@@ -12,10 +22,7 @@ function useNodeSelection(nodeId, maintainSelection = true) {
|
|
|
12
22
|
])
|
|
13
23
|
});
|
|
14
24
|
useEffect(()=>{
|
|
15
|
-
if (maintainSelection && selectedNodeId) setNodes((nds)=>nds
|
|
16
|
-
...node,
|
|
17
|
-
selected: node.id === selectedNodeId
|
|
18
|
-
})));
|
|
25
|
+
if (maintainSelection && selectedNodeId) setNodes((nds)=>applySelection(nds, selectedNodeId));
|
|
19
26
|
}, [
|
|
20
27
|
selectedNodeId,
|
|
21
28
|
maintainSelection,
|
|
@@ -28,4 +35,15 @@ function useNodeSelection(nodeId, maintainSelection = true) {
|
|
|
28
35
|
selectedNode
|
|
29
36
|
};
|
|
30
37
|
}
|
|
31
|
-
|
|
38
|
+
function useSetNodeSelection() {
|
|
39
|
+
const { setNodes } = useReactFlow();
|
|
40
|
+
const setSelectedNodeId = useCallback((nodeId)=>{
|
|
41
|
+
setNodes((nds)=>applySelection(nds, nodeId));
|
|
42
|
+
}, [
|
|
43
|
+
setNodes
|
|
44
|
+
]);
|
|
45
|
+
return {
|
|
46
|
+
setSelectedNodeId
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export { useNodeSelection, useSetNodeSelection };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
AdhocTaskItem: ()=>AdhocTaskItem
|
|
37
|
+
});
|
|
38
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
+
const apollo_core_namespaceObject = require("@uipath/apollo-core");
|
|
40
|
+
const index_cjs_namespaceObject = require("../../../material/index.cjs");
|
|
41
|
+
const external_debounce_namespaceObject = require("debounce");
|
|
42
|
+
var external_debounce_default = /*#__PURE__*/ __webpack_require__.n(external_debounce_namespaceObject);
|
|
43
|
+
const external_react_namespaceObject = require("react");
|
|
44
|
+
const external_icons_index_cjs_namespaceObject = require("../../icons/index.cjs");
|
|
45
|
+
const external_DraggableTask_cjs_namespaceObject = require("./DraggableTask.cjs");
|
|
46
|
+
const external_StageNode_styles_cjs_namespaceObject = require("./StageNode.styles.cjs");
|
|
47
|
+
const external_TaskMenu_cjs_namespaceObject = require("./TaskMenu.cjs");
|
|
48
|
+
const AdhocTaskPlayButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ taskId, onTaskPlay })=>{
|
|
49
|
+
const [playLoading, setPlayLoading] = (0, external_react_namespaceObject.useState)(false);
|
|
50
|
+
const debouncedTaskPlay = (0, external_react_namespaceObject.useMemo)(()=>external_debounce_default()(async (id)=>{
|
|
51
|
+
setPlayLoading(true);
|
|
52
|
+
try {
|
|
53
|
+
await onTaskPlay(id);
|
|
54
|
+
} catch {} finally{
|
|
55
|
+
setPlayLoading(false);
|
|
56
|
+
}
|
|
57
|
+
}, 500, {
|
|
58
|
+
immediate: true
|
|
59
|
+
}), [
|
|
60
|
+
onTaskPlay
|
|
61
|
+
]);
|
|
62
|
+
const handlePlayClick = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
debouncedTaskPlay(taskId);
|
|
66
|
+
}, [
|
|
67
|
+
debouncedTaskPlay,
|
|
68
|
+
taskId
|
|
69
|
+
]);
|
|
70
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.ApTooltip, {
|
|
71
|
+
content: "Trigger task",
|
|
72
|
+
placement: "top",
|
|
73
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.ApIconButton, {
|
|
74
|
+
"data-testid": `stage-task-play-${taskId}`,
|
|
75
|
+
onClick: handlePlayClick,
|
|
76
|
+
onMouseDown: (e)=>e.stopPropagation(),
|
|
77
|
+
onKeyDown: (e)=>e.stopPropagation(),
|
|
78
|
+
className: "task-menu-icon-button",
|
|
79
|
+
sx: {
|
|
80
|
+
color: 'var(--uix-canvas-primary) !important',
|
|
81
|
+
minWidth: 'unset !important',
|
|
82
|
+
width: `${apollo_core_namespaceObject.Spacing.SpacingL} !important`,
|
|
83
|
+
height: `${apollo_core_namespaceObject.Spacing.SpacingL} !important`,
|
|
84
|
+
padding: '0 !important'
|
|
85
|
+
},
|
|
86
|
+
children: playLoading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_cjs_namespaceObject.ApCircularProgress, {
|
|
87
|
+
size: 20
|
|
88
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_icons_index_cjs_namespaceObject.PlayIcon, {
|
|
89
|
+
w: 20,
|
|
90
|
+
h: 20
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
const AdhocTaskItemComponent = ({ task, taskExecution, isSelected, getContextMenuItems, onTaskClick, onTaskPlay })=>{
|
|
96
|
+
const [isMenuOpen, setIsMenuOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
97
|
+
const taskRef = (0, external_react_namespaceObject.useRef)(null);
|
|
98
|
+
const menuRef = (0, external_react_namespaceObject.useRef)(null);
|
|
99
|
+
const handleClick = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
100
|
+
if (isMenuOpen) return;
|
|
101
|
+
onTaskClick(e, task.id);
|
|
102
|
+
}, [
|
|
103
|
+
isMenuOpen,
|
|
104
|
+
onTaskClick,
|
|
105
|
+
task.id
|
|
106
|
+
]);
|
|
107
|
+
const handleMenuOpenChange = (0, external_react_namespaceObject.useCallback)((isOpen)=>{
|
|
108
|
+
setIsMenuOpen(isOpen);
|
|
109
|
+
}, []);
|
|
110
|
+
const handleContextMenu = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
111
|
+
menuRef.current?.handleContextMenu(e);
|
|
112
|
+
}, []);
|
|
113
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_StageNode_styles_cjs_namespaceObject.StageTask, {
|
|
114
|
+
ref: taskRef,
|
|
115
|
+
"data-testid": `stage-task-${task.id}`,
|
|
116
|
+
selected: isSelected,
|
|
117
|
+
status: taskExecution?.status,
|
|
118
|
+
onClick: handleClick,
|
|
119
|
+
...getContextMenuItems && {
|
|
120
|
+
onContextMenu: handleContextMenu
|
|
121
|
+
},
|
|
122
|
+
children: [
|
|
123
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_DraggableTask_cjs_namespaceObject.TaskContent, {
|
|
124
|
+
task: task,
|
|
125
|
+
taskExecution: taskExecution
|
|
126
|
+
}),
|
|
127
|
+
onTaskPlay && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AdhocTaskPlayButton, {
|
|
128
|
+
taskId: task.id,
|
|
129
|
+
onTaskPlay: onTaskPlay
|
|
130
|
+
}),
|
|
131
|
+
getContextMenuItems && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_TaskMenu_cjs_namespaceObject.TaskMenu, {
|
|
132
|
+
ref: menuRef,
|
|
133
|
+
taskId: task.id,
|
|
134
|
+
getContextMenuItems: getContextMenuItems,
|
|
135
|
+
onMenuOpenChange: handleMenuOpenChange,
|
|
136
|
+
taskRef: taskRef
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const AdhocTaskItem = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(AdhocTaskItemComponent);
|
|
142
|
+
exports.AdhocTaskItem = __webpack_exports__.AdhocTaskItem;
|
|
143
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
144
|
+
"AdhocTaskItem"
|
|
145
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
146
|
+
Object.defineProperty(exports, '__esModule', {
|
|
147
|
+
value: true
|
|
148
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NodeMenuItem } from '../NodeContextMenu';
|
|
2
|
+
import type { StageTaskExecution, StageTaskItem } from './StageNode.types';
|
|
3
|
+
interface AdhocTaskItemProps {
|
|
4
|
+
task: StageTaskItem;
|
|
5
|
+
taskExecution?: StageTaskExecution;
|
|
6
|
+
isSelected: boolean;
|
|
7
|
+
getContextMenuItems?: () => NodeMenuItem[];
|
|
8
|
+
onTaskClick: (e: React.MouseEvent, taskId: string) => void;
|
|
9
|
+
onTaskPlay?: (taskId: string) => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const AdhocTaskItem: import("react").MemoExoticComponent<({ task, taskExecution, isSelected, getContextMenuItems, onTaskClick, onTaskPlay, }: AdhocTaskItemProps) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=AdhocTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdhocTask.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/AdhocTask.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AA0D3E,UAAU,kBAAkB;IAC1B,IAAI,EAAE,aAAa,CAAC;IACpB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,YAAY,EAAE,CAAC;IAC3C,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAsDD,eAAO,MAAM,aAAa,2HA7CvB,kBAAkB,6CA6CoC,CAAC"}
|