@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.es.js
CHANGED
|
@@ -71,23 +71,46 @@ function resolveCollectionPathIds(path, allCollections) {
|
|
|
71
71
|
const cleanPath = removeInitialAndTrailingSlashes(path);
|
|
72
72
|
const subpaths = cleanPath.split("/");
|
|
73
73
|
if (subpaths.length % 2 === 0) {
|
|
74
|
-
throw Error(`
|
|
75
|
-
}
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
throw Error(`resolveCollectionPathIds: Collection paths must have an odd number of segments: ${path}`);
|
|
75
|
+
}
|
|
76
|
+
const exactMatch = allCollections.find((col) => col.path === cleanPath);
|
|
77
|
+
if (exactMatch) {
|
|
78
|
+
return exactMatch.path;
|
|
79
|
+
}
|
|
80
|
+
if (subpaths.length === 1) {
|
|
81
|
+
const aliasedCollection = allCollections.find((col) => col.id === subpaths[0]);
|
|
82
|
+
return aliasedCollection?.path ?? subpaths[0];
|
|
83
|
+
}
|
|
84
|
+
let matchingCollection;
|
|
85
|
+
let entityIndex = 1;
|
|
86
|
+
for (const collection of allCollections) {
|
|
87
|
+
const pathSegments = collection.path.split("/");
|
|
88
|
+
if (pathSegments.length > 1 && subpaths.slice(0, pathSegments.length).join("/") === collection.path) {
|
|
89
|
+
matchingCollection = collection;
|
|
90
|
+
entityIndex = pathSegments.length;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
80
93
|
}
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
if (!
|
|
94
|
+
if (!matchingCollection) {
|
|
95
|
+
const matchingCollections = allCollections.filter((col) => col.id === subpaths[0] || col.path === subpaths[0]);
|
|
96
|
+
if (!matchingCollections.length) {
|
|
84
97
|
return cleanPath;
|
|
85
98
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
matchingCollection = matchingCollections[0];
|
|
100
|
+
}
|
|
101
|
+
const entityId = subpaths[entityIndex];
|
|
102
|
+
const remainingPath = subpaths.slice(entityIndex + 1);
|
|
103
|
+
if (remainingPath.length > 0) {
|
|
104
|
+
const subcollectionId = remainingPath[0];
|
|
105
|
+
const subcollection = matchingCollection.subcollections?.find((subcol) => subcol.id === subcollectionId);
|
|
106
|
+
if (subcollection) {
|
|
107
|
+
return `${matchingCollection.path}/${entityId}/${subcollection.path}`;
|
|
108
|
+
}
|
|
90
109
|
}
|
|
110
|
+
if (remainingPath.length === 0) {
|
|
111
|
+
return `${matchingCollection.path}/${entityId}`;
|
|
112
|
+
}
|
|
113
|
+
return `${matchingCollection.path}/${entityId}/${remainingPath.join("/")}`;
|
|
91
114
|
}
|
|
92
115
|
function getCollectionByPathOrId(pathOrId, collections) {
|
|
93
116
|
const subpaths = removeInitialAndTrailingSlashes(pathOrId).split("/");
|
|
@@ -10483,7 +10506,30 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10483
10506
|
useEffect(() => {
|
|
10484
10507
|
setColumns(columnsProp);
|
|
10485
10508
|
}, [columnsProp]);
|
|
10486
|
-
const [
|
|
10509
|
+
const [_, setForceUpdate] = useState(false);
|
|
10510
|
+
useEffect(() => {
|
|
10511
|
+
if (tableRef.current) {
|
|
10512
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
10513
|
+
setForceUpdate((prev) => !prev);
|
|
10514
|
+
});
|
|
10515
|
+
resizeObserver.observe(tableRef.current);
|
|
10516
|
+
return () => {
|
|
10517
|
+
if (tableRef.current) {
|
|
10518
|
+
resizeObserver.unobserve(tableRef.current);
|
|
10519
|
+
}
|
|
10520
|
+
resizeObserver.disconnect();
|
|
10521
|
+
};
|
|
10522
|
+
}
|
|
10523
|
+
return () => {
|
|
10524
|
+
};
|
|
10525
|
+
}, [tableRef]);
|
|
10526
|
+
const [measureRef, bounds] = useMeasure({
|
|
10527
|
+
debounce: 50,
|
|
10528
|
+
polyfill: ResizeObserver,
|
|
10529
|
+
scroll: true,
|
|
10530
|
+
// This is important for handling zooming in react-flow
|
|
10531
|
+
offsetSize: true
|
|
10532
|
+
});
|
|
10487
10533
|
const onColumnResizeInternal = useCallback((params) => {
|
|
10488
10534
|
if (debug) console.log("onColumnResizeInternal", params);
|
|
10489
10535
|
setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));
|
|
@@ -18423,9 +18469,13 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
|
|
|
18423
18469
|
...collectionProp
|
|
18424
18470
|
}) {
|
|
18425
18471
|
const context = useFireCMSContext();
|
|
18426
|
-
const fullPath = fullPathProp ?? collectionProp.path;
|
|
18427
|
-
const dataSource = useDataSource();
|
|
18428
18472
|
const navigation = useNavigationController();
|
|
18473
|
+
const fullPath = (fullPathProp ? navigation.resolveIdsFrom(fullPathProp) : void 0) ?? collectionProp.path;
|
|
18474
|
+
console.log("aaa", {
|
|
18475
|
+
fullPathProp,
|
|
18476
|
+
fullPath
|
|
18477
|
+
});
|
|
18478
|
+
const dataSource = useDataSource();
|
|
18429
18479
|
const sideEntityController = useSideEntityController();
|
|
18430
18480
|
const authController = useAuthController();
|
|
18431
18481
|
const userConfigPersistence = useUserConfigurationPersistence();
|