@firecms/core 3.0.0-canary.227 → 3.0.0-canary.228

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -150,6 +150,7 @@
150
150
  entityId,
151
151
  copy,
152
152
  path,
153
+ fullIdPath,
153
154
  selectedTab,
154
155
  sideEntityController,
155
156
  onClose,
@@ -158,7 +159,8 @@
158
159
  if (openEntityMode === "side_panel") {
159
160
  sideEntityController.open({
160
161
  entityId,
161
- path,
162
+ path: fullIdPath ?? path,
163
+ // fullIdPath,
162
164
  copy,
163
165
  selectedTab,
164
166
  collection,
@@ -166,7 +168,7 @@
166
168
  onClose
167
169
  });
168
170
  } else {
169
- let to = navigation.buildUrlCollectionPath(entityId ? `${path}/${entityId}` : path);
171
+ let to = navigation.buildUrlCollectionPath(entityId ? `${fullIdPath ?? path}/${entityId}` : fullIdPath ?? path);
170
172
  if (entityId && selectedTab) {
171
173
  to += `/${selectedTab}`;
172
174
  }
@@ -12264,6 +12266,7 @@
12264
12266
  collection,
12265
12267
  entityId: entity.id,
12266
12268
  path,
12269
+ fullIdPath: path,
12267
12270
  sideEntityController: context.sideEntityController,
12268
12271
  onClose: () => unhighlightEntity?.(entity),
12269
12272
  navigation: context.navigation,
@@ -12296,6 +12299,7 @@
12296
12299
  collection,
12297
12300
  entityId: entity.id,
12298
12301
  path,
12302
+ fullIdPath: path,
12299
12303
  copy: true,
12300
12304
  sideEntityController: context.sideEntityController,
12301
12305
  onClose: () => unhighlightEntity?.(entity),
@@ -18463,6 +18467,7 @@
18463
18467
  const DEFAULT_ENTITY_OPEN_MODE = "side_panel";
18464
18468
  const EntityCollectionView = React.memo(function EntityCollectionView2({
18465
18469
  fullPath: fullPathProp,
18470
+ fullIdPath,
18466
18471
  parentCollectionIds,
18467
18472
  isSubCollection,
18468
18473
  className,
@@ -18542,6 +18547,7 @@
18542
18547
  navigateToEntity({
18543
18548
  navigation,
18544
18549
  path,
18550
+ fullIdPath,
18545
18551
  sideEntityController,
18546
18552
  openEntityMode,
18547
18553
  collection: collection_1,
@@ -18558,6 +18564,7 @@
18558
18564
  collection: collection_2,
18559
18565
  entityId: void 0,
18560
18566
  path: fullPath,
18567
+ fullIdPath,
18561
18568
  sideEntityController,
18562
18569
  navigation,
18563
18570
  onClose: unselectNavigatedEntity
@@ -18693,6 +18700,7 @@
18693
18700
  entityId: entity_3.id,
18694
18701
  selectedTab: subcollection.id ?? subcollection.path,
18695
18702
  path: fullPath,
18703
+ fullIdPath,
18696
18704
  navigation,
18697
18705
  sideEntityController
18698
18706
  });
@@ -18748,7 +18756,7 @@
18748
18756
  entity: entity_6,
18749
18757
  customEntityActions: collection.entityActions
18750
18758
  });
18751
- return /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionRowActions, { entity: entity_6, width: width_0, frozen, isSelected, selectionEnabled, size: size_0, highlightEntity: setHighlightedEntity, unhighlightEntity: unselectNavigatedEntity, collection, fullPath, actions: actions_0, hideId: collection?.hideIdFromCollection, onCollectionChange: updateLastDeleteTimestamp, selectionController: usedSelectionController, openEntityMode });
18759
+ return /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionRowActions, { entity: entity_6, width: width_0, frozen, isSelected, selectionEnabled, size: size_0, highlightEntity: setHighlightedEntity, unhighlightEntity: unselectNavigatedEntity, collection, fullPath: fullIdPath ?? fullPath, actions: actions_0, hideId: collection?.hideIdFromCollection, onCollectionChange: updateLastDeleteTimestamp, selectionController: usedSelectionController, openEntityMode });
18752
18760
  }, [updateLastDeleteTimestamp, usedSelectionController]);
