@firecms/core 3.4.0-canary.d20cc85 → 3.4.0-canary.e2466ba

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.
Files changed (64) hide show
  1. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +3 -2
  2. package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +3 -1
  3. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +3 -1
  4. package/dist/components/common/useDataSourceTableController.d.ts +4 -2
  5. package/dist/components/common/useTableSearchHelper.d.ts +3 -1
  6. package/dist/core/EntityEditView.d.ts +2 -0
  7. package/dist/core/EntityEditViewFormActions.d.ts +1 -1
  8. package/dist/form/EntityForm.d.ts +2 -0
  9. package/dist/form/EntityFormActions.d.ts +2 -0
  10. package/dist/hooks/data/delete.d.ts +1 -1
  11. package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
  12. package/dist/hooks/data/useEntityFetch.d.ts +4 -1
  13. package/dist/index.es.js +663 -451
  14. package/dist/index.es.js.map +1 -1
  15. package/dist/index.umd.js +663 -451
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/types/collections.d.ts +7 -0
  18. package/dist/types/datasource.d.ts +8 -0
  19. package/dist/types/entity_actions.d.ts +6 -0
  20. package/dist/types/entity_callbacks.d.ts +21 -0
  21. package/dist/types/navigation.d.ts +34 -5
  22. package/dist/types/plugins.d.ts +13 -0
  23. package/dist/types/side_entity_controller.d.ts +3 -2
  24. package/dist/util/navigation_utils.d.ts +84 -2
  25. package/dist/util/parent_references_from_path.d.ts +15 -0
  26. package/dist/util/paths.d.ts +28 -0
  27. package/dist/util/permissions.d.ts +10 -4
  28. package/package.json +3 -3
  29. package/src/components/DeleteEntityDialog.tsx +2 -0
  30. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +8 -0
  31. package/src/components/EntityCollectionView/EntityCollectionView.tsx +38 -14
  32. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +6 -2
  33. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +4 -0
  34. package/src/components/EntityCollectionView/useBoardDataController.tsx +7 -2
  35. package/src/components/EntityPreview.tsx +4 -1
  36. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +8 -2
  37. package/src/components/common/default_entity_actions.tsx +16 -0
  38. package/src/components/common/useDataSourceTableController.tsx +11 -5
  39. package/src/components/common/useTableSearchHelper.ts +5 -0
  40. package/src/core/EntityEditView.tsx +6 -10
  41. package/src/core/EntityEditViewFormActions.tsx +3 -2
  42. package/src/core/EntitySidePanel.tsx +4 -2
  43. package/src/form/EntityForm.tsx +16 -2
  44. package/src/form/EntityFormActions.tsx +2 -0
  45. package/src/hooks/data/delete.ts +8 -2
  46. package/src/hooks/data/save.ts +4 -1
  47. package/src/hooks/data/useCollectionFetch.tsx +9 -2
  48. package/src/hooks/data/useEntityFetch.tsx +15 -3
  49. package/src/hooks/useBuildNavigationController.tsx +23 -8
  50. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  51. package/src/internal/useBuildDataSource.ts +13 -12
  52. package/src/preview/components/ReferencePreview.tsx +4 -1
  53. package/src/routes/FireCMSRoute.tsx +9 -4
  54. package/src/types/collections.ts +8 -0
  55. package/src/types/datasource.ts +8 -0
  56. package/src/types/entity_actions.tsx +6 -0
  57. package/src/types/entity_callbacks.ts +24 -0
  58. package/src/types/navigation.ts +35 -5
  59. package/src/types/plugins.tsx +13 -0
  60. package/src/types/side_entity_controller.tsx +3 -2
  61. package/src/util/navigation_utils.ts +197 -2
  62. package/src/util/parent_references_from_path.ts +32 -1
  63. package/src/util/paths.ts +40 -3
  64. package/src/util/permissions.ts +22 -10
