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