18753
18761
  const title = /* @__PURE__ */ jsxRuntime.jsx(ui.Popover, { open: popOverOpen, onOpenChange: setPopOverOpen, enabled: Boolean(collection.description), trigger: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-start", children: [
18754
18762
  /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "subtitle1", className: `leading-none truncate max-w-[160px] lg:max-w-[240px] ${collection.description ? "cursor-pointer" : "cursor-auto"}`, onClick: collection.description ? (e_2) => {
@@ -18790,7 +18798,7 @@
18790
18798
  /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}),
18791
18799
  "Create your first entity"
18792
18800
  ] })
18793
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "No results with the applied filter/sort" }), hoverRow, inlineEditing: checkInlineEditing(), AdditionalHeaderWidget: buildAdditionalHeaderWidget, AddColumnComponent: addColumnComponentInternal, getIdColumnWidth, additionalIDHeaderWidget: /* @__PURE__ */ jsxRuntime.jsx(EntityIdHeaderWidget, { path: fullPath, collection }), openEntityMode }, `collection_table_${fullPath}`),
18801
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "No results with the applied filter/sort" }), hoverRow, inlineEditing: checkInlineEditing(), AdditionalHeaderWidget: buildAdditionalHeaderWidget, AddColumnComponent: addColumnComponentInternal, getIdColumnWidth, additionalIDHeaderWidget: /* @__PURE__ */ jsxRuntime.jsx(EntityIdHeaderWidget, { path: fullPath, fullIdPath: fullIdPath ?? fullPath, collection }), openEntityMode }, `collection_table_${fullPath}`),
18794
18802
  popupCell && /* @__PURE__ */ jsxRuntime.jsx(PopupFormField, { open: Boolean(popupCell), onClose: onPopupClose, cellRect: popupCell?.cellRect, propertyKey: popupCell?.propertyKey, collection, entityId: popupCell.entityId, tableKey: tableKey.current, customFieldValidator: uniqueFieldValidator, path: resolvedFullPath, onCellValueChange: onValueChange, container: containerRef.current }, `popup_form_${popupCell?.propertyKey}_${popupCell?.entityId}`),
18795
18803
  deleteEntityClicked && /* @__PURE__ */ jsxRuntime.jsx(DeleteEntityDialog, { entityOrEntitiesToDelete: deleteEntityClicked, path: fullPath, collection, callbacks: collection.callbacks, open: Boolean(deleteEntityClicked), onEntityDelete: internalOnEntityDelete, onMultipleEntitiesDelete: internalOnMultipleEntitiesDelete, onClose: () => setDeleteEntityClicked(void 0) })
18796
18804
  ] });
@@ -18849,10 +18857,11 @@
18849
18857
  };
18850
18858
  }
18851
18859
  function EntityIdHeaderWidget(t0) {
18852
- const $ = reactCompilerRuntime.c(40);
18860
+ const $ = reactCompilerRuntime.c(42);
18853
18861
  const {
18854
18862
  collection,
18855
- path
18863
+ path,
18864
+ fullIdPath
18856
18865
  } = t0;
18857
18866
  const navigation = useNavigationController();
18858
18867
  const [openPopup, setOpenPopup] = React.useState(false);
@@ -18881,7 +18890,7 @@
18881
18890
  t4 = $[3];
18882
18891
  }
18883
18892
  let t5;
18884
- if ($[4] !== collection || $[5] !== navigation || $[6] !== openEntityMode || $[7] !== path || $[8] !== searchString || $[9] !== sideEntityController) {
18893
+ if ($[4] !== collection || $[5] !== fullIdPath || $[6] !== navigation || $[7] !== openEntityMode || $[8] !== path || $[9] !== searchString || $[10] !== sideEntityController) {
18885
18894
  t5 = (e) => {
18886
18895
  e.preventDefault();
18887
18896
  if (!searchString) {
@@ -18895,77 +18904,79 @@
18895
18904
  collection,
18896
18905
  entityId,
18897
18906
  path,
18907
+ fullIdPath,
18898
18908
  sideEntityController,
18899
18909
  navigation
18900
18910
  });
18901
18911
  };
18902
18912
  $[4] = collection;
18903
- $[5] = navigation;
18904
- $[6] = openEntityMode;
18905
- $[7] = path;
18906
- $[8] = searchString;
18907
- $[9] = sideEntityController;
18908
- $[10] = t5;
18913
+ $[5] = fullIdPath;
18914
+ $[6] = navigation;
18915
+ $[7] = openEntityMode;
18916
+ $[8] = path;
18917
+ $[9] = searchString;
18918
+ $[10] = sideEntityController;
18919
+ $[11] = t5;
18909
18920
  } else {
18910
- t5 = $[10];
18921
+ t5 = $[11];
18911
18922
  }
