@thepocman/gantt-task-react 1.0.14 → 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.
|
@@ -1944,31 +1944,26 @@ const useOptimizedList = (containerRef, property, cellSize) => {
|
|
|
1944
1944
|
return indexes;
|
|
1945
1945
|
};
|
|
1946
1946
|
const TASK_SPACING = 2;
|
|
1947
|
-
const
|
|
1948
|
-
const
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1947
|
+
const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight) => {
|
|
1948
|
+
const rowEntries = useMemo(() => {
|
|
1949
|
+
if (!rowIndexToTasksMap || rowIndexToTasksMap.size === 0)
|
|
1950
|
+
return [];
|
|
1951
|
+
const rowToHeight = /* @__PURE__ */ new Map();
|
|
1952
|
+
for (const levelMap of rowIndexToTasksMap.values()) {
|
|
1953
|
+
for (const [rowIndex, tasks] of levelMap.entries()) {
|
|
1954
|
+
const height = tasks.length * (taskHeight + TASK_SPACING);
|
|
1955
|
+
rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
|
|
1956
|
+
}
|
|
1952
1957
|
}
|
|
1958
|
+
return [...rowToHeight.entries()].map(([rowIndex, height]) => ({ rowIndex, height })).sort((a4, b3) => a4.rowIndex - b3.rowIndex);
|
|
1959
|
+
}, [rowIndexToTasksMap, taskHeight]);
|
|
1960
|
+
if (rowEntries.length === 0) {
|
|
1961
|
+
return [0, 0, true, true, 0];
|
|
1953
1962
|
}
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
};
|
|
1959
|
-
const useGroupedVirtualization = (rowIndexToTasksMap, taskHeight) => {
|
|
1960
|
-
var _a, _b;
|
|
1961
|
-
const rowEntries = useMemo(
|
|
1962
|
-
() => buildRowEntries(rowIndexToTasksMap, taskHeight),
|
|
1963
|
-
[rowIndexToTasksMap, taskHeight]
|
|
1964
|
-
);
|
|
1965
|
-
return [
|
|
1966
|
-
((_a = rowEntries[0]) == null ? void 0 : _a.rowIndex) ?? 0,
|
|
1967
|
-
((_b = rowEntries[rowEntries.length - 1]) == null ? void 0 : _b.rowIndex) ?? 0,
|
|
1968
|
-
true,
|
|
1969
|
-
true,
|
|
1970
|
-
rowEntries.reduce((sum, entry) => sum + entry.height, 0)
|
|
1971
|
-
];
|
|
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];
|
|
1972
1967
|
};
|
|
1973
1968
|
const button$2 = "_button_1eue5_1";
|
|
1974
1969
|
const styles$i = {
|
|
@@ -3446,7 +3441,7 @@ const TaskListInner = ({
|
|
|
3446
3441
|
onColumnResizeStart
|
|
3447
3442
|
] = useTableListResize(columnsProp, distances, onResizeColumn);
|
|
3448
3443
|
const renderedIndexes = enableTaskGrouping ? useGroupedVirtualization(
|
|
3449
|
-
|
|
3444
|
+
taskListContentRef,
|
|
3450
3445
|
rowIndexToTasksMap,
|
|
3451
3446
|
distances.taskHeight
|
|
3452
3447
|
) : useOptimizedList(
|
|
@@ -11788,7 +11783,7 @@ const Gantt = ({
|
|
|
11788
11783
|
return totalRows * fullRowHeight;
|
|
11789
11784
|
}, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
|
|
11790
11785
|
const renderedRowIndexes = enableTaskGrouping ? useGroupedVirtualization(
|
|
11791
|
-
|
|
11786
|
+
ganttTaskContentRef,
|
|
11792
11787
|
rowIndexToTasksMap,
|
|
11793
11788
|
fullRowHeight
|
|
11794
11789
|
) : useOptimizedList(
|
|
@@ -1957,31 +1957,26 @@
|
|
|
1957
1957
|
return indexes;
|
|
1958
1958
|
};
|
|
1959
1959
|
const TASK_SPACING = 2;
|
|
1960
|
-
const
|
|
1961
|
-
const
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1960
|
+
const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight) => {
|
|
1961
|
+
const rowEntries = React.useMemo(() => {
|
|
1962
|
+
if (!rowIndexToTasksMap || rowIndexToTasksMap.size === 0)
|
|
1963
|
+
return [];
|
|
1964
|
+
const rowToHeight = /* @__PURE__ */ new Map();
|
|
1965
|
+
for (const levelMap of rowIndexToTasksMap.values()) {
|
|
1966
|
+
for (const [rowIndex, tasks] of levelMap.entries()) {
|
|
1967
|
+
const height = tasks.length * (taskHeight + TASK_SPACING);
|
|
1968
|
+
rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
|
|
1969
|
+
}
|
|
1965
1970
|
}
|
|
1971
|
+
return [...rowToHeight.entries()].map(([rowIndex, height]) => ({ rowIndex, height })).sort((a2, b2) => a2.rowIndex - b2.rowIndex);
|
|
1972
|
+
}, [rowIndexToTasksMap, taskHeight]);
|
|
1973
|
+
if (rowEntries.length === 0) {
|
|
1974
|
+
return [0, 0, true, true, 0];
|
|
1966
1975
|
}
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
};
|
|
1972
|
-
const useGroupedVirtualization = (rowIndexToTasksMap, taskHeight) => {
|
|
1973
|
-
var _a, _b;
|
|
1974
|
-
const rowEntries = React.useMemo(
|
|
1975
|
-
() => buildRowEntries(rowIndexToTasksMap, taskHeight),
|
|
1976
|
-
[rowIndexToTasksMap, taskHeight]
|
|
1977
|
-
);
|
|
1978
|
-
return [
|
|
1979
|
-
((_a = rowEntries[0]) == null ? void 0 : _a.rowIndex) ?? 0,
|
|
1980
|
-
((_b = rowEntries[rowEntries.length - 1]) == null ? void 0 : _b.rowIndex) ?? 0,
|
|
1981
|
-
true,
|
|
1982
|
-
true,
|
|
1983
|
-
rowEntries.reduce((sum, entry) => sum + entry.height, 0)
|
|
1984
|
-
];
|
|
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];
|
|
1985
1980
|
};
|
|
1986
1981
|
const button$2 = "_button_1eue5_1";
|
|
1987
1982
|
const styles$i = {
|
|
@@ -3459,7 +3454,7 @@
|
|
|
3459
3454
|
onColumnResizeStart
|
|
3460
3455
|
] = useTableListResize(columnsProp, distances, onResizeColumn);
|
|
3461
3456
|
const renderedIndexes = enableTaskGrouping ? useGroupedVirtualization(
|
|
3462
|
-
|
|
3457
|
+
taskListContentRef,
|
|
3463
3458
|
rowIndexToTasksMap,
|
|
3464
3459
|
distances.taskHeight
|
|
3465
3460
|
) : useOptimizedList(
|
|
@@ -11801,7 +11796,7 @@
|
|
|
11801
11796
|
return totalRows * fullRowHeight;
|
|
11802
11797
|
}, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
|
|
11803
11798
|
const renderedRowIndexes = enableTaskGrouping ? useGroupedVirtualization(
|
|
11804
|
-
|
|
11799
|
+
ganttTaskContentRef,
|
|
11805
11800
|
rowIndexToTasksMap,
|
|
11806
11801
|
fullRowHeight
|
|
11807
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",
|