@thepocman/gantt-task-react 1.0.11 → 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,19 +11707,20 @@ 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
- let totalRows = 0;
11713
+ let totalHeight = 0;
11723
11714
  for (const [, taskMap] of rowIndexToTasksMap) {
11724
11715
  for (const [, tasks2] of taskMap) {
11725
- totalRows += tasks2.length;
11716
+ const rowHeight = tasks2.length * (taskHeight + 2);
11717
+ totalHeight += Math.max(rowHeight, fullRowHeight);
11726
11718
  }
11727
11719
  }
11728
- return Math.max(totalRows, 1) * fullRowHeight;
11720
+ return Math.max(totalHeight, fullRowHeight);
11729
11721
  }
11730
11722
  return maxLevelLength * fullRowHeight;
11731
- }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
11723
+ }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight, taskHeight]);
11732
11724
  const {
11733
11725
  checkHasCopyTasks,
11734
11726
  checkHasCutTasks,
@@ -12001,6 +11993,8 @@ const Gantt = ({
12001
11993
  };
12002
11994
  const handleExpanderClick = useCallback(
12003
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}`));
12004
11998
  if (onChangeExpandState) {
12005
11999
  onChangeExpandState({
12006
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,19 +11720,20 @@
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
- let totalRows = 0;
11726
+ let totalHeight = 0;
11736
11727
  for (const [, taskMap] of rowIndexToTasksMap) {
11737
11728
  for (const [, tasks2] of taskMap) {
11738
- totalRows += tasks2.length;
11729
+ const rowHeight = tasks2.length * (taskHeight + 2);
11730
+ totalHeight += Math.max(rowHeight, fullRowHeight);
11739
11731
  }
11740
11732
  }
11741
- return Math.max(totalRows, 1) * fullRowHeight;
11733
+ return Math.max(totalHeight, fullRowHeight);
11742
11734
  }
11743
11735
  return maxLevelLength * fullRowHeight;
11744
- }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
11736
+ }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight, taskHeight]);
11745
11737
  const {
11746
11738
  checkHasCopyTasks,
11747
11739
  checkHasCutTasks,
@@ -12014,6 +12006,8 @@
12014
12006
  };
12015
12007
  const handleExpanderClick = React.useCallback(
12016
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}`));
12017
12011
  if (onChangeExpandState) {
12018
12012
  onChangeExpandState({
12019
12013
  ...clickedTask,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepocman/gantt-task-react",
3
- "version": "1.0.11",
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",