@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
package/dist/index.umd.js
CHANGED
|
@@ -40,8 +40,6 @@
|
|
|
40
40
|
const DEFAULT_MODE_STATE = {
|
|
41
41
|
mode: "light",
|
|
42
42
|
setMode: (mode) => {
|
|
43
|
-
},
|
|
44
|
-
toggleMode: () => {
|
|
45
43
|
}
|
|
46
44
|
};
|
|
47
45
|
const ModeControllerContext = React.createContext(DEFAULT_MODE_STATE);
|
|
@@ -6129,7 +6127,13 @@
|
|
|
6129
6127
|
if (validation.lowercase) collection = collection.lowercase();
|
|
6130
6128
|
if (validation.uppercase) collection = collection.uppercase();
|
|
6131
6129
|
if (property.email) collection = collection.email(`${property.name} must be an email`);
|
|
6132
|
-
if (property.url)
|
|
6130
|
+
if (property.url) {
|
|
6131
|
+
if (!property.storage || property.storage?.storeUrl) {
|
|
6132
|
+
collection = collection.url(`${property.name} must be a url`);
|
|
6133
|
+
} else {
|
|
6134
|
+
console.warn(`Property ${property.name} has a url validation but its storage configuration is not set to store urls`);
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6133
6137
|
} else {
|
|
6134
6138
|
collection = collection.notRequired().nullable(true);
|
|
6135
6139
|
}
|
|
@@ -7009,7 +7013,7 @@
|
|
|
7009
7013
|
return entityCache.has(path);
|
|
7010
7014
|
}
|
|
7011
7015
|
function removeEntityFromCache(path) {
|
|
7012
|
-
console.
|
|
7016
|
+
console.debug("Removing entity from cache", path);
|
|
7013
7017
|
entityCache.delete(path);
|
|
7014
7018
|
if (isLocalStorageAvailable) {
|
|
7015
7019
|
try {
|
|
@@ -13582,7 +13586,7 @@
|
|
|
13582
13586
|
const authController = useAuthController();
|
|
13583
13587
|
const {
|
|
13584
13588
|
mode,
|
|
13585
|
-
|
|
13589
|
+
setMode
|
|
13586
13590
|
} = useModeController();
|
|
13587
13591
|
const navigate = reactRouterDom.useNavigate();
|
|
13588
13592
|
const largeLayout = useLargeLayout();
|
|
@@ -13682,11 +13686,25 @@
|
|
|
13682
13686
|
t9 = $[22];
|
|
13683
13687
|
}
|
|
13684
13688
|
let t10;
|
|
13685
|
-
if ($[23] !== includeModeToggle || $[24] !== mode || $[25] !==
|
|
13686
|
-
t10 = includeModeToggle && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { color: "inherit", "aria-label": "Open drawer",
|
|
13689
|
+
if ($[23] !== includeModeToggle || $[24] !== mode || $[25] !== setMode) {
|
|
13690
|
+
t10 = includeModeToggle && /* @__PURE__ */ jsxRuntime.jsxs(ui.Menu, { trigger: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { color: "inherit", "aria-label": "Open drawer", size: "large", children: mode === "dark" ? /* @__PURE__ */ jsxRuntime.jsx(ui.DarkModeIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(ui.LightModeIcon, {}) }), children: [
|
|
13691
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { onClick: () => setMode("dark"), children: [
|
|
13692
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.DarkModeIcon, { size: "smallest" }),
|
|
13693
|
+
" Dark"
|
|
13694
|
+
] }),
|
|
13695
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { onClick: () => setMode("light"), children: [
|
|
13696
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.LightModeIcon, { size: "smallest" }),
|
|
13697
|
+
" Light "
|
|
13698
|
+
] }),
|
|
13699
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { onClick: () => setMode("system"), children: [
|
|
13700
|
+
" ",
|
|
13701
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.BrightnessMediumIcon, { size: "smallest" }),
|
|
13702
|
+
"System"
|
|
13703
|
+
] })
|
|
13704
|
+
] });
|
|
13687
13705
|
$[23] = includeModeToggle;
|
|
13688
13706
|
$[24] = mode;
|
|
13689
|
-
$[25] =
|
|
13707
|
+
$[25] = setMode;
|
|
13690
13708
|
$[26] = t10;
|
|
13691
13709
|
} else {
|
|
13692
13710
|
t10 = $[26];
|
|
@@ -14361,7 +14379,8 @@
|
|
|
14361
14379
|
viewsOrder,
|
|
14362
14380
|
userConfigPersistence,
|
|
14363
14381
|
dataSourceDelegate,
|
|
14364
|
-
injectCollections
|
|
14382
|
+
injectCollections,
|
|
14383
|
+
disabled
|
|
14365
14384
|
} = props;
|
|
14366
14385
|
const navigate = reactRouterDom.useNavigate();
|
|
14367
14386
|
const collectionsRef = React.useRef();
|
|
@@ -14447,7 +14466,7 @@
|
|
|
14447
14466
|
};
|
|
14448
14467
|
}, [buildCMSUrlPath, buildUrlCollectionPath]);
|
|
14449
14468
|
const refreshNavigation = React.useCallback(async () => {
|
|
14450
|
-
if (authController.initialLoading) return;
|
|
14469
|
+
if (disabled || authController.initialLoading) return;
|
|
14451
14470
|
console.debug("Refreshing navigation");
|
|
14452
14471
|
try {
|
|
14453
14472
|
const [resolvedCollections = [], resolvedViews, resolvedAdminViews = []] = await Promise.all([resolveCollections(collectionsProp, collectionPermissions, authController, dataSourceDelegate, injectCollections), resolveCMSViews(viewsProp, authController, dataSourceDelegate), resolveCMSViews(adminViewsProp, authController, dataSourceDelegate)]);
|
|
@@ -14479,7 +14498,7 @@
|
|
|
14479
14498
|
}
|
|
14480
14499
|
if (navigationLoading) setNavigationLoading(false);
|
|
14481
14500
|
if (!initialised) setInitialised(true);
|
|
14482
|
-
}, [collectionsProp, collectionPermissions, authController.user, authController.initialLoading, viewsProp, adminViewsProp, computeTopNavigation, injectCollections]);
|
|
14501
|
+
}, [collectionsProp, collectionPermissions, authController.user, authController.initialLoading, disabled, viewsProp, adminViewsProp, computeTopNavigation, injectCollections]);
|
|
14483
14502
|
React.useEffect(() => {
|
|
14484
14503
|
refreshNavigation();
|
|
14485
14504
|
}, [refreshNavigation]);
|
|
@@ -14819,40 +14838,35 @@
|
|
|
14819
14838
|
return mediaQueryList.matches;
|
|
14820
14839
|
}, []);
|
|
14821
14840
|
const prefersDarkModeStorage = localStorage.getItem("prefers-dark-mode") != null ? localStorage.getItem("prefers-dark-mode") === "true" : null;
|
|
14822
|
-
const prefersDarkMode = prefersDarkModeStorage ?? prefersDarkModeQuery;
|
|
14841
|
+
const prefersDarkMode = prefersDarkModeStorage ?? prefersDarkModeQuery();
|
|
14823
14842
|
const [mode, setMode] = React.useState(prefersDarkMode ? "dark" : "light");
|
|
14824
14843
|
React.useEffect(() => {
|
|
14825
14844
|
setMode(prefersDarkMode ? "dark" : "light");
|
|
14826
14845
|
setDocumentMode(prefersDarkMode ? "dark" : "light");
|
|
14827
14846
|
}, [prefersDarkMode]);
|
|
14828
|
-
const setDarkMode = React.useCallback(() => {
|
|
14829
|
-
setMode("dark");
|
|
14830
|
-
setDocumentMode("dark");
|
|
14831
|
-
}, []);
|
|
14832
|
-
const setLightMode = React.useCallback(() => {
|
|
14833
|
-
setMode("light");
|
|
14834
|
-
setDocumentMode("light");
|
|
14835
|
-
}, []);
|
|
14836
14847
|
const setDocumentMode = (mode_0) => {
|
|
14837
14848
|
document.body.style.setProperty("color-scheme", mode_0);
|
|
14838
14849
|
document.documentElement.dataset.theme = mode_0;
|
|
14839
14850
|
};
|
|
14840
|
-
const
|
|
14841
|
-
|
|
14842
|
-
|
|
14843
|
-
|
|
14844
|
-
|
|
14845
|
-
|
|
14851
|
+
const setModeInternal = React.useCallback((mode_1) => {
|
|
14852
|
+
if (mode_1 === "light") {
|
|
14853
|
+
setDocumentMode("light");
|
|
14854
|
+
localStorage.setItem("prefers-dark-mode", "false");
|
|
14855
|
+
setMode("light");
|
|
14856
|
+
} else if (mode_1 === "dark") {
|
|
14857
|
+
setDocumentMode("dark");
|
|
14858
|
+
localStorage.setItem("prefers-dark-mode", "true");
|
|
14859
|
+
setMode("dark");
|
|
14846
14860
|
} else {
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
14861
|
+
const preferredMode = prefersDarkModeQuery() ? "dark" : "light";
|
|
14862
|
+
setDocumentMode(preferredMode);
|
|
14863
|
+
localStorage.removeItem("prefers-dark-mode");
|
|
14864
|
+
setMode(preferredMode);
|
|
14850
14865
|
}
|
|
14851
|
-
}, [
|
|
14866
|
+
}, [prefersDarkModeQuery]);
|
|
14852
14867
|
return {
|
|
14853
14868
|
mode,
|
|
14854
|
-
setMode
|
|
14855
|
-
toggleMode
|
|
14869
|
+
setMode: setModeInternal
|
|
14856
14870
|
};
|
|
14857
14871
|
}
|
|
14858
14872
|
function useValidateAuthenticator(t0) {
|
|
@@ -16506,12 +16520,13 @@
|
|
|
16506
16520
|
if ($[10] !== mapProperty.properties || $[11] !== mapPropertyKeys || $[12] !== size || $[13] !== value) {
|
|
16507
16521
|
t2 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1 w-full", children: mapPropertyKeys && mapPropertyKeys.map((key_0, index_0) => {
|
|
16508
16522
|
const childProperty = mapProperty.properties[key_0];
|
|
16523
|
+
const isArrayOrMap = childProperty.dataType === "map" || childProperty === "array";
|
|
16509
16524
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls(ui.defaultBorderMixin, "last:border-b-0 border-b"), children: [
|
|
16510
16525
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row pt-0.5 pb-0.5 gap-2", children: [
|
|
16511
16526
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-[140px] w-[25%] py-1", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", className: "font-mono break-words", color: "secondary", children: childProperty.name }) }),
|
|
16512
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow max-w-[75%]", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: !
|
|
16527
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow max-w-[75%]", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: !isArrayOrMap && /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { propertyKey: key_0, value: value[key_0], property: childProperty, size }) }) })
|
|
16513
16528
|
] }),
|
|
16514
|
-
|
|
16529
|
+
isArrayOrMap && /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls(ui.defaultBorderMixin, "border-l pl-4 ml-2 my-2"), children: /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { propertyKey: key_0, value: value[key_0], property: childProperty, size }) })
|
|
16515
16530
|
] }, `map_preview_table_${key_0}}`);
|
|
16516
16531
|
}) });
|
|
16517
16532
|
$[10] = mapProperty.properties;
|
|
@@ -16746,50 +16761,50 @@
|
|
|
16746
16761
|
if (property.dataType === "string") {
|
|
16747
16762
|
const stringProperty = property;
|
|
16748
16763
|
if (typeof value === "string") {
|
|
16749
|
-
if (stringProperty.
|
|
16750
|
-
|
|
16751
|
-
|
|
16752
|
-
|
|
16753
|
-
|
|
16754
|
-
|
|
16755
|
-
|
|
16756
|
-
|
|
16757
|
-
|
|
16758
|
-
|
|
16759
|
-
|
|
16760
|
-
content = t02;
|
|
16764
|
+
if (stringProperty.storage) {
|
|
16765
|
+
const filePath = stringProperty.storage.previewUrl ? stringProperty.storage.previewUrl(value) : value;
|
|
16766
|
+
const t02 = property.storage?.storeUrl ?? false;
|
|
16767
|
+
let t1;
|
|
16768
|
+
if ($[12] !== filePath || $[13] !== interactive || $[14] !== props.size || $[15] !== t02) {
|
|
16769
|
+
t1 = /* @__PURE__ */ jsxRuntime.jsx(StorageThumbnail, { interactive, storeUrl: t02, size: props.size, storagePathOrDownloadUrl: filePath });
|
|
16770
|
+
$[12] = filePath;
|
|
16771
|
+
$[13] = interactive;
|
|
16772
|
+
$[14] = props.size;
|
|
16773
|
+
$[15] = t02;
|
|
16774
|
+
$[16] = t1;
|
|
16761
16775
|
} else {
|
|
16762
|
-
|
|
16763
|
-
content = /* @__PURE__ */ jsxRuntime.jsx(UrlComponentPreview, { size: props.size, url: value, interactive, previewType: stringProperty.url });
|
|
16764
|
-
}
|
|
16776
|
+
t1 = $[16];
|
|
16765
16777
|
}
|
|
16778
|
+
content = t1;
|
|
16766
16779
|
} else {
|
|
16767
|
-
if (stringProperty.
|
|
16768
|
-
|
|
16769
|
-
|
|
16770
|
-
|
|
16771
|
-
|
|
16772
|
-
|
|
16780
|
+
if (stringProperty.url) {
|
|
16781
|
+
if (typeof stringProperty.url === "boolean") {
|
|
16782
|
+
let t02;
|
|
16783
|
+
if ($[17] !== props.size || $[18] !== value) {
|
|
16784
|
+
t02 = /* @__PURE__ */ jsxRuntime.jsx(UrlComponentPreview, { size: props.size, url: value });
|
|
16785
|
+
$[17] = props.size;
|
|
16786
|
+
$[18] = value;
|
|
16787
|
+
$[19] = t02;
|
|
16788
|
+
} else {
|
|
16789
|
+
t02 = $[19];
|
|
16790
|
+
}
|
|
16791
|
+
content = t02;
|
|
16773
16792
|
} else {
|
|
16774
|
-
|
|
16793
|
+
if (typeof stringProperty.url === "string") {
|
|
16794
|
+
content = /* @__PURE__ */ jsxRuntime.jsx(UrlComponentPreview, { size: props.size, url: value, interactive, previewType: stringProperty.url });
|
|
16795
|
+
}
|
|
16775
16796
|
}
|
|
16776
|
-
content = t02;
|
|
16777
16797
|
} else {
|
|
16778
|
-
if (stringProperty.
|
|
16779
|
-
|
|
16780
|
-
|
|
16781
|
-
|
|
16782
|
-
|
|
16783
|
-
|
|
16784
|
-
$[17] = filePath;
|
|
16785
|
-
$[18] = interactive;
|
|
16786
|
-
$[19] = props.size;
|
|
16787
|
-
$[20] = t02;
|
|
16788
|
-
$[21] = t1;
|
|
16798
|
+
if (stringProperty.markdown) {
|
|
16799
|
+
let t02;
|
|
16800
|
+
if ($[20] !== value) {
|
|
16801
|
+
t02 = /* @__PURE__ */ jsxRuntime.jsx(ui.Markdown, { source: value, size: "small" });
|
|
16802
|
+
$[20] = value;
|
|
16803
|
+
$[21] = t02;
|
|
16789
16804
|
} else {
|
|
16790
|
-
|
|
16805
|
+
t02 = $[21];
|
|
16791
16806
|
}
|
|
16792
|
-
content =
|
|
16807
|
+
content = t02;
|
|
16793
16808
|
} else {
|
|
16794
16809
|
content = /* @__PURE__ */ jsxRuntime.jsx(StringPropertyPreview, { ...props, property: stringProperty, value });
|
|
16795
16810
|
}
|
|
@@ -22870,7 +22885,7 @@
|
|
|
22870
22885
|
return t6;
|
|
22871
22886
|
}
|
|
22872
22887
|
function FireCMSRoute() {
|
|
22873
|
-
const $ = reactCompilerRuntime.c(
|
|
22888
|
+
const $ = reactCompilerRuntime.c(32);
|
|
22874
22889
|
const location = reactRouter.useLocation();
|
|
22875
22890
|
const navigation = useNavigationController();
|
|
22876
22891
|
const breadcrumbs = useBreadcrumbsController();
|
|
@@ -22885,27 +22900,36 @@
|
|
|
22885
22900
|
t0 = $[1];
|
|
22886
22901
|
}
|
|
22887
22902
|
const isNew = t0;
|
|
22903
|
+
let t1;
|
|
22904
|
+
if ($[2] !== hash2) {
|
|
22905
|
+
t1 = hash2.includes("#copy");
|
|
22906
|
+
$[2] = hash2;
|
|
22907
|
+
$[3] = t1;
|
|
22908
|
+
} else {
|
|
22909
|
+
t1 = $[3];
|
|
22910
|
+
}
|
|
22911
|
+
const isCopy = t1;
|
|
22888
22912
|
const pathname = location.pathname;
|
|
22889
22913
|
let navigationEntries;
|
|
22890
|
-
let t1;
|
|
22891
22914
|
let t2;
|
|
22892
22915
|
let t3;
|
|
22893
|
-
|
|
22916
|
+
let t4;
|
|
22917
|
+
if ($[4] !== breadcrumbs || $[5] !== navigation || $[6] !== pathname) {
|
|
22894
22918
|
const navigationPath = navigation.urlPathToDataPath(pathname);
|
|
22895
|
-
let
|
|
22896
|
-
if ($[
|
|
22897
|
-
|
|
22898
|
-
$[
|
|
22899
|
-
$[
|
|
22919
|
+
let t52;
|
|
22920
|
+
if ($[11] !== navigation.collections) {
|
|
22921
|
+
t52 = navigation.collections ?? [];
|
|
22922
|
+
$[11] = navigation.collections;
|
|
22923
|
+
$[12] = t52;
|
|
22900
22924
|
} else {
|
|
22901
|
-
|
|
22925
|
+
t52 = $[12];
|
|
22902
22926
|
}
|
|
22903
22927
|
navigationEntries = getNavigationEntriesFromPath({
|
|
22904
22928
|
path: navigationPath,
|
|
22905
|
-
collections:
|
|
22929
|
+
collections: t52
|
|
22906
22930
|
});
|
|
22907
|
-
|
|
22908
|
-
|
|
22931
|
+
t3 = React.useEffect;
|
|
22932
|
+
t4 = () => {
|
|
22909
22933
|
breadcrumbs.set({
|
|
22910
22934
|
breadcrumbs: navigationEntries.map((entry) => {
|
|
22911
22935
|
if (entry.type === "entity") {
|
|
@@ -22933,118 +22957,119 @@
|
|
|
22933
22957
|
})
|
|
22934
22958
|
});
|
|
22935
22959
|
};
|
|
22936
|
-
|
|
22937
|
-
$[
|
|
22938
|
-
$[
|
|
22939
|
-
$[
|
|
22940
|
-
$[
|
|
22941
|
-
$[
|
|
22942
|
-
$[
|
|
22943
|
-
$[
|
|
22960
|
+
t2 = navigationEntries.map(_temp$1).join(",");
|
|
22961
|
+
$[4] = breadcrumbs;
|
|
22962
|
+
$[5] = navigation;
|
|
22963
|
+
$[6] = pathname;
|
|
22964
|
+
$[7] = navigationEntries;
|
|
22965
|
+
$[8] = t2;
|
|
22966
|
+
$[9] = t3;
|
|
22967
|
+
$[10] = t4;
|
|
22944
22968
|
} else {
|
|
22945
|
-
navigationEntries = $[
|
|
22946
|
-
|
|
22947
|
-
|
|
22948
|
-
|
|
22969
|
+
navigationEntries = $[7];
|
|
22970
|
+
t2 = $[8];
|
|
22971
|
+
t3 = $[9];
|
|
22972
|
+
t4 = $[10];
|
|
22949
22973
|
}
|
|
22950
|
-
let
|
|
22951
|
-
if ($[
|
|
22952
|
-
|
|
22953
|
-
$[
|
|
22954
|
-
$[
|
|
22974
|
+
let t5;
|
|
22975
|
+
if ($[13] !== t2) {
|
|
22976
|
+
t5 = [t2];
|
|
22977
|
+
$[13] = t2;
|
|
22978
|
+
$[14] = t5;
|
|
22955
22979
|
} else {
|
|
22956
|
-
|
|
22980
|
+
t5 = $[14];
|
|
22957
22981
|
}
|
|
22958
|
-
|
|
22982
|
+
t3(t4, t5);
|
|
22959
22983
|
if (isNew) {
|
|
22960
|
-
let
|
|
22961
|
-
if ($[
|
|
22962
|
-
|
|
22963
|
-
$[
|
|
22964
|
-
$[
|
|
22965
|
-
$[
|
|
22984
|
+
let t62;
|
|
22985
|
+
if ($[15] !== navigationEntries || $[16] !== pathname) {
|
|
22986
|
+
t62 = /* @__PURE__ */ jsxRuntime.jsx(EntityFullScreenRoute, { pathname, navigationEntries, isNew: true, isCopy: false });
|
|
22987
|
+
$[15] = navigationEntries;
|
|
22988
|
+
$[16] = pathname;
|
|
22989
|
+
$[17] = t62;
|
|
22966
22990
|
} else {
|
|
22967
|
-
|
|
22991
|
+
t62 = $[17];
|
|
22968
22992
|
}
|
|
22969
|
-
return
|
|
22993
|
+
return t62;
|
|
22970
22994
|
}
|
|
22971
22995
|
if (navigationEntries.length === 1 && navigationEntries[0].type === "collection") {
|
|
22972
|
-
let
|
|
22973
|
-
let
|
|
22974
|
-
if ($[
|
|
22975
|
-
|
|
22996
|
+
let t62;
|
|
22997
|
+
let t7;
|
|
22998
|
+
if ($[18] !== navigation || $[19] !== navigationEntries) {
|
|
22999
|
+
t7 = Symbol.for("react.early_return_sentinel");
|
|
22976
23000
|
bb0: {
|
|
22977
23001
|
const collection = navigation.getCollection(navigationEntries[0].path);
|
|
22978
23002
|
if (!collection) {
|
|
22979
|
-
|
|
23003
|
+
t7 = null;
|
|
22980
23004
|
break bb0;
|
|
22981
23005
|
}
|
|
22982
|
-
let
|
|
22983
|
-
if ($[
|
|
22984
|
-
|
|
22985
|
-
$[
|
|
23006
|
+
let t8;
|
|
23007
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23008
|
+
t8 = [];
|
|
23009
|
+
$[22] = t8;
|
|
22986
23010
|
} else {
|
|
22987
|
-
|
|
23011
|
+
t8 = $[22];
|
|
22988
23012
|
}
|
|
22989
|
-
|
|
23013
|
+
t62 = /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionView, { isSubCollection: false, parentCollectionIds: t8, fullPath: collection.id, updateUrl: true, ...collection, Actions: toArray(collection.Actions) }, `collection_view_${collection.id ?? collection.path}`);
|
|
22990
23014
|
}
|
|
22991
|
-
$[
|
|
22992
|
-
$[
|
|
22993
|
-
$[
|
|
22994
|
-
$[
|
|
23015
|
+
$[18] = navigation;
|
|
23016
|
+
$[19] = navigationEntries;
|
|
23017
|
+
$[20] = t62;
|
|
23018
|
+
$[21] = t7;
|
|
22995
23019
|
} else {
|
|
22996
|
-
|
|
22997
|
-
|
|
23020
|
+
t62 = $[20];
|
|
23021
|
+
t7 = $[21];
|
|
22998
23022
|
}
|
|
22999
|
-
if (
|
|
23000
|
-
return
|
|
23023
|
+
if (t7 !== Symbol.for("react.early_return_sentinel")) {
|
|
23024
|
+
return t7;
|
|
23001
23025
|
}
|
|
23002
|
-
return
|
|
23026
|
+
return t62;
|
|
23003
23027
|
}
|
|
23004
23028
|
if (isSidePanel) {
|
|
23005
|
-
let
|
|
23006
|
-
if ($[
|
|
23007
|
-
|
|
23029
|
+
let t62;
|
|
23030
|
+
if ($[23] !== navigation || $[24] !== navigationEntries) {
|
|
23031
|
+
t62 = Symbol.for("react.early_return_sentinel");
|
|
23008
23032
|
bb1: {
|
|
23009
23033
|
const lastCollectionEntry = navigationEntries.findLast(_temp2$1);
|
|
23010
23034
|
if (lastCollectionEntry) {
|
|
23011
23035
|
const collection_0 = navigation.getCollection(lastCollectionEntry.path);
|
|
23012
23036
|
if (!collection_0) {
|
|
23013
|
-
|
|
23037
|
+
t62 = null;
|
|
23014
23038
|
break bb1;
|
|
23015
23039
|
}
|
|
23016
|
-
let
|
|
23017
|
-
if ($[
|
|
23018
|
-
|
|
23019
|
-
$[
|
|
23040
|
+
let t7;
|
|
23041
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23042
|
+
t7 = [];
|
|
23043
|
+
$[26] = t7;
|
|
23020
23044
|
} else {
|
|
23021
|
-
|
|
23045
|
+
t7 = $[26];
|
|
23022
23046
|
}
|
|
23023
|
-
|
|
23047
|
+
t62 = /* @__PURE__ */ jsxRuntime.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}`);
|
|
23024
23048
|
break bb1;
|
|
23025
23049
|
}
|
|
23026
23050
|
}
|
|
23027
|
-
$[
|
|
23028
|
-
$[
|
|
23029
|
-
$[
|
|
23051
|
+
$[23] = navigation;
|
|
23052
|
+
$[24] = navigationEntries;
|
|
23053
|
+
$[25] = t62;
|
|
23030
23054
|
} else {
|
|
23031
|
-
|
|
23055
|
+
t62 = $[25];
|
|
23032
23056
|
}
|
|
23033
|
-
if (
|
|
23034
|
-
return
|
|
23057
|
+
if (t62 !== Symbol.for("react.early_return_sentinel")) {
|
|
23058
|
+
return t62;
|
|
23035
23059
|
}
|
|
23036
23060
|
}
|
|
23037
|
-
let
|
|
23038
|
-
if ($[
|
|
23039
|
-
|
|
23040
|
-
$[
|
|
23041
|
-
$[
|
|
23042
|
-
$[
|
|
23043
|
-
$[
|
|
23061
|
+
let t6;
|
|
23062
|
+
if ($[27] !== isCopy || $[28] !== isNew || $[29] !== navigationEntries || $[30] !== pathname) {
|
|
23063
|
+
t6 = /* @__PURE__ */ jsxRuntime.jsx(EntityFullScreenRoute, { pathname, navigationEntries, isNew, isCopy });
|
|
23064
|
+
$[27] = isCopy;
|
|
23065
|
+
$[28] = isNew;
|
|
23066
|
+
$[29] = navigationEntries;
|
|
23067
|
+
$[30] = pathname;
|
|
23068
|
+
$[31] = t6;
|
|
23044
23069
|
} else {
|
|
23045
|
-
|
|
23070
|
+
t6 = $[31];
|
|
23046
23071
|
}
|
|
23047
|
-
return
|
|
23072
|
+
return t6;
|
|
23048
23073
|
}
|
|
23049
23074
|
function _temp2$1(entry_1) {
|
|
23050
23075
|
return entry_1.type === "collection";
|
|
@@ -23055,7 +23080,8 @@
|
|
|
23055
23080
|
function EntityFullScreenRoute({
|
|
23056
23081
|
pathname,
|
|
23057
23082
|
navigationEntries,
|
|
23058
|
-
isNew
|
|
23083
|
+
isNew,
|
|
23084
|
+
isCopy
|
|
23059
23085
|
}) {
|
|
23060
23086
|
const navigation = useNavigationController();
|
|
23061
23087
|
const navigate = reactRouterDom.useNavigate();
|
|
@@ -23086,34 +23112,6 @@
|
|
|
23086
23112
|
} catch (e) {
|
|
23087
23113
|
console.warn("Blocker not available, navigation will not be blocked");
|
|
23088
23114
|
}
|
|
23089
|
-
function updateUrl(entityId_0, newSelectedTab, replace, path, isNew_0) {
|
|
23090
|
-
console.log("Updating url", {
|
|
23091
|
-
entityId: entityId_0,
|
|
23092
|
-
newSelectedTab,
|
|
23093
|
-
replace,
|
|
23094
|
-
basePath,
|
|
23095
|
-
path,
|
|
23096
|
-
isNew: isNew_0
|
|
23097
|
-
});
|
|
23098
|
-
if (!isNew_0 && (newSelectedTab ?? null) === (selectedTab ?? null)) {
|
|
23099
|
-
return;
|
|
23100
|
-
}
|
|
23101
|
-
if (isNew_0) {
|
|
23102
|
-
navigate(`${basePath}/${entityId_0}`, {
|
|
23103
|
-
replace
|
|
23104
|
-
});
|
|
23105
|
-
return;
|
|
23106
|
-
}
|
|
23107
|
-
if (newSelectedTab) {
|
|
23108
|
-
navigate(`${basePath}/${entityId_0}/${newSelectedTab}`, {
|
|
23109
|
-
replace
|
|
23110
|
-
});
|
|
23111
|
-
} else {
|
|
23112
|
-
navigate(`${basePath}/${entityId_0}`, {
|
|
23113
|
-
replace
|
|
23114
|
-
});
|
|
23115
|
-
}
|
|
23116
|
-
}
|
|
23117
23115
|
const lastCollectionEntry = navigationEntries.findLast((entry_1) => entry_1.type === "collection");
|
|
23118
23116
|
if (isNew && !lastCollectionEntry) {
|
|
23119
23117
|
throw new Error("INTERNAL: No collection found in the navigation");
|
|
@@ -23124,12 +23122,27 @@
|
|
|
23124
23122
|
const collection = isNew ? lastCollectionEntry.collection : lastEntityEntry.parentCollection;
|
|
23125
23123
|
const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path);
|
|
23126
23124
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
23127
|
-
/* @__PURE__ */ jsxRuntime.jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, collection, layout: "full_screen", path: collectionPath, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
|
|
23128
|
-
|
|
23125
|
+
/* @__PURE__ */ jsxRuntime.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) => {
|
|
23126
|
+
console.log("Entity saved", params);
|
|
23127
|
+
navigate(`${basePath}/${params.entityId}`, {
|
|
23128
|
+
replace: true
|
|
23129
|
+
});
|
|
23129
23130
|
}, onTabChange: (params_0) => {
|
|
23130
|
-
updateUrl(params_0.entityId, params_0.selectedTab, !isNew, params_0.path, isNew);
|
|
23131
23131
|
setSelectedTab(params_0.selectedTab);
|
|
23132
|
-
|
|
23132
|
+
if (isNew) {
|
|
23133
|
+
return;
|
|
23134
|
+
}
|
|
23135
|
+
const newSelectedTab = params_0.selectedTab;
|
|
23136
|
+
if (newSelectedTab) {
|
|
23137
|
+
navigate(`${basePath}/${entityId}/${newSelectedTab}`, {
|
|
23138
|
+
replace: true
|
|
23139
|
+
});
|
|
23140
|
+
} else {
|
|
23141
|
+
navigate(`${basePath}/${entityId}`, {
|
|
23142
|
+
replace: true
|
|
23143
|
+
});
|
|
23144
|
+
}
|
|
23145
|
+
}, parentCollectionIds }, collection.id + "_" + (isNew ? "new" : isCopy ? entityId + "_copy" : entityId)),
|
|
23133
23146
|
/* @__PURE__ */ jsxRuntime.jsx(UnsavedChangesDialog, { open: blocker?.state === "blocked", handleOk: () => blocker?.proceed?.(), handleCancel: () => blocker?.reset?.(), body: "You have unsaved changes in this entity." })
|
|
23134
23147
|
] });
|
|
23135
23148
|
}
|