@firecms/core 3.0.0-canary.224 → 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 +68 -18
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +68 -18
- 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/core/EntityEditView.tsx +3 -3
- 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();
|
|
@@ -21340,10 +21390,10 @@
|
|
|
21340
21390
|
});
|
|
21341
21391
|
}
|
|
21342
21392
|
};
|
|
21343
|
-
const entityReadOnlyView = /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", canEdit || !mainViewVisible || selectedSecondaryForm ? "hidden" : ""), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("relative flex flex-col max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit"), children: [
|
|
21393
|
+
const entityReadOnlyView = !canEdit && entity ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", canEdit || !mainViewVisible || selectedSecondaryForm ? "hidden" : ""), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("relative flex flex-col max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit"), children: [
|
|
21344
21394
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: "mt-16 mb-8 mx-8", variant: "h4", children: collection.singularName ?? collection.name }),
|
|
21345
21395
|
/* @__PURE__ */ jsxRuntime.jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection })
|
|
21346
|
-
] }) });
|
|
21396
|
+
] }) }) : null;
|
|
21347
21397
|
const entityView = /* @__PURE__ */ jsxRuntime.jsx(EntityForm, { collection, path, entityId: entityId ?? usedEntity?.id, onValuesModified, entity, initialDirtyValues: cachedDirtyValues, openEntityMode: layout, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, className: ui.cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, disabled: !canEdit, ...formProps, onEntityChange: (entity_0) => {
|
|
21348
21398
|
setUsedEntity(entity_0);
|
|
21349
21399
|
formProps?.onEntityChange?.(entity_0);
|