@thepocman/gantt-task-react 1.0.12 → 1.0.13

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.
@@ -11693,16 +11693,7 @@ const Gantt = ({
11693
11693
  );
11694
11694
  const maxLevelLength = useMemo(() => {
11695
11695
  if (enableTaskGrouping) {
11696
- let totalHeightInRows = 0;
11697
- for (const [_, rowMap] of rowIndexToTasksMap) {
11698
- for (const [_2, tasksInRow] of rowMap) {
11699
- const maxStack = tasksInRow.length;
11700
- const stackedHeight = maxStack * (taskHeight + 2);
11701
- const rowsNeeded = Math.ceil(stackedHeight / fullRowHeight);
11702
- totalHeightInRows += rowsNeeded;
11703
- }
11704
- }
11705
- return Math.max(totalHeightInRows, 1);
11696
+ return Math.max((rowIndexToTasksMap == null ? void 0 : rowIndexToTasksMap.size) ?? 0, 1);
11706
11697
  }
11707
11698
  let maxLength = 0;
11708
11699
  const countByLevel = {};
@@ -11716,17 +11707,17 @@ const Gantt = ({
11716
11707
  }
11717
11708
  });
11718
11709
  return maxLength;
11719
- }, [visibleTasks, comparisonLevels, enableTaskGrouping, rowIndexToTasksMap, fullRowHeight, taskHeight]);
11710
+ }, [visibleTasks, comparisonLevels, enableTaskGrouping, rowIndexToTasksMap]);
11720
11711
  const ganttFullHeight = useMemo(() => {
11721
11712
  if (enableTaskGrouping) {
11722
11713
  let totalHeight = 0;
11723
11714
  for (const [, taskMap] of rowIndexToTasksMap) {
11724
11715
  for (const [, tasks2] of taskMap) {
11725
- const stackedHeight = tasks2.length * (taskHeight + 2);
11726
- totalHeight += Math.max(stackedHeight, fullRowHeight);
11716
+ const rowHeight = tasks2.length * (taskHeight + 2);
11717
+ totalHeight += Math.max(rowHeight, fullRowHeight);
11727
11718
  }
11728
11719
  }
11729
- return totalHeight;
11720
+ return Math.max(totalHeight, fullRowHeight);
11730
11721
  }
11731
11722
  return maxLevelLength * fullRowHeight;
11732
11723
  }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight, taskHeight]);
@@ -12002,6 +11993,8 @@ const Gantt = ({
12002
11993
  };
12003
11994
  const handleExpanderClick = useCallback(
12004
11995
  (clickedTask) => {
11996
+ console.log(`Task ${clickedTask.id} hideChildren changed from ${clickedTask.hideChildren} to ${!clickedTask.hideChildren}`);
11997
+ console.log("Task types:", tasks.map((task) => `${task.id}: ${task.type}`));
12005
11998
  if (onChangeExpandState) {
12006
11999
  onChangeExpandState({
12007
12000
  ...clickedTask,
@@ -11706,16 +11706,7 @@
11706
11706
  );
11707
11707
  const maxLevelLength = React.useMemo(() => {
11708
11708
  if (enableTaskGrouping) {
11709
- let totalHeightInRows = 0;
11710
- for (const [_, rowMap] of rowIndexToTasksMap) {
11711
- for (const [_2, tasksInRow] of rowMap) {
11712
- const maxStack = tasksInRow.length;
11713
- const stackedHeight = maxStack * (taskHeight + 2);
11714
- const rowsNeeded = Math.ceil(stackedHeight / fullRowHeight);
11715
- totalHeightInRows += rowsNeeded;
11716
- }
11717
- }
11718
- return Math.max(totalHeightInRows, 1);
11709
+ return Math.max((rowIndexToTasksMap == null ? void 0 : rowIndexToTasksMap.size) ?? 0, 1);
11719
11710
  }
11720
11711
  let maxLength = 0;
11721
11712
  const countByLevel = {};
@@ -11729,17 +11720,17 @@
11729
11720
  }
11730
11721
  });
11731
11722
  return maxLength;
11732
- }, [visibleTasks, comparisonLevels, enableTaskGrouping, rowIndexToTasksMap, fullRowHeight, taskHeight]);
11723
+ }, [visibleTasks, comparisonLevels, enableTaskGrouping, rowIndexToTasksMap]);
11733
11724
  const ganttFullHeight = React.useMemo(() => {
11734
11725
  if (enableTaskGrouping) {
11735
11726
  let totalHeight = 0;
11736
11727
  for (const [, taskMap] of rowIndexToTasksMap) {
11737
11728
  for (const [, tasks2] of taskMap) {
11738
- const stackedHeight = tasks2.length * (taskHeight + 2);
11739
- totalHeight += Math.max(stackedHeight, fullRowHeight);
11729
+ const rowHeight = tasks2.length * (taskHeight + 2);
11730
+ totalHeight += Math.max(rowHeight, fullRowHeight);
11740
11731
  }
11741
11732
  }
11742
- return totalHeight;
11733
+ return Math.max(totalHeight, fullRowHeight);
11743
11734
  }
11744
11735
  return maxLevelLength * fullRowHeight;
11745
11736
  }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight, taskHeight]);
@@ -12015,6 +12006,8 @@
12015
12006
  };
12016
12007
  const handleExpanderClick = React.useCallback(
12017
12008
  (clickedTask) => {
12009
+ console.log(`Task ${clickedTask.id} hideChildren changed from ${clickedTask.hideChildren} to ${!clickedTask.hideChildren}`);
12010
+ console.log("Task types:", tasks.map((task) => `${task.id}: ${task.type}`));
12018
12011
  if (onChangeExpandState) {
12019
12012
  onChangeExpandState({
12020
12013
  ...clickedTask,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepocman/gantt-task-react",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
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",