@uipath/apollo-react 3.62.1 → 3.63.0-pr431.b5c8666
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 +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 +30 -5
- 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 +26 -4
- package/dist/canvas/components/StageNode/DraggableTask.cjs +9 -7
- 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 +9 -7
- 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/StageNode.cjs +12 -11
- package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.js +14 -13
- package/dist/canvas/components/StageNode/StageNode.stories.cjs +114 -152
- package/dist/canvas/components/StageNode/StageNode.stories.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.stories.js +115 -153
- 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/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 +1 -1
|
@@ -24,6 +24,7 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useSetNodeSelection: ()=>external_useNodeSelection_cjs_namespaceObject.useSetNodeSelection,
|
|
27
28
|
useNodeSelection: ()=>external_useNodeSelection_cjs_namespaceObject.useNodeSelection,
|
|
28
29
|
useNodeConfiguration: ()=>external_useNodeConfiguration_cjs_namespaceObject.useNodeConfiguration
|
|
29
30
|
});
|
|
@@ -31,9 +32,11 @@ const external_useNodeConfiguration_cjs_namespaceObject = require("./useNodeConf
|
|
|
31
32
|
const external_useNodeSelection_cjs_namespaceObject = require("./useNodeSelection.cjs");
|
|
32
33
|
exports.useNodeConfiguration = __webpack_exports__.useNodeConfiguration;
|
|
33
34
|
exports.useNodeSelection = __webpack_exports__.useNodeSelection;
|
|
35
|
+
exports.useSetNodeSelection = __webpack_exports__.useSetNodeSelection;
|
|
34
36
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
35
37
|
"useNodeConfiguration",
|
|
36
|
-
"useNodeSelection"
|
|
38
|
+
"useNodeSelection",
|
|
39
|
+
"useSetNodeSelection"
|
|
37
40
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
38
41
|
Object.defineProperty(exports, '__esModule', {
|
|
39
42
|
value: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/NodePropertiesPanel/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/NodePropertiesPanel/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { useNodeConfiguration } from "./useNodeConfiguration.js";
|
|
2
|
-
import { useNodeSelection } from "./useNodeSelection.js";
|
|
3
|
-
export { useNodeConfiguration, useNodeSelection };
|
|
2
|
+
import { useNodeSelection, useSetNodeSelection } from "./useNodeSelection.js";
|
|
3
|
+
export { useNodeConfiguration, useNodeSelection, useSetNodeSelection };
|
|
@@ -24,7 +24,8 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
useNodeSelection: ()=>useNodeSelection
|
|
27
|
+
useNodeSelection: ()=>useNodeSelection,
|
|
28
|
+
useSetNodeSelection: ()=>useSetNodeSelection
|
|
28
29
|
});
|
|
29
30
|
const react_cjs_namespaceObject = require("../../../xyflow/react.cjs");
|
|
30
31
|
const external_react_namespaceObject = require("react");
|
|
@@ -40,10 +41,14 @@ function useNodeSelection(nodeId, maintainSelection = true) {
|
|
|
40
41
|
])
|
|
41
42
|
});
|
|
42
43
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
43
|
-
if (maintainSelection && selectedNodeId) setNodes((nds)=>nds.map((node)=>
|
|
44
|
+
if (maintainSelection && selectedNodeId) setNodes((nds)=>nds.map((node)=>{
|
|
45
|
+
const shouldBeSelected = node.id === selectedNodeId;
|
|
46
|
+
if (node.selected === shouldBeSelected) return node;
|
|
47
|
+
return {
|
|
44
48
|
...node,
|
|
45
|
-
selected:
|
|
46
|
-
}
|
|
49
|
+
selected: shouldBeSelected
|
|
50
|
+
};
|
|
51
|
+
}));
|
|
47
52
|
}, [
|
|
48
53
|
selectedNodeId,
|
|
49
54
|
maintainSelection,
|
|
@@ -56,9 +61,29 @@ function useNodeSelection(nodeId, maintainSelection = true) {
|
|
|
56
61
|
selectedNode
|
|
57
62
|
};
|
|
58
63
|
}
|
|
64
|
+
function useSetNodeSelection() {
|
|
65
|
+
const { setNodes } = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
66
|
+
const setSelectedNodeId = (0, external_react_namespaceObject.useCallback)((nodeId)=>{
|
|
67
|
+
setNodes((nds)=>nds.map((node)=>{
|
|
68
|
+
const shouldBeSelected = node.id === nodeId;
|
|
69
|
+
if (node.selected === shouldBeSelected) return node;
|
|
70
|
+
return {
|
|
71
|
+
...node,
|
|
72
|
+
selected: shouldBeSelected
|
|
73
|
+
};
|
|
74
|
+
}));
|
|
75
|
+
}, [
|
|
76
|
+
setNodes
|
|
77
|
+
]);
|
|
78
|
+
return {
|
|
79
|
+
setSelectedNodeId
|
|
80
|
+
};
|
|
81
|
+
}
|
|
59
82
|
exports.useNodeSelection = __webpack_exports__.useNodeSelection;
|
|
83
|
+
exports.useSetNodeSelection = __webpack_exports__.useSetNodeSelection;
|
|
60
84
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
61
|
-
"useNodeSelection"
|
|
85
|
+
"useNodeSelection",
|
|
86
|
+
"useSetNodeSelection"
|
|
62
87
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
63
88
|
Object.defineProperty(exports, '__esModule', {
|
|
64
89
|
value: true
|
|
@@ -4,4 +4,7 @@ export declare function useNodeSelection(nodeId?: string, maintainSelection?: bo
|
|
|
4
4
|
setSelectedNodeId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
5
5
|
selectedNode: ConfigurableNode | undefined;
|
|
6
6
|
};
|
|
7
|
+
export declare function useSetNodeSelection(): {
|
|
8
|
+
setSelectedNodeId: (nodeId: string) => void;
|
|
9
|
+
};
|
|
7
10
|
//# sourceMappingURL=useNodeSelection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNodeSelection.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,iBAAiB,UAAO;;;;
|
|
1
|
+
{"version":3,"file":"useNodeSelection.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/NodePropertiesPanel/hooks/useNodeSelection.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAErE,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,iBAAiB,UAAO;;;;EAyCzE;AAOD,wBAAgB,mBAAmB;gCAItB,MAAM;EAalB"}
|
|
@@ -12,10 +12,14 @@ function useNodeSelection(nodeId, maintainSelection = true) {
|
|
|
12
12
|
])
|
|
13
13
|
});
|
|
14
14
|
useEffect(()=>{
|
|
15
|
-
if (maintainSelection && selectedNodeId) setNodes((nds)=>nds.map((node)=>
|
|
15
|
+
if (maintainSelection && selectedNodeId) setNodes((nds)=>nds.map((node)=>{
|
|
16
|
+
const shouldBeSelected = node.id === selectedNodeId;
|
|
17
|
+
if (node.selected === shouldBeSelected) return node;
|
|
18
|
+
return {
|
|
16
19
|
...node,
|
|
17
|
-
selected:
|
|
18
|
-
}
|
|
20
|
+
selected: shouldBeSelected
|
|
21
|
+
};
|
|
22
|
+
}));
|
|
19
23
|
}, [
|
|
20
24
|
selectedNodeId,
|
|
21
25
|
maintainSelection,
|
|
@@ -28,4 +32,22 @@ function useNodeSelection(nodeId, maintainSelection = true) {
|
|
|
28
32
|
selectedNode
|
|
29
33
|
};
|
|
30
34
|
}
|
|
31
|
-
|
|
35
|
+
function useSetNodeSelection() {
|
|
36
|
+
const { setNodes } = useReactFlow();
|
|
37
|
+
const setSelectedNodeId = useCallback((nodeId)=>{
|
|
38
|
+
setNodes((nds)=>nds.map((node)=>{
|
|
39
|
+
const shouldBeSelected = node.id === nodeId;
|
|
40
|
+
if (node.selected === shouldBeSelected) return node;
|
|
41
|
+
return {
|
|
42
|
+
...node,
|
|
43
|
+
selected: shouldBeSelected
|
|
44
|
+
};
|
|
45
|
+
}));
|
|
46
|
+
}, [
|
|
47
|
+
setNodes
|
|
48
|
+
]);
|
|
49
|
+
return {
|
|
50
|
+
setSelectedNodeId
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export { useNodeSelection, useSetNodeSelection };
|
|
@@ -41,6 +41,7 @@ const sortable_namespaceObject = require("@dnd-kit/sortable");
|
|
|
41
41
|
const utilities_namespaceObject = require("@dnd-kit/utilities");
|
|
42
42
|
const apollo_core_namespaceObject = require("@uipath/apollo-core");
|
|
43
43
|
const index_cjs_namespaceObject = require("../../layouts/index.cjs");
|
|
44
|
+
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
44
45
|
const external_material_index_cjs_namespaceObject = require("../../../material/index.cjs");
|
|
45
46
|
const external_debounce_namespaceObject = require("debounce");
|
|
46
47
|
var external_debounce_default = /*#__PURE__*/ __webpack_require__.n(external_debounce_namespaceObject);
|
|
@@ -182,8 +183,9 @@ const TaskContent = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ ta
|
|
|
182
183
|
]
|
|
183
184
|
})
|
|
184
185
|
}));
|
|
185
|
-
const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel,
|
|
186
|
+
const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, getContextMenuItems, onTaskClick, onMenuOpen, onTaskPlay, isDragDisabled, projectedDepth })=>{
|
|
186
187
|
const [isMenuOpen, setIsMenuOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
188
|
+
const storeApi = (0, react_cjs_namespaceObject.useStoreApi)();
|
|
187
189
|
const taskRef = (0, external_react_namespaceObject.useRef)(null);
|
|
188
190
|
const menuRef = (0, external_react_namespaceObject.useRef)(null);
|
|
189
191
|
const [playLoading, setPlayLoading] = (0, external_react_namespaceObject.useState)(false);
|
|
@@ -228,8 +230,8 @@ const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, c
|
|
|
228
230
|
const style = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
229
231
|
const scaledTransform = transform ? {
|
|
230
232
|
...transform,
|
|
231
|
-
x: transform.x /
|
|
232
|
-
y: transform.y /
|
|
233
|
+
x: transform.x / storeApi.getState().transform[2],
|
|
234
|
+
y: transform.y / storeApi.getState().transform[2]
|
|
233
235
|
} : null;
|
|
234
236
|
let marginLeft;
|
|
235
237
|
if (isDragging && void 0 !== projectedDepth) if (1 !== projectedDepth || isParallel) {
|
|
@@ -242,7 +244,7 @@ const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, c
|
|
|
242
244
|
};
|
|
243
245
|
}, [
|
|
244
246
|
transform,
|
|
245
|
-
|
|
247
|
+
storeApi,
|
|
246
248
|
transition,
|
|
247
249
|
isDragging,
|
|
248
250
|
projectedDepth,
|
|
@@ -266,7 +268,7 @@ const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, c
|
|
|
266
268
|
isParallel: isParallel,
|
|
267
269
|
isDragEnabled: !isDragDisabled,
|
|
268
270
|
onClick: handleClick,
|
|
269
|
-
...
|
|
271
|
+
...getContextMenuItems && {
|
|
270
272
|
onContextMenu: handleContextMenu
|
|
271
273
|
},
|
|
272
274
|
children: [
|
|
@@ -313,10 +315,10 @@ const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, c
|
|
|
313
315
|
})
|
|
314
316
|
})
|
|
315
317
|
}),
|
|
316
|
-
|
|
318
|
+
getContextMenuItems && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_TaskMenu_cjs_namespaceObject.TaskMenu, {
|
|
317
319
|
ref: menuRef,
|
|
318
320
|
taskId: task.id,
|
|
319
|
-
|
|
321
|
+
getContextMenuItems: getContextMenuItems,
|
|
320
322
|
onMenuOpenChange: handleMenuOpenChange,
|
|
321
323
|
onMenuOpen: onMenuOpen,
|
|
322
324
|
taskRef: taskRef
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DraggableTaskProps, TaskContentProps } from './DraggableTask.types';
|
|
2
2
|
export declare const TaskContent: import("react").MemoExoticComponent<({ task, taskExecution, isDragging }: TaskContentProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
-
export declare const DraggableTask: import("react").MemoExoticComponent<({ task, taskExecution, isSelected, isParallel,
|
|
3
|
+
export declare const DraggableTask: import("react").MemoExoticComponent<({ task, taskExecution, isSelected, isParallel, getContextMenuItems, onTaskClick, onMenuOpen, onTaskPlay, isDragDisabled, projectedDepth, }: DraggableTaskProps) => import("react/jsx-runtime").JSX.Element>;
|
|
4
4
|
//# sourceMappingURL=DraggableTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DraggableTask.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/DraggableTask.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DraggableTask.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/DraggableTask.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAgClF,eAAO,MAAM,WAAW,4EAA8C,gBAAgB,6CAwEpF,CAAC;AAqLH,eAAO,MAAM,aAAa,mLAxKvB,kBAAkB,6CAwKoC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { useSortable } from "@dnd-kit/sortable";
|
|
|
3
3
|
import { CSS } from "@dnd-kit/utilities";
|
|
4
4
|
import { FontVariantToken, Padding, Spacing } from "@uipath/apollo-core";
|
|
5
5
|
import { Column, Row } from "../../layouts/index.js";
|
|
6
|
+
import { useStoreApi } from "../../xyflow/react.js";
|
|
6
7
|
import { ApBadge, ApCircularProgress, ApIconButton, ApTooltip, ApTypography, BadgeSize } from "../../../material/index.js";
|
|
7
8
|
import debounce from "debounce";
|
|
8
9
|
import { memo, useCallback, useMemo, useRef, useState } from "react";
|
|
@@ -143,8 +144,9 @@ const TaskContent = /*#__PURE__*/ memo(({ task, taskExecution, isDragging })=>/*
|
|
|
143
144
|
]
|
|
144
145
|
})
|
|
145
146
|
}));
|
|
146
|
-
const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel,
|
|
147
|
+
const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, getContextMenuItems, onTaskClick, onMenuOpen, onTaskPlay, isDragDisabled, projectedDepth })=>{
|
|
147
148
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
149
|
+
const storeApi = useStoreApi();
|
|
148
150
|
const taskRef = useRef(null);
|
|
149
151
|
const menuRef = useRef(null);
|
|
150
152
|
const [playLoading, setPlayLoading] = useState(false);
|
|
@@ -189,8 +191,8 @@ const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, c
|
|
|
189
191
|
const style = useMemo(()=>{
|
|
190
192
|
const scaledTransform = transform ? {
|
|
191
193
|
...transform,
|
|
192
|
-
x: transform.x /
|
|
193
|
-
y: transform.y /
|
|
194
|
+
x: transform.x / storeApi.getState().transform[2],
|
|
195
|
+
y: transform.y / storeApi.getState().transform[2]
|
|
194
196
|
} : null;
|
|
195
197
|
let marginLeft;
|
|
196
198
|
if (isDragging && void 0 !== projectedDepth) if (1 !== projectedDepth || isParallel) {
|
|
@@ -203,7 +205,7 @@ const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, c
|
|
|
203
205
|
};
|
|
204
206
|
}, [
|
|
205
207
|
transform,
|
|
206
|
-
|
|
208
|
+
storeApi,
|
|
207
209
|
transition,
|
|
208
210
|
isDragging,
|
|
209
211
|
projectedDepth,
|
|
@@ -227,7 +229,7 @@ const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, c
|
|
|
227
229
|
isParallel: isParallel,
|
|
228
230
|
isDragEnabled: !isDragDisabled,
|
|
229
231
|
onClick: handleClick,
|
|
230
|
-
...
|
|
232
|
+
...getContextMenuItems && {
|
|
231
233
|
onContextMenu: handleContextMenu
|
|
232
234
|
},
|
|
233
235
|
children: [
|
|
@@ -274,10 +276,10 @@ const DraggableTaskComponent = ({ task, taskExecution, isSelected, isParallel, c
|
|
|
274
276
|
})
|
|
275
277
|
})
|
|
276
278
|
}),
|
|
277
|
-
|
|
279
|
+
getContextMenuItems && /*#__PURE__*/ jsx(TaskMenu, {
|
|
278
280
|
ref: menuRef,
|
|
279
281
|
taskId: task.id,
|
|
280
|
-
|
|
282
|
+
getContextMenuItems: getContextMenuItems,
|
|
281
283
|
onMenuOpenChange: handleMenuOpenChange,
|
|
282
284
|
onMenuOpen: onMenuOpen,
|
|
283
285
|
taskRef: taskRef
|
|
@@ -10,12 +10,11 @@ export interface DraggableTaskProps {
|
|
|
10
10
|
taskExecution?: StageTaskExecution;
|
|
11
11
|
isSelected: boolean;
|
|
12
12
|
isParallel: boolean;
|
|
13
|
-
|
|
13
|
+
getContextMenuItems?: () => NodeMenuItem[];
|
|
14
14
|
onTaskClick: (e: React.MouseEvent, taskId: string) => void;
|
|
15
15
|
onMenuOpen?: () => void;
|
|
16
16
|
onTaskPlay?: (taskId: string) => Promise<void>;
|
|
17
17
|
isDragDisabled?: boolean;
|
|
18
18
|
projectedDepth?: number;
|
|
19
|
-
zoom?: number;
|
|
20
19
|
}
|
|
21
20
|
//# sourceMappingURL=DraggableTask.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DraggableTask.types.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/DraggableTask.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE3E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,aAAa,CAAC;IACpB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"DraggableTask.types.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/DraggableTask.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE3E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,aAAa,CAAC;IACpB,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,YAAY,EAAE,CAAC;IAC3C,WAAW,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -85,6 +85,7 @@ const StageNodeComponent = (props)=>{
|
|
|
85
85
|
taskIndex: -1
|
|
86
86
|
});
|
|
87
87
|
const isConnecting = (0, react_cjs_namespaceObject.useStore)((state)=>!!state.connectionClickStartHandle);
|
|
88
|
+
const storeApi = (0, react_cjs_namespaceObject.useStoreApi)();
|
|
88
89
|
const connectedHandleIds = (0, ConnectedHandlesContext_cjs_namespaceObject.useConnectedHandles)(id);
|
|
89
90
|
const [isAddingTask, setIsAddingTask] = (0, external_react_namespaceObject.useState)(false);
|
|
90
91
|
const [isReplacingTask, setIsReplacingTask] = (0, external_react_namespaceObject.useState)(false);
|
|
@@ -124,7 +125,6 @@ const StageNodeComponent = (props)=>{
|
|
|
124
125
|
tasks,
|
|
125
126
|
activeDragId
|
|
126
127
|
]);
|
|
127
|
-
const { zoom } = (0, react_cjs_namespaceObject.useViewport)();
|
|
128
128
|
const projected = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
129
129
|
if (!activeDragId || !overId) return null;
|
|
130
130
|
return (0, external_StageNode_utils_cjs_namespaceObject.getProjection)(tasks, activeDragId, overId, offsetLeft);
|
|
@@ -207,7 +207,8 @@ const StageNodeComponent = (props)=>{
|
|
|
207
207
|
handleStageTitleClickToSave,
|
|
208
208
|
isStageTitleEditing
|
|
209
209
|
]);
|
|
210
|
-
const
|
|
210
|
+
const hasContextMenu = !!(onReplaceTaskFromToolbox || onTaskGroupModification);
|
|
211
|
+
const buildContextMenuItems = (0, external_react_namespaceObject.useCallback)((isParallel, groupIndex, taskIndex)=>{
|
|
211
212
|
const items = [];
|
|
212
213
|
if (onReplaceTaskFromToolbox) {
|
|
213
214
|
items.push((0, external_StageNodeTaskUtilities_cjs_namespaceObject.getMenuItem)('replace-task', 'Replace task', ()=>{
|
|
@@ -218,7 +219,8 @@ const StageNodeComponent = (props)=>{
|
|
|
218
219
|
items.push((0, external_StageNodeTaskUtilities_cjs_namespaceObject.getDivider)());
|
|
219
220
|
}
|
|
220
221
|
if (onTaskGroupModification) {
|
|
221
|
-
const
|
|
222
|
+
const taskGroup = tasks[groupIndex] ?? [];
|
|
223
|
+
const reGroupOptions = (0, external_StageNodeTaskUtilities_cjs_namespaceObject.getContextMenuItems)(isParallel, groupIndex, tasks.length, taskIndex, taskGroup.length, (tasks[groupIndex - 1]?.length ?? 0) > 1, (tasks[groupIndex + 1]?.length ?? 0) > 1, reGroupTaskFunction);
|
|
222
224
|
return [
|
|
223
225
|
...items,
|
|
224
226
|
...reGroupOptions
|
|
@@ -232,7 +234,7 @@ const StageNodeComponent = (props)=>{
|
|
|
232
234
|
reGroupTaskFunction,
|
|
233
235
|
tasks
|
|
234
236
|
]);
|
|
235
|
-
const { setSelectedNodeId } = (0, hooks_index_cjs_namespaceObject.
|
|
237
|
+
const { setSelectedNodeId } = (0, hooks_index_cjs_namespaceObject.useSetNodeSelection)();
|
|
236
238
|
const handleStageClick = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
237
239
|
onStageClick?.();
|
|
238
240
|
}, [
|
|
@@ -355,9 +357,9 @@ const StageNodeComponent = (props)=>{
|
|
|
355
357
|
setActiveDragId(event.active.id);
|
|
356
358
|
}, []);
|
|
357
359
|
const handleDragMove = (0, external_react_namespaceObject.useCallback)((event)=>{
|
|
358
|
-
setOffsetLeft(event.delta.x /
|
|
360
|
+
setOffsetLeft(event.delta.x / storeApi.getState().transform[2]);
|
|
359
361
|
}, [
|
|
360
|
-
|
|
362
|
+
storeApi
|
|
361
363
|
]);
|
|
362
364
|
const handleDragOver = (0, external_react_namespaceObject.useCallback)((event)=>{
|
|
363
365
|
setOverId(event.over?.id ?? null);
|
|
@@ -394,10 +396,10 @@ const StageNodeComponent = (props)=>{
|
|
|
394
396
|
taskWidth
|
|
395
397
|
]);
|
|
396
398
|
const dragOverlayStyle = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
397
|
-
transform: `scale(${
|
|
399
|
+
transform: `scale(${storeApi.getState().transform[2]})`,
|
|
398
400
|
transformOrigin: 'top left'
|
|
399
401
|
}), [
|
|
400
|
-
|
|
402
|
+
storeApi.getState
|
|
401
403
|
]);
|
|
402
404
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
403
405
|
"data-testid": `stage-${id}`,
|
|
@@ -538,13 +540,12 @@ const StageNodeComponent = (props)=>{
|
|
|
538
540
|
taskExecution: taskExecution,
|
|
539
541
|
isSelected: selectedTaskId === task.id,
|
|
540
542
|
isParallel: isParallel,
|
|
541
|
-
contextMenuItems: contextMenuItems(isParallel, groupIndex, taskIndex, tasks.length, taskGroup.length, (tasks[groupIndex - 1]?.length ?? 0) > 1, (tasks[groupIndex + 1]?.length ?? 0) > 1),
|
|
542
543
|
onTaskClick: handleTaskClick,
|
|
543
544
|
projectedDepth: task.id === activeDragId && projected ? projected.depth : void 0,
|
|
544
545
|
onTaskPlay: onTaskPlay,
|
|
545
546
|
isDragDisabled: !onTaskReorder,
|
|
546
|
-
|
|
547
|
-
|
|
547
|
+
...hasContextMenu && {
|
|
548
|
+
getContextMenuItems: ()=>buildContextMenuItems(isParallel, groupIndex, taskIndex),
|
|
548
549
|
onMenuOpen: ()=>{
|
|
549
550
|
taskStateReference.current = {
|
|
550
551
|
isParallel,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StageNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNode.tsx"],"names":[],"mappings":"AAqDA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"StageNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNode.tsx"],"names":[],"mappings":"AAqDA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA6oBxD,eAAO,MAAM,SAAS,8CAnoBa,cAAc,6CAmoBA,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,
|
|
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
9
|
import { createPortal } from "react-dom";
|
|
@@ -12,7 +12,7 @@ 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";
|
|
@@ -57,6 +57,7 @@ const StageNodeComponent = (props)=>{
|
|
|
57
57
|
taskIndex: -1
|
|
58
58
|
});
|
|
59
59
|
const isConnecting = useStore((state)=>!!state.connectionClickStartHandle);
|
|
60
|
+
const storeApi = useStoreApi();
|
|
60
61
|
const connectedHandleIds = useConnectedHandles(id);
|
|
61
62
|
const [isAddingTask, setIsAddingTask] = useState(false);
|
|
62
63
|
const [isReplacingTask, setIsReplacingTask] = useState(false);
|
|
@@ -96,7 +97,6 @@ const StageNodeComponent = (props)=>{
|
|
|
96
97
|
tasks,
|
|
97
98
|
activeDragId
|
|
98
99
|
]);
|
|
99
|
-
const { zoom } = useViewport();
|
|
100
100
|
const projected = useMemo(()=>{
|
|
101
101
|
if (!activeDragId || !overId) return null;
|
|
102
102
|
return getProjection(tasks, activeDragId, overId, offsetLeft);
|
|
@@ -179,7 +179,8 @@ const StageNodeComponent = (props)=>{
|
|
|
179
179
|
handleStageTitleClickToSave,
|
|
180
180
|
isStageTitleEditing
|
|
181
181
|
]);
|
|
182
|
-
const
|
|
182
|
+
const hasContextMenu = !!(onReplaceTaskFromToolbox || onTaskGroupModification);
|
|
183
|
+
const buildContextMenuItems = useCallback((isParallel, groupIndex, taskIndex)=>{
|
|
183
184
|
const items = [];
|
|
184
185
|
if (onReplaceTaskFromToolbox) {
|
|
185
186
|
items.push(getMenuItem('replace-task', 'Replace task', ()=>{
|
|
@@ -190,7 +191,8 @@ const StageNodeComponent = (props)=>{
|
|
|
190
191
|
items.push(getDivider());
|
|
191
192
|
}
|
|
192
193
|
if (onTaskGroupModification) {
|
|
193
|
-
const
|
|
194
|
+
const taskGroup = tasks[groupIndex] ?? [];
|
|
195
|
+
const reGroupOptions = getContextMenuItems(isParallel, groupIndex, tasks.length, taskIndex, taskGroup.length, (tasks[groupIndex - 1]?.length ?? 0) > 1, (tasks[groupIndex + 1]?.length ?? 0) > 1, reGroupTaskFunction);
|
|
194
196
|
return [
|
|
195
197
|
...items,
|
|
196
198
|
...reGroupOptions
|
|
@@ -204,7 +206,7 @@ const StageNodeComponent = (props)=>{
|
|
|
204
206
|
reGroupTaskFunction,
|
|
205
207
|
tasks
|
|
206
208
|
]);
|
|
207
|
-
const { setSelectedNodeId } =
|
|
209
|
+
const { setSelectedNodeId } = useSetNodeSelection();
|
|
208
210
|
const handleStageClick = useCallback(()=>{
|
|
209
211
|
onStageClick?.();
|
|
210
212
|
}, [
|
|
@@ -327,9 +329,9 @@ const StageNodeComponent = (props)=>{
|
|
|
327
329
|
setActiveDragId(event.active.id);
|
|
328
330
|
}, []);
|
|
329
331
|
const handleDragMove = useCallback((event)=>{
|
|
330
|
-
setOffsetLeft(event.delta.x /
|
|
332
|
+
setOffsetLeft(event.delta.x / storeApi.getState().transform[2]);
|
|
331
333
|
}, [
|
|
332
|
-
|
|
334
|
+
storeApi
|
|
333
335
|
]);
|
|
334
336
|
const handleDragOver = useCallback((event)=>{
|
|
335
337
|
setOverId(event.over?.id ?? null);
|
|
@@ -366,10 +368,10 @@ const StageNodeComponent = (props)=>{
|
|
|
366
368
|
taskWidth
|
|
367
369
|
]);
|
|
368
370
|
const dragOverlayStyle = useMemo(()=>({
|
|
369
|
-
transform: `scale(${
|
|
371
|
+
transform: `scale(${storeApi.getState().transform[2]})`,
|
|
370
372
|
transformOrigin: 'top left'
|
|
371
373
|
}), [
|
|
372
|
-
|
|
374
|
+
storeApi.getState
|
|
373
375
|
]);
|
|
374
376
|
return /*#__PURE__*/ jsxs("div", {
|
|
375
377
|
"data-testid": `stage-${id}`,
|
|
@@ -510,13 +512,12 @@ const StageNodeComponent = (props)=>{
|
|
|
510
512
|
taskExecution: taskExecution,
|
|
511
513
|
isSelected: selectedTaskId === task.id,
|
|
512
514
|
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
515
|
onTaskClick: handleTaskClick,
|
|
515
516
|
projectedDepth: task.id === activeDragId && projected ? projected.depth : void 0,
|
|
516
517
|
onTaskPlay: onTaskPlay,
|
|
517
518
|
isDragDisabled: !onTaskReorder,
|
|
518
|
-
|
|
519
|
-
|
|
519
|
+
...hasContextMenu && {
|
|
520
|
+
getContextMenuItems: ()=>buildContextMenuItems(isParallel, groupIndex, taskIndex),
|
|
520
521
|
onMenuOpen: ()=>{
|
|
521
522
|
taskStateReference.current = {
|
|
522
523
|
isParallel,
|