gantt-task-react-v 1.5.5 → 1.5.6

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,15 @@ 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
+ if (onDoubleClick) {
10222
+ onDoubleClick(task);
10223
+ }
10224
+ },
10225
+ [onDoubleClick, task]
10226
+ );
10217
10227
  const onRootMouseDown = useCallback(
10218
10228
  (event) => {
10219
10229
  event.preventDefault();
@@ -10346,6 +10356,7 @@ const TaskListTableRowInner = forwardRef(
10346
10356
  ref,
10347
10357
  className: rowClassName,
10348
10358
  onMouseDown: onRootMouseDown,
10359
+ onDoubleClick: onRowDoubleClick,
10349
10360
  style: {
10350
10361
  height: fullRowHeight,
10351
10362
  backgroundColor,
@@ -10919,6 +10930,7 @@ const TaskListInner = ({
10919
10930
  mapTaskToNestedIndex,
10920
10931
  onExpanderClick,
10921
10932
  onClick,
10933
+ onDoubleClick,
10922
10934
  scrollToTask,
10923
10935
  selectTaskOnMouseDown,
10924
10936
  selectedIdsMirror,
@@ -10986,6 +10998,7 @@ const TaskListInner = ({
10986
10998
  isSelected: selectedIdsMirror[id],
10987
10999
  isShowTaskNumbers,
10988
11000
  onClick,
11001
+ onDoubleClick,
10989
11002
  onExpanderClick,
10990
11003
  scrollToTask,
10991
11004
  selectTaskOnMouseDown,
@@ -11010,6 +11023,7 @@ const TaskListInner = ({
11010
11023
  isShowTaskNumbers,
11011
11024
  mapTaskToNestedIndex,
11012
11025
  onClick,
11026
+ onDoubleClick,
11013
11027
  onExpanderClick,
11014
11028
  scrollToTask,
11015
11029
  selectTaskOnMouseDown,
@@ -20833,6 +20847,19 @@ const Gantt = (props) => {
20833
20847
  setActiveArrowKey(null);
20834
20848
  setActiveTaskId(null);
20835
20849
  }, []);
20850
+ const handleTableRowDoubleClick = useCallback(
20851
+ (task) => {
20852
+ if (enableDrawer && taskList.enableTableRowDoubleClick) {
20853
+ setActiveArrowKey(null);
20854
+ setActiveTaskId(task.id);
20855
+ setDrawerData({ type: "task", task });
20856
+ }
20857
+ if (taskList.onTableRowDoubleClick) {
20858
+ taskList.onTableRowDoubleClick(task);
20859
+ }
20860
+ },
20861
+ [enableDrawer, taskList]
20862
+ );
20836
20863
  const handleGoToTask = useCallback(
20837
20864
  (taskId) => {
20838
20865
  for (const [comparisonLevel, levelMap] of tasksMap) {
@@ -21173,6 +21200,7 @@ const Gantt = (props) => {
21173
21200
  handleOpenContextMenu: handleOpenContextMenuForRow,
21174
21201
  mapTaskToNestedIndex,
21175
21202
  onExpanderClick,
21203
+ onDoubleClick: handleTableRowDoubleClick,
21176
21204
  scrollToBottomStep,
21177
21205
  scrollToTopStep,
21178
21206
  selectTaskOnMouseDown,
@@ -21210,7 +21238,8 @@ const Gantt = (props) => {
21210
21238
  selectedIdsMirror,
21211
21239
  taskList,
21212
21240
  taskListContainerRef,
21213
- visibleTasks
21241
+ visibleTasks,
21242
+ handleTableRowDoubleClick
21214
21243
  ]
21215
21244
  );
21216
21245
  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,15 @@
10231
10232
  moveOverPosition
10232
10233
  } = props;
10233
10234
  const { id, comparisonLevel = 1 } = task;
10235
+ const onRowDoubleClick = React.useCallback(
10236
+ (event) => {
10237
+ event.preventDefault();
10238
+ if (onDoubleClick) {
10239
+ onDoubleClick(task);
10240
+ }
10241
+ },
10242
+ [onDoubleClick, task]
10243
+ );
10234
10244
  const onRootMouseDown = React.useCallback(
10235
10245
  (event) => {
10236
10246
  event.preventDefault();
@@ -10363,6 +10373,7 @@
10363
10373
  ref,
10364
10374
  className: rowClassName,
10365
10375
  onMouseDown: onRootMouseDown,
10376
+ onDoubleClick: onRowDoubleClick,
10366
10377
  style: {
10367
10378
  height: fullRowHeight,
10368
10379
  backgroundColor,
@@ -10936,6 +10947,7 @@
10936
10947
  mapTaskToNestedIndex,
10937
10948
  onExpanderClick,
10938
10949
  onClick,
10950
+ onDoubleClick,
10939
10951
  scrollToTask,
10940
10952
  selectTaskOnMouseDown,
10941
10953
  selectedIdsMirror,
@@ -11003,6 +11015,7 @@
11003
11015
  isSelected: selectedIdsMirror[id],
11004
11016
  isShowTaskNumbers,
11005
11017
  onClick,
11018
+ onDoubleClick,
11006
11019
  onExpanderClick,
11007
11020
  scrollToTask,
11008
11021
  selectTaskOnMouseDown,
@@ -11027,6 +11040,7 @@
11027
11040
  isShowTaskNumbers,
11028
11041
  mapTaskToNestedIndex,
11029
11042
  onClick,
11043
+ onDoubleClick,
11030
11044
  onExpanderClick,
11031
11045
  scrollToTask,
11032
11046
  selectTaskOnMouseDown,
@@ -20850,6 +20864,19 @@
20850
20864
  setActiveArrowKey(null);
20851
20865
  setActiveTaskId(null);
20852
20866
  }, []);
20867
+ const handleTableRowDoubleClick = React.useCallback(
20868
+ (task) => {
20869
+ if (enableDrawer && taskList.enableTableRowDoubleClick) {
20870
+ setActiveArrowKey(null);
20871
+ setActiveTaskId(task.id);
20872
+ setDrawerData({ type: "task", task });
20873
+ }
20874
+ if (taskList.onTableRowDoubleClick) {
20875
+ taskList.onTableRowDoubleClick(task);
20876
+ }
20877
+ },
20878
+ [enableDrawer, taskList]
20879
+ );
20853
20880
  const handleGoToTask = React.useCallback(
20854
20881
  (taskId) => {
20855
20882
  for (const [comparisonLevel, levelMap] of tasksMap) {
@@ -21190,6 +21217,7 @@
21190
21217
  handleOpenContextMenu: handleOpenContextMenuForRow,
21191
21218
  mapTaskToNestedIndex,
21192
21219
  onExpanderClick,
21220
+ onDoubleClick: handleTableRowDoubleClick,
21193
21221
  scrollToBottomStep,
21194
21222
  scrollToTopStep,
21195
21223
  selectTaskOnMouseDown,
@@ -21227,7 +21255,8 @@
21227
21255
  selectedIdsMirror,
21228
21256
  taskList,
21229
21257
  taskListContainerRef,
21230
- visibleTasks
21258
+ visibleTasks,
21259
+ handleTableRowDoubleClick
21231
21260
  ]
21232
21261
  );
21233
21262
  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.6",
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",