package/dist/index.es.js CHANGED
@@ -215,6 +215,11 @@ function encodeEntityId(entityId) {
215
215
  function decodeEntityId(encodedEntityId) {
216
216
  return encodedEntityId.replaceAll("%2F", "/").replaceAll("%23", "#").replaceAll("%3F", "?").replaceAll("%25", "%");
217
217
  }
218
+ function buildSubcollectionPathSegments(parentPathSegments, entityId, subcollectionPath) {
219
+ if (!parentPathSegments || !entityId) return void 0;
220
+ const ownSegments = removeInitialAndTrailingSlashes(subcollectionPath).split("/");
221
+ return [...parentPathSegments, entityId, ...ownSegments];
222
+ }
218
223
  function getLastSegment(path) {
219
224
  const cleanPath = removeInitialAndTrailingSlashes(path);
220
225
  if (cleanPath.includes("/")) {
@@ -223,7 +228,88 @@ function getLastSegment(path) {
223
228
  }
224
229
  return cleanPath;
225
230
  }
226
- function resolveCollectionPathIds(path, allCollections) {
231
+ function walkPathSegments(pathSegments, allCollections) {
232
+ const resolved = [];
233
+ const steps = [];
234
+ let currentCollections = allCollections;
235
+ let index = 0;
236
+ while (index < pathSegments.length) {
237
+ const remaining = pathSegments.slice(index);
238
+ if (!currentCollections || currentCollections.length === 0) {
239
+ resolved.push(...remaining);
240
+ return {
241
+ resolved,
242
+ steps,
243
+ unmatched: remaining[0]
244
+ };
245
+ }
246
+ let match;
247
+ for (const collection of currentCollections) {
248
+ for (const candidate of [collection.path, collection.id]) {
249
+ if (!candidate) continue;
250
+ const parts = removeInitialAndTrailingSlashes(candidate).split("/");
251
+ if (parts.length > remaining.length) continue;
252
+ if (parts.some((part, i) => part !== remaining[i])) continue;
253
+ if (!match || parts.length > match.length) match = {
254
+ collection,
255
+ length: parts.length
256
+ };
257
+ }
258
+ }
259
+ if (!match) {
260
+ resolved.push(...remaining);
261
+ return {
262
+ resolved,
263
+ steps,
264
+ unmatched: remaining[0]
265
+ };
266
+ }
267
+ resolved.push(...removeInitialAndTrailingSlashes(match.collection.path).split("/"));
268
+ index += match.length;
269
+ const step = {
270
+ collection: match.collection,
271
+ collectionPath: resolved.join("/"),
272
+ collectionSegments: [...resolved]
273
+ };
274
+ steps.push(step);
275
+ if (index >= pathSegments.length) {
276
+ return {
277
+ resolved,
278
+ steps,
279
+ collection: match.collection
280
+ };
281
+ }
282
+ step.entityId = pathSegments[index];
283
+ resolved.push(pathSegments[index]);
284
+ index += 1;
285
+ if (index >= pathSegments.length) {
286
+ return {
287
+ resolved,
288
+ steps,
289
+ collection: match.collection
290
+ };
291
+ }
292
+ currentCollections = match.collection.subcollections;
293
+ }
294
+ return {
295
+ resolved,
296
+ steps
297
+ };
298
+ }
299
+ function resolveCollectionPathSegments(pathSegments, allCollections) {
300
+ const walk = walkPathSegments(pathSegments, allCollections);
301
+ if (walk.unmatched !== void 0) {
302
+ console.warn(`resolveCollectionPathSegments: Collection definition not found for segment "${walk.unmatched}" in [${pathSegments.join(", ")}]. Carrying the remaining segments through unresolved.`);
303
+ }
304
+ return walk.resolved;
305
+ }
306
+ function getCollectionByPathSegments(pathSegments, collections) {
307
+ return walkPathSegments(pathSegments, collections).collection;
308
+ }
309
+ function resolveCollectionPathIds(path, allCollections, pathSegments) {
310
+ if (pathSegments) {
311
+ return resolveCollectionPathSegments(pathSegments, allCollections).join("/");
312
+ }
227
313
  let remainingPath = removeInitialAndTrailingSlashes(path);
228
314
  if (!remainingPath) {
229
315
  return "";
@@ -285,7 +371,10 @@ function resolveCollectionPathIds(path, allCollections) {
285
371
  }
286
372
  return resolvedPathParts.join("/");
287
373
  }
288
- function getCollectionByPathOrId(pathOrId, collections) {
374
+ function getCollectionByPathOrId(pathOrId, collections, pathSegments) {
375
+ if (pathSegments) {
376
+ return getCollectionByPathSegments(pathSegments, collections);
377
+ }
289
378
  const subpaths = removeInitialAndTrailingSlashes(pathOrId).split("/");
290
379
  if (subpaths.length % 2 === 0) {
291
380
  throw Error(`getCollectionByPathOrId: Collection paths must have an odd number of segments: ${pathOrId}`);
@@ -1417,7 +1506,16 @@ function segmentsToStrippedPath(paths) {
1417
1506
  return paths.reduce((a, b) => `${a}${COLLECTION_PATH_SEPARATOR}${b}`);
1418
1507
  }
1419
1508
  function fullPathToCollectionSegments(path) {
1420
- return path.split("/").filter((e, i) => i % 2 === 0);
1509
+ return positionalCollectionSegments(path);
1510
+ }
1511
+ function collectionSegmentsFrom(pathSegments) {
1512
+ return keepCollectionPositions(pathSegments);
1513
+ }
1514
+ function positionalCollectionSegments(path) {
1515
+ return keepCollectionPositions(path.split("/"));
1516
+ }
1517
+ function keepCollectionPositions(segments) {
1518
+ return segments.filter((e, i) => i % 2 === 0);
1421
1519
  }
1422
1520
  function serializeRegExp(input) {
1423
1521
  if (!input) return "";
@@ -1647,35 +1745,35 @@ const DEFAULT_PERMISSIONS = {
1647
1745
  create: true,
1648
1746
  delete: true
1649
1747
  };
1650
- function resolvePermissions(collection, authController, path, entity) {
1748
+ function resolvePermissions(collection, authController, path, entity, pathSegments) {
1651
1749
  const permission = collection.permissions;
1652
1750
  if (permission === void 0) {
1653
1751
  return DEFAULT_PERMISSIONS;
1654
1752
  } else if (typeof permission === "object") {
1655
1753
  return permission;
1656
1754
  } else if (typeof permission === "function") {
1657
- const pathSegments = fullPathToCollectionSegments(path);
1755
+ const collectionSegments = pathSegments ? collectionSegmentsFrom(pathSegments) : fullPathToCollectionSegments(path);
1658
1756
  return permission({
1659
1757
  entity,
1660
1758
  path,
1661
1759
  user: authController.user,
1662
1760
  authController,
1663
1761
  collection,
1664
- pathSegments
1762
+ pathSegments: collectionSegments
1665
1763
  });
1666
1764
  }
1667
1765
  console.error("Permissions:", permission);
1668
1766
  throw Error("New type of permission added and not mapped");
1669
1767
  }
1670
- function canEditEntity(collection, authController, path, entity) {
1671
- return resolvePermissions(collection, authController, path, entity)?.edit ?? DEFAULT_PERMISSIONS.edit;
1768
+ function canEditEntity(collection, authController, path, entity, pathSegments) {
1769
+ return resolvePermissions(collection, authController, path, entity, pathSegments)?.edit ?? DEFAULT_PERMISSIONS.edit;
1672
1770
  }
1673
- function canCreateEntity(collection, authController, path, entity) {
1771
+ function canCreateEntity(collection, authController, path, entity, pathSegments) {
1674
1772
  if (collection.collectionGroup) return false;
1675
- return resolvePermissions(collection, authController, path, entity)?.create ?? DEFAULT_PERMISSIONS.create;
1773
+ return resolvePermissions(collection, authController, path, entity, pathSegments)?.create ?? DEFAULT_PERMISSIONS.create;
1676
1774
  }
1677
- function canDeleteEntity(collection, authController, path, entity) {
1678
- return resolvePermissions(collection, authController, path, entity)?.delete ?? DEFAULT_PERMISSIONS.delete;
1775
+ function canDeleteEntity(collection, authController, path, entity, pathSegments) {
1776
+ return resolvePermissions(collection, authController, path, entity, pathSegments)?.delete ?? DEFAULT_PERMISSIONS.delete;
1679
1777
  }
1680
1778
  function toNumber(value) {
1681
1779
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
@@ -4647,10 +4745,10 @@ const useFireCMSContext = () => {
4647
4745
  return fireCMSContextRef.current;
4648
4746
  };
4649
4747
  function useCollectionFetch(t0) {
4650
- const $ = c(27);
4748
+ const $ = c(31);
4651
4749
  const {
4652
4750
  path: inputPath,
4653
- pathSegments,
4751
+ pathSegments: inputPathSegments,
4654
4752
  collection,
4655
4753
  filterValues,
4656
4754
  sortBy,
@@ -4660,32 +4758,43 @@ function useCollectionFetch(t0) {
4660
4758
  const dataSource = useDataSource();
4661
4759
  const navigationController = useNavigationController();
4662
4760
  let t1;
4663
- if ($[0] !== inputPath || $[1] !== navigationController) {
4664
- t1 = navigationController.resolveIdsFrom(inputPath);
4665
- $[0] = inputPath;
4761
+ if ($[0] !== inputPathSegments || $[1] !== navigationController) {
4762
+ t1 = inputPathSegments ? navigationController.resolveSegmentsFrom?.(inputPathSegments) ?? inputPathSegments : void 0;
4763
+ $[0] = inputPathSegments;
4666
4764
  $[1] = navigationController;
4667
4765
  $[2] = t1;
4668
4766
  } else {
4669
4767
  t1 = $[2];
4670
4768
  }
4671
- const path = t1;
4769
+ const pathSegments = t1;
4770
+ let t2;
4771
+ if ($[3] !== inputPath || $[4] !== inputPathSegments || $[5] !== navigationController) {
4772
+ t2 = navigationController.resolveIdsFrom(inputPath, inputPathSegments);
4773
+ $[3] = inputPath;
4774
+ $[4] = inputPathSegments;
4775
+ $[5] = navigationController;
4776
+ $[6] = t2;
4777
+ } else {
4778
+ t2 = $[6];
4779
+ }
4780
+ const path = t2;
4672
4781
  const sortByProperty = sortBy ? sortBy[0] : void 0;
4673
4782
  const currentSort = sortBy ? sortBy[1] : void 0;
4674
4783
  const context = useFireCMSContext();
4675
- let t2;
4676
- if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
4677
- t2 = [];
4678
- $[3] = t2;
4784
+ let t3;
4785
+ if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
4786
+ t3 = [];
4787
+ $[7] = t3;
4679
4788
  } else {
4680
- t2 = $[3];
4789
+ t3 = $[7];
4681
4790
  }
4682
- const [data, setData] = useState(t2);
4791
+ const [data, setData] = useState(t3);
4683
4792
  const [dataLoading, setDataLoading] = useState(false);
4684
4793
  const [dataLoadingError, setDataLoadingError] = useState();
4685
4794
  const [noMoreToLoad, setNoMoreToLoad] = useState(false);
4686
- let t3;
4687
- if ($[4] !== collection || $[5] !== context || $[6] !== currentSort || $[7] !== dataSource || $[8] !== filterValues || $[9] !== itemCount || $[10] !== path || $[11] !== pathSegments || $[12] !== searchString || $[13] !== sortByProperty) {
4688
- t3 = () => {
4795
+ let t4;
4796
+ if ($[8] !== collection || $[9] !== context || $[10] !== currentSort || $[11] !== dataSource || $[12] !== filterValues || $[13] !== itemCount || $[14] !== path || $[15] !== pathSegments || $[16] !== searchString || $[17] !== sortByProperty) {
4797
+ t4 = () => {
4689
4798
  setDataLoading(true);
4690
4799
  const onEntitiesUpdate = async (entities) => {
4691
4800
  if (pathSegments) {
@@ -4699,11 +4808,12 @@ function useCollectionFetch(t0) {
4699
4808
  entities = await Promise.all(entities.map((entity) => collection.callbacks.onFetch({
4700
4809
  collection,
4701
4810
  path,
4811
+ pathSegments,
4702
4812
  entity,
4703
4813
  context
4704
4814
  })));
4705
- } catch (t42) {
4706
- const e_0 = t42;
4815
+ } catch (t52) {
4816
+ const e_0 = t52;
4707
4817
  console.error(e_0);
4708
4818
  }
4709
4819
  }
@@ -4747,51 +4857,51 @@ function useCollectionFetch(t0) {
4747
4857
  return _temp2$f;
4748
4858
  }
4749
4859
  };
4750
- $[4] = collection;
4751
- $[5] = context;
4752
- $[6] = currentSort;
4753
- $[7] = dataSource;
4754
- $[8] = filterValues;
4755
- $[9] = itemCount;
4756
- $[10] = path;
4757
- $[11] = pathSegments;
4758
- $[12] = searchString;
4759
- $[13] = sortByProperty;
4760
- $[14] = t3;
4860
+ $[8] = collection;
4861
+ $[9] = context;
4862
+ $[10] = currentSort;
4863
+ $[11] = dataSource;
4864
+ $[12] = filterValues;
4865
+ $[13] = itemCount;
4866
+ $[14] = path;
4867
+ $[15] = pathSegments;
4868
+ $[16] = searchString;
4869
+ $[17] = sortByProperty;
4870
+ $[18] = t4;
4761
4871
  } else {
4762
- t3 = $[14];
4872
+ t4 = $[18];
4763
4873
  }
4764
- let t4;
4765
- if ($[15] !== currentSort || $[16] !== filterValues || $[17] !== itemCount || $[18] !== path || $[19] !== searchString || $[20] !== sortByProperty) {
4766
- t4 = [path, itemCount, currentSort, sortByProperty, filterValues, searchString];
4767
- $[15] = currentSort;
4768
- $[16] = filterValues;
4769
- $[17] = itemCount;
4770
- $[18] = path;
4771
- $[19] = searchString;
4772
- $[20] = sortByProperty;
4773
- $[21] = t4;
4874
+ let t5;
4875
+ if ($[19] !== currentSort || $[20] !== filterValues || $[21] !== itemCount || $[22] !== path || $[23] !== searchString || $[24] !== sortByProperty) {
4876
+ t5 = [path, itemCount, currentSort, sortByProperty, filterValues, searchString];
4877
+ $[19] = currentSort;
4878
+ $[20] = filterValues;
4879
+ $[21] = itemCount;
4880
+ $[22] = path;
4881
+ $[23] = searchString;
4882
+ $[24] = sortByProperty;
4883
+ $[25] = t5;
4774
4884
  } else {
4775
- t4 = $[21];
4885
+ t5 = $[25];
4776
4886
  }
4777
- useEffect(t3, t4);
4778
- let t5;
4779
- if ($[22] !== data || $[23] !== dataLoading || $[24] !== dataLoadingError || $[25] !== noMoreToLoad) {
4780
- t5 = {
4887
+ useEffect(t4, t5);
4888
+ let t6;
4889
+ if ($[26] !== data || $[27] !== dataLoading || $[28] !== dataLoadingError || $[29] !== noMoreToLoad) {
4890
+ t6 = {
4781
4891
  data,
4782
4892
  dataLoading,
4783
4893
  dataLoadingError,
4784
4894
  noMoreToLoad
4785
4895
  };
4786
- $[22] = data;
4787
- $[23] = dataLoading;
4788
- $[24] = dataLoadingError;
4789
- $[25] = noMoreToLoad;
4790
- $[26] = t5;
4896
+ $[26] = data;
4897
+ $[27] = dataLoading;
4898
+ $[28] = dataLoadingError;
4899
+ $[29] = noMoreToLoad;
4900
+ $[30] = t6;
4791
4901
  } else {
4792
- t5 = $[26];
4902
+ t6 = $[30];
4793
4903
  }
4794
- return t5;
4904
+ return t6;
4795
4905
  }
4796
4906
  function _temp2$f() {
4797
4907
  }
@@ -4802,7 +4912,7 @@ function _temp$D(e_1) {
4802
4912
  }
4803
4913
  const CACHE = {};
4804
4914
  function useEntityFetch(t0) {
4805
- const $ = c(19);
4915
+ const $ = c(23);
4806
4916
  const {
4807
4917
  path: inputPath,
4808
4918
  pathSegments: inputPathSegments,
@@ -4815,23 +4925,33 @@ function useEntityFetch(t0) {
4815
4925
  const dataSource = useDataSource();
4816
4926
  const navigationController = useNavigationController();
4817
4927
  let t2;
4818
- if ($[0] !== inputPath || $[1] !== navigationController) {
4819
- t2 = navigationController.resolveIdsFrom(inputPath);
4820
- $[0] = inputPath;
4928
+ if ($[0] !== inputPathSegments || $[1] !== navigationController) {
4929
+ t2 = inputPathSegments ? navigationController.resolveSegmentsFrom?.(inputPathSegments) ?? inputPathSegments : void 0;
4930
+ $[0] = inputPathSegments;
4821
4931
  $[1] = navigationController;
4822
4932
  $[2] = t2;
4823
4933
  } else {
4824
4934
  t2 = $[2];
4825
4935
  }
4826
- const path = t2;
4827
- const pathSegments = inputPathSegments;
4936
+ const pathSegments = t2;
4937
+ let t3;
4938
+ if ($[3] !== inputPath || $[4] !== inputPathSegments || $[5] !== navigationController) {
4939
+ t3 = navigationController.resolveIdsFrom(inputPath, inputPathSegments);
4940
+ $[3] = inputPath;
4941
+ $[4] = inputPathSegments;
4942
+ $[5] = navigationController;
4943
+ $[6] = t3;
4944
+ } else {
4945
+ t3 = $[6];
4946
+ }
4947
+ const path = t3;
4828
4948
  const context = useFireCMSContext();
4829
4949
  const [entity, setEntity] = useState();
4830
4950
  const [dataLoading, setDataLoading] = useState(true);
4831
4951
  const [dataLoadingError, setDataLoadingError] = useState();
4832
- let t3;
4833
- if ($[3] !== collection || $[4] !== context || $[5] !== dataSource || $[6] !== databaseId || $[7] !== entityId || $[8] !== path || $[9] !== pathSegments || $[10] !== useCache) {
4834
- t3 = () => {
4952
+ let t4;
4953
+ if ($[7] !== collection || $[8] !== context || $[9] !== dataSource || $[10] !== databaseId || $[11] !== entityId || $[12] !== path || $[13] !== pathSegments || $[14] !== useCache) {
4954
+ t4 = () => {
4835
4955
  setDataLoading(true);
4836
4956
  const onEntityUpdate = async (updatedEntity) => {
4837
4957
  if (updatedEntity && pathSegments && !updatedEntity.pathSegments) {
@@ -4845,11 +4965,12 @@ function useEntityFetch(t0) {
4845
4965
  updatedEntity = await collection.callbacks.onFetch({
4846
4966
  collection,
4847
4967
  path,
4968
+ pathSegments,
4848
4969
  entity: updatedEntity,
4849
4970
  context
4850
4971
  });
4851
- } catch (t42) {
4852
- const e = t42;
4972
+ } catch (t52) {
4973
+ const e = t52;
4853
4974
  console.error(e);
4854
4975
  }
4855
4976
  }
@@ -4897,43 +5018,43 @@ function useEntityFetch(t0) {
4897
5018
  }
4898
5019
  }
4899
5020
  };
4900
- $[3] = collection;
4901
- $[4] = context;
4902
- $[5] = dataSource;
4903
- $[6] = databaseId;
4904
- $[7] = entityId;
4905
- $[8] = path;
4906
- $[9] = pathSegments;
4907
- $[10] = useCache;
4908
- $[11] = t3;
5021
+ $[7] = collection;
5022
+ $[8] = context;
5023
+ $[9] = dataSource;
5024
+ $[10] = databaseId;
5025
+ $[11] = entityId;
5026
+ $[12] = path;
5027
+ $[13] = pathSegments;
5028
+ $[14] = useCache;
5029
+ $[15] = t4;
4909
5030
  } else {
4910
- t3 = $[11];
5031
+ t4 = $[15];
4911
5032
  }
4912
- let t4;
4913
- if ($[12] !== entityId || $[13] !== path) {
4914
- t4 = [entityId, path];
4915
- $[12] = entityId;
4916
- $[13] = path;
4917
- $[14] = t4;
5033
+ let t5;
5034
+ if ($[16] !== entityId || $[17] !== path) {
5035
+ t5 = [entityId, path];
5036
+ $[16] = entityId;
5037
+ $[17] = path;
5038
+ $[18] = t5;
4918
5039
  } else {
4919
- t4 = $[14];
5040
+ t5 = $[18];
4920
5041
  }
4921
- useEffect(t3, t4);
4922
- let t5;
4923
- if ($[15] !== dataLoading || $[16] !== dataLoadingError || $[17] !== entity) {
4924
- t5 = {
5042
+ useEffect(t4, t5);
5043
+ let t6;
5044
+ if ($[19] !== dataLoading || $[20] !== dataLoadingError || $[21] !== entity) {
5045
+ t6 = {
4925
5046
  entity,
4926
5047
  dataLoading,
4927
5048
  dataLoadingError
4928
5049
  };
4929
- $[15] = dataLoading;
4930
- $[16] = dataLoadingError;
4931
- $[17] = entity;
4932
- $[18] = t5;
5050
+ $[19] = dataLoading;
5051
+ $[20] = dataLoadingError;
5052
+ $[21] = entity;
5053
+ $[22] = t6;
4933
5054
  } else {
4934
- t5 = $[18];
5055
+ t6 = $[22];
4935
5056
  }
4936
- return t5;
5057
+ return t6;
4937
5058
  }
4938
5059
  function _temp3$5() {
4939
5060
  }
@@ -4961,7 +5082,7 @@ async function saveEntityWithCallbacks({
4961
5082
  }
4962
5083
  let updatedValues;
4963
5084
  const customizationController = context.customizationController;
4964
- const resolvedPath = context.navigation.resolveIdsFrom(path);
5085
+ const resolvedPath = context.navigation.resolveIdsFrom(path, pathSegments);
4965
5086
  const callbacks = collection.callbacks;
4966
5087
  if (callbacks?.onPreSave) {
4967
5088
  try {
@@ -4976,6 +5097,7 @@ async function saveEntityWithCallbacks({
4976
5097
  updatedValues = await callbacks.onPreSave({
4977
5098
  collection: resolvedCollection,
4978
5099
  path,
5100
+ pathSegments,
4979
5101
  resolvedPath,
4980
5102
  entityId,
4981
5103
  values,
@@ -5013,6 +5135,7 @@ async function saveEntityWithCallbacks({
5013
5135
  callbacks.onSaveSuccess({
5014
5136
  collection: resolvedCollection,
5015
5137
  path,
5138
+ pathSegments,
5016
5139
  resolvedPath,
5017
5140
  entityId: entity.id,
5018
5141
  values: updatedValues,
@@ -5038,6 +5161,7 @@ async function saveEntityWithCallbacks({
5038
5161
  callbacks.onSaveFailure({
5039
5162
  collection: resolvedCollection,
5040
5163
  path,
5164
+ pathSegments,
5041
5165
  resolvedPath,
5042
5166
  entityId,
5043
5167
  values: updatedValues,
@@ -5052,6 +5176,7 @@ async function saveEntityWithCallbacks({
5052
5176
  async function deleteEntityWithCallbacks({
5053
5177
  dataSource,
5054
5178
  entity,
5179
+ pathSegments,
5055
5180
  collection,
5056
5181
  callbacks,
5057
5182
  onDeleteSuccess,
@@ -5061,11 +5186,13 @@ async function deleteEntityWithCallbacks({
5061
5186
  context
5062
5187
  }) {
5063
5188
  console.debug("Deleting entity", entity.path, entity.id);
5189
+ const resolvedPathSegments = pathSegments ?? entity.pathSegments;
5064
5190
  const entityDeleteProps = {
5065
5191
  entity,
5066
5192
  collection,
5067
5193
  entityId: entity.id,
5068
5194
  path: entity.path,
5195
+ pathSegments: resolvedPathSegments,
5069
5196
  context
5070
5197
  };
5071
5198
  if (callbacks?.onPreDelete) {
@@ -5078,8 +5205,7 @@ async function deleteEntityWithCallbacks({
5078
5205
  }
5079
5206
  }
5080
5207
  return dataSource.deleteEntity({
5081
- // Carried by the entity from the fetch that produced it; undefined if unknown.
5082
- pathSegments: entity.pathSegments,
5208
+ pathSegments: resolvedPathSegments,
5083
5209
  entity,
5084
5210
  collection
5085
5211
  }).then(() => {
@@ -5115,7 +5241,7 @@ function resolveNavigationFrom({
5115
5241
  if (entry.type === "collection") {
5116
5242
  return Promise.resolve(entry);
5117
5243
  } else if (entry.type === "entity") {
5118
- const collection = navigation.getCollection(entry.path);
5244
+ const collection = navigation.getCollection(entry.path, false, entry.pathSegments);
5119
5245
  if (!collection) {
5120
5246
  throw Error(`No collection defined in the navigation for the entity with path ${entry.path}`);
5121
5247
  }
@@ -6522,7 +6648,7 @@ function EntityPreview({
6522
6648
  const sideEntityController = useSideEntityController();
6523
6649
  const customizationController = useCustomizationController();
6524
6650
  const navigationController = useNavigationController();
6525
- const collection = collectionProp ?? navigationController.getCollection(entity.path);
6651
+ const collection = collectionProp ?? navigationController.getCollection(entity.path, false, entity.pathSegments);
6526
6652
  if (!collection) {
6527
6653
  throw Error(`Couldn't find the corresponding collection view for the path: ${entity.path}`);
6528
6654
  }
@@ -6565,6 +6691,9 @@ function EntityPreview({
6565
6691
  sideEntityController.open({
6566
6692
  entityId: entity.id,
6567
6693
  path: entity.path,
6694
+ // Paired with `entity.path` above; undefined if the entity was
6695
+ // loaded without them.
6696
+ pathSegments: entity.pathSegments,
6568
6697
  collection,
6569
6698
  updateUrl: true
6570
6699
  });
@@ -6689,7 +6818,7 @@ const ReferencePreview = function ReferencePreview2(props) {
6689
6818
  return t0;
6690
6819
  };
6691
6820
  function ReferencePreviewInternal(t0) {
6692
- const $ = c(22);
6821
+ const $ = c(23);
6693
6822
  const {
6694
6823
  disabled,
6695
6824
  reference,
@@ -6705,70 +6834,71 @@ function ReferencePreviewInternal(t0) {
6705
6834
  const customizationController = useCustomizationController();
6706
6835
  const navigationController = useNavigationController();
6707
6836
  let t3;
6708
- if ($[0] !== navigationController || $[1] !== reference.path) {
6709
- t3 = navigationController.getCollection(reference.path);
6837
+ if ($[0] !== navigationController || $[1] !== reference.path || $[2] !== reference.pathSegments) {
6838
+ t3 = navigationController.getCollection(reference.path, false, reference.pathSegments);
6710
6839
  $[0] = navigationController;
6711
6840
  $[1] = reference.path;
6712
- $[2] = t3;
6841
+ $[2] = reference.pathSegments;
6842
+ $[3] = t3;
6713
6843
  } else {
6714
- t3 = $[2];
6844
+ t3 = $[3];
6715
6845
  }
6716
6846
  const collection = t3;
6717
6847
  if (!collection) {
6718
6848
  if (customizationController.components?.missingReference) {
6719
6849
  let t42;
6720
- if ($[3] !== customizationController.components.missingReference || $[4] !== reference.path) {
6850
+ if ($[4] !== customizationController.components.missingReference || $[5] !== reference.path) {
6721
6851
  t42 = /* @__PURE__ */ jsx(customizationController.components.missingReference, { path: reference.path });
6722
- $[3] = customizationController.components.missingReference;
6723
- $[4] = reference.path;
6724
- $[5] = t42;
6852
+ $[4] = customizationController.components.missingReference;
6853
+ $[5] = reference.path;
6854
+ $[6] = t42;
6725
6855
  } else {
6726
- t42 = $[5];
6856
+ t42 = $[6];
6727
6857
  }
6728
6858
  return t42;
6729
6859
  } else {
6730
6860
  const t42 = size ?? "medium";
6731
6861
  let t5;
6732
- if ($[6] !== reference.pathWithId) {
6862
+ if ($[7] !== reference.pathWithId) {
6733
6863
  t5 = /* @__PURE__ */ jsx(ErrorView, { error: "Unexpected reference value. Click to edit", tooltip: reference.pathWithId });
6734
- $[6] = reference.pathWithId;
6735
- $[7] = t5;
6864
+ $[7] = reference.pathWithId;
6865
+ $[8] = t5;
6736
6866
  } else {
6737
- t5 = $[7];
6867
+ t5 = $[8];
6738
6868
  }
6739
6869
  let t6;
6740
- if ($[8] !== onClick || $[9] !== t42 || $[10] !== t5) {
6870
+ if ($[9] !== onClick || $[10] !== t42 || $[11] !== t5) {
6741
6871
  t6 = /* @__PURE__ */ jsx(EntityPreviewContainer, { onClick, size: t42, children: t5 });
6742
- $[8] = onClick;
6743
- $[9] = t42;
6744
- $[10] = t5;
6745
- $[11] = t6;
6872
+ $[9] = onClick;
6873
+ $[10] = t42;
6874
+ $[11] = t5;
6875
+ $[12] = t6;
6746
6876
  } else {
6747
- t6 = $[11];
6877
+ t6 = $[12];
6748
6878
  }
6749
6879
  return t6;
6750
6880
  }
6751
6881
  }
6752
6882
  let t4;
6753
- if ($[12] !== collection || $[13] !== disabled || $[14] !== hover || $[15] !== includeEntityLink || $[16] !== includeId || $[17] !== onClick || $[18] !== previewProperties || $[19] !== reference || $[20] !== size) {
6883
+ if ($[13] !== collection || $[14] !== disabled || $[15] !== hover || $[16] !== includeEntityLink || $[17] !== includeId || $[18] !== onClick || $[19] !== previewProperties || $[20] !== reference || $[21] !== size) {
6754
6884
  t4 = /* @__PURE__ */ jsx(ReferencePreviewExisting, { reference, collection, previewProperties, size, disabled, includeEntityLink, includeId, onClick, hover });
6755
- $[12] = collection;
6756
- $[13] = disabled;
6757
- $[14] = hover;
6758
- $[15] = includeEntityLink;
6759
- $[16] = includeId;
6760
- $[17] = onClick;
6761
- $[18] = previewProperties;
6762
- $[19] = reference;
6763
- $[20] = size;
6764
- $[21] = t4;
6885
+ $[13] = collection;
6886
+ $[14] = disabled;
6887
+ $[15] = hover;
6888
+ $[16] = includeEntityLink;
6889
+ $[17] = includeId;
6890
+ $[18] = onClick;
6891
+ $[19] = previewProperties;
6892
+ $[20] = reference;
6893
+ $[21] = size;
6894
+ $[22] = t4;
6765
6895
  } else {
6766
- t4 = $[21];
6896
+ t4 = $[22];
6767
6897
  }
6768
6898
  return t4;
6769
6899
  }
6770
6900
  function ReferencePreviewExisting(t0) {
6771
- const $ = c(35);
6901
+ const $ = c(36);
6772
6902
  const {
6773
6903
  reference,
6774
6904
  collection,
@@ -6781,9 +6911,10 @@ function ReferencePreviewExisting(t0) {
6781
6911
  hover
6782
6912
  } = t0;
6783
6913
  let t1;
6784
- if ($[0] !== collection || $[1] !== reference.id || $[2] !== reference.path) {
6914
+ if ($[0] !== collection || $[1] !== reference.id || $[2] !== reference.path || $[3] !== reference.pathSegments) {
6785
6915
  t1 = {
6786
6916
  path: reference.path,
6917
+ pathSegments: reference.pathSegments,
6787
6918
  entityId: reference.id,
6788
6919
  collection,
6789
6920
  useCache: true
@@ -6791,9 +6922,10 @@ function ReferencePreviewExisting(t0) {
6791
6922
  $[0] = collection;
6792
6923
  $[1] = reference.id;
6793
6924
  $[2] = reference.path;
6794
- $[3] = t1;
6925
+ $[3] = reference.pathSegments;
6926
+ $[4] = t1;
6795
6927
  } else {
6796
- t1 = $[3];
6928
+ t1 = $[4];
6797
6929
  }
6798
6930
  const {
6799
6931
  entity,
@@ -6803,34 +6935,34 @@ function ReferencePreviewExisting(t0) {
6803
6935
  referencesCache.set(reference.pathWithId, entity);
6804
6936
  }
6805
6937
  let t2;
6806
- if ($[4] !== entity || $[5] !== reference.pathWithId) {
6938
+ if ($[5] !== entity || $[6] !== reference.pathWithId) {
6807
6939
  t2 = entity ?? referencesCache.get(reference.pathWithId);
6808
- $[4] = entity;
6809
- $[5] = reference.pathWithId;
6810
- $[6] = t2;
6940
+ $[5] = entity;
6941
+ $[6] = reference.pathWithId;
6942
+ $[7] = t2;
6811
6943
  } else {
6812
- t2 = $[6];
6944
+ t2 = $[7];
6813
6945
  }
6814
6946
  const usedEntity = t2;
6815
6947
  let body;
6816
6948
  if (!reference) {
6817
6949
  let t32;
6818
- if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6950
+ if ($[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6819
6951
  t32 = /* @__PURE__ */ jsx(ErrorView, { error: "Reference not set" });
6820
- $[7] = t32;
6952
+ $[8] = t32;
6821
6953
  } else {
6822
- t32 = $[7];
6954
+ t32 = $[8];
6823
6955
  }
6824
6956
  body = t32;
6825
6957
  } else {
6826
6958
  if (usedEntity && !usedEntity.values) {
6827
6959
  let t32;
6828
- if ($[8] !== reference.path) {
6960
+ if ($[9] !== reference.path) {
6829
6961
  t32 = /* @__PURE__ */ jsx(ErrorView, { error: "Reference does not exist", tooltip: reference.path });
6830
- $[8] = reference.path;
6831
- $[9] = t32;
6962
+ $[9] = reference.path;
6963
+ $[10] = t32;
6832
6964
  } else {
6833
- t32 = $[9];
6965
+ t32 = $[10];
6834
6966
  }
6835
6967
  body = t32;
6836
6968
  }
@@ -6839,15 +6971,15 @@ function ReferencePreviewExisting(t0) {
6839
6971
  const t32 = disabled ? void 0 : onClick;
6840
6972
  const t4 = disabled ? void 0 : hover;
6841
6973
  let t5;
6842
- if ($[10] !== body || $[11] !== size || $[12] !== t32 || $[13] !== t4) {
6974
+ if ($[11] !== body || $[12] !== size || $[13] !== t32 || $[14] !== t4) {
6843
6975
  t5 = /* @__PURE__ */ jsx(EntityPreviewContainer, { onClick: t32, hover: t4, size, children: body });
6844
- $[10] = body;
6845
- $[11] = size;
6846
- $[12] = t32;
6847
- $[13] = t4;
6848
- $[14] = t5;
6976
+ $[11] = body;
6977
+ $[12] = size;
6978
+ $[13] = t32;
6979
+ $[14] = t4;
6980
+ $[15] = t5;
6849
6981
  } else {
6850
- t5 = $[14];
6982
+ t5 = $[15];
6851
6983
  }
6852
6984
  return t5;
6853
6985
  }
@@ -6855,21 +6987,21 @@ function ReferencePreviewExisting(t0) {
6855
6987
  const t32 = disabled ? void 0 : onClick;
6856
6988
  const t4 = disabled ? void 0 : hover;
6857
6989
  let t5;
6858
- if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6990
+ if ($[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6859
6991
  t5 = /* @__PURE__ */ jsx(Skeleton, {});
6860
- $[15] = t5;
6992
+ $[16] = t5;
6861
6993
  } else {
6862
- t5 = $[15];
6994
+ t5 = $[16];
6863
6995
  }
6864
6996
  let t6;
6865
- if ($[16] !== size || $[17] !== t32 || $[18] !== t4) {
6997
+ if ($[17] !== size || $[18] !== t32 || $[19] !== t4) {
6866
6998
  t6 = /* @__PURE__ */ jsx(EntityPreviewContainer, { onClick: t32, hover: t4, size, children: t5 });
6867
- $[16] = size;
6868
- $[17] = t32;
6869
- $[18] = t4;
6870
- $[19] = t6;
6999
+ $[17] = size;
7000
+ $[18] = t32;
7001
+ $[19] = t4;
7002
+ $[20] = t6;
6871
7003
  } else {
6872
- t6 = $[19];
7004
+ t6 = $[20];
6873
7005
  }
6874
7006
  return t6;
6875
7007
  }
@@ -6877,39 +7009,39 @@ function ReferencePreviewExisting(t0) {
6877
7009
  const t32 = disabled ? void 0 : onClick;
6878
7010
  const t4 = disabled ? void 0 : hover;
6879
7011
  let t5;
6880
- if ($[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
7012
+ if ($[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6881
7013
  t5 = /* @__PURE__ */ jsx(ErrorView, { error: "Entity not found" });
6882
- $[20] = t5;
7014
+ $[21] = t5;
6883
7015
  } else {
6884
- t5 = $[20];
7016
+ t5 = $[21];
6885
7017
  }
6886
7018
  let t6;
6887
- if ($[21] !== size || $[22] !== t32 || $[23] !== t4) {
7019
+ if ($[22] !== size || $[23] !== t32 || $[24] !== t4) {
6888
7020
  t6 = /* @__PURE__ */ jsx(EntityPreviewContainer, { onClick: t32, hover: t4, size, children: t5 });
6889
- $[21] = size;
6890
- $[22] = t32;
6891
- $[23] = t4;
6892
- $[24] = t6;
7021
+ $[22] = size;
7022
+ $[23] = t32;
7023
+ $[24] = t4;
7024
+ $[25] = t6;
6893
7025
  } else {
6894
- t6 = $[24];
7026
+ t6 = $[25];
6895
7027
  }
6896
7028
  return t6;
6897
7029
  }
6898
7030
  let t3;
6899
- if ($[25] !== collection || $[26] !== disabled || $[27] !== hover || $[28] !== includeEntityLink || $[29] !== includeId || $[30] !== onClick || $[31] !== previewProperties || $[32] !== size || $[33] !== usedEntity) {
7031
+ if ($[26] !== collection || $[27] !== disabled || $[28] !== hover || $[29] !== includeEntityLink || $[30] !== includeId || $[31] !== onClick || $[32] !== previewProperties || $[33] !== size || $[34] !== usedEntity) {
6900
7032
  t3 = /* @__PURE__ */ jsx(EntityPreview, { size, previewKeys: previewProperties, disabled, entity: usedEntity, collection, onClick, includeEntityLink, includeId, hover });
6901
- $[25] = collection;
6902
- $[26] = disabled;
6903
- $[27] = hover;
6904
- $[28] = includeEntityLink;
6905
- $[29] = includeId;
6906
- $[30] = onClick;
6907
- $[31] = previewProperties;
6908
- $[32] = size;
6909
- $[33] = usedEntity;
6910
- $[34] = t3;
7033
+ $[26] = collection;
7034
+ $[27] = disabled;
7035
+ $[28] = hover;
7036
+ $[29] = includeEntityLink;
7037
+ $[30] = includeId;
7038
+ $[31] = onClick;
7039
+ $[32] = previewProperties;
7040
+ $[33] = size;
7041
+ $[34] = usedEntity;
7042
+ $[35] = t3;
6911
7043
  } else {
6912
- t3 = $[34];
7044
+ t3 = $[35];
6913
7045
  }
6914
7046
  return t3;
6915
7047
  }
@@ -16820,6 +16952,7 @@ function EntityForm({
16820
16952
  entityId: entityIdProp,
16821
16953
  collection,
16822
16954
  path,
16955
+ pathSegments,
16823
16956
  values: valuesToBeSaved
16824
16957
  });
16825
16958
  }, false, 2e3);
@@ -16993,6 +17126,7 @@ function EntityForm({
16993
17126
  entity: updatedEntity,
16994
17127
  status,
16995
17128
  path,
17129
+ pathSegments,
16996
17130
  entityId: updatedEntity.id,
16997
17131
  collection
16998
17132
  });
@@ -17011,10 +17145,12 @@ function EntityForm({
17011
17145
  previousValues,
17012
17146
  entityId: entityId_0,
17013
17147
  collection: collection_0,
17014
- path: path_0
17148
+ path: path_0,
17149
+ pathSegments: pathSegments_0
17015
17150
  }) => {
17016
17151
  return saveEntityWithCallbacks({
17017
17152
  path: path_0,
17153
+ pathSegments: pathSegments_0,
17018
17154
  entityId: entityId_0,
17019
17155
  values: values_2,
17020
17156
  previousValues,
@@ -17031,6 +17167,7 @@ function EntityForm({
17031
17167
  const onSaveEntityRequest = async ({
17032
17168
  collection: collection_1,
17033
17169
  path: path_1,
17170
+ pathSegments: pathSegments_1,
17034
17171
  entityId: entityId_1,
17035
17172
  values: values_3,
17036
17173
  previousValues: previousValues_0,
@@ -17043,6 +17180,7 @@ function EntityForm({
17043
17180
  return saveEntity({
17044
17181
  collection: collection_1,
17045
17182
  path: path_1,
17183
+ pathSegments: pathSegments_1,
17046
17184
  entityId: entityId_1,
17047
17185
  values: values_3,
17048
17186
  previousValues: previousValues_0
@@ -17055,6 +17193,7 @@ function EntityForm({
17055
17193
  return onSaveEntityRequest({
17056
17194
  collection: resolvedCollection,
17057
17195
  path,
17196
+ pathSegments,
17058
17197
  entityId,
17059
17198
  values: values_4,
17060
17199
  previousValues: entity?.values,
@@ -17099,12 +17238,13 @@ function EntityForm({
17099
17238
  const pluginBeforeTitle = [];
17100
17239
  const plugins = customizationController.plugins;
17101
17240
  const actionsDisabled = disabled || formex.isSubmitting || status === "existing" && !formex.dirty || Boolean(disabledProp);
17102
- const parentCollectionIds = navigationController.getParentCollectionIds(path);
17241
+ const parentCollectionIds = navigationController.getParentCollectionIds(path, pathSegments);
17103
17242
  if (plugins && collection) {
17104
17243
  const actionProps = {
17105
17244
  entityId,
17106
17245
  parentCollectionIds,
17107
17246
  path,
17247
+ pathSegments,
17108
17248
  status,
17109
17249
  collection,
17110
17250
  context,
@@ -17253,7 +17393,7 @@ function EntityForm({
17253
17393
  if (!resolvedCollection || !path) {
17254
17394
  throw Error("INTERNAL: Collection and path must be defined in form context");
17255
17395
  }
17256
- const dialogActions = /* @__PURE__ */ jsx(EntityFormActionsComponent, { collection: resolvedCollection, path, fullPath: path, fullIdPath, entity, layout: forceActionsAtTheBottom ? "bottom" : "side", savingError, formex, disabled: actionsDisabled, status, pluginActions: pluginActions ?? [], openEntityMode, showDefaultActions, navigateBack, formContext });
17396
+ const dialogActions = /* @__PURE__ */ jsx(EntityFormActionsComponent, { collection: resolvedCollection, path, pathSegments, fullPath: path, fullIdPath, entity, layout: forceActionsAtTheBottom ? "bottom" : "side", savingError, formex, disabled: actionsDisabled, status, pluginActions: pluginActions ?? [], openEntityMode, showDefaultActions, navigateBack, formContext });
17257
17397
  return /* @__PURE__ */ jsx(Formex, { value: formex, children: /* @__PURE__ */ jsxs("form", { onSubmit: formex.handleSubmit, onReset: () => formex.resetForm({
17258
17398
  values: baseInitialValues
17259
17399
  }), noValidate: true, className: cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", className), children: [
@@ -20116,8 +20256,8 @@ function useDataSourceTableController({
20116
20256
  const [popupCell, setPopupCell] = React__default.useState(void 0);
20117
20257
  const navigation = useNavigationController();
20118
20258
  const dataSource = useDataSource();
20119
- const resolvedPath = useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
20120
- const resolvedPathSegments = pathSegments;
20259
+ const resolvedPath = useMemo(() => navigation.resolveIdsFrom(fullPath, pathSegments), [fullPath, pathSegments, navigation.resolveIdsFrom]);
20260
+ const resolvedPathSegments = useMemo(() => pathSegments ? navigation.resolveSegmentsFrom?.(pathSegments) ?? pathSegments : void 0, [pathSegments, navigation.resolveSegmentsFrom]);
20121
20261
  const forceFilter = forceFilterFromProps ?? forceFilterFromCollection;
20122
20262
  const paginationEnabled = collection.pagination === void 0 || Boolean(collection.pagination);
20123
20263
  const pageSize = typeof collection.pagination === "number" ? collection.pagination : DEFAULT_PAGE_SIZE$1;
@@ -20225,6 +20365,7 @@ function useDataSourceTableController({
20225
20365
  entities = await Promise.all(entities.map((entity) => collection.callbacks.onFetch({
20226
20366
  collection,
20227
20367
  path: resolvedPath,
20368
+ pathSegments: resolvedPathSegments,
20228
20369
  entity,
20229
20370
  context
20230
20371
  })));
@@ -20381,10 +20522,11 @@ function useSelectionController(onSelectionChange) {
20381
20522
  };
20382
20523
  }
20383
20524
  function useTableSearchHelper(t0) {
20384
- const $ = c(18);
20525
+ const $ = c(19);
20385
20526
  const {
20386
20527
  collection,
20387
20528
  fullPath,
20529
+ pathSegments,
20388
20530
  parentCollectionIds,
20389
20531
  initialSearchString
20390
20532
  } = t0;
@@ -20396,11 +20538,12 @@ function useTableSearchHelper(t0) {
20396
20538
  const autoInitialisedRef = useRef(false);
20397
20539
  let onTextSearchClick;
20398
20540
  let textSearchEnabled;
20399
- if ($[0] !== collection || $[1] !== context || $[2] !== customizationController.plugins || $[3] !== dataSource || $[4] !== fullPath || $[5] !== parentCollectionIds) {
20541
+ if ($[0] !== collection || $[1] !== context || $[2] !== customizationController.plugins || $[3] !== dataSource || $[4] !== fullPath || $[5] !== parentCollectionIds || $[6] !== pathSegments) {
20400
20542
  textSearchEnabled = Boolean(collection.textSearchEnabled);
20401
20543
  const props = {
20402
20544
  context,
20403
20545
  path: fullPath,
20546
+ pathSegments,
20404
20547
  databaseId: collection.databaseId,
20405
20548
  collection,
20406
20549
  parentCollectionIds
@@ -20420,6 +20563,7 @@ function useTableSearchHelper(t0) {
20420
20563
  promises.push(p_1.collectionView.onTextSearchClick({
20421
20564
  context,
20422
20565
  path: fullPath,
20566
+ pathSegments,
20423
20567
  collection,
20424
20568
  parentCollectionIds
20425
20569
  }));
@@ -20451,15 +20595,16 @@ function useTableSearchHelper(t0) {
20451
20595
  $[3] = dataSource;
20452
20596
  $[4] = fullPath;
20453
20597
  $[5] = parentCollectionIds;
20454
- $[6] = onTextSearchClick;
20455
- $[7] = textSearchEnabled;
20598
+ $[6] = pathSegments;
20599
+ $[7] = onTextSearchClick;
20600
+ $[8] = textSearchEnabled;
20456
20601
  } else {
20457
- onTextSearchClick = $[6];
20458
- textSearchEnabled = $[7];
20602
+ onTextSearchClick = $[7];
20603
+ textSearchEnabled = $[8];
20459
20604
  }
20460
20605
  const shouldAutoInitialise = Boolean(initialSearchString) && textSearchEnabled && !textSearchInitialised && Boolean(onTextSearchClick);
20461
20606
  let t1;
20462
- if ($[8] !== onTextSearchClick || $[9] !== shouldAutoInitialise) {
20607
+ if ($[9] !== onTextSearchClick || $[10] !== shouldAutoInitialise) {
20463
20608
  t1 = () => {
20464
20609
  if (autoInitialisedRef.current || !shouldAutoInitialise) {
20465
20610
  return;
@@ -20467,36 +20612,36 @@ function useTableSearchHelper(t0) {
20467
20612
  autoInitialisedRef.current = true;
20468
20613
  onTextSearchClick?.();
20469
20614
  };
20470
- $[8] = onTextSearchClick;
20471
- $[9] = shouldAutoInitialise;
20472
- $[10] = t1;
20615
+ $[9] = onTextSearchClick;
20616
+ $[10] = shouldAutoInitialise;
20617
+ $[11] = t1;
20473
20618
  } else {
20474
- t1 = $[10];
20619
+ t1 = $[11];
20475
20620
  }
20476
20621
  let t2;
20477
- if ($[11] !== shouldAutoInitialise) {
20622
+ if ($[12] !== shouldAutoInitialise) {
20478
20623
  t2 = [shouldAutoInitialise];
20479
- $[11] = shouldAutoInitialise;
20480
- $[12] = t2;
20624
+ $[12] = shouldAutoInitialise;
20625
+ $[13] = t2;
20481
20626
  } else {
20482
- t2 = $[12];
20627
+ t2 = $[13];
20483
20628
  }
20484
20629
  useEffect(t1, t2);
20485
20630
  let t3;
20486
- if ($[13] !== onTextSearchClick || $[14] !== textSearchEnabled || $[15] !== textSearchInitialised || $[16] !== textSearchLoading) {
20631
+ if ($[14] !== onTextSearchClick || $[15] !== textSearchEnabled || $[16] !== textSearchInitialised || $[17] !== textSearchLoading) {
20487
20632
  t3 = {
20488
20633
  textSearchLoading,
20489
20634
  textSearchInitialised,
20490
20635
  onTextSearchClick,
20491
20636
  textSearchEnabled
20492
20637
  };
20493
- $[13] = onTextSearchClick;
20494
- $[14] = textSearchEnabled;
20495
- $[15] = textSearchInitialised;
20496
- $[16] = textSearchLoading;
20497
- $[17] = t3;
20638
+ $[14] = onTextSearchClick;
20639
+ $[15] = textSearchEnabled;
20640
+ $[16] = textSearchInitialised;
20641
+ $[17] = textSearchLoading;
20642
+ $[18] = t3;
20498
20643
  } else {
20499
- t3 = $[17];
20644
+ t3 = $[18];
20500
20645
  }
20501
20646
  return t3;
20502
20647
  }
@@ -20565,6 +20710,8 @@ function DeleteEntityDialog({
20565
20710
  const performDelete = useCallback((entity_3) => deleteEntityWithCallbacks({
20566
20711
  dataSource,
20567
20712
  entity: entity_3,
20713
+ // The entity is the authority on where it lives; stated rather than left implicit.
20714
+ pathSegments: entity_3.pathSegments,
20568
20715
  collection: resolvedCollection,
20569
20716
  callbacks,
20570
20717
  onDeleteSuccess,
@@ -20666,6 +20813,7 @@ const editEntityAction = {
20666
20813
  entity,
20667
20814
  collection,
20668
20815
  fullPath,
20816
+ pathSegments,
20669
20817
  fullIdPath,
20670
20818
  context,
20671
20819
  highlightEntity,
@@ -20684,6 +20832,7 @@ const editEntityAction = {
20684
20832
  addRecentId(collection.id, entity.id);
20685
20833
  }
20686
20834
  const path = collection?.collectionGroup ? entity.path : fullPath ?? collection?.path ?? entity.path;
20835
+ const resolvedPathSegments = collection?.collectionGroup ? entity.pathSegments : pathSegments ?? entity.pathSegments;
20687
20836
  const newFullIdPath = collection?.collectionGroup ? collection.id : fullIdPath ?? collection?.id ?? entity.path;
20688
20837
  const defaultSelectedView = resolveDefaultSelectedView(collection ? collection.defaultSelectedView : void 0, {
20689
20838
  status: "existing",
@@ -20694,6 +20843,7 @@ const editEntityAction = {
20694
20843
  collection,
20695
20844
  entityId: entity.id,
20696
20845
  path,
20846
+ pathSegments: resolvedPathSegments,
20697
20847
  fullIdPath: newFullIdPath,
20698
20848
  sideEntityController: context.sideEntityController,
20699
20849
  onClose: () => unhighlightEntity?.(entity),
@@ -20715,6 +20865,7 @@ const copyEntityAction = {
20715
20865
  collection,
20716
20866
  context,
20717
20867
  fullPath,
20868
+ pathSegments,
20718
20869
  highlightEntity,
20719
20870
  unhighlightEntity,
20720
20871
  openEntityMode
@@ -20728,12 +20879,14 @@ const copyEntityAction = {
20728
20879
  entityId: entity.id
20729
20880
  });
20730
20881
  const path = collection?.collectionGroup ? collection.path : fullPath ?? collection?.path ?? entity.path;
20882
+ const resolvedPathSegments = collection?.collectionGroup ? void 0 : pathSegments ?? entity.pathSegments;
20731
20883
  const fullIdPath = collection?.collectionGroup ? collection.id : fullPath ?? collection?.id ?? entity.path;
20732
20884
  navigateToEntity({
20733
20885
  openEntityMode,
20734
20886
  collection,
20735
20887
  entityId: entity.id,
20736
20888
  path,
20889
+ pathSegments: resolvedPathSegments,
20737
20890
  fullIdPath,
20738
20891
  copy: true,
20739
20892
  sideEntityController: context.sideEntityController,
@@ -20804,7 +20957,7 @@ function ReferenceSelectionTable({
20804
20957
  const navigation = useNavigationController();
20805
20958
  const analyticsController = useAnalyticsController();
20806
20959
  const customizationController = useCustomizationController();
20807
- const fullPath = navigation.resolveIdsFrom(pathInput);
20960
+ const fullPath = navigation.resolveIdsFrom(pathInput, pathSegments);
20808
20961
  const dataSource = useDataSource();
20809
20962
  const [entitiesDisplayedFirst, setEntitiesDisplayedFirst] = useState([]);
20810
20963
  const toggleEntitySelection = (entity) => {
@@ -20879,6 +21032,7 @@ function ReferenceSelectionTable({
20879
21032
  });
20880
21033
  sideEntityController.open({
20881
21034
  path: fullPath,
21035
+ pathSegments,
20882
21036
  collection,
20883
21037
  updateUrl: true,
20884
21038
  onUpdate: ({
@@ -20928,6 +21082,7 @@ function ReferenceSelectionTable({
20928
21082
  onTextSearchClick,
20929
21083
  textSearchEnabled
20930
21084
  } = useTableSearchHelper({
21085
+ pathSegments,
20931
21086
  collection,
20932
21087
  fullPath
20933
21088
  });
@@ -20939,7 +21094,7 @@ function ReferenceSelectionTable({
20939
21094
  }) : t("select_from", {
20940
21095
  name: collection.name
20941
21096
  })
20942
- ] }), defaultSize: collection.defaultSize, properties: resolvedCollection.properties, forceFilter, inlineEditing: false, selectionController, actions: /* @__PURE__ */ jsx(ReferenceDialogActions, { collection, path: fullPath, onNewClick, onClear }) }) }),
21097
+ ] }), defaultSize: collection.defaultSize, properties: resolvedCollection.properties, forceFilter, inlineEditing: false, selectionController, actions: /* @__PURE__ */ jsx(ReferenceDialogActions, { collection, path: fullPath, pathSegments, onNewClick, onClear }) }) }),
20943
21098
  /* @__PURE__ */ jsxs(DialogActions, { translucent: false, children: [
20944
21099
  description && /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "flex-grow text-left", children: description }),
20945
21100
  /* @__PURE__ */ jsx(Button, { onClick: onDone, variant: "filled", children: t("done") })
@@ -20947,10 +21102,11 @@ function ReferenceSelectionTable({
20947
21102
  ] });
20948
21103
  }
20949
21104
  function ReferenceDialogActions(t0) {
20950
- const $ = c(17);
21105
+ const $ = c(18);
20951
21106
  const {
20952
21107
  collection,
20953
21108
  path,
21109
+ pathSegments,
20954
21110
  onClear,
20955
21111
  onNewClick
20956
21112
  } = t0;
@@ -20972,8 +21128,8 @@ function ReferenceDialogActions(t0) {
20972
21128
  }
20973
21129
  const onClick = t1;
20974
21130
  let t2;
20975
- if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onClick || $[6] !== path || $[7] !== t) {
20976
- t2 = canCreateEntity(collection, authController, path, null) && onClick && (largeLayout ? /* @__PURE__ */ jsx(Button, { onClick, startIcon: /* @__PURE__ */ jsx(AddIcon, {}), children: t("add_specific", {
21131
+ if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onClick || $[6] !== path || $[7] !== pathSegments || $[8] !== t) {
21132
+ t2 = canCreateEntity(collection, authController, path, null, pathSegments) && onClick && (largeLayout ? /* @__PURE__ */ jsx(Button, { onClick, startIcon: /* @__PURE__ */ jsx(AddIcon, {}), children: t("add_specific", {
20977
21133
  name: collection.singularName ?? collection.name
20978
21134
  }) }) : /* @__PURE__ */ jsx(Button, { onClick, children: /* @__PURE__ */ jsx(AddIcon, {}) }));
20979
21135
  $[2] = authController;
@@ -20981,40 +21137,41 @@ function ReferenceDialogActions(t0) {
20981
21137
  $[4] = largeLayout;
20982
21138
  $[5] = onClick;
20983
21139
  $[6] = path;
20984
- $[7] = t;
20985
- $[8] = t2;
21140
+ $[7] = pathSegments;
21141
+ $[8] = t;
21142
+ $[9] = t2;
20986
21143
  } else {
20987
- t2 = $[8];
21144
+ t2 = $[9];
20988
21145
  }
20989
21146
  const addButton = t2;
20990
21147
  let t3;
20991
- if ($[9] !== t) {
21148
+ if ($[10] !== t) {
20992
21149
  t3 = t("clear");
20993
- $[9] = t;
20994
- $[10] = t3;
21150
+ $[10] = t;
21151
+ $[11] = t3;
20995
21152
  } else {
20996
- t3 = $[10];
21153
+ t3 = $[11];
20997
21154
  }
20998
21155
  let t4;
20999
- if ($[11] !== onClear || $[12] !== t3) {
21156
+ if ($[12] !== onClear || $[13] !== t3) {
21000
21157
  t4 = /* @__PURE__ */ jsx(Button, { onClick: onClear, variant: "text", children: t3 });
21001
- $[11] = onClear;
21002
- $[12] = t3;
21003
- $[13] = t4;
21158
+ $[12] = onClear;
21159
+ $[13] = t3;
21160
+ $[14] = t4;
21004
21161
  } else {
21005
- t4 = $[13];
21162
+ t4 = $[14];
21006
21163
  }
21007
21164
  let t5;
21008
- if ($[14] !== addButton || $[15] !== t4) {
21165
+ if ($[15] !== addButton || $[16] !== t4) {
21009
21166
  t5 = /* @__PURE__ */ jsxs(Fragment, { children: [
21010
21167
  t4,
21011
21168
  addButton
21012
21169
  ] });
21013
- $[14] = addButton;
21014
- $[15] = t4;
21015
- $[16] = t5;
21170
+ $[15] = addButton;
21171
+ $[16] = t4;
21172
+ $[17] = t5;
21016
21173
  } else {
21017
- t5 = $[16];
21174
+ t5 = $[17];
21018
21175
  }
21019
21176
  return t5;
21020
21177
  }
@@ -22930,7 +23087,7 @@ const useBreadcrumbsController = () => {
22930
23087
  return useContext(BreadcrumbContext);
22931
23088
  };
22932
23089
  function EntityCollectionViewActions(t0) {
22933
- const $ = c(45);
23090
+ const $ = c(48);
22934
23091
  const {
22935
23092
  collection,
22936
23093
  relativePath,
@@ -22939,6 +23096,7 @@ function EntityCollectionViewActions(t0) {
22939
23096
  onMultipleDeleteClick,
22940
23097
  selectionEnabled,
22941
23098
  path,
23099
+ pathSegments,
22942
23100
  selectionController,
22943
23101
  tableController,
22944
23102
  collectionEntitiesCount
@@ -22961,8 +23119,8 @@ function EntityCollectionViewActions(t0) {
22961
23119
  const largeLayout = useLargeLayout();
22962
23120
  const selectedEntities = selectionController.selectedEntities;
22963
23121
  let t2;
22964
- if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onNewClick || $[6] !== path || $[7] !== t) {
22965
- t2 = canCreateEntity(collection, authController, path, null) && onNewClick && (largeLayout ? /* @__PURE__ */ jsxs(Button, { id: `add_entity_${path}`, onClick: onNewClick, startIcon: /* @__PURE__ */ jsx(AddIcon, { size: "small" }), variant: "filled", color: "primary", children: [
23122
+ if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onNewClick || $[6] !== path || $[7] !== pathSegments || $[8] !== t) {
23123
+ t2 = canCreateEntity(collection, authController, path, null, pathSegments) && onNewClick && (largeLayout ? /* @__PURE__ */ jsxs(Button, { id: `add_entity_${path}`, onClick: onNewClick, startIcon: /* @__PURE__ */ jsx(AddIcon, { size: "small" }), variant: "filled", color: "primary", children: [
22966
23124
  t("add"),
22967
23125
  " ",
22968
23126
  collection.singularName ?? collection.name
@@ -22972,65 +23130,68 @@ function EntityCollectionViewActions(t0) {
22972
23130
  $[4] = largeLayout;
22973
23131
  $[5] = onNewClick;
22974
23132
  $[6] = path;
22975
- $[7] = t;
22976
- $[8] = t2;
23133
+ $[7] = pathSegments;
23134
+ $[8] = t;
23135
+ $[9] = t2;
22977
23136
  } else {
22978
- t2 = $[8];
23137
+ t2 = $[9];
22979
23138
  }
22980
23139
  const addButton = t2;
22981
23140
  let t3;
22982
- if ($[9] !== authController || $[10] !== collection || $[11] !== path) {
22983
- t3 = canDeleteEntity(collection, authController, path, null);
22984
- $[9] = authController;
22985
- $[10] = collection;
22986
- $[11] = path;
22987
- $[12] = t3;
23141
+ if ($[10] !== authController || $[11] !== collection || $[12] !== path || $[13] !== pathSegments) {
23142
+ t3 = canDeleteEntity(collection, authController, path, null, pathSegments);
23143
+ $[10] = authController;
23144
+ $[11] = collection;
23145
+ $[12] = path;
23146
+ $[13] = pathSegments;
23147
+ $[14] = t3;
22988
23148
  } else {
22989
- t3 = $[12];
23149
+ t3 = $[14];
22990
23150
  }
22991
23151
  const multipleDeleteEnabled = t3;
22992
23152
  let multipleDeleteButton;
22993
23153
  if (selectionEnabled) {
22994
23154
  let t42;
22995
- if ($[13] !== largeLayout || $[14] !== multipleDeleteEnabled || $[15] !== onMultipleDeleteClick || $[16] !== selectedEntities?.length) {
23155
+ if ($[15] !== largeLayout || $[16] !== multipleDeleteEnabled || $[17] !== onMultipleDeleteClick || $[18] !== selectedEntities?.length) {
22996
23156
  t42 = largeLayout ? /* @__PURE__ */ jsxs(Button, { variant: "text", disabled: !selectedEntities?.length || !multipleDeleteEnabled, startIcon: /* @__PURE__ */ jsx(DeleteIcon, { size: "small" }), onClick: onMultipleDeleteClick, color: "primary", className: "lg:w-20", children: [
22997
23157
  "(",
22998
23158
  selectedEntities?.length,
22999
23159
  ")"
23000
23160
  ] }) : /* @__PURE__ */ jsx(IconButton, { size: "small", color: "primary", disabled: !selectedEntities?.length || !multipleDeleteEnabled, onClick: onMultipleDeleteClick, children: /* @__PURE__ */ jsx(DeleteIcon, { size: "small" }) });
23001
- $[13] = largeLayout;
23002
- $[14] = multipleDeleteEnabled;
23003
- $[15] = onMultipleDeleteClick;
23004
- $[16] = selectedEntities?.length;
23005
- $[17] = t42;
23161
+ $[15] = largeLayout;
23162
+ $[16] = multipleDeleteEnabled;
23163
+ $[17] = onMultipleDeleteClick;
23164
+ $[18] = selectedEntities?.length;
23165
+ $[19] = t42;
23006
23166
  } else {
23007
- t42 = $[17];
23167
+ t42 = $[19];
23008
23168
  }
23009
23169
  const button = t42;
23010
23170
  let t52;
23011
- if ($[18] !== multipleDeleteEnabled || $[19] !== t) {
23171
+ if ($[20] !== multipleDeleteEnabled || $[21] !== t) {
23012
23172
  t52 = multipleDeleteEnabled ? t("delete_selected") : t("cannot_delete_selected");
23013
- $[18] = multipleDeleteEnabled;
23014
- $[19] = t;
23015
- $[20] = t52;
23173
+ $[20] = multipleDeleteEnabled;
23174
+ $[21] = t;
23175
+ $[22] = t52;
23016
23176
  } else {
23017
- t52 = $[20];
23177
+ t52 = $[22];
23018
23178
  }
23019
23179
  let t62;
23020
- if ($[21] !== button || $[22] !== t52) {
23180
+ if ($[23] !== button || $[24] !== t52) {
23021
23181
  t62 = /* @__PURE__ */ jsx(Tooltip, { title: t52, children: button });
23022
- $[21] = button;
23023
- $[22] = t52;
23024
- $[23] = t62;
23182
+ $[23] = button;
23183
+ $[24] = t52;
23184
+ $[25] = t62;
23025
23185
  } else {
23026
- t62 = $[23];
23186
+ t62 = $[25];
23027
23187
  }
23028
23188
  multipleDeleteButton = t62;
23029
23189
  }
23030
23190
  let t4;
23031
- if ($[24] !== collection || $[25] !== collectionEntitiesCount || $[26] !== context || $[27] !== parentCollectionIds || $[28] !== path || $[29] !== relativePath || $[30] !== selectionController || $[31] !== tableController) {
23191
+ if ($[26] !== collection || $[27] !== collectionEntitiesCount || $[28] !== context || $[29] !== parentCollectionIds || $[30] !== path || $[31] !== pathSegments || $[32] !== relativePath || $[33] !== selectionController || $[34] !== tableController) {
23032
23192
  t4 = {
23033
23193
  path,
23194
+ pathSegments,
23034
23195
  relativePath,
23035
23196
  parentCollectionIds,
23036
23197
  collection,
@@ -23039,28 +23200,29 @@ function EntityCollectionViewActions(t0) {
23039
23200
  tableController,
23040
23201
  collectionEntitiesCount
23041
23202
  };
23042
- $[24] = collection;
23043
- $[25] = collectionEntitiesCount;
23044
- $[26] = context;
23045
- $[27] = parentCollectionIds;
23046
- $[28] = path;
23047
- $[29] = relativePath;
23048
- $[30] = selectionController;
23049
- $[31] = tableController;
23050
- $[32] = t4;
23203
+ $[26] = collection;
23204
+ $[27] = collectionEntitiesCount;
23205
+ $[28] = context;
23206
+ $[29] = parentCollectionIds;
23207
+ $[30] = path;
23208
+ $[31] = pathSegments;
23209
+ $[32] = relativePath;
23210
+ $[33] = selectionController;
23211
+ $[34] = tableController;
23212
+ $[35] = t4;
23051
23213
  } else {
23052
- t4 = $[32];
23214
+ t4 = $[35];
23053
23215
  }
23054
23216
  const actionProps = t4;
23055
23217
  let actions;
23056
- if ($[33] !== actionProps || $[34] !== collection.Actions || $[35] !== plugins) {
23218
+ if ($[36] !== actionProps || $[37] !== collection.Actions || $[38] !== plugins) {
23057
23219
  let t52;
23058
- if ($[37] !== actionProps) {
23220
+ if ($[40] !== actionProps) {
23059
23221
  t52 = (Action, i) => /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Action, { ...actionProps }) }, `actions_${i}`);
23060
- $[37] = actionProps;
23061
- $[38] = t52;
23222
+ $[40] = actionProps;
23223
+ $[41] = t52;
23062
23224
  } else {
23063
- t52 = $[38];
23225
+ t52 = $[41];
23064
23226
  }
23065
23227
  actions = toArray(collection.Actions).map(t52);
23066
23228
  if (plugins) {
@@ -23070,34 +23232,34 @@ function EntityCollectionViewActions(t0) {
23070
23232
  }
23071
23233
  });
23072
23234
  }
23073
- $[33] = actionProps;
23074
- $[34] = collection.Actions;
23075
- $[35] = plugins;
23076
- $[36] = actions;
23235
+ $[36] = actionProps;
23236
+ $[37] = collection.Actions;
23237
+ $[38] = plugins;
23238
+ $[39] = actions;
23077
23239
  } else {
23078
- actions = $[36];
23240
+ actions = $[39];
23079
23241
  }
23080
23242
  let t5;
23081
- if ($[39] !== actions) {
23243
+ if ($[42] !== actions) {
23082
23244
  t5 = /* @__PURE__ */ jsx(ErrorBoundary, { children: actions });
23083
- $[39] = actions;
23084
- $[40] = t5;
23245
+ $[42] = actions;
23246
+ $[43] = t5;
23085
23247
  } else {
23086
- t5 = $[40];
23248
+ t5 = $[43];
23087
23249
  }
23088
23250
  let t6;
23089
- if ($[41] !== addButton || $[42] !== multipleDeleteButton || $[43] !== t5) {
23251
+ if ($[44] !== addButton || $[45] !== multipleDeleteButton || $[46] !== t5) {
23090
23252
  t6 = /* @__PURE__ */ jsxs(Fragment, { children: [
23091
23253
  t5,
23092
23254
  multipleDeleteButton,
23093
23255
  addButton
23094
23256
  ] });
23095
- $[41] = addButton;
23096
- $[42] = multipleDeleteButton;
23097
- $[43] = t5;
23098
- $[44] = t6;
23257
+ $[44] = addButton;
23258
+ $[45] = multipleDeleteButton;
23259
+ $[46] = t5;
23260
+ $[47] = t6;
23099
23261
  } else {
23100
- t6 = $[44];
23262
+ t6 = $[47];
23101
23263
  }
23102
23264
  return t6;
23103
23265
  }
@@ -24443,8 +24605,8 @@ function useBoardDataController({
24443
24605
  const context = useFireCMSContext();
24444
24606
  const dataSource = useDataSource();
24445
24607
  const navigation = useNavigationController();
24446
- const resolvedPath = useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
24447
- const resolvedPathSegments = pathSegments;
24608
+ const resolvedPath = useMemo(() => navigation.resolveIdsFrom(fullPath, pathSegments), [fullPath, pathSegments, navigation.resolveIdsFrom]);
24609
+ const resolvedPathSegments = useMemo(() => pathSegments ? navigation.resolveSegmentsFrom?.(pathSegments) ?? pathSegments : void 0, [pathSegments, navigation.resolveSegmentsFrom]);
24448
24610
  const dataSourceRef = useRef(dataSource);
24449
24611
  const collectionRef = useRef(collection);
24450
24612
  const contextRef = useRef(context);
@@ -24530,6 +24692,7 @@ function useBoardDataController({
24530
24692
  processed = await Promise.all(processed.map((entity) => currentCollection.callbacks.onFetch({
24531
24693
  collection: currentCollection,
24532
24694
  path: currentResolvedPath,
24695
+ pathSegments: currentPathSegments,
24533
24696
  entity,
24534
24697
  context: currentContext
24535
24698
  })));
@@ -25038,6 +25201,7 @@ function EntityCollectionBoardView({
25038
25201
  let completed = 0;
25039
25202
  currentDataSource.countEntities({
25040
25203
  path: fullPath,
25204
+ pathSegments,
25041
25205
  collection: currentCollection
25042
25206
  }).then((count) => {
25043
25207
  totalCount = count;
@@ -25048,6 +25212,7 @@ function EntityCollectionBoardView({
25048
25212
  }).catch((e) => console.warn("Failed to get total count:", e));
25049
25213
  currentDataSource.countEntities({
25050
25214
  path: fullPath,
25215
+ pathSegments,
25051
25216
  collection: currentCollection,
25052
25217
  filter: {
25053
25218
  [orderProperty]: ["!=", null]
@@ -25155,6 +25320,8 @@ function EntityCollectionBoardView({
25155
25320
  }
25156
25321
  const saveProps = {
25157
25322
  path: entity_2.path,
25323
+ // Paired with `entity.path`: the segments the entity was loaded with.
25324
+ pathSegments: entity_2.pathSegments,
25158
25325
  entityId: entity_2.id,
25159
25326
  values: updatedValues,
25160
25327
  previousValues: entity_2.values,
@@ -25192,6 +25359,7 @@ function EntityCollectionBoardView({
25192
25359
  console.log("Fetching all documents from collection...");
25193
25360
  const allDocs = await dataSource.fetchCollection({
25194
25361
  path: fullPath,
25362
+ pathSegments,
25195
25363
  collection,
25196
25364
  limit: 1e4
25197
25365
  // Fetch all
@@ -25210,6 +25378,8 @@ function EntityCollectionBoardView({
25210
25378
  }, orderProperty, index);
25211
25379
  const saveProps_0 = {
25212
25380
  path: entity_4.path,
25381
+ // Paired with `entity.path`: the segments the entity was loaded with.
25382
+ pathSegments: entity_4.pathSegments,
25213
25383
  entityId: entity_4.id,
25214
25384
  values: updatedValues_0,
25215
25385
  previousValues: entity_4.values,
@@ -25295,6 +25465,7 @@ function EntityCollectionBoardView({
25295
25465
  });
25296
25466
  sideEntityController.open({
25297
25467
  path: fullPath,
25468
+ pathSegments,
25298
25469
  collection,
25299
25470
  entityId: void 0,
25300
25471
  updateUrl: true,
@@ -25992,12 +26163,13 @@ function FiltersDialog({
25992
26163
  ] });
25993
26164
  }
25994
26165
  function EntityCollectionViewStartActions(t0) {
25995
- const $ = c(37);
26166
+ const $ = c(38);
25996
26167
  const {
25997
26168
  collection,
25998
26169
  relativePath,
25999
26170
  parentCollectionIds,
26000
26171
  path,
26172
+ pathSegments,
26001
26173
  selectionController,
26002
26174
  tableController,
26003
26175
  collectionEntitiesCount,
@@ -26032,9 +26204,10 @@ function EntityCollectionViewStartActions(t0) {
26032
26204
  }
26033
26205
  const activeFilterCount = t2;
26034
26206
  let t3;
26035
- if ($[5] !== collection || $[6] !== collectionEntitiesCount || $[7] !== context || $[8] !== parentCollectionIds || $[9] !== path || $[10] !== relativePath || $[11] !== selectionController || $[12] !== tableController) {
26207
+ if ($[5] !== collection || $[6] !== collectionEntitiesCount || $[7] !== context || $[8] !== parentCollectionIds || $[9] !== path || $[10] !== pathSegments || $[11] !== relativePath || $[12] !== selectionController || $[13] !== tableController) {
26036
26208
  t3 = {
26037
26209
  path,
26210
+ pathSegments,
26038
26211
  relativePath,
26039
26212
  parentCollectionIds,
26040
26213
  collection,
@@ -26048,44 +26221,45 @@ function EntityCollectionViewStartActions(t0) {
26048
26221
  $[7] = context;
26049
26222
  $[8] = parentCollectionIds;
26050
26223
  $[9] = path;
26051
- $[10] = relativePath;
26052
- $[11] = selectionController;
26053
- $[12] = tableController;
26054
- $[13] = t3;
26224
+ $[10] = pathSegments;
26225
+ $[11] = relativePath;
26226
+ $[12] = selectionController;
26227
+ $[13] = tableController;
26228
+ $[14] = t3;
26055
26229
  } else {
26056
- t3 = $[13];
26230
+ t3 = $[14];
26057
26231
  }
26058
26232
  const actionProps = t3;
26059
26233
  const hasAnyAllowedFilters = !tableController.allowedFilters || tableController.allowedFilters.length > 0;
26060
26234
  let t4;
26061
- if ($[14] !== activeFilterCount || $[15] !== hasAnyAllowedFilters || $[16] !== largeLayout || $[17] !== resolvedProperties || $[18] !== t || $[19] !== tableController.setFilterValues) {
26235
+ if ($[15] !== activeFilterCount || $[16] !== hasAnyAllowedFilters || $[17] !== largeLayout || $[18] !== resolvedProperties || $[19] !== t || $[20] !== tableController.setFilterValues) {
26062
26236
  t4 = resolvedProperties && tableController.setFilterValues && hasAnyAllowedFilters && /* @__PURE__ */ jsx(Tooltip, { title: t("filters"), children: /* @__PURE__ */ jsx(Badge, { color: "primary", invisible: activeFilterCount === 0, children: largeLayout ? /* @__PURE__ */ jsxs(Button, { variant: "text", size: "small", onClick: () => setFiltersDialogOpen(true), startIcon: /* @__PURE__ */ jsx(FilterListIcon, { size: "small" }), className: cls(activeFilterCount > 0 && "text-primary"), children: [
26063
26237
  t("filters"),
26064
26238
  activeFilterCount > 0 ? ` (${activeFilterCount})` : ""
26065
26239
  ] }) : /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: () => setFiltersDialogOpen(true), className: cls(activeFilterCount > 0 && "text-primary"), children: /* @__PURE__ */ jsx(FilterListIcon, { size: "small" }) }) }) }, "filters_tooltip");
26066
- $[14] = activeFilterCount;
26067
- $[15] = hasAnyAllowedFilters;
26068
- $[16] = largeLayout;
26069
- $[17] = resolvedProperties;
26070
- $[18] = t;
26071
- $[19] = tableController.setFilterValues;
26072
- $[20] = t4;
26240
+ $[15] = activeFilterCount;
26241
+ $[16] = hasAnyAllowedFilters;
26242
+ $[17] = largeLayout;
26243
+ $[18] = resolvedProperties;
26244
+ $[19] = t;
26245
+ $[20] = tableController.setFilterValues;
26246
+ $[21] = t4;
26073
26247
  } else {
26074
- t4 = $[20];
26248
+ t4 = $[21];
26075
26249
  }
26076
26250
  const filtersButton = t4;
26077
26251
  const t5 = !collection.forceFilter;
26078
26252
  let t6;
26079
- if ($[21] !== t5 || $[22] !== tableController) {
26253
+ if ($[22] !== t5 || $[23] !== tableController) {
26080
26254
  t6 = /* @__PURE__ */ jsx(ClearFilterSortButton, { tableController, enabled: t5 }, "clear_filter");
26081
- $[21] = t5;
26082
- $[22] = tableController;
26083
- $[23] = t6;
26255
+ $[22] = t5;
26256
+ $[23] = tableController;
26257
+ $[24] = t6;
26084
26258
  } else {
26085
- t6 = $[23];
26259
+ t6 = $[24];
26086
26260
  }
26087
26261
  let actions;
26088
- if ($[24] !== actionProps || $[25] !== filtersButton || $[26] !== plugins || $[27] !== t6) {
26262
+ if ($[25] !== actionProps || $[26] !== filtersButton || $[27] !== plugins || $[28] !== t6) {
26089
26263
  actions = [filtersButton, t6];
26090
26264
  if (plugins) {
26091
26265
  plugins.forEach((plugin, i) => {
@@ -26094,36 +26268,36 @@ function EntityCollectionViewStartActions(t0) {
26094
26268
  }
26095
26269
  });
26096
26270
  }
26097
- $[24] = actionProps;
26098
- $[25] = filtersButton;
26099
- $[26] = plugins;
26100
- $[27] = t6;
26101
- $[28] = actions;
26271
+ $[25] = actionProps;
26272
+ $[26] = filtersButton;
26273
+ $[27] = plugins;
26274
+ $[28] = t6;
26275
+ $[29] = actions;
26102
26276
  } else {
26103
- actions = $[28];
26277
+ actions = $[29];
26104
26278
  }
26105
26279
  let t7;
26106
- if ($[29] !== collection.forceFilter || $[30] !== filtersDialogOpen || $[31] !== resolvedProperties || $[32] !== tableController) {
26280
+ if ($[30] !== collection.forceFilter || $[31] !== filtersDialogOpen || $[32] !== resolvedProperties || $[33] !== tableController) {
26107
26281
  t7 = resolvedProperties && tableController.setFilterValues && /* @__PURE__ */ 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) });
26108
- $[29] = collection.forceFilter;
26109
- $[30] = filtersDialogOpen;
26110
- $[31] = resolvedProperties;
26111
- $[32] = tableController;
26112
- $[33] = t7;
26282
+ $[30] = collection.forceFilter;
26283
+ $[31] = filtersDialogOpen;
26284
+ $[32] = resolvedProperties;
26285
+ $[33] = tableController;
26286
+ $[34] = t7;
26113
26287
  } else {
26114
- t7 = $[33];
26288
+ t7 = $[34];
26115
26289
  }
26116
26290
  let t8;
26117
- if ($[34] !== actions || $[35] !== t7) {
26291
+ if ($[35] !== actions || $[36] !== t7) {
26118
26292
  t8 = /* @__PURE__ */ jsxs(Fragment, { children: [
26119
26293
  actions,
26120
26294
  t7
26121
26295
  ] });
26122
- $[34] = actions;
26123
- $[35] = t7;
26124
- $[36] = t8;
26296
+ $[35] = actions;
26297
+ $[36] = t7;
26298
+ $[37] = t8;
26125
26299
  } else {
26126
- t8 = $[36];
26300
+ t8 = $[37];
26127
26301
  }
26128
26302
  return t8;
26129
26303
  }
@@ -26201,7 +26375,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26201
26375
  useEffect(() => {
26202
26376
  collectionRef.current = collection;
26203
26377
  }, [collection]);
26204
- const canCreateEntities = canCreateEntity(collection, authController, fullPath, null);
26378
+ const canCreateEntities = canCreateEntity(collection, authController, fullPath, null, pathSegments);
26205
26379
  const [highlightedEntity, setHighlightedEntity] = useState(void 0);
26206
26380
  const [deleteEntityClicked, setDeleteEntityClicked] = React__default.useState(void 0);
26207
26381
  const [lastDeleteTimestamp, setLastDeleteTimestamp] = React__default.useState(0);
@@ -26219,7 +26393,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26219
26393
  }, [highlightedEntity]);
26220
26394
  const checkInlineEditing = useCallback((entity) => {
26221
26395
  const collection_0 = collectionRef.current;
26222
- if (!canEditEntity(collection_0, authController, fullPath, entity ?? null)) {
26396
+ if (!canEditEntity(collection_0, authController, fullPath, entity ?? null, pathSegments)) {
26223
26397
  return false;
26224
26398
  }
26225
26399
  return collection_0.inlineEditing === void 0 || collection_0.inlineEditing;
@@ -26309,10 +26483,12 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26309
26483
  if (collection_1) {
26310
26484
  addRecentId(collection_1.id, clickedEntity.id);
26311
26485
  }
26312
- const path = collection_1?.collectionGroup ? clickedEntity.path : fullPath ?? clickedEntity.path;
26486
+ const isCollectionGroup = Boolean(collection_1?.collectionGroup);
26487
+ const path = isCollectionGroup ? clickedEntity.path : fullPath ?? clickedEntity.path;
26313
26488
  navigateToEntity({
26314
26489
  navigation,
26315
26490
  path,
26491
+ pathSegments: isCollectionGroup ? clickedEntity.pathSegments : pathSegments ?? clickedEntity.pathSegments,
26316
26492
  fullIdPath,
26317
26493
  sideEntityController,
26318
26494
  openEntityMode,
@@ -26400,13 +26576,13 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26400
26576
  });
26401
26577
  }
26402
26578
  }, [setViewMode, userConfigPersistence, onCollectionModifiedForUser, fullPath, analyticsController, viewMode]);
26403
- const createEnabled = canCreateEntity(collection, authController, fullPath, null);
26579
+ const createEnabled = canCreateEntity(collection, authController, fullPath, null, pathSegments);
26404
26580
  const uniqueFieldValidator = useCallback(({
26405
26581
  name,
26406
26582
  value,
26407
26583
  property,
26408
26584
  entityId
26409
- }) => dataSource.checkUniqueField(fullPath, name, value, entityId, collection), [fullPath]);
26585
+ }) => dataSource.checkUniqueField(fullPath, name, value, entityId, collection, pathSegments), [fullPath, pathSegments]);
26410
26586
  const onValueChange = ({
26411
26587
  value: value_0,
26412
26588
  propertyKey,
@@ -26419,6 +26595,8 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26419
26595
  }, propertyKey, value_0);
26420
26596
  const saveProps = {
26421
26597
  path: entity_1.path ?? fullPath,
26598
+ // Paired with the `path` above: the row's segments describe the row's path.
26599
+ pathSegments: entity_1.path ? entity_1.pathSegments : pathSegments,
26422
26600
  entityId: entity_1.id,
26423
26601
  values: updatedValues,
26424
26602
  previousValues: entity_1.values,
@@ -26446,7 +26624,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26446
26624
  }
26447
26625
  });
26448
26626
  };
26449
- const resolvedFullPath = navigation.resolveIdsFrom(fullPath);
26627
+ const resolvedFullPath = navigation.resolveIdsFrom(fullPath, pathSegments);
26450
26628
  const resolvedCollection = useMemo(() => resolveCollection({
26451
26629
  collection,
26452
26630
  path: fullPath,
@@ -26575,7 +26753,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26575
26753
  Builder: ({
26576
26754
  entity: entity_4
26577
26755
  }) => {
26578
- const collectionsWithPath = navigation.getParentReferencesFromPath(entity_4.path);
26756
+ const collectionsWithPath = navigation.getParentReferencesFromPath(entity_4.path, entity_4.pathSegments);
26579
26757
  return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 w-full", children: collectionsWithPath.map((reference) => {
26580
26758
  return /* @__PURE__ */ jsx(ReferencePreview, { reference, size: "small" }, reference.path + "/" + reference.id);
26581
26759
  }) });
@@ -26591,7 +26769,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26591
26769
  entity: entity_5,
26592
26770
  customEntityActions
26593
26771
  }) => {
26594
- const deleteEnabled = entity_5 ? canDeleteEntity(collection, authController, fullPath, entity_5) : true;
26772
+ const deleteEnabled = entity_5 ? canDeleteEntity(collection, authController, fullPath, entity_5, entity_5.pathSegments ?? pathSegments) : true;
26595
26773
  const actions = [{
26596
26774
  ...editEntityAction,
26597
26775
  name: t("edit")
@@ -26656,6 +26834,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26656
26834
  onTextSearchClick,
26657
26835
  textSearchEnabled
26658
26836
  } = useTableSearchHelper({
26837
+ pathSegments,
26659
26838
  collection,
26660
26839
  fullPath: resolvedFullPath,
26661
26840
  parentCollectionIds,
@@ -26679,7 +26858,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26679
26858
  }, [tableController.dataLoadingError, customizationController.plugins, fullPath, collection, parentCollectionIds]);
26680
26859
  return /* @__PURE__ */ jsxs("div", { className: cls("overflow-hidden h-full w-full rounded-md flex flex-col", className), ref: containerRef, children: [
26681
26860
  countFetcher,
26682
- /* @__PURE__ */ 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__ */ jsx(EntityCollectionViewStartActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, collectionEntitiesCount: docsCount, resolvedProperties: resolvedCollection.properties }), actions: /* @__PURE__ */ jsx(EntityCollectionViewActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, onMultipleDeleteClick, onNewClick, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, selectionEnabled, collectionEntitiesCount: docsCount }) }),
26861
+ /* @__PURE__ */ 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__ */ jsx(EntityCollectionViewStartActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, path: fullPath, pathSegments, relativePath: collection.path, selectionController: usedSelectionController, collectionEntitiesCount: docsCount, resolvedProperties: resolvedCollection.properties }), actions: /* @__PURE__ */ jsx(EntityCollectionViewActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, onMultipleDeleteClick, onNewClick, path: fullPath, pathSegments, relativePath: collection.path, selectionController: usedSelectionController, selectionEnabled, collectionEntitiesCount: docsCount }) }),
26683
26862
  tableController.dataLoadingError ? pluginErrorView ?? /* @__PURE__ */ jsx(CollectionDataErrorBanner, { error: tableController.dataLoadingError }) : viewMode === "kanban" && enabledViews.includes("kanban") ? /* @__PURE__ */ 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__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
26684
26863
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: t("so_empty") }),
26685
26864
  /* @__PURE__ */ jsxs(Button, { onClick: onNewClick, className: "mt-4", children: [
@@ -26698,7 +26877,7 @@ const EntityCollectionView$1 = React__default.memo(function EntityCollectionView
26698
26877
  /* @__PURE__ */ jsx(AddIcon, {}),
26699
26878
  t("create_your_first_entry")
26700
26879
  ] })
26701
- ] }) : /* @__PURE__ */ jsx(Typography, { variant: "label", children: t("no_results_filter_sort") }), hoverRow, inlineEditing: checkInlineEditing(), AdditionalHeaderWidget: buildAdditionalHeaderWidget, AddColumnComponent: addColumnComponentInternal, getIdColumnWidth, additionalIDHeaderWidget: /* @__PURE__ */ jsx(EntityIdHeaderWidget, { path: fullPath, fullIdPath: fullIdPath ?? fullPath, collection }), openEntityMode, onColumnsOrderChange: (newColumns) => {
26880
+ ] }) : /* @__PURE__ */ jsx(Typography, { variant: "label", children: t("no_results_filter_sort") }), hoverRow, inlineEditing: checkInlineEditing(), AdditionalHeaderWidget: buildAdditionalHeaderWidget, AddColumnComponent: addColumnComponentInternal, getIdColumnWidth, additionalIDHeaderWidget: /* @__PURE__ */ jsx(EntityIdHeaderWidget, { path: fullPath, pathSegments, fullIdPath: fullIdPath ?? fullPath, collection }), openEntityMode, onColumnsOrderChange: (newColumns) => {
26702
26881
  const seenKeys = /* @__PURE__ */ new Set();
26703
26882
  const newPropertiesOrder = newColumns.filter((col) => !col.frozen && getPropertyInPath(collection.properties, col.key)).map((col_0) => col_0.key).filter((key_1) => {
26704
26883
  if (seenKeys.has(key_1)) return false;
@@ -26737,8 +26916,8 @@ function EntitiesCount({
26737
26916
  const [error, setError] = useState(void 0);
26738
26917
  const sortByProperty = sortBy ? sortBy[0] : void 0;
26739
26918
  const currentSort = sortBy ? sortBy[1] : void 0;
26740
- const resolvedPath = useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
26741
- const resolvedPathSegments = pathSegments;
26919
+ const resolvedPath = useMemo(() => navigation.resolveIdsFrom(fullPath, pathSegments), [fullPath, pathSegments, navigation.resolveIdsFrom]);
26920
+ const resolvedPathSegments = useMemo(() => pathSegments ? navigation.resolveSegmentsFrom?.(pathSegments) ?? pathSegments : void 0, [pathSegments, navigation.resolveSegmentsFrom]);
26742
26921
  useEffect(() => {
26743
26922
  if (dataSource.countEntities) dataSource.countEntities({
26744
26923
  path: resolvedPath,
@@ -26778,10 +26957,11 @@ function buildPropertyWidthOverwrite(key, width) {
26778
26957
  };
26779
26958
  }
26780
26959
  function EntityIdHeaderWidget(t0) {
26781
- const $ = c(48);
26960
+ const $ = c(50);
26782
26961
  const {
26783
26962
  collection,
26784
26963
  path,
26964
+ pathSegments,
26785
26965
  fullIdPath
26786
26966
  } = t0;
26787
26967
  const navigation = useNavigationController();
@@ -26822,7 +27002,7 @@ function EntityIdHeaderWidget(t0) {
26822
27002
  t4 = $[6];
26823
27003
  }
26824
27004
  let t5;
26825
- if ($[7] !== collection || $[8] !== fullIdPath || $[9] !== navigation || $[10] !== openEntityMode || $[11] !== path || $[12] !== searchString || $[13] !== sideEntityController) {
27005
+ if ($[7] !== collection || $[8] !== fullIdPath || $[9] !== navigation || $[10] !== openEntityMode || $[11] !== path || $[12] !== pathSegments || $[13] !== searchString || $[14] !== sideEntityController) {
26826
27006
  t5 = (e) => {
26827
27007
  e.preventDefault();
26828
27008
  if (!searchString) {
@@ -26836,6 +27016,7 @@ function EntityIdHeaderWidget(t0) {
26836
27016
  collection,
26837
27017
  entityId,
26838
27018
  path,
27019
+ pathSegments,
26839
27020
  fullIdPath,
26840
27021
  sideEntityController,
26841
27022
  navigation
@@ -26846,130 +27027,133 @@ function EntityIdHeaderWidget(t0) {
26846
27027
  $[9] = navigation;
26847
27028
  $[10] = openEntityMode;
26848
27029
  $[11] = path;
26849
- $[12] = searchString;
26850
- $[13] = sideEntityController;
26851
- $[14] = t5;
27030
+ $[12] = pathSegments;
27031
+ $[13] = searchString;
27032
+ $[14] = sideEntityController;
27033
+ $[15] = t5;
26852
27034
  } else {
26853
- t5 = $[14];
27035
+ t5 = $[15];
26854
27036
  }
26855
27037
  let t6;
26856
- if ($[15] !== t) {
27038
+ if ($[16] !== t) {
26857
27039
  t6 = t("find_entity_by_id");
26858
- $[15] = t;
26859
- $[16] = t6;
27040
+ $[16] = t;
27041
+ $[17] = t6;
26860
27042
  } else {
26861
- t6 = $[16];
27043
+ t6 = $[17];
26862
27044
  }
26863
27045
  let t7;
26864
- if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
27046
+ if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
26865
27047
  t7 = (e_0) => {
26866
27048
  setSearchString(e_0.target.value);
26867
27049
  };
26868
- $[17] = t7;
27050
+ $[18] = t7;
26869
27051
  } else {
26870
- t7 = $[17];
27052
+ t7 = $[18];
26871
27053
  }
26872
27054
  let t8;
26873
- if ($[18] !== openPopup || $[19] !== searchString || $[20] !== t6) {
27055
+ if ($[19] !== openPopup || $[20] !== searchString || $[21] !== t6) {
26874
27056
  t8 = /* @__PURE__ */ 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 " + focusedDisabled });
26875
- $[18] = openPopup;
26876
- $[19] = searchString;
26877
- $[20] = t6;
26878
- $[21] = t8;
27057
+ $[19] = openPopup;
27058
+ $[20] = searchString;
27059
+ $[21] = t6;
27060
+ $[22] = t8;
26879
27061
  } else {
26880
- t8 = $[21];
27062
+ t8 = $[22];
26881
27063
  }
26882
27064
  const t9 = !searchString.trim();
26883
27065
  let t10;
26884
- if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
27066
+ if ($[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
26885
27067
  t10 = /* @__PURE__ */ jsx(KeyboardTabIcon, {});
26886
- $[22] = t10;
27068
+ $[23] = t10;
26887
27069
  } else {
26888
- t10 = $[22];
27070
+ t10 = $[23];
26889
27071
  }
26890
27072
  let t11;
26891
- if ($[23] !== t9) {
27073
+ if ($[24] !== t9) {
26892
27074
  t11 = /* @__PURE__ */ jsx(Button, { variant: "text", disabled: t9, type: "submit", children: t10 });
26893
- $[23] = t9;
26894
- $[24] = t11;
27075
+ $[24] = t9;
27076
+ $[25] = t11;
26895
27077
  } else {
26896
- t11 = $[24];
27078
+ t11 = $[25];
26897
27079
  }
26898
27080
  let t12;
26899
- if ($[25] !== t11 || $[26] !== t8) {
27081
+ if ($[26] !== t11 || $[27] !== t8) {
26900
27082
  t12 = /* @__PURE__ */ jsxs("div", { className: "flex p-2 w-full gap-2", children: [
26901
27083
  t8,
26902
27084
  t11
26903
27085
  ] });
26904
- $[25] = t11;
26905
- $[26] = t8;
26906
- $[27] = t12;
27086
+ $[26] = t11;
27087
+ $[27] = t8;
27088
+ $[28] = t12;
26907
27089
  } else {
26908
- t12 = $[27];
27090
+ t12 = $[28];
26909
27091
  }
26910
27092
  let t13;
26911
- if ($[28] !== t12 || $[29] !== t5) {
27093
+ if ($[29] !== t12 || $[30] !== t5) {
26912
27094
  t13 = /* @__PURE__ */ jsx("form", { noValidate: true, onSubmit: t5, className: "w-96 max-w-full", children: t12 });
26913
- $[28] = t12;
26914
- $[29] = t5;
26915
- $[30] = t13;
27095
+ $[29] = t12;
27096
+ $[30] = t5;
27097
+ $[31] = t13;
26916
27098
  } else {
26917
- t13 = $[30];
27099
+ t13 = $[31];
26918
27100
  }
26919
27101
  let t14;
26920
- if ($[31] !== collection || $[32] !== fullIdPath || $[33] !== navigation || $[34] !== openEntityMode || $[35] !== path || $[36] !== recentIds || $[37] !== sideEntityController) {
26921
- t14 = recentIds && recentIds.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 p-2", children: recentIds.map((id) => /* @__PURE__ */ jsx(ReferencePreview, { reference: new EntityReference(id, path), hover: true, onClick: () => {
27102
+ if ($[32] !== collection || $[33] !== fullIdPath || $[34] !== navigation || $[35] !== openEntityMode || $[36] !== path || $[37] !== pathSegments || $[38] !== recentIds || $[39] !== sideEntityController) {
27103
+ t14 = recentIds && recentIds.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 p-2", children: recentIds.map((id) => /* @__PURE__ */ jsx(ReferencePreview, { reference: new EntityReference(id, path, void 0, pathSegments), hover: true, onClick: () => {
26922
27104
  setOpenPopup(false);
26923
27105
  navigateToEntity({
26924
27106
  openEntityMode,
26925
27107
  collection,
26926
27108
  entityId: id,
26927
27109
  path,
27110
+ pathSegments,
26928
27111
  fullIdPath,
26929
27112
  sideEntityController,
26930
27113
  navigation
26931
27114
  });
26932
27115
  }, includeEntityLink: false, size: "small" }, id)) });
26933
- $[31] = collection;
26934
- $[32] = fullIdPath;
26935
- $[33] = navigation;
26936
- $[34] = openEntityMode;
26937
- $[35] = path;
26938
- $[36] = recentIds;
26939
- $[37] = sideEntityController;
26940
- $[38] = t14;
27116
+ $[32] = collection;
27117
+ $[33] = fullIdPath;
27118
+ $[34] = navigation;
27119
+ $[35] = openEntityMode;
27120
+ $[36] = path;
27121
+ $[37] = pathSegments;
27122
+ $[38] = recentIds;
27123
+ $[39] = sideEntityController;
27124
+ $[40] = t14;
26941
27125
  } else {
26942
- t14 = $[38];
27126
+ t14 = $[40];
26943
27127
  }
26944
27128
  let t15;
26945
- if ($[39] !== t13 || $[40] !== t14) {
27129
+ if ($[41] !== t13 || $[42] !== t14) {
26946
27130
  t15 = /* @__PURE__ */ jsxs("div", { className: t4, children: [
26947
27131
  t13,
26948
27132
  t14
26949
27133
  ] });
26950
- $[39] = t13;
26951
- $[40] = t14;
26952
- $[41] = t15;
27134
+ $[41] = t13;
27135
+ $[42] = t14;
27136
+ $[43] = t15;
26953
27137
  } else {
26954
- t15 = $[41];
27138
+ t15 = $[43];
26955
27139
  }
26956
27140
  let t16;
26957
- if ($[42] !== openPopup || $[43] !== t15) {
27141
+ if ($[44] !== openPopup || $[45] !== t15) {
26958
27142
  t16 = /* @__PURE__ */ jsx(Popover, { open: openPopup, onOpenChange: setOpenPopup, sideOffset: 0, align: "start", alignOffset: -117, trigger: t3, children: t15 });
26959
- $[42] = openPopup;
26960
- $[43] = t15;
26961
- $[44] = t16;
27143
+ $[44] = openPopup;
27144
+ $[45] = t15;
27145
+ $[46] = t16;
26962
27146
  } else {
26963
- t16 = $[44];
27147
+ t16 = $[46];
26964
27148
  }
26965
27149
  let t17;
26966
- if ($[45] !== t16 || $[46] !== t2) {
27150
+ if ($[47] !== t16 || $[48] !== t2) {
26967
27151
  t17 = /* @__PURE__ */ jsx(Tooltip, { title: t2, asChild: false, children: t16 });
26968
- $[45] = t16;
26969
- $[46] = t2;
26970
- $[47] = t17;
27152
+ $[47] = t16;
27153
+ $[48] = t2;
27154
+ $[49] = t17;
26971
27155
  } else {
26972
- t17 = $[47];
27156
+ t17 = $[49];
26973
27157
  }
26974
27158
  return t17;
26975
27159
  }
@@ -28537,8 +28721,12 @@ function getParentReferencesFromPath(props) {
28537
28721
  path,
28538
28722
  collections = [],
28539
28723
  currentFullPath,
28540
- currentPathSegments = []
28724
+ currentPathSegments = [],
28725
+ pathSegments
28541
28726
  } = props;
28727
+ if (pathSegments) {
28728
+ return getParentReferencesFromPathSegments(pathSegments, collections);
28729
+ }
28542
28730
  const subpaths = removeInitialAndTrailingSlashes(path).split("/");
28543
28731
  const subpathCombinations = getCollectionPathsCombinations(subpaths);
28544
28732
  const result = [];
@@ -28575,6 +28763,9 @@ function getParentReferencesFromPath(props) {
28575
28763
  }
28576
28764
  return result;
28577
28765
  }
28766
+ function getParentReferencesFromPathSegments(pathSegments, collections) {
28767
+ return walkPathSegments(pathSegments, collections).steps.filter((step) => step.entityId !== void 0).map((step) => new EntityReference(step.entityId, step.collectionPath, void 0, step.collectionSegments));
28768
+ }
28578
28769
  const DEFAULT_BASE_PATH = "/";
28579
28770
  const DEFAULT_COLLECTION_PATH = "/c";
28580
28771
  const NAVIGATION_ADMIN_GROUP_NAME = "Admin";
@@ -28779,10 +28970,10 @@ function useBuildNavigationController(props) {
28779
28970
  useEffect(() => {
28780
28971
  refreshNavigation();
28781
28972
  }, [refreshNavigation]);
28782
- const getCollection = useCallback((idOrPath, includeUserOverride = false) => {
28973
+ const getCollection = useCallback((idOrPath, includeUserOverride = false, pathSegments) => {
28783
28974
  const collections_0 = collectionsRef.current;
28784
28975
  if (!collections_0) return void 0;
28785
- const baseCollection = getCollectionByPathOrId(removeInitialAndTrailingSlashes(idOrPath), collections_0);
28976
+ const baseCollection = getCollectionByPathOrId(removeInitialAndTrailingSlashes(idOrPath), collections_0, pathSegments);
28786
28977
  const userOverride = includeUserOverride ? userConfigPersistence?.getCollectionConfig(idOrPath) : void 0;
28787
28978
  let overriddenCollection = baseCollection;
28788
28979
  if (baseCollection && userOverride) {
@@ -28817,16 +29008,16 @@ function useBuildNavigationController(props) {
28817
29008
  if (!collection_0) return void 0;
28818
29009
  return collection_0;
28819
29010
  }, []);
28820
- const getCollectionFromPaths = useCallback((pathSegments) => {
29011
+ const getCollectionFromPaths = useCallback((pathSegments_0) => {
28821
29012
  const collections_2 = collectionsRef.current;
28822
29013
  if (collections_2 === void 0) throw Error("getCollectionFromPaths: Collections have not been initialised yet");
28823
29014
  let currentCollections = [...collections_2 ?? []];
28824
- for (let i = 0; i < pathSegments.length; i++) {
28825
- const pathSegment = pathSegments[i];
29015
+ for (let i = 0; i < pathSegments_0.length; i++) {
29016
+ const pathSegment = pathSegments_0[i];
28826
29017
  const collection_1 = currentCollections.find((c_0) => c_0.id === pathSegment || c_0.path === pathSegment);
28827
29018
  if (!collection_1) return void 0;
28828
29019
  currentCollections = collection_1.subcollections;
28829
- if (i === pathSegments.length - 1) return collection_1;
29020
+ if (i === pathSegments_0.length - 1) return collection_1;
28830
29021
  }
28831
29022
  return void 0;
28832
29023
  }, []);
@@ -28851,33 +29042,37 @@ function useBuildNavigationController(props) {
28851
29042
  if (cleanPath_0.startsWith(fullCollectionPath)) return cleanPath_0.replace(fullCollectionPath, "");
28852
29043
  throw Error("Expected path starting with " + fullCollectionPath);
28853
29044
  }, [fullCollectionPath]);
28854
- const resolveIdsFrom = useCallback((path_3) => {
29045
+ const resolveIdsFrom = useCallback((path_3, pathSegments_1) => {
28855
29046
  const collections_4 = collectionsRef.current ?? [];
28856
- return resolveCollectionPathIds(path_3, collections_4);
29047
+ return resolveCollectionPathIds(path_3, collections_4, pathSegments_1);
28857
29048
  }, []);
28858
- const getAllParentReferencesForPath = useCallback((path_4) => {
29049
+ const resolveSegmentsFrom = useCallback((pathSegments_2) => {
28859
29050
  const collections_5 = collectionsRef.current ?? [];
29051
+ return resolveCollectionPathSegments(pathSegments_2, collections_5);
29052
+ }, []);
29053
+ const getAllParentReferencesForPath = useCallback((path_4, pathSegments_3) => {
29054
+ const collections_6 = collectionsRef.current ?? [];
28860
29055
  return getParentReferencesFromPath({
28861
29056
  path: path_4,
28862
- collections: collections_5
29057
+ pathSegments: pathSegments_3,
29058
+ collections: collections_6
28863
29059
  });
28864
29060
  }, []);
28865
- const getParentCollectionIds = useCallback((path_5) => {
28866
- const strings = path_5.split("/");
28867
- const oddPathSegments = strings.filter((_, i_1) => i_1 % 2 === 0);
29061
+ const getParentCollectionIds = useCallback((path_5, pathSegments_4) => {
29062
+ const oddPathSegments = pathSegments_4 ? collectionSegmentsFrom(pathSegments_4) : fullPathToCollectionSegments(path_5);
28868
29063
  oddPathSegments.pop();
28869
29064
  const result_0 = [];
28870
- for (let i_2 = 1; i_2 <= oddPathSegments.length; i_2++) {
28871
- result_0.push(oddPathSegments.slice(0, i_2));
29065
+ for (let i_1 = 1; i_1 <= oddPathSegments.length; i_1++) {
29066
+ result_0.push(oddPathSegments.slice(0, i_1));
28872
29067
  }
28873
29068
  return result_0.map((r) => getCollectionFromPaths(r)?.id).filter(Boolean);
28874
29069
  }, [getAllParentReferencesForPath]);
28875
29070
  const convertIdsToPaths = useCallback((ids_0) => {
28876
- const collections_6 = collectionsRef.current;
28877
- let currentCollections_1 = collections_6;
29071
+ const collections_7 = collectionsRef.current;
29072
+ let currentCollections_1 = collections_7;
28878
29073
  const paths = [];
28879
- for (let i_3 = 0; i_3 < ids_0.length; i_3++) {
28880
- const id_1 = ids_0[i_3];
29074
+ for (let i_2 = 0; i_2 < ids_0.length; i_2++) {
29075
+ const id_1 = ids_0[i_2];
28881
29076
  const collection_3 = currentCollections_1.find((c_2) => c_2.id === id_1);
28882
29077
  if (!collection_3) throw Error(`Collection with id ${id_1} not found`);
28883
29078
  paths.push(collection_3.path);
@@ -28903,6 +29098,7 @@ function useBuildNavigationController(props) {
28903
29098
  urlPathToDataPath,
28904
29099
  buildUrlCollectionPath,
28905
29100
  resolveIdsFrom,
29101
+ resolveSegmentsFrom,
28906
29102
  topLevelNavigation,
28907
29103
  refreshNavigation,
28908
29104
  getParentReferencesFromPath: getAllParentReferencesForPath,
@@ -29660,6 +29856,7 @@ function EntitySidePanel(props) {
29660
29856
  if (params.status !== "existing") {
29661
29857
  sideEntityController.replace({
29662
29858
  path: params.path,
29859
+ pathSegments: params.pathSegments ?? pathSegments,
29663
29860
  entityId: params.entityId,
29664
29861
  fullIdPath: props.fullIdPath,
29665
29862
  selectedTab: params.selectedTab,
@@ -29673,9 +29870,9 @@ function EntitySidePanel(props) {
29673
29870
  }
29674
29871
  };
29675
29872
  const parentCollectionIds = useMemo(() => {
29676
- return navigationController.getParentCollectionIds(path);
29873
+ return navigationController.getParentCollectionIds(path, pathSegments);
29677
29874
  }, [navigationController, path]);
29678
- const collection = props.collection ?? navigationController.getCollection(fullIdPath ?? path);
29875
+ const collection = props.collection ?? navigationController.getCollection(fullIdPath ?? path, false, pathSegments);
29679
29876
  useEffect(() => {
29680
29877
  function beforeunload(e) {
29681
29878
  if (blocked && collection) {
@@ -29715,6 +29912,7 @@ function EntitySidePanel(props) {
29715
29912
  }) => {
29716
29913
  sideEntityController.replace({
29717
29914
  path,
29915
+ pathSegments,
29718
29916
  entityId: entityId_0,
29719
29917
  fullIdPath: props.fullIdPath,
29720
29918
  selectedTab,
@@ -29830,6 +30028,7 @@ function SideDialogView({
29830
30028
  function EntityEditViewFormActions({
29831
30029
  collection,
29832
30030
  path,
30031
+ pathSegments,
29833
30032
  entity,
29834
30033
  layout,
29835
30034
  savingError,
@@ -29852,8 +30051,8 @@ function EntityEditViewFormActions({
29852
30051
  } = useTranslation();
29853
30052
  const entityActions = useMemo(() => {
29854
30053
  const customEntityActions = (collection.entityActions ?? []).map((action) => resolveEntityAction(action, customizationController.entityActions)).filter(Boolean);
29855
- const createEnabled = canCreateEntity(collection, authController, path, null);
29856
- const deleteEnabled = entity ? canDeleteEntity(collection, authController, path, entity) : false;
30054
+ const createEnabled = canCreateEntity(collection, authController, path, null, pathSegments);
30055
+ const deleteEnabled = entity ? canDeleteEntity(collection, authController, path, entity, entity.pathSegments ?? pathSegments) : false;
29857
30056
  const actions = [];
29858
30057
  if (createEnabled) actions.push(copyEntityAction);
29859
30058
  if (deleteEnabled) actions.push(deleteEntityAction);
@@ -30217,7 +30416,7 @@ function EntityEditView$1({
30217
30416
  if (status === "new" || status === "copy") {
30218
30417
  return true;
30219
30418
  } else {
30220
- return entity ? canEditEntity(props.collection, authController, props.path, entity ?? null) : void 0;
30419
+ return entity ? canEditEntity(props.collection, authController, props.path, entity ?? null, props.pathSegments) : void 0;
30221
30420
  }
30222
30421
  }, [authController, entity, status]);
30223
30422
  if (dataLoading && !initialDirtyValues || (!entity || canEdit === void 0) && (status === "existing" || status === "copy")) {
@@ -30267,6 +30466,7 @@ function EntityEditViewInner({
30267
30466
  entityId,
30268
30467
  parentCollectionIds,
30269
30468
  path,
30469
+ pathSegments,
30270
30470
  status,
30271
30471
  collection,
30272
30472
  context,
@@ -30365,7 +30565,7 @@ function EntityEditViewInner({
30365
30565
  const subcollectionId = subcollection.id ?? subcollection.path;
30366
30566
  const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection.path)}` : void 0;
30367
30567
  const newFullIdPath = fullIdPath && usedEntity ? `${fullIdPath}/${encodeEntityId(usedEntity.id)}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
30368
- const newPathSegments = usedEntity && pathSegments ? [...pathSegments, usedEntity.id, ...removeInitialAndTrailingSlashes(subcollection.path).split("/")] : void 0;
30568
+ const newPathSegments = buildSubcollectionPathSegments(pathSegments, usedEntity?.id, subcollection.path);
30369
30569
  if (selectedTab !== subcollectionId) return null;
30370
30570
  return /* @__PURE__ */ jsxs("div", { className: "relative flex-1 h-full overflow-auto w-full", role: "tabpanel", children: [
30371
30571
  globalLoading && /* @__PURE__ */ jsx(CircularProgressCenter, {}),
@@ -30940,7 +31140,7 @@ function useBuildDataSource({
30940
31140
  onUpdate,
30941
31141
  onError
30942
31142
  }) => {
30943
- const collection_0 = collectionProp ?? navigationController.getCollection(path_0);
31143
+ const collection_0 = collectionProp ?? navigationController.getCollection(path_0, false, pathSegments_0);
30944
31144
  const usedDelegate_0 = collection_0?.overrides?.dataSourceDelegate ?? delegate;
30945
31145
  if (!usedDelegate_0.listenCollection) throw Error("useBuildDataSource delegate not initialised");
30946
31146
  return usedDelegate_0.listenCollection({
@@ -31026,7 +31226,7 @@ function useBuildDataSource({
31026
31226
  collection: collectionProp_0,
31027
31227
  status
31028
31228
  }) => {
31029
- const collection_3 = collectionProp_0 ?? navigationController.getCollection(path_3);
31229
+ const collection_3 = collectionProp_0 ?? navigationController.getCollection(path_3, false, pathSegments_3);
31030
31230
  const usedDelegate_3 = collection_3?.overrides?.dataSourceDelegate ?? delegate;
31031
31231
  const resolvedCollection = collection_3 ? resolveCollection({
31032
31232
  collection: collection_3,
@@ -31083,8 +31283,11 @@ function useBuildDataSource({
31083
31283
  status
31084
31284
  }).then((res) => {
31085
31285
  return {
31086
- id: res.id,
31087
- path: res.path,
31286
+ ...res,
31287
+ // A delegate that predates `pathSegments` returns none; the segments we
31288
+ // just saved with describe exactly this entity's collection, so they are
31289
+ // the authoritative answer rather than a guess.
31290
+ pathSegments: res.pathSegments ?? pathSegments_3,
31088
31291
  values: usedDelegate_3.delegateToCMSModel(finalValues)
31089
31292
  };
31090
31293
  });
@@ -31126,6 +31329,8 @@ function useBuildDataSource({
31126
31329
  const usedDelegate_6 = collection_6?.overrides?.dataSourceDelegate ?? delegate;
31127
31330
  return usedDelegate_6.generateEntityId(path_5, collection_6, pathSegments_6);
31128
31331
  }, [delegate.generateEntityId]),
31332
+ // Typed with the declared props rather than an inline duplicate: the duplicate is
31333
+ // free to drift from the interface, and a field it forgets is dropped in silence.
31129
31334
  countEntities: delegate.countEntities ? async ({
31130
31335
  path: path_6,
31131
31336
  pathSegments: pathSegments_7,
@@ -32652,7 +32857,7 @@ function FireCMSRoute() {
32652
32857
  let collection;
32653
32858
  collection = navigation.getCollectionById(navigationEntries[0].id);
32654
32859
  if (!collection) {
32655
- collection = navigation.getCollection(navigationEntries[0].path);
32860
+ collection = navigation.getCollection(navigationEntries[0].path, false, navigationEntries[0].pathSegments);
32656
32861
  }
32657
32862
  if (!collection) {
32658
32863
  t16 = null;
@@ -32763,7 +32968,7 @@ function FireCMSRoute() {
32763
32968
  const firstEntry = navigationEntries[0];
32764
32969
  collection_0 = navigation.getCollectionById(firstEntry.id);
32765
32970
  if (!collection_0) {
32766
- collection_0 = navigation.getCollection(firstEntry.path);
32971
+ collection_0 = navigation.getCollection(firstEntry.path, false, firstEntry.pathSegments);
32767
32972
  }
32768
32973
  if (!collection_0) {
32769
32974
  t16 = null;
@@ -32936,9 +33141,10 @@ function EntityFullScreenRoute({
32936
33141
  }
32937
33142
  const collection = isNew ? lastCollectionEntry.collection : lastEntityEntry.parentCollection;
32938
33143
  const fullIdPath = isNew ? lastCollectionEntry.fullPath : parentCollectionEntry?.fullPath ?? lastEntityEntry.fullPath;
32939
- const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path);
33144
+ const pathSegments = isNew ? lastCollectionEntry.pathSegments : lastEntityEntry.pathSegments;
33145
+ const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path, pathSegments);
32940
33146
  return /* @__PURE__ */ jsxs(Fragment, { children: [
32941
- /* @__PURE__ */ jsx(React__default.Suspense, { fallback: null, children: /* @__PURE__ */ jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, fullIdPath, pathSegments: isNew ? lastCollectionEntry.pathSegments : lastEntityEntry.pathSegments, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
33147
+ /* @__PURE__ */ jsx(React__default.Suspense, { fallback: null, children: /* @__PURE__ */ 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) => {
32942
33148
  const newEntityId = params.entityId;
32943
33149
  if (!newEntityId) return;
32944
33150
  navigate(buildEntityUrl(newEntityId, params.selectedTab), {
@@ -43825,9 +44031,11 @@ export {
43825
44031
  buildProperties,
43826
44032
  buildPropertiesOrBuilder,
43827
44033
  buildProperty,
44034
+ buildSubcollectionPathSegments,
43828
44035
  canCreateEntity,
43829
44036
  canDeleteEntity,
43830
44037
  canEditEntity,
44038
+ collectionSegmentsFrom,
43831
44039
  copyEntityAction,
43832
44040
  decodeEntityId,
43833
44041
  defaultDateFormat,
@@ -43846,6 +44054,7 @@ export {
43846
44054
  getArrayValuesCount,
43847
44055
  getBracketNotation,
43848
44056
  getCollectionByPathOrId,
44057
+ getCollectionByPathSegments,
43849
44058
  getCollectionPathsCombinations,
43850
44059
  getColorForProperty,
43851
44060
  getColorScheme,
@@ -43907,6 +44116,7 @@ export {
43907
44116
  parseGeoPoint,
43908
44117
  pick,
43909
44118
  plural,
44119
+ positionalCollectionSegments,
43910
44120
  prettifyIdentifier,
43911
44121
  printChanged,
43912
44122
  propertiesToColumns,
@@ -43928,6 +44138,7 @@ export {
43928
44138
  resolveArrayProperty,
43929
44139
  resolveCollection,
43930
44140
  resolveCollectionPathIds,
44141
+ resolveCollectionPathSegments,
43931
44142
  resolveDefaultSelectedView,
43932
44143
  resolveEntityAction,
43933
44144
  resolveEntityView,
@@ -43990,6 +44201,7 @@ export {
43990
44201
  useTraceUpdate,
43991
44202
  useTranslation,
43992
44203
  useValidateAuthenticator,
44204
+ walkPathSegments,
43993
44205
  yupToFormErrors
43994
44206
  };
43995
44207
  //# sourceMappingURL=index.es.js.map