18912
18923
  let t6;
18913
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
18924
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
18914
18925
  t6 = (e_0) => {
18915
18926
  setSearchString(e_0.target.value);
18916
18927
  };
18917
- $[11] = t6;
18928
+ $[12] = t6;
18918
18929
  } else {
18919
- t6 = $[11];
18930
+ t6 = $[12];
18920
18931
  }
18921
18932
  let t7;
18922
- if ($[12] !== openPopup || $[13] !== searchString) {
18933
+ if ($[13] !== openPopup || $[14] !== searchString) {
18923
18934
  t7 = /* @__PURE__ */ jsxRuntime.jsx("input", { autoFocus: openPopup, placeholder: "Find entity by ID", onChange: t6, value: searchString, className: "rounded-lg bg-white dark:bg-surface-800 flex-grow bg-transparent outline-none p-2 " + ui.focusedDisabled });
18924
- $[12] = openPopup;
18925
- $[13] = searchString;
18926
- $[14] = t7;
18935
+ $[13] = openPopup;
18936
+ $[14] = searchString;
18937
+ $[15] = t7;
18927
18938
  } else {
18928
- t7 = $[14];
18939
+ t7 = $[15];
18929
18940
  }
18930
18941
  const t8 = !searchString.trim();
18931
18942
  let t9;
18932
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
18943
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
18933
18944
  t9 = /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardTabIcon, {});
18934
- $[15] = t9;
18945
+ $[16] = t9;
18935
18946
  } else {
18936
- t9 = $[15];
18947
+ t9 = $[16];
18937
18948
  }
18938
18949
  let t10;
18939
- if ($[16] !== t8) {
18950
+ if ($[17] !== t8) {
18940
18951
  t10 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", disabled: t8, type: "submit", children: t9 });
18941
- $[16] = t8;
18942
- $[17] = t10;
18952
+ $[17] = t8;
18953
+ $[18] = t10;
18943
18954
  } else {
18944
- t10 = $[17];
18955
+ t10 = $[18];
18945
18956
  }
18946
18957
  let t11;
18947
- if ($[18] !== t10 || $[19] !== t7) {
18958
+ if ($[19] !== t10 || $[20] !== t7) {
18948
18959
  t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex p-2 w-full gap-2", children: [
18949
18960
  t7,
18950
18961
  t10
18951
18962
  ] });
18952
- $[18] = t10;
18953
- $[19] = t7;
18954
- $[20] = t11;
18963
+ $[19] = t10;
18964
+ $[20] = t7;
18965
+ $[21] = t11;
18955
18966
  } else {
18956
- t11 = $[20];
18967
+ t11 = $[21];
18957
18968
  }
18958
18969
  let t12;
18959
- if ($[21] !== t11 || $[22] !== t5) {
18970
+ if ($[22] !== t11 || $[23] !== t5) {
18960
18971
  t12 = /* @__PURE__ */ jsxRuntime.jsx("form", { noValidate: true, onSubmit: t5, className: "w-96 max-w-full", children: t11 });
18961
- $[21] = t11;
18962
- $[22] = t5;
18963
- $[23] = t12;
18972
+ $[22] = t11;
18973
+ $[23] = t5;
18974
+ $[24] = t12;
18964
18975
  } else {
18965
- t12 = $[23];
18976
+ t12 = $[24];
18966
18977
  }
18967
18978
  let t13;
18968
- if ($[24] !== collection || $[25] !== navigation || $[26] !== openEntityMode || $[27] !== path || $[28] !== recentIds || $[29] !== sideEntityController) {
18979
+ if ($[25] !== collection || $[26] !== fullIdPath || $[27] !== navigation || $[28] !== openEntityMode || $[29] !== path || $[30] !== recentIds || $[31] !== sideEntityController) {
18969
18980
  t13 = 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: () => {
18970
18981
  setOpenPopup(false);
18971
18982
  navigateToEntity({
@@ -18973,49 +18984,51 @@
18973
18984
  collection,
18974
18985
  entityId: id,
18975
18986
  path,
18987
+ fullIdPath,
18976
18988
  sideEntityController,
18977
18989
  navigation
18978
18990
  });
18979
18991
  }, includeEntityLink: false, size: "small" }, id)) });
