gantt-task-react-v 1.1.8 → 1.1.10

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.
@@ -18785,6 +18785,8 @@ const Gantt = (props) => {
18785
18785
  onAddTaskAction,
18786
18786
  onEditTaskAction,
18787
18787
  onSelectTaskIds,
18788
+ // Invoked when user right-clicks a row in the task list
18789
+ onRowContextMenu,
18788
18790
  onWheel,
18789
18791
  roundEndDate: clientRoundEndDate = defaultRoundEndDate,
18790
18792
  roundStartDate: clientRoundStartDate = defaultRoundStartDate,
@@ -19111,6 +19113,19 @@ const Gantt = (props) => {
19111
19113
  [mapTaskToCoordinates, setScrollXProgrammatically]
19112
19114
  );
19113
19115
  const { contextMenu, handleCloseContextMenu, handleOpenContextMenu } = useContextMenu(wrapperRef, scrollToTask);
19116
+ const handleOpenContextMenuForRow = useCallback(
19117
+ (task, clientX, clientY) => {
19118
+ try {
19119
+ if (onRowContextMenu && task) {
19120
+ onRowContextMenu(task);
19121
+ }
19122
+ } catch (err) {
19123
+ console.error(err);
19124
+ }
19125
+ handleOpenContextMenu(task, clientX, clientY);
19126
+ },
19127
+ [onRowContextMenu, handleOpenContextMenu]
19128
+ );
19114
19129
  const [ganttContextMenu, setGanttContextMenu] = useState({
19115
19130
  task: null,
19116
19131
  x: 0,
@@ -20132,7 +20147,7 @@ const Gantt = (props) => {
20132
20147
  handleMoveTaskBefore,
20133
20148
  handleMoveTaskAfter,
20134
20149
  handleMoveTasksInside,
20135
- handleOpenContextMenu,
20150
+ handleOpenContextMenu: handleOpenContextMenuForRow,
20136
20151
  mapTaskToNestedIndex,
20137
20152
  onExpanderClick,
20138
20153
  scrollToBottomStep,
@@ -20162,7 +20177,7 @@ const Gantt = (props) => {
20162
20177
  handleMoveTaskAfter,
20163
20178
  handleMoveTaskBefore,
20164
20179
  handleMoveTasksInside,
20165
- handleOpenContextMenu,
20180
+ handleOpenContextMenuForRow,
20166
20181
  mapTaskToNestedIndex,
20167
20182
  onExpanderClick,
20168
20183
  scrollToBottomStep,
@@ -18802,6 +18802,8 @@
18802
18802
  onAddTaskAction,
18803
18803
  onEditTaskAction,
18804
18804
  onSelectTaskIds,
18805
+ // Invoked when user right-clicks a row in the task list
18806
+ onRowContextMenu,
18805
18807
  onWheel,
18806
18808
  roundEndDate: clientRoundEndDate = defaultRoundEndDate,
18807
18809
  roundStartDate: clientRoundStartDate = defaultRoundStartDate,
@@ -19128,6 +19130,19 @@
19128
19130
  [mapTaskToCoordinates, setScrollXProgrammatically]
19129
19131
  );
19130
19132
  const { contextMenu, handleCloseContextMenu, handleOpenContextMenu } = useContextMenu(wrapperRef, scrollToTask);
19133
+ const handleOpenContextMenuForRow = React.useCallback(
19134
+ (task, clientX, clientY) => {
19135
+ try {
19136
+ if (onRowContextMenu && task) {
19137
+ onRowContextMenu(task);
19138
+ }
19139
+ } catch (err) {
19140
+ console.error(err);
19141
+ }
19142
+ handleOpenContextMenu(task, clientX, clientY);
19143
+ },
19144
+ [onRowContextMenu, handleOpenContextMenu]
19145
+ );
19131
19146
  const [ganttContextMenu, setGanttContextMenu] = React.useState({
19132
19147
  task: null,
19133
19148
  x: 0,
@@ -20149,7 +20164,7 @@
20149
20164
  handleMoveTaskBefore,
20150
20165
  handleMoveTaskAfter,
20151
20166
  handleMoveTasksInside,
20152
- handleOpenContextMenu,
20167
+ handleOpenContextMenu: handleOpenContextMenuForRow,
20153
20168
  mapTaskToNestedIndex,
20154
20169
  onExpanderClick,
20155
20170
  scrollToBottomStep,
@@ -20179,7 +20194,7 @@
20179
20194
  handleMoveTaskAfter,
20180
20195
  handleMoveTaskBefore,
20181
20196
  handleMoveTasksInside,
20182
- handleOpenContextMenu,
20197
+ handleOpenContextMenuForRow,
20183
20198
  mapTaskToNestedIndex,
20184
20199
  onExpanderClick,
20185
20200
  scrollToBottomStep,
@@ -308,6 +308,10 @@ export interface GanttProps {
308
308
  * @param wheelEvent
309
309
  */
310
310
  onWheel?: (wheelEvent: WheelEvent) => void;
311
+ /**
312
+ * Invokes when user right-clicks a row in the task list. Receives the full `task` object of the clicked row.
313
+ */
314
+ onRowContextMenu?: (task: RenderTask) => void;
311
315
  /**
312
316
  * Recount descedents of a group task when moving
313
317
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
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",