gantt-lib 0.70.0 → 0.71.1
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/index.js +75 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4572,7 +4572,8 @@ var TaskListRow = React9.memo(
|
|
|
4572
4572
|
canDemoteTask = true,
|
|
4573
4573
|
isLastChild = true,
|
|
4574
4574
|
nestingDepth = 0,
|
|
4575
|
-
|
|
4575
|
+
hasVisibleChildren = false,
|
|
4576
|
+
ancestorLineModes = [],
|
|
4576
4577
|
customDays,
|
|
4577
4578
|
isWeekend: isWeekend3,
|
|
4578
4579
|
businessDays,
|
|
@@ -4629,6 +4630,9 @@ var TaskListRow = React9.memo(
|
|
|
4629
4630
|
[businessDays, weekendPredicate]
|
|
4630
4631
|
);
|
|
4631
4632
|
const isCollapsed = collapsedParentIds.has(task.id);
|
|
4633
|
+
const getHierarchyLineColor = useCallback4((columnDepth) => {
|
|
4634
|
+
return columnDepth % 2 === 0 ? "#93c5fd" : "var(--gantt-hierarchy-line-color)";
|
|
4635
|
+
}, []);
|
|
4632
4636
|
const isPicking = selectingPredecessorFor != null;
|
|
4633
4637
|
const isSourceRow = isPicking && selectingPredecessorFor === task.id;
|
|
4634
4638
|
const [dependencySearchQuery, setDependencySearchQuery] = useState4("");
|
|
@@ -5377,23 +5381,41 @@ var TaskListRow = React9.memo(
|
|
|
5377
5381
|
const nameCell = /* @__PURE__ */ jsxs9("div", { className: "gantt-tl-cell gantt-tl-cell-name", children: [
|
|
5378
5382
|
isChild && !editingName && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
5379
5383
|
!isFilterHideMode && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
5380
|
-
|
|
5381
|
-
(
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5384
|
+
ancestorLineModes.map(
|
|
5385
|
+
(mode, idx) => mode ? /* @__PURE__ */ jsxs9(React9.Fragment, { children: [
|
|
5386
|
+
/* @__PURE__ */ jsx12(
|
|
5387
|
+
"span",
|
|
5388
|
+
{
|
|
5389
|
+
"data-testid": `gantt-tl-ancestor-connector-${idx}`,
|
|
5390
|
+
style: {
|
|
5391
|
+
position: "absolute",
|
|
5392
|
+
left: `${idx * 20 + 9}px`,
|
|
5393
|
+
top: 0,
|
|
5394
|
+
height: mode === "half" ? `${rowHeight / 2}px` : `${rowHeight}px`,
|
|
5395
|
+
width: "1.5px",
|
|
5396
|
+
background: getHierarchyLineColor(idx),
|
|
5397
|
+
borderRadius: "1px",
|
|
5398
|
+
pointerEvents: "none"
|
|
5399
|
+
}
|
|
5393
5400
|
}
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5401
|
+
),
|
|
5402
|
+
mode === "half" && /* @__PURE__ */ jsx12(
|
|
5403
|
+
"span",
|
|
5404
|
+
{
|
|
5405
|
+
"data-testid": `gantt-tl-ancestor-connector-cap-${idx}`,
|
|
5406
|
+
style: {
|
|
5407
|
+
position: "absolute",
|
|
5408
|
+
left: `${idx * 20 + 9}px`,
|
|
5409
|
+
top: `${rowHeight / 2 - 0.75}px`,
|
|
5410
|
+
width: "5px",
|
|
5411
|
+
height: "1.5px",
|
|
5412
|
+
background: getHierarchyLineColor(idx),
|
|
5413
|
+
borderRadius: "1px",
|
|
5414
|
+
pointerEvents: "none"
|
|
5415
|
+
}
|
|
5416
|
+
}
|
|
5417
|
+
)
|
|
5418
|
+
] }, idx) : null
|
|
5397
5419
|
),
|
|
5398
5420
|
nestingDepth > 0 && /* @__PURE__ */ jsx12(
|
|
5399
5421
|
"span",
|
|
@@ -5403,9 +5425,9 @@ var TaskListRow = React9.memo(
|
|
|
5403
5425
|
position: "absolute",
|
|
5404
5426
|
left: `${(nestingDepth - 1) * 20 + 9}px`,
|
|
5405
5427
|
top: 0,
|
|
5406
|
-
height: isLastChild ? `${rowHeight / 2}px` : `${rowHeight}px`,
|
|
5428
|
+
height: isLastChild && !hasVisibleChildren ? `${rowHeight / 2}px` : `${rowHeight}px`,
|
|
5407
5429
|
width: "1.5px",
|
|
5408
|
-
background:
|
|
5430
|
+
background: getHierarchyLineColor(nestingDepth - 1),
|
|
5409
5431
|
borderRadius: "1px",
|
|
5410
5432
|
pointerEvents: "none"
|
|
5411
5433
|
}
|
|
@@ -5420,7 +5442,7 @@ var TaskListRow = React9.memo(
|
|
|
5420
5442
|
top: `${rowHeight / 2 - 0.75}px`,
|
|
5421
5443
|
width: "8px",
|
|
5422
5444
|
height: "1.5px",
|
|
5423
|
-
background:
|
|
5445
|
+
background: getHierarchyLineColor(nestingDepth - 1),
|
|
5424
5446
|
borderRadius: "1px",
|
|
5425
5447
|
pointerEvents: "none"
|
|
5426
5448
|
}
|
|
@@ -5436,7 +5458,7 @@ var TaskListRow = React9.memo(
|
|
|
5436
5458
|
width: "4px",
|
|
5437
5459
|
height: "4px",
|
|
5438
5460
|
borderRadius: "50%",
|
|
5439
|
-
background:
|
|
5461
|
+
background: getHierarchyLineColor(nestingDepth - 1),
|
|
5440
5462
|
pointerEvents: "none"
|
|
5441
5463
|
}
|
|
5442
5464
|
}
|
|
@@ -5452,7 +5474,7 @@ var TaskListRow = React9.memo(
|
|
|
5452
5474
|
top: `${rowHeight / 2 + 7}px`,
|
|
5453
5475
|
height: `${rowHeight / 2 - 7}px`,
|
|
5454
5476
|
width: "1.5px",
|
|
5455
|
-
background:
|
|
5477
|
+
background: getHierarchyLineColor(nestingDepth),
|
|
5456
5478
|
borderRadius: "1px",
|
|
5457
5479
|
pointerEvents: "none"
|
|
5458
5480
|
}
|
|
@@ -5482,7 +5504,7 @@ var TaskListRow = React9.memo(
|
|
|
5482
5504
|
top: `${rowHeight / 2 + 7}px`,
|
|
5483
5505
|
height: `${rowHeight / 2 - 7}px`,
|
|
5484
5506
|
width: "1.5px",
|
|
5485
|
-
background:
|
|
5507
|
+
background: getHierarchyLineColor(nestingDepth),
|
|
5486
5508
|
borderRadius: "1px",
|
|
5487
5509
|
pointerEvents: "none"
|
|
5488
5510
|
}
|
|
@@ -5821,7 +5843,7 @@ var TaskListRow = React9.memo(
|
|
|
5821
5843
|
"span",
|
|
5822
5844
|
{
|
|
5823
5845
|
style: editingDuration ? { visibility: "hidden", pointerEvents: "none" } : void 0,
|
|
5824
|
-
children: isMilestone ? "
|
|
5846
|
+
children: isMilestone ? "\u25C6" : `${getDuration(normalizedTask.startDate, normalizedTask.endDate)}\u0434`
|
|
5825
5847
|
}
|
|
5826
5848
|
)
|
|
5827
5849
|
]
|
|
@@ -6469,20 +6491,41 @@ var TaskList = ({
|
|
|
6469
6491
|
}
|
|
6470
6492
|
return last;
|
|
6471
6493
|
}, [visibleTasks]);
|
|
6472
|
-
const
|
|
6494
|
+
const visibleParentIds = useMemo8(() => {
|
|
6495
|
+
const parentIds = /* @__PURE__ */ new Set();
|
|
6496
|
+
for (const task of visibleTasks) {
|
|
6497
|
+
if (task.parentId) parentIds.add(task.parentId);
|
|
6498
|
+
}
|
|
6499
|
+
return parentIds;
|
|
6500
|
+
}, [visibleTasks]);
|
|
6501
|
+
const ancestorLineModesMap = useMemo8(() => {
|
|
6473
6502
|
const taskById = new Map(tasks.map((t) => [t.id, t]));
|
|
6503
|
+
const isDescendantOf = (taskId, ancestorId) => {
|
|
6504
|
+
let current = taskById.get(taskId);
|
|
6505
|
+
while (current?.parentId && taskById.has(current.parentId)) {
|
|
6506
|
+
if (current.parentId === ancestorId) return true;
|
|
6507
|
+
current = taskById.get(current.parentId);
|
|
6508
|
+
}
|
|
6509
|
+
return false;
|
|
6510
|
+
};
|
|
6474
6511
|
const map = /* @__PURE__ */ new Map();
|
|
6475
|
-
for (
|
|
6476
|
-
const
|
|
6512
|
+
for (let index = 0; index < visibleTasks.length; index++) {
|
|
6513
|
+
const task = visibleTasks[index];
|
|
6514
|
+
const ancestorIds = [];
|
|
6477
6515
|
let current = taskById.get(task.id);
|
|
6478
6516
|
while (current?.parentId && taskById.has(current.parentId)) {
|
|
6479
|
-
|
|
6517
|
+
ancestorIds.unshift(current.parentId);
|
|
6480
6518
|
current = taskById.get(current.parentId);
|
|
6481
6519
|
}
|
|
6482
|
-
|
|
6520
|
+
const ancestorsAboveParent = ancestorIds.slice(0, -1);
|
|
6521
|
+
const modes = ancestorsAboveParent.map((ancestorId) => {
|
|
6522
|
+
const hasLaterVisibleDescendant = visibleTasks.slice(index + 1).some((laterTask) => isDescendantOf(laterTask.id, ancestorId));
|
|
6523
|
+
return hasLaterVisibleDescendant ? "full" : "half";
|
|
6524
|
+
});
|
|
6525
|
+
map.set(task.id, modes);
|
|
6483
6526
|
}
|
|
6484
6527
|
return map;
|
|
6485
|
-
}, [tasks, visibleTasks
|
|
6528
|
+
}, [tasks, visibleTasks]);
|
|
6486
6529
|
const handleRowClick = useCallback5((taskId) => {
|
|
6487
6530
|
onTaskSelect?.(taskId);
|
|
6488
6531
|
}, [onTaskSelect]);
|
|
@@ -7027,7 +7070,8 @@ var TaskList = ({
|
|
|
7027
7070
|
canDemoteTask,
|
|
7028
7071
|
isLastChild: lastChildIds.has(task.id),
|
|
7029
7072
|
nestingDepth: nestingDepthMap.get(task.id) ?? 0,
|
|
7030
|
-
|
|
7073
|
+
hasVisibleChildren: visibleParentIds.has(task.id),
|
|
7074
|
+
ancestorLineModes: ancestorLineModesMap.get(task.id) ?? [],
|
|
7031
7075
|
customDays,
|
|
7032
7076
|
isWeekend: isWeekend3,
|
|
7033
7077
|
businessDays,
|