@thepocman/gantt-task-react 1.0.17 → 1.0.19

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.
@@ -1957,13 +1957,19 @@ const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight)
1957
1957
  }
1958
1958
  return [...rowToHeight.entries()].map(([rowIndex, height]) => ({ rowIndex, height })).sort((a4, b3) => a4.rowIndex - b3.rowIndex);
1959
1959
  }, [rowIndexToTasksMap, taskHeight]);
1960
- if (rowEntries.length === 0) {
1960
+ if (!rowEntries || rowEntries.length === 0) {
1961
1961
  return [0, 0, true, true, 0];
1962
1962
  }
1963
- const startRow = rowEntries[0].rowIndex;
1964
- const endRow = rowEntries[rowEntries.length - 1].rowIndex;
1963
+ const first = rowEntries[0];
1964
+ const last = rowEntries[rowEntries.length - 1];
1965
1965
  const fullHeight = rowEntries.reduce((sum, r) => sum + r.height, 0);
1966
- return [startRow, endRow, true, true, fullHeight];
1966
+ return [
1967
+ (first == null ? void 0 : first.rowIndex) ?? 0,
1968
+ (last == null ? void 0 : last.rowIndex) ?? 0,
1969
+ true,
1970
+ true,
1971
+ fullHeight
1972
+ ];
1967
1973
  };
1968
1974
  const button$2 = "_button_1eue5_1";
1969
1975
  const styles$i = {
@@ -3440,15 +3446,17 @@ const TaskListInner = ({
3440
3446
  onTableResizeStart,
3441
3447
  onColumnResizeStart
3442
3448
  ] = useTableListResize(columnsProp, distances, onResizeColumn);
3443
- const renderedIndexes = enableTaskGrouping ? useGroupedVirtualization(
3449
+ const groupedIndexes = useGroupedVirtualization(
3444
3450
  taskListContentRef,
3445
3451
  rowIndexToTasksMap,
3446
3452
  distances.taskHeight
3447
- ) : useOptimizedList(
3453
+ );
3454
+ const optimizedIndexes = useOptimizedList(
3448
3455
  taskListContentRef,
3449
3456
  "scrollTop",
3450
3457
  fullRowHeight
3451
3458
  );
3459
+ const renderedIndexes = enableTaskGrouping ? groupedIndexes : optimizedIndexes;
3452
3460
  return /* @__PURE__ */ jsxs("div", { className: styles$e.ganttTableRoot, ref: taskListRef, children: [
3453
3461
  /* @__PURE__ */ jsxs(
3454
3462
  "div",
@@ -11782,15 +11790,17 @@ const Gantt = ({
11782
11790
  }
11783
11791
  return totalRows * fullRowHeight;
11784
11792
  }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
11785
- const renderedRowIndexes = enableTaskGrouping ? useGroupedVirtualization(
11793
+ const groupedIndexes = useGroupedVirtualization(
11786
11794
  ganttTaskContentRef,
11787
11795
  rowIndexToTasksMap,
11788
11796
  fullRowHeight
11789
- ) : useOptimizedList(
11797
+ );
11798
+ const optimizedIndexes = useOptimizedList(
11790
11799
  ganttTaskContentRef,
11791
11800
  "scrollTop",
11792
11801
  fullRowHeight
11793
11802
  );
11803
+ const renderedRowIndexes = enableTaskGrouping ? groupedIndexes : optimizedIndexes;
11794
11804
  const {
11795
11805
  checkHasCopyTasks,
11796
11806
  checkHasCutTasks,
@@ -1970,13 +1970,19 @@
1970
1970
  }
1971
1971
  return [...rowToHeight.entries()].map(([rowIndex, height]) => ({ rowIndex, height })).sort((a2, b2) => a2.rowIndex - b2.rowIndex);
1972
1972
  }, [rowIndexToTasksMap, taskHeight]);
1973
- if (rowEntries.length === 0) {
1973
+ if (!rowEntries || rowEntries.length === 0) {
1974
1974
  return [0, 0, true, true, 0];
1975
1975
  }
1976
- const startRow = rowEntries[0].rowIndex;
1977
- const endRow = rowEntries[rowEntries.length - 1].rowIndex;
1976
+ const first = rowEntries[0];
1977
+ const last = rowEntries[rowEntries.length - 1];
1978
1978
  const fullHeight = rowEntries.reduce((sum, r) => sum + r.height, 0);
1979
- return [startRow, endRow, true, true, fullHeight];
1979
+ return [
1980
+ (first == null ? void 0 : first.rowIndex) ?? 0,
1981
+ (last == null ? void 0 : last.rowIndex) ?? 0,
1982
+ true,
1983
+ true,
1984
+ fullHeight
1985
+ ];
1980
1986
  };
1981
1987
  const button$2 = "_button_1eue5_1";
1982
1988
  const styles$i = {
@@ -3453,15 +3459,17 @@
3453
3459
  onTableResizeStart,
3454
3460
  onColumnResizeStart
3455
3461
  ] = useTableListResize(columnsProp, distances, onResizeColumn);
3456
- const renderedIndexes = enableTaskGrouping ? useGroupedVirtualization(
3462
+ const groupedIndexes = useGroupedVirtualization(
3457
3463
  taskListContentRef,
3458
3464
  rowIndexToTasksMap,
3459
3465
  distances.taskHeight
3460
- ) : useOptimizedList(
3466
+ );
3467
+ const optimizedIndexes = useOptimizedList(
3461
3468
  taskListContentRef,
3462
3469
  "scrollTop",
3463
3470
  fullRowHeight
3464
3471
  );
3472
+ const renderedIndexes = enableTaskGrouping ? groupedIndexes : optimizedIndexes;
3465
3473
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$e.ganttTableRoot, ref: taskListRef, children: [
3466
3474
  /* @__PURE__ */ jsxRuntime.jsxs(
3467
3475
  "div",
@@ -11795,15 +11803,17 @@
11795
11803
  }
11796
11804
  return totalRows * fullRowHeight;
11797
11805
  }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
11798
- const renderedRowIndexes = enableTaskGrouping ? useGroupedVirtualization(
11806
+ const groupedIndexes = useGroupedVirtualization(
11799
11807
  ganttTaskContentRef,
11800
11808
  rowIndexToTasksMap,
11801
11809
  fullRowHeight
11802
- ) : useOptimizedList(
11810
+ );
11811
+ const optimizedIndexes = useOptimizedList(
11803
11812
  ganttTaskContentRef,
11804
11813
  "scrollTop",
11805
11814
  fullRowHeight
11806
11815
  );
11816
+ const renderedRowIndexes = enableTaskGrouping ? groupedIndexes : optimizedIndexes;
11807
11817
  const {
11808
11818
  checkHasCopyTasks,
11809
11819
  checkHasCutTasks,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepocman/gantt-task-react",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Fork of gantt-task-react with support for grouped tasks on a single row when collapsed",
5
5
  "author": "Adrian Bueno <adrianlbueno@users.noreply.github.com>",
6
6
  "homepage": "https://github.com/adrianlbueno/gantt-task-react#readme",