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