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