@underverse-ui/underverse 1.0.11 → 1.0.12
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 +23 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10948,13 +10948,28 @@ function CalendarTimeline({
|
|
|
10948
10948
|
const colMax = maxResourceColumnWidth ?? 520;
|
|
10949
10949
|
const rowMin = minRowHeight ?? 36;
|
|
10950
10950
|
const rowMax = maxRowHeight ?? 120;
|
|
10951
|
-
const
|
|
10952
|
-
|
|
10953
|
-
[onlyView]
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10951
|
+
const viewList = React33.useMemo(() => Array.isArray(view) ? view : void 0, [view]);
|
|
10952
|
+
const availableViews = React33.useMemo(() => {
|
|
10953
|
+
if (onlyView) return [onlyView];
|
|
10954
|
+
if (viewList?.length) return viewList;
|
|
10955
|
+
return ["month", "week", "day", "sprint"];
|
|
10956
|
+
}, [onlyView, viewList]);
|
|
10957
|
+
const isControlledView = view !== void 0 && !Array.isArray(view);
|
|
10958
|
+
const [internalView, setInternalView] = React33.useState(() => {
|
|
10959
|
+
if (onlyView) return onlyView;
|
|
10960
|
+
if (viewList?.length) {
|
|
10961
|
+
if (defaultView && viewList.includes(defaultView)) return defaultView;
|
|
10962
|
+
return viewList[0] ?? defaultView ?? "month";
|
|
10963
|
+
}
|
|
10964
|
+
return defaultView ?? "month";
|
|
10965
|
+
});
|
|
10957
10966
|
const activeView = onlyView ? onlyView : isControlledView ? view : internalView;
|
|
10967
|
+
React33.useEffect(() => {
|
|
10968
|
+
if (onlyView || isControlledView) return;
|
|
10969
|
+
if (!availableViews.includes(internalView)) {
|
|
10970
|
+
setInternalView(availableViews[0] ?? "month");
|
|
10971
|
+
}
|
|
10972
|
+
}, [availableViews, internalView, isControlledView, onlyView]);
|
|
10958
10973
|
const effectiveSlotMinWidth = React33.useMemo(() => {
|
|
10959
10974
|
if (slotMinWidth == null) {
|
|
10960
10975
|
if (activeView === "month" && monthEventStyle === "compact") {
|
|
@@ -10996,10 +11011,11 @@ function CalendarTimeline({
|
|
|
10996
11011
|
const setView = React33.useCallback(
|
|
10997
11012
|
(next) => {
|
|
10998
11013
|
if (onlyView) return;
|
|
11014
|
+
if (!availableViews.includes(next)) return;
|
|
10999
11015
|
if (!isControlledView) setInternalView(next);
|
|
11000
11016
|
onViewChange?.(next);
|
|
11001
11017
|
},
|
|
11002
|
-
[isControlledView, onViewChange, onlyView]
|
|
11018
|
+
[availableViews, isControlledView, onViewChange, onlyView]
|
|
11003
11019
|
);
|
|
11004
11020
|
const setDate = React33.useCallback(
|
|
11005
11021
|
(next) => {
|