@firecms/core 3.0.0-canary.183 → 3.0.0-canary.186
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/hooks/useBuildNavigationController.d.ts +4 -0
- package/dist/hooks/useModeController.d.ts +1 -2
- package/dist/index.es.js +201 -188
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +200 -187
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/contexts/ModeController.tsx +1 -3
- package/src/core/DefaultAppBar.tsx +16 -10
- package/src/form/validation.ts +12 -6
- package/src/hooks/useBuildModeController.tsx +15 -28
- package/src/hooks/useBuildNavigationController.tsx +9 -2
- package/src/hooks/useModeController.tsx +1 -2
- package/src/preview/PropertyPreview.tsx +8 -8
- package/src/preview/property_previews/MapPropertyPreview.tsx +3 -2
- package/src/routes/FireCMSRoute.tsx +21 -33
- package/src/util/entity_cache.ts +1 -1
|
@@ -18,5 +18,9 @@ export type BuildNavigationContextProps<EC extends EntityCollection, USER extend
|
|
|
18
18
|
* @param collections
|
|
19
19
|
*/
|
|
20
20
|
injectCollections?: (collections: EntityCollection[]) => EntityCollection[];
|
|
21
|
+
/**
|
|
22
|
+
* If true, the navigation logic will not be updated until this flag is false
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
21
25
|
};
|
|
22
26
|
export declare function useBuildNavigationController<EC extends EntityCollection, USER extends User>(props: BuildNavigationContextProps<EC, USER>): NavigationController;
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export interface ModeController {
|
|
6
6
|
mode: "light" | "dark";
|
|
7
|
-
setMode: (mode: "light" | "dark") => void;
|
|
8
|
-
toggleMode: () => void;
|
|
7
|
+
setMode: (mode: "light" | "dark" | "system") => void;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* Hook to retrieve the current mode ("light" | "dark"), and `setMode`
|
package/dist/index.es.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import React__default, { forwardRef, useState, useRef, useEffect, useContext, useCallback, useMemo, createRef, createContext, useLayoutEffect, useDeferredValue, createElement } from "react";
|
|
5
|
-
import { getColorSchemeForSeed, CHIP_COLORS, Tooltip, IconButton, InfoIcon, Typography, cls, ContentCopyIcon, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, ErrorIcon, defaultBorderMixin, OpenInNewIcon, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, Skeleton, paperMixin, EditIcon, KeyboardTabIcon, DoNotDisturbOnIcon, Menu, MoreVertIcon, MenuItem, Checkbox, Chip, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, CenteredView, AssignmentIcon, Label, CloseIcon, TextField, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogTitle, DialogContent, DialogActions, FileCopyIcon, DeleteIcon, AddIcon, ExpandablePanel, Markdown, ArrowForwardIcon, Card, cardMixin, cardClickableMixin, StarIcon, Collapse, Container, NotesIcon, Alert, Tab, Tabs, LoadingButton, CheckIcon, FilterListOffIcon, SearchIcon, Avatar, DarkModeIcon, LightModeIcon, LogoutIcon, HandleIcon, RemoveIcon, KeyboardArrowUpIcon, KeyboardArrowDownIcon, debounce, DescriptionIcon, fieldBackgroundMixin, fieldBackgroundHoverMixin, fieldBackgroundDisabledMixin, ArrowDropDownIcon, ShortTextIcon, SubjectIcon, FormatQuoteIcon, HttpIcon, MailIcon, FlagIcon, ListIcon, ListAltIcon, NumbersIcon, FormatListNumberedIcon, UploadFileIcon, DriveFolderUploadIcon, LinkIcon, AddLinkIcon, ScheduleIcon, BallotIcon, RepeatIcon, ViewStreamIcon, Sheet, OpenInFullIcon, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
|
|
5
|
+
import { getColorSchemeForSeed, CHIP_COLORS, Tooltip, IconButton, InfoIcon, Typography, cls, ContentCopyIcon, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, ErrorIcon, defaultBorderMixin, OpenInNewIcon, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, Skeleton, paperMixin, EditIcon, KeyboardTabIcon, DoNotDisturbOnIcon, Menu, MoreVertIcon, MenuItem, Checkbox, Chip, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, CenteredView, AssignmentIcon, Label, CloseIcon, TextField, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogTitle, DialogContent, DialogActions, FileCopyIcon, DeleteIcon, AddIcon, ExpandablePanel, Markdown, ArrowForwardIcon, Card, cardMixin, cardClickableMixin, StarIcon, Collapse, Container, NotesIcon, Alert, Tab, Tabs, LoadingButton, CheckIcon, FilterListOffIcon, SearchIcon, Avatar, DarkModeIcon, LightModeIcon, BrightnessMediumIcon, LogoutIcon, HandleIcon, RemoveIcon, KeyboardArrowUpIcon, KeyboardArrowDownIcon, debounce, DescriptionIcon, fieldBackgroundMixin, fieldBackgroundHoverMixin, fieldBackgroundDisabledMixin, ArrowDropDownIcon, ShortTextIcon, SubjectIcon, FormatQuoteIcon, HttpIcon, MailIcon, FlagIcon, ListIcon, ListAltIcon, NumbersIcon, FormatListNumberedIcon, UploadFileIcon, DriveFolderUploadIcon, LinkIcon, AddLinkIcon, ScheduleIcon, BallotIcon, RepeatIcon, ViewStreamIcon, Sheet, OpenInFullIcon, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
|
|
6
6
|
import { SnackbarProvider as SnackbarProvider$1, useSnackbar } from "notistack";
|
|
7
7
|
import hash from "object-hash";
|
|
8
8
|
import { useFormex, setIn, getIn, useCreateFormex, Formex, Field } from "@firecms/formex";
|
|
@@ -38,8 +38,6 @@ const SnackbarProvider = (t0) => {
|
|
|
38
38
|
const DEFAULT_MODE_STATE = {
|
|
39
39
|
mode: "light",
|
|
40
40
|
setMode: (mode) => {
|
|
41
|
-
},
|
|
42
|
-
toggleMode: () => {
|
|
43
41
|
}
|
|
44
42
|
};
|
|
45
43
|
const ModeControllerContext = React__default.createContext(DEFAULT_MODE_STATE);
|
|
@@ -6127,7 +6125,13 @@ function getYupStringSchema({
|
|
|
6127
6125
|
if (validation.lowercase) collection = collection.lowercase();
|
|
6128
6126
|
if (validation.uppercase) collection = collection.uppercase();
|
|
6129
6127
|
if (property.email) collection = collection.email(`${property.name} must be an email`);
|
|
6130
|
-
if (property.url)
|
|
6128
|
+
if (property.url) {
|
|
6129
|
+
if (!property.storage || property.storage?.storeUrl) {
|
|
6130
|
+
collection = collection.url(`${property.name} must be a url`);
|
|
6131
|
+
} else {
|
|
6132
|
+
console.warn(`Property ${property.name} has a url validation but its storage configuration is not set to store urls`);
|
|
6133
|
+
}
|
|
6134
|
+
}
|
|
6131
6135
|
} else {
|
|
6132
6136
|
collection = collection.notRequired().nullable(true);
|
|
6133
6137
|
}
|
|
@@ -7007,7 +7011,7 @@ function hasEntityInCache(path) {
|
|
|
7007
7011
|
return entityCache.has(path);
|
|
7008
7012
|
}
|
|
7009
7013
|
function removeEntityFromCache(path) {
|
|
7010
|
-
console.
|
|
7014
|
+
console.debug("Removing entity from cache", path);
|
|
7011
7015
|
entityCache.delete(path);
|
|
7012
7016
|
if (isLocalStorageAvailable) {
|
|
7013
7017
|
try {
|
|
@@ -13580,7 +13584,7 @@ const DefaultAppBar = function DefaultAppBar2(t0) {
|
|
|
13580
13584
|
const authController = useAuthController();
|
|
13581
13585
|
const {
|
|
13582
13586
|
mode,
|
|
13583
|
-
|
|
13587
|
+
setMode
|
|
13584
13588
|
} = useModeController();
|
|
13585
13589
|
const navigate = useNavigate();
|
|
13586
13590
|
const largeLayout = useLargeLayout();
|
|
@@ -13680,11 +13684,25 @@ const DefaultAppBar = function DefaultAppBar2(t0) {
|
|
|
13680
13684
|
t9 = $[22];
|
|
13681
13685
|
}
|
|
13682
13686
|
let t10;
|
|
13683
|
-
if ($[23] !== includeModeToggle || $[24] !== mode || $[25] !==
|
|
13684
|
-
t10 = includeModeToggle && /* @__PURE__ */ jsx(IconButton, { color: "inherit", "aria-label": "Open drawer",
|
|
13687
|
+
if ($[23] !== includeModeToggle || $[24] !== mode || $[25] !== setMode) {
|
|
13688
|
+
t10 = includeModeToggle && /* @__PURE__ */ jsxs(Menu, { trigger: /* @__PURE__ */ jsx(IconButton, { color: "inherit", "aria-label": "Open drawer", size: "large", children: mode === "dark" ? /* @__PURE__ */ jsx(DarkModeIcon, {}) : /* @__PURE__ */ jsx(LightModeIcon, {}) }), children: [
|
|
13689
|
+
/* @__PURE__ */ jsxs(MenuItem, { onClick: () => setMode("dark"), children: [
|
|
13690
|
+
/* @__PURE__ */ jsx(DarkModeIcon, { size: "smallest" }),
|
|
13691
|
+
" Dark"
|
|
13692
|
+
] }),
|
|
13693
|
+
/* @__PURE__ */ jsxs(MenuItem, { onClick: () => setMode("light"), children: [
|
|
13694
|
+
/* @__PURE__ */ jsx(LightModeIcon, { size: "smallest" }),
|
|
13695
|
+
" Light "
|
|
13696
|
+
] }),
|
|
13697
|
+
/* @__PURE__ */ jsxs(MenuItem, { onClick: () => setMode("system"), children: [
|
|
13698
|
+
" ",
|
|
13699
|
+
/* @__PURE__ */ jsx(BrightnessMediumIcon, { size: "smallest" }),
|
|
13700
|
+
"System"
|
|
13701
|
+
] })
|
|
13702
|
+
] });
|
|
13685
13703
|
$[23] = includeModeToggle;
|
|
13686
13704
|
$[24] = mode;
|
|
13687
|
-
$[25] =
|
|
13705
|
+
$[25] = setMode;
|
|
13688
13706
|
$[26] = t10;
|
|
13689
13707
|
} else {
|
|
13690
13708
|
t10 = $[26];
|
|
@@ -14359,7 +14377,8 @@ function useBuildNavigationController(props) {
|
|
|
14359
14377
|
viewsOrder,
|
|
14360
14378
|
userConfigPersistence,
|
|
14361
14379
|
dataSourceDelegate,
|
|
14362
|
-
injectCollections
|
|
14380
|
+
injectCollections,
|
|
14381
|
+
disabled
|
|
14363
14382
|
} = props;
|
|
14364
14383
|
const navigate = useNavigate();
|
|
14365
14384
|
const collectionsRef = useRef();
|
|
@@ -14445,7 +14464,7 @@ function useBuildNavigationController(props) {
|
|
|
14445
14464
|
};
|
|
14446
14465
|
}, [buildCMSUrlPath, buildUrlCollectionPath]);
|
|
14447
14466
|
const refreshNavigation = useCallback(async () => {
|
|
14448
|
-
if (authController.initialLoading) return;
|
|
14467
|
+
if (disabled || authController.initialLoading) return;
|
|
14449
14468
|
console.debug("Refreshing navigation");
|
|
14450
14469
|
try {
|
|
14451
14470
|
const [resolvedCollections = [], resolvedViews, resolvedAdminViews = []] = await Promise.all([resolveCollections(collectionsProp, collectionPermissions, authController, dataSourceDelegate, injectCollections), resolveCMSViews(viewsProp, authController, dataSourceDelegate), resolveCMSViews(adminViewsProp, authController, dataSourceDelegate)]);
|
|
@@ -14477,7 +14496,7 @@ function useBuildNavigationController(props) {
|
|
|
14477
14496
|
}
|
|
14478
14497
|
if (navigationLoading) setNavigationLoading(false);
|
|
14479
14498
|
if (!initialised) setInitialised(true);
|
|
14480
|
-
}, [collectionsProp, collectionPermissions, authController.user, authController.initialLoading, viewsProp, adminViewsProp, computeTopNavigation, injectCollections]);
|
|
14499
|
+
}, [collectionsProp, collectionPermissions, authController.user, authController.initialLoading, disabled, viewsProp, adminViewsProp, computeTopNavigation, injectCollections]);
|
|
14481
14500
|
useEffect(() => {
|
|
14482
14501
|
refreshNavigation();
|
|
14483
14502
|
}, [refreshNavigation]);
|
|
@@ -14817,40 +14836,35 @@ function useBuildModeController() {
|
|
|
14817
14836
|
return mediaQueryList.matches;
|
|
14818
14837
|
}, []);
|
|
14819
14838
|
const prefersDarkModeStorage = localStorage.getItem("prefers-dark-mode") != null ? localStorage.getItem("prefers-dark-mode") === "true" : null;
|
|
14820
|
-
const prefersDarkMode = prefersDarkModeStorage ?? prefersDarkModeQuery;
|
|
14839
|
+
const prefersDarkMode = prefersDarkModeStorage ?? prefersDarkModeQuery();
|
|
14821
14840
|
const [mode, setMode] = useState(prefersDarkMode ? "dark" : "light");
|
|
14822
14841
|
useEffect(() => {
|
|
14823
14842
|
setMode(prefersDarkMode ? "dark" : "light");
|
|
14824
14843
|
setDocumentMode(prefersDarkMode ? "dark" : "light");
|
|
14825
14844
|
}, [prefersDarkMode]);
|
|
14826
|
-
const setDarkMode = useCallback(() => {
|
|
14827
|
-
setMode("dark");
|
|
14828
|
-
setDocumentMode("dark");
|
|
14829
|
-
}, []);
|
|
14830
|
-
const setLightMode = useCallback(() => {
|
|
14831
|
-
setMode("light");
|
|
14832
|
-
setDocumentMode("light");
|
|
14833
|
-
}, []);
|
|
14834
14845
|
const setDocumentMode = (mode_0) => {
|
|
14835
14846
|
document.body.style.setProperty("color-scheme", mode_0);
|
|
14836
14847
|
document.documentElement.dataset.theme = mode_0;
|
|
14837
14848
|
};
|
|
14838
|
-
const
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14849
|
+
const setModeInternal = useCallback((mode_1) => {
|
|
14850
|
+
if (mode_1 === "light") {
|
|
14851
|
+
setDocumentMode("light");
|
|
14852
|
+
localStorage.setItem("prefers-dark-mode", "false");
|
|
14853
|
+
setMode("light");
|
|
14854
|
+
} else if (mode_1 === "dark") {
|
|
14855
|
+
setDocumentMode("dark");
|
|
14856
|
+
localStorage.setItem("prefers-dark-mode", "true");
|
|
14857
|
+
setMode("dark");
|
|
14844
14858
|
} else {
|
|
14845
|
-
|
|
14846
|
-
|
|
14847
|
-
|
|
14859
|
+
const preferredMode = prefersDarkModeQuery() ? "dark" : "light";
|
|
14860
|
+
setDocumentMode(preferredMode);
|
|
14861
|
+
localStorage.removeItem("prefers-dark-mode");
|
|
14862
|
+
setMode(preferredMode);
|
|
14848
14863
|
}
|
|
14849
|
-
}, [
|
|
14864
|
+
}, [prefersDarkModeQuery]);
|
|
14850
14865
|
return {
|
|
14851
14866
|
mode,
|
|
14852
|
-
setMode
|
|
14853
|
-
toggleMode
|
|
14867
|
+
setMode: setModeInternal
|
|
14854
14868
|
};
|
|
14855
14869
|
}
|
|
14856
14870
|
function useValidateAuthenticator(t0) {
|
|
@@ -16504,12 +16518,13 @@ function MapPropertyPreview(t0) {
|
|
|
16504
16518
|
if ($[10] !== mapProperty.properties || $[11] !== mapPropertyKeys || $[12] !== size || $[13] !== value) {
|
|
16505
16519
|
t2 = /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1 w-full", children: mapPropertyKeys && mapPropertyKeys.map((key_0, index_0) => {
|
|
16506
16520
|
const childProperty = mapProperty.properties[key_0];
|
|
16521
|
+
const isArrayOrMap = childProperty.dataType === "map" || childProperty === "array";
|
|
16507
16522
|
return /* @__PURE__ */ jsxs("div", { className: cls(defaultBorderMixin, "last:border-b-0 border-b"), children: [
|
|
16508
16523
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row pt-0.5 pb-0.5 gap-2", children: [
|
|
16509
16524
|
/* @__PURE__ */ jsx("div", { className: "min-w-[140px] w-[25%] py-1", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-mono break-words", color: "secondary", children: childProperty.name }) }),
|
|
16510
|
-
/* @__PURE__ */ jsx("div", { className: "flex-grow max-w-[75%]", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: !
|
|
16525
|
+
/* @__PURE__ */ jsx("div", { className: "flex-grow max-w-[75%]", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: !isArrayOrMap && /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: key_0, value: value[key_0], property: childProperty, size }) }) })
|
|
16511
16526
|
] }),
|
|
16512
|
-
|
|
16527
|
+
isArrayOrMap && /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "border-l pl-4 ml-2 my-2"), children: /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: key_0, value: value[key_0], property: childProperty, size }) })
|
|
16513
16528
|
] }, `map_preview_table_${key_0}}`);
|
|
16514
16529
|
}) });
|
|
16515
16530
|
$[10] = mapProperty.properties;
|
|
@@ -16744,50 +16759,50 @@ const PropertyPreview = React__default.memo(function PropertyPreview2(props) {
|
|
|
16744
16759
|
if (property.dataType === "string") {
|
|
16745
16760
|
const stringProperty = property;
|
|
16746
16761
|
if (typeof value === "string") {
|
|
16747
|
-
if (stringProperty.
|
|
16748
|
-
|
|
16749
|
-
|
|
16750
|
-
|
|
16751
|
-
|
|
16752
|
-
|
|
16753
|
-
|
|
16754
|
-
|
|
16755
|
-
|
|
16756
|
-
|
|
16757
|
-
|
|
16758
|
-
content = t02;
|
|
16762
|
+
if (stringProperty.storage) {
|
|
16763
|
+
const filePath = stringProperty.storage.previewUrl ? stringProperty.storage.previewUrl(value) : value;
|
|
16764
|
+
const t02 = property.storage?.storeUrl ?? false;
|
|
16765
|
+
let t1;
|
|
16766
|
+
if ($[12] !== filePath || $[13] !== interactive || $[14] !== props.size || $[15] !== t02) {
|
|
16767
|
+
t1 = /* @__PURE__ */ jsx(StorageThumbnail, { interactive, storeUrl: t02, size: props.size, storagePathOrDownloadUrl: filePath });
|
|
16768
|
+
$[12] = filePath;
|
|
16769
|
+
$[13] = interactive;
|
|
16770
|
+
$[14] = props.size;
|
|
16771
|
+
$[15] = t02;
|
|
16772
|
+
$[16] = t1;
|
|
16759
16773
|
} else {
|
|
16760
|
-
|
|
16761
|
-
content = /* @__PURE__ */ jsx(UrlComponentPreview, { size: props.size, url: value, interactive, previewType: stringProperty.url });
|
|
16762
|
-
}
|
|
16774
|
+
t1 = $[16];
|
|
16763
16775
|
}
|
|
16776
|
+
content = t1;
|
|
16764
16777
|
} else {
|
|
16765
|
-
if (stringProperty.
|
|
16766
|
-
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
|
|
16770
|
-
|
|
16778
|
+
if (stringProperty.url) {
|
|
16779
|
+
if (typeof stringProperty.url === "boolean") {
|
|
16780
|
+
let t02;
|
|
16781
|
+
if ($[17] !== props.size || $[18] !== value) {
|
|
16782
|
+
t02 = /* @__PURE__ */ jsx(UrlComponentPreview, { size: props.size, url: value });
|
|
16783
|
+
$[17] = props.size;
|
|
16784
|
+
$[18] = value;
|
|
16785
|
+
$[19] = t02;
|
|
16786
|
+
} else {
|
|
16787
|
+
t02 = $[19];
|
|
16788
|
+
}
|
|
16789
|
+
content = t02;
|
|
16771
16790
|
} else {
|
|
16772
|
-
|
|
16791
|
+
if (typeof stringProperty.url === "string") {
|
|
16792
|
+
content = /* @__PURE__ */ jsx(UrlComponentPreview, { size: props.size, url: value, interactive, previewType: stringProperty.url });
|
|
16793
|
+
}
|
|
16773
16794
|
}
|
|
16774
|
-
content = t02;
|
|
16775
16795
|
} else {
|
|
16776
|
-
if (stringProperty.
|
|
16777
|
-
|
|
16778
|
-
|
|
16779
|
-
|
|
16780
|
-
|
|
16781
|
-
|
|
16782
|
-
$[17] = filePath;
|
|
16783
|
-
$[18] = interactive;
|
|
16784
|
-
$[19] = props.size;
|
|
16785
|
-
$[20] = t02;
|
|
16786
|
-
$[21] = t1;
|
|
16796
|
+
if (stringProperty.markdown) {
|
|
16797
|
+
let t02;
|
|
16798
|
+
if ($[20] !== value) {
|
|
16799
|
+
t02 = /* @__PURE__ */ jsx(Markdown, { source: value, size: "small" });
|
|
16800
|
+
$[20] = value;
|
|
16801
|
+
$[21] = t02;
|
|
16787
16802
|
} else {
|
|
16788
|
-
|
|
16803
|
+
t02 = $[21];
|
|
16789
16804
|
}
|
|
16790
|
-
content =
|
|
16805
|
+
content = t02;
|
|
16791
16806
|
} else {
|
|
16792
16807
|
content = /* @__PURE__ */ jsx(StringPropertyPreview, { ...props, property: stringProperty, value });
|
|
16793
16808
|
}
|
|
@@ -22868,7 +22883,7 @@ function DrawerLogo(t0) {
|
|
|
22868
22883
|
return t6;
|
|
22869
22884
|
}
|
|
22870
22885
|
function FireCMSRoute() {
|
|
22871
|
-
const $ = c(
|
|
22886
|
+
const $ = c(32);
|
|
22872
22887
|
const location = useLocation$1();
|
|
22873
22888
|
const navigation = useNavigationController();
|
|
22874
22889
|
const breadcrumbs = useBreadcrumbsController();
|
|
@@ -22883,27 +22898,36 @@ function FireCMSRoute() {
|
|
|
22883
22898
|
t0 = $[1];
|
|
22884
22899
|
}
|
|
22885
22900
|
const isNew = t0;
|
|
22901
|
+
let t1;
|
|
22902
|
+
if ($[2] !== hash2) {
|
|
22903
|
+
t1 = hash2.includes("#copy");
|
|
22904
|
+
$[2] = hash2;
|
|
22905
|
+
$[3] = t1;
|
|
22906
|
+
} else {
|
|
22907
|
+
t1 = $[3];
|
|
22908
|
+
}
|
|
22909
|
+
const isCopy = t1;
|
|
22886
22910
|
const pathname = location.pathname;
|
|
22887
22911
|
let navigationEntries;
|
|
22888
|
-
let t1;
|
|
22889
22912
|
let t2;
|
|
22890
22913
|
let t3;
|
|
22891
|
-
|
|
22914
|
+
let t4;
|
|
22915
|
+
if ($[4] !== breadcrumbs || $[5] !== navigation || $[6] !== pathname) {
|
|
22892
22916
|
const navigationPath = navigation.urlPathToDataPath(pathname);
|
|
22893
|
-
let
|
|
22894
|
-
if ($[
|
|
22895
|
-
|
|
22896
|
-
$[
|
|
22897
|
-
$[
|
|
22917
|
+
let t52;
|
|
22918
|
+
if ($[11] !== navigation.collections) {
|
|
22919
|
+
t52 = navigation.collections ?? [];
|
|
22920
|
+
$[11] = navigation.collections;
|
|
22921
|
+
$[12] = t52;
|
|
22898
22922
|
} else {
|
|
22899
|
-
|
|
22923
|
+
t52 = $[12];
|
|
22900
22924
|
}
|
|
22901
22925
|
navigationEntries = getNavigationEntriesFromPath({
|
|
22902
22926
|
path: navigationPath,
|
|
22903
|
-
collections:
|
|
22927
|
+
collections: t52
|
|
22904
22928
|
});
|
|
22905
|
-
|
|
22906
|
-
|
|
22929
|
+
t3 = useEffect;
|
|
22930
|
+
t4 = () => {
|
|
22907
22931
|
breadcrumbs.set({
|
|
22908
22932
|
breadcrumbs: navigationEntries.map((entry) => {
|
|
22909
22933
|
if (entry.type === "entity") {
|
|
@@ -22931,118 +22955,119 @@ function FireCMSRoute() {
|
|
|
22931
22955
|
})
|
|
22932
22956
|
});
|
|
22933
22957
|
};
|
|
22934
|
-
|
|
22935
|
-
$[
|
|
22936
|
-
$[
|
|
22937
|
-
$[
|
|
22938
|
-
$[
|
|
22939
|
-
$[
|
|
22940
|
-
$[
|
|
22941
|
-
$[
|
|
22958
|
+
t2 = navigationEntries.map(_temp$1).join(",");
|
|
22959
|
+
$[4] = breadcrumbs;
|
|
22960
|
+
$[5] = navigation;
|
|
22961
|
+
$[6] = pathname;
|
|
22962
|
+
$[7] = navigationEntries;
|
|
22963
|
+
$[8] = t2;
|
|
22964
|
+
$[9] = t3;
|
|
22965
|
+
$[10] = t4;
|
|
22942
22966
|
} else {
|
|
22943
|
-
navigationEntries = $[
|
|
22944
|
-
|
|
22945
|
-
|
|
22946
|
-
|
|
22967
|
+
navigationEntries = $[7];
|
|
22968
|
+
t2 = $[8];
|
|
22969
|
+
t3 = $[9];
|
|
22970
|
+
t4 = $[10];
|
|
22947
22971
|
}
|
|
22948
|
-
let
|
|
22949
|
-
if ($[
|
|
22950
|
-
|
|
22951
|
-
$[
|
|
22952
|
-
$[
|
|
22972
|
+
let t5;
|
|
22973
|
+
if ($[13] !== t2) {
|
|
22974
|
+
t5 = [t2];
|
|
22975
|
+
$[13] = t2;
|
|
22976
|
+
$[14] = t5;
|
|
22953
22977
|
} else {
|
|
22954
|
-
|
|
22978
|
+
t5 = $[14];
|
|
22955
22979
|
}
|
|
22956
|
-
|
|
22980
|
+
t3(t4, t5);
|
|
22957
22981
|
if (isNew) {
|
|
22958
|
-
let
|
|
22959
|
-
if ($[
|
|
22960
|
-
|
|
22961
|
-
$[
|
|
22962
|
-
$[
|
|
22963
|
-
$[
|
|
22982
|
+
let t62;
|
|
22983
|
+
if ($[15] !== navigationEntries || $[16] !== pathname) {
|
|
22984
|
+
t62 = /* @__PURE__ */ jsx(EntityFullScreenRoute, { pathname, navigationEntries, isNew: true, isCopy: false });
|
|
22985
|
+
$[15] = navigationEntries;
|
|
22986
|
+
$[16] = pathname;
|
|
22987
|
+
$[17] = t62;
|
|
22964
22988
|
} else {
|
|
22965
|
-
|
|
22989
|
+
t62 = $[17];
|
|
22966
22990
|
}
|
|
22967
|
-
return
|
|
22991
|
+
return t62;
|
|
22968
22992
|
}
|
|
22969
22993
|
if (navigationEntries.length === 1 && navigationEntries[0].type === "collection") {
|
|
22970
|
-
let
|
|
22971
|
-
let
|
|
22972
|
-
if ($[
|
|
22973
|
-
|
|
22994
|
+
let t62;
|
|
22995
|
+
let t7;
|
|
22996
|
+
if ($[18] !== navigation || $[19] !== navigationEntries) {
|
|
22997
|
+
t7 = Symbol.for("react.early_return_sentinel");
|
|
22974
22998
|
bb0: {
|
|
22975
22999
|
const collection = navigation.getCollection(navigationEntries[0].path);
|
|
22976
23000
|
if (!collection) {
|
|
22977
|
-
|
|
23001
|
+
t7 = null;
|
|
22978
23002
|
break bb0;
|
|
22979
23003
|
}
|
|
22980
|
-
let
|
|
22981
|
-
if ($[
|
|
22982
|
-
|
|
22983
|
-
$[
|
|
23004
|
+
let t8;
|
|
23005
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23006
|
+
t8 = [];
|
|
23007
|
+
$[22] = t8;
|
|
22984
23008
|
} else {
|
|
22985
|
-
|
|
23009
|
+
t8 = $[22];
|
|
22986
23010
|
}
|
|
22987
|
-
|
|
23011
|
+
t62 = /* @__PURE__ */ jsx(EntityCollectionView, { isSubCollection: false, parentCollectionIds: t8, fullPath: collection.id, updateUrl: true, ...collection, Actions: toArray(collection.Actions) }, `collection_view_${collection.id ?? collection.path}`);
|
|
22988
23012
|
}
|
|
22989
|
-
$[
|
|
22990
|
-
$[
|
|
22991
|
-
$[
|
|
22992
|
-
$[
|
|
23013
|
+
$[18] = navigation;
|
|
23014
|
+
$[19] = navigationEntries;
|
|
23015
|
+
$[20] = t62;
|
|
23016
|
+
$[21] = t7;
|
|
22993
23017
|
} else {
|
|
22994
|
-
|
|
22995
|
-
|
|
23018
|
+
t62 = $[20];
|
|
23019
|
+
t7 = $[21];
|
|
22996
23020
|
}
|
|
22997
|
-
if (
|
|
22998
|
-
return
|
|
23021
|
+
if (t7 !== Symbol.for("react.early_return_sentinel")) {
|
|
23022
|
+
return t7;
|
|
22999
23023
|
}
|
|
23000
|
-
return
|
|
23024
|
+
return t62;
|
|
23001
23025
|
}
|
|
23002
23026
|
if (isSidePanel) {
|
|
23003
|
-
let
|
|
23004
|
-
if ($[
|
|
23005
|
-
|
|
23027
|
+
let t62;
|
|
23028
|
+
if ($[23] !== navigation || $[24] !== navigationEntries) {
|
|
23029
|
+
t62 = Symbol.for("react.early_return_sentinel");
|
|
23006
23030
|
bb1: {
|
|
23007
23031
|
const lastCollectionEntry = navigationEntries.findLast(_temp2$1);
|
|
23008
23032
|
if (lastCollectionEntry) {
|
|
23009
23033
|
const collection_0 = navigation.getCollection(lastCollectionEntry.path);
|
|
23010
23034
|
if (!collection_0) {
|
|
23011
|
-
|
|
23035
|
+
t62 = null;
|
|
23012
23036
|
break bb1;
|
|
23013
23037
|
}
|
|
23014
|
-
let
|
|
23015
|
-
if ($[
|
|
23016
|
-
|
|
23017
|
-
$[
|
|
23038
|
+
let t7;
|
|
23039
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23040
|
+
t7 = [];
|
|
23041
|
+
$[26] = t7;
|
|
23018
23042
|
} else {
|
|
23019
|
-
|
|
23043
|
+
t7 = $[26];
|
|
23020
23044
|
}
|
|
23021
|
-
|
|
23045
|
+
t62 = /* @__PURE__ */ jsx(EntityCollectionView, { isSubCollection: false, parentCollectionIds: t7, fullPath: collection_0.id, updateUrl: true, ...collection_0, Actions: toArray(collection_0.Actions) }, `collection_view_${collection_0.id ?? collection_0.path}`);
|
|
23022
23046
|
break bb1;
|
|
23023
23047
|
}
|
|
23024
23048
|
}
|
|
23025
|
-
$[
|
|
23026
|
-
$[
|
|
23027
|
-
$[
|
|
23049
|
+
$[23] = navigation;
|
|
23050
|
+
$[24] = navigationEntries;
|
|
23051
|
+
$[25] = t62;
|
|
23028
23052
|
} else {
|
|
23029
|
-
|
|
23053
|
+
t62 = $[25];
|
|
23030
23054
|
}
|
|
23031
|
-
if (
|
|
23032
|
-
return
|
|
23055
|
+
if (t62 !== Symbol.for("react.early_return_sentinel")) {
|
|
23056
|
+
return t62;
|
|
23033
23057
|
}
|
|
23034
23058
|
}
|
|
23035
|
-
let
|
|
23036
|
-
if ($[
|
|
23037
|
-
|
|
23038
|
-
$[
|
|
23039
|
-
$[
|
|
23040
|
-
$[
|
|
23041
|
-
$[
|
|
23059
|
+
let t6;
|
|
23060
|
+
if ($[27] !== isCopy || $[28] !== isNew || $[29] !== navigationEntries || $[30] !== pathname) {
|
|
23061
|
+
t6 = /* @__PURE__ */ jsx(EntityFullScreenRoute, { pathname, navigationEntries, isNew, isCopy });
|
|
23062
|
+
$[27] = isCopy;
|
|
23063
|
+
$[28] = isNew;
|
|
23064
|
+
$[29] = navigationEntries;
|
|
23065
|
+
$[30] = pathname;
|
|
23066
|
+
$[31] = t6;
|
|
23042
23067
|
} else {
|
|
23043
|
-
|
|
23068
|
+
t6 = $[31];
|
|
23044
23069
|
}
|
|
23045
|
-
return
|
|
23070
|
+
return t6;
|
|
23046
23071
|
}
|
|
23047
23072
|
function _temp2$1(entry_1) {
|
|
23048
23073
|
return entry_1.type === "collection";
|
|
@@ -23053,7 +23078,8 @@ function _temp$1(entry_0) {
|
|
|
23053
23078
|
function EntityFullScreenRoute({
|
|
23054
23079
|
pathname,
|
|
23055
23080
|
navigationEntries,
|
|
23056
|
-
isNew
|
|
23081
|
+
isNew,
|
|
23082
|
+
isCopy
|
|
23057
23083
|
}) {
|
|
23058
23084
|
const navigation = useNavigationController();
|
|
23059
23085
|
const navigate = useNavigate();
|
|
@@ -23084,34 +23110,6 @@ function EntityFullScreenRoute({
|
|
|
23084
23110
|
} catch (e) {
|
|
23085
23111
|
console.warn("Blocker not available, navigation will not be blocked");
|
|
23086
23112
|
}
|
|
23087
|
-
function updateUrl(entityId_0, newSelectedTab, replace, path, isNew_0) {
|
|
23088
|
-
console.log("Updating url", {
|
|
23089
|
-
entityId: entityId_0,
|
|
23090
|
-
newSelectedTab,
|
|
23091
|
-
replace,
|
|
23092
|
-
basePath,
|
|
23093
|
-
path,
|
|
23094
|
-
isNew: isNew_0
|
|
23095
|
-
});
|
|
23096
|
-
if (!isNew_0 && (newSelectedTab ?? null) === (selectedTab ?? null)) {
|
|
23097
|
-
return;
|
|
23098
|
-
}
|
|
23099
|
-
if (isNew_0) {
|
|
23100
|
-
navigate(`${basePath}/${entityId_0}`, {
|
|
23101
|
-
replace
|
|
23102
|
-
});
|
|
23103
|
-
return;
|
|
23104
|
-
}
|
|
23105
|
-
if (newSelectedTab) {
|
|
23106
|
-
navigate(`${basePath}/${entityId_0}/${newSelectedTab}`, {
|
|
23107
|
-
replace
|
|
23108
|
-
});
|
|
23109
|
-
} else {
|
|
23110
|
-
navigate(`${basePath}/${entityId_0}`, {
|
|
23111
|
-
replace
|
|
23112
|
-
});
|
|
23113
|
-
}
|
|
23114
|
-
}
|
|
23115
23113
|
const lastCollectionEntry = navigationEntries.findLast((entry_1) => entry_1.type === "collection");
|
|
23116
23114
|
if (isNew && !lastCollectionEntry) {
|
|
23117
23115
|
throw new Error("INTERNAL: No collection found in the navigation");
|
|
@@ -23122,12 +23120,27 @@ function EntityFullScreenRoute({
|
|
|
23122
23120
|
const collection = isNew ? lastCollectionEntry.collection : lastEntityEntry.parentCollection;
|
|
23123
23121
|
const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path);
|
|
23124
23122
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
23125
|
-
/* @__PURE__ */ jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, collection, layout: "full_screen", path: collectionPath, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
|
|
23126
|
-
|
|
23123
|
+
/* @__PURE__ */ jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
|
|
23124
|
+
console.log("Entity saved", params);
|
|
23125
|
+
navigate(`${basePath}/${params.entityId}`, {
|
|
23126
|
+
replace: true
|
|
23127
|
+
});
|
|
23127
23128
|
}, onTabChange: (params_0) => {
|
|
23128
|
-
updateUrl(params_0.entityId, params_0.selectedTab, !isNew, params_0.path, isNew);
|
|
23129
23129
|
setSelectedTab(params_0.selectedTab);
|
|
23130
|
-
|
|
23130
|
+
if (isNew) {
|
|
23131
|
+
return;
|
|
23132
|
+
}
|
|
23133
|
+
const newSelectedTab = params_0.selectedTab;
|
|
23134
|
+
if (newSelectedTab) {
|
|
23135
|
+
navigate(`${basePath}/${entityId}/${newSelectedTab}`, {
|
|
23136
|
+
replace: true
|
|
23137
|
+
});
|
|
23138
|
+
} else {
|
|
23139
|
+
navigate(`${basePath}/${entityId}`, {
|
|
23140
|
+
replace: true
|
|
23141
|
+
});
|
|
23142
|
+
}
|
|
23143
|
+
}, parentCollectionIds }, collection.id + "_" + (isNew ? "new" : isCopy ? entityId + "_copy" : entityId)),
|
|
23131
23144
|
/* @__PURE__ */ jsx(UnsavedChangesDialog, { open: blocker?.state === "blocked", handleOk: () => blocker?.proceed?.(), handleCancel: () => blocker?.reset?.(), body: "You have unsaved changes in this entity." })
|
|
23132
23145
|
] });
|
|
23133
23146
|
}
|