@firecms/core 3.4.0-canary.63041d0 → 3.4.0-canary.cfeed0b
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/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +3 -1
- package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +3 -1
- package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +3 -2
- package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +3 -1
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +3 -1
- package/dist/components/EntityCollectionView/useBoardDataController.d.ts +3 -1
- package/dist/components/ReferenceTable/ReferenceSelectionTable.d.ts +10 -1
- package/dist/components/common/useDataSourceTableController.d.ts +4 -2
- package/dist/components/common/useTableSearchHelper.d.ts +3 -1
- package/dist/core/EntityEditView.d.ts +2 -0
- package/dist/core/EntityEditViewFormActions.d.ts +1 -1
- package/dist/form/EntityForm.d.ts +8 -1
- package/dist/form/EntityFormActions.d.ts +2 -0
- package/dist/hooks/data/delete.d.ts +1 -1
- package/dist/hooks/data/useCollectionFetch.d.ts +7 -1
- package/dist/hooks/data/useEntityFetch.d.ts +4 -1
- package/dist/i18n/__tests__/FireCMSi18nProvider.test.d.ts +1 -0
- package/dist/i18n/__tests__/nested_provider_lifecycle.test.d.ts +1 -0
- package/dist/index.es.js +967 -649
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +966 -648
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collections.d.ts +7 -0
- package/dist/types/datasource.d.ts +25 -4
- package/dist/types/entities.d.ts +21 -1
- package/dist/types/entity_actions.d.ts +6 -0
- package/dist/types/entity_callbacks.d.ts +21 -0
- package/dist/types/navigation.d.ts +34 -5
- package/dist/types/plugins.d.ts +13 -0
- package/dist/types/side_entity_controller.d.ts +3 -2
- package/dist/util/entity_cache.d.ts +11 -0
- package/dist/util/navigation_utils.d.ts +84 -2
- package/dist/util/parent_references_from_path.d.ts +16 -0
- package/dist/util/paths.d.ts +28 -0
- package/dist/util/permissions.d.ts +10 -4
- package/package.json +4 -4
- package/src/components/DeleteEntityDialog.tsx +2 -0
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +5 -1
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +12 -0
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +49 -16
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +6 -2
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +4 -0
- package/src/components/EntityCollectionView/useBoardDataController.tsx +17 -1
- package/src/components/EntityPreview.tsx +4 -1
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +19 -2
- package/src/components/common/default_entity_actions.tsx +22 -2
- package/src/components/common/useDataSourceTableController.tsx +17 -5
- package/src/components/common/useTableSearchHelper.ts +5 -0
- package/src/core/EntityEditView.tsx +11 -12
- package/src/core/EntityEditViewFormActions.tsx +3 -2
- package/src/core/EntitySidePanel.tsx +6 -4
- package/src/form/EntityForm.tsx +30 -9
- package/src/form/EntityFormActions.tsx +2 -0
- package/src/hooks/data/delete.ts +8 -0
- package/src/hooks/data/save.ts +5 -2
- package/src/hooks/data/useCollectionFetch.tsx +21 -1
- package/src/hooks/data/useEntityFetch.tsx +28 -6
- package/src/hooks/useBuildNavigationController.tsx +23 -8
- package/src/hooks/useResolvedNavigationFrom.tsx +3 -1
- package/src/i18n/FireCMSi18nProvider.tsx +48 -4
- package/src/i18n/__tests__/FireCMSi18nProvider.test.tsx +91 -0
- package/src/i18n/__tests__/nested_provider_lifecycle.test.tsx +67 -0
- package/src/internal/useBuildDataSource.ts +26 -15
- package/src/internal/useBuildSideEntityController.tsx +13 -5
- package/src/preview/components/ReferencePreview.tsx +7 -3
- package/src/routes/FireCMSRoute.tsx +9 -4
- package/src/types/collections.ts +8 -0
- package/src/types/datasource.ts +25 -4
- package/src/types/entities.ts +24 -1
- package/src/types/entity_actions.tsx +6 -0
- package/src/types/entity_callbacks.ts +24 -0
- package/src/types/navigation.ts +35 -5
- package/src/types/plugins.tsx +13 -0
- package/src/types/side_entity_controller.tsx +3 -2
- package/src/util/entities.ts +3 -1
- package/src/util/entity_cache.ts +18 -0
- package/src/util/navigation_from_path.ts +6 -1
- package/src/util/navigation_utils.ts +204 -2
- package/src/util/parent_references_from_path.ts +42 -3
- package/src/util/paths.ts +40 -3
- package/src/util/permissions.ts +22 -10
package/dist/index.umd.js
CHANGED
|
@@ -192,6 +192,11 @@
|
|
|
192
192
|
function decodeEntityId(encodedEntityId) {
|
|
193
193
|
return encodedEntityId.replaceAll("%2F", "/").replaceAll("%23", "#").replaceAll("%3F", "?").replaceAll("%25", "%");
|
|
194
194
|
}
|
|
195
|
+
function buildSubcollectionPathSegments(parentPathSegments, entityId, subcollectionPath) {
|
|
196
|
+
if (!parentPathSegments || !entityId) return void 0;
|
|
197
|
+
const ownSegments = removeInitialAndTrailingSlashes(subcollectionPath).split("/");
|
|
198
|
+
return [...parentPathSegments, entityId, ...ownSegments];
|
|
199
|
+
}
|
|
195
200
|
function getLastSegment(path) {
|
|
196
201
|
const cleanPath = removeInitialAndTrailingSlashes(path);
|
|
197
202
|
if (cleanPath.includes("/")) {
|
|
@@ -200,7 +205,88 @@
|
|
|
200
205
|
}
|
|
201
206
|
return cleanPath;
|
|
202
207
|
}
|
|
203
|
-
function
|
|
208
|
+
function walkPathSegments(pathSegments, allCollections) {
|
|
209
|
+
const resolved = [];
|
|
210
|
+
const steps = [];
|
|
211
|
+
let currentCollections = allCollections;
|
|
212
|
+
let index = 0;
|
|
213
|
+
while (index < pathSegments.length) {
|
|
214
|
+
const remaining = pathSegments.slice(index);
|
|
215
|
+
if (!currentCollections || currentCollections.length === 0) {
|
|
216
|
+
resolved.push(...remaining);
|
|
217
|
+
return {
|
|
218
|
+
resolved,
|
|
219
|
+
steps,
|
|
220
|
+
unmatched: remaining[0]
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
let match;
|
|
224
|
+
for (const collection of currentCollections) {
|
|
225
|
+
for (const candidate of [collection.path, collection.id]) {
|
|
226
|
+
if (!candidate) continue;
|
|
227
|
+
const parts = removeInitialAndTrailingSlashes(candidate).split("/");
|
|
228
|
+
if (parts.length > remaining.length) continue;
|
|
229
|
+
if (parts.some((part, i) => part !== remaining[i])) continue;
|
|
230
|
+
if (!match || parts.length > match.length) match = {
|
|
231
|
+
collection,
|
|
232
|
+
length: parts.length
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (!match) {
|
|
237
|
+
resolved.push(...remaining);
|
|
238
|
+
return {
|
|
239
|
+
resolved,
|
|
240
|
+
steps,
|
|
241
|
+
unmatched: remaining[0]
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
resolved.push(...removeInitialAndTrailingSlashes(match.collection.path).split("/"));
|
|
245
|
+
index += match.length;
|
|
246
|
+
const step = {
|
|
247
|
+
collection: match.collection,
|
|
248
|
+
collectionPath: resolved.join("/"),
|
|
249
|
+
collectionSegments: [...resolved]
|
|
250
|
+
};
|
|
251
|
+
steps.push(step);
|
|
252
|
+
if (index >= pathSegments.length) {
|
|
253
|
+
return {
|
|
254
|
+
resolved,
|
|
255
|
+
steps,
|
|
256
|
+
collection: match.collection
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
step.entityId = pathSegments[index];
|
|
260
|
+
resolved.push(pathSegments[index]);
|
|
261
|
+
index += 1;
|
|
262
|
+
if (index >= pathSegments.length) {
|
|
263
|
+
return {
|
|
264
|
+
resolved,
|
|
265
|
+
steps,
|
|
266
|
+
collection: match.collection
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
currentCollections = match.collection.subcollections;
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
resolved,
|
|
273
|
+
steps
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function resolveCollectionPathSegments(pathSegments, allCollections) {
|
|
277
|
+
const walk = walkPathSegments(pathSegments, allCollections);
|
|
278
|
+
if (walk.unmatched !== void 0) {
|
|
279
|
+
console.warn(`resolveCollectionPathSegments: Collection definition not found for segment "${walk.unmatched}" in [${pathSegments.join(", ")}]. Carrying the remaining segments through unresolved.`);
|
|
280
|
+
}
|
|
281
|
+
return walk.resolved;
|
|
282
|
+
}
|
|
283
|
+
function getCollectionByPathSegments(pathSegments, collections) {
|
|
284
|
+
return walkPathSegments(pathSegments, collections).collection;
|
|
285
|
+
}
|
|
286
|
+
function resolveCollectionPathIds(path, allCollections, pathSegments) {
|
|
287
|
+
if (pathSegments) {
|
|
288
|
+
return resolveCollectionPathSegments(pathSegments, allCollections).join("/");
|
|
289
|
+
}
|
|
204
290
|
let remainingPath = removeInitialAndTrailingSlashes(path);
|
|
205
291
|
if (!remainingPath) {
|
|
206
292
|
return "";
|
|
@@ -262,7 +348,10 @@
|
|
|
262
348
|
}
|
|
263
349
|
return resolvedPathParts.join("/");
|
|
264
350
|
}
|
|
265
|
-
function getCollectionByPathOrId(pathOrId, collections) {
|
|
351
|
+
function getCollectionByPathOrId(pathOrId, collections, pathSegments) {
|
|
352
|
+
if (pathSegments) {
|
|
353
|
+
return getCollectionByPathSegments(pathSegments, collections);
|
|
354
|
+
}
|
|
266
355
|
const subpaths = removeInitialAndTrailingSlashes(pathOrId).split("/");
|
|
267
356
|
if (subpaths.length % 2 === 0) {
|
|
268
357
|
throw Error(`getCollectionByPathOrId: Collection paths must have an odd number of segments: ${pathOrId}`);
|
|
@@ -319,6 +408,9 @@
|
|
|
319
408
|
onClose
|
|
320
409
|
});
|
|
321
410
|
} else {
|
|
411
|
+
if (!fullIdPath && pathSegments?.some((segment) => segment.includes("/"))) {
|
|
412
|
+
console.warn(`navigateToEntity: no "fullIdPath" was given and "${path}" contains an entity id with a "/", so no unambiguous URL can be built for it. The link will point at a different location. Pass "fullIdPath" — the escaped chain — alongside "path".`);
|
|
413
|
+
}
|
|
322
414
|
let to = navigation.buildUrlCollectionPath(entityId ? `${fullIdPath ?? path}/${encodeEntityId(entityId)}` : fullIdPath ?? path);
|
|
323
415
|
if (entityId && selectedTab) {
|
|
324
416
|
to += `/${selectedTab}`;
|
|
@@ -346,10 +438,21 @@
|
|
|
346
438
|
* Optional database ID where the entity is stored (if multiple databases are used)
|
|
347
439
|
*/
|
|
348
440
|
databaseId;
|
|
349
|
-
|
|
441
|
+
/**
|
|
442
|
+
* `path` split at its real segment boundaries, e.g. `["nodes", "node/42", "edges"]`.
|
|
443
|
+
*
|
|
444
|
+
* `path` is a single flattened string, so a parent entity id containing "/" cannot be
|
|
445
|
+
* recovered from it. This keeps each segment whole.
|
|
446
|
+
*
|
|
447
|
+
* Optional, and never derived by splitting `path` — a guess would be wrong in exactly
|
|
448
|
+
* the case the field exists for. Absent means "not known here", not "no slashes".
|
|
449
|
+
*/
|
|
450
|
+
pathSegments;
|
|
451
|
+
constructor(id, path, databaseId, pathSegments) {
|
|
350
452
|
this.id = id;
|
|
351
453
|
this.path = path;
|
|
352
454
|
this.databaseId = databaseId;
|
|
455
|
+
this.pathSegments = pathSegments;
|
|
353
456
|
}
|
|
354
457
|
get pathWithId() {
|
|
355
458
|
return `${this.path}/${this.id}`;
|
|
@@ -720,7 +823,7 @@
|
|
|
720
823
|
if (!entity) {
|
|
721
824
|
throw new Error("getReferenceFrom: entity is null or undefined");
|
|
722
825
|
}
|
|
723
|
-
return new EntityReference(entity.id, entity.path, entity.databaseId);
|
|
826
|
+
return new EntityReference(entity.id, entity.path, entity.databaseId, entity.pathSegments);
|
|
724
827
|
}
|
|
725
828
|
function traverseValuesProperties(inputValues, properties, operation) {
|
|
726
829
|
const safeInputValues = inputValues ?? {};
|
|
@@ -1211,7 +1314,12 @@
|
|
|
1211
1314
|
path: newPath,
|
|
1212
1315
|
collections: collection.subcollections,
|
|
1213
1316
|
currentFullPath: fullPath,
|
|
1214
|
-
|
|
1317
|
+
// The entity id is a hop in the id chain exactly as it is in the
|
|
1318
|
+
// other two. Without it a nested `fullIdPath` was
|
|
1319
|
+
// "products/locales" rather than "products/pid/locales", so any
|
|
1320
|
+
// URL built from it pointed at a collection that does not exist.
|
|
1321
|
+
// Escaped, because `fullIdPath` is URL-facing.
|
|
1322
|
+
currentFullIdPath: fullIdPath + "/" + encodedEntityId,
|
|
1215
1323
|
currentFullUrlPath: fullUrlPath,
|
|
1216
1324
|
currentPathSegments: entitySegments,
|
|
1217
1325
|
contextEntityViews: props.contextEntityViews
|
|
@@ -1383,7 +1491,16 @@
|
|
|
1383
1491
|
return paths.reduce((a, b) => `${a}${COLLECTION_PATH_SEPARATOR}${b}`);
|
|
1384
1492
|
}
|
|
1385
1493
|
function fullPathToCollectionSegments(path) {
|
|
1386
|
-
return path
|
|
1494
|
+
return positionalCollectionSegments(path);
|
|
1495
|
+
}
|
|
1496
|
+
function collectionSegmentsFrom(pathSegments) {
|
|
1497
|
+
return keepCollectionPositions(pathSegments);
|
|
1498
|
+
}
|
|
1499
|
+
function positionalCollectionSegments(path) {
|
|
1500
|
+
return keepCollectionPositions(path.split("/"));
|
|
1501
|
+
}
|
|
1502
|
+
function keepCollectionPositions(segments) {
|
|
1503
|
+
return segments.filter((e, i) => i % 2 === 0);
|
|
1387
1504
|
}
|
|
1388
1505
|
function serializeRegExp(input) {
|
|
1389
1506
|
if (!input) return "";
|
|
@@ -1613,35 +1730,35 @@
|
|
|
1613
1730
|
create: true,
|
|
1614
1731
|
delete: true
|
|
1615
1732
|
};
|
|
1616
|
-
function resolvePermissions(collection, authController, path, entity) {
|
|
1733
|
+
function resolvePermissions(collection, authController, path, entity, pathSegments) {
|
|
1617
1734
|
const permission = collection.permissions;
|
|
1618
1735
|
if (permission === void 0) {
|
|
1619
1736
|
return DEFAULT_PERMISSIONS;
|
|
1620
1737
|
} else if (typeof permission === "object") {
|
|
1621
1738
|
return permission;
|
|
1622
1739
|
} else if (typeof permission === "function") {
|
|
1623
|
-
const
|
|
1740
|
+
const collectionSegments = pathSegments ? collectionSegmentsFrom(pathSegments) : fullPathToCollectionSegments(path);
|
|
1624
1741
|
return permission({
|
|
1625
1742
|
entity,
|
|
1626
1743
|
path,
|
|
1627
1744
|
user: authController.user,
|
|
1628
1745
|
authController,
|
|
1629
1746
|
collection,
|
|
1630
|
-
pathSegments
|
|
1747
|
+
pathSegments: collectionSegments
|
|
1631
1748
|
});
|
|
1632
1749
|
}
|
|
1633
1750
|
console.error("Permissions:", permission);
|
|
1634
1751
|
throw Error("New type of permission added and not mapped");
|
|
1635
1752
|
}
|
|
1636
|
-
function canEditEntity(collection, authController, path, entity) {
|
|
1637
|
-
return resolvePermissions(collection, authController, path, entity)?.edit ?? DEFAULT_PERMISSIONS.edit;
|
|
1753
|
+
function canEditEntity(collection, authController, path, entity, pathSegments) {
|
|
1754
|
+
return resolvePermissions(collection, authController, path, entity, pathSegments)?.edit ?? DEFAULT_PERMISSIONS.edit;
|
|
1638
1755
|
}
|
|
1639
|
-
function canCreateEntity(collection, authController, path, entity) {
|
|
1756
|
+
function canCreateEntity(collection, authController, path, entity, pathSegments) {
|
|
1640
1757
|
if (collection.collectionGroup) return false;
|
|
1641
|
-
return resolvePermissions(collection, authController, path, entity)?.create ?? DEFAULT_PERMISSIONS.create;
|
|
1758
|
+
return resolvePermissions(collection, authController, path, entity, pathSegments)?.create ?? DEFAULT_PERMISSIONS.create;
|
|
1642
1759
|
}
|
|
1643
|
-
function canDeleteEntity(collection, authController, path, entity) {
|
|
1644
|
-
return resolvePermissions(collection, authController, path, entity)?.delete ?? DEFAULT_PERMISSIONS.delete;
|
|
1760
|
+
function canDeleteEntity(collection, authController, path, entity, pathSegments) {
|
|
1761
|
+
return resolvePermissions(collection, authController, path, entity, pathSegments)?.delete ?? DEFAULT_PERMISSIONS.delete;
|
|
1645
1762
|
}
|
|
1646
1763
|
function toNumber(value) {
|
|
1647
1764
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
@@ -4613,9 +4730,10 @@
|
|
|
4613
4730
|
return fireCMSContextRef.current;
|
|
4614
4731
|
};
|
|
4615
4732
|
function useCollectionFetch(t0) {
|
|
4616
|
-
const $ = reactCompilerRuntime.c(
|
|
4733
|
+
const $ = reactCompilerRuntime.c(31);
|
|
4617
4734
|
const {
|
|
4618
4735
|
path: inputPath,
|
|
4736
|
+
pathSegments: inputPathSegments,
|
|
4619
4737
|
collection,
|
|
4620
4738
|
filterValues,
|
|
4621
4739
|
sortBy,
|
|
@@ -4625,45 +4743,63 @@
|
|
|
4625
4743
|
const dataSource = useDataSource();
|
|
4626
4744
|
const navigationController = useNavigationController();
|
|
4627
4745
|
let t1;
|
|
4628
|
-
if ($[0] !==
|
|
4629
|
-
t1 = navigationController.
|
|
4630
|
-
$[0] =
|
|
4746
|
+
if ($[0] !== inputPathSegments || $[1] !== navigationController) {
|
|
4747
|
+
t1 = inputPathSegments ? navigationController.resolveSegmentsFrom?.(inputPathSegments) ?? inputPathSegments : void 0;
|
|
4748
|
+
$[0] = inputPathSegments;
|
|
4631
4749
|
$[1] = navigationController;
|
|
4632
4750
|
$[2] = t1;
|
|
4633
4751
|
} else {
|
|
4634
4752
|
t1 = $[2];
|
|
4635
4753
|
}
|
|
4636
|
-
const
|
|
4754
|
+
const pathSegments = t1;
|
|
4755
|
+
let t2;
|
|
4756
|
+
if ($[3] !== inputPath || $[4] !== inputPathSegments || $[5] !== navigationController) {
|
|
4757
|
+
t2 = navigationController.resolveIdsFrom(inputPath, inputPathSegments);
|
|
4758
|
+
$[3] = inputPath;
|
|
4759
|
+
$[4] = inputPathSegments;
|
|
4760
|
+
$[5] = navigationController;
|
|
4761
|
+
$[6] = t2;
|
|
4762
|
+
} else {
|
|
4763
|
+
t2 = $[6];
|
|
4764
|
+
}
|
|
4765
|
+
const path = t2;
|
|
4637
4766
|
const sortByProperty = sortBy ? sortBy[0] : void 0;
|
|
4638
4767
|
const currentSort = sortBy ? sortBy[1] : void 0;
|
|
4639
4768
|
const context = useFireCMSContext();
|
|
4640
|
-
let
|
|
4641
|
-
if ($[
|
|
4642
|
-
|
|
4643
|
-
$[
|
|
4769
|
+
let t3;
|
|
4770
|
+
if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
4771
|
+
t3 = [];
|
|
4772
|
+
$[7] = t3;
|
|
4644
4773
|
} else {
|
|
4645
|
-
|
|
4774
|
+
t3 = $[7];
|
|
4646
4775
|
}
|
|
4647
|
-
const [data, setData] = React.useState(
|
|
4776
|
+
const [data, setData] = React.useState(t3);
|
|
4648
4777
|
const [dataLoading, setDataLoading] = React.useState(false);
|
|
4649
4778
|
const [dataLoadingError, setDataLoadingError] = React.useState();
|
|
4650
4779
|
const [noMoreToLoad, setNoMoreToLoad] = React.useState(false);
|
|
4651
|
-
let
|
|
4652
|
-
if ($[
|
|
4653
|
-
|
|
4780
|
+
let t4;
|
|
4781
|
+
if ($[8] !== collection || $[9] !== context || $[10] !== currentSort || $[11] !== dataSource || $[12] !== filterValues || $[13] !== itemCount || $[14] !== path || $[15] !== pathSegments || $[16] !== searchString || $[17] !== sortByProperty) {
|
|
4782
|
+
t4 = () => {
|
|
4654
4783
|
setDataLoading(true);
|
|
4655
4784
|
const onEntitiesUpdate = async (entities) => {
|
|
4785
|
+
if (pathSegments) {
|
|
4786
|
+
entities = entities.map((e) => e.pathSegments ? e : {
|
|
4787
|
+
...e,
|
|
4788
|
+
pathSegments
|
|
4789
|
+
});
|
|
4790
|
+
}
|
|
4656
4791
|
if (collection.callbacks?.onFetch) {
|
|
4657
4792
|
try {
|
|
4658
4793
|
entities = await Promise.all(entities.map((entity) => collection.callbacks.onFetch({
|
|
4659
4794
|
collection,
|
|
4660
4795
|
path,
|
|
4796
|
+
pathSegments,
|
|
4661
4797
|
entity,
|
|
4662
4798
|
context
|
|
4663
4799
|
})));
|
|
4664
|
-
} catch (
|
|
4665
|
-
const
|
|
4666
|
-
console.error(
|
|
4800
|
+
} catch (t52) {
|
|
4801
|
+
const e_0 = t52;
|
|
4802
|
+
console.error(e_0);
|
|
4667
4803
|
}
|
|
4668
4804
|
}
|
|
4669
4805
|
setDataLoading(false);
|
|
@@ -4680,6 +4816,7 @@
|
|
|
4680
4816
|
if (dataSource.listenCollection) {
|
|
4681
4817
|
return dataSource.listenCollection({
|
|
4682
4818
|
path,
|
|
4819
|
+
pathSegments,
|
|
4683
4820
|
collection,
|
|
4684
4821
|
onUpdate: onEntitiesUpdate,
|
|
4685
4822
|
onError,
|
|
@@ -4693,6 +4830,7 @@
|
|
|
4693
4830
|
} else {
|
|
4694
4831
|
dataSource.fetchCollection({
|
|
4695
4832
|
path,
|
|
4833
|
+
pathSegments,
|
|
4696
4834
|
collection,
|
|
4697
4835
|
searchString,
|
|
4698
4836
|
filter: filterValues,
|
|
@@ -4704,61 +4842,185 @@
|
|
|
4704
4842
|
return _temp2$f;
|
|
4705
4843
|
}
|
|
4706
4844
|
};
|
|
4707
|
-
$[
|
|
4708
|
-
$[
|
|
4709
|
-
$[
|
|
4710
|
-
$[
|
|
4711
|
-
$[
|
|
4712
|
-
$[
|
|
4713
|
-
$[
|
|
4714
|
-
$[
|
|
4715
|
-
$[
|
|
4716
|
-
$[
|
|
4845
|
+
$[8] = collection;
|
|
4846
|
+
$[9] = context;
|
|
4847
|
+
$[10] = currentSort;
|
|
4848
|
+
$[11] = dataSource;
|
|
4849
|
+
$[12] = filterValues;
|
|
4850
|
+
$[13] = itemCount;
|
|
4851
|
+
$[14] = path;
|
|
4852
|
+
$[15] = pathSegments;
|
|
4853
|
+
$[16] = searchString;
|
|
4854
|
+
$[17] = sortByProperty;
|
|
4855
|
+
$[18] = t4;
|
|
4717
4856
|
} else {
|
|
4718
|
-
|
|
4857
|
+
t4 = $[18];
|
|
4719
4858
|
}
|
|
4720
|
-
let
|
|
4721
|
-
if ($[
|
|
4722
|
-
|
|
4723
|
-
$[
|
|
4724
|
-
$[
|
|
4725
|
-
$[
|
|
4726
|
-
$[
|
|
4727
|
-
$[
|
|
4728
|
-
$[
|
|
4729
|
-
$[
|
|
4859
|
+
let t5;
|
|
4860
|
+
if ($[19] !== currentSort || $[20] !== filterValues || $[21] !== itemCount || $[22] !== path || $[23] !== searchString || $[24] !== sortByProperty) {
|
|
4861
|
+
t5 = [path, itemCount, currentSort, sortByProperty, filterValues, searchString];
|
|
4862
|
+
$[19] = currentSort;
|
|
4863
|
+
$[20] = filterValues;
|
|
4864
|
+
$[21] = itemCount;
|
|
4865
|
+
$[22] = path;
|
|
4866
|
+
$[23] = searchString;
|
|
4867
|
+
$[24] = sortByProperty;
|
|
4868
|
+
$[25] = t5;
|
|
4730
4869
|
} else {
|
|
4731
|
-
|
|
4870
|
+
t5 = $[25];
|
|
4732
4871
|
}
|
|
4733
|
-
React.useEffect(
|
|
4734
|
-
let
|
|
4735
|
-
if ($[
|
|
4736
|
-
|
|
4872
|
+
React.useEffect(t4, t5);
|
|
4873
|
+
let t6;
|
|
4874
|
+
if ($[26] !== data || $[27] !== dataLoading || $[28] !== dataLoadingError || $[29] !== noMoreToLoad) {
|
|
4875
|
+
t6 = {
|
|
4737
4876
|
data,
|
|
4738
4877
|
dataLoading,
|
|
4739
4878
|
dataLoadingError,
|
|
4740
4879
|
noMoreToLoad
|
|
4741
4880
|
};
|
|
4742
|
-
$[
|
|
4743
|
-
$[
|
|
4744
|
-
$[
|
|
4745
|
-
$[
|
|
4746
|
-
$[
|
|
4881
|
+
$[26] = data;
|
|
4882
|
+
$[27] = dataLoading;
|
|
4883
|
+
$[28] = dataLoadingError;
|
|
4884
|
+
$[29] = noMoreToLoad;
|
|
4885
|
+
$[30] = t6;
|
|
4747
4886
|
} else {
|
|
4748
|
-
|
|
4887
|
+
t6 = $[30];
|
|
4749
4888
|
}
|
|
4750
|
-
return
|
|
4889
|
+
return t6;
|
|
4751
4890
|
}
|
|
4752
4891
|
function _temp2$f() {
|
|
4753
4892
|
}
|
|
4754
|
-
function _temp$D(
|
|
4893
|
+
function _temp$D(e_1) {
|
|
4755
4894
|
return {
|
|
4756
|
-
...
|
|
4895
|
+
...e_1
|
|
4757
4896
|
};
|
|
4758
4897
|
}
|
|
4898
|
+
function entityCacheKey(path, entityId) {
|
|
4899
|
+
return `${path}/${entityId === void 0 ? entityId : encodeEntityId(entityId)}`;
|
|
4900
|
+
}
|
|
4901
|
+
const LOCAL_STORAGE_PREFIX = "entity_cache::";
|
|
4902
|
+
const entityCache = /* @__PURE__ */ new Map();
|
|
4903
|
+
const isLocalStorageAvailable = typeof localStorage !== "undefined";
|
|
4904
|
+
function customReplacer(key) {
|
|
4905
|
+
const value = this[key];
|
|
4906
|
+
if (value instanceof Date) {
|
|
4907
|
+
return {
|
|
4908
|
+
__type: "Date",
|
|
4909
|
+
value: value.toISOString()
|
|
4910
|
+
};
|
|
4911
|
+
}
|
|
4912
|
+
if (value instanceof EntityReference) {
|
|
4913
|
+
return {
|
|
4914
|
+
__type: "EntityReference",
|
|
4915
|
+
id: value.id,
|
|
4916
|
+
path: value.path,
|
|
4917
|
+
databaseId: value.databaseId
|
|
4918
|
+
};
|
|
4919
|
+
}
|
|
4920
|
+
if (value instanceof GeoPoint) {
|
|
4921
|
+
return {
|
|
4922
|
+
__type: "GeoPoint",
|
|
4923
|
+
latitude: value.latitude,
|
|
4924
|
+
longitude: value.longitude
|
|
4925
|
+
};
|
|
4926
|
+
}
|
|
4927
|
+
if (value instanceof Vector) {
|
|
4928
|
+
return {
|
|
4929
|
+
__type: "Vector",
|
|
4930
|
+
value: value.value
|
|
4931
|
+
};
|
|
4932
|
+
}
|
|
4933
|
+
return value;
|
|
4934
|
+
}
|
|
4935
|
+
function customReviver(key, value) {
|
|
4936
|
+
if (value && typeof value === "object" && "__type" in value) {
|
|
4937
|
+
switch (value.__type) {
|
|
4938
|
+
case "Date":
|
|
4939
|
+
return new Date(value.value);
|
|
4940
|
+
case "EntityReference":
|
|
4941
|
+
return new EntityReference(value.id, value.path, value.databaseId);
|
|
4942
|
+
case "GeoPoint":
|
|
4943
|
+
return new GeoPoint(value.latitude, value.longitude);
|
|
4944
|
+
case "Vector":
|
|
4945
|
+
return new Vector(value.value);
|
|
4946
|
+
default:
|
|
4947
|
+
return value;
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4950
|
+
return value;
|
|
4951
|
+
}
|
|
4952
|
+
function saveEntityToCache(path, data) {
|
|
4953
|
+
if (isLocalStorageAvailable) {
|
|
4954
|
+
try {
|
|
4955
|
+
const key = LOCAL_STORAGE_PREFIX + path;
|
|
4956
|
+
const entityString = JSON.stringify(data, customReplacer);
|
|
4957
|
+
console.debug("Saving entity to localStorage:", {
|
|
4958
|
+
key,
|
|
4959
|
+
entityString
|
|
4960
|
+
});
|
|
4961
|
+
localStorage.setItem(key, entityString);
|
|
4962
|
+
} catch (error) {
|
|
4963
|
+
console.error(`Failed to save entity for path "${path}" to localStorage:`, error);
|
|
4964
|
+
}
|
|
4965
|
+
}
|
|
4966
|
+
}
|
|
4967
|
+
function removeEntityFromMemoryCache(path) {
|
|
4968
|
+
entityCache.delete(path);
|
|
4969
|
+
}
|
|
4970
|
+
function saveEntityToMemoryCache(path, data) {
|
|
4971
|
+
entityCache.set(path, data);
|
|
4972
|
+
}
|
|
4973
|
+
function getEntityFromMemoryCache(path) {
|
|
4974
|
+
return entityCache.get(path);
|
|
4975
|
+
}
|
|
4976
|
+
function getEntityFromCache(path) {
|
|
4977
|
+
if (isLocalStorageAvailable) {
|
|
4978
|
+
try {
|
|
4979
|
+
const key = LOCAL_STORAGE_PREFIX + path;
|
|
4980
|
+
const entityString = localStorage.getItem(key);
|
|
4981
|
+
if (entityString) {
|
|
4982
|
+
const entity = JSON.parse(entityString, customReviver);
|
|
4983
|
+
return entity;
|
|
4984
|
+
}
|
|
4985
|
+
} catch (error) {
|
|
4986
|
+
console.error(`Failed to load entity for path "${path}" from localStorage:`, error);
|
|
4987
|
+
}
|
|
4988
|
+
}
|
|
4989
|
+
return void 0;
|
|
4990
|
+
}
|
|
4991
|
+
function removeEntityFromCache(path) {
|
|
4992
|
+
if (isLocalStorageAvailable) {
|
|
4993
|
+
try {
|
|
4994
|
+
const key = LOCAL_STORAGE_PREFIX + path;
|
|
4995
|
+
localStorage.removeItem(key);
|
|
4996
|
+
} catch (error) {
|
|
4997
|
+
console.error(`Failed to remove entity for path "${path}" from localStorage:`, error);
|
|
4998
|
+
}
|
|
4999
|
+
}
|
|
5000
|
+
}
|
|
5001
|
+
function flattenKeys(obj, prefix = "", result = []) {
|
|
5002
|
+
if (isObject(obj) || Array.isArray(obj)) {
|
|
5003
|
+
const plainObject = isPlainObject(obj);
|
|
5004
|
+
if (!plainObject && prefix) {
|
|
5005
|
+
result.push(prefix);
|
|
5006
|
+
} else {
|
|
5007
|
+
for (const key in obj) {
|
|
5008
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
5009
|
+
const newKey = prefix ? Array.isArray(obj) ? `${prefix}[${key}]` : `${prefix}.${key}` : key;
|
|
5010
|
+
if (isObject(obj[key]) || Array.isArray(obj[key])) {
|
|
5011
|
+
flattenKeys(obj[key], newKey, result);
|
|
5012
|
+
} else {
|
|
5013
|
+
result.push(newKey);
|
|
5014
|
+
}
|
|
5015
|
+
}
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
return result;
|
|
5020
|
+
}
|
|
4759
5021
|
const CACHE = {};
|
|
4760
5022
|
function useEntityFetch(t0) {
|
|
4761
|
-
const $ = reactCompilerRuntime.c(
|
|
5023
|
+
const $ = reactCompilerRuntime.c(23);
|
|
4762
5024
|
const {
|
|
4763
5025
|
path: inputPath,
|
|
4764
5026
|
pathSegments: inputPathSegments,
|
|
@@ -4770,44 +5032,57 @@
|
|
|
4770
5032
|
const useCache = t1 === void 0 ? false : t1;
|
|
4771
5033
|
const dataSource = useDataSource();
|
|
4772
5034
|
const navigationController = useNavigationController();
|
|
4773
|
-
let path;
|
|
4774
5035
|
let t2;
|
|
4775
|
-
if ($[0] !==
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
$[
|
|
4779
|
-
$[
|
|
4780
|
-
$[2] = navigationController;
|
|
4781
|
-
$[3] = path;
|
|
4782
|
-
$[4] = t2;
|
|
5036
|
+
if ($[0] !== inputPathSegments || $[1] !== navigationController) {
|
|
5037
|
+
t2 = inputPathSegments ? navigationController.resolveSegmentsFrom?.(inputPathSegments) ?? inputPathSegments : void 0;
|
|
5038
|
+
$[0] = inputPathSegments;
|
|
5039
|
+
$[1] = navigationController;
|
|
5040
|
+
$[2] = t2;
|
|
4783
5041
|
} else {
|
|
4784
|
-
|
|
4785
|
-
t2 = $[4];
|
|
5042
|
+
t2 = $[2];
|
|
4786
5043
|
}
|
|
4787
5044
|
const pathSegments = t2;
|
|
5045
|
+
let t3;
|
|
5046
|
+
if ($[3] !== inputPath || $[4] !== inputPathSegments || $[5] !== navigationController) {
|
|
5047
|
+
t3 = navigationController.resolveIdsFrom(inputPath, inputPathSegments);
|
|
5048
|
+
$[3] = inputPath;
|
|
5049
|
+
$[4] = inputPathSegments;
|
|
5050
|
+
$[5] = navigationController;
|
|
5051
|
+
$[6] = t3;
|
|
5052
|
+
} else {
|
|
5053
|
+
t3 = $[6];
|
|
5054
|
+
}
|
|
5055
|
+
const path = t3;
|
|
4788
5056
|
const context = useFireCMSContext();
|
|
4789
5057
|
const [entity, setEntity] = React.useState();
|
|
4790
5058
|
const [dataLoading, setDataLoading] = React.useState(true);
|
|
4791
5059
|
const [dataLoadingError, setDataLoadingError] = React.useState();
|
|
4792
|
-
let
|
|
4793
|
-
if ($[
|
|
4794
|
-
|
|
5060
|
+
let t4;
|
|
5061
|
+
if ($[7] !== collection || $[8] !== context || $[9] !== dataSource || $[10] !== databaseId || $[11] !== entityId || $[12] !== path || $[13] !== pathSegments || $[14] !== useCache) {
|
|
5062
|
+
t4 = () => {
|
|
4795
5063
|
setDataLoading(true);
|
|
4796
5064
|
const onEntityUpdate = async (updatedEntity) => {
|
|
5065
|
+
if (updatedEntity && pathSegments && !updatedEntity.pathSegments) {
|
|
5066
|
+
updatedEntity = {
|
|
5067
|
+
...updatedEntity,
|
|
5068
|
+
pathSegments
|
|
5069
|
+
};
|
|
5070
|
+
}
|
|
4797
5071
|
if (collection.callbacks?.onFetch && updatedEntity) {
|
|
4798
5072
|
try {
|
|
4799
5073
|
updatedEntity = await collection.callbacks.onFetch({
|
|
4800
5074
|
collection,
|
|
4801
5075
|
path,
|
|
5076
|
+
pathSegments,
|
|
4802
5077
|
entity: updatedEntity,
|
|
4803
5078
|
context
|
|
4804
5079
|
});
|
|
4805
|
-
} catch (
|
|
4806
|
-
const e =
|
|
5080
|
+
} catch (t52) {
|
|
5081
|
+
const e = t52;
|
|
4807
5082
|
console.error(e);
|
|
4808
5083
|
}
|
|
4809
5084
|
}
|
|
4810
|
-
CACHE[
|
|
5085
|
+
CACHE[entityCacheKey(path, entityId)] = updatedEntity;
|
|
4811
5086
|
setEntity(updatedEntity);
|
|
4812
5087
|
setDataLoading(false);
|
|
4813
5088
|
setDataLoadingError(void 0);
|
|
@@ -4818,8 +5093,8 @@
|
|
|
4818
5093
|
setEntity(void 0);
|
|
4819
5094
|
setDataLoadingError(error);
|
|
4820
5095
|
};
|
|
4821
|
-
if (entityId && useCache && CACHE[
|
|
4822
|
-
setEntity(CACHE[
|
|
5096
|
+
if (entityId && useCache && CACHE[entityCacheKey(path, entityId)]) {
|
|
5097
|
+
setEntity(CACHE[entityCacheKey(path, entityId)]);
|
|
4823
5098
|
setDataLoading(false);
|
|
4824
5099
|
setDataLoadingError(void 0);
|
|
4825
5100
|
return _temp$C;
|
|
@@ -4851,43 +5126,43 @@
|
|
|
4851
5126
|
}
|
|
4852
5127
|
}
|
|
4853
5128
|
};
|
|
4854
|
-
$[
|
|
4855
|
-
$[
|
|
4856
|
-
$[
|
|
4857
|
-
$[
|
|
4858
|
-
$[
|
|
4859
|
-
$[
|
|
4860
|
-
$[
|
|
4861
|
-
$[
|
|
4862
|
-
$[
|
|
5129
|
+
$[7] = collection;
|
|
5130
|
+
$[8] = context;
|
|
5131
|
+
$[9] = dataSource;
|
|
5132
|
+
$[10] = databaseId;
|
|
5133
|
+
$[11] = entityId;
|
|
5134
|
+
$[12] = path;
|
|
5135
|
+
$[13] = pathSegments;
|
|
5136
|
+
$[14] = useCache;
|
|
5137
|
+
$[15] = t4;
|
|
4863
5138
|
} else {
|
|
4864
|
-
|
|
5139
|
+
t4 = $[15];
|
|
4865
5140
|
}
|
|
4866
|
-
let
|
|
4867
|
-
if ($[
|
|
4868
|
-
|
|
4869
|
-
$[
|
|
4870
|
-
$[
|
|
4871
|
-
$[
|
|
5141
|
+
let t5;
|
|
5142
|
+
if ($[16] !== entityId || $[17] !== path) {
|
|
5143
|
+
t5 = [entityId, path];
|
|
5144
|
+
$[16] = entityId;
|
|
5145
|
+
$[17] = path;
|
|
5146
|
+
$[18] = t5;
|
|
4872
5147
|
} else {
|
|
4873
|
-
|
|
5148
|
+
t5 = $[18];
|
|
4874
5149
|
}
|
|
4875
|
-
React.useEffect(
|
|
4876
|
-
let
|
|
4877
|
-
if ($[
|
|
4878
|
-
|
|
5150
|
+
React.useEffect(t4, t5);
|
|
5151
|
+
let t6;
|
|
5152
|
+
if ($[19] !== dataLoading || $[20] !== dataLoadingError || $[21] !== entity) {
|
|
5153
|
+
t6 = {
|
|
4879
5154
|
entity,
|
|
4880
5155
|
dataLoading,
|
|
4881
5156
|
dataLoadingError
|
|
4882
5157
|
};
|
|
4883
|
-
$[
|
|
4884
|
-
$[
|
|
4885
|
-
$[
|
|
4886
|
-
$[
|
|
5158
|
+
$[19] = dataLoading;
|
|
5159
|
+
$[20] = dataLoadingError;
|
|
5160
|
+
$[21] = entity;
|
|
5161
|
+
$[22] = t6;
|
|
4887
5162
|
} else {
|
|
4888
|
-
|
|
5163
|
+
t6 = $[22];
|
|
4889
5164
|
}
|
|
4890
|
-
return
|
|
5165
|
+
return t6;
|
|
4891
5166
|
}
|
|
4892
5167
|
function _temp3$5() {
|
|
4893
5168
|
}
|
|
@@ -4915,7 +5190,7 @@
|
|
|
4915
5190
|
}
|
|
4916
5191
|
let updatedValues;
|
|
4917
5192
|
const customizationController = context.customizationController;
|
|
4918
|
-
const resolvedPath = context.navigation.resolveIdsFrom(path);
|
|
5193
|
+
const resolvedPath = context.navigation.resolveIdsFrom(path, pathSegments);
|
|
4919
5194
|
const callbacks = collection.callbacks;
|
|
4920
5195
|
if (callbacks?.onPreSave) {
|
|
4921
5196
|
try {
|
|
@@ -4930,6 +5205,7 @@
|
|
|
4930
5205
|
updatedValues = await callbacks.onPreSave({
|
|
4931
5206
|
collection: resolvedCollection,
|
|
4932
5207
|
path,
|
|
5208
|
+
pathSegments,
|
|
4933
5209
|
resolvedPath,
|
|
4934
5210
|
entityId,
|
|
4935
5211
|
values,
|
|
@@ -4948,7 +5224,7 @@
|
|
|
4948
5224
|
return dataSource.saveEntity({
|
|
4949
5225
|
collection,
|
|
4950
5226
|
path: resolvedPath,
|
|
4951
|
-
pathSegments
|
|
5227
|
+
pathSegments,
|
|
4952
5228
|
entityId,
|
|
4953
5229
|
values: updatedValues,
|
|
4954
5230
|
previousValues,
|
|
@@ -4967,6 +5243,7 @@
|
|
|
4967
5243
|
callbacks.onSaveSuccess({
|
|
4968
5244
|
collection: resolvedCollection,
|
|
4969
5245
|
path,
|
|
5246
|
+
pathSegments,
|
|
4970
5247
|
resolvedPath,
|
|
4971
5248
|
entityId: entity.id,
|
|
4972
5249
|
values: updatedValues,
|
|
@@ -4992,6 +5269,7 @@
|
|
|
4992
5269
|
callbacks.onSaveFailure({
|
|
4993
5270
|
collection: resolvedCollection,
|
|
4994
5271
|
path,
|
|
5272
|
+
pathSegments,
|
|
4995
5273
|
resolvedPath,
|
|
4996
5274
|
entityId,
|
|
4997
5275
|
values: updatedValues,
|
|
@@ -5006,6 +5284,7 @@
|
|
|
5006
5284
|
async function deleteEntityWithCallbacks({
|
|
5007
5285
|
dataSource,
|
|
5008
5286
|
entity,
|
|
5287
|
+
pathSegments,
|
|
5009
5288
|
collection,
|
|
5010
5289
|
callbacks,
|
|
5011
5290
|
onDeleteSuccess,
|
|
@@ -5015,11 +5294,13 @@
|
|
|
5015
5294
|
context
|
|
5016
5295
|
}) {
|
|
5017
5296
|
console.debug("Deleting entity", entity.path, entity.id);
|
|
5297
|
+
const resolvedPathSegments = pathSegments ?? entity.pathSegments;
|
|
5018
5298
|
const entityDeleteProps = {
|
|
5019
5299
|
entity,
|
|
5020
5300
|
collection,
|
|
5021
5301
|
entityId: entity.id,
|
|
5022
5302
|
path: entity.path,
|
|
5303
|
+
pathSegments: resolvedPathSegments,
|
|
5023
5304
|
context
|
|
5024
5305
|
};
|
|
5025
5306
|
if (callbacks?.onPreDelete) {
|
|
@@ -5032,6 +5313,7 @@
|
|
|
5032
5313
|
}
|
|
5033
5314
|
}
|
|
5034
5315
|
return dataSource.deleteEntity({
|
|
5316
|
+
pathSegments: resolvedPathSegments,
|
|
5035
5317
|
entity,
|
|
5036
5318
|
collection
|
|
5037
5319
|
}).then(() => {
|
|
@@ -5067,12 +5349,14 @@
|
|
|
5067
5349
|
if (entry.type === "collection") {
|
|
5068
5350
|
return Promise.resolve(entry);
|
|
5069
5351
|
} else if (entry.type === "entity") {
|
|
5070
|
-
const collection = navigation.getCollection(entry.path);
|
|
5352
|
+
const collection = navigation.getCollection(entry.path, false, entry.pathSegments);
|
|
5071
5353
|
if (!collection) {
|
|
5072
5354
|
throw Error(`No collection defined in the navigation for the entity with path ${entry.path}`);
|
|
5073
5355
|
}
|
|
5074
5356
|
return dataSource.fetchEntity({
|
|
5075
5357
|
path: entry.path,
|
|
5358
|
+
// The navigation entry already knows the real segment boundaries.
|
|
5359
|
+
pathSegments: entry.pathSegments,
|
|
5076
5360
|
entityId: entry.entityId,
|
|
5077
5361
|
collection
|
|
5078
5362
|
}).then((entity) => {
|
|
@@ -6472,7 +6756,7 @@
|
|
|
6472
6756
|
const sideEntityController = useSideEntityController();
|
|
6473
6757
|
const customizationController = useCustomizationController();
|
|
6474
6758
|
const navigationController = useNavigationController();
|
|
6475
|
-
const collection = collectionProp ?? navigationController.getCollection(entity.path);
|
|
6759
|
+
const collection = collectionProp ?? navigationController.getCollection(entity.path, false, entity.pathSegments);
|
|
6476
6760
|
if (!collection) {
|
|
6477
6761
|
throw Error(`Couldn't find the corresponding collection view for the path: ${entity.path}`);
|
|
6478
6762
|
}
|
|
@@ -6515,6 +6799,9 @@
|
|
|
6515
6799
|
sideEntityController.open({
|
|
6516
6800
|
entityId: entity.id,
|
|
6517
6801
|
path: entity.path,
|
|
6802
|
+
// Paired with `entity.path` above; undefined if the entity was
|
|
6803
|
+
// loaded without them.
|
|
6804
|
+
pathSegments: entity.pathSegments,
|
|
6518
6805
|
collection,
|
|
6519
6806
|
updateUrl: true
|
|
6520
6807
|
});
|
|
@@ -6639,7 +6926,7 @@
|
|
|
6639
6926
|
return t0;
|
|
6640
6927
|
};
|
|
6641
6928
|
function ReferencePreviewInternal(t0) {
|
|
6642
|
-
const $ = reactCompilerRuntime.c(
|
|
6929
|
+
const $ = reactCompilerRuntime.c(23);
|
|
6643
6930
|
const {
|
|
6644
6931
|
disabled,
|
|
6645
6932
|
reference,
|
|
@@ -6655,70 +6942,71 @@
|
|
|
6655
6942
|
const customizationController = useCustomizationController();
|
|
6656
6943
|
const navigationController = useNavigationController();
|
|
6657
6944
|
let t3;
|
|
6658
|
-
if ($[0] !== navigationController || $[1] !== reference.path) {
|
|
6659
|
-
t3 = navigationController.getCollection(reference.path);
|
|
6945
|
+
if ($[0] !== navigationController || $[1] !== reference.path || $[2] !== reference.pathSegments) {
|
|
6946
|
+
t3 = navigationController.getCollection(reference.path, false, reference.pathSegments);
|
|
6660
6947
|
$[0] = navigationController;
|
|
6661
6948
|
$[1] = reference.path;
|
|
6662
|
-
$[2] =
|
|
6949
|
+
$[2] = reference.pathSegments;
|
|
6950
|
+
$[3] = t3;
|
|
6663
6951
|
} else {
|
|
6664
|
-
t3 = $[
|
|
6952
|
+
t3 = $[3];
|
|
6665
6953
|
}
|
|
6666
6954
|
const collection = t3;
|
|
6667
6955
|
if (!collection) {
|
|
6668
6956
|
if (customizationController.components?.missingReference) {
|
|
6669
6957
|
let t42;
|
|
6670
|
-
if ($[
|
|
6958
|
+
if ($[4] !== customizationController.components.missingReference || $[5] !== reference.path) {
|
|
6671
6959
|
t42 = /* @__PURE__ */ jsxRuntime.jsx(customizationController.components.missingReference, { path: reference.path });
|
|
6672
|
-
$[
|
|
6673
|
-
$[
|
|
6674
|
-
$[
|
|
6960
|
+
$[4] = customizationController.components.missingReference;
|
|
6961
|
+
$[5] = reference.path;
|
|
6962
|
+
$[6] = t42;
|
|
6675
6963
|
} else {
|
|
6676
|
-
t42 = $[
|
|
6964
|
+
t42 = $[6];
|
|
6677
6965
|
}
|
|
6678
6966
|
return t42;
|
|
6679
6967
|
} else {
|
|
6680
6968
|
const t42 = size ?? "medium";
|
|
6681
6969
|
let t5;
|
|
6682
|
-
if ($[
|
|
6970
|
+
if ($[7] !== reference.pathWithId) {
|
|
6683
6971
|
t5 = /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "Unexpected reference value. Click to edit", tooltip: reference.pathWithId });
|
|
6684
|
-
$[
|
|
6685
|
-
$[
|
|
6972
|
+
$[7] = reference.pathWithId;
|
|
6973
|
+
$[8] = t5;
|
|
6686
6974
|
} else {
|
|
6687
|
-
t5 = $[
|
|
6975
|
+
t5 = $[8];
|
|
6688
6976
|
}
|
|
6689
6977
|
let t6;
|
|
6690
|
-
if ($[
|
|
6978
|
+
if ($[9] !== onClick || $[10] !== t42 || $[11] !== t5) {
|
|
6691
6979
|
t6 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreviewContainer, { onClick, size: t42, children: t5 });
|
|
6692
|
-
$[
|
|
6693
|
-
$[
|
|
6694
|
-
$[
|
|
6695
|
-
$[
|
|
6980
|
+
$[9] = onClick;
|
|
6981
|
+
$[10] = t42;
|
|
6982
|
+
$[11] = t5;
|
|
6983
|
+
$[12] = t6;
|
|
6696
6984
|
} else {
|
|
6697
|
-
t6 = $[
|
|
6985
|
+
t6 = $[12];
|
|
6698
6986
|
}
|
|
6699
6987
|
return t6;
|
|
6700
6988
|
}
|
|
6701
6989
|
}
|
|
6702
6990
|
let t4;
|
|
6703
|
-
if ($[
|
|
6991
|
+
if ($[13] !== collection || $[14] !== disabled || $[15] !== hover || $[16] !== includeEntityLink || $[17] !== includeId || $[18] !== onClick || $[19] !== previewProperties || $[20] !== reference || $[21] !== size) {
|
|
6704
6992
|
t4 = /* @__PURE__ */ jsxRuntime.jsx(ReferencePreviewExisting, { reference, collection, previewProperties, size, disabled, includeEntityLink, includeId, onClick, hover });
|
|
6705
|
-
$[
|
|
6706
|
-
$[
|
|
6707
|
-
$[
|
|
6708
|
-
$[
|
|
6709
|
-
$[
|
|
6710
|
-
$[
|
|
6711
|
-
$[
|
|
6712
|
-
$[
|
|
6713
|
-
$[
|
|
6714
|
-
$[
|
|
6993
|
+
$[13] = collection;
|
|
6994
|
+
$[14] = disabled;
|
|
6995
|
+
$[15] = hover;
|
|
6996
|
+
$[16] = includeEntityLink;
|
|
6997
|
+
$[17] = includeId;
|
|
6998
|
+
$[18] = onClick;
|
|
6999
|
+
$[19] = previewProperties;
|
|
7000
|
+
$[20] = reference;
|
|
7001
|
+
$[21] = size;
|
|
7002
|
+
$[22] = t4;
|
|
6715
7003
|
} else {
|
|
6716
|
-
t4 = $[
|
|
7004
|
+
t4 = $[22];
|
|
6717
7005
|
}
|
|
6718
7006
|
return t4;
|
|
6719
7007
|
}
|
|
6720
7008
|
function ReferencePreviewExisting(t0) {
|
|
6721
|
-
const $ = reactCompilerRuntime.c(
|
|
7009
|
+
const $ = reactCompilerRuntime.c(37);
|
|
6722
7010
|
const {
|
|
6723
7011
|
reference,
|
|
6724
7012
|
collection,
|
|
@@ -6731,9 +7019,10 @@
|
|
|
6731
7019
|
hover
|
|
6732
7020
|
} = t0;
|
|
6733
7021
|
let t1;
|
|
6734
|
-
if ($[0] !== collection || $[1] !== reference.id || $[2] !== reference.path) {
|
|
7022
|
+
if ($[0] !== collection || $[1] !== reference.id || $[2] !== reference.path || $[3] !== reference.pathSegments) {
|
|
6735
7023
|
t1 = {
|
|
6736
7024
|
path: reference.path,
|
|
7025
|
+
pathSegments: reference.pathSegments,
|
|
6737
7026
|
entityId: reference.id,
|
|
6738
7027
|
collection,
|
|
6739
7028
|
useCache: true
|
|
@@ -6741,46 +7030,48 @@
|
|
|
6741
7030
|
$[0] = collection;
|
|
6742
7031
|
$[1] = reference.id;
|
|
6743
7032
|
$[2] = reference.path;
|
|
6744
|
-
$[3] =
|
|
7033
|
+
$[3] = reference.pathSegments;
|
|
7034
|
+
$[4] = t1;
|
|
6745
7035
|
} else {
|
|
6746
|
-
t1 = $[
|
|
7036
|
+
t1 = $[4];
|
|
6747
7037
|
}
|
|
6748
7038
|
const {
|
|
6749
7039
|
entity,
|
|
6750
7040
|
dataLoading
|
|
6751
7041
|
} = useEntityFetch(t1);
|
|
6752
7042
|
if (entity) {
|
|
6753
|
-
referencesCache.set(reference.
|
|
7043
|
+
referencesCache.set(entityCacheKey(reference.path, reference.id), entity);
|
|
6754
7044
|
}
|
|
6755
7045
|
let t2;
|
|
6756
|
-
if ($[
|
|
6757
|
-
t2 = entity ?? referencesCache.get(reference.
|
|
6758
|
-
$[
|
|
6759
|
-
$[
|
|
6760
|
-
$[
|
|
7046
|
+
if ($[5] !== entity || $[6] !== reference.id || $[7] !== reference.path) {
|
|
7047
|
+
t2 = entity ?? referencesCache.get(entityCacheKey(reference.path, reference.id));
|
|
7048
|
+
$[5] = entity;
|
|
7049
|
+
$[6] = reference.id;
|
|
7050
|
+
$[7] = reference.path;
|
|
7051
|
+
$[8] = t2;
|
|
6761
7052
|
} else {
|
|
6762
|
-
t2 = $[
|
|
7053
|
+
t2 = $[8];
|
|
6763
7054
|
}
|
|
6764
7055
|
const usedEntity = t2;
|
|
6765
7056
|
let body;
|
|
6766
7057
|
if (!reference) {
|
|
6767
7058
|
let t32;
|
|
6768
|
-
if ($[
|
|
7059
|
+
if ($[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
6769
7060
|
t32 = /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "Reference not set" });
|
|
6770
|
-
$[
|
|
7061
|
+
$[9] = t32;
|
|
6771
7062
|
} else {
|
|
6772
|
-
t32 = $[
|
|
7063
|
+
t32 = $[9];
|
|
6773
7064
|
}
|
|
6774
7065
|
body = t32;
|
|
6775
7066
|
} else {
|
|
6776
7067
|
if (usedEntity && !usedEntity.values) {
|
|
6777
7068
|
let t32;
|
|
6778
|
-
if ($[
|
|
7069
|
+
if ($[10] !== reference.path) {
|
|
6779
7070
|
t32 = /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "Reference does not exist", tooltip: reference.path });
|
|
6780
|
-
$[
|
|
6781
|
-
$[
|
|
7071
|
+
$[10] = reference.path;
|
|
7072
|
+
$[11] = t32;
|
|
6782
7073
|
} else {
|
|
6783
|
-
t32 = $[
|
|
7074
|
+
t32 = $[11];
|
|
6784
7075
|
}
|
|
6785
7076
|
body = t32;
|
|
6786
7077
|
}
|
|
@@ -6789,15 +7080,15 @@
|
|
|
6789
7080
|
const t32 = disabled ? void 0 : onClick;
|
|
6790
7081
|
const t4 = disabled ? void 0 : hover;
|
|
6791
7082
|
let t5;
|
|
6792
|
-
if ($[
|
|
7083
|
+
if ($[12] !== body || $[13] !== size || $[14] !== t32 || $[15] !== t4) {
|
|
6793
7084
|
t5 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreviewContainer, { onClick: t32, hover: t4, size, children: body });
|
|
6794
|
-
$[
|
|
6795
|
-
$[
|
|
6796
|
-
$[
|
|
6797
|
-
$[
|
|
6798
|
-
$[
|
|
7085
|
+
$[12] = body;
|
|
7086
|
+
$[13] = size;
|
|
7087
|
+
$[14] = t32;
|
|
7088
|
+
$[15] = t4;
|
|
7089
|
+
$[16] = t5;
|
|
6799
7090
|
} else {
|
|
6800
|
-
t5 = $[
|
|
7091
|
+
t5 = $[16];
|
|
6801
7092
|
}
|
|
6802
7093
|
return t5;
|
|
6803
7094
|
}
|
|
@@ -6805,21 +7096,21 @@
|
|
|
6805
7096
|
const t32 = disabled ? void 0 : onClick;
|
|
6806
7097
|
const t4 = disabled ? void 0 : hover;
|
|
6807
7098
|
let t5;
|
|
6808
|
-
if ($[
|
|
7099
|
+
if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
6809
7100
|
t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, {});
|
|
6810
|
-
$[
|
|
7101
|
+
$[17] = t5;
|
|
6811
7102
|
} else {
|
|
6812
|
-
t5 = $[
|
|
7103
|
+
t5 = $[17];
|
|
6813
7104
|
}
|
|
6814
7105
|
let t6;
|
|
6815
|
-
if ($[
|
|
7106
|
+
if ($[18] !== size || $[19] !== t32 || $[20] !== t4) {
|
|
6816
7107
|
t6 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreviewContainer, { onClick: t32, hover: t4, size, children: t5 });
|
|
6817
|
-
$[
|
|
6818
|
-
$[
|
|
6819
|
-
$[
|
|
6820
|
-
$[
|
|
7108
|
+
$[18] = size;
|
|
7109
|
+
$[19] = t32;
|
|
7110
|
+
$[20] = t4;
|
|
7111
|
+
$[21] = t6;
|
|
6821
7112
|
} else {
|
|
6822
|
-
t6 = $[
|
|
7113
|
+
t6 = $[21];
|
|
6823
7114
|
}
|
|
6824
7115
|
return t6;
|
|
6825
7116
|
}
|
|
@@ -6827,39 +7118,39 @@
|
|
|
6827
7118
|
const t32 = disabled ? void 0 : onClick;
|
|
6828
7119
|
const t4 = disabled ? void 0 : hover;
|
|
6829
7120
|
let t5;
|
|
6830
|
-
if ($[
|
|
7121
|
+
if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
6831
7122
|
t5 = /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "Entity not found" });
|
|
6832
|
-
$[
|
|
7123
|
+
$[22] = t5;
|
|
6833
7124
|
} else {
|
|
6834
|
-
t5 = $[
|
|
7125
|
+
t5 = $[22];
|
|
6835
7126
|
}
|
|
6836
7127
|
let t6;
|
|
6837
|
-
if ($[
|
|
7128
|
+
if ($[23] !== size || $[24] !== t32 || $[25] !== t4) {
|
|
6838
7129
|
t6 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreviewContainer, { onClick: t32, hover: t4, size, children: t5 });
|
|
6839
|
-
$[
|
|
6840
|
-
$[
|
|
6841
|
-
$[
|
|
6842
|
-
$[
|
|
7130
|
+
$[23] = size;
|
|
7131
|
+
$[24] = t32;
|
|
7132
|
+
$[25] = t4;
|
|
7133
|
+
$[26] = t6;
|
|
6843
7134
|
} else {
|
|
6844
|
-
t6 = $[
|
|
7135
|
+
t6 = $[26];
|
|
6845
7136
|
}
|
|
6846
7137
|
return t6;
|
|
6847
7138
|
}
|
|
6848
7139
|
let t3;
|
|
6849
|
-
if ($[
|
|
7140
|
+
if ($[27] !== collection || $[28] !== disabled || $[29] !== hover || $[30] !== includeEntityLink || $[31] !== includeId || $[32] !== onClick || $[33] !== previewProperties || $[34] !== size || $[35] !== usedEntity) {
|
|
6850
7141
|
t3 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreview, { size, previewKeys: previewProperties, disabled, entity: usedEntity, collection, onClick, includeEntityLink, includeId, hover });
|
|
6851
|
-
$[
|
|
6852
|
-
$[
|
|
6853
|
-
$[
|
|
6854
|
-
$[
|
|
6855
|
-
$[
|
|
6856
|
-
$[
|
|
6857
|
-
$[
|
|
6858
|
-
$[
|
|
6859
|
-
$[
|
|
6860
|
-
$[
|
|
7142
|
+
$[27] = collection;
|
|
7143
|
+
$[28] = disabled;
|
|
7144
|
+
$[29] = hover;
|
|
7145
|
+
$[30] = includeEntityLink;
|
|
7146
|
+
$[31] = includeId;
|
|
7147
|
+
$[32] = onClick;
|
|
7148
|
+
$[33] = previewProperties;
|
|
7149
|
+
$[34] = size;
|
|
7150
|
+
$[35] = usedEntity;
|
|
7151
|
+
$[36] = t3;
|
|
6861
7152
|
} else {
|
|
6862
|
-
t3 = $[
|
|
7153
|
+
t3 = $[36];
|
|
6863
7154
|
}
|
|
6864
7155
|
return t3;
|
|
6865
7156
|
}
|
|
@@ -11156,126 +11447,6 @@
|
|
|
11156
11447
|
function areEqual(prevProps, nextProps) {
|
|
11157
11448
|
return prevProps.height === nextProps.height && prevProps.propertyKey === nextProps.propertyKey && prevProps.align === nextProps.align && prevProps.width === nextProps.width && equal(prevProps.property, nextProps.property) && equal(prevProps.value, nextProps.value) && equal(prevProps.entity.id, nextProps.entity.id) && equal(prevProps.entity.values, nextProps.entity.values) && prevProps.isDragging === nextProps.isDragging && prevProps.isDraggable === nextProps.isDraggable && prevProps.frozen === nextProps.frozen;
|
|
11158
11449
|
}
|
|
11159
|
-
const LOCAL_STORAGE_PREFIX = "entity_cache::";
|
|
11160
|
-
const entityCache = /* @__PURE__ */ new Map();
|
|
11161
|
-
const isLocalStorageAvailable = typeof localStorage !== "undefined";
|
|
11162
|
-
function customReplacer(key) {
|
|
11163
|
-
const value = this[key];
|
|
11164
|
-
if (value instanceof Date) {
|
|
11165
|
-
return {
|
|
11166
|
-
__type: "Date",
|
|
11167
|
-
value: value.toISOString()
|
|
11168
|
-
};
|
|
11169
|
-
}
|
|
11170
|
-
if (value instanceof EntityReference) {
|
|
11171
|
-
return {
|
|
11172
|
-
__type: "EntityReference",
|
|
11173
|
-
id: value.id,
|
|
11174
|
-
path: value.path,
|
|
11175
|
-
databaseId: value.databaseId
|
|
11176
|
-
};
|
|
11177
|
-
}
|
|
11178
|
-
if (value instanceof GeoPoint) {
|
|
11179
|
-
return {
|
|
11180
|
-
__type: "GeoPoint",
|
|
11181
|
-
latitude: value.latitude,
|
|
11182
|
-
longitude: value.longitude
|
|
11183
|
-
};
|
|
11184
|
-
}
|
|
11185
|
-
if (value instanceof Vector) {
|
|
11186
|
-
return {
|
|
11187
|
-
__type: "Vector",
|
|
11188
|
-
value: value.value
|
|
11189
|
-
};
|
|
11190
|
-
}
|
|
11191
|
-
return value;
|
|
11192
|
-
}
|
|
11193
|
-
function customReviver(key, value) {
|
|
11194
|
-
if (value && typeof value === "object" && "__type" in value) {
|
|
11195
|
-
switch (value.__type) {
|
|
11196
|
-
case "Date":
|
|
11197
|
-
return new Date(value.value);
|
|
11198
|
-
case "EntityReference":
|
|
11199
|
-
return new EntityReference(value.id, value.path, value.databaseId);
|
|
11200
|
-
case "GeoPoint":
|
|
11201
|
-
return new GeoPoint(value.latitude, value.longitude);
|
|
11202
|
-
case "Vector":
|
|
11203
|
-
return new Vector(value.value);
|
|
11204
|
-
default:
|
|
11205
|
-
return value;
|
|
11206
|
-
}
|
|
11207
|
-
}
|
|
11208
|
-
return value;
|
|
11209
|
-
}
|
|
11210
|
-
function saveEntityToCache(path, data) {
|
|
11211
|
-
if (isLocalStorageAvailable) {
|
|
11212
|
-
try {
|
|
11213
|
-
const key = LOCAL_STORAGE_PREFIX + path;
|
|
11214
|
-
const entityString = JSON.stringify(data, customReplacer);
|
|
11215
|
-
console.debug("Saving entity to localStorage:", {
|
|
11216
|
-
key,
|
|
11217
|
-
entityString
|
|
11218
|
-
});
|
|
11219
|
-
localStorage.setItem(key, entityString);
|
|
11220
|
-
} catch (error) {
|
|
11221
|
-
console.error(`Failed to save entity for path "${path}" to localStorage:`, error);
|
|
11222
|
-
}
|
|
11223
|
-
}
|
|
11224
|
-
}
|
|
11225
|
-
function removeEntityFromMemoryCache(path) {
|
|
11226
|
-
entityCache.delete(path);
|
|
11227
|
-
}
|
|
11228
|
-
function saveEntityToMemoryCache(path, data) {
|
|
11229
|
-
entityCache.set(path, data);
|
|
11230
|
-
}
|
|
11231
|
-
function getEntityFromMemoryCache(path) {
|
|
11232
|
-
return entityCache.get(path);
|
|
11233
|
-
}
|
|
11234
|
-
function getEntityFromCache(path) {
|
|
11235
|
-
if (isLocalStorageAvailable) {
|
|
11236
|
-
try {
|
|
11237
|
-
const key = LOCAL_STORAGE_PREFIX + path;
|
|
11238
|
-
const entityString = localStorage.getItem(key);
|
|
11239
|
-
if (entityString) {
|
|
11240
|
-
const entity = JSON.parse(entityString, customReviver);
|
|
11241
|
-
return entity;
|
|
11242
|
-
}
|
|
11243
|
-
} catch (error) {
|
|
11244
|
-
console.error(`Failed to load entity for path "${path}" from localStorage:`, error);
|
|
11245
|
-
}
|
|
11246
|
-
}
|
|
11247
|
-
return void 0;
|
|
11248
|
-
}
|
|
11249
|
-
function removeEntityFromCache(path) {
|
|
11250
|
-
if (isLocalStorageAvailable) {
|
|
11251
|
-
try {
|
|
11252
|
-
const key = LOCAL_STORAGE_PREFIX + path;
|
|
11253
|
-
localStorage.removeItem(key);
|
|
11254
|
-
} catch (error) {
|
|
11255
|
-
console.error(`Failed to remove entity for path "${path}" from localStorage:`, error);
|
|
11256
|
-
}
|
|
11257
|
-
}
|
|
11258
|
-
}
|
|
11259
|
-
function flattenKeys(obj, prefix = "", result = []) {
|
|
11260
|
-
if (isObject(obj) || Array.isArray(obj)) {
|
|
11261
|
-
const plainObject = isPlainObject(obj);
|
|
11262
|
-
if (!plainObject && prefix) {
|
|
11263
|
-
result.push(prefix);
|
|
11264
|
-
} else {
|
|
11265
|
-
for (const key in obj) {
|
|
11266
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
11267
|
-
const newKey = prefix ? Array.isArray(obj) ? `${prefix}[${key}]` : `${prefix}.${key}` : key;
|
|
11268
|
-
if (isObject(obj[key]) || Array.isArray(obj[key])) {
|
|
11269
|
-
flattenKeys(obj[key], newKey, result);
|
|
11270
|
-
} else {
|
|
11271
|
-
result.push(newKey);
|
|
11272
|
-
}
|
|
11273
|
-
}
|
|
11274
|
-
}
|
|
11275
|
-
}
|
|
11276
|
-
}
|
|
11277
|
-
return result;
|
|
11278
|
-
}
|
|
11279
11450
|
function FieldHelperText(t0) {
|
|
11280
11451
|
const $ = reactCompilerRuntime.c(10);
|
|
11281
11452
|
const {
|
|
@@ -16719,6 +16890,7 @@
|
|
|
16719
16890
|
}
|
|
16720
16891
|
function EntityForm({
|
|
16721
16892
|
path,
|
|
16893
|
+
pathSegments,
|
|
16722
16894
|
fullIdPath,
|
|
16723
16895
|
entityId: entityIdProp,
|
|
16724
16896
|
collection,
|
|
@@ -16769,6 +16941,7 @@
|
|
|
16769
16941
|
entityId: entityIdProp,
|
|
16770
16942
|
collection,
|
|
16771
16943
|
path,
|
|
16944
|
+
pathSegments,
|
|
16772
16945
|
values: valuesToBeSaved
|
|
16773
16946
|
});
|
|
16774
16947
|
}, false, 2e3);
|
|
@@ -16785,7 +16958,7 @@
|
|
|
16785
16958
|
if (mustSetCustomId) {
|
|
16786
16959
|
return void 0;
|
|
16787
16960
|
} else {
|
|
16788
|
-
return dataSource.generateEntityId(path, collection);
|
|
16961
|
+
return dataSource.generateEntityId(path, collection, pathSegments);
|
|
16789
16962
|
}
|
|
16790
16963
|
} else {
|
|
16791
16964
|
return entityIdProp;
|
|
@@ -16796,7 +16969,7 @@
|
|
|
16796
16969
|
const [savingError, setSavingError] = React.useState();
|
|
16797
16970
|
const autoSave = collection.formAutoSave && !collection.customId;
|
|
16798
16971
|
const baseInitialValues = React.useMemo(() => getInitialEntityValues(authController, collection, path, status, entity, customizationController.propertyConfigs), [authController, collection, path, status, entity, customizationController.propertyConfigs]);
|
|
16799
|
-
const localChangesDataRaw = React.useMemo(() => entityId ? getEntityFromCache(path
|
|
16972
|
+
const localChangesDataRaw = React.useMemo(() => entityId ? getEntityFromCache(entityCacheKey(path, entityId)) : getEntityFromCache(path + "#new"), [entityId, path]);
|
|
16800
16973
|
const [localChangesCleared, setLocalChangesCleared] = React.useState(false);
|
|
16801
16974
|
const localChangesBackup = getLocalChangesBackup(collection);
|
|
16802
16975
|
const autoApplyLocalChanges = localChangesBackup === "auto_apply";
|
|
@@ -16858,7 +17031,7 @@
|
|
|
16858
17031
|
onValuesModified?.(false, initialValues_0);
|
|
16859
17032
|
},
|
|
16860
17033
|
onValuesChangeDeferred: (values_0, controller) => {
|
|
16861
|
-
const key = status === "new" || status === "copy" ? path + "#new" : path
|
|
17034
|
+
const key = status === "new" || status === "copy" ? path + "#new" : entityCacheKey(path, entityId);
|
|
16862
17035
|
if (controller.dirty && localChangesBackup !== false) {
|
|
16863
17036
|
const touchedValues = removeEmptyContainers(extractTouchedValues(values_0, controller.touched));
|
|
16864
17037
|
if (touchedValues && Object.keys(touchedValues).length > 0) {
|
|
@@ -16923,8 +17096,8 @@
|
|
|
16923
17096
|
removeEntityFromMemoryCache(path + "#new");
|
|
16924
17097
|
removeEntityFromCache(path + "#new");
|
|
16925
17098
|
} else {
|
|
16926
|
-
removeEntityFromMemoryCache(path
|
|
16927
|
-
removeEntityFromCache(path
|
|
17099
|
+
removeEntityFromMemoryCache(entityCacheKey(path, entityId));
|
|
17100
|
+
removeEntityFromCache(entityCacheKey(path, entityId));
|
|
16928
17101
|
}
|
|
16929
17102
|
}
|
|
16930
17103
|
const onSaveSuccess = (updatedEntity) => {
|
|
@@ -16942,6 +17115,7 @@
|
|
|
16942
17115
|
entity: updatedEntity,
|
|
16943
17116
|
status,
|
|
16944
17117
|
path,
|
|
17118
|
+
pathSegments,
|
|
16945
17119
|
entityId: updatedEntity.id,
|
|
16946
17120
|
collection
|
|
16947
17121
|
});
|
|
@@ -16960,10 +17134,12 @@
|
|
|
16960
17134
|
previousValues,
|
|
16961
17135
|
entityId: entityId_0,
|
|
16962
17136
|
collection: collection_0,
|
|
16963
|
-
path: path_0
|
|
17137
|
+
path: path_0,
|
|
17138
|
+
pathSegments: pathSegments_0
|
|
16964
17139
|
}) => {
|
|
16965
17140
|
return saveEntityWithCallbacks({
|
|
16966
17141
|
path: path_0,
|
|
17142
|
+
pathSegments: pathSegments_0,
|
|
16967
17143
|
entityId: entityId_0,
|
|
16968
17144
|
values: values_2,
|
|
16969
17145
|
previousValues,
|
|
@@ -16980,6 +17156,7 @@
|
|
|
16980
17156
|
const onSaveEntityRequest = async ({
|
|
16981
17157
|
collection: collection_1,
|
|
16982
17158
|
path: path_1,
|
|
17159
|
+
pathSegments: pathSegments_1,
|
|
16983
17160
|
entityId: entityId_1,
|
|
16984
17161
|
values: values_3,
|
|
16985
17162
|
previousValues: previousValues_0,
|
|
@@ -16992,6 +17169,7 @@
|
|
|
16992
17169
|
return saveEntity({
|
|
16993
17170
|
collection: collection_1,
|
|
16994
17171
|
path: path_1,
|
|
17172
|
+
pathSegments: pathSegments_1,
|
|
16995
17173
|
entityId: entityId_1,
|
|
16996
17174
|
values: values_3,
|
|
16997
17175
|
previousValues: previousValues_0
|
|
@@ -17004,6 +17182,7 @@
|
|
|
17004
17182
|
return onSaveEntityRequest({
|
|
17005
17183
|
collection: resolvedCollection,
|
|
17006
17184
|
path,
|
|
17185
|
+
pathSegments,
|
|
17007
17186
|
entityId,
|
|
17008
17187
|
values: values_4,
|
|
17009
17188
|
previousValues: entity?.values,
|
|
@@ -17048,12 +17227,13 @@
|
|
|
17048
17227
|
const pluginBeforeTitle = [];
|
|
17049
17228
|
const plugins = customizationController.plugins;
|
|
17050
17229
|
const actionsDisabled = disabled || formex$1.isSubmitting || status === "existing" && !formex$1.dirty || Boolean(disabledProp);
|
|
17051
|
-
const parentCollectionIds = navigationController.getParentCollectionIds(path);
|
|
17230
|
+
const parentCollectionIds = navigationController.getParentCollectionIds(path, pathSegments);
|
|
17052
17231
|
if (plugins && collection) {
|
|
17053
17232
|
const actionProps = {
|
|
17054
17233
|
entityId,
|
|
17055
17234
|
parentCollectionIds,
|
|
17056
17235
|
path,
|
|
17236
|
+
pathSegments,
|
|
17057
17237
|
status,
|
|
17058
17238
|
collection,
|
|
17059
17239
|
context,
|
|
@@ -17098,7 +17278,7 @@
|
|
|
17098
17278
|
const uniqueFieldValidator = React.useCallback(({
|
|
17099
17279
|
name,
|
|
17100
17280
|
value
|
|
17101
|
-
}) => dataSource.checkUniqueField(path, name, value, entityId, collection), [dataSource, path, entityId]);
|
|
17281
|
+
}) => dataSource.checkUniqueField(path, name, value, entityId, collection, pathSegments), [dataSource, path, entityId]);
|
|
17102
17282
|
const validationSchema = React.useMemo(() => entityId ? getYupEntitySchema(entityId, resolvedCollection.properties, uniqueFieldValidator) : void 0, [entityId, resolvedCollection.properties, uniqueFieldValidator]);
|
|
17103
17283
|
useOnAutoSave(autoSave, formex$1, lastSavedValues, save);
|
|
17104
17284
|
const prevEntityValuesRef = React.useRef(entity?.values);
|
|
@@ -17202,13 +17382,13 @@
|
|
|
17202
17382
|
if (!resolvedCollection || !path) {
|
|
17203
17383
|
throw Error("INTERNAL: Collection and path must be defined in form context");
|
|
17204
17384
|
}
|
|
17205
|
-
const dialogActions = /* @__PURE__ */ jsxRuntime.jsx(EntityFormActionsComponent, { collection: resolvedCollection, path, fullPath: path, fullIdPath, entity, layout: forceActionsAtTheBottom ? "bottom" : "side", savingError, formex: formex$1, disabled: actionsDisabled, status, pluginActions: pluginActions ?? [], openEntityMode, showDefaultActions, navigateBack, formContext });
|
|
17385
|
+
const dialogActions = /* @__PURE__ */ jsxRuntime.jsx(EntityFormActionsComponent, { collection: resolvedCollection, path, pathSegments, fullPath: path, fullIdPath, entity, layout: forceActionsAtTheBottom ? "bottom" : "side", savingError, formex: formex$1, disabled: actionsDisabled, status, pluginActions: pluginActions ?? [], openEntityMode, showDefaultActions, navigateBack, formContext });
|
|
17206
17386
|
return /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: formex$1.handleSubmit, onReset: () => formex$1.resetForm({
|
|
17207
17387
|
values: baseInitialValues
|
|
17208
17388
|
}), noValidate: true, className: ui.cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", className), children: [
|
|
17209
17389
|
/* @__PURE__ */ jsxRuntime.jsx("div", { id: `form_${path}`, className: ui.cls("relative flex flex-row max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("flex flex-col w-full pt-12 pb-16 px-4 sm:px-8 md:px-10"), children: [
|
|
17210
17390
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row gap-4 self-end sticky top-4 z-10", children: [
|
|
17211
|
-
manualApplyLocalChanges && hasLocalChanges && /* @__PURE__ */ jsxRuntime.jsx(LocalChangesMenu, { cacheKey: status === "new" || status === "copy" ? path + "#new" : path
|
|
17391
|
+
manualApplyLocalChanges && hasLocalChanges && /* @__PURE__ */ jsxRuntime.jsx(LocalChangesMenu, { cacheKey: status === "new" || status === "copy" ? path + "#new" : entityCacheKey(path, entityId), properties: resolvedCollection.properties, cachedData: localChangesDataRaw, formex: formex$1, onClearLocalChanges: () => setLocalChangesCleared(true) }),
|
|
17212
17392
|
formex$1.dirty ? /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "This form has been modified", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Chip, { size: "small", className: "py-1", colorScheme: "orangeDarker", children: /* @__PURE__ */ jsxRuntime.jsx(ui.EditIcon, { size: "smallest" }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: "The current form is in sync with the database", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Chip, { size: "small", className: "py-1", children: /* @__PURE__ */ jsxRuntime.jsx(ui.CheckIcon, { size: "smallest" }) }) })
|
|
17213
17393
|
] }),
|
|
17214
17394
|
formView
|
|
@@ -17299,7 +17479,7 @@
|
|
|
17299
17479
|
const collapsedActions = actions.filter((a_0) => a_0.collapsed || a_0.collapsed === void 0);
|
|
17300
17480
|
const uncollapsedActions = actions.filter((a_1) => a_1.collapsed === false);
|
|
17301
17481
|
const enableLocalChangesBackup = collection ? getLocalChangesBackup(collection) : false;
|
|
17302
|
-
const cachedData = enableLocalChangesBackup ? getEntityFromCache(fullPath
|
|
17482
|
+
const cachedData = enableLocalChangesBackup ? getEntityFromCache(entityCacheKey(fullPath, entity.id)) : void 0;
|
|
17303
17483
|
const hasDraft = (() => {
|
|
17304
17484
|
if (!cachedData || typeof cachedData !== "object" || Object.keys(cachedData).length === 0) return false;
|
|
17305
17485
|
const realChanges = getChanges(cachedData, entity?.values ?? {});
|
|
@@ -20065,8 +20245,8 @@
|
|
|
20065
20245
|
const [popupCell, setPopupCell] = React.useState(void 0);
|
|
20066
20246
|
const navigation = useNavigationController();
|
|
20067
20247
|
const dataSource = useDataSource();
|
|
20068
|
-
const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
|
|
20069
|
-
const resolvedPathSegments = React.useMemo(() => pathSegments
|
|
20248
|
+
const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath, pathSegments), [fullPath, pathSegments, navigation.resolveIdsFrom]);
|
|
20249
|
+
const resolvedPathSegments = React.useMemo(() => pathSegments ? navigation.resolveSegmentsFrom?.(pathSegments) ?? pathSegments : void 0, [pathSegments, navigation.resolveSegmentsFrom]);
|
|
20070
20250
|
const forceFilter = forceFilterFromProps ?? forceFilterFromCollection;
|
|
20071
20251
|
const paginationEnabled = collection.pagination === void 0 || Boolean(collection.pagination);
|
|
20072
20252
|
const pageSize = typeof collection.pagination === "number" ? collection.pagination : DEFAULT_PAGE_SIZE$1;
|
|
@@ -20074,6 +20254,7 @@
|
|
|
20074
20254
|
if (!dataSource.isFilterCombinationValid) return true;
|
|
20075
20255
|
return dataSource.isFilterCombinationValid({
|
|
20076
20256
|
path: resolvedPath,
|
|
20257
|
+
pathSegments: resolvedPathSegments,
|
|
20077
20258
|
collection,
|
|
20078
20259
|
filterValues,
|
|
20079
20260
|
sortBy
|
|
@@ -20162,22 +20343,29 @@
|
|
|
20162
20343
|
React.useEffect(() => {
|
|
20163
20344
|
setDataLoading(true);
|
|
20164
20345
|
const onEntitiesUpdate = async (entities) => {
|
|
20346
|
+
if (resolvedPathSegments) {
|
|
20347
|
+
entities = entities.map((e) => e.pathSegments ? e : {
|
|
20348
|
+
...e,
|
|
20349
|
+
pathSegments: resolvedPathSegments
|
|
20350
|
+
});
|
|
20351
|
+
}
|
|
20165
20352
|
if (collection.callbacks?.onFetch) {
|
|
20166
20353
|
try {
|
|
20167
20354
|
entities = await Promise.all(entities.map((entity) => collection.callbacks.onFetch({
|
|
20168
20355
|
collection,
|
|
20169
20356
|
path: resolvedPath,
|
|
20357
|
+
pathSegments: resolvedPathSegments,
|
|
20170
20358
|
entity,
|
|
20171
20359
|
context
|
|
20172
20360
|
})));
|
|
20173
|
-
} catch (
|
|
20174
|
-
console.error(
|
|
20361
|
+
} catch (e_0) {
|
|
20362
|
+
console.error(e_0);
|
|
20175
20363
|
}
|
|
20176
20364
|
}
|
|
20177
20365
|
setDataLoading(false);
|
|
20178
20366
|
setDataLoadingError(void 0);
|
|
20179
|
-
setRawData(entities.map((
|
|
20180
|
-
...
|
|
20367
|
+
setRawData(entities.map((e_1) => ({
|
|
20368
|
+
...e_1
|
|
20181
20369
|
// values: sanitizeData(e.values, resolvedCollection.properties)
|
|
20182
20370
|
})));
|
|
20183
20371
|
setNoMoreToLoad(!itemCount || entities.length < itemCount);
|
|
@@ -20218,8 +20406,8 @@
|
|
|
20218
20406
|
return () => {
|
|
20219
20407
|
};
|
|
20220
20408
|
}
|
|
20221
|
-
} catch (
|
|
20222
|
-
onError(
|
|
20409
|
+
} catch (e_2) {
|
|
20410
|
+
onError(e_2 instanceof Error ? e_2 : new Error(String(e_2)));
|
|
20223
20411
|
return () => {
|
|
20224
20412
|
};
|
|
20225
20413
|
}
|
|
@@ -20323,10 +20511,11 @@
|
|
|
20323
20511
|
};
|
|
20324
20512
|
}
|
|
20325
20513
|
function useTableSearchHelper(t0) {
|
|
20326
|
-
const $ = reactCompilerRuntime.c(
|
|
20514
|
+
const $ = reactCompilerRuntime.c(19);
|
|
20327
20515
|
const {
|
|
20328
20516
|
collection,
|
|
20329
20517
|
fullPath,
|
|
20518
|
+
pathSegments,
|
|
20330
20519
|
parentCollectionIds,
|
|
20331
20520
|
initialSearchString
|
|
20332
20521
|
} = t0;
|
|
@@ -20338,11 +20527,12 @@
|
|
|
20338
20527
|
const autoInitialisedRef = React.useRef(false);
|
|
20339
20528
|
let onTextSearchClick;
|
|
20340
20529
|
let textSearchEnabled;
|
|
20341
|
-
if ($[0] !== collection || $[1] !== context || $[2] !== customizationController.plugins || $[3] !== dataSource || $[4] !== fullPath || $[5] !== parentCollectionIds) {
|
|
20530
|
+
if ($[0] !== collection || $[1] !== context || $[2] !== customizationController.plugins || $[3] !== dataSource || $[4] !== fullPath || $[5] !== parentCollectionIds || $[6] !== pathSegments) {
|
|
20342
20531
|
textSearchEnabled = Boolean(collection.textSearchEnabled);
|
|
20343
20532
|
const props = {
|
|
20344
20533
|
context,
|
|
20345
20534
|
path: fullPath,
|
|
20535
|
+
pathSegments,
|
|
20346
20536
|
databaseId: collection.databaseId,
|
|
20347
20537
|
collection,
|
|
20348
20538
|
parentCollectionIds
|
|
@@ -20362,6 +20552,7 @@
|
|
|
20362
20552
|
promises.push(p_1.collectionView.onTextSearchClick({
|
|
20363
20553
|
context,
|
|
20364
20554
|
path: fullPath,
|
|
20555
|
+
pathSegments,
|
|
20365
20556
|
collection,
|
|
20366
20557
|
parentCollectionIds
|
|
20367
20558
|
}));
|
|
@@ -20393,15 +20584,16 @@
|
|
|
20393
20584
|
$[3] = dataSource;
|
|
20394
20585
|
$[4] = fullPath;
|
|
20395
20586
|
$[5] = parentCollectionIds;
|
|
20396
|
-
$[6] =
|
|
20397
|
-
$[7] =
|
|
20587
|
+
$[6] = pathSegments;
|
|
20588
|
+
$[7] = onTextSearchClick;
|
|
20589
|
+
$[8] = textSearchEnabled;
|
|
20398
20590
|
} else {
|
|
20399
|
-
onTextSearchClick = $[
|
|
20400
|
-
textSearchEnabled = $[
|
|
20591
|
+
onTextSearchClick = $[7];
|
|
20592
|
+
textSearchEnabled = $[8];
|
|
20401
20593
|
}
|
|
20402
20594
|
const shouldAutoInitialise = Boolean(initialSearchString) && textSearchEnabled && !textSearchInitialised && Boolean(onTextSearchClick);
|
|
20403
20595
|
let t1;
|
|
20404
|
-
if ($[
|
|
20596
|
+
if ($[9] !== onTextSearchClick || $[10] !== shouldAutoInitialise) {
|
|
20405
20597
|
t1 = () => {
|
|
20406
20598
|
if (autoInitialisedRef.current || !shouldAutoInitialise) {
|
|
20407
20599
|
return;
|
|
@@ -20409,36 +20601,36 @@
|
|
|
20409
20601
|
autoInitialisedRef.current = true;
|
|
20410
20602
|
onTextSearchClick?.();
|
|
20411
20603
|
};
|
|
20412
|
-
$[
|
|
20413
|
-
$[
|
|
20414
|
-
$[
|
|
20604
|
+
$[9] = onTextSearchClick;
|
|
20605
|
+
$[10] = shouldAutoInitialise;
|
|
20606
|
+
$[11] = t1;
|
|
20415
20607
|
} else {
|
|
20416
|
-
t1 = $[
|
|
20608
|
+
t1 = $[11];
|
|
20417
20609
|
}
|
|
20418
20610
|
let t2;
|
|
20419
|
-
if ($[
|
|
20611
|
+
if ($[12] !== shouldAutoInitialise) {
|
|
20420
20612
|
t2 = [shouldAutoInitialise];
|
|
20421
|
-
$[
|
|
20422
|
-
$[
|
|
20613
|
+
$[12] = shouldAutoInitialise;
|
|
20614
|
+
$[13] = t2;
|
|
20423
20615
|
} else {
|
|
20424
|
-
t2 = $[
|
|
20616
|
+
t2 = $[13];
|
|
20425
20617
|
}
|
|
20426
20618
|
React.useEffect(t1, t2);
|
|
20427
20619
|
let t3;
|
|
20428
|
-
if ($[
|
|
20620
|
+
if ($[14] !== onTextSearchClick || $[15] !== textSearchEnabled || $[16] !== textSearchInitialised || $[17] !== textSearchLoading) {
|
|
20429
20621
|
t3 = {
|
|
20430
20622
|
textSearchLoading,
|
|
20431
20623
|
textSearchInitialised,
|
|
20432
20624
|
onTextSearchClick,
|
|
20433
20625
|
textSearchEnabled
|
|
20434
20626
|
};
|
|
20435
|
-
$[
|
|
20436
|
-
$[
|
|
20437
|
-
$[
|
|
20438
|
-
$[
|
|
20439
|
-
$[
|
|
20627
|
+
$[14] = onTextSearchClick;
|
|
20628
|
+
$[15] = textSearchEnabled;
|
|
20629
|
+
$[16] = textSearchInitialised;
|
|
20630
|
+
$[17] = textSearchLoading;
|
|
20631
|
+
$[18] = t3;
|
|
20440
20632
|
} else {
|
|
20441
|
-
t3 = $[
|
|
20633
|
+
t3 = $[18];
|
|
20442
20634
|
}
|
|
20443
20635
|
return t3;
|
|
20444
20636
|
}
|
|
@@ -20507,6 +20699,8 @@
|
|
|
20507
20699
|
const performDelete = React.useCallback((entity_3) => deleteEntityWithCallbacks({
|
|
20508
20700
|
dataSource,
|
|
20509
20701
|
entity: entity_3,
|
|
20702
|
+
// The entity is the authority on where it lives; stated rather than left implicit.
|
|
20703
|
+
pathSegments: entity_3.pathSegments,
|
|
20510
20704
|
collection: resolvedCollection,
|
|
20511
20705
|
callbacks,
|
|
20512
20706
|
onDeleteSuccess,
|
|
@@ -20608,6 +20802,7 @@
|
|
|
20608
20802
|
entity,
|
|
20609
20803
|
collection,
|
|
20610
20804
|
fullPath,
|
|
20805
|
+
pathSegments,
|
|
20611
20806
|
fullIdPath,
|
|
20612
20807
|
context,
|
|
20613
20808
|
highlightEntity,
|
|
@@ -20626,6 +20821,7 @@
|
|
|
20626
20821
|
addRecentId(collection.id, entity.id);
|
|
20627
20822
|
}
|
|
20628
20823
|
const path = collection?.collectionGroup ? entity.path : fullPath ?? collection?.path ?? entity.path;
|
|
20824
|
+
const resolvedPathSegments = collection?.collectionGroup ? entity.pathSegments : pathSegments ?? entity.pathSegments;
|
|
20629
20825
|
const newFullIdPath = collection?.collectionGroup ? collection.id : fullIdPath ?? collection?.id ?? entity.path;
|
|
20630
20826
|
const defaultSelectedView = resolveDefaultSelectedView(collection ? collection.defaultSelectedView : void 0, {
|
|
20631
20827
|
status: "existing",
|
|
@@ -20636,6 +20832,7 @@
|
|
|
20636
20832
|
collection,
|
|
20637
20833
|
entityId: entity.id,
|
|
20638
20834
|
path,
|
|
20835
|
+
pathSegments: resolvedPathSegments,
|
|
20639
20836
|
fullIdPath: newFullIdPath,
|
|
20640
20837
|
sideEntityController: context.sideEntityController,
|
|
20641
20838
|
onClose: () => unhighlightEntity?.(entity),
|
|
@@ -20657,6 +20854,8 @@
|
|
|
20657
20854
|
collection,
|
|
20658
20855
|
context,
|
|
20659
20856
|
fullPath,
|
|
20857
|
+
pathSegments,
|
|
20858
|
+
fullIdPath,
|
|
20660
20859
|
highlightEntity,
|
|
20661
20860
|
unhighlightEntity,
|
|
20662
20861
|
openEntityMode
|
|
@@ -20670,13 +20869,15 @@
|
|
|
20670
20869
|
entityId: entity.id
|
|
20671
20870
|
});
|
|
20672
20871
|
const path = collection?.collectionGroup ? collection.path : fullPath ?? collection?.path ?? entity.path;
|
|
20673
|
-
const
|
|
20872
|
+
const resolvedPathSegments = collection?.collectionGroup ? void 0 : pathSegments ?? entity.pathSegments;
|
|
20873
|
+
const newFullIdPath = collection?.collectionGroup ? collection.id : fullIdPath ?? collection?.id;
|
|
20674
20874
|
navigateToEntity({
|
|
20675
20875
|
openEntityMode,
|
|
20676
20876
|
collection,
|
|
20677
20877
|
entityId: entity.id,
|
|
20678
20878
|
path,
|
|
20679
|
-
|
|
20879
|
+
pathSegments: resolvedPathSegments,
|
|
20880
|
+
fullIdPath: newFullIdPath,
|
|
20680
20881
|
copy: true,
|
|
20681
20882
|
sideEntityController: context.sideEntityController,
|
|
20682
20883
|
onClose: () => unhighlightEntity?.(entity),
|
|
@@ -20731,6 +20932,7 @@
|
|
|
20731
20932
|
multiselect,
|
|
20732
20933
|
collection,
|
|
20733
20934
|
path: pathInput,
|
|
20935
|
+
pathSegments,
|
|
20734
20936
|
selectedEntityIds: selectedEntityIdsProp,
|
|
20735
20937
|
description,
|
|
20736
20938
|
forceFilter,
|
|
@@ -20745,7 +20947,7 @@
|
|
|
20745
20947
|
const navigation = useNavigationController();
|
|
20746
20948
|
const analyticsController = useAnalyticsController();
|
|
20747
20949
|
const customizationController = useCustomizationController();
|
|
20748
|
-
const fullPath = navigation.resolveIdsFrom(pathInput);
|
|
20950
|
+
const fullPath = navigation.resolveIdsFrom(pathInput, pathSegments);
|
|
20749
20951
|
const dataSource = useDataSource();
|
|
20750
20952
|
const [entitiesDisplayedFirst, setEntitiesDisplayedFirst] = React.useState([]);
|
|
20751
20953
|
const toggleEntitySelection = (entity) => {
|
|
@@ -20773,6 +20975,7 @@
|
|
|
20773
20975
|
if (selectedEntityIds && collection) {
|
|
20774
20976
|
Promise.all(selectedEntityIds.map((entityId) => dataSource.fetchEntity({
|
|
20775
20977
|
path: fullPath,
|
|
20978
|
+
pathSegments,
|
|
20776
20979
|
entityId,
|
|
20777
20980
|
collection
|
|
20778
20981
|
}))).then((entities) => {
|
|
@@ -20819,6 +21022,7 @@
|
|
|
20819
21022
|
});
|
|
20820
21023
|
sideEntityController.open({
|
|
20821
21024
|
path: fullPath,
|
|
21025
|
+
pathSegments,
|
|
20822
21026
|
collection,
|
|
20823
21027
|
updateUrl: true,
|
|
20824
21028
|
onUpdate: ({
|
|
@@ -20868,6 +21072,7 @@
|
|
|
20868
21072
|
onTextSearchClick,
|
|
20869
21073
|
textSearchEnabled
|
|
20870
21074
|
} = useTableSearchHelper({
|
|
21075
|
+
pathSegments,
|
|
20871
21076
|
collection,
|
|
20872
21077
|
fullPath
|
|
20873
21078
|
});
|
|
@@ -20879,7 +21084,7 @@
|
|
|
20879
21084
|
}) : t("select_from", {
|
|
20880
21085
|
name: collection.name
|
|
20881
21086
|
})
|
|
20882
|
-
] }), defaultSize: collection.defaultSize, properties: resolvedCollection.properties, forceFilter, inlineEditing: false, selectionController, actions: /* @__PURE__ */ jsxRuntime.jsx(ReferenceDialogActions, { collection, path: fullPath, onNewClick, onClear }) }) }),
|
|
21087
|
+
] }), defaultSize: collection.defaultSize, properties: resolvedCollection.properties, forceFilter, inlineEditing: false, selectionController, actions: /* @__PURE__ */ jsxRuntime.jsx(ReferenceDialogActions, { collection, path: fullPath, pathSegments, onNewClick, onClear }) }) }),
|
|
20883
21088
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { translucent: false, children: [
|
|
20884
21089
|
description && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "body2", className: "flex-grow text-left", children: description }),
|
|
20885
21090
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: onDone, variant: "filled", children: t("done") })
|
|
@@ -20887,10 +21092,11 @@
|
|
|
20887
21092
|
] });
|
|
20888
21093
|
}
|
|
20889
21094
|
function ReferenceDialogActions(t0) {
|
|
20890
|
-
const $ = reactCompilerRuntime.c(
|
|
21095
|
+
const $ = reactCompilerRuntime.c(18);
|
|
20891
21096
|
const {
|
|
20892
21097
|
collection,
|
|
20893
21098
|
path,
|
|
21099
|
+
pathSegments,
|
|
20894
21100
|
onClear,
|
|
20895
21101
|
onNewClick
|
|
20896
21102
|
} = t0;
|
|
@@ -20912,8 +21118,8 @@
|
|
|
20912
21118
|
}
|
|
20913
21119
|
const onClick = t1;
|
|
20914
21120
|
let t2;
|
|
20915
|
-
if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onClick || $[6] !== path || $[7] !== t) {
|
|
20916
|
-
t2 = canCreateEntity(collection, authController, path, null) && onClick && (largeLayout ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), children: t("add_specific", {
|
|
21121
|
+
if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onClick || $[6] !== path || $[7] !== pathSegments || $[8] !== t) {
|
|
21122
|
+
t2 = canCreateEntity(collection, authController, path, null, pathSegments) && onClick && (largeLayout ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), children: t("add_specific", {
|
|
20917
21123
|
name: collection.singularName ?? collection.name
|
|
20918
21124
|
}) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick, children: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}) }));
|
|
20919
21125
|
$[2] = authController;
|
|
@@ -20921,40 +21127,41 @@
|
|
|
20921
21127
|
$[4] = largeLayout;
|
|
20922
21128
|
$[5] = onClick;
|
|
20923
21129
|
$[6] = path;
|
|
20924
|
-
$[7] =
|
|
20925
|
-
$[8] =
|
|
21130
|
+
$[7] = pathSegments;
|
|
21131
|
+
$[8] = t;
|
|
21132
|
+
$[9] = t2;
|
|
20926
21133
|
} else {
|
|
20927
|
-
t2 = $[
|
|
21134
|
+
t2 = $[9];
|
|
20928
21135
|
}
|
|
20929
21136
|
const addButton = t2;
|
|
20930
21137
|
let t3;
|
|
20931
|
-
if ($[
|
|
21138
|
+
if ($[10] !== t) {
|
|
20932
21139
|
t3 = t("clear");
|
|
20933
|
-
$[
|
|
20934
|
-
$[
|
|
21140
|
+
$[10] = t;
|
|
21141
|
+
$[11] = t3;
|
|
20935
21142
|
} else {
|
|
20936
|
-
t3 = $[
|
|
21143
|
+
t3 = $[11];
|
|
20937
21144
|
}
|
|
20938
21145
|
let t4;
|
|
20939
|
-
if ($[
|
|
21146
|
+
if ($[12] !== onClear || $[13] !== t3) {
|
|
20940
21147
|
t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: onClear, variant: "text", children: t3 });
|
|
20941
|
-
$[
|
|
20942
|
-
$[
|
|
20943
|
-
$[
|
|
21148
|
+
$[12] = onClear;
|
|
21149
|
+
$[13] = t3;
|
|
21150
|
+
$[14] = t4;
|
|
20944
21151
|
} else {
|
|
20945
|
-
t4 = $[
|
|
21152
|
+
t4 = $[14];
|
|
20946
21153
|
}
|
|
20947
21154
|
let t5;
|
|
20948
|
-
if ($[
|
|
21155
|
+
if ($[15] !== addButton || $[16] !== t4) {
|
|
20949
21156
|
t5 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
20950
21157
|
t4,
|
|
20951
21158
|
addButton
|
|
20952
21159
|
] });
|
|
20953
|
-
$[
|
|
20954
|
-
$[
|
|
20955
|
-
$[
|
|
21160
|
+
$[15] = addButton;
|
|
21161
|
+
$[16] = t4;
|
|
21162
|
+
$[17] = t5;
|
|
20956
21163
|
} else {
|
|
20957
|
-
t5 = $[
|
|
21164
|
+
t5 = $[17];
|
|
20958
21165
|
}
|
|
20959
21166
|
return t5;
|
|
20960
21167
|
}
|
|
@@ -22870,7 +23077,7 @@
|
|
|
22870
23077
|
return React.useContext(BreadcrumbContext);
|
|
22871
23078
|
};
|
|
22872
23079
|
function EntityCollectionViewActions(t0) {
|
|
22873
|
-
const $ = reactCompilerRuntime.c(
|
|
23080
|
+
const $ = reactCompilerRuntime.c(48);
|
|
22874
23081
|
const {
|
|
22875
23082
|
collection,
|
|
22876
23083
|
relativePath,
|
|
@@ -22879,6 +23086,7 @@
|
|
|
22879
23086
|
onMultipleDeleteClick,
|
|
22880
23087
|
selectionEnabled,
|
|
22881
23088
|
path,
|
|
23089
|
+
pathSegments,
|
|
22882
23090
|
selectionController,
|
|
22883
23091
|
tableController,
|
|
22884
23092
|
collectionEntitiesCount
|
|
@@ -22901,8 +23109,8 @@
|
|
|
22901
23109
|
const largeLayout = useLargeLayout();
|
|
22902
23110
|
const selectedEntities = selectionController.selectedEntities;
|
|
22903
23111
|
let t2;
|
|
22904
|
-
if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onNewClick || $[6] !== path || $[7] !== t) {
|
|
22905
|
-
t2 = canCreateEntity(collection, authController, path, null) && onNewClick && (largeLayout ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { id: `add_entity_${path}`, onClick: onNewClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, { size: "small" }), variant: "filled", color: "primary", children: [
|
|
23112
|
+
if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onNewClick || $[6] !== path || $[7] !== pathSegments || $[8] !== t) {
|
|
23113
|
+
t2 = canCreateEntity(collection, authController, path, null, pathSegments) && onNewClick && (largeLayout ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { id: `add_entity_${path}`, onClick: onNewClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, { size: "small" }), variant: "filled", color: "primary", children: [
|
|
22906
23114
|
t("add"),
|
|
22907
23115
|
" ",
|
|
22908
23116
|
collection.singularName ?? collection.name
|
|
@@ -22912,65 +23120,68 @@
|
|
|
22912
23120
|
$[4] = largeLayout;
|
|
22913
23121
|
$[5] = onNewClick;
|
|
22914
23122
|
$[6] = path;
|
|
22915
|
-
$[7] =
|
|
22916
|
-
$[8] =
|
|
23123
|
+
$[7] = pathSegments;
|
|
23124
|
+
$[8] = t;
|
|
23125
|
+
$[9] = t2;
|
|
22917
23126
|
} else {
|
|
22918
|
-
t2 = $[
|
|
23127
|
+
t2 = $[9];
|
|
22919
23128
|
}
|
|
22920
23129
|
const addButton = t2;
|
|
22921
23130
|
let t3;
|
|
22922
|
-
if ($[
|
|
22923
|
-
t3 = canDeleteEntity(collection, authController, path, null);
|
|
22924
|
-
$[
|
|
22925
|
-
$[
|
|
22926
|
-
$[
|
|
22927
|
-
$[
|
|
23131
|
+
if ($[10] !== authController || $[11] !== collection || $[12] !== path || $[13] !== pathSegments) {
|
|
23132
|
+
t3 = canDeleteEntity(collection, authController, path, null, pathSegments);
|
|
23133
|
+
$[10] = authController;
|
|
23134
|
+
$[11] = collection;
|
|
23135
|
+
$[12] = path;
|
|
23136
|
+
$[13] = pathSegments;
|
|
23137
|
+
$[14] = t3;
|
|
22928
23138
|
} else {
|
|
22929
|
-
t3 = $[
|
|
23139
|
+
t3 = $[14];
|
|
22930
23140
|
}
|
|
22931
23141
|
const multipleDeleteEnabled = t3;
|
|
22932
23142
|
let multipleDeleteButton;
|
|
22933
23143
|
if (selectionEnabled) {
|
|
22934
23144
|
let t42;
|
|
22935
|
-
if ($[
|
|
23145
|
+
if ($[15] !== largeLayout || $[16] !== multipleDeleteEnabled || $[17] !== onMultipleDeleteClick || $[18] !== selectedEntities?.length) {
|
|
22936
23146
|
t42 = largeLayout ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { variant: "text", disabled: !selectedEntities?.length || !multipleDeleteEnabled, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, { size: "small" }), onClick: onMultipleDeleteClick, color: "primary", className: "lg:w-20", children: [
|
|
22937
23147
|
"(",
|
|
22938
23148
|
selectedEntities?.length,
|
|
22939
23149
|
")"
|
|
22940
23150
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", color: "primary", disabled: !selectedEntities?.length || !multipleDeleteEnabled, onClick: onMultipleDeleteClick, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, { size: "small" }) });
|
|
22941
|
-
$[
|
|
22942
|
-
$[
|
|
22943
|
-
$[
|
|
22944
|
-
$[
|
|
22945
|
-
$[
|
|
23151
|
+
$[15] = largeLayout;
|
|
23152
|
+
$[16] = multipleDeleteEnabled;
|
|
23153
|
+
$[17] = onMultipleDeleteClick;
|
|
23154
|
+
$[18] = selectedEntities?.length;
|
|
23155
|
+
$[19] = t42;
|
|
22946
23156
|
} else {
|
|
22947
|
-
t42 = $[
|
|
23157
|
+
t42 = $[19];
|
|
22948
23158
|
}
|
|
22949
23159
|
const button = t42;
|
|
22950
23160
|
let t52;
|
|
22951
|
-
if ($[
|
|
23161
|
+
if ($[20] !== multipleDeleteEnabled || $[21] !== t) {
|
|
22952
23162
|
t52 = multipleDeleteEnabled ? t("delete_selected") : t("cannot_delete_selected");
|
|
22953
|
-
$[
|
|
22954
|
-
$[
|
|
22955
|
-
$[
|
|
23163
|
+
$[20] = multipleDeleteEnabled;
|
|
23164
|
+
$[21] = t;
|
|
23165
|
+
$[22] = t52;
|
|
22956
23166
|
} else {
|
|
22957
|
-
t52 = $[
|
|
23167
|
+
t52 = $[22];
|
|
22958
23168
|
}
|
|
22959
23169
|
let t62;
|
|
22960
|
-
if ($[
|
|
23170
|
+
if ($[23] !== button || $[24] !== t52) {
|
|
22961
23171
|
t62 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t52, children: button });
|
|
22962
|
-
$[
|
|
22963
|
-
$[
|
|
22964
|
-
$[
|
|
23172
|
+
$[23] = button;
|
|
23173
|
+
$[24] = t52;
|
|
23174
|
+
$[25] = t62;
|
|
22965
23175
|
} else {
|
|
22966
|
-
t62 = $[
|
|
23176
|
+
t62 = $[25];
|
|
22967
23177
|
}
|
|
22968
23178
|
multipleDeleteButton = t62;
|
|
22969
23179
|
}
|
|
22970
23180
|
let t4;
|
|
22971
|
-
if ($[
|
|
23181
|
+
if ($[26] !== collection || $[27] !== collectionEntitiesCount || $[28] !== context || $[29] !== parentCollectionIds || $[30] !== path || $[31] !== pathSegments || $[32] !== relativePath || $[33] !== selectionController || $[34] !== tableController) {
|
|
22972
23182
|
t4 = {
|
|
22973
23183
|
path,
|
|
23184
|
+
pathSegments,
|
|
22974
23185
|
relativePath,
|
|
22975
23186
|
parentCollectionIds,
|
|
22976
23187
|
collection,
|
|
@@ -22979,28 +23190,29 @@
|
|
|
22979
23190
|
tableController,
|
|
22980
23191
|
collectionEntitiesCount
|
|
22981
23192
|
};
|
|
22982
|
-
$[
|
|
22983
|
-
$[
|
|
22984
|
-
$[
|
|
22985
|
-
$[
|
|
22986
|
-
$[
|
|
22987
|
-
$[
|
|
22988
|
-
$[
|
|
22989
|
-
$[
|
|
22990
|
-
$[
|
|
23193
|
+
$[26] = collection;
|
|
23194
|
+
$[27] = collectionEntitiesCount;
|
|
23195
|
+
$[28] = context;
|
|
23196
|
+
$[29] = parentCollectionIds;
|
|
23197
|
+
$[30] = path;
|
|
23198
|
+
$[31] = pathSegments;
|
|
23199
|
+
$[32] = relativePath;
|
|
23200
|
+
$[33] = selectionController;
|
|
23201
|
+
$[34] = tableController;
|
|
23202
|
+
$[35] = t4;
|
|
22991
23203
|
} else {
|
|
22992
|
-
t4 = $[
|
|
23204
|
+
t4 = $[35];
|
|
22993
23205
|
}
|
|
22994
23206
|
const actionProps = t4;
|
|
22995
23207
|
let actions;
|
|
22996
|
-
if ($[
|
|
23208
|
+
if ($[36] !== actionProps || $[37] !== collection.Actions || $[38] !== plugins) {
|
|
22997
23209
|
let t52;
|
|
22998
|
-
if ($[
|
|
23210
|
+
if ($[40] !== actionProps) {
|
|
22999
23211
|
t52 = (Action, i) => /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(Action, { ...actionProps }) }, `actions_${i}`);
|
|
23000
|
-
$[
|
|
23001
|
-
$[
|
|
23212
|
+
$[40] = actionProps;
|
|
23213
|
+
$[41] = t52;
|
|
23002
23214
|
} else {
|
|
23003
|
-
t52 = $[
|
|
23215
|
+
t52 = $[41];
|
|
23004
23216
|
}
|
|
23005
23217
|
actions = toArray(collection.Actions).map(t52);
|
|
23006
23218
|
if (plugins) {
|
|
@@ -23010,34 +23222,34 @@
|
|
|
23010
23222
|
}
|
|
23011
23223
|
});
|
|
23012
23224
|
}
|
|
23013
|
-
$[
|
|
23014
|
-
$[
|
|
23015
|
-
$[
|
|
23016
|
-
$[
|
|
23225
|
+
$[36] = actionProps;
|
|
23226
|
+
$[37] = collection.Actions;
|
|
23227
|
+
$[38] = plugins;
|
|
23228
|
+
$[39] = actions;
|
|
23017
23229
|
} else {
|
|
23018
|
-
actions = $[
|
|
23230
|
+
actions = $[39];
|
|
23019
23231
|
}
|
|
23020
23232
|
let t5;
|
|
23021
|
-
if ($[
|
|
23233
|
+
if ($[42] !== actions) {
|
|
23022
23234
|
t5 = /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: actions });
|
|
23023
|
-
$[
|
|
23024
|
-
$[
|
|
23235
|
+
$[42] = actions;
|
|
23236
|
+
$[43] = t5;
|
|
23025
23237
|
} else {
|
|
23026
|
-
t5 = $[
|
|
23238
|
+
t5 = $[43];
|
|
23027
23239
|
}
|
|
23028
23240
|
let t6;
|
|
23029
|
-
if ($[
|
|
23241
|
+
if ($[44] !== addButton || $[45] !== multipleDeleteButton || $[46] !== t5) {
|
|
23030
23242
|
t6 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
23031
23243
|
t5,
|
|
23032
23244
|
multipleDeleteButton,
|
|
23033
23245
|
addButton
|
|
23034
23246
|
] });
|
|
23035
|
-
$[
|
|
23036
|
-
$[
|
|
23037
|
-
$[
|
|
23038
|
-
$[
|
|
23247
|
+
$[44] = addButton;
|
|
23248
|
+
$[45] = multipleDeleteButton;
|
|
23249
|
+
$[46] = t5;
|
|
23250
|
+
$[47] = t6;
|
|
23039
23251
|
} else {
|
|
23040
|
-
t6 = $[
|
|
23252
|
+
t6 = $[47];
|
|
23041
23253
|
}
|
|
23042
23254
|
return t6;
|
|
23043
23255
|
}
|
|
@@ -24371,6 +24583,7 @@
|
|
|
24371
24583
|
const DEFAULT_PAGE_SIZE = 20;
|
|
24372
24584
|
function useBoardDataController({
|
|
24373
24585
|
fullPath,
|
|
24586
|
+
pathSegments,
|
|
24374
24587
|
collection,
|
|
24375
24588
|
columnProperty,
|
|
24376
24589
|
columns,
|
|
@@ -24382,7 +24595,8 @@
|
|
|
24382
24595
|
const context = useFireCMSContext();
|
|
24383
24596
|
const dataSource = useDataSource();
|
|
24384
24597
|
const navigation = useNavigationController();
|
|
24385
|
-
const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
|
|
24598
|
+
const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath, pathSegments), [fullPath, pathSegments, navigation.resolveIdsFrom]);
|
|
24599
|
+
const resolvedPathSegments = React.useMemo(() => pathSegments ? navigation.resolveSegmentsFrom?.(pathSegments) ?? pathSegments : void 0, [pathSegments, navigation.resolveSegmentsFrom]);
|
|
24386
24600
|
const dataSourceRef = React.useRef(dataSource);
|
|
24387
24601
|
const collectionRef = React.useRef(collection);
|
|
24388
24602
|
const contextRef = React.useRef(context);
|
|
@@ -24394,11 +24608,13 @@
|
|
|
24394
24608
|
const orderPropertyRef = React.useRef(orderProperty);
|
|
24395
24609
|
const searchStringRef = React.useRef(searchString);
|
|
24396
24610
|
const resolvedPathRef = React.useRef(resolvedPath);
|
|
24611
|
+
const resolvedPathSegmentsRef = React.useRef(resolvedPathSegments);
|
|
24397
24612
|
filterValuesRef.current = filterValues;
|
|
24398
24613
|
columnPropertyRef.current = columnProperty;
|
|
24399
24614
|
orderPropertyRef.current = orderProperty;
|
|
24400
24615
|
searchStringRef.current = searchString;
|
|
24401
24616
|
resolvedPathRef.current = resolvedPath;
|
|
24617
|
+
resolvedPathSegmentsRef.current = resolvedPathSegments;
|
|
24402
24618
|
const [columnItemCounts, setColumnItemCounts] = React.useState(() => {
|
|
24403
24619
|
const initial = {};
|
|
24404
24620
|
columns.forEach((col) => {
|
|
@@ -24445,6 +24661,7 @@
|
|
|
24445
24661
|
const currentOrderProperty = orderPropertyRef.current;
|
|
24446
24662
|
const currentSearchString = searchStringRef.current;
|
|
24447
24663
|
const currentResolvedPath = resolvedPathRef.current;
|
|
24664
|
+
const currentPathSegments = resolvedPathSegmentsRef.current;
|
|
24448
24665
|
const columnFilter = {
|
|
24449
24666
|
...currentFilterValues,
|
|
24450
24667
|
[currentColumnProperty]: ["==", column]
|
|
@@ -24465,6 +24682,7 @@
|
|
|
24465
24682
|
processed = await Promise.all(processed.map((entity) => currentCollection.callbacks.onFetch({
|
|
24466
24683
|
collection: currentCollection,
|
|
24467
24684
|
path: currentResolvedPath,
|
|
24685
|
+
pathSegments: currentPathSegments,
|
|
24468
24686
|
entity,
|
|
24469
24687
|
context: currentContext
|
|
24470
24688
|
})));
|
|
@@ -24501,6 +24719,7 @@
|
|
|
24501
24719
|
if (currentDataSource.listenCollection) {
|
|
24502
24720
|
const unsubscribe = currentDataSource.listenCollection({
|
|
24503
24721
|
path: currentResolvedPath,
|
|
24722
|
+
pathSegments: currentPathSegments,
|
|
24504
24723
|
collection: currentCollection,
|
|
24505
24724
|
onUpdate,
|
|
24506
24725
|
onError,
|
|
@@ -24515,6 +24734,7 @@
|
|
|
24515
24734
|
} else {
|
|
24516
24735
|
currentDataSource.fetchCollection({
|
|
24517
24736
|
path: currentResolvedPath,
|
|
24737
|
+
pathSegments: currentPathSegments,
|
|
24518
24738
|
collection: currentCollection,
|
|
24519
24739
|
searchString: currentSearchString,
|
|
24520
24740
|
filter: columnFilter,
|
|
@@ -24543,6 +24763,7 @@
|
|
|
24543
24763
|
const currentColumnProperty = columnPropertyRef.current;
|
|
24544
24764
|
const currentSearchString = searchStringRef.current;
|
|
24545
24765
|
const currentResolvedPath = resolvedPathRef.current;
|
|
24766
|
+
const currentPathSegments = resolvedPathSegmentsRef.current;
|
|
24546
24767
|
const currentColumns = columns;
|
|
24547
24768
|
const currentColumnItemCounts = columnItemCounts;
|
|
24548
24769
|
const timeoutId = setTimeout(() => {
|
|
@@ -24557,6 +24778,7 @@
|
|
|
24557
24778
|
};
|
|
24558
24779
|
currentDataSource.countEntities({
|
|
24559
24780
|
path: currentResolvedPath,
|
|
24781
|
+
pathSegments: currentPathSegments,
|
|
24560
24782
|
collection: currentCollection,
|
|
24561
24783
|
filter: columnFilter,
|
|
24562
24784
|
searchString: currentSearchString
|
|
@@ -24801,6 +25023,7 @@
|
|
|
24801
25023
|
collection,
|
|
24802
25024
|
tableController,
|
|
24803
25025
|
fullPath,
|
|
25026
|
+
pathSegments,
|
|
24804
25027
|
parentCollectionIds = [],
|
|
24805
25028
|
columnProperty,
|
|
24806
25029
|
onEntityClick,
|
|
@@ -24894,6 +25117,7 @@
|
|
|
24894
25117
|
const columns = localColumnsOrder;
|
|
24895
25118
|
const boardDataController = useBoardDataController({
|
|
24896
25119
|
fullPath,
|
|
25120
|
+
pathSegments,
|
|
24897
25121
|
collection,
|
|
24898
25122
|
columnProperty,
|
|
24899
25123
|
columns,
|
|
@@ -24967,6 +25191,7 @@
|
|
|
24967
25191
|
let completed = 0;
|
|
24968
25192
|
currentDataSource.countEntities({
|
|
24969
25193
|
path: fullPath,
|
|
25194
|
+
pathSegments,
|
|
24970
25195
|
collection: currentCollection
|
|
24971
25196
|
}).then((count) => {
|
|
24972
25197
|
totalCount = count;
|
|
@@ -24977,6 +25202,7 @@
|
|
|
24977
25202
|
}).catch((e) => console.warn("Failed to get total count:", e));
|
|
24978
25203
|
currentDataSource.countEntities({
|
|
24979
25204
|
path: fullPath,
|
|
25205
|
+
pathSegments,
|
|
24980
25206
|
collection: currentCollection,
|
|
24981
25207
|
filter: {
|
|
24982
25208
|
[orderProperty]: ["!=", null]
|
|
@@ -25084,6 +25310,8 @@
|
|
|
25084
25310
|
}
|
|
25085
25311
|
const saveProps = {
|
|
25086
25312
|
path: entity_2.path,
|
|
25313
|
+
// Paired with `entity.path`: the segments the entity was loaded with.
|
|
25314
|
+
pathSegments: entity_2.pathSegments,
|
|
25087
25315
|
entityId: entity_2.id,
|
|
25088
25316
|
values: updatedValues,
|
|
25089
25317
|
previousValues: entity_2.values,
|
|
@@ -25121,6 +25349,7 @@
|
|
|
25121
25349
|
console.log("Fetching all documents from collection...");
|
|
25122
25350
|
const allDocs = await dataSource.fetchCollection({
|
|
25123
25351
|
path: fullPath,
|
|
25352
|
+
pathSegments,
|
|
25124
25353
|
collection,
|
|
25125
25354
|
limit: 1e4
|
|
25126
25355
|
// Fetch all
|
|
@@ -25139,6 +25368,8 @@
|
|
|
25139
25368
|
}, orderProperty, index);
|
|
25140
25369
|
const saveProps_0 = {
|
|
25141
25370
|
path: entity_4.path,
|
|
25371
|
+
// Paired with `entity.path`: the segments the entity was loaded with.
|
|
25372
|
+
pathSegments: entity_4.pathSegments,
|
|
25142
25373
|
entityId: entity_4.id,
|
|
25143
25374
|
values: updatedValues_0,
|
|
25144
25375
|
previousValues: entity_4.values,
|
|
@@ -25224,6 +25455,7 @@
|
|
|
25224
25455
|
});
|
|
25225
25456
|
sideEntityController.open({
|
|
25226
25457
|
path: fullPath,
|
|
25458
|
+
pathSegments,
|
|
25227
25459
|
collection,
|
|
25228
25460
|
entityId: void 0,
|
|
25229
25461
|
updateUrl: true,
|
|
@@ -25439,7 +25671,7 @@
|
|
|
25439
25671
|
return t0;
|
|
25440
25672
|
}
|
|
25441
25673
|
function PopupFormFieldLoading(t0) {
|
|
25442
|
-
const $ = reactCompilerRuntime.c(
|
|
25674
|
+
const $ = reactCompilerRuntime.c(22);
|
|
25443
25675
|
const {
|
|
25444
25676
|
tableKey,
|
|
25445
25677
|
entityId,
|
|
@@ -25447,6 +25679,7 @@
|
|
|
25447
25679
|
propertyKey,
|
|
25448
25680
|
collection: inputCollection,
|
|
25449
25681
|
path,
|
|
25682
|
+
pathSegments,
|
|
25450
25683
|
cellRect,
|
|
25451
25684
|
open,
|
|
25452
25685
|
onClose,
|
|
@@ -25457,33 +25690,35 @@
|
|
|
25457
25690
|
const [entity, setEntity] = React.useState(void 0);
|
|
25458
25691
|
let t1;
|
|
25459
25692
|
let t2;
|
|
25460
|
-
if ($[0] !== dataSource || $[1] !== entityId || $[2] !== inputCollection || $[3] !== path) {
|
|
25693
|
+
if ($[0] !== dataSource || $[1] !== entityId || $[2] !== inputCollection || $[3] !== path || $[4] !== pathSegments) {
|
|
25461
25694
|
t1 = () => {
|
|
25462
25695
|
if (entityId && inputCollection) {
|
|
25463
25696
|
dataSource.fetchEntity({
|
|
25464
25697
|
path,
|
|
25698
|
+
pathSegments,
|
|
25465
25699
|
entityId,
|
|
25466
25700
|
collection: inputCollection
|
|
25467
25701
|
}).then(setEntity);
|
|
25468
25702
|
}
|
|
25469
25703
|
};
|
|
25470
|
-
t2 = [entityId, inputCollection, dataSource, path];
|
|
25704
|
+
t2 = [entityId, inputCollection, dataSource, path, pathSegments];
|
|
25471
25705
|
$[0] = dataSource;
|
|
25472
25706
|
$[1] = entityId;
|
|
25473
25707
|
$[2] = inputCollection;
|
|
25474
25708
|
$[3] = path;
|
|
25475
|
-
$[4] =
|
|
25476
|
-
$[5] =
|
|
25709
|
+
$[4] = pathSegments;
|
|
25710
|
+
$[5] = t1;
|
|
25711
|
+
$[6] = t2;
|
|
25477
25712
|
} else {
|
|
25478
|
-
t1 = $[
|
|
25479
|
-
t2 = $[
|
|
25713
|
+
t1 = $[5];
|
|
25714
|
+
t2 = $[6];
|
|
25480
25715
|
}
|
|
25481
25716
|
React.useEffect(t1, t2);
|
|
25482
25717
|
if (!entity) {
|
|
25483
25718
|
return null;
|
|
25484
25719
|
}
|
|
25485
25720
|
let t3;
|
|
25486
|
-
if ($[
|
|
25721
|
+
if ($[7] !== cellRect || $[8] !== container || $[9] !== customFieldValidator || $[10] !== entityId || $[11] !== inputCollection || $[12] !== onCellValueChange || $[13] !== onClose || $[14] !== open || $[15] !== path || $[16] !== propertyKey || $[17] !== tableKey) {
|
|
25487
25722
|
t3 = {
|
|
25488
25723
|
tableKey,
|
|
25489
25724
|
entityId,
|
|
@@ -25497,29 +25732,29 @@
|
|
|
25497
25732
|
onCellValueChange,
|
|
25498
25733
|
container
|
|
25499
25734
|
};
|
|
25500
|
-
$[
|
|
25501
|
-
$[
|
|
25502
|
-
$[
|
|
25503
|
-
$[
|
|
25504
|
-
$[
|
|
25505
|
-
$[
|
|
25506
|
-
$[
|
|
25507
|
-
$[
|
|
25508
|
-
$[
|
|
25509
|
-
$[
|
|
25510
|
-
$[
|
|
25511
|
-
$[
|
|
25735
|
+
$[7] = cellRect;
|
|
25736
|
+
$[8] = container;
|
|
25737
|
+
$[9] = customFieldValidator;
|
|
25738
|
+
$[10] = entityId;
|
|
25739
|
+
$[11] = inputCollection;
|
|
25740
|
+
$[12] = onCellValueChange;
|
|
25741
|
+
$[13] = onClose;
|
|
25742
|
+
$[14] = open;
|
|
25743
|
+
$[15] = path;
|
|
25744
|
+
$[16] = propertyKey;
|
|
25745
|
+
$[17] = tableKey;
|
|
25746
|
+
$[18] = t3;
|
|
25512
25747
|
} else {
|
|
25513
|
-
t3 = $[
|
|
25748
|
+
t3 = $[18];
|
|
25514
25749
|
}
|
|
25515
25750
|
let t4;
|
|
25516
|
-
if ($[
|
|
25751
|
+
if ($[19] !== entity || $[20] !== t3) {
|
|
25517
25752
|
t4 = /* @__PURE__ */ jsxRuntime.jsx(PopupFormFieldInternal, { ...t3, entity });
|
|
25518
|
-
$[
|
|
25519
|
-
$[
|
|
25520
|
-
$[
|
|
25753
|
+
$[19] = entity;
|
|
25754
|
+
$[20] = t3;
|
|
25755
|
+
$[21] = t4;
|
|
25521
25756
|
} else {
|
|
25522
|
-
t4 = $[
|
|
25757
|
+
t4 = $[21];
|
|
25523
25758
|
}
|
|
25524
25759
|
return t4;
|
|
25525
25760
|
}
|
|
@@ -25918,12 +26153,13 @@
|
|
|
25918
26153
|
] });
|
|
25919
26154
|
}
|
|
25920
26155
|
function EntityCollectionViewStartActions(t0) {
|
|
25921
|
-
const $ = reactCompilerRuntime.c(
|
|
26156
|
+
const $ = reactCompilerRuntime.c(38);
|
|
25922
26157
|
const {
|
|
25923
26158
|
collection,
|
|
25924
26159
|
relativePath,
|
|
25925
26160
|
parentCollectionIds,
|
|
25926
26161
|
path,
|
|
26162
|
+
pathSegments,
|
|
25927
26163
|
selectionController,
|
|
25928
26164
|
tableController,
|
|
25929
26165
|
collectionEntitiesCount,
|
|
@@ -25958,9 +26194,10 @@
|
|
|
25958
26194
|
}
|
|
25959
26195
|
const activeFilterCount = t2;
|
|
25960
26196
|
let t3;
|
|
25961
|
-
if ($[5] !== collection || $[6] !== collectionEntitiesCount || $[7] !== context || $[8] !== parentCollectionIds || $[9] !== path || $[10] !==
|
|
26197
|
+
if ($[5] !== collection || $[6] !== collectionEntitiesCount || $[7] !== context || $[8] !== parentCollectionIds || $[9] !== path || $[10] !== pathSegments || $[11] !== relativePath || $[12] !== selectionController || $[13] !== tableController) {
|
|
25962
26198
|
t3 = {
|
|
25963
26199
|
path,
|
|
26200
|
+
pathSegments,
|
|
25964
26201
|
relativePath,
|
|
25965
26202
|
parentCollectionIds,
|
|
25966
26203
|
collection,
|
|
@@ -25974,44 +26211,45 @@
|
|
|
25974
26211
|
$[7] = context;
|
|
25975
26212
|
$[8] = parentCollectionIds;
|
|
25976
26213
|
$[9] = path;
|
|
25977
|
-
$[10] =
|
|
25978
|
-
$[11] =
|
|
25979
|
-
$[12] =
|
|
25980
|
-
$[13] =
|
|
26214
|
+
$[10] = pathSegments;
|
|
26215
|
+
$[11] = relativePath;
|
|
26216
|
+
$[12] = selectionController;
|
|
26217
|
+
$[13] = tableController;
|
|
26218
|
+
$[14] = t3;
|
|
25981
26219
|
} else {
|
|
25982
|
-
t3 = $[
|
|
26220
|
+
t3 = $[14];
|
|
25983
26221
|
}
|
|
25984
26222
|
const actionProps = t3;
|
|
25985
26223
|
const hasAnyAllowedFilters = !tableController.allowedFilters || tableController.allowedFilters.length > 0;
|
|
25986
26224
|
let t4;
|
|
25987
|
-
if ($[
|
|
26225
|
+
if ($[15] !== activeFilterCount || $[16] !== hasAnyAllowedFilters || $[17] !== largeLayout || $[18] !== resolvedProperties || $[19] !== t || $[20] !== tableController.setFilterValues) {
|
|
25988
26226
|
t4 = resolvedProperties && tableController.setFilterValues && hasAnyAllowedFilters && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t("filters"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "primary", invisible: activeFilterCount === 0, children: largeLayout ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { variant: "text", size: "small", onClick: () => setFiltersDialogOpen(true), startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.FilterListIcon, { size: "small" }), className: ui.cls(activeFilterCount > 0 && "text-primary"), children: [
|
|
25989
26227
|
t("filters"),
|
|
25990
26228
|
activeFilterCount > 0 ? ` (${activeFilterCount})` : ""
|
|
25991
26229
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: () => setFiltersDialogOpen(true), className: ui.cls(activeFilterCount > 0 && "text-primary"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.FilterListIcon, { size: "small" }) }) }) }, "filters_tooltip");
|
|
25992
|
-
$[
|
|
25993
|
-
$[
|
|
25994
|
-
$[
|
|
25995
|
-
$[
|
|
25996
|
-
$[
|
|
25997
|
-
$[
|
|
25998
|
-
$[
|
|
26230
|
+
$[15] = activeFilterCount;
|
|
26231
|
+
$[16] = hasAnyAllowedFilters;
|
|
26232
|
+
$[17] = largeLayout;
|
|
26233
|
+
$[18] = resolvedProperties;
|
|
26234
|
+
$[19] = t;
|
|
26235
|
+
$[20] = tableController.setFilterValues;
|
|
26236
|
+
$[21] = t4;
|
|
25999
26237
|
} else {
|
|
26000
|
-
t4 = $[
|
|
26238
|
+
t4 = $[21];
|
|
26001
26239
|
}
|
|
26002
26240
|
const filtersButton = t4;
|
|
26003
26241
|
const t5 = !collection.forceFilter;
|
|
26004
26242
|
let t6;
|
|
26005
|
-
if ($[
|
|
26243
|
+
if ($[22] !== t5 || $[23] !== tableController) {
|
|
26006
26244
|
t6 = /* @__PURE__ */ jsxRuntime.jsx(ClearFilterSortButton, { tableController, enabled: t5 }, "clear_filter");
|
|
26007
|
-
$[
|
|
26008
|
-
$[
|
|
26009
|
-
$[
|
|
26245
|
+
$[22] = t5;
|
|
26246
|
+
$[23] = tableController;
|
|
26247
|
+
$[24] = t6;
|
|
26010
26248
|
} else {
|
|
26011
|
-
t6 = $[
|
|
26249
|
+
t6 = $[24];
|
|
26012
26250
|
}
|
|
26013
26251
|
let actions;
|
|
26014
|
-
if ($[
|
|
26252
|
+
if ($[25] !== actionProps || $[26] !== filtersButton || $[27] !== plugins || $[28] !== t6) {
|
|
26015
26253
|
actions = [filtersButton, t6];
|
|
26016
26254
|
if (plugins) {
|
|
26017
26255
|
plugins.forEach((plugin, i) => {
|
|
@@ -26020,36 +26258,36 @@
|
|
|
26020
26258
|
}
|
|
26021
26259
|
});
|
|
26022
26260
|
}
|
|
26023
|
-
$[
|
|
26024
|
-
$[
|
|
26025
|
-
$[
|
|
26026
|
-
$[
|
|
26027
|
-
$[
|
|
26261
|
+
$[25] = actionProps;
|
|
26262
|
+
$[26] = filtersButton;
|
|
26263
|
+
$[27] = plugins;
|
|
26264
|
+
$[28] = t6;
|
|
26265
|
+
$[29] = actions;
|
|
26028
26266
|
} else {
|
|
26029
|
-
actions = $[
|
|
26267
|
+
actions = $[29];
|
|
26030
26268
|
}
|
|
26031
26269
|
let t7;
|
|
26032
|
-
if ($[
|
|
26270
|
+
if ($[30] !== collection.forceFilter || $[31] !== filtersDialogOpen || $[32] !== resolvedProperties || $[33] !== tableController) {
|
|
26033
26271
|
t7 = resolvedProperties && tableController.setFilterValues && /* @__PURE__ */ jsxRuntime.jsx(FiltersDialog, { open: filtersDialogOpen, onOpenChange: setFiltersDialogOpen, properties: resolvedProperties, filterValues: tableController.filterValues, setFilterValues: (filterValues_0) => tableController.setFilterValues?.(filterValues_0 ?? {}), forceFilter: collection.forceFilter, allowedFilters: tableController.allowedFilters?.map(_temp$g) });
|
|
26034
|
-
$[
|
|
26035
|
-
$[
|
|
26036
|
-
$[
|
|
26037
|
-
$[
|
|
26038
|
-
$[
|
|
26272
|
+
$[30] = collection.forceFilter;
|
|
26273
|
+
$[31] = filtersDialogOpen;
|
|
26274
|
+
$[32] = resolvedProperties;
|
|
26275
|
+
$[33] = tableController;
|
|
26276
|
+
$[34] = t7;
|
|
26039
26277
|
} else {
|
|
26040
|
-
t7 = $[
|
|
26278
|
+
t7 = $[34];
|
|
26041
26279
|
}
|
|
26042
26280
|
let t8;
|
|
26043
|
-
if ($[
|
|
26281
|
+
if ($[35] !== actions || $[36] !== t7) {
|
|
26044
26282
|
t8 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
26045
26283
|
actions,
|
|
26046
26284
|
t7
|
|
26047
26285
|
] });
|
|
26048
|
-
$[
|
|
26049
|
-
$[
|
|
26050
|
-
$[
|
|
26286
|
+
$[35] = actions;
|
|
26287
|
+
$[36] = t7;
|
|
26288
|
+
$[37] = t8;
|
|
26051
26289
|
} else {
|
|
26052
|
-
t8 = $[
|
|
26290
|
+
t8 = $[37];
|
|
26053
26291
|
}
|
|
26054
26292
|
return t8;
|
|
26055
26293
|
}
|
|
@@ -26127,7 +26365,7 @@
|
|
|
26127
26365
|
React.useEffect(() => {
|
|
26128
26366
|
collectionRef.current = collection;
|
|
26129
26367
|
}, [collection]);
|
|
26130
|
-
const canCreateEntities = canCreateEntity(collection, authController, fullPath, null);
|
|
26368
|
+
const canCreateEntities = canCreateEntity(collection, authController, fullPath, null, pathSegments);
|
|
26131
26369
|
const [highlightedEntity, setHighlightedEntity] = React.useState(void 0);
|
|
26132
26370
|
const [deleteEntityClicked, setDeleteEntityClicked] = React.useState(void 0);
|
|
26133
26371
|
const [lastDeleteTimestamp, setLastDeleteTimestamp] = React.useState(0);
|
|
@@ -26145,7 +26383,7 @@
|
|
|
26145
26383
|
}, [highlightedEntity]);
|
|
26146
26384
|
const checkInlineEditing = React.useCallback((entity) => {
|
|
26147
26385
|
const collection_0 = collectionRef.current;
|
|
26148
|
-
if (!canEditEntity(collection_0, authController, fullPath, entity ?? null)) {
|
|
26386
|
+
if (!canEditEntity(collection_0, authController, fullPath, entity ?? null, pathSegments)) {
|
|
26149
26387
|
return false;
|
|
26150
26388
|
}
|
|
26151
26389
|
return collection_0.inlineEditing === void 0 || collection_0.inlineEditing;
|
|
@@ -26235,10 +26473,12 @@
|
|
|
26235
26473
|
if (collection_1) {
|
|
26236
26474
|
addRecentId(collection_1.id, clickedEntity.id);
|
|
26237
26475
|
}
|
|
26238
|
-
const
|
|
26476
|
+
const isCollectionGroup = Boolean(collection_1?.collectionGroup);
|
|
26477
|
+
const path = isCollectionGroup ? clickedEntity.path : fullPath ?? clickedEntity.path;
|
|
26239
26478
|
navigateToEntity({
|
|
26240
26479
|
navigation,
|
|
26241
26480
|
path,
|
|
26481
|
+
pathSegments: isCollectionGroup ? clickedEntity.pathSegments : pathSegments ?? clickedEntity.pathSegments,
|
|
26242
26482
|
fullIdPath,
|
|
26243
26483
|
sideEntityController,
|
|
26244
26484
|
openEntityMode,
|
|
@@ -26326,13 +26566,13 @@
|
|
|
26326
26566
|
});
|
|
26327
26567
|
}
|
|
26328
26568
|
}, [setViewMode, userConfigPersistence, onCollectionModifiedForUser, fullPath, analyticsController, viewMode]);
|
|
26329
|
-
const createEnabled = canCreateEntity(collection, authController, fullPath, null);
|
|
26569
|
+
const createEnabled = canCreateEntity(collection, authController, fullPath, null, pathSegments);
|
|
26330
26570
|
const uniqueFieldValidator = React.useCallback(({
|
|
26331
26571
|
name,
|
|
26332
26572
|
value,
|
|
26333
26573
|
property,
|
|
26334
26574
|
entityId
|
|
26335
|
-
}) => dataSource.checkUniqueField(fullPath, name, value, entityId, collection), [fullPath]);
|
|
26575
|
+
}) => dataSource.checkUniqueField(fullPath, name, value, entityId, collection, pathSegments), [fullPath, pathSegments]);
|
|
26336
26576
|
const onValueChange = ({
|
|
26337
26577
|
value: value_0,
|
|
26338
26578
|
propertyKey,
|
|
@@ -26345,6 +26585,8 @@
|
|
|
26345
26585
|
}, propertyKey, value_0);
|
|
26346
26586
|
const saveProps = {
|
|
26347
26587
|
path: entity_1.path ?? fullPath,
|
|
26588
|
+
// Paired with the `path` above: the row's segments describe the row's path.
|
|
26589
|
+
pathSegments: entity_1.path ? entity_1.pathSegments : pathSegments,
|
|
26348
26590
|
entityId: entity_1.id,
|
|
26349
26591
|
values: updatedValues,
|
|
26350
26592
|
previousValues: entity_1.values,
|
|
@@ -26372,7 +26614,7 @@
|
|
|
26372
26614
|
}
|
|
26373
26615
|
});
|
|
26374
26616
|
};
|
|
26375
|
-
const resolvedFullPath = navigation.resolveIdsFrom(fullPath);
|
|
26617
|
+
const resolvedFullPath = navigation.resolveIdsFrom(fullPath, pathSegments);
|
|
26376
26618
|
const resolvedCollection = React.useMemo(() => resolveCollection({
|
|
26377
26619
|
collection,
|
|
26378
26620
|
path: fullPath,
|
|
@@ -26501,9 +26743,9 @@
|
|
|
26501
26743
|
Builder: ({
|
|
26502
26744
|
entity: entity_4
|
|
26503
26745
|
}) => {
|
|
26504
|
-
const collectionsWithPath = navigation.getParentReferencesFromPath(entity_4.path);
|
|
26746
|
+
const collectionsWithPath = navigation.getParentReferencesFromPath(entity_4.path, entity_4.pathSegments);
|
|
26505
26747
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 w-full", children: collectionsWithPath.map((reference) => {
|
|
26506
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ReferencePreview, { reference, size: "small" }, reference.path
|
|
26748
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ReferencePreview, { reference, size: "small" }, entityCacheKey(reference.path, reference.id));
|
|
26507
26749
|
}) });
|
|
26508
26750
|
}
|
|
26509
26751
|
}] : [];
|
|
@@ -26517,7 +26759,7 @@
|
|
|
26517
26759
|
entity: entity_5,
|
|
26518
26760
|
customEntityActions
|
|
26519
26761
|
}) => {
|
|
26520
|
-
const deleteEnabled = entity_5 ? canDeleteEntity(collection, authController, fullPath, entity_5) : true;
|
|
26762
|
+
const deleteEnabled = entity_5 ? canDeleteEntity(collection, authController, fullPath, entity_5, entity_5.pathSegments ?? pathSegments) : true;
|
|
26521
26763
|
const actions = [{
|
|
26522
26764
|
...editEntityAction,
|
|
26523
26765
|
name: t("edit")
|
|
@@ -26559,7 +26801,7 @@
|
|
|
26559
26801
|
breadcrumbs.updateCount(fullPath, docsCount);
|
|
26560
26802
|
}
|
|
26561
26803
|
}, [docsCount, fullPath, breadcrumbs.updateCount]);
|
|
26562
|
-
const countFetcher = /* @__PURE__ */ jsxRuntime.jsx(EntitiesCount, { fullPath, collection, filter: tableController.filterValues, sortBy: tableController.sortBy, onCountChange: setDocsCount });
|
|
26804
|
+
const countFetcher = /* @__PURE__ */ jsxRuntime.jsx(EntitiesCount, { fullPath, pathSegments, collection, filter: tableController.filterValues, sortBy: tableController.sortBy, onCountChange: setDocsCount });
|
|
26563
26805
|
const buildAdditionalHeaderWidget = React.useCallback(({
|
|
26564
26806
|
property: property_2,
|
|
26565
26807
|
propertyKey: propertyKey_1,
|
|
@@ -26582,6 +26824,7 @@
|
|
|
26582
26824
|
onTextSearchClick,
|
|
26583
26825
|
textSearchEnabled
|
|
26584
26826
|
} = useTableSearchHelper({
|
|
26827
|
+
pathSegments,
|
|
26585
26828
|
collection,
|
|
26586
26829
|
fullPath: resolvedFullPath,
|
|
26587
26830
|
parentCollectionIds,
|
|
@@ -26605,8 +26848,8 @@
|
|
|
26605
26848
|
}, [tableController.dataLoadingError, customizationController.plugins, fullPath, collection, parentCollectionIds]);
|
|
26606
26849
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("overflow-hidden h-full w-full rounded-md flex flex-col", className), ref: containerRef, children: [
|
|
26607
26850
|
countFetcher,
|
|
26608
|
-
/* @__PURE__ */ jsxRuntime.jsx(CollectionTableToolbar, { loading: tableController.dataLoading, onTextSearch: textSearchEnabled && textSearchInitialised ? tableController.setSearchString : void 0, onTextSearchClick: textSearchEnabled && !textSearchInitialised ? onTextSearchClick : void 0, initialSearchString: tableController.searchString, textSearchLoading, viewModeToggle: viewModeToggleElement, actionsStart: /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionViewStartActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, collectionEntitiesCount: docsCount, resolvedProperties: resolvedCollection.properties }), actions: /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionViewActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, onMultipleDeleteClick, onNewClick, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, selectionEnabled, collectionEntitiesCount: docsCount }) }),
|
|
26609
|
-
tableController.dataLoadingError ? pluginErrorView ?? /* @__PURE__ */ jsxRuntime.jsx(CollectionDataErrorBanner, { error: tableController.dataLoadingError }) : viewMode === "kanban" && enabledViews.includes("kanban") ? /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionBoardView, { collection, tableController, fullPath, parentCollectionIds, columnProperty: selectedKanbanProperty, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], deletedEntities, emptyComponent: canCreateEntities && tableController.filterValues === void 0 && tableController.sortBy === void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
26851
|
+
/* @__PURE__ */ jsxRuntime.jsx(CollectionTableToolbar, { loading: tableController.dataLoading, onTextSearch: textSearchEnabled && textSearchInitialised ? tableController.setSearchString : void 0, onTextSearchClick: textSearchEnabled && !textSearchInitialised ? onTextSearchClick : void 0, initialSearchString: tableController.searchString, textSearchLoading, viewModeToggle: viewModeToggleElement, actionsStart: /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionViewStartActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, path: fullPath, pathSegments, relativePath: collection.path, selectionController: usedSelectionController, collectionEntitiesCount: docsCount, resolvedProperties: resolvedCollection.properties }), actions: /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionViewActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, onMultipleDeleteClick, onNewClick, path: fullPath, pathSegments, relativePath: collection.path, selectionController: usedSelectionController, selectionEnabled, collectionEntitiesCount: docsCount }) }),
|
|
26852
|
+
tableController.dataLoadingError ? pluginErrorView ?? /* @__PURE__ */ jsxRuntime.jsx(CollectionDataErrorBanner, { error: tableController.dataLoadingError }) : viewMode === "kanban" && enabledViews.includes("kanban") ? /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionBoardView, { collection, tableController, fullPath, pathSegments, parentCollectionIds, columnProperty: selectedKanbanProperty, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], deletedEntities, emptyComponent: canCreateEntities && tableController.filterValues === void 0 && tableController.sortBy === void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
26610
26853
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", children: t("so_empty") }),
|
|
26611
26854
|
/* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: onNewClick, className: "mt-4", children: [
|
|
26612
26855
|
/* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}),
|
|
@@ -26624,7 +26867,7 @@
|
|
|
26624
26867
|
/* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}),
|
|
26625
26868
|
t("create_your_first_entry")
|
|
26626
26869
|
] })
|
|
26627
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: t("no_results_filter_sort") }), hoverRow, inlineEditing: checkInlineEditing(), AdditionalHeaderWidget: buildAdditionalHeaderWidget, AddColumnComponent: addColumnComponentInternal, getIdColumnWidth, additionalIDHeaderWidget: /* @__PURE__ */ jsxRuntime.jsx(EntityIdHeaderWidget, { path: fullPath, fullIdPath: fullIdPath ?? fullPath, collection }), openEntityMode, onColumnsOrderChange: (newColumns) => {
|
|
26870
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: t("no_results_filter_sort") }), hoverRow, inlineEditing: checkInlineEditing(), AdditionalHeaderWidget: buildAdditionalHeaderWidget, AddColumnComponent: addColumnComponentInternal, getIdColumnWidth, additionalIDHeaderWidget: /* @__PURE__ */ jsxRuntime.jsx(EntityIdHeaderWidget, { path: fullPath, pathSegments, fullIdPath: fullIdPath ?? fullPath, collection }), openEntityMode, onColumnsOrderChange: (newColumns) => {
|
|
26628
26871
|
const seenKeys = /* @__PURE__ */ new Set();
|
|
26629
26872
|
const newPropertiesOrder = newColumns.filter((col) => !col.frozen && getPropertyInPath(collection.properties, col.key)).map((col_0) => col_0.key).filter((key_1) => {
|
|
26630
26873
|
if (seenKeys.has(key_1)) return false;
|
|
@@ -26643,7 +26886,7 @@
|
|
|
26643
26886
|
});
|
|
26644
26887
|
}
|
|
26645
26888
|
} }, `collection_table_${fullPath}`),
|
|
26646
|
-
popupCell && /* @__PURE__ */ jsxRuntime.jsx(PopupFormField, { open: Boolean(popupCell), onClose: onPopupClose, cellRect: popupCell?.cellRect, propertyKey: popupCell?.propertyKey, collection, entityId: popupCell.entityId, tableKey: tableKey.current, customFieldValidator: uniqueFieldValidator, path: resolvedFullPath, onCellValueChange: onValueChange, container: containerRef.current }, `popup_form_${popupCell?.propertyKey}_${popupCell?.entityId}`),
|
|
26889
|
+
popupCell && /* @__PURE__ */ jsxRuntime.jsx(PopupFormField, { pathSegments, open: Boolean(popupCell), onClose: onPopupClose, cellRect: popupCell?.cellRect, propertyKey: popupCell?.propertyKey, collection, entityId: popupCell.entityId, tableKey: tableKey.current, customFieldValidator: uniqueFieldValidator, path: resolvedFullPath, onCellValueChange: onValueChange, container: containerRef.current }, `popup_form_${popupCell?.propertyKey}_${popupCell?.entityId}`),
|
|
26647
26890
|
deleteEntityClicked && /* @__PURE__ */ jsxRuntime.jsx(DeleteEntityDialog, { entityOrEntitiesToDelete: deleteEntityClicked, path: fullPath, collection, callbacks: collection.callbacks, open: Boolean(deleteEntityClicked), onEntityDelete: internalOnEntityDelete, onMultipleEntitiesDelete: internalOnMultipleEntitiesDelete, onClose: () => setDeleteEntityClicked(void 0) })
|
|
26648
26891
|
] });
|
|
26649
26892
|
}, (a, b) => {
|
|
@@ -26654,7 +26897,8 @@
|
|
|
26654
26897
|
collection,
|
|
26655
26898
|
filter,
|
|
26656
26899
|
sortBy,
|
|
26657
|
-
onCountChange
|
|
26900
|
+
onCountChange,
|
|
26901
|
+
pathSegments
|
|
26658
26902
|
}) {
|
|
26659
26903
|
const dataSource = useDataSource();
|
|
26660
26904
|
const navigation = useNavigationController();
|
|
@@ -26662,16 +26906,18 @@
|
|
|
26662
26906
|
const [error, setError] = React.useState(void 0);
|
|
26663
26907
|
const sortByProperty = sortBy ? sortBy[0] : void 0;
|
|
26664
26908
|
const currentSort = sortBy ? sortBy[1] : void 0;
|
|
26665
|
-
const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
|
|
26909
|
+
const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath, pathSegments), [fullPath, pathSegments, navigation.resolveIdsFrom]);
|
|
26910
|
+
const resolvedPathSegments = React.useMemo(() => pathSegments ? navigation.resolveSegmentsFrom?.(pathSegments) ?? pathSegments : void 0, [pathSegments, navigation.resolveSegmentsFrom]);
|
|
26666
26911
|
React.useEffect(() => {
|
|
26667
26912
|
if (dataSource.countEntities) dataSource.countEntities({
|
|
26668
26913
|
path: resolvedPath,
|
|
26914
|
+
pathSegments: resolvedPathSegments,
|
|
26669
26915
|
collection,
|
|
26670
26916
|
filter,
|
|
26671
26917
|
orderBy: sortByProperty,
|
|
26672
26918
|
order: currentSort
|
|
26673
26919
|
}).then(setCount).catch(setError);
|
|
26674
|
-
}, [fullPath, dataSource.countEntities, resolvedPath, collection, filter, sortByProperty, currentSort]);
|
|
26920
|
+
}, [fullPath, dataSource.countEntities, resolvedPath, resolvedPathSegments, collection, filter, sortByProperty, currentSort]);
|
|
26675
26921
|
React.useEffect(() => {
|
|
26676
26922
|
if (onCountChange && count !== void 0) {
|
|
26677
26923
|
setError(void 0);
|
|
@@ -26701,10 +26947,11 @@
|
|
|
26701
26947
|
};
|
|
26702
26948
|
}
|
|
26703
26949
|
function EntityIdHeaderWidget(t0) {
|
|
26704
|
-
const $ = reactCompilerRuntime.c(
|
|
26950
|
+
const $ = reactCompilerRuntime.c(50);
|
|
26705
26951
|
const {
|
|
26706
26952
|
collection,
|
|
26707
26953
|
path,
|
|
26954
|
+
pathSegments,
|
|
26708
26955
|
fullIdPath
|
|
26709
26956
|
} = t0;
|
|
26710
26957
|
const navigation = useNavigationController();
|
|
@@ -26745,7 +26992,7 @@
|
|
|
26745
26992
|
t4 = $[6];
|
|
26746
26993
|
}
|
|
26747
26994
|
let t5;
|
|
26748
|
-
if ($[7] !== collection || $[8] !== fullIdPath || $[9] !== navigation || $[10] !== openEntityMode || $[11] !== path || $[12] !==
|
|
26995
|
+
if ($[7] !== collection || $[8] !== fullIdPath || $[9] !== navigation || $[10] !== openEntityMode || $[11] !== path || $[12] !== pathSegments || $[13] !== searchString || $[14] !== sideEntityController) {
|
|
26749
26996
|
t5 = (e) => {
|
|
26750
26997
|
e.preventDefault();
|
|
26751
26998
|
if (!searchString) {
|
|
@@ -26759,6 +27006,7 @@
|
|
|
26759
27006
|
collection,
|
|
26760
27007
|
entityId,
|
|
26761
27008
|
path,
|
|
27009
|
+
pathSegments,
|
|
26762
27010
|
fullIdPath,
|
|
26763
27011
|
sideEntityController,
|
|
26764
27012
|
navigation
|
|
@@ -26769,130 +27017,133 @@
|
|
|
26769
27017
|
$[9] = navigation;
|
|
26770
27018
|
$[10] = openEntityMode;
|
|
26771
27019
|
$[11] = path;
|
|
26772
|
-
$[12] =
|
|
26773
|
-
$[13] =
|
|
26774
|
-
$[14] =
|
|
27020
|
+
$[12] = pathSegments;
|
|
27021
|
+
$[13] = searchString;
|
|
27022
|
+
$[14] = sideEntityController;
|
|
27023
|
+
$[15] = t5;
|
|
26775
27024
|
} else {
|
|
26776
|
-
t5 = $[
|
|
27025
|
+
t5 = $[15];
|
|
26777
27026
|
}
|
|
26778
27027
|
let t6;
|
|
26779
|
-
if ($[
|
|
27028
|
+
if ($[16] !== t) {
|
|
26780
27029
|
t6 = t("find_entity_by_id");
|
|
26781
|
-
$[
|
|
26782
|
-
$[
|
|
27030
|
+
$[16] = t;
|
|
27031
|
+
$[17] = t6;
|
|
26783
27032
|
} else {
|
|
26784
|
-
t6 = $[
|
|
27033
|
+
t6 = $[17];
|
|
26785
27034
|
}
|
|
26786
27035
|
let t7;
|
|
26787
|
-
if ($[
|
|
27036
|
+
if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
26788
27037
|
t7 = (e_0) => {
|
|
26789
27038
|
setSearchString(e_0.target.value);
|
|
26790
27039
|
};
|
|
26791
|
-
$[
|
|
27040
|
+
$[18] = t7;
|
|
26792
27041
|
} else {
|
|
26793
|
-
t7 = $[
|
|
27042
|
+
t7 = $[18];
|
|
26794
27043
|
}
|
|
26795
27044
|
let t8;
|
|
26796
|
-
if ($[
|
|
27045
|
+
if ($[19] !== openPopup || $[20] !== searchString || $[21] !== t6) {
|
|
26797
27046
|
t8 = /* @__PURE__ */ jsxRuntime.jsx("input", { autoFocus: openPopup, placeholder: t6, onChange: t7, value: searchString, className: "rounded-lg bg-white dark:bg-surface-800 flex-grow bg-transparent outline-none p-2 " + ui.focusedDisabled });
|
|
26798
|
-
$[
|
|
26799
|
-
$[
|
|
26800
|
-
$[
|
|
26801
|
-
$[
|
|
27047
|
+
$[19] = openPopup;
|
|
27048
|
+
$[20] = searchString;
|
|
27049
|
+
$[21] = t6;
|
|
27050
|
+
$[22] = t8;
|
|
26802
27051
|
} else {
|
|
26803
|
-
t8 = $[
|
|
27052
|
+
t8 = $[22];
|
|
26804
27053
|
}
|
|
26805
27054
|
const t9 = !searchString.trim();
|
|
26806
27055
|
let t10;
|
|
26807
|
-
if ($[
|
|
27056
|
+
if ($[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
26808
27057
|
t10 = /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardTabIcon, {});
|
|
26809
|
-
$[
|
|
27058
|
+
$[23] = t10;
|
|
26810
27059
|
} else {
|
|
26811
|
-
t10 = $[
|
|
27060
|
+
t10 = $[23];
|
|
26812
27061
|
}
|
|
26813
27062
|
let t11;
|
|
26814
|
-
if ($[
|
|
27063
|
+
if ($[24] !== t9) {
|
|
26815
27064
|
t11 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", disabled: t9, type: "submit", children: t10 });
|
|
26816
|
-
$[
|
|
26817
|
-
$[
|
|
27065
|
+
$[24] = t9;
|
|
27066
|
+
$[25] = t11;
|
|
26818
27067
|
} else {
|
|
26819
|
-
t11 = $[
|
|
27068
|
+
t11 = $[25];
|
|
26820
27069
|
}
|
|
26821
27070
|
let t12;
|
|
26822
|
-
if ($[
|
|
27071
|
+
if ($[26] !== t11 || $[27] !== t8) {
|
|
26823
27072
|
t12 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex p-2 w-full gap-2", children: [
|
|
26824
27073
|
t8,
|
|
26825
27074
|
t11
|
|
26826
27075
|
] });
|
|
26827
|
-
$[
|
|
26828
|
-
$[
|
|
26829
|
-
$[
|
|
27076
|
+
$[26] = t11;
|
|
27077
|
+
$[27] = t8;
|
|
27078
|
+
$[28] = t12;
|
|
26830
27079
|
} else {
|
|
26831
|
-
t12 = $[
|
|
27080
|
+
t12 = $[28];
|
|
26832
27081
|
}
|
|
26833
27082
|
let t13;
|
|
26834
|
-
if ($[
|
|
27083
|
+
if ($[29] !== t12 || $[30] !== t5) {
|
|
26835
27084
|
t13 = /* @__PURE__ */ jsxRuntime.jsx("form", { noValidate: true, onSubmit: t5, className: "w-96 max-w-full", children: t12 });
|
|
26836
|
-
$[
|
|
26837
|
-
$[
|
|
26838
|
-
$[
|
|
27085
|
+
$[29] = t12;
|
|
27086
|
+
$[30] = t5;
|
|
27087
|
+
$[31] = t13;
|
|
26839
27088
|
} else {
|
|
26840
|
-
t13 = $[
|
|
27089
|
+
t13 = $[31];
|
|
26841
27090
|
}
|
|
26842
27091
|
let t14;
|
|
26843
|
-
if ($[
|
|
26844
|
-
t14 = recentIds && recentIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 p-2", children: recentIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(ReferencePreview, { reference: new EntityReference(id, path), hover: true, onClick: () => {
|
|
27092
|
+
if ($[32] !== collection || $[33] !== fullIdPath || $[34] !== navigation || $[35] !== openEntityMode || $[36] !== path || $[37] !== pathSegments || $[38] !== recentIds || $[39] !== sideEntityController) {
|
|
27093
|
+
t14 = recentIds && recentIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 p-2", children: recentIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(ReferencePreview, { reference: new EntityReference(id, path, void 0, pathSegments), hover: true, onClick: () => {
|
|
26845
27094
|
setOpenPopup(false);
|
|
26846
27095
|
navigateToEntity({
|
|
26847
27096
|
openEntityMode,
|
|
26848
27097
|
collection,
|
|
26849
27098
|
entityId: id,
|
|
26850
27099
|
path,
|
|
27100
|
+
pathSegments,
|
|
26851
27101
|
fullIdPath,
|
|
26852
27102
|
sideEntityController,
|
|
26853
27103
|
navigation
|
|
26854
27104
|
});
|
|
26855
27105
|
}, includeEntityLink: false, size: "small" }, id)) });
|
|
26856
|
-
$[
|
|
26857
|
-
$[
|
|
26858
|
-
$[
|
|
26859
|
-
$[
|
|
26860
|
-
$[
|
|
26861
|
-
$[
|
|
26862
|
-
$[
|
|
26863
|
-
$[
|
|
27106
|
+
$[32] = collection;
|
|
27107
|
+
$[33] = fullIdPath;
|
|
27108
|
+
$[34] = navigation;
|
|
27109
|
+
$[35] = openEntityMode;
|
|
27110
|
+
$[36] = path;
|
|
27111
|
+
$[37] = pathSegments;
|
|
27112
|
+
$[38] = recentIds;
|
|
27113
|
+
$[39] = sideEntityController;
|
|
27114
|
+
$[40] = t14;
|
|
26864
27115
|
} else {
|
|
26865
|
-
t14 = $[
|
|
27116
|
+
t14 = $[40];
|
|
26866
27117
|
}
|
|
26867
27118
|
let t15;
|
|
26868
|
-
if ($[
|
|
27119
|
+
if ($[41] !== t13 || $[42] !== t14) {
|
|
26869
27120
|
t15 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t4, children: [
|
|
26870
27121
|
t13,
|
|
26871
27122
|
t14
|
|
26872
27123
|
] });
|
|
26873
|
-
$[
|
|
26874
|
-
$[
|
|
26875
|
-
$[
|
|
27124
|
+
$[41] = t13;
|
|
27125
|
+
$[42] = t14;
|
|
27126
|
+
$[43] = t15;
|
|
26876
27127
|
} else {
|
|
26877
|
-
t15 = $[
|
|
27128
|
+
t15 = $[43];
|
|
26878
27129
|
}
|
|
26879
27130
|
let t16;
|
|
26880
|
-
if ($[
|
|
27131
|
+
if ($[44] !== openPopup || $[45] !== t15) {
|
|
26881
27132
|
t16 = /* @__PURE__ */ jsxRuntime.jsx(ui.Popover, { open: openPopup, onOpenChange: setOpenPopup, sideOffset: 0, align: "start", alignOffset: -117, trigger: t3, children: t15 });
|
|
26882
|
-
$[
|
|
26883
|
-
$[
|
|
26884
|
-
$[
|
|
27133
|
+
$[44] = openPopup;
|
|
27134
|
+
$[45] = t15;
|
|
27135
|
+
$[46] = t16;
|
|
26885
27136
|
} else {
|
|
26886
|
-
t16 = $[
|
|
27137
|
+
t16 = $[46];
|
|
26887
27138
|
}
|
|
26888
27139
|
let t17;
|
|
26889
|
-
if ($[
|
|
27140
|
+
if ($[47] !== t16 || $[48] !== t2) {
|
|
26890
27141
|
t17 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t2, asChild: false, children: t16 });
|
|
26891
|
-
$[
|
|
26892
|
-
$[
|
|
26893
|
-
$[
|
|
27142
|
+
$[47] = t16;
|
|
27143
|
+
$[48] = t2;
|
|
27144
|
+
$[49] = t17;
|
|
26894
27145
|
} else {
|
|
26895
|
-
t17 = $[
|
|
27146
|
+
t17 = $[49];
|
|
26896
27147
|
}
|
|
26897
27148
|
return t17;
|
|
26898
27149
|
}
|
|
@@ -28459,8 +28710,13 @@
|
|
|
28459
28710
|
const {
|
|
28460
28711
|
path,
|
|
28461
28712
|
collections = [],
|
|
28462
|
-
currentFullPath
|
|
28713
|
+
currentFullPath,
|
|
28714
|
+
currentPathSegments = [],
|
|
28715
|
+
pathSegments
|
|
28463
28716
|
} = props;
|
|
28717
|
+
if (pathSegments) {
|
|
28718
|
+
return getParentReferencesFromPathSegments(pathSegments, collections);
|
|
28719
|
+
}
|
|
28464
28720
|
const subpaths = removeInitialAndTrailingSlashes(path).split("/");
|
|
28465
28721
|
const subpathCombinations = getCollectionPathsCombinations(subpaths);
|
|
28466
28722
|
const result = [];
|
|
@@ -28469,12 +28725,14 @@
|
|
|
28469
28725
|
const collection = collections && collections.find((entry) => entry.id === subpathCombination || entry.path === subpathCombination);
|
|
28470
28726
|
if (collection) {
|
|
28471
28727
|
const collectionPath = currentFullPath && currentFullPath.length > 0 ? currentFullPath + "/" + collection.path : collection.path;
|
|
28728
|
+
const collectionSegments = [...currentPathSegments, ...collection.path.split("/")];
|
|
28472
28729
|
const restOfThePath = removeInitialAndTrailingSlashes(removeInitialAndTrailingSlashes(path).replace(subpathCombination, ""));
|
|
28473
28730
|
const nextSegments = restOfThePath.length > 0 ? restOfThePath.split("/") : [];
|
|
28474
28731
|
if (nextSegments.length > 0) {
|
|
28475
28732
|
const entityId = decodeEntityId(nextSegments[0]);
|
|
28476
28733
|
const fullPath = collectionPath + "/" + entityId;
|
|
28477
|
-
|
|
28734
|
+
const entitySegments = [...collectionSegments, entityId];
|
|
28735
|
+
result.push(new EntityReference(entityId, collectionPath, void 0, collectionSegments));
|
|
28478
28736
|
if (nextSegments.length > 1) {
|
|
28479
28737
|
const newPath = nextSegments.slice(1).join("/");
|
|
28480
28738
|
if (!collection) {
|
|
@@ -28484,7 +28742,8 @@
|
|
|
28484
28742
|
result.push(...getParentReferencesFromPath({
|
|
28485
28743
|
path: newPath,
|
|
28486
28744
|
collections: collection.subcollections,
|
|
28487
|
-
currentFullPath: fullPath
|
|
28745
|
+
currentFullPath: fullPath,
|
|
28746
|
+
currentPathSegments: entitySegments
|
|
28488
28747
|
}));
|
|
28489
28748
|
}
|
|
28490
28749
|
}
|
|
@@ -28494,6 +28753,9 @@
|
|
|
28494
28753
|
}
|
|
28495
28754
|
return result;
|
|
28496
28755
|
}
|
|
28756
|
+
function getParentReferencesFromPathSegments(pathSegments, collections) {
|
|
28757
|
+
return walkPathSegments(pathSegments, collections).steps.filter((step) => step.entityId !== void 0).map((step) => new EntityReference(step.entityId, step.collectionPath, void 0, step.collectionSegments));
|
|
28758
|
+
}
|
|
28497
28759
|
const DEFAULT_BASE_PATH = "/";
|
|
28498
28760
|
const DEFAULT_COLLECTION_PATH = "/c";
|
|
28499
28761
|
const NAVIGATION_ADMIN_GROUP_NAME = "Admin";
|
|
@@ -28698,10 +28960,10 @@
|
|
|
28698
28960
|
React.useEffect(() => {
|
|
28699
28961
|
refreshNavigation();
|
|
28700
28962
|
}, [refreshNavigation]);
|
|
28701
|
-
const getCollection = React.useCallback((idOrPath, includeUserOverride = false) => {
|
|
28963
|
+
const getCollection = React.useCallback((idOrPath, includeUserOverride = false, pathSegments) => {
|
|
28702
28964
|
const collections_0 = collectionsRef.current;
|
|
28703
28965
|
if (!collections_0) return void 0;
|
|
28704
|
-
const baseCollection = getCollectionByPathOrId(removeInitialAndTrailingSlashes(idOrPath), collections_0);
|
|
28966
|
+
const baseCollection = getCollectionByPathOrId(removeInitialAndTrailingSlashes(idOrPath), collections_0, pathSegments);
|
|
28705
28967
|
const userOverride = includeUserOverride ? userConfigPersistence?.getCollectionConfig(idOrPath) : void 0;
|
|
28706
28968
|
let overriddenCollection = baseCollection;
|
|
28707
28969
|
if (baseCollection && userOverride) {
|
|
@@ -28736,16 +28998,16 @@
|
|
|
28736
28998
|
if (!collection_0) return void 0;
|
|
28737
28999
|
return collection_0;
|
|
28738
29000
|
}, []);
|
|
28739
|
-
const getCollectionFromPaths = React.useCallback((
|
|
29001
|
+
const getCollectionFromPaths = React.useCallback((pathSegments_0) => {
|
|
28740
29002
|
const collections_2 = collectionsRef.current;
|
|
28741
29003
|
if (collections_2 === void 0) throw Error("getCollectionFromPaths: Collections have not been initialised yet");
|
|
28742
29004
|
let currentCollections = [...collections_2 ?? []];
|
|
28743
|
-
for (let i = 0; i <
|
|
28744
|
-
const pathSegment =
|
|
29005
|
+
for (let i = 0; i < pathSegments_0.length; i++) {
|
|
29006
|
+
const pathSegment = pathSegments_0[i];
|
|
28745
29007
|
const collection_1 = currentCollections.find((c_0) => c_0.id === pathSegment || c_0.path === pathSegment);
|
|
28746
29008
|
if (!collection_1) return void 0;
|
|
28747
29009
|
currentCollections = collection_1.subcollections;
|
|
28748
|
-
if (i ===
|
|
29010
|
+
if (i === pathSegments_0.length - 1) return collection_1;
|
|
28749
29011
|
}
|
|
28750
29012
|
return void 0;
|
|
28751
29013
|
}, []);
|
|
@@ -28770,33 +29032,37 @@
|
|
|
28770
29032
|
if (cleanPath_0.startsWith(fullCollectionPath)) return cleanPath_0.replace(fullCollectionPath, "");
|
|
28771
29033
|
throw Error("Expected path starting with " + fullCollectionPath);
|
|
28772
29034
|
}, [fullCollectionPath]);
|
|
28773
|
-
const resolveIdsFrom = React.useCallback((path_3) => {
|
|
29035
|
+
const resolveIdsFrom = React.useCallback((path_3, pathSegments_1) => {
|
|
28774
29036
|
const collections_4 = collectionsRef.current ?? [];
|
|
28775
|
-
return resolveCollectionPathIds(path_3, collections_4);
|
|
29037
|
+
return resolveCollectionPathIds(path_3, collections_4, pathSegments_1);
|
|
28776
29038
|
}, []);
|
|
28777
|
-
const
|
|
29039
|
+
const resolveSegmentsFrom = React.useCallback((pathSegments_2) => {
|
|
28778
29040
|
const collections_5 = collectionsRef.current ?? [];
|
|
29041
|
+
return resolveCollectionPathSegments(pathSegments_2, collections_5);
|
|
29042
|
+
}, []);
|
|
29043
|
+
const getAllParentReferencesForPath = React.useCallback((path_4, pathSegments_3) => {
|
|
29044
|
+
const collections_6 = collectionsRef.current ?? [];
|
|
28779
29045
|
return getParentReferencesFromPath({
|
|
28780
29046
|
path: path_4,
|
|
28781
|
-
|
|
29047
|
+
pathSegments: pathSegments_3,
|
|
29048
|
+
collections: collections_6
|
|
28782
29049
|
});
|
|
28783
29050
|
}, []);
|
|
28784
|
-
const getParentCollectionIds = React.useCallback((path_5) => {
|
|
28785
|
-
const
|
|
28786
|
-
const oddPathSegments = strings.filter((_, i_1) => i_1 % 2 === 0);
|
|
29051
|
+
const getParentCollectionIds = React.useCallback((path_5, pathSegments_4) => {
|
|
29052
|
+
const oddPathSegments = pathSegments_4 ? collectionSegmentsFrom(pathSegments_4) : fullPathToCollectionSegments(path_5);
|
|
28787
29053
|
oddPathSegments.pop();
|
|
28788
29054
|
const result_0 = [];
|
|
28789
|
-
for (let
|
|
28790
|
-
result_0.push(oddPathSegments.slice(0,
|
|
29055
|
+
for (let i_1 = 1; i_1 <= oddPathSegments.length; i_1++) {
|
|
29056
|
+
result_0.push(oddPathSegments.slice(0, i_1));
|
|
28791
29057
|
}
|
|
28792
29058
|
return result_0.map((r) => getCollectionFromPaths(r)?.id).filter(Boolean);
|
|
28793
29059
|
}, [getAllParentReferencesForPath]);
|
|
28794
29060
|
const convertIdsToPaths = React.useCallback((ids_0) => {
|
|
28795
|
-
const
|
|
28796
|
-
let currentCollections_1 =
|
|
29061
|
+
const collections_7 = collectionsRef.current;
|
|
29062
|
+
let currentCollections_1 = collections_7;
|
|
28797
29063
|
const paths = [];
|
|
28798
|
-
for (let
|
|
28799
|
-
const id_1 = ids_0[
|
|
29064
|
+
for (let i_2 = 0; i_2 < ids_0.length; i_2++) {
|
|
29065
|
+
const id_1 = ids_0[i_2];
|
|
28800
29066
|
const collection_3 = currentCollections_1.find((c_2) => c_2.id === id_1);
|
|
28801
29067
|
if (!collection_3) throw Error(`Collection with id ${id_1} not found`);
|
|
28802
29068
|
paths.push(collection_3.path);
|
|
@@ -28822,6 +29088,7 @@
|
|
|
28822
29088
|
urlPathToDataPath,
|
|
28823
29089
|
buildUrlCollectionPath,
|
|
28824
29090
|
resolveIdsFrom,
|
|
29091
|
+
resolveSegmentsFrom,
|
|
28825
29092
|
topLevelNavigation,
|
|
28826
29093
|
refreshNavigation,
|
|
28827
29094
|
getParentReferencesFromPath: getAllParentReferencesForPath,
|
|
@@ -29579,6 +29846,7 @@
|
|
|
29579
29846
|
if (params.status !== "existing") {
|
|
29580
29847
|
sideEntityController.replace({
|
|
29581
29848
|
path: params.path,
|
|
29849
|
+
pathSegments: params.pathSegments ?? pathSegments,
|
|
29582
29850
|
entityId: params.entityId,
|
|
29583
29851
|
fullIdPath: props.fullIdPath,
|
|
29584
29852
|
selectedTab: params.selectedTab,
|
|
@@ -29592,9 +29860,9 @@
|
|
|
29592
29860
|
}
|
|
29593
29861
|
};
|
|
29594
29862
|
const parentCollectionIds = React.useMemo(() => {
|
|
29595
|
-
return navigationController.getParentCollectionIds(path);
|
|
29863
|
+
return navigationController.getParentCollectionIds(path, pathSegments);
|
|
29596
29864
|
}, [navigationController, path]);
|
|
29597
|
-
const collection = props.collection ?? navigationController.getCollection(fullIdPath ?? path);
|
|
29865
|
+
const collection = props.collection ?? navigationController.getCollection(fullIdPath ?? path, false, pathSegments);
|
|
29598
29866
|
React.useEffect(() => {
|
|
29599
29867
|
function beforeunload(e) {
|
|
29600
29868
|
if (blocked && collection) {
|
|
@@ -29622,7 +29890,7 @@
|
|
|
29622
29890
|
}) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
29623
29891
|
/* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { className: "self-center", size: "smallest", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { size: "smallest" }) }),
|
|
29624
29892
|
allowFullScreen && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { className: "self-center", size: "smallest", onClick: () => {
|
|
29625
|
-
const key = status === "new" || status === "copy" ? path + "#new" : path
|
|
29893
|
+
const key = status === "new" || status === "copy" ? path + "#new" : entityCacheKey(path, entityId);
|
|
29626
29894
|
saveEntityToMemoryCache(key, values);
|
|
29627
29895
|
if (entityId) navigate(location.pathname + location.search);
|
|
29628
29896
|
else navigate(location.pathname + location.search + "#new");
|
|
@@ -29634,6 +29902,7 @@
|
|
|
29634
29902
|
}) => {
|
|
29635
29903
|
sideEntityController.replace({
|
|
29636
29904
|
path,
|
|
29905
|
+
pathSegments,
|
|
29637
29906
|
entityId: entityId_0,
|
|
29638
29907
|
fullIdPath: props.fullIdPath,
|
|
29639
29908
|
selectedTab,
|
|
@@ -29749,6 +30018,7 @@
|
|
|
29749
30018
|
function EntityEditViewFormActions({
|
|
29750
30019
|
collection,
|
|
29751
30020
|
path,
|
|
30021
|
+
pathSegments,
|
|
29752
30022
|
entity,
|
|
29753
30023
|
layout,
|
|
29754
30024
|
savingError,
|
|
@@ -29771,8 +30041,8 @@
|
|
|
29771
30041
|
} = useTranslation();
|
|
29772
30042
|
const entityActions = React.useMemo(() => {
|
|
29773
30043
|
const customEntityActions = (collection.entityActions ?? []).map((action) => resolveEntityAction(action, customizationController.entityActions)).filter(Boolean);
|
|
29774
|
-
const createEnabled = canCreateEntity(collection, authController, path, null);
|
|
29775
|
-
const deleteEnabled = entity ? canDeleteEntity(collection, authController, path, entity) : false;
|
|
30044
|
+
const createEnabled = canCreateEntity(collection, authController, path, null, pathSegments);
|
|
30045
|
+
const deleteEnabled = entity ? canDeleteEntity(collection, authController, path, entity, entity.pathSegments ?? pathSegments) : false;
|
|
29776
30046
|
const actions = [];
|
|
29777
30047
|
if (createEnabled) actions.push(copyEntityAction);
|
|
29778
30048
|
if (deleteEnabled) actions.push(deleteEntityAction);
|
|
@@ -30128,7 +30398,7 @@
|
|
|
30128
30398
|
databaseId: props.databaseId,
|
|
30129
30399
|
useCache: false
|
|
30130
30400
|
});
|
|
30131
|
-
const initialDirtyValues = entityId ? getEntityFromMemoryCache(props.path
|
|
30401
|
+
const initialDirtyValues = entityId ? getEntityFromMemoryCache(entityCacheKey(props.path, entityId)) : getEntityFromMemoryCache(props.path + "#new");
|
|
30132
30402
|
const authController = useAuthController();
|
|
30133
30403
|
const initialStatus = props.copy ? "copy" : entityId ? "existing" : "new";
|
|
30134
30404
|
const [status, setStatus] = React.useState(initialStatus);
|
|
@@ -30136,7 +30406,7 @@
|
|
|
30136
30406
|
if (status === "new" || status === "copy") {
|
|
30137
30407
|
return true;
|
|
30138
30408
|
} else {
|
|
30139
|
-
return entity ? canEditEntity(props.collection, authController, props.path, entity ?? null) : void 0;
|
|
30409
|
+
return entity ? canEditEntity(props.collection, authController, props.path, entity ?? null, props.pathSegments) : void 0;
|
|
30140
30410
|
}
|
|
30141
30411
|
}, [authController, entity, status]);
|
|
30142
30412
|
if (dataLoading && !initialDirtyValues || (!entity || canEdit === void 0) && (status === "existing" || status === "copy")) {
|
|
@@ -30186,6 +30456,7 @@
|
|
|
30186
30456
|
entityId,
|
|
30187
30457
|
parentCollectionIds,
|
|
30188
30458
|
path,
|
|
30459
|
+
pathSegments,
|
|
30189
30460
|
status,
|
|
30190
30461
|
collection,
|
|
30191
30462
|
context,
|
|
@@ -30284,7 +30555,7 @@
|
|
|
30284
30555
|
const subcollectionId = subcollection.id ?? subcollection.path;
|
|
30285
30556
|
const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection.path)}` : void 0;
|
|
30286
30557
|
const newFullIdPath = fullIdPath && usedEntity ? `${fullIdPath}/${encodeEntityId(usedEntity.id)}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
|
|
30287
|
-
const newPathSegments =
|
|
30558
|
+
const newPathSegments = buildSubcollectionPathSegments(pathSegments, usedEntity?.id, subcollection.path);
|
|
30288
30559
|
if (selectedTab !== subcollectionId) return null;
|
|
30289
30560
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 h-full overflow-auto w-full", role: "tabpanel", children: [
|
|
30290
30561
|
globalLoading && /* @__PURE__ */ jsxRuntime.jsx(CircularProgressCenter, {}),
|
|
@@ -30307,7 +30578,7 @@
|
|
|
30307
30578
|
/* @__PURE__ */ jsxRuntime.jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection }),
|
|
30308
30579
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-16" })
|
|
30309
30580
|
] }) }) : null;
|
|
30310
|
-
const entityView = /* @__PURE__ */ jsxRuntime.jsx(EntityForm, { fullIdPath, collection, path, entityId: entityId ?? usedEntity?.id, onValuesModified, entity, initialDirtyValues, openEntityMode: layout, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, className: ui.cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, disabled: !canEdit, ...formProps, onEntityChange: (entity_0) => {
|
|
30581
|
+
const entityView = /* @__PURE__ */ jsxRuntime.jsx(EntityForm, { fullIdPath, collection, path, pathSegments, entityId: entityId ?? usedEntity?.id, onValuesModified, entity, initialDirtyValues, openEntityMode: layout, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, className: ui.cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, disabled: !canEdit, ...formProps, onEntityChange: (entity_0) => {
|
|
30311
30582
|
setUsedEntity(entity_0);
|
|
30312
30583
|
formProps?.onEntityChange?.(entity_0);
|
|
30313
30584
|
}, onStatusChange: (status_0) => {
|
|
@@ -30578,19 +30849,21 @@
|
|
|
30578
30849
|
return sidePanel ? [sidePanel] : [];
|
|
30579
30850
|
}
|
|
30580
30851
|
const propsToSidePanel = (props, buildUrlCollectionPath, resolveIdsFrom, smallLayout, customizationController, authController, locationSearch) => {
|
|
30581
|
-
const
|
|
30582
|
-
const urlPath = props.entityId ? buildUrlCollectionPath(`${
|
|
30852
|
+
const urlChain = removeInitialAndTrailingSlashes(props.fullIdPath ?? props.path);
|
|
30853
|
+
const urlPath = props.entityId ? buildUrlCollectionPath(`${urlChain}/${encodeEntityId(props.entityId)}${props.selectedTab ? "/" + props.selectedTab : ""}${locationSearch}#${SIDE_URL_HASH}`) : buildUrlCollectionPath(`${urlChain}${locationSearch}#${NEW_URL_HASH}`);
|
|
30583
30854
|
const resolvedPanelProps = {
|
|
30584
30855
|
...props,
|
|
30585
30856
|
formProps: props.formProps
|
|
30586
30857
|
};
|
|
30587
30858
|
const entityViewWidth = getEntityViewWidth(props, smallLayout, customizationController, authController);
|
|
30588
30859
|
return {
|
|
30589
|
-
|
|
30860
|
+
// Built from the escaped chain so that two different chains which happen to flatten
|
|
30861
|
+
// to the same raw string are still two different panels.
|
|
30862
|
+
key: `${urlChain}/${props.entityId ? encodeEntityId(props.entityId) : ""}`,
|
|
30590
30863
|
component: void 0,
|
|
30591
30864
|
// Lazy render in SideDialogs for better performance
|
|
30592
30865
|
urlPath,
|
|
30593
|
-
parentUrlPath: buildUrlCollectionPath(
|
|
30866
|
+
parentUrlPath: buildUrlCollectionPath(urlChain),
|
|
30594
30867
|
width: entityViewWidth,
|
|
30595
30868
|
onClose: props.onClose,
|
|
30596
30869
|
additional: resolvedPanelProps
|
|
@@ -30859,7 +31132,7 @@
|
|
|
30859
31132
|
onUpdate,
|
|
30860
31133
|
onError
|
|
30861
31134
|
}) => {
|
|
30862
|
-
const collection_0 = collectionProp ?? navigationController.getCollection(path_0);
|
|
31135
|
+
const collection_0 = collectionProp ?? navigationController.getCollection(path_0, false, pathSegments_0);
|
|
30863
31136
|
const usedDelegate_0 = collection_0?.overrides?.dataSourceDelegate ?? delegate;
|
|
30864
31137
|
if (!usedDelegate_0.listenCollection) throw Error("useBuildDataSource delegate not initialised");
|
|
30865
31138
|
return usedDelegate_0.listenCollection({
|
|
@@ -30945,7 +31218,7 @@
|
|
|
30945
31218
|
collection: collectionProp_0,
|
|
30946
31219
|
status
|
|
30947
31220
|
}) => {
|
|
30948
|
-
const collection_3 = collectionProp_0 ?? navigationController.getCollection(path_3);
|
|
31221
|
+
const collection_3 = collectionProp_0 ?? navigationController.getCollection(path_3, false, pathSegments_3);
|
|
30949
31222
|
const usedDelegate_3 = collection_3?.overrides?.dataSourceDelegate ?? delegate;
|
|
30950
31223
|
const resolvedCollection = collection_3 ? resolveCollection({
|
|
30951
31224
|
collection: collection_3,
|
|
@@ -31002,8 +31275,11 @@
|
|
|
31002
31275
|
status
|
|
31003
31276
|
}).then((res) => {
|
|
31004
31277
|
return {
|
|
31005
|
-
|
|
31006
|
-
|
|
31278
|
+
...res,
|
|
31279
|
+
// A delegate that predates `pathSegments` returns none; the segments we
|
|
31280
|
+
// just saved with describe exactly this entity's collection, so they are
|
|
31281
|
+
// the authoritative answer rather than a guess.
|
|
31282
|
+
pathSegments: res.pathSegments ?? pathSegments_3,
|
|
31007
31283
|
values: usedDelegate_3.delegateToCMSModel(finalValues)
|
|
31008
31284
|
};
|
|
31009
31285
|
});
|
|
@@ -31016,11 +31292,14 @@
|
|
|
31016
31292
|
*/
|
|
31017
31293
|
deleteEntity: React.useCallback(({
|
|
31018
31294
|
entity,
|
|
31295
|
+
pathSegments: pathSegments_4,
|
|
31019
31296
|
collection: collection_4
|
|
31020
31297
|
}) => {
|
|
31021
31298
|
const usedDelegate_4 = collection_4?.overrides?.dataSourceDelegate ?? delegate;
|
|
31022
31299
|
return usedDelegate_4.deleteEntity({
|
|
31023
31300
|
entity,
|
|
31301
|
+
// Falls back to what the entity carries from the fetch that produced it.
|
|
31302
|
+
pathSegments: pathSegments_4 ?? entity.pathSegments,
|
|
31024
31303
|
collection: collection_4
|
|
31025
31304
|
});
|
|
31026
31305
|
}, [delegate.deleteEntity]),
|
|
@@ -31034,16 +31313,19 @@
|
|
|
31034
31313
|
* @return `true` if there are no other fields besides the given entity
|
|
31035
31314
|
* @group Firestore
|
|
31036
31315
|
*/
|
|
31037
|
-
checkUniqueField: React.useCallback((path_4, name, value, entityId_2, collection_5) => {
|
|
31316
|
+
checkUniqueField: React.useCallback((path_4, name, value, entityId_2, collection_5, pathSegments_5) => {
|
|
31038
31317
|
const usedDelegate_5 = collection_5?.overrides?.dataSourceDelegate ?? delegate;
|
|
31039
|
-
return usedDelegate_5.checkUniqueField(path_4, name, value, entityId_2, collection_5);
|
|
31318
|
+
return usedDelegate_5.checkUniqueField(path_4, name, value, entityId_2, collection_5, pathSegments_5);
|
|
31040
31319
|
}, [delegate.checkUniqueField]),
|
|
31041
|
-
generateEntityId: React.useCallback((path_5, collection_6) => {
|
|
31320
|
+
generateEntityId: React.useCallback((path_5, collection_6, pathSegments_6) => {
|
|
31042
31321
|
const usedDelegate_6 = collection_6?.overrides?.dataSourceDelegate ?? delegate;
|
|
31043
|
-
return usedDelegate_6.generateEntityId(path_5, collection_6);
|
|
31322
|
+
return usedDelegate_6.generateEntityId(path_5, collection_6, pathSegments_6);
|
|
31044
31323
|
}, [delegate.generateEntityId]),
|
|
31324
|
+
// Typed with the declared props rather than an inline duplicate: the duplicate is
|
|
31325
|
+
// free to drift from the interface, and a field it forgets is dropped in silence.
|
|
31045
31326
|
countEntities: delegate.countEntities ? async ({
|
|
31046
31327
|
path: path_6,
|
|
31328
|
+
pathSegments: pathSegments_7,
|
|
31047
31329
|
collection: collection_7,
|
|
31048
31330
|
filter: filter_1,
|
|
31049
31331
|
order: order_1,
|
|
@@ -31052,6 +31334,7 @@
|
|
|
31052
31334
|
const usedDelegate_7 = collection_7?.overrides?.dataSourceDelegate ?? delegate;
|
|
31053
31335
|
return usedDelegate_7.countEntities({
|
|
31054
31336
|
path: path_6,
|
|
31337
|
+
pathSegments: pathSegments_7,
|
|
31055
31338
|
filter: filter_1,
|
|
31056
31339
|
orderBy: orderBy_1,
|
|
31057
31340
|
order: order_1,
|
|
@@ -31060,6 +31343,7 @@
|
|
|
31060
31343
|
} : void 0,
|
|
31061
31344
|
isFilterCombinationValid: React.useCallback(({
|
|
31062
31345
|
path: path_7,
|
|
31346
|
+
pathSegments: pathSegments_8,
|
|
31063
31347
|
databaseId,
|
|
31064
31348
|
filterValues,
|
|
31065
31349
|
sortBy
|
|
@@ -31067,6 +31351,7 @@
|
|
|
31067
31351
|
if (!delegate.isFilterCombinationValid) return true;
|
|
31068
31352
|
return delegate.isFilterCombinationValid({
|
|
31069
31353
|
path: path_7,
|
|
31354
|
+
pathSegments: pathSegments_8,
|
|
31070
31355
|
databaseId,
|
|
31071
31356
|
filterValues,
|
|
31072
31357
|
sortBy
|
|
@@ -32564,7 +32849,7 @@
|
|
|
32564
32849
|
let collection;
|
|
32565
32850
|
collection = navigation.getCollectionById(navigationEntries[0].id);
|
|
32566
32851
|
if (!collection) {
|
|
32567
|
-
collection = navigation.getCollection(navigationEntries[0].path);
|
|
32852
|
+
collection = navigation.getCollection(navigationEntries[0].path, false, navigationEntries[0].pathSegments);
|
|
32568
32853
|
}
|
|
32569
32854
|
if (!collection) {
|
|
32570
32855
|
t16 = null;
|
|
@@ -32675,7 +32960,7 @@
|
|
|
32675
32960
|
const firstEntry = navigationEntries[0];
|
|
32676
32961
|
collection_0 = navigation.getCollectionById(firstEntry.id);
|
|
32677
32962
|
if (!collection_0) {
|
|
32678
|
-
collection_0 = navigation.getCollection(firstEntry.path);
|
|
32963
|
+
collection_0 = navigation.getCollection(firstEntry.path, false, firstEntry.pathSegments);
|
|
32679
32964
|
}
|
|
32680
32965
|
if (!collection_0) {
|
|
32681
32966
|
t16 = null;
|
|
@@ -32848,9 +33133,10 @@
|
|
|
32848
33133
|
}
|
|
32849
33134
|
const collection = isNew ? lastCollectionEntry.collection : lastEntityEntry.parentCollection;
|
|
32850
33135
|
const fullIdPath = isNew ? lastCollectionEntry.fullPath : parentCollectionEntry?.fullPath ?? lastEntityEntry.fullPath;
|
|
32851
|
-
const
|
|
33136
|
+
const pathSegments = isNew ? lastCollectionEntry.pathSegments : lastEntityEntry.pathSegments;
|
|
33137
|
+
const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path, pathSegments);
|
|
32852
33138
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
32853
|
-
/* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, fullIdPath, pathSegments
|
|
33139
|
+
/* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, fullIdPath, pathSegments, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
|
|
32854
33140
|
const newEntityId = params.entityId;
|
|
32855
33141
|
if (!newEntityId) return;
|
|
32856
33142
|
navigate(buildEntityUrl(newEntityId, params.selectedTab), {
|
|
@@ -38942,12 +39228,27 @@
|
|
|
38942
39228
|
translations,
|
|
38943
39229
|
children
|
|
38944
39230
|
}) {
|
|
39231
|
+
const parentI18n = React.useContext(reactI18next.I18nContext)?.i18n;
|
|
39232
|
+
const parentInstance = parentI18n?.hasResourceBundle?.("en", FIRECMS_NS) ? parentI18n : void 0;
|
|
38945
39233
|
const i18nRef = React.useRef(null);
|
|
38946
39234
|
const [ready, setReady] = React.useState(false);
|
|
38947
39235
|
if (!i18nRef.current) {
|
|
38948
39236
|
const instance = i18next.createInstance();
|
|
38949
39237
|
const resources = buildResources(translations);
|
|
38950
|
-
|
|
39238
|
+
if (parentInstance) {
|
|
39239
|
+
const inherited = parentInstance.services?.resourceStore?.data ?? {};
|
|
39240
|
+
for (const [lang, namespaces] of Object.entries(inherited)) {
|
|
39241
|
+
const bundle = namespaces?.[FIRECMS_NS];
|
|
39242
|
+
if (!bundle) continue;
|
|
39243
|
+
resources[lang] = {
|
|
39244
|
+
[FIRECMS_NS]: {
|
|
39245
|
+
...bundle,
|
|
39246
|
+
...translations?.[lang] ?? {}
|
|
39247
|
+
}
|
|
39248
|
+
};
|
|
39249
|
+
}
|
|
39250
|
+
}
|
|
39251
|
+
let initialLocale = parentInstance?.language ?? locale;
|
|
38951
39252
|
if (typeof window !== "undefined") {
|
|
38952
39253
|
const stored = localStorage.getItem(FIRECMS_LOCALE_STORAGE_KEY);
|
|
38953
39254
|
if (stored) initialLocale = stored;
|
|
@@ -38972,6 +39273,17 @@
|
|
|
38972
39273
|
});
|
|
38973
39274
|
i18nRef.current = instance;
|
|
38974
39275
|
}
|
|
39276
|
+
React.useEffect(() => {
|
|
39277
|
+
if (!parentInstance || !i18nRef.current) return;
|
|
39278
|
+
const instance_0 = i18nRef.current;
|
|
39279
|
+
const follow = (lng_0) => {
|
|
39280
|
+
if (instance_0.language !== lng_0) instance_0.changeLanguage(lng_0);
|
|
39281
|
+
};
|
|
39282
|
+
parentInstance.on("languageChanged", follow);
|
|
39283
|
+
return () => {
|
|
39284
|
+
parentInstance.off("languageChanged", follow);
|
|
39285
|
+
};
|
|
39286
|
+
}, [parentInstance]);
|
|
38975
39287
|
React.useEffect(() => {
|
|
38976
39288
|
if (i18nRef.current && i18nRef.current.language !== locale) {
|
|
38977
39289
|
const hasUserPreference = typeof window !== "undefined" && Boolean(localStorage.getItem(FIRECMS_LOCALE_STORAGE_KEY));
|
|
@@ -38983,11 +39295,11 @@
|
|
|
38983
39295
|
React.useEffect(() => {
|
|
38984
39296
|
if (!i18nRef.current) return;
|
|
38985
39297
|
const resources_0 = buildResources(translations);
|
|
38986
|
-
for (const [
|
|
39298
|
+
for (const [lang_0, bundle_0] of Object.entries(resources_0)) {
|
|
38987
39299
|
i18nRef.current.addResourceBundle(
|
|
38988
|
-
|
|
39300
|
+
lang_0,
|
|
38989
39301
|
FIRECMS_NS,
|
|
38990
|
-
|
|
39302
|
+
bundle_0[FIRECMS_NS],
|
|
38991
39303
|
true,
|
|
38992
39304
|
// deep merge
|
|
38993
39305
|
true
|
|
@@ -43736,9 +44048,11 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
|
|
|
43736
44048
|
exports2.buildProperties = buildProperties;
|
|
43737
44049
|
exports2.buildPropertiesOrBuilder = buildPropertiesOrBuilder;
|
|
43738
44050
|
exports2.buildProperty = buildProperty;
|
|
44051
|
+
exports2.buildSubcollectionPathSegments = buildSubcollectionPathSegments;
|
|
43739
44052
|
exports2.canCreateEntity = canCreateEntity;
|
|
43740
44053
|
exports2.canDeleteEntity = canDeleteEntity;
|
|
43741
44054
|
exports2.canEditEntity = canEditEntity;
|
|
44055
|
+
exports2.collectionSegmentsFrom = collectionSegmentsFrom;
|
|
43742
44056
|
exports2.copyEntityAction = copyEntityAction;
|
|
43743
44057
|
exports2.decodeEntityId = decodeEntityId;
|
|
43744
44058
|
exports2.defaultDateFormat = defaultDateFormat;
|
|
@@ -43757,6 +44071,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
|
|
|
43757
44071
|
exports2.getArrayValuesCount = getArrayValuesCount;
|
|
43758
44072
|
exports2.getBracketNotation = getBracketNotation;
|
|
43759
44073
|
exports2.getCollectionByPathOrId = getCollectionByPathOrId;
|
|
44074
|
+
exports2.getCollectionByPathSegments = getCollectionByPathSegments;
|
|
43760
44075
|
exports2.getCollectionPathsCombinations = getCollectionPathsCombinations;
|
|
43761
44076
|
exports2.getColorForProperty = getColorForProperty;
|
|
43762
44077
|
exports2.getColorScheme = getColorScheme;
|
|
@@ -43818,6 +44133,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
|
|
|
43818
44133
|
exports2.parseGeoPoint = parseGeoPoint;
|
|
43819
44134
|
exports2.pick = pick;
|
|
43820
44135
|
exports2.plural = plural;
|
|
44136
|
+
exports2.positionalCollectionSegments = positionalCollectionSegments;
|
|
43821
44137
|
exports2.prettifyIdentifier = prettifyIdentifier;
|
|
43822
44138
|
exports2.printChanged = printChanged;
|
|
43823
44139
|
exports2.propertiesToColumns = propertiesToColumns;
|
|
@@ -43839,6 +44155,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
|
|
|
43839
44155
|
exports2.resolveArrayProperty = resolveArrayProperty;
|
|
43840
44156
|
exports2.resolveCollection = resolveCollection;
|
|
43841
44157
|
exports2.resolveCollectionPathIds = resolveCollectionPathIds;
|
|
44158
|
+
exports2.resolveCollectionPathSegments = resolveCollectionPathSegments;
|
|
43842
44159
|
exports2.resolveDefaultSelectedView = resolveDefaultSelectedView;
|
|
43843
44160
|
exports2.resolveEntityAction = resolveEntityAction;
|
|
43844
44161
|
exports2.resolveEntityView = resolveEntityView;
|
|
@@ -43901,6 +44218,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
|
|
|
43901
44218
|
exports2.useTraceUpdate = useTraceUpdate;
|
|
43902
44219
|
exports2.useTranslation = useTranslation;
|
|
43903
44220
|
exports2.useValidateAuthenticator = useValidateAuthenticator;
|
|
44221
|
+
exports2.walkPathSegments = walkPathSegments;
|
|
43904
44222
|
exports2.yupToFormErrors = yupToFormErrors;
|
|
43905
44223
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
43906
44224
|
}));
|