@thepocman/gantt-task-react 1.0.20 → 1.0.23

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.
@@ -49,5 +49,4 @@ 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;
53
52
  export declare const TaskGanttContent: React.FC<TaskGanttContentProps>;
@@ -676,6 +676,7 @@ var ViewMode = /* @__PURE__ */ ((ViewMode2) => {
676
676
  ViewMode2["Week"] = "Week";
677
677
  ViewMode2["Month"] = "Month";
678
678
  ViewMode2["QuarterYear"] = "QuarterYear";
679
+ ViewMode2["HalfYear"] = "HalfYear";
679
680
  ViewMode2["Year"] = "Year";
680
681
  return ViewMode2;
681
682
  })(ViewMode || {});
@@ -806,6 +807,11 @@ function differenceInMonths(dirtyDateLeft, dirtyDateRight) {
806
807
  }
807
808
  return result === 0 ? 0 : result;
808
809
  }
810
+ function differenceInQuarters(dateLeft, dateRight, options) {
811
+ requiredArgs(2, arguments);
812
+ var diff = differenceInMonths(dateLeft, dateRight) / 3;
813
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
814
+ }
809
815
  function differenceInWeeks(dateLeft, dateRight, options) {
810
816
  requiredArgs(2, arguments);
811
817
  var diff = differenceInDays(dateLeft, dateRight) / 7;
@@ -829,11 +835,6 @@ function differenceInYears(dirtyDateLeft, dirtyDateRight) {
829
835
  var result = sign * (difference - Number(isLastYearNotFull));
830
836
  return result === 0 ? 0 : result;
831
837
  }
832
- function differenceInQuarters(dateLeft, dateRight, options) {
833
- requiredArgs(2, arguments);
834
- var diff = differenceInMonths(dateLeft, dateRight) / 3;
835
- return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
836
- }
837
838
  const getDatesDiff = (dateFrom, dateTo, viewMode) => {
838
839
  switch (viewMode) {
839
840
  case ViewMode.Day:
@@ -852,12 +853,19 @@ const getDatesDiff = (dateFrom, dateTo, viewMode) => {
852
853
  return differenceInWeeks(dateFrom, dateTo);
853
854
  case ViewMode.QuarterYear:
854
855
  return differenceInQuarters(dateFrom, dateTo);
856
+ case ViewMode.HalfYear:
857
+ return Math.round(differenceInMonths(dateFrom, dateTo) / 6);
855
858
  case ViewMode.Year:
856
859
  return differenceInYears(dateFrom, dateTo);
857
860
  default:
858
861
  throw new Error("Unknown view mode");
859
862
  }
860
863
  };
864
+ const startOfHalfYear = (date) => {
865
+ const d4 = new Date(date);
866
+ const startMonth = d4.getMonth() < 6 ? 0 : 6;
867
+ return new Date(d4.getFullYear(), startMonth, 1);
868
+ };
861
869
  const ganttDateRange = (tasks, viewMode, preStepsCount) => {
862
870
  let minTaskDate = null;
863
871
  let maxTaskDate = null;
@@ -883,6 +891,12 @@ const ganttDateRange = (tasks, viewMode, preStepsCount) => {
883
891
  newEndDate = addYears(maxTaskDate, 1);
884
892
  newEndDate = startOfYear(newEndDate);
885
893
  break;
894
+ case ViewMode.HalfYear:
895
+ newStartDate = subMonths(minTaskDate, preStepsCount * 6);
896
+ newStartDate = startOfHalfYear(newStartDate);
897
+ newEndDate = addMonths(maxTaskDate, 6);
898
+ newEndDate = startOfHalfYear(addMonths(newEndDate, 6));
899
+ break;
886
900
  case ViewMode.QuarterYear:
887
901
  newStartDate = subMonths(minTaskDate, preStepsCount * 3);
888
902
  newStartDate = startOfQuarter(newStartDate);
@@ -1945,20 +1959,14 @@ const useOptimizedList = (containerRef, property, cellSize) => {
1945
1959
  return indexes;
1946
1960
  };
1947
1961
  const TASK_SPACING = 2;
1948
- const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight, taskToRowIndexMap) => {
1962
+ const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight) => {
1949
1963
  const rowEntries = useMemo(() => {
1950
1964
  if (!rowIndexToTasksMap || rowIndexToTasksMap.size === 0)
1951
1965
  return [];
1952
- if (!taskToRowIndexMap || taskToRowIndexMap.size === 0)
1953
- return [];
1954
1966
  const rowToHeight = /* @__PURE__ */ new Map();
1955
1967
  for (const levelMap of rowIndexToTasksMap.values()) {
1956
1968
  for (const [rowIndex, tasks] of levelMap.entries()) {
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);
1969
+ const height = tasks.length * (taskHeight + TASK_SPACING);
1962
1970
  rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
1963
1971
  }
1964
1972
  }
@@ -3415,7 +3423,6 @@ const TaskListInner = ({
3415
3423
  dependencyMap,
3416
3424
  distances,
3417
3425
  rowIndexToTasksMap,
3418
- taskToRowIndexMap,
3419
3426
  fontFamily,
3420
3427
  fontSize,
3421
3428
  fullRowHeight,
@@ -3457,8 +3464,7 @@ const TaskListInner = ({
3457
3464
  const groupedIndexes = useGroupedVirtualization(
3458
3465
  taskListContentRef,
3459
3466
  rowIndexToTasksMap,
3460
- distances.taskHeight,
3461
- taskToRowIndexMap
3467
+ distances.taskHeight
3462
3468
  );
3463
3469
  const optimizedIndexes = useOptimizedList(
3464
3470
  taskListContentRef,
@@ -4309,6 +4315,9 @@ const defaultRenderBottomHeader = (date, viewMode, dateSetup, index2, isUnknownD
4309
4315
  case ViewMode.Year:
4310
4316
  value = formatDistance3("xYears", offsetFromStart);
4311
4317
  break;
4318
+ case ViewMode.HalfYear:
4319
+ value = formatDistance3("xMonths", offsetFromStart * 6);
4320
+ break;
4312
4321
  case ViewMode.Month:
4313
4322
  value = formatDistance3("xMonths", offsetFromStart);
4314
4323
  break;
@@ -4342,6 +4351,10 @@ const defaultRenderBottomHeader = (date, viewMode, dateSetup, index2, isUnknownD
4342
4351
  switch (viewMode) {
4343
4352
  case ViewMode.Year:
4344
4353
  return date.getFullYear();
4354
+ case ViewMode.HalfYear: {
4355
+ const half = Math.ceil((date.getMonth() + 1) / 6);
4356
+ return `H${half}`;
4357
+ }
4345
4358
  case ViewMode.Month:
4346
4359
  try {
4347
4360
  return format(date, dateSetup.dateFormats.monthBottomHeaderFormat, {
@@ -4397,10 +4410,16 @@ const getQuarterText = (date) => {
4397
4410
  const quarter = Math.ceil((date.getMonth() + 1) / 3);
4398
4411
  return `Q${quarter}`;
4399
4412
  };
4413
+ const getHalfYearText = (date) => {
4414
+ const halfYear = Math.ceil((date.getMonth() + 1) / 6);
4415
+ return `H${halfYear}`;
4416
+ };
4400
4417
  const defaultRenderTopHeader = (date, viewMode, dateSetup) => {
4401
4418
  switch (viewMode) {
4402
4419
  case ViewMode.Year:
4403
4420
  return date.getFullYear().toString();
4421
+ case ViewMode.HalfYear:
4422
+ return `${getHalfYearText(date)} ${date.getFullYear()}`;
4404
4423
  case ViewMode.QuarterYear:
4405
4424
  return `${getQuarterText(date)} ${date.getFullYear()}`;
4406
4425
  case ViewMode.Month:
@@ -4534,6 +4553,48 @@ const Calendar = ({
4534
4553
  }
4535
4554
  return [topValues2, bottomValues2];
4536
4555
  };
4556
+ const getCalenderValuesForHalfYear = () => {
4557
+ const topValues2 = [];
4558
+ const bottomValues2 = [];
4559
+ const topDefaultHeight = headerHeight * 0.5;
4560
+ for (let i2 = startColumnIndex; i2 <= endColumnIndex; i2++) {
4561
+ const date = getDate(i2);
4562
+ const halfYear = "H" + Math.ceil((date.getMonth() + 1) / 6);
4563
+ bottomValues2.push(
4564
+ /* @__PURE__ */ jsx(
4565
+ "text",
4566
+ {
4567
+ y: headerHeight * 0.8,
4568
+ x: additionalLeftSpace + columnWidth * i2 + columnWidth * 0.5,
4569
+ className: styles$a.calendarBottomText,
4570
+ style: { fill: colors.barLabelColor },
4571
+ children: halfYear
4572
+ },
4573
+ `${halfYear}-${date.getFullYear()}-${i2}`
4574
+ )
4575
+ );
4576
+ if (!isUnknownDates && (i2 === startColumnIndex || date.getFullYear() !== getDate(i2 - 1).getFullYear())) {
4577
+ const year = date.getFullYear().toString();
4578
+ const startHalf = Math.floor(i2 / 6) * 6;
4579
+ topValues2.push(
4580
+ /* @__PURE__ */ jsx(
4581
+ TopPartOfCalendar,
4582
+ {
4583
+ value: year,
4584
+ x1Line: additionalLeftSpace + columnWidth * startHalf,
4585
+ y1Line: 0,
4586
+ y2Line: topDefaultHeight,
4587
+ xText: additionalLeftSpace + columnWidth * (startHalf + 3),
4588
+ yText: topDefaultHeight * 0.9,
4589
+ colors
4590
+ },
4591
+ year
4592
+ )
4593
+ );
4594
+ }
4595
+ }
4596
+ return [topValues2, bottomValues2];
4597
+ };
4537
4598
  const getCalendarValuesForQuarterYear = () => {
4538
4599
  const topValues2 = [];
4539
4600
  const bottomValues2 = [];
@@ -4541,6 +4602,7 @@ const Calendar = ({
4541
4602
  for (let i2 = startColumnIndex; i2 <= endColumnIndex; i2++) {
4542
4603
  const date = getDate(i2);
4543
4604
  const quarter = "Q" + Math.ceil((date.getMonth() + 1) / 3);
4605
+ console.log("quarter :>> ", quarter);
4544
4606
  bottomValues2.push(
4545
4607
  /* @__PURE__ */ jsx(
4546
4608
  "text",
@@ -4820,6 +4882,9 @@ const Calendar = ({
4820
4882
  case ViewMode.Year:
4821
4883
  [topValues, bottomValues] = getCalendarValuesForYear();
4822
4884
  break;
4885
+ case ViewMode.HalfYear:
4886
+ [topValues, bottomValues] = getCalenderValuesForHalfYear();
4887
+ break;
4823
4888
  case ViewMode.QuarterYear:
4824
4889
  [topValues, bottomValues] = getCalendarValuesForQuarterYear();
4825
4890
  break;
@@ -5094,9 +5159,9 @@ const Grid = (props) => {
5094
5159
  /* @__PURE__ */ jsx(GridBody, { ...props })
5095
5160
  ] });
5096
5161
  };
5097
- const ganttTaskRoot = "_ganttTaskRoot_1lwsd_1";
5098
- const ganttTaskContent = "_ganttTaskContent_1lwsd_83";
5099
- const wrapper$2 = "_wrapper_1lwsd_111";
5162
+ const ganttTaskRoot = "_ganttTaskRoot_1mu5y_1";
5163
+ const ganttTaskContent = "_ganttTaskContent_1mu5y_83";
5164
+ const wrapper$2 = "_wrapper_1mu5y_111";
5100
5165
  const styles$9 = {
5101
5166
  ganttTaskRoot,
5102
5167
  ganttTaskContent,
@@ -6500,13 +6565,6 @@ const TaskItemInner = (props) => {
6500
6565
  );
6501
6566
  };
6502
6567
  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
- };
6510
6568
  const TaskGanttContent = ({
6511
6569
  authorizedRelations,
6512
6570
  additionalLeftSpace,
@@ -6552,7 +6610,7 @@ const TaskGanttContent = ({
6552
6610
  taskToRowIndexMap
6553
6611
  }) => {
6554
6612
  const [renderedTasks, renderedArrows, renderedSelectedTasks] = useMemo(() => {
6555
- var _a, _b;
6613
+ var _a;
6556
6614
  if (!renderedRowIndexes)
6557
6615
  return [null, null, null];
6558
6616
  const [start, end] = renderedRowIndexes;
@@ -6567,7 +6625,7 @@ const TaskGanttContent = ({
6567
6625
  for (let level = 1; level <= comparisonLevels; level++) {
6568
6626
  const levelMap = rowIndexToTasksMap.get(level);
6569
6627
  const rowTasks = levelMap == null ? void 0 : levelMap.get(index2);
6570
- if (rowTasks) {
6628
+ if (Array.isArray(rowTasks)) {
6571
6629
  tasksAtRow.push(...rowTasks);
6572
6630
  }
6573
6631
  }
@@ -6578,32 +6636,31 @@ const TaskGanttContent = ({
6578
6636
  }
6579
6637
  for (const task of tasksAtRow) {
6580
6638
  const comparisonLevel = task.comparisonLevel ?? 1;
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
- );
6639
+ const { id: taskId } = task;
6640
+ if (selectedIdsMirror[taskId] && !addedSelectedTasks[taskId]) {
6641
+ addedSelectedTasks[taskId] = true;
6642
+ const rowIndex = (_a = taskToRowIndexMap.get(comparisonLevel)) == null ? void 0 : _a.get(taskId);
6643
+ if (typeof rowIndex === "number") {
6644
+ selectedTasksRes.push(
6645
+ /* @__PURE__ */ jsx(
6646
+ "rect",
6647
+ {
6648
+ x: 0,
6649
+ y: rowIndex * fullRowHeight,
6650
+ width: "100%",
6651
+ height: fullRowHeight,
6652
+ fill: colorStyles.selectedTaskBackgroundColor
6653
+ },
6654
+ `selected-${taskId}`
6655
+ )
6656
+ );
6657
+ }
6602
6658
  }
6603
6659
  if (comparisonLevel > comparisonLevels)
6604
6660
  continue;
6605
6661
  if (task.type === "empty" || task.type === "user")
6606
6662
  continue;
6663
+ const key = `${comparisonLevel}_${task.id}`;
6607
6664
  const criticalPathOnLevel = criticalPaths == null ? void 0 : criticalPaths.get(comparisonLevel);
6608
6665
  const isCritical = !!(criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.tasks.has(task.id));
6609
6666
  const {
@@ -6617,78 +6674,64 @@ const TaskGanttContent = ({
6617
6674
  x1: taskX1,
6618
6675
  x2: taskX2
6619
6676
  } = getTaskCoordinates2(task);
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
- }
6677
+ tasksRes.push(
6678
+ /* @__PURE__ */ jsx(
6679
+ "svg",
6680
+ {
6681
+ id: task.id,
6682
+ className: "TaskItemClassName",
6683
+ x: containerX + additionalLeftSpace,
6684
+ y: levelY,
6685
+ width: containerWidth,
6686
+ height: fullRowHeight,
6687
+ children: /* @__PURE__ */ jsx(
6688
+ TaskItem,
6689
+ {
6690
+ getTaskGlobalIndexByRef,
6691
+ hasChildren: checkHasChildren(task, childTasksMap),
6692
+ hasDependencyWarning: taskToHasDependencyWarningMap ? checkTaskHasDependencyWarning(task, taskToHasDependencyWarningMap) : false,
6693
+ progressWidth,
6694
+ progressX: rtl ? innerX2 : innerX1,
6695
+ selectTaskOnMouseDown,
6696
+ task,
6697
+ taskYOffset,
6698
+ width,
6699
+ x1: innerX1,
6700
+ x2: innerX2,
6701
+ childOutOfParentWarnings,
6702
+ distances,
6703
+ taskHeight,
6704
+ taskHalfHeight,
6705
+ isProgressChangeable: !task.isDisabled,
6706
+ isDateChangeable: !task.isDisabled,
6707
+ isRelationChangeable: !task.isRelationDisabled,
6708
+ authorizedRelations,
6709
+ ganttRelationEvent,
6710
+ isDelete: !task.isDisabled,
6711
+ onDoubleClick,
6712
+ onClick,
6713
+ onEventStart: handleTaskDragStart,
6714
+ setTooltipTask,
6715
+ onRelationStart: handleBarRelationStart,
6716
+ isSelected: Boolean(selectedIdsMirror[taskId]),
6717
+ isCritical,
6718
+ rtl,
6719
+ fixStartPosition,
6720
+ fixEndPosition,
6721
+ handleDeleteTasks,
6722
+ colorStyles
6723
+ }
6724
+ )
6725
+ },
6726
+ key
6727
+ )
6728
+ );
6684
6729
  const addedDependenciesAtLevel = addedDependencies[comparisonLevel] ?? (addedDependencies[comparisonLevel] = {});
6685
6730
  const addedDependenciesAtTask = addedDependenciesAtLevel[taskId] ?? (addedDependenciesAtLevel[taskId] = {});
6686
6731
  const dependenciesAtLevel = dependencyMap.get(comparisonLevel);
6687
6732
  const dependenciesByTask = dependenciesAtLevel == null ? void 0 : dependenciesAtLevel.get(taskId);
6688
- dependenciesByTask == null ? void 0 : dependenciesByTask.forEach((dep) => {
6733
+ dependenciesByTask == null ? void 0 : dependenciesByTask.filter(({ source }) => visibleTasksMirror[source.id]).forEach((dep) => {
6689
6734
  var _a2;
6690
- if (!visibleTasksMirror[dep.source.id])
6691
- return;
6692
6735
  if (addedDependenciesAtTask[dep.source.id])
6693
6736
  return;
6694
6737
  addedDependenciesAtTask[dep.source.id] = true;
@@ -6732,21 +6775,20 @@ const TaskGanttContent = ({
6732
6775
  }
6733
6776
  )
6734
6777
  },
6735
- `Arrow from ${dep.source.id} to ${taskId} on ${comparisonLevel} at ${index2}`
6778
+ `Arrow from ${dep.source.id} to ${taskId} on ${comparisonLevel}`
6736
6779
  )
6737
6780
  );
6738
6781
  });
6739
6782
  const dependentsAtLevel = dependentMap.get(comparisonLevel);
6740
6783
  const dependentsByTask = dependentsAtLevel == null ? void 0 : dependentsAtLevel.get(taskId);
6741
- dependentsByTask == null ? void 0 : dependentsByTask.forEach((dep) => {
6742
- var _a2, _b2;
6743
- if (!visibleTasksMirror[dep.dependent.id])
6744
- return;
6784
+ dependentsByTask == null ? void 0 : dependentsByTask.filter(({ dependent }) => visibleTasksMirror[dependent.id]).forEach((dep) => {
6785
+ var _a2, _b;
6786
+ console.log("dependent", dep);
6745
6787
  const addedDepsForDep = addedDependenciesAtLevel[_a2 = dep.dependent.id] ?? (addedDependenciesAtLevel[_a2] = {});
6746
6788
  if (addedDepsForDep[taskId])
6747
6789
  return;
6748
6790
  addedDepsForDep[taskId] = true;
6749
- const isDepCritical = !!((_b2 = criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.dependencies.get(dep.dependent.id)) == null ? void 0 : _b2.has(task.id));
6791
+ const isDepCritical = !!((_b = criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.dependencies.get(dep.dependent.id)) == null ? void 0 : _b.has(task.id));
6750
6792
  const { x1: toX1, x2: toX2 } = getTaskCoordinates2(dep.dependent);
6751
6793
  const containerX2 = Math.min(toX1, taskX1) - 300;
6752
6794
  const containerWidth2 = Math.max(toX2, taskX2) - containerX2 + 300;
@@ -6786,7 +6828,7 @@ const TaskGanttContent = ({
6786
6828
  }
6787
6829
  )
6788
6830
  },
6789
- `Arrow from ${taskId} to ${dep.dependent.id} on ${comparisonLevel} at ${index2}`
6831
+ `Arrow from ${taskId} to ${dep.dependent.id} on ${comparisonLevel}`
6790
6832
  )
6791
6833
  );
6792
6834
  });
@@ -6856,6 +6898,7 @@ const TaskGanttInner = (props) => {
6856
6898
  height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
6857
6899
  width: (ganttTaskRootRef == null ? void 0 : ganttTaskRootRef.current) ? ganttTaskRootRef.current.clientWidth + ganttTaskRootRef.current.scrollLeft : fullSvgWidth
6858
6900
  };
6901
+ console.log("containerStyle:>> ", containerStyle);
6859
6902
  const gridStyle = useMemo(
6860
6903
  () => ({
6861
6904
  height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
@@ -11483,36 +11526,49 @@ const getMapTaskToRowIndexWithGrouping = (tasks, comparisonLevels, isGrouped = f
11483
11526
  const rowIndexToTasksMap = /* @__PURE__ */ new Map();
11484
11527
  const mapGlobalRowIndexToTask = /* @__PURE__ */ new Map();
11485
11528
  const parentMap = new Map(tasks.map((t2) => [t2.id, t2]));
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);
11529
+ let globalRowIndex = 0;
11530
+ for (let comparisonLevel = 1; comparisonLevel <= comparisonLevels; comparisonLevel++) {
11531
+ const taskToRow = /* @__PURE__ */ new Map();
11532
+ const rowToTask = /* @__PURE__ */ new Map();
11533
+ const rowToTasks = /* @__PURE__ */ new Map();
11534
+ taskToRowIndexMap.set(comparisonLevel, taskToRow);
11535
+ rowIndexToTaskMap.set(comparisonLevel, rowToTask);
11536
+ rowIndexToTasksMap.set(comparisonLevel, rowToTasks);
11537
+ let rowIndex = 0;
11538
+ for (const task of tasks) {
11539
+ if ((task.comparisonLevel ?? 1) !== comparisonLevel)
11540
+ continue;
11541
+ const { id, parent, type } = task;
11542
+ let assignedRowIndex = rowIndex;
11543
+ if (type === "user" || type === "project") {
11544
+ taskToRow.set(id, rowIndex);
11545
+ rowToTask.set(rowIndex, task);
11546
+ rowToTasks.set(rowIndex, [task]);
11547
+ mapGlobalRowIndexToTask.set(globalRowIndex, task);
11548
+ rowIndex++;
11549
+ globalRowIndex++;
11507
11550
  continue;
11508
11551
  }
11552
+ if (isGrouped && parent) {
11553
+ const parentTask = parentMap.get(parent);
11554
+ const parentRowIndex = taskToRow.get(parent);
11555
+ if ((parentTask == null ? void 0 : parentTask.hideChildren) && parentRowIndex !== void 0) {
11556
+ assignedRowIndex = parentRowIndex;
11557
+ } else {
11558
+ assignedRowIndex = rowIndex;
11559
+ rowIndex++;
11560
+ }
11561
+ } else {
11562
+ assignedRowIndex = rowIndex;
11563
+ rowIndex++;
11564
+ }
11565
+ taskToRow.set(id, assignedRowIndex);
11566
+ rowToTask.set(assignedRowIndex, task);
11567
+ const existing = rowToTasks.get(assignedRowIndex) ?? [];
11568
+ rowToTasks.set(assignedRowIndex, [...existing, task]);
11569
+ mapGlobalRowIndexToTask.set(globalRowIndex, task);
11570
+ globalRowIndex++;
11509
11571
  }
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]++;
11516
11572
  }
11517
11573
  return [
11518
11574
  taskToRowIndexMap,
@@ -11813,8 +11869,7 @@ const Gantt = ({
11813
11869
  const groupedIndexes = useGroupedVirtualization(
11814
11870
  ganttTaskContentRef,
11815
11871
  rowIndexToTasksMap,
11816
- fullRowHeight,
11817
- taskToRowIndexMap
11872
+ fullRowHeight
11818
11873
  );
11819
11874
  const optimizedIndexes = useOptimizedList(
11820
11875
  ganttTaskContentRef,
@@ -689,6 +689,7 @@
689
689
  ViewMode2["Week"] = "Week";
690
690
  ViewMode2["Month"] = "Month";
691
691
  ViewMode2["QuarterYear"] = "QuarterYear";
692
+ ViewMode2["HalfYear"] = "HalfYear";
692
693
  ViewMode2["Year"] = "Year";
693
694
  return ViewMode2;
694
695
  })(ViewMode || {});
@@ -819,6 +820,11 @@
819
820
  }
820
821
  return result === 0 ? 0 : result;
821
822
  }
823
+ function differenceInQuarters(dateLeft, dateRight, options) {
824
+ requiredArgs(2, arguments);
825
+ var diff = differenceInMonths(dateLeft, dateRight) / 3;
826
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
827
+ }
822
828
  function differenceInWeeks(dateLeft, dateRight, options) {
823
829
  requiredArgs(2, arguments);
824
830
  var diff = differenceInDays(dateLeft, dateRight) / 7;
@@ -842,11 +848,6 @@
842
848
  var result = sign * (difference - Number(isLastYearNotFull));
843
849
  return result === 0 ? 0 : result;
844
850
  }
845
- function differenceInQuarters(dateLeft, dateRight, options) {
846
- requiredArgs(2, arguments);
847
- var diff = differenceInMonths(dateLeft, dateRight) / 3;
848
- return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
849
- }
850
851
  const getDatesDiff = (dateFrom, dateTo, viewMode) => {
851
852
  switch (viewMode) {
852
853
  case ViewMode.Day:
@@ -865,12 +866,19 @@
865
866
  return differenceInWeeks(dateFrom, dateTo);
866
867
  case ViewMode.QuarterYear:
867
868
  return differenceInQuarters(dateFrom, dateTo);
869
+ case ViewMode.HalfYear:
870
+ return Math.round(differenceInMonths(dateFrom, dateTo) / 6);
868
871
  case ViewMode.Year:
869
872
  return differenceInYears(dateFrom, dateTo);
870
873
  default:
871
874
  throw new Error("Unknown view mode");
872
875
  }
873
876
  };
877
+ const startOfHalfYear = (date) => {
878
+ const d2 = new Date(date);
879
+ const startMonth = d2.getMonth() < 6 ? 0 : 6;
880
+ return new Date(d2.getFullYear(), startMonth, 1);
881
+ };
874
882
  const ganttDateRange = (tasks, viewMode, preStepsCount) => {
875
883
  let minTaskDate = null;
876
884
  let maxTaskDate = null;
@@ -896,6 +904,12 @@
896
904
  newEndDate = addYears(maxTaskDate, 1);
897
905
  newEndDate = startOfYear(newEndDate);
898
906
  break;
907
+ case ViewMode.HalfYear:
908
+ newStartDate = subMonths(minTaskDate, preStepsCount * 6);
909
+ newStartDate = startOfHalfYear(newStartDate);
910
+ newEndDate = addMonths(maxTaskDate, 6);
911
+ newEndDate = startOfHalfYear(addMonths(newEndDate, 6));
912
+ break;
899
913
  case ViewMode.QuarterYear:
900
914
  newStartDate = subMonths(minTaskDate, preStepsCount * 3);
901
915
  newStartDate = startOfQuarter(newStartDate);
@@ -1958,20 +1972,14 @@
1958
1972
  return indexes;
1959
1973
  };
1960
1974
  const TASK_SPACING = 2;
1961
- const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight, taskToRowIndexMap) => {
1975
+ const useGroupedVirtualization = (_containerRef, rowIndexToTasksMap, taskHeight) => {
1962
1976
  const rowEntries = React.useMemo(() => {
1963
1977
  if (!rowIndexToTasksMap || rowIndexToTasksMap.size === 0)
1964
1978
  return [];
1965
- if (!taskToRowIndexMap || taskToRowIndexMap.size === 0)
1966
- return [];
1967
1979
  const rowToHeight = /* @__PURE__ */ new Map();
1968
1980
  for (const levelMap of rowIndexToTasksMap.values()) {
1969
1981
  for (const [rowIndex, tasks] of levelMap.entries()) {
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);
1982
+ const height = tasks.length * (taskHeight + TASK_SPACING);
1975
1983
  rowToHeight.set(rowIndex, (rowToHeight.get(rowIndex) ?? 0) + height);
1976
1984
  }
1977
1985
  }
@@ -3428,7 +3436,6 @@
3428
3436
  dependencyMap,
3429
3437
  distances,
3430
3438
  rowIndexToTasksMap,
3431
- taskToRowIndexMap,
3432
3439
  fontFamily,
3433
3440
  fontSize,
3434
3441
  fullRowHeight,
@@ -3470,8 +3477,7 @@
3470
3477
  const groupedIndexes = useGroupedVirtualization(
3471
3478
  taskListContentRef,
3472
3479
  rowIndexToTasksMap,
3473
- distances.taskHeight,
3474
- taskToRowIndexMap
3480
+ distances.taskHeight
3475
3481
  );
3476
3482
  const optimizedIndexes = useOptimizedList(
3477
3483
  taskListContentRef,
@@ -4322,6 +4328,9 @@
4322
4328
  case ViewMode.Year:
4323
4329
  value = formatDistance2("xYears", offsetFromStart);
4324
4330
  break;
4331
+ case ViewMode.HalfYear:
4332
+ value = formatDistance2("xMonths", offsetFromStart * 6);
4333
+ break;
4325
4334
  case ViewMode.Month:
4326
4335
  value = formatDistance2("xMonths", offsetFromStart);
4327
4336
  break;
@@ -4355,6 +4364,10 @@
4355
4364
  switch (viewMode) {
4356
4365
  case ViewMode.Year:
4357
4366
  return date.getFullYear();
4367
+ case ViewMode.HalfYear: {
4368
+ const half = Math.ceil((date.getMonth() + 1) / 6);
4369
+ return `H${half}`;
4370
+ }
4358
4371
  case ViewMode.Month:
4359
4372
  try {
4360
4373
  return format(date, dateSetup.dateFormats.monthBottomHeaderFormat, {
@@ -4410,10 +4423,16 @@
4410
4423
  const quarter = Math.ceil((date.getMonth() + 1) / 3);
4411
4424
  return `Q${quarter}`;
4412
4425
  };
4426
+ const getHalfYearText = (date) => {
4427
+ const halfYear = Math.ceil((date.getMonth() + 1) / 6);
4428
+ return `H${halfYear}`;
4429
+ };
4413
4430
  const defaultRenderTopHeader = (date, viewMode, dateSetup) => {
4414
4431
  switch (viewMode) {
4415
4432
  case ViewMode.Year:
4416
4433
  return date.getFullYear().toString();
4434
+ case ViewMode.HalfYear:
4435
+ return `${getHalfYearText(date)} ${date.getFullYear()}`;
4417
4436
  case ViewMode.QuarterYear:
4418
4437
  return `${getQuarterText(date)} ${date.getFullYear()}`;
4419
4438
  case ViewMode.Month:
@@ -4547,6 +4566,48 @@
4547
4566
  }
4548
4567
  return [topValues2, bottomValues2];
4549
4568
  };
4569
+ const getCalenderValuesForHalfYear = () => {
4570
+ const topValues2 = [];
4571
+ const bottomValues2 = [];
4572
+ const topDefaultHeight = headerHeight * 0.5;
4573
+ for (let i = startColumnIndex; i <= endColumnIndex; i++) {
4574
+ const date = getDate(i);
4575
+ const halfYear = "H" + Math.ceil((date.getMonth() + 1) / 6);
4576
+ bottomValues2.push(
4577
+ /* @__PURE__ */ jsxRuntime.jsx(
4578
+ "text",
4579
+ {
4580
+ y: headerHeight * 0.8,
4581
+ x: additionalLeftSpace + columnWidth * i + columnWidth * 0.5,
4582
+ className: styles$a.calendarBottomText,
4583
+ style: { fill: colors.barLabelColor },
4584
+ children: halfYear
4585
+ },
4586
+ `${halfYear}-${date.getFullYear()}-${i}`
4587
+ )
4588
+ );
4589
+ if (!isUnknownDates && (i === startColumnIndex || date.getFullYear() !== getDate(i - 1).getFullYear())) {
4590
+ const year = date.getFullYear().toString();
4591
+ const startHalf = Math.floor(i / 6) * 6;
4592
+ topValues2.push(
4593
+ /* @__PURE__ */ jsxRuntime.jsx(
4594
+ TopPartOfCalendar,
4595
+ {
4596
+ value: year,
4597
+ x1Line: additionalLeftSpace + columnWidth * startHalf,
4598
+ y1Line: 0,
4599
+ y2Line: topDefaultHeight,
4600
+ xText: additionalLeftSpace + columnWidth * (startHalf + 3),
4601
+ yText: topDefaultHeight * 0.9,
4602
+ colors
4603
+ },
4604
+ year
4605
+ )
4606
+ );
4607
+ }
4608
+ }
4609
+ return [topValues2, bottomValues2];
4610
+ };
4550
4611
  const getCalendarValuesForQuarterYear = () => {
4551
4612
  const topValues2 = [];
4552
4613
  const bottomValues2 = [];
@@ -4554,6 +4615,7 @@
4554
4615
  for (let i = startColumnIndex; i <= endColumnIndex; i++) {
4555
4616
  const date = getDate(i);
4556
4617
  const quarter = "Q" + Math.ceil((date.getMonth() + 1) / 3);
4618
+ console.log("quarter :>> ", quarter);
4557
4619
  bottomValues2.push(
4558
4620
  /* @__PURE__ */ jsxRuntime.jsx(
4559
4621
  "text",
@@ -4833,6 +4895,9 @@
4833
4895
  case ViewMode.Year:
4834
4896
  [topValues, bottomValues] = getCalendarValuesForYear();
4835
4897
  break;
4898
+ case ViewMode.HalfYear:
4899
+ [topValues, bottomValues] = getCalenderValuesForHalfYear();
4900
+ break;
4836
4901
  case ViewMode.QuarterYear:
4837
4902
  [topValues, bottomValues] = getCalendarValuesForQuarterYear();
4838
4903
  break;
@@ -5107,9 +5172,9 @@
5107
5172
  /* @__PURE__ */ jsxRuntime.jsx(GridBody, { ...props })
5108
5173
  ] });
5109
5174
  };
5110
- const ganttTaskRoot = "_ganttTaskRoot_1lwsd_1";
5111
- const ganttTaskContent = "_ganttTaskContent_1lwsd_83";
5112
- const wrapper$2 = "_wrapper_1lwsd_111";
5175
+ const ganttTaskRoot = "_ganttTaskRoot_1mu5y_1";
5176
+ const ganttTaskContent = "_ganttTaskContent_1mu5y_83";
5177
+ const wrapper$2 = "_wrapper_1mu5y_111";
5113
5178
  const styles$9 = {
5114
5179
  ganttTaskRoot,
5115
5180
  ganttTaskContent,
@@ -6513,13 +6578,6 @@
6513
6578
  );
6514
6579
  };
6515
6580
  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
- };
6523
6581
  const TaskGanttContent = ({
6524
6582
  authorizedRelations,
6525
6583
  additionalLeftSpace,
@@ -6565,7 +6623,7 @@
6565
6623
  taskToRowIndexMap
6566
6624
  }) => {
6567
6625
  const [renderedTasks, renderedArrows, renderedSelectedTasks] = React.useMemo(() => {
6568
- var _a, _b;
6626
+ var _a;
6569
6627
  if (!renderedRowIndexes)
6570
6628
  return [null, null, null];
6571
6629
  const [start, end] = renderedRowIndexes;
@@ -6580,7 +6638,7 @@
6580
6638
  for (let level = 1; level <= comparisonLevels; level++) {
6581
6639
  const levelMap = rowIndexToTasksMap.get(level);
6582
6640
  const rowTasks = levelMap == null ? void 0 : levelMap.get(index2);
6583
- if (rowTasks) {
6641
+ if (Array.isArray(rowTasks)) {
6584
6642
  tasksAtRow.push(...rowTasks);
6585
6643
  }
6586
6644
  }
@@ -6591,32 +6649,31 @@
6591
6649
  }
6592
6650
  for (const task of tasksAtRow) {
6593
6651
  const comparisonLevel = task.comparisonLevel ?? 1;
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
- );
6652
+ const { id: taskId } = task;
6653
+ if (selectedIdsMirror[taskId] && !addedSelectedTasks[taskId]) {
6654
+ addedSelectedTasks[taskId] = true;
6655
+ const rowIndex = (_a = taskToRowIndexMap.get(comparisonLevel)) == null ? void 0 : _a.get(taskId);
6656
+ if (typeof rowIndex === "number") {
6657
+ selectedTasksRes.push(
6658
+ /* @__PURE__ */ jsxRuntime.jsx(
6659
+ "rect",
6660
+ {
6661
+ x: 0,
6662
+ y: rowIndex * fullRowHeight,
6663
+ width: "100%",
6664
+ height: fullRowHeight,
6665
+ fill: colorStyles.selectedTaskBackgroundColor
6666
+ },
6667
+ `selected-${taskId}`
6668
+ )
6669
+ );
6670
+ }
6615
6671
  }
6616
6672
  if (comparisonLevel > comparisonLevels)
6617
6673
  continue;
6618
6674
  if (task.type === "empty" || task.type === "user")
6619
6675
  continue;
6676
+ const key = `${comparisonLevel}_${task.id}`;
6620
6677
  const criticalPathOnLevel = criticalPaths == null ? void 0 : criticalPaths.get(comparisonLevel);
6621
6678
  const isCritical = !!(criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.tasks.has(task.id));
6622
6679
  const {
@@ -6630,78 +6687,64 @@
6630
6687
  x1: taskX1,
6631
6688
  x2: taskX2
6632
6689
  } = getTaskCoordinates2(task);
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
- }
6690
+ tasksRes.push(
6691
+ /* @__PURE__ */ jsxRuntime.jsx(
6692
+ "svg",
6693
+ {
6694
+ id: task.id,
6695
+ className: "TaskItemClassName",
6696
+ x: containerX + additionalLeftSpace,
6697
+ y: levelY,
6698
+ width: containerWidth,
6699
+ height: fullRowHeight,
6700
+ children: /* @__PURE__ */ jsxRuntime.jsx(
6701
+ TaskItem,
6702
+ {
6703
+ getTaskGlobalIndexByRef,
6704
+ hasChildren: checkHasChildren(task, childTasksMap),
6705
+ hasDependencyWarning: taskToHasDependencyWarningMap ? checkTaskHasDependencyWarning(task, taskToHasDependencyWarningMap) : false,
6706
+ progressWidth,
6707
+ progressX: rtl ? innerX2 : innerX1,
6708
+ selectTaskOnMouseDown,
6709
+ task,
6710
+ taskYOffset,
6711
+ width,
6712
+ x1: innerX1,
6713
+ x2: innerX2,
6714
+ childOutOfParentWarnings,
6715
+ distances,
6716
+ taskHeight,
6717
+ taskHalfHeight,
6718
+ isProgressChangeable: !task.isDisabled,
6719
+ isDateChangeable: !task.isDisabled,
6720
+ isRelationChangeable: !task.isRelationDisabled,
6721
+ authorizedRelations,
6722
+ ganttRelationEvent,
6723
+ isDelete: !task.isDisabled,
6724
+ onDoubleClick,
6725
+ onClick,
6726
+ onEventStart: handleTaskDragStart,
6727
+ setTooltipTask,
6728
+ onRelationStart: handleBarRelationStart,
6729
+ isSelected: Boolean(selectedIdsMirror[taskId]),
6730
+ isCritical,
6731
+ rtl,
6732
+ fixStartPosition,
6733
+ fixEndPosition,
6734
+ handleDeleteTasks,
6735
+ colorStyles
6736
+ }
6737
+ )
6738
+ },
6739
+ key
6740
+ )
6741
+ );
6697
6742
  const addedDependenciesAtLevel = addedDependencies[comparisonLevel] ?? (addedDependencies[comparisonLevel] = {});
6698
6743
  const addedDependenciesAtTask = addedDependenciesAtLevel[taskId] ?? (addedDependenciesAtLevel[taskId] = {});
6699
6744
  const dependenciesAtLevel = dependencyMap.get(comparisonLevel);
6700
6745
  const dependenciesByTask = dependenciesAtLevel == null ? void 0 : dependenciesAtLevel.get(taskId);
6701
- dependenciesByTask == null ? void 0 : dependenciesByTask.forEach((dep) => {
6746
+ dependenciesByTask == null ? void 0 : dependenciesByTask.filter(({ source }) => visibleTasksMirror[source.id]).forEach((dep) => {
6702
6747
  var _a2;
6703
- if (!visibleTasksMirror[dep.source.id])
6704
- return;
6705
6748
  if (addedDependenciesAtTask[dep.source.id])
6706
6749
  return;
6707
6750
  addedDependenciesAtTask[dep.source.id] = true;
@@ -6745,21 +6788,20 @@
6745
6788
  }
6746
6789
  )
6747
6790
  },
6748
- `Arrow from ${dep.source.id} to ${taskId} on ${comparisonLevel} at ${index2}`
6791
+ `Arrow from ${dep.source.id} to ${taskId} on ${comparisonLevel}`
6749
6792
  )
6750
6793
  );
6751
6794
  });
6752
6795
  const dependentsAtLevel = dependentMap.get(comparisonLevel);
6753
6796
  const dependentsByTask = dependentsAtLevel == null ? void 0 : dependentsAtLevel.get(taskId);
6754
- dependentsByTask == null ? void 0 : dependentsByTask.forEach((dep) => {
6755
- var _a2, _b2;
6756
- if (!visibleTasksMirror[dep.dependent.id])
6757
- return;
6797
+ dependentsByTask == null ? void 0 : dependentsByTask.filter(({ dependent }) => visibleTasksMirror[dependent.id]).forEach((dep) => {
6798
+ var _a2, _b;
6799
+ console.log("dependent", dep);
6758
6800
  const addedDepsForDep = addedDependenciesAtLevel[_a2 = dep.dependent.id] ?? (addedDependenciesAtLevel[_a2] = {});
6759
6801
  if (addedDepsForDep[taskId])
6760
6802
  return;
6761
6803
  addedDepsForDep[taskId] = true;
6762
- const isDepCritical = !!((_b2 = criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.dependencies.get(dep.dependent.id)) == null ? void 0 : _b2.has(task.id));
6804
+ const isDepCritical = !!((_b = criticalPathOnLevel == null ? void 0 : criticalPathOnLevel.dependencies.get(dep.dependent.id)) == null ? void 0 : _b.has(task.id));
6763
6805
  const { x1: toX1, x2: toX2 } = getTaskCoordinates2(dep.dependent);
6764
6806
  const containerX2 = Math.min(toX1, taskX1) - 300;
6765
6807
  const containerWidth2 = Math.max(toX2, taskX2) - containerX2 + 300;
@@ -6799,7 +6841,7 @@
6799
6841
  }
6800
6842
  )
6801
6843
  },
6802
- `Arrow from ${taskId} to ${dep.dependent.id} on ${comparisonLevel} at ${index2}`
6844
+ `Arrow from ${taskId} to ${dep.dependent.id} on ${comparisonLevel}`
6803
6845
  )
6804
6846
  );
6805
6847
  });
@@ -6869,6 +6911,7 @@
6869
6911
  height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
6870
6912
  width: (ganttTaskRootRef == null ? void 0 : ganttTaskRootRef.current) ? ganttTaskRootRef.current.clientWidth + ganttTaskRootRef.current.scrollLeft : fullSvgWidth
6871
6913
  };
6914
+ console.log("containerStyle:>> ", containerStyle);
6872
6915
  const gridStyle = React.useMemo(
6873
6916
  () => ({
6874
6917
  height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
@@ -11496,36 +11539,49 @@
11496
11539
  const rowIndexToTasksMap = /* @__PURE__ */ new Map();
11497
11540
  const mapGlobalRowIndexToTask = /* @__PURE__ */ new Map();
11498
11541
  const parentMap = new Map(tasks.map((t) => [t.id, t]));
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);
11542
+ let globalRowIndex = 0;
11543
+ for (let comparisonLevel = 1; comparisonLevel <= comparisonLevels; comparisonLevel++) {
11544
+ const taskToRow = /* @__PURE__ */ new Map();
11545
+ const rowToTask = /* @__PURE__ */ new Map();
11546
+ const rowToTasks = /* @__PURE__ */ new Map();
11547
+ taskToRowIndexMap.set(comparisonLevel, taskToRow);
11548
+ rowIndexToTaskMap.set(comparisonLevel, rowToTask);
11549
+ rowIndexToTasksMap.set(comparisonLevel, rowToTasks);
11550
+ let rowIndex = 0;
11551
+ for (const task of tasks) {
11552
+ if ((task.comparisonLevel ?? 1) !== comparisonLevel)
11553
+ continue;
11554
+ const { id, parent, type } = task;
11555
+ let assignedRowIndex = rowIndex;
11556
+ if (type === "user" || type === "project") {
11557
+ taskToRow.set(id, rowIndex);
11558
+ rowToTask.set(rowIndex, task);
11559
+ rowToTasks.set(rowIndex, [task]);
11560
+ mapGlobalRowIndexToTask.set(globalRowIndex, task);
11561
+ rowIndex++;
11562
+ globalRowIndex++;
11520
11563
  continue;
11521
11564
  }
11565
+ if (isGrouped && parent) {
11566
+ const parentTask = parentMap.get(parent);
11567
+ const parentRowIndex = taskToRow.get(parent);
11568
+ if ((parentTask == null ? void 0 : parentTask.hideChildren) && parentRowIndex !== void 0) {
11569
+ assignedRowIndex = parentRowIndex;
11570
+ } else {
11571
+ assignedRowIndex = rowIndex;
11572
+ rowIndex++;
11573
+ }
11574
+ } else {
11575
+ assignedRowIndex = rowIndex;
11576
+ rowIndex++;
11577
+ }
11578
+ taskToRow.set(id, assignedRowIndex);
11579
+ rowToTask.set(assignedRowIndex, task);
11580
+ const existing = rowToTasks.get(assignedRowIndex) ?? [];
11581
+ rowToTasks.set(assignedRowIndex, [...existing, task]);
11582
+ mapGlobalRowIndexToTask.set(globalRowIndex, task);
11583
+ globalRowIndex++;
11522
11584
  }
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]++;
11529
11585
  }
11530
11586
  return [
11531
11587
  taskToRowIndexMap,
@@ -11826,8 +11882,7 @@
11826
11882
  const groupedIndexes = useGroupedVirtualization(
11827
11883
  ganttTaskContentRef,
11828
11884
  rowIndexToTasksMap,
11829
- fullRowHeight,
11830
- taskToRowIndexMap
11885
+ fullRowHeight
11831
11886
  );
11832
11887
  const optimizedIndexes = useOptimizedList(
11833
11888
  ganttTaskContentRef,
@@ -1,3 +1,3 @@
1
- import type { RowIndexToTasksMap, TaskToRowIndexMap } from "../types/public-types";
1
+ import type { RowIndexToTasksMap } 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, taskToRowIndexMap: TaskToRowIndexMap) => OptimizedListParams;
3
+ export declare const useGroupedVirtualization: (_containerRef: React.RefObject<HTMLElement>, rowIndexToTasksMap: RowIndexToTasksMap, taskHeight: number) => OptimizedListParams;
package/dist/style.css CHANGED
@@ -332,7 +332,7 @@
332
332
  stroke: #e0e0e0;
333
333
  stroke-width: 1.4;
334
334
  }
335
- ._ganttTaskRoot_1lwsd_1 {
335
+ ._ganttTaskRoot_1mu5y_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_1lwsd_1 {
347
+ ._ganttTaskRoot_1mu5y_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_1lwsd_83 {
376
+ ._ganttTaskContent_1mu5y_83 {
377
377
  margin: 0;
378
378
  padding: 0;
379
379
  overflow-x: hidden;
@@ -382,12 +382,12 @@
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_1lwsd_83 {
385
+ ._ganttTaskContent_1mu5y_83 {
386
386
  scrollbar-width: thin;
387
387
  }
388
388
  }
389
389
 
390
- ._wrapper_1lwsd_111 {
390
+ ._wrapper_1mu5y_111 {
391
391
  display: grid;
392
392
  overflow-x: hidden;
393
393
  overflow-y: auto;
@@ -396,6 +396,7 @@
396
396
  list-style: none;
397
397
  outline: none;
398
398
  position: relative;
399
+ height: 600px;
399
400
  }._hoverVisibleWrapper_11ld1_1:hover ._wrapper_11ld1_1 {
400
401
  display: initial;
401
402
  }
@@ -12,6 +12,7 @@ export declare enum ViewMode {
12
12
  Week = "Week",
13
13
  Month = "Month",
14
14
  QuarterYear = "QuarterYear",
15
+ HalfYear = "HalfYear",
15
16
  Year = "Year"
16
17
  }
17
18
  export interface DateSetup {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thepocman/gantt-task-react",
3
- "version": "1.0.20",
3
+ "version": "1.0.23",
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",