@uipath/apollo-react 3.63.0 → 3.64.0-pr431.76f87cc
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/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 +125 -45
- 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 +129 -49
- package/dist/canvas/components/StageNode/StageNode.stories.cjs +321 -158
- package/dist/canvas/components/StageNode/StageNode.stories.d.ts +1 -0
- package/dist/canvas/components/StageNode/StageNode.stories.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.stories.js +314 -154
- package/dist/canvas/components/StageNode/StageNode.stories.utils.cjs +42 -0
- package/dist/canvas/components/StageNode/StageNode.stories.utils.d.ts +3 -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 +35 -2
- package/dist/canvas/components/StageNode/StageNode.styles.d.ts +8 -0
- package/dist/canvas/components/StageNode/StageNode.styles.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.styles.js +28 -1
- package/dist/canvas/components/StageNode/StageNode.types.cjs +26 -1
- package/dist/canvas/components/StageNode/StageNode.types.d.ts +23 -1
- package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.types.js +9 -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/Toolbox/Toolbox.cjs +3 -3
- package/dist/canvas/components/Toolbox/Toolbox.d.ts +3 -1
- package/dist/canvas/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/Toolbox.js +3 -3
- package/dist/canvas/icons/ExitConditionIcon.cjs +49 -0
- package/dist/canvas/icons/ExitConditionIcon.d.ts +5 -0
- package/dist/canvas/icons/ExitConditionIcon.d.ts.map +1 -0
- package/dist/canvas/icons/ExitConditionIcon.js +15 -0
- package/dist/canvas/icons/ReturnToOriginIcon.cjs +50 -0
- package/dist/canvas/icons/ReturnToOriginIcon.d.ts +5 -0
- package/dist/canvas/icons/ReturnToOriginIcon.d.ts.map +1 -0
- package/dist/canvas/icons/ReturnToOriginIcon.js +16 -0
- package/dist/canvas/icons/index.cjs +8 -0
- package/dist/canvas/icons/index.d.ts +2 -0
- package/dist/canvas/icons/index.d.ts.map +1 -1
- package/dist/canvas/icons/index.js +3 -1
- package/package.json +3 -3
|
@@ -1,24 +1,74 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
3
3
|
import { SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
4
|
-
import { FontVariantToken, Padding, Spacing } from "@uipath/apollo-core";
|
|
4
|
+
import { FontVariantToken, Icon, Padding, Spacing } from "@uipath/apollo-core";
|
|
5
5
|
import { Column, Row } from "../../layouts/index.js";
|
|
6
|
-
import { Position, useStore, useViewport } from "../../xyflow/react.js";
|
|
6
|
+
import { Position, useStore, useStoreApi, useViewport } from "../../xyflow/react.js";
|
|
7
7
|
import { ApIcon, ApIconButton, ApLink, ApTooltip, ApTypography } from "../../../material/index.js";
|
|
8
8
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { createPortal } from "react-dom";
|
|
10
|
+
import { EntryConditionIcon, ExitConditionIcon, ReturnToOriginIcon } from "../../icons/index.js";
|
|
10
11
|
import { useConnectedHandles } from "../BaseCanvas/ConnectedHandlesContext.js";
|
|
11
12
|
import { useButtonHandles } from "../ButtonHandle/useButtonHandles.js";
|
|
12
13
|
import { ExecutionStatusIcon } from "../ExecutionStatusIcon/index.js";
|
|
13
14
|
import { FloatingCanvasPanel } from "../FloatingCanvasPanel/index.js";
|
|
14
15
|
import { NodeContextMenu } from "../NodeContextMenu/index.js";
|
|
15
|
-
import {
|
|
16
|
+
import { useSetNodeSelection } from "../NodePropertiesPanel/hooks/index.js";
|
|
16
17
|
import { Toolbox } from "../Toolbox/index.js";
|
|
17
18
|
import { DraggableTask, TaskContent } from "./DraggableTask.js";
|
|
18
|
-
import { INDENTATION_WIDTH, STAGE_CONTENT_INSET, StageContainer, StageContent, StageHeader, StageParallelBracket, StageParallelLabel, StageTask, StageTaskGroup, StageTaskList, StageTitleContainer, StageTitleInput } from "./StageNode.styles.js";
|
|
19
|
+
import { INDENTATION_WIDTH, STAGE_CONTENT_INSET, StageChip, StageContainer, StageContent, StageHeader, StageHeaderChipsRow, StageParallelBracket, StageParallelLabel, StageTask, StageTaskGroup, StageTaskList, StageTitleContainer, StageTitleInput } from "./StageNode.styles.js";
|
|
20
|
+
import { StageHeaderChipType } from "./StageNode.types.js";
|
|
19
21
|
import { flattenTasks, getProjection, reorderTasks } from "./StageNode.utils.js";
|
|
20
22
|
import { getContextMenuItems, getDivider, getMenuItem } from "./StageNodeTaskUtilities.js";
|
|
21
|
-
const
|
|
23
|
+
const CHIP_ICONS = {
|
|
24
|
+
[StageHeaderChipType.Entry]: /*#__PURE__*/ jsx(EntryConditionIcon, {
|
|
25
|
+
w: Icon.IconXs,
|
|
26
|
+
h: Icon.IconXs
|
|
27
|
+
}),
|
|
28
|
+
[StageHeaderChipType.Exit]: /*#__PURE__*/ jsx(ExitConditionIcon, {
|
|
29
|
+
w: Icon.IconXs,
|
|
30
|
+
h: Icon.IconXs
|
|
31
|
+
}),
|
|
32
|
+
[StageHeaderChipType.ReturnToOrigin]: /*#__PURE__*/ jsx(ReturnToOriginIcon, {
|
|
33
|
+
w: Icon.IconXs,
|
|
34
|
+
h: Icon.IconXs
|
|
35
|
+
}),
|
|
36
|
+
[StageHeaderChipType.CaseExit]: /*#__PURE__*/ jsx(ApIcon, {
|
|
37
|
+
name: "close",
|
|
38
|
+
size: Icon.IconXs
|
|
39
|
+
}),
|
|
40
|
+
[StageHeaderChipType.CaseCompletion]: /*#__PURE__*/ jsx(ApIcon, {
|
|
41
|
+
name: "check-mark",
|
|
42
|
+
size: Icon.IconXs
|
|
43
|
+
})
|
|
44
|
+
};
|
|
45
|
+
const StageNode_StageTaskDragOverlay = /*#__PURE__*/ memo(function({ activeTask, isActiveTaskParallel, taskWidthStyle }) {
|
|
46
|
+
const { zoom } = useViewport();
|
|
47
|
+
const dragOverlayStyle = useMemo(()=>({
|
|
48
|
+
transform: `scale(${zoom})`,
|
|
49
|
+
transformOrigin: 'top left'
|
|
50
|
+
}), [
|
|
51
|
+
zoom
|
|
52
|
+
]);
|
|
53
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(DragOverlay, {
|
|
54
|
+
children: activeTask ? /*#__PURE__*/ jsx("div", {
|
|
55
|
+
style: dragOverlayStyle,
|
|
56
|
+
children: /*#__PURE__*/ jsx(StageTask, {
|
|
57
|
+
selected: true,
|
|
58
|
+
isParallel: isActiveTaskParallel,
|
|
59
|
+
style: {
|
|
60
|
+
cursor: 'grabbing',
|
|
61
|
+
...taskWidthStyle
|
|
62
|
+
},
|
|
63
|
+
children: /*#__PURE__*/ jsx(TaskContent, {
|
|
64
|
+
task: activeTask,
|
|
65
|
+
isDragging: true
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
}) : null
|
|
69
|
+
}), document.body);
|
|
70
|
+
});
|
|
71
|
+
const StageNodeInner = (props)=>{
|
|
22
72
|
const { dragging, selected, id, width, execution, stageDetails, addTaskLabel = 'Add task', addTaskLoading = false, replaceTaskLabel = 'Replace task', taskOptions = [], menuItems, pendingReplaceTask, onStageClick, onTaskAdd, onAddTaskFromToolbox, onTaskToolboxSearch, onTaskClick, onTaskGroupModification, onStageTitleChange, onTaskReorder, onReplaceTaskFromToolbox, onTaskPlay } = props;
|
|
23
73
|
const taskWidth = width ? width - STAGE_CONTENT_INSET : void 0;
|
|
24
74
|
const tasks = useMemo(()=>stageDetails?.tasks || [], [
|
|
@@ -38,9 +88,6 @@ const StageNodeComponent = (props)=>{
|
|
|
38
88
|
const status = execution?.stageStatus?.status;
|
|
39
89
|
const statusLabel = execution?.stageStatus?.label;
|
|
40
90
|
const stageDuration = execution?.stageStatus?.duration;
|
|
41
|
-
const reGroupTaskFunction = useMemo(()=>onTaskGroupModification || (()=>{}), [
|
|
42
|
-
onTaskGroupModification
|
|
43
|
-
]);
|
|
44
91
|
const isStageTitleEditable = !!onStageTitleChange && !isReadOnly;
|
|
45
92
|
const [isHovered, setIsHovered] = useState(false);
|
|
46
93
|
const [label, setLabel] = useState(props.stageDetails.label);
|
|
@@ -57,6 +104,7 @@ const StageNodeComponent = (props)=>{
|
|
|
57
104
|
taskIndex: -1
|
|
58
105
|
});
|
|
59
106
|
const isConnecting = useStore((state)=>!!state.connectionClickStartHandle);
|
|
107
|
+
const storeApi = useStoreApi();
|
|
60
108
|
const connectedHandleIds = useConnectedHandles(id);
|
|
61
109
|
const [isAddingTask, setIsAddingTask] = useState(false);
|
|
62
110
|
const [isReplacingTask, setIsReplacingTask] = useState(false);
|
|
@@ -96,7 +144,6 @@ const StageNodeComponent = (props)=>{
|
|
|
96
144
|
tasks,
|
|
97
145
|
activeDragId
|
|
98
146
|
]);
|
|
99
|
-
const { zoom } = useViewport();
|
|
100
147
|
const projected = useMemo(()=>{
|
|
101
148
|
if (!activeDragId || !overId) return null;
|
|
102
149
|
return getProjection(tasks, activeDragId, overId, offsetLeft);
|
|
@@ -179,18 +226,26 @@ const StageNodeComponent = (props)=>{
|
|
|
179
226
|
handleStageTitleClickToSave,
|
|
180
227
|
isStageTitleEditing
|
|
181
228
|
]);
|
|
182
|
-
const
|
|
229
|
+
const hasContextMenu = !!(onReplaceTaskFromToolbox || onTaskGroupModification);
|
|
230
|
+
const buildContextMenuItems = useCallback((groupIndex, taskIndex)=>{
|
|
231
|
+
const taskGroup = tasks[groupIndex] ?? [];
|
|
232
|
+
const isParallel = taskGroup.length > 1;
|
|
183
233
|
const items = [];
|
|
184
234
|
if (onReplaceTaskFromToolbox) {
|
|
185
235
|
items.push(getMenuItem('replace-task', 'Replace task', ()=>{
|
|
186
|
-
|
|
236
|
+
taskStateReference.current = {
|
|
237
|
+
isParallel,
|
|
238
|
+
groupIndex,
|
|
239
|
+
taskIndex
|
|
240
|
+
};
|
|
241
|
+
const taskId = taskGroup[taskIndex]?.id;
|
|
187
242
|
if (taskId) onTaskClick?.(taskId);
|
|
188
243
|
setIsReplacingTask(true);
|
|
189
244
|
}));
|
|
190
245
|
items.push(getDivider());
|
|
191
246
|
}
|
|
192
247
|
if (onTaskGroupModification) {
|
|
193
|
-
const reGroupOptions = getContextMenuItems(isParallel, groupIndex,
|
|
248
|
+
const reGroupOptions = getContextMenuItems(isParallel, groupIndex, tasks.length, taskIndex, taskGroup.length, (tasks[groupIndex - 1]?.length ?? 0) > 1, (tasks[groupIndex + 1]?.length ?? 0) > 1, onTaskGroupModification);
|
|
194
249
|
return [
|
|
195
250
|
...items,
|
|
196
251
|
...reGroupOptions
|
|
@@ -201,10 +256,9 @@ const StageNodeComponent = (props)=>{
|
|
|
201
256
|
onReplaceTaskFromToolbox,
|
|
202
257
|
onTaskClick,
|
|
203
258
|
onTaskGroupModification,
|
|
204
|
-
reGroupTaskFunction,
|
|
205
259
|
tasks
|
|
206
260
|
]);
|
|
207
|
-
const { setSelectedNodeId } =
|
|
261
|
+
const { setSelectedNodeId } = useSetNodeSelection();
|
|
208
262
|
const handleStageClick = useCallback(()=>{
|
|
209
263
|
onStageClick?.();
|
|
210
264
|
}, [
|
|
@@ -327,9 +381,9 @@ const StageNodeComponent = (props)=>{
|
|
|
327
381
|
setActiveDragId(event.active.id);
|
|
328
382
|
}, []);
|
|
329
383
|
const handleDragMove = useCallback((event)=>{
|
|
330
|
-
setOffsetLeft(event.delta.x /
|
|
384
|
+
setOffsetLeft(event.delta.x / storeApi.getState().transform[2]);
|
|
331
385
|
}, [
|
|
332
|
-
|
|
386
|
+
storeApi
|
|
333
387
|
]);
|
|
334
388
|
const handleDragOver = useCallback((event)=>{
|
|
335
389
|
setOverId(event.over?.id ?? null);
|
|
@@ -365,12 +419,6 @@ const StageNodeComponent = (props)=>{
|
|
|
365
419
|
} : void 0, [
|
|
366
420
|
taskWidth
|
|
367
421
|
]);
|
|
368
|
-
const dragOverlayStyle = useMemo(()=>({
|
|
369
|
-
transform: `scale(${zoom})`,
|
|
370
|
-
transformOrigin: 'top left'
|
|
371
|
-
}), [
|
|
372
|
-
zoom
|
|
373
|
-
]);
|
|
374
422
|
return /*#__PURE__*/ jsxs("div", {
|
|
375
423
|
"data-testid": `stage-${id}`,
|
|
376
424
|
style: {
|
|
@@ -431,6 +479,31 @@ const StageNodeComponent = (props)=>{
|
|
|
431
479
|
variant: FontVariantToken.fontSizeS,
|
|
432
480
|
color: "var(--uix-canvas-foreground-de-emp)",
|
|
433
481
|
children: stageDuration
|
|
482
|
+
}),
|
|
483
|
+
stageDetails.headerChips && stageDetails.headerChips.length > 0 && /*#__PURE__*/ jsx(StageHeaderChipsRow, {
|
|
484
|
+
children: stageDetails.headerChips.map((chip)=>{
|
|
485
|
+
const button = /*#__PURE__*/ jsxs(StageChip, {
|
|
486
|
+
type: "button",
|
|
487
|
+
"aria-label": 'string' == typeof chip.tooltip ? chip.tooltip : chip.type,
|
|
488
|
+
onClick: (e)=>{
|
|
489
|
+
e.stopPropagation();
|
|
490
|
+
chip.onClick?.();
|
|
491
|
+
},
|
|
492
|
+
children: [
|
|
493
|
+
CHIP_ICONS[chip.type],
|
|
494
|
+
void 0 !== chip.count && /*#__PURE__*/ jsx(ApTypography, {
|
|
495
|
+
variant: FontVariantToken.fontSizeS,
|
|
496
|
+
children: chip.count
|
|
497
|
+
})
|
|
498
|
+
]
|
|
499
|
+
}, chip.type);
|
|
500
|
+
if (chip.tooltip) return /*#__PURE__*/ jsx(ApTooltip, {
|
|
501
|
+
placement: "bottom",
|
|
502
|
+
content: chip.tooltip,
|
|
503
|
+
children: button
|
|
504
|
+
}, chip.type);
|
|
505
|
+
return button;
|
|
506
|
+
})
|
|
434
507
|
})
|
|
435
508
|
]
|
|
436
509
|
})
|
|
@@ -510,20 +583,14 @@ const StageNodeComponent = (props)=>{
|
|
|
510
583
|
taskExecution: taskExecution,
|
|
511
584
|
isSelected: selectedTaskId === task.id,
|
|
512
585
|
isParallel: isParallel,
|
|
513
|
-
|
|
586
|
+
groupIndex: groupIndex,
|
|
587
|
+
taskIndex: taskIndex,
|
|
514
588
|
onTaskClick: handleTaskClick,
|
|
515
589
|
projectedDepth: task.id === activeDragId && projected ? projected.depth : void 0,
|
|
516
590
|
onTaskPlay: onTaskPlay,
|
|
517
591
|
isDragDisabled: !onTaskReorder,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
onMenuOpen: ()=>{
|
|
521
|
-
taskStateReference.current = {
|
|
522
|
-
isParallel,
|
|
523
|
-
groupIndex,
|
|
524
|
-
taskIndex
|
|
525
|
-
};
|
|
526
|
-
}
|
|
592
|
+
...hasContextMenu && {
|
|
593
|
+
getContextMenuItems: buildContextMenuItems
|
|
527
594
|
}
|
|
528
595
|
}, task.id);
|
|
529
596
|
})
|
|
@@ -534,23 +601,11 @@ const StageNodeComponent = (props)=>{
|
|
|
534
601
|
})
|
|
535
602
|
})
|
|
536
603
|
}),
|
|
537
|
-
/*#__PURE__*/
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
isParallel: isActiveTaskParallel,
|
|
543
|
-
style: {
|
|
544
|
-
cursor: 'grabbing',
|
|
545
|
-
...taskWidthStyle
|
|
546
|
-
},
|
|
547
|
-
children: /*#__PURE__*/ jsx(TaskContent, {
|
|
548
|
-
task: activeTask,
|
|
549
|
-
isDragging: true
|
|
550
|
-
})
|
|
551
|
-
})
|
|
552
|
-
}) : null
|
|
553
|
-
}), document.body)
|
|
604
|
+
/*#__PURE__*/ jsx(StageNode_StageTaskDragOverlay, {
|
|
605
|
+
activeTask: activeTask,
|
|
606
|
+
isActiveTaskParallel: isActiveTaskParallel,
|
|
607
|
+
taskWidthStyle: taskWidthStyle
|
|
608
|
+
})
|
|
554
609
|
]
|
|
555
610
|
}) : /*#__PURE__*/ jsx(Column, {
|
|
556
611
|
py: 2,
|
|
@@ -604,5 +659,30 @@ const StageNodeComponent = (props)=>{
|
|
|
604
659
|
]
|
|
605
660
|
});
|
|
606
661
|
};
|
|
662
|
+
const StageNodeInnerMemo = /*#__PURE__*/ memo(StageNodeInner);
|
|
663
|
+
const StageNodeComponent = ({ dragging, selected, id, width, execution, stageDetails, addTaskLabel, addTaskLoading, replaceTaskLabel, taskOptions, menuItems, pendingReplaceTask, onStageClick, onTaskAdd, onAddTaskFromToolbox, onTaskToolboxSearch, onTaskClick, onTaskGroupModification, onStageTitleChange, onTaskReorder, onReplaceTaskFromToolbox, onTaskPlay })=>/*#__PURE__*/ jsx(StageNodeInnerMemo, {
|
|
664
|
+
dragging: dragging,
|
|
665
|
+
selected: selected,
|
|
666
|
+
id: id,
|
|
667
|
+
width: width,
|
|
668
|
+
execution: execution,
|
|
669
|
+
stageDetails: stageDetails,
|
|
670
|
+
addTaskLabel: addTaskLabel,
|
|
671
|
+
addTaskLoading: addTaskLoading,
|
|
672
|
+
replaceTaskLabel: replaceTaskLabel,
|
|
673
|
+
taskOptions: taskOptions,
|
|
674
|
+
menuItems: menuItems,
|
|
675
|
+
pendingReplaceTask: pendingReplaceTask,
|
|
676
|
+
onStageClick: onStageClick,
|
|
677
|
+
onTaskAdd: onTaskAdd,
|
|
678
|
+
onAddTaskFromToolbox: onAddTaskFromToolbox,
|
|
679
|
+
onTaskToolboxSearch: onTaskToolboxSearch,
|
|
680
|
+
onTaskClick: onTaskClick,
|
|
681
|
+
onTaskGroupModification: onTaskGroupModification,
|
|
682
|
+
onStageTitleChange: onStageTitleChange,
|
|
683
|
+
onTaskReorder: onTaskReorder,
|
|
684
|
+
onReplaceTaskFromToolbox: onReplaceTaskFromToolbox,
|
|
685
|
+
onTaskPlay: onTaskPlay
|
|
686
|
+
});
|
|
607
687
|
const StageNode = /*#__PURE__*/ memo(StageNodeComponent);
|
|
608
688
|
export { StageNode };
|