@thepocman/gantt-task-react 1.0.15 → 1.0.17
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,27 @@ const useOptimizedList = (containerRef, property, cellSize) => {
|
|
|
1943
1943
|
]);
|
|
1944
1944
|
return indexes;
|
|
1945
1945
|
};
|
|
1946
|
-
const
|
|
1947
|
-
|
|
1946
|
+
const TASK_SPACING = 2;
|
|
1947
|
+
const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight) => {
|
|
1948
1948
|
const rowEntries = useMemo(() => {
|
|
1949
|
+
if (!rowIndexToTasksMap || rowIndexToTasksMap.size === 0)
|
|
1950
|
+
return [];
|
|
1949
1951
|
const rowToHeight = /* @__PURE__ */ new Map();
|
|
1950
1952
|
for (const levelMap of rowIndexToTasksMap.values()) {
|
|
1951
1953
|
for (const [rowIndex, tasks] of levelMap.entries()) {
|
|
1952
|
-
const height = tasks.length * (taskHeight +
|
|
1954
|
+
const height = tasks.length * (taskHeight + TASK_SPACING);
|
|
1953
1955
|
rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
|
|
1954
1956
|
}
|
|
1955
1957
|
}
|
|
1956
1958
|
return [...rowToHeight.entries()].map(([rowIndex, height]) => ({ rowIndex, height })).sort((a4, b3) => a4.rowIndex - b3.rowIndex);
|
|
1957
1959
|
}, [rowIndexToTasksMap, taskHeight]);
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
];
|
|
1960
|
+
if (rowEntries.length === 0) {
|
|
1961
|
+
return [0, 0, true, true, 0];
|
|
1962
|
+
}
|
|
1963
|
+
const startRow = rowEntries[0].rowIndex;
|
|
1964
|
+
const endRow = rowEntries[rowEntries.length - 1].rowIndex;
|
|
1965
|
+
const fullHeight = rowEntries.reduce((sum, r) => sum + r.height, 0);
|
|
1966
|
+
return [startRow, endRow, true, true, fullHeight];
|
|
1965
1967
|
};
|
|
1966
1968
|
const button$2 = "_button_1eue5_1";
|
|
1967
1969
|
const styles$i = {
|
|
@@ -3439,7 +3441,7 @@ const TaskListInner = ({
|
|
|
3439
3441
|
onColumnResizeStart
|
|
3440
3442
|
] = useTableListResize(columnsProp, distances, onResizeColumn);
|
|
3441
3443
|
const renderedIndexes = enableTaskGrouping ? useGroupedVirtualization(
|
|
3442
|
-
|
|
3444
|
+
taskListContentRef,
|
|
3443
3445
|
rowIndexToTasksMap,
|
|
3444
3446
|
distances.taskHeight
|
|
3445
3447
|
) : useOptimizedList(
|
|
@@ -11781,7 +11783,7 @@ const Gantt = ({
|
|
|
11781
11783
|
return totalRows * fullRowHeight;
|
|
11782
11784
|
}, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
|
|
11783
11785
|
const renderedRowIndexes = enableTaskGrouping ? useGroupedVirtualization(
|
|
11784
|
-
|
|
11786
|
+
ganttTaskContentRef,
|
|
11785
11787
|
rowIndexToTasksMap,
|
|
11786
11788
|
fullRowHeight
|
|
11787
11789
|
) : useOptimizedList(
|
|
@@ -1956,25 +1956,27 @@
|
|
|
1956
1956
|
]);
|
|
1957
1957
|
return indexes;
|
|
1958
1958
|
};
|
|
1959
|
-
const
|
|
1960
|
-
|
|
1959
|
+
const TASK_SPACING = 2;
|
|
1960
|
+
const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight) => {
|
|
1961
1961
|
const rowEntries = React.useMemo(() => {
|
|
1962
|
+
if (!rowIndexToTasksMap || rowIndexToTasksMap.size === 0)
|
|
1963
|
+
return [];
|
|
1962
1964
|
const rowToHeight = /* @__PURE__ */ new Map();
|
|
1963
1965
|
for (const levelMap of rowIndexToTasksMap.values()) {
|
|
1964
1966
|
for (const [rowIndex, tasks] of levelMap.entries()) {
|
|
1965
|
-
const height = tasks.length * (taskHeight +
|
|
1967
|
+
const height = tasks.length * (taskHeight + TASK_SPACING);
|
|
1966
1968
|
rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
|
|
1967
1969
|
}
|
|
1968
1970
|
}
|
|
1969
1971
|
return [...rowToHeight.entries()].map(([rowIndex, height]) => ({ rowIndex, height })).sort((a2, b2) => a2.rowIndex - b2.rowIndex);
|
|
1970
1972
|
}, [rowIndexToTasksMap, taskHeight]);
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
];
|
|
1973
|
+
if (rowEntries.length === 0) {
|
|
1974
|
+
return [0, 0, true, true, 0];
|
|
1975
|
+
}
|
|
1976
|
+
const startRow = rowEntries[0].rowIndex;
|
|
1977
|
+
const endRow = rowEntries[rowEntries.length - 1].rowIndex;
|
|
1978
|
+
const fullHeight = rowEntries.reduce((sum, r) => sum + r.height, 0);
|
|
1979
|
+
return [startRow, endRow, true, true, fullHeight];
|
|
1978
1980
|
};
|
|
1979
1981
|
const button$2 = "_button_1eue5_1";
|
|
1980
1982
|
const styles$i = {
|
|
@@ -3452,7 +3454,7 @@
|
|
|
3452
3454
|
onColumnResizeStart
|
|
3453
3455
|
] = useTableListResize(columnsProp, distances, onResizeColumn);
|
|
3454
3456
|
const renderedIndexes = enableTaskGrouping ? useGroupedVirtualization(
|
|
3455
|
-
|
|
3457
|
+
taskListContentRef,
|
|
3456
3458
|
rowIndexToTasksMap,
|
|
3457
3459
|
distances.taskHeight
|
|
3458
3460
|
) : useOptimizedList(
|
|
@@ -11794,7 +11796,7 @@
|
|
|
11794
11796
|
return totalRows * fullRowHeight;
|
|
11795
11797
|
}, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
|
|
11796
11798
|
const renderedRowIndexes = enableTaskGrouping ? useGroupedVirtualization(
|
|
11797
|
-
|
|
11799
|
+
ganttTaskContentRef,
|
|
11798
11800
|
rowIndexToTasksMap,
|
|
11799
11801
|
fullRowHeight
|
|
11800
11802
|
) : useOptimizedList(
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { RowIndexToTasksMap } from "../types/public-types";
|
|
2
|
-
import { OptimizedListParams } from "./use-optimized-list";
|
|
3
|
-
export declare const useGroupedVirtualization: (rowIndexToTasksMap: RowIndexToTasksMap, taskHeight: number) => OptimizedListParams;
|
|
2
|
+
import type { OptimizedListParams } from "./use-optimized-list";
|
|
3
|
+
export declare const useGroupedVirtualization: (_containerRef: React.RefObject<HTMLElement>, rowIndexToTasksMap: RowIndexToTasksMap, taskHeight: number) => OptimizedListParams;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thepocman/gantt-task-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
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",
|