@underverse-ui/underverse 0.2.96 → 0.2.97
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 +22 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +22 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8308,9 +8308,9 @@ function useClientWidth(ref) {
|
|
|
8308
8308
|
var SIZE_CONFIG_BY_SIZE = {
|
|
8309
8309
|
sm: {
|
|
8310
8310
|
resourceColumnWidth: 200,
|
|
8311
|
-
rowHeight:
|
|
8311
|
+
rowHeight: 66,
|
|
8312
8312
|
slotMinWidth: 52,
|
|
8313
|
-
eventHeight:
|
|
8313
|
+
eventHeight: 40,
|
|
8314
8314
|
laneGap: 3,
|
|
8315
8315
|
lanePaddingY: 5,
|
|
8316
8316
|
densityClass: "text-xs",
|
|
@@ -8324,9 +8324,9 @@ var SIZE_CONFIG_BY_SIZE = {
|
|
|
8324
8324
|
},
|
|
8325
8325
|
md: {
|
|
8326
8326
|
resourceColumnWidth: 240,
|
|
8327
|
-
rowHeight:
|
|
8327
|
+
rowHeight: 78,
|
|
8328
8328
|
slotMinWidth: 64,
|
|
8329
|
-
eventHeight:
|
|
8329
|
+
eventHeight: 48,
|
|
8330
8330
|
laneGap: 4,
|
|
8331
8331
|
lanePaddingY: 6,
|
|
8332
8332
|
densityClass: "text-sm",
|
|
@@ -8340,9 +8340,9 @@ var SIZE_CONFIG_BY_SIZE = {
|
|
|
8340
8340
|
},
|
|
8341
8341
|
xl: {
|
|
8342
8342
|
resourceColumnWidth: 280,
|
|
8343
|
-
rowHeight:
|
|
8343
|
+
rowHeight: 90,
|
|
8344
8344
|
slotMinWidth: 76,
|
|
8345
|
-
eventHeight:
|
|
8345
|
+
eventHeight: 56,
|
|
8346
8346
|
laneGap: 5,
|
|
8347
8347
|
lanePaddingY: 8,
|
|
8348
8348
|
densityClass: "text-base",
|
|
@@ -8546,18 +8546,18 @@ function CalendarTimelineHeader(props) {
|
|
|
8546
8546
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("h2", { className: cn("ml-3 font-semibold tracking-tight truncate text-foreground", sizeConfig.titleClass), children: title })
|
|
8547
8547
|
] }),
|
|
8548
8548
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8549
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8549
|
+
onNewEventClick ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
8550
8550
|
Button_default,
|
|
8551
8551
|
{
|
|
8552
8552
|
variant: "default",
|
|
8553
8553
|
size: "sm",
|
|
8554
8554
|
icon: import_lucide_react18.Plus,
|
|
8555
|
-
disabled: newEventDisabled
|
|
8555
|
+
disabled: newEventDisabled,
|
|
8556
8556
|
onClick: onNewEventClick,
|
|
8557
8557
|
className: cn(sizeConfig.controlButtonTextClass, "rounded-lg font-medium transition-all duration-200 gap-1.5"),
|
|
8558
8558
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "hidden sm:inline", children: newEventLabel })
|
|
8559
8559
|
}
|
|
8560
|
-
),
|
|
8560
|
+
) : null,
|
|
8561
8561
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center bg-muted/40 rounded-xl p-1 gap-0.5", children: ["month", "week", "day"].map((v) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
8562
8562
|
Button_default,
|
|
8563
8563
|
{
|
|
@@ -8760,6 +8760,7 @@ function CalendarTimeline({
|
|
|
8760
8760
|
const resolvedLocale = React28.useMemo(() => localeToBCP47(locale ?? detectedLocale), [locale, detectedLocale]);
|
|
8761
8761
|
const resolvedTimeZone = React28.useMemo(() => timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC", [timeZone]);
|
|
8762
8762
|
const effectiveEnableEventSheet = enableEventSheet ?? Boolean(renderEventSheet);
|
|
8763
|
+
const isViewOnly = interactions?.mode === "view";
|
|
8763
8764
|
const isControlledSelectedEventId = selectedEventId !== void 0;
|
|
8764
8765
|
const [internalSelectedEventId, setInternalSelectedEventId] = React28.useState(defaultSelectedEventId ?? null);
|
|
8765
8766
|
const activeSelectedEventId = isControlledSelectedEventId ? selectedEventId : internalSelectedEventId;
|
|
@@ -8785,15 +8786,17 @@ function CalendarTimeline({
|
|
|
8785
8786
|
const canResizeColumn = React28.useMemo(() => {
|
|
8786
8787
|
const cfg = enableLayoutResize;
|
|
8787
8788
|
if (!cfg) return false;
|
|
8789
|
+
if (isViewOnly) return false;
|
|
8788
8790
|
if (cfg === true) return true;
|
|
8789
8791
|
return cfg.column !== false;
|
|
8790
|
-
}, [enableLayoutResize]);
|
|
8792
|
+
}, [enableLayoutResize, isViewOnly]);
|
|
8791
8793
|
const canResizeRow = React28.useMemo(() => {
|
|
8792
8794
|
const cfg = enableLayoutResize;
|
|
8793
8795
|
if (!cfg) return false;
|
|
8796
|
+
if (isViewOnly) return false;
|
|
8794
8797
|
if (cfg === true) return true;
|
|
8795
8798
|
return cfg.row !== false;
|
|
8796
|
-
}, [enableLayoutResize]);
|
|
8799
|
+
}, [enableLayoutResize, isViewOnly]);
|
|
8797
8800
|
const isControlledResourceColumnWidth = resourceColumnWidth !== void 0;
|
|
8798
8801
|
const [internalResourceColumnWidth, setInternalResourceColumnWidth] = React28.useState(() => {
|
|
8799
8802
|
const init = defaultResourceColumnWidth ?? sizeConfig.resourceColumnWidth;
|
|
@@ -9108,7 +9111,7 @@ function CalendarTimeline({
|
|
|
9108
9111
|
const laneGap = sizeConfig.laneGap;
|
|
9109
9112
|
const lanePaddingY = sizeConfig.lanePaddingY;
|
|
9110
9113
|
const createMode = interactions?.createMode ?? "drag";
|
|
9111
|
-
const canCreate = (interactions?.creatable ?? false) && !!onCreateEvent;
|
|
9114
|
+
const canCreate = !isViewOnly && (interactions?.creatable ?? false) && !!onCreateEvent;
|
|
9112
9115
|
const [createOpen, setCreateOpen] = React28.useState(false);
|
|
9113
9116
|
const [createResourceId, setCreateResourceId] = React28.useState(null);
|
|
9114
9117
|
const [createStartIdx, setCreateStartIdx] = React28.useState(0);
|
|
@@ -9202,6 +9205,7 @@ function CalendarTimeline({
|
|
|
9202
9205
|
);
|
|
9203
9206
|
const onPointerDownEvent = (e, ev, mode) => {
|
|
9204
9207
|
if (e.button !== 0 || e.ctrlKey) return;
|
|
9208
|
+
if (isViewOnly) return;
|
|
9205
9209
|
if (ev.resourceId == null) return;
|
|
9206
9210
|
const allowDrag = interactions?.draggableEvents ?? true;
|
|
9207
9211
|
const allowResize = interactions?.resizableEvents ?? true;
|
|
@@ -9229,6 +9233,7 @@ function CalendarTimeline({
|
|
|
9229
9233
|
};
|
|
9230
9234
|
const onPointerDownCell = (e) => {
|
|
9231
9235
|
if (e.button !== 0 || e.ctrlKey) return;
|
|
9236
|
+
if (isViewOnly) return;
|
|
9232
9237
|
if (!(interactions?.creatable ?? false) || !onCreateEvent) return;
|
|
9233
9238
|
if (createMode === "click") return;
|
|
9234
9239
|
const ctx = getPointerContext(e.clientX, e.clientY, { biasLeft: true });
|
|
@@ -9253,6 +9258,7 @@ function CalendarTimeline({
|
|
|
9253
9258
|
};
|
|
9254
9259
|
const onClickCell = (e) => {
|
|
9255
9260
|
if (e.button !== 0 || e.ctrlKey) return;
|
|
9261
|
+
if (isViewOnly) return;
|
|
9256
9262
|
if (!(interactions?.creatable ?? false)) return;
|
|
9257
9263
|
if (createMode !== "click") return;
|
|
9258
9264
|
if (!onCreateEventClick) return;
|
|
@@ -9384,8 +9390,8 @@ function CalendarTimeline({
|
|
|
9384
9390
|
resourcesHeaderLabel: t("resourcesHeader"),
|
|
9385
9391
|
labels: { today: l.today, prev: l.prev, next: l.next, month: l.month, week: l.week, day: l.day },
|
|
9386
9392
|
newEventLabel: l.newEvent,
|
|
9387
|
-
newEventDisabled: !canCreate || resources.length === 0,
|
|
9388
|
-
onNewEventClick: openCreate,
|
|
9393
|
+
newEventDisabled: isViewOnly || !canCreate || resources.length === 0,
|
|
9394
|
+
onNewEventClick: isViewOnly ? void 0 : openCreate,
|
|
9389
9395
|
activeView,
|
|
9390
9396
|
sizeConfig,
|
|
9391
9397
|
navigate,
|
|
@@ -9561,6 +9567,7 @@ function CalendarTimeline({
|
|
|
9561
9567
|
tabIndex: 0,
|
|
9562
9568
|
"aria-label": aria,
|
|
9563
9569
|
onContextMenu: (e) => {
|
|
9570
|
+
if (isViewOnly) return;
|
|
9564
9571
|
if (!onEventDelete) return;
|
|
9565
9572
|
if (interactions?.deletableEvents === false) return;
|
|
9566
9573
|
e.preventDefault();
|
|
@@ -9583,7 +9590,7 @@ function CalendarTimeline({
|
|
|
9583
9590
|
onDoubleClick: () => onEventDoubleClick?.(ev),
|
|
9584
9591
|
onPointerDown: (e) => onPointerDownEvent(e, ev, "move"),
|
|
9585
9592
|
children: [
|
|
9586
|
-
(interactions?.resizableEvents ?? true) && ev.resizable !== false ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
9593
|
+
!isViewOnly && (interactions?.resizableEvents ?? true) && ev.resizable !== false ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
|
|
9587
9594
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
9588
9595
|
"div",
|
|
9589
9596
|
{
|