@firecms/core 3.0.0-canary.225 → 3.0.0-canary.227
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 +63 -17
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +63 -17
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +1 -1
- package/src/components/VirtualTable/VirtualTable.tsx +29 -1
- package/src/components/common/default_entity_actions.tsx +3 -2
- package/src/util/navigation_utils.ts +59 -14
package/dist/index.umd.js
CHANGED
|
@@ -72,23 +72,46 @@
|
|
|
72
72
|
const cleanPath = removeInitialAndTrailingSlashes(path);
|
|
73
73
|
const subpaths = cleanPath.split("/");
|
|
74
74
|
if (subpaths.length % 2 === 0) {
|
|
75
|
-
throw Error(`
|
|
76
|
-
}
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
throw Error(`resolveCollectionPathIds: Collection paths must have an odd number of segments: ${path}`);
|
|
76
|
+
}
|
|
77
|
+
const exactMatch = allCollections.find((col) => col.path === cleanPath);
|
|
78
|
+
if (exactMatch) {
|
|
79
|
+
return exactMatch.path;
|
|
80
|
+
}
|
|
81
|
+
if (subpaths.length === 1) {
|
|
82
|
+
const aliasedCollection = allCollections.find((col) => col.id === subpaths[0]);
|
|
83
|
+
return aliasedCollection?.path ?? subpaths[0];
|
|
84
|
+
}
|
|
85
|
+
let matchingCollection;
|
|
86
|
+
let entityIndex = 1;
|
|
87
|
+
for (const collection of allCollections) {
|
|
88
|
+
const pathSegments = collection.path.split("/");
|
|
89
|
+
if (pathSegments.length > 1 && subpaths.slice(0, pathSegments.length).join("/") === collection.path) {
|
|
90
|
+
matchingCollection = collection;
|
|
91
|
+
entityIndex = pathSegments.length;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
81
94
|
}
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
if (!
|
|
95
|
+
if (!matchingCollection) {
|
|
96
|
+
const matchingCollections = allCollections.filter((col) => col.id === subpaths[0] || col.path === subpaths[0]);
|
|
97
|
+
if (!matchingCollections.length) {
|
|
85
98
|
return cleanPath;
|
|
86
99
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
100
|
+
matchingCollection = matchingCollections[0];
|
|
101
|
+
}
|
|
102
|
+
const entityId = subpaths[entityIndex];
|
|
103
|
+
const remainingPath = subpaths.slice(entityIndex + 1);
|
|
104
|
+
if (remainingPath.length > 0) {
|
|
105
|
+
const subcollectionId = remainingPath[0];
|
|
106
|
+
const subcollection = matchingCollection.subcollections?.find((subcol) => subcol.id === subcollectionId);
|
|
107
|
+
if (subcollection) {
|
|
108
|
+
return `${matchingCollection.path}/${entityId}/${subcollection.path}`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (remainingPath.length === 0) {
|
|
112
|
+
return `${matchingCollection.path}/${entityId}`;
|
|
91
113
|
}
|
|
114
|
+
return `${matchingCollection.path}/${entityId}/${remainingPath.join("/")}`;
|
|
92
115
|
}
|
|
93
116
|
function getCollectionByPathOrId(pathOrId, collections) {
|
|
94
117
|
const subpaths = removeInitialAndTrailingSlashes(pathOrId).split("/");
|
|
@@ -10484,7 +10507,30 @@
|
|
|
10484
10507
|
React.useEffect(() => {
|
|
10485
10508
|
setColumns(columnsProp);
|
|
10486
10509
|
}, [columnsProp]);
|
|
10487
|
-
const [
|
|
10510
|
+
const [_, setForceUpdate] = React.useState(false);
|
|
10511
|
+
React.useEffect(() => {
|
|
10512
|
+
if (tableRef.current) {
|
|
10513
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
10514
|
+
setForceUpdate((prev) => !prev);
|
|
10515
|
+
});
|
|
10516
|
+
resizeObserver.observe(tableRef.current);
|
|
10517
|
+
return () => {
|
|
10518
|
+
if (tableRef.current) {
|
|
10519
|
+
resizeObserver.unobserve(tableRef.current);
|
|
10520
|
+
}
|
|
10521
|
+
resizeObserver.disconnect();
|
|
10522
|
+
};
|
|
10523
|
+
}
|
|
10524
|
+
return () => {
|
|
10525
|
+
};
|
|
10526
|
+
}, [tableRef]);
|
|
10527
|
+
const [measureRef, bounds] = useMeasure({
|
|
10528
|
+
debounce: 50,
|
|
10529
|
+
polyfill: ResizeObserver,
|
|
10530
|
+
scroll: true,
|
|
10531
|
+
// This is important for handling zooming in react-flow
|
|
10532
|
+
offsetSize: true
|
|
10533
|
+
});
|
|
10488
10534
|
const onColumnResizeInternal = React.useCallback((params) => {
|
|
10489
10535
|
if (debug) console.log("onColumnResizeInternal", params);
|
|
10490
10536
|
setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));
|
|
@@ -12208,7 +12254,7 @@
|
|
|
12208
12254
|
if (collection) {
|
|
12209
12255
|
addRecentId(collection.id, entity.id);
|
|
12210
12256
|
}
|
|
12211
|
-
const path = collection?.collectionGroup ?
|
|
12257
|
+
const path = collection?.collectionGroup ? collection.id : fullPath ?? collection?.id ?? entity.path;
|
|
12212
12258
|
const defaultSelectedView = resolveDefaultSelectedView(collection ? collection.defaultSelectedView : void 0, {
|
|
12213
12259
|
status: "existing",
|
|
12214
12260
|
entityId: entity.id
|
|
@@ -12244,7 +12290,7 @@
|
|
|
12244
12290
|
path: entity.path,
|
|
12245
12291
|
entityId: entity.id
|
|
12246
12292
|
});
|
|
12247
|
-
const path = collection?.collectionGroup ?
|
|
12293
|
+
const path = collection?.collectionGroup ? collection.id : fullPath ?? collection?.id ?? entity.path;
|
|
12248
12294
|
navigateToEntity({
|
|
12249
12295
|
openEntityMode,
|
|
12250
12296
|
collection,
|
|
@@ -18424,9 +18470,9 @@
|
|
|
18424
18470
|
...collectionProp
|
|
18425
18471
|
}) {
|
|
18426
18472
|
const context = useFireCMSContext();
|
|
18473
|
+
const navigation = useNavigationController();
|
|
18427
18474
|
const fullPath = fullPathProp ?? collectionProp.path;
|
|
18428
18475
|
const dataSource = useDataSource();
|
|
18429
|
-
const navigation = useNavigationController();
|
|
18430
18476
|
const sideEntityController = useSideEntityController();
|
|
18431
18477
|
const authController = useAuthController();
|
|
18432
18478
|
const userConfigPersistence = useUserConfigurationPersistence();
|