@thepocman/gantt-task-react 1.0.19 → 1.0.20

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.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { DateSetup, RenderTopHeader, RenderBottomHeader, Distances, ColorStyles } from "../../types/public-types";
2
+ import { ColorStyles, DateSetup, Distances, RenderBottomHeader, RenderTopHeader } from "../../types/public-types";
3
3
  export type CalendarProps = {
4
4
  additionalLeftSpace: number;
5
5
  dateSetup: DateSetup;
@@ -49,4 +49,5 @@ export type TaskGanttContentProps = {
49
49
  ContextualPalette?: React.FC<TaskContextualPaletteProps>;
50
50
  TaskDependencyContextualPalette?: React.FC<TaskDependencyContextualPaletteProps>;
51
51
  };
52
+ export declare const generateRenderId: (task: TaskOrEmpty, index: number) => string;
52
53
  export declare const TaskGanttContent: React.FC<TaskGanttContentProps>;
@@ -1,6 +1,6 @@
1
1
  import type { ComponentType, MouseEvent, RefObject, SyntheticEvent } from "react";
2
2
  import React from "react";
3
- import { ChildByLevelMap, ColorStyles, Column, DateSetup, DependencyMap, Distances, Icons, MapTaskToNestedIndex, OnResizeColumn, RowIndexToTasksMap, Task, TaskListHeaderProps, TaskListTableProps, TaskOrEmpty } from "../../types/public-types";
3
+ import { ChildByLevelMap, ColorStyles, Column, DateSetup, DependencyMap, Distances, Icons, MapTaskToNestedIndex, OnResizeColumn, RowIndexToTasksMap, Task, TaskListHeaderProps, TaskListTableProps, TaskOrEmpty, TaskToRowIndexMap } from "../../types/public-types";
4
4
  import { TaskListHeaderActionsProps } from "./TaskListHeaderActions";
5
5
  export type TaskListProps = {
6
6
  canMoveTasks: boolean;
@@ -29,6 +29,7 @@ export type TaskListProps = {
29
29
  icons?: Partial<Icons>;
30
30
  isShowTaskNumbers: boolean;
31
31
  rowIndexToTasksMap: RowIndexToTasksMap;
32
+ taskToRowIndexMap: TaskToRowIndexMap;
32
33
  mapTaskToNestedIndex: MapTaskToNestedIndex;
33
34
  onClick?: (task: TaskOrEmpty) => void;
34
35
  onExpanderClick: (task: Task) => void;
@@ -70,6 +71,7 @@ export declare const TaskList: React.NamedExoticComponent<{
70
71
  icons?: Partial<Icons>;
71
72
  isShowTaskNumbers: boolean;
72
73
  rowIndexToTasksMap: RowIndexToTasksMap;
74
+ taskToRowIndexMap: TaskToRowIndexMap;
73
75
  mapTaskToNestedIndex: MapTaskToNestedIndex;
74
76
  onClick?: (task: TaskOrEmpty) => void;
75
77
  onExpanderClick: (task: Task) => void;
@@ -465,7 +465,8 @@ const collectChildren = (arrayRes, mirrorRes, task, childTasksOnLevel, enableTas
465
465
  if (comparisonLevel === 1) {
466
466
  mirrorRes[task.id] = true;
467
467
  }
468
- if (task.type === "empty" || (enableTaskGrouping ? task.hideChildren && task.type !== "user" : task.hideChildren)) {
468
+ const isTaskGroupingEnabled = enableTaskGrouping ? task.hideChildren && task.type !== "user" : task.hideChildren;
469
+ if (task.type === "empty" || isTaskGroupingEnabled) {
469
470
  return;
470
471
  }
471
472
  const childs = childTasksOnLevel.get(task.id);
@@ -1254,7 +1255,7 @@ const getCriticalPath = (rootTasksMap, childTasksMap, tasksMap, dependencyMargin
1254
1255
  return res;
1255
1256
  };
1256
1257
  function isRealTask(task) {
1257
- return task.type === "task" || task.type === "milestone" || task.type === "project" || task.type === "user";
1258
+ return task.type === "task" || task.type === "milestone" || task.type === "project" || task.type === "vacation" || task.type === "user";
1258
1259
  }
1259
1260
  const getMapTaskToCoordinatesOnLevel = (task, mapTaskToCoordinates) => {
1260
1261
  const {
@@ -1944,14 +1945,20 @@ const useOptimizedList = (containerRef, property, cellSize) => {
1944
1945
  return indexes;
1945
1946
  };
1946
1947
  const TASK_SPACING = 2;
1947
- const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight) => {
1948
+ const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight, taskToRowIndexMap) => {
1948
1949
  const rowEntries = useMemo(() => {
1949
1950
  if (!rowIndexToTasksMap || rowIndexToTasksMap.size === 0)
1950
1951
  return [];
1952
+ if (!taskToRowIndexMap || taskToRowIndexMap.size === 0)
1953
+ return [];
1951
1954
  const rowToHeight = /* @__PURE__ */ new Map();
1952
1955
  for (const levelMap of rowIndexToTasksMap.values()) {
1953
1956
  for (const [rowIndex, tasks] of levelMap.entries()) {
1954
- const height = tasks.length * (taskHeight + TASK_SPACING);
1957
+ const visibleGroupedTasks = tasks.filter((task) => {
1958
+ var _a;
1959
+ return !((_a = taskToRowIndexMap.get(task.comparisonLevel ?? 1)) == null ? void 0 : _a.has(task.id));
1960
+ });
1961
+ const height = visibleGroupedTasks.length * (taskHeight + TASK_SPACING);
1955
1962
  rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
1956
1963
  }
1957
1964
  }
@@ -3408,6 +3415,7 @@ const TaskListInner = ({
3408
3415
  dependencyMap,
3409
3416
  distances,
3410
3417
  rowIndexToTasksMap,
3418
+ taskToRowIndexMap,
3411
3419
  fontFamily,
3412
3420
  fontSize,
3413
3421
  fullRowHeight,
@@ -3449,7 +3457,8 @@ const TaskListInner = ({
3449
3457
  const groupedIndexes = useGroupedVirtualization(
3450
3458
  taskListContentRef,
3451
3459
  rowIndexToTasksMap,
3452
- distances.taskHeight
3460
+ distances.taskHeight,
3461
+ taskToRowIndexMap
3453
3462
  );
3454
3463
  const optimizedIndexes = useOptimizedList(
3455
3464
  taskListContentRef,
@@ -4189,6 +4198,7 @@ const TaskListTableDefaultInner = ({
4189
4198
  );
4190
4199
  }
4191
4200
  } else {
4201
+ const seen = /* @__PURE__ */ new Set();
4192
4202
  for (let rowIndex = start; rowIndex <= end; rowIndex++) {
4193
4203
  const taskList = (_a = rowIndexToTasksMap.get(1)) == null ? void 0 : _a.get(rowIndex);
4194
4204
  if (!taskList)
@@ -4197,14 +4207,15 @@ const TaskListTableDefaultInner = ({
4197
4207
  const parent = tasks.find((t2) => t2.id === task.parent);
4198
4208
  if (parent == null ? void 0 : parent.hideChildren)
4199
4209
  continue;
4210
+ if (seen.has(task.id))
4211
+ continue;
4212
+ seen.add(task.id);
4200
4213
  const { id, comparisonLevel } = task;
4201
4214
  let depth = 0;
4202
4215
  let indexStr = "";
4203
- console.log("comparisonLevel", comparisonLevel);
4204
4216
  const levelMap = mapTaskToNestedIndex.get(comparisonLevel);
4205
4217
  const taskIndex = levelMap == null ? void 0 : levelMap.get(id);
4206
4218
  if (taskIndex) {
4207
- console.log("object :>> ", [depth, indexStr] = taskIndex);
4208
4219
  [depth, indexStr] = taskIndex;
4209
4220
  }
4210
4221
  renderList.push(
@@ -4280,50 +4291,6 @@ const TaskListTableDefaultInner = ({
4280
4291
  );
4281
4292
  };
4282
4293
  const TaskListTableDefault = memo(TaskListTableDefaultInner);
4283
- const calendarMain = "_calendarMain_lemhx_1";
4284
- const calendarBottomText = "_calendarBottomText_lemhx_13";
4285
- const calendarTopTick = "_calendarTopTick_lemhx_35";
4286
- const calendarTopText = "_calendarTopText_lemhx_43";
4287
- const calendarHeader = "_calendarHeader_lemhx_65";
4288
- const styles$a = {
4289
- calendarMain,
4290
- calendarBottomText,
4291
- calendarTopTick,
4292
- calendarTopText,
4293
- calendarHeader
4294
- };
4295
- const TopPartOfCalendar = ({
4296
- value,
4297
- x1Line,
4298
- y1Line,
4299
- y2Line,
4300
- xText,
4301
- yText,
4302
- colors
4303
- }) => {
4304
- return /* @__PURE__ */ jsxs("g", { className: "calendarTop", children: [
4305
- /* @__PURE__ */ jsx(
4306
- "line",
4307
- {
4308
- x1: x1Line,
4309
- y1: y1Line,
4310
- x2: x1Line,
4311
- y2: y2Line,
4312
- className: styles$a.calendarTopTick
4313
- }
4314
- ),
4315
- value !== null && /* @__PURE__ */ jsx(
4316
- "text",
4317
- {
4318
- y: yText,
4319
- x: xText,
4320
- className: styles$a.calendarTopText,
4321
- style: { fill: colors.barLabelColor },
4322
- children: value
4323
- }
4324
- )
4325
- ] });
4326
- };
4327
4294
  const defaultRenderBottomHeader = (date, viewMode, dateSetup, index2, isUnknownDates) => {
4328
4295
  if (isUnknownDates) {
4329
4296
  const {
@@ -4453,6 +4420,50 @@ const defaultRenderTopHeader = (date, viewMode, dateSetup) => {
4453
4420
  throw new Error("Unknown viewMode");
4454
4421
  }
4455
4422
  };
4423
+ const calendarMain = "_calendarMain_lemhx_1";
4424
+ const calendarBottomText = "_calendarBottomText_lemhx_13";
4425
+ const calendarTopTick = "_calendarTopTick_lemhx_35";
4426
+ const calendarTopText = "_calendarTopText_lemhx_43";
4427
+ const calendarHeader = "_calendarHeader_lemhx_65";
4428
+ const styles$a = {
4429
+ calendarMain,
4430
+ calendarBottomText,
4431
+ calendarTopTick,
4432
+ calendarTopText,
4433
+ calendarHeader
4434
+ };
4435
+ const TopPartOfCalendar = ({
4436
+ value,
4437
+ x1Line,
4438
+ y1Line,
4439
+ y2Line,
4440
+ xText,
4441
+ yText,
4442
+ colors
4443
+ }) => {
4444
+ return /* @__PURE__ */ jsxs("g", { className: "calendarTop", children: [
4445
+ /* @__PURE__ */ jsx(
4446
+ "line",
4447
+ {
4448
+ x1: x1Line,
4449
+ y1: y1Line,
4450
+ x2: x1Line,
4451
+ y2: y2Line,
4452
+ className: styles$a.calendarTopTick
4453
+ }
4454
+ ),
4455
+ value !== null && /* @__PURE__ */ jsx(
4456
+ "text",
4457
+ {
4458
+ y: yText,
4459
+ x: xText,
4460
+ className: styles$a.calendarTopText,
4461
+ style: { fill: colors.barLabelColor },
4462
+ children: value
4463
+ }
4464
+ )
4465
+ ] });
4466
+ };
4456
4467
  const Calendar = ({
4457
4468
  additionalLeftSpace,
4458
4469
  dateSetup,
@@ -5083,9 +5094,9 @@ const Grid = (props) => {
5083
5094
  /* @__PURE__ */ jsx(GridBody, { ...props })
5084
5095
  ] });
5085
5096
  };
5086
- const ganttTaskRoot = "_ganttTaskRoot_jnu0p_1";
5087
- const ganttTaskContent = "_ganttTaskContent_jnu0p_83";
5088
- const wrapper$2 = "_wrapper_jnu0p_111";
5097
+ const ganttTaskRoot = "_ganttTaskRoot_1lwsd_1";
5098
+ const ganttTaskContent = "_ganttTaskContent_1lwsd_83";
5099
+ const wrapper$2 = "_wrapper_1lwsd_111";
5089
5100
  const styles$9 = {
5090
5101
  ganttTaskRoot,
5091
5102
  ganttTaskContent,
@@ -6489,6 +6500,13 @@ const TaskItemInner = (props) => {
6489
6500
  );
6490
6501
  };
6491
6502
  const TaskItem = memo(TaskItemInner);
6503
+ const generateRenderId = (task, index2) => {
6504
+ if ("renderId" in task && typeof task.renderId === "string")
6505
+ return task.renderId;
6506
+ if ("type" in task && task.type === "user")
6507
+ return `${task.id}-user`;
6508
+ return `${task.id}-row-${index2}`;
6509
+ };
6492
6510
  const TaskGanttContent = ({
6493
6511
  authorizedRelations,
6494
6512
  additionalLeftSpace,
@@ -6534,7 +6552,7 @@ const TaskGanttContent = ({
6534
6552
  taskToRowIndexMap
6535
6553
  }) => {
6536
6554
  const [renderedTasks, renderedArrows, renderedSelectedTasks] = useMemo(() => {
6537
- var _a;
6555
+ var _a, _b;
6538
6556
  if (!renderedRowIndexes)
6539
6557
  return [null, null, null];
6540
6558
  const [start, end] = renderedRowIndexes;
@@ -6549,7 +6567,7 @@ const TaskGanttContent = ({
6549
6567
  for (let level = 1; level <= comparisonLevels; level++) {
6550
6568
  const levelMap = rowIndexToTasksMap.get(level);
6551
6569
  const rowTasks = levelMap == null ? void 0 : levelMap.get(index2);
6552
- if (Array.isArray(rowTasks)) {
6570
+ if (rowTasks) {
6553
6571
  tasksAtRow.push(...rowTasks);
6554
6572
  }
6555
6573
  }
@@ -6558,34 +6576,34 @@ const TaskGanttContent = ({
6558
6576
  if (task)
6559
6577
  tasksAtRow.push(task);
6560
6578
  }
6561
- console.log("tasksAtRow", tasksAtRow);
6562
6579
  for (const task of tasksAtRow) {
6563
6580
  const comparisonLevel = task.comparisonLevel ?? 1;
6564
- const { id: taskId } = task;
6565
- if (selectedIdsMirror[taskId] && !addedSelectedTasks[taskId]) {
6566
- addedSelectedTasks[taskId] = true;
6567
- const rowIndex = (_a = taskToRowIndexMap.get(comparisonLevel)) == null ? void 0 : _a.get(taskId);
6568
- if (typeof rowIndex === "number") {
6569
- selectedTasksRes.push(
6570
- /* @__PURE__ */ jsx(
6571
- "rect",
6572
- {
6573
- x: 0,
6574
- y: rowIndex * fullRowHeight,
6575
- width: "100%",
6576
- height: fullRowHeight,
6577
- fill: colorStyles.selectedTaskBackgroundColor
6578
- },
6579
- `selected-${taskId}`
6580
- )
6581
- );
6582
- }
6581
+ const renderId = generateRenderId(task, index2);
6582
+ const taskId = task.id;
6583
+ const rowIndex = (_a = taskToRowIndexMap.get(comparisonLevel)) == null ? void 0 : _a.get(taskId);
6584
+ if (typeof rowIndex !== "number")
6585
+ continue;
6586
+ const key = `${taskId}-${rowIndex}`;
6587
+ if (selectedIdsMirror[taskId] && !addedSelectedTasks[`${taskId}-${rowIndex}`]) {
6588
+ addedSelectedTasks[key] = true;
6589
+ selectedTasksRes.push(
6590
+ /* @__PURE__ */ jsx(
6591
+ "rect",
6592
+ {
6593
+ x: 0,
6594
+ y: rowIndex * fullRowHeight,
6595
+ width: "100%",
6596
+ height: fullRowHeight,
6597
+ fill: colorStyles.selectedTaskBackgroundColor
6598
+ },
6599
+ `selected-${key}`
6600
+ )
6601
+ );
6583
6602
  }
6584
6603
  if (comparisonLevel > comparisonLevels)
6585
6604
  continue;
6586
6605
  if (task.type === "empty" || task.type === "user")
6587
6606
  continue;
6588
- const key = `${comparisonLevel}_${task.id}`;
6589
6607
  const criticalPathOnLevel = criticalPaths == null ? void 0 : criticalPaths.get(comparisonLevel);
6590
6608
  const isCritical = !!(criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.tasks.has(task.id));
6591
6609
  const {
@@ -6599,64 +6617,78 @@ const TaskGanttContent = ({
6599
6617
  x1: taskX1,
6600
6618
  x2: taskX2
6601
6619
  } = getTaskCoordinates2(task);
6602
- tasksRes.push(
6603
- /* @__PURE__ */ jsx(
6604
- "svg",
6605
- {
6606
- id: task.id,
6607
- className: "TaskItemClassName",
6608
- x: containerX + additionalLeftSpace,
6609
- y: levelY,
6610
- width: containerWidth,
6611
- height: fullRowHeight,
6612
- children: /* @__PURE__ */ jsx(
6613
- TaskItem,
6614
- {
6615
- getTaskGlobalIndexByRef,
6616
- hasChildren: checkHasChildren(task, childTasksMap),
6617
- hasDependencyWarning: taskToHasDependencyWarningMap ? checkTaskHasDependencyWarning(task, taskToHasDependencyWarningMap) : false,
6618
- progressWidth,
6619
- progressX: rtl ? innerX2 : innerX1,
6620
- selectTaskOnMouseDown,
6621
- task,
6622
- taskYOffset,
6623
- width,
6624
- x1: innerX1,
6625
- x2: innerX2,
6626
- childOutOfParentWarnings,
6627
- distances,
6628
- taskHeight,
6629
- taskHalfHeight,
6630
- isProgressChangeable: !task.isDisabled,
6631
- isDateChangeable: !task.isDisabled,
6632
- isRelationChangeable: !task.isRelationDisabled,
6633
- authorizedRelations,
6634
- ganttRelationEvent,
6635
- isDelete: !task.isDisabled,
6636
- onDoubleClick,
6637
- onClick,
6638
- onEventStart: handleTaskDragStart,
6639
- setTooltipTask,
6640
- onRelationStart: handleBarRelationStart,
6641
- isSelected: Boolean(selectedIdsMirror[taskId]),
6642
- isCritical,
6643
- rtl,
6644
- fixStartPosition,
6645
- fixEndPosition,
6646
- handleDeleteTasks,
6647
- colorStyles
6648
- }
6649
- )
6650
- },
6651
- key
6652
- )
6653
- );
6620
+ const renderContexts = [];
6621
+ const oneRowDefaultRender = { y: levelY, keySuffix: "default" };
6622
+ renderContexts.push(oneRowDefaultRender);
6623
+ if (enableTaskGrouping && task.parent) {
6624
+ const parentRowIndex = (_b = taskToRowIndexMap.get(comparisonLevel)) == null ? void 0 : _b.get(task.parent);
6625
+ if (typeof parentRowIndex === "number") {
6626
+ const yInUserRow = parentRowIndex * fullRowHeight;
6627
+ renderContexts.push({ y: yInUserRow, keySuffix: "grouped" });
6628
+ }
6629
+ }
6630
+ for (const context of renderContexts) {
6631
+ tasksRes.push(
6632
+ /* @__PURE__ */ jsx(
6633
+ "svg",
6634
+ {
6635
+ id: `${renderId}-${context.keySuffix}`,
6636
+ className: "TaskItemClassName",
6637
+ x: containerX + additionalLeftSpace,
6638
+ y: context.y,
6639
+ width: containerWidth,
6640
+ height: fullRowHeight,
6641
+ children: /* @__PURE__ */ jsx(
6642
+ TaskItem,
6643
+ {
6644
+ getTaskGlobalIndexByRef,
6645
+ hasChildren: checkHasChildren(task, childTasksMap),
6646
+ hasDependencyWarning: taskToHasDependencyWarningMap ? checkTaskHasDependencyWarning(task, taskToHasDependencyWarningMap) : false,
6647
+ progressWidth,
6648
+ progressX: rtl ? innerX2 : innerX1,
6649
+ selectTaskOnMouseDown,
6650
+ task,
6651
+ taskYOffset,
6652
+ width,
6653
+ x1: innerX1,
6654
+ x2: innerX2,
6655
+ childOutOfParentWarnings,
6656
+ distances,
6657
+ taskHeight,
6658
+ taskHalfHeight,
6659
+ isProgressChangeable: !task.isDisabled,
6660
+ isDateChangeable: !task.isDisabled,
6661
+ isRelationChangeable: !task.isRelationDisabled,
6662
+ authorizedRelations,
6663
+ ganttRelationEvent,
6664
+ isDelete: !task.isDisabled,
6665
+ onDoubleClick,
6666
+ onClick,
6667
+ onEventStart: handleTaskDragStart,
6668
+ setTooltipTask,
6669
+ onRelationStart: handleBarRelationStart,
6670
+ isSelected: Boolean(selectedIdsMirror[taskId]),
6671
+ isCritical,
6672
+ rtl,
6673
+ fixStartPosition,
6674
+ fixEndPosition,
6675
+ handleDeleteTasks,
6676
+ colorStyles
6677
+ }
6678
+ )
6679
+ },
6680
+ `${comparisonLevel}_${task.id}_${index2}_${context.keySuffix}`
6681
+ )
6682
+ );
6683
+ }
6654
6684
  const addedDependenciesAtLevel = addedDependencies[comparisonLevel] ?? (addedDependencies[comparisonLevel] = {});
6655
6685
  const addedDependenciesAtTask = addedDependenciesAtLevel[taskId] ?? (addedDependenciesAtLevel[taskId] = {});
6656
6686
  const dependenciesAtLevel = dependencyMap.get(comparisonLevel);
6657
6687
  const dependenciesByTask = dependenciesAtLevel == null ? void 0 : dependenciesAtLevel.get(taskId);
6658
- dependenciesByTask == null ? void 0 : dependenciesByTask.filter(({ source }) => visibleTasksMirror[source.id]).forEach((dep) => {
6688
+ dependenciesByTask == null ? void 0 : dependenciesByTask.forEach((dep) => {
6659
6689
  var _a2;
6690
+ if (!visibleTasksMirror[dep.source.id])
6691
+ return;
6660
6692
  if (addedDependenciesAtTask[dep.source.id])
6661
6693
  return;
6662
6694
  addedDependenciesAtTask[dep.source.id] = true;
@@ -6700,20 +6732,21 @@ const TaskGanttContent = ({
6700
6732
  }
6701
6733
  )
6702
6734
  },
6703
- `Arrow from ${dep.source.id} to ${taskId} on ${comparisonLevel}`
6735
+ `Arrow from ${dep.source.id} to ${taskId} on ${comparisonLevel} at ${index2}`
6704
6736
  )
6705
6737
  );
6706
6738
  });
6707
6739
  const dependentsAtLevel = dependentMap.get(comparisonLevel);
6708
6740
  const dependentsByTask = dependentsAtLevel == null ? void 0 : dependentsAtLevel.get(taskId);
6709
- dependentsByTask == null ? void 0 : dependentsByTask.filter(({ dependent }) => visibleTasksMirror[dependent.id]).forEach((dep) => {
6710
- var _a2, _b;
6711
- console.log("dependent", dep);
6741
+ dependentsByTask == null ? void 0 : dependentsByTask.forEach((dep) => {
6742
+ var _a2, _b2;
6743
+ if (!visibleTasksMirror[dep.dependent.id])
6744
+ return;
6712
6745
  const addedDepsForDep = addedDependenciesAtLevel[_a2 = dep.dependent.id] ?? (addedDependenciesAtLevel[_a2] = {});
6713
6746
  if (addedDepsForDep[taskId])
6714
6747
  return;
6715
6748
  addedDepsForDep[taskId] = true;
6716
- const isDepCritical = !!((_b = criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.dependencies.get(dep.dependent.id)) == null ? void 0 : _b.has(task.id));
6749
+ const isDepCritical = !!((_b2 = criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.dependencies.get(dep.dependent.id)) == null ? void 0 : _b2.has(task.id));
6717
6750
  const { x1: toX1, x2: toX2 } = getTaskCoordinates2(dep.dependent);
6718
6751
  const containerX2 = Math.min(toX1, taskX1) - 300;
6719
6752
  const containerWidth2 = Math.max(toX2, taskX2) - containerX2 + 300;
@@ -6753,7 +6786,7 @@ const TaskGanttContent = ({
6753
6786
  }
6754
6787
  )
6755
6788
  },
6756
- `Arrow from ${taskId} to ${dep.dependent.id} on ${comparisonLevel}`
6789
+ `Arrow from ${taskId} to ${dep.dependent.id} on ${comparisonLevel} at ${index2}`
6757
6790
  )
6758
6791
  );
6759
6792
  });
@@ -11450,49 +11483,36 @@ const getMapTaskToRowIndexWithGrouping = (tasks, comparisonLevels, isGrouped = f
11450
11483
  const rowIndexToTasksMap = /* @__PURE__ */ new Map();
11451
11484
  const mapGlobalRowIndexToTask = /* @__PURE__ */ new Map();
11452
11485
  const parentMap = new Map(tasks.map((t2) => [t2.id, t2]));
11453
- let globalRowIndex = 0;
11454
- for (let comparisonLevel = 1; comparisonLevel <= comparisonLevels; comparisonLevel++) {
11455
- const taskToRow = /* @__PURE__ */ new Map();
11456
- const rowToTask = /* @__PURE__ */ new Map();
11457
- const rowToTasks = /* @__PURE__ */ new Map();
11458
- taskToRowIndexMap.set(comparisonLevel, taskToRow);
11459
- rowIndexToTaskMap.set(comparisonLevel, rowToTask);
11460
- rowIndexToTasksMap.set(comparisonLevel, rowToTasks);
11461
- let rowIndex = 0;
11462
- for (const task of tasks) {
11463
- if ((task.comparisonLevel ?? 1) !== comparisonLevel)
11464
- continue;
11465
- const { id, parent, type } = task;
11466
- let assignedRowIndex = rowIndex;
11467
- if (type === "user" || type === "project") {
11468
- taskToRow.set(id, rowIndex);
11469
- rowToTask.set(rowIndex, task);
11470
- rowToTasks.set(rowIndex, [task]);
11471
- mapGlobalRowIndexToTask.set(globalRowIndex, task);
11472
- rowIndex++;
11473
- globalRowIndex++;
11486
+ const rowCounterPerLevel = {};
11487
+ for (let level = 1; level <= comparisonLevels; level++) {
11488
+ taskToRowIndexMap.set(level, /* @__PURE__ */ new Map());
11489
+ rowIndexToTaskMap.set(level, /* @__PURE__ */ new Map());
11490
+ rowIndexToTasksMap.set(level, /* @__PURE__ */ new Map());
11491
+ rowCounterPerLevel[level] = 0;
11492
+ }
11493
+ for (const task of tasks) {
11494
+ const comparisonLevel = task.comparisonLevel ?? 1;
11495
+ const rowIndex = rowCounterPerLevel[comparisonLevel];
11496
+ const taskToRow = taskToRowIndexMap.get(comparisonLevel);
11497
+ const rowToTask = rowIndexToTaskMap.get(comparisonLevel);
11498
+ const rowToTasks = rowIndexToTasksMap.get(comparisonLevel);
11499
+ const { id, parent } = task;
11500
+ const parentTask = parent ? parentMap.get(parent) : null;
11501
+ if (isGrouped && comparisonLevel === 1 && parent && parentTask && parentTask.hideChildren) {
11502
+ const parentRow = taskToRow.get(parent);
11503
+ if (parentRow !== void 0) {
11504
+ const existing = rowToTasks.get(parentRow) ?? [];
11505
+ rowToTasks.set(parentRow, [...existing, task]);
11506
+ taskToRow.set(id, parentRow);
11474
11507
  continue;
11475
11508
  }
11476
- if (isGrouped && parent) {
11477
- const parentTask = parentMap.get(parent);
11478
- const parentRowIndex = taskToRow.get(parent);
11479
- if ((parentTask == null ? void 0 : parentTask.hideChildren) && parentRowIndex !== void 0) {
11480
- assignedRowIndex = parentRowIndex;
11481
- } else {
11482
- assignedRowIndex = rowIndex;
11483
- rowIndex++;
11484
- }
11485
- } else {
11486
- assignedRowIndex = rowIndex;
11487
- rowIndex++;
11488
- }
11489
- taskToRow.set(id, assignedRowIndex);
11490
- rowToTask.set(assignedRowIndex, task);
11491
- const existing = rowToTasks.get(assignedRowIndex) ?? [];
11492
- rowToTasks.set(assignedRowIndex, [...existing, task]);
11493
- mapGlobalRowIndexToTask.set(globalRowIndex, task);
11494
- globalRowIndex++;
11495
11509
  }
11510
+ taskToRow.set(id, rowIndex);
11511
+ rowToTask.set(rowIndex, task);
11512
+ rowToTasks.set(rowIndex, [task]);
11513
+ const globalIndex = rowIndex * comparisonLevels + (comparisonLevel - 1);
11514
+ mapGlobalRowIndexToTask.set(globalIndex, task);
11515
+ rowCounterPerLevel[comparisonLevel]++;
11496
11516
  }
11497
11517
  return [
11498
11518
  taskToRowIndexMap,
@@ -11793,7 +11813,8 @@ const Gantt = ({
11793
11813
  const groupedIndexes = useGroupedVirtualization(
11794
11814
  ganttTaskContentRef,
11795
11815
  rowIndexToTasksMap,
11796
- fullRowHeight
11816
+ fullRowHeight,
11817
+ taskToRowIndexMap
11797
11818
  );
11798
11819
  const optimizedIndexes = useOptimizedList(
11799
11820
  ganttTaskContentRef,
@@ -13055,6 +13076,7 @@ const Gantt = ({
13055
13076
  TaskListTable,
13056
13077
  enableTaskGrouping,
13057
13078
  rowIndexToTasksMap,
13079
+ taskToRowIndexMap,
13058
13080
  canMoveTasks,
13059
13081
  canResizeColumns,
13060
13082
  childTasksMap,
@@ -478,7 +478,8 @@
478
478
  if (comparisonLevel === 1) {
479
479
  mirrorRes[task.id] = true;
480
480
  }
481
- if (task.type === "empty" || (enableTaskGrouping ? task.hideChildren && task.type !== "user" : task.hideChildren)) {
481
+ const isTaskGroupingEnabled = enableTaskGrouping ? task.hideChildren && task.type !== "user" : task.hideChildren;
482
+ if (task.type === "empty" || isTaskGroupingEnabled) {
482
483
  return;
483
484
  }
484
485
  const childs = childTasksOnLevel.get(task.id);
@@ -1267,7 +1268,7 @@
1267
1268
  return res;
1268
1269
  };
1269
1270
  function isRealTask(task) {
1270
- return task.type === "task" || task.type === "milestone" || task.type === "project" || task.type === "user";
1271
+ return task.type === "task" || task.type === "milestone" || task.type === "project" || task.type === "vacation" || task.type === "user";
1271
1272
  }
1272
1273
  const getMapTaskToCoordinatesOnLevel = (task, mapTaskToCoordinates) => {
1273
1274
  const {
@@ -1957,14 +1958,20 @@
1957
1958
  return indexes;
1958
1959
  };
1959
1960
  const TASK_SPACING = 2;
1960
- const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight) => {
1961
+ const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight, taskToRowIndexMap) => {
1961
1962
  const rowEntries = React.useMemo(() => {
1962
1963
  if (!rowIndexToTasksMap || rowIndexToTasksMap.size === 0)
1963
1964
  return [];
1965
+ if (!taskToRowIndexMap || taskToRowIndexMap.size === 0)
1966
+ return [];
1964
1967
  const rowToHeight = /* @__PURE__ */ new Map();
1965
1968
  for (const levelMap of rowIndexToTasksMap.values()) {
1966
1969
  for (const [rowIndex, tasks] of levelMap.entries()) {
1967
- const height = tasks.length * (taskHeight + TASK_SPACING);
1970
+ const visibleGroupedTasks = tasks.filter((task) => {
1971
+ var _a;
1972
+ return !((_a = taskToRowIndexMap.get(task.comparisonLevel ?? 1)) == null ? void 0 : _a.has(task.id));
1973
+ });
1974
+ const height = visibleGroupedTasks.length * (taskHeight + TASK_SPACING);
1968
1975
  rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
1969
1976
  }
1970
1977
  }
@@ -3421,6 +3428,7 @@
3421
3428
  dependencyMap,
3422
3429
  distances,
3423
3430
  rowIndexToTasksMap,
3431
+ taskToRowIndexMap,
3424
3432
  fontFamily,
3425
3433
  fontSize,
3426
3434
  fullRowHeight,
@@ -3462,7 +3470,8 @@
3462
3470
  const groupedIndexes = useGroupedVirtualization(
3463
3471
  taskListContentRef,
3464
3472
  rowIndexToTasksMap,
3465
- distances.taskHeight
3473
+ distances.taskHeight,
3474
+ taskToRowIndexMap
3466
3475
  );
3467
3476
  const optimizedIndexes = useOptimizedList(
3468
3477
  taskListContentRef,
@@ -4202,6 +4211,7 @@
4202
4211
  );
4203
4212
  }
4204
4213
  } else {
4214
+ const seen = /* @__PURE__ */ new Set();
4205
4215
  for (let rowIndex = start; rowIndex <= end; rowIndex++) {
4206
4216
  const taskList = (_a = rowIndexToTasksMap.get(1)) == null ? void 0 : _a.get(rowIndex);
4207
4217
  if (!taskList)
@@ -4210,14 +4220,15 @@
4210
4220
  const parent = tasks.find((t) => t.id === task.parent);
4211
4221
  if (parent == null ? void 0 : parent.hideChildren)
4212
4222
  continue;
4223
+ if (seen.has(task.id))
4224
+ continue;
4225
+ seen.add(task.id);
4213
4226
  const { id, comparisonLevel } = task;
4214
4227
  let depth = 0;
4215
4228
  let indexStr = "";
4216
- console.log("comparisonLevel", comparisonLevel);
4217
4229
  const levelMap = mapTaskToNestedIndex.get(comparisonLevel);
4218
4230
  const taskIndex = levelMap == null ? void 0 : levelMap.get(id);
4219
4231
  if (taskIndex) {
4220
- console.log("object :>> ", [depth, indexStr] = taskIndex);
4221
4232
  [depth, indexStr] = taskIndex;
4222
4233
  }
4223
4234
  renderList.push(
@@ -4293,50 +4304,6 @@
4293
4304
  );
4294
4305
  };
4295
4306
  const TaskListTableDefault = React.memo(TaskListTableDefaultInner);
4296
- const calendarMain = "_calendarMain_lemhx_1";
4297
- const calendarBottomText = "_calendarBottomText_lemhx_13";
4298
- const calendarTopTick = "_calendarTopTick_lemhx_35";
4299
- const calendarTopText = "_calendarTopText_lemhx_43";
4300
- const calendarHeader = "_calendarHeader_lemhx_65";
4301
- const styles$a = {
4302
- calendarMain,
4303
- calendarBottomText,
4304
- calendarTopTick,
4305
- calendarTopText,
4306
- calendarHeader
4307
- };
4308
- const TopPartOfCalendar = ({
4309
- value,
4310
- x1Line,
4311
- y1Line,
4312
- y2Line,
4313
- xText,
4314
- yText,
4315
- colors
4316
- }) => {
4317
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "calendarTop", children: [
4318
- /* @__PURE__ */ jsxRuntime.jsx(
4319
- "line",
4320
- {
4321
- x1: x1Line,
4322
- y1: y1Line,
4323
- x2: x1Line,
4324
- y2: y2Line,
4325
- className: styles$a.calendarTopTick
4326
- }
4327
- ),
4328
- value !== null && /* @__PURE__ */ jsxRuntime.jsx(
4329
- "text",
4330
- {
4331
- y: yText,
4332
- x: xText,
4333
- className: styles$a.calendarTopText,
4334
- style: { fill: colors.barLabelColor },
4335
- children: value
4336
- }
4337
- )
4338
- ] });
4339
- };
4340
4307
  const defaultRenderBottomHeader = (date, viewMode, dateSetup, index2, isUnknownDates) => {
4341
4308
  if (isUnknownDates) {
4342
4309
  const {
@@ -4466,6 +4433,50 @@
4466
4433
  throw new Error("Unknown viewMode");
4467
4434
  }
4468
4435
  };
4436
+ const calendarMain = "_calendarMain_lemhx_1";
4437
+ const calendarBottomText = "_calendarBottomText_lemhx_13";
4438
+ const calendarTopTick = "_calendarTopTick_lemhx_35";
4439
+ const calendarTopText = "_calendarTopText_lemhx_43";
4440
+ const calendarHeader = "_calendarHeader_lemhx_65";
4441
+ const styles$a = {
4442
+ calendarMain,
4443
+ calendarBottomText,
4444
+ calendarTopTick,
4445
+ calendarTopText,
4446
+ calendarHeader
4447
+ };
4448
+ const TopPartOfCalendar = ({
4449
+ value,
4450
+ x1Line,
4451
+ y1Line,
4452
+ y2Line,
4453
+ xText,
4454
+ yText,
4455
+ colors
4456
+ }) => {
4457
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "calendarTop", children: [
4458
+ /* @__PURE__ */ jsxRuntime.jsx(
4459
+ "line",
4460
+ {
4461
+ x1: x1Line,
4462
+ y1: y1Line,
4463
+ x2: x1Line,
4464
+ y2: y2Line,
4465
+ className: styles$a.calendarTopTick
4466
+ }
4467
+ ),
4468
+ value !== null && /* @__PURE__ */ jsxRuntime.jsx(
4469
+ "text",
4470
+ {
4471
+ y: yText,
4472
+ x: xText,
4473
+ className: styles$a.calendarTopText,
4474
+ style: { fill: colors.barLabelColor },
4475
+ children: value
4476
+ }
4477
+ )
4478
+ ] });
4479
+ };
4469
4480
  const Calendar = ({
4470
4481
  additionalLeftSpace,
4471
4482
  dateSetup,
@@ -5096,9 +5107,9 @@
5096
5107
  /* @__PURE__ */ jsxRuntime.jsx(GridBody, { ...props })
5097
5108
  ] });
5098
5109
  };
5099
- const ganttTaskRoot = "_ganttTaskRoot_jnu0p_1";
5100
- const ganttTaskContent = "_ganttTaskContent_jnu0p_83";
5101
- const wrapper$2 = "_wrapper_jnu0p_111";
5110
+ const ganttTaskRoot = "_ganttTaskRoot_1lwsd_1";
5111
+ const ganttTaskContent = "_ganttTaskContent_1lwsd_83";
5112
+ const wrapper$2 = "_wrapper_1lwsd_111";
5102
5113
  const styles$9 = {
5103
5114
  ganttTaskRoot,
5104
5115
  ganttTaskContent,
@@ -6502,6 +6513,13 @@
6502
6513
  );
6503
6514
  };
6504
6515
  const TaskItem = React.memo(TaskItemInner);
6516
+ const generateRenderId = (task, index2) => {
6517
+ if ("renderId" in task && typeof task.renderId === "string")
6518
+ return task.renderId;
6519
+ if ("type" in task && task.type === "user")
6520
+ return `${task.id}-user`;
6521
+ return `${task.id}-row-${index2}`;
6522
+ };
6505
6523
  const TaskGanttContent = ({
6506
6524
  authorizedRelations,
6507
6525
  additionalLeftSpace,
@@ -6547,7 +6565,7 @@
6547
6565
  taskToRowIndexMap
6548
6566
  }) => {
6549
6567
  const [renderedTasks, renderedArrows, renderedSelectedTasks] = React.useMemo(() => {
6550
- var _a;
6568
+ var _a, _b;
6551
6569
  if (!renderedRowIndexes)
6552
6570
  return [null, null, null];
6553
6571
  const [start, end] = renderedRowIndexes;
@@ -6562,7 +6580,7 @@
6562
6580
  for (let level = 1; level <= comparisonLevels; level++) {
6563
6581
  const levelMap = rowIndexToTasksMap.get(level);
6564
6582
  const rowTasks = levelMap == null ? void 0 : levelMap.get(index2);
6565
- if (Array.isArray(rowTasks)) {
6583
+ if (rowTasks) {
6566
6584
  tasksAtRow.push(...rowTasks);
6567
6585
  }
6568
6586
  }
@@ -6571,34 +6589,34 @@
6571
6589
  if (task)
6572
6590
  tasksAtRow.push(task);
6573
6591
  }
6574
- console.log("tasksAtRow", tasksAtRow);
6575
6592
  for (const task of tasksAtRow) {
6576
6593
  const comparisonLevel = task.comparisonLevel ?? 1;
6577
- const { id: taskId } = task;
6578
- if (selectedIdsMirror[taskId] && !addedSelectedTasks[taskId]) {
6579
- addedSelectedTasks[taskId] = true;
6580
- const rowIndex = (_a = taskToRowIndexMap.get(comparisonLevel)) == null ? void 0 : _a.get(taskId);
6581
- if (typeof rowIndex === "number") {
6582
- selectedTasksRes.push(
6583
- /* @__PURE__ */ jsxRuntime.jsx(
6584
- "rect",
6585
- {
6586
- x: 0,
6587
- y: rowIndex * fullRowHeight,
6588
- width: "100%",
6589
- height: fullRowHeight,
6590
- fill: colorStyles.selectedTaskBackgroundColor
6591
- },
6592
- `selected-${taskId}`
6593
- )
6594
- );
6595
- }
6594
+ const renderId = generateRenderId(task, index2);
6595
+ const taskId = task.id;
6596
+ const rowIndex = (_a = taskToRowIndexMap.get(comparisonLevel)) == null ? void 0 : _a.get(taskId);
6597
+ if (typeof rowIndex !== "number")
6598
+ continue;
6599
+ const key = `${taskId}-${rowIndex}`;
6600
+ if (selectedIdsMirror[taskId] && !addedSelectedTasks[`${taskId}-${rowIndex}`]) {
6601
+ addedSelectedTasks[key] = true;
6602
+ selectedTasksRes.push(
6603
+ /* @__PURE__ */ jsxRuntime.jsx(
6604
+ "rect",
6605
+ {
6606
+ x: 0,
6607
+ y: rowIndex * fullRowHeight,
6608
+ width: "100%",
6609
+ height: fullRowHeight,
6610
+ fill: colorStyles.selectedTaskBackgroundColor
6611
+ },
6612
+ `selected-${key}`
6613
+ )
6614
+ );
6596
6615
  }
6597
6616
  if (comparisonLevel > comparisonLevels)
6598
6617
  continue;
6599
6618
  if (task.type === "empty" || task.type === "user")
6600
6619
  continue;
6601
- const key = `${comparisonLevel}_${task.id}`;
6602
6620
  const criticalPathOnLevel = criticalPaths == null ? void 0 : criticalPaths.get(comparisonLevel);
6603
6621
  const isCritical = !!(criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.tasks.has(task.id));
6604
6622
  const {
@@ -6612,64 +6630,78 @@
6612
6630
  x1: taskX1,
6613
6631
  x2: taskX2
6614
6632
  } = getTaskCoordinates2(task);
6615
- tasksRes.push(
6616
- /* @__PURE__ */ jsxRuntime.jsx(
6617
- "svg",
6618
- {
6619
- id: task.id,
6620
- className: "TaskItemClassName",
6621
- x: containerX + additionalLeftSpace,
6622
- y: levelY,
6623
- width: containerWidth,
6624
- height: fullRowHeight,
6625
- children: /* @__PURE__ */ jsxRuntime.jsx(
6626
- TaskItem,
6627
- {
6628
- getTaskGlobalIndexByRef,
6629
- hasChildren: checkHasChildren(task, childTasksMap),
6630
- hasDependencyWarning: taskToHasDependencyWarningMap ? checkTaskHasDependencyWarning(task, taskToHasDependencyWarningMap) : false,
6631
- progressWidth,
6632
- progressX: rtl ? innerX2 : innerX1,
6633
- selectTaskOnMouseDown,
6634
- task,
6635
- taskYOffset,
6636
- width,
6637
- x1: innerX1,
6638
- x2: innerX2,
6639
- childOutOfParentWarnings,
6640
- distances,
6641
- taskHeight,
6642
- taskHalfHeight,
6643
- isProgressChangeable: !task.isDisabled,
6644
- isDateChangeable: !task.isDisabled,
6645
- isRelationChangeable: !task.isRelationDisabled,
6646
- authorizedRelations,
6647
- ganttRelationEvent,
6648
- isDelete: !task.isDisabled,
6649
- onDoubleClick,
6650
- onClick,
6651
- onEventStart: handleTaskDragStart,
6652
- setTooltipTask,
6653
- onRelationStart: handleBarRelationStart,
6654
- isSelected: Boolean(selectedIdsMirror[taskId]),
6655
- isCritical,
6656
- rtl,
6657
- fixStartPosition,
6658
- fixEndPosition,
6659
- handleDeleteTasks,
6660
- colorStyles
6661
- }
6662
- )
6663
- },
6664
- key
6665
- )
6666
- );
6633
+ const renderContexts = [];
6634
+ const oneRowDefaultRender = { y: levelY, keySuffix: "default" };
6635
+ renderContexts.push(oneRowDefaultRender);
6636
+ if (enableTaskGrouping && task.parent) {
6637
+ const parentRowIndex = (_b = taskToRowIndexMap.get(comparisonLevel)) == null ? void 0 : _b.get(task.parent);
6638
+ if (typeof parentRowIndex === "number") {
6639
+ const yInUserRow = parentRowIndex * fullRowHeight;
6640
+ renderContexts.push({ y: yInUserRow, keySuffix: "grouped" });
6641
+ }
6642
+ }
6643
+ for (const context of renderContexts) {
6644
+ tasksRes.push(
6645
+ /* @__PURE__ */ jsxRuntime.jsx(
6646
+ "svg",
6647
+ {
6648
+ id: `${renderId}-${context.keySuffix}`,
6649
+ className: "TaskItemClassName",
6650
+ x: containerX + additionalLeftSpace,
6651
+ y: context.y,
6652
+ width: containerWidth,
6653
+ height: fullRowHeight,
6654
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6655
+ TaskItem,
6656
+ {
6657
+ getTaskGlobalIndexByRef,
6658
+ hasChildren: checkHasChildren(task, childTasksMap),
6659
+ hasDependencyWarning: taskToHasDependencyWarningMap ? checkTaskHasDependencyWarning(task, taskToHasDependencyWarningMap) : false,
6660
+ progressWidth,
6661
+ progressX: rtl ? innerX2 : innerX1,
6662
+ selectTaskOnMouseDown,
6663
+ task,
6664
+ taskYOffset,
6665
+ width,
6666
+ x1: innerX1,
6667
+ x2: innerX2,
6668
+ childOutOfParentWarnings,
6669
+ distances,
6670
+ taskHeight,
6671
+ taskHalfHeight,
6672
+ isProgressChangeable: !task.isDisabled,
6673
+ isDateChangeable: !task.isDisabled,
6674
+ isRelationChangeable: !task.isRelationDisabled,
6675
+ authorizedRelations,
6676
+ ganttRelationEvent,
6677
+ isDelete: !task.isDisabled,
6678
+ onDoubleClick,
6679
+ onClick,
6680
+ onEventStart: handleTaskDragStart,
6681
+ setTooltipTask,
6682
+ onRelationStart: handleBarRelationStart,
6683
+ isSelected: Boolean(selectedIdsMirror[taskId]),
6684
+ isCritical,
6685
+ rtl,
6686
+ fixStartPosition,
6687
+ fixEndPosition,
6688
+ handleDeleteTasks,
6689
+ colorStyles
6690
+ }
6691
+ )
6692
+ },
6693
+ `${comparisonLevel}_${task.id}_${index2}_${context.keySuffix}`
6694
+ )
6695
+ );
6696
+ }
6667
6697
  const addedDependenciesAtLevel = addedDependencies[comparisonLevel] ?? (addedDependencies[comparisonLevel] = {});
6668
6698
  const addedDependenciesAtTask = addedDependenciesAtLevel[taskId] ?? (addedDependenciesAtLevel[taskId] = {});
6669
6699
  const dependenciesAtLevel = dependencyMap.get(comparisonLevel);
6670
6700
  const dependenciesByTask = dependenciesAtLevel == null ? void 0 : dependenciesAtLevel.get(taskId);
6671
- dependenciesByTask == null ? void 0 : dependenciesByTask.filter(({ source }) => visibleTasksMirror[source.id]).forEach((dep) => {
6701
+ dependenciesByTask == null ? void 0 : dependenciesByTask.forEach((dep) => {
6672
6702
  var _a2;
6703
+ if (!visibleTasksMirror[dep.source.id])
6704
+ return;
6673
6705
  if (addedDependenciesAtTask[dep.source.id])
6674
6706
  return;
6675
6707
  addedDependenciesAtTask[dep.source.id] = true;
@@ -6713,20 +6745,21 @@
6713
6745
  }
6714
6746
  )
6715
6747
  },
6716
- `Arrow from ${dep.source.id} to ${taskId} on ${comparisonLevel}`
6748
+ `Arrow from ${dep.source.id} to ${taskId} on ${comparisonLevel} at ${index2}`
6717
6749
  )
6718
6750
  );
6719
6751
  });
6720
6752
  const dependentsAtLevel = dependentMap.get(comparisonLevel);
6721
6753
  const dependentsByTask = dependentsAtLevel == null ? void 0 : dependentsAtLevel.get(taskId);
6722
- dependentsByTask == null ? void 0 : dependentsByTask.filter(({ dependent }) => visibleTasksMirror[dependent.id]).forEach((dep) => {
6723
- var _a2, _b;
6724
- console.log("dependent", dep);
6754
+ dependentsByTask == null ? void 0 : dependentsByTask.forEach((dep) => {
6755
+ var _a2, _b2;
6756
+ if (!visibleTasksMirror[dep.dependent.id])
6757
+ return;
6725
6758
  const addedDepsForDep = addedDependenciesAtLevel[_a2 = dep.dependent.id] ?? (addedDependenciesAtLevel[_a2] = {});
6726
6759
  if (addedDepsForDep[taskId])
6727
6760
  return;
6728
6761
  addedDepsForDep[taskId] = true;
6729
- const isDepCritical = !!((_b = criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.dependencies.get(dep.dependent.id)) == null ? void 0 : _b.has(task.id));
6762
+ const isDepCritical = !!((_b2 = criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.dependencies.get(dep.dependent.id)) == null ? void 0 : _b2.has(task.id));
6730
6763
  const { x1: toX1, x2: toX2 } = getTaskCoordinates2(dep.dependent);
6731
6764
  const containerX2 = Math.min(toX1, taskX1) - 300;
6732
6765
  const containerWidth2 = Math.max(toX2, taskX2) - containerX2 + 300;
@@ -6766,7 +6799,7 @@
6766
6799
  }
6767
6800
  )
6768
6801
  },
6769
- `Arrow from ${taskId} to ${dep.dependent.id} on ${comparisonLevel}`
6802
+ `Arrow from ${taskId} to ${dep.dependent.id} on ${comparisonLevel} at ${index2}`
6770
6803
  )
6771
6804
  );
6772
6805
  });
@@ -11463,49 +11496,36 @@
11463
11496
  const rowIndexToTasksMap = /* @__PURE__ */ new Map();
11464
11497
  const mapGlobalRowIndexToTask = /* @__PURE__ */ new Map();
11465
11498
  const parentMap = new Map(tasks.map((t) => [t.id, t]));
11466
- let globalRowIndex = 0;
11467
- for (let comparisonLevel = 1; comparisonLevel <= comparisonLevels; comparisonLevel++) {
11468
- const taskToRow = /* @__PURE__ */ new Map();
11469
- const rowToTask = /* @__PURE__ */ new Map();
11470
- const rowToTasks = /* @__PURE__ */ new Map();
11471
- taskToRowIndexMap.set(comparisonLevel, taskToRow);
11472
- rowIndexToTaskMap.set(comparisonLevel, rowToTask);
11473
- rowIndexToTasksMap.set(comparisonLevel, rowToTasks);
11474
- let rowIndex = 0;
11475
- for (const task of tasks) {
11476
- if ((task.comparisonLevel ?? 1) !== comparisonLevel)
11477
- continue;
11478
- const { id, parent, type } = task;
11479
- let assignedRowIndex = rowIndex;
11480
- if (type === "user" || type === "project") {
11481
- taskToRow.set(id, rowIndex);
11482
- rowToTask.set(rowIndex, task);
11483
- rowToTasks.set(rowIndex, [task]);
11484
- mapGlobalRowIndexToTask.set(globalRowIndex, task);
11485
- rowIndex++;
11486
- globalRowIndex++;
11499
+ const rowCounterPerLevel = {};
11500
+ for (let level = 1; level <= comparisonLevels; level++) {
11501
+ taskToRowIndexMap.set(level, /* @__PURE__ */ new Map());
11502
+ rowIndexToTaskMap.set(level, /* @__PURE__ */ new Map());
11503
+ rowIndexToTasksMap.set(level, /* @__PURE__ */ new Map());
11504
+ rowCounterPerLevel[level] = 0;
11505
+ }
11506
+ for (const task of tasks) {
11507
+ const comparisonLevel = task.comparisonLevel ?? 1;
11508
+ const rowIndex = rowCounterPerLevel[comparisonLevel];
11509
+ const taskToRow = taskToRowIndexMap.get(comparisonLevel);
11510
+ const rowToTask = rowIndexToTaskMap.get(comparisonLevel);
11511
+ const rowToTasks = rowIndexToTasksMap.get(comparisonLevel);
11512
+ const { id, parent } = task;
11513
+ const parentTask = parent ? parentMap.get(parent) : null;
11514
+ if (isGrouped && comparisonLevel === 1 && parent && parentTask && parentTask.hideChildren) {
11515
+ const parentRow = taskToRow.get(parent);
11516
+ if (parentRow !== void 0) {
11517
+ const existing = rowToTasks.get(parentRow) ?? [];
11518
+ rowToTasks.set(parentRow, [...existing, task]);
11519
+ taskToRow.set(id, parentRow);
11487
11520
  continue;
11488
11521
  }
11489
- if (isGrouped && parent) {
11490
- const parentTask = parentMap.get(parent);
11491
- const parentRowIndex = taskToRow.get(parent);
11492
- if ((parentTask == null ? void 0 : parentTask.hideChildren) && parentRowIndex !== void 0) {
11493
- assignedRowIndex = parentRowIndex;
11494
- } else {
11495
- assignedRowIndex = rowIndex;
11496
- rowIndex++;
11497
- }
11498
- } else {
11499
- assignedRowIndex = rowIndex;
11500
- rowIndex++;
11501
- }
11502
- taskToRow.set(id, assignedRowIndex);
11503
- rowToTask.set(assignedRowIndex, task);
11504
- const existing = rowToTasks.get(assignedRowIndex) ?? [];
11505
- rowToTasks.set(assignedRowIndex, [...existing, task]);
11506
- mapGlobalRowIndexToTask.set(globalRowIndex, task);
11507
- globalRowIndex++;
11508
11522
  }
11523
+ taskToRow.set(id, rowIndex);
11524
+ rowToTask.set(rowIndex, task);
11525
+ rowToTasks.set(rowIndex, [task]);
11526
+ const globalIndex = rowIndex * comparisonLevels + (comparisonLevel - 1);
11527
+ mapGlobalRowIndexToTask.set(globalIndex, task);
11528
+ rowCounterPerLevel[comparisonLevel]++;
11509
11529
  }
11510
11530
  return [
11511
11531
  taskToRowIndexMap,
@@ -11806,7 +11826,8 @@
11806
11826
  const groupedIndexes = useGroupedVirtualization(
11807
11827
  ganttTaskContentRef,
11808
11828
  rowIndexToTasksMap,
11809
- fullRowHeight
11829
+ fullRowHeight,
11830
+ taskToRowIndexMap
11810
11831
  );
11811
11832
  const optimizedIndexes = useOptimizedList(
11812
11833
  ganttTaskContentRef,
@@ -13068,6 +13089,7 @@
13068
13089
  TaskListTable,
13069
13090
  enableTaskGrouping,
13070
13091
  rowIndexToTasksMap,
13092
+ taskToRowIndexMap,
13071
13093
  canMoveTasks,
13072
13094
  canResizeColumns,
13073
13095
  childTasksMap,
@@ -0,0 +1,2 @@
1
+ import { RowIndexToTasksMap, TaskOrEmpty } from "../types/public-types";
2
+ export declare const getUniqueTasksFromRowIndexToTasksMap: (rowIndexToTasksMap: RowIndexToTasksMap) => TaskOrEmpty[];
@@ -1,3 +1,3 @@
1
- import type { RowIndexToTasksMap } from "../types/public-types";
1
+ import type { RowIndexToTasksMap, TaskToRowIndexMap } from "../types/public-types";
2
2
  import type { OptimizedListParams } from "./use-optimized-list";
3
- export declare const useGroupedVirtualization: (_containerRef: React.RefObject<HTMLElement>, rowIndexToTasksMap: RowIndexToTasksMap, taskHeight: number) => OptimizedListParams;
3
+ export declare const useGroupedVirtualization: (_containerRef: React.RefObject<HTMLElement>, rowIndexToTasksMap: RowIndexToTasksMap, taskHeight: number, taskToRowIndexMap: TaskToRowIndexMap) => OptimizedListParams;
package/dist/style.css CHANGED
@@ -332,7 +332,7 @@
332
332
  stroke: #e0e0e0;
333
333
  stroke-width: 1.4;
334
334
  }
335
- ._ganttTaskRoot_jnu0p_1 {
335
+ ._ganttTaskRoot_1lwsd_1 {
336
336
  display: flex;
337
337
  flex-direction: column;
338
338
  overflow-x: scroll;
@@ -344,7 +344,7 @@
344
344
 
345
345
  /* Only chrome otherwise the firefox scrollbar has no edge*/
346
346
  @media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) {
347
- ._ganttTaskRoot_jnu0p_1 {
347
+ ._ganttTaskRoot_1lwsd_1 {
348
348
  scrollbar-width: thin;
349
349
  }
350
350
  }
@@ -373,7 +373,7 @@
373
373
  background-clip: padding-box;
374
374
  } */
375
375
 
376
- ._ganttTaskContent_jnu0p_83 {
376
+ ._ganttTaskContent_1lwsd_83 {
377
377
  margin: 0;
378
378
  padding: 0;
379
379
  overflow-x: hidden;
@@ -382,15 +382,15 @@
382
382
 
383
383
  /* Only chrome otherwise the firefox scrollbar has no edges*/
384
384
  @media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) {
385
- ._ganttTaskContent_jnu0p_83 {
385
+ ._ganttTaskContent_1lwsd_83 {
386
386
  scrollbar-width: thin;
387
387
  }
388
388
  }
389
389
 
390
- ._wrapper_jnu0p_111 {
390
+ ._wrapper_1lwsd_111 {
391
391
  display: grid;
392
392
  overflow-x: hidden;
393
- overflow-y: hidden;
393
+ overflow-y: auto;
394
394
  padding: 0;
395
395
  margin: 0;
396
396
  list-style: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepocman/gantt-task-react",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
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",