@firecms/core 3.0.0-canary.204 → 3.0.0-canary.206

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) {
@@ -16393,6 +16393,21 @@
16393
16393
  });
16394
16394
  }
16395
16395
  });
16396
+ React.useEffect(() => {
16397
+ const handleKeyDown = (e_0) => {
16398
+ const isUndo = (e_0.metaKey || e_0.ctrlKey) && !e_0.shiftKey && e_0.key.toLowerCase() === "z";
16399
+ const isRedo = (e_0.metaKey || e_0.ctrlKey) && e_0.shiftKey && e_0.key.toLowerCase() === "z" || (e_0.metaKey || e_0.ctrlKey) && !e_0.shiftKey && e_0.key.toLowerCase() === "y";
16400
+ if (isUndo && formex$1.canUndo) {
16401
+ e_0.preventDefault();
16402
+ formex$1.undo();
16403
+ } else if (isRedo && formex$1.canRedo) {
16404
+ e_0.preventDefault();
16405
+ formex$1.redo();
16406
+ }
16407
+ };
16408
+ window.addEventListener("keydown", handleKeyDown);
16409
+ return () => window.removeEventListener("keydown", handleKeyDown);
16410
+ }, [formex$1]);
16396
16411
  const resolvedCollection = React.useMemo(() => resolveCollection({
16397
16412
  collection,
16398
16413
  path,
@@ -16401,21 +16416,21 @@
16401
16416
  previousValues: formex$1.initialValues,
16402
16417
  propertyConfigs: customizationController.propertyConfigs
16403
16418
  }), [collection, path, entityId, formex$1.values, formex$1.initialValues, customizationController.propertyConfigs]);
16404
- const onPreSaveHookError = React.useCallback((e_0) => {
16419
+ const onPreSaveHookError = React.useCallback((e_1) => {
16405
16420
  setSaving(false);
16406
16421
  snackbarController.open({
16407
16422
  type: "error",
16408
- message: "Error before saving: " + e_0?.message
16423
+ message: "Error before saving: " + e_1?.message
16409
16424
  });
16410
- console.error(e_0);
16425
+ console.error(e_1);
16411
16426
  }, [snackbarController]);
16412
- const onSaveSuccessHookError = React.useCallback((e_1) => {
16427
+ const onSaveSuccessHookError = React.useCallback((e_2) => {
16413
16428
  setSaving(false);
16414
16429
  snackbarController.open({
16415
16430
  type: "error",
16416
- message: "Error after saving (entity is saved): " + e_1?.message
16431
+ message: "Error after saving (entity is saved): " + e_2?.message
16417
16432
  });
16418
- console.error(e_1);
16433
+ console.error(e_2);
16419
16434
  }, [snackbarController]);
16420
16435
  function clearDirtyCache() {
16421
16436
  if (status === "new" || status === "copy") {
@@ -16445,14 +16460,14 @@
16445
16460
  });
16446
16461
  }
16447
16462
  };
16448
- const onSaveFailure = React.useCallback((e_2) => {
16463
+ const onSaveFailure = React.useCallback((e_3) => {
16449
16464
  setSaving(false);
16450
16465
  snackbarController.open({
16451
16466
  type: "error",
16452
- message: "Error saving: " + e_2?.message
16467
+ message: "Error saving: " + e_3?.message
16453
16468
  });
16454
16469
  console.error("Error saving entity", path, entityId);
16455
- console.error(e_2);
16470
+ console.error(e_3);
16456
16471
  }, [entityId, path, snackbarController]);
16457
16472
  const saveEntity = ({
16458
16473
  values: values_1,
@@ -16513,9 +16528,9 @@
16513
16528
  analyticsController.onAnalyticsEvent?.(eventName, {
16514
16529
  path
16515
16530
  });
16516
- }).catch((e_3) => {
16517
- console.error(e_3);
16518
- setSavingError(e_3);
16531
+ }).catch((e_4) => {
16532
+ console.error(e_4);
16533
+ setSavingError(e_4);
16519
16534
  });
16520
16535
  };
16521
16536
  const formContext = {
@@ -16571,9 +16586,9 @@
16571
16586
  context
16572
16587
  });
16573
16588
  setEntityId(updatedId);
16574
- } catch (e_4) {
16575
- onIdUpdateError?.(e_4);
16576
- console.error(e_4);
16589
+ } catch (e_5) {
16590
+ onIdUpdateError?.(e_5);
16591
+ console.error(e_5);
16577
16592
  }
16578
16593
  setCustomIdLoading(false);
16579
16594
  }