18980
- $[24] = collection;
18981
- $[25] = navigation;
18982
- $[26] = openEntityMode;
18983
- $[27] = path;
18984
- $[28] = recentIds;
18985
- $[29] = sideEntityController;
18986
- $[30] = t13;
18992
+ $[25] = collection;
18993
+ $[26] = fullIdPath;
18994
+ $[27] = navigation;
18995
+ $[28] = openEntityMode;
18996
+ $[29] = path;
18997
+ $[30] = recentIds;
18998
+ $[31] = sideEntityController;
18999
+ $[32] = t13;
18987
19000
  } else {
18988
- t13 = $[30];
19001
+ t13 = $[32];
18989
19002
  }
18990
19003
  let t14;
18991
- if ($[31] !== t12 || $[32] !== t13) {
19004
+ if ($[33] !== t12 || $[34] !== t13) {
18992
19005
  t14 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t4, children: [
18993
19006
  t12,
18994
19007
  t13
18995
19008
  ] });
18996
- $[31] = t12;
18997
- $[32] = t13;
18998
- $[33] = t14;
19009
+ $[33] = t12;
19010
+ $[34] = t13;
19011
+ $[35] = t14;
18999
19012
  } else {
19000
- t14 = $[33];
19013
+ t14 = $[35];
19001
19014
  }
19002
19015
  let t15;
19003
- if ($[34] !== openPopup || $[35] !== t14) {
19016
+ if ($[36] !== openPopup || $[37] !== t14) {
19004
19017
  t15 = /* @__PURE__ */ jsxRuntime.jsx(ui.Popover, { open: openPopup, onOpenChange: setOpenPopup, sideOffset: 0, align: "start", alignOffset: -117, trigger: t3, children: t14 });
19005
- $[34] = openPopup;
19006
- $[35] = t14;
19007
- $[36] = t15;
19018
+ $[36] = openPopup;
19019
+ $[37] = t14;
19020
+ $[38] = t15;
19008
19021
  } else {
19009
- t15 = $[36];
19022
+ t15 = $[38];
19010
19023
  }
19011
19024
  let t16;
19012
- if ($[37] !== t15 || $[38] !== t2) {
19025
+ if ($[39] !== t15 || $[40] !== t2) {
19013
19026
  t16 = /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: t2, asChild: false, children: t15 });
19014
- $[37] = t15;
19015
- $[38] = t2;
19016
- $[39] = t16;
19027
+ $[39] = t15;
19028
+ $[40] = t2;
19029
+ $[41] = t16;
19017
19030
  } else {
19018
- t16 = $[39];
19031
+ t16 = $[41];
19019
19032
  }
19020
19033
  return t16;
19021
19034
  }
@@ -21271,6 +21284,7 @@
21271
21284
  }
21272
21285
  function EntityEditViewInner({
21273
21286
  path,
21287
+ fullIdPath,
21274
21288
  entityId,
21275
21289
  selectedTab: selectedTabProp,
21276
21290
  collection,
@@ -21368,18 +21382,19 @@
21368
21382
  }), role: "tabpanel", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(EntityJsonPreview, { values: formContext?.values ?? entity?.values ?? {} }) }) }, "json_view");
