@uipath/apollo-react 4.11.0 → 4.12.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/StageNode/DraggableTask.cjs +3 -17
- package/dist/canvas/components/StageNode/DraggableTask.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/DraggableTask.js +3 -17
- package/dist/canvas/components/StageNode/EventDrivenTask.cjs +80 -0
- package/dist/canvas/components/StageNode/EventDrivenTask.d.ts +13 -0
- package/dist/canvas/components/StageNode/EventDrivenTask.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/EventDrivenTask.js +46 -0
- package/dist/canvas/components/StageNode/StageNode.cjs +29 -581
- package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.js +28 -580
- package/dist/canvas/components/StageNode/StageNode.styles.cjs +12 -12
- package/dist/canvas/components/StageNode/StageNode.styles.d.ts +3 -3
- package/dist/canvas/components/StageNode/StageNode.styles.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.styles.js +4 -4
- package/dist/canvas/components/StageNode/StageNode.types.d.ts +11 -0
- package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNodeAdhocTaskGroups.cjs +98 -0
- package/dist/canvas/components/StageNode/StageNodeAdhocTaskGroups.d.ts +13 -0
- package/dist/canvas/components/StageNode/StageNodeAdhocTaskGroups.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageNodeAdhocTaskGroups.js +64 -0
- package/dist/canvas/components/StageNode/StageNodeAllTaskGroups.cjs +129 -0
- package/dist/canvas/components/StageNode/StageNodeAllTaskGroups.d.ts +12 -0
- package/dist/canvas/components/StageNode/StageNodeAllTaskGroups.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageNodeAllTaskGroups.js +95 -0
- package/dist/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.cjs +97 -0
- package/dist/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.d.ts +13 -0
- package/dist/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.js +63 -0
- package/dist/canvas/components/StageNode/StageNodeHandles.cjs +119 -0
- package/dist/canvas/components/StageNode/StageNodeHandles.d.ts +8 -0
- package/dist/canvas/components/StageNode/StageNodeHandles.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageNodeHandles.js +85 -0
- package/dist/canvas/components/StageNode/StageNodeHeader.cjs +245 -0
- package/dist/canvas/components/StageNode/StageNodeHeader.d.ts +9 -0
- package/dist/canvas/components/StageNode/StageNodeHeader.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageNodeHeader.js +211 -0
- package/dist/canvas/components/StageNode/StageNodeSequentialTaskGroups.cjs +176 -0
- package/dist/canvas/components/StageNode/StageNodeSequentialTaskGroups.d.ts +16 -0
- package/dist/canvas/components/StageNode/StageNodeSequentialTaskGroups.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageNodeSequentialTaskGroups.js +142 -0
- package/dist/canvas/components/StageNode/StageTaskEntryConditionIcon.cjs +57 -0
- package/dist/canvas/components/StageNode/StageTaskEntryConditionIcon.d.ts +5 -0
- package/dist/canvas/components/StageNode/StageTaskEntryConditionIcon.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/StageTaskEntryConditionIcon.js +23 -0
- package/dist/canvas/components/StageNode/hooks/useStageTaskDragHandler.cjs +117 -0
- package/dist/canvas/components/StageNode/hooks/useStageTaskDragHandler.d.ts +18 -0
- package/dist/canvas/components/StageNode/hooks/useStageTaskDragHandler.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/hooks/useStageTaskDragHandler.js +83 -0
- package/dist/canvas/components/StageNode/hooks/useStageTasksByGroups.cjs +87 -0
- package/dist/canvas/components/StageNode/hooks/useStageTasksByGroups.d.ts +22 -0
- package/dist/canvas/components/StageNode/hooks/useStageTasksByGroups.d.ts.map +1 -0
- package/dist/canvas/components/StageNode/hooks/useStageTasksByGroups.js +53 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useStageTaskDragHandler: ()=>useStageTaskDragHandler
|
|
28
|
+
});
|
|
29
|
+
const react_namespaceObject = require("@xyflow/react");
|
|
30
|
+
const external_react_namespaceObject = require("react");
|
|
31
|
+
const external_StageNode_utils_cjs_namespaceObject = require("../StageNode.utils.cjs");
|
|
32
|
+
const useStageTaskDragHandler = ({ sequentialTaskGroups, sequentialTasks, onTaskReorder })=>{
|
|
33
|
+
const storeApi = (0, react_namespaceObject.useStoreApi)();
|
|
34
|
+
const [activeDragId, setActiveDragId] = (0, external_react_namespaceObject.useState)(null);
|
|
35
|
+
const [offsetLeft, setOffsetLeft] = (0, external_react_namespaceObject.useState)(0);
|
|
36
|
+
const [overId, setOverId] = (0, external_react_namespaceObject.useState)(null);
|
|
37
|
+
const activeSequentialTask = (0, external_react_namespaceObject.useMemo)(()=>sequentialTasks.find(({ task })=>task.id === activeDragId), [
|
|
38
|
+
sequentialTasks,
|
|
39
|
+
activeDragId
|
|
40
|
+
]);
|
|
41
|
+
const isActiveTaskParallel = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
42
|
+
if (!activeDragId) return false;
|
|
43
|
+
const group = sequentialTaskGroups.find((g)=>g.some((t)=>t.id === activeDragId));
|
|
44
|
+
return group ? group.length > 1 : false;
|
|
45
|
+
}, [
|
|
46
|
+
sequentialTaskGroups,
|
|
47
|
+
activeDragId
|
|
48
|
+
]);
|
|
49
|
+
const projected = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
50
|
+
if (!activeDragId || !overId) return null;
|
|
51
|
+
return (0, external_StageNode_utils_cjs_namespaceObject.getProjection)(sequentialTaskGroups, activeDragId, overId, offsetLeft);
|
|
52
|
+
}, [
|
|
53
|
+
sequentialTaskGroups,
|
|
54
|
+
activeDragId,
|
|
55
|
+
overId,
|
|
56
|
+
offsetLeft
|
|
57
|
+
]);
|
|
58
|
+
const resetState = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
59
|
+
setActiveDragId(null);
|
|
60
|
+
setOffsetLeft(0);
|
|
61
|
+
setOverId(null);
|
|
62
|
+
}, []);
|
|
63
|
+
const handleDragStart = (0, external_react_namespaceObject.useCallback)((event)=>{
|
|
64
|
+
setActiveDragId(event.active.id);
|
|
65
|
+
}, []);
|
|
66
|
+
const handleDragMove = (0, external_react_namespaceObject.useCallback)((event)=>{
|
|
67
|
+
setOffsetLeft(event.delta.x / storeApi.getState().transform[2]);
|
|
68
|
+
}, [
|
|
69
|
+
storeApi
|
|
70
|
+
]);
|
|
71
|
+
const handleDragOver = (0, external_react_namespaceObject.useCallback)((event)=>{
|
|
72
|
+
setOverId(event.over?.id ?? null);
|
|
73
|
+
}, []);
|
|
74
|
+
const handleDragEnd = (0, external_react_namespaceObject.useCallback)((event)=>{
|
|
75
|
+
const { active, over } = event;
|
|
76
|
+
const currentOffsetLeft = offsetLeft;
|
|
77
|
+
resetState();
|
|
78
|
+
if (!over) return;
|
|
79
|
+
const projection = (0, external_StageNode_utils_cjs_namespaceObject.getProjection)(sequentialTaskGroups, active.id, over.id, currentOffsetLeft);
|
|
80
|
+
if (!projection) return;
|
|
81
|
+
if (active.id === over.id) {
|
|
82
|
+
const flattened = (0, external_StageNode_utils_cjs_namespaceObject.flattenTasks)(sequentialTaskGroups);
|
|
83
|
+
const activeTask = flattened.find((t)=>t.id === active.id);
|
|
84
|
+
if (activeTask && activeTask.depth === projection.depth) return;
|
|
85
|
+
}
|
|
86
|
+
const newTasks = (0, external_StageNode_utils_cjs_namespaceObject.reorderTasks)(sequentialTaskGroups, active.id, over.id, projection.depth);
|
|
87
|
+
onTaskReorder(newTasks);
|
|
88
|
+
}, [
|
|
89
|
+
sequentialTaskGroups,
|
|
90
|
+
onTaskReorder,
|
|
91
|
+
offsetLeft,
|
|
92
|
+
resetState
|
|
93
|
+
]);
|
|
94
|
+
const handleDragCancel = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
95
|
+
resetState();
|
|
96
|
+
}, [
|
|
97
|
+
resetState
|
|
98
|
+
]);
|
|
99
|
+
return {
|
|
100
|
+
activeDragId,
|
|
101
|
+
activeSequentialTask,
|
|
102
|
+
isActiveTaskParallel,
|
|
103
|
+
projected,
|
|
104
|
+
handleDragMove,
|
|
105
|
+
handleDragOver,
|
|
106
|
+
handleDragStart,
|
|
107
|
+
handleDragEnd,
|
|
108
|
+
handleDragCancel
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
exports.useStageTaskDragHandler = __webpack_exports__.useStageTaskDragHandler;
|
|
112
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
113
|
+
"useStageTaskDragHandler"
|
|
114
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
115
|
+
Object.defineProperty(exports, '__esModule', {
|
|
116
|
+
value: true
|
|
117
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DragEndEvent, DragMoveEvent, DragOverEvent, DragStartEvent } from '@dnd-kit/core';
|
|
2
|
+
import { StageTaskGroup, StageTaskItem } from '../StageNode.types';
|
|
3
|
+
export declare const useStageTaskDragHandler: ({ sequentialTaskGroups, sequentialTasks, onTaskReorder, }: {
|
|
4
|
+
sequentialTaskGroups: StageTaskItem[][];
|
|
5
|
+
sequentialTasks: StageTaskGroup[];
|
|
6
|
+
onTaskReorder: (newTasks: StageTaskItem[][]) => void;
|
|
7
|
+
}) => {
|
|
8
|
+
activeDragId: string | null;
|
|
9
|
+
activeSequentialTask: StageTaskGroup | undefined;
|
|
10
|
+
isActiveTaskParallel: boolean;
|
|
11
|
+
projected: import("../StageNode.utils").ProjectionResult | null;
|
|
12
|
+
handleDragMove: (event: DragMoveEvent) => void;
|
|
13
|
+
handleDragOver: (event: DragOverEvent) => void;
|
|
14
|
+
handleDragStart: (event: DragStartEvent) => void;
|
|
15
|
+
handleDragEnd: (event: DragEndEvent) => void;
|
|
16
|
+
handleDragCancel: () => void;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useStageTaskDragHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStageTaskDragHandler.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/StageNode/hooks/useStageTaskDragHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG3F,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnE,eAAO,MAAM,uBAAuB,GAAI,2DAIrC;IACD,oBAAoB,EAAE,aAAa,EAAE,EAAE,CAAC;IACxC,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,aAAa,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,KAAK,IAAI,CAAC;CACtD;;;;;4BAkCW,aAAa;4BAMoB,aAAa;6BAXZ,cAAc;2BAgBhD,YAAY;;CAsDvB,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useStoreApi } from "@xyflow/react";
|
|
2
|
+
import { useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { flattenTasks, getProjection, reorderTasks } from "../StageNode.utils.js";
|
|
4
|
+
const useStageTaskDragHandler = ({ sequentialTaskGroups, sequentialTasks, onTaskReorder })=>{
|
|
5
|
+
const storeApi = useStoreApi();
|
|
6
|
+
const [activeDragId, setActiveDragId] = useState(null);
|
|
7
|
+
const [offsetLeft, setOffsetLeft] = useState(0);
|
|
8
|
+
const [overId, setOverId] = useState(null);
|
|
9
|
+
const activeSequentialTask = useMemo(()=>sequentialTasks.find(({ task })=>task.id === activeDragId), [
|
|
10
|
+
sequentialTasks,
|
|
11
|
+
activeDragId
|
|
12
|
+
]);
|
|
13
|
+
const isActiveTaskParallel = useMemo(()=>{
|
|
14
|
+
if (!activeDragId) return false;
|
|
15
|
+
const group = sequentialTaskGroups.find((g)=>g.some((t)=>t.id === activeDragId));
|
|
16
|
+
return group ? group.length > 1 : false;
|
|
17
|
+
}, [
|
|
18
|
+
sequentialTaskGroups,
|
|
19
|
+
activeDragId
|
|
20
|
+
]);
|
|
21
|
+
const projected = useMemo(()=>{
|
|
22
|
+
if (!activeDragId || !overId) return null;
|
|
23
|
+
return getProjection(sequentialTaskGroups, activeDragId, overId, offsetLeft);
|
|
24
|
+
}, [
|
|
25
|
+
sequentialTaskGroups,
|
|
26
|
+
activeDragId,
|
|
27
|
+
overId,
|
|
28
|
+
offsetLeft
|
|
29
|
+
]);
|
|
30
|
+
const resetState = useCallback(()=>{
|
|
31
|
+
setActiveDragId(null);
|
|
32
|
+
setOffsetLeft(0);
|
|
33
|
+
setOverId(null);
|
|
34
|
+
}, []);
|
|
35
|
+
const handleDragStart = useCallback((event)=>{
|
|
36
|
+
setActiveDragId(event.active.id);
|
|
37
|
+
}, []);
|
|
38
|
+
const handleDragMove = useCallback((event)=>{
|
|
39
|
+
setOffsetLeft(event.delta.x / storeApi.getState().transform[2]);
|
|
40
|
+
}, [
|
|
41
|
+
storeApi
|
|
42
|
+
]);
|
|
43
|
+
const handleDragOver = useCallback((event)=>{
|
|
44
|
+
setOverId(event.over?.id ?? null);
|
|
45
|
+
}, []);
|
|
46
|
+
const handleDragEnd = useCallback((event)=>{
|
|
47
|
+
const { active, over } = event;
|
|
48
|
+
const currentOffsetLeft = offsetLeft;
|
|
49
|
+
resetState();
|
|
50
|
+
if (!over) return;
|
|
51
|
+
const projection = getProjection(sequentialTaskGroups, active.id, over.id, currentOffsetLeft);
|
|
52
|
+
if (!projection) return;
|
|
53
|
+
if (active.id === over.id) {
|
|
54
|
+
const flattened = flattenTasks(sequentialTaskGroups);
|
|
55
|
+
const activeTask = flattened.find((t)=>t.id === active.id);
|
|
56
|
+
if (activeTask && activeTask.depth === projection.depth) return;
|
|
57
|
+
}
|
|
58
|
+
const newTasks = reorderTasks(sequentialTaskGroups, active.id, over.id, projection.depth);
|
|
59
|
+
onTaskReorder(newTasks);
|
|
60
|
+
}, [
|
|
61
|
+
sequentialTaskGroups,
|
|
62
|
+
onTaskReorder,
|
|
63
|
+
offsetLeft,
|
|
64
|
+
resetState
|
|
65
|
+
]);
|
|
66
|
+
const handleDragCancel = useCallback(()=>{
|
|
67
|
+
resetState();
|
|
68
|
+
}, [
|
|
69
|
+
resetState
|
|
70
|
+
]);
|
|
71
|
+
return {
|
|
72
|
+
activeDragId,
|
|
73
|
+
activeSequentialTask,
|
|
74
|
+
isActiveTaskParallel,
|
|
75
|
+
projected,
|
|
76
|
+
handleDragMove,
|
|
77
|
+
handleDragOver,
|
|
78
|
+
handleDragStart,
|
|
79
|
+
handleDragEnd,
|
|
80
|
+
handleDragCancel
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export { useStageTaskDragHandler };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useStageTasksByGroups: ()=>useStageTasksByGroups
|
|
28
|
+
});
|
|
29
|
+
const external_react_namespaceObject = require("react");
|
|
30
|
+
const useStageTasksByGroups = (allTasks)=>{
|
|
31
|
+
const sequentialTaskGroups = (0, external_react_namespaceObject.useMemo)(()=>allTasks.filter((group)=>group.some((t)=>{
|
|
32
|
+
if (null != t.taskGroupType) return 'sequential' === t.taskGroupType;
|
|
33
|
+
if (null != t.isAdhoc) return !t.isAdhoc;
|
|
34
|
+
return true;
|
|
35
|
+
})), [
|
|
36
|
+
allTasks
|
|
37
|
+
]);
|
|
38
|
+
const sequentialTasks = (0, external_react_namespaceObject.useMemo)(()=>sequentialTaskGroups.flatMap((group, groupIndex)=>group.map((task, taskIndex)=>({
|
|
39
|
+
task,
|
|
40
|
+
groupIndex,
|
|
41
|
+
taskIndex
|
|
42
|
+
}))), [
|
|
43
|
+
sequentialTaskGroups
|
|
44
|
+
]);
|
|
45
|
+
const adhocTaskGroups = (0, external_react_namespaceObject.useMemo)(()=>allTasks.filter((group)=>group.every((t)=>{
|
|
46
|
+
if (null != t.taskGroupType) return 'adhoc' === t.taskGroupType;
|
|
47
|
+
if (null != t.isAdhoc) return t.isAdhoc;
|
|
48
|
+
return false;
|
|
49
|
+
})), [
|
|
50
|
+
allTasks
|
|
51
|
+
]);
|
|
52
|
+
const adhocTasks = (0, external_react_namespaceObject.useMemo)(()=>adhocTaskGroups.flatMap((group, groupIndex)=>group.map((task, taskIndex)=>({
|
|
53
|
+
task,
|
|
54
|
+
groupIndex,
|
|
55
|
+
taskIndex
|
|
56
|
+
}))), [
|
|
57
|
+
adhocTaskGroups
|
|
58
|
+
]);
|
|
59
|
+
const eventDrivenTaskGroups = (0, external_react_namespaceObject.useMemo)(()=>allTasks.filter((group)=>group.every((t)=>{
|
|
60
|
+
if (null != t.taskGroupType) return 'event-driven' === t.taskGroupType;
|
|
61
|
+
return false;
|
|
62
|
+
})), [
|
|
63
|
+
allTasks
|
|
64
|
+
]);
|
|
65
|
+
const eventDrivenTasks = (0, external_react_namespaceObject.useMemo)(()=>eventDrivenTaskGroups.flatMap((group, groupIndex)=>group.map((task, taskIndex)=>({
|
|
66
|
+
task,
|
|
67
|
+
groupIndex,
|
|
68
|
+
taskIndex
|
|
69
|
+
}))), [
|
|
70
|
+
eventDrivenTaskGroups
|
|
71
|
+
]);
|
|
72
|
+
return {
|
|
73
|
+
sequentialTaskGroups,
|
|
74
|
+
sequentialTasks,
|
|
75
|
+
adhocTaskGroups,
|
|
76
|
+
adhocTasks,
|
|
77
|
+
eventDrivenTaskGroups,
|
|
78
|
+
eventDrivenTasks
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
exports.useStageTasksByGroups = __webpack_exports__.useStageTasksByGroups;
|
|
82
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
83
|
+
"useStageTasksByGroups"
|
|
84
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
85
|
+
Object.defineProperty(exports, '__esModule', {
|
|
86
|
+
value: true
|
|
87
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StageTaskItem } from '../StageNode.types';
|
|
2
|
+
export declare const useStageTasksByGroups: (allTasks: StageTaskItem[][]) => {
|
|
3
|
+
sequentialTaskGroups: StageTaskItem[][];
|
|
4
|
+
sequentialTasks: {
|
|
5
|
+
task: StageTaskItem;
|
|
6
|
+
groupIndex: number;
|
|
7
|
+
taskIndex: number;
|
|
8
|
+
}[];
|
|
9
|
+
adhocTaskGroups: StageTaskItem[][];
|
|
10
|
+
adhocTasks: {
|
|
11
|
+
task: StageTaskItem;
|
|
12
|
+
groupIndex: number;
|
|
13
|
+
taskIndex: number;
|
|
14
|
+
}[];
|
|
15
|
+
eventDrivenTaskGroups: StageTaskItem[][];
|
|
16
|
+
eventDrivenTasks: {
|
|
17
|
+
task: StageTaskItem;
|
|
18
|
+
groupIndex: number;
|
|
19
|
+
taskIndex: number;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useStageTasksByGroups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStageTasksByGroups.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/StageNode/hooks/useStageTasksByGroups.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,eAAO,MAAM,qBAAqB,GAAI,UAAU,aAAa,EAAE,EAAE;;;;;;;;;;;;;;;;;;;CA2EhE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
const useStageTasksByGroups = (allTasks)=>{
|
|
3
|
+
const sequentialTaskGroups = useMemo(()=>allTasks.filter((group)=>group.some((t)=>{
|
|
4
|
+
if (null != t.taskGroupType) return 'sequential' === t.taskGroupType;
|
|
5
|
+
if (null != t.isAdhoc) return !t.isAdhoc;
|
|
6
|
+
return true;
|
|
7
|
+
})), [
|
|
8
|
+
allTasks
|
|
9
|
+
]);
|
|
10
|
+
const sequentialTasks = useMemo(()=>sequentialTaskGroups.flatMap((group, groupIndex)=>group.map((task, taskIndex)=>({
|
|
11
|
+
task,
|
|
12
|
+
groupIndex,
|
|
13
|
+
taskIndex
|
|
14
|
+
}))), [
|
|
15
|
+
sequentialTaskGroups
|
|
16
|
+
]);
|
|
17
|
+
const adhocTaskGroups = useMemo(()=>allTasks.filter((group)=>group.every((t)=>{
|
|
18
|
+
if (null != t.taskGroupType) return 'adhoc' === t.taskGroupType;
|
|
19
|
+
if (null != t.isAdhoc) return t.isAdhoc;
|
|
20
|
+
return false;
|
|
21
|
+
})), [
|
|
22
|
+
allTasks
|
|
23
|
+
]);
|
|
24
|
+
const adhocTasks = useMemo(()=>adhocTaskGroups.flatMap((group, groupIndex)=>group.map((task, taskIndex)=>({
|
|
25
|
+
task,
|
|
26
|
+
groupIndex,
|
|
27
|
+
taskIndex
|
|
28
|
+
}))), [
|
|
29
|
+
adhocTaskGroups
|
|
30
|
+
]);
|
|
31
|
+
const eventDrivenTaskGroups = useMemo(()=>allTasks.filter((group)=>group.every((t)=>{
|
|
32
|
+
if (null != t.taskGroupType) return 'event-driven' === t.taskGroupType;
|
|
33
|
+
return false;
|
|
34
|
+
})), [
|
|
35
|
+
allTasks
|
|
36
|
+
]);
|
|
37
|
+
const eventDrivenTasks = useMemo(()=>eventDrivenTaskGroups.flatMap((group, groupIndex)=>group.map((task, taskIndex)=>({
|
|
38
|
+
task,
|
|
39
|
+
groupIndex,
|
|
40
|
+
taskIndex
|
|
41
|
+
}))), [
|
|
42
|
+
eventDrivenTaskGroups
|
|
43
|
+
]);
|
|
44
|
+
return {
|
|
45
|
+
sequentialTaskGroups,
|
|
46
|
+
sequentialTasks,
|
|
47
|
+
adhocTaskGroups,
|
|
48
|
+
adhocTasks,
|
|
49
|
+
eventDrivenTaskGroups,
|
|
50
|
+
eventDrivenTasks
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export { useStageTasksByGroups };
|