@@ -16659,7 +16674,7 @@
16659
16674
  };
16660
16675
  const formRef = React.useRef(null);
16661
16676
  const formView = /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16662
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full py-2 flex flex-col items-start my-4 lg:my-6", children: [
16677
+ !Builder && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full py-2 flex flex-col items-start my-4 lg:my-6", children: [
16663
16678
  /* @__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 }),
16664
16679
  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: [
16665
16680
  entity?.path ?? path,
@@ -16668,7 +16683,7 @@
16668
16683
  ] }) })
16669
16684
  ] }),
16670
16685
  children,
16671
- !collection.hideIdFromForm && /* @__PURE__ */ jsxRuntime.jsx(CustomIdField, { customId: collection.customId, entityId, status, onChange: setEntityId, error: entityIdError, loading: customIdLoading, entity }),
16686
+ !Builder && !collection.hideIdFromForm && /* @__PURE__ */ jsxRuntime.jsx(CustomIdField, { customId: collection.customId, entityId, status, onChange: setEntityId, error: entityIdError, loading: customIdLoading, entity }),
16672
16687
  entityId && formContext && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-12 flex flex-col gap-8", ref: formRef, children: [
16673
16688
  formFields(),
16674
16689
  /* @__PURE__ */ jsxRuntime.jsx(ErrorFocus, { containerRef: formRef })
@@ -16678,7 +16693,20 @@
16678
16693
  React.useEffect(() => {
16679
16694
  if (entityId && onIdChange) onIdChange(entityId);
16680
16695
  }, [entityId, onIdChange]);
