@thepocman/gantt-task-react 1.0.30 → 1.0.31
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.
- package/dist/components/task-item/task-item.d.ts +0 -1
- package/dist/gantt-task-react.es.js +29 -18
- package/dist/gantt-task-react.umd.js +29 -18
- package/package.json +1 -1
- package/dist/helpers/get-initial-closed-tasks.d.ts +0 -2
- package/dist/helpers/get-unique-tasks-from-row-index-to-tasks-map.d.ts +0 -2
- package/dist/helpers/sort-visible-tasks.d.ts +0 -2
|
@@ -38,6 +38,5 @@ export type TaskItemProps = {
|
|
|
38
38
|
handleDeleteTasks: (task: TaskOrEmpty[]) => void;
|
|
39
39
|
colorStyles: ColorStyles;
|
|
40
40
|
enableTaskGrouping?: boolean;
|
|
41
|
-
getTaskInitials?: (task: Task) => string;
|
|
42
41
|
};
|
|
43
42
|
export declare const TaskItem: React.NamedExoticComponent<TaskItemProps>;
|
|
@@ -465,14 +465,13 @@ const collectChildren = (arrayRes, mirrorRes, task, childTasksOnLevel, enableTas
|
|
|
465
465
|
if (comparisonLevel === 1) {
|
|
466
466
|
mirrorRes[task.id] = true;
|
|
467
467
|
}
|
|
468
|
-
|
|
469
|
-
if (task.type === "empty" || isTaskGroupingEnabled) {
|
|
468
|
+
if (task.type === "empty") {
|
|
470
469
|
return;
|
|
471
470
|
}
|
|
472
471
|
const childs = childTasksOnLevel.get(task.id);
|
|
473
472
|
if (childs && childs.length > 0) {
|
|
474
473
|
childs.forEach((childTask) => {
|
|
475
|
-
collectChildren(arrayRes, mirrorRes, childTask, childTasksOnLevel
|
|
474
|
+
collectChildren(arrayRes, mirrorRes, childTask, childTasksOnLevel);
|
|
476
475
|
});
|
|
477
476
|
}
|
|
478
477
|
};
|
|
@@ -482,7 +481,7 @@ const collectVisibleTasks = (childTasksMap, rootTasksMap, enableTaskGrouping) =>
|
|
|
482
481
|
for (const [comparisonLevel, rootTasks] of rootTasksMap.entries()) {
|
|
483
482
|
const childTasksOnLevel = childTasksMap.get(comparisonLevel) || /* @__PURE__ */ new Map();
|
|
484
483
|
rootTasks.forEach((task) => {
|
|
485
|
-
collectChildren(arrayRes, mirrorRes, task, childTasksOnLevel
|
|
484
|
+
collectChildren(arrayRes, mirrorRes, task, childTasksOnLevel);
|
|
486
485
|
});
|
|
487
486
|
}
|
|
488
487
|
return [arrayRes, mirrorRes];
|
|
@@ -4579,21 +4578,24 @@ const Calendar = ({
|
|
|
4579
4578
|
)
|
|
4580
4579
|
);
|
|
4581
4580
|
if (!isUnknownDates && (i2 === startColumnIndex || date.getFullYear() !== getDate(i2 - 1).getFullYear())) {
|
|
4582
|
-
const year = date.getFullYear()
|
|
4583
|
-
|
|
4581
|
+
const year = date.getFullYear();
|
|
4582
|
+
console.log("Fulll year :>> ", year);
|
|
4583
|
+
const topValue = year.toString();
|
|
4584
|
+
const startHalfYearIndex = i2 - date.getMonth();
|
|
4585
|
+
const centerX = additionalLeftSpace + columnWidth * i2 + columnWidth;
|
|
4584
4586
|
topValues2.push(
|
|
4585
4587
|
/* @__PURE__ */ jsx(
|
|
4586
4588
|
TopPartOfCalendar,
|
|
4587
4589
|
{
|
|
4588
|
-
value:
|
|
4589
|
-
x1Line: additionalLeftSpace + columnWidth *
|
|
4590
|
+
value: topValue,
|
|
4591
|
+
x1Line: additionalLeftSpace + columnWidth * startHalfYearIndex,
|
|
4590
4592
|
y1Line: 0,
|
|
4591
4593
|
y2Line: topDefaultHeight,
|
|
4592
|
-
xText:
|
|
4594
|
+
xText: centerX,
|
|
4593
4595
|
yText: topDefaultHeight * 0.9,
|
|
4594
4596
|
colors
|
|
4595
4597
|
},
|
|
4596
|
-
year
|
|
4598
|
+
`year-${year}`
|
|
4597
4599
|
)
|
|
4598
4600
|
);
|
|
4599
4601
|
}
|
|
@@ -4812,6 +4814,7 @@ const Calendar = ({
|
|
|
4812
4814
|
);
|
|
4813
4815
|
const dayOfMonth = date.getDate();
|
|
4814
4816
|
const prevDate = getDate(i2 - 1);
|
|
4817
|
+
console.log("testing center :>> ", additionalLeftSpace + columnWidth * i2 + ticks * columnWidth * 0.5);
|
|
4815
4818
|
if (!isUnknownDates && dayOfMonth !== prevDate.getDate()) {
|
|
4816
4819
|
const topValue = renderTopHeaderByDate(date);
|
|
4817
4820
|
topValues2.push(
|
|
@@ -4936,7 +4939,9 @@ const shouldDrawVerticalDivider = (currentDate, previousDate, viewMode, isUnknow
|
|
|
4936
4939
|
case ViewMode.Year:
|
|
4937
4940
|
return currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4938
4941
|
case ViewMode.HalfYear:
|
|
4939
|
-
|
|
4942
|
+
const currentHalf = Math.ceil((currentDate.getMonth() + 1) / 6);
|
|
4943
|
+
const previousHalf = Math.ceil((previousDate.getMonth() + 1) / 6);
|
|
4944
|
+
return currentHalf !== previousHalf || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4940
4945
|
case ViewMode.QuarterYear:
|
|
4941
4946
|
return Math.ceil((currentDate.getMonth() + 1) / 3) !== Math.ceil((previousDate.getMonth() + 1) / 3) || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4942
4947
|
case ViewMode.Month:
|
|
@@ -5008,6 +5013,7 @@ const GridBodyInner = ({
|
|
|
5008
5013
|
startColumnIndex
|
|
5009
5014
|
)) {
|
|
5010
5015
|
const x3 = additionalLeftSpace + columnWidth * i2;
|
|
5016
|
+
console.log("drawing divider at x:", x3, "for index:", i2, "date:", currentDate);
|
|
5011
5017
|
dividers.push(
|
|
5012
5018
|
/* @__PURE__ */ jsx(
|
|
5013
5019
|
"line",
|
|
@@ -6373,6 +6379,7 @@ const TaskItemInner = (props) => {
|
|
|
6373
6379
|
rtl,
|
|
6374
6380
|
selectTaskOnMouseDown,
|
|
6375
6381
|
setTooltipTask,
|
|
6382
|
+
enableTaskGrouping,
|
|
6376
6383
|
task,
|
|
6377
6384
|
task: { styles: taskStyles },
|
|
6378
6385
|
taskHalfHeight,
|
|
@@ -6600,7 +6607,7 @@ const TaskItemInner = (props) => {
|
|
|
6600
6607
|
y: taskYOffset + taskHeight * 0.5,
|
|
6601
6608
|
className: isTextInside ? style.barLabel : style.barLabel && style.barLabelOutside,
|
|
6602
6609
|
ref: textRef,
|
|
6603
|
-
children: isTextInside ? task.name : ""
|
|
6610
|
+
children: enableTaskGrouping ? isTextInside ? task.name : "" : task.name
|
|
6604
6611
|
}
|
|
6605
6612
|
),
|
|
6606
6613
|
(outOfParentWarnings || hasDependencyWarning) && /* @__PURE__ */ jsx(
|
|
@@ -6802,11 +6809,7 @@ const TaskGanttContent = ({
|
|
|
6802
6809
|
fixEndPosition,
|
|
6803
6810
|
handleDeleteTasks,
|
|
6804
6811
|
colorStyles,
|
|
6805
|
-
enableTaskGrouping
|
|
6806
|
-
getTaskInitials: (task2) => {
|
|
6807
|
-
var _a2;
|
|
6808
|
-
return ((_a2 = task2.name) == null ? void 0 : _a2.split(" ").map((word) => word[0]).join("").toUpperCase()) ?? "";
|
|
6809
|
-
}
|
|
6812
|
+
enableTaskGrouping
|
|
6810
6813
|
}
|
|
6811
6814
|
)
|
|
6812
6815
|
},
|
|
@@ -10477,6 +10480,14 @@ const defaultRoundEndDate = (date, viewMode) => {
|
|
|
10477
10480
|
}
|
|
10478
10481
|
return subQuarters(end, 1);
|
|
10479
10482
|
}
|
|
10483
|
+
case ViewMode.HalfYear: {
|
|
10484
|
+
const month = date.getMonth();
|
|
10485
|
+
if (month < 6) {
|
|
10486
|
+
return endOfHour(new Date(date.getFullYear(), 5, 1));
|
|
10487
|
+
} else {
|
|
10488
|
+
return endOfYear(date);
|
|
10489
|
+
}
|
|
10490
|
+
}
|
|
10480
10491
|
case ViewMode.Year: {
|
|
10481
10492
|
const end = endOfYear(date);
|
|
10482
10493
|
const diff = differenceInMonths(end, date);
|
|
@@ -11871,7 +11882,7 @@ const Gantt = ({
|
|
|
11871
11882
|
[sortedTasks]
|
|
11872
11883
|
);
|
|
11873
11884
|
const [visibleTasks, visibleTasksMirror] = useMemo(
|
|
11874
|
-
() => collectVisibleTasks(childTasksMap, rootTasksMap
|
|
11885
|
+
() => collectVisibleTasks(childTasksMap, rootTasksMap),
|
|
11875
11886
|
[childTasksMap, rootTasksMap]
|
|
11876
11887
|
);
|
|
11877
11888
|
const tasksMap = useMemo(() => getTasksMap(tasks), [tasks]);
|
|
@@ -478,14 +478,13 @@
|
|
|
478
478
|
if (comparisonLevel === 1) {
|
|
479
479
|
mirrorRes[task.id] = true;
|
|
480
480
|
}
|
|
481
|
-
|
|
482
|
-
if (task.type === "empty" || isTaskGroupingEnabled) {
|
|
481
|
+
if (task.type === "empty") {
|
|
483
482
|
return;
|
|
484
483
|
}
|
|
485
484
|
const childs = childTasksOnLevel.get(task.id);
|
|
486
485
|
if (childs && childs.length > 0) {
|
|
487
486
|
childs.forEach((childTask) => {
|
|
488
|
-
collectChildren(arrayRes, mirrorRes, childTask, childTasksOnLevel
|
|
487
|
+
collectChildren(arrayRes, mirrorRes, childTask, childTasksOnLevel);
|
|
489
488
|
});
|
|
490
489
|
}
|
|
491
490
|
};
|
|
@@ -495,7 +494,7 @@
|
|
|
495
494
|
for (const [comparisonLevel, rootTasks] of rootTasksMap.entries()) {
|
|
496
495
|
const childTasksOnLevel = childTasksMap.get(comparisonLevel) || /* @__PURE__ */ new Map();
|
|
497
496
|
rootTasks.forEach((task) => {
|
|
498
|
-
collectChildren(arrayRes, mirrorRes, task, childTasksOnLevel
|
|
497
|
+
collectChildren(arrayRes, mirrorRes, task, childTasksOnLevel);
|
|
499
498
|
});
|
|
500
499
|
}
|
|
501
500
|
return [arrayRes, mirrorRes];
|
|
@@ -4592,21 +4591,24 @@
|
|
|
4592
4591
|
)
|
|
4593
4592
|
);
|
|
4594
4593
|
if (!isUnknownDates && (i === startColumnIndex || date.getFullYear() !== getDate(i - 1).getFullYear())) {
|
|
4595
|
-
const year = date.getFullYear()
|
|
4596
|
-
|
|
4594
|
+
const year = date.getFullYear();
|
|
4595
|
+
console.log("Fulll year :>> ", year);
|
|
4596
|
+
const topValue = year.toString();
|
|
4597
|
+
const startHalfYearIndex = i - date.getMonth();
|
|
4598
|
+
const centerX = additionalLeftSpace + columnWidth * i + columnWidth;
|
|
4597
4599
|
topValues2.push(
|
|
4598
4600
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4599
4601
|
TopPartOfCalendar,
|
|
4600
4602
|
{
|
|
4601
|
-
value:
|
|
4602
|
-
x1Line: additionalLeftSpace + columnWidth *
|
|
4603
|
+
value: topValue,
|
|
4604
|
+
x1Line: additionalLeftSpace + columnWidth * startHalfYearIndex,
|
|
4603
4605
|
y1Line: 0,
|
|
4604
4606
|
y2Line: topDefaultHeight,
|
|
4605
|
-
xText:
|
|
4607
|
+
xText: centerX,
|
|
4606
4608
|
yText: topDefaultHeight * 0.9,
|
|
4607
4609
|
colors
|
|
4608
4610
|
},
|
|
4609
|
-
year
|
|
4611
|
+
`year-${year}`
|
|
4610
4612
|
)
|
|
4611
4613
|
);
|
|
4612
4614
|
}
|
|
@@ -4825,6 +4827,7 @@
|
|
|
4825
4827
|
);
|
|
4826
4828
|
const dayOfMonth = date.getDate();
|
|
4827
4829
|
const prevDate = getDate(i - 1);
|
|
4830
|
+
console.log("testing center :>> ", additionalLeftSpace + columnWidth * i + ticks * columnWidth * 0.5);
|
|
4828
4831
|
if (!isUnknownDates && dayOfMonth !== prevDate.getDate()) {
|
|
4829
4832
|
const topValue = renderTopHeaderByDate(date);
|
|
4830
4833
|
topValues2.push(
|
|
@@ -4949,7 +4952,9 @@
|
|
|
4949
4952
|
case ViewMode.Year:
|
|
4950
4953
|
return currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4951
4954
|
case ViewMode.HalfYear:
|
|
4952
|
-
|
|
4955
|
+
const currentHalf = Math.ceil((currentDate.getMonth() + 1) / 6);
|
|
4956
|
+
const previousHalf = Math.ceil((previousDate.getMonth() + 1) / 6);
|
|
4957
|
+
return currentHalf !== previousHalf || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4953
4958
|
case ViewMode.QuarterYear:
|
|
4954
4959
|
return Math.ceil((currentDate.getMonth() + 1) / 3) !== Math.ceil((previousDate.getMonth() + 1) / 3) || currentDate.getFullYear() !== previousDate.getFullYear();
|
|
4955
4960
|
case ViewMode.Month:
|
|
@@ -5021,6 +5026,7 @@
|
|
|
5021
5026
|
startColumnIndex
|
|
5022
5027
|
)) {
|
|
5023
5028
|
const x2 = additionalLeftSpace + columnWidth * i;
|
|
5029
|
+
console.log("drawing divider at x:", x2, "for index:", i, "date:", currentDate);
|
|
5024
5030
|
dividers.push(
|
|
5025
5031
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5026
5032
|
"line",
|
|
@@ -6386,6 +6392,7 @@
|
|
|
6386
6392
|
rtl,
|
|
6387
6393
|
selectTaskOnMouseDown,
|
|
6388
6394
|
setTooltipTask,
|
|
6395
|
+
enableTaskGrouping,
|
|
6389
6396
|
task,
|
|
6390
6397
|
task: { styles: taskStyles },
|
|
6391
6398
|
taskHalfHeight,
|
|
@@ -6613,7 +6620,7 @@
|
|
|
6613
6620
|
y: taskYOffset + taskHeight * 0.5,
|
|
6614
6621
|
className: isTextInside ? style.barLabel : style.barLabel && style.barLabelOutside,
|
|
6615
6622
|
ref: textRef,
|
|
6616
|
-
children: isTextInside ? task.name : ""
|
|
6623
|
+
children: enableTaskGrouping ? isTextInside ? task.name : "" : task.name
|
|
6617
6624
|
}
|
|
6618
6625
|
),
|
|
6619
6626
|
(outOfParentWarnings || hasDependencyWarning) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6815,11 +6822,7 @@
|
|
|
6815
6822
|
fixEndPosition,
|
|
6816
6823
|
handleDeleteTasks,
|
|
6817
6824
|
colorStyles,
|
|
6818
|
-
enableTaskGrouping
|
|
6819
|
-
getTaskInitials: (task2) => {
|
|
6820
|
-
var _a2;
|
|
6821
|
-
return ((_a2 = task2.name) == null ? void 0 : _a2.split(" ").map((word) => word[0]).join("").toUpperCase()) ?? "";
|
|
6822
|
-
}
|
|
6825
|
+
enableTaskGrouping
|
|
6823
6826
|
}
|
|
6824
6827
|
)
|
|
6825
6828
|
},
|
|
@@ -10490,6 +10493,14 @@
|
|
|
10490
10493
|
}
|
|
10491
10494
|
return subQuarters(end, 1);
|
|
10492
10495
|
}
|
|
10496
|
+
case ViewMode.HalfYear: {
|
|
10497
|
+
const month = date.getMonth();
|
|
10498
|
+
if (month < 6) {
|
|
10499
|
+
return endOfHour(new Date(date.getFullYear(), 5, 1));
|
|
10500
|
+
} else {
|
|
10501
|
+
return endOfYear(date);
|
|
10502
|
+
}
|
|
10503
|
+
}
|
|
10493
10504
|
case ViewMode.Year: {
|
|
10494
10505
|
const end = endOfYear(date);
|
|
10495
10506
|
const diff = differenceInMonths(end, date);
|
|
@@ -11884,7 +11895,7 @@
|
|
|
11884
11895
|
[sortedTasks]
|
|
11885
11896
|
);
|
|
11886
11897
|
const [visibleTasks, visibleTasksMirror] = React.useMemo(
|
|
11887
|
-
() => collectVisibleTasks(childTasksMap, rootTasksMap
|
|
11898
|
+
() => collectVisibleTasks(childTasksMap, rootTasksMap),
|
|
11888
11899
|
[childTasksMap, rootTasksMap]
|
|
11889
11900
|
);
|
|
11890
11901
|
const tasksMap = React.useMemo(() => getTasksMap(tasks), [tasks]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thepocman/gantt-task-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
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",
|