21369
21383
  const subCollectionsViews = subcollections && subcollections.map((subcollection) => {
21370
21384
  const subcollectionId = subcollection.id ?? subcollection.path;
21371
- const fullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
21385
+ const newFullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
21386
+ const newFullIdPath = fullIdPath ? `${fullIdPath}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
21372
21387
  if (selectedTab !== subcollectionId) return null;
21373
21388
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-1 h-full overflow-auto w-full", role: "tabpanel", children: [
21374
21389
  globalLoading && /* @__PURE__ */ jsxRuntime.jsx(CircularProgressCenter, {}),
21375
- !globalLoading && (usedEntity && fullPath ? /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionView, { fullPath, parentCollectionIds: [...parentCollectionIds, collection.id], isSubCollection: true, updateUrl: false, ...subcollection, openEntityMode: layout }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-full h-full p-3", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "You need to save your entity before adding additional collections" }) }))
21390
+ !globalLoading && (usedEntity && newFullPath ? /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionView, { fullPath: newFullPath, fullIdPath: newFullIdPath, parentCollectionIds: [...parentCollectionIds, collection.id], isSubCollection: true, updateUrl: false, ...subcollection, openEntityMode: layout }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center w-full h-full p-3", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "You need to save your entity before adding additional collections" }) }))
21376
21391
  ] }, `subcol_${subcollectionId}`);
21377
21392
  }).filter(Boolean);
21378
21393
  const onSideTabClick = (value_0) => {
21379
21394
  setSelectedTab(value_0);
21380
21395
  if (status === "existing") {
21381
21396
  onTabChange?.({
21382
- path,
21397
+ path: fullIdPath ?? path,
21383
21398
  entityId,
21384
21399
  selectedTab: value_0 === MAIN_TAB_VALUE ? void 0 : value_0,
21385
21400
  collection
@@ -21696,6 +21711,7 @@
21696
21711
  if (navigationEntry.type === "entity") {
21697
21712
  sidePanel = {
21698
21713
  path: navigationEntry.path,
21714
+ // fullIdPath: navigationEntry.path,
21699
21715
  entityId: navigationEntry.entityId,
21700
21716
  copy: false,
21701
21717
  width: navigationEntry.parentCollection?.sideDialogWidth
@@ -21713,6 +21729,7 @@
21713
21729
  if (newFlag) {
21714
21730
  sidePanel = {
21715
21731
  path: lastCollectionPath,
21732
+ // fullIdPath: lastCollectionPath,
21716
21733
  copy: false
21717
21734
  };
21718
21735
  }
@@ -21721,10 +21738,8 @@
21721
21738
  const propsToSidePanel = (props, buildUrlCollectionPath, resolveIdsFrom, smallLayout, customizationController, authController) => {
21722
21739
  const collectionPath = removeInitialAndTrailingSlashes(props.path);
21723
21740
  const newPath = props.entityId ? buildUrlCollectionPath(`${collectionPath}/${props.entityId}${props.selectedTab ? "/" + props.selectedTab : ""}#${SIDE_URL_HASH}`) : buildUrlCollectionPath(`${collectionPath}#${NEW_URL_HASH}`);
21724
- const resolvedPath = resolveIdsFrom(props.path);
21725
21741
  const resolvedPanelProps = {
21726
21742
  ...props,
21727
- path: resolvedPath,
21728
21743
  formProps: props.formProps
21729
21744
  };
21730
21745
  const entityViewWidth = getEntityViewWidth(props, smallLayout, customizationController, authController);
@@ -23226,7 +23241,7 @@
23226
23241
  } else {
23227
23242
  t8 = $[27];
23228
23243
  }
23229
- t62 = /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionView, { isSubCollection: false, parentCollectionIds: t8, fullPath: collection_0.id, updateUrl: true, ...collection_0, Actions: toArray(collection_0.Actions) }, `collection_view_${collection_0.id ?? collection_0.path}`);
23244
+ t62 = /* @__PURE__ */ jsxRuntime.jsx(EntityCollectionView, { fullIdPath: collection_0.id, isSubCollection: false, parentCollectionIds: t8, fullPath: collection_0.id, updateUrl: true, ...collection_0, Actions: toArray(collection_0.Actions) }, `collection_view_${collection_0.id ?? collection_0.path}`);
23230
23245
  }
23231
23246
  $[23] = navigation;
23232
23247
  $[24] = navigationEntries;
@@ -23315,9 +23330,10 @@
23315
23330
  return /* @__PURE__ */ jsxRuntime.jsx(NotFoundPage, {});
23316
23331
  }
23317
23332
  const collection = isNew ? lastCollectionEntry.collection : lastEntityEntry.parentCollection;
23318
- const collectionPath = navigation.resolveIdsFrom(isNew ? lastCollectionEntry.path : lastEntityEntry.path);
23333
+ const fullIdPath = isNew ? lastCollectionEntry.path : lastEntityEntry.path;
23334
+ const collectionPath = navigation.resolveIdsFrom(fullIdPath);
23319
23335
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
23320
- /* @__PURE__ */ jsxRuntime.jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
23336
+ /* @__PURE__ */ jsxRuntime.jsx(EntityEditView, { entityId: isNew ? void 0 : entityId, fullIdPath, collection, layout: "full_screen", path: collectionPath, copy: isCopy, selectedTab: selectedTab ?? void 0, onValuesModified: (modified) => blocked.current = modified, onSaved: (params) => {
23321
23337
  const newSelectedTab = params.selectedTab;
23322
23338
  const newEntityId = params.entityId;
23323
23339
  if (newSelectedTab) {