@underverse-ui/underverse 0.2.86 → 0.2.87
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.cjs +81 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +81 -71
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7891,41 +7891,48 @@ function intervalPack(items) {
|
|
|
7891
7891
|
// ../../components/ui/CalendarTimeline/hooks.ts
|
|
7892
7892
|
var React27 = __toESM(require("react"), 1);
|
|
7893
7893
|
function useHorizontalScrollSync(args) {
|
|
7894
|
-
const { bodyRef, headerRef } = args;
|
|
7894
|
+
const { bodyRef, headerRef, leftRef } = args;
|
|
7895
7895
|
React27.useEffect(() => {
|
|
7896
7896
|
const body = bodyRef.current;
|
|
7897
7897
|
const header = headerRef.current;
|
|
7898
|
+
const left = leftRef?.current ?? null;
|
|
7898
7899
|
if (!body || !header) return;
|
|
7899
7900
|
let raf = 0;
|
|
7900
7901
|
let syncing = false;
|
|
7901
|
-
const
|
|
7902
|
+
const syncFrom = (source) => {
|
|
7902
7903
|
if (syncing) return;
|
|
7903
7904
|
syncing = true;
|
|
7904
|
-
header
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
7911
|
-
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
};
|
|
7917
|
-
const onHeaderScroll = () => {
|
|
7905
|
+
if (source === "header") {
|
|
7906
|
+
const x = header.scrollLeft;
|
|
7907
|
+
if (body.scrollLeft !== x) body.scrollLeft = x;
|
|
7908
|
+
} else if (source === "left" && left) {
|
|
7909
|
+
const y = left.scrollTop;
|
|
7910
|
+
if (body.scrollTop !== y) body.scrollTop = y;
|
|
7911
|
+
} else {
|
|
7912
|
+
const x = body.scrollLeft;
|
|
7913
|
+
const y = body.scrollTop;
|
|
7914
|
+
if (header.scrollLeft !== x) header.scrollLeft = x;
|
|
7915
|
+
if (left && left.scrollTop !== y) left.scrollTop = y;
|
|
7916
|
+
}
|
|
7918
7917
|
cancelAnimationFrame(raf);
|
|
7919
|
-
raf = requestAnimationFrame(
|
|
7918
|
+
raf = requestAnimationFrame(() => {
|
|
7919
|
+
syncing = false;
|
|
7920
|
+
});
|
|
7920
7921
|
};
|
|
7922
|
+
const onBodyScroll = () => syncFrom("body");
|
|
7923
|
+
const onHeaderScroll = () => syncFrom("header");
|
|
7924
|
+
const onLeftScroll = () => syncFrom("left");
|
|
7925
|
+
syncFrom("body");
|
|
7921
7926
|
body.addEventListener("scroll", onBodyScroll, { passive: true });
|
|
7922
7927
|
header.addEventListener("scroll", onHeaderScroll, { passive: true });
|
|
7928
|
+
left?.addEventListener("scroll", onLeftScroll, { passive: true });
|
|
7923
7929
|
return () => {
|
|
7924
7930
|
cancelAnimationFrame(raf);
|
|
7925
7931
|
body.removeEventListener("scroll", onBodyScroll);
|
|
7926
7932
|
header.removeEventListener("scroll", onHeaderScroll);
|
|
7933
|
+
left?.removeEventListener("scroll", onLeftScroll);
|
|
7927
7934
|
};
|
|
7928
|
-
}, [bodyRef, headerRef]);
|
|
7935
|
+
}, [bodyRef, headerRef, leftRef]);
|
|
7929
7936
|
}
|
|
7930
7937
|
function useVirtualRows(args) {
|
|
7931
7938
|
const { enabled, overscan, rowHeight, itemCount, scrollRef } = args;
|
|
@@ -8239,9 +8246,10 @@ function CalendarTimeline({
|
|
|
8239
8246
|
}
|
|
8240
8247
|
return map;
|
|
8241
8248
|
}, [normalizedEvents]);
|
|
8249
|
+
const leftRef = React28.useRef(null);
|
|
8242
8250
|
const bodyRef = React28.useRef(null);
|
|
8243
8251
|
const headerRef = React28.useRef(null);
|
|
8244
|
-
useHorizontalScrollSync({ bodyRef, headerRef });
|
|
8252
|
+
useHorizontalScrollSync({ bodyRef, headerRef, leftRef });
|
|
8245
8253
|
const title = React28.useMemo(() => {
|
|
8246
8254
|
return formatters?.monthTitle?.(activeDate, { locale: resolvedLocale, timeZone: resolvedTimeZone }) ?? defaultMonthTitle(activeDate, resolvedLocale, resolvedTimeZone);
|
|
8247
8255
|
}, [activeDate, formatters, resolvedLocale, resolvedTimeZone]);
|
|
@@ -8587,49 +8595,51 @@ function CalendarTimeline({
|
|
|
8587
8595
|
...rest,
|
|
8588
8596
|
children: [
|
|
8589
8597
|
Header,
|
|
8590
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
children:
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8598
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex min-h-0", children: [
|
|
8599
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8600
|
+
"div",
|
|
8601
|
+
{
|
|
8602
|
+
ref: leftRef,
|
|
8603
|
+
className: "shrink-0 overflow-y-auto overflow-x-hidden scrollbar-none",
|
|
8604
|
+
style: { width: effectiveResourceColumnWidth, minWidth: effectiveResourceColumnWidth },
|
|
8605
|
+
children: [
|
|
8606
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { style: { height: topSpacer } }),
|
|
8607
|
+
rows.slice(startRow, endRow).map((row, idx) => {
|
|
8608
|
+
const rowIndex = startRow + idx;
|
|
8609
|
+
if (row.kind === "group") {
|
|
8610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { style: { height: effectiveRowHeight }, children: renderGroupRow(row.group) }, `lg_${row.group.id}_${rowIndex}`);
|
|
8611
|
+
}
|
|
8612
|
+
const r = row.resource;
|
|
8613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { style: { height: effectiveRowHeight }, children: ResourceCell(r) }, `lr_${r.id}_${rowIndex}`);
|
|
8614
|
+
}),
|
|
8615
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { style: { height: bottomSpacer } })
|
|
8616
|
+
]
|
|
8617
|
+
}
|
|
8618
|
+
),
|
|
8619
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8620
|
+
"div",
|
|
8621
|
+
{
|
|
8622
|
+
ref: bodyRef,
|
|
8623
|
+
className: "relative flex-1 overflow-auto scrollbar-thin scrollbar-thumb-muted scrollbar-track-transparent",
|
|
8624
|
+
onPointerMove,
|
|
8625
|
+
onPointerUp,
|
|
8626
|
+
children: [
|
|
8627
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { style: { height: topSpacer } }),
|
|
8628
|
+
rows.slice(startRow, endRow).map((row, idx) => {
|
|
8629
|
+
const rowIndex = startRow + idx;
|
|
8630
|
+
if (row.kind === "group") {
|
|
8631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex", style: { height: effectiveRowHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "border-b border-border/30 bg-linear-to-r from-muted/15 to-muted/5", style: { width: gridWidth, minWidth: gridWidth } }) }, `rg_${row.group.id}_${rowIndex}`);
|
|
8632
|
+
}
|
|
8633
|
+
const r = row.resource;
|
|
8634
|
+
const layout = layoutsByResource.get(r.id) ?? { visible: [], hidden: [] };
|
|
8635
|
+
const canMore = layout.hidden.length > 0 && !!onMoreClick;
|
|
8636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8637
|
+
"div",
|
|
8638
|
+
{
|
|
8639
|
+
className: "group/row hover:bg-muted/5 transition-colors duration-150",
|
|
8640
|
+
style: { height: effectiveRowHeight },
|
|
8641
|
+
"data-uv-ct-row": r.id,
|
|
8642
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "relative shrink-0", style: { width: gridWidth, minWidth: gridWidth, height: "100%" }, children: [
|
|
8633
8643
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "absolute inset-0", onPointerDown: onPointerDownCell, "data-uv-ct-timeline": true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "absolute inset-0 flex", children: slots.map((s, i2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
8634
8644
|
"div",
|
|
8635
8645
|
{
|
|
@@ -8741,15 +8751,15 @@ function CalendarTimeline({
|
|
|
8741
8751
|
}
|
|
8742
8752
|
) : null
|
|
8743
8753
|
] })
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
)
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
)
|
|
8754
|
+
},
|
|
8755
|
+
`rr_${r.id}_${rowIndex}`
|
|
8756
|
+
);
|
|
8757
|
+
}),
|
|
8758
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { style: { height: bottomSpacer } })
|
|
8759
|
+
]
|
|
8760
|
+
}
|
|
8761
|
+
)
|
|
8762
|
+
] })
|
|
8753
8763
|
]
|
|
8754
8764
|
}
|
|
8755
8765
|
);
|