@thepocman/gantt-task-react 1.0.14 → 1.0.15

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.
@@ -1943,25 +1943,18 @@ const useOptimizedList = (containerRef, property, cellSize) => {
1943
1943
  ]);
1944
1944
  return indexes;
1945
1945
  };
1946
- const TASK_SPACING = 2;
1947
- const buildRowEntries = (rowIndexToTasksMap, taskHeight) => {
1948
- const rowToTaskCount = /* @__PURE__ */ new Map();
1949
- for (const rowMap of rowIndexToTasksMap.values()) {
1950
- for (const [rowIndex, tasks] of rowMap.entries()) {
1951
- rowToTaskCount.set(rowIndex, (rowToTaskCount.get(rowIndex) ?? 0) + tasks.length);
1952
- }
1953
- }
1954
- return [...rowToTaskCount.entries()].map(([rowIndex, count2]) => ({
1955
- rowIndex,
1956
- height: count2 * (taskHeight + TASK_SPACING)
1957
- })).sort((a4, b3) => a4.rowIndex - b3.rowIndex);
1958
- };
1959
1946
  const useGroupedVirtualization = (rowIndexToTasksMap, taskHeight) => {
1960
1947
  var _a, _b;
1961
- const rowEntries = useMemo(
1962
- () => buildRowEntries(rowIndexToTasksMap, taskHeight),
1963
- [rowIndexToTasksMap, taskHeight]
1964
- );
1948
+ const rowEntries = useMemo(() => {
1949
+ const rowToHeight = /* @__PURE__ */ new Map();
1950
+ for (const levelMap of rowIndexToTasksMap.values()) {
1951
+ for (const [rowIndex, tasks] of levelMap.entries()) {
1952
+ const height = tasks.length * (taskHeight + 2);
1953
+ rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
1954
+ }
1955
+ }
1956
+ return [...rowToHeight.entries()].map(([rowIndex, height]) => ({ rowIndex, height })).sort((a4, b3) => a4.rowIndex - b3.rowIndex);
1957
+ }, [rowIndexToTasksMap, taskHeight]);
1965
1958
  return [
1966
1959
  ((_a = rowEntries[0]) == null ? void 0 : _a.rowIndex) ?? 0,
1967
1960
  ((_b = rowEntries[rowEntries.length - 1]) == null ? void 0 : _b.rowIndex) ?? 0,
@@ -1956,25 +1956,18 @@
1956
1956
  ]);
1957
1957
  return indexes;
1958
1958
  };
1959
- const TASK_SPACING = 2;
1960
- const buildRowEntries = (rowIndexToTasksMap, taskHeight) => {
1961
- const rowToTaskCount = /* @__PURE__ */ new Map();
1962
- for (const rowMap of rowIndexToTasksMap.values()) {
1963
- for (const [rowIndex, tasks] of rowMap.entries()) {
1964
- rowToTaskCount.set(rowIndex, (rowToTaskCount.get(rowIndex) ?? 0) + tasks.length);
1965
- }
1966
- }
1967
- return [...rowToTaskCount.entries()].map(([rowIndex, count2]) => ({
1968
- rowIndex,
1969
- height: count2 * (taskHeight + TASK_SPACING)
1970
- })).sort((a2, b2) => a2.rowIndex - b2.rowIndex);
1971
- };
1972
1959
  const useGroupedVirtualization = (rowIndexToTasksMap, taskHeight) => {
1973
1960
  var _a, _b;
1974
- const rowEntries = React.useMemo(
1975
- () => buildRowEntries(rowIndexToTasksMap, taskHeight),
1976
- [rowIndexToTasksMap, taskHeight]
1977
- );
1961
+ const rowEntries = React.useMemo(() => {
1962
+ const rowToHeight = /* @__PURE__ */ new Map();
1963
+ for (const levelMap of rowIndexToTasksMap.values()) {
1964
+ for (const [rowIndex, tasks] of levelMap.entries()) {
1965
+ const height = tasks.length * (taskHeight + 2);
1966
+ rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
1967
+ }
1968
+ }
1969
+ return [...rowToHeight.entries()].map(([rowIndex, height]) => ({ rowIndex, height })).sort((a2, b2) => a2.rowIndex - b2.rowIndex);
1970
+ }, [rowIndexToTasksMap, taskHeight]);
1978
1971
  return [
1979
1972
  ((_a = rowEntries[0]) == null ? void 0 : _a.rowIndex) ?? 0,
1980
1973
  ((_b = rowEntries[rowEntries.length - 1]) == null ? void 0 : _b.rowIndex) ?? 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepocman/gantt-task-react",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
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",