@underverse-ui/underverse 0.2.87 → 0.2.88
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 +48 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7802,6 +7802,18 @@ function getZonedParts(date, timeZone) {
|
|
|
7802
7802
|
second: get("second")
|
|
7803
7803
|
};
|
|
7804
7804
|
}
|
|
7805
|
+
function getIsoWeekInfo(date, timeZone) {
|
|
7806
|
+
const p = getZonedParts(date, timeZone);
|
|
7807
|
+
const target = new Date(Date.UTC(p.year, p.month - 1, p.day));
|
|
7808
|
+
const dayNr = (target.getUTCDay() + 6) % 7;
|
|
7809
|
+
target.setUTCDate(target.getUTCDate() - dayNr + 3);
|
|
7810
|
+
const isoYear = target.getUTCFullYear();
|
|
7811
|
+
const firstThursday = new Date(Date.UTC(isoYear, 0, 4));
|
|
7812
|
+
const firstDayNr = (firstThursday.getUTCDay() + 6) % 7;
|
|
7813
|
+
firstThursday.setUTCDate(firstThursday.getUTCDate() - firstDayNr + 3);
|
|
7814
|
+
const week = 1 + Math.round((target.getTime() - firstThursday.getTime()) / (7 * 24 * 60 * 60 * 1e3));
|
|
7815
|
+
return { year: isoYear, week };
|
|
7816
|
+
}
|
|
7805
7817
|
function partsToUtcMs(p) {
|
|
7806
7818
|
return Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second);
|
|
7807
7819
|
}
|
|
@@ -8246,13 +8258,34 @@ function CalendarTimeline({
|
|
|
8246
8258
|
}
|
|
8247
8259
|
return map;
|
|
8248
8260
|
}, [normalizedEvents]);
|
|
8261
|
+
const resourceById = React28.useMemo(() => {
|
|
8262
|
+
const map = /* @__PURE__ */ new Map();
|
|
8263
|
+
for (const r of resources) map.set(r.id, r);
|
|
8264
|
+
return map;
|
|
8265
|
+
}, [resources]);
|
|
8249
8266
|
const leftRef = React28.useRef(null);
|
|
8250
8267
|
const bodyRef = React28.useRef(null);
|
|
8251
8268
|
const headerRef = React28.useRef(null);
|
|
8252
8269
|
useHorizontalScrollSync({ bodyRef, headerRef, leftRef });
|
|
8253
8270
|
const title = React28.useMemo(() => {
|
|
8254
|
-
|
|
8255
|
-
|
|
8271
|
+
if (activeView === "month") {
|
|
8272
|
+
return formatters?.monthTitle?.(activeDate, { locale: resolvedLocale, timeZone: resolvedTimeZone }) ?? defaultMonthTitle(activeDate, resolvedLocale, resolvedTimeZone);
|
|
8273
|
+
}
|
|
8274
|
+
if (activeView === "week") {
|
|
8275
|
+
const { week } = getIsoWeekInfo(range.start, resolvedTimeZone);
|
|
8276
|
+
const fmt2 = getDtf(resolvedLocale, resolvedTimeZone, { month: "short", day: "numeric" });
|
|
8277
|
+
const fmtYear = getDtf(resolvedLocale, resolvedTimeZone, { year: "numeric" });
|
|
8278
|
+
const endInclusive = new Date(range.end.getTime() - 1);
|
|
8279
|
+
const a = fmt2.format(range.start);
|
|
8280
|
+
const b = fmt2.format(endInclusive);
|
|
8281
|
+
const ya = fmtYear.format(range.start);
|
|
8282
|
+
const yb = fmtYear.format(endInclusive);
|
|
8283
|
+
const rangeText = ya === yb ? `${a} \u2013 ${b}, ${ya}` : `${a}, ${ya} \u2013 ${b}, ${yb}`;
|
|
8284
|
+
return `${l.week} ${week} \u2022 ${rangeText}`;
|
|
8285
|
+
}
|
|
8286
|
+
const fmt = getDtf(resolvedLocale, resolvedTimeZone, { weekday: "long", year: "numeric", month: "long", day: "numeric" });
|
|
8287
|
+
return fmt.format(range.start);
|
|
8288
|
+
}, [activeDate, activeView, formatters, l.week, range.end, range.start, resolvedLocale, resolvedTimeZone]);
|
|
8256
8289
|
const densityClass = sizeConfig.densityClass;
|
|
8257
8290
|
const eventHeight = sizeConfig.eventHeight;
|
|
8258
8291
|
const laneGap = sizeConfig.laneGap;
|
|
@@ -8278,10 +8311,9 @@ function CalendarTimeline({
|
|
|
8278
8311
|
const body = bodyRef.current;
|
|
8279
8312
|
if (!body) return null;
|
|
8280
8313
|
const el = document.elementFromPoint(clientX, clientY);
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
const
|
|
8284
|
-
const x = clientX - timelineRect.left + body.scrollLeft;
|
|
8314
|
+
if (!el || !body.contains(el)) return null;
|
|
8315
|
+
const bodyRect = body.getBoundingClientRect();
|
|
8316
|
+
const x = clientX - bodyRect.left + body.scrollLeft;
|
|
8285
8317
|
const slotIdx = clamp3(Math.floor(x / slotWidth), 0, Math.max(0, slots.length - 1));
|
|
8286
8318
|
const rowEl = el?.closest?.("[data-uv-ct-row]");
|
|
8287
8319
|
const rid = rowEl?.dataset?.uvCtRow ?? null;
|
|
@@ -8669,7 +8701,14 @@ function CalendarTimeline({
|
|
|
8669
8701
|
ev.title ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "font-semibold text-[11px] truncate leading-tight", children: ev.title }) : null,
|
|
8670
8702
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-[10px] opacity-70 truncate ml-auto", children: timeText })
|
|
8671
8703
|
] });
|
|
8672
|
-
|
|
8704
|
+
const resource = resourceById.get(ev.resourceId);
|
|
8705
|
+
const tooltipTitle = ev.title || ev.id;
|
|
8706
|
+
const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-0.5", children: [
|
|
8707
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "font-semibold", children: tooltipTitle }),
|
|
8708
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-xs opacity-80", children: timeText }),
|
|
8709
|
+
resource?.label ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-xs opacity-70", children: resource.label }) : null
|
|
8710
|
+
] });
|
|
8711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Tooltip, { content: tooltipContent, placement: "top", delay: { open: 250, close: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
8673
8712
|
"div",
|
|
8674
8713
|
{
|
|
8675
8714
|
className: cn(
|
|
@@ -8714,9 +8753,8 @@ function CalendarTimeline({
|
|
|
8714
8753
|
] }) : null,
|
|
8715
8754
|
node
|
|
8716
8755
|
]
|
|
8717
|
-
}
|
|
8718
|
-
|
|
8719
|
-
);
|
|
8756
|
+
}
|
|
8757
|
+
) }, ev.id);
|
|
8720
8758
|
}),
|
|
8721
8759
|
preview && preview.resourceId === r.id && !preview.eventId ? (() => {
|
|
8722
8760
|
const startIdx = binarySearchLastLE(slotStarts, preview.start);
|