@uipath/apollo-react 3.63.1 → 3.64.0-pr431.cb6b0b8
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 +100 -47
- 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 +106 -53
- 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/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/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 +2 -2
|
@@ -1,24 +1,48 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { DndContext,
|
|
2
|
+
import { DndContext, 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,
|
|
6
|
+
import { Position, useStore, useStoreApi } 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
|
-
import {
|
|
9
|
+
import { EntryConditionIcon, ExitConditionIcon, ReturnToOriginIcon } from "../../icons/index.js";
|
|
10
10
|
import { useConnectedHandles } from "../BaseCanvas/ConnectedHandlesContext.js";
|
|
11
11
|
import { useButtonHandles } from "../ButtonHandle/useButtonHandles.js";
|
|
12
12
|
import { ExecutionStatusIcon } from "../ExecutionStatusIcon/index.js";
|
|
13
13
|
import { FloatingCanvasPanel } from "../FloatingCanvasPanel/index.js";
|
|
14
14
|
import { NodeContextMenu } from "../NodeContextMenu/index.js";
|
|
15
|
-
import {
|
|
15
|
+
import { useSetNodeSelection } from "../NodePropertiesPanel/hooks/index.js";
|
|
16
16
|
import { Toolbox } from "../Toolbox/index.js";
|
|
17
|
-
import { DraggableTask
|
|
18
|
-
import { INDENTATION_WIDTH, STAGE_CONTENT_INSET, StageContainer, StageContent, StageHeader, StageParallelBracket, StageParallelLabel,
|
|
17
|
+
import { DraggableTask } from "./DraggableTask.js";
|
|
18
|
+
import { INDENTATION_WIDTH, STAGE_CONTENT_INSET, StageChip, StageContainer, StageContent, StageHeader, StageHeaderChipsRow, StageParallelBracket, StageParallelLabel, StageTaskGroup, StageTaskList, StageTitleContainer, StageTitleInput } from "./StageNode.styles.js";
|
|
19
|
+
import { StageHeaderChipType } from "./StageNode.types.js";
|
|
19
20
|
import { flattenTasks, getProjection, reorderTasks } from "./StageNode.utils.js";
|
|
20
21
|
import { getContextMenuItems, getDivider, getMenuItem } from "./StageNodeTaskUtilities.js";
|
|
21
|
-
|
|
22
|
+
import { StageTaskDragOverlay } from "./StageTaskDragOverlay.js";
|
|
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 StageNodeInner = (props)=>{
|
|
22
46
|
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
47
|
const taskWidth = width ? width - STAGE_CONTENT_INSET : void 0;
|
|
24
48
|
const tasks = useMemo(()=>stageDetails?.tasks || [], [
|
|
@@ -38,9 +62,6 @@ const StageNodeComponent = (props)=>{
|
|
|
38
62
|
const status = execution?.stageStatus?.status;
|
|
39
63
|
const statusLabel = execution?.stageStatus?.label;
|
|
40
64
|
const stageDuration = execution?.stageStatus?.duration;
|
|
41
|
-
const reGroupTaskFunction = useMemo(()=>onTaskGroupModification || (()=>{}), [
|
|
42
|
-
onTaskGroupModification
|
|
43
|
-
]);
|
|
44
65
|
const isStageTitleEditable = !!onStageTitleChange && !isReadOnly;
|
|
45
66
|
const [isHovered, setIsHovered] = useState(false);
|
|
46
67
|
const [label, setLabel] = useState(props.stageDetails.label);
|
|
@@ -57,6 +78,7 @@ const StageNodeComponent = (props)=>{
|
|
|
57
78
|
taskIndex: -1
|
|
58
79
|
});
|
|
59
80
|
const isConnecting = useStore((state)=>!!state.connectionClickStartHandle);
|
|
81
|
+
const storeApi = useStoreApi();
|
|
60
82
|
const connectedHandleIds = useConnectedHandles(id);
|
|
61
83
|
const [isAddingTask, setIsAddingTask] = useState(false);
|
|
62
84
|
const [isReplacingTask, setIsReplacingTask] = useState(false);
|
|
@@ -96,7 +118,6 @@ const StageNodeComponent = (props)=>{
|
|
|
96
118
|
tasks,
|
|
97
119
|
activeDragId
|
|
98
120
|
]);
|
|
99
|
-
const { zoom } = useViewport();
|
|
100
121
|
const projected = useMemo(()=>{
|
|
101
122
|
if (!activeDragId || !overId) return null;
|
|
102
123
|
return getProjection(tasks, activeDragId, overId, offsetLeft);
|
|
@@ -179,18 +200,26 @@ const StageNodeComponent = (props)=>{
|
|
|
179
200
|
handleStageTitleClickToSave,
|
|
180
201
|
isStageTitleEditing
|
|
181
202
|
]);
|
|
182
|
-
const
|
|
203
|
+
const hasContextMenu = !!(onReplaceTaskFromToolbox || onTaskGroupModification);
|
|
204
|
+
const buildContextMenuItems = useCallback((groupIndex, taskIndex)=>{
|
|
205
|
+
const taskGroup = tasks[groupIndex] ?? [];
|
|
206
|
+
const isParallel = taskGroup.length > 1;
|
|
183
207
|
const items = [];
|
|
184
208
|
if (onReplaceTaskFromToolbox) {
|
|
185
209
|
items.push(getMenuItem('replace-task', 'Replace task', ()=>{
|
|
186
|
-
|
|
210
|
+
taskStateReference.current = {
|
|
211
|
+
isParallel,
|
|
212
|
+
groupIndex,
|
|
213
|
+
taskIndex
|
|
214
|
+
};
|
|
215
|
+
const taskId = taskGroup[taskIndex]?.id;
|
|
187
216
|
if (taskId) onTaskClick?.(taskId);
|
|
188
217
|
setIsReplacingTask(true);
|
|
189
218
|
}));
|
|
190
219
|
items.push(getDivider());
|
|
191
220
|
}
|
|
192
221
|
if (onTaskGroupModification) {
|
|
193
|
-
const reGroupOptions = getContextMenuItems(isParallel, groupIndex,
|
|
222
|
+
const reGroupOptions = getContextMenuItems(isParallel, groupIndex, tasks.length, taskIndex, taskGroup.length, (tasks[groupIndex - 1]?.length ?? 0) > 1, (tasks[groupIndex + 1]?.length ?? 0) > 1, onTaskGroupModification);
|
|
194
223
|
return [
|
|
195
224
|
...items,
|
|
196
225
|
...reGroupOptions
|
|
@@ -201,10 +230,9 @@ const StageNodeComponent = (props)=>{
|
|
|
201
230
|
onReplaceTaskFromToolbox,
|
|
202
231
|
onTaskClick,
|
|
203
232
|
onTaskGroupModification,
|
|
204
|
-
reGroupTaskFunction,
|
|
205
233
|
tasks
|
|
206
234
|
]);
|
|
207
|
-
const { setSelectedNodeId } =
|
|
235
|
+
const { setSelectedNodeId } = useSetNodeSelection();
|
|
208
236
|
const handleStageClick = useCallback(()=>{
|
|
209
237
|
onStageClick?.();
|
|
210
238
|
}, [
|
|
@@ -327,9 +355,9 @@ const StageNodeComponent = (props)=>{
|
|
|
327
355
|
setActiveDragId(event.active.id);
|
|
328
356
|
}, []);
|
|
329
357
|
const handleDragMove = useCallback((event)=>{
|
|
330
|
-
setOffsetLeft(event.delta.x /
|
|
358
|
+
setOffsetLeft(event.delta.x / storeApi.getState().transform[2]);
|
|
331
359
|
}, [
|
|
332
|
-
|
|
360
|
+
storeApi
|
|
333
361
|
]);
|
|
334
362
|
const handleDragOver = useCallback((event)=>{
|
|
335
363
|
setOverId(event.over?.id ?? null);
|
|
@@ -365,12 +393,6 @@ const StageNodeComponent = (props)=>{
|
|
|
365
393
|
} : void 0, [
|
|
366
394
|
taskWidth
|
|
367
395
|
]);
|
|
368
|
-
const dragOverlayStyle = useMemo(()=>({
|
|
369
|
-
transform: `scale(${zoom})`,
|
|
370
|
-
transformOrigin: 'top left'
|
|
371
|
-
}), [
|
|
372
|
-
zoom
|
|
373
|
-
]);
|
|
374
396
|
return /*#__PURE__*/ jsxs("div", {
|
|
375
397
|
"data-testid": `stage-${id}`,
|
|
376
398
|
style: {
|
|
@@ -431,6 +453,31 @@ const StageNodeComponent = (props)=>{
|
|
|
431
453
|
variant: FontVariantToken.fontSizeS,
|
|
432
454
|
color: "var(--uix-canvas-foreground-de-emp)",
|
|
433
455
|
children: stageDuration
|
|
456
|
+
}),
|
|
457
|
+
stageDetails.headerChips && stageDetails.headerChips.length > 0 && /*#__PURE__*/ jsx(StageHeaderChipsRow, {
|
|
458
|
+
children: stageDetails.headerChips.map((chip)=>{
|
|
459
|
+
const button = /*#__PURE__*/ jsxs(StageChip, {
|
|
460
|
+
type: "button",
|
|
461
|
+
"aria-label": 'string' == typeof chip.tooltip ? chip.tooltip : chip.type,
|
|
462
|
+
onClick: (e)=>{
|
|
463
|
+
e.stopPropagation();
|
|
464
|
+
chip.onClick?.();
|
|
465
|
+
},
|
|
466
|
+
children: [
|
|
467
|
+
CHIP_ICONS[chip.type],
|
|
468
|
+
void 0 !== chip.count && /*#__PURE__*/ jsx(ApTypography, {
|
|
469
|
+
variant: FontVariantToken.fontSizeS,
|
|
470
|
+
children: chip.count
|
|
471
|
+
})
|
|
472
|
+
]
|
|
473
|
+
}, chip.type);
|
|
474
|
+
if (chip.tooltip) return /*#__PURE__*/ jsx(ApTooltip, {
|
|
475
|
+
placement: "bottom",
|
|
476
|
+
content: chip.tooltip,
|
|
477
|
+
children: button
|
|
478
|
+
}, chip.type);
|
|
479
|
+
return button;
|
|
480
|
+
})
|
|
434
481
|
})
|
|
435
482
|
]
|
|
436
483
|
})
|
|
@@ -510,20 +557,14 @@ const StageNodeComponent = (props)=>{
|
|
|
510
557
|
taskExecution: taskExecution,
|
|
511
558
|
isSelected: selectedTaskId === task.id,
|
|
512
559
|
isParallel: isParallel,
|
|
513
|
-
|
|
560
|
+
groupIndex: groupIndex,
|
|
561
|
+
taskIndex: taskIndex,
|
|
514
562
|
onTaskClick: handleTaskClick,
|
|
515
563
|
projectedDepth: task.id === activeDragId && projected ? projected.depth : void 0,
|
|
516
564
|
onTaskPlay: onTaskPlay,
|
|
517
565
|
isDragDisabled: !onTaskReorder,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
onMenuOpen: ()=>{
|
|
521
|
-
taskStateReference.current = {
|
|
522
|
-
isParallel,
|
|
523
|
-
groupIndex,
|
|
524
|
-
taskIndex
|
|
525
|
-
};
|
|
526
|
-
}
|
|
566
|
+
...hasContextMenu && {
|
|
567
|
+
getContextMenuItems: buildContextMenuItems
|
|
527
568
|
}
|
|
528
569
|
}, task.id);
|
|
529
570
|
})
|
|
@@ -534,23 +575,11 @@ const StageNodeComponent = (props)=>{
|
|
|
534
575
|
})
|
|
535
576
|
})
|
|
536
577
|
}),
|
|
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)
|
|
578
|
+
/*#__PURE__*/ jsx(StageTaskDragOverlay, {
|
|
579
|
+
activeTask: activeTask,
|
|
580
|
+
isActiveTaskParallel: isActiveTaskParallel,
|
|
581
|
+
taskWidthStyle: taskWidthStyle
|
|
582
|
+
})
|
|
554
583
|
]
|
|
555
584
|
}) : /*#__PURE__*/ jsx(Column, {
|
|
556
585
|
py: 2,
|
|
@@ -604,5 +633,29 @@ const StageNodeComponent = (props)=>{
|
|
|
604
633
|
]
|
|
605
634
|
});
|
|
606
635
|
};
|
|
607
|
-
const
|
|
636
|
+
const StageNodeInnerMemo = /*#__PURE__*/ memo(StageNodeInner);
|
|
637
|
+
const StageNode = ({ 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, {
|
|
638
|
+
dragging: dragging,
|
|
639
|
+
selected: selected,
|
|
640
|
+
id: id,
|
|
641
|
+
width: width,
|
|
642
|
+
execution: execution,
|
|
643
|
+
stageDetails: stageDetails,
|
|
644
|
+
addTaskLabel: addTaskLabel,
|
|
645
|
+
addTaskLoading: addTaskLoading,
|
|
646
|
+
replaceTaskLabel: replaceTaskLabel,
|
|
647
|
+
taskOptions: taskOptions,
|
|
648
|
+
menuItems: menuItems,
|
|
649
|
+
pendingReplaceTask: pendingReplaceTask,
|
|
650
|
+
onStageClick: onStageClick,
|
|
651
|
+
onTaskAdd: onTaskAdd,
|
|
652
|
+
onAddTaskFromToolbox: onAddTaskFromToolbox,
|
|
653
|
+
onTaskToolboxSearch: onTaskToolboxSearch,
|
|
654
|
+
onTaskClick: onTaskClick,
|
|
655
|
+
onTaskGroupModification: onTaskGroupModification,
|
|
656
|
+
onStageTitleChange: onStageTitleChange,
|
|
657
|
+
onTaskReorder: onTaskReorder,
|
|
658
|
+
onReplaceTaskFromToolbox: onReplaceTaskFromToolbox,
|
|
659
|
+
onTaskPlay: onTaskPlay
|
|
660
|
+
});
|
|
608
661
|
export { StageNode };
|