gantt-task-react-v 1.1.9 → 1.1.11

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.
@@ -8,6 +8,8 @@ type ContextMenuProps = {
8
8
  handleAction: (task: RenderTask, action: (meta: ActionMetaType) => void) => void;
9
9
  handleCloseContextMenu: () => void;
10
10
  options: ContextMenuOptionType[];
11
+ /** Optional callback invoked to select the task that opened the context menu (useful for task list) */
12
+ onSelectTask?: (taskId: string) => void;
11
13
  /** Optional boundary element to contain the context menu (like tooltips) */
12
14
  boundaryElement?: RefObject<HTMLElement>;
13
15
  };
@@ -18089,10 +18089,12 @@ function ContextMenu(props) {
18089
18089
  }, [task, checkHasCopyTasks, checkHasCutTasks, options]);
18090
18090
  const handleOptionAction = useCallback(
18091
18091
  (option) => {
18092
+ var _a2;
18092
18093
  handleCloseContextMenu();
18093
18094
  if (!task) {
18094
18095
  return;
18095
18096
  }
18097
+ (_a2 = props.onSelectTask) == null ? void 0 : _a2.call(props, task.id);
18096
18098
  handleAction(task, option.action);
18097
18099
  },
18098
18100
  [handleAction, handleCloseContextMenu, task]
@@ -19007,6 +19009,7 @@ const Gantt = (props) => {
19007
19009
  cutSelectedTasks,
19008
19010
  cutTask,
19009
19011
  resetSelectedTasks,
19012
+ selectTask,
19010
19013
  selectTaskOnMouseDown,
19011
19014
  selectedIdsMirror
19012
19015
  } = useSelection(
@@ -19116,8 +19119,8 @@ const Gantt = (props) => {
19116
19119
  const handleOpenContextMenuForRow = useCallback(
19117
19120
  (task, clientX, clientY) => {
19118
19121
  try {
19119
- if (onRowContextMenu && task && task.id) {
19120
- onRowContextMenu(task.id);
19122
+ if (onRowContextMenu && task) {
19123
+ onRowContextMenu(task);
19121
19124
  }
19122
19125
  } catch (err) {
19123
19126
  console.error(err);
@@ -20261,6 +20264,7 @@ const Gantt = (props) => {
20261
20264
  distances,
20262
20265
  handleAction,
20263
20266
  handleCloseContextMenu,
20267
+ onSelectTask: selectTask,
20264
20268
  options: contextMenuOptions,
20265
20269
  boundaryElement: taskListHorizontalScrollRef
20266
20270
  }
@@ -18106,10 +18106,12 @@
18106
18106
  }, [task, checkHasCopyTasks, checkHasCutTasks, options]);
18107
18107
  const handleOptionAction = React.useCallback(
18108
18108
  (option) => {
18109
+ var _a2;
18109
18110
  handleCloseContextMenu();
18110
18111
  if (!task) {
18111
18112
  return;
18112
18113
  }
18114
+ (_a2 = props.onSelectTask) == null ? void 0 : _a2.call(props, task.id);
18113
18115
  handleAction(task, option.action);
18114
18116
  },
18115
18117
  [handleAction, handleCloseContextMenu, task]
@@ -19024,6 +19026,7 @@
19024
19026
  cutSelectedTasks,
19025
19027
  cutTask,
19026
19028
  resetSelectedTasks,
19029
+ selectTask,
19027
19030
  selectTaskOnMouseDown,
19028
19031
  selectedIdsMirror
19029
19032
  } = useSelection(
@@ -19133,8 +19136,8 @@
19133
19136
  const handleOpenContextMenuForRow = React.useCallback(
19134
19137
  (task, clientX, clientY) => {
19135
19138
  try {
19136
- if (onRowContextMenu && task && task.id) {
19137
- onRowContextMenu(task.id);
19139
+ if (onRowContextMenu && task) {
19140
+ onRowContextMenu(task);
19138
19141
  }
19139
19142
  } catch (err) {
19140
19143
  console.error(err);
@@ -20278,6 +20281,7 @@
20278
20281
  distances,
20279
20282
  handleAction,
20280
20283
  handleCloseContextMenu,
20284
+ onSelectTask: selectTask,
20281
20285
  options: contextMenuOptions,
20282
20286
  boundaryElement: taskListHorizontalScrollRef
20283
20287
  }
@@ -309,9 +309,9 @@ export interface GanttProps {
309
309
  */
310
310
  onWheel?: (wheelEvent: WheelEvent) => void;
311
311
  /**
312
- * Invokes when user right-clicks a row in the task list. Receives the `task.id` of the clicked row.
312
+ * Invokes when user right-clicks a row in the task list. Receives the full `task` object of the clicked row.
313
313
  */
314
- onRowContextMenu?: (taskId: string) => void;
314
+ onRowContextMenu?: (task: RenderTask) => void;
315
315
  /**
316
316
  * Recount descedents of a group task when moving
317
317
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "Interactive Gantt Chart for React with TypeScript.",
5
5
  "author": "aguilanbon",
6
6
  "homepage": "https://github.com/aguilanbon/gantt-task-react-v",