@firecms/core 3.0.0-canary.203 → 3.0.0-canary.205

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -3683,7 +3683,7 @@ function useCollectionFetch(t0) {
3683
3683
  }
3684
3684
  setDataLoading(false);
3685
3685
  setDataLoadingError(void 0);
3686
- setData(entities.map(_temp$t));
3686
+ setData(entities.map(_temp$s));
3687
3687
  setNoMoreToLoad(!itemCount || entities.length < itemCount);
3688
3688
  };
3689
3689
  const onError = (error) => {
@@ -3766,7 +3766,7 @@ function useCollectionFetch(t0) {
3766
3766
  }
3767
3767
  function _temp2$e() {
3768
3768
  }
3769
- function _temp$t(e_0) {
3769
+ function _temp$s(e_0) {
3770
3770
  return {
3771
3771
  ...e_0
3772
3772
  };
@@ -3831,7 +3831,7 @@ function useEntityFetch(t0) {
3831
3831
  setEntity(CACHE[`${path}/${entityId}`]);
3832
3832
  setDataLoading(false);
3833
3833
  setDataLoadingError(void 0);
3834
- return _temp$s;
3834
+ return _temp$r;
3835
3835
  } else {
3836
3836
  if (entityId && path && collection) {
3837
3837
  if (dataSource.listenEntity) {
@@ -3899,7 +3899,7 @@ function _temp3$4() {
3899
3899
  }
3900
3900
  function _temp2$d() {
3901
3901
  }
3902
- function _temp$s() {
3902
+ function _temp$r() {
3903
3903
  }
3904
3904
  async function saveEntityWithCallbacks({
3905
3905
  collection,
@@ -4749,7 +4749,7 @@ function useBuildLocalConfigurationPersistence() {
4749
4749
  t0 = $[0];
4750
4750
  }
4751
4751
  const configCache = useRef(t0);
4752
- const getCollectionFromStorage = _temp$r;
4752
+ const getCollectionFromStorage = _temp$q;
4753
4753
  let t1;
4754
4754
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
4755
4755
  t1 = (path) => {
@@ -4872,7 +4872,7 @@ function useBuildLocalConfigurationPersistence() {
4872
4872
  }
4873
4873
  return t11;
4874
4874
  }
4875
- function _temp$r(storageKey) {
4875
+ function _temp$q(storageKey) {
4876
4876
  const item = localStorage.getItem(storageKey);
4877
4877
  return item ? JSON.parse(item) : {};
4878
4878
  }
@@ -5165,7 +5165,7 @@ function ImagePreview(t0) {
5165
5165
  }
5166
5166
  let t9;
5167
5167
  if ($[16] !== url) {
5168
- t9 = /* @__PURE__ */ jsx(Tooltip, { title: "Open image in new tab", side: "bottom", children: /* @__PURE__ */ jsx(IconButton, { className: "invisible group-hover:visible", variant: "filled", component: "a", href: url, rel: "noopener noreferrer", target: "_blank", size: "small", onClick: _temp$q, children: t8 }) });
5168
+ t9 = /* @__PURE__ */ jsx(Tooltip, { title: "Open image in new tab", side: "bottom", children: /* @__PURE__ */ jsx(IconButton, { className: "invisible group-hover:visible", variant: "filled", component: "a", href: url, rel: "noopener noreferrer", target: "_blank", size: "small", onClick: _temp$p, children: t8 }) });
5169
5169
  $[16] = url;
5170
5170
  $[17] = t9;
5171
5171
  } else {
@@ -5199,7 +5199,7 @@ function ImagePreview(t0) {
5199
5199
  }
5200
5200
  return t11;
5201
5201
  }
5202
- function _temp$q(e_0) {
5202
+ function _temp$p(e_0) {
5203
5203
  return e_0.stopPropagation();
5204
5204
  }
5205
5205
  function UrlComponentPreview(t0) {
@@ -5232,7 +5232,7 @@ function UrlComponentPreview(t0) {
5232
5232
  }
5233
5233
  let t3;
5234
5234
  if ($[2] !== url) {
5235
- t3 = /* @__PURE__ */ jsxs("a", { className: "flex gap-4 break-words items-center font-medium text-primary visited:text-primary dark:visited:text-primary dark:text-primary", href: url, rel: "noopener noreferrer", onMouseDown: _temp$p, target: "_blank", children: [
5235
+ t3 = /* @__PURE__ */ jsxs("a", { className: "flex gap-4 break-words items-center font-medium text-primary visited:text-primary dark:visited:text-primary dark:text-primary", href: url, rel: "noopener noreferrer", onMouseDown: _temp$o, target: "_blank", children: [
5236
5236
  t2,
5237
5237
  url
5238
5238
  ] });
@@ -5363,7 +5363,7 @@ function UrlComponentPreview(t0) {
5363
5363
  function _temp2$c(e_0) {
5364
5364
  return e_0.stopPropagation();
5365
5365
  }
5366
- function _temp$p(e) {
5366
+ function _temp$o(e) {
5367
5367
  e.preventDefault();
5368
5368
  }
5369
5369
  function VideoPreview(t0) {
@@ -5497,7 +5497,7 @@ function SkeletonPropertyComponent(t0) {
5497
5497
  if (Array.isArray(arrayProperty.of)) {
5498
5498
  let t1;
5499
5499
  if ($[6] !== arrayProperty.of) {
5500
- t1 = arrayProperty.of.map(_temp$o);
5500
+ t1 = arrayProperty.of.map(_temp$n);
5501
5501
  $[6] = arrayProperty.of;
5502
5502
  $[7] = t1;
5503
5503
  } else {
@@ -5635,7 +5635,7 @@ function SkeletonPropertyComponent(t0) {
5635
5635
  }
5636
5636
  return content || null;
5637
5637
  }
5638
- function _temp$o(p, i) {
5638
+ function _temp$n(p, i) {
5639
5639
  return renderGenericArrayCell(p, i);
5640
5640
  }
5641
5641
  function renderMap(property, size) {
@@ -6799,7 +6799,7 @@ function KeyValuePreview(t0) {
6799
6799
  }
6800
6800
  let t1;
6801
6801
  if ($[1] !== value) {
6802
- t1 = Object.entries(value).map(_temp$n);
6802
+ t1 = Object.entries(value).map(_temp$m);
6803
6803
  $[1] = value;
6804
6804
  $[2] = t1;
6805
6805
  } else {
@@ -6815,7 +6815,7 @@ function KeyValuePreview(t0) {
6815
6815
  }
6816
6816
  return t2;
6817
6817
  }
6818
- function _temp$n(t0) {
6818
+ function _temp$m(t0) {
6819
6819
  const [key, childValue] = t0;
6820
6820
  return /* @__PURE__ */ jsxs("div", { className: cls(defaultBorderMixin, "last:border-b-0 border-b"), children: [
6821
6821
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row pt-0.5 pb-0.5 gap-2", children: [
@@ -7561,7 +7561,7 @@ function VirtualTableSelect(props) {
7561
7561
  console.trace("onChange");
7562
7562
  if (valueType === "number") {
7563
7563
  if (multiple) {
7564
- const newValue = updatedValue.map(_temp$m);
7564
+ const newValue = updatedValue.map(_temp$l);
7565
7565
  updateValue(newValue);
7566
7566
  } else {
7567
7567
  updateValue(parseFloat(updatedValue));
@@ -7616,7 +7616,7 @@ function VirtualTableSelect(props) {
7616
7616
  function _temp2$b(v_0) {
7617
7617
  return v_0.toString();
7618
7618
  }
7619
- function _temp$m(v) {
7619
+ function _temp$l(v) {
7620
7620
  return parseFloat(v);
7621
7621
  }
7622
7622
  function VirtualTableNumberInput(props) {
@@ -8159,7 +8159,7 @@ function StorageUpload$1(t0) {
8159
8159
  const snackbarContext = useSnackbarController();
8160
8160
  let t1;
8161
8161
  if ($[0] !== storage.acceptedFiles) {
8162
- t1 = storage.acceptedFiles ? storage.acceptedFiles.map(_temp$l).reduce(_temp2$a, {}) : void 0;
8162
+ t1 = storage.acceptedFiles ? storage.acceptedFiles.map(_temp$k).reduce(_temp2$a, {}) : void 0;
8163
8163
  $[0] = storage.acceptedFiles;
8164
8164
  $[1] = t1;
8165
8165
  } else {
@@ -8388,7 +8388,7 @@ function _temp2$a(a, b) {
8388
8388
  ...b
8389
8389
  };
8390
8390
  }
8391
- function _temp$l(e) {
8391
+ function _temp$k(e) {
8392
8392
  return {
8393
8393
  [e]: []
8394
8394
  };
@@ -8495,7 +8495,7 @@ const TableReferenceFieldInternal = React__default.memo(function TableReferenceF
8495
8495
  let t1;
8496
8496
  if ($[2] !== updateValue) {
8497
8497
  t1 = (entities) => {
8498
- updateValue(entities.map(_temp$k));
8498
+ updateValue(entities.map(_temp$j));
8499
8499
  };
8500
8500
  $[2] = updateValue;
8501
8501
  $[3] = t1;
@@ -8656,7 +8656,7 @@ const TableReferenceFieldInternal = React__default.memo(function TableReferenceF
8656
8656
  }
8657
8657
  return t10;
8658
8658
  }, equal);
8659
- function _temp$k(e) {
8659
+ function _temp$j(e) {
8660
8660
  return getReferenceFrom(e);
8661
8661
  }
8662
8662
  function _temp2$9(ref) {
@@ -9792,7 +9792,7 @@ function CollectionTableToolbar(t0) {
9792
9792
  }
9793
9793
  let t6;
9794
9794
  if ($[6] !== t3 || $[7] !== t4) {
9795
- t6 = /* @__PURE__ */ jsx(Tooltip, { title: "Table row size", side: "right", sideOffset: 4, children: /* @__PURE__ */ jsx(Select, { value: t3, className: "w-16 h-10", size: "small", onValueChange: t4, renderValue: _temp$j, children: t5 }) });
9795
+ t6 = /* @__PURE__ */ jsx(Tooltip, { title: "Table row size", side: "right", sideOffset: 4, children: /* @__PURE__ */ jsx(Select, { value: t3, className: "w-16 h-10", size: "small", onValueChange: t4, renderValue: _temp$i, children: t5 }) });
9796
9796
  $[6] = t3;
9797
9797
  $[7] = t4;
9798
9798
  $[8] = t6;
@@ -9879,7 +9879,7 @@ function CollectionTableToolbar(t0) {
9879
9879
  function _temp2$8(size_0) {
9880
9880
  return /* @__PURE__ */ jsx(SelectItem, { value: size_0, className: "w-12 font-medium text-center", children: size_0.toUpperCase() }, size_0);
9881
9881
  }
9882
- function _temp$j(v_0) {
9882
+ function _temp$i(v_0) {
9883
9883
  return /* @__PURE__ */ jsx("div", { className: "font-medium", children: v_0.toUpperCase() });
9884
9884
  }
9885
9885
  function getTableCellAlignment(property) {
@@ -10988,7 +10988,7 @@ const SafeLinkRenderer = (t0) => {
10988
10988
  let t1;
10989
10989
  if ($[0] !== text) {
10990
10990
  const urlRegex = /https?:\/\/[^\s]+/g;
10991
- t1 = text.replace(urlRegex, _temp$i);
10991
+ t1 = text.replace(urlRegex, _temp$h);
10992
10992
  $[0] = text;
10993
10993
  $[1] = t1;
10994
10994
  } else {
@@ -11007,7 +11007,7 @@ const SafeLinkRenderer = (t0) => {
11007
11007
  }
11008
11008
  return t2;
11009
11009
  };
11010
- function _temp$i(url) {
11010
+ function _temp$h(url) {
11011
11011
  return `<a href="${url}" class="underline" target="_blank">Link</a><br/>`;
11012
11012
  }
11013
11013
  const operationLabels$2 = {
@@ -11215,7 +11215,7 @@ function StringNumberFilterField(t0) {
11215
11215
  }
11216
11216
  let t6;
11217
11217
  if ($[16] !== operation || $[17] !== t4 || $[18] !== t5) {
11218
- t6 = /* @__PURE__ */ jsx("div", { className: "w-[80px]", children: /* @__PURE__ */ jsx(Select, { value: operation, fullWidth: true, position: "item-aligned", onValueChange: t4, renderValue: _temp$h, children: t5 }) });
11218
+ t6 = /* @__PURE__ */ jsx("div", { className: "w-[80px]", children: /* @__PURE__ */ jsx(Select, { value: operation, fullWidth: true, position: "item-aligned", onValueChange: t4, renderValue: _temp$g, children: t5 }) });
11219
11219
  $[16] = operation;
11220
11220
  $[17] = t4;
11221
11221
  $[18] = t5;
@@ -11339,7 +11339,7 @@ function _temp3$3(e_1) {
11339
11339
  function _temp2$7(op_1) {
11340
11340
  return /* @__PURE__ */ jsx(SelectItem, { value: op_1, children: operationLabels$1[op_1] }, op_1);
11341
11341
  }
11342
- function _temp$h(op_0) {
11342
+ function _temp$g(op_0) {
11343
11343
  return operationLabels$1[op_0];
11344
11344
  }
11345
11345
  function BooleanFilterField(t0) {
@@ -11478,7 +11478,7 @@ function DateTimeFilterField(t0) {
11478
11478
  }
11479
11479
  let t6;
11480
11480
  if ($[13] !== operation || $[14] !== t4 || $[15] !== t5) {
11481
- t6 = /* @__PURE__ */ jsx("div", { className: "w-[80px]", children: /* @__PURE__ */ jsx(Select, { value: operation, size: "large", fullWidth: true, onValueChange: t4, renderValue: _temp$g, children: t5 }) });
11481
+ t6 = /* @__PURE__ */ jsx("div", { className: "w-[80px]", children: /* @__PURE__ */ jsx(Select, { value: operation, size: "large", fullWidth: true, onValueChange: t4, renderValue: _temp$f, children: t5 }) });
11482
11482
  $[13] = operation;
11483
11483
  $[14] = t4;
11484
11484
  $[15] = t5;
@@ -11567,7 +11567,7 @@ function DateTimeFilterField(t0) {
11567
11567
  function _temp2$6(op_1) {
11568
11568
  return /* @__PURE__ */ jsx(SelectItem, { value: op_1, children: operationLabels[op_1] }, op_1);
11569
11569
  }
11570
- function _temp$g(op_0) {
11570
+ function _temp$f(op_0) {
11571
11571
  return operationLabels[op_0];
11572
11572
  }
11573
11573
  const SelectableTable = React__default.memo(
@@ -12274,7 +12274,7 @@ function useTableSearchHelper(t0) {
12274
12274
  const searchBlocked = t12;
12275
12275
  let t2;
12276
12276
  if ($[15] !== customizationController.plugins || $[16] !== dataSource?.initTextSearch) {
12277
- t2 = Boolean(dataSource?.initTextSearch) || customizationController.plugins?.find(_temp$f);
12277
+ t2 = Boolean(dataSource?.initTextSearch) || customizationController.plugins?.find(_temp$e);
12278
12278
  $[15] = customizationController.plugins;
12279
12279
  $[16] = dataSource?.initTextSearch;
12280
12280
  $[17] = t2;
@@ -12366,7 +12366,7 @@ function useTableSearchHelper(t0) {
12366
12366
  }
12367
12367
  return t1;
12368
12368
  }
12369
- function _temp$f(p_0) {
12369
+ function _temp$e(p_0) {
12370
12370
  return Boolean(p_0.collectionView?.onTextSearchClick);
12371
12371
  }
12372
12372
  function DeleteEntityDialog({
@@ -12916,7 +12916,7 @@ function NavigationCard(t0) {
12916
12916
  }
12917
12917
  let t3;
12918
12918
  if ($[3] !== actions) {
12919
- t3 = /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", onClick: _temp$e, children: actions });
12919
+ t3 = /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", onClick: _temp$d, children: actions });
12920
12920
  $[3] = actions;
12921
12921
  $[4] = t3;
12922
12922
  } else {
@@ -13002,7 +13002,7 @@ function NavigationCard(t0) {
13002
13002
  }
13003
13003
  return t11;
13004
13004
  }
13005
- function _temp$e(event) {
13005
+ function _temp$d(event) {
13006
13006
  event.preventDefault();
13007
13007
  event.stopPropagation();
13008
13008
  }
@@ -13294,7 +13294,7 @@ function FavouritesView(t0) {
13294
13294
  T0 = Collapse;
13295
13295
  t4 = favouriteCollections.length > 0;
13296
13296
  t2 = "flex flex-row flex-wrap gap-2 pb-2 min-h-[32px]";
13297
- t3 = favouriteCollections.map(_temp$d);
13297
+ t3 = favouriteCollections.map(_temp$c);
13298
13298
  $[2] = navigationController.topLevelNavigation?.navigationEntries;
13299
13299
  $[3] = t1;
13300
13300
  $[4] = T0;
@@ -13328,7 +13328,7 @@ function FavouritesView(t0) {
13328
13328
  }
13329
13329
  return t6;
13330
13330
  }
13331
- function _temp$d(entry_0) {
13331
+ function _temp$c(entry_0) {
13332
13332
  return /* @__PURE__ */ jsx(NavigationChip, { entry: entry_0 }, entry_0.path);
13333
13333
  }
13334
13334
  const scrollsMap = {};
@@ -13425,7 +13425,7 @@ function DefaultHomePage(t0) {
13425
13425
  } else {
13426
13426
  const searchResult = fuse.current?.search(value);
13427
13427
  if (searchResult) {
13428
- setFilteredUrls(searchResult.map(_temp$c));
13428
+ setFilteredUrls(searchResult.map(_temp$b));
13429
13429
  }
13430
13430
  }
13431
13431
  };
@@ -13703,7 +13703,7 @@ function _temp3$2(e_1) {
13703
13703
  function _temp2$5(entry) {
13704
13704
  return entry.group;
13705
13705
  }
13706
- function _temp$c(e_0) {
13706
+ function _temp$b(e_0) {
13707
13707
  return e_0.item.url;
13708
13708
  }
13709
13709
  function EntityCollectionViewActions(t0) {
@@ -15481,7 +15481,7 @@ const DefaultAppBar = function DefaultAppBar2(t0) {
15481
15481
  }
15482
15482
  let t7;
15483
15483
  if ($[18] !== breadcrumbs.breadcrumbs) {
15484
- t7 = breadcrumbs.breadcrumbs && /* @__PURE__ */ jsx("div", { className: "mr-8 hidden lg:block", children: /* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2", children: breadcrumbs.breadcrumbs.map(_temp$b) }) });
15484
+ t7 = breadcrumbs.breadcrumbs && /* @__PURE__ */ jsx("div", { className: "mr-8 hidden lg:block", children: /* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2", children: breadcrumbs.breadcrumbs.map(_temp$a) }) });
15485
15485
  $[18] = breadcrumbs.breadcrumbs;
15486
15486
  $[19] = t7;
15487
15487
  } else {
@@ -15593,7 +15593,7 @@ const DefaultAppBar = function DefaultAppBar2(t0) {
15593
15593
  }
15594
15594
  return t14;
15595
15595
  };
15596
- function _temp$b(breadcrumb, index) {
15596
+ function _temp$a(breadcrumb, index) {
15597
15597
  return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
15598
15598
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: "/" }),
15599
15599
  /* @__PURE__ */ jsx(Link, { className: "visited:text-inherit visited:dark:text-inherit block", to: breadcrumb.url, children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: breadcrumb.title }) }, index)
@@ -15963,7 +15963,7 @@ function SearchIconsView(t0) {
15963
15963
  } else {
15964
15964
  const searchResult = iconsSearch.search(value);
15965
15965
  const limited = searchResult.slice(0, 50);
15966
- setKeys(limited.map(_temp$a));
15966
+ setKeys(limited.map(_temp$9));
15967
15967
  }
15968
15968
  }, UPDATE_SEARCH_INDEX_WAIT_MS);
15969
15969
  $[0] = t3;
@@ -16030,7 +16030,7 @@ function SearchIconsView(t0) {
16030
16030
  }
16031
16031
  return t8;
16032
16032
  }
16033
- function _temp$a(e) {
16033
+ function _temp$9(e) {
16034
16034
  return e.item.key;
16035
16035
  }
16036
16036
  function FieldCaption(t0) {
@@ -16296,6 +16296,7 @@ function EntityForm({
16296
16296
  onEntityChange,
16297
16297
  openEntityMode = "full_screen",
16298
16298
  formex: formexProp,
16299
+ Builder,
16299
16300
  EntityFormActionsComponent = EntityFormActions,
16300
16301
  showDefaultActions = true,
16301
16302
  showEntityPath = true,
@@ -16610,48 +16611,53 @@ function EntityForm({
16610
16611
  }
16611
16612
  }, [formex.isSubmitting, autoSave, underlyingChanges, entity, formex.values, formex.touched, formex.setFieldValue]);
16612
16613
  const formFieldKeys = getFormFieldKeys(resolvedCollection);
16613
- const formFields = () => /* @__PURE__ */ jsx(FormLayout, { children: formFieldKeys.map((key_1) => {
16614
- const property_0 = resolvedCollection.properties[key_1];
16615
- if (property_0) {
16616
- const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(key_1) && formex.touched[key_1];
16617
- const disabled = !autoSave && formex.isSubmitting || isReadOnly(property_0) || Boolean(property_0.disabled);
16618
- const hidden = isHidden(property_0);
16619
- if (hidden) return null;
16620
- const widthPercentage = property_0.widthPercentage ?? 100;
16621
- const cmsFormFieldProps = {
16622
- propertyKey: key_1,
16623
- disabled,
16624
- property: property_0,
16625
- includeDescription: property_0.description || property_0.longDescription,
16626
- underlyingValueHasChanged: underlyingValueHasChanged && !autoSave,
16627
- context: formContext,
16628
- partOfArray: false,
16629
- minimalistView: false,
16630
- autoFocus: false
16631
- };
16632
- return /* @__PURE__ */ jsx(FormEntry, { propertyKey: key_1, widthPercentage, children: /* @__PURE__ */ jsx(PropertyFieldBinding, { ...cmsFormFieldProps }) }, `field_${key_1}`);
16633
- }
16634
- const additionalField = resolvedCollection.additionalFields?.find((f) => f.key === key_1);
16635
- if (additionalField && entity) {
16636
- const Builder = additionalField.Builder;
16637
- if (!Builder && !additionalField.value) {
16638
- throw new Error("When using additional fields you need to provide a Builder or a value");
16614
+ const formFields = () => {
16615
+ if (Builder) {
16616
+ return /* @__PURE__ */ jsx(Builder, { collection, entity, modifiedValues: formex.values, formContext });
16617
+ }
16618
+ return /* @__PURE__ */ jsx(FormLayout, { children: formFieldKeys.map((key_1) => {
16619
+ const property_0 = resolvedCollection.properties[key_1];
16620
+ if (property_0) {
16621
+ const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(key_1) && formex.touched[key_1];
16622
+ const disabled = !autoSave && formex.isSubmitting || isReadOnly(property_0) || Boolean(property_0.disabled);
16623
+ const hidden = isHidden(property_0);
16624
+ if (hidden) return null;
16625
+ const widthPercentage = property_0.widthPercentage ?? 100;
16626
+ const cmsFormFieldProps = {
16627
+ propertyKey: key_1,
16628
+ disabled,
16629
+ property: property_0,
16630
+ includeDescription: property_0.description || property_0.longDescription,
16631
+ underlyingValueHasChanged: underlyingValueHasChanged && !autoSave,
16632
+ context: formContext,
16633
+ partOfArray: false,
16634
+ minimalistView: false,
16635
+ autoFocus: false
16636
+ };
16637
+ return /* @__PURE__ */ jsx(FormEntry, { propertyKey: key_1, widthPercentage, children: /* @__PURE__ */ jsx(PropertyFieldBinding, { ...cmsFormFieldProps }) }, `field_${key_1}`);
16639
16638
  }
16640
- const child = Builder ? /* @__PURE__ */ jsx(Builder, { entity, context }) : /* @__PURE__ */ jsx("div", { className: "w-full", children: additionalField.value?.({
16641
- entity,
16642
- context
16643
- })?.toString() });
16644
- return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
16645
- /* @__PURE__ */ jsx(LabelWithIconAndTooltip, { propertyKey: key_1, icon: /* @__PURE__ */ jsx(NotesIcon, { size: "small" }), title: additionalField.name, className: "text-text-secondary dark:text-text-secondary-dark ml-3.5" }),
16646
- /* @__PURE__ */ jsx("div", { className: cls(paperMixin, "w-full min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar"), children: /* @__PURE__ */ jsx(ErrorBoundary, { children: child }) })
16647
- ] }, `additional_${key_1}`);
16648
- }
16649
- console.warn(`Property ${key_1} not found in collection ${resolvedCollection.name} in properties or additional fields. Skipping.`);
16650
- return null;
16651
- }).filter(Boolean) });
16639
+ const additionalField = resolvedCollection.additionalFields?.find((f) => f.key === key_1);
16640
+ if (additionalField && entity) {
16641
+ const Builder_0 = additionalField.Builder;
16642
+ if (!Builder_0 && !additionalField.value) {
16643
+ throw new Error("When using additional fields you need to provide a Builder or a value");
16644
+ }
16645
+ const child = Builder_0 ? /* @__PURE__ */ jsx(Builder_0, { entity, context }) : /* @__PURE__ */ jsx("div", { className: "w-full", children: additionalField.value?.({
16646
+ entity,
16647
+ context
16648
+ })?.toString() });
16649
+ return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
16650
+ /* @__PURE__ */ jsx(LabelWithIconAndTooltip, { propertyKey: key_1, icon: /* @__PURE__ */ jsx(NotesIcon, { size: "small" }), title: additionalField.name, className: "text-text-secondary dark:text-text-secondary-dark ml-3.5" }),
16651
+ /* @__PURE__ */ jsx("div", { className: cls(paperMixin, "w-full min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar"), children: /* @__PURE__ */ jsx(ErrorBoundary, { children: child }) })
16652
+ ] }, `additional_${key_1}`);
16653
+ }
16654
+ console.warn(`Property ${key_1} not found in collection ${resolvedCollection.name} in properties or additional fields. Skipping.`);
16655
+ return null;
16656
+ }).filter(Boolean) });
16657
+ };
16652
16658
  const formRef = useRef(null);
16653
16659
  const formView = /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
16654
- /* @__PURE__ */ jsxs("div", { className: "w-full py-2 flex flex-col items-start my-4 lg:my-6", children: [
16660
+ !Builder && /* @__PURE__ */ jsxs("div", { className: "w-full py-2 flex flex-col items-start my-4 lg:my-6", children: [
16655
16661
  /* @__PURE__ */ jsx(Typography, { className: "py-4 flex-grow line-clamp-1 " + (collection.hideIdFromForm ? "mb-2" : "mb-0"), variant: "h4", children: title ?? collection.singularName ?? collection.name }),
16656
16662
  showEntityPath && /* @__PURE__ */ jsx(Alert, { color: "base", className: "w-full", size: "small", children: /* @__PURE__ */ jsxs("code", { className: "text-xs select-all text-text-secondary dark:text-text-secondary-dark", children: [
16657
16663
  entity?.path ?? path,
@@ -16660,7 +16666,7 @@ function EntityForm({
16660
16666
  ] }) })
16661
16667
  ] }),
16662
16668
  children,
16663
- !collection.hideIdFromForm && /* @__PURE__ */ jsx(CustomIdField, { customId: collection.customId, entityId, status, onChange: setEntityId, error: entityIdError, loading: customIdLoading, entity }),
16669
+ !Builder && !collection.hideIdFromForm && /* @__PURE__ */ jsx(CustomIdField, { customId: collection.customId, entityId, status, onChange: setEntityId, error: entityIdError, loading: customIdLoading, entity }),
16664
16670
  entityId && formContext && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "mt-12 flex flex-col gap-8", ref: formRef, children: [
16665
16671
  formFields(),
16666
16672
  /* @__PURE__ */ jsx(ErrorFocus, { containerRef: formRef })
@@ -16670,7 +16676,20 @@ function EntityForm({
16670
16676
  useEffect(() => {
16671
16677
  if (entityId && onIdChange) onIdChange(entityId);
16672
16678
  }, [entityId, onIdChange]);
16673
- return /* @__PURE__ */ jsx(FormLayoutInner, { className, id: `form_${path}`, pluginActions, forceActionsAtTheBottom, EntityFormActionsComponent, formContext, showDefaultActions, children: formView });
16679
+ const disabled_0 = formex.isSubmitting || !formex.dirty && status === "existing";
16680
+ if (!resolvedCollection || !path) {
16681
+ throw Error("INTERNAL: Collection and path must be defined in form context");
16682
+ }
16683
+ const dialogActions = /* @__PURE__ */ jsx(EntityFormActionsComponent, { collection: resolvedCollection, path, entity, layout: forceActionsAtTheBottom ? "bottom" : "side", savingError, formex, disabled: disabled_0, status, pluginActions, openEntityMode, showDefaultActions });
16684
+ return /* @__PURE__ */ jsx(Formex, { value: formContext.formex, children: /* @__PURE__ */ jsxs("form", { onSubmit: formContext.formex.handleSubmit, onReset: () => formex.resetForm({
16685
+ values: getInitialEntityValues(collection, path, status, entity, customizationController.propertyConfigs)
16686
+ }), noValidate: true, className: cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", className), children: [
16687
+ /* @__PURE__ */ jsx("div", { id: `form_${path}`, className: cls("relative flex flex-row max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit"), children: /* @__PURE__ */ jsxs("div", { className: cls("flex flex-col w-full pt-12 pb-16 px-4 sm:px-8 md:px-10"), children: [
16688
+ formContext.formex.dirty ? /* @__PURE__ */ jsx(Tooltip, { title: "Unsaved changes", className: "self-end sticky top-4 z-10", children: /* @__PURE__ */ jsx(Chip, { size: "small", colorScheme: "orangeDarker", children: /* @__PURE__ */ jsx(EditIcon, { size: "smallest" }) }) }) : /* @__PURE__ */ jsx(Tooltip, { title: "In sync with the database", className: "self-end sticky top-4 z-10", children: /* @__PURE__ */ jsx(Chip, { size: "small", children: /* @__PURE__ */ jsx(CheckIcon, { size: "smallest" }) }) }),
16689
+ formView
16690
+ ] }) }),
16691
+ dialogActions
16692
+ ] }) });
16674
16693
  }
16675
16694
  function getInitialEntityValues(collection, path, status, entity, propertyConfigs) {
16676
16695
  const resolvedCollection = resolveCollection({
@@ -16711,150 +16730,6 @@ function yupToFormErrors(yupError) {
16711
16730
  }
16712
16731
  return errors;
16713
16732
  }
16714
- function FormLayoutInner(t0) {
16715
- const $ = c(43);
16716
- const {
16717
- id,
16718
- formContext,
16719
- children,
16720
- className,
16721
- forceActionsAtTheBottom,
16722
- pluginActions,
16723
- EntityFormActionsComponent,
16724
- showDefaultActions
16725
- } = t0;
16726
- const formex = formContext.formex;
16727
- const collection = formContext.collection;
16728
- const path = formContext.path;
16729
- const entity = formContext.entity;
16730
- const savingError = formContext.savingError;
16731
- const status = formContext.status;
16732
- const openEntityMode = formContext.openEntityMode;
16733
- const disabled = formex.isSubmitting || !formex.dirty && status === "existing";
16734
- const customizationController = useCustomizationController();
16735
- if (!collection || !path) {
16736
- throw Error("INTERNAL: Collection and path must be defined in form context");
16737
- }
16738
- const t1 = forceActionsAtTheBottom ? "bottom" : "side";
16739
- let t2;
16740
- if ($[0] !== pluginActions) {
16741
- t2 = pluginActions ?? [];
16742
- $[0] = pluginActions;
16743
- $[1] = t2;
16744
- } else {
16745
- t2 = $[1];
16746
- }
16747
- let t3;
16748
- if ($[2] !== EntityFormActionsComponent || $[3] !== collection || $[4] !== disabled || $[5] !== entity || $[6] !== formex || $[7] !== openEntityMode || $[8] !== path || $[9] !== savingError || $[10] !== showDefaultActions || $[11] !== status || $[12] !== t1 || $[13] !== t2) {
16749
- t3 = /* @__PURE__ */ jsx(EntityFormActionsComponent, { collection, path, entity, layout: t1, savingError, formex, disabled, status, pluginActions: t2, openEntityMode, showDefaultActions });
16750
- $[2] = EntityFormActionsComponent;
16751
- $[3] = collection;
16752
- $[4] = disabled;
16753
- $[5] = entity;
16754
- $[6] = formex;
16755
- $[7] = openEntityMode;
16756
- $[8] = path;
16757
- $[9] = savingError;
16758
- $[10] = showDefaultActions;
16759
- $[11] = status;
16760
- $[12] = t1;
16761
- $[13] = t2;
16762
- $[14] = t3;
16763
- } else {
16764
- t3 = $[14];
16765
- }
16766
- const dialogActions = t3;
16767
- const t4 = formContext.formex;
16768
- const t5 = formContext.formex.handleSubmit;
16769
- let t6;
16770
- if ($[15] !== collection || $[16] !== customizationController.propertyConfigs || $[17] !== entity || $[18] !== formex || $[19] !== path || $[20] !== status) {
16771
- t6 = () => formex.resetForm({
16772
- values: getInitialEntityValues(collection, path, status, entity, customizationController.propertyConfigs)
16773
- });
16774
- $[15] = collection;
16775
- $[16] = customizationController.propertyConfigs;
16776
- $[17] = entity;
16777
- $[18] = formex;
16778
- $[19] = path;
16779
- $[20] = status;
16780
- $[21] = t6;
16781
- } else {
16782
- t6 = $[21];
16783
- }
16784
- let t7;
16785
- if ($[22] !== className) {
16786
- t7 = cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", className);
16787
- $[22] = className;
16788
- $[23] = t7;
16789
- } else {
16790
- t7 = $[23];
16791
- }
16792
- let t8;
16793
- let t9;
16794
- if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
16795
- t8 = cls("relative flex flex-row max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit");
16796
- t9 = cls("flex flex-col w-full pt-12 pb-16 px-4 sm:px-8 md:px-10");
16797
- $[24] = t8;
16798
- $[25] = t9;
16799
- } else {
16800
- t8 = $[24];
16801
- t9 = $[25];
16802
- }
16803
- let t10;
16804
- if ($[26] !== formContext.formex.dirty) {
16805
- t10 = formContext.formex.dirty ? /* @__PURE__ */ jsx(Tooltip, { title: "Unsaved changes", className: "self-end sticky top-4 z-10", children: /* @__PURE__ */ jsx(Chip, { size: "small", colorScheme: "orangeDarker", children: /* @__PURE__ */ jsx(EditIcon, { size: "smallest" }) }) }) : /* @__PURE__ */ jsx(Tooltip, { title: "In sync with the database", className: "self-end sticky top-4 z-10", children: /* @__PURE__ */ jsx(Chip, { size: "small", children: /* @__PURE__ */ jsx(CheckIcon, { size: "smallest" }) }) });
16806
- $[26] = formContext.formex.dirty;
16807
- $[27] = t10;
16808
- } else {
16809
- t10 = $[27];
16810
- }
16811
- let t11;
16812
- if ($[28] !== children || $[29] !== t10) {
16813
- t11 = /* @__PURE__ */ jsxs("div", { className: t9, children: [
16814
- t10,
16815
- children
16816
- ] });
16817
- $[28] = children;
16818
- $[29] = t10;
16819
- $[30] = t11;
16820
- } else {
16821
- t11 = $[30];
16822
- }
16823
- let t12;
16824
- if ($[31] !== id || $[32] !== t11) {
16825
- t12 = /* @__PURE__ */ jsx("div", { id, className: t8, children: t11 });
16826
- $[31] = id;
16827
- $[32] = t11;
16828
- $[33] = t12;
16829
- } else {
16830
- t12 = $[33];
16831
- }
16832
- let t13;
16833
- if ($[34] !== dialogActions || $[35] !== formContext.formex.handleSubmit || $[36] !== t12 || $[37] !== t6 || $[38] !== t7) {
16834
- t13 = /* @__PURE__ */ jsxs("form", { onSubmit: t5, onReset: t6, noValidate: true, className: t7, children: [
16835
- t12,
16836
- dialogActions
16837
- ] });
16838
- $[34] = dialogActions;
16839
- $[35] = formContext.formex.handleSubmit;
16840
- $[36] = t12;
16841
- $[37] = t6;
16842
- $[38] = t7;
16843
- $[39] = t13;
16844
- } else {
16845
- t13 = $[39];
16846
- }
16847
- let t14;
16848
- if ($[40] !== formContext.formex || $[41] !== t13) {
16849
- t14 = /* @__PURE__ */ jsx(Formex, { value: t4, children: t13 });
16850
- $[40] = formContext.formex;
16851
- $[41] = t13;
16852
- $[42] = t14;
16853
- } else {
16854
- t14 = $[42];
16855
- }
16856
- return t14;
16857
- }
16858
16733
  function useOnAutoSave(autoSave, formex, lastSavedValues, save) {
16859
16734
  if (!autoSave) return;
16860
16735
  useEffect(() => {
@@ -17430,7 +17305,7 @@ function StorageItemPreview(t0) {
17430
17305
  }
17431
17306
  let t5;
17432
17307
  if ($[14] !== placeholder) {
17433
- t5 = placeholder && /* @__PURE__ */ jsx("div", { onClick: _temp$9, className: "flex flex-col items-center justify-center w-full h-full", children: /* @__PURE__ */ jsx(DescriptionIcon, { className: "text-surface-700 dark:text-surface-300" }) });
17308
+ t5 = placeholder && /* @__PURE__ */ jsx("div", { onClick: _temp$8, className: "flex flex-col items-center justify-center w-full h-full", children: /* @__PURE__ */ jsx(DescriptionIcon, { className: "text-surface-700 dark:text-surface-300" }) });
17434
17309
  $[14] = placeholder;
17435
17310
  $[15] = t5;
17436
17311
  } else {
@@ -17453,7 +17328,7 @@ function StorageItemPreview(t0) {
17453
17328
  }
17454
17329
  return t6;
17455
17330
  }
17456
- function _temp$9(e) {
17331
+ function _temp$8(e) {
17457
17332
  return e.stopPropagation();
17458
17333
  }
17459
17334
  const dropZoneClasses = "box-border relative pt-[2px] items-center border border-transparent min-h-[254px] outline-none rounded-md duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] focus:border-primary-solid";
@@ -17636,7 +17511,7 @@ function FileDropComponent(t0) {
17636
17511
  const snackbarContext = useSnackbarController();
17637
17512
  let t1;
17638
17513
  if ($[0] !== storage.acceptedFiles) {
17639
- t1 = storage.acceptedFiles ? storage.acceptedFiles.map(_temp$8).reduce(_temp2$4, {}) : void 0;
17514
+ t1 = storage.acceptedFiles ? storage.acceptedFiles.map(_temp$7).reduce(_temp2$4, {}) : void 0;
17640
17515
  $[0] = storage.acceptedFiles;
17641
17516
  $[1] = t1;
17642
17517
  } else {
@@ -17852,7 +17727,7 @@ function _temp2$4(a, b) {
17852
17727
  ...b
17853
17728
  };
17854
17729
  }
17855
- function _temp$8(e) {
17730
+ function _temp$7(e) {
17856
17731
  return {
17857
17732
  [e]: []
17858
17733
  };
@@ -18817,7 +18692,7 @@ function MapFieldBinding(t0) {
18817
18692
  } else {
18818
18693
  t42 = $[20];
18819
18694
  }
18820
- t3 = Object.entries(mapProperties).filter(_temp$7).map(t42);
18695
+ t3 = Object.entries(mapProperties).filter(_temp$6).map(t42);
18821
18696
  $[6] = autoFocus;
18822
18697
  $[7] = context;
18823
18698
  $[8] = disabled;
@@ -18887,7 +18762,7 @@ function MapFieldBinding(t0) {
18887
18762
  }
18888
18763
  return t10;
18889
18764
  }
18890
- function _temp$7(t0) {
18765
+ function _temp$6(t0) {
18891
18766
  const [, property_0] = t0;
18892
18767
  return !isHidden(property_0);
18893
18768
  }
@@ -20010,7 +19885,7 @@ function BlockEntry(t0) {
20010
19885
  const property = t4;
20011
19886
  let t5;
20012
19887
  if ($[9] !== properties) {
20013
- t5 = Object.entries(properties).map(_temp$6);
19888
+ t5 = Object.entries(properties).map(_temp$5);
20014
19889
  $[9] = properties;
20015
19890
  $[10] = t5;
20016
19891
  } else {
@@ -20101,7 +19976,7 @@ function BlockEntry(t0) {
20101
19976
  }
20102
19977
  return t11;
20103
19978
  }
20104
- function _temp$6(t0) {
19979
+ function _temp$5(t0) {
20105
19980
  const [key, property_0] = t0;
20106
19981
  return {
20107
19982
  id: key,
@@ -21171,6 +21046,16 @@ function resolveEntityView(entityView, contextEntityViews) {
21171
21046
  return entityView;
21172
21047
  }
21173
21048
  }
21049
+ function resolvedSelectedEntityView(customViews, customizationController, selectedTab) {
21050
+ const resolvedEntityViews = customViews ? customViews.map((e) => resolveEntityView(e, customizationController.entityViews)).filter(Boolean) : [];
21051
+ const selectedEntityView = resolvedEntityViews.find((e) => e.key === selectedTab);
21052
+ const selectedSecondaryForm = customViews && resolvedEntityViews.filter((e) => e.includeActions).find((e) => e.key === selectedTab);
21053
+ return {
21054
+ resolvedEntityViews,
21055
+ selectedEntityView,
21056
+ selectedSecondaryForm
21057
+ };
21058
+ }
21174
21059
  function getNavigationEntriesFromPath(props) {
21175
21060
  const {
21176
21061
  path,
@@ -21749,52 +21634,6 @@ function EntityEditView(t0) {
21749
21634
  }
21750
21635
  return t5;
21751
21636
  }
21752
- function SecondaryForm(t0) {
21753
- const $ = c(12);
21754
- const {
21755
- collection,
21756
- className,
21757
- customView,
21758
- entity,
21759
- formContext,
21760
- forceActionsAtTheBottom
21761
- } = t0;
21762
- if (!customView.Builder) {
21763
- console.error("customView.Builder is not defined");
21764
- return null;
21765
- }
21766
- let t1;
21767
- if ($[0] !== collection || $[1] !== customView.Builder || $[2] !== entity || $[3] !== formContext) {
21768
- t1 = formContext && /* @__PURE__ */ jsx(customView.Builder, { collection, entity, modifiedValues: formContext.formex.values ?? entity?.values, formContext });
21769
- $[0] = collection;
21770
- $[1] = customView.Builder;
21771
- $[2] = entity;
21772
- $[3] = formContext;
21773
- $[4] = t1;
21774
- } else {
21775
- t1 = $[4];
21776
- }
21777
- let t2;
21778
- if ($[5] !== t1) {
21779
- t2 = /* @__PURE__ */ jsx(ErrorBoundary, { children: t1 });
21780
- $[5] = t1;
21781
- $[6] = t2;
21782
- } else {
21783
- t2 = $[6];
21784
- }
21785
- let t3;
21786
- if ($[7] !== className || $[8] !== forceActionsAtTheBottom || $[9] !== formContext || $[10] !== t2) {
21787
- t3 = /* @__PURE__ */ jsx(FormLayoutInner, { className, forceActionsAtTheBottom, formContext, EntityFormActionsComponent: EntityEditViewFormActions, children: t2 });
21788
- $[7] = className;
21789
- $[8] = forceActionsAtTheBottom;
21790
- $[9] = formContext;
21791
- $[10] = t2;
21792
- $[11] = t3;
21793
- } else {
21794
- t3 = $[11];
21795
- }
21796
- return t3;
21797
- }
21798
21637
  function EntityEditViewInner({
21799
21638
  path,
21800
21639
  entityId,
@@ -21831,33 +21670,28 @@ function EntityEditViewInner({
21831
21670
  setSelectedTab(selectedTabProp ?? MAIN_TAB_VALUE);
21832
21671
  }
21833
21672
  }, [selectedTabProp]);
21834
- const mainViewVisible = selectedTab === MAIN_TAB_VALUE;
21835
21673
  const subcollections = (collection.subcollections ?? []).filter((c2) => !c2.hideFromNavigation);
21836
21674
  const subcollectionsCount = subcollections?.length ?? 0;
21837
21675
  const customViews = collection.entityViews;
21838
21676
  const customViewsCount = customViews?.length ?? 0;
21839
21677
  const hasAdditionalViews = customViewsCount > 0 || subcollectionsCount > 0;
21840
- const resolvedEntityViews = customViews ? customViews.map((e) => resolveEntityView(e, customizationController.entityViews)).filter(Boolean) : [];
21841
- const selectedEntityView = resolvedEntityViews.find((e_0) => e_0.key === selectedTab);
21678
+ const {
21679
+ resolvedEntityViews,
21680
+ selectedEntityView,
21681
+ selectedSecondaryForm
21682
+ } = resolvedSelectedEntityView(customViews, customizationController, selectedTab);
21842
21683
  const actionsAtTheBottom = !largeLayout || layout === "side_panel" || selectedEntityView?.includeActions === "bottom";
21843
- const secondaryForms = formContext && customViews && resolvedEntityViews.filter((e_1) => e_1.includeActions).map((customView) => {
21844
- if (!customView || !formContext) return null;
21845
- if (!customView.Builder) {
21846
- console.error("customView.Builder is not defined");
21847
- return null;
21848
- }
21849
- return /* @__PURE__ */ jsx(SecondaryForm, { className: selectedTab !== customView.key ? "hidden" : "", customView, formContext, collection, forceActionsAtTheBottom: !largeLayout || layout === "side_panel" || customView.includeActions === "bottom", entity: usedEntity }, `custom_view_${customView.key}`);
21850
- }).filter(Boolean);
21851
- const customViewsView = customViews && resolvedEntityViews.filter((e_2) => !e_2.includeActions).map((customView_0) => {
21852
- if (!customView_0) return null;
21853
- const Builder = customView_0.Builder;
21684
+ const mainViewVisible = selectedTab === MAIN_TAB_VALUE || Boolean(selectedSecondaryForm);
21685
+ const customViewsView = customViews && resolvedEntityViews.filter((e) => !e.includeActions).map((customView) => {
21686
+ if (!customView) return null;
21687
+ const Builder = customView.Builder;
21854
21688
  if (!Builder) {
21855
21689
  console.error("customView.Builder is not defined");
21856
21690
  return null;
21857
21691
  }
21858
21692
  return /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "relative flex-1 w-full h-full overflow-auto", {
21859
- "hidden": selectedTab !== customView_0.key
21860
- }), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: formContext && /* @__PURE__ */ jsx(Builder, { collection, entity: usedEntity, modifiedValues: formContext.formex.values ?? usedEntity?.values, formContext }) }) }, `custom_view_${customView_0.key}`);
21693
+ "hidden": selectedTab !== customView.key
21694
+ }), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: formContext && /* @__PURE__ */ jsx(Builder, { collection, entity: usedEntity, modifiedValues: formContext.formex.values ?? usedEntity?.values, formContext }) }) }, `custom_view_${customView.key}`);
21861
21695
  }).filter(Boolean);
21862
21696
  const globalLoading = dataLoading && !usedEntity;
21863
21697
  const subCollectionsViews = subcollections && subcollections.map((subcollection) => {
@@ -21896,7 +21730,7 @@ function EntityEditViewInner({
21896
21730
  };
21897
21731
  onSaved?.(res);
21898
21732
  formProps?.onSaved?.(res);
21899
- } });
21733
+ }, Builder: selectedSecondaryForm?.Builder });
21900
21734
  const subcollectionTabs = subcollections && subcollections.map((subcollection_0) => /* @__PURE__ */ jsx(Tab, { className: "text-sm min-w-[120px]", value: subcollection_0.id, children: subcollection_0.name }, `entity_detail_collection_tab_${subcollection_0.name}`));
21901
21735
  const customViewTabs = resolvedEntityViews.map((view) => /* @__PURE__ */ jsx(Tab, { className: "text-sm min-w-[120px]", value: view.key, children: view.name }, `entity_detail_collection_tab_${view.name}`));
21902
21736
  const shouldShowTopBar = Boolean(barActions) || hasAdditionalViews;
@@ -21914,7 +21748,6 @@ function EntityEditViewInner({
21914
21748
  ] })
21915
21749
  ] }),
21916
21750
  globalLoading ? /* @__PURE__ */ jsx("div", { className: "w-full pt-12 pb-16 px-4 sm:px-8 md:px-10", children: /* @__PURE__ */ jsx(CircularProgressCenter, {}) }) : entityView,
21917
- secondaryForms,
21918
21751
  customViewsView,
21919
21752
  subCollectionsViews
21920
21753
  ] });
@@ -22025,16 +21858,19 @@ function EntitySidePanel(props) {
22025
21858
  }
22026
21859
  const NEW_URL_HASH = "new_side";
22027
21860
  const SIDE_URL_HASH = "side";
22028
- function getEntityViewWidth(props, small) {
21861
+ function getEntityViewWidth(props, small, customizationController) {
22029
21862
  if (small) return CONTAINER_FULL_WIDTH;
22030
- const mainViewSelected = !props.selectedTab;
21863
+ const {
21864
+ selectedSecondaryForm
21865
+ } = resolvedSelectedEntityView(props.collection?.entityViews, customizationController, props.selectedTab);
21866
+ const shouldUseSmallLayout = !props.selectedTab || Boolean(selectedSecondaryForm);
22031
21867
  let resolvedWidth;
22032
21868
  if (props.width) {
22033
21869
  resolvedWidth = typeof props.width === "number" ? `${props.width}px` : props.width;
22034
21870
  } else if (props.collection?.sideDialogWidth) {
22035
21871
  resolvedWidth = typeof props.collection.sideDialogWidth === "number" ? `${props.collection.sideDialogWidth}px` : props.collection.sideDialogWidth;
22036
21872
  }
22037
- if (!mainViewSelected) {
21873
+ if (!shouldUseSmallLayout) {
22038
21874
  return `calc(${ADDITIONAL_TAB_WIDTH} + ${resolvedWidth ?? FORM_CONTAINER_WIDTH})`;
22039
21875
  } else {
22040
21876
  if (resolvedWidth) {
@@ -22086,194 +21922,81 @@ function getNestedPropertiesDepth(property, accumulator = 0) {
22086
21922
  }
22087
21923
  }
22088
21924
  const useBuildSideEntityController = (navigation, sideDialogsController) => {
22089
- const $ = c(44);
22090
21925
  const location = useLocation();
22091
21926
  const initialised = useRef(false);
21927
+ const customizationController = useCustomizationController();
22092
21928
  const smallLayout = !useLargeLayout();
22093
- let t0;
22094
- if ($[0] !== location.hash || $[1] !== location.pathname || $[2] !== navigation || $[3] !== sideDialogsController || $[4] !== smallLayout) {
22095
- t0 = () => {
22096
- const newFlag = location.hash === `#${NEW_URL_HASH}`;
22097
- const sideFlag = location.hash === `#${SIDE_URL_HASH}`;
22098
- if (!navigation.loading) {
22099
- if ((newFlag || sideFlag) && navigation.isUrlCollectionPath(location.pathname)) {
22100
- const entityOrCollectionPath = navigation.urlPathToDataPath(location.pathname);
22101
- const panelsFromUrl = buildSidePanelsFromUrl(entityOrCollectionPath, navigation.collections ?? [], newFlag);
22102
- for (let i = 0; i < panelsFromUrl.length; i++) {
22103
- const props = panelsFromUrl[i];
22104
- if (i === 0) {
22105
- sideDialogsController.replace(propsToSidePanel(props, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout));
22106
- } else {
22107
- sideDialogsController.open(propsToSidePanel(props, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout));
22108
- }
22109
- }
21929
+ useEffect(() => {
21930
+ const newFlag = location.hash === `#${NEW_URL_HASH}`;
21931
+ const sideFlag = location.hash === `#${SIDE_URL_HASH}`;
21932
+ if (!navigation.loading) {
21933
+ if ((newFlag || sideFlag) && navigation.isUrlCollectionPath(location.pathname)) {
21934
+ const entityOrCollectionPath = navigation.urlPathToDataPath(location.pathname);
21935
+ const panelsFromUrl = buildSidePanelsFromUrl(entityOrCollectionPath, navigation.collections ?? [], newFlag);
21936
+ for (let i = 0; i < panelsFromUrl.length; i++) {
21937
+ const props = panelsFromUrl[i];
21938
+ if (i === 0) sideDialogsController.replace(propsToSidePanel(props, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController));
21939
+ else sideDialogsController.open(propsToSidePanel(props, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController));
22110
21940
  }
22111
- initialised.current = true;
22112
21941
  }
22113
- };
22114
- $[0] = location.hash;
22115
- $[1] = location.pathname;
22116
- $[2] = navigation;
22117
- $[3] = sideDialogsController;
22118
- $[4] = smallLayout;
22119
- $[5] = t0;
22120
- } else {
22121
- t0 = $[5];
22122
- }
22123
- let t1;
22124
- if ($[6] !== navigation.loading) {
22125
- t1 = [navigation.loading];
22126
- $[6] = navigation.loading;
22127
- $[7] = t1;
22128
- } else {
22129
- t1 = $[7];
22130
- }
22131
- useEffect(t0, t1);
22132
- let t2;
22133
- if ($[8] !== sideDialogsController.sidePanels) {
22134
- t2 = sideDialogsController.sidePanels.map(_temp$5);
22135
- $[8] = sideDialogsController.sidePanels;
22136
- $[9] = t2;
22137
- } else {
22138
- t2 = $[9];
22139
- }
22140
- const currentPanelKeys = t2;
22141
- let t3;
22142
- if ($[10] !== currentPanelKeys || $[11] !== location.hash || $[12] !== location.pathname || $[13] !== navigation || $[14] !== sideDialogsController || $[15] !== smallLayout) {
22143
- t3 = () => {
22144
- if (initialised.current) {
22145
- const sideFlag_0 = location.hash === `#${SIDE_URL_HASH}`;
22146
- if (sideFlag_0) {
22147
- const entityOrCollectionPath_0 = navigation.urlPathToDataPath(location.pathname);
22148
- const panelsFromUrl_0 = buildSidePanelsFromUrl(entityOrCollectionPath_0, navigation.collections ?? [], false);
22149
- if (panelsFromUrl_0.length <= currentPanelKeys.length) {
22150
- return;
22151
- }
22152
- const lastPanel = panelsFromUrl_0[panelsFromUrl_0.length - 1];
22153
- const panelProps = propsToSidePanel(lastPanel, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout);
22154
- const lastCurrentPanel = currentPanelKeys.length > 0 ? currentPanelKeys[currentPanelKeys.length - 1] : void 0;
22155
- if (!lastCurrentPanel || lastCurrentPanel !== panelProps.key) {
22156
- sideDialogsController.replace(panelProps);
22157
- }
21942
+ initialised.current = true;
21943
+ }
21944
+ }, [navigation.loading]);
21945
+ const currentPanelKeys = sideDialogsController.sidePanels.map((p) => p.key);
21946
+ useEffect(() => {
21947
+ if (initialised.current) {
21948
+ const sideFlag_0 = location.hash === `#${SIDE_URL_HASH}`;
21949
+ if (sideFlag_0) {
21950
+ const entityOrCollectionPath_0 = navigation.urlPathToDataPath(location.pathname);
21951
+ const panelsFromUrl_0 = buildSidePanelsFromUrl(entityOrCollectionPath_0, navigation.collections ?? [], false);
21952
+ if (panelsFromUrl_0.length <= currentPanelKeys.length) {
21953
+ return;
22158
21954
  }
22159
- }
22160
- };
22161
- $[10] = currentPanelKeys;
22162
- $[11] = location.hash;
22163
- $[12] = location.pathname;
22164
- $[13] = navigation;
22165
- $[14] = sideDialogsController;
22166
- $[15] = smallLayout;
22167
- $[16] = t3;
22168
- } else {
22169
- t3 = $[16];
22170
- }
22171
- let t4;
22172
- if ($[17] !== currentPanelKeys || $[18] !== location.hash || $[19] !== location.pathname) {
22173
- t4 = [location.pathname, location.hash, currentPanelKeys];
22174
- $[17] = currentPanelKeys;
22175
- $[18] = location.hash;
22176
- $[19] = location.pathname;
22177
- $[20] = t4;
22178
- } else {
22179
- t4 = $[20];
22180
- }
22181
- useEffect(t3, t4);
22182
- let t5;
22183
- if ($[21] !== navigation.buildUrlCollectionPath || $[22] !== navigation.resolveIdsFrom || $[23] !== sideDialogsController || $[24] !== smallLayout) {
22184
- t5 = () => {
22185
- const updatedSidePanels = sideDialogsController.sidePanels.map((sidePanelProps) => {
22186
- if (sidePanelProps.additional) {
22187
- return propsToSidePanel(sidePanelProps.additional, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout);
21955
+ const lastPanel = panelsFromUrl_0[panelsFromUrl_0.length - 1];
21956
+ const panelProps = propsToSidePanel(lastPanel, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController);
21957
+ const lastCurrentPanel = currentPanelKeys.length > 0 ? currentPanelKeys[currentPanelKeys.length - 1] : void 0;
21958
+ if (!lastCurrentPanel || lastCurrentPanel !== panelProps.key) {
21959
+ sideDialogsController.replace(panelProps);
22188
21960
  }
22189
- return sidePanelProps;
22190
- });
22191
- sideDialogsController.setSidePanels(updatedSidePanels);
22192
- };
22193
- $[21] = navigation.buildUrlCollectionPath;
22194
- $[22] = navigation.resolveIdsFrom;
22195
- $[23] = sideDialogsController;
22196
- $[24] = smallLayout;
22197
- $[25] = t5;
22198
- } else {
22199
- t5 = $[25];
22200
- }
22201
- let t6;
22202
- if ($[26] !== smallLayout) {
22203
- t6 = [smallLayout];
22204
- $[26] = smallLayout;
22205
- $[27] = t6;
22206
- } else {
22207
- t6 = $[27];
22208
- }
22209
- useEffect(t5, t6);
22210
- let t7;
22211
- if ($[28] !== sideDialogsController) {
22212
- t7 = () => {
22213
- sideDialogsController.close();
22214
- };
22215
- $[28] = sideDialogsController;
22216
- $[29] = t7;
22217
- } else {
22218
- t7 = $[29];
22219
- }
22220
- const close = t7;
22221
- let t8;
22222
- if ($[30] !== navigation.buildUrlCollectionPath || $[31] !== navigation.resolveIdsFrom || $[32] !== sideDialogsController || $[33] !== smallLayout) {
22223
- t8 = (props_0) => {
22224
- if (props_0.copy && !props_0.entityId) {
22225
- throw Error("If you want to copy an entity you need to provide an entityId");
22226
21961
  }
22227
- const defaultSelectedView = resolveDefaultSelectedView(props_0.collection ? props_0.collection.defaultSelectedView : void 0, {
22228
- status: props_0.copy ? "copy" : props_0.entityId ? "existing" : "new",
22229
- entityId: props_0.entityId
22230
- });
22231
- sideDialogsController.open(propsToSidePanel({
22232
- selectedTab: defaultSelectedView,
22233
- ...props_0
22234
- }, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout));
22235
- };
22236
- $[30] = navigation.buildUrlCollectionPath;
22237
- $[31] = navigation.resolveIdsFrom;
22238
- $[32] = sideDialogsController;
22239
- $[33] = smallLayout;
22240
- $[34] = t8;
22241
- } else {
22242
- t8 = $[34];
22243
- }
22244
- const open = t8;
22245
- let t9;
22246
- if ($[35] !== navigation.buildUrlCollectionPath || $[36] !== navigation.resolveIdsFrom || $[37] !== sideDialogsController || $[38] !== smallLayout) {
22247
- t9 = (props_1) => {
22248
- if (props_1.copy && !props_1.entityId) {
22249
- throw Error("If you want to copy an entity you need to provide an entityId");
21962
+ }
21963
+ }, [location.pathname, location.hash, currentPanelKeys]);
21964
+ useEffect(() => {
21965
+ const updatedSidePanels = sideDialogsController.sidePanels.map((sidePanelProps) => {
21966
+ if (sidePanelProps.additional) {
21967
+ return propsToSidePanel(sidePanelProps.additional, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController);
22250
21968
  }
22251
- sideDialogsController.replace(propsToSidePanel(props_1, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout));
22252
- };
22253
- $[35] = navigation.buildUrlCollectionPath;
22254
- $[36] = navigation.resolveIdsFrom;
22255
- $[37] = sideDialogsController;
22256
- $[38] = smallLayout;
22257
- $[39] = t9;
22258
- } else {
22259
- t9 = $[39];
22260
- }
22261
- const replace = t9;
22262
- let t10;
22263
- if ($[40] !== close || $[41] !== open || $[42] !== replace) {
22264
- t10 = {
22265
- close,
22266
- open,
22267
- replace
22268
- };
22269
- $[40] = close;
22270
- $[41] = open;
22271
- $[42] = replace;
22272
- $[43] = t10;
22273
- } else {
22274
- t10 = $[43];
22275
- }
22276
- return t10;
21969
+ return sidePanelProps;
21970
+ });
21971
+ sideDialogsController.setSidePanels(updatedSidePanels);
21972
+ }, [smallLayout]);
21973
+ const close = useCallback(() => {
21974
+ sideDialogsController.close();
21975
+ }, [sideDialogsController]);
21976
+ const open = useCallback((props_0) => {
21977
+ if (props_0.copy && !props_0.entityId) {
21978
+ throw Error("If you want to copy an entity you need to provide an entityId");
21979
+ }
21980
+ const defaultSelectedView = resolveDefaultSelectedView(props_0.collection ? props_0.collection.defaultSelectedView : void 0, {
21981
+ status: props_0.copy ? "copy" : props_0.entityId ? "existing" : "new",
21982
+ entityId: props_0.entityId
21983
+ });
21984
+ sideDialogsController.open(propsToSidePanel({
21985
+ selectedTab: defaultSelectedView,
21986
+ ...props_0
21987
+ }, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController));
21988
+ }, [sideDialogsController, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout]);
21989
+ const replace = useCallback((props_1) => {
21990
+ if (props_1.copy && !props_1.entityId) {
21991
+ throw Error("If you want to copy an entity you need to provide an entityId");
21992
+ }
21993
+ sideDialogsController.replace(propsToSidePanel(props_1, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController));
21994
+ }, [navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, sideDialogsController, smallLayout]);
21995
+ return {
21996
+ close,
21997
+ open,
21998
+ replace
21999
+ };
22277
22000
  };
22278
22001
  function buildSidePanelsFromUrl(path, collections, newFlag) {
22279
22002
  const navigationViewsForPath = getNavigationEntriesFromPath({
@@ -22313,7 +22036,7 @@ function buildSidePanelsFromUrl(path, collections, newFlag) {
22313
22036
  }
22314
22037
  return sidePanel ? [sidePanel] : [];
22315
22038
  }
22316
- const propsToSidePanel = (props, buildUrlCollectionPath, resolveIdsFrom, smallLayout) => {
22039
+ const propsToSidePanel = (props, buildUrlCollectionPath, resolveIdsFrom, smallLayout, customizationController) => {
22317
22040
  const collectionPath = removeInitialAndTrailingSlashes(props.path);
22318
22041
  const newPath = props.entityId ? buildUrlCollectionPath(`${collectionPath}/${props.entityId}${props.selectedTab ? "/" + props.selectedTab : ""}#${SIDE_URL_HASH}`) : buildUrlCollectionPath(`${collectionPath}#${NEW_URL_HASH}`);
22319
22042
  const resolvedPath = resolveIdsFrom(props.path);
@@ -22322,7 +22045,7 @@ const propsToSidePanel = (props, buildUrlCollectionPath, resolveIdsFrom, smallLa
22322
22045
  path: resolvedPath,
22323
22046
  formProps: props.formProps
22324
22047
  };
22325
- const entityViewWidth = getEntityViewWidth(props, smallLayout);
22048
+ const entityViewWidth = getEntityViewWidth(props, smallLayout, customizationController);
22326
22049
  return {
22327
22050
  key: `${props.path}/${props.entityId}`,
22328
22051
  component: /* @__PURE__ */ jsx(EntitySidePanel, { ...resolvedPanelProps }),
@@ -22333,9 +22056,6 @@ const propsToSidePanel = (props, buildUrlCollectionPath, resolveIdsFrom, smallLa
22333
22056
  additional: props
22334
22057
  };
22335
22058
  };
22336
- function _temp$5(p) {
22337
- return p.key;
22338
- }
22339
22059
  function useBuildSideDialogsController() {
22340
22060
  const $ = c(24);
22341
22061
  const location = useLocation();
@@ -24221,7 +23941,6 @@ export {
24221
23941
  FireCMSRouter,
24222
23942
  FormEntry,
24223
23943
  FormLayout,
24224
- FormLayoutInner,
24225
23944
  GeoPoint,
24226
23945
  IconForView,
24227
23946
  ImagePreview,
@@ -24378,6 +24097,7 @@ export {
24378
24097
  resolvePropertyEnum,
24379
24098
  resolveStorageFilenameString,
24380
24099
  resolveStoragePathString,
24100
+ resolvedSelectedEntityView,
24381
24101
  sanitizeData,
24382
24102
  saveEntityWithCallbacks,
24383
24103
  segmentsToStrippedPath,