@uipath/apollo-react 4.12.1 → 4.12.2-pr572.e8b532c

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.
Files changed (32) hide show
  1. package/dist/canvas/components/BaseNode/BaseNode.cjs +2 -0
  2. package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
  3. package/dist/canvas/components/BaseNode/BaseNode.js +2 -0
  4. package/dist/canvas/components/BaseNode/BaseNodeContainer.cjs +4 -2
  5. package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts +2 -1
  6. package/dist/canvas/components/BaseNode/BaseNodeContainer.d.ts.map +1 -1
  7. package/dist/canvas/components/BaseNode/BaseNodeContainer.js +4 -2
  8. package/dist/canvas/components/StageNode/DraggableTask.cjs +3 -2
  9. package/dist/canvas/components/StageNode/DraggableTask.js +3 -2
  10. package/dist/canvas/components/StageNode/DraggableTask.types.d.ts +1 -1
  11. package/dist/canvas/components/StageNode/DraggableTask.types.d.ts.map +1 -1
  12. package/dist/canvas/components/StageNode/StageNodeAdhocTaskGroups.cjs +11 -25
  13. package/dist/canvas/components/StageNode/StageNodeAdhocTaskGroups.d.ts +5 -5
  14. package/dist/canvas/components/StageNode/StageNodeAdhocTaskGroups.d.ts.map +1 -1
  15. package/dist/canvas/components/StageNode/StageNodeAdhocTaskGroups.js +11 -25
  16. package/dist/canvas/components/StageNode/StageNodeAllTaskGroups.cjs +50 -7
  17. package/dist/canvas/components/StageNode/StageNodeAllTaskGroups.d.ts.map +1 -1
  18. package/dist/canvas/components/StageNode/StageNodeAllTaskGroups.js +50 -7
  19. package/dist/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.cjs +11 -25
  20. package/dist/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.d.ts +5 -5
  21. package/dist/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.d.ts.map +1 -1
  22. package/dist/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.js +11 -25
  23. package/dist/canvas/components/StageNode/StageNodeSequentialTaskGroups.cjs +27 -20
  24. package/dist/canvas/components/StageNode/StageNodeSequentialTaskGroups.d.ts +6 -5
  25. package/dist/canvas/components/StageNode/StageNodeSequentialTaskGroups.d.ts.map +1 -1
  26. package/dist/canvas/components/StageNode/StageNodeSequentialTaskGroups.js +28 -21
  27. package/dist/canvas/components/StageNode/StageNodeTaskUtilities.cjs +11 -11
  28. package/dist/canvas/components/StageNode/StageNodeTaskUtilities.d.ts +11 -1
  29. package/dist/canvas/components/StageNode/StageNodeTaskUtilities.d.ts.map +1 -1
  30. package/dist/canvas/components/StageNode/StageNodeTaskUtilities.js +11 -11
  31. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  32. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"StageNodeEventDrivenTaskGroups.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAe,MAAM,OAAO,CAAC;AASrD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAsG5F,eAAO,MAAM,8BAA8B,qKA1FxC;IACD,KAAK,EAAE,cAAc,CAAC;IACtB,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,kBAAkB,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,IAAI,CAAC;CACxD,oDAiFsF,CAAC"}
1
+ {"version":3,"file":"StageNodeEventDrivenTaskGroups.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNodeEventDrivenTaskGroups.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOvD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA8ExE,eAAO,MAAM,8BAA8B,oMAnExC;IACD,KAAK,EAAE,cAAc,CAAC;IACtB,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,kCAAkC,EAAE,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,OAAO,KAChB,YAAY,GAAG,SAAS,CAAC;IAC9B,iCAAiC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,YAAY,GAAG,SAAS,CAAC;CACjF,oDAuDsF,CAAC"}
@@ -1,33 +1,19 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { memo, useCallback } from "react";
3
- import { GroupModificationType } from "../../utils/GroupModificationUtils.js";
4
3
  import { EventDrivenTaskItem } from "./EventDrivenTask.js";
5
4
  import { StageAdditionalTasksHeaderSection, StageAdditionalTasksSection, StageTaskList } from "./StageNode.styles.js";
