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.js
CHANGED
|
@@ -4667,7 +4667,8 @@ var TaskListRow = import_react10.default.memo(
|
|
|
4667
4667
|
canDemoteTask = true,
|
|
4668
4668
|
isLastChild = true,
|
|
4669
4669
|
nestingDepth = 0,
|
|
4670
|
-
|
|
4670
|
+
hasVisibleChildren = false,
|
|
4671
|
+
ancestorLineModes = [],
|
|
4671
4672
|
customDays,
|
|
4672
4673
|
isWeekend: isWeekend3,
|
|
4673
4674
|
businessDays,
|
|
@@ -4724,6 +4725,9 @@ var TaskListRow = import_react10.default.memo(
|
|
|
4724
4725
|
[businessDays, weekendPredicate]
|
|
4725
4726
|
);
|
|
4726
4727
|
const isCollapsed = collapsedParentIds.has(task.id);
|
|
4728
|
+
const getHierarchyLineColor = (0, import_react10.useCallback)((columnDepth) => {
|
|
4729
|
+
return columnDepth % 2 === 0 ? "#93c5fd" : "var(--gantt-hierarchy-line-color)";
|
|
4730
|
+
}, []);
|
|
4727
4731
|
const isPicking = selectingPredecessorFor != null;
|
|
4728
4732
|
const isSourceRow = isPicking && selectingPredecessorFor === task.id;
|
|
4729
4733
|
const [dependencySearchQuery, setDependencySearchQuery] = (0, import_react10.useState)("");
|
|
@@ -5472,23 +5476,41 @@ var TaskListRow = import_react10.default.memo(
|
|
|
5472
5476
|
const nameCell = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "gantt-tl-cell gantt-tl-cell-name", children: [
|
|
5473
5477
|
isChild && !editingName && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
5474
5478
|
!isFilterHideMode && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
5475
|
-
|
|
5476
|
-
(
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5479
|
+
ancestorLineModes.map(
|
|
5480
|
+
(mode, idx) => mode ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react10.default.Fragment, { children: [
|
|
5481
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5482
|
+
"span",
|
|
5483
|
+
{
|
|
5484
|
+
"data-testid": `gantt-tl-ancestor-connector-${idx}`,
|
|
5485
|
+
style: {
|
|
5486
|
+
position: "absolute",
|
|
5487
|
+
left: `${idx * 20 + 9}px`,
|
|
5488
|
+
top: 0,
|
|
5489
|
+
height: mode === "half" ? `${rowHeight / 2}px` : `${rowHeight}px`,
|
|
5490
|
+
width: "1.5px",
|
|
5491
|
+
background: getHierarchyLineColor(idx),
|
|
5492
|
+
borderRadius: "1px",
|
|
5493
|
+
pointerEvents: "none"
|
|
5494
|
+
}
|
|
5488
5495
|
}
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5496
|
+
),
|
|
5497
|
+
mode === "half" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5498
|
+
"span",
|
|
5499
|
+
{
|
|
5500
|
+
"data-testid": `gantt-tl-ancestor-connector-cap-${idx}`,
|
|
5501
|
+
style: {
|
|
5502
|
+
position: "absolute",
|
|
5503
|
+
left: `${idx * 20 + 9}px`,
|
|
5504
|
+
top: `${rowHeight / 2 - 0.75}px`,
|
|
5505
|
+
width: "5px",
|
|
5506
|
+
height: "1.5px",
|
|
5507
|
+
background: getHierarchyLineColor(idx),
|
|
5508
|
+
borderRadius: "1px",
|
|
5509
|
+
pointerEvents: "none"
|
|
5510
|
+
}
|
|
5511
|
+
}
|
|
5512
|
+
)
|
|
5513
|
+
] }, idx) : null
|
|
5492
5514
|
),
|
|
5493
5515
|
nestingDepth > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
5494
5516
|
"span",
|
|
@@ -5498,9 +5520,9 @@ var TaskListRow = import_react10.default.memo(
|
|
|
5498
5520
|
position: "absolute",
|
|
5499
5521
|
left: `${(nestingDepth - 1) * 20 + 9}px`,
|
|
5500
5522
|
top: 0,
|
|
5501
|
-
height: isLastChild ? `${rowHeight / 2}px` : `${rowHeight}px`,
|
|
5523
|
+
height: isLastChild && !hasVisibleChildren ? `${rowHeight / 2}px` : `${rowHeight}px`,
|
|
5502
5524
|
width: "1.5px",
|
|
5503
|
-
background:
|
|
5525
|
+
background: getHierarchyLineColor(nestingDepth - 1),
|
|
5504
5526
|
borderRadius: "1px",
|
|
5505
5527
|
pointerEvents: "none"
|
|
5506
5528
|
}
|
|
@@ -5515,7 +5537,7 @@ var TaskListRow = import_react10.default.memo(
|
|
|
5515
5537
|
top: `${rowHeight / 2 - 0.75}px`,
|
|
5516
5538
|
width: "8px",
|
|
5517
5539
|
height: "1.5px",
|
|
5518
|
-
background:
|
|
5540
|
+
background: getHierarchyLineColor(nestingDepth - 1),
|
|
5519
5541
|
borderRadius: "1px",
|
|
5520
5542
|
pointerEvents: "none"
|
|
5521
5543
|
}
|
|
@@ -5531,7 +5553,7 @@ var TaskListRow = import_react10.default.memo(
|
|
|
5531
5553
|
width: "4px",
|
|
5532
5554
|
height: "4px",
|
|
5533
5555
|
borderRadius: "50%",
|
|
5534
|
-
background:
|
|
5556
|
+
background: getHierarchyLineColor(nestingDepth - 1),
|
|
5535
5557
|
pointerEvents: "none"
|
|
5536
5558
|
}
|
|
5537
5559
|
}
|
|
@@ -5547,7 +5569,7 @@ var TaskListRow = import_react10.default.memo(
|
|
|
5547
5569
|
top: `${rowHeight / 2 + 7}px`,
|
|
5548
5570
|
height: `${rowHeight / 2 - 7}px`,
|
|
5549
5571
|
width: "1.5px",
|
|
5550
|
-
background:
|
|
5572
|
+
background: getHierarchyLineColor(nestingDepth),
|
|
5551
5573
|
borderRadius: "1px",
|
|
5552
5574
|
pointerEvents: "none"
|
|
5553
5575
|
}
|
|
@@ -5577,7 +5599,7 @@ var TaskListRow = import_react10.default.memo(
|
|
|
5577
5599
|
top: `${rowHeight / 2 + 7}px`,
|
|
5578
5600
|
height: `${rowHeight / 2 - 7}px`,
|
|
5579
5601
|
width: "1.5px",
|
|
5580
|
-
background:
|
|
5602
|
+
background: getHierarchyLineColor(nestingDepth),
|
|
5581
5603
|
borderRadius: "1px",
|
|
5582
5604
|
pointerEvents: "none"
|
|
5583
5605
|
}
|
|
@@ -5916,7 +5938,7 @@ var TaskListRow = import_react10.default.memo(
|
|
|
5916
5938
|
"span",
|
|
5917
5939
|
{
|
|
5918
5940
|
style: editingDuration ? { visibility: "hidden", pointerEvents: "none" } : void 0,
|
|
5919
|
-
children: isMilestone ? "
|
|
5941
|
+
children: isMilestone ? "\u25C6" : `${getDuration(normalizedTask.startDate, normalizedTask.endDate)}\u0434`
|
|
5920
5942
|
}
|
|
5921
5943
|
)
|
|
5922
5944
|
]
|
|
@@ -6564,20 +6586,41 @@ var TaskList = ({
|
|
|
6564
6586
|
}
|
|
6565
6587
|
return last;
|
|
6566
6588
|
}, [visibleTasks]);
|
|
6567
|
-
const
|
|
6589
|
+
const visibleParentIds = (0, import_react12.useMemo)(() => {
|
|
6590
|
+
const parentIds = /* @__PURE__ */ new Set();
|
|
6591
|
+
for (const task of visibleTasks) {
|
|
6592
|
+
if (task.parentId) parentIds.add(task.parentId);
|
|
6593
|
+
}
|
|
6594
|
+
return parentIds;
|
|
6595
|
+
}, [visibleTasks]);
|
|
6596
|
+
const ancestorLineModesMap = (0, import_react12.useMemo)(() => {
|
|
6568
6597
|
const taskById = new Map(tasks.map((t) => [t.id, t]));
|
|
6598
|
+
const isDescendantOf = (taskId, ancestorId) => {
|
|
6599
|
+
let current = taskById.get(taskId);
|
|
6600
|
+
while (current?.parentId && taskById.has(current.parentId)) {
|
|
6601
|
+
if (current.parentId === ancestorId) return true;
|
|
6602
|
+
current = taskById.get(current.parentId);
|
|
6603
|
+
}
|
|
6604
|
+
return false;
|
|
6605
|
+
};
|
|
6569
6606
|
const map = /* @__PURE__ */ new Map();
|
|
6570
|
-
for (
|
|
6571
|
-
const
|
|
6607
|
+
for (let index = 0; index < visibleTasks.length; index++) {
|
|
6608
|
+
const task = visibleTasks[index];
|
|
6609
|
+
const ancestorIds = [];
|
|
6572
6610
|
let current = taskById.get(task.id);
|
|
6573
6611
|
while (current?.parentId && taskById.has(current.parentId)) {
|
|
6574
|
-
|
|
6612
|
+
ancestorIds.unshift(current.parentId);
|
|
6575
6613
|
current = taskById.get(current.parentId);
|
|
6576
6614
|
}
|
|
6577
|
-
|
|
6615
|
+
const ancestorsAboveParent = ancestorIds.slice(0, -1);
|
|
6616
|
+
const modes = ancestorsAboveParent.map((ancestorId) => {
|
|
6617
|
+
const hasLaterVisibleDescendant = visibleTasks.slice(index + 1).some((laterTask) => isDescendantOf(laterTask.id, ancestorId));
|
|
6618
|
+
return hasLaterVisibleDescendant ? "full" : "half";
|
|
6619
|
+
});
|
|
6620
|
+
map.set(task.id, modes);
|
|
6578
6621
|
}
|
|
6579
6622
|
return map;
|
|
6580
|
-
}, [tasks, visibleTasks
|
|
6623
|
+
}, [tasks, visibleTasks]);
|
|
6581
6624
|
const handleRowClick = (0, import_react12.useCallback)((taskId) => {
|
|
6582
6625
|
onTaskSelect?.(taskId);
|
|
6583
6626
|
}, [onTaskSelect]);
|
|
@@ -7122,7 +7165,8 @@ var TaskList = ({
|
|
|
7122
7165
|
canDemoteTask,
|
|
7123
7166
|
isLastChild: lastChildIds.has(task.id),
|
|
7124
7167
|
nestingDepth: nestingDepthMap.get(task.id) ?? 0,
|
|
7125
|
-
|
|
7168
|
+
hasVisibleChildren: visibleParentIds.has(task.id),
|
|
7169
|
+
ancestorLineModes: ancestorLineModesMap.get(task.id) ?? [],
|
|
7126
7170
|
customDays,
|
|
7127
7171
|
isWeekend: isWeekend3,
|
|
7128
7172
|
businessDays,
|