@firecms/core 3.0.0-canary.225 → 3.0.0-canary.226
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 +66 -16
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +66 -16
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +6 -2
- package/src/components/VirtualTable/VirtualTable.tsx +29 -1
- 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
|
+
}
|
|
91
110
|
}
|
|
111
|
+
if (remainingPath.length === 0) {
|
|
112
|
+
return `${matchingCollection.path}/${entityId}`;
|
|
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));
|
|
@@ -18424,9 +18470,13 @@
|
|
|
18424
18470
|
...collectionProp
|
|
18425
18471
|
}) {
|
|
18426
18472
|
const context = useFireCMSContext();
|
|
18427
|
-
const fullPath = fullPathProp ?? collectionProp.path;
|
|
18428
|
-
const dataSource = useDataSource();
|
|
18429
18473
|
const navigation = useNavigationController();
|
|
18474
|
+
const fullPath = (fullPathProp ? navigation.resolveIdsFrom(fullPathProp) : void 0) ?? collectionProp.path;
|
|
18475
|
+
console.log("aaa", {
|
|
18476
|
+
fullPathProp,
|
|
18477
|
+
fullPath
|
|
18478
|
+
});
|
|
18479
|
+
const dataSource = useDataSource();
|
|
18430
18480
|
const sideEntityController = useSideEntityController();
|
|
18431
18481
|
const authController = useAuthController();
|
|
18432
18482
|
const userConfigPersistence = useUserConfigurationPersistence();
|