6
- import { getDivider, getMenuItem } from "./StageNodeTaskUtilities.js";
7
- const StageNodeEventDrivenTaskGroupsInner = ({ props, eventDrivenTasks, isReadOnly, selectedTaskId, taskStateReference, marginTop, handleTaskClick, setIsReplacingTask })=>{
8
- const { execution, onTaskClick, onTaskGroupModification, onReplaceTaskFromToolbox, loadingTaskIds } = props;
9
- const getEventDrivenContextMenuItems = useCallback((groupIndex, taskIndex, taskId)=>{
5
+ const StageNodeEventDrivenTaskGroupsInner = ({ props, eventDrivenTasks, isReadOnly, selectedTaskId, marginTop, handleTaskClick, generateReplaceTaskMenuItemForTask, generateDeleteTaskMenuItemForTask })=>{
6
+ const { execution, onTaskGroupModification, onReplaceTaskFromToolbox, loadingTaskIds } = props;
7
+ const getEventDrivenContextMenuItems = useCallback((taskId)=>{
10
8
  const items = [];
11
- if (onReplaceTaskFromToolbox) items.push(getMenuItem('replace-task', 'Replace task', ()=>{
12
- taskStateReference.current = {
13
- isParallel: false,
14
- groupIndex,
15
- taskIndex
16
- };
17
- onTaskClick?.(taskId);
18
- setIsReplacingTask(true);
19
- }));
20
- if (onTaskGroupModification) {
21
- if (items.length > 0) items.push(getDivider());
22
- items.push(getMenuItem('remove-task', 'Delete task', ()=>onTaskGroupModification(GroupModificationType.REMOVE_TASK, groupIndex, taskIndex)));
23
- }
9
+ const replaceTaskMenuItem = generateReplaceTaskMenuItemForTask(taskId, false);
10
+ if (replaceTaskMenuItem) items.push(replaceTaskMenuItem);
11
+ const deleteTaskMenuItem = generateDeleteTaskMenuItemForTask(taskId);
12
+ if (deleteTaskMenuItem) items.push(deleteTaskMenuItem);
24
13
  return items;
25
14
  }, [
26
- onReplaceTaskFromToolbox,
27
- onTaskClick,
28
- onTaskGroupModification,
29
- setIsReplacingTask,
30
- taskStateReference
15
+ generateReplaceTaskMenuItemForTask,
16
+ generateDeleteTaskMenuItemForTask
31
17
  ]);
32
18
  if (0 === eventDrivenTasks.length) return null;
33
19
  return /*#__PURE__*/ jsxs(StageAdditionalTasksSection, {
@@ -42,7 +28,7 @@ const StageNodeEventDrivenTaskGroupsInner = ({ props, eventDrivenTasks, isReadOn
42
28
  })
43
29
  }),
44
30
  /*#__PURE__*/ jsx(StageTaskList, {
45
- children: eventDrivenTasks.map(({ task, groupIndex, taskIndex })=>{
31
+ children: eventDrivenTasks.map(({ task })=>{
46
32
  const taskExecution = execution?.taskStatus?.[task.id];
47
33
  return /*#__PURE__*/ jsx(EventDrivenTaskItem, {
48
34
  task: task,
@@ -51,7 +37,7 @@ const StageNodeEventDrivenTaskGroupsInner = ({ props, eventDrivenTasks, isReadOn
51
37
  onTaskClick: handleTaskClick,
52
38
  isTaskLoading: loadingTaskIds?.has(task.id),
53
39
  ...(onTaskGroupModification || onReplaceTaskFromToolbox) && !isReadOnly && {
54
- getContextMenuItems: ()=>getEventDrivenContextMenuItems(groupIndex, taskIndex, task.id)
40
+ getContextMenuItems: ()=>getEventDrivenContextMenuItems(task.id)
55
41
  }
56
42
  }, task.id);
57
43
  })
@@ -38,8 +38,8 @@ const useStageTaskDragHandler_cjs_namespaceObject = require("./hooks/useStageTas
38
38
  const external_StageNode_styles_cjs_namespaceObject = require("./StageNode.styles.cjs");
39
39
  const external_StageNodeTaskUtilities_cjs_namespaceObject = require("./StageNodeTaskUtilities.cjs");
40
40
  const external_StageTaskDragOverlay_cjs_namespaceObject = require("./StageTaskDragOverlay.cjs");
41
- const StageNodeSequentialTaskGroups = ({ props, sequentialTaskGroups, sequentialTasks, isReadOnly, selectedTaskId, taskWidthStyle, taskStateReference, hasContextMenu, handleTaskClick, setIsReplacingTask, handleReorderSequentialTasks })=>{
42
- const { execution, onTaskClick, onTaskGroupModification, onTaskReorder, onReplaceTaskFromToolbox, hideParallelOptions, loadingTaskIds } = props;
41
+ const StageNodeSequentialTaskGroups = ({ props, sequentialTaskGroups, sequentialTasks, allTasks, isReadOnly, selectedTaskId, taskWidthStyle, hasContextMenu, handleTaskClick, handleReorderSequentialTasks, generateReplaceTaskMenuItemForTask })=>{
42
+ const { execution, onTaskGroupModification, onTaskReorder, hideParallelOptions, loadingTaskIds } = props;
43
43
  const sequentialTaskIds = (0, external_react_namespaceObject.useMemo)(()=>sequentialTasks.map(({ task })=>task.id), [
44
44
  sequentialTasks
45
45
  ]);
@@ -62,25 +62,34 @@ const StageNodeSequentialTaskGroups = ({ props, sequentialTaskGroups, sequential
62
62
  onTaskGroupModification,
63
63
  sequentialTaskGroups
64
64
  ]);
65
- const buildContextMenuItems = (0, external_react_namespaceObject.useCallback)((groupIndex, taskIndex)=>{
65
+ const buildContextMenuItems = (0, external_react_namespaceObject.useCallback)((groupIndex, _, taskId)=>{
66
66
  const taskGroup = sequentialTaskGroups[groupIndex] ?? [];
67
67
  const isParallel = taskGroup.length > 1;
68
68
  const items = [];
69
- if (onReplaceTaskFromToolbox) {
70
- items.push((0, external_StageNodeTaskUtilities_cjs_namespaceObject.getMenuItem)('replace-task', 'Replace task', ()=>{
71
- taskStateReference.current = {
72
- isParallel,
73
- groupIndex,
74
- taskIndex
75
- };
76
- const taskId = taskGroup[taskIndex]?.id;
77
- if (taskId) onTaskClick?.(taskId);
78
- setIsReplacingTask(true);
79
- }));
69
+ const replaceTaskMenuItem = generateReplaceTaskMenuItemForTask(taskId, isParallel);
70
+ if (replaceTaskMenuItem) {
71
+ items.push(replaceTaskMenuItem);
80
72
  items.push((0, external_StageNodeTaskUtilities_cjs_namespaceObject.getDivider)());
81
73
  }
82
- if (onTaskGroupModification) {
83
- const reGroupOptions = (0, external_StageNodeTaskUtilities_cjs_namespaceObject.getContextMenuItems)(isParallel, groupIndex, sequentialTaskGroups.length, taskIndex, taskGroup.length, (sequentialTaskGroups[groupIndex - 1]?.length ?? 0) > 1, (sequentialTaskGroups[groupIndex + 1]?.length ?? 0) > 1, handleTaskRegroup, hideParallelOptions);
74
+ let groupIndexInAllTasks;
75
+ let taskIndexInAllTasks;
76
+ for (const [allTasksGroupIndex, group] of allTasks.entries())for (const [allTasksTaskIndex, task] of group.entries())if (task.id === taskId) {
77
+ groupIndexInAllTasks = allTasksGroupIndex;
78
+ taskIndexInAllTasks = allTasksTaskIndex;
79
+ break;
80
+ }
81
+ if (onTaskGroupModification && void 0 !== groupIndexInAllTasks && void 0 !== taskIndexInAllTasks) {
82
+ const reGroupOptions = (0, external_StageNodeTaskUtilities_cjs_namespaceObject.getContextMenuItems)({
83
+ isParallelGroup: isParallel,
84
+ groupIndex,
85
+ tasksLength: sequentialTaskGroups.length,
86
+ groupIndexInAllTasks,
87
+ taskIndexInAllTasks,
88
+ isAboveParallel: (sequentialTaskGroups[groupIndex - 1]?.length ?? 0) > 1,
89
+ isBelowParallel: (sequentialTaskGroups[groupIndex + 1]?.length ?? 0) > 1,
90
+ reGroupTaskFunction: handleTaskRegroup,
91
+ hideParallelOptions
92
+ });
84
93
  return [
85
94
  ...items,
86
95
  ...reGroupOptions
@@ -88,14 +97,12 @@ const StageNodeSequentialTaskGroups = ({ props, sequentialTaskGroups, sequential
88
97
  }
89
98
  return items;
90
99
  }, [
91
- onReplaceTaskFromToolbox,
92
- onTaskClick,
93
100
  onTaskGroupModification,
94
101
  sequentialTaskGroups,
95
102
  hideParallelOptions,
96
103
  handleTaskRegroup,
97
- setIsReplacingTask,
98
- taskStateReference
104
+ generateReplaceTaskMenuItemForTask,
105
+ allTasks
99
106
  ]);
100
107
  const sensors = (0, core_namespaceObject.useSensors)((0, core_namespaceObject.useSensor)(core_namespaceObject.PointerSensor, {
101
108
  activationConstraint: {
@@ -1,16 +1,17 @@
1
- import { CSSProperties, RefObject } from 'react';
2
- import type { StageNodeProps, StageTaskGroup, StageTaskItem, TaskStateReference } from './StageNode.types';
3
- export declare const StageNodeSequentialTaskGroups: ({ props, sequentialTaskGroups, sequentialTasks, isReadOnly, selectedTaskId, taskWidthStyle, taskStateReference, hasContextMenu, handleTaskClick, setIsReplacingTask, handleReorderSequentialTasks, }: {
1
+ import { CSSProperties } from 'react';
2
+ import type { NodeMenuItem } from '../NodeContextMenu';
3
+ import type { StageNodeProps, StageTaskGroup, StageTaskItem } from './StageNode.types';
4
+ export declare const StageNodeSequentialTaskGroups: ({ props, sequentialTaskGroups, sequentialTasks, allTasks, isReadOnly, selectedTaskId, taskWidthStyle, hasContextMenu, handleTaskClick, handleReorderSequentialTasks, generateReplaceTaskMenuItemForTask, }: {
4
5
  props: StageNodeProps;
5
6
  sequentialTaskGroups: StageTaskItem[][];
6
7
  sequentialTasks: StageTaskGroup[];
8
+ allTasks: StageTaskItem[][];
7
9
  isReadOnly: boolean;
8
10
  selectedTaskId?: string;
9
11
  taskWidthStyle?: CSSProperties;
10
- taskStateReference: RefObject<TaskStateReference>;
11
12
  hasContextMenu: boolean;
12
13
  handleTaskClick: (e: React.MouseEvent, taskElementId: string) => void;
13
- setIsReplacingTask: (isReplacingTask: boolean) => void;
14
14
  handleReorderSequentialTasks: (newTasks: StageTaskItem[][]) => void;
15
+ generateReplaceTaskMenuItemForTask: (taskId: string, isParallel: boolean) => NodeMenuItem | undefined;
15
16
  }) => import("react/jsx-runtime").JSX.Element | null;
16
17
  //# sourceMappingURL=StageNodeSequentialTaskGroups.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StageNodeSequentialTaskGroups.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNodeSequentialTaskGroups.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAwB,MAAM,OAAO,CAAC;AAevE,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,aAAa,EACb,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAI3B,eAAO,MAAM,6BAA6B,GAAI,sMAY3C;IACD,KAAK,EAAE,cAAc,CAAC;IACtB,oBAAoB,EAAE,aAAa,EAAE,EAAE,CAAC;IACxC,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,kBAAkB,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC;IAClD,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,kBAAkB,EAAE,CAAC,eAAe,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,4BAA4B,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,KAAK,IAAI,CAAC;CACrE,mDAqLA,CAAC"}
1
+ {"version":3,"file":"StageNodeSequentialTaskGroups.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNodeSequentialTaskGroups.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,aAAa,EAAwB,MAAM,OAAO,CAAC;AAM5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AASvD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvF,eAAO,MAAM,6BAA6B,GAAI,4MAY3C;IACD,KAAK,EAAE,cAAc,CAAC;IACtB,oBAAoB,EAAE,aAAa,EAAE,EAAE,CAAC;IACxC,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,QAAQ,EAAE,aAAa,EAAE,EAAE,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,4BAA4B,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,KAAK,IAAI,CAAC;IACpE,kCAAkC,EAAE,CAClC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,OAAO,KAChB,YAAY,GAAG,SAAS,CAAC;CAC/B,mDAiLA,CAAC"}
@@ -8,10 +8,10 @@ import { GroupModificationType, moveGroupDown, moveGroupUp } from "../../utils/G
8
8
  import { DraggableTask } from "./DraggableTask.js";
9
9
  import { useStageTaskDragHandler } from "./hooks/useStageTaskDragHandler.js";
10
10
  import { StageParallelBracket, StageParallelLabel, StageTaskGroupContainer, StageTaskList } from "./StageNode.styles.js";
11
- import { getContextMenuItems, getDivider, getMenuItem } from "./StageNodeTaskUtilities.js";
11
+ import { getContextMenuItems, getDivider } from "./StageNodeTaskUtilities.js";
12
12
  import { StageTaskDragOverlay } from "./StageTaskDragOverlay.js";
13
- const StageNodeSequentialTaskGroups = ({ props, sequentialTaskGroups, sequentialTasks, isReadOnly, selectedTaskId, taskWidthStyle, taskStateReference, hasContextMenu, handleTaskClick, setIsReplacingTask, handleReorderSequentialTasks })=>{
14
- const { execution, onTaskClick, onTaskGroupModification, onTaskReorder, onReplaceTaskFromToolbox, hideParallelOptions, loadingTaskIds } = props;
13
+ const StageNodeSequentialTaskGroups = ({ props, sequentialTaskGroups, sequentialTasks, allTasks, isReadOnly, selectedTaskId, taskWidthStyle, hasContextMenu, handleTaskClick, handleReorderSequentialTasks, generateReplaceTaskMenuItemForTask })=>{
14
+ const { execution, onTaskGroupModification, onTaskReorder, hideParallelOptions, loadingTaskIds } = props;
15
15
  const sequentialTaskIds = useMemo(()=>sequentialTasks.map(({ task })=>task.id), [
16
16
  sequentialTasks
17
17
  ]);
@@ -34,25 +34,34 @@ const StageNodeSequentialTaskGroups = ({ props, sequentialTaskGroups, sequential
34
34
  onTaskGroupModification,
35
35
  sequentialTaskGroups
36
36
  ]);
37
- const buildContextMenuItems = useCallback((groupIndex, taskIndex)=>{
37
+ const buildContextMenuItems = useCallback((groupIndex, _, taskId)=>{
38
38
  const taskGroup = sequentialTaskGroups[groupIndex] ?? [];
39
39
  const isParallel = taskGroup.length > 1;
40
40
  const items = [];
41
- if (onReplaceTaskFromToolbox) {
42
- items.push(getMenuItem('replace-task', 'Replace task', ()=>{
43
- taskStateReference.current = {
44
- isParallel,
45
- groupIndex,
46
- taskIndex
47
- };
48
- const taskId = taskGroup[taskIndex]?.id;
49
- if (taskId) onTaskClick?.(taskId);
50
- setIsReplacingTask(true);
51
- }));
41
+ const replaceTaskMenuItem = generateReplaceTaskMenuItemForTask(taskId, isParallel);
42
+ if (replaceTaskMenuItem) {
43
+ items.push(replaceTaskMenuItem);
52
44
  items.push(getDivider());
53
45
  }
54
- if (onTaskGroupModification) {
55
- const reGroupOptions = getContextMenuItems(isParallel, groupIndex, sequentialTaskGroups.length, taskIndex, taskGroup.length, (sequentialTaskGroups[groupIndex - 1]?.length ?? 0) > 1, (sequentialTaskGroups[groupIndex + 1]?.length ?? 0) > 1, handleTaskRegroup, hideParallelOptions);
46
+ let groupIndexInAllTasks;
47
+ let taskIndexInAllTasks;
48
+ for (const [allTasksGroupIndex, group] of allTasks.entries())for (const [allTasksTaskIndex, task] of group.entries())if (task.id === taskId) {
49
+ groupIndexInAllTasks = allTasksGroupIndex;
50
+ taskIndexInAllTasks = allTasksTaskIndex;
51
+ break;
52
+ }
53
+ if (onTaskGroupModification && void 0 !== groupIndexInAllTasks && void 0 !== taskIndexInAllTasks) {
54
+ const reGroupOptions = getContextMenuItems({
55
+ isParallelGroup: isParallel,
56
+ groupIndex,
57
+ tasksLength: sequentialTaskGroups.length,
58
+ groupIndexInAllTasks,
59
+ taskIndexInAllTasks,
60
+ isAboveParallel: (sequentialTaskGroups[groupIndex - 1]?.length ?? 0) > 1,
61
+ isBelowParallel: (sequentialTaskGroups[groupIndex + 1]?.length ?? 0) > 1,
62
+ reGroupTaskFunction: handleTaskRegroup,
63
+ hideParallelOptions
64
+ });
56
65
  return [
57
66
  ...items,
58
67
  ...reGroupOptions
@@ -60,14 +69,12 @@ const StageNodeSequentialTaskGroups = ({ props, sequentialTaskGroups, sequential
60
69
  }
61
70
  return items;
62
71
  }, [
63
- onReplaceTaskFromToolbox,
64
- onTaskClick,
65
72
  onTaskGroupModification,
66
73
  sequentialTaskGroups,
67
74
  hideParallelOptions,
68
75
  handleTaskRegroup,
69
- setIsReplacingTask,
70
- taskStateReference
76
+ generateReplaceTaskMenuItemForTask,
77
+ allTasks
71
78
  ]);
72
79
  const sensors = useSensors(useSensor(PointerSensor, {
73
80
  activationConstraint: {
@@ -30,18 +30,18 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  getContextMenuItems: ()=>getContextMenuItems
31
31
  });
32
32
  const GroupModificationUtils_cjs_namespaceObject = require("../../utils/GroupModificationUtils.cjs");
33
- const getContextMenuItems = (isParallelGroup, groupIndex, tasksLength, taskIndex, _taskGroupLength, isAboveParallel, isBelowParallel, reGroupTaskFunction, hideParallelOptions = false)=>{
33
+ const getContextMenuItems = ({ isParallelGroup, groupIndex, tasksLength, groupIndexInAllTasks, taskIndexInAllTasks, isAboveParallel, isBelowParallel, reGroupTaskFunction, hideParallelOptions = false })=>{
34
34
  const CONTEXT_MENU_ITEMS = {
35
- MOVE_UP: getMenuItem('move-up', 'Move up', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.TASK_GROUP_UP, groupIndex, taskIndex)),
36
- MOVE_DOWN: getMenuItem('move-down', 'Move down', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.TASK_GROUP_DOWN, groupIndex, taskIndex)),
37
- UNGROUP_ALL: getMenuItem('ungroup', 'Ungroup parallel tasks', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.UNGROUP_ALL_TASKS, groupIndex, taskIndex)),
38
- SPLIT_TASK: getMenuItem('split', 'Remove from parallel group', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.SPLIT_GROUP, groupIndex, taskIndex)),
39
- REMOVE_GROUP: getMenuItem('remove-group', 'Remove group from stage', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.REMOVE_GROUP, groupIndex, taskIndex)),
40
- REMOVE_TASK: getMenuItem('remove-task', 'Delete task', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.REMOVE_TASK, groupIndex, taskIndex)),
41
- CREATE_PARALLEL_GROUP_ABOVE: getMenuItem('group-with-up', 'Create parallel group with task above', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.MERGE_GROUP_UP, groupIndex, taskIndex)),
42
- CREATE_PARALLEL_GROUP_BELOW: getMenuItem('group-with-down', 'Create parallel group with task below', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.MERGE_GROUP_DOWN, groupIndex, taskIndex)),
43
- ADD_TO_PARALLEL_GROUP_ABOVE: getMenuItem('add-to-group-with-up', 'Add task to parallel group above', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.MERGE_GROUP_UP, groupIndex, taskIndex)),
44
- ADD_TO_PARALLEL_GROUP_BELOW: getMenuItem('add-to-group-with-down', 'Add task to parallel group below', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.MERGE_GROUP_DOWN, groupIndex, taskIndex)),
35
+ MOVE_UP: getMenuItem('move-up', 'Move up', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.TASK_GROUP_UP, groupIndexInAllTasks, taskIndexInAllTasks)),
36
+ MOVE_DOWN: getMenuItem('move-down', 'Move down', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.TASK_GROUP_DOWN, groupIndexInAllTasks, taskIndexInAllTasks)),
37
+ UNGROUP_ALL: getMenuItem('ungroup', 'Ungroup parallel tasks', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.UNGROUP_ALL_TASKS, groupIndexInAllTasks, taskIndexInAllTasks)),
38
+ SPLIT_TASK: getMenuItem('split', 'Remove from parallel group', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.SPLIT_GROUP, groupIndexInAllTasks, taskIndexInAllTasks)),
39
+ REMOVE_GROUP: getMenuItem('remove-group', 'Remove group from stage', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.REMOVE_GROUP, groupIndexInAllTasks, taskIndexInAllTasks)),
40
+ REMOVE_TASK: getMenuItem('remove-task', 'Delete task', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.REMOVE_TASK, groupIndexInAllTasks, taskIndexInAllTasks)),
41
+ CREATE_PARALLEL_GROUP_ABOVE: getMenuItem('group-with-up', 'Create parallel group with task above', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.MERGE_GROUP_UP, groupIndexInAllTasks, taskIndexInAllTasks)),
42
+ CREATE_PARALLEL_GROUP_BELOW: getMenuItem('group-with-down', 'Create parallel group with task below', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.MERGE_GROUP_DOWN, groupIndexInAllTasks, taskIndexInAllTasks)),
43
+ ADD_TO_PARALLEL_GROUP_ABOVE: getMenuItem('add-to-group-with-up', 'Add task to parallel group above', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.MERGE_GROUP_UP, groupIndexInAllTasks, taskIndexInAllTasks)),
44
+ ADD_TO_PARALLEL_GROUP_BELOW: getMenuItem('add-to-group-with-down', 'Add task to parallel group below', ()=>reGroupTaskFunction(GroupModificationUtils_cjs_namespaceObject.GroupModificationType.MERGE_GROUP_DOWN, groupIndexInAllTasks, taskIndexInAllTasks)),
45
45
  DIVIDER: getDivider()
46
46
  };
47
47
  const items = [];
@@ -1,7 +1,17 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import { GroupModificationType } from '../../utils/GroupModificationUtils';
3
3
  import type { NodeMenuAction, NodeMenuItem } from '../NodeContextMenu';
4
- export declare const getContextMenuItems: (isParallelGroup: boolean, groupIndex: number, tasksLength: number, taskIndex: number, _taskGroupLength: number, isAboveParallel: boolean, isBelowParallel: boolean, reGroupTaskFunction: (groupModificationType: GroupModificationType, groupIndex: number, taskIndex: number) => void, hideParallelOptions?: boolean) => NodeMenuItem[];
4
+ export declare const getContextMenuItems: ({ isParallelGroup, groupIndex, tasksLength, groupIndexInAllTasks, taskIndexInAllTasks, isAboveParallel, isBelowParallel, reGroupTaskFunction, hideParallelOptions, }: {
5
+ isParallelGroup: boolean;
6
+ groupIndex: number;
7
+ tasksLength: number;
8
+ groupIndexInAllTasks: number;
9
+ taskIndexInAllTasks: number;
10
+ isAboveParallel: boolean;
11
+ isBelowParallel: boolean;
12
+ reGroupTaskFunction: (groupModificationType: GroupModificationType, groupIndex: number, taskIndex: number) => void;
13
+ hideParallelOptions?: boolean;
14
+ }) => NodeMenuItem[];
5
15
  export declare function getMenuItem(id: string | undefined, label: string | undefined, onClick: () => void, isDisabled?: boolean): NodeMenuItem;
6
16
  export declare const getDivider: () => NodeMenuItem;
7
17
  export interface TransformedMenuItem {
@@ -1 +1 @@
1
- {"version":3,"file":"StageNodeTaskUtilities.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNodeTaskUtilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvE,eAAO,MAAM,mBAAmB,GAC9B,iBAAiB,OAAO,EACxB,YAAY,MAAM,EAClB,aAAa,MAAM,EACnB,WAAW,MAAM,EACjB,kBAAkB,MAAM,EACxB,iBAAiB,OAAO,EACxB,iBAAiB,OAAO,EACxB,qBAAqB,CACnB,qBAAqB,EAAE,qBAAqB,EAC5C,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,KACd,IAAI,EACT,6BAA2B,KAC1B,YAAY,EAmFd,CAAC;AAEF,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,YAAO,EACjB,KAAK,EAAE,MAAM,YAAU,EACvB,OAAO,EAAE,MAAM,IAAI,EACnB,UAAU,UAAQ,GACjB,YAAY,CAEd;AAED,eAAO,MAAM,UAAU,QAAO,YAI7B,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD,eAAO,MAAM,kBAAkB,GAC7B,WAAW,YAAY,EAAE,GAAG,SAAS,EACrC,aAAa,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,KAC1C,mBAAmB,EAwBrB,CAAC"}
1
+ {"version":3,"file":"StageNodeTaskUtilities.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/StageNode/StageNodeTaskUtilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvE,eAAO,MAAM,mBAAmB,GAAI,sKAUjC;IACD,eAAe,EAAE,OAAO,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,CACnB,qBAAqB,EAAE,qBAAqB,EAC5C,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,KACd,IAAI,CAAC;IACV,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,KAAG,YAAY,EA+Hf,CAAC;AAEF,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,YAAO,EACjB,KAAK,EAAE,MAAM,YAAU,EACvB,OAAO,EAAE,MAAM,IAAI,EACnB,UAAU,UAAQ,GACjB,YAAY,CAEd;AAED,eAAO,MAAM,UAAU,QAAO,YAI7B,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD,eAAO,MAAM,kBAAkB,GAC7B,WAAW,YAAY,EAAE,GAAG,SAAS,EACrC,aAAa,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,KAC1C,mBAAmB,EAwBrB,CAAC"}
@@ -1,16 +1,16 @@
1
1
  import { GroupModificationType } from "../../utils/GroupModificationUtils.js";
2
- const getContextMenuItems = (isParallelGroup, groupIndex, tasksLength, taskIndex, _taskGroupLength, isAboveParallel, isBelowParallel, reGroupTaskFunction, hideParallelOptions = false)=>{
2
+ const getContextMenuItems = ({ isParallelGroup, groupIndex, tasksLength, groupIndexInAllTasks, taskIndexInAllTasks, isAboveParallel, isBelowParallel, reGroupTaskFunction, hideParallelOptions = false })=>{
3
3
  const CONTEXT_MENU_ITEMS = {
4
- MOVE_UP: getMenuItem('move-up', 'Move up', ()=>reGroupTaskFunction(GroupModificationType.TASK_GROUP_UP, groupIndex, taskIndex)),
5
- MOVE_DOWN: getMenuItem('move-down', 'Move down', ()=>reGroupTaskFunction(GroupModificationType.TASK_GROUP_DOWN, groupIndex, taskIndex)),
6
- UNGROUP_ALL: getMenuItem('ungroup', 'Ungroup parallel tasks', ()=>reGroupTaskFunction(GroupModificationType.UNGROUP_ALL_TASKS, groupIndex, taskIndex)),
7
- SPLIT_TASK: getMenuItem('split', 'Remove from parallel group', ()=>reGroupTaskFunction(GroupModificationType.SPLIT_GROUP, groupIndex, taskIndex)),
8
- REMOVE_GROUP: getMenuItem('remove-group', 'Remove group from stage', ()=>reGroupTaskFunction(GroupModificationType.REMOVE_GROUP, groupIndex, taskIndex)),
9
- REMOVE_TASK: getMenuItem('remove-task', 'Delete task', ()=>reGroupTaskFunction(GroupModificationType.REMOVE_TASK, groupIndex, taskIndex)),
10
- CREATE_PARALLEL_GROUP_ABOVE: getMenuItem('group-with-up', 'Create parallel group with task above', ()=>reGroupTaskFunction(GroupModificationType.MERGE_GROUP_UP, groupIndex, taskIndex)),
11
- CREATE_PARALLEL_GROUP_BELOW: getMenuItem('group-with-down', 'Create parallel group with task below', ()=>reGroupTaskFunction(GroupModificationType.MERGE_GROUP_DOWN, groupIndex, taskIndex)),
12
- ADD_TO_PARALLEL_GROUP_ABOVE: getMenuItem('add-to-group-with-up', 'Add task to parallel group above', ()=>reGroupTaskFunction(GroupModificationType.MERGE_GROUP_UP, groupIndex, taskIndex)),
13
- ADD_TO_PARALLEL_GROUP_BELOW: getMenuItem('add-to-group-with-down', 'Add task to parallel group below', ()=>reGroupTaskFunction(GroupModificationType.MERGE_GROUP_DOWN, groupIndex, taskIndex)),
4
+ MOVE_UP: getMenuItem('move-up', 'Move up', ()=>reGroupTaskFunction(GroupModificationType.TASK_GROUP_UP, groupIndexInAllTasks, taskIndexInAllTasks)),
5
+ MOVE_DOWN: getMenuItem('move-down', 'Move down', ()=>reGroupTaskFunction(GroupModificationType.TASK_GROUP_DOWN, groupIndexInAllTasks, taskIndexInAllTasks)),
6
+ UNGROUP_ALL: getMenuItem('ungroup', 'Ungroup parallel tasks', ()=>reGroupTaskFunction(GroupModificationType.UNGROUP_ALL_TASKS, groupIndexInAllTasks, taskIndexInAllTasks)),
7
+ SPLIT_TASK: getMenuItem('split', 'Remove from parallel group', ()=>reGroupTaskFunction(GroupModificationType.SPLIT_GROUP, groupIndexInAllTasks, taskIndexInAllTasks)),
8
+ REMOVE_GROUP: getMenuItem('remove-group', 'Remove group from stage', ()=>reGroupTaskFunction(GroupModificationType.REMOVE_GROUP, groupIndexInAllTasks, taskIndexInAllTasks)),
9
+ REMOVE_TASK: getMenuItem('remove-task', 'Delete task', ()=>reGroupTaskFunction(GroupModificationType.REMOVE_TASK, groupIndexInAllTasks, taskIndexInAllTasks)),
10
+ CREATE_PARALLEL_GROUP_ABOVE: getMenuItem('group-with-up', 'Create parallel group with task above', ()=>reGroupTaskFunction(GroupModificationType.MERGE_GROUP_UP, groupIndexInAllTasks, taskIndexInAllTasks)),
11
+ CREATE_PARALLEL_GROUP_BELOW: getMenuItem('group-with-down', 'Create parallel group with task below', ()=>reGroupTaskFunction(GroupModificationType.MERGE_GROUP_DOWN, groupIndexInAllTasks, taskIndexInAllTasks)),
12
+ ADD_TO_PARALLEL_GROUP_ABOVE: getMenuItem('add-to-group-with-up', 'Add task to parallel group above', ()=>reGroupTaskFunction(GroupModificationType.MERGE_GROUP_UP, groupIndexInAllTasks, taskIndexInAllTasks)),
13
+ ADD_TO_PARALLEL_GROUP_BELOW: getMenuItem('add-to-group-with-down', 'Add task to parallel group below', ()=>reGroupTaskFunction(GroupModificationType.MERGE_GROUP_DOWN, groupIndexInAllTasks, taskIndexInAllTasks)),
14
14
  DIVIDER: getDivider()
15
15
  };
16
16
  const items = [];