16681
- return /* @__PURE__ */ jsxRuntime.jsx(FormLayoutInner, { className, id: `form_${path}`, pluginActions, forceActionsAtTheBottom, EntityFormActionsComponent, formContext, showDefaultActions, children: formView });
16696
+ const disabled_0 = formex$1.isSubmitting || !formex$1.dirty && status === "existing";
16697
+ if (!resolvedCollection || !path) {
16698
+ throw Error("INTERNAL: Collection and path must be defined in form context");
16699
+ }
16700
+ 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 });
16701
+ return /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formContext.formex, children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: formContext.formex.handleSubmit, onReset: () => formex$1.resetForm({
16702
+ values: getInitialEntityValues(collection, path, status, entity, customizationController.propertyConfigs)
16703
+ }), noValidate: true, className: ui.cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", className), children: [
16704
+ /* @__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: [
16705
+ 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" }) }) }),
16706
+ formView
16707
+ ] }) }),
16708
+ dialogActions
16709
+ ] }) });
16682
16710
  }
16683
16711
  function getInitialEntityValues(collection, path, status, entity, propertyConfigs) {
16684
16712
  const resolvedCollection = resolveCollection({
@@ -16719,150 +16747,6 @@
16719
16747
  }
16720
16748
  return errors;
16721
16749
  }
16722
- function FormLayoutInner(t0) {
16723
- const $ = reactCompilerRuntime.c(43);
16724
- const {
16725
- id,
16726
- formContext,
16727
- children,
16728
- className,
16729
- forceActionsAtTheBottom,
16730
- pluginActions,
16731
- EntityFormActionsComponent,
16732
- showDefaultActions
16733
- } = t0;
16734
- const formex$1 = formContext.formex;
16735
- const collection = formContext.collection;
16736
- const path = formContext.path;
16737
- const entity = formContext.entity;
16738
- const savingError = formContext.savingError;
16739
- const status = formContext.status;
16740
- const openEntityMode = formContext.openEntityMode;
16741
- const disabled = formex$1.isSubmitting || !formex$1.dirty && status === "existing";
16742
- const customizationController = useCustomizationController();
16743
- if (!collection || !path) {
16744
- throw Error("INTERNAL: Collection and path must be defined in form context");
16745
- }
16746
- const t1 = forceActionsAtTheBottom ? "bottom" : "side";
16747
- let t2;
16748
- if ($[0] !== pluginActions) {
16749
- t2 = pluginActions ?? [];
16750
- $[0] = pluginActions;
16751
- $[1] = t2;
16752
- } else {
16753
- t2 = $[1];
16754
- }
16755
- let t3;
16756
- 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) {
16757
- t3 = /* @__PURE__ */ jsxRuntime.jsx(EntityFormActionsComponent, { collection, path, entity, layout: t1, savingError, formex: formex$1, disabled, status, pluginActions: t2, openEntityMode, showDefaultActions });
16758
- $[2] = EntityFormActionsComponent;
16759
- $[3] = collection;
16760
- $[4] = disabled;
16761
- $[5] = entity;
16762
- $[6] = formex$1;
16763
- $[7] = openEntityMode;
16764
- $[8] = path;
16765
- $[9] = savingError;
16766
- $[10] = showDefaultActions;
16767
- $[11] = status;
16768
- $[12] = t1;
16769
- $[13] = t2;
16770
- $[14] = t3;
16771
- } else {
16772
- t3 = $[14];
16773
- }
16774
- const dialogActions = t3;
16775
- const t4 = formContext.formex;
16776
- const t5 = formContext.formex.handleSubmit;
16777
- let t6;
16778
- if ($[15] !== collection || $[16] !== customizationController.propertyConfigs || $[17] !== entity || $[18] !== formex$1 || $[19] !== path || $[20] !== status) {
16779
- t6 = () => formex$1.resetForm({
16780
- values: getInitialEntityValues(collection, path, status, entity, customizationController.propertyConfigs)
16781
- });
16782
- $[15] = collection;
16783
- $[16] = customizationController.propertyConfigs;
16784
- $[17] = entity;
16785
- $[18] = formex$1;
16786
- $[19] = path;
16787
- $[20] = status;
16788
- $[21] = t6;
16789
- } else {
16790
- t6 = $[21];
16791
- }
16792
- let t7;
16793
- if ($[22] !== className) {
16794
- t7 = ui.cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", className);
16795
- $[22] = className;
16796
- $[23] = t7;
16797
- } else {
16798
- t7 = $[23];
16799
- }
16800
- let t8;
16801
- let t9;
16802
- if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
16803
- 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");
16804
- t9 = ui.cls("flex flex-col w-full pt-12 pb-16 px-4 sm:px-8 md:px-10");
16805
- $[24] = t8;
16806
- $[25] = t9;
16807
- } else {
16808
- t8 = $[24];
16809
- t9 = $[25];
16810
- }
16811
- let t10;
16812
- if ($[26] !== formContext.formex.dirty) {
16813
- 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" }) }) });
16814
- $[26] = formContext.formex.dirty;
16815
- $[27] = t10;
16816
- } else {
16817
- t10 = $[27];
16818
- }
16819
- let t11;
16820
- if ($[28] !== children || $[29] !== t10) {
16821
- t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t9, children: [
16822
- t10,
16823
- children
16824
- ] });
16825
- $[28] = children;
16826
- $[29] = t10;
16827
- $[30] = t11;
16828
- } else {
16829
- t11 = $[30];
16830
- }
16831
- let t12;
16832
- if ($[31] !== id || $[32] !== t11) {
16833
- t12 = /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: t8, children: t11 });
16834
- $[31] = id;
16835
- $[32] = t11;
16836
- $[33] = t12;
16837
- } else {
16838
- t12 = $[33];
16839
- }
16840
- let t13;
16841
- if ($[34] !== dialogActions || $[35] !== formContext.formex.handleSubmit || $[36] !== t12 || $[37] !== t6 || $[38] !== t7) {
16842
- t13 = /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: t5, onReset: t6, noValidate: true, className: t7, children: [
16843
- t12,
16844
- dialogActions
16845
- ] });
16846
- $[34] = dialogActions;
16847
- $[35] = formContext.formex.handleSubmit;
16848
- $[36] = t12;
16849
- $[37] = t6;
16850
- $[38] = t7;
16851
- $[39] = t13;
16852
- } else {
16853
- t13 = $[39];
16854
- }
16855
- let t14;
16856
- if ($[40] !== formContext.formex || $[41] !== t13) {
16857
- t14 = /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: t4, children: t13 });
16858
- $[40] = formContext.formex;
16859
- $[41] = t13;
16860
- $[42] = t14;
16861
- } else {
16862
- t14 = $[42];
16863
- }
16864
- return t14;
16865
- }
16866
16750
  function useOnAutoSave(autoSave, formex2, lastSavedValues, save) {
16867
16751
  if (!autoSave) return;
16868
16752
  React.useEffect(() => {
@@ -17438,7 +17322,7 @@
17438
17322
  }
17439
17323
  let t5;
17440
17324
  if ($[14] !== placeholder) {
17441
- 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" }) });
17325
+ 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" }) });
17442
17326
  $[14] = placeholder;
17443
17327
  $[15] = t5;
17444
17328
  } else {
@@ -17461,7 +17345,7 @@
17461
17345
  }
17462
17346
  return t6;
17463
17347
  }
17464
- function _temp$9(e) {
17348
+ function _temp$8(e) {
17465
17349
  return e.stopPropagation();
17466
17350
  }
17467
17351
  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";
@@ -17644,7 +17528,7 @@
17644
17528
  const snackbarContext = useSnackbarController();
17645
17529
  let t1;
17646
17530
  if ($[0] !== storage.acceptedFiles) {
17647
- t1 = storage.acceptedFiles ? storage.acceptedFiles.map(_temp$8).reduce(_temp2$4, {}) : void 0;
17531
+ t1 = storage.acceptedFiles ? storage.acceptedFiles.map(_temp$7).reduce(_temp2$4, {}) : void 0;
17648
17532
  $[0] = storage.acceptedFiles;
17649
17533
  $[1] = t1;
17650
17534
  } else {
@@ -17860,7 +17744,7 @@
17860
17744
  ...b
17861
17745
  };
17862
17746
  }
17863
- function _temp$8(e) {
17747
+ function _temp$7(e) {
17864
17748
  return {
17865
17749
  [e]: []
17866
17750
  };
@@ -18825,7 +18709,7 @@
18825
18709
  } else {
18826
18710
  t42 = $[20];
18827
18711
  }
18828
- t3 = Object.entries(mapProperties).filter(_temp$7).map(t42);
18712
+ t3 = Object.entries(mapProperties).filter(_temp$6).map(t42);
18829
18713
  $[6] = autoFocus;
18830
18714
  $[7] = context;
18831
18715
  $[8] = disabled;
@@ -18895,7 +18779,7 @@
18895
18779
  }
18896
18780
  return t10;
18897
18781
  }
18898
- function _temp$7(t0) {
18782
+ function _temp$6(t0) {
18899
18783
  const [, property_0] = t0;
18900
18784
  return !isHidden(property_0);
18901
18785
  }
@@ -20018,7 +19902,7 @@
20018
19902
  const property = t4;
20019
19903
  let t5;
20020
19904
  if ($[9] !== properties) {
20021
- t5 = Object.entries(properties).map(_temp$6);
19905
+ t5 = Object.entries(properties).map(_temp$5);
20022
19906
  $[9] = properties;
20023
19907
  $[10] = t5;
20024
19908
  } else {
@@ -20109,7 +19993,7 @@
20109
19993
  }
20110
19994
  return t11;
20111
19995
  }
20112
- function _temp$6(t0) {
19996
+ function _temp$5(t0) {
20113
19997
  const [key, property_0] = t0;
20114
19998
  return {
20115
19999
  id: key,
@@ -21179,6 +21063,16 @@
21179
21063
  return entityView;
21180
21064
  }
21181
21065
  }
21066
+ function resolvedSelectedEntityView(customViews, customizationController, selectedTab) {
21067
+ const resolvedEntityViews = customViews ? customViews.map((e) => resolveEntityView(e, customizationController.entityViews)).filter(Boolean) : [];
21068
+ const selectedEntityView = resolvedEntityViews.find((e) => e.key === selectedTab);
21069
+ const selectedSecondaryForm = customViews && resolvedEntityViews.filter((e) => e.includeActions).find((e) => e.key === selectedTab);
21070
+ return {
21071
+ resolvedEntityViews,
21072
+ selectedEntityView,
21073
+ selectedSecondaryForm
21074
+ };
21075
+ }
21182
21076
  function getNavigationEntriesFromPath(props) {
21183
21077
  const {
21184
21078
  path,
@@ -21798,12 +21692,14 @@
21798
21692
  const customViews = collection.entityViews;
21799
21693
  const customViewsCount = customViews?.length ?? 0;
21800
21694
  const hasAdditionalViews = customViewsCount > 0 || subcollectionsCount > 0;
21801
- const resolvedEntityViews = customViews ? customViews.map((e) => resolveEntityView(e, customizationController.entityViews)).filter(Boolean) : [];
21802
- const selectedEntityView = resolvedEntityViews.find((e_0) => e_0.key === selectedTab);
21803
- const selectedSecondaryForm = formContext && customViews && resolvedEntityViews.filter((e_1) => e_1.includeActions).find((e_2) => e_2.key === selectedTab);
21695
+ const {
21696
+ resolvedEntityViews,
21697
+ selectedEntityView,
21698
+ selectedSecondaryForm
21699
+ } = resolvedSelectedEntityView(customViews, customizationController, selectedTab);
21804
21700
  const actionsAtTheBottom = !largeLayout || layout === "side_panel" || selectedEntityView?.includeActions === "bottom";
21805
21701
  const mainViewVisible = selectedTab === MAIN_TAB_VALUE || Boolean(selectedSecondaryForm);
21806
- const customViewsView = customViews && resolvedEntityViews.filter((e_3) => !e_3.includeActions).map((customView) => {
21702
+ const customViewsView = customViews && resolvedEntityViews.filter((e) => !e.includeActions).map((customView) => {
21807
21703
  if (!customView) return null;
21808
21704
  const Builder = customView.Builder;
21809
21705
  if (!Builder) {
@@ -21979,16 +21875,19 @@
21979
21875
  }
21980
21876
  const NEW_URL_HASH = "new_side";
21981
21877
  const SIDE_URL_HASH = "side";
21982
- function getEntityViewWidth(props, small) {
21878
+ function getEntityViewWidth(props, small, customizationController) {
21983
21879
  if (small) return CONTAINER_FULL_WIDTH;
21984
- const mainViewSelected = !props.selectedTab;
21880
+ const {
21881
+ selectedSecondaryForm
21882
+ } = resolvedSelectedEntityView(props.collection?.entityViews, customizationController, props.selectedTab);
21883
+ const shouldUseSmallLayout = !props.selectedTab || Boolean(selectedSecondaryForm);
21985
21884
  let resolvedWidth;
21986
21885
  if (props.width) {
21987
21886
  resolvedWidth = typeof props.width === "number" ? `${props.width}px` : props.width;
21988
21887
  } else if (props.collection?.sideDialogWidth) {
21989
21888
  resolvedWidth = typeof props.collection.sideDialogWidth === "number" ? `${props.collection.sideDialogWidth}px` : props.collection.sideDialogWidth;
21990
21889
  }
21991
- if (!mainViewSelected) {
21890
+ if (!shouldUseSmallLayout) {
21992
21891
  return `calc(${ADDITIONAL_TAB_WIDTH} + ${resolvedWidth ?? FORM_CONTAINER_WIDTH})`;
21993
21892
  } else {
21994
21893
  if (resolvedWidth) {
@@ -22040,194 +21939,81 @@
22040
21939
  }
22041
21940
  }
22042
21941
  const useBuildSideEntityController = (navigation, sideDialogsController) => {
22043
- const $ = reactCompilerRuntime.c(44);
22044
21942
  const location = reactRouterDom.useLocation();
22045
21943
  const initialised = React.useRef(false);
21944
+ const customizationController = useCustomizationController();
22046
21945
  const smallLayout = !useLargeLayout();
22047
- let t0;
22048
- if ($[0] !== location.hash || $[1] !== location.pathname || $[2] !== navigation || $[3] !== sideDialogsController || $[4] !== smallLayout) {
22049
- t0 = () => {
22050
- const newFlag = location.hash === `#${NEW_URL_HASH}`;
22051
- const sideFlag = location.hash === `#${SIDE_URL_HASH}`;
22052
- if (!navigation.loading) {
22053
- if ((newFlag || sideFlag) && navigation.isUrlCollectionPath(location.pathname)) {
22054
- const entityOrCollectionPath = navigation.urlPathToDataPath(location.pathname);
22055
- const panelsFromUrl = buildSidePanelsFromUrl(entityOrCollectionPath, navigation.collections ?? [], newFlag);
22056
- for (let i = 0; i < panelsFromUrl.length; i++) {
22057
- const props = panelsFromUrl[i];
22058
- if (i === 0) {
22059
- sideDialogsController.replace(propsToSidePanel(props, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout));
22060
- } else {
22061
- sideDialogsController.open(propsToSidePanel(props, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout));
22062
- }
22063
- }
21946
+ React.useEffect(() => {
21947
+ const newFlag = location.hash === `#${NEW_URL_HASH}`;
21948
+ const sideFlag = location.hash === `#${SIDE_URL_HASH}`;
21949
+ if (!navigation.loading) {
21950
+ if ((newFlag || sideFlag) && navigation.isUrlCollectionPath(location.pathname)) {
21951
+ const entityOrCollectionPath = navigation.urlPathToDataPath(location.pathname);
21952
+ const panelsFromUrl = buildSidePanelsFromUrl(entityOrCollectionPath, navigation.collections ?? [], newFlag);
21953
+ for (let i = 0; i < panelsFromUrl.length; i++) {
21954
+ const props = panelsFromUrl[i];
21955
+ if (i === 0) sideDialogsController.replace(propsToSidePanel(props, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController));
21956
+ else sideDialogsController.open(propsToSidePanel(props, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController));
22064
21957
  }
22065
- initialised.current = true;
22066
21958
  }
22067
- };
22068
- $[0] = location.hash;
22069
- $[1] = location.pathname;
22070
- $[2] = navigation;
22071
- $[3] = sideDialogsController;
22072
- $[4] = smallLayout;
22073
- $[5] = t0;
22074
- } else {
22075
- t0 = $[5];
22076
- }
22077
- let t1;
22078
- if ($[6] !== navigation.loading) {
22079
- t1 = [navigation.loading];
22080
- $[6] = navigation.loading;
22081
- $[7] = t1;
22082
- } else {
22083
- t1 = $[7];
22084
- }
22085
- React.useEffect(t0, t1);
22086
- let t2;
22087
- if ($[8] !== sideDialogsController.sidePanels) {
22088
- t2 = sideDialogsController.sidePanels.map(_temp$5);
22089
- $[8] = sideDialogsController.sidePanels;
22090
- $[9] = t2;
22091
- } else {
22092
- t2 = $[9];
22093
- }
22094
- const currentPanelKeys = t2;
22095
- let t3;
22096
- if ($[10] !== currentPanelKeys || $[11] !== location.hash || $[12] !== location.pathname || $[13] !== navigation || $[14] !== sideDialogsController || $[15] !== smallLayout) {
22097
- t3 = () => {
22098
- if (initialised.current) {
22099
- const sideFlag_0 = location.hash === `#${SIDE_URL_HASH}`;
22100
- if (sideFlag_0) {
22101
- const entityOrCollectionPath_0 = navigation.urlPathToDataPath(location.pathname);
22102
- const panelsFromUrl_0 = buildSidePanelsFromUrl(entityOrCollectionPath_0, navigation.collections ?? [], false);
22103
- if (panelsFromUrl_0.length <= currentPanelKeys.length) {
22104
- return;
22105
- }
22106
- const lastPanel = panelsFromUrl_0[panelsFromUrl_0.length - 1];
22107
- const panelProps = propsToSidePanel(lastPanel, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout);
22108
- const lastCurrentPanel = currentPanelKeys.length > 0 ? currentPanelKeys[currentPanelKeys.length - 1] : void 0;
22109
- if (!lastCurrentPanel || lastCurrentPanel !== panelProps.key) {
22110
- sideDialogsController.replace(panelProps);
22111
- }
21959
+ initialised.current = true;
21960
+ }
21961
+ }, [navigation.loading]);
21962
+ const currentPanelKeys = sideDialogsController.sidePanels.map((p) => p.key);
21963
+ React.useEffect(() => {
21964
+ if (initialised.current) {
21965
+ const sideFlag_0 = location.hash === `#${SIDE_URL_HASH}`;
21966
+ if (sideFlag_0) {
21967
+ const entityOrCollectionPath_0 = navigation.urlPathToDataPath(location.pathname);
21968
+ const panelsFromUrl_0 = buildSidePanelsFromUrl(entityOrCollectionPath_0, navigation.collections ?? [], false);
21969
+ if (panelsFromUrl_0.length <= currentPanelKeys.length) {
21970
+ return;
22112
21971
  }
22113
- }
22114
- };
22115
- $[10] = currentPanelKeys;
22116
- $[11] = location.hash;
22117
- $[12] = location.pathname;
22118
- $[13] = navigation;
22119
- $[14] = sideDialogsController;
22120
- $[15] = smallLayout;
22121
- $[16] = t3;
22122
- } else {
22123
- t3 = $[16];
22124
- }
22125
- let t4;
22126
- if ($[17] !== currentPanelKeys || $[18] !== location.hash || $[19] !== location.pathname) {
22127
- t4 = [location.pathname, location.hash, currentPanelKeys];
22128
- $[17] = currentPanelKeys;
22129
- $[18] = location.hash;
22130
- $[19] = location.pathname;
22131
- $[20] = t4;
22132
- } else {
22133
- t4 = $[20];
22134
- }
22135
- React.useEffect(t3, t4);
22136
- let t5;
22137
- if ($[21] !== navigation.buildUrlCollectionPath || $[22] !== navigation.resolveIdsFrom || $[23] !== sideDialogsController || $[24] !== smallLayout) {
22138
- t5 = () => {
22139
- const updatedSidePanels = sideDialogsController.sidePanels.map((sidePanelProps) => {
22140
- if (sidePanelProps.additional) {
22141
- return propsToSidePanel(sidePanelProps.additional, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout);
21972
+ const lastPanel = panelsFromUrl_0[panelsFromUrl_0.length - 1];
21973
+ const panelProps = propsToSidePanel(lastPanel, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController);
21974
+ const lastCurrentPanel = currentPanelKeys.length > 0 ? currentPanelKeys[currentPanelKeys.length - 1] : void 0;
21975
+ if (!lastCurrentPanel || lastCurrentPanel !== panelProps.key) {
21976
+ sideDialogsController.replace(panelProps);
22142
21977
  }
22143
- return sidePanelProps;
22144
- });
22145
- sideDialogsController.setSidePanels(updatedSidePanels);
22146
- };
22147
- $[21] = navigation.buildUrlCollectionPath;
22148
- $[22] = navigation.resolveIdsFrom;
22149
- $[23] = sideDialogsController;
22150
- $[24] = smallLayout;
22151
- $[25] = t5;
22152
- } else {
22153
- t5 = $[25];
22154
- }
22155
- let t6;
22156
- if ($[26] !== smallLayout) {
22157
- t6 = [smallLayout];
22158
- $[26] = smallLayout;
22159
- $[27] = t6;
22160
- } else {
22161
- t6 = $[27];
22162
- }
22163
- React.useEffect(t5, t6);
22164
- let t7;
22165
- if ($[28] !== sideDialogsController) {
22166
- t7 = () => {
22167
- sideDialogsController.close();
22168
- };
22169
- $[28] = sideDialogsController;
22170
- $[29] = t7;
22171
- } else {
22172
- t7 = $[29];
22173
- }
22174
- const close = t7;
22175
- let t8;
22176
- if ($[30] !== navigation.buildUrlCollectionPath || $[31] !== navigation.resolveIdsFrom || $[32] !== sideDialogsController || $[33] !== smallLayout) {
22177
- t8 = (props_0) => {
22178
- if (props_0.copy && !props_0.entityId) {
22179
- throw Error("If you want to copy an entity you need to provide an entityId");
22180
21978
  }
22181
- const defaultSelectedView = resolveDefaultSelectedView(props_0.collection ? props_0.collection.defaultSelectedView : void 0, {
22182
- status: props_0.copy ? "copy" : props_0.entityId ? "existing" : "new",
22183
- entityId: props_0.entityId
22184
- });
22185
- sideDialogsController.open(propsToSidePanel({
22186
- selectedTab: defaultSelectedView,
22187
- ...props_0
22188
- }, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout));
22189
- };
22190
- $[30] = navigation.buildUrlCollectionPath;
22191
- $[31] = navigation.resolveIdsFrom;
22192
- $[32] = sideDialogsController;
22193
- $[33] = smallLayout;
22194
- $[34] = t8;
22195
- } else {
22196
- t8 = $[34];
22197
- }
22198
- const open = t8;
22199
- let t9;
22200
- if ($[35] !== navigation.buildUrlCollectionPath || $[36] !== navigation.resolveIdsFrom || $[37] !== sideDialogsController || $[38] !== smallLayout) {
22201
- t9 = (props_1) => {
22202
- if (props_1.copy && !props_1.entityId) {
22203
- throw Error("If you want to copy an entity you need to provide an entityId");
21979
+ }
21980
+ }, [location.pathname, location.hash, currentPanelKeys]);
21981
+ React.useEffect(() => {
21982
+ const updatedSidePanels = sideDialogsController.sidePanels.map((sidePanelProps) => {
21983
+ if (sidePanelProps.additional) {
21984
+ return propsToSidePanel(sidePanelProps.additional, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController);
22204
21985
  }
22205
- sideDialogsController.replace(propsToSidePanel(props_1, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout));
22206
- };
22207
- $[35] = navigation.buildUrlCollectionPath;
22208
- $[36] = navigation.resolveIdsFrom;
22209
- $[37] = sideDialogsController;
22210
- $[38] = smallLayout;
22211
- $[39] = t9;
22212
- } else {
22213
- t9 = $[39];
22214
- }
22215
- const replace = t9;
22216
- let t10;
22217
- if ($[40] !== close || $[41] !== open || $[42] !== replace) {
22218
- t10 = {
22219
- close,
22220
- open,
22221
- replace
22222
- };
22223
- $[40] = close;
22224
- $[41] = open;
22225
- $[42] = replace;
22226
- $[43] = t10;
22227
- } else {
22228
- t10 = $[43];
22229
- }
22230
- return t10;
21986
+ return sidePanelProps;
21987
+ });
21988
+ sideDialogsController.setSidePanels(updatedSidePanels);
21989
+ }, [smallLayout]);
21990
+ const close = React.useCallback(() => {
21991
+ sideDialogsController.close();
21992
+ }, [sideDialogsController]);
21993
+ const open = React.useCallback((props_0) => {
21994
+ if (props_0.copy && !props_0.entityId) {
21995
+ throw Error("If you want to copy an entity you need to provide an entityId");
21996
+ }
21997
+ const defaultSelectedView = resolveDefaultSelectedView(props_0.collection ? props_0.collection.defaultSelectedView : void 0, {
21998
+ status: props_0.copy ? "copy" : props_0.entityId ? "existing" : "new",
21999
+ entityId: props_0.entityId
22000
+ });
22001
+ sideDialogsController.open(propsToSidePanel({
22002
+ selectedTab: defaultSelectedView,
22003
+ ...props_0
22004
+ }, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController));
22005
+ }, [sideDialogsController, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout]);
22006
+ const replace = React.useCallback((props_1) => {
22007
+ if (props_1.copy && !props_1.entityId) {
22008
+ throw Error("If you want to copy an entity you need to provide an entityId");
22009
+ }
22010
+ sideDialogsController.replace(propsToSidePanel(props_1, navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, smallLayout, customizationController));
22011
+ }, [navigation.buildUrlCollectionPath, navigation.resolveIdsFrom, sideDialogsController, smallLayout]);
22012
+ return {
22013
+ close,
22014
+ open,
22015
+ replace
22016
+ };
22231
22017
  };
22232
22018
  function buildSidePanelsFromUrl(path, collections, newFlag) {
22233
22019
  const navigationViewsForPath = getNavigationEntriesFromPath({
@@ -22267,7 +22053,7 @@
22267
22053
  }
22268
22054
  return sidePanel ? [sidePanel] : [];
22269
22055
  }
22270
- const propsToSidePanel = (props, buildUrlCollectionPath, resolveIdsFrom, smallLayout) => {
22056
+ const propsToSidePanel = (props, buildUrlCollectionPath, resolveIdsFrom, smallLayout, customizationController) => {
22271
22057
  const collectionPath = removeInitialAndTrailingSlashes(props.path);
22272
22058
  const newPath = props.entityId ? buildUrlCollectionPath(`${collectionPath}/${props.entityId}${props.selectedTab ? "/" + props.selectedTab : ""}#${SIDE_URL_HASH}`) : buildUrlCollectionPath(`${collectionPath}#${NEW_URL_HASH}`);
22273
22059
  const resolvedPath = resolveIdsFrom(props.path);
@@ -22276,7 +22062,7 @@
22276
22062
  path: resolvedPath,
22277
22063
  formProps: props.formProps
22278
22064
  };
22279
- const entityViewWidth = getEntityViewWidth(props, smallLayout);
22065
+ const entityViewWidth = getEntityViewWidth(props, smallLayout, customizationController);
22280
22066
  return {
22281
22067
  key: `${props.path}/${props.entityId}`,
22282
22068
  component: /* @__PURE__ */ jsxRuntime.jsx(EntitySidePanel, { ...resolvedPanelProps }),
@@ -22287,9 +22073,6 @@
22287
22073
  additional: props
22288
22074
  };
22289
22075
  };
22290
- function _temp$5(p) {
22291
- return p.key;
22292
- }
22293
22076
  function useBuildSideDialogsController() {
22294
22077
  const $ = reactCompilerRuntime.c(24);
22295
22078
  const location = reactRouterDom.useLocation();
@@ -24174,7 +23957,6 @@
24174
23957
  exports2.FireCMSRouter = FireCMSRouter;
24175
23958
  exports2.FormEntry = FormEntry;
24176
23959
  exports2.FormLayout = FormLayout;
24177
- exports2.FormLayoutInner = FormLayoutInner;
24178
23960
  exports2.GeoPoint = GeoPoint;
24179
23961
  exports2.IconForView = IconForView;
24180
23962
  exports2.ImagePreview = ImagePreview;
@@ -24331,6 +24113,7 @@
24331
24113
  exports2.resolvePropertyEnum = resolvePropertyEnum;
24332
24114
  exports2.resolveStorageFilenameString = resolveStorageFilenameString;
24333
24115
  exports2.resolveStoragePathString = resolveStoragePathString;
24116
+ exports2.resolvedSelectedEntityView = resolvedSelectedEntityView;
24334
24117
  exports2.sanitizeData = sanitizeData;
24335
24118
  exports2.saveEntityWithCallbacks = saveEntityWithCallbacks;
24336
24119
  exports2.segmentsToStrippedPath = segmentsToStrippedPath;