gantt-task-react-v 1.5.5 → 1.5.7

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.
@@ -29,6 +29,7 @@ export type TaskListProps = {
29
29
  isShowTaskNumbers?: boolean;
30
30
  mapTaskToNestedIndex: MapTaskToNestedIndex;
31
31
  onClick?: (task: RenderTask) => void;
32
+ onDoubleClick?: (task: RenderTask) => void;
32
33
  onExpanderClick: (task: Task) => void;
33
34
  scrollToBottomStep: () => void;
34
35
  scrollToTask: (task: Task) => void;
@@ -10204,6 +10204,7 @@ const TaskListTableRowInner = forwardRef(
10204
10204
  isDragging,
10205
10205
  isShowTaskNumbers,
10206
10206
  onClick,
10207
+ onDoubleClick,
10207
10208
  onExpanderClick,
10208
10209
  scrollToTask,
10209
10210
  selectTaskOnMouseDown,
@@ -10214,6 +10215,19 @@ const TaskListTableRowInner = forwardRef(
10214
10215
  moveOverPosition
10215
10216
  } = props;
10216
10217
  const { id, comparisonLevel = 1 } = task;
10218
+ const onRowDoubleClick = useCallback(
10219
+ (event) => {
10220
+ event.preventDefault();
10221
+ selectTaskOnMouseDown(task.id, event);
10222
+ if (task.type !== "empty") {
10223
+ scrollToTask(task);
10224
+ }
10225
+ if (onDoubleClick) {
10226
+ onDoubleClick(task);
10227
+ }
10228
+ },
10229
+ [onDoubleClick, scrollToTask, selectTaskOnMouseDown, task]
10230
+ );
10217
10231
  const onRootMouseDown = useCallback(
10218
10232
  (event) => {
10219
10233
  event.preventDefault();
@@ -10346,6 +10360,7 @@ const TaskListTableRowInner = forwardRef(
10346
10360
  ref,
10347
10361
  className: rowClassName,
10348
10362
  onMouseDown: onRootMouseDown,
10363
+ onDoubleClick: onRowDoubleClick,
10349
10364
  style: {
10350
10365
  height: fullRowHeight,
10351
10366
  backgroundColor,
@@ -10919,6 +10934,7 @@ const TaskListInner = ({
10919
10934
  mapTaskToNestedIndex,
10920
10935
  onExpanderClick,
10921
10936
  onClick,
10937
+ onDoubleClick,
10922
10938
  scrollToTask,
10923
10939
  selectTaskOnMouseDown,
10924
10940
  selectedIdsMirror,
@@ -10986,6 +11002,7 @@ const TaskListInner = ({
10986
11002
  isSelected: selectedIdsMirror[id],
10987
11003
  isShowTaskNumbers,
10988
11004
  onClick,
11005
+ onDoubleClick,
10989
11006
  onExpanderClick,
10990
11007
  scrollToTask,
10991
11008
  selectTaskOnMouseDown,
@@ -11010,6 +11027,7 @@ const TaskListInner = ({
11010
11027
  isShowTaskNumbers,
11011
11028
  mapTaskToNestedIndex,
11012
11029
  onClick,
11030
+ onDoubleClick,
11013
11031
  onExpanderClick,
11014
11032
  scrollToTask,
11015
11033
  selectTaskOnMouseDown,
@@ -20833,6 +20851,19 @@ const Gantt = (props) => {
20833
20851
  setActiveArrowKey(null);
20834
20852
  setActiveTaskId(null);
20835
20853
  }, []);
20854
+ const handleTableRowDoubleClick = useCallback(
20855
+ (task) => {
20856
+ if (enableDrawer && taskList.enableTableRowDoubleClick) {
20857
+ setActiveArrowKey(null);
20858
+ setActiveTaskId(task.id);
20859
+ setDrawerData({ type: "task", task });
20860
+ }
20861
+ if (taskList.onTableRowDoubleClick) {
20862
+ taskList.onTableRowDoubleClick(task);
20863
+ }
20864
+ },
20865
+ [enableDrawer, taskList]
20866
+ );
20836
20867
  const handleGoToTask = useCallback(
20837
20868
  (taskId) => {
20838
20869
  for (const [comparisonLevel, levelMap] of tasksMap) {
@@ -21173,6 +21204,7 @@ const Gantt = (props) => {
21173
21204
  handleOpenContextMenu: handleOpenContextMenuForRow,
21174
21205
  mapTaskToNestedIndex,
21175
21206
  onExpanderClick,
21207
+ onDoubleClick: handleTableRowDoubleClick,
21176
21208
  scrollToBottomStep,
21177
21209
  scrollToTopStep,
21178
21210
  selectTaskOnMouseDown,
@@ -21210,7 +21242,8 @@ const Gantt = (props) => {
21210
21242
  selectedIdsMirror,
21211
21243
  taskList,
21212
21244
  taskListContainerRef,
21213
- visibleTasks
21245
+ visibleTasks,
21246
+ handleTableRowDoubleClick
21214
21247
  ]
21215
21248
  );
21216
21249
  return /* @__PURE__ */ jsx(GanttThemeProvider, { theme, children: (cssVars) => /* @__PURE__ */ jsx(GanttLocaleProvider, { locale, children: /* @__PURE__ */ jsxs(
@@ -10221,6 +10221,7 @@
10221
10221
  isDragging,
10222
10222
  isShowTaskNumbers,
10223
10223
  onClick,
10224
+ onDoubleClick,
10224
10225
  onExpanderClick,
10225
10226
  scrollToTask,
10226
10227
  selectTaskOnMouseDown,
@@ -10231,6 +10232,19 @@
10231
10232
  moveOverPosition
10232
10233
  } = props;
10233
10234
  const { id, comparisonLevel = 1 } = task;
10235
+ const onRowDoubleClick = React.useCallback(
10236
+ (event) => {
10237
+ event.preventDefault();
10238
+ selectTaskOnMouseDown(task.id, event);
10239
+ if (task.type !== "empty") {
10240
+ scrollToTask(task);
10241
+ }
10242
+ if (onDoubleClick) {
10243
+ onDoubleClick(task);
10244
+ }
10245
+ },
10246
+ [onDoubleClick, scrollToTask, selectTaskOnMouseDown, task]
10247
+ );
10234
10248
  const onRootMouseDown = React.useCallback(
10235
10249
  (event) => {
10236
10250
  event.preventDefault();
@@ -10363,6 +10377,7 @@
10363
10377
  ref,
10364
10378
  className: rowClassName,
10365
10379
  onMouseDown: onRootMouseDown,
10380
+ onDoubleClick: onRowDoubleClick,
10366
10381
  style: {
10367
10382
  height: fullRowHeight,
10368
10383
  backgroundColor,
@@ -10936,6 +10951,7 @@
10936
10951
  mapTaskToNestedIndex,
10937
10952
  onExpanderClick,
10938
10953
  onClick,
10954
+ onDoubleClick,
10939
10955
  scrollToTask,
10940
10956
  selectTaskOnMouseDown,
10941
10957
  selectedIdsMirror,
@@ -11003,6 +11019,7 @@
11003
11019
  isSelected: selectedIdsMirror[id],
11004
11020
  isShowTaskNumbers,
11005
11021
  onClick,
11022
+ onDoubleClick,
11006
11023
  onExpanderClick,
11007
11024
  scrollToTask,
11008
11025
  selectTaskOnMouseDown,
@@ -11027,6 +11044,7 @@
11027
11044
  isShowTaskNumbers,
11028
11045
  mapTaskToNestedIndex,
11029
11046
  onClick,
11047
+ onDoubleClick,
11030
11048
  onExpanderClick,
11031
11049
  scrollToTask,
11032
11050
  selectTaskOnMouseDown,
@@ -20850,6 +20868,19 @@
20850
20868
  setActiveArrowKey(null);
20851
20869
  setActiveTaskId(null);
20852
20870
  }, []);
20871
+ const handleTableRowDoubleClick = React.useCallback(
20872
+ (task) => {
20873
+ if (enableDrawer && taskList.enableTableRowDoubleClick) {
20874
+ setActiveArrowKey(null);
20875
+ setActiveTaskId(task.id);
20876
+ setDrawerData({ type: "task", task });
20877
+ }
20878
+ if (taskList.onTableRowDoubleClick) {
20879
+ taskList.onTableRowDoubleClick(task);
20880
+ }
20881
+ },
20882
+ [enableDrawer, taskList]
20883
+ );
20853
20884
  const handleGoToTask = React.useCallback(
20854
20885
  (taskId) => {
20855
20886
  for (const [comparisonLevel, levelMap] of tasksMap) {
@@ -21190,6 +21221,7 @@
21190
21221
  handleOpenContextMenu: handleOpenContextMenuForRow,
21191
21222
  mapTaskToNestedIndex,
21192
21223
  onExpanderClick,
21224
+ onDoubleClick: handleTableRowDoubleClick,
21193
21225
  scrollToBottomStep,
21194
21226
  scrollToTopStep,
21195
21227
  selectTaskOnMouseDown,
@@ -21227,7 +21259,8 @@
21227
21259
  selectedIdsMirror,
21228
21260
  taskList,
21229
21261
  taskListContainerRef,
21230
- visibleTasks
21262
+ visibleTasks,
21263
+ handleTableRowDoubleClick
21231
21264
  ]
21232
21265
  );
21233
21266
  return /* @__PURE__ */ jsxRuntime.jsx(GanttThemeProvider, { theme, children: (cssVars) => /* @__PURE__ */ jsxRuntime.jsx(GanttLocaleProvider, { locale, children: /* @__PURE__ */ jsxRuntime.jsxs(
@@ -184,6 +184,7 @@ export type TaskListTableRowProps = {
184
184
  isSelected: boolean;
185
185
  isShowTaskNumbers: boolean;
186
186
  onClick: (task: RenderTask) => void;
187
+ onDoubleClick?: (task: RenderTask) => void;
187
188
  onExpanderClick: (task: Task) => void;
188
189
  scrollToTask: (task: Task) => void;
189
190
  selectTaskOnMouseDown: (taskId: string, event: MouseEvent) => void;
@@ -184,6 +184,16 @@ export interface GanttTaskListProps {
184
184
  * Render bottom table content
185
185
  */
186
186
  tableBottom?: TableRenderBottomProps;
187
+ /**
188
+ * Enable double-click on task table rows to open the drawer.
189
+ * Requires `drawer.enableDrawer` to be true for the drawer to open.
190
+ */
191
+ enableTableRowDoubleClick?: boolean;
192
+ /**
193
+ * Callback invoked when a task table row is double-clicked.
194
+ * Called regardless of `enableTableRowDoubleClick`; use it to open a custom drawer or panel.
195
+ */
196
+ onTableRowDoubleClick?: (task: RenderTask) => void;
187
197
  }
188
198
  export interface TableRenderBottomProps {
189
199
  height?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gantt-task-react-v",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
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",