gantt-task-react-v 1.5.25 → 1.5.27

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.
@@ -10224,7 +10224,7 @@ const TaskListTableRowInner = forwardRef(
10224
10224
  if (task.type !== "empty") {
10225
10225
  scrollToTask(task);
10226
10226
  }
10227
- if (event.detail >= 2 && isSelected) {
10227
+ if (event.detail >= 2) {
10228
10228
  return;
10229
10229
  }
10230
10230
  selectTaskOnMouseDown(task.id, event);
@@ -13021,7 +13021,6 @@ const TaskItemInner = (props) => {
13021
13021
  onSelectTaskOnMouseDown,
13022
13022
  onTooltipTask,
13023
13023
  task,
13024
- isSelected,
13025
13024
  taskHalfHeight,
13026
13025
  taskHeight,
13027
13026
  taskYOffset,
@@ -13151,12 +13150,12 @@ const TaskItemInner = (props) => {
13151
13150
  const onMouseDown = useCallback(
13152
13151
  (event) => {
13153
13152
  event.stopPropagation();
13154
- if (event.detail >= 2 && isSelected) {
13153
+ if (event.detail >= 2) {
13155
13154
  return;
13156
13155
  }
13157
13156
  onSelectTaskOnMouseDown(task.id, event);
13158
13157
  },
13159
- [onSelectTaskOnMouseDown, task, isSelected]
13158
+ [onSelectTaskOnMouseDown, task]
13160
13159
  );
13161
13160
  const onMouseEnter = useCallback(
13162
13161
  (event) => {
@@ -19566,12 +19565,12 @@ const GanttDrawerInner = ({
19566
19565
  )
19567
19566
  ] }),
19568
19567
  /* @__PURE__ */ jsxs("div", { className: styles.body, children: [
19569
- data && onGoToTask && /* @__PURE__ */ jsx("div", { className: styles.goToTaskBar, children: data.type === "arrow" && /* @__PURE__ */ jsxs(Fragment, { children: [
19570
- /* @__PURE__ */ jsxs(
19568
+ data && onGoToTask && /* @__PURE__ */ jsxs("div", { className: styles.goToTaskBar, children: [
19569
+ data.type === "task" && /* @__PURE__ */ jsxs(
19571
19570
  "button",
19572
19571
  {
19573
19572
  className: styles.goToTaskButton,
19574
- onClick: () => onGoToTask(data.taskFrom.id),
19573
+ onClick: () => onGoToTask(data.task.id),
19575
19574
  type: "button",
19576
19575
  children: [
19577
19576
  /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
@@ -19584,35 +19583,59 @@ const GanttDrawerInner = ({
19584
19583
  strokeLinejoin: "round"
19585
19584
  }
19586
19585
  ) }),
19587
- "Go to ",
19588
- data.taskFrom.name
19586
+ "Go to Task"
19589
19587
  ]
19590
19588
  }
19591
19589
  ),
19592
- /* @__PURE__ */ jsxs(
19593
- "button",
19594
- {
19595
- className: styles.goToTaskButton,
19596
- onClick: () => onGoToTask(data.taskTo.id),
19597
- type: "button",
19598
- children: [
19599
- /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
19600
- "path",
19601
- {
19602
- d: "M2 7h10M8 3l4 4-4 4",
19603
- stroke: "currentColor",
19604
- strokeWidth: "1.5",
19605
- strokeLinecap: "round",
19606
- strokeLinejoin: "round"
19607
- }
19608
- ) }),
19609
- "Go to ",
19610
- data.taskTo.name
19611
- ]
19612
- }
19613
- )
19614
- ] }) }),
19615
- data && renderContent ? renderContent(data) : null
19590
+ data.type === "arrow" && /* @__PURE__ */ jsxs(Fragment, { children: [
19591
+ /* @__PURE__ */ jsxs(
19592
+ "button",
19593
+ {
19594
+ className: styles.goToTaskButton,
19595
+ onClick: () => onGoToTask(data.taskFrom.id),
19596
+ type: "button",
19597
+ children: [
19598
+ /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
19599
+ "path",
19600
+ {
19601
+ d: "M2 7h10M8 3l4 4-4 4",
19602
+ stroke: "currentColor",
19603
+ strokeWidth: "1.5",
19604
+ strokeLinecap: "round",
19605
+ strokeLinejoin: "round"
19606
+ }
19607
+ ) }),
19608
+ "Go to ",
19609
+ data.taskFrom.name
19610
+ ]
19611
+ }
19612
+ ),
19613
+ /* @__PURE__ */ jsxs(
19614
+ "button",
19615
+ {
19616
+ className: styles.goToTaskButton,
19617
+ onClick: () => onGoToTask(data.taskTo.id),
19618
+ type: "button",
19619
+ children: [
19620
+ /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
19621
+ "path",
19622
+ {
19623
+ d: "M2 7h10M8 3l4 4-4 4",
19624
+ stroke: "currentColor",
19625
+ strokeWidth: "1.5",
19626
+ strokeLinecap: "round",
19627
+ strokeLinejoin: "round"
19628
+ }
19629
+ ) }),
19630
+ "Go to ",
19631
+ data.taskTo.name
19632
+ ]
19633
+ }
19634
+ )
19635
+ ] })
19636
+ ] }),
19637
+ data && renderContent ? renderContent(data, onGoToTask ?? (() => {
19638
+ })) : null
19616
19639
  ] })
19617
19640
  ]
19618
19641
  }
@@ -19645,8 +19668,6 @@ const Gantt = (props) => {
19645
19668
  onSelectTaskIds,
19646
19669
  // Invoked when user right-clicks a row in the task list
19647
19670
  onRowContextMenu,
19648
- onClickTaskRow,
19649
- onDoubleClickTaskRow,
19650
19671
  onWheel,
19651
19672
  roundEndDate: clientRoundEndDate = defaultRoundEndDate,
19652
19673
  roundStartDate: clientRoundStartDate = defaultRoundStartDate,
@@ -20834,11 +20855,11 @@ const Gantt = (props) => {
20834
20855
  setDrawerData({ type: "task", task });
20835
20856
  }
20836
20857
  }
20837
- if (onClickTaskRow) {
20838
- onClickTaskRow(task);
20858
+ if (taskList.onClickTaskRow) {
20859
+ taskList.onClickTaskRow(task);
20839
20860
  }
20840
20861
  },
20841
- [enableDrawer, drawerData, onClickTaskRow]
20862
+ [enableDrawer, drawerData, taskList]
20842
20863
  );
20843
20864
  const handleTaskRowDoubleClick = useCallback(
20844
20865
  (task) => {
@@ -20853,11 +20874,11 @@ const Gantt = (props) => {
20853
20874
  setActiveTaskId(task.id);
20854
20875
  setDrawerData({ type: "task", task });
20855
20876
  }
20856
- if (onDoubleClickTaskRow) {
20857
- onDoubleClickTaskRow(task);
20877
+ if (taskList.onDoubleClickTaskRow) {
20878
+ taskList.onDoubleClickTaskRow(task);
20858
20879
  }
20859
20880
  },
20860
- [enableDrawer, drawerData, onDoubleClickTaskRow, selectTask]
20881
+ [enableDrawer, drawerData, taskList, selectTask]
20861
20882
  );
20862
20883
  const handleDrawerClose = useCallback(() => {
20863
20884
  setDrawerData(null);
@@ -10241,7 +10241,7 @@
10241
10241
  if (task.type !== "empty") {
10242
10242
  scrollToTask(task);
10243
10243
  }
10244
- if (event.detail >= 2 && isSelected) {
10244
+ if (event.detail >= 2) {
10245
10245
  return;
10246
10246
  }
10247
10247
  selectTaskOnMouseDown(task.id, event);
@@ -13038,7 +13038,6 @@
13038
13038
  onSelectTaskOnMouseDown,
13039
13039
  onTooltipTask,
13040
13040
  task,
13041
- isSelected,
13042
13041
  taskHalfHeight,
13043
13042
  taskHeight,
13044
13043
  taskYOffset,
@@ -13168,12 +13167,12 @@
13168
13167
  const onMouseDown = React.useCallback(
13169
13168
  (event) => {
13170
13169
  event.stopPropagation();
13171
- if (event.detail >= 2 && isSelected) {
13170
+ if (event.detail >= 2) {
13172
13171
  return;
13173
13172
  }
13174
13173
  onSelectTaskOnMouseDown(task.id, event);
13175
13174
  },
13176
- [onSelectTaskOnMouseDown, task, isSelected]
13175
+ [onSelectTaskOnMouseDown, task]
13177
13176
  );
13178
13177
  const onMouseEnter = React.useCallback(
13179
13178
  (event) => {
@@ -19583,12 +19582,12 @@
19583
19582
  )
19584
19583
  ] }),
19585
19584
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.body, children: [
19586
- data && onGoToTask && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.goToTaskBar, children: data.type === "arrow" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19587
- /* @__PURE__ */ jsxRuntime.jsxs(
19585
+ data && onGoToTask && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.goToTaskBar, children: [
19586
+ data.type === "task" && /* @__PURE__ */ jsxRuntime.jsxs(
19588
19587
  "button",
19589
19588
  {
19590
19589
  className: styles.goToTaskButton,
19591
- onClick: () => onGoToTask(data.taskFrom.id),
19590
+ onClick: () => onGoToTask(data.task.id),
19592
19591
  type: "button",
19593
19592
  children: [
19594
19593
  /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -19601,35 +19600,59 @@
19601
19600
  strokeLinejoin: "round"
19602
19601
  }
19603
19602
  ) }),
19604
- "Go to ",
19605
- data.taskFrom.name
19603
+ "Go to Task"
19606
19604
  ]
19607
19605
  }
19608
19606
  ),
19609
- /* @__PURE__ */ jsxRuntime.jsxs(
19610
- "button",
19611
- {
19612
- className: styles.goToTaskButton,
19613
- onClick: () => onGoToTask(data.taskTo.id),
19614
- type: "button",
19615
- children: [
19616
- /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
19617
- "path",
19618
- {
19619
- d: "M2 7h10M8 3l4 4-4 4",
19620
- stroke: "currentColor",
19621
- strokeWidth: "1.5",
19622
- strokeLinecap: "round",
19623
- strokeLinejoin: "round"
19624
- }
19625
- ) }),
19626
- "Go to ",
19627
- data.taskTo.name
19628
- ]
19629
- }
19630
- )
19631
- ] }) }),
19632
- data && renderContent ? renderContent(data) : null
19607
+ data.type === "arrow" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19608
+ /* @__PURE__ */ jsxRuntime.jsxs(
19609
+ "button",
19610
+ {
19611
+ className: styles.goToTaskButton,
19612
+ onClick: () => onGoToTask(data.taskFrom.id),
19613
+ type: "button",
19614
+ children: [
19615
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
19616
+ "path",
19617
+ {
19618
+ d: "M2 7h10M8 3l4 4-4 4",
19619
+ stroke: "currentColor",
19620
+ strokeWidth: "1.5",
19621
+ strokeLinecap: "round",
19622
+ strokeLinejoin: "round"
19623
+ }
19624
+ ) }),
19625
+ "Go to ",
19626
+ data.taskFrom.name
19627
+ ]
19628
+ }
19629
+ ),
19630
+ /* @__PURE__ */ jsxRuntime.jsxs(
19631
+ "button",
19632
+ {
19633
+ className: styles.goToTaskButton,
19634
+ onClick: () => onGoToTask(data.taskTo.id),
19635
+ type: "button",
19636
+ children: [
19637
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
19638
+ "path",
19639
+ {
19640
+ d: "M2 7h10M8 3l4 4-4 4",
19641
+ stroke: "currentColor",
19642
+ strokeWidth: "1.5",
19643
+ strokeLinecap: "round",
19644
+ strokeLinejoin: "round"
19645
+ }
19646
+ ) }),
19647
+ "Go to ",
19648
+ data.taskTo.name
19649
+ ]
19650
+ }
19651
+ )
19652
+ ] })
19653
+ ] }),
19654
+ data && renderContent ? renderContent(data, onGoToTask ?? (() => {
19655
+ })) : null
19633
19656
  ] })
19634
19657
  ]
19635
19658
  }
@@ -19662,8 +19685,6 @@
19662
19685
  onSelectTaskIds,
19663
19686
  // Invoked when user right-clicks a row in the task list
19664
19687
  onRowContextMenu,
19665
- onClickTaskRow,
19666
- onDoubleClickTaskRow,
19667
19688
  onWheel,
19668
19689
  roundEndDate: clientRoundEndDate = defaultRoundEndDate,
19669
19690
  roundStartDate: clientRoundStartDate = defaultRoundStartDate,
@@ -20851,11 +20872,11 @@
20851
20872
  setDrawerData({ type: "task", task });
20852
20873
  }
20853
20874
  }
20854
- if (onClickTaskRow) {
20855
- onClickTaskRow(task);
20875
+ if (taskList.onClickTaskRow) {
20876
+ taskList.onClickTaskRow(task);
20856
20877
  }
20857
20878
  },
20858
- [enableDrawer, drawerData, onClickTaskRow]
20879
+ [enableDrawer, drawerData, taskList]
20859
20880
  );
20860
20881
  const handleTaskRowDoubleClick = React.useCallback(
20861
20882
  (task) => {
@@ -20870,11 +20891,11 @@
20870
20891
  setActiveTaskId(task.id);
20871
20892
  setDrawerData({ type: "task", task });
20872
20893
  }
20873
- if (onDoubleClickTaskRow) {
20874
- onDoubleClickTaskRow(task);
20894
+ if (taskList.onDoubleClickTaskRow) {
20895
+ taskList.onDoubleClickTaskRow(task);
20875
20896
  }
20876
20897
  },
20877
- [enableDrawer, drawerData, onDoubleClickTaskRow, selectTask]
20898
+ [enableDrawer, drawerData, taskList, selectTask]
20878
20899
  );
20879
20900
  const handleDrawerClose = React.useCallback(() => {
20880
20901
  setDrawerData(null);
@@ -10,7 +10,7 @@ export type GanttDrawerData = {
10
10
  taskFrom: Task;
11
11
  taskTo: Task;
12
12
  };
13
- export type RenderDrawerContent = (data: GanttDrawerData) => ReactNode;
13
+ export type RenderDrawerContent = (data: GanttDrawerData, goToTask: (taskId: string) => void) => ReactNode;
14
14
  export interface GanttDrawerProps {
15
15
  /**
16
16
  * Enable the drawer panel on task/arrow click
@@ -184,6 +184,14 @@ export interface GanttTaskListProps {
184
184
  * Render bottom table content
185
185
  */
186
186
  tableBottom?: TableRenderBottomProps;
187
+ /**
188
+ * Invokes on single click on a task list row. Receives the task data.
189
+ */
190
+ onClickTaskRow?: (task: RenderTask) => void;
191
+ /**
192
+ * Invokes on double click on a task list row. Receives the task data.
193
+ */
194
+ onDoubleClickTaskRow?: (task: RenderTask) => void;
187
195
  }
188
196
  export interface TableRenderBottomProps {
189
197
  height?: number;
@@ -408,14 +416,6 @@ export interface GanttProps {
408
416
  * Set to a task id to scroll both horizontally and vertically to that task.
409
417
  */
410
418
  scrollToTaskId?: TaskId;
411
- /**
412
- * Invokes on single click on a task list row. Receives the task data.
413
- */
414
- onClickTaskRow?: (task: RenderTask) => void;
415
- /**
416
- * Invokes on double click on a task list row. Receives the task data.
417
- */
418
- onDoubleClickTaskRow?: (task: RenderTask) => void;
419
419
  /**
420
420
  * Drawer panel options for task/arrow click
421
421
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.5.25",
3
+ "version": "1.5.27",
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",