@uipath/apollo-react 3.62.1 → 3.63.0-pr431.329c320
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 +360 -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 +323 -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 +6 -4
- 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 +6 -4
- package/dist/canvas/components/StageNode/DraggableTask.types.d.ts +1 -2
- 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 +69 -38
- 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 +71 -40
- package/dist/canvas/components/StageNode/StageNode.stories.cjs +116 -157
- package/dist/canvas/components/StageNode/StageNode.stories.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.stories.js +112 -153
- 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.types.d.ts +9 -1
- package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/TaskMenu.cjs +13 -15
- package/dist/canvas/components/StageNode/TaskMenu.d.ts +1 -1
- package/dist/canvas/components/StageNode/TaskMenu.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/TaskMenu.js +14 -16
- package/dist/canvas/components/TaskIcon/TaskIcon.styles.cjs +1 -1
- package/dist/canvas/components/TaskIcon/TaskIcon.styles.js +1 -1
- package/dist/canvas/icons/CaseManagementProject.cjs +9 -18
- package/dist/canvas/icons/CaseManagementProject.d.ts.map +1 -1
- package/dist/canvas/icons/CaseManagementProject.js +9 -18
- package/package.json +3 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { StageNodeProps } from './StageNode.types';
|
|
2
|
-
export declare const StageNode: import("react").MemoExoticComponent<(
|
|
2
|
+
export declare const StageNode: import("react").MemoExoticComponent<({ dragging, selected, id, width, execution, stageDetails, addTaskLabel, addTaskLoading, replaceTaskLabel, taskOptions, menuItems, pendingReplaceTask, onStageClick, onTaskAdd, onAddTaskFromToolbox, onTaskToolboxSearch, onTaskClick, onTaskGroupModification, onStageTitleChange, onTaskReorder, onReplaceTaskFromToolbox, onTaskPlay, }: StageNodeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
3
|
//# sourceMappingURL=StageNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StageNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StageNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNode.tsx"],"names":[],"mappings":"AA0DA,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAotB3B,eAAO,MAAM,SAAS,mXA7BnB,cAAc,6CA6BgC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter,
|
|
|
3
3
|
import { SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
4
4
|
import { FontVariantToken, 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";
|
|
@@ -12,13 +12,39 @@ 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
17
|
import { DraggableTask, TaskContent } from "./DraggableTask.js";
|
|
18
18
|
import { INDENTATION_WIDTH, STAGE_CONTENT_INSET, StageContainer, StageContent, StageHeader, StageParallelBracket, StageParallelLabel, StageTask, StageTaskGroup, StageTaskList, StageTitleContainer, StageTitleInput } from "./StageNode.styles.js";
|
|
19
19
|
import { flattenTasks, getProjection, reorderTasks } from "./StageNode.utils.js";
|
|
20
20
|
import { getContextMenuItems, getDivider, getMenuItem } from "./StageNodeTaskUtilities.js";
|
|
21
|
-
const
|
|
21
|
+
const StageNode_StageTaskDragOverlay = /*#__PURE__*/ memo(function({ activeTask, isActiveTaskParallel, taskWidthStyle }) {
|
|
22
|
+
const { zoom } = useViewport();
|
|
23
|
+
const dragOverlayStyle = useMemo(()=>({
|
|
24
|
+
transform: `scale(${zoom})`,
|
|
25
|
+
transformOrigin: 'top left'
|
|
26
|
+
}), [
|
|
27
|
+
zoom
|
|
28
|
+
]);
|
|
29
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(DragOverlay, {
|
|
30
|
+
children: activeTask ? /*#__PURE__*/ jsx("div", {
|
|
31
|
+
style: dragOverlayStyle,
|
|
32
|
+
children: /*#__PURE__*/ jsx(StageTask, {
|
|
33
|
+
selected: true,
|
|
34
|
+
isParallel: isActiveTaskParallel,
|
|
35
|
+
style: {
|
|
36
|
+
cursor: 'grabbing',
|
|
37
|
+
...taskWidthStyle
|
|
38
|
+
},
|
|
39
|
+
children: /*#__PURE__*/ jsx(TaskContent, {
|
|
40
|
+
task: activeTask,
|
|
41
|
+
isDragging: true
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
}) : null
|
|
45
|
+
}), document.body);
|
|
46
|
+
});
|
|
47
|
+
const StageNodeInner = (props)=>{
|
|
22
48
|
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
49
|
const taskWidth = width ? width - STAGE_CONTENT_INSET : void 0;
|
|
24
50
|
const tasks = useMemo(()=>stageDetails?.tasks || [], [
|
|
@@ -38,9 +64,6 @@ const StageNodeComponent = (props)=>{
|
|
|
38
64
|
const status = execution?.stageStatus?.status;
|
|
39
65
|
const statusLabel = execution?.stageStatus?.label;
|
|
40
66
|
const stageDuration = execution?.stageStatus?.duration;
|
|
41
|
-
const reGroupTaskFunction = useMemo(()=>onTaskGroupModification || (()=>{}), [
|
|
42
|
-
onTaskGroupModification
|
|
43
|
-
]);
|
|
44
67
|
const isStageTitleEditable = !!onStageTitleChange && !isReadOnly;
|
|
45
68
|
const [isHovered, setIsHovered] = useState(false);
|
|
46
69
|
const [label, setLabel] = useState(props.stageDetails.label);
|
|
@@ -57,6 +80,7 @@ const StageNodeComponent = (props)=>{
|
|
|
57
80
|
taskIndex: -1
|
|
58
81
|
});
|
|
59
82
|
const isConnecting = useStore((state)=>!!state.connectionClickStartHandle);
|
|
83
|
+
const storeApi = useStoreApi();
|
|
60
84
|
const connectedHandleIds = useConnectedHandles(id);
|
|
61
85
|
const [isAddingTask, setIsAddingTask] = useState(false);
|
|
62
86
|
const [isReplacingTask, setIsReplacingTask] = useState(false);
|
|
@@ -96,7 +120,6 @@ const StageNodeComponent = (props)=>{
|
|
|
96
120
|
tasks,
|
|
97
121
|
activeDragId
|
|
98
122
|
]);
|
|
99
|
-
const { zoom } = useViewport();
|
|
100
123
|
const projected = useMemo(()=>{
|
|
101
124
|
if (!activeDragId || !overId) return null;
|
|
102
125
|
return getProjection(tasks, activeDragId, overId, offsetLeft);
|
|
@@ -179,18 +202,21 @@ const StageNodeComponent = (props)=>{
|
|
|
179
202
|
handleStageTitleClickToSave,
|
|
180
203
|
isStageTitleEditing
|
|
181
204
|
]);
|
|
182
|
-
const
|
|
205
|
+
const hasContextMenu = !!(onReplaceTaskFromToolbox || onTaskGroupModification);
|
|
206
|
+
const buildContextMenuItems = useCallback((groupIndex, taskIndex)=>{
|
|
207
|
+
const taskGroup = tasks[groupIndex] ?? [];
|
|
208
|
+
const isParallel = taskGroup.length > 1;
|
|
183
209
|
const items = [];
|
|
184
210
|
if (onReplaceTaskFromToolbox) {
|
|
185
211
|
items.push(getMenuItem('replace-task', 'Replace task', ()=>{
|
|
186
|
-
const taskId =
|
|
212
|
+
const taskId = taskGroup[taskIndex]?.id;
|
|
187
213
|
if (taskId) onTaskClick?.(taskId);
|
|
188
214
|
setIsReplacingTask(true);
|
|
189
215
|
}));
|
|
190
216
|
items.push(getDivider());
|
|
191
217
|
}
|
|
192
218
|
if (onTaskGroupModification) {
|
|
193
|
-
const reGroupOptions = getContextMenuItems(isParallel, groupIndex,
|
|
219
|
+
const reGroupOptions = getContextMenuItems(isParallel, groupIndex, tasks.length, taskIndex, taskGroup.length, (tasks[groupIndex - 1]?.length ?? 0) > 1, (tasks[groupIndex + 1]?.length ?? 0) > 1, onTaskGroupModification);
|
|
194
220
|
return [
|
|
195
221
|
...items,
|
|
196
222
|
...reGroupOptions
|
|
@@ -201,10 +227,9 @@ const StageNodeComponent = (props)=>{
|
|
|
201
227
|
onReplaceTaskFromToolbox,
|
|
202
228
|
onTaskClick,
|
|
203
229
|
onTaskGroupModification,
|
|
204
|
-
reGroupTaskFunction,
|
|
205
230
|
tasks
|
|
206
231
|
]);
|
|
207
|
-
const { setSelectedNodeId } =
|
|
232
|
+
const { setSelectedNodeId } = useSetNodeSelection();
|
|
208
233
|
const handleStageClick = useCallback(()=>{
|
|
209
234
|
onStageClick?.();
|
|
210
235
|
}, [
|
|
@@ -327,9 +352,9 @@ const StageNodeComponent = (props)=>{
|
|
|
327
352
|
setActiveDragId(event.active.id);
|
|
328
353
|
}, []);
|
|
329
354
|
const handleDragMove = useCallback((event)=>{
|
|
330
|
-
setOffsetLeft(event.delta.x /
|
|
355
|
+
setOffsetLeft(event.delta.x / storeApi.getState().transform[2]);
|
|
331
356
|
}, [
|
|
332
|
-
|
|
357
|
+
storeApi
|
|
333
358
|
]);
|
|
334
359
|
const handleDragOver = useCallback((event)=>{
|
|
335
360
|
setOverId(event.over?.id ?? null);
|
|
@@ -365,12 +390,6 @@ const StageNodeComponent = (props)=>{
|
|
|
365
390
|
} : void 0, [
|
|
366
391
|
taskWidth
|
|
367
392
|
]);
|
|
368
|
-
const dragOverlayStyle = useMemo(()=>({
|
|
369
|
-
transform: `scale(${zoom})`,
|
|
370
|
-
transformOrigin: 'top left'
|
|
371
|
-
}), [
|
|
372
|
-
zoom
|
|
373
|
-
]);
|
|
374
393
|
return /*#__PURE__*/ jsxs("div", {
|
|
375
394
|
"data-testid": `stage-${id}`,
|
|
376
395
|
style: {
|
|
@@ -510,13 +529,12 @@ const StageNodeComponent = (props)=>{
|
|
|
510
529
|
taskExecution: taskExecution,
|
|
511
530
|
isSelected: selectedTaskId === task.id,
|
|
512
531
|
isParallel: isParallel,
|
|
513
|
-
contextMenuItems: contextMenuItems(isParallel, groupIndex, taskIndex, tasks.length, taskGroup.length, (tasks[groupIndex - 1]?.length ?? 0) > 1, (tasks[groupIndex + 1]?.length ?? 0) > 1),
|
|
514
532
|
onTaskClick: handleTaskClick,
|
|
515
533
|
projectedDepth: task.id === activeDragId && projected ? projected.depth : void 0,
|
|
516
534
|
onTaskPlay: onTaskPlay,
|
|
517
535
|
isDragDisabled: !onTaskReorder,
|
|
518
|
-
|
|
519
|
-
|
|
536
|
+
...hasContextMenu && {
|
|
537
|
+
getContextMenuItems: ()=>buildContextMenuItems(groupIndex, taskIndex),
|
|
520
538
|
onMenuOpen: ()=>{
|
|
521
539
|
taskStateReference.current = {
|
|
522
540
|
isParallel,
|
|
@@ -534,23 +552,11 @@ const StageNodeComponent = (props)=>{
|
|
|
534
552
|
})
|
|
535
553
|
})
|
|
536
554
|
}),
|
|
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)
|
|
555
|
+
/*#__PURE__*/ jsx(StageNode_StageTaskDragOverlay, {
|
|
556
|
+
activeTask: activeTask,
|
|
557
|
+
isActiveTaskParallel: isActiveTaskParallel,
|
|
558
|
+
taskWidthStyle: taskWidthStyle
|
|
559
|
+
})
|
|
554
560
|
]
|
|
555
561
|
}) : /*#__PURE__*/ jsx(Column, {
|
|
556
562
|
py: 2,
|
|
@@ -604,5 +610,30 @@ const StageNodeComponent = (props)=>{
|
|
|
604
610
|
]
|
|
605
611
|
});
|
|
606
612
|
};
|
|
613
|
+
const StageNodeInnerMemo = /*#__PURE__*/ memo(StageNodeInner);
|
|
614
|
+
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, {
|
|
615
|
+
dragging: dragging,
|
|
616
|
+
selected: selected,
|
|
617
|
+
id: id,
|
|
618
|
+
width: width,
|
|
619
|
+
execution: execution,
|
|
620
|
+
stageDetails: stageDetails,
|
|
621
|
+
addTaskLabel: addTaskLabel,
|
|
622
|
+
addTaskLoading: addTaskLoading,
|
|
623
|
+
replaceTaskLabel: replaceTaskLabel,
|
|
624
|
+
taskOptions: taskOptions,
|
|
625
|
+
menuItems: menuItems,
|
|
626
|
+
pendingReplaceTask: pendingReplaceTask,
|
|
627
|
+
onStageClick: onStageClick,
|
|
628
|
+
onTaskAdd: onTaskAdd,
|
|
629
|
+
onAddTaskFromToolbox: onAddTaskFromToolbox,
|
|
630
|
+
onTaskToolboxSearch: onTaskToolboxSearch,
|
|
631
|
+
onTaskClick: onTaskClick,
|
|
632
|
+
onTaskGroupModification: onTaskGroupModification,
|
|
633
|
+
onStageTitleChange: onStageTitleChange,
|
|
634
|
+
onTaskReorder: onTaskReorder,
|
|
635
|
+
onReplaceTaskFromToolbox: onReplaceTaskFromToolbox,
|
|
636
|
+
onTaskPlay: onTaskPlay
|
|
637
|
+
});
|
|
607
638
|
const StageNode = /*#__PURE__*/ memo(StageNodeComponent);
|
|
608
639
|
export { StageNode };
|
|
@@ -48,6 +48,53 @@ const external_TaskIcon_index_cjs_namespaceObject = require("../TaskIcon/index.c
|
|
|
48
48
|
const external_StageConnectionEdge_cjs_namespaceObject = require("./StageConnectionEdge.cjs");
|
|
49
49
|
const external_StageEdge_cjs_namespaceObject = require("./StageEdge.cjs");
|
|
50
50
|
const external_StageNode_cjs_namespaceObject = require("./StageNode.cjs");
|
|
51
|
+
const external_StageNode_stories_utils_cjs_namespaceObject = require("./StageNode.stories.utils.cjs");
|
|
52
|
+
const DefaultCanvasDecorator = ({ initialNodes, initialEdges = [] })=>{
|
|
53
|
+
const [nodes, _setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(initialNodes);
|
|
54
|
+
const [edges, setEdges, onEdgesChange] = (0, react_cjs_namespaceObject.useEdgesState)(initialEdges);
|
|
55
|
+
const onConnect = (0, external_react_namespaceObject.useCallback)((connection)=>{
|
|
56
|
+
setEdges((eds)=>(0, react_cjs_namespaceObject.addEdge)(connection, eds));
|
|
57
|
+
}, [
|
|
58
|
+
setEdges
|
|
59
|
+
]);
|
|
60
|
+
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
61
|
+
stage: external_StageNode_stories_utils_cjs_namespaceObject.StageNodeWrapper
|
|
62
|
+
}), []);
|
|
63
|
+
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
64
|
+
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
65
|
+
}), []);
|
|
66
|
+
const defaultEdgeOptions = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
67
|
+
type: 'stage'
|
|
68
|
+
}), []);
|
|
69
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
70
|
+
style: {
|
|
71
|
+
width: '100vw',
|
|
72
|
+
height: '100vh'
|
|
73
|
+
},
|
|
74
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.ReactFlowProvider, {
|
|
75
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseCanvas_index_cjs_namespaceObject.BaseCanvas, {
|
|
76
|
+
nodes: nodes,
|
|
77
|
+
edges: edges,
|
|
78
|
+
onNodesChange: onNodesChange,
|
|
79
|
+
onEdgesChange: onEdgesChange,
|
|
80
|
+
onConnect: onConnect,
|
|
81
|
+
nodeTypes: nodeTypes,
|
|
82
|
+
edgeTypes: edgeTypes,
|
|
83
|
+
mode: "design",
|
|
84
|
+
connectionMode: react_cjs_namespaceObject.ConnectionMode.Strict,
|
|
85
|
+
defaultEdgeOptions: defaultEdgeOptions,
|
|
86
|
+
connectionLineComponent: external_StageConnectionEdge_cjs_namespaceObject.StageConnectionEdge,
|
|
87
|
+
elevateEdgesOnSelect: true,
|
|
88
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Panel, {
|
|
89
|
+
position: "bottom-right",
|
|
90
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasPositionControls_cjs_namespaceObject.CanvasPositionControls, {
|
|
91
|
+
translations: external_types_cjs_namespaceObject.DefaultCanvasTranslations
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
};
|
|
51
98
|
const meta = {
|
|
52
99
|
title: 'Canvas/StageNode',
|
|
53
100
|
component: external_StageNode_cjs_namespaceObject.StageNode,
|
|
@@ -57,10 +104,6 @@ const meta = {
|
|
|
57
104
|
decorators: [
|
|
58
105
|
(Story, context)=>{
|
|
59
106
|
if (context.parameters?.useCustomRender) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Story, {});
|
|
60
|
-
const StageNodeWrapper = (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StageNode_cjs_namespaceObject.StageNode, {
|
|
61
|
-
...props,
|
|
62
|
-
...props.data
|
|
63
|
-
});
|
|
64
107
|
const initialNodes = context.parameters?.nodes || [
|
|
65
108
|
{
|
|
66
109
|
id: '1',
|
|
@@ -80,51 +123,9 @@ const meta = {
|
|
|
80
123
|
}
|
|
81
124
|
];
|
|
82
125
|
const initialEdges = context.parameters?.edges || [];
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
setEdges((eds)=>(0, react_cjs_namespaceObject.addEdge)(connection, eds));
|
|
87
|
-
}, [
|
|
88
|
-
setEdges
|
|
89
|
-
]);
|
|
90
|
-
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
91
|
-
stage: StageNodeWrapper
|
|
92
|
-
}), [
|
|
93
|
-
StageNodeWrapper
|
|
94
|
-
]);
|
|
95
|
-
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
96
|
-
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
97
|
-
}), []);
|
|
98
|
-
const defaultEdgeOptions = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
99
|
-
type: 'stage'
|
|
100
|
-
}), []);
|
|
101
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
102
|
-
style: {
|
|
103
|
-
width: '100vw',
|
|
104
|
-
height: '100vh'
|
|
105
|
-
},
|
|
106
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.ReactFlowProvider, {
|
|
107
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseCanvas_index_cjs_namespaceObject.BaseCanvas, {
|
|
108
|
-
nodes: nodes,
|
|
109
|
-
edges: edges,
|
|
110
|
-
onNodesChange: onNodesChange,
|
|
111
|
-
onEdgesChange: onEdgesChange,
|
|
112
|
-
onConnect: onConnect,
|
|
113
|
-
nodeTypes: nodeTypes,
|
|
114
|
-
edgeTypes: edgeTypes,
|
|
115
|
-
mode: "design",
|
|
116
|
-
connectionMode: react_cjs_namespaceObject.ConnectionMode.Strict,
|
|
117
|
-
defaultEdgeOptions: defaultEdgeOptions,
|
|
118
|
-
connectionLineComponent: external_StageConnectionEdge_cjs_namespaceObject.StageConnectionEdge,
|
|
119
|
-
elevateEdgesOnSelect: true,
|
|
120
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Panel, {
|
|
121
|
-
position: "bottom-right",
|
|
122
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasPositionControls_cjs_namespaceObject.CanvasPositionControls, {
|
|
123
|
-
translations: external_types_cjs_namespaceObject.DefaultCanvasTranslations
|
|
124
|
-
})
|
|
125
|
-
})
|
|
126
|
-
})
|
|
127
|
-
})
|
|
126
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(DefaultCanvasDecorator, {
|
|
127
|
+
initialNodes: initialNodes,
|
|
128
|
+
initialEdges: initialEdges
|
|
128
129
|
});
|
|
129
130
|
}
|
|
130
131
|
],
|
|
@@ -200,7 +201,7 @@ const DocumentIcon = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("sv
|
|
|
200
201
|
strokeWidth: "1.5",
|
|
201
202
|
children: [
|
|
202
203
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
203
|
-
d: "M14 2H6C4.9 2 4 2.9 4
|
|
204
|
+
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"
|
|
204
205
|
}),
|
|
205
206
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
206
207
|
d: "M14 2V8H20"
|
|
@@ -1311,17 +1312,9 @@ const initialTasks = [
|
|
|
1311
1312
|
]
|
|
1312
1313
|
];
|
|
1313
1314
|
const DraggableTaskReorderingStory = ()=>{
|
|
1314
|
-
const StageNodeWrapper = (0, external_react_namespaceObject.useMemo)(()=>function(props) {
|
|
1315
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StageNode_cjs_namespaceObject.StageNode, {
|
|
1316
|
-
...props,
|
|
1317
|
-
...props.data
|
|
1318
|
-
});
|
|
1319
|
-
}, []);
|
|
1320
1315
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1321
|
-
stage: StageNodeWrapper
|
|
1322
|
-
}), [
|
|
1323
|
-
StageNodeWrapper
|
|
1324
|
-
]);
|
|
1316
|
+
stage: external_StageNode_stories_utils_cjs_namespaceObject.StageNodeWrapper
|
|
1317
|
+
}), []);
|
|
1325
1318
|
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1326
1319
|
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
1327
1320
|
}), []);
|
|
@@ -1490,17 +1483,9 @@ const availableTaskOptions = [
|
|
|
1490
1483
|
}
|
|
1491
1484
|
];
|
|
1492
1485
|
const AddAndReplaceTasksStory = ()=>{
|
|
1493
|
-
const StageNodeWrapper = (0, external_react_namespaceObject.useMemo)(()=>function(props) {
|
|
1494
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StageNode_cjs_namespaceObject.StageNode, {
|
|
1495
|
-
...props,
|
|
1496
|
-
...props.data
|
|
1497
|
-
});
|
|
1498
|
-
}, []);
|
|
1499
1486
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1500
|
-
stage: StageNodeWrapper
|
|
1501
|
-
}), [
|
|
1502
|
-
StageNodeWrapper
|
|
1503
|
-
]);
|
|
1487
|
+
stage: external_StageNode_stories_utils_cjs_namespaceObject.StageNodeWrapper
|
|
1488
|
+
}), []);
|
|
1504
1489
|
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1505
1490
|
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
1506
1491
|
}), []);
|
|
@@ -1741,20 +1726,25 @@ const AddAndReplaceTasks = {
|
|
|
1741
1726
|
args: {}
|
|
1742
1727
|
};
|
|
1743
1728
|
const InlineTitleEditStory = ()=>{
|
|
1744
|
-
const StageNodeWrapper = (0, external_react_namespaceObject.useMemo)(()=>function(props) {
|
|
1745
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StageNode_cjs_namespaceObject.StageNode, {
|
|
1746
|
-
...props,
|
|
1747
|
-
...props.data
|
|
1748
|
-
});
|
|
1749
|
-
}, []);
|
|
1750
1729
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1751
|
-
stage: StageNodeWrapper
|
|
1752
|
-
}), [
|
|
1753
|
-
StageNodeWrapper
|
|
1754
|
-
]);
|
|
1730
|
+
stage: external_StageNode_stories_utils_cjs_namespaceObject.StageNodeWrapper
|
|
1731
|
+
}), []);
|
|
1755
1732
|
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1756
1733
|
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
1757
1734
|
}), []);
|
|
1735
|
+
const setNodesRef = (0, external_react_namespaceObject.useRef)(null);
|
|
1736
|
+
const createTitleChangeHandler = (0, external_react_namespaceObject.useCallback)((nodeId)=>(newTitle)=>{
|
|
1737
|
+
setNodesRef.current((nds)=>nds.map((node)=>node.id === nodeId ? {
|
|
1738
|
+
...node,
|
|
1739
|
+
data: {
|
|
1740
|
+
...node.data,
|
|
1741
|
+
stageDetails: {
|
|
1742
|
+
...node.data.stageDetails,
|
|
1743
|
+
label: newTitle
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
} : node));
|
|
1747
|
+
}, []);
|
|
1758
1748
|
const initialNodes = (0, external_react_namespaceObject.useMemo)(()=>[
|
|
1759
1749
|
{
|
|
1760
1750
|
id: 'editable-stage',
|
|
@@ -1786,7 +1776,8 @@ const InlineTitleEditStory = ()=>{
|
|
|
1786
1776
|
},
|
|
1787
1777
|
onTaskAdd: ()=>{
|
|
1788
1778
|
window.alert('Add task functionality - this would open a dialog to add a new task');
|
|
1789
|
-
}
|
|
1779
|
+
},
|
|
1780
|
+
onStageTitleChange: createTitleChangeHandler('editable-stage')
|
|
1790
1781
|
}
|
|
1791
1782
|
},
|
|
1792
1783
|
{
|
|
@@ -1812,36 +1803,16 @@ const InlineTitleEditStory = ()=>{
|
|
|
1812
1803
|
},
|
|
1813
1804
|
onTaskAdd: ()=>{
|
|
1814
1805
|
window.alert('Add task functionality - this would open a dialog to add a new task');
|
|
1815
|
-
}
|
|
1806
|
+
},
|
|
1807
|
+
onStageTitleChange: createTitleChangeHandler('long-title-stage')
|
|
1816
1808
|
}
|
|
1817
1809
|
}
|
|
1818
|
-
], [
|
|
1819
|
-
const [nodes, setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(initialNodes);
|
|
1820
|
-
const [edges, setEdges, onEdgesChange] = (0, react_cjs_namespaceObject.useEdgesState)([]);
|
|
1821
|
-
const createTitleChangeHandler = (0, external_react_namespaceObject.useCallback)((nodeId)=>(newTitle)=>{
|
|
1822
|
-
setNodes((nds)=>nds.map((node)=>node.id === nodeId ? {
|
|
1823
|
-
...node,
|
|
1824
|
-
data: {
|
|
1825
|
-
...node.data,
|
|
1826
|
-
stageDetails: {
|
|
1827
|
-
...node.data.stageDetails,
|
|
1828
|
-
label: newTitle
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
} : node));
|
|
1832
|
-
}, [
|
|
1833
|
-
setNodes
|
|
1834
|
-
]);
|
|
1835
|
-
const nodesWithHandlers = (0, external_react_namespaceObject.useMemo)(()=>nodes.map((node)=>({
|
|
1836
|
-
...node,
|
|
1837
|
-
data: {
|
|
1838
|
-
...node.data,
|
|
1839
|
-
onStageTitleChange: createTitleChangeHandler(node.id)
|
|
1840
|
-
}
|
|
1841
|
-
})), [
|
|
1842
|
-
nodes,
|
|
1810
|
+
], [
|
|
1843
1811
|
createTitleChangeHandler
|
|
1844
1812
|
]);
|
|
1813
|
+
const [nodes, setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(initialNodes);
|
|
1814
|
+
setNodesRef.current = setNodes;
|
|
1815
|
+
const [edges, setEdges, onEdgesChange] = (0, react_cjs_namespaceObject.useEdgesState)([]);
|
|
1845
1816
|
const onConnect = (0, external_react_namespaceObject.useCallback)((connection)=>setEdges((eds)=>(0, react_cjs_namespaceObject.addEdge)(connection, eds)), [
|
|
1846
1817
|
setEdges
|
|
1847
1818
|
]);
|
|
@@ -1852,7 +1823,7 @@ const InlineTitleEditStory = ()=>{
|
|
|
1852
1823
|
},
|
|
1853
1824
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.ReactFlowProvider, {
|
|
1854
1825
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseCanvas_index_cjs_namespaceObject.BaseCanvas, {
|
|
1855
|
-
nodes:
|
|
1826
|
+
nodes: nodes,
|
|
1856
1827
|
edges: edges,
|
|
1857
1828
|
onNodesChange: onNodesChange,
|
|
1858
1829
|
onEdgesChange: onEdgesChange,
|
|
@@ -1943,20 +1914,33 @@ const loadedTaskOptionsWithChildren = [
|
|
|
1943
1914
|
}
|
|
1944
1915
|
];
|
|
1945
1916
|
const AddTaskLoadingStory = ()=>{
|
|
1946
|
-
const StageNodeWrapper = (0, external_react_namespaceObject.useMemo)(()=>function(props) {
|
|
1947
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StageNode_cjs_namespaceObject.StageNode, {
|
|
1948
|
-
...props,
|
|
1949
|
-
...props.data
|
|
1950
|
-
});
|
|
1951
|
-
}, []);
|
|
1952
1917
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1953
|
-
stage: StageNodeWrapper
|
|
1954
|
-
}), [
|
|
1955
|
-
StageNodeWrapper
|
|
1956
|
-
]);
|
|
1918
|
+
stage: external_StageNode_stories_utils_cjs_namespaceObject.StageNodeWrapper
|
|
1919
|
+
}), []);
|
|
1957
1920
|
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1958
1921
|
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
1959
1922
|
}), []);
|
|
1923
|
+
const setNodesRef = (0, external_react_namespaceObject.useRef)(null);
|
|
1924
|
+
const timeoutRef = (0, external_react_namespaceObject.useRef)(void 0);
|
|
1925
|
+
const handleAddTaskFromToolbox = (0, external_react_namespaceObject.useCallback)((nodeId, _taskItem)=>{
|
|
1926
|
+
clearTimeout(timeoutRef.current);
|
|
1927
|
+
setNodesRef.current((nds)=>nds.map((n)=>n.id === nodeId ? {
|
|
1928
|
+
...n,
|
|
1929
|
+
data: {
|
|
1930
|
+
...n.data,
|
|
1931
|
+
addTaskLoading: true
|
|
1932
|
+
}
|
|
1933
|
+
} : n));
|
|
1934
|
+
timeoutRef.current = setTimeout(()=>{
|
|
1935
|
+
setNodesRef.current((nds)=>nds.map((n)=>n.id === nodeId ? {
|
|
1936
|
+
...n,
|
|
1937
|
+
data: {
|
|
1938
|
+
...n.data,
|
|
1939
|
+
addTaskLoading: false
|
|
1940
|
+
}
|
|
1941
|
+
} : n));
|
|
1942
|
+
}, 2000);
|
|
1943
|
+
}, []);
|
|
1960
1944
|
const initialNodes = (0, external_react_namespaceObject.useMemo)(()=>[
|
|
1961
1945
|
{
|
|
1962
1946
|
id: 'loading-stage-empty',
|
|
@@ -1972,7 +1956,10 @@ const AddTaskLoadingStory = ()=>{
|
|
|
1972
1956
|
tasks: []
|
|
1973
1957
|
},
|
|
1974
1958
|
addTaskLoading: true,
|
|
1975
|
-
taskOptions: []
|
|
1959
|
+
taskOptions: [],
|
|
1960
|
+
onAddTaskFromToolbox: (taskItem)=>{
|
|
1961
|
+
handleAddTaskFromToolbox('loading-stage-empty', taskItem);
|
|
1962
|
+
}
|
|
1976
1963
|
}
|
|
1977
1964
|
},
|
|
1978
1965
|
{
|
|
@@ -1997,11 +1984,17 @@ const AddTaskLoadingStory = ()=>{
|
|
|
1997
1984
|
]
|
|
1998
1985
|
},
|
|
1999
1986
|
addTaskLoading: false,
|
|
2000
|
-
taskOptions: loadedTaskOptionsWithChildren
|
|
1987
|
+
taskOptions: loadedTaskOptionsWithChildren,
|
|
1988
|
+
onAddTaskFromToolbox: (taskItem)=>{
|
|
1989
|
+
handleAddTaskFromToolbox('loading-stage-children', taskItem);
|
|
1990
|
+
}
|
|
2001
1991
|
}
|
|
2002
1992
|
}
|
|
2003
|
-
], [
|
|
2004
|
-
|
|
1993
|
+
], [
|
|
1994
|
+
handleAddTaskFromToolbox
|
|
1995
|
+
]);
|
|
1996
|
+
const [nodes, setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(initialNodes);
|
|
1997
|
+
setNodesRef.current = setNodes;
|
|
2005
1998
|
const [edges, setEdges, onEdgesChange] = (0, react_cjs_namespaceObject.useEdgesState)([]);
|
|
2006
1999
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
2007
2000
|
const timeout = setTimeout(()=>{
|
|
@@ -2018,41 +2011,7 @@ const AddTaskLoadingStory = ()=>{
|
|
|
2018
2011
|
}, [
|
|
2019
2012
|
setNodes
|
|
2020
2013
|
]);
|
|
2021
|
-
const timeoutRef = (0, external_react_namespaceObject.useRef)(void 0);
|
|
2022
2014
|
(0, external_react_namespaceObject.useEffect)(()=>()=>clearTimeout(timeoutRef.current), []);
|
|
2023
|
-
const handleAddTaskFromToolbox = (0, external_react_namespaceObject.useCallback)((nodeId, _taskItem)=>{
|
|
2024
|
-
clearTimeout(timeoutRef.current);
|
|
2025
|
-
setNodes((nds)=>nds.map((n)=>n.id === nodeId ? {
|
|
2026
|
-
...n,
|
|
2027
|
-
data: {
|
|
2028
|
-
...n.data,
|
|
2029
|
-
addTaskLoading: true
|
|
2030
|
-
}
|
|
2031
|
-
} : n));
|
|
2032
|
-
timeoutRef.current = setTimeout(()=>{
|
|
2033
|
-
setNodes((nds)=>nds.map((n)=>n.id === nodeId ? {
|
|
2034
|
-
...n,
|
|
2035
|
-
data: {
|
|
2036
|
-
...n.data,
|
|
2037
|
-
addTaskLoading: false
|
|
2038
|
-
}
|
|
2039
|
-
} : n));
|
|
2040
|
-
}, 2000);
|
|
2041
|
-
}, [
|
|
2042
|
-
setNodes
|
|
2043
|
-
]);
|
|
2044
|
-
const nodesWithHandler = (0, external_react_namespaceObject.useMemo)(()=>nodesState.map((node)=>({
|
|
2045
|
-
...node,
|
|
2046
|
-
data: {
|
|
2047
|
-
...node.data,
|
|
2048
|
-
onAddTaskFromToolbox: (taskItem)=>{
|
|
2049
|
-
handleAddTaskFromToolbox(node.id, taskItem);
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
})), [
|
|
2053
|
-
nodesState,
|
|
2054
|
-
handleAddTaskFromToolbox
|
|
2055
|
-
]);
|
|
2056
2015
|
const onConnect = (0, external_react_namespaceObject.useCallback)((connection)=>setEdges((eds)=>(0, react_cjs_namespaceObject.addEdge)(connection, eds)), [
|
|
2057
2016
|
setEdges
|
|
2058
2017
|
]);
|
|
@@ -2063,7 +2022,7 @@ const AddTaskLoadingStory = ()=>{
|
|
|
2063
2022
|
},
|
|
2064
2023
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.ReactFlowProvider, {
|
|
2065
2024
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseCanvas_index_cjs_namespaceObject.BaseCanvas, {
|
|
2066
|
-
nodes:
|
|
2025
|
+
nodes: nodes,
|
|
2067
2026
|
edges: edges,
|
|
2068
2027
|
onNodesChange: onNodesChange,
|
|
2069
2028
|
onEdgesChange: onEdgesChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StageNode.stories.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNode.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAyBvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"StageNode.stories.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNode.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAyBvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAmDxC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CA8CD,CAAC;AAEjC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AA4CnC,eAAO,MAAM,OAAO,EAAE,KAoHrB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAsE3B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KA8M7B,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KA+HvC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAoKpC,CAAC;AAsGF,eAAO,MAAM,uBAAuB,EAAE,KAOrC,CAAC;AA0UF,eAAO,MAAM,kBAAkB,EAAE,KAOhC,CAAC;AA4GF,eAAO,MAAM,kBAAkB,EAAE,KAOhC,CAAC;AAqJF,eAAO,MAAM,cAAc,EAAE,KAO5B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAiHxB,CAAC"}
|