@thepocman/gantt-task-react 1.0.19 → 1.0.22
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/calendar/calendar.d.ts +1 -1
- package/dist/components/task-list/task-list.d.ts +3 -1
- package/dist/gantt-task-react.es.js +127 -52
- package/dist/gantt-task-react.umd.js +127 -52
- package/dist/helpers/get-unique-tasks-from-row-index-to-tasks-map.d.ts +2 -0
- package/dist/style.css +7 -6
- package/dist/types/public-types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { DateSetup,
|
|
2
|
+
import { ColorStyles, DateSetup, Distances, RenderBottomHeader, RenderTopHeader } from "../../types/public-types";
|
|
3
3
|
export type CalendarProps = {
|
|
4
4
|
additionalLeftSpace: number;
|
|
5
5
|
dateSetup: DateSetup;
|
|
@@ -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
|
-
|
|
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);
|
|
@@ -675,6 +676,7 @@ var ViewMode = /* @__PURE__ */ ((ViewMode2) => {
|
|
|
675
676
|
ViewMode2["Week"] = "Week";
|
|
676
677
|
ViewMode2["Month"] = "Month";
|
|
677
678
|
ViewMode2["QuarterYear"] = "QuarterYear";
|
|
679
|
+
ViewMode2["HalfYear"] = "HalfYear";
|
|
678
680
|
ViewMode2["Year"] = "Year";
|
|
679
681
|
return ViewMode2;
|
|
680
682
|
})(ViewMode || {});
|
|
@@ -857,6 +859,11 @@ const getDatesDiff = (dateFrom, dateTo, viewMode) => {
|
|
|
857
859
|
throw new Error("Unknown view mode");
|
|
858
860
|
}
|
|
859
861
|
};
|
|
862
|
+
const startOfHalfYear = (date) => {
|
|
863
|
+
const d4 = new Date(date);
|
|
864
|
+
const startMonth = d4.getMonth() < 6 ? 0 : 6;
|
|
865
|
+
return new Date(d4.getFullYear(), startMonth, 1);
|
|
866
|
+
};
|
|
860
867
|
const ganttDateRange = (tasks, viewMode, preStepsCount) => {
|
|
861
868
|
let minTaskDate = null;
|
|
862
869
|
let maxTaskDate = null;
|
|
@@ -882,6 +889,12 @@ const ganttDateRange = (tasks, viewMode, preStepsCount) => {
|
|
|
882
889
|
newEndDate = addYears(maxTaskDate, 1);
|
|
883
890
|
newEndDate = startOfYear(newEndDate);
|
|
884
891
|
break;
|
|
892
|
+
case ViewMode.HalfYear:
|
|
893
|
+
newStartDate = subMonths(minTaskDate, preStepsCount * 6);
|
|
894
|
+
newStartDate = startOfHalfYear(newStartDate);
|
|
895
|
+
newEndDate = addMonths(maxTaskDate, 6);
|
|
896
|
+
newEndDate = startOfHalfYear(addMonths(newEndDate, 6));
|
|
897
|
+
break;
|
|
885
898
|
case ViewMode.QuarterYear:
|
|
886
899
|
newStartDate = subMonths(minTaskDate, preStepsCount * 3);
|
|
887
900
|
newStartDate = startOfQuarter(newStartDate);
|
|
@@ -1254,7 +1267,7 @@ const getCriticalPath = (rootTasksMap, childTasksMap, tasksMap, dependencyMargin
|
|
|
1254
1267
|
return res;
|
|
1255
1268
|
};
|
|
1256
1269
|
function isRealTask(task) {
|
|
1257
|
-
return task.type === "task" || task.type === "milestone" || task.type === "project" || task.type === "user";
|
|
1270
|
+
return task.type === "task" || task.type === "milestone" || task.type === "project" || task.type === "vacation" || task.type === "user";
|
|
1258
1271
|
}
|
|
1259
1272
|
const getMapTaskToCoordinatesOnLevel = (task, mapTaskToCoordinates) => {
|
|
1260
1273
|
const {
|
|
@@ -4189,6 +4202,7 @@ const TaskListTableDefaultInner = ({
|
|
|
4189
4202
|
);
|
|
4190
4203
|
}
|
|
4191
4204
|
} else {
|
|
4205
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4192
4206
|
for (let rowIndex = start; rowIndex <= end; rowIndex++) {
|
|
4193
4207
|
const taskList = (_a = rowIndexToTasksMap.get(1)) == null ? void 0 : _a.get(rowIndex);
|
|
4194
4208
|
if (!taskList)
|
|
@@ -4197,14 +4211,15 @@ const TaskListTableDefaultInner = ({
|
|
|
4197
4211
|
const parent = tasks.find((t2) => t2.id === task.parent);
|
|
4198
4212
|
if (parent == null ? void 0 : parent.hideChildren)
|
|
4199
4213
|
continue;
|
|
4214
|
+
if (seen.has(task.id))
|
|
4215
|
+
continue;
|
|
4216
|
+
seen.add(task.id);
|
|
4200
4217
|
const { id, comparisonLevel } = task;
|
|
4201
4218
|
let depth = 0;
|
|
4202
4219
|
let indexStr = "";
|
|
4203
|
-
console.log("comparisonLevel", comparisonLevel);
|
|
4204
4220
|
const levelMap = mapTaskToNestedIndex.get(comparisonLevel);
|
|
4205
4221
|
const taskIndex = levelMap == null ? void 0 : levelMap.get(id);
|
|
4206
4222
|
if (taskIndex) {
|
|
4207
|
-
console.log("object :>> ", [depth, indexStr] = taskIndex);
|
|
4208
4223
|
[depth, indexStr] = taskIndex;
|
|
4209
4224
|
}
|
|
4210
4225
|
renderList.push(
|
|
@@ -4280,50 +4295,6 @@ const TaskListTableDefaultInner = ({
|
|
|
4280
4295
|
);
|
|
4281
4296
|
};
|
|
4282
4297
|
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
4298
|
const defaultRenderBottomHeader = (date, viewMode, dateSetup, index2, isUnknownDates) => {
|
|
4328
4299
|
if (isUnknownDates) {
|
|
4329
4300
|
const {
|
|
@@ -4342,6 +4313,9 @@ const defaultRenderBottomHeader = (date, viewMode, dateSetup, index2, isUnknownD
|
|
|
4342
4313
|
case ViewMode.Year:
|
|
4343
4314
|
value = formatDistance3("xYears", offsetFromStart);
|
|
4344
4315
|
break;
|
|
4316
|
+
case ViewMode.HalfYear:
|
|
4317
|
+
value = formatDistance3("xMonths", offsetFromStart * 6);
|
|
4318
|
+
break;
|
|
4345
4319
|
case ViewMode.Month:
|
|
4346
4320
|
value = formatDistance3("xMonths", offsetFromStart);
|
|
4347
4321
|
break;
|
|
@@ -4375,6 +4349,10 @@ const defaultRenderBottomHeader = (date, viewMode, dateSetup, index2, isUnknownD
|
|
|
4375
4349
|
switch (viewMode) {
|
|
4376
4350
|
case ViewMode.Year:
|
|
4377
4351
|
return date.getFullYear();
|
|
4352
|
+
case ViewMode.HalfYear: {
|
|
4353
|
+
const half = Math.ceil((date.getMonth() + 1) / 6);
|
|
4354
|
+
return `H${half}`;
|
|
4355
|
+
}
|
|
4378
4356
|
case ViewMode.Month:
|
|
4379
4357
|
try {
|
|
4380
4358
|
return format(date, dateSetup.dateFormats.monthBottomHeaderFormat, {
|
|
@@ -4430,10 +4408,16 @@ const getQuarterText = (date) => {
|
|
|
4430
4408
|
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
4431
4409
|
return `Q${quarter}`;
|
|
4432
4410
|
};
|
|
4411
|
+
const getHalfYearText = (date) => {
|
|
4412
|
+
const halfYear = Math.ceil((date.getMonth() + 1) / 6);
|
|
4413
|
+
return `H${halfYear}`;
|
|
4414
|
+
};
|
|
4433
4415
|
const defaultRenderTopHeader = (date, viewMode, dateSetup) => {
|
|
4434
4416
|
switch (viewMode) {
|
|
4435
4417
|
case ViewMode.Year:
|
|
4436
4418
|
return date.getFullYear().toString();
|
|
4419
|
+
case ViewMode.HalfYear:
|
|
4420
|
+
return `${getHalfYearText(date)} ${date.getFullYear()}`;
|
|
4437
4421
|
case ViewMode.QuarterYear:
|
|
4438
4422
|
return `${getQuarterText(date)} ${date.getFullYear()}`;
|
|
4439
4423
|
case ViewMode.Month:
|
|
@@ -4453,6 +4437,50 @@ const defaultRenderTopHeader = (date, viewMode, dateSetup) => {
|
|
|
4453
4437
|
throw new Error("Unknown viewMode");
|
|
4454
4438
|
}
|
|
4455
4439
|
};
|
|
4440
|
+
const calendarMain = "_calendarMain_lemhx_1";
|
|
4441
|
+
const calendarBottomText = "_calendarBottomText_lemhx_13";
|
|
4442
|
+
const calendarTopTick = "_calendarTopTick_lemhx_35";
|
|
4443
|
+
const calendarTopText = "_calendarTopText_lemhx_43";
|
|
4444
|
+
const calendarHeader = "_calendarHeader_lemhx_65";
|
|
4445
|
+
const styles$a = {
|
|
4446
|
+
calendarMain,
|
|
4447
|
+
calendarBottomText,
|
|
4448
|
+
calendarTopTick,
|
|
4449
|
+
calendarTopText,
|
|
4450
|
+
calendarHeader
|
|
4451
|
+
};
|
|
4452
|
+
const TopPartOfCalendar = ({
|
|
4453
|
+
value,
|
|
4454
|
+
x1Line,
|
|
4455
|
+
y1Line,
|
|
4456
|
+
y2Line,
|
|
4457
|
+
xText,
|
|
4458
|
+
yText,
|
|
4459
|
+
colors
|
|
4460
|
+
}) => {
|
|
4461
|
+
return /* @__PURE__ */ jsxs("g", { className: "calendarTop", children: [
|
|
4462
|
+
/* @__PURE__ */ jsx(
|
|
4463
|
+
"line",
|
|
4464
|
+
{
|
|
4465
|
+
x1: x1Line,
|
|
4466
|
+
y1: y1Line,
|
|
4467
|
+
x2: x1Line,
|
|
4468
|
+
y2: y2Line,
|
|
4469
|
+
className: styles$a.calendarTopTick
|
|
4470
|
+
}
|
|
4471
|
+
),
|
|
4472
|
+
value !== null && /* @__PURE__ */ jsx(
|
|
4473
|
+
"text",
|
|
4474
|
+
{
|
|
4475
|
+
y: yText,
|
|
4476
|
+
x: xText,
|
|
4477
|
+
className: styles$a.calendarTopText,
|
|
4478
|
+
style: { fill: colors.barLabelColor },
|
|
4479
|
+
children: value
|
|
4480
|
+
}
|
|
4481
|
+
)
|
|
4482
|
+
] });
|
|
4483
|
+
};
|
|
4456
4484
|
const Calendar = ({
|
|
4457
4485
|
additionalLeftSpace,
|
|
4458
4486
|
dateSetup,
|
|
@@ -4523,6 +4551,48 @@ const Calendar = ({
|
|
|
4523
4551
|
}
|
|
4524
4552
|
return [topValues2, bottomValues2];
|
|
4525
4553
|
};
|
|
4554
|
+
const getCalenderValuesForHalfYear = () => {
|
|
4555
|
+
const topValues2 = [];
|
|
4556
|
+
const bottomValues2 = [];
|
|
4557
|
+
const topDefaultHeight = headerHeight * 0.5;
|
|
4558
|
+
for (let i2 = startColumnIndex; i2 <= endColumnIndex; i2++) {
|
|
4559
|
+
const date = getDate(i2);
|
|
4560
|
+
const halfYear = "H" + Math.ceil((date.getMonth() + 1) / 6);
|
|
4561
|
+
bottomValues2.push(
|
|
4562
|
+
/* @__PURE__ */ jsx(
|
|
4563
|
+
"text",
|
|
4564
|
+
{
|
|
4565
|
+
y: headerHeight * 0.8,
|
|
4566
|
+
x: additionalLeftSpace + columnWidth * i2 + columnWidth * 0.5,
|
|
4567
|
+
className: styles$a.calendarBottomText,
|
|
4568
|
+
style: { fill: colors.barLabelColor },
|
|
4569
|
+
children: halfYear
|
|
4570
|
+
},
|
|
4571
|
+
`${halfYear}-${date.getFullYear()}-${i2}`
|
|
4572
|
+
)
|
|
4573
|
+
);
|
|
4574
|
+
if (!isUnknownDates && (i2 === startColumnIndex || date.getFullYear() !== getDate(i2 - 1).getFullYear())) {
|
|
4575
|
+
const year = date.getFullYear().toString();
|
|
4576
|
+
const startHalf = Math.floor(i2 / 6) * 6;
|
|
4577
|
+
topValues2.push(
|
|
4578
|
+
/* @__PURE__ */ jsx(
|
|
4579
|
+
TopPartOfCalendar,
|
|
4580
|
+
{
|
|
4581
|
+
value: year,
|
|
4582
|
+
x1Line: additionalLeftSpace + columnWidth * startHalf,
|
|
4583
|
+
y1Line: 0,
|
|
4584
|
+
y2Line: topDefaultHeight,
|
|
4585
|
+
xText: additionalLeftSpace + columnWidth * (startHalf + 3),
|
|
4586
|
+
yText: topDefaultHeight * 0.9,
|
|
4587
|
+
colors
|
|
4588
|
+
},
|
|
4589
|
+
year
|
|
4590
|
+
)
|
|
4591
|
+
);
|
|
4592
|
+
}
|
|
4593
|
+
}
|
|
4594
|
+
return [topValues2, bottomValues2];
|
|
4595
|
+
};
|
|
4526
4596
|
const getCalendarValuesForQuarterYear = () => {
|
|
4527
4597
|
const topValues2 = [];
|
|
4528
4598
|
const bottomValues2 = [];
|
|
@@ -4530,6 +4600,7 @@ const Calendar = ({
|
|
|
4530
4600
|
for (let i2 = startColumnIndex; i2 <= endColumnIndex; i2++) {
|
|
4531
4601
|
const date = getDate(i2);
|
|
4532
4602
|
const quarter = "Q" + Math.ceil((date.getMonth() + 1) / 3);
|
|
4603
|
+
console.log("quarter :>> ", quarter);
|
|
4533
4604
|
bottomValues2.push(
|
|
4534
4605
|
/* @__PURE__ */ jsx(
|
|
4535
4606
|
"text",
|
|
@@ -4809,6 +4880,9 @@ const Calendar = ({
|
|
|
4809
4880
|
case ViewMode.Year:
|
|
4810
4881
|
[topValues, bottomValues] = getCalendarValuesForYear();
|
|
4811
4882
|
break;
|
|
4883
|
+
case ViewMode.HalfYear:
|
|
4884
|
+
[topValues, bottomValues] = getCalenderValuesForHalfYear();
|
|
4885
|
+
break;
|
|
4812
4886
|
case ViewMode.QuarterYear:
|
|
4813
4887
|
[topValues, bottomValues] = getCalendarValuesForQuarterYear();
|
|
4814
4888
|
break;
|
|
@@ -5083,9 +5157,9 @@ const Grid = (props) => {
|
|
|
5083
5157
|
/* @__PURE__ */ jsx(GridBody, { ...props })
|
|
5084
5158
|
] });
|
|
5085
5159
|
};
|
|
5086
|
-
const ganttTaskRoot = "
|
|
5087
|
-
const ganttTaskContent = "
|
|
5088
|
-
const wrapper$2 = "
|
|
5160
|
+
const ganttTaskRoot = "_ganttTaskRoot_1mu5y_1";
|
|
5161
|
+
const ganttTaskContent = "_ganttTaskContent_1mu5y_83";
|
|
5162
|
+
const wrapper$2 = "_wrapper_1mu5y_111";
|
|
5089
5163
|
const styles$9 = {
|
|
5090
5164
|
ganttTaskRoot,
|
|
5091
5165
|
ganttTaskContent,
|
|
@@ -6558,7 +6632,6 @@ const TaskGanttContent = ({
|
|
|
6558
6632
|
if (task)
|
|
6559
6633
|
tasksAtRow.push(task);
|
|
6560
6634
|
}
|
|
6561
|
-
console.log("tasksAtRow", tasksAtRow);
|
|
6562
6635
|
for (const task of tasksAtRow) {
|
|
6563
6636
|
const comparisonLevel = task.comparisonLevel ?? 1;
|
|
6564
6637
|
const { id: taskId } = task;
|
|
@@ -6823,6 +6896,7 @@ const TaskGanttInner = (props) => {
|
|
|
6823
6896
|
height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
|
|
6824
6897
|
width: (ganttTaskRootRef == null ? void 0 : ganttTaskRootRef.current) ? ganttTaskRootRef.current.clientWidth + ganttTaskRootRef.current.scrollLeft : fullSvgWidth
|
|
6825
6898
|
};
|
|
6899
|
+
console.log("containerStyle:>> ", containerStyle);
|
|
6826
6900
|
const gridStyle = useMemo(
|
|
6827
6901
|
() => ({
|
|
6828
6902
|
height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
|
|
@@ -13055,6 +13129,7 @@ const Gantt = ({
|
|
|
13055
13129
|
TaskListTable,
|
|
13056
13130
|
enableTaskGrouping,
|
|
13057
13131
|
rowIndexToTasksMap,
|
|
13132
|
+
taskToRowIndexMap,
|
|
13058
13133
|
canMoveTasks,
|
|
13059
13134
|
canResizeColumns,
|
|
13060
13135
|
childTasksMap,
|
|
@@ -478,7 +478,8 @@
|
|
|
478
478
|
if (comparisonLevel === 1) {
|
|
479
479
|
mirrorRes[task.id] = true;
|
|
480
480
|
}
|
|
481
|
-
|
|
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);
|
|
@@ -688,6 +689,7 @@
|
|
|
688
689
|
ViewMode2["Week"] = "Week";
|
|
689
690
|
ViewMode2["Month"] = "Month";
|
|
690
691
|
ViewMode2["QuarterYear"] = "QuarterYear";
|
|
692
|
+
ViewMode2["HalfYear"] = "HalfYear";
|
|
691
693
|
ViewMode2["Year"] = "Year";
|
|
692
694
|
return ViewMode2;
|
|
693
695
|
})(ViewMode || {});
|
|
@@ -870,6 +872,11 @@
|
|
|
870
872
|
throw new Error("Unknown view mode");
|
|
871
873
|
}
|
|
872
874
|
};
|
|
875
|
+
const startOfHalfYear = (date) => {
|
|
876
|
+
const d2 = new Date(date);
|
|
877
|
+
const startMonth = d2.getMonth() < 6 ? 0 : 6;
|
|
878
|
+
return new Date(d2.getFullYear(), startMonth, 1);
|
|
879
|
+
};
|
|
873
880
|
const ganttDateRange = (tasks, viewMode, preStepsCount) => {
|
|
874
881
|
let minTaskDate = null;
|
|
875
882
|
let maxTaskDate = null;
|
|
@@ -895,6 +902,12 @@
|
|
|
895
902
|
newEndDate = addYears(maxTaskDate, 1);
|
|
896
903
|
newEndDate = startOfYear(newEndDate);
|
|
897
904
|
break;
|
|
905
|
+
case ViewMode.HalfYear:
|
|
906
|
+
newStartDate = subMonths(minTaskDate, preStepsCount * 6);
|
|
907
|
+
newStartDate = startOfHalfYear(newStartDate);
|
|
908
|
+
newEndDate = addMonths(maxTaskDate, 6);
|
|
909
|
+
newEndDate = startOfHalfYear(addMonths(newEndDate, 6));
|
|
910
|
+
break;
|
|
898
911
|
case ViewMode.QuarterYear:
|
|
899
912
|
newStartDate = subMonths(minTaskDate, preStepsCount * 3);
|
|
900
913
|
newStartDate = startOfQuarter(newStartDate);
|
|
@@ -1267,7 +1280,7 @@
|
|
|
1267
1280
|
return res;
|
|
1268
1281
|
};
|
|
1269
1282
|
function isRealTask(task) {
|
|
1270
|
-
return task.type === "task" || task.type === "milestone" || task.type === "project" || task.type === "user";
|
|
1283
|
+
return task.type === "task" || task.type === "milestone" || task.type === "project" || task.type === "vacation" || task.type === "user";
|
|
1271
1284
|
}
|
|
1272
1285
|
const getMapTaskToCoordinatesOnLevel = (task, mapTaskToCoordinates) => {
|
|
1273
1286
|
const {
|
|
@@ -4202,6 +4215,7 @@
|
|
|
4202
4215
|
);
|
|
4203
4216
|
}
|
|
4204
4217
|
} else {
|
|
4218
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4205
4219
|
for (let rowIndex = start; rowIndex <= end; rowIndex++) {
|
|
4206
4220
|
const taskList = (_a = rowIndexToTasksMap.get(1)) == null ? void 0 : _a.get(rowIndex);
|
|
4207
4221
|
if (!taskList)
|
|
@@ -4210,14 +4224,15 @@
|
|
|
4210
4224
|
const parent = tasks.find((t) => t.id === task.parent);
|
|
4211
4225
|
if (parent == null ? void 0 : parent.hideChildren)
|
|
4212
4226
|
continue;
|
|
4227
|
+
if (seen.has(task.id))
|
|
4228
|
+
continue;
|
|
4229
|
+
seen.add(task.id);
|
|
4213
4230
|
const { id, comparisonLevel } = task;
|
|
4214
4231
|
let depth = 0;
|
|
4215
4232
|
let indexStr = "";
|
|
4216
|
-
console.log("comparisonLevel", comparisonLevel);
|
|
4217
4233
|
const levelMap = mapTaskToNestedIndex.get(comparisonLevel);
|
|
4218
4234
|
const taskIndex = levelMap == null ? void 0 : levelMap.get(id);
|
|
4219
4235
|
if (taskIndex) {
|
|
4220
|
-
console.log("object :>> ", [depth, indexStr] = taskIndex);
|
|
4221
4236
|
[depth, indexStr] = taskIndex;
|
|
4222
4237
|
}
|
|
4223
4238
|
renderList.push(
|
|
@@ -4293,50 +4308,6 @@
|
|
|
4293
4308
|
);
|
|
4294
4309
|
};
|
|
4295
4310
|
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
4311
|
const defaultRenderBottomHeader = (date, viewMode, dateSetup, index2, isUnknownDates) => {
|
|
4341
4312
|
if (isUnknownDates) {
|
|
4342
4313
|
const {
|
|
@@ -4355,6 +4326,9 @@
|
|
|
4355
4326
|
case ViewMode.Year:
|
|
4356
4327
|
value = formatDistance2("xYears", offsetFromStart);
|
|
4357
4328
|
break;
|
|
4329
|
+
case ViewMode.HalfYear:
|
|
4330
|
+
value = formatDistance2("xMonths", offsetFromStart * 6);
|
|
4331
|
+
break;
|
|
4358
4332
|
case ViewMode.Month:
|
|
4359
4333
|
value = formatDistance2("xMonths", offsetFromStart);
|
|
4360
4334
|
break;
|
|
@@ -4388,6 +4362,10 @@
|
|
|
4388
4362
|
switch (viewMode) {
|
|
4389
4363
|
case ViewMode.Year:
|
|
4390
4364
|
return date.getFullYear();
|
|
4365
|
+
case ViewMode.HalfYear: {
|
|
4366
|
+
const half = Math.ceil((date.getMonth() + 1) / 6);
|
|
4367
|
+
return `H${half}`;
|
|
4368
|
+
}
|
|
4391
4369
|
case ViewMode.Month:
|
|
4392
4370
|
try {
|
|
4393
4371
|
return format(date, dateSetup.dateFormats.monthBottomHeaderFormat, {
|
|
@@ -4443,10 +4421,16 @@
|
|
|
4443
4421
|
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
4444
4422
|
return `Q${quarter}`;
|
|
4445
4423
|
};
|
|
4424
|
+
const getHalfYearText = (date) => {
|
|
4425
|
+
const halfYear = Math.ceil((date.getMonth() + 1) / 6);
|
|
4426
|
+
return `H${halfYear}`;
|
|
4427
|
+
};
|
|
4446
4428
|
const defaultRenderTopHeader = (date, viewMode, dateSetup) => {
|
|
4447
4429
|
switch (viewMode) {
|
|
4448
4430
|
case ViewMode.Year:
|
|
4449
4431
|
return date.getFullYear().toString();
|
|
4432
|
+
case ViewMode.HalfYear:
|
|
4433
|
+
return `${getHalfYearText(date)} ${date.getFullYear()}`;
|
|
4450
4434
|
case ViewMode.QuarterYear:
|
|
4451
4435
|
return `${getQuarterText(date)} ${date.getFullYear()}`;
|
|
4452
4436
|
case ViewMode.Month:
|
|
@@ -4466,6 +4450,50 @@
|
|
|
4466
4450
|
throw new Error("Unknown viewMode");
|
|
4467
4451
|
}
|
|
4468
4452
|
};
|
|
4453
|
+
const calendarMain = "_calendarMain_lemhx_1";
|
|
4454
|
+
const calendarBottomText = "_calendarBottomText_lemhx_13";
|
|
4455
|
+
const calendarTopTick = "_calendarTopTick_lemhx_35";
|
|
4456
|
+
const calendarTopText = "_calendarTopText_lemhx_43";
|
|
4457
|
+
const calendarHeader = "_calendarHeader_lemhx_65";
|
|
4458
|
+
const styles$a = {
|
|
4459
|
+
calendarMain,
|
|
4460
|
+
calendarBottomText,
|
|
4461
|
+
calendarTopTick,
|
|
4462
|
+
calendarTopText,
|
|
4463
|
+
calendarHeader
|
|
4464
|
+
};
|
|
4465
|
+
const TopPartOfCalendar = ({
|
|
4466
|
+
value,
|
|
4467
|
+
x1Line,
|
|
4468
|
+
y1Line,
|
|
4469
|
+
y2Line,
|
|
4470
|
+
xText,
|
|
4471
|
+
yText,
|
|
4472
|
+
colors
|
|
4473
|
+
}) => {
|
|
4474
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { className: "calendarTop", children: [
|
|
4475
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4476
|
+
"line",
|
|
4477
|
+
{
|
|
4478
|
+
x1: x1Line,
|
|
4479
|
+
y1: y1Line,
|
|
4480
|
+
x2: x1Line,
|
|
4481
|
+
y2: y2Line,
|
|
4482
|
+
className: styles$a.calendarTopTick
|
|
4483
|
+
}
|
|
4484
|
+
),
|
|
4485
|
+
value !== null && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4486
|
+
"text",
|
|
4487
|
+
{
|
|
4488
|
+
y: yText,
|
|
4489
|
+
x: xText,
|
|
4490
|
+
className: styles$a.calendarTopText,
|
|
4491
|
+
style: { fill: colors.barLabelColor },
|
|
4492
|
+
children: value
|
|
4493
|
+
}
|
|
4494
|
+
)
|
|
4495
|
+
] });
|
|
4496
|
+
};
|
|
4469
4497
|
const Calendar = ({
|
|
4470
4498
|
additionalLeftSpace,
|
|
4471
4499
|
dateSetup,
|
|
@@ -4536,6 +4564,48 @@
|
|
|
4536
4564
|
}
|
|
4537
4565
|
return [topValues2, bottomValues2];
|
|
4538
4566
|
};
|
|
4567
|
+
const getCalenderValuesForHalfYear = () => {
|
|
4568
|
+
const topValues2 = [];
|
|
4569
|
+
const bottomValues2 = [];
|
|
4570
|
+
const topDefaultHeight = headerHeight * 0.5;
|
|
4571
|
+
for (let i = startColumnIndex; i <= endColumnIndex; i++) {
|
|
4572
|
+
const date = getDate(i);
|
|
4573
|
+
const halfYear = "H" + Math.ceil((date.getMonth() + 1) / 6);
|
|
4574
|
+
bottomValues2.push(
|
|
4575
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4576
|
+
"text",
|
|
4577
|
+
{
|
|
4578
|
+
y: headerHeight * 0.8,
|
|
4579
|
+
x: additionalLeftSpace + columnWidth * i + columnWidth * 0.5,
|
|
4580
|
+
className: styles$a.calendarBottomText,
|
|
4581
|
+
style: { fill: colors.barLabelColor },
|
|
4582
|
+
children: halfYear
|
|
4583
|
+
},
|
|
4584
|
+
`${halfYear}-${date.getFullYear()}-${i}`
|
|
4585
|
+
)
|
|
4586
|
+
);
|
|
4587
|
+
if (!isUnknownDates && (i === startColumnIndex || date.getFullYear() !== getDate(i - 1).getFullYear())) {
|
|
4588
|
+
const year = date.getFullYear().toString();
|
|
4589
|
+
const startHalf = Math.floor(i / 6) * 6;
|
|
4590
|
+
topValues2.push(
|
|
4591
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4592
|
+
TopPartOfCalendar,
|
|
4593
|
+
{
|
|
4594
|
+
value: year,
|
|
4595
|
+
x1Line: additionalLeftSpace + columnWidth * startHalf,
|
|
4596
|
+
y1Line: 0,
|
|
4597
|
+
y2Line: topDefaultHeight,
|
|
4598
|
+
xText: additionalLeftSpace + columnWidth * (startHalf + 3),
|
|
4599
|
+
yText: topDefaultHeight * 0.9,
|
|
4600
|
+
colors
|
|
4601
|
+
},
|
|
4602
|
+
year
|
|
4603
|
+
)
|
|
4604
|
+
);
|
|
4605
|
+
}
|
|
4606
|
+
}
|
|
4607
|
+
return [topValues2, bottomValues2];
|
|
4608
|
+
};
|
|
4539
4609
|
const getCalendarValuesForQuarterYear = () => {
|
|
4540
4610
|
const topValues2 = [];
|
|
4541
4611
|
const bottomValues2 = [];
|
|
@@ -4543,6 +4613,7 @@
|
|
|
4543
4613
|
for (let i = startColumnIndex; i <= endColumnIndex; i++) {
|
|
4544
4614
|
const date = getDate(i);
|
|
4545
4615
|
const quarter = "Q" + Math.ceil((date.getMonth() + 1) / 3);
|
|
4616
|
+
console.log("quarter :>> ", quarter);
|
|
4546
4617
|
bottomValues2.push(
|
|
4547
4618
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4548
4619
|
"text",
|
|
@@ -4822,6 +4893,9 @@
|
|
|
4822
4893
|
case ViewMode.Year:
|
|
4823
4894
|
[topValues, bottomValues] = getCalendarValuesForYear();
|
|
4824
4895
|
break;
|
|
4896
|
+
case ViewMode.HalfYear:
|
|
4897
|
+
[topValues, bottomValues] = getCalenderValuesForHalfYear();
|
|
4898
|
+
break;
|
|
4825
4899
|
case ViewMode.QuarterYear:
|
|
4826
4900
|
[topValues, bottomValues] = getCalendarValuesForQuarterYear();
|
|
4827
4901
|
break;
|
|
@@ -5096,9 +5170,9 @@
|
|
|
5096
5170
|
/* @__PURE__ */ jsxRuntime.jsx(GridBody, { ...props })
|
|
5097
5171
|
] });
|
|
5098
5172
|
};
|
|
5099
|
-
const ganttTaskRoot = "
|
|
5100
|
-
const ganttTaskContent = "
|
|
5101
|
-
const wrapper$2 = "
|
|
5173
|
+
const ganttTaskRoot = "_ganttTaskRoot_1mu5y_1";
|
|
5174
|
+
const ganttTaskContent = "_ganttTaskContent_1mu5y_83";
|
|
5175
|
+
const wrapper$2 = "_wrapper_1mu5y_111";
|
|
5102
5176
|
const styles$9 = {
|
|
5103
5177
|
ganttTaskRoot,
|
|
5104
5178
|
ganttTaskContent,
|
|
@@ -6571,7 +6645,6 @@
|
|
|
6571
6645
|
if (task)
|
|
6572
6646
|
tasksAtRow.push(task);
|
|
6573
6647
|
}
|
|
6574
|
-
console.log("tasksAtRow", tasksAtRow);
|
|
6575
6648
|
for (const task of tasksAtRow) {
|
|
6576
6649
|
const comparisonLevel = task.comparisonLevel ?? 1;
|
|
6577
6650
|
const { id: taskId } = task;
|
|
@@ -6836,6 +6909,7 @@
|
|
|
6836
6909
|
height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
|
|
6837
6910
|
width: (ganttTaskRootRef == null ? void 0 : ganttTaskRootRef.current) ? ganttTaskRootRef.current.clientWidth + ganttTaskRootRef.current.scrollLeft : fullSvgWidth
|
|
6838
6911
|
};
|
|
6912
|
+
console.log("containerStyle:>> ", containerStyle);
|
|
6839
6913
|
const gridStyle = React.useMemo(
|
|
6840
6914
|
() => ({
|
|
6841
6915
|
height: Math.max(ganttFullHeight, minimumRowDisplayed * rowHeight),
|
|
@@ -13068,6 +13142,7 @@
|
|
|
13068
13142
|
TaskListTable,
|
|
13069
13143
|
enableTaskGrouping,
|
|
13070
13144
|
rowIndexToTasksMap,
|
|
13145
|
+
taskToRowIndexMap,
|
|
13071
13146
|
canMoveTasks,
|
|
13072
13147
|
canResizeColumns,
|
|
13073
13148
|
childTasksMap,
|
package/dist/style.css
CHANGED
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
stroke: #e0e0e0;
|
|
333
333
|
stroke-width: 1.4;
|
|
334
334
|
}
|
|
335
|
-
.
|
|
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
|
-
.
|
|
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
|
-
.
|
|
376
|
+
._ganttTaskContent_1mu5y_83 {
|
|
377
377
|
margin: 0;
|
|
378
378
|
padding: 0;
|
|
379
379
|
overflow-x: hidden;
|
|
@@ -382,20 +382,21 @@
|
|
|
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
|
-
.
|
|
385
|
+
._ganttTaskContent_1mu5y_83 {
|
|
386
386
|
scrollbar-width: thin;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
-
.
|
|
390
|
+
._wrapper_1mu5y_111 {
|
|
391
391
|
display: grid;
|
|
392
392
|
overflow-x: hidden;
|
|
393
|
-
overflow-y:
|
|
393
|
+
overflow-y: auto;
|
|
394
394
|
padding: 0;
|
|
395
395
|
margin: 0;
|
|
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
|
}
|
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.22",
|
|
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",
|