@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.umd.js CHANGED
@@ -192,6 +192,11 @@
192
192
  function decodeEntityId(encodedEntityId) {
193
193
  return encodedEntityId.replaceAll("%2F", "/").replaceAll("%23", "#").replaceAll("%3F", "?").replaceAll("%25", "%");
194
194
  }
195
+ function buildSubcollectionPathSegments(parentPathSegments, entityId, subcollectionPath) {
196
+ if (!parentPathSegments || !entityId) return void 0;
197
+ const ownSegments = removeInitialAndTrailingSlashes(subcollectionPath).split("/");
198
+ return [...parentPathSegments, entityId, ...ownSegments];
199
+ }
195
200
  function getLastSegment(path) {
196
201
  const cleanPath = removeInitialAndTrailingSlashes(path);
197
202
  if (cleanPath.includes("/")) {
@@ -200,7 +205,88 @@
200
205
  }
201
206
  return cleanPath;
202
207
  }
203
- function resolveCollectionPathIds(path, allCollections) {
208
+ function walkPathSegments(pathSegments, allCollections) {
209
+ const resolved = [];
210
+ const steps = [];
211
+ let currentCollections = allCollections;
212
+ let index = 0;
213
+ while (index < pathSegments.length) {
214
+ const remaining = pathSegments.slice(index);
215
+ if (!currentCollections || currentCollections.length === 0) {
216
+ resolved.push(...remaining);
217
+ return {
218
+ resolved,
219
+ steps,
220
+ unmatched: remaining[0]
221
+ };
222
+ }
223
+ let match;
224
+ for (const collection of currentCollections) {
225
+ for (const candidate of [collection.path, collection.id]) {
226
+ if (!candidate) continue;
227
+ const parts = removeInitialAndTrailingSlashes(candidate).split("/");
228
+ if (parts.length > remaining.length) continue;
229
+ if (parts.some((part, i) => part !== remaining[i])) continue;
230
+ if (!match || parts.length > match.length) match = {
231
+ collection,
232
+ length: parts.length
233
+ };
234
+ }
235
+ }
236
+ if (!match) {
237
+ resolved.push(...remaining);
238
+ return {
239
+ resolved,
240
+ steps,
241
+ unmatched: remaining[0]
242
+ };
243
+ }
244
+ resolved.push(...removeInitialAndTrailingSlashes(match.collection.path).split("/"));
245
+ index += match.length;
246
+ const step = {
247
+ collection: match.collection,
248
+ collectionPath: resolved.join("/"),
249
+ collectionSegments: [...resolved]
250
+ };
251
+ steps.push(step);
252
+ if (index >= pathSegments.length) {
253
+ return {
254
+ resolved,
255
+ steps,
256
+ collection: match.collection
257
+ };
258
+ }
259
+ step.entityId = pathSegments[index];
260
+ resolved.push(pathSegments[index]);
261
+ index += 1;
262
+ if (index >= pathSegments.length) {
263
+ return {
264
+ resolved,
265
+ steps,
266
+ collection: match.collection
267
+ };
268
+ }
269
+ currentCollections = match.collection.subcollections;
270
+ }
271
+ return {
272
+ resolved,
273
+ steps
274
+ };
275
+ }
276
+ function resolveCollectionPathSegments(pathSegments, allCollections) {
277
+ const walk = walkPathSegments(pathSegments, allCollections);
278
+ if (walk.unmatched !== void 0) {
279
+ console.warn(`resolveCollectionPathSegments: Collection definition not found for segment "${walk.unmatched}" in [${pathSegments.join(", ")}]. Carrying the remaining segments through unresolved.`);
280
+ }
281
+ return walk.resolved;
282
+ }
283
+ function getCollectionByPathSegments(pathSegments, collections) {
284
+ return walkPathSegments(pathSegments, collections).collection;
285
+ }
286
+ function resolveCollectionPathIds(path, allCollections, pathSegments) {
287
+ if (pathSegments) {
288
+ return resolveCollectionPathSegments(pathSegments, allCollections).join("/");
289
+ }
204
290
  let remainingPath = removeInitialAndTrailingSlashes(path);
205
291
  if (!remainingPath) {
206
292
  return "";
@@ -262,7 +348,10 @@
262
348
  }
263
349
  return resolvedPathParts.join("/");
264
350
  }
265
- function getCollectionByPathOrId(pathOrId, collections) {
351
+ function getCollectionByPathOrId(pathOrId, collections, pathSegments) {
352
+ if (pathSegments) {
353
+ return getCollectionByPathSegments(pathSegments, collections);
354
+ }
266
355
  const subpaths = removeInitialAndTrailingSlashes(pathOrId).split("/");
267
356
  if (subpaths.length % 2 === 0) {
268
357
  throw Error(`getCollectionByPathOrId: Collection paths must have an odd number of segments: ${pathOrId}`);
@@ -1394,7 +1483,16 @@
1394
1483
  return paths.reduce((a, b) => `${a}${COLLECTION_PATH_SEPARATOR}${b}`);
1395
1484
  }
1396
1485
  function fullPathToCollectionSegments(path) {
1397
- return path.split("/").filter((e, i) => i % 2 === 0);
1486
+ return positionalCollectionSegments(path);
1487
+ }
1488
+ function collectionSegmentsFrom(pathSegments) {
1489
+ return keepCollectionPositions(pathSegments);
1490
+ }
1491
+ function positionalCollectionSegments(path) {
1492
+ return keepCollectionPositions(path.split("/"));
1493
+ }
1494
+ function keepCollectionPositions(segments) {
1495
+ return segments.filter((e, i) => i % 2 === 0);
1398
1496
  }
1399
1497
  function serializeRegExp(input) {
1400
1498
  if (!input) return "";
@@ -1624,35 +1722,35 @@
1624
1722
  create: true,
1625
1723
  delete: true
1626
1724
  };
1627
- function resolvePermissions(collection, authController, path, entity) {
1725
+ function resolvePermissions(collection, authController, path, entity, pathSegments) {
1628
1726
  const permission = collection.permissions;
1629
1727
  if (permission === void 0) {
1630
1728
  return DEFAULT_PERMISSIONS;
1631
1729
  } else if (typeof permission === "object") {
1632
1730
  return permission;
1633
1731
  } else if (typeof permission === "function") {
1634
- const pathSegments = fullPathToCollectionSegments(path);
1732
+ const collectionSegments = pathSegments ? collectionSegmentsFrom(pathSegments) : fullPathToCollectionSegments(path);
1635
1733
  return permission({
1636
1734
  entity,
1637
1735
  path,
1638
1736
  user: authController.user,
1639
1737
  authController,
1640
1738
  collection,
1641
- pathSegments
1739
+ pathSegments: collectionSegments
1642
1740
  });
1643
1741
  }
1644
1742
  console.error("Permissions:", permission);
1645
1743
  throw Error("New type of permission added and not mapped");
1646
1744
  }
1647
- function canEditEntity(collection, authController, path, entity) {
1648
- return resolvePermissions(collection, authController, path, entity)?.edit ?? DEFAULT_PERMISSIONS.edit;
1745
+ function canEditEntity(collection, authController, path, entity, pathSegments) {
1746
+ return resolvePermissions(collection, authController, path, entity, pathSegments)?.edit ?? DEFAULT_PERMISSIONS.edit;
1649
1747
  }
1650
- function canCreateEntity(collection, authController, path, entity) {
1748
+ function canCreateEntity(collection, authController, path, entity, pathSegments) {
1651
1749
  if (collection.collectionGroup) return false;
1652
- return resolvePermissions(collection, authController, path, entity)?.create ?? DEFAULT_PERMISSIONS.create;
1750
+ return resolvePermissions(collection, authController, path, entity, pathSegments)?.create ?? DEFAULT_PERMISSIONS.create;
1653
1751
  }
1654
- function canDeleteEntity(collection, authController, path, entity) {
1655
- return resolvePermissions(collection, authController, path, entity)?.delete ?? DEFAULT_PERMISSIONS.delete;
1752
+ function canDeleteEntity(collection, authController, path, entity, pathSegments) {
1753
+ return resolvePermissions(collection, authController, path, entity, pathSegments)?.delete ?? DEFAULT_PERMISSIONS.delete;
1656
1754
  }
1657
1755
  function toNumber(value) {
1658
1756
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
@@ -4624,10 +4722,10 @@
4624
4722
  return fireCMSContextRef.current;
4625
4723
  };
4626
4724
  function useCollectionFetch(t0) {
4627
- const $ = reactCompilerRuntime.c(27);
4725
+ const $ = reactCompilerRuntime.c(31);
4628
4726
  const {
4629
4727
  path: inputPath,
4630
- pathSegments,
4728
+ pathSegments: inputPathSegments,
4631
4729
  collection,
4632
4730
  filterValues,
4633
4731
  sortBy,
@@ -4637,32 +4735,43 @@
4637
4735
  const dataSource = useDataSource();
4638
4736
  const navigationController = useNavigationController();
4639
4737
  let t1;
4640
- if ($[0] !== inputPath || $[1] !== navigationController) {
4641
- t1 = navigationController.resolveIdsFrom(inputPath);
4642
- $[0] = inputPath;
4738
+ if ($[0] !== inputPathSegments || $[1] !== navigationController) {
4739
+ t1 = inputPathSegments ? navigationController.resolveSegmentsFrom?.(inputPathSegments) ?? inputPathSegments : void 0;
4740
+ $[0] = inputPathSegments;
4643
4741
  $[1] = navigationController;
4644
4742
  $[2] = t1;
4645
4743
  } else {
4646
4744
  t1 = $[2];
4647
4745
  }
4648
- const path = t1;
4746
+ const pathSegments = t1;
4747
+ let t2;
4748
+ if ($[3] !== inputPath || $[4] !== inputPathSegments || $[5] !== navigationController) {
4749
+ t2 = navigationController.resolveIdsFrom(inputPath, inputPathSegments);
4750
+ $[3] = inputPath;
4751
+ $[4] = inputPathSegments;
4752
+ $[5] = navigationController;
4753
+ $[6] = t2;
4754
+ } else {
4755
+ t2 = $[6];
4756
+ }
4757
+ const path = t2;
4649
4758
  const sortByProperty = sortBy ? sortBy[0] : void 0;
4650
4759
  const currentSort = sortBy ? sortBy[1] : void 0;
4651
4760
  const context = useFireCMSContext();
4652
- let t2;
4653
- if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
4654
- t2 = [];
4655
- $[3] = t2;
4761
+ let t3;
4762
+ if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
4763
+ t3 = [];
4764
+ $[7] = t3;
4656
4765
  } else {
4657
- t2 = $[3];
4766
+ t3 = $[7];
4658
4767
  }
4659
- const [data, setData] = React.useState(t2);
4768
+ const [data, setData] = React.useState(t3);
4660
4769
  const [dataLoading, setDataLoading] = React.useState(false);
4661
4770
  const [dataLoadingError, setDataLoadingError] = React.useState();
4662
4771
  const [noMoreToLoad, setNoMoreToLoad] = React.useState(false);
4663
- let t3;
4664
- if ($[4] !== collection || $[5] !== context || $[6] !== currentSort || $[7] !== dataSource || $[8] !== filterValues || $[9] !== itemCount || $[10] !== path || $[11] !== pathSegments || $[12] !== searchString || $[13] !== sortByProperty) {
4665
- t3 = () => {
4772
+ let t4;
4773
+ if ($[8] !== collection || $[9] !== context || $[10] !== currentSort || $[11] !== dataSource || $[12] !== filterValues || $[13] !== itemCount || $[14] !== path || $[15] !== pathSegments || $[16] !== searchString || $[17] !== sortByProperty) {
4774
+ t4 = () => {
4666
4775
  setDataLoading(true);
4667
4776
  const onEntitiesUpdate = async (entities) => {
4668
4777
  if (pathSegments) {
@@ -4676,11 +4785,12 @@
4676
4785
  entities = await Promise.all(entities.map((entity) => collection.callbacks.onFetch({
4677
4786
  collection,
4678
4787
  path,
4788
+ pathSegments,
4679
4789
  entity,
4680
4790
  context
4681
4791
  })));
4682
- } catch (t42) {
4683
- const e_0 = t42;
4792
+ } catch (t52) {
4793
+ const e_0 = t52;
4684
4794
  console.error(e_0);
4685
4795
  }
4686
4796
  }
@@ -4724,51 +4834,51 @@
4724
4834
  return _temp2$f;
4725
4835
  }
4726
4836
  };
4727
- $[4] = collection;
4728
- $[5] = context;
4729
- $[6] = currentSort;
4730
- $[7] = dataSource;
4731
- $[8] = filterValues;
4732
- $[9] = itemCount;
4733
- $[10] = path;
4734
- $[11] = pathSegments;
4735
- $[12] = searchString;
4736
- $[13] = sortByProperty;
4737
- $[14] = t3;
4837
+ $[8] = collection;
4838
+ $[9] = context;
4839
+ $[10] = currentSort;
4840
+ $[11] = dataSource;
4841
+ $[12] = filterValues;
4842
+ $[13] = itemCount;
4843
+ $[14] = path;
4844
+ $[15] = pathSegments;
4845
+ $[16] = searchString;
4846
+ $[17] = sortByProperty;
4847
+ $[18] = t4;
4738
4848
  } else {
4739
- t3 = $[14];
4849
+ t4 = $[18];
4740
4850
  }
4741
- let t4;
4742
- if ($[15] !== currentSort || $[16] !== filterValues || $[17] !== itemCount || $[18] !== path || $[19] !== searchString || $[20] !== sortByProperty) {
4743
- t4 = [path, itemCount, currentSort, sortByProperty, filterValues, searchString];
4744
- $[15] = currentSort;
4745
- $[16] = filterValues;
4746
- $[17] = itemCount;
4747
- $[18] = path;
4748
- $[19] = searchString;
4749
- $[20] = sortByProperty;
4750
- $[21] = t4;
4851
+ let t5;
4852
+ if ($[19] !== currentSort || $[20] !== filterValues || $[21] !== itemCount || $[22] !== path || $[23] !== searchString || $[24] !== sortByProperty) {
4853
+ t5 = [path, itemCount, currentSort, sortByProperty, filterValues, searchString];
4854
+ $[19] = currentSort;
4855
+ $[20] = filterValues;
4856
+ $[21] = itemCount;
4857
+ $[22] = path;
4858
+ $[23] = searchString;
4859
+ $[24] = sortByProperty;
4860
+ $[25] = t5;
4751
4861
  } else {
4752
- t4 = $[21];
4862
+ t5 = $[25];
4753
4863
  }
4754
- React.useEffect(t3, t4);
4755
- let t5;
4756
- if ($[22] !== data || $[23] !== dataLoading || $[24] !== dataLoadingError || $[25] !== noMoreToLoad) {
4757
- t5 = {
4864
+ React.useEffect(t4, t5);
4865
+ let t6;
4866
+ if ($[26] !== data || $[27] !== dataLoading || $[28] !== dataLoadingError || $[29] !== noMoreToLoad) {
4867
+ t6 = {
4758
4868
  data,
4759
4869
  dataLoading,
4760
4870
  dataLoadingError,
4761
4871
  noMoreToLoad
4762
4872
  };
4763
- $[22] = data;
4764
- $[23] = dataLoading;
4765
- $[24] = dataLoadingError;
4766
- $[25] = noMoreToLoad;
4767
- $[26] = t5;
4873
+ $[26] = data;
4874
+ $[27] = dataLoading;
4875
+ $[28] = dataLoadingError;
4876
+ $[29] = noMoreToLoad;
4877
+ $[30] = t6;
4768
4878
  } else {
4769
- t5 = $[26];
4879
+ t6 = $[30];
4770
4880
  }
4771
- return t5;
4881
+ return t6;
4772
4882
  }
4773
4883
  function _temp2$f() {
4774
4884
  }
@@ -4779,7 +4889,7 @@
4779
4889
  }
4780
4890
  const CACHE = {};
4781
4891
  function useEntityFetch(t0) {
4782
- const $ = reactCompilerRuntime.c(19);
4892
+ const $ = reactCompilerRuntime.c(23);
4783
4893
  const {
4784
4894
  path: inputPath,
4785
4895
  pathSegments: inputPathSegments,
@@ -4792,23 +4902,33 @@
4792
4902
  const dataSource = useDataSource();
4793
4903
  const navigationController = useNavigationController();
4794
4904
  let t2;
4795
- if ($[0] !== inputPath || $[1] !== navigationController) {
4796
- t2 = navigationController.resolveIdsFrom(inputPath);
4797
- $[0] = inputPath;
4905
+ if ($[0] !== inputPathSegments || $[1] !== navigationController) {
4906
+ t2 = inputPathSegments ? navigationController.resolveSegmentsFrom?.(inputPathSegments) ?? inputPathSegments : void 0;
4907
+ $[0] = inputPathSegments;
4798
4908
  $[1] = navigationController;
4799
4909
  $[2] = t2;
4800
4910
  } else {
4801
4911
  t2 = $[2];
4802
4912
  }
4803
- const path = t2;
4804
- const pathSegments = inputPathSegments;
4913
+ const pathSegments = t2;
4914
+ let t3;
4915
+ if ($[3] !== inputPath || $[4] !== inputPathSegments || $[5] !== navigationController) {
4916
+ t3 = navigationController.resolveIdsFrom(inputPath, inputPathSegments);
4917
+ $[3] = inputPath;
4918
+ $[4] = inputPathSegments;
4919
+ $[5] = navigationController;
4920
+ $[6] = t3;
4921
+ } else {
4922
+ t3 = $[6];
4923
+ }
4924
+ const path = t3;
4805
4925
  const context = useFireCMSContext();
4806
4926
  const [entity, setEntity] = React.useState();
4807
4927
  const [dataLoading, setDataLoading] = React.useState(true);
4808
4928
  const [dataLoadingError, setDataLoadingError] = React.useState();
4809
- let t3;
4810
- if ($[3] !== collection || $[4] !== context || $[5] !== dataSource || $[6] !== databaseId || $[7] !== entityId || $[8] !== path || $[9] !== pathSegments || $[10] !== useCache) {
4811
- t3 = () => {
4929
+ let t4;
4930
+ if ($[7] !== collection || $[8] !== context || $[9] !== dataSource || $[10] !== databaseId || $[11] !== entityId || $[12] !== path || $[13] !== pathSegments || $[14] !== useCache) {
4931
+ t4 = () => {
4812
4932
  setDataLoading(true);
4813
4933
  const onEntityUpdate = async (updatedEntity) => {
4814
4934
  if (updatedEntity && pathSegments && !updatedEntity.pathSegments) {
@@ -4822,11 +4942,12 @@
4822
4942
  updatedEntity = await collection.callbacks.onFetch({
4823
4943
  collection,
4824
4944
  path,
4945
+ pathSegments,
4825
4946
  entity: updatedEntity,
4826
4947
  context
4827
4948
  });
4828
- } catch (t42) {
4829
- const e = t42;
4949
+ } catch (t52) {
4950
+ const e = t52;
4830
4951
  console.error(e);
4831
4952
  }
4832
4953
  }
@@ -4874,43 +4995,43 @@
4874
4995
  }
4875
4996
  }
4876
4997
  };
4877
- $[3] = collection;
4878
- $[4] = context;
4879
- $[5] = dataSource;
4880
- $[6] = databaseId;
4881
- $[7] = entityId;
4882
- $[8] = path;
4883
- $[9] = pathSegments;
4884
- $[10] = useCache;
4885
- $[11] = t3;
4998
+ $[7] = collection;
4999
+ $[8] = context;
5000
+ $[9] = dataSource;
5001
+ $[10] = databaseId;
5002
+ $[11] = entityId;
5003
+ $[12] = path;
5004
+ $[13] = pathSegments;
5005
+ $[14] = useCache;
5006
+ $[15] = t4;
4886
5007
  } else {
4887
- t3 = $[11];
5008
+ t4 = $[15];
4888
5009
  }
4889
- let t4;
4890
- if ($[12] !== entityId || $[13] !== path) {
4891
- t4 = [entityId, path];
4892
- $[12] = entityId;
4893
- $[13] = path;
4894
- $[14] = t4;
5010
+ let t5;
5011
+ if ($[16] !== entityId || $[17] !== path) {
5012
+ t5 = [entityId, path];
5013
+ $[16] = entityId;
5014
+ $[17] = path;
5015
+ $[18] = t5;
4895
5016
  } else {
4896
- t4 = $[14];
5017
+ t5 = $[18];
4897
5018
  }
4898
- React.useEffect(t3, t4);
4899
- let t5;
4900
- if ($[15] !== dataLoading || $[16] !== dataLoadingError || $[17] !== entity) {
4901
- t5 = {
5019
+ React.useEffect(t4, t5);
5020
+ let t6;
5021
+ if ($[19] !== dataLoading || $[20] !== dataLoadingError || $[21] !== entity) {
5022
+ t6 = {
4902
5023
  entity,
4903
5024
  dataLoading,
4904
5025
  dataLoadingError
4905
5026
  };
4906
- $[15] = dataLoading;
4907
- $[16] = dataLoadingError;
4908
- $[17] = entity;
4909
- $[18] = t5;
5027
+ $[19] = dataLoading;
5028
+ $[20] = dataLoadingError;
5029
+ $[21] = entity;
5030
+ $[22] = t6;
4910
5031
  } else {
4911
- t5 = $[18];
5032
+ t6 = $[22];
4912
5033
  }
4913
- return t5;
5034
+ return t6;
4914
5035
  }
4915
5036
  function _temp3$5() {
4916
5037
  }
@@ -4938,7 +5059,7 @@
4938
5059
  }
4939
5060
  let updatedValues;
4940
5061
  const customizationController = context.customizationController;
4941
- const resolvedPath = context.navigation.resolveIdsFrom(path);
5062
+ const resolvedPath = context.navigation.resolveIdsFrom(path, pathSegments);
4942
5063
  const callbacks = collection.callbacks;
4943
5064
  if (callbacks?.onPreSave) {
4944
5065
  try {
@@ -4953,6 +5074,7 @@
4953
5074
  updatedValues = await callbacks.onPreSave({
4954
5075
  collection: resolvedCollection,
4955
5076
  path,
5077
+ pathSegments,
4956
5078
  resolvedPath,
4957
5079
  entityId,
4958
5080
  values,
@@ -4990,6 +5112,7 @@
4990
5112
  callbacks.onSaveSuccess({
4991
5113
  collection: resolvedCollection,
4992
5114
  path,
5115
+ pathSegments,
4993
5116
  resolvedPath,
4994
5117
  entityId: entity.id,
4995
5118
  values: updatedValues,
@@ -5015,6 +5138,7 @@
5015
5138
  callbacks.onSaveFailure({
5016
5139
  collection: resolvedCollection,
5017
5140
  path,
5141
+ pathSegments,
5018
5142
  resolvedPath,
5019
5143
  entityId,
5020
5144
  values: updatedValues,
@@ -5029,6 +5153,7 @@
5029
5153
  async function deleteEntityWithCallbacks({
5030
5154
  dataSource,
5031
5155
  entity,
5156
+ pathSegments,
5032
5157
  collection,
5033
5158
  callbacks,
5034
5159
  onDeleteSuccess,
@@ -5038,11 +5163,13 @@
5038
5163
  context
5039
5164
  }) {
5040
5165
  console.debug("Deleting entity", entity.path, entity.id);
5166
+ const resolvedPathSegments = pathSegments ?? entity.pathSegments;
5041
5167
  const entityDeleteProps = {
5042
5168
  entity,
5043
5169
  collection,
5044
5170
  entityId: entity.id,
5045
5171
  path: entity.path,
5172
+ pathSegments: resolvedPathSegments,
5046
5173
  context
5047
5174
  };
5048
5175
  if (callbacks?.onPreDelete) {
@@ -5055,8 +5182,7 @@
5055
5182
  }
5056
5183
  }
5057
5184
  return dataSource.deleteEntity({
5058
- // Carried by the entity from the fetch that produced it; undefined if unknown.
5059
- pathSegments: entity.pathSegments,
5185
+ pathSegments: resolvedPathSegments,
5060
5186
  entity,
5061
5187
  collection
5062
5188
  }).then(() => {
@@ -5092,7 +5218,7 @@
5092
5218
  if (entry.type === "collection") {
5093
5219
  return Promise.resolve(entry);
5094
5220
  } else if (entry.type === "entity") {
5095
- const collection = navigation.getCollection(entry.path);
5221
+ const collection = navigation.getCollection(entry.path, false, entry.pathSegments);
5096
5222
  if (!collection) {
5097
5223
  throw Error(`No collection defined in the navigation for the entity with path ${entry.path}`);
5098
5224
  }
@@ -6499,7 +6625,7 @@
6499
6625
  const sideEntityController = useSideEntityController();
6500
6626
  const customizationController = useCustomizationController();
6501
6627
  const navigationController = useNavigationController();
6502
- const collection = collectionProp ?? navigationController.getCollection(entity.path);
6628
+ const collection = collectionProp ?? navigationController.getCollection(entity.path, false, entity.pathSegments);
6503
6629
  if (!collection) {
6504
6630
  throw Error(`Couldn't find the corresponding collection view for the path: ${entity.path}`);
6505
6631
  }
@@ -6542,6 +6668,9 @@
6542
6668
  sideEntityController.open({
6543
6669
  entityId: entity.id,
6544
6670
  path: entity.path,
6671
+ // Paired with `entity.path` above; undefined if the entity was
6672
+ // loaded without them.
6673
+ pathSegments: entity.pathSegments,
6545
6674
  collection,
6546
6675
  updateUrl: true
6547
6676
  });
@@ -6666,7 +6795,7 @@
6666
6795
  return t0;
6667
6796
  };
6668
6797
  function ReferencePreviewInternal(t0) {
6669
- const $ = reactCompilerRuntime.c(22);
6798
+ const $ = reactCompilerRuntime.c(23);
6670
6799
  const {
6671
6800
  disabled,
6672
6801
  reference,
@@ -6682,70 +6811,71 @@
6682
6811
  const customizationController = useCustomizationController();
6683
6812
  const navigationController = useNavigationController();
6684
6813
  let t3;
6685
- if ($[0] !== navigationController || $[1] !== reference.path) {
6686
- t3 = navigationController.getCollection(reference.path);
6814
+ if ($[0] !== navigationController || $[1] !== reference.path || $[2] !== reference.pathSegments) {
6815
+ t3 = navigationController.getCollection(reference.path, false, reference.pathSegments);
6687
6816
  $[0] = navigationController;
6688
6817
  $[1] = reference.path;
6689
- $[2] = t3;
6818
+ $[2] = reference.pathSegments;
6819
+ $[3] = t3;
6690
6820
  } else {
6691
- t3 = $[2];
6821
+ t3 = $[3];
6692
6822
  }
6693
6823
  const collection = t3;
6694
6824
  if (!collection) {
6695
6825
  if (customizationController.components?.missingReference) {
6696
6826
  let t42;
6697
- if ($[3] !== customizationController.components.missingReference || $[4] !== reference.path) {
6827
+ if ($[4] !== customizationController.components.missingReference || $[5] !== reference.path) {
6698
6828
  t42 = /* @__PURE__ */ jsxRuntime.jsx(customizationController.components.missingReference, { path: reference.path });
6699
- $[3] = customizationController.components.missingReference;
6700
- $[4] = reference.path;
6701
- $[5] = t42;
6829
+ $[4] = customizationController.components.missingReference;
6830
+ $[5] = reference.path;
6831
+ $[6] = t42;
6702
6832
  } else {
6703
- t42 = $[5];
6833
+ t42 = $[6];
6704
6834
  }
6705
6835
  return t42;
6706
6836
  } else {
6707
6837
  const t42 = size ?? "medium";
6708
6838
  let t5;
6709
- if ($[6] !== reference.pathWithId) {
6839
+ if ($[7] !== reference.pathWithId) {
6710
6840
  t5 = /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "Unexpected reference value. Click to edit", tooltip: reference.pathWithId });
6711
- $[6] = reference.pathWithId;
6712
- $[7] = t5;
6841
+ $[7] = reference.pathWithId;
6842
+ $[8] = t5;
6713
6843
  } else {
6714
- t5 = $[7];
6844
+ t5 = $[8];
6715
6845
  }
6716
6846
  let t6;
6717
- if ($[8] !== onClick || $[9] !== t42 || $[10] !== t5) {
6847
+ if ($[9] !== onClick || $[10] !== t42 || $[11] !== t5) {
6718
6848
  t6 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreviewContainer, { onClick, size: t42, children: t5 });
6719
- $[8] = onClick;
6720
- $[9] = t42;
6721
- $[10] = t5;
6722
- $[11] = t6;
6849
+ $[9] = onClick;
6850
+ $[10] = t42;
6851
+ $[11] = t5;
6852
+ $[12] = t6;
6723
6853
  } else {
6724
- t6 = $[11];
6854
+ t6 = $[12];
6725
6855
  }
6726
6856
  return t6;
6727
6857
  }
6728
6858
  }
6729
6859
  let t4;
6730
- if ($[12] !== collection || $[13] !== disabled || $[14] !== hover || $[15] !== includeEntityLink || $[16] !== includeId || $[17] !== onClick || $[18] !== previewProperties || $[19] !== reference || $[20] !== size) {
6860
+ if ($[13] !== collection || $[14] !== disabled || $[15] !== hover || $[16] !== includeEntityLink || $[17] !== includeId || $[18] !== onClick || $[19] !== previewProperties || $[20] !== reference || $[21] !== size) {
6731
6861
  t4 = /* @__PURE__ */ jsxRuntime.jsx(ReferencePreviewExisting, { reference, collection, previewProperties, size, disabled, includeEntityLink, includeId, onClick, hover });
6732
- $[12] = collection;
6733
- $[13] = disabled;
6734
- $[14] = hover;
6735
- $[15] = includeEntityLink;
6736
- $[16] = includeId;
6737
- $[17] = onClick;
6738
- $[18] = previewProperties;
6739
- $[19] = reference;
6740
- $[20] = size;
6741
- $[21] = t4;
6862
+ $[13] = collection;
6863
+ $[14] = disabled;
6864
+ $[15] = hover;
6865
+ $[16] = includeEntityLink;
6866
+ $[17] = includeId;
6867
+ $[18] = onClick;
6868
+ $[19] = previewProperties;
6869
+ $[20] = reference;
6870
+ $[21] = size;
6871
+ $[22] = t4;
6742
6872
  } else {
6743
- t4 = $[21];
6873
+ t4 = $[22];
6744
6874
  }
6745
6875
  return t4;
6746
6876
  }
6747
6877
  function ReferencePreviewExisting(t0) {
6748
- const $ = reactCompilerRuntime.c(35);
6878
+ const $ = reactCompilerRuntime.c(36);
6749
6879
  const {
6750
6880
  reference,
6751
6881
  collection,
@@ -6758,9 +6888,10 @@
6758
6888
  hover
6759
6889
  } = t0;
6760
6890
  let t1;
6761
- if ($[0] !== collection || $[1] !== reference.id || $[2] !== reference.path) {
6891
+ if ($[0] !== collection || $[1] !== reference.id || $[2] !== reference.path || $[3] !== reference.pathSegments) {
6762
6892
  t1 = {
6763
6893
  path: reference.path,
6894
+ pathSegments: reference.pathSegments,
6764
6895
  entityId: reference.id,
6765
6896
  collection,
6766
6897
  useCache: true
@@ -6768,9 +6899,10 @@
6768
6899
  $[0] = collection;
6769
6900
  $[1] = reference.id;
6770
6901
  $[2] = reference.path;
6771
- $[3] = t1;
6902
+ $[3] = reference.pathSegments;
6903
+ $[4] = t1;
6772
6904
  } else {
6773
- t1 = $[3];
6905
+ t1 = $[4];
6774
6906
  }
6775
6907
  const {
6776
6908
  entity,
@@ -6780,34 +6912,34 @@
6780
6912
  referencesCache.set(reference.pathWithId, entity);
6781
6913
  }
6782
6914
  let t2;
6783
- if ($[4] !== entity || $[5] !== reference.pathWithId) {
6915
+ if ($[5] !== entity || $[6] !== reference.pathWithId) {
6784
6916
  t2 = entity ?? referencesCache.get(reference.pathWithId);
6785
- $[4] = entity;
6786
- $[5] = reference.pathWithId;
6787
- $[6] = t2;
6917
+ $[5] = entity;
6918
+ $[6] = reference.pathWithId;
6919
+ $[7] = t2;
6788
6920
  } else {
6789
- t2 = $[6];
6921
+ t2 = $[7];
6790
6922
  }
6791
6923
  const usedEntity = t2;
6792
6924
  let body;
6793
6925
  if (!reference) {
6794
6926
  let t32;
6795
- if ($[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6927
+ if ($[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6796
6928
  t32 = /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "Reference not set" });
6797
- $[7] = t32;
6929
+ $[8] = t32;
6798
6930
  } else {
6799
- t32 = $[7];
6931
+ t32 = $[8];
6800
6932
  }
6801
6933
  body = t32;
6802
6934
  } else {
6803
6935
  if (usedEntity && !usedEntity.values) {
6804
6936
  let t32;
6805
- if ($[8] !== reference.path) {
6937
+ if ($[9] !== reference.path) {
6806
6938
  t32 = /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "Reference does not exist", tooltip: reference.path });
6807
- $[8] = reference.path;
6808
- $[9] = t32;
6939
+ $[9] = reference.path;
6940
+ $[10] = t32;
6809
6941
  } else {
6810
- t32 = $[9];
6942
+ t32 = $[10];
6811
6943
  }
6812
6944
  body = t32;
6813
6945
  }
@@ -6816,15 +6948,15 @@
6816
6948
  const t32 = disabled ? void 0 : onClick;
6817
6949
  const t4 = disabled ? void 0 : hover;
6818
6950
  let t5;
6819
- if ($[10] !== body || $[11] !== size || $[12] !== t32 || $[13] !== t4) {
6951
+ if ($[11] !== body || $[12] !== size || $[13] !== t32 || $[14] !== t4) {
6820
6952
  t5 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreviewContainer, { onClick: t32, hover: t4, size, children: body });
6821
- $[10] = body;
6822
- $[11] = size;
6823
- $[12] = t32;
6824
- $[13] = t4;
6825
- $[14] = t5;
6953
+ $[11] = body;
6954
+ $[12] = size;
6955
+ $[13] = t32;
6956
+ $[14] = t4;
6957
+ $[15] = t5;
6826
6958
  } else {
6827
- t5 = $[14];
6959
+ t5 = $[15];
6828
6960
  }
6829
6961
  return t5;
6830
6962
  }
@@ -6832,21 +6964,21 @@
6832
6964
  const t32 = disabled ? void 0 : onClick;
6833
6965
  const t4 = disabled ? void 0 : hover;
6834
6966
  let t5;
6835
- if ($[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6967
+ if ($[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6836
6968
  t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, {});
6837
- $[15] = t5;
6969
+ $[16] = t5;
6838
6970
  } else {
6839
- t5 = $[15];
6971
+ t5 = $[16];
6840
6972
  }
6841
6973
  let t6;
6842
- if ($[16] !== size || $[17] !== t32 || $[18] !== t4) {
6974
+ if ($[17] !== size || $[18] !== t32 || $[19] !== t4) {
6843
6975
  t6 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreviewContainer, { onClick: t32, hover: t4, size, children: t5 });
6844
- $[16] = size;
6845
- $[17] = t32;
6846
- $[18] = t4;
6847
- $[19] = t6;
6976
+ $[17] = size;
6977
+ $[18] = t32;
6978
+ $[19] = t4;
6979
+ $[20] = t6;
6848
6980
  } else {
6849
- t6 = $[19];
6981
+ t6 = $[20];
6850
6982
  }
6851
6983
  return t6;
6852
6984
  }
@@ -6854,39 +6986,39 @@
6854
6986
  const t32 = disabled ? void 0 : onClick;
6855
6987
  const t4 = disabled ? void 0 : hover;
6856
6988
  let t5;
6857
- if ($[20] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6989
+ if ($[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
6858
6990
  t5 = /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "Entity not found" });
6859
- $[20] = t5;
6991
+ $[21] = t5;
6860
6992
  } else {
6861
- t5 = $[20];
6993
+ t5 = $[21];
6862
6994
  }
6863
6995
  let t6;
6864
- if ($[21] !== size || $[22] !== t32 || $[23] !== t4) {
6996
+ if ($[22] !== size || $[23] !== t32 || $[24] !== t4) {
6865
6997
  t6 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreviewContainer, { onClick: t32, hover: t4, size, children: t5 });
6866
- $[21] = size;
6867
- $[22] = t32;
6868
- $[23] = t4;
6869
- $[24] = t6;
6998
+ $[22] = size;
6999
+ $[23] = t32;
7000
+ $[24] = t4;
7001
+ $[25] = t6;
6870
7002
  } else {
6871
- t6 = $[24];
7003
+ t6 = $[25];
6872
7004
  }
6873
7005
  return t6;
6874
7006
  }
6875
7007
  let t3;
6876
- if ($[25] !== collection || $[26] !== disabled || $[27] !== hover || $[28] !== includeEntityLink || $[29] !== includeId || $[30] !== onClick || $[31] !== previewProperties || $[32] !== size || $[33] !== usedEntity) {
7008
+ if ($[26] !== collection || $[27] !== disabled || $[28] !== hover || $[29] !== includeEntityLink || $[30] !== includeId || $[31] !== onClick || $[32] !== previewProperties || $[33] !== size || $[34] !== usedEntity) {
6877
7009
  t3 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreview, { size, previewKeys: previewProperties, disabled, entity: usedEntity, collection, onClick, includeEntityLink, includeId, hover });
6878
- $[25] = collection;
6879
- $[26] = disabled;
6880
- $[27] = hover;
6881
- $[28] = includeEntityLink;
6882
- $[29] = includeId;
6883
- $[30] = onClick;
6884
- $[31] = previewProperties;
6885
- $[32] = size;
6886
- $[33] = usedEntity;
6887
- $[34] = t3;
7010
+ $[26] = collection;
7011
+ $[27] = disabled;
7012
+ $[28] = hover;
7013
+ $[29] = includeEntityLink;
7014
+ $[30] = includeId;
7015
+ $[31] = onClick;
7016
+ $[32] = previewProperties;
7017
+ $[33] = size;
7018
+ $[34] = usedEntity;
7019
+ $[35] = t3;
6888
7020
  } else {
6889
- t3 = $[34];
7021
+ t3 = $[35];
6890
7022
  }
6891
7023
  return t3;
6892
7024
  }
@@ -16797,6 +16929,7 @@
16797
16929
  entityId: entityIdProp,
16798
16930
  collection,
16799
16931
  path,
16932
+ pathSegments,
16800
16933
  values: valuesToBeSaved
16801
16934
  });
16802
16935
  }, false, 2e3);
@@ -16970,6 +17103,7 @@
16970
17103
  entity: updatedEntity,
16971
17104
  status,
16972
17105
  path,
17106
+ pathSegments,
16973
17107
  entityId: updatedEntity.id,
16974
17108
  collection
16975
17109
  });
@@ -16988,10 +17122,12 @@
16988
17122
  previousValues,
16989
17123
  entityId: entityId_0,
16990
17124
  collection: collection_0,
16991
- path: path_0
17125
+ path: path_0,
17126
+ pathSegments: pathSegments_0
16992
17127
  }) => {
16993
17128
  return saveEntityWithCallbacks({
16994
17129
  path: path_0,
17130
+ pathSegments: pathSegments_0,
16995
17131
  entityId: entityId_0,
16996
17132
  values: values_2,
16997
17133
  previousValues,
@@ -17008,6 +17144,7 @@
17008
17144
  const onSaveEntityRequest = async ({
17009
17145
  collection: collection_1,
17010
17146
  path: path_1,
17147
+ pathSegments: pathSegments_1,
17011
17148
  entityId: entityId_1,
17012
17149
  values: values_3,
17013
17150
  previousValues: previousValues_0,
@@ -17020,6 +17157,7 @@
17020
17157
  return saveEntity({
17021
17158
  collection: collection_1,
17022
17159
  path: path_1,
17160
+ pathSegments: pathSegments_1,
17023
17161
  entityId: entityId_1,
17024
17162
  values: values_3,
17025
17163
  previousValues: previousValues_0
@@ -17032,6 +17170,7 @@
17032
17170
  return onSaveEntityRequest({
17033
17171
  collection: resolvedCollection,
17034
17172
  path,
17173
+ pathSegments,
17035
17174
  entityId,
17036
17175
  values: values_4,
17037
17176
  previousValues: entity?.values,
@@ -17076,12 +17215,13 @@
17076
17215
  const pluginBeforeTitle = [];
17077
17216
  const plugins = customizationController.plugins;
17078
17217
  const actionsDisabled = disabled || formex$1.isSubmitting || status === "existing" && !formex$1.dirty || Boolean(disabledProp);
17079
- const parentCollectionIds = navigationController.getParentCollectionIds(path);
17218
+ const parentCollectionIds = navigationController.getParentCollectionIds(path, pathSegments);
17080
17219
  if (plugins && collection) {
17081
17220
  const actionProps = {
17082
17221
  entityId,
17083
17222
  parentCollectionIds,
17084
17223
  path,
17224
+ pathSegments,
17085
17225
  status,
17086
17226
  collection,
17087
17227
  context,
@@ -17230,7 +17370,7 @@
17230
17370
  if (!resolvedCollection || !path) {
17231
17371
  throw Error("INTERNAL: Collection and path must be defined in form context");
17232
17372
  }
17233
- const dialogActions = /* @__PURE__ */ jsxRuntime.jsx(EntityFormActionsComponent, { collection: resolvedCollection, path, fullPath: path, fullIdPath, entity, layout: forceActionsAtTheBottom ? "bottom" : "side", savingError, formex: formex$1, disabled: actionsDisabled, status, pluginActions: pluginActions ?? [], openEntityMode, showDefaultActions, navigateBack, formContext });
17373
+ const dialogActions = /* @__PURE__ */ jsxRuntime.jsx(EntityFormActionsComponent, { collection: resolvedCollection, path, pathSegments, fullPath: path, fullIdPath, entity, layout: forceActionsAtTheBottom ? "bottom" : "side", savingError, formex: formex$1, disabled: actionsDisabled, status, pluginActions: pluginActions ?? [], openEntityMode, showDefaultActions, navigateBack, formContext });
17234
17374
  return /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: formex$1.handleSubmit, onReset: () => formex$1.resetForm({
17235
17375
  values: baseInitialValues
17236
17376
  }), noValidate: true, className: ui.cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", className), children: [
@@ -20093,8 +20233,8 @@
20093
20233
  const [popupCell, setPopupCell] = React.useState(void 0);
20094
20234
  const navigation = useNavigationController();
20095
20235
  const dataSource = useDataSource();
20096
- const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
20097
- const resolvedPathSegments = pathSegments;
20236
+ const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath, pathSegments), [fullPath, pathSegments, navigation.resolveIdsFrom]);
20237
+ const resolvedPathSegments = React.useMemo(() => pathSegments ? navigation.resolveSegmentsFrom?.(pathSegments) ?? pathSegments : void 0, [pathSegments, navigation.resolveSegmentsFrom]);
20098
20238
  const forceFilter = forceFilterFromProps ?? forceFilterFromCollection;
20099
20239
  const paginationEnabled = collection.pagination === void 0 || Boolean(collection.pagination);
20100
20240
  const pageSize = typeof collection.pagination === "number" ? collection.pagination : DEFAULT_PAGE_SIZE$1;
@@ -20202,6 +20342,7 @@
20202
20342
  entities = await Promise.all(entities.map((entity) => collection.callbacks.onFetch({
20203
20343
  collection,
20204
20344
  path: resolvedPath,
20345
+ pathSegments: resolvedPathSegments,
20205
20346
  entity,
20206
20347
  context
20207
20348
  })));
@@ -20358,10 +20499,11 @@
20358
20499
  };
20359
20500
  }
20360
20501
  function useTableSearchHelper(t0) {
20361
- const $ = reactCompilerRuntime.c(18);
20502
+ const $ = reactCompilerRuntime.c(19);
20362
20503
  const {
20363
20504
  collection,
20364
20505
  fullPath,
20506
+ pathSegments,
20365
20507
  parentCollectionIds,
20366
20508
  initialSearchString
20367
20509
  } = t0;
@@ -20373,11 +20515,12 @@
20373
20515
  const autoInitialisedRef = React.useRef(false);
20374
20516
  let onTextSearchClick;
20375
20517
  let textSearchEnabled;
20376
- if ($[0] !== collection || $[1] !== context || $[2] !== customizationController.plugins || $[3] !== dataSource || $[4] !== fullPath || $[5] !== parentCollectionIds) {
20518
+ if ($[0] !== collection || $[1] !== context || $[2] !== customizationController.plugins || $[3] !== dataSource || $[4] !== fullPath || $[5] !== parentCollectionIds || $[6] !== pathSegments) {
20377
20519
  textSearchEnabled = Boolean(collection.textSearchEnabled);
20378
20520
  const props = {
20379
20521
  context,
20380
20522
  path: fullPath,
20523
+ pathSegments,
20381
20524
  databaseId: collection.databaseId,
20382
20525
  collection,
20383
20526
  parentCollectionIds
@@ -20397,6 +20540,7 @@
20397
20540
  promises.push(p_1.collectionView.onTextSearchClick({
20398
20541
  context,
20399
20542
  path: fullPath,
20543
+ pathSegments,
20400
20544
  collection,
20401
20545
  parentCollectionIds
20402
20546
  }));
@@ -20428,15 +20572,16 @@
20428
20572
  $[3] = dataSource;
20429
20573
  $[4] = fullPath;
20430
20574
  $[5] = parentCollectionIds;
20431
- $[6] = onTextSearchClick;
20432
- $[7] = textSearchEnabled;
20575
+ $[6] = pathSegments;
20576
+ $[7] = onTextSearchClick;
20577
+ $[8] = textSearchEnabled;
20433
20578
  } else {
20434
- onTextSearchClick = $[6];
20435
- textSearchEnabled = $[7];
20579
+ onTextSearchClick = $[7];
20580
+ textSearchEnabled = $[8];
20436
20581
  }
20437
20582
  const shouldAutoInitialise = Boolean(initialSearchString) && textSearchEnabled && !textSearchInitialised && Boolean(onTextSearchClick);
20438
20583
  let t1;
20439
- if ($[8] !== onTextSearchClick || $[9] !== shouldAutoInitialise) {
20584
+ if ($[9] !== onTextSearchClick || $[10] !== shouldAutoInitialise) {
20440
20585
  t1 = () => {
20441
20586
  if (autoInitialisedRef.current || !shouldAutoInitialise) {
20442
20587
  return;
@@ -20444,36 +20589,36 @@
20444
20589
  autoInitialisedRef.current = true;
20445
20590
  onTextSearchClick?.();
20446
20591
  };
20447
- $[8] = onTextSearchClick;
20448
- $[9] = shouldAutoInitialise;
20449
- $[10] = t1;
20592
+ $[9] = onTextSearchClick;
20593
+ $[10] = shouldAutoInitialise;
20594
+ $[11] = t1;
20450
20595
  } else {
20451
- t1 = $[10];
20596
+ t1 = $[11];
20452
20597
  }
20453
20598
  let t2;
20454
- if ($[11] !== shouldAutoInitialise) {
20599
+ if ($[12] !== shouldAutoInitialise) {
20455
20600
  t2 = [shouldAutoInitialise];
20456
- $[11] = shouldAutoInitialise;
20457
- $[12] = t2;
20601
+ $[12] = shouldAutoInitialise;
20602
+ $[13] = t2;
20458
20603
  } else {
20459
- t2 = $[12];
20604
+ t2 = $[13];
20460
20605
  }
20461
20606
  React.useEffect(t1, t2);
20462
20607
  let t3;
20463
- if ($[13] !== onTextSearchClick || $[14] !== textSearchEnabled || $[15] !== textSearchInitialised || $[16] !== textSearchLoading) {
20608
+ if ($[14] !== onTextSearchClick || $[15] !== textSearchEnabled || $[16] !== textSearchInitialised || $[17] !== textSearchLoading) {
20464
20609
  t3 = {
20465
20610
  textSearchLoading,
20466
20611
  textSearchInitialised,
20467
20612
  onTextSearchClick,
20468
20613
  textSearchEnabled
20469
20614
  };
20470
- $[13] = onTextSearchClick;
20471
- $[14] = textSearchEnabled;
20472
- $[15] = textSearchInitialised;
20473
- $[16] = textSearchLoading;
20474
- $[17] = t3;
20615
+ $[14] = onTextSearchClick;
20616
+ $[15] = textSearchEnabled;
20617
+ $[16] = textSearchInitialised;
20618
+ $[17] = textSearchLoading;
20619
+ $[18] = t3;
20475
20620
  } else {
20476
- t3 = $[17];
20621
+ t3 = $[18];
20477
20622
  }
20478
20623
  return t3;
20479
20624
  }
@@ -20542,6 +20687,8 @@
20542
20687
  const performDelete = React.useCallback((entity_3) => deleteEntityWithCallbacks({
20543
20688
  dataSource,
20544
20689
  entity: entity_3,
20690
+ // The entity is the authority on where it lives; stated rather than left implicit.
20691
+ pathSegments: entity_3.pathSegments,
20545
20692
  collection: resolvedCollection,
20546
20693
  callbacks,
20547
20694
  onDeleteSuccess,
@@ -20643,6 +20790,7 @@
20643
20790
  entity,
20644
20791
  collection,
20645
20792
  fullPath,
20793
+ pathSegments,
20646
20794
  fullIdPath,
20647
20795
  context,
20648
20796
  highlightEntity,
@@ -20661,6 +20809,7 @@
20661
20809
  addRecentId(collection.id, entity.id);
20662
20810
  }
20663
20811
  const path = collection?.collectionGroup ? entity.path : fullPath ?? collection?.path ?? entity.path;
20812
+ const resolvedPathSegments = collection?.collectionGroup ? entity.pathSegments : pathSegments ?? entity.pathSegments;
20664
20813
  const newFullIdPath = collection?.collectionGroup ? collection.id : fullIdPath ?? collection?.id ?? entity.path;
20665
20814
  const defaultSelectedView = resolveDefaultSelectedView(collection ? collection.defaultSelectedView : void 0, {
20666
20815
  status: "existing",
@@ -20671,6 +20820,7 @@
20671
20820
  collection,
20672
20821
  entityId: entity.id,
20673
20822
  path,
20823
+ pathSegments: resolvedPathSegments,
20674
20824
  fullIdPath: newFullIdPath,
20675
20825
  sideEntityController: context.sideEntityController,
20676
20826
  onClose: () => unhighlightEntity?.(entity),
@@ -20692,6 +20842,7 @@
20692
20842
  collection,
20693
20843
  context,
20694
20844
  fullPath,
20845
+ pathSegments,
20695
20846
  highlightEntity,
20696
20847
  unhighlightEntity,
20697
20848
  openEntityMode
@@ -20705,12 +20856,14 @@
20705
20856
  entityId: entity.id
20706
20857
  });
20707
20858
  const path = collection?.collectionGroup ? collection.path : fullPath ?? collection?.path ?? entity.path;
20859
+ const resolvedPathSegments = collection?.collectionGroup ? void 0 : pathSegments ?? entity.pathSegments;
20708
20860
  const fullIdPath = collection?.collectionGroup ? collection.id : fullPath ?? collection?.id ?? entity.path;
20709
20861
  navigateToEntity({
20710
20862
  openEntityMode,
20711
20863
  collection,
20712
20864
  entityId: entity.id,
20713
20865
  path,
20866
+ pathSegments: resolvedPathSegments,
20714
20867
  fullIdPath,
20715
20868
  copy: true,
20716
20869
  sideEntityController: context.sideEntityController,
@@ -20781,7 +20934,7 @@
20781
20934
  const navigation = useNavigationController();
20782
20935
  const analyticsController = useAnalyticsController();
20783
20936
  const customizationController = useCustomizationController();
20784
- const fullPath = navigation.resolveIdsFrom(pathInput);
20937
+ const fullPath = navigation.resolveIdsFrom(pathInput, pathSegments);
20785
20938
  const dataSource = useDataSource();
20786
20939
  const [entitiesDisplayedFirst, setEntitiesDisplayedFirst] = React.useState([]);
20787
20940
  const toggleEntitySelection = (entity) => {
@@ -20856,6 +21009,7 @@
20856
21009
  });
20857
21010
  sideEntityController.open({
20858
21011
  path: fullPath,
21012
+ pathSegments,
20859
21013
  collection,
20860
21014
  updateUrl: true,
20861
21015
  onUpdate: ({
@@ -20905,6 +21059,7 @@
20905
21059
  onTextSearchClick,
20906
21060
  textSearchEnabled
20907
21061
  } = useTableSearchHelper({
21062
+ pathSegments,
20908
21063
  collection,
20909
21064
  fullPath
20910
21065
  });
@@ -20916,7 +21071,7 @@
20916
21071
  }) : t("select_from", {
20917
21072
  name: collection.name
20918
21073
  })
20919
- ] }), defaultSize: collection.defaultSize, properties: resolvedCollection.properties, forceFilter, inlineEditing: false, selectionController, actions: /* @__PURE__ */ jsxRuntime.jsx(ReferenceDialogActions, { collection, path: fullPath, onNewClick, onClear }) }) }),
21074
+ ] }), defaultSize: collection.defaultSize, properties: resolvedCollection.properties, forceFilter, inlineEditing: false, selectionController, actions: /* @__PURE__ */ jsxRuntime.jsx(ReferenceDialogActions, { collection, path: fullPath, pathSegments, onNewClick, onClear }) }) }),
20920
21075
  /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { translucent: false, children: [
20921
21076
  description && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "body2", className: "flex-grow text-left", children: description }),
20922
21077
  /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: onDone, variant: "filled", children: t("done") })
@@ -20924,10 +21079,11 @@
20924
21079
  ] });
20925
21080
  }
20926
21081
  function ReferenceDialogActions(t0) {
20927
- const $ = reactCompilerRuntime.c(17);
21082
+ const $ = reactCompilerRuntime.c(18);
20928
21083
  const {
20929
21084
  collection,
20930
21085
  path,
21086
+ pathSegments,
20931
21087
  onClear,
20932
21088
  onNewClick
20933
21089
  } = t0;
@@ -20949,8 +21105,8 @@
20949
21105
  }
20950
21106
  const onClick = t1;
20951
21107
  let t2;
20952
- if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onClick || $[6] !== path || $[7] !== t) {
20953
- t2 = canCreateEntity(collection, authController, path, null) && onClick && (largeLayout ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), children: t("add_specific", {
21108
+ if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onClick || $[6] !== path || $[7] !== pathSegments || $[8] !== t) {
21109
+ t2 = canCreateEntity(collection, authController, path, null, pathSegments) && onClick && (largeLayout ? /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), children: t("add_specific", {
20954
21110
  name: collection.singularName ?? collection.name
20955
21111
  }) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick, children: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}) }));
20956
21112
  $[2] = authController;
@@ -20958,40 +21114,41 @@
20958
21114
  $[4] = largeLayout;
20959
21115
  $[5] = onClick;
20960
21116
  $[6] = path;
20961
- $[7] = t;
20962
- $[8] = t2;
21117
+ $[7] = pathSegments;
21118
+ $[8] = t;
21119
+ $[9] = t2;
20963
21120
  } else {
20964
- t2 = $[8];
21121
+ t2 = $[9];
20965
21122
  }
20966
21123
  const addButton = t2;
20967
21124
  let t3;
20968
- if ($[9] !== t) {
21125
+ if ($[10] !== t) {
20969
21126
  t3 = t("clear");
20970
- $[9] = t;
20971
- $[10] = t3;
21127
+ $[10] = t;
21128
+ $[11] = t3;
20972
21129
  } else {
20973
- t3 = $[10];
21130
+ t3 = $[11];
20974
21131
  }
20975
21132
  let t4;
20976
- if ($[11] !== onClear || $[12] !== t3) {
21133
+ if ($[12] !== onClear || $[13] !== t3) {
20977
21134
  t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: onClear, variant: "text", children: t3 });
20978
- $[11] = onClear;
20979
- $[12] = t3;
20980
- $[13] = t4;
21135
+ $[12] = onClear;
21136
+ $[13] = t3;
21137
+ $[14] = t4;
20981
21138
  } else {
20982
- t4 = $[13];
21139
+ t4 = $[14];
20983
21140
  }
20984
21141
  let t5;
20985
- if ($[14] !== addButton || $[15] !== t4) {
21142
+ if ($[15] !== addButton || $[16] !== t4) {
20986
21143
  t5 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
20987
21144
  t4,
20988
21145
  addButton
20989
21146
  ] });
20990
- $[14] = addButton;
20991
- $[15] = t4;
20992
- $[16] = t5;
21147
+ $[15] = addButton;
21148
+ $[16] = t4;
21149
+ $[17] = t5;
20993
21150
  } else {
20994
- t5 = $[16];
21151
+ t5 = $[17];
20995
21152
  }
20996
21153
  return t5;
20997
21154
  }
@@ -22907,7 +23064,7 @@
22907
23064
  return React.useContext(BreadcrumbContext);
22908
23065
  };
22909
23066
  function EntityCollectionViewActions(t0) {
22910
- const $ = reactCompilerRuntime.c(45);
23067
+ const $ = reactCompilerRuntime.c(48);
22911
23068
  const {
22912
23069
  collection,
22913
23070
  relativePath,
@@ -22916,6 +23073,7 @@
22916
23073
  onMultipleDeleteClick,
22917
23074
  selectionEnabled,
22918
23075
  path,
23076
+ pathSegments,
22919
23077
  selectionController,
22920
23078
  tableController,
22921
23079
  collectionEntitiesCount
@@ -22938,8 +23096,8 @@
22938
23096
  const largeLayout = useLargeLayout();
22939
23097
  const selectedEntities = selectionController.selectedEntities;
22940
23098
  let t2;
22941
- if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onNewClick || $[6] !== path || $[7] !== t) {
22942
- t2 = canCreateEntity(collection, authController, path, null) && onNewClick && (largeLayout ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { id: `add_entity_${path}`, onClick: onNewClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, { size: "small" }), variant: "filled", color: "primary", children: [
23099
+ if ($[2] !== authController || $[3] !== collection || $[4] !== largeLayout || $[5] !== onNewClick || $[6] !== path || $[7] !== pathSegments || $[8] !== t) {
23100
+ t2 = canCreateEntity(collection, authController, path, null, pathSegments) && onNewClick && (largeLayout ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { id: `add_entity_${path}`, onClick: onNewClick, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, { size: "small" }), variant: "filled", color: "primary", children: [
22943
23101
  t("add"),
22944
23102
  " ",
22945
23103
  collection.singularName ?? collection.name
@@ -22949,65 +23107,68 @@
22949
23107
  $[4] = largeLayout;
22950
23108
  $[5] = onNewClick;
22951
23109
  $[6] = path;
22952
- $[7] = t;
22953
- $[8] = t2;
23110
+ $[7] = pathSegments;
23111
+ $[8] = t;
23112
+ $[9] = t2;
22954
23113
  } else {
22955
- t2 = $[8];
23114
+ t2 = $[9];
22956
23115
  }
22957
23116
  const addButton = t2;
22958
23117
  let t3;
22959
- if ($[9] !== authController || $[10] !== collection || $[11] !== path) {
22960
- t3 = canDeleteEntity(collection, authController, path, null);
22961
- $[9] = authController;
22962
- $[10] = collection;
22963
- $[11] = path;
22964
- $[12] = t3;
23118
+ if ($[10] !== authController || $[11] !== collection || $[12] !== path || $[13] !== pathSegments) {
23119
+ t3 = canDeleteEntity(collection, authController, path, null, pathSegments);
23120
+ $[10] = authController;
23121
+ $[11] = collection;
23122
+ $[12] = path;
23123
+ $[13] = pathSegments;
23124
+ $[14] = t3;
22965
23125
  } else {
22966
- t3 = $[12];
23126
+ t3 = $[14];
22967
23127
  }
22968
23128
  const multipleDeleteEnabled = t3;
22969
23129
  let multipleDeleteButton;
22970
23130
  if (selectionEnabled) {
22971
23131
  let t42;
22972
- if ($[13] !== largeLayout || $[14] !== multipleDeleteEnabled || $[15] !== onMultipleDeleteClick || $[16] !== selectedEntities?.length) {
23132
+ if ($[15] !== largeLayout || $[16] !== multipleDeleteEnabled || $[17] !== onMultipleDeleteClick || $[18] !== selectedEntities?.length) {
22973
23133
  t42 = largeLayout ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { variant: "text", disabled: !selectedEntities?.length || !multipleDeleteEnabled, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, { size: "small" }), onClick: onMultipleDeleteClick, color: "primary", className: "lg:w-20", children: [
22974
23134
  "(",
22975
23135
  selectedEntities?.length,
22976
23136
  ")"
22977
23137
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", color: "primary", disabled: !selectedEntities?.length || !multipleDeleteEnabled, onClick: onMultipleDeleteClick, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, { size: "small" }) });
22978
- $[13] = largeLayout;
22979
- $[14] = multipleDeleteEnabled;
22980
- $[15] = onMultipleDeleteClick;
22981
- $[16] = selectedEntities?.length;
22982
- $[17] = t42;
23138
+ $[15] = largeLayout;
23139
+ $[16] = multipleDeleteEnabled;
23140
+ $[17] = onMultipleDeleteClick;
23141
+ $[18] = selectedEntities?.length;
23142
+ $[19] = t42;
22983
23143
  } else {
22984
- t42 = $[17];
23144
+ t42 = $[19];
22985
23145
  }
22986
23146
  const button = t42;
22987
23147
  let t52;
22988
- if ($[18] !== multipleDeleteEnabled || $[19] !== t) {
23148
+ if ($[20] !== multipleDeleteEnabled || $[21] !== t) {
22989
23149
  t52 = multipleDeleteEnabled ? t("delete_selected") : t("cannot_delete_selected");
22990
- $[18] = multipleDeleteEnabled;
22991
- $[19] = t;
22992
- $[20] = t52;
23150
+ $[20] = multipleDeleteEnabled;
23151
+ $[21] = t;
23152
+ $[22] = t52;
22993
23153
  } else {
22994
- t52 = $[20];
23154
+ t52 = $[22];
22995
23155
  }
22996
23156
  let t62;
22997
- if ($[21] !== button || $[22] !== t52) {
23157
+ if ($[23] !== button || $[24] !== t52) {
22998
23158
  t62 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t52, children: button });
22999
- $[21] = button;
23000
- $[22] = t52;
23001
- $[23] = t62;
23159
+ $[23] = button;
23160
+ $[24] = t52;
23161
+ $[25] = t62;
23002
23162
  } else {
23003
- t62 = $[23];
23163
+ t62 = $[25];
23004
23164
  }
23005
23165
  multipleDeleteButton = t62;
23006
23166
  }
23007
23167
  let t4;
23008
- if ($[24] !== collection || $[25] !== collectionEntitiesCount || $[26] !== context || $[27] !== parentCollectionIds || $[28] !== path || $[29] !== relativePath || $[30] !== selectionController || $[31] !== tableController) {
23168
+ if ($[26] !== collection || $[27] !== collectionEntitiesCount || $[28] !== context || $[29] !== parentCollectionIds || $[30] !== path || $[31] !== pathSegments || $[32] !== relativePath || $[33] !== selectionController || $[34] !== tableController) {
23009
23169
  t4 = {
23010
23170
  path,
23171
+ pathSegments,
23011
23172
  relativePath,
23012
23173
  parentCollectionIds,
23013
23174
  collection,
@@ -23016,28 +23177,29 @@
23016
23177
  tableController,
23017
23178
  collectionEntitiesCount
23018
23179
  };
23019
- $[24] = collection;
23020
- $[25] = collectionEntitiesCount;
23021
- $[26] = context;
23022
- $[27] = parentCollectionIds;
23023
- $[28] = path;
23024
- $[29] = relativePath;
23025
- $[30] = selectionController;
23026
- $[31] = tableController;
23027
- $[32] = t4;
23180
+ $[26] = collection;
23181
+ $[27] = collectionEntitiesCount;
23182
+ $[28] = context;
23183
+ $[29] = parentCollectionIds;
23184
+ $[30] = path;
23185
+ $[31] = pathSegments;
23186
+ $[32] = relativePath;
23187
+ $[33] = selectionController;
23188
+ $[34] = tableController;
23189
+ $[35] = t4;
23028
23190
  } else {
23029
- t4 = $[32];
23191
+ t4 = $[35];
23030
23192
  }
23031
23193
  const actionProps = t4;
23032
23194
  let actions;
23033
- if ($[33] !== actionProps || $[34] !== collection.Actions || $[35] !== plugins) {
23195
+ if ($[36] !== actionProps || $[37] !== collection.Actions || $[38] !== plugins) {
23034
23196
  let t52;
23035
- if ($[37] !== actionProps) {
23197
+ if ($[40] !== actionProps) {
23036
23198
  t52 = (Action, i) => /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(Action, { ...actionProps }) }, `actions_${i}`);
23037
- $[37] = actionProps;
23038
- $[38] = t52;
23199
+ $[40] = actionProps;
23200
+ $[41] = t52;
23039
23201
  } else {
23040
- t52 = $[38];
23202
+ t52 = $[41];
23041
23203
  }
23042
23204
  actions = toArray(collection.Actions).map(t52);
23043
23205
  if (plugins) {
@@ -23047,34 +23209,34 @@
23047
23209
  }
23048
23210
  });
23049
23211
  }
23050
- $[33] = actionProps;
23051
- $[34] = collection.Actions;
23052
- $[35] = plugins;
23053
- $[36] = actions;
23212
+ $[36] = actionProps;
23213
+ $[37] = collection.Actions;
23214
+ $[38] = plugins;
23215
+ $[39] = actions;
23054
23216
  } else {
23055
- actions = $[36];
23217
+ actions = $[39];
23056
23218
  }
23057
23219
  let t5;
23058
- if ($[39] !== actions) {
23220
+ if ($[42] !== actions) {
23059
23221
  t5 = /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: actions });
23060
- $[39] = actions;
23061
- $[40] = t5;
23222
+ $[42] = actions;
23223
+ $[43] = t5;
23062
23224
  } else {
23063
- t5 = $[40];
23225
+ t5 = $[43];
23064
23226
  }
23065
23227
  let t6;
23066
- if ($[41] !== addButton || $[42] !== multipleDeleteButton || $[43] !== t5) {
23228
+ if ($[44] !== addButton || $[45] !== multipleDeleteButton || $[46] !== t5) {
23067
23229
  t6 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
23068
23230
  t5,
23069
23231
  multipleDeleteButton,
23070
23232
  addButton
23071
23233
  ] });
23072
- $[41] = addButton;
23073
- $[42] = multipleDeleteButton;
23074
- $[43] = t5;
23075
- $[44] = t6;
23234
+ $[44] = addButton;
23235
+ $[45] = multipleDeleteButton;
23236
+ $[46] = t5;
23237
+ $[47] = t6;
23076
23238
  } else {
23077
- t6 = $[44];
23239
+ t6 = $[47];
23078
23240
  }
23079
23241
  return t6;
23080
23242
  }
@@ -24420,8 +24582,8 @@
24420
24582
  const context = useFireCMSContext();
24421
24583
  const dataSource = useDataSource();
24422
24584
  const navigation = useNavigationController();
24423
- const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
24424
- const resolvedPathSegments = pathSegments;
24585
+ const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath, pathSegments), [fullPath, pathSegments, navigation.resolveIdsFrom]);
24586
+ const resolvedPathSegments = React.useMemo(() => pathSegments ? navigation.resolveSegmentsFrom?.(pathSegments) ?? pathSegments : void 0, [pathSegments, navigation.resolveSegmentsFrom]);
24425
24587
  const dataSourceRef = React.useRef(dataSource);
24426
24588
  const collectionRef = React.useRef(collection);
24427
24589
  const contextRef = React.useRef(context);
@@ -24507,6 +24669,7 @@
24507
24669
  processed = await Promise.all(processed.map((entity) => currentCollection.callbacks.onFetch({
24508
24670
  collection: currentCollection,
24509
24671
  path: currentResolvedPath,
24672
+ pathSegments: currentPathSegments,
24510
24673
  entity,
24511
24674
  context: currentContext
24512
24675
  })));
@@ -25015,6 +25178,7 @@
25015
25178
  let completed = 0;
25016
25179
  currentDataSource.countEntities({
25017
25180
  path: fullPath,
25181
+ pathSegments,
25018
25182
  collection: currentCollection
25019
25183
  }).then((count) => {
25020
25184
  totalCount = count;
@@ -25025,6 +25189,7 @@
25025
25189
  }).catch((e) => console.warn("Failed to get total count:", e));
25026
25190
  currentDataSource.countEntities({
25027
25191
  path: fullPath,
25192
+ pathSegments,
25028
25193
  collection: currentCollection,
25029
25194
  filter: {
25030
25195
  [orderProperty]: ["!=", null]
@@ -25132,6 +25297,8 @@
25132
25297
  }
25133
25298
  const saveProps = {
25134
25299
  path: entity_2.path,
25300
+ // Paired with `entity.path`: the segments the entity was loaded with.
25301
+ pathSegments: entity_2.pathSegments,
25135
25302
  entityId: entity_2.id,
25136
25303
  values: updatedValues,
25137
25304
  previousValues: entity_2.values,
@@ -25169,6 +25336,7 @@
25169
25336
  console.log("Fetching all documents from collection...");
25170
25337
  const allDocs = await dataSource.fetchCollection({
25171
25338
  path: fullPath,
25339
+ pathSegments,
25172
25340
  collection,
25173
25341
  limit: 1e4
25174
25342
  // Fetch all
@@ -25187,6 +25355,8 @@
25187
25355
  }, orderProperty, index);
25188
25356
  const saveProps_0 = {
25189
25357
  path: entity_4.path,
25358
+ // Paired with `entity.path`: the segments the entity was loaded with.
25359
+ pathSegments: entity_4.pathSegments,
25190
25360
  entityId: entity_4.id,
25191
25361
  values: updatedValues_0,
25192
25362
  previousValues: entity_4.values,
@@ -25272,6 +25442,7 @@
25272
25442
  });
25273
25443
  sideEntityController.open({
25274
25444
  path: fullPath,
25445
+ pathSegments,
25275
25446
  collection,
25276
25447
  entityId: void 0,
25277
25448
  updateUrl: true,
@@ -25969,12 +26140,13 @@
25969
26140
  ] });
25970
26141
  }
25971
26142
  function EntityCollectionViewStartActions(t0) {
25972
- const $ = reactCompilerRuntime.c(37);
26143
+ const $ = reactCompilerRuntime.c(38);
25973
26144
  const {
25974
26145
  collection,
25975
26146
  relativePath,
25976
26147
  parentCollectionIds,
25977
26148
  path,
26149
+ pathSegments,
25978
26150
  selectionController,
25979
26151
  tableController,
25980
26152
  collectionEntitiesCount,
@@ -26009,9 +26181,10 @@
26009
26181
  }
26010
26182
  const activeFilterCount = t2;
26011
26183
  let t3;
26012
- if ($[5] !== collection || $[6] !== collectionEntitiesCount || $[7] !== context || $[8] !== parentCollectionIds || $[9] !== path || $[10] !== relativePath || $[11] !== selectionController || $[12] !== tableController) {
26184
+ if ($[5] !== collection || $[6] !== collectionEntitiesCount || $[7] !== context || $[8] !== parentCollectionIds || $[9] !== path || $[10] !== pathSegments || $[11] !== relativePath || $[12] !== selectionController || $[13] !== tableController) {
26013
26185
  t3 = {
26014
26186
  path,
26187
+ pathSegments,
26015
26188
  relativePath,
26016
26189
  parentCollectionIds,
26017
26190
  collection,
@@ -26025,44 +26198,45 @@
26025
26198
  $[7] = context;
26026
26199
  $[8] = parentCollectionIds;
26027
26200
  $[9] = path;
26028
- $[10] = relativePath;
26029
- $[11] = selectionController;
26030
- $[12] = tableController;
26031
- $[13] = t3;
26201
+ $[10] = pathSegments;
26202
+ $[11] = relativePath;
26203
+ $[12] = selectionController;
26204
+ $[13] = tableController;
26205
+ $[14] = t3;
26032
26206
  } else {
26033
- t3 = $[13];
26207
+ t3 = $[14];
26034
26208
  }
26035
26209
  const actionProps = t3;
26036
26210
  const hasAnyAllowedFilters = !tableController.allowedFilters || tableController.allowedFilters.length > 0;
26037
26211
  let t4;
26038
- if ($[14] !== activeFilterCount || $[15] !== hasAnyAllowedFilters || $[16] !== largeLayout || $[17] !== resolvedProperties || $[18] !== t || $[19] !== tableController.setFilterValues) {
26212
+ if ($[15] !== activeFilterCount || $[16] !== hasAnyAllowedFilters || $[17] !== largeLayout || $[18] !== resolvedProperties || $[19] !== t || $[20] !== tableController.setFilterValues) {
26039
26213
  t4 = resolvedProperties && tableController.setFilterValues && hasAnyAllowedFilters && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t("filters"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { color: "primary", invisible: activeFilterCount === 0, children: largeLayout ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { variant: "text", size: "small", onClick: () => setFiltersDialogOpen(true), startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.FilterListIcon, { size: "small" }), className: ui.cls(activeFilterCount > 0 && "text-primary"), children: [
26040
26214
  t("filters"),
26041
26215
  activeFilterCount > 0 ? ` (${activeFilterCount})` : ""
26042
26216
  ] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: () => setFiltersDialogOpen(true), className: ui.cls(activeFilterCount > 0 && "text-primary"), children: /* @__PURE__ */ jsxRuntime.jsx(ui.FilterListIcon, { size: "small" }) }) }) }, "filters_tooltip");
26043
- $[14] = activeFilterCount;
26044
- $[15] = hasAnyAllowedFilters;
26045
- $[16] = largeLayout;
26046
- $[17] = resolvedProperties;
26047
- $[18] = t;
26048
- $[19] = tableController.setFilterValues;
26049
- $[20] = t4;
26217
+ $[15] = activeFilterCount;
26218
+ $[16] = hasAnyAllowedFilters;
26219
+ $[17] = largeLayout;
26220
+ $[18] = resolvedProperties;
26221
+ $[19] = t;
26222
+ $[20] = tableController.setFilterValues;
26223
+ $[21] = t4;
26050
26224
  } else {
26051
- t4 = $[20];
26225
+ t4 = $[21];
26052
26226
  }
26053
26227
  const filtersButton = t4;
26054
26228
  const t5 = !collection.forceFilter;
26055
26229
  let t6;
26056
- if ($[21] !== t5 || $[22] !== tableController) {
26230
+ if ($[22] !== t5 || $[23] !== tableController) {
26057
26231
  t6 = /* @__PURE__ */ jsxRuntime.jsx(ClearFilterSortButton, { tableController, enabled: t5 }, "clear_filter");
26058
- $[21] = t5;
26059
- $[22] = tableController;
26060
- $[23] = t6;
26232
+ $[22] = t5;
26233
+ $[23] = tableController;
26234
+ $[24] = t6;
26061
26235
  } else {
26062
- t6 = $[23];
26236
+ t6 = $[24];
26063
26237
  }
26064
26238
  let actions;
26065
- if ($[24] !== actionProps || $[25] !== filtersButton || $[26] !== plugins || $[27] !== t6) {
26239
+ if ($[25] !== actionProps || $[26] !== filtersButton || $[27] !== plugins || $[28] !== t6) {
26066
26240
  actions = [filtersButton, t6];
26067
26241
  if (plugins) {
26068
26242
  plugins.forEach((plugin, i) => {
@@ -26071,36 +26245,36 @@
26071
26245
  }
26072
26246
  });
26073
26247
  }
26074
- $[24] = actionProps;
26075
- $[25] = filtersButton;
26076
- $[26] = plugins;
26077
- $[27] = t6;
26078
- $[28] = actions;
26248
+ $[25] = actionProps;
26249
+ $[26] = filtersButton;
26250
+ $[27] = plugins;
26251
+ $[28] = t6;
26252
+ $[29] = actions;
26079
26253
  } else {
26080
- actions = $[28];
26254
+ actions = $[29];
26081
26255
  }
26082
26256
  let t7;
26083
- if ($[29] !== collection.forceFilter || $[30] !== filtersDialogOpen || $[31] !== resolvedProperties || $[32] !== tableController) {
26257
+ if ($[30] !== collection.forceFilter || $[31] !== filtersDialogOpen || $[32] !== resolvedProperties || $[33] !== tableController) {
26084
26258
  t7 = resolvedProperties && tableController.setFilterValues && /* @__PURE__ */ jsxRuntime.jsx(FiltersDialog, { open: filtersDialogOpen, onOpenChange: setFiltersDialogOpen, properties: resolvedProperties, filterValues: tableController.filterValues, setFilterValues: (filterValues_0) => tableController.setFilterValues?.(filterValues_0 ?? {}), forceFilter: collection.forceFilter, allowedFilters: tableController.allowedFilters?.map(_temp$g) });
26085
- $[29] = collection.forceFilter;
26086
- $[30] = filtersDialogOpen;
26087
- $[31] = resolvedProperties;
26088
- $[32] = tableController;
26089
- $[33] = t7;
26259
+ $[30] = collection.forceFilter;
26260
+ $[31] = filtersDialogOpen;
26261
+ $[32] = resolvedProperties;
26262
+ $[33] = tableController;
26263
+ $[34] = t7;
26090
26264
  } else {
26091
- t7 = $[33];
26265
+ t7 = $[34];
26092
26266
  }
26093
26267
  let t8;
26094
- if ($[34] !== actions || $[35] !== t7) {
26268
+ if ($[35] !== actions || $[36] !== t7) {
26095
26269
  t8 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
26096
26270
  actions,
26097
26271
  t7
26098
26272
  ] });
26099
- $[34] = actions;
26100
- $[35] = t7;
26101
- $[36] = t8;
26273
+ $[35] = actions;
26274
+ $[36] = t7;
26275
+ $[37] = t8;
26102
26276
  } else {
26103
- t8 = $[36];
26277
+ t8 = $[37];
26104
26278
  }
26105
26279
  return t8;
26106
26280
  }
@@ -26178,7 +26352,7 @@
26178
26352
  React.useEffect(() => {
26179
26353
  collectionRef.current = collection;
26180
26354
  }, [collection]);
26181
- const canCreateEntities = canCreateEntity(collection, authController, fullPath, null);
26355
+ const canCreateEntities = canCreateEntity(collection, authController, fullPath, null, pathSegments);
26182
26356
  const [highlightedEntity, setHighlightedEntity] = React.useState(void 0);
26183
26357
  const [deleteEntityClicked, setDeleteEntityClicked] = React.useState(void 0);
26184
26358
  const [lastDeleteTimestamp, setLastDeleteTimestamp] = React.useState(0);
@@ -26196,7 +26370,7 @@
26196
26370
  }, [highlightedEntity]);
26197
26371
  const checkInlineEditing = React.useCallback((entity) => {
26198
26372
  const collection_0 = collectionRef.current;
26199
- if (!canEditEntity(collection_0, authController, fullPath, entity ?? null)) {
26373
+ if (!canEditEntity(collection_0, authController, fullPath, entity ?? null, pathSegments)) {
26200
26374
  return false;
26201
26375
  }
26202
26376
  return collection_0.inlineEditing === void 0 || collection_0.inlineEditing;
@@ -26286,10 +26460,12 @@
26286
26460
  if (collection_1) {
26287
26461
  addRecentId(collection_1.id, clickedEntity.id);
26288
26462
  }
26289
- const path = collection_1?.collectionGroup ? clickedEntity.path : fullPath ?? clickedEntity.path;
26463
+ const isCollectionGroup = Boolean(collection_1?.collectionGroup);
26464
+ const path = isCollectionGroup ? clickedEntity.path : fullPath ?? clickedEntity.path;
26290
26465
  navigateToEntity({
26291
26466
  navigation,
26292
26467
  path,
26468
+ pathSegments: isCollectionGroup ? clickedEntity.pathSegments : pathSegments ?? clickedEntity.pathSegments,
26293
26469
  fullIdPath,
26294
26470
  sideEntityController,
26295
26471
  openEntityMode,
@@ -26377,13 +26553,13 @@
26377
26553
  });
26378
26554
  }
26379
26555
  }, [setViewMode, userConfigPersistence, onCollectionModifiedForUser, fullPath, analyticsController, viewMode]);
26380
- const createEnabled = canCreateEntity(collection, authController, fullPath, null);
26556
+ const createEnabled = canCreateEntity(collection, authController, fullPath, null, pathSegments);
26381
26557
  const uniqueFieldValidator = React.useCallback(({
26382
26558
  name,
26383
26559
  value,
26384
26560
  property,
26385
26561
  entityId
26386
- }) => dataSource.checkUniqueField(fullPath, name, value, entityId, collection), [fullPath]);
26562
+ }) => dataSource.checkUniqueField(fullPath, name, value, entityId, collection, pathSegments), [fullPath, pathSegments]);
26387
26563
  const onValueChange = ({
26388
26564
  value: value_0,
26389
26565
  propertyKey,
@@ -26396,6 +26572,8 @@
26396
26572
  }, propertyKey, value_0);
26397
26573
  const saveProps = {
26398
26574
  path: entity_1.path ?? fullPath,
26575
+ // Paired with the `path` above: the row's segments describe the row's path.
26576
+ pathSegments: entity_1.path ? entity_1.pathSegments : pathSegments,
26399
26577
  entityId: entity_1.id,
26400
26578
  values: updatedValues,
26401
26579
  previousValues: entity_1.values,
@@ -26423,7 +26601,7 @@
26423
26601
  }
26424
26602
  });
26425
26603
  };
26426
- const resolvedFullPath = navigation.resolveIdsFrom(fullPath);
26604
+ const resolvedFullPath = navigation.resolveIdsFrom(fullPath, pathSegments);
26427
26605
  const resolvedCollection = React.useMemo(() => resolveCollection({
26428
26606
  collection,
26429
26607
  path: fullPath,
@@ -26552,7 +26730,7 @@
26552
26730
  Builder: ({
26553
26731
  entity: entity_4
26554
26732
  }) => {
26555
- const collectionsWithPath = navigation.getParentReferencesFromPath(entity_4.path);
26733
+ const collectionsWithPath = navigation.getParentReferencesFromPath(entity_4.path, entity_4.pathSegments);
26556
26734
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 w-full", children: collectionsWithPath.map((reference) => {
26557
26735
  return /* @__PURE__ */ jsxRuntime.jsx(ReferencePreview, { reference, size: "small" }, reference.path + "/" + reference.id);
26558
26736
  }) });
@@ -26568,7 +26746,7 @@
26568
26746
  entity: entity_5,
26569
26747
  customEntityActions
26570
26748
  }) => {
26571
- const deleteEnabled = entity_5 ? canDeleteEntity(collection, authController, fullPath, entity_5) : true;
26749
+ const deleteEnabled = entity_5 ? canDeleteEntity(collection, authController, fullPath, entity_5, entity_5.pathSegments ?? pathSegments) : true;
26572
26750
  const actions = [{
26573
26751
  ...editEntityAction,
26574
26752
  name: t("edit")
@@ -26633,6 +26811,7 @@
26633
26811
  onTextSearchClick,
26634
26812
  textSearchEnabled
26635
26813
  } = useTableSearchHelper({
26814
+ pathSegments,
26636
26815
  collection,
26637
26816
  fullPath: resolvedFullPath,
26638
26817
  parentCollectionIds,
@@ -26656,7 +26835,7 @@
26656
26835
  }, [tableController.dataLoadingError, customizationController.plugins, fullPath, collection, parentCollectionIds]);
26657
26836
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("overflow-hidden h-full w-full rounded-md flex flex-col", className), ref: containerRef, children: [
26658
26837
  countFetcher,
26659
- /* @__PURE__ */ jsxRuntime.jsx(CollectionTableToolbar, { loading: tableController.dataLoading, onTextSearch: textSearchEnabled && textSearchInitialised ? tableController.setSearchString : void 0, onTextSearchClick: textSearchEnabled && !textSearchInitialised ? onTextSearchClick : void 0, initialSearchString: tableController.searchString, textSearchLoading, viewModeToggle: viewModeToggleElement, actionsStart: /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionViewStartActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, collectionEntitiesCount: docsCount, resolvedProperties: resolvedCollection.properties }), actions: /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionViewActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, onMultipleDeleteClick, onNewClick, path: fullPath, relativePath: collection.path, selectionController: usedSelectionController, selectionEnabled, collectionEntitiesCount: docsCount }) }),
26838
+ /* @__PURE__ */ jsxRuntime.jsx(CollectionTableToolbar, { loading: tableController.dataLoading, onTextSearch: textSearchEnabled && textSearchInitialised ? tableController.setSearchString : void 0, onTextSearchClick: textSearchEnabled && !textSearchInitialised ? onTextSearchClick : void 0, initialSearchString: tableController.searchString, textSearchLoading, viewModeToggle: viewModeToggleElement, actionsStart: /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionViewStartActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, path: fullPath, pathSegments, relativePath: collection.path, selectionController: usedSelectionController, collectionEntitiesCount: docsCount, resolvedProperties: resolvedCollection.properties }), actions: /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionViewActions, { parentCollectionIds: parentCollectionIds ?? [], collection, tableController, onMultipleDeleteClick, onNewClick, path: fullPath, pathSegments, relativePath: collection.path, selectionController: usedSelectionController, selectionEnabled, collectionEntitiesCount: docsCount }) }),
26660
26839
  tableController.dataLoadingError ? pluginErrorView ?? /* @__PURE__ */ jsxRuntime.jsx(CollectionDataErrorBanner, { error: tableController.dataLoadingError }) : viewMode === "kanban" && enabledViews.includes("kanban") ? /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionBoardView, { collection, tableController, fullPath, pathSegments, parentCollectionIds, columnProperty: selectedKanbanProperty, onEntityClick, selectionController: usedSelectionController, selectionEnabled, highlightedEntities: highlightedEntity ? [highlightedEntity] : [], deletedEntities, emptyComponent: canCreateEntities && tableController.filterValues === void 0 && tableController.sortBy === void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [
26661
26840
  /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle2", children: t("so_empty") }),
26662
26841
  /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: onNewClick, className: "mt-4", children: [
@@ -26675,7 +26854,7 @@
26675
26854
  /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}),
26676
26855
  t("create_your_first_entry")
26677
26856
  ] })
26678
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: t("no_results_filter_sort") }), hoverRow, inlineEditing: checkInlineEditing(), AdditionalHeaderWidget: buildAdditionalHeaderWidget, AddColumnComponent: addColumnComponentInternal, getIdColumnWidth, additionalIDHeaderWidget: /* @__PURE__ */ jsxRuntime.jsx(EntityIdHeaderWidget, { path: fullPath, fullIdPath: fullIdPath ?? fullPath, collection }), openEntityMode, onColumnsOrderChange: (newColumns) => {
26857
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: t("no_results_filter_sort") }), hoverRow, inlineEditing: checkInlineEditing(), AdditionalHeaderWidget: buildAdditionalHeaderWidget, AddColumnComponent: addColumnComponentInternal, getIdColumnWidth, additionalIDHeaderWidget: /* @__PURE__ */ jsxRuntime.jsx(EntityIdHeaderWidget, { path: fullPath, pathSegments, fullIdPath: fullIdPath ?? fullPath, collection }), openEntityMode, onColumnsOrderChange: (newColumns) => {
26679
26858
  const seenKeys = /* @__PURE__ */ new Set();
26680
26859
  const newPropertiesOrder = newColumns.filter((col) => !col.frozen && getPropertyInPath(collection.properties, col.key)).map((col_0) => col_0.key).filter((key_1) => {
26681
26860
  if (seenKeys.has(key_1)) return false;
@@ -26714,8 +26893,8 @@
26714
26893
  const [error, setError] = React.useState(void 0);
26715
26894
  const sortByProperty = sortBy ? sortBy[0] : void 0;
26716
26895
  const currentSort = sortBy ? sortBy[1] : void 0;
26717
- const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath), [fullPath, navigation.resolveIdsFrom]);
26718
- const resolvedPathSegments = pathSegments;
26896
+ const resolvedPath = React.useMemo(() => navigation.resolveIdsFrom(fullPath, pathSegments), [fullPath, pathSegments, navigation.resolveIdsFrom]);
26897
+ const resolvedPathSegments = React.useMemo(() => pathSegments ? navigation.resolveSegmentsFrom?.(pathSegments) ?? pathSegments : void 0, [pathSegments, navigation.resolveSegmentsFrom]);
26719
26898
  React.useEffect(() => {
26720
26899
  if (dataSource.countEntities) dataSource.countEntities({
26721
26900
  path: resolvedPath,
@@ -26755,10 +26934,11 @@
26755
26934
  };
26756
26935
  }
26757
26936
  function EntityIdHeaderWidget(t0) {
26758
- const $ = reactCompilerRuntime.c(48);
26937
+ const $ = reactCompilerRuntime.c(50);
26759
26938
  const {
26760
26939
  collection,
26761
26940
  path,
26941
+ pathSegments,
26762
26942
  fullIdPath
26763
26943
  } = t0;
26764
26944
  const navigation = useNavigationController();
@@ -26799,7 +26979,7 @@
26799
26979
  t4 = $[6];
26800
26980
  }
26801
26981
  let t5;
26802
- if ($[7] !== collection || $[8] !== fullIdPath || $[9] !== navigation || $[10] !== openEntityMode || $[11] !== path || $[12] !== searchString || $[13] !== sideEntityController) {
26982
+ if ($[7] !== collection || $[8] !== fullIdPath || $[9] !== navigation || $[10] !== openEntityMode || $[11] !== path || $[12] !== pathSegments || $[13] !== searchString || $[14] !== sideEntityController) {
26803
26983
  t5 = (e) => {
26804
26984
  e.preventDefault();
26805
26985
  if (!searchString) {
@@ -26813,6 +26993,7 @@
26813
26993
  collection,
26814
26994
  entityId,
26815
26995
  path,
26996
+ pathSegments,
26816
26997
  fullIdPath,
26817
26998
  sideEntityController,
26818
26999
  navigation
@@ -26823,130 +27004,133 @@
26823
27004
  $[9] = navigation;
26824
27005
  $[10] = openEntityMode;
26825
27006
  $[11] = path;
26826
- $[12] = searchString;
26827
- $[13] = sideEntityController;
26828
- $[14] = t5;
27007
+ $[12] = pathSegments;
27008
+ $[13] = searchString;
27009
+ $[14] = sideEntityController;
27010
+ $[15] = t5;
26829
27011
  } else {
26830
- t5 = $[14];
27012
+ t5 = $[15];
26831
27013
  }
26832
27014
  let t6;
26833
- if ($[15] !== t) {
27015
+ if ($[16] !== t) {
26834
27016
  t6 = t("find_entity_by_id");
26835
- $[15] = t;
26836
- $[16] = t6;
27017
+ $[16] = t;
27018
+ $[17] = t6;
26837
27019
  } else {
26838
- t6 = $[16];
27020
+ t6 = $[17];
26839
27021
  }
26840
27022
  let t7;
26841
- if ($[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
27023
+ if ($[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
26842
27024
  t7 = (e_0) => {
26843
27025
  setSearchString(e_0.target.value);
26844
27026
  };
26845
- $[17] = t7;
27027
+ $[18] = t7;
26846
27028
  } else {
26847
- t7 = $[17];
27029
+ t7 = $[18];
26848
27030
  }
26849
27031
  let t8;
26850
- if ($[18] !== openPopup || $[19] !== searchString || $[20] !== t6) {
27032
+ if ($[19] !== openPopup || $[20] !== searchString || $[21] !== t6) {
26851
27033
  t8 = /* @__PURE__ */ jsxRuntime.jsx("input", { autoFocus: openPopup, placeholder: t6, onChange: t7, value: searchString, className: "rounded-lg bg-white dark:bg-surface-800 flex-grow bg-transparent outline-none p-2 " + ui.focusedDisabled });
26852
- $[18] = openPopup;
26853
- $[19] = searchString;
26854
- $[20] = t6;
26855
- $[21] = t8;
27034
+ $[19] = openPopup;
27035
+ $[20] = searchString;
27036
+ $[21] = t6;
27037
+ $[22] = t8;
26856
27038
  } else {
26857
- t8 = $[21];
27039
+ t8 = $[22];
26858
27040
  }
26859
27041
  const t9 = !searchString.trim();
26860
27042
  let t10;
26861
- if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
27043
+ if ($[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
26862
27044
  t10 = /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardTabIcon, {});
26863
- $[22] = t10;
27045
+ $[23] = t10;
26864
27046
  } else {
26865
- t10 = $[22];
27047
+ t10 = $[23];
26866
27048
  }
26867
27049
  let t11;
26868
- if ($[23] !== t9) {
27050
+ if ($[24] !== t9) {
26869
27051
  t11 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", disabled: t9, type: "submit", children: t10 });
26870
- $[23] = t9;
26871
- $[24] = t11;
27052
+ $[24] = t9;
27053
+ $[25] = t11;
26872
27054
  } else {
26873
- t11 = $[24];
27055
+ t11 = $[25];
26874
27056
  }
26875
27057
  let t12;
26876
- if ($[25] !== t11 || $[26] !== t8) {
27058
+ if ($[26] !== t11 || $[27] !== t8) {
26877
27059
  t12 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex p-2 w-full gap-2", children: [
26878
27060
  t8,
26879
27061
  t11
26880
27062
  ] });
26881
- $[25] = t11;
26882
- $[26] = t8;
26883
- $[27] = t12;
27063
+ $[26] = t11;
27064
+ $[27] = t8;
27065
+ $[28] = t12;
26884
27066
  } else {
26885
- t12 = $[27];
27067
+ t12 = $[28];
26886
27068
  }
26887
27069
  let t13;
26888
- if ($[28] !== t12 || $[29] !== t5) {
27070
+ if ($[29] !== t12 || $[30] !== t5) {
26889
27071
  t13 = /* @__PURE__ */ jsxRuntime.jsx("form", { noValidate: true, onSubmit: t5, className: "w-96 max-w-full", children: t12 });
26890
- $[28] = t12;
26891
- $[29] = t5;
26892
- $[30] = t13;
27072
+ $[29] = t12;
27073
+ $[30] = t5;
27074
+ $[31] = t13;
26893
27075
  } else {
26894
- t13 = $[30];
27076
+ t13 = $[31];
26895
27077
  }
26896
27078
  let t14;
26897
- if ($[31] !== collection || $[32] !== fullIdPath || $[33] !== navigation || $[34] !== openEntityMode || $[35] !== path || $[36] !== recentIds || $[37] !== sideEntityController) {
26898
- t14 = recentIds && recentIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 p-2", children: recentIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(ReferencePreview, { reference: new EntityReference(id, path), hover: true, onClick: () => {
27079
+ if ($[32] !== collection || $[33] !== fullIdPath || $[34] !== navigation || $[35] !== openEntityMode || $[36] !== path || $[37] !== pathSegments || $[38] !== recentIds || $[39] !== sideEntityController) {
27080
+ t14 = recentIds && recentIds.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-2 p-2", children: recentIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(ReferencePreview, { reference: new EntityReference(id, path, void 0, pathSegments), hover: true, onClick: () => {
26899
27081
  setOpenPopup(false);
26900
27082
  navigateToEntity({
26901
27083
  openEntityMode,
26902
27084
  collection,
26903
27085
  entityId: id,
26904
27086
  path,
27087
+ pathSegments,
26905
27088
  fullIdPath,
26906
27089
  sideEntityController,
26907
27090
  navigation
26908
27091
  });
26909
27092
  }, includeEntityLink: false, size: "small" }, id)) });
26910
- $[31] = collection;
26911
- $[32] = fullIdPath;
26912
- $[33] = navigation;
26913
- $[34] = openEntityMode;
26914
- $[35] = path;
26915
- $[36] = recentIds;
26916
- $[37] = sideEntityController;
26917
- $[38] = t14;
27093
+ $[32] = collection;
27094
+ $[33] = fullIdPath;
27095
+ $[34] = navigation;
27096
+ $[35] = openEntityMode;
27097
+ $[36] = path;
27098
+ $[37] = pathSegments;
27099
+ $[38] = recentIds;
27100
+ $[39] = sideEntityController;
27101
+ $[40] = t14;
26918
27102
  } else {
26919
- t14 = $[38];
27103
+ t14 = $[40];
26920
27104
  }
26921
27105
  let t15;
26922
- if ($[39] !== t13 || $[40] !== t14) {
27106
+ if ($[41] !== t13 || $[42] !== t14) {
26923
27107
  t15 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t4, children: [
26924
27108
  t13,
26925
27109
  t14
26926
27110
  ] });
26927
- $[39] = t13;
26928
- $[40] = t14;
26929
- $[41] = t15;
27111
+ $[41] = t13;
27112
+ $[42] = t14;
27113
+ $[43] = t15;
26930
27114
  } else {
26931
- t15 = $[41];
27115
+ t15 = $[43];
26932
27116
  }
26933
27117
  let t16;
26934
- if ($[42] !== openPopup || $[43] !== t15) {
27118
+ if ($[44] !== openPopup || $[45] !== t15) {
26935
27119
  t16 = /* @__PURE__ */ jsxRuntime.jsx(ui.Popover, { open: openPopup, onOpenChange: setOpenPopup, sideOffset: 0, align: "start", alignOffset: -117, trigger: t3, children: t15 });
26936
- $[42] = openPopup;
26937
- $[43] = t15;
26938
- $[44] = t16;
27120
+ $[44] = openPopup;
27121
+ $[45] = t15;
27122
+ $[46] = t16;
26939
27123
  } else {
26940
- t16 = $[44];
27124
+ t16 = $[46];
26941
27125
  }
26942
27126
  let t17;
26943
- if ($[45] !== t16 || $[46] !== t2) {
27127
+ if ($[47] !== t16 || $[48] !== t2) {
26944
27128
  t17 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t2, asChild: false, children: t16 });
26945
- $[45] = t16;
26946
- $[46] = t2;
26947
- $[47] = t17;
27129
+ $[47] = t16;
27130
+ $[48] = t2;
27131
+ $[49] = t17;
26948
27132
  } else {
26949
- t17 = $[47];
27133
+ t17 = $[49];
26950
27134
  }
26951
27135
  return t17;
26952
27136
  }
@@ -28514,8 +28698,12 @@
28514
28698
  path,
28515
28699
  collections = [],
28516
28700
  currentFullPath,
28517
- currentPathSegments = []
28701
+ currentPathSegments = [],
28702
+ pathSegments
28518
28703
  } = props;
28704
+ if (pathSegments) {
28705
+ return getParentReferencesFromPathSegments(pathSegments, collections);
28706
+ }
28519
28707
  const subpaths = removeInitialAndTrailingSlashes(path).split("/");
28520
28708
  const subpathCombinations = getCollectionPathsCombinations(subpaths);
28521
28709
  const result = [];
@@ -28552,6 +28740,9 @@
28552
28740
  }
28553
28741
  return result;
28554
28742
  }
28743
+ function getParentReferencesFromPathSegments(pathSegments, collections) {
28744
+ return walkPathSegments(pathSegments, collections).steps.filter((step) => step.entityId !== void 0).map((step) => new EntityReference(step.entityId, step.collectionPath, void 0, step.collectionSegments));
28745
+ }
28555
28746
  const DEFAULT_BASE_PATH = "/";
28556
28747
  const DEFAULT_COLLECTION_PATH = "/c";
28557
28748
  const NAVIGATION_ADMIN_GROUP_NAME = "Admin";
@@ -28756,10 +28947,10 @@
28756
28947
  React.useEffect(() => {
28757
28948
  refreshNavigation();
28758
28949
  }, [refreshNavigation]);
28759
- const getCollection = React.useCallback((idOrPath, includeUserOverride = false) => {
28950
+ const getCollection = React.useCallback((idOrPath, includeUserOverride = false, pathSegments) => {
28760
28951
  const collections_0 = collectionsRef.current;
28761
28952
  if (!collections_0) return void 0;
28762
- const baseCollection = getCollectionByPathOrId(removeInitialAndTrailingSlashes(idOrPath), collections_0);
28953
+ const baseCollection = getCollectionByPathOrId(removeInitialAndTrailingSlashes(idOrPath), collections_0, pathSegments);
28763
28954
  const userOverride = includeUserOverride ? userConfigPersistence?.getCollectionConfig(idOrPath) : void 0;
28764
28955
  let overriddenCollection = baseCollection;
28765
28956
  if (baseCollection && userOverride) {
@@ -28794,16 +28985,16 @@
28794
28985
  if (!collection_0) return void 0;
28795
28986
  return collection_0;
28796
28987
  }, []);
28797
- const getCollectionFromPaths = React.useCallback((pathSegments) => {
28988
+ const getCollectionFromPaths = React.useCallback((pathSegments_0) => {
28798
28989
  const collections_2 = collectionsRef.current;
28799
28990
  if (collections_2 === void 0) throw Error("getCollectionFromPaths: Collections have not been initialised yet");
28800
28991
  let currentCollections = [...collections_2 ?? []];
28801
- for (let i = 0; i < pathSegments.length; i++) {
28802
- const pathSegment = pathSegments[i];
28992
+ for (let i = 0; i < pathSegments_0.length; i++) {
28993
+ const pathSegment = pathSegments_0[i];
28803
28994
  const collection_1 = currentCollections.find((c_0) => c_0.id === pathSegment || c_0.path === pathSegment);
28804
28995
  if (!collection_1) return void 0;
28805
28996
  currentCollections = collection_1.subcollections;
28806
- if (i === pathSegments.length - 1) return collection_1;
28997
+ if (i === pathSegments_0.length - 1) return collection_1;
28807
28998
  }
28808
28999
  return void 0;
28809
29000
  }, []);
@@ -28828,33 +29019,37 @@
28828
29019
  if (cleanPath_0.startsWith(fullCollectionPath)) return cleanPath_0.replace(fullCollectionPath, "");
28829
29020
  throw Error("Expected path starting with " + fullCollectionPath);
28830
29021
  }, [fullCollectionPath]);
28831
- const resolveIdsFrom = React.useCallback((path_3) => {
29022
+ const resolveIdsFrom = React.useCallback((path_3, pathSegments_1) => {
28832
29023
  const collections_4 = collectionsRef.current ?? [];
28833
- return resolveCollectionPathIds(path_3, collections_4);
29024
+ return resolveCollectionPathIds(path_3, collections_4, pathSegments_1);
28834
29025
  }, []);
28835
- const getAllParentReferencesForPath = React.useCallback((path_4) => {
29026
+ const resolveSegmentsFrom = React.useCallback((pathSegments_2) => {
28836
29027
  const collections_5 = collectionsRef.current ?? [];
29028
+ return resolveCollectionPathSegments(pathSegments_2, collections_5);
29029
+ }, []);
29030
+ const getAllParentReferencesForPath = React.useCallback((path_4, pathSegments_3) => {
29031
+ const collections_6 = collectionsRef.current ?? [];
28837
29032
  return getParentReferencesFromPath({
28838
29033
  path: path_4,
28839
- collections: collections_5
29034
+ pathSegments: pathSegments_3,
29035
+ collections: collections_6
28840
29036
  });
28841
29037
  }, []);
28842
- const getParentCollectionIds = React.useCallback((path_5) => {
28843
- const strings = path_5.split("/");
28844
- const oddPathSegments = strings.filter((_, i_1) => i_1 % 2 === 0);
29038
+ const getParentCollectionIds = React.useCallback((path_5, pathSegments_4) => {
29039
+ const oddPathSegments = pathSegments_4 ? collectionSegmentsFrom(pathSegments_4) : fullPathToCollectionSegments(path_5);
28845
29040
  oddPathSegments.pop();
28846
29041
  const result_0 = [];
28847
- for (let i_2 = 1; i_2 <= oddPathSegments.length; i_2++) {
28848
- result_0.push(oddPathSegments.slice(0, i_2));
29042
+ for (let i_1 = 1; i_1 <= oddPathSegments.length; i_1++) {
29043
+ result_0.push(oddPathSegments.slice(0, i_1));
28849
29044
  }
28850
29045
  return result_0.map((r) => getCollectionFromPaths(r)?.id).filter(Boolean);
28851
29046
  }, [getAllParentReferencesForPath]);
28852
29047
  const convertIdsToPaths = React.useCallback((ids_0) => {
28853
- const collections_6 = collectionsRef.current;
28854
- let currentCollections_1 = collections_6;
29048
+ const collections_7 = collectionsRef.current;
29049
+ let currentCollections_1 = collections_7;
28855
29050
  const paths = [];
28856
- for (let i_3 = 0; i_3 < ids_0.length; i_3++) {
28857
- const id_1 = ids_0[i_3];
29051
+ for (let i_2 = 0; i_2 < ids_0.length; i_2++) {
29052
+ const id_1 = ids_0[i_2];
28858
29053
  const collection_3 = currentCollections_1.find((c_2) => c_2.id === id_1);
28859
29054
  if (!collection_3) throw Error(`Collection with id ${id_1} not found`);
28860
29055
  paths.push(collection_3.path);
@@ -28880,6 +29075,7 @@
28880
29075
  urlPathToDataPath,
28881
29076
  buildUrlCollectionPath,
28882
29077
  resolveIdsFrom,
29078
+ resolveSegmentsFrom,
28883
29079
  topLevelNavigation,
28884
29080
  refreshNavigation,
28885
29081
  getParentReferencesFromPath: getAllParentReferencesForPath,
@@ -29637,6 +29833,7 @@
29637
29833
  if (params.status !== "existing") {
29638
29834
  sideEntityController.replace({
29639
29835
  path: params.path,
29836
+ pathSegments: params.pathSegments ?? pathSegments,
29640
29837
  entityId: params.entityId,
29641
29838
  fullIdPath: props.fullIdPath,
29642
29839
  selectedTab: params.selectedTab,
@@ -29650,9 +29847,9 @@
29650
29847
  }
29651
29848
  };
29652
29849
  const parentCollectionIds = React.useMemo(() => {
29653
- return navigationController.getParentCollectionIds(path);
29850
+ return navigationController.getParentCollectionIds(path, pathSegments);
29654
29851
  }, [navigationController, path]);
29655
- const collection = props.collection ?? navigationController.getCollection(fullIdPath ?? path);
29852
+ const collection = props.collection ?? navigationController.getCollection(fullIdPath ?? path, false, pathSegments);
29656
29853
  React.useEffect(() => {
29657
29854
  function beforeunload(e) {
29658
29855
  if (blocked && collection) {
@@ -29692,6 +29889,7 @@
29692
29889
  }) => {
29693
29890
  sideEntityController.replace({
29694
29891
  path,
29892
+ pathSegments,
29695
29893
  entityId: entityId_0,
29696
29894
  fullIdPath: props.fullIdPath,
29697
29895
  selectedTab,
@@ -29807,6 +30005,7 @@
29807
30005
  function EntityEditViewFormActions({
29808
30006
  collection,
29809
30007
  path,
30008
+ pathSegments,
29810
30009
  entity,
29811
30010
  layout,
29812
30011
  savingError,
@@ -29829,8 +30028,8 @@
29829
30028
  } = useTranslation();
29830
30029
  const entityActions = React.useMemo(() => {
29831
30030
  const customEntityActions = (collection.entityActions ?? []).map((action) => resolveEntityAction(action, customizationController.entityActions)).filter(Boolean);
29832
- const createEnabled = canCreateEntity(collection, authController, path, null);
29833
- const deleteEnabled = entity ? canDeleteEntity(collection, authController, path, entity) : false;
30031
+ const createEnabled = canCreateEntity(collection, authController, path, null, pathSegments);
30032
+ const deleteEnabled = entity ? canDeleteEntity(collection, authController, path, entity, entity.pathSegments ?? pathSegments) : false;
29834
30033
  const actions = [];
29835
30034
  if (createEnabled) actions.push(copyEntityAction);
29836
30035
  if (deleteEnabled) actions.push(deleteEntityAction);
@@ -30194,7 +30393,7 @@
30194
30393
  if (status === "new" || status === "copy") {
30195
30394
  return true;
30196
30395
  } else {
30197
- return entity ? canEditEntity(props.collection, authController, props.path, entity ?? null) : void 0;
30396
+ return entity ? canEditEntity(props.collection, authController, props.path, entity ?? null, props.pathSegments) : void 0;
30198
30397
  }
30199
30398
  }, [authController, entity, status]);
30200
30399
  if (dataLoading && !initialDirtyValues || (!entity || canEdit === void 0) && (status === "existing" || status === "copy")) {
@@ -30244,6 +30443,7 @@
30244
30443
  entityId,
30245
30444
  parentCollectionIds,
30246
30445
  path,
30446
+ pathSegments,
30247
30447
  status,
30248
30448
  collection,
30249
30449
  context,
@@ -30342,7 +30542,7 @@
30342
30542
  const subcollectionId = subcollection.id ?? subcollection.path;
30343
30543
  const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollection.path)}` : void 0;
30344
30544
  const newFullIdPath = fullIdPath && usedEntity ? `${fullIdPath}/${encodeEntityId(usedEntity.id)}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
30345
- const newPathSegments = usedEntity && pathSegments ? [...pathSegments, usedEntity.id, ...removeInitialAndTrailingSlashes(subcollection.path).split("/")] : void 0;
30545
+ const newPathSegments = buildSubcollectionPathSegments(pathSegments, usedEntity?.id, subcollection.path);
30346
30546
  if (selectedTab !== subcollectionId) return null;
30347
30547
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 h-full overflow-auto w-full", role: "tabpanel", children: [
30348
30548
  globalLoading && /* @__PURE__ */ jsxRuntime.jsx(CircularProgressCenter, {}),
@@ -30917,7 +31117,7 @@
30917
31117
  onUpdate,
30918
31118
  onError
30919
31119
  }) => {
30920
- const collection_0 = collectionProp ?? navigationController.getCollection(path_0);
31120
+ const collection_0 = collectionProp ?? navigationController.getCollection(path_0, false, pathSegments_0);
30921
31121
  const usedDelegate_0 = collection_0?.overrides?.dataSourceDelegate ?? delegate;
30922
31122
  if (!usedDelegate_0.listenCollection) throw Error("useBuildDataSource delegate not initialised");
30923
31123
  return usedDelegate_0.listenCollection({
@@ -31003,7 +31203,7 @@
31003
31203
  collection: collectionProp_0,
31004
31204
  status
31005
31205
  }) => {
31006
- const collection_3 = collectionProp_0 ?? navigationController.getCollection(path_3);
31206
+ const collection_3 = collectionProp_0 ?? navigationController.getCollection(path_3, false, pathSegments_3);
31007
31207
  const usedDelegate_3 = collection_3?.overrides?.dataSourceDelegate ?? delegate;
31008
31208
  const resolvedCollection = collection_3 ? resolveCollection({
31009
31209
  collection: collection_3,
@@ -31060,8 +31260,11 @@
31060
31260
  status
31061
31261
  }).then((res) => {
31062
31262
  return {
31063
- id: res.id,
31064
- path: res.path,
31263
+ ...res,
31264
+ // A delegate that predates `pathSegments` returns none; the segments we
31265
+ // just saved with describe exactly this entity's collection, so they are
31266
+ // the authoritative answer rather than a guess.
31267
+ pathSegments: res.pathSegments ?? pathSegments_3,
31065
31268
  values: usedDelegate_3.delegateToCMSModel(finalValues)
31066
31269
  };
31067
31270
  });
@@ -31103,6 +31306,8 @@
31103
31306
  const usedDelegate_6 = collection_6?.overrides?.dataSourceDelegate ?? delegate;
31104
31307
  return usedDelegate_6.generateEntityId(path_5, collection_6, pathSegments_6);
31105
31308
  }, [delegate.generateEntityId]),
31309
+ // Typed with the declared props rather than an inline duplicate: the duplicate is
31310
+ // free to drift from the interface, and a field it forgets is dropped in silence.
31106
31311
  countEntities: delegate.countEntities ? async ({
31107
31312
  path: path_6,
31108
31313
  pathSegments: pathSegments_7,
@@ -32629,7 +32834,7 @@
32629
32834
  let collection;
32630
32835
  collection = navigation.getCollectionById(navigationEntries[0].id);
32631
32836
  if (!collection) {
32632
- collection = navigation.getCollection(navigationEntries[0].path);
32837
+ collection = navigation.getCollection(navigationEntries[0].path, false, navigationEntries[0].pathSegments);
32633
32838
  }
32634
32839
  if (!collection) {
32635
32840
  t16 = null;
@@ -32740,7 +32945,7 @@
32740
32945
  const firstEntry = navigationEntries[0];
32741
32946
  collection_0 = navigation.getCollectionById(firstEntry.id);
32742
32947
  if (!collection_0) {
32743
- collection_0 = navigation.getCollection(firstEntry.path);
32948
+ collection_0 = navigation.getCollection(firstEntry.path, false, firstEntry.pathSegments);
32744
32949
  }
32745
32950
  if (!collection_0) {
32746
32951
  t16 = null;
@@ -32913,9 +33118,10 @@
32913
33118
  }
32914
33119
  const collection = isNew ? lastCollectionEntry.collection : lastEntityEntry.parentCollection;
32915
33120
  const fullIdPath = isNew ? lastCollectionEntry.fullPath : parentCollectionEntry?.fullPath ?? lastEntityEntry.fullPath;
32916
- const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path);
33121
+ const pathSegments = isNew ? lastCollectionEntry.pathSegments : lastEntityEntry.pathSegments;
33122
+ const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path, pathSegments);
32917
33123
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
32918
- /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.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) => {
33124
+ /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: null, children: /* @__PURE__ */ jsxRuntime.jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, fullIdPath, pathSegments, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
32919
33125
  const newEntityId = params.entityId;
32920
33126
  if (!newEntityId) return;
32921
33127
  navigate(buildEntityUrl(newEntityId, params.selectedTab), {
@@ -43801,9 +44007,11 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
43801
44007
  exports2.buildProperties = buildProperties;
43802
44008
  exports2.buildPropertiesOrBuilder = buildPropertiesOrBuilder;
43803
44009
  exports2.buildProperty = buildProperty;
44010
+ exports2.buildSubcollectionPathSegments = buildSubcollectionPathSegments;
43804
44011
  exports2.canCreateEntity = canCreateEntity;
43805
44012
  exports2.canDeleteEntity = canDeleteEntity;
43806
44013
  exports2.canEditEntity = canEditEntity;
44014
+ exports2.collectionSegmentsFrom = collectionSegmentsFrom;
43807
44015
  exports2.copyEntityAction = copyEntityAction;
43808
44016
  exports2.decodeEntityId = decodeEntityId;
43809
44017
  exports2.defaultDateFormat = defaultDateFormat;
@@ -43822,6 +44030,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
43822
44030
  exports2.getArrayValuesCount = getArrayValuesCount;
43823
44031
  exports2.getBracketNotation = getBracketNotation;
43824
44032
  exports2.getCollectionByPathOrId = getCollectionByPathOrId;
44033
+ exports2.getCollectionByPathSegments = getCollectionByPathSegments;
43825
44034
  exports2.getCollectionPathsCombinations = getCollectionPathsCombinations;
43826
44035
  exports2.getColorForProperty = getColorForProperty;
43827
44036
  exports2.getColorScheme = getColorScheme;
@@ -43883,6 +44092,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
43883
44092
  exports2.parseGeoPoint = parseGeoPoint;
43884
44093
  exports2.pick = pick;
43885
44094
  exports2.plural = plural;
44095
+ exports2.positionalCollectionSegments = positionalCollectionSegments;
43886
44096
  exports2.prettifyIdentifier = prettifyIdentifier;
43887
44097
  exports2.printChanged = printChanged;
43888
44098
  exports2.propertiesToColumns = propertiesToColumns;
@@ -43904,6 +44114,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
43904
44114
  exports2.resolveArrayProperty = resolveArrayProperty;
43905
44115
  exports2.resolveCollection = resolveCollection;
43906
44116
  exports2.resolveCollectionPathIds = resolveCollectionPathIds;
44117
+ exports2.resolveCollectionPathSegments = resolveCollectionPathSegments;
43907
44118
  exports2.resolveDefaultSelectedView = resolveDefaultSelectedView;
43908
44119
  exports2.resolveEntityAction = resolveEntityAction;
43909
44120
  exports2.resolveEntityView = resolveEntityView;
@@ -43966,6 +44177,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
43966
44177
  exports2.useTraceUpdate = useTraceUpdate;
43967
44178
  exports2.useTranslation = useTranslation;
43968
44179
  exports2.useValidateAuthenticator = useValidateAuthenticator;
44180
+ exports2.walkPathSegments = walkPathSegments;
43969
44181
  exports2.yupToFormErrors = yupToFormErrors;
43970
44182
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
43971
44183
  }));