@underverse-ui/underverse 1.0.3 → 1.0.4
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 +33 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +33 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8957,6 +8957,8 @@ function CalendarTimelineHeader(props) {
|
|
|
8957
8957
|
newEventDisabled,
|
|
8958
8958
|
onNewEventClick,
|
|
8959
8959
|
activeView,
|
|
8960
|
+
availableViews,
|
|
8961
|
+
showResourceColumn,
|
|
8960
8962
|
sizeConfig,
|
|
8961
8963
|
navigate,
|
|
8962
8964
|
now,
|
|
@@ -8968,6 +8970,12 @@ function CalendarTimelineHeader(props) {
|
|
|
8968
8970
|
headerRef,
|
|
8969
8971
|
slotHeaderNodes
|
|
8970
8972
|
} = props;
|
|
8973
|
+
const resolvedAvailableViews = React28.useMemo(
|
|
8974
|
+
() => availableViews?.length ? availableViews : ["month", "week", "day"],
|
|
8975
|
+
[availableViews]
|
|
8976
|
+
);
|
|
8977
|
+
const showViewSwitcher = resolvedAvailableViews.length > 1;
|
|
8978
|
+
const showLeftColumn = showResourceColumn ?? true;
|
|
8971
8979
|
const dt = useTranslations("DateTimePicker");
|
|
8972
8980
|
const locale = useLocale();
|
|
8973
8981
|
const [todayOpen, setTodayOpen] = React28.useState(false);
|
|
@@ -9152,7 +9160,7 @@ function CalendarTimelineHeader(props) {
|
|
|
9152
9160
|
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "hidden sm:inline", children: newEventLabel })
|
|
9153
9161
|
}
|
|
9154
9162
|
) : null,
|
|
9155
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center bg-muted/40 rounded-full p-1 gap-0.5", children:
|
|
9163
|
+
showViewSwitcher ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center bg-muted/40 rounded-full p-1 gap-0.5", children: resolvedAvailableViews.map((v) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9156
9164
|
Button_default,
|
|
9157
9165
|
{
|
|
9158
9166
|
variant: activeView === v ? "default" : "ghost",
|
|
@@ -9169,11 +9177,11 @@ function CalendarTimelineHeader(props) {
|
|
|
9169
9177
|
]
|
|
9170
9178
|
},
|
|
9171
9179
|
v
|
|
9172
|
-
)) })
|
|
9180
|
+
)) }) : null
|
|
9173
9181
|
] })
|
|
9174
9182
|
] }),
|
|
9175
9183
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex border-t border-border/20", children: [
|
|
9176
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9184
|
+
showLeftColumn ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
9177
9185
|
"div",
|
|
9178
9186
|
{
|
|
9179
9187
|
className: "shrink-0 border-r border-border/30 bg-muted/20 flex items-center justify-center relative group/uv-ct-top-left",
|
|
@@ -9202,7 +9210,7 @@ function CalendarTimelineHeader(props) {
|
|
|
9202
9210
|
) : null
|
|
9203
9211
|
]
|
|
9204
9212
|
}
|
|
9205
|
-
),
|
|
9213
|
+
) : null,
|
|
9206
9214
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref: headerRef, className: "flex-1 min-w-0 overflow-x-auto overflow-y-hidden scrollbar-none", children: slotHeaderNodes })
|
|
9207
9215
|
] })
|
|
9208
9216
|
] });
|
|
@@ -9685,6 +9693,7 @@ function CalendarTimeline({
|
|
|
9685
9693
|
eventSheetOpen,
|
|
9686
9694
|
defaultEventSheetOpen,
|
|
9687
9695
|
onEventSheetOpenChange,
|
|
9696
|
+
onlyView,
|
|
9688
9697
|
view,
|
|
9689
9698
|
defaultView = "month",
|
|
9690
9699
|
onViewChange,
|
|
@@ -9700,6 +9709,7 @@ function CalendarTimeline({
|
|
|
9700
9709
|
groupCollapsed,
|
|
9701
9710
|
defaultGroupCollapsed,
|
|
9702
9711
|
onGroupCollapsedChange,
|
|
9712
|
+
hideResourceColumn,
|
|
9703
9713
|
resourceColumnWidth,
|
|
9704
9714
|
defaultResourceColumnWidth,
|
|
9705
9715
|
onResourceColumnWidthChange,
|
|
@@ -9772,6 +9782,7 @@ function CalendarTimeline({
|
|
|
9772
9782
|
},
|
|
9773
9783
|
[isControlledEventSheetOpen, onEventSheetOpenChange, setSelectedEventId]
|
|
9774
9784
|
);
|
|
9785
|
+
const showResourceColumn = !hideResourceColumn;
|
|
9775
9786
|
const sizeConfig = React32.useMemo(() => getSizeConfig(size), [size]);
|
|
9776
9787
|
const densityClass = sizeConfig.densityClass;
|
|
9777
9788
|
const eventHeight = sizeConfig.eventHeight;
|
|
@@ -9781,16 +9792,18 @@ function CalendarTimeline({
|
|
|
9781
9792
|
const cfg = enableLayoutResize;
|
|
9782
9793
|
if (!cfg) return false;
|
|
9783
9794
|
if (isViewOnly) return false;
|
|
9795
|
+
if (!showResourceColumn) return false;
|
|
9784
9796
|
if (cfg === true) return true;
|
|
9785
9797
|
return cfg.column !== false;
|
|
9786
|
-
}, [enableLayoutResize, isViewOnly]);
|
|
9798
|
+
}, [enableLayoutResize, isViewOnly, showResourceColumn]);
|
|
9787
9799
|
const canResizeRow = React32.useMemo(() => {
|
|
9788
9800
|
const cfg = enableLayoutResize;
|
|
9789
9801
|
if (!cfg) return false;
|
|
9790
9802
|
if (isViewOnly) return false;
|
|
9803
|
+
if (!showResourceColumn) return false;
|
|
9791
9804
|
if (cfg === true) return true;
|
|
9792
9805
|
return cfg.row !== false;
|
|
9793
|
-
}, [enableLayoutResize, isViewOnly]);
|
|
9806
|
+
}, [enableLayoutResize, isViewOnly, showResourceColumn]);
|
|
9794
9807
|
const isControlledResourceColumnWidth = resourceColumnWidth !== void 0;
|
|
9795
9808
|
const [internalResourceColumnWidth, setInternalResourceColumnWidth] = React32.useState(() => {
|
|
9796
9809
|
const init = defaultResourceColumnWidth ?? sizeConfig.resourceColumnWidth;
|
|
@@ -9801,7 +9814,7 @@ function CalendarTimeline({
|
|
|
9801
9814
|
if (defaultResourceColumnWidth == null) return;
|
|
9802
9815
|
setInternalResourceColumnWidth(defaultResourceColumnWidth);
|
|
9803
9816
|
}, [defaultResourceColumnWidth, isControlledResourceColumnWidth]);
|
|
9804
|
-
const effectiveResourceColumnWidth = isControlledResourceColumnWidth ? resourceColumnWidth : internalResourceColumnWidth;
|
|
9817
|
+
const effectiveResourceColumnWidth = showResourceColumn ? isControlledResourceColumnWidth ? resourceColumnWidth : internalResourceColumnWidth : 0;
|
|
9805
9818
|
const isControlledRowHeight = rowHeight !== void 0;
|
|
9806
9819
|
const [internalRowHeight, setInternalRowHeight] = React32.useState(() => defaultRowHeight ?? sizeConfig.rowHeight);
|
|
9807
9820
|
React32.useEffect(() => {
|
|
@@ -9815,9 +9828,13 @@ function CalendarTimeline({
|
|
|
9815
9828
|
const colMax = maxResourceColumnWidth ?? 520;
|
|
9816
9829
|
const rowMin = minRowHeight ?? 36;
|
|
9817
9830
|
const rowMax = maxRowHeight ?? 120;
|
|
9831
|
+
const availableViews = React32.useMemo(
|
|
9832
|
+
() => onlyView ? [onlyView] : ["month", "week", "day"],
|
|
9833
|
+
[onlyView]
|
|
9834
|
+
);
|
|
9818
9835
|
const isControlledView = view !== void 0;
|
|
9819
|
-
const [internalView, setInternalView] = React32.useState(defaultView);
|
|
9820
|
-
const activeView = isControlledView ? view : internalView;
|
|
9836
|
+
const [internalView, setInternalView] = React32.useState(() => onlyView ?? defaultView);
|
|
9837
|
+
const activeView = onlyView ? onlyView : isControlledView ? view : internalView;
|
|
9821
9838
|
const isControlledDate = date !== void 0;
|
|
9822
9839
|
const [internalDate, setInternalDate] = React32.useState(() => defaultDate ?? /* @__PURE__ */ new Date());
|
|
9823
9840
|
const activeDate = isControlledDate ? date : internalDate;
|
|
@@ -9846,10 +9863,11 @@ function CalendarTimeline({
|
|
|
9846
9863
|
);
|
|
9847
9864
|
const setView = React32.useCallback(
|
|
9848
9865
|
(next) => {
|
|
9866
|
+
if (onlyView) return;
|
|
9849
9867
|
if (!isControlledView) setInternalView(next);
|
|
9850
9868
|
onViewChange?.(next);
|
|
9851
9869
|
},
|
|
9852
|
-
[isControlledView, onViewChange]
|
|
9870
|
+
[isControlledView, onViewChange, onlyView]
|
|
9853
9871
|
);
|
|
9854
9872
|
const setDate = React32.useCallback(
|
|
9855
9873
|
(next) => {
|
|
@@ -9958,7 +9976,7 @@ function CalendarTimeline({
|
|
|
9958
9976
|
setEventSheetOpen(false);
|
|
9959
9977
|
}
|
|
9960
9978
|
}, [activeEventSheetOpen, activeSelectedEventId, effectiveEnableEventSheet, selectedEvent, setEventSheetOpen]);
|
|
9961
|
-
useHorizontalScrollSync({ bodyRef, headerRef, leftRef });
|
|
9979
|
+
useHorizontalScrollSync({ bodyRef, headerRef, leftRef: showResourceColumn ? leftRef : void 0 });
|
|
9962
9980
|
const virt = virtualization?.enabled;
|
|
9963
9981
|
const overscan = virtualization?.overscan ?? 8;
|
|
9964
9982
|
const isControlledRowHeights = rowHeights !== void 0;
|
|
@@ -10579,6 +10597,8 @@ function CalendarTimeline({
|
|
|
10579
10597
|
newEventDisabled: isViewOnly || !canCreate || resources.length === 0,
|
|
10580
10598
|
onNewEventClick: isViewOnly ? void 0 : openCreate,
|
|
10581
10599
|
activeView,
|
|
10600
|
+
availableViews,
|
|
10601
|
+
showResourceColumn,
|
|
10582
10602
|
sizeConfig,
|
|
10583
10603
|
navigate,
|
|
10584
10604
|
now: resolvedNow,
|
|
@@ -10616,7 +10636,7 @@ function CalendarTimeline({
|
|
|
10616
10636
|
children: [
|
|
10617
10637
|
Header,
|
|
10618
10638
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex min-h-0", children: [
|
|
10619
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
10639
|
+
showResourceColumn ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
10620
10640
|
"div",
|
|
10621
10641
|
{
|
|
10622
10642
|
ref: leftRef,
|
|
@@ -10645,7 +10665,7 @@ function CalendarTimeline({
|
|
|
10645
10665
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { style: { height: bottomSpacer } })
|
|
10646
10666
|
]
|
|
10647
10667
|
}
|
|
10648
|
-
),
|
|
10668
|
+
) : null,
|
|
10649
10669
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
10650
10670
|
"div",
|
|
10651
10671
|
{
|