@firecms/core 3.0.0-canary.183 → 3.0.0-canary.184
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/index.es.js +166 -160
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +166 -160
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/form/validation.ts +12 -6
- package/src/hooks/useBuildNavigationController.tsx +9 -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;
|
package/dist/index.es.js
CHANGED
|
@@ -6127,7 +6127,13 @@ function getYupStringSchema({
|
|
|
6127
6127
|
if (validation.lowercase) collection = collection.lowercase();
|
|
6128
6128
|
if (validation.uppercase) collection = collection.uppercase();
|
|
6129
6129
|
if (property.email) collection = collection.email(`${property.name} must be an email`);
|
|
6130
|
-
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
|
+
}
|
|
6131
6137
|
} else {
|
|
6132
6138
|
collection = collection.notRequired().nullable(true);
|
|
6133
6139
|
}
|
|
@@ -7007,7 +7013,7 @@ function hasEntityInCache(path) {
|
|
|
7007
7013
|
return entityCache.has(path);
|
|
7008
7014
|
}
|
|
7009
7015
|
function removeEntityFromCache(path) {
|
|
7010
|
-
console.
|
|
7016
|
+
console.debug("Removing entity from cache", path);
|
|
7011
7017
|
entityCache.delete(path);
|
|
7012
7018
|
if (isLocalStorageAvailable) {
|
|
7013
7019
|
try {
|
|
@@ -14359,7 +14365,8 @@ function useBuildNavigationController(props) {
|
|
|
14359
14365
|
viewsOrder,
|
|
14360
14366
|
userConfigPersistence,
|
|
14361
14367
|
dataSourceDelegate,
|
|
14362
|
-
injectCollections
|
|
14368
|
+
injectCollections,
|
|
14369
|
+
disabled
|
|
14363
14370
|
} = props;
|
|
14364
14371
|
const navigate = useNavigate();
|
|
14365
14372
|
const collectionsRef = useRef();
|
|
@@ -14445,7 +14452,7 @@ function useBuildNavigationController(props) {
|
|
|
14445
14452
|
};
|
|
14446
14453
|
}, [buildCMSUrlPath, buildUrlCollectionPath]);
|
|
14447
14454
|
const refreshNavigation = useCallback(async () => {
|
|
14448
|
-
if (authController.initialLoading) return;
|
|
14455
|
+
if (disabled || authController.initialLoading) return;
|
|
14449
14456
|
console.debug("Refreshing navigation");
|
|
14450
14457
|
try {
|
|
14451
14458
|
const [resolvedCollections = [], resolvedViews, resolvedAdminViews = []] = await Promise.all([resolveCollections(collectionsProp, collectionPermissions, authController, dataSourceDelegate, injectCollections), resolveCMSViews(viewsProp, authController, dataSourceDelegate), resolveCMSViews(adminViewsProp, authController, dataSourceDelegate)]);
|
|
@@ -14477,7 +14484,7 @@ function useBuildNavigationController(props) {
|
|
|
14477
14484
|
}
|
|
14478
14485
|
if (navigationLoading) setNavigationLoading(false);
|
|
14479
14486
|
if (!initialised) setInitialised(true);
|
|
14480
|
-
}, [collectionsProp, collectionPermissions, authController.user, authController.initialLoading, viewsProp, adminViewsProp, computeTopNavigation, injectCollections]);
|
|
14487
|
+
}, [collectionsProp, collectionPermissions, authController.user, authController.initialLoading, disabled, viewsProp, adminViewsProp, computeTopNavigation, injectCollections]);
|
|
14481
14488
|
useEffect(() => {
|
|
14482
14489
|
refreshNavigation();
|
|
14483
14490
|
}, [refreshNavigation]);
|
|
@@ -16504,12 +16511,13 @@ function MapPropertyPreview(t0) {
|
|
|
16504
16511
|
if ($[10] !== mapProperty.properties || $[11] !== mapPropertyKeys || $[12] !== size || $[13] !== value) {
|
|
16505
16512
|
t2 = /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1 w-full", children: mapPropertyKeys && mapPropertyKeys.map((key_0, index_0) => {
|
|
16506
16513
|
const childProperty = mapProperty.properties[key_0];
|
|
16514
|
+
const isArrayOrMap = childProperty.dataType === "map" || childProperty === "array";
|
|
16507
16515
|
return /* @__PURE__ */ jsxs("div", { className: cls(defaultBorderMixin, "last:border-b-0 border-b"), children: [
|
|
16508
16516
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row pt-0.5 pb-0.5 gap-2", children: [
|
|
16509
16517
|
/* @__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: !
|
|
16518
|
+
/* @__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
16519
|
] }),
|
|
16512
|
-
|
|
16520
|
+
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
16521
|
] }, `map_preview_table_${key_0}}`);
|
|
16514
16522
|
}) });
|
|
16515
16523
|
$[10] = mapProperty.properties;
|
|
@@ -16744,50 +16752,50 @@ const PropertyPreview = React__default.memo(function PropertyPreview2(props) {
|
|
|
16744
16752
|
if (property.dataType === "string") {
|
|
16745
16753
|
const stringProperty = property;
|
|
16746
16754
|
if (typeof value === "string") {
|
|
16747
|
-
if (stringProperty.
|
|
16748
|
-
|
|
16749
|
-
|
|
16750
|
-
|
|
16751
|
-
|
|
16752
|
-
|
|
16753
|
-
|
|
16754
|
-
|
|
16755
|
-
|
|
16756
|
-
|
|
16757
|
-
|
|
16758
|
-
content = t02;
|
|
16755
|
+
if (stringProperty.storage) {
|
|
16756
|
+
const filePath = stringProperty.storage.previewUrl ? stringProperty.storage.previewUrl(value) : value;
|
|
16757
|
+
const t02 = property.storage?.storeUrl ?? false;
|
|
16758
|
+
let t1;
|
|
16759
|
+
if ($[12] !== filePath || $[13] !== interactive || $[14] !== props.size || $[15] !== t02) {
|
|
16760
|
+
t1 = /* @__PURE__ */ jsx(StorageThumbnail, { interactive, storeUrl: t02, size: props.size, storagePathOrDownloadUrl: filePath });
|
|
16761
|
+
$[12] = filePath;
|
|
16762
|
+
$[13] = interactive;
|
|
16763
|
+
$[14] = props.size;
|
|
16764
|
+
$[15] = t02;
|
|
16765
|
+
$[16] = t1;
|
|
16759
16766
|
} else {
|
|
16760
|
-
|
|
16761
|
-
content = /* @__PURE__ */ jsx(UrlComponentPreview, { size: props.size, url: value, interactive, previewType: stringProperty.url });
|
|
16762
|
-
}
|
|
16767
|
+
t1 = $[16];
|
|
16763
16768
|
}
|
|
16769
|
+
content = t1;
|
|
16764
16770
|
} else {
|
|
16765
|
-
if (stringProperty.
|
|
16766
|
-
|
|
16767
|
-
|
|
16768
|
-
|
|
16769
|
-
|
|
16770
|
-
|
|
16771
|
+
if (stringProperty.url) {
|
|
16772
|
+
if (typeof stringProperty.url === "boolean") {
|
|
16773
|
+
let t02;
|
|
16774
|
+
if ($[17] !== props.size || $[18] !== value) {
|
|
16775
|
+
t02 = /* @__PURE__ */ jsx(UrlComponentPreview, { size: props.size, url: value });
|
|
16776
|
+
$[17] = props.size;
|
|
16777
|
+
$[18] = value;
|
|
16778
|
+
$[19] = t02;
|
|
16779
|
+
} else {
|
|
16780
|
+
t02 = $[19];
|
|
16781
|
+
}
|
|
16782
|
+
content = t02;
|
|
16771
16783
|
} else {
|
|
16772
|
-
|
|
16784
|
+
if (typeof stringProperty.url === "string") {
|
|
16785
|
+
content = /* @__PURE__ */ jsx(UrlComponentPreview, { size: props.size, url: value, interactive, previewType: stringProperty.url });
|
|
16786
|
+
}
|
|
16773
16787
|
}
|
|
16774
|
-
content = t02;
|
|
16775
16788
|
} 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;
|
|
16789
|
+
if (stringProperty.markdown) {
|
|
16790
|
+
let t02;
|
|
16791
|
+
if ($[20] !== value) {
|
|
16792
|
+
t02 = /* @__PURE__ */ jsx(Markdown, { source: value, size: "small" });
|
|
16793
|
+
$[20] = value;
|
|
16794
|
+
$[21] = t02;
|
|
16787
16795
|
} else {
|
|
16788
|
-
|
|
16796
|
+
t02 = $[21];
|
|
16789
16797
|
}
|
|
16790
|
-
content =
|
|
16798
|
+
content = t02;
|
|
16791
16799
|
} else {
|
|
16792
16800
|
content = /* @__PURE__ */ jsx(StringPropertyPreview, { ...props, property: stringProperty, value });
|
|
16793
16801
|
}
|
|
@@ -22868,7 +22876,7 @@ function DrawerLogo(t0) {
|
|
|
22868
22876
|
return t6;
|
|
22869
22877
|
}
|
|
22870
22878
|
function FireCMSRoute() {
|
|
22871
|
-
const $ = c(
|
|
22879
|
+
const $ = c(32);
|
|
22872
22880
|
const location = useLocation$1();
|
|
22873
22881
|
const navigation = useNavigationController();
|
|
22874
22882
|
const breadcrumbs = useBreadcrumbsController();
|
|
@@ -22883,27 +22891,36 @@ function FireCMSRoute() {
|
|
|
22883
22891
|
t0 = $[1];
|
|
22884
22892
|
}
|
|
22885
22893
|
const isNew = t0;
|
|
22894
|
+
let t1;
|
|
22895
|
+
if ($[2] !== hash2) {
|
|
22896
|
+
t1 = hash2.includes("#copy");
|
|
22897
|
+
$[2] = hash2;
|
|
22898
|
+
$[3] = t1;
|
|
22899
|
+
} else {
|
|
22900
|
+
t1 = $[3];
|
|
22901
|
+
}
|
|
22902
|
+
const isCopy = t1;
|
|
22886
22903
|
const pathname = location.pathname;
|
|
22887
22904
|
let navigationEntries;
|
|
22888
|
-
let t1;
|
|
22889
22905
|
let t2;
|
|
22890
22906
|
let t3;
|
|
22891
|
-
|
|
22907
|
+
let t4;
|
|
22908
|
+
if ($[4] !== breadcrumbs || $[5] !== navigation || $[6] !== pathname) {
|
|
22892
22909
|
const navigationPath = navigation.urlPathToDataPath(pathname);
|
|
22893
|
-
let
|
|
22894
|
-
if ($[
|
|
22895
|
-
|
|
22896
|
-
$[
|
|
22897
|
-
$[
|
|
22910
|
+
let t52;
|
|
22911
|
+
if ($[11] !== navigation.collections) {
|
|
22912
|
+
t52 = navigation.collections ?? [];
|
|
22913
|
+
$[11] = navigation.collections;
|
|
22914
|
+
$[12] = t52;
|
|
22898
22915
|
} else {
|
|
22899
|
-
|
|
22916
|
+
t52 = $[12];
|
|
22900
22917
|
}
|
|
22901
22918
|
navigationEntries = getNavigationEntriesFromPath({
|
|
22902
22919
|
path: navigationPath,
|
|
22903
|
-
collections:
|
|
22920
|
+
collections: t52
|
|
22904
22921
|
});
|
|
22905
|
-
|
|
22906
|
-
|
|
22922
|
+
t3 = useEffect;
|
|
22923
|
+
t4 = () => {
|
|
22907
22924
|
breadcrumbs.set({
|
|
22908
22925
|
breadcrumbs: navigationEntries.map((entry) => {
|
|
22909
22926
|
if (entry.type === "entity") {
|
|
@@ -22931,118 +22948,119 @@ function FireCMSRoute() {
|
|
|
22931
22948
|
})
|
|
22932
22949
|
});
|
|
22933
22950
|
};
|
|
22934
|
-
|
|
22935
|
-
$[
|
|
22936
|
-
$[
|
|
22937
|
-
$[
|
|
22938
|
-
$[
|
|
22939
|
-
$[
|
|
22940
|
-
$[
|
|
22941
|
-
$[
|
|
22951
|
+
t2 = navigationEntries.map(_temp$1).join(",");
|
|
22952
|
+
$[4] = breadcrumbs;
|
|
22953
|
+
$[5] = navigation;
|
|
22954
|
+
$[6] = pathname;
|
|
22955
|
+
$[7] = navigationEntries;
|
|
22956
|
+
$[8] = t2;
|
|
22957
|
+
$[9] = t3;
|
|
22958
|
+
$[10] = t4;
|
|
22942
22959
|
} else {
|
|
22943
|
-
navigationEntries = $[
|
|
22944
|
-
|
|
22945
|
-
|
|
22946
|
-
|
|
22960
|
+
navigationEntries = $[7];
|
|
22961
|
+
t2 = $[8];
|
|
22962
|
+
t3 = $[9];
|
|
22963
|
+
t4 = $[10];
|
|
22947
22964
|
}
|
|
22948
|
-
let
|
|
22949
|
-
if ($[
|
|
22950
|
-
|
|
22951
|
-
$[
|
|
22952
|
-
$[
|
|
22965
|
+
let t5;
|
|
22966
|
+
if ($[13] !== t2) {
|
|
22967
|
+
t5 = [t2];
|
|
22968
|
+
$[13] = t2;
|
|
22969
|
+
$[14] = t5;
|
|
22953
22970
|
} else {
|
|
22954
|
-
|
|
22971
|
+
t5 = $[14];
|
|
22955
22972
|
}
|
|
22956
|
-
|
|
22973
|
+
t3(t4, t5);
|
|
22957
22974
|
if (isNew) {
|
|
22958
|
-
let
|
|
22959
|
-
if ($[
|
|
22960
|
-
|
|
22961
|
-
$[
|
|
22962
|
-
$[
|
|
22963
|
-
$[
|
|
22975
|
+
let t62;
|
|
22976
|
+
if ($[15] !== navigationEntries || $[16] !== pathname) {
|
|
22977
|
+
t62 = /* @__PURE__ */ jsx(EntityFullScreenRoute, { pathname, navigationEntries, isNew: true, isCopy: false });
|
|
22978
|
+
$[15] = navigationEntries;
|
|
22979
|
+
$[16] = pathname;
|
|
22980
|
+
$[17] = t62;
|
|
22964
22981
|
} else {
|
|
22965
|
-
|
|
22982
|
+
t62 = $[17];
|
|
22966
22983
|
}
|
|
22967
|
-
return
|
|
22984
|
+
return t62;
|
|
22968
22985
|
}
|
|
22969
22986
|
if (navigationEntries.length === 1 && navigationEntries[0].type === "collection") {
|
|
22970
|
-
let
|
|
22971
|
-
let
|
|
22972
|
-
if ($[
|
|
22973
|
-
|
|
22987
|
+
let t62;
|
|
22988
|
+
let t7;
|
|
22989
|
+
if ($[18] !== navigation || $[19] !== navigationEntries) {
|
|
22990
|
+
t7 = Symbol.for("react.early_return_sentinel");
|
|
22974
22991
|
bb0: {
|
|
22975
22992
|
const collection = navigation.getCollection(navigationEntries[0].path);
|
|
22976
22993
|
if (!collection) {
|
|
22977
|
-
|
|
22994
|
+
t7 = null;
|
|
22978
22995
|
break bb0;
|
|
22979
22996
|
}
|
|
22980
|
-
let
|
|
22981
|
-
if ($[
|
|
22982
|
-
|
|
22983
|
-
$[
|
|
22997
|
+
let t8;
|
|
22998
|
+
if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
|
|
22999
|
+
t8 = [];
|
|
23000
|
+
$[22] = t8;
|
|
22984
23001
|
} else {
|
|
22985
|
-
|
|
23002
|
+
t8 = $[22];
|
|
22986
23003
|
}
|
|
22987
|
-
|
|
23004
|
+
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
23005
|
}
|
|
22989
|
-
$[
|
|
22990
|
-
$[
|
|
22991
|
-
$[
|
|
22992
|
-
$[
|
|
23006
|
+
$[18] = navigation;
|
|
23007
|
+
$[19] = navigationEntries;
|
|
23008
|
+
$[20] = t62;
|
|
23009
|
+
$[21] = t7;
|
|
22993
23010
|
} else {
|
|
22994
|
-
|
|
22995
|
-
|
|
23011
|
+
t62 = $[20];
|
|
23012
|
+
t7 = $[21];
|
|
22996
23013
|
}
|
|
22997
|
-
if (
|
|
22998
|
-
return
|
|
23014
|
+
if (t7 !== Symbol.for("react.early_return_sentinel")) {
|
|
23015
|
+
return t7;
|
|
22999
23016
|
}
|
|
23000
|
-
return
|
|
23017
|
+
return t62;
|
|
23001
23018
|
}
|
|
23002
23019
|
if (isSidePanel) {
|
|
23003
|
-
let
|
|
23004
|
-
if ($[
|
|
23005
|
-
|
|
23020
|
+
let t62;
|
|
23021
|
+
if ($[23] !== navigation || $[24] !== navigationEntries) {
|
|
23022
|
+
t62 = Symbol.for("react.early_return_sentinel");
|
|
23006
23023
|
bb1: {
|
|
23007
23024
|
const lastCollectionEntry = navigationEntries.findLast(_temp2$1);
|
|
23008
23025
|
if (lastCollectionEntry) {
|
|
23009
23026
|
const collection_0 = navigation.getCollection(lastCollectionEntry.path);
|
|
23010
23027
|
if (!collection_0) {
|
|
23011
|
-
|
|
23028
|
+
t62 = null;
|
|
23012
23029
|
break bb1;
|
|
23013
23030
|
}
|
|
23014
|
-
let
|
|
23015
|
-
if ($[
|
|
23016
|
-
|
|
23017
|
-
$[
|
|
23031
|
+
let t7;
|
|
23032
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23033
|
+
t7 = [];
|
|
23034
|
+
$[26] = t7;
|
|
23018
23035
|
} else {
|
|
23019
|
-
|
|
23036
|
+
t7 = $[26];
|
|
23020
23037
|
}
|
|
23021
|
-
|
|
23038
|
+
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
23039
|
break bb1;
|
|
23023
23040
|
}
|
|
23024
23041
|
}
|
|
23025
|
-
$[
|
|
23026
|
-
$[
|
|
23027
|
-
$[
|
|
23042
|
+
$[23] = navigation;
|
|
23043
|
+
$[24] = navigationEntries;
|
|
23044
|
+
$[25] = t62;
|
|
23028
23045
|
} else {
|
|
23029
|
-
|
|
23046
|
+
t62 = $[25];
|
|
23030
23047
|
}
|
|
23031
|
-
if (
|
|
23032
|
-
return
|
|
23048
|
+
if (t62 !== Symbol.for("react.early_return_sentinel")) {
|
|
23049
|
+
return t62;
|
|
23033
23050
|
}
|
|
23034
23051
|
}
|
|
23035
|
-
let
|
|
23036
|
-
if ($[
|
|
23037
|
-
|
|
23038
|
-
$[
|
|
23039
|
-
$[
|
|
23040
|
-
$[
|
|
23041
|
-
$[
|
|
23052
|
+
let t6;
|
|
23053
|
+
if ($[27] !== isCopy || $[28] !== isNew || $[29] !== navigationEntries || $[30] !== pathname) {
|
|
23054
|
+
t6 = /* @__PURE__ */ jsx(EntityFullScreenRoute, { pathname, navigationEntries, isNew, isCopy });
|
|
23055
|
+
$[27] = isCopy;
|
|
23056
|
+
$[28] = isNew;
|
|
23057
|
+
$[29] = navigationEntries;
|
|
23058
|
+
$[30] = pathname;
|
|
23059
|
+
$[31] = t6;
|
|
23042
23060
|
} else {
|
|
23043
|
-
|
|
23061
|
+
t6 = $[31];
|
|
23044
23062
|
}
|
|
23045
|
-
return
|
|
23063
|
+
return t6;
|
|
23046
23064
|
}
|
|
23047
23065
|
function _temp2$1(entry_1) {
|
|
23048
23066
|
return entry_1.type === "collection";
|
|
@@ -23053,7 +23071,8 @@ function _temp$1(entry_0) {
|
|
|
23053
23071
|
function EntityFullScreenRoute({
|
|
23054
23072
|
pathname,
|
|
23055
23073
|
navigationEntries,
|
|
23056
|
-
isNew
|
|
23074
|
+
isNew,
|
|
23075
|
+
isCopy
|
|
23057
23076
|
}) {
|
|
23058
23077
|
const navigation = useNavigationController();
|
|
23059
23078
|
const navigate = useNavigate();
|
|
@@ -23084,34 +23103,6 @@ function EntityFullScreenRoute({
|
|
|
23084
23103
|
} catch (e) {
|
|
23085
23104
|
console.warn("Blocker not available, navigation will not be blocked");
|
|
23086
23105
|
}
|
|
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
23106
|
const lastCollectionEntry = navigationEntries.findLast((entry_1) => entry_1.type === "collection");
|
|
23116
23107
|
if (isNew && !lastCollectionEntry) {
|
|
23117
23108
|
throw new Error("INTERNAL: No collection found in the navigation");
|
|
@@ -23122,12 +23113,27 @@ function EntityFullScreenRoute({
|
|
|
23122
23113
|
const collection = isNew ? lastCollectionEntry.collection : lastEntityEntry.parentCollection;
|
|
23123
23114
|
const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path);
|
|
23124
23115
|
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
|
-
|
|
23116
|
+
/* @__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) => {
|
|
23117
|
+
console.log("Entity saved", params);
|
|
23118
|
+
navigate(`${basePath}/${params.entityId}`, {
|
|
23119
|
+
replace: true
|
|
23120
|
+
});
|
|
23127
23121
|
}, onTabChange: (params_0) => {
|
|
23128
|
-
updateUrl(params_0.entityId, params_0.selectedTab, !isNew, params_0.path, isNew);
|
|
23129
23122
|
setSelectedTab(params_0.selectedTab);
|
|
23130
|
-
|
|
23123
|
+
if (isNew) {
|
|
23124
|
+
return;
|
|
23125
|
+
}
|
|
23126
|
+
const newSelectedTab = params_0.selectedTab;
|
|
23127
|
+
if (newSelectedTab) {
|
|
23128
|
+
navigate(`${basePath}/${entityId}/${newSelectedTab}`, {
|
|
23129
|
+
replace: true
|
|
23130
|
+
});
|
|
23131
|
+
} else {
|
|
23132
|
+
navigate(`${basePath}/${entityId}`, {
|
|
23133
|
+
replace: true
|
|
23134
|
+
});
|
|
23135
|
+
}
|
|
23136
|
+
}, parentCollectionIds }, collection.id + "_" + (isNew ? "new" : isCopy ? entityId + "_copy" : entityId)),
|
|
23131
23137
|
/* @__PURE__ */ jsx(UnsavedChangesDialog, { open: blocker?.state === "blocked", handleOk: () => blocker?.proceed?.(), handleCancel: () => blocker?.reset?.(), body: "You have unsaved changes in this entity." })
|
|
23132
23138
|
] });
|
|
23133
23139
|
}
|