gantt-task-react-v 1.5.26 → 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.
@@ -19565,12 +19565,12 @@ const GanttDrawerInner = ({
19565
19565
  )
19566
19566
  ] }),
19567
19567
  /* @__PURE__ */ jsxs("div", { className: styles.body, children: [
19568
- data && onGoToTask && /* @__PURE__ */ jsx("div", { className: styles.goToTaskBar, children: data.type === "arrow" && /* @__PURE__ */ jsxs(Fragment, { children: [
19569
- /* @__PURE__ */ jsxs(
19568
+ data && onGoToTask && /* @__PURE__ */ jsxs("div", { className: styles.goToTaskBar, children: [
19569
+ data.type === "task" && /* @__PURE__ */ jsxs(
19570
19570
  "button",
19571
19571
  {
19572
19572
  className: styles.goToTaskButton,
19573
- onClick: () => onGoToTask(data.taskFrom.id),
19573
+ onClick: () => onGoToTask(data.task.id),
19574
19574
  type: "button",
19575
19575
  children: [
19576
19576
  /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsx(
@@ -19583,35 +19583,59 @@ const GanttDrawerInner = ({
19583
19583
  strokeLinejoin: "round"
19584
19584
  }
19585
19585
  ) }),
19586
- "Go to ",
19587
- data.taskFrom.name
19586
+ "Go to Task"
19588
19587
  ]
19589
19588
  }
19590
19589
  ),
19591
- /* @__PURE__ */ jsxs(
19592
- "button",
19593
- {
19594
- className: styles.goToTaskButton,
19595
- onClick: () => onGoToTask(data.taskTo.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.taskTo.name
19610
- ]
19611
- }
19612
- )
19613
- ] }) }),
19614
- 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
19615
19639
  ] })
19616
19640
  ]
19617
19641
  }
@@ -19644,8 +19668,6 @@ const Gantt = (props) => {
19644
19668
  onSelectTaskIds,
19645
19669
  // Invoked when user right-clicks a row in the task list
19646
19670
  onRowContextMenu,
19647
- onClickTaskRow,
19648
- onDoubleClickTaskRow,
19649
19671
  onWheel,
19650
19672
  roundEndDate: clientRoundEndDate = defaultRoundEndDate,
19651
19673
  roundStartDate: clientRoundStartDate = defaultRoundStartDate,
@@ -20833,11 +20855,11 @@ const Gantt = (props) => {
20833
20855
  setDrawerData({ type: "task", task });
20834
20856
  }
20835
20857
  }
20836
- if (onClickTaskRow) {
20837
- onClickTaskRow(task);
20858
+ if (taskList.onClickTaskRow) {
20859
+ taskList.onClickTaskRow(task);
20838
20860
  }
20839
20861
  },
20840
- [enableDrawer, drawerData, onClickTaskRow]
20862
+ [enableDrawer, drawerData, taskList]
20841
20863
  );
20842
20864
  const handleTaskRowDoubleClick = useCallback(
20843
20865
  (task) => {
@@ -20852,11 +20874,11 @@ const Gantt = (props) => {
20852
20874
  setActiveTaskId(task.id);
20853
20875
  setDrawerData({ type: "task", task });
20854
20876
  }
20855
- if (onDoubleClickTaskRow) {
20856
- onDoubleClickTaskRow(task);
20877
+ if (taskList.onDoubleClickTaskRow) {
20878
+ taskList.onDoubleClickTaskRow(task);
20857
20879
  }
20858
20880
  },
20859
- [enableDrawer, drawerData, onDoubleClickTaskRow, selectTask]
20881
+ [enableDrawer, drawerData, taskList, selectTask]
20860
20882
  );
20861
20883
  const handleDrawerClose = useCallback(() => {
20862
20884
  setDrawerData(null);
@@ -19582,12 +19582,12 @@
19582
19582
  )
19583
19583
  ] }),
19584
19584
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.body, children: [
19585
- data && onGoToTask && /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.goToTaskBar, children: data.type === "arrow" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
19586
- /* @__PURE__ */ jsxRuntime.jsxs(
19585
+ data && onGoToTask && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.goToTaskBar, children: [
19586
+ data.type === "task" && /* @__PURE__ */ jsxRuntime.jsxs(
19587
19587
  "button",
19588
19588
  {
19589
19589
  className: styles.goToTaskButton,
19590
- onClick: () => onGoToTask(data.taskFrom.id),
19590
+ onClick: () => onGoToTask(data.task.id),
19591
19591
  type: "button",
19592
19592
  children: [
19593
19593
  /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -19600,35 +19600,59 @@
19600
19600
  strokeLinejoin: "round"
19601
19601
  }
19602
19602
  ) }),
19603
- "Go to ",
19604
- data.taskFrom.name
19603
+ "Go to Task"
19605
19604
  ]
19606
19605
  }
19607
19606
  ),
19608
- /* @__PURE__ */ jsxRuntime.jsxs(
19609
- "button",
19610
- {
19611
- className: styles.goToTaskButton,
19612
- onClick: () => onGoToTask(data.taskTo.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.taskTo.name
19627
- ]
19628
- }
19629
- )
19630
- ] }) }),
19631
- 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
19632
19656
  ] })
19633
19657
  ]
19634
19658
  }
@@ -19661,8 +19685,6 @@
19661
19685
  onSelectTaskIds,
19662
19686
  // Invoked when user right-clicks a row in the task list
19663
19687
  onRowContextMenu,
19664
- onClickTaskRow,
19665
- onDoubleClickTaskRow,
19666
19688
  onWheel,
19667
19689
  roundEndDate: clientRoundEndDate = defaultRoundEndDate,
19668
19690
  roundStartDate: clientRoundStartDate = defaultRoundStartDate,
@@ -20850,11 +20872,11 @@
20850
20872
  setDrawerData({ type: "task", task });
20851
20873
  }
20852
20874
  }
20853
- if (onClickTaskRow) {
20854
- onClickTaskRow(task);
20875
+ if (taskList.onClickTaskRow) {
20876
+ taskList.onClickTaskRow(task);
20855
20877
  }
20856
20878
  },
20857
- [enableDrawer, drawerData, onClickTaskRow]
20879
+ [enableDrawer, drawerData, taskList]
20858
20880
  );
20859
20881
  const handleTaskRowDoubleClick = React.useCallback(
20860
20882
  (task) => {
@@ -20869,11 +20891,11 @@
20869
20891
  setActiveTaskId(task.id);
20870
20892
  setDrawerData({ type: "task", task });
20871
20893
  }
20872
- if (onDoubleClickTaskRow) {
20873
- onDoubleClickTaskRow(task);
20894
+ if (taskList.onDoubleClickTaskRow) {
20895
+ taskList.onDoubleClickTaskRow(task);
20874
20896
  }
20875
20897
  },
20876
- [enableDrawer, drawerData, onDoubleClickTaskRow, selectTask]
20898
+ [enableDrawer, drawerData, taskList, selectTask]
20877
20899
  );
20878
20900
  const handleDrawerClose = React.useCallback(() => {
20879
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.26",
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",