@thepocman/gantt-task-react 1.0.10 → 1.0.11

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.
@@ -11691,14 +11691,18 @@ const Gantt = ({
11691
11691
  () => Math.round(taskHeight / 2),
11692
11692
  [taskHeight]
11693
11693
  );
11694
- console.log("rowIndexToTasksMap ------", rowIndexToTasksMap);
11695
11694
  const maxLevelLength = useMemo(() => {
11696
11695
  if (enableTaskGrouping) {
11697
- let totalRows = 0;
11698
- for (const [, rowMap] of rowIndexToTasksMap ?? /* @__PURE__ */ new Map()) {
11699
- totalRows += rowMap.size;
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
+ }
11700
11704
  }
11701
- return Math.max(totalRows, 1);
11705
+ return Math.max(totalHeightInRows, 1);
11702
11706
  }
11703
11707
  let maxLength = 0;
11704
11708
  const countByLevel = {};
@@ -11711,14 +11715,20 @@ const Gantt = ({
11711
11715
  maxLength = countByLevel[comparisonLevel];
11712
11716
  }
11713
11717
  });
11714
- console.log("📦 Tasks per level:", countByLevel);
11715
- console.log("📏 maxLevelLength:", maxLength);
11716
11718
  return maxLength;
11717
- }, [visibleTasks, comparisonLevels, enableTaskGrouping, rowIndexToTasksMap]);
11718
- const ganttFullHeight = useMemo(
11719
- () => maxLevelLength * fullRowHeight,
11720
- [maxLevelLength, fullRowHeight]
11721
- );
11719
+ }, [visibleTasks, comparisonLevels, enableTaskGrouping, rowIndexToTasksMap, fullRowHeight, taskHeight]);
11720
+ const ganttFullHeight = useMemo(() => {
11721
+ if (enableTaskGrouping) {
11722
+ let totalRows = 0;
11723
+ for (const [, taskMap] of rowIndexToTasksMap) {
11724
+ for (const [, tasks2] of taskMap) {
11725
+ totalRows += tasks2.length;
11726
+ }
11727
+ }
11728
+ return Math.max(totalRows, 1) * fullRowHeight;
11729
+ }
11730
+ return maxLevelLength * fullRowHeight;
11731
+ }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
11722
11732
  const {
11723
11733
  checkHasCopyTasks,
11724
11734
  checkHasCutTasks,
@@ -11991,8 +12001,6 @@ const Gantt = ({
11991
12001
  };
11992
12002
  const handleExpanderClick = useCallback(
11993
12003
  (clickedTask) => {
11994
- console.log(`Task ${clickedTask.id} hideChildren changed from ${clickedTask.hideChildren} to ${!clickedTask.hideChildren}`);
11995
- console.log("Task types:", tasks.map((task) => `${task.id}: ${task.type}`));
11996
12004
  if (onChangeExpandState) {
11997
12005
  onChangeExpandState({
11998
12006
  ...clickedTask,
@@ -11704,14 +11704,18 @@
11704
11704
  () => Math.round(taskHeight / 2),
11705
11705
  [taskHeight]
11706
11706
  );
11707
- console.log("rowIndexToTasksMap ------", rowIndexToTasksMap);
11708
11707
  const maxLevelLength = React.useMemo(() => {
11709
11708
  if (enableTaskGrouping) {
11710
- let totalRows = 0;
11711
- for (const [, rowMap] of rowIndexToTasksMap ?? /* @__PURE__ */ new Map()) {
11712
- totalRows += rowMap.size;
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
+ }
11713
11717
  }
11714
- return Math.max(totalRows, 1);
11718
+ return Math.max(totalHeightInRows, 1);
11715
11719
  }
11716
11720
  let maxLength = 0;
11717
11721
  const countByLevel = {};
@@ -11724,14 +11728,20 @@
11724
11728
  maxLength = countByLevel[comparisonLevel];
11725
11729
  }
11726
11730
  });
11727
- console.log("📦 Tasks per level:", countByLevel);
11728
- console.log("📏 maxLevelLength:", maxLength);
11729
11731
  return maxLength;
11730
- }, [visibleTasks, comparisonLevels, enableTaskGrouping, rowIndexToTasksMap]);
11731
- const ganttFullHeight = React.useMemo(
11732
- () => maxLevelLength * fullRowHeight,
11733
- [maxLevelLength, fullRowHeight]
11734
- );
11732
+ }, [visibleTasks, comparisonLevels, enableTaskGrouping, rowIndexToTasksMap, fullRowHeight, taskHeight]);
11733
+ const ganttFullHeight = React.useMemo(() => {
11734
+ if (enableTaskGrouping) {
11735
+ let totalRows = 0;
11736
+ for (const [, taskMap] of rowIndexToTasksMap) {
11737
+ for (const [, tasks2] of taskMap) {
11738
+ totalRows += tasks2.length;
11739
+ }
11740
+ }
11741
+ return Math.max(totalRows, 1) * fullRowHeight;
11742
+ }
11743
+ return maxLevelLength * fullRowHeight;
11744
+ }, [enableTaskGrouping, rowIndexToTasksMap, maxLevelLength, fullRowHeight]);
11735
11745
  const {
11736
11746
  checkHasCopyTasks,
11737
11747
  checkHasCutTasks,
@@ -12004,8 +12014,6 @@
12004
12014
  };
12005
12015
  const handleExpanderClick = React.useCallback(
12006
12016
  (clickedTask) => {
12007
- console.log(`Task ${clickedTask.id} hideChildren changed from ${clickedTask.hideChildren} to ${!clickedTask.hideChildren}`);
12008
- console.log("Task types:", tasks.map((task) => `${task.id}: ${task.type}`));
12009
12017
  if (onChangeExpandState) {
12010
12018
  onChangeExpandState({
12011
12019
  ...clickedTask,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepocman/gantt-task-react",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
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",