@kumix/ui 0.3.9 → 0.3.10
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/README.md +15 -14
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
- package/dist/components/motion/animated-sidebar.js.map +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -1
- package/dist/components/motion/availability-scheduler/day-row.js +15 -7
- package/dist/components/motion/availability-scheduler/day-row.js.map +1 -1
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/button/index.d.ts +2 -1
- package/dist/components/motion/button/index.js +2 -1
- package/dist/components/motion/button/metallic.d.ts +10 -0
- package/dist/components/motion/button/metallic.d.ts.map +1 -0
- package/dist/components/motion/button/metallic.js +71 -0
- package/dist/components/motion/button/metallic.js.map +1 -0
- package/dist/components/motion/expandable-control.d.ts +28 -0
- package/dist/components/motion/expandable-control.d.ts.map +1 -0
- package/dist/components/motion/expandable-control.js +149 -0
- package/dist/components/motion/expandable-control.js.map +1 -0
- package/dist/components/motion/expanding-arrow-button.d.ts +12 -0
- package/dist/components/motion/expanding-arrow-button.d.ts.map +1 -0
- package/dist/components/motion/expanding-arrow-button.js +142 -0
- package/dist/components/motion/expanding-arrow-button.js.map +1 -0
- package/dist/components/motion/file-tree.d.ts +42 -0
- package/dist/components/motion/file-tree.d.ts.map +1 -0
- package/dist/components/motion/file-tree.js +272 -0
- package/dist/components/motion/file-tree.js.map +1 -0
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/code-block/code-block-highlight.d.ts +216 -0
- package/dist/components/reui/code-block/code-block-highlight.d.ts.map +1 -0
- package/dist/components/reui/code-block/code-block-highlight.js +792 -0
- package/dist/components/reui/code-block/code-block-highlight.js.map +1 -0
- package/dist/components/reui/code-block/code-block.d.ts +197 -0
- package/dist/components/reui/code-block/code-block.d.ts.map +1 -0
- package/dist/components/reui/code-block/code-block.js +1150 -0
- package/dist/components/reui/code-block/code-block.js.map +1 -0
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +42 -12
- package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
- package/dist/components/reui/gantt/gantt-dnd.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-dnd.js +22 -7
- package/dist/components/reui/gantt/gantt-dnd.js.map +1 -1
- package/dist/components/reui/gantt/gantt-i18n.d.ts +8 -0
- package/dist/components/reui/gantt/gantt-i18n.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-i18n.js +6 -1
- package/dist/components/reui/gantt/gantt-i18n.js.map +1 -1
- package/dist/components/reui/gantt/gantt-lib.d.ts +59 -2
- package/dist/components/reui/gantt/gantt-lib.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-lib.js +67 -2
- package/dist/components/reui/gantt/gantt-lib.js.map +1 -1
- package/dist/components/reui/gantt/gantt-recurrence.js +3 -3
- package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -1
- package/dist/components/reui/gantt/gantt-types.d.ts +32 -1
- package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-view.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +324 -35
- package/dist/components/reui/gantt/gantt-view.js.map +1 -1
- package/dist/components/reui/gantt/gantt.d.ts +71 -2
- package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt.js +8 -0
- package/dist/components/reui/gantt/gantt.js.map +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/{copy-menu-1FKoMc9o.js → copy-menu-C5GaT4Z-.js} +67 -2
- package/dist/copy-menu-C5GaT4Z-.js.map +1 -0
- package/dist/types-smkWN_7x.d.ts.map +1 -1
- package/package.json +5 -11
- package/dist/copy-menu-1FKoMc9o.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { ScrollArea as ScrollArea$1, ScrollBar } from "../../ui/scroll-area.js";
|
|
|
4
4
|
import { Checkbox } from "../../ui/checkbox.js";
|
|
5
5
|
import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../ui/context-menu.js";
|
|
6
6
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
|
|
7
|
-
import { getDayKey, getLaneKey, getRangeKey, packTimedSegments, reorderResources, resolveOffDay, toZoned, zonedStartOfDay } from "./gantt-lib.js";
|
|
7
|
+
import { buildDependencyPath, getBaselineVariance, getDayKey, getLaneKey, getRangeKey, packTimedSegments, reorderResources, resolveEventBaseline, resolveOffDay, toZoned, zonedStartOfDay } from "./gantt-lib.js";
|
|
8
8
|
import { resolveScheduleMode, resolveTimelineLines, useGantt, useGanttSelector, useGanttSettings, useGanttViewConfig } from "./gantt.js";
|
|
9
9
|
import { cancelActiveGanttGestures, markGestureEnd, useGanttGestureTeardown, useGanttGestures, wasRecentDrag } from "./gantt-dnd.js";
|
|
10
10
|
import { GanttBar } from "./gantt-bar.js";
|
|
@@ -109,8 +109,21 @@ function trackFraction(el, clientX) {
|
|
|
109
109
|
const LANE_HEIGHT_REM = 1.25;
|
|
110
110
|
const LANE_GAP_REM = .1875;
|
|
111
111
|
const ROW_PADDING_REM = .5;
|
|
112
|
-
/**
|
|
112
|
+
/** Default drop-indicator height, centered inside its lane band; a consumer
|
|
113
|
+
* overrides it with metrics.ghostHeight (published as --gantt-ghost-height). */
|
|
113
114
|
const GHOST_HEIGHT_REM = 1.25;
|
|
115
|
+
/**
|
|
116
|
+
* The ONE lane-pitch formula: top of lane `lane` inside a row. Every overlay
|
|
117
|
+
* that rides a lane (bar, baseline ghost, drag ghost, hint ring, slot draft)
|
|
118
|
+
* reads it, so their vertical positions can never drift apart.
|
|
119
|
+
*/
|
|
120
|
+
function laneTopRem(laneOffsetRem, lane, laneHeightRem, laneGapRem) {
|
|
121
|
+
return laneOffsetRem + lane * (laneHeightRem + laneGapRem);
|
|
122
|
+
}
|
|
123
|
+
/** Height of a stack of `count` lanes, inter-lane gaps included. */
|
|
124
|
+
function laneBlockRem(count, laneHeightRem, laneGapRem) {
|
|
125
|
+
return count * laneHeightRem + (count - 1) * laneGapRem;
|
|
126
|
+
}
|
|
114
127
|
/** Bars narrower than this flip their title outside in barLabel "auto". */
|
|
115
128
|
const AUTO_LABEL_MIN_REM = 7;
|
|
116
129
|
const DEFAULT_TREE_PANEL = {
|
|
@@ -129,6 +142,8 @@ const DEFAULT_ZOOM_RANGE = {
|
|
|
129
142
|
const MIN_TIMELINE_WIDTH = 200;
|
|
130
143
|
/** Scroll distance from an edge that triggers infinite-range growth. */
|
|
131
144
|
const INFINITE_EDGE_PX = 160;
|
|
145
|
+
/** Shared empty set so rows without dependency data never churn on identity. */
|
|
146
|
+
const EMPTY_ID_SET = /* @__PURE__ */ new Set();
|
|
132
147
|
/** The pane's scrollable viewport (custom ScrollArea or native host). */
|
|
133
148
|
function getPaneViewport(pane) {
|
|
134
149
|
return pane?.querySelector("[data-slot=scroll-area-viewport]") ?? null;
|
|
@@ -160,6 +175,7 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
160
175
|
const rowPaddingRem = metrics?.rowPadding ?? ROW_PADDING_REM;
|
|
161
176
|
const laneGapRem = metrics?.laneGap ?? LANE_GAP_REM;
|
|
162
177
|
const minRowRem = metrics?.minRowHeight ?? 2.5;
|
|
178
|
+
const ghostHeightRem = metrics?.ghostHeight ?? GHOST_HEIGHT_REM;
|
|
163
179
|
const minTimelineWidth = metrics?.minTimelineWidth ?? MIN_TIMELINE_WIDTH;
|
|
164
180
|
const infiniteEdgePx = metrics?.infiniteScrollEdge ?? INFINITE_EDGE_PX;
|
|
165
181
|
const timeZone = settings.timeZone;
|
|
@@ -500,6 +516,26 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
500
516
|
env.toMin = Math.max(env.toMin, toMin);
|
|
501
517
|
}
|
|
502
518
|
}
|
|
519
|
+
const baselinesByResource = /* @__PURE__ */ new Map();
|
|
520
|
+
const latestEndByResource = /* @__PURE__ */ new Map();
|
|
521
|
+
if (viewConfig.baselineBars) for (const event of allEvents) {
|
|
522
|
+
if (!event.resourceId) continue;
|
|
523
|
+
const endMsActual = event.end.getTime();
|
|
524
|
+
const prev = latestEndByResource.get(event.resourceId);
|
|
525
|
+
if (prev === void 0 || endMsActual > prev) latestEndByResource.set(event.resourceId, endMsActual);
|
|
526
|
+
const baseline = resolveEventBaseline(event);
|
|
527
|
+
if (!baseline) continue;
|
|
528
|
+
const startMs = baseline.start.getTime();
|
|
529
|
+
const endMs = baseline.end.getTime();
|
|
530
|
+
if (!(baseline.milestone ? startMs >= rangeStartMs && startMs <= rangeEndMs : startMs < rangeEndMs && endMs > rangeStartMs)) continue;
|
|
531
|
+
const list = baselinesByResource.get(event.resourceId);
|
|
532
|
+
const entry = {
|
|
533
|
+
event,
|
|
534
|
+
baseline
|
|
535
|
+
};
|
|
536
|
+
if (list) list.push(entry);
|
|
537
|
+
else baselinesByResource.set(event.resourceId, [entry]);
|
|
538
|
+
}
|
|
503
539
|
for (const row of rows) {
|
|
504
540
|
const segments = (byResource.get(row.resource.id) ?? []).map((occurrence) => ({
|
|
505
541
|
occurrence,
|
|
@@ -522,6 +558,27 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
522
558
|
endMs: segment.occurrence.end.getTime()
|
|
523
559
|
});
|
|
524
560
|
const laneCount = segments.reduce((max, segment) => Math.max(max, (segment.column ?? 0) + 1), 1);
|
|
561
|
+
const plans = baselinesByResource.get(row.resource.id);
|
|
562
|
+
const laneByEvent = plans ? new Map(segments.map((segment) => [segment.occurrence.eventId, segment.column ?? 0])) : null;
|
|
563
|
+
const baselines = plans ? plans.flatMap(({ event, baseline }) => {
|
|
564
|
+
let lane = laneByEvent?.get(event.id);
|
|
565
|
+
if (lane === void 0) {
|
|
566
|
+
if (mode === "single" || segments.length === 0) lane = 0;
|
|
567
|
+
else {
|
|
568
|
+
const free = lowestFreeLane(segments, baseline.start.getTime(), baseline.end.getTime());
|
|
569
|
+
if (free >= laneCount) return [];
|
|
570
|
+
lane = free;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return [{
|
|
574
|
+
event,
|
|
575
|
+
baseline,
|
|
576
|
+
startMin: Math.max((baseline.start.getTime() - rangeStartMs) / 6e4, 0),
|
|
577
|
+
endMin: Math.min((baseline.end.getTime() - rangeStartMs) / 6e4, totalMin),
|
|
578
|
+
lane,
|
|
579
|
+
variance: getBaselineVariance(event) ?? "on-time"
|
|
580
|
+
}];
|
|
581
|
+
}) : [];
|
|
525
582
|
let from = Infinity;
|
|
526
583
|
let to = -Infinity;
|
|
527
584
|
for (const segment of segments) {
|
|
@@ -544,12 +601,36 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
544
601
|
progress: subtreeProgress.get(row.resource.id) ?? null
|
|
545
602
|
};
|
|
546
603
|
}
|
|
547
|
-
|
|
604
|
+
let rowBaseline = null;
|
|
605
|
+
if (viewConfig.baselineBars) {
|
|
606
|
+
const plan = resolveEventBaseline(row.resource);
|
|
607
|
+
if (plan) {
|
|
608
|
+
const planStartMs = plan.start.getTime();
|
|
609
|
+
const planEndMs = plan.end.getTime();
|
|
610
|
+
if (plan.milestone ? planStartMs >= rangeStartMs && planStartMs <= rangeEndMs : planStartMs < rangeEndMs && planEndMs > rangeStartMs) {
|
|
611
|
+
const ids = row.isGroup ? [row.resource.id, ...descendantIds.get(row.resource.id) ?? []] : [row.resource.id];
|
|
612
|
+
let latest;
|
|
613
|
+
for (const id of ids) {
|
|
614
|
+
const end = latestEndByResource.get(id);
|
|
615
|
+
if (end !== void 0 && (latest === void 0 || end > latest)) latest = end;
|
|
616
|
+
}
|
|
617
|
+
rowBaseline = {
|
|
618
|
+
baseline: plan,
|
|
619
|
+
startMin: Math.max((planStartMs - rangeStartMs) / 6e4, 0),
|
|
620
|
+
endMin: Math.min((planEndMs - rangeStartMs) / 6e4, totalMin),
|
|
621
|
+
variance: latest === void 0 ? null : latest > planEndMs ? "late" : latest < planEndMs ? "early" : "on-time"
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
const blockRem = laneBlockRem(laneCount, laneHeightRem, laneGapRem);
|
|
548
627
|
const heightRem = Math.max(minRowRem, blockRem + 2 * rowPaddingRem);
|
|
549
628
|
const laneOffsetRem = (heightRem - blockRem) / 2;
|
|
550
629
|
map.set(row.resource.id, {
|
|
551
630
|
segments,
|
|
552
631
|
laneCount,
|
|
632
|
+
baselines,
|
|
633
|
+
rowBaseline,
|
|
553
634
|
draftLane: null,
|
|
554
635
|
scheduleMode: mode,
|
|
555
636
|
heightRem,
|
|
@@ -575,10 +656,12 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
575
656
|
}, [
|
|
576
657
|
rows,
|
|
577
658
|
occurrences,
|
|
659
|
+
allEvents,
|
|
578
660
|
rangeStartMs,
|
|
579
661
|
rangeEndMs,
|
|
580
662
|
settings.i18n,
|
|
581
663
|
viewConfig.summaryBars,
|
|
664
|
+
viewConfig.baselineBars,
|
|
582
665
|
descendantIds,
|
|
583
666
|
subtreeProgress,
|
|
584
667
|
laneHeightRem,
|
|
@@ -622,8 +705,7 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
622
705
|
return next;
|
|
623
706
|
}
|
|
624
707
|
const draftLane = lowestFreeLane(base.segments, draftLayout.startMs, draftLayout.endMs);
|
|
625
|
-
const
|
|
626
|
-
const draftBlockRem = trackCount * laneHeightRem + (trackCount - 1) * laneGapRem;
|
|
708
|
+
const draftBlockRem = laneBlockRem(Math.max(base.laneCount, draftLane + 1), laneHeightRem, laneGapRem);
|
|
627
709
|
next.set(draftLayout.resourceId, {
|
|
628
710
|
...base,
|
|
629
711
|
draftLane,
|
|
@@ -636,6 +718,82 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
636
718
|
laneHeightRem,
|
|
637
719
|
laneGapRem
|
|
638
720
|
]);
|
|
721
|
+
const dependencySourceIds = useMemo(() => {
|
|
722
|
+
if (!viewConfig.dependencyLines) return EMPTY_ID_SET;
|
|
723
|
+
let ids = null;
|
|
724
|
+
for (const event of allEvents) {
|
|
725
|
+
if (!event.dependencies?.length) continue;
|
|
726
|
+
for (const id of event.dependencies) {
|
|
727
|
+
if (!ids) ids = /* @__PURE__ */ new Set();
|
|
728
|
+
ids.add(id);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
return ids ?? EMPTY_ID_SET;
|
|
732
|
+
}, [allEvents, viewConfig.dependencyLines]);
|
|
733
|
+
const dependencyEdges = useMemo(() => {
|
|
734
|
+
const none = {
|
|
735
|
+
edges: [],
|
|
736
|
+
totalRem: 0
|
|
737
|
+
};
|
|
738
|
+
if (!viewConfig.dependencyLines) return none;
|
|
739
|
+
const totalMin = (rangeEndMs - rangeStartMs) / 6e4;
|
|
740
|
+
if (totalMin <= 0) return none;
|
|
741
|
+
const anchors = /* @__PURE__ */ new Map();
|
|
742
|
+
const pending = [];
|
|
743
|
+
let topRem = 0;
|
|
744
|
+
for (const row of rows) {
|
|
745
|
+
const bars = rowBars.get(row.resource.id);
|
|
746
|
+
if (bars) for (const segment of bars.segments) {
|
|
747
|
+
const occ = segment.occurrence;
|
|
748
|
+
if (occ.isRecurring) continue;
|
|
749
|
+
const lane = segment.column ?? 0;
|
|
750
|
+
const y = topRem + laneTopRem(bars.laneOffsetRem, lane, laneHeightRem, laneGapRem) + laneHeightRem / 2;
|
|
751
|
+
const startX = (segment.startMin ?? 0) / totalMin * trackRemWidth;
|
|
752
|
+
const endX = (segment.endMin ?? 0) / totalMin * trackRemWidth;
|
|
753
|
+
anchors.set(occ.eventId, {
|
|
754
|
+
endX,
|
|
755
|
+
y
|
|
756
|
+
});
|
|
757
|
+
if (occ.event.dependencies?.length) pending.push({
|
|
758
|
+
id: occ.eventId,
|
|
759
|
+
dependencies: occ.event.dependencies,
|
|
760
|
+
startX,
|
|
761
|
+
y
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
topRem += bars?.heightRem ?? minRowRem;
|
|
765
|
+
}
|
|
766
|
+
if (pending.length === 0) return none;
|
|
767
|
+
const edges = [];
|
|
768
|
+
for (const item of pending) for (const depId of item.dependencies) {
|
|
769
|
+
if (depId === item.id) continue;
|
|
770
|
+
const from = anchors.get(depId);
|
|
771
|
+
if (!from) continue;
|
|
772
|
+
edges.push({
|
|
773
|
+
key: `${depId}->${item.id}`,
|
|
774
|
+
fromId: depId,
|
|
775
|
+
toId: item.id,
|
|
776
|
+
fromX: from.endX,
|
|
777
|
+
fromY: from.y,
|
|
778
|
+
toX: item.startX,
|
|
779
|
+
toY: item.y
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
return {
|
|
783
|
+
edges,
|
|
784
|
+
totalRem: topRem
|
|
785
|
+
};
|
|
786
|
+
}, [
|
|
787
|
+
rows,
|
|
788
|
+
rowBars,
|
|
789
|
+
rangeStartMs,
|
|
790
|
+
rangeEndMs,
|
|
791
|
+
trackRemWidth,
|
|
792
|
+
laneHeightRem,
|
|
793
|
+
laneGapRem,
|
|
794
|
+
minRowRem,
|
|
795
|
+
viewConfig.dependencyLines
|
|
796
|
+
]);
|
|
639
797
|
const showCreateTask = viewConfig.displayCreateTaskHint && !!settings.onCreateTask && (settings.canCreateTask?.({ parentId: null }) ?? true);
|
|
640
798
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
641
799
|
const clampContainer = (width, container) => {
|
|
@@ -1427,6 +1585,15 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
1427
1585
|
})
|
|
1428
1586
|
]
|
|
1429
1587
|
}),
|
|
1588
|
+
dependencyEdges.edges.length > 0 && /* @__PURE__ */ jsx(GanttDependencyLayer, {
|
|
1589
|
+
edges: dependencyEdges.edges,
|
|
1590
|
+
totalRem: dependencyEdges.totalRem,
|
|
1591
|
+
trackRemWidth,
|
|
1592
|
+
rangeStartMs,
|
|
1593
|
+
rangeEndMs,
|
|
1594
|
+
laneHeightRem,
|
|
1595
|
+
laneGapRem
|
|
1596
|
+
}),
|
|
1430
1597
|
rows.map((row, rowIndex) => /* @__PURE__ */ jsx(GanttTimelineRow, {
|
|
1431
1598
|
row,
|
|
1432
1599
|
rowIndex,
|
|
@@ -1441,7 +1608,9 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
1441
1608
|
isPanning,
|
|
1442
1609
|
laneHeightRem,
|
|
1443
1610
|
laneGapRem,
|
|
1444
|
-
minRowRem
|
|
1611
|
+
minRowRem,
|
|
1612
|
+
ghostHeightRem,
|
|
1613
|
+
dependencySourceIds
|
|
1445
1614
|
}, row.resource.id)),
|
|
1446
1615
|
rows.length === 0 && viewConfig.renderNoResources && /* @__PURE__ */ jsx("div", {
|
|
1447
1616
|
"data-slot": "gantt-no-resources",
|
|
@@ -1543,7 +1712,7 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
1543
1712
|
children: [
|
|
1544
1713
|
viewConfig.zoomControl && /* @__PURE__ */ jsx("div", {
|
|
1545
1714
|
"data-slot": "gantt-zoom",
|
|
1546
|
-
className: "absolute end-
|
|
1715
|
+
className: "absolute end-[calc(0.75rem+var(--gantt-zoom-shift,0px))] bottom-5 z-40 flex flex-col rounded-md border bg-background shadow-sm transition-[inset-inline-end] duration-200",
|
|
1547
1716
|
children: /* @__PURE__ */ jsxs(TooltipProvider, {
|
|
1548
1717
|
delay: 600,
|
|
1549
1718
|
closeDelay: 0,
|
|
@@ -1610,6 +1779,7 @@ function GanttView({ className, render, interval: intervalProp, ...props }) {
|
|
|
1610
1779
|
}),
|
|
1611
1780
|
viewConfig.offscreenIndicators && /* @__PURE__ */ jsx(GanttOffscreenChips, {
|
|
1612
1781
|
paneRef: timelinePaneRef,
|
|
1782
|
+
occurrences,
|
|
1613
1783
|
locale: settings.locale,
|
|
1614
1784
|
refreshKey: `${scale}:${rangeKey}:${zoom}:${rows.length}:${clampedTreeWidth}:${viewConfig.scrollbars}`
|
|
1615
1785
|
})
|
|
@@ -1686,10 +1856,70 @@ function GanttCustomDragLayer() {
|
|
|
1686
1856
|
kind: drag.kind,
|
|
1687
1857
|
start: drag.proposedStart,
|
|
1688
1858
|
end: drag.proposedEnd,
|
|
1689
|
-
valid: drag.valid
|
|
1859
|
+
valid: drag.valid,
|
|
1860
|
+
baseline: resolveEventBaseline(drag.occurrence.event)
|
|
1690
1861
|
})
|
|
1691
1862
|
});
|
|
1692
1863
|
}
|
|
1864
|
+
/**
|
|
1865
|
+
* The dependency-arrow overlay: one SVG whose user unit is 1rem at the
|
|
1866
|
+
* track's natural width (the viewBox mirrors it), stretched to w-full so its
|
|
1867
|
+
* mapping tracks the bars' percentage positions when the zoomed track is
|
|
1868
|
+
* narrower than the pane. While a gesture is in flight the dragged event's
|
|
1869
|
+
* own endpoints re-derive from the proposed range and its edges go dashed -
|
|
1870
|
+
* the arrows point at the drop indicator's landing, never at stale data.
|
|
1871
|
+
* A component of its own so the per-snap drag subscription re-renders a few
|
|
1872
|
+
* paths instead of the whole view.
|
|
1873
|
+
*/
|
|
1874
|
+
const GanttDependencyLayer = memo(function GanttDependencyLayer({ edges, totalRem, trackRemWidth, rangeStartMs, rangeEndMs, laneHeightRem, laneGapRem }) {
|
|
1875
|
+
const viewConfig = useGanttViewConfig();
|
|
1876
|
+
const dragLink = useGanttSelector((state) => state.drag ? {
|
|
1877
|
+
eventId: state.drag.occurrence.eventId,
|
|
1878
|
+
startMs: state.drag.proposedStart.getTime(),
|
|
1879
|
+
endMs: state.drag.proposedEnd.getTime()
|
|
1880
|
+
} : null, { isEqual: (a, b) => a === b || a !== null && b !== null && a.eventId === b.eventId && a.startMs === b.startMs && a.endMs === b.endMs });
|
|
1881
|
+
const totalMin = (rangeEndMs - rangeStartMs) / 6e4;
|
|
1882
|
+
const liveX = (ms) => Math.min(Math.max((ms - rangeStartMs) / 6e4, 0), totalMin) / totalMin * trackRemWidth;
|
|
1883
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
1884
|
+
"aria-hidden": true,
|
|
1885
|
+
"data-slot": "gantt-dependencies",
|
|
1886
|
+
className: cn("pointer-events-none absolute start-0 top-0 w-full overflow-visible text-muted-foreground/70 rtl:-scale-x-100", viewConfig.classNames?.dependencies),
|
|
1887
|
+
style: { height: `${totalRem}rem` },
|
|
1888
|
+
viewBox: `0 0 ${trackRemWidth} ${totalRem}`,
|
|
1889
|
+
preserveAspectRatio: "none",
|
|
1890
|
+
children: edges.map((edge) => {
|
|
1891
|
+
const dragged = dragLink !== null && (edge.fromId === dragLink.eventId || edge.toId === dragLink.eventId);
|
|
1892
|
+
const fromX = dragged && edge.fromId === dragLink.eventId ? liveX(dragLink.endMs) : edge.fromX;
|
|
1893
|
+
const toX = dragged && edge.toId === dragLink.eventId ? liveX(dragLink.startMs) : edge.toX;
|
|
1894
|
+
const geometry = buildDependencyPath({
|
|
1895
|
+
x: fromX,
|
|
1896
|
+
y: edge.fromY
|
|
1897
|
+
}, {
|
|
1898
|
+
x: toX,
|
|
1899
|
+
y: edge.toY
|
|
1900
|
+
}, {
|
|
1901
|
+
clearance: .625,
|
|
1902
|
+
laneStep: laneHeightRem / 2 + laneGapRem,
|
|
1903
|
+
arrowSize: .375
|
|
1904
|
+
});
|
|
1905
|
+
return /* @__PURE__ */ jsxs("g", {
|
|
1906
|
+
"data-slot": "gantt-dependency",
|
|
1907
|
+
"data-dragging": dragged || void 0,
|
|
1908
|
+
className: dragged ? "opacity-50" : void 0,
|
|
1909
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
1910
|
+
d: geometry.line,
|
|
1911
|
+
fill: "none",
|
|
1912
|
+
stroke: "currentColor",
|
|
1913
|
+
strokeWidth: 1.5,
|
|
1914
|
+
vectorEffect: "non-scaling-stroke"
|
|
1915
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
1916
|
+
d: geometry.arrow,
|
|
1917
|
+
fill: "currentColor"
|
|
1918
|
+
})]
|
|
1919
|
+
}, edge.key);
|
|
1920
|
+
})
|
|
1921
|
+
});
|
|
1922
|
+
});
|
|
1693
1923
|
/** Memoized: only rows whose props actually changed re-render. */
|
|
1694
1924
|
const GanttTreeRow = memo(function GanttTreeRow({ row, heightRem, bandRem, columns, nameWidth, dimmed, selected, onSelectedChange, onGripPointerDown, onToggle }) {
|
|
1695
1925
|
const settings = useGanttSettings();
|
|
@@ -1794,7 +2024,7 @@ const GanttTreeRow = memo(function GanttTreeRow({ row, heightRem, bandRem, colum
|
|
|
1794
2024
|
children: menu
|
|
1795
2025
|
})] });
|
|
1796
2026
|
});
|
|
1797
|
-
const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, rangeStartMs, rangeEndMs, trackWidth, trackRemWidth, rowBorder, selected, resolveHintStop, isPanning, laneHeightRem, laneGapRem, minRowRem }) {
|
|
2027
|
+
const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, rangeStartMs, rangeEndMs, trackWidth, trackRemWidth, rowBorder, selected, resolveHintStop, isPanning, laneHeightRem, laneGapRem, minRowRem, ghostHeightRem, dependencySourceIds }) {
|
|
1798
2028
|
const instance = useGantt();
|
|
1799
2029
|
const settings = useGanttSettings();
|
|
1800
2030
|
const viewConfig = useGanttViewConfig();
|
|
@@ -1810,7 +2040,7 @@ const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, r
|
|
|
1810
2040
|
const canSchedule = useGanttSelector((state) => state.interactions.selectSlot);
|
|
1811
2041
|
const hintFreeLane = hintStop ? lowestFreeLane(segments, hintStop.ms, hintStop.endMs) : 0;
|
|
1812
2042
|
const hintLane = bars?.scheduleMode === "single" ? 0 : hintFreeLane;
|
|
1813
|
-
const hintTopRem = Math.min(laneOffsetRem
|
|
2043
|
+
const hintTopRem = Math.min(laneTopRem(laneOffsetRem, hintLane, laneHeightRem, laneGapRem) + laneHeightRem / 2, Math.max(heightRem - laneHeightRem / 2, laneHeightRem / 2));
|
|
1814
2044
|
const hintVisible = hintStop !== null && hintFreeLane < laneCount && !hintSuppressed && !isPanning;
|
|
1815
2045
|
const hintLabel = viewConfig.dragCreate ? settings.i18n.labels.scheduleHintDrag : settings.i18n.labels.scheduleHint;
|
|
1816
2046
|
const showHint = viewConfig.displayScheduleHint && schedulable && canSchedule && !isPanning && !!(settings.onSelectSlot || settings.onSlotClick);
|
|
@@ -1830,7 +2060,8 @@ const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, r
|
|
|
1830
2060
|
valid: drag.valid,
|
|
1831
2061
|
title: drag.occurrence.event.title,
|
|
1832
2062
|
kind: drag.kind,
|
|
1833
|
-
occurrenceKey: drag.occurrence.key
|
|
2063
|
+
occurrenceKey: drag.occurrence.key,
|
|
2064
|
+
milestone: drag.proposedEnd.getTime() === drag.proposedStart.getTime()
|
|
1834
2065
|
};
|
|
1835
2066
|
}, { isEqual: (a, b) => a === b || a !== null && b !== null && a.from === b.from && a.to === b.to && a.valid === b.valid });
|
|
1836
2067
|
const draft = useGanttSelector((state) => {
|
|
@@ -1852,7 +2083,7 @@ const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, r
|
|
|
1852
2083
|
* and the layout catching up.
|
|
1853
2084
|
*/
|
|
1854
2085
|
const draftLane = bars?.draftLane ?? 0;
|
|
1855
|
-
const draftTopRem = Math.min(laneOffsetRem
|
|
2086
|
+
const draftTopRem = Math.min(laneTopRem(laneOffsetRem, draftLane, laneHeightRem, laneGapRem), Math.max(heightRem - laneHeightRem, 0));
|
|
1856
2087
|
const draftLabel = draft ? settings.i18n.functions.formatEventTime(toZoned(new Date(draft.startMs), settings.timeZone), toZoned(new Date(draft.endMs), settings.timeZone), false, settings.locale) : "";
|
|
1857
2088
|
/**
|
|
1858
2089
|
* The row's create contract, in one place: onSlotClick if the consumer
|
|
@@ -1873,7 +2104,7 @@ const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, r
|
|
|
1873
2104
|
resourceId: row.resource.id
|
|
1874
2105
|
});
|
|
1875
2106
|
};
|
|
1876
|
-
const ghostLaneOffsetRem = laneOffsetRem
|
|
2107
|
+
const ghostLaneOffsetRem = laneTopRem(laneOffsetRem, ghost ? segments.find((segment) => segment.occurrence.key === ghost.occurrenceKey)?.column ?? 0 : 0, laneHeightRem, laneGapRem) + (laneHeightRem - ghostHeightRem) / 2;
|
|
1877
2108
|
return /* @__PURE__ */ jsxs("div", {
|
|
1878
2109
|
"data-gantt-row": "",
|
|
1879
2110
|
"data-gantt-resource": row.resource.id,
|
|
@@ -1949,23 +2180,79 @@ const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, r
|
|
|
1949
2180
|
className: "pointer-events-none absolute inset-0",
|
|
1950
2181
|
style: { contentVisibility: "auto" },
|
|
1951
2182
|
children: [
|
|
2183
|
+
bars?.rowBaseline && (() => {
|
|
2184
|
+
const plan = bars.rowBaseline;
|
|
2185
|
+
const from = fractionOf(rangeStartMs + plan.startMin * 6e4);
|
|
2186
|
+
const to = fractionOf(rangeStartMs + plan.endMin * 6e4);
|
|
2187
|
+
const bandRemHeight = laneBlockRem(laneCount, laneHeightRem, laneGapRem);
|
|
2188
|
+
const content = viewConfig.renderRowBaseline?.({
|
|
2189
|
+
resource: row.resource,
|
|
2190
|
+
start: plan.baseline.start,
|
|
2191
|
+
end: plan.baseline.end,
|
|
2192
|
+
milestone: plan.baseline.milestone,
|
|
2193
|
+
variance: plan.variance
|
|
2194
|
+
});
|
|
2195
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2196
|
+
"data-slot": "gantt-row-baseline",
|
|
2197
|
+
"data-milestone": plan.baseline.milestone || void 0,
|
|
2198
|
+
"data-variance": plan.variance ?? void 0,
|
|
2199
|
+
"aria-hidden": true,
|
|
2200
|
+
className: cn("absolute", plan.baseline.milestone ? "flex items-center justify-center" : "px-px", viewConfig.classNames?.baseline),
|
|
2201
|
+
style: {
|
|
2202
|
+
"--gantt-event-color": row.resource.color ?? "var(--color-primary)",
|
|
2203
|
+
insetInlineStart: plan.baseline.milestone ? `clamp(0rem, ${from * 100}% - ${laneHeightRem / 2}rem, 100% - ${laneHeightRem}rem)` : `${from * 100}%`,
|
|
2204
|
+
width: plan.baseline.milestone ? `${laneHeightRem}rem` : `${Math.max((to - from) * 100, .5)}%`,
|
|
2205
|
+
top: `${laneOffsetRem}rem`,
|
|
2206
|
+
height: `${bandRemHeight}rem`
|
|
2207
|
+
},
|
|
2208
|
+
children: content ?? (plan.baseline.milestone ? /* @__PURE__ */ jsx("span", { className: "size-2.5 rotate-45 rounded-[2px] border border-(--gantt-event-color)/60 bg-(--gantt-event-color)/15" }) : /* @__PURE__ */ jsx("span", { className: "relative block h-full w-full rounded-sm border border-(--gantt-event-color)/25 bg-(--gantt-event-color)/6" }))
|
|
2209
|
+
});
|
|
2210
|
+
})(),
|
|
2211
|
+
bars?.baselines.map((plan) => {
|
|
2212
|
+
const from = fractionOf(rangeStartMs + plan.startMin * 6e4);
|
|
2213
|
+
const to = fractionOf(rangeStartMs + plan.endMin * 6e4);
|
|
2214
|
+
const content = viewConfig.renderBaseline?.({
|
|
2215
|
+
event: plan.event,
|
|
2216
|
+
start: plan.baseline.start,
|
|
2217
|
+
end: plan.baseline.end,
|
|
2218
|
+
milestone: plan.baseline.milestone,
|
|
2219
|
+
variance: plan.variance
|
|
2220
|
+
});
|
|
2221
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2222
|
+
"data-slot": "gantt-baseline",
|
|
2223
|
+
"data-milestone": plan.baseline.milestone || void 0,
|
|
2224
|
+
"data-variance": plan.variance,
|
|
2225
|
+
"aria-hidden": true,
|
|
2226
|
+
className: cn("absolute", plan.baseline.milestone ? "flex items-center justify-center" : "px-px", viewConfig.classNames?.baseline),
|
|
2227
|
+
style: {
|
|
2228
|
+
"--gantt-event-color": plan.event.color ?? "var(--color-primary)",
|
|
2229
|
+
insetInlineStart: plan.baseline.milestone ? `clamp(0rem, ${from * 100}% - ${laneHeightRem / 2}rem, 100% - ${laneHeightRem}rem)` : `${from * 100}%`,
|
|
2230
|
+
width: plan.baseline.milestone ? `${laneHeightRem}rem` : `${Math.max((to - from) * 100, .5)}%`,
|
|
2231
|
+
top: `${laneTopRem(laneOffsetRem, plan.lane, laneHeightRem, laneGapRem)}rem`,
|
|
2232
|
+
height: `${laneHeightRem}rem`
|
|
2233
|
+
},
|
|
2234
|
+
children: content ?? (plan.baseline.milestone ? /* @__PURE__ */ jsx("span", { className: "size-2 rotate-45 rounded-[2px] border border-(--gantt-event-color)/60 bg-(--gantt-event-color)/15" }) : /* @__PURE__ */ jsx("span", { className: "relative block h-full w-full rounded-sm border border-(--gantt-event-color)/40 bg-(--gantt-event-color)/10" }))
|
|
2235
|
+
}, `baseline-${plan.event.id}`);
|
|
2236
|
+
}),
|
|
1952
2237
|
segments.map((segment, segmentIndex) => {
|
|
1953
2238
|
const from = fractionOf(rangeStartMs + (segment.startMin ?? 0) * 6e4);
|
|
1954
2239
|
const to = fractionOf(rangeStartMs + (segment.endMin ?? 0) * 6e4);
|
|
1955
|
-
|
|
2240
|
+
const milestone = segment.occurrence.end.getTime() === segment.occurrence.start.getTime();
|
|
2241
|
+
if (to <= from && !milestone) return null;
|
|
1956
2242
|
const lane = segment.column ?? 0;
|
|
1957
|
-
const barRemWidth = (to - from) * trackRemWidth;
|
|
1958
|
-
const placement = !(viewConfig.barLabel === "outside" || viewConfig.barLabel === "auto" && barRemWidth < (viewConfig.metrics?.autoLabelMin ?? AUTO_LABEL_MIN_REM)) ? "inside" : to <= .92 ? "after" : from >= .08 ? "before" : "inside";
|
|
2243
|
+
const barRemWidth = milestone ? laneHeightRem : (to - from) * trackRemWidth;
|
|
2244
|
+
const placement = !(milestone || viewConfig.barLabel === "outside" || viewConfig.barLabel === "auto" && barRemWidth < (viewConfig.metrics?.autoLabelMin ?? AUTO_LABEL_MIN_REM)) ? "inside" : to <= .92 ? "after" : from >= .08 ? "before" : "inside";
|
|
1959
2245
|
const segDragKind = ghost && ghost.occurrenceKey === segment.occurrence.key ? ghost.kind : void 0;
|
|
1960
2246
|
return /* @__PURE__ */ jsxs("div", {
|
|
1961
2247
|
"data-drag-kind": segDragKind,
|
|
2248
|
+
"data-milestone": milestone || void 0,
|
|
1962
2249
|
"data-lane": lane,
|
|
1963
2250
|
"data-lane-count": laneCount,
|
|
1964
2251
|
className: "group/gantt-seg pointer-events-auto absolute px-px data-[drag-kind=move]:opacity-0",
|
|
1965
2252
|
style: {
|
|
1966
|
-
insetInlineStart: `${from * 100}%`,
|
|
1967
|
-
width: `${Math.max((to - from) * 100, .5)}%`,
|
|
1968
|
-
top: `${laneOffsetRem
|
|
2253
|
+
insetInlineStart: milestone ? `clamp(0rem, ${from * 100}% - ${laneHeightRem / 2}rem, 100% - ${laneHeightRem}rem)` : `${from * 100}%`,
|
|
2254
|
+
width: milestone ? `${laneHeightRem}rem` : `${Math.max((to - from) * 100, .5)}%`,
|
|
2255
|
+
top: `${laneTopRem(laneOffsetRem, lane, laneHeightRem, laneGapRem)}rem`,
|
|
1969
2256
|
height: `${laneHeightRem}rem`,
|
|
1970
2257
|
zIndex: segment.occurrence.event.zIndex ?? 10 + (singleTrack ? segmentIndex : lane)
|
|
1971
2258
|
},
|
|
@@ -1977,7 +2264,7 @@ const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, r
|
|
|
1977
2264
|
}), placement !== "inside" && /* @__PURE__ */ jsx("span", {
|
|
1978
2265
|
"data-slot": "gantt-bar-label",
|
|
1979
2266
|
"data-placement": placement,
|
|
1980
|
-
className: cn("pointer-events-none absolute top-1/2 z-10 max-w-60 -translate-y-1/2 truncate font-medium text-foreground", "group-data-[drag-kind^=resize]/gantt-seg:opacity-0", placement === "after" ? "start-full ms-2" : "end-full me-2"),
|
|
2267
|
+
className: cn("pointer-events-none absolute top-1/2 z-10 max-w-60 -translate-y-1/2 truncate font-medium text-foreground", "group-data-[drag-kind^=resize]/gantt-seg:opacity-0", placement === "after" ? dependencySourceIds.has(segment.occurrence.eventId) ? "start-full ms-4" : "start-full ms-2" : "end-full me-2"),
|
|
1981
2268
|
children: segment.occurrence.event.title
|
|
1982
2269
|
})]
|
|
1983
2270
|
}, segment.occurrence.key);
|
|
@@ -2018,21 +2305,23 @@ const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, r
|
|
|
2018
2305
|
})
|
|
2019
2306
|
] })
|
|
2020
2307
|
}),
|
|
2021
|
-
ghost && /* @__PURE__ */
|
|
2308
|
+
ghost && /* @__PURE__ */ jsxs("div", {
|
|
2022
2309
|
"data-slot": "gantt-drag-ghost",
|
|
2023
2310
|
"data-kind": ghost.kind,
|
|
2311
|
+
"data-milestone": ghost.milestone || void 0,
|
|
2024
2312
|
"data-drop-invalid": !ghost.valid || void 0,
|
|
2025
|
-
className: cn("pointer-events-none absolute z-40 h-
|
|
2313
|
+
className: cn("pointer-events-none absolute z-40 h-(--gantt-ghost-height) rounded-sm border border-dashed font-medium", !ghost.valid && "border-destructive bg-destructive/10 text-destructive", ghost.valid && ghost.kind === "move" && "border-(--gantt-event-color)/50 bg-(--gantt-event-color)/8", ghost.valid && ghost.kind !== "move" && "border-(--gantt-event-color)/70 bg-(--gantt-event-color)/22 text-foreground", ghost.milestone && "flex items-center justify-center rounded-none border-0 bg-transparent"),
|
|
2026
2314
|
style: {
|
|
2027
|
-
insetInlineStart: `${ghost.from * 100}%`,
|
|
2028
|
-
width: `${Math.max((ghost.to - ghost.from) * 100, .5)}%`,
|
|
2315
|
+
insetInlineStart: ghost.milestone ? `clamp(0rem, ${ghost.from * 100}% - ${laneHeightRem / 2}rem, 100% - ${laneHeightRem}rem)` : `${ghost.from * 100}%`,
|
|
2316
|
+
width: ghost.milestone ? `${laneHeightRem}rem` : `${Math.max((ghost.to - ghost.from) * 100, .5)}%`,
|
|
2029
2317
|
top: `${ghostLaneOffsetRem}rem`,
|
|
2318
|
+
"--gantt-ghost-height": `${ghostHeightRem}rem`,
|
|
2030
2319
|
"--gantt-event-color": ghost.color ?? "var(--color-primary)"
|
|
2031
2320
|
},
|
|
2032
|
-
children: ghost.kind !== "move" && /* @__PURE__ */ jsx("span", {
|
|
2321
|
+
children: [ghost.milestone && /* @__PURE__ */ jsx("span", { className: cn("size-2.5 rotate-45 rounded-[2px] border border-dashed", ghost.valid ? "border-(--gantt-event-color)/70 bg-(--gantt-event-color)/10" : "border-destructive bg-destructive/10") }), ghost.kind !== "move" && /* @__PURE__ */ jsx("span", {
|
|
2033
2322
|
className: "pointer-events-none absolute start-full top-1/2 ms-2 max-w-60 -translate-y-1/2 truncate whitespace-nowrap",
|
|
2034
2323
|
children: ghost.title
|
|
2035
|
-
})
|
|
2324
|
+
})]
|
|
2036
2325
|
}),
|
|
2037
2326
|
draft && /* @__PURE__ */ jsx("div", {
|
|
2038
2327
|
"data-slot": "gantt-slot-draft",
|
|
@@ -2105,7 +2394,7 @@ const GanttTimelineRow = memo(function GanttTimelineRow({ row, rowIndex, bars, r
|
|
|
2105
2394
|
});
|
|
2106
2395
|
});
|
|
2107
2396
|
function sameChips(a, b) {
|
|
2108
|
-
return a.length === b.length && a.every((chip, i) => chip.id === b[i].id && chip.side === b[i].side && chip.top === b[i].top && chip.target === b[i].target
|
|
2397
|
+
return a.length === b.length && a.every((chip, i) => chip.id === b[i].id && chip.side === b[i].side && chip.top === b[i].top && chip.target === b[i].target);
|
|
2109
2398
|
}
|
|
2110
2399
|
/**
|
|
2111
2400
|
* Edge chips for rows whose bars sit entirely outside the visible timeline;
|
|
@@ -2131,9 +2420,9 @@ function GanttOffscreenChips({ paneRef, locale }) {
|
|
|
2131
2420
|
const zoomEl = pane.querySelector("[data-slot=gantt-zoom]");
|
|
2132
2421
|
const zoom = zoomEl ? {
|
|
2133
2422
|
top: zoomEl.getBoundingClientRect().top - paneRect.top - 8,
|
|
2134
|
-
bottom: zoomEl.getBoundingClientRect().bottom - paneRect.top + 8
|
|
2135
|
-
inset: paneRect.right - zoomEl.getBoundingClientRect().left + 8
|
|
2423
|
+
bottom: zoomEl.getBoundingClientRect().bottom - paneRect.top + 8
|
|
2136
2424
|
} : null;
|
|
2425
|
+
let chipInZoomBand = false;
|
|
2137
2426
|
const next = [];
|
|
2138
2427
|
for (const rowEl of viewport.querySelectorAll("[data-gantt-row]")) {
|
|
2139
2428
|
const from = parseFloat(rowEl.dataset.ganttBarMin ?? "");
|
|
@@ -2155,19 +2444,18 @@ function GanttOffscreenChips({ paneRef, locale }) {
|
|
|
2155
2444
|
if (endPx <= visibleStart + 2) next.push({
|
|
2156
2445
|
...base,
|
|
2157
2446
|
side: "start",
|
|
2158
|
-
target: startPx - 24
|
|
2159
|
-
insetEnd: 14
|
|
2447
|
+
target: startPx - 24
|
|
2160
2448
|
});
|
|
2161
2449
|
else if (startPx >= visibleEnd - 2) {
|
|
2162
|
-
|
|
2450
|
+
if (zoom && top >= zoom.top && top <= zoom.bottom) chipInZoomBand = true;
|
|
2163
2451
|
next.push({
|
|
2164
2452
|
...base,
|
|
2165
2453
|
side: "end",
|
|
2166
|
-
target: endPx - viewport.clientWidth + 24
|
|
2167
|
-
insetEnd: overlapsZoom ? Math.max(14, zoom.inset) : 14
|
|
2454
|
+
target: endPx - viewport.clientWidth + 24
|
|
2168
2455
|
});
|
|
2169
2456
|
}
|
|
2170
2457
|
}
|
|
2458
|
+
zoomEl?.style.setProperty("--gantt-zoom-shift", chipInZoomBand ? "28px" : "0px");
|
|
2171
2459
|
setChips((prev) => sameChips(prev, next) ? prev : next);
|
|
2172
2460
|
};
|
|
2173
2461
|
const schedule = () => {
|
|
@@ -2181,6 +2469,7 @@ function GanttOffscreenChips({ paneRef, locale }) {
|
|
|
2181
2469
|
viewport.removeEventListener("scroll", schedule);
|
|
2182
2470
|
observer.disconnect();
|
|
2183
2471
|
if (raf) cancelAnimationFrame(raf);
|
|
2472
|
+
pane.querySelector("[data-slot=gantt-zoom]")?.style.removeProperty("--gantt-zoom-shift");
|
|
2184
2473
|
};
|
|
2185
2474
|
}, [paneRef]);
|
|
2186
2475
|
if (chips.length === 0) return null;
|
|
@@ -2210,7 +2499,7 @@ function GanttOffscreenChips({ paneRef, locale }) {
|
|
|
2210
2499
|
className: "pointer-events-auto absolute flex size-5 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full border bg-background text-muted-foreground shadow-xs hover:text-foreground",
|
|
2211
2500
|
style: {
|
|
2212
2501
|
top: chip.top,
|
|
2213
|
-
...chip.side === "start" ? { insetInlineStart: "0.5rem" } : { insetInlineEnd:
|
|
2502
|
+
...chip.side === "start" ? { insetInlineStart: "0.5rem" } : { insetInlineEnd: "0.875rem" }
|
|
2214
2503
|
},
|
|
2215
2504
|
onClick: () => scrollTo(chip)
|
|
2216
2505
|
}),
|