@uipath/apollo-react 3.68.3 → 3.69.0-pr458.25d2dee
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 +349 -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 +312 -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 +4 -5
- package/dist/canvas/components/StageNode/AdhocTask.d.ts +2 -3
- package/dist/canvas/components/StageNode/AdhocTask.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/AdhocTask.js +4 -5
- 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 +30 -59
- package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.js +35 -64
- package/dist/canvas/components/StageNode/StageNode.stories.cjs +127 -179
- package/dist/canvas/components/StageNode/StageNode.stories.d.ts +2 -2
- package/dist/canvas/components/StageNode/StageNode.stories.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.stories.js +123 -175
- package/dist/canvas/components/StageNode/StageNode.stories.utils.cjs +45 -0
- package/dist/canvas/components/StageNode/StageNode.stories.utils.d.ts +8 -0
- package/dist/canvas/components/StageNode/StageNode.stories.utils.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageNode.stories.utils.js +11 -0
- package/dist/canvas/components/StageNode/StageNode.types.d.ts +9 -4
- package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageTaskDragOverlay.cjs +69 -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 +35 -0
- package/dist/canvas/components/StageNode/TaskMenu.cjs +14 -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 +15 -18
- package/dist/canvas/components/StageNode/index.d.ts +1 -1
- package/dist/canvas/components/StageNode/index.d.ts.map +1 -1
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.cjs +10 -2
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.d.ts.map +1 -1
- package/dist/canvas/components/StickyNoteNode/StickyNoteNode.js +9 -2
- package/dist/canvas/components/StickyNoteNode/useScrollCapture.cjs +72 -0
- package/dist/canvas/components/StickyNoteNode/useScrollCapture.d.ts +9 -0
- package/dist/canvas/components/StickyNoteNode/useScrollCapture.d.ts.map +1 -0
- package/dist/canvas/components/StickyNoteNode/useScrollCapture.js +38 -0
- package/package.json +5 -4
|
@@ -0,0 +1,349 @@
|
|
|
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
|
+
StageWorkflow: ()=>StageWorkflow,
|
|
28
|
+
default: ()=>CanvasPerformance_stories
|
|
29
|
+
});
|
|
30
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
+
const react_cjs_namespaceObject = require("../xyflow/react.cjs");
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const external_types_cjs_namespaceObject = require("../types.cjs");
|
|
34
|
+
const index_cjs_namespaceObject = require("./BaseCanvas/index.cjs");
|
|
35
|
+
const external_CanvasPositionControls_cjs_namespaceObject = require("./CanvasPositionControls.cjs");
|
|
36
|
+
const StageConnectionEdge_cjs_namespaceObject = require("./StageNode/StageConnectionEdge.cjs");
|
|
37
|
+
const StageEdge_cjs_namespaceObject = require("./StageNode/StageEdge.cjs");
|
|
38
|
+
const StageNode_stories_utils_cjs_namespaceObject = require("./StageNode/StageNode.stories.utils.cjs");
|
|
39
|
+
const meta = {
|
|
40
|
+
title: 'Canvas/Performance',
|
|
41
|
+
parameters: {
|
|
42
|
+
layout: 'fullscreen'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const CanvasPerformance_stories = meta;
|
|
46
|
+
const PERFORMANCE_STAGE_NODE_WIDTH = 304;
|
|
47
|
+
const PERFORMANCE_STAGE_SPACING_X = 400;
|
|
48
|
+
const PERFORMANCE_STAGE_SPACING_Y = 384;
|
|
49
|
+
const DEFAULT_STAGE_COUNT = 48;
|
|
50
|
+
const MIN_STAGE_COUNT = 1;
|
|
51
|
+
const MAX_STAGE_COUNT = 200;
|
|
52
|
+
const VerificationIcon = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("svg", {
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
fill: "none",
|
|
55
|
+
stroke: "currentColor",
|
|
56
|
+
strokeWidth: "1.5",
|
|
57
|
+
children: [
|
|
58
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
59
|
+
d: "M9 11L12 14L20 6"
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
62
|
+
d: "M20 12V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18V6C4 4.89543 4.89543 4 6 4H13"
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
const DocumentIcon = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("svg", {
|
|
67
|
+
viewBox: "0 0 24 24",
|
|
68
|
+
fill: "none",
|
|
69
|
+
stroke: "currentColor",
|
|
70
|
+
strokeWidth: "1.5",
|
|
71
|
+
children: [
|
|
72
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
73
|
+
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"
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
76
|
+
d: "M14 2V8H20"
|
|
77
|
+
}),
|
|
78
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
79
|
+
d: "M8 12H16"
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
82
|
+
d: "M8 16H16"
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
const ProcessIcon = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("svg", {
|
|
87
|
+
viewBox: "0 0 24 24",
|
|
88
|
+
fill: "none",
|
|
89
|
+
stroke: "currentColor",
|
|
90
|
+
strokeWidth: "1.5",
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("rect", {
|
|
93
|
+
x: "3",
|
|
94
|
+
y: "3",
|
|
95
|
+
width: "7",
|
|
96
|
+
height: "7",
|
|
97
|
+
rx: "1"
|
|
98
|
+
}),
|
|
99
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("rect", {
|
|
100
|
+
x: "14",
|
|
101
|
+
y: "3",
|
|
102
|
+
width: "7",
|
|
103
|
+
height: "7",
|
|
104
|
+
rx: "1"
|
|
105
|
+
}),
|
|
106
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("rect", {
|
|
107
|
+
x: "3",
|
|
108
|
+
y: "14",
|
|
109
|
+
width: "7",
|
|
110
|
+
height: "7",
|
|
111
|
+
rx: "1"
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("rect", {
|
|
114
|
+
x: "14",
|
|
115
|
+
y: "14",
|
|
116
|
+
width: "7",
|
|
117
|
+
height: "7",
|
|
118
|
+
rx: "1"
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
function createPerformanceStageTasks(index) {
|
|
123
|
+
return [
|
|
124
|
+
[
|
|
125
|
+
{
|
|
126
|
+
id: `stage-${index}-task-intake`,
|
|
127
|
+
label: 'Intake Review',
|
|
128
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VerificationIcon, {})
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
[
|
|
132
|
+
{
|
|
133
|
+
id: `stage-${index}-task-documents`,
|
|
134
|
+
label: 'Document Processing',
|
|
135
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DocumentIcon, {})
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
{
|
|
140
|
+
id: `stage-${index}-task-risk`,
|
|
141
|
+
label: 'Risk Assessment',
|
|
142
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VerificationIcon, {})
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
id: `stage-${index}-task-policy`,
|
|
146
|
+
label: 'Policy Validation',
|
|
147
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(VerificationIcon, {})
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
[
|
|
151
|
+
{
|
|
152
|
+
id: `stage-${index}-task-review`,
|
|
153
|
+
label: 'Final Review',
|
|
154
|
+
icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ProcessIcon, {})
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
function createPerformanceStageNodes(stageCount) {
|
|
160
|
+
const columns = Math.ceil(Math.sqrt(stageCount));
|
|
161
|
+
return Array.from({
|
|
162
|
+
length: stageCount
|
|
163
|
+
}, (_, index)=>{
|
|
164
|
+
const row = Math.floor(index / columns);
|
|
165
|
+
const col = index % columns;
|
|
166
|
+
const stageId = `performance-stage-${index}`;
|
|
167
|
+
return {
|
|
168
|
+
id: stageId,
|
|
169
|
+
type: 'stage',
|
|
170
|
+
position: {
|
|
171
|
+
x: col * PERFORMANCE_STAGE_SPACING_X,
|
|
172
|
+
y: row * PERFORMANCE_STAGE_SPACING_Y
|
|
173
|
+
},
|
|
174
|
+
width: PERFORMANCE_STAGE_NODE_WIDTH,
|
|
175
|
+
data: {
|
|
176
|
+
stageDetails: {
|
|
177
|
+
label: `Performance Stage ${index + 1}`,
|
|
178
|
+
tasks: createPerformanceStageTasks(index)
|
|
179
|
+
},
|
|
180
|
+
execution: {
|
|
181
|
+
stageStatus: {
|
|
182
|
+
duration: `SLA: ${30 + index % 5 * 15}m`
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
function createPerformanceStageEdges(stageCount) {
|
|
190
|
+
const columns = Math.ceil(Math.sqrt(stageCount));
|
|
191
|
+
const edges = [];
|
|
192
|
+
for(let index = 0; index < stageCount; index++){
|
|
193
|
+
const col = index % columns;
|
|
194
|
+
const sourceId = `performance-stage-${index}`;
|
|
195
|
+
const rightIndex = index + 1;
|
|
196
|
+
if (col < columns - 1 && rightIndex < stageCount) {
|
|
197
|
+
const targetId = `performance-stage-${rightIndex}`;
|
|
198
|
+
edges.push({
|
|
199
|
+
id: `performance-edge-right-${index}`,
|
|
200
|
+
type: 'stage',
|
|
201
|
+
source: sourceId,
|
|
202
|
+
sourceHandle: `${sourceId}____source____right`,
|
|
203
|
+
target: targetId,
|
|
204
|
+
targetHandle: `${targetId}____target____left`
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return edges;
|
|
209
|
+
}
|
|
210
|
+
const CanvasPerformanceStory = ()=>{
|
|
211
|
+
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
212
|
+
stage: StageNode_stories_utils_cjs_namespaceObject.StageNodeWrapper
|
|
213
|
+
}), []);
|
|
214
|
+
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
215
|
+
stage: StageEdge_cjs_namespaceObject.StageEdge
|
|
216
|
+
}), []);
|
|
217
|
+
const defaultEdgeOptions = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
218
|
+
type: 'stage'
|
|
219
|
+
}), []);
|
|
220
|
+
const [stageCount, setStageCount] = (0, external_react_namespaceObject.useState)(DEFAULT_STAGE_COUNT);
|
|
221
|
+
const [nodes, setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(createPerformanceStageNodes(DEFAULT_STAGE_COUNT));
|
|
222
|
+
const [edges, setEdges, onEdgesChange] = (0, react_cjs_namespaceObject.useEdgesState)(createPerformanceStageEdges(DEFAULT_STAGE_COUNT));
|
|
223
|
+
const onConnect = (0, external_react_namespaceObject.useCallback)((connection)=>setEdges((eds)=>(0, react_cjs_namespaceObject.addEdge)(connection, eds)), [
|
|
224
|
+
setEdges
|
|
225
|
+
]);
|
|
226
|
+
const handleStageCountChange = (0, external_react_namespaceObject.useCallback)((e)=>{
|
|
227
|
+
const nextCount = Number.parseInt(e.target.value, 10);
|
|
228
|
+
setStageCount(nextCount);
|
|
229
|
+
setNodes(createPerformanceStageNodes(nextCount));
|
|
230
|
+
setEdges(createPerformanceStageEdges(nextCount));
|
|
231
|
+
}, [
|
|
232
|
+
setEdges,
|
|
233
|
+
setNodes
|
|
234
|
+
]);
|
|
235
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
236
|
+
style: {
|
|
237
|
+
width: '100vw',
|
|
238
|
+
height: '100vh'
|
|
239
|
+
},
|
|
240
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.ReactFlowProvider, {
|
|
241
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.BaseCanvas, {
|
|
242
|
+
nodes: nodes,
|
|
243
|
+
edges: edges,
|
|
244
|
+
onNodesChange: onNodesChange,
|
|
245
|
+
onEdgesChange: onEdgesChange,
|
|
246
|
+
onConnect: onConnect,
|
|
247
|
+
nodeTypes: nodeTypes,
|
|
248
|
+
edgeTypes: edgeTypes,
|
|
249
|
+
mode: "design",
|
|
250
|
+
connectionMode: react_cjs_namespaceObject.ConnectionMode.Strict,
|
|
251
|
+
defaultEdgeOptions: defaultEdgeOptions,
|
|
252
|
+
connectionLineComponent: StageConnectionEdge_cjs_namespaceObject.StageConnectionEdge,
|
|
253
|
+
elevateEdgesOnSelect: true,
|
|
254
|
+
children: [
|
|
255
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Panel, {
|
|
256
|
+
position: "top-left",
|
|
257
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
258
|
+
className: "nodrag nopan nowheel",
|
|
259
|
+
style: {
|
|
260
|
+
width: 240,
|
|
261
|
+
background: 'var(--uix-canvas-background)',
|
|
262
|
+
border: '1px solid var(--uix-canvas-border-de-emp)',
|
|
263
|
+
borderRadius: 16,
|
|
264
|
+
padding: 16,
|
|
265
|
+
boxShadow: '0 8px 32px rgba(15, 23, 42, 0.08)'
|
|
266
|
+
},
|
|
267
|
+
children: [
|
|
268
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
269
|
+
style: {
|
|
270
|
+
fontWeight: 600,
|
|
271
|
+
fontSize: 14
|
|
272
|
+
},
|
|
273
|
+
children: "Performance Test"
|
|
274
|
+
}),
|
|
275
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
276
|
+
style: {
|
|
277
|
+
marginTop: 6,
|
|
278
|
+
color: 'var(--uix-canvas-foreground-de-emp)',
|
|
279
|
+
fontSize: 12,
|
|
280
|
+
lineHeight: 1.4
|
|
281
|
+
},
|
|
282
|
+
children: "Adjust the number of stage nodes to profile drag and pan performance."
|
|
283
|
+
}),
|
|
284
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
285
|
+
style: {
|
|
286
|
+
display: 'flex',
|
|
287
|
+
justifyContent: 'space-between',
|
|
288
|
+
alignItems: 'center',
|
|
289
|
+
marginTop: 12,
|
|
290
|
+
marginBottom: 8,
|
|
291
|
+
fontSize: 12
|
|
292
|
+
},
|
|
293
|
+
children: [
|
|
294
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
295
|
+
children: "Stage Count"
|
|
296
|
+
}),
|
|
297
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("strong", {
|
|
298
|
+
style: {
|
|
299
|
+
fontSize: 14
|
|
300
|
+
},
|
|
301
|
+
children: stageCount
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
}),
|
|
305
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("input", {
|
|
306
|
+
type: "range",
|
|
307
|
+
min: MIN_STAGE_COUNT,
|
|
308
|
+
max: MAX_STAGE_COUNT,
|
|
309
|
+
value: stageCount,
|
|
310
|
+
onChange: handleStageCountChange,
|
|
311
|
+
style: {
|
|
312
|
+
width: '100%',
|
|
313
|
+
cursor: 'pointer'
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
]
|
|
317
|
+
})
|
|
318
|
+
}),
|
|
319
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Panel, {
|
|
320
|
+
position: "bottom-right",
|
|
321
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasPositionControls_cjs_namespaceObject.CanvasPositionControls, {
|
|
322
|
+
translations: external_types_cjs_namespaceObject.DefaultCanvasTranslations
|
|
323
|
+
})
|
|
324
|
+
})
|
|
325
|
+
]
|
|
326
|
+
})
|
|
327
|
+
})
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
const StageWorkflow = {
|
|
331
|
+
name: 'Stage Workflow',
|
|
332
|
+
parameters: {
|
|
333
|
+
docs: {
|
|
334
|
+
description: {
|
|
335
|
+
story: 'Standalone performance story with adjustable stage count. Use this to profile stage workflow drag and pan behavior under load.'
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
render: ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CanvasPerformanceStory, {})
|
|
340
|
+
};
|
|
341
|
+
exports.StageWorkflow = __webpack_exports__.StageWorkflow;
|
|
342
|
+
exports["default"] = __webpack_exports__["default"];
|
|
343
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
344
|
+
"StageWorkflow",
|
|
345
|
+
"default"
|
|
346
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
347
|
+
Object.defineProperty(exports, '__esModule', {
|
|
348
|
+
value: true
|
|
349
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanvasPerformance.stories.d.ts","sourceRoot":"","sources":["../../../src/canvas/components/CanvasPerformance.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAmBvD,QAAA,MAAM,IAAI,EAAE,IAKX,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAmOnC,eAAO,MAAM,aAAa,EAAE,KAW3B,CAAC"}
|
|
@@ -0,0 +1,312 @@
|
|
|
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
|
+
}
|
|
179
|
+
return edges;
|
|
180
|
+
}
|
|
181
|
+
const CanvasPerformanceStory = ()=>{
|
|
182
|
+
const nodeTypes = useMemo(()=>({
|
|
183
|
+
stage: StageNodeWrapper
|
|
184
|
+
}), []);
|
|
185
|
+
const edgeTypes = useMemo(()=>({
|
|
186
|
+
stage: StageEdge
|
|
187
|
+
}), []);
|
|
188
|
+
const defaultEdgeOptions = useMemo(()=>({
|
|
189
|
+
type: 'stage'
|
|
190
|
+
}), []);
|
|
191
|
+
const [stageCount, setStageCount] = useState(DEFAULT_STAGE_COUNT);
|
|
192
|
+
const [nodes, setNodes, onNodesChange] = useNodesState(createPerformanceStageNodes(DEFAULT_STAGE_COUNT));
|
|
193
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState(createPerformanceStageEdges(DEFAULT_STAGE_COUNT));
|
|
194
|
+
const onConnect = useCallback((connection)=>setEdges((eds)=>addEdge(connection, eds)), [
|
|
195
|
+
setEdges
|
|
196
|
+
]);
|
|
197
|
+
const handleStageCountChange = useCallback((e)=>{
|
|
198
|
+
const nextCount = Number.parseInt(e.target.value, 10);
|
|
199
|
+
setStageCount(nextCount);
|
|
200
|
+
setNodes(createPerformanceStageNodes(nextCount));
|
|
201
|
+
setEdges(createPerformanceStageEdges(nextCount));
|
|
202
|
+
}, [
|
|
203
|
+
setEdges,
|
|
204
|
+
setNodes
|
|
205
|
+
]);
|
|
206
|
+
return /*#__PURE__*/ jsx("div", {
|
|
207
|
+
style: {
|
|
208
|
+
width: '100vw',
|
|
209
|
+
height: '100vh'
|
|
210
|
+
},
|
|
211
|
+
children: /*#__PURE__*/ jsx(ReactFlowProvider, {
|
|
212
|
+
children: /*#__PURE__*/ jsxs(BaseCanvas, {
|
|
213
|
+
nodes: nodes,
|
|
214
|
+
edges: edges,
|
|
215
|
+
onNodesChange: onNodesChange,
|
|
216
|
+
onEdgesChange: onEdgesChange,
|
|
217
|
+
onConnect: onConnect,
|
|
218
|
+
nodeTypes: nodeTypes,
|
|
219
|
+
edgeTypes: edgeTypes,
|
|
220
|
+
mode: "design",
|
|
221
|
+
connectionMode: ConnectionMode.Strict,
|
|
222
|
+
defaultEdgeOptions: defaultEdgeOptions,
|
|
223
|
+
connectionLineComponent: StageConnectionEdge,
|
|
224
|
+
elevateEdgesOnSelect: true,
|
|
225
|
+
children: [
|
|
226
|
+
/*#__PURE__*/ jsx(Panel, {
|
|
227
|
+
position: "top-left",
|
|
228
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
229
|
+
className: "nodrag nopan nowheel",
|
|
230
|
+
style: {
|
|
231
|
+
width: 240,
|
|
232
|
+
background: 'var(--uix-canvas-background)',
|
|
233
|
+
border: '1px solid var(--uix-canvas-border-de-emp)',
|
|
234
|
+
borderRadius: 16,
|
|
235
|
+
padding: 16,
|
|
236
|
+
boxShadow: '0 8px 32px rgba(15, 23, 42, 0.08)'
|
|
237
|
+
},
|
|
238
|
+
children: [
|
|
239
|
+
/*#__PURE__*/ jsx("div", {
|
|
240
|
+
style: {
|
|
241
|
+
fontWeight: 600,
|
|
242
|
+
fontSize: 14
|
|
243
|
+
},
|
|
244
|
+
children: "Performance Test"
|
|
245
|
+
}),
|
|
246
|
+
/*#__PURE__*/ jsx("div", {
|
|
247
|
+
style: {
|
|
248
|
+
marginTop: 6,
|
|
249
|
+
color: 'var(--uix-canvas-foreground-de-emp)',
|
|
250
|
+
fontSize: 12,
|
|
251
|
+
lineHeight: 1.4
|
|
252
|
+
},
|
|
253
|
+
children: "Adjust the number of stage nodes to profile drag and pan performance."
|
|
254
|
+
}),
|
|
255
|
+
/*#__PURE__*/ jsxs("div", {
|
|
256
|
+
style: {
|
|
257
|
+
display: 'flex',
|
|
258
|
+
justifyContent: 'space-between',
|
|
259
|
+
alignItems: 'center',
|
|
260
|
+
marginTop: 12,
|
|
261
|
+
marginBottom: 8,
|
|
262
|
+
fontSize: 12
|
|
263
|
+
},
|
|
264
|
+
children: [
|
|
265
|
+
/*#__PURE__*/ jsx("span", {
|
|
266
|
+
children: "Stage Count"
|
|
267
|
+
}),
|
|
268
|
+
/*#__PURE__*/ jsx("strong", {
|
|
269
|
+
style: {
|
|
270
|
+
fontSize: 14
|
|
271
|
+
},
|
|
272
|
+
children: stageCount
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
}),
|
|
276
|
+
/*#__PURE__*/ jsx("input", {
|
|
277
|
+
type: "range",
|
|
278
|
+
min: MIN_STAGE_COUNT,
|
|
279
|
+
max: MAX_STAGE_COUNT,
|
|
280
|
+
value: stageCount,
|
|
281
|
+
onChange: handleStageCountChange,
|
|
282
|
+
style: {
|
|
283
|
+
width: '100%',
|
|
284
|
+
cursor: 'pointer'
|
|
285
|
+
}
|
|
286
|
+
})
|
|
287
|
+
]
|
|
288
|
+
})
|
|
289
|
+
}),
|
|
290
|
+
/*#__PURE__*/ jsx(Panel, {
|
|
291
|
+
position: "bottom-right",
|
|
292
|
+
children: /*#__PURE__*/ jsx(CanvasPositionControls, {
|
|
293
|
+
translations: DefaultCanvasTranslations
|
|
294
|
+
})
|
|
295
|
+
})
|
|
296
|
+
]
|
|
297
|
+
})
|
|
298
|
+
})
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
const StageWorkflow = {
|
|
302
|
+
name: 'Stage Workflow',
|
|
303
|
+
parameters: {
|
|
304
|
+
docs: {
|
|
305
|
+
description: {
|
|
306
|
+
story: 'Standalone performance story with adjustable stage count. Use this to profile stage workflow drag and pan behavior under load.'
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
render: ()=>/*#__PURE__*/ jsx(CanvasPerformanceStory, {})
|
|
311
|
+
};
|
|
312
|
+
export { StageWorkflow, CanvasPerformance_stories as default };
|