@firecms/core 3.0.0-canary.221 → 3.0.0-canary.223
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +93 -63
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +93 -63
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collections.d.ts +4 -0
- package/dist/types/navigation.d.ts +4 -0
- package/package.json +5 -5
- package/src/components/common/default_entity_actions.tsx +11 -3
- package/src/core/EntityEditView.tsx +1 -1
- package/src/hooks/useBuildNavigationController.tsx +11 -0
- package/src/routes/FireCMSRoute.tsx +10 -2
- package/src/types/collections.ts +5 -0
- package/src/types/navigation.ts +5 -0
- package/src/util/navigation_from_path.ts +5 -1
package/dist/index.es.js
CHANGED
|
@@ -879,7 +879,11 @@ function getNavigationEntriesFromPath(props) {
|
|
|
879
879
|
const result = [];
|
|
880
880
|
for (let i = 0; i < subpathCombinations.length; i++) {
|
|
881
881
|
const subpathCombination = subpathCombinations[i];
|
|
882
|
-
|
|
882
|
+
let collection;
|
|
883
|
+
collection = collections && collections.find((entry) => entry.id === subpathCombination);
|
|
884
|
+
if (!collection) {
|
|
885
|
+
collection = collections && collections.find((entry) => entry.path === subpathCombination);
|
|
886
|
+
}
|
|
883
887
|
if (collection) {
|
|
884
888
|
const pathOrAlias = collection.id ?? collection.path;
|
|
885
889
|
const collectionPath = currentFullPath && currentFullPath.length > 0 ? currentFullPath + "/" + pathOrAlias : pathOrAlias;
|
|
@@ -12204,6 +12208,10 @@ const editEntityAction = {
|
|
|
12204
12208
|
addRecentId(collection.id, entity.id);
|
|
12205
12209
|
}
|
|
12206
12210
|
const path = collection?.collectionGroup ? entity.path : fullPath ?? entity.path;
|
|
12211
|
+
const defaultSelectedView = resolveDefaultSelectedView(collection ? collection.defaultSelectedView : void 0, {
|
|
12212
|
+
status: "existing",
|
|
12213
|
+
entityId: entity.id
|
|
12214
|
+
});
|
|
12207
12215
|
navigateToEntity({
|
|
12208
12216
|
openEntityMode,
|
|
12209
12217
|
collection,
|
|
@@ -12211,7 +12219,8 @@ const editEntityAction = {
|
|
|
12211
12219
|
path,
|
|
12212
12220
|
sideEntityController: context.sideEntityController,
|
|
12213
12221
|
onClose: () => unhighlightEntity?.(entity),
|
|
12214
|
-
navigation: context.navigation
|
|
12222
|
+
navigation: context.navigation,
|
|
12223
|
+
selectedTab: defaultSelectedView
|
|
12215
12224
|
});
|
|
12216
12225
|
return Promise.resolve(void 0);
|
|
12217
12226
|
}
|
|
@@ -20206,29 +20215,36 @@ function useBuildNavigationController(props) {
|
|
|
20206
20215
|
...result
|
|
20207
20216
|
};
|
|
20208
20217
|
}, [userConfigPersistence]);
|
|
20209
|
-
const
|
|
20218
|
+
const getCollectionById = useCallback((id) => {
|
|
20210
20219
|
const collections_1 = collectionsRef.current;
|
|
20211
|
-
if (collections_1 === void 0) throw Error("
|
|
20212
|
-
|
|
20220
|
+
if (collections_1 === void 0) throw Error("getCollectionById: Collections have not been initialised yet");
|
|
20221
|
+
const collection_0 = collections_1.find((c2) => c2.id === id);
|
|
20222
|
+
if (!collection_0) return void 0;
|
|
20223
|
+
return collection_0;
|
|
20224
|
+
}, []);
|
|
20225
|
+
const getCollectionFromPaths = useCallback((pathSegments) => {
|
|
20226
|
+
const collections_2 = collectionsRef.current;
|
|
20227
|
+
if (collections_2 === void 0) throw Error("getCollectionFromPaths: Collections have not been initialised yet");
|
|
20228
|
+
let currentCollections = [...collections_2 ?? []];
|
|
20213
20229
|
for (let i = 0; i < pathSegments.length; i++) {
|
|
20214
20230
|
const pathSegment = pathSegments[i];
|
|
20215
|
-
const
|
|
20216
|
-
if (!
|
|
20217
|
-
currentCollections =
|
|
20218
|
-
if (i === pathSegments.length - 1) return
|
|
20231
|
+
const collection_1 = currentCollections.find((c_0) => c_0.id === pathSegment || c_0.path === pathSegment);
|
|
20232
|
+
if (!collection_1) return void 0;
|
|
20233
|
+
currentCollections = collection_1.subcollections;
|
|
20234
|
+
if (i === pathSegments.length - 1) return collection_1;
|
|
20219
20235
|
}
|
|
20220
20236
|
return void 0;
|
|
20221
20237
|
}, []);
|
|
20222
20238
|
const getCollectionFromIds = useCallback((ids) => {
|
|
20223
|
-
const
|
|
20224
|
-
if (
|
|
20225
|
-
let currentCollections_0 = [...
|
|
20239
|
+
const collections_3 = collectionsRef.current;
|
|
20240
|
+
if (collections_3 === void 0) throw Error("getCollectionFromIds: Collections have not been initialised yet");
|
|
20241
|
+
let currentCollections_0 = [...collections_3 ?? []];
|
|
20226
20242
|
for (let i_0 = 0; i_0 < ids.length; i_0++) {
|
|
20227
|
-
const
|
|
20228
|
-
const
|
|
20229
|
-
if (!
|
|
20230
|
-
currentCollections_0 =
|
|
20231
|
-
if (i_0 === ids.length - 1) return
|
|
20243
|
+
const id_0 = ids[i_0];
|
|
20244
|
+
const collection_2 = currentCollections_0.find((c_1) => c_1.id === id_0);
|
|
20245
|
+
if (!collection_2) return void 0;
|
|
20246
|
+
currentCollections_0 = collection_2.subcollections;
|
|
20247
|
+
if (i_0 === ids.length - 1) return collection_2;
|
|
20232
20248
|
}
|
|
20233
20249
|
return void 0;
|
|
20234
20250
|
}, []);
|
|
@@ -20238,14 +20254,14 @@ function useBuildNavigationController(props) {
|
|
|
20238
20254
|
throw Error("Expected path starting with " + fullCollectionPath);
|
|
20239
20255
|
}, [fullCollectionPath]);
|
|
20240
20256
|
const resolveIdsFrom = useCallback((path_3) => {
|
|
20241
|
-
const
|
|
20242
|
-
return resolveCollectionPathIds(path_3,
|
|
20257
|
+
const collections_4 = collectionsRef.current ?? [];
|
|
20258
|
+
return resolveCollectionPathIds(path_3, collections_4);
|
|
20243
20259
|
}, []);
|
|
20244
20260
|
const getAllParentReferencesForPath = useCallback((path_4) => {
|
|
20245
|
-
const
|
|
20261
|
+
const collections_5 = collectionsRef.current ?? [];
|
|
20246
20262
|
return getParentReferencesFromPath({
|
|
20247
20263
|
path: path_4,
|
|
20248
|
-
collections:
|
|
20264
|
+
collections: collections_5
|
|
20249
20265
|
});
|
|
20250
20266
|
}, []);
|
|
20251
20267
|
const getParentCollectionIds = useCallback((path_5) => {
|
|
@@ -20259,15 +20275,15 @@ function useBuildNavigationController(props) {
|
|
|
20259
20275
|
return result_0.map((r) => getCollectionFromPaths(r)?.id).filter(Boolean);
|
|
20260
20276
|
}, [getAllParentReferencesForPath]);
|
|
20261
20277
|
const convertIdsToPaths = useCallback((ids_0) => {
|
|
20262
|
-
const
|
|
20263
|
-
let currentCollections_1 =
|
|
20278
|
+
const collections_6 = collectionsRef.current;
|
|
20279
|
+
let currentCollections_1 = collections_6;
|
|
20264
20280
|
const paths = [];
|
|
20265
20281
|
for (let i_3 = 0; i_3 < ids_0.length; i_3++) {
|
|
20266
|
-
const
|
|
20267
|
-
const
|
|
20268
|
-
if (!
|
|
20269
|
-
paths.push(
|
|
20270
|
-
currentCollections_1 =
|
|
20282
|
+
const id_1 = ids_0[i_3];
|
|
20283
|
+
const collection_3 = currentCollections_1.find((c_2) => c_2.id === id_1);
|
|
20284
|
+
if (!collection_3) throw Error(`Collection with id ${id_1} not found`);
|
|
20285
|
+
paths.push(collection_3.path);
|
|
20286
|
+
currentCollections_1 = collection_3.subcollections;
|
|
20271
20287
|
}
|
|
20272
20288
|
return paths;
|
|
20273
20289
|
}, [getCollectionFromIds]);
|
|
@@ -20282,6 +20298,7 @@ function useBuildNavigationController(props) {
|
|
|
20282
20298
|
baseCollectionPath,
|
|
20283
20299
|
initialised,
|
|
20284
20300
|
getCollection,
|
|
20301
|
+
getCollectionById,
|
|
20285
20302
|
getCollectionFromPaths,
|
|
20286
20303
|
getCollectionFromIds,
|
|
20287
20304
|
isUrlCollectionPath,
|
|
@@ -21285,7 +21302,7 @@ function EntityEditViewInner({
|
|
|
21285
21302
|
const subcollectionsCount = subcollections?.length ?? 0;
|
|
21286
21303
|
const customViews = collection.entityViews;
|
|
21287
21304
|
const customViewsCount = customViews?.length ?? 0;
|
|
21288
|
-
const includeJsonView = true;
|
|
21305
|
+
const includeJsonView = collection.includeJsonView === void 0 ? true : collection.includeJsonView;
|
|
21289
21306
|
const hasAdditionalViews = customViewsCount > 0 || subcollectionsCount > 0 || includeJsonView;
|
|
21290
21307
|
const {
|
|
21291
21308
|
resolvedEntityViews,
|
|
@@ -21384,15 +21401,16 @@ function EntityEditViewInner({
|
|
|
21384
21401
|
}, Builder: selectedSecondaryForm?.Builder });
|
|
21385
21402
|
const subcollectionTabs = subcollections && subcollections.map((subcollection_0) => /* @__PURE__ */ jsx(Tab, { className: "text-sm min-w-[120px]", value: subcollection_0.id, children: subcollection_0.name }, `entity_detail_collection_tab_${subcollection_0.name}`));
|
|
21386
21403
|
const customViewTabs = resolvedEntityViews.map((view) => /* @__PURE__ */ jsx(Tab, { className: "text-sm min-w-[120px]", value: view.key, children: view.name }, `entity_detail_collection_tab_${view.name}`));
|
|
21404
|
+
const shouldShowTopBar = Boolean(barActions) || hasAdditionalViews;
|
|
21387
21405
|
let result = /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col h-full w-full bg-white dark:bg-surface-900", children: [
|
|
21388
|
-
/* @__PURE__ */ jsxs("div", { className: cls("h-14 flex overflow-visible overflow-x-scroll w-full no-scrollbar h-14 border-b pl-2 pr-2 pt-1 flex items-end bg-surface-50 dark:bg-surface-900", defaultBorderMixin), children: [
|
|
21406
|
+
shouldShowTopBar && /* @__PURE__ */ jsxs("div", { className: cls("h-14 flex overflow-visible overflow-x-scroll w-full no-scrollbar h-14 border-b pl-2 pr-2 pt-1 flex items-end bg-surface-50 dark:bg-surface-900", defaultBorderMixin), children: [
|
|
21389
21407
|
barActions,
|
|
21390
21408
|
/* @__PURE__ */ jsx("div", { className: "flex-grow" }),
|
|
21391
21409
|
globalLoading && /* @__PURE__ */ jsx("div", { className: "self-center", children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" }) }),
|
|
21392
|
-
/* @__PURE__ */ jsxs(Tabs, { value: selectedTab, onValueChange: (value_1) => {
|
|
21410
|
+
hasAdditionalViews && /* @__PURE__ */ jsxs(Tabs, { value: selectedTab, onValueChange: (value_1) => {
|
|
21393
21411
|
onSideTabClick(value_1);
|
|
21394
21412
|
}, children: [
|
|
21395
|
-
/* @__PURE__ */ jsx(Tab, { disabled: !hasAdditionalViews, value: JSON_TAB_VALUE, innerClassName: "block", className: "text-sm", children: /* @__PURE__ */ jsx(CodeIcon, { size: "small" }) }),
|
|
21413
|
+
includeJsonView && /* @__PURE__ */ jsx(Tab, { disabled: !hasAdditionalViews, value: JSON_TAB_VALUE, innerClassName: "block", className: "text-sm", children: /* @__PURE__ */ jsx(CodeIcon, { size: "small" }) }),
|
|
21396
21414
|
/* @__PURE__ */ jsx(Tab, { disabled: !hasAdditionalViews, value: MAIN_TAB_VALUE, className: "text-sm min-w-[120px]", children: collection.singularName ?? collection.name }),
|
|
21397
21415
|
customViewTabs,
|
|
21398
21416
|
subcollectionTabs
|
|
@@ -23031,7 +23049,7 @@ function getFieldId(property) {
|
|
|
23031
23049
|
return getDefaultFieldId(property);
|
|
23032
23050
|
}
|
|
23033
23051
|
function FireCMSRoute() {
|
|
23034
|
-
const $ = c(
|
|
23052
|
+
const $ = c(33);
|
|
23035
23053
|
const location = useLocation$1();
|
|
23036
23054
|
const navigation = useNavigationController();
|
|
23037
23055
|
const breadcrumbs = useBreadcrumbsController();
|
|
@@ -23144,7 +23162,11 @@ function FireCMSRoute() {
|
|
|
23144
23162
|
if ($[18] !== navigation || $[19] !== navigationEntries) {
|
|
23145
23163
|
t7 = Symbol.for("react.early_return_sentinel");
|
|
23146
23164
|
bb0: {
|
|
23147
|
-
|
|
23165
|
+
let collection;
|
|
23166
|
+
collection = navigation.getCollectionById(navigationEntries[0].id);
|
|
23167
|
+
if (!collection) {
|
|
23168
|
+
collection = navigation.getCollection(navigationEntries[0].path);
|
|
23169
|
+
}
|
|
23148
23170
|
if (!collection) {
|
|
23149
23171
|
t7 = null;
|
|
23150
23172
|
break bb0;
|
|
@@ -23172,48 +23194,56 @@ function FireCMSRoute() {
|
|
|
23172
23194
|
return t62;
|
|
23173
23195
|
}
|
|
23174
23196
|
if (isSidePanel) {
|
|
23175
|
-
|
|
23176
|
-
if (
|
|
23177
|
-
t62
|
|
23178
|
-
|
|
23179
|
-
|
|
23180
|
-
|
|
23181
|
-
|
|
23197
|
+
const lastCollectionEntry = navigationEntries.findLast(_temp2$1);
|
|
23198
|
+
if (lastCollectionEntry) {
|
|
23199
|
+
let t62;
|
|
23200
|
+
let t7;
|
|
23201
|
+
if ($[23] !== navigation || $[24] !== navigationEntries) {
|
|
23202
|
+
t7 = Symbol.for("react.early_return_sentinel");
|
|
23203
|
+
bb1: {
|
|
23204
|
+
let collection_0;
|
|
23205
|
+
const firstEntry = navigationEntries[0];
|
|
23206
|
+
collection_0 = navigation.getCollectionById(firstEntry.id);
|
|
23182
23207
|
if (!collection_0) {
|
|
23183
|
-
|
|
23208
|
+
collection_0 = navigation.getCollection(firstEntry.path);
|
|
23209
|
+
}
|
|
23210
|
+
if (!collection_0) {
|
|
23211
|
+
t7 = null;
|
|
23184
23212
|
break bb1;
|
|
23185
23213
|
}
|
|
23186
|
-
let
|
|
23187
|
-
if ($[
|
|
23188
|
-
|
|
23189
|
-
$[
|
|
23214
|
+
let t8;
|
|
23215
|
+
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23216
|
+
t8 = [];
|
|
23217
|
+
$[27] = t8;
|
|
23190
23218
|
} else {
|
|
23191
|
-
|
|
23219
|
+
t8 = $[27];
|
|
23192
23220
|
}
|
|
23193
|
-
t62 = /* @__PURE__ */ jsx(EntityCollectionView, { isSubCollection: false, parentCollectionIds:
|
|
23194
|
-
break bb1;
|
|
23221
|
+
t62 = /* @__PURE__ */ jsx(EntityCollectionView, { isSubCollection: false, parentCollectionIds: t8, fullPath: collection_0.id, updateUrl: true, ...collection_0, Actions: toArray(collection_0.Actions) }, `collection_view_${collection_0.id ?? collection_0.path}`);
|
|
23195
23222
|
}
|
|
23223
|
+
$[23] = navigation;
|
|
23224
|
+
$[24] = navigationEntries;
|
|
23225
|
+
$[25] = t62;
|
|
23226
|
+
$[26] = t7;
|
|
23227
|
+
} else {
|
|
23228
|
+
t62 = $[25];
|
|
23229
|
+
t7 = $[26];
|
|
23230
|
+
}
|
|
23231
|
+
if (t7 !== Symbol.for("react.early_return_sentinel")) {
|
|
23232
|
+
return t7;
|
|
23196
23233
|
}
|
|
23197
|
-
$[23] = navigation;
|
|
23198
|
-
$[24] = navigationEntries;
|
|
23199
|
-
$[25] = t62;
|
|
23200
|
-
} else {
|
|
23201
|
-
t62 = $[25];
|
|
23202
|
-
}
|
|
23203
|
-
if (t62 !== Symbol.for("react.early_return_sentinel")) {
|
|
23204
23234
|
return t62;
|
|
23205
23235
|
}
|
|
23206
23236
|
}
|
|
23207
23237
|
let t6;
|
|
23208
|
-
if ($[
|
|
23238
|
+
if ($[28] !== isCopy || $[29] !== isNew || $[30] !== navigationEntries || $[31] !== pathname) {
|
|
23209
23239
|
t6 = /* @__PURE__ */ jsx(EntityFullScreenRoute, { pathname, navigationEntries, isNew, isCopy });
|
|
23210
|
-
$[
|
|
23211
|
-
$[
|
|
23212
|
-
$[
|
|
23213
|
-
$[
|
|
23214
|
-
$[
|
|
23240
|
+
$[28] = isCopy;
|
|
23241
|
+
$[29] = isNew;
|
|
23242
|
+
$[30] = navigationEntries;
|
|
23243
|
+
$[31] = pathname;
|
|
23244
|
+
$[32] = t6;
|
|
23215
23245
|
} else {
|
|
23216
|
-
t6 = $[
|
|
23246
|
+
t6 = $[32];
|
|
23217
23247
|
}
|
|
23218
23248
|
return t6;
|
|
23219
23249
|
}
|