@uipath/apollo-react 3.63.0-pr431.bfdc347 → 3.63.0
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/NodePropertiesPanel/hooks/index.cjs +1 -4
- 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 +5 -30
- package/dist/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.d.ts +0 -3
- package/dist/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.d.ts.map +1 -1
- package/dist/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.js +4 -26
- package/dist/canvas/components/StageNode/DraggableTask.cjs +7 -9
- 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 +7 -9
- package/dist/canvas/components/StageNode/DraggableTask.types.d.ts +2 -1
- package/dist/canvas/components/StageNode/DraggableTask.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.cjs +11 -12
- package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.js +13 -14
- package/dist/canvas/components/StageNode/StageNode.stories.cjs +152 -114
- package/dist/canvas/components/StageNode/StageNode.stories.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.stories.js +153 -115
- package/dist/canvas/components/StageNode/TaskMenu.cjs +12 -12
- 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 +13 -13
- package/package.json +3 -3
|
@@ -48,56 +48,6 @@ 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 StageNodeWrapper = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StageNode_cjs_namespaceObject.StageNode, {
|
|
52
|
-
...props,
|
|
53
|
-
...props.data
|
|
54
|
-
}));
|
|
55
|
-
const DefaultCanvasDecorator = ({ initialNodes, initialEdges = [] })=>{
|
|
56
|
-
const [nodes, _setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(initialNodes);
|
|
57
|
-
const [edges, setEdges, onEdgesChange] = (0, react_cjs_namespaceObject.useEdgesState)(initialEdges);
|
|
58
|
-
const onConnect = (0, external_react_namespaceObject.useCallback)((connection)=>{
|
|
59
|
-
setEdges((eds)=>(0, react_cjs_namespaceObject.addEdge)(connection, eds));
|
|
60
|
-
}, [
|
|
61
|
-
setEdges
|
|
62
|
-
]);
|
|
63
|
-
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
64
|
-
stage: StageNodeWrapper
|
|
65
|
-
}), []);
|
|
66
|
-
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
67
|
-
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
68
|
-
}), []);
|
|
69
|
-
const defaultEdgeOptions = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
70
|
-
type: 'stage'
|
|
71
|
-
}), []);
|
|
72
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
73
|
-
style: {
|
|
74
|
-
width: '100vw',
|
|
75
|
-
height: '100vh'
|
|
76
|
-
},
|
|
77
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.ReactFlowProvider, {
|
|
78
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseCanvas_index_cjs_namespaceObject.BaseCanvas, {
|
|
79
|
-
nodes: nodes,
|
|
80
|
-
edges: edges,
|
|
81
|
-
onNodesChange: onNodesChange,
|
|
82
|
-
onEdgesChange: onEdgesChange,
|
|
83
|
-
onConnect: onConnect,
|
|
84
|
-
nodeTypes: nodeTypes,
|
|
85
|
-
edgeTypes: edgeTypes,
|
|
86
|
-
mode: "design",
|
|
87
|
-
connectionMode: react_cjs_namespaceObject.ConnectionMode.Strict,
|
|
88
|
-
defaultEdgeOptions: defaultEdgeOptions,
|
|
89
|
-
connectionLineComponent: external_StageConnectionEdge_cjs_namespaceObject.StageConnectionEdge,
|
|
90
|
-
elevateEdgesOnSelect: true,
|
|
91
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Panel, {
|
|
92
|
-
position: "bottom-right",
|
|
93
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasPositionControls_cjs_namespaceObject.CanvasPositionControls, {
|
|
94
|
-
translations: external_types_cjs_namespaceObject.DefaultCanvasTranslations
|
|
95
|
-
})
|
|
96
|
-
})
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
51
|
const meta = {
|
|
102
52
|
title: 'Canvas/StageNode',
|
|
103
53
|
component: external_StageNode_cjs_namespaceObject.StageNode,
|
|
@@ -107,6 +57,10 @@ const meta = {
|
|
|
107
57
|
decorators: [
|
|
108
58
|
(Story, context)=>{
|
|
109
59
|
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
|
+
});
|
|
110
64
|
const initialNodes = context.parameters?.nodes || [
|
|
111
65
|
{
|
|
112
66
|
id: '1',
|
|
@@ -126,9 +80,51 @@ const meta = {
|
|
|
126
80
|
}
|
|
127
81
|
];
|
|
128
82
|
const initialEdges = context.parameters?.edges || [];
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
83
|
+
const [nodes, _setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(initialNodes);
|
|
84
|
+
const [edges, setEdges, onEdgesChange] = (0, react_cjs_namespaceObject.useEdgesState)(initialEdges);
|
|
85
|
+
const onConnect = (0, external_react_namespaceObject.useCallback)((connection)=>{
|
|
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
|
+
})
|
|
132
128
|
});
|
|
133
129
|
}
|
|
134
130
|
],
|
|
@@ -1315,9 +1311,17 @@ const initialTasks = [
|
|
|
1315
1311
|
]
|
|
1316
1312
|
];
|
|
1317
1313
|
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
|
+
}, []);
|
|
1318
1320
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1319
1321
|
stage: StageNodeWrapper
|
|
1320
|
-
}), [
|
|
1322
|
+
}), [
|
|
1323
|
+
StageNodeWrapper
|
|
1324
|
+
]);
|
|
1321
1325
|
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1322
1326
|
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
1323
1327
|
}), []);
|
|
@@ -1486,9 +1490,17 @@ const availableTaskOptions = [
|
|
|
1486
1490
|
}
|
|
1487
1491
|
];
|
|
1488
1492
|
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
|
+
}, []);
|
|
1489
1499
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1490
1500
|
stage: StageNodeWrapper
|
|
1491
|
-
}), [
|
|
1501
|
+
}), [
|
|
1502
|
+
StageNodeWrapper
|
|
1503
|
+
]);
|
|
1492
1504
|
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1493
1505
|
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
1494
1506
|
}), []);
|
|
@@ -1729,25 +1741,20 @@ const AddAndReplaceTasks = {
|
|
|
1729
1741
|
args: {}
|
|
1730
1742
|
};
|
|
1731
1743
|
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
|
+
}, []);
|
|
1732
1750
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1733
1751
|
stage: StageNodeWrapper
|
|
1734
|
-
}), [
|
|
1752
|
+
}), [
|
|
1753
|
+
StageNodeWrapper
|
|
1754
|
+
]);
|
|
1735
1755
|
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1736
1756
|
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
1737
1757
|
}), []);
|
|
1738
|
-
const setNodesRef = (0, external_react_namespaceObject.useRef)(null);
|
|
1739
|
-
const createTitleChangeHandler = (0, external_react_namespaceObject.useCallback)((nodeId)=>(newTitle)=>{
|
|
1740
|
-
setNodesRef.current((nds)=>nds.map((node)=>node.id === nodeId ? {
|
|
1741
|
-
...node,
|
|
1742
|
-
data: {
|
|
1743
|
-
...node.data,
|
|
1744
|
-
stageDetails: {
|
|
1745
|
-
...node.data.stageDetails,
|
|
1746
|
-
label: newTitle
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
} : node));
|
|
1750
|
-
}, []);
|
|
1751
1758
|
const initialNodes = (0, external_react_namespaceObject.useMemo)(()=>[
|
|
1752
1759
|
{
|
|
1753
1760
|
id: 'editable-stage',
|
|
@@ -1779,8 +1786,7 @@ const InlineTitleEditStory = ()=>{
|
|
|
1779
1786
|
},
|
|
1780
1787
|
onTaskAdd: ()=>{
|
|
1781
1788
|
window.alert('Add task functionality - this would open a dialog to add a new task');
|
|
1782
|
-
}
|
|
1783
|
-
onStageTitleChange: createTitleChangeHandler('editable-stage')
|
|
1789
|
+
}
|
|
1784
1790
|
}
|
|
1785
1791
|
},
|
|
1786
1792
|
{
|
|
@@ -1806,16 +1812,36 @@ const InlineTitleEditStory = ()=>{
|
|
|
1806
1812
|
},
|
|
1807
1813
|
onTaskAdd: ()=>{
|
|
1808
1814
|
window.alert('Add task functionality - this would open a dialog to add a new task');
|
|
1809
|
-
}
|
|
1810
|
-
onStageTitleChange: createTitleChangeHandler('long-title-stage')
|
|
1815
|
+
}
|
|
1811
1816
|
}
|
|
1812
1817
|
}
|
|
1813
|
-
], [
|
|
1814
|
-
createTitleChangeHandler
|
|
1815
|
-
]);
|
|
1818
|
+
], []);
|
|
1816
1819
|
const [nodes, setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(initialNodes);
|
|
1817
|
-
setNodesRef.current = setNodes;
|
|
1818
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,
|
|
1843
|
+
createTitleChangeHandler
|
|
1844
|
+
]);
|
|
1819
1845
|
const onConnect = (0, external_react_namespaceObject.useCallback)((connection)=>setEdges((eds)=>(0, react_cjs_namespaceObject.addEdge)(connection, eds)), [
|
|
1820
1846
|
setEdges
|
|
1821
1847
|
]);
|
|
@@ -1826,7 +1852,7 @@ const InlineTitleEditStory = ()=>{
|
|
|
1826
1852
|
},
|
|
1827
1853
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.ReactFlowProvider, {
|
|
1828
1854
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseCanvas_index_cjs_namespaceObject.BaseCanvas, {
|
|
1829
|
-
nodes:
|
|
1855
|
+
nodes: nodesWithHandlers,
|
|
1830
1856
|
edges: edges,
|
|
1831
1857
|
onNodesChange: onNodesChange,
|
|
1832
1858
|
onEdgesChange: onEdgesChange,
|
|
@@ -1917,33 +1943,20 @@ const loadedTaskOptionsWithChildren = [
|
|
|
1917
1943
|
}
|
|
1918
1944
|
];
|
|
1919
1945
|
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
|
+
}, []);
|
|
1920
1952
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1921
1953
|
stage: StageNodeWrapper
|
|
1922
|
-
}), [
|
|
1954
|
+
}), [
|
|
1955
|
+
StageNodeWrapper
|
|
1956
|
+
]);
|
|
1923
1957
|
const edgeTypes = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
1924
1958
|
stage: external_StageEdge_cjs_namespaceObject.StageEdge
|
|
1925
1959
|
}), []);
|
|
1926
|
-
const setNodesRef = (0, external_react_namespaceObject.useRef)(null);
|
|
1927
|
-
const timeoutRef = (0, external_react_namespaceObject.useRef)(void 0);
|
|
1928
|
-
const handleAddTaskFromToolbox = (0, external_react_namespaceObject.useCallback)((nodeId, _taskItem)=>{
|
|
1929
|
-
clearTimeout(timeoutRef.current);
|
|
1930
|
-
setNodesRef.current((nds)=>nds.map((n)=>n.id === nodeId ? {
|
|
1931
|
-
...n,
|
|
1932
|
-
data: {
|
|
1933
|
-
...n.data,
|
|
1934
|
-
addTaskLoading: true
|
|
1935
|
-
}
|
|
1936
|
-
} : n));
|
|
1937
|
-
timeoutRef.current = setTimeout(()=>{
|
|
1938
|
-
setNodesRef.current((nds)=>nds.map((n)=>n.id === nodeId ? {
|
|
1939
|
-
...n,
|
|
1940
|
-
data: {
|
|
1941
|
-
...n.data,
|
|
1942
|
-
addTaskLoading: false
|
|
1943
|
-
}
|
|
1944
|
-
} : n));
|
|
1945
|
-
}, 2000);
|
|
1946
|
-
}, []);
|
|
1947
1960
|
const initialNodes = (0, external_react_namespaceObject.useMemo)(()=>[
|
|
1948
1961
|
{
|
|
1949
1962
|
id: 'loading-stage-empty',
|
|
@@ -1959,10 +1972,7 @@ const AddTaskLoadingStory = ()=>{
|
|
|
1959
1972
|
tasks: []
|
|
1960
1973
|
},
|
|
1961
1974
|
addTaskLoading: true,
|
|
1962
|
-
taskOptions: []
|
|
1963
|
-
onAddTaskFromToolbox: (taskItem)=>{
|
|
1964
|
-
handleAddTaskFromToolbox('loading-stage-empty', taskItem);
|
|
1965
|
-
}
|
|
1975
|
+
taskOptions: []
|
|
1966
1976
|
}
|
|
1967
1977
|
},
|
|
1968
1978
|
{
|
|
@@ -1987,17 +1997,11 @@ const AddTaskLoadingStory = ()=>{
|
|
|
1987
1997
|
]
|
|
1988
1998
|
},
|
|
1989
1999
|
addTaskLoading: false,
|
|
1990
|
-
taskOptions: loadedTaskOptionsWithChildren
|
|
1991
|
-
onAddTaskFromToolbox: (taskItem)=>{
|
|
1992
|
-
handleAddTaskFromToolbox('loading-stage-children', taskItem);
|
|
1993
|
-
}
|
|
2000
|
+
taskOptions: loadedTaskOptionsWithChildren
|
|
1994
2001
|
}
|
|
1995
2002
|
}
|
|
1996
|
-
], [
|
|
1997
|
-
|
|
1998
|
-
]);
|
|
1999
|
-
const [nodes, setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(initialNodes);
|
|
2000
|
-
setNodesRef.current = setNodes;
|
|
2003
|
+
], []);
|
|
2004
|
+
const [nodesState, setNodes, onNodesChange] = (0, react_cjs_namespaceObject.useNodesState)(initialNodes);
|
|
2001
2005
|
const [edges, setEdges, onEdgesChange] = (0, react_cjs_namespaceObject.useEdgesState)([]);
|
|
2002
2006
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
2003
2007
|
const timeout = setTimeout(()=>{
|
|
@@ -2014,7 +2018,41 @@ const AddTaskLoadingStory = ()=>{
|
|
|
2014
2018
|
}, [
|
|
2015
2019
|
setNodes
|
|
2016
2020
|
]);
|
|
2021
|
+
const timeoutRef = (0, external_react_namespaceObject.useRef)(void 0);
|
|
2017
2022
|
(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
|
+
]);
|
|
2018
2056
|
const onConnect = (0, external_react_namespaceObject.useCallback)((connection)=>setEdges((eds)=>(0, react_cjs_namespaceObject.addEdge)(connection, eds)), [
|
|
2019
2057
|
setEdges
|
|
2020
2058
|
]);
|
|
@@ -2025,7 +2063,7 @@ const AddTaskLoadingStory = ()=>{
|
|
|
2025
2063
|
},
|
|
2026
2064
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.ReactFlowProvider, {
|
|
2027
2065
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BaseCanvas_index_cjs_namespaceObject.BaseCanvas, {
|
|
2028
|
-
nodes:
|
|
2066
|
+
nodes: nodesWithHandler,
|
|
2029
2067
|
edges: edges,
|
|
2030
2068
|
onNodesChange: onNodesChange,
|
|
2031
2069
|
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;AAGxC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CA0FD,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;AA8GF,eAAO,MAAM,uBAAuB,EAAE,KAOrC,CAAC;AAkVF,eAAO,MAAM,kBAAkB,EAAE,KAOhC,CAAC;AA2HF,eAAO,MAAM,kBAAkB,EAAE,KAOhC,CAAC;AA0KF,eAAO,MAAM,cAAc,EAAE,KAO5B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAiHxB,CAAC"}
|