@firecms/core 3.0.0-beta.13 → 3.0.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/components/ArrayContainer.d.ts +7 -12
  2. package/dist/components/EntityPreview.d.ts +4 -2
  3. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  4. package/dist/components/VirtualTable/VirtualTableProps.d.ts +0 -4
  5. package/dist/components/index.d.ts +1 -0
  6. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  7. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -9
  8. package/dist/hooks/useBuildNavigationController.d.ts +2 -9
  9. package/dist/index.es.js +1183 -705
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.umd.js +1191 -716
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/collections.d.ts +20 -2
  14. package/dist/types/firecms.d.ts +2 -1
  15. package/dist/types/navigation.d.ts +5 -0
  16. package/dist/types/plugins.d.ts +12 -0
  17. package/dist/types/side_entity_controller.d.ts +4 -0
  18. package/dist/util/callbacks.d.ts +2 -0
  19. package/dist/util/index.d.ts +1 -0
  20. package/package.json +8 -6
  21. package/src/components/ArrayContainer.tsx +409 -294
  22. package/src/components/ClearFilterSortButton.tsx +1 -1
  23. package/src/components/ConfirmationDialog.tsx +9 -9
  24. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +1 -1
  25. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +1 -1
  26. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +13 -2
  27. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +53 -27
  28. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +9 -9
  29. package/src/components/EntityCollectionView/EntityCollectionView.tsx +4 -0
  30. package/src/components/EntityPreview.tsx +18 -14
  31. package/src/components/ErrorView.tsx +1 -1
  32. package/src/components/HomePage/DefaultHomePage.tsx +2 -1
  33. package/src/components/HomePage/NavigationCardBinding.tsx +3 -1
  34. package/src/components/SelectableTable/SelectableTable.tsx +140 -143
  35. package/src/components/VirtualTable/VirtualTable.tsx +8 -30
  36. package/src/components/VirtualTable/VirtualTableProps.tsx +0 -5
  37. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +0 -1
  38. package/src/components/index.tsx +2 -0
  39. package/src/core/EntityEditView.tsx +26 -14
  40. package/src/core/EntitySidePanel.tsx +15 -20
  41. package/src/core/FireCMS.tsx +7 -1
  42. package/src/form/EntityForm.tsx +1 -1
  43. package/src/form/PropertyFieldBinding.tsx +0 -1
  44. package/src/form/components/CustomIdField.tsx +3 -1
  45. package/src/form/components/LabelWithIcon.tsx +1 -1
  46. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +3 -2
  47. package/src/form/field_bindings/MapFieldBinding.tsx +5 -4
  48. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +1 -1
  49. package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -0
  50. package/src/form/field_bindings/SelectFieldBinding.tsx +2 -1
  51. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +222 -154
  52. package/src/hooks/data/save.ts +0 -6
  53. package/src/hooks/useBuildNavigationController.tsx +30 -16
  54. package/src/internal/useBuildSideEntityController.tsx +1 -1
  55. package/src/preview/components/ImagePreview.tsx +2 -2
  56. package/src/preview/components/ReferencePreview.tsx +1 -1
  57. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
  58. package/src/preview/property_previews/MapPropertyPreview.tsx +1 -1
  59. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +1 -1
  60. package/src/preview/property_previews/StringPropertyPreview.tsx +1 -1
  61. package/src/types/collections.ts +24 -2
  62. package/src/types/firecms.tsx +2 -2
  63. package/src/types/navigation.ts +6 -0
  64. package/src/types/plugins.tsx +16 -0
  65. package/src/types/side_entity_controller.tsx +5 -5
  66. package/src/util/callbacks.ts +119 -0
  67. package/src/util/index.ts +1 -0
  68. package/src/util/navigation_utils.ts +70 -55
  69. package/src/util/objects.ts +53 -20
  70. package/dist/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.d.ts +0 -5
  71. package/src/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.tsx +0 -59
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("react-compiler-runtime"), require("react"), require("@firecms/ui"), require("notistack"), require("object-hash"), require("@firecms/formex"), require("react-router-dom"), require("fuse.js"), require("react-fast-compare"), require("date-fns"), require("date-fns/locale"), require("react-use-measure"), require("yup"), require("react-window"), require("@hello-pangea/dnd"), require("react-dropzone"), require("react-image-file-resizer"), require("@firecms/editor"), require("prism-react-renderer"), require("react-router"), require("@radix-ui/react-portal")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "react-compiler-runtime", "react", "@firecms/ui", "notistack", "object-hash", "@firecms/formex", "react-router-dom", "fuse.js", "react-fast-compare", "date-fns", "date-fns/locale", "react-use-measure", "yup", "react-window", "@hello-pangea/dnd", "react-dropzone", "react-image-file-resizer", "@firecms/editor", "prism-react-renderer", "react-router", "@radix-ui/react-portal"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["FireCMS Core"] = {}, global.jsxRuntime, global.reactCompilerRuntime, global.React, global.ui, global.notistack, global.hash, global.formex, global.reactRouterDom, global.Fuse, global.equal, global.dateFns, global.locales, global.useMeasure, global.yup, global.reactWindow, global.dnd, global.reactDropzone, global.Resizer, global.editor, global.prismReactRenderer, global.reactRouter, global.Portal));
3
- })(this, function(exports2, jsxRuntime, reactCompilerRuntime, React, ui, notistack, hash, formex, reactRouterDom, Fuse, equal, dateFns, locales, useMeasure, yup, reactWindow, dnd, reactDropzone, Resizer, editor, prismReactRenderer, reactRouter, Portal) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("react-compiler-runtime"), require("react"), require("@firecms/ui"), require("notistack"), require("object-hash"), require("@firecms/formex"), require("react-router-dom"), require("fuse.js"), require("react-fast-compare"), require("date-fns"), require("date-fns/locale"), require("react-use-measure"), require("yup"), require("react-window"), require("@dnd-kit/core"), require("@dnd-kit/modifiers"), require("@dnd-kit/sortable"), require("@dnd-kit/utilities"), require("react-dropzone"), require("react-image-file-resizer"), require("@firecms/editor"), require("prism-react-renderer"), require("react-router"), require("@radix-ui/react-portal")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "react-compiler-runtime", "react", "@firecms/ui", "notistack", "object-hash", "@firecms/formex", "react-router-dom", "fuse.js", "react-fast-compare", "date-fns", "date-fns/locale", "react-use-measure", "yup", "react-window", "@dnd-kit/core", "@dnd-kit/modifiers", "@dnd-kit/sortable", "@dnd-kit/utilities", "react-dropzone", "react-image-file-resizer", "@firecms/editor", "prism-react-renderer", "react-router", "@radix-ui/react-portal"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["FireCMS Core"] = {}, global.jsxRuntime, global.reactCompilerRuntime, global.React, global.ui, global.notistack, global.hash, global.formex, global.reactRouterDom, global.Fuse, global.equal, global.dateFns, global.locales, global.useMeasure, global.yup, global.reactWindow, global.core, global.modifiers, global.sortable, global.utilities, global.reactDropzone, global.Resizer, global.editor, global.prismReactRenderer, global.reactRouter, global.Portal));
3
+ })(this, function(exports2, jsxRuntime, reactCompilerRuntime, React, ui, notistack, hash, formex, reactRouterDom, Fuse, equal, dateFns, locales, useMeasure, yup, reactWindow, core, modifiers, sortable, utilities, reactDropzone, Resizer, editor, prismReactRenderer, reactRouter, Portal) {
4
4
  "use strict";
5
5
  function _interopNamespaceDefault(e) {
6
6
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -69,49 +69,66 @@
69
69
  return cleanPath;
70
70
  }
71
71
  function resolveCollectionPathIds(path, allCollections) {
72
- const cleanPath = removeInitialAndTrailingSlashes(path);
73
- const subpaths = cleanPath.split("/");
74
- if (subpaths.length % 2 === 0) {
75
- throw Error(`resolveCollectionPathIds: Collection paths must have an odd number of segments: ${path}`);
76
- }
77
- const exactMatch = allCollections.find((col) => col.path === cleanPath);
78
- if (exactMatch) {
79
- return exactMatch.path;
80
- }
81
- if (subpaths.length === 1) {
82
- const aliasedCollection = allCollections.find((col) => col.id === subpaths[0]);
83
- return aliasedCollection?.path ?? subpaths[0];
84
- }
85
- let matchingCollection;
86
- let entityIndex = 1;
87
- for (const collection of allCollections) {
88
- const pathSegments = collection.path.split("/");
89
- if (pathSegments.length > 1 && subpaths.slice(0, pathSegments.length).join("/") === collection.path) {
90
- matchingCollection = collection;
91
- entityIndex = pathSegments.length;
72
+ let remainingPath = removeInitialAndTrailingSlashes(path);
73
+ if (!remainingPath) {
74
+ return "";
75
+ }
76
+ let currentCollections = allCollections;
77
+ const resolvedPathParts = [];
78
+ while (remainingPath.length > 0) {
79
+ if (!currentCollections || currentCollections.length === 0) {
80
+ console.warn(`resolveCollectionPathIds: Path structure implies subcollections, but none found before segment starting with "${remainingPath}" in original path "${path}". Appending remaining original path.`);
81
+ resolvedPathParts.push(remainingPath);
82
+ remainingPath = "";
92
83
  break;
93
84
  }
94
- }
95
- if (!matchingCollection) {
96
- const matchingCollections = allCollections.filter((col) => col.id === subpaths[0] || col.path === subpaths[0]);
97
- if (!matchingCollections.length) {
98
- return cleanPath;
85
+ let foundMatch = false;
86
+ const potentialMatches = currentCollections.flatMap((col) => [{
87
+ col,
88
+ match: col.path
89
+ }, {
90
+ col,
91
+ match: col.id
92
+ }]).filter((p) => p.match && remainingPath.startsWith(p.match)).sort((a, b) => b.match.length - a.match.length);
93
+ if (potentialMatches.length > 0) {
94
+ const {
95
+ col: foundCollection,
96
+ match: matchString
97
+ } = potentialMatches[0];
98
+ resolvedPathParts.push(foundCollection.path);
99
+ remainingPath = removeInitialSlash(remainingPath.substring(matchString.length));
100
+ if (remainingPath.length === 0) {
101
+ foundMatch = true;
102
+ break;
103
+ }
104
+ const idSeparatorIndex = remainingPath.indexOf("/");
105
+ let entityId;
106
+ if (idSeparatorIndex > -1) {
107
+ entityId = remainingPath.substring(0, idSeparatorIndex);
108
+ remainingPath = remainingPath.substring(idSeparatorIndex + 1);
109
+ } else {
110
+ entityId = remainingPath;
111
+ remainingPath = "";
112
+ console.warn(`resolveCollectionPathIds: Path seems to end with an entity ID "${entityId}" instead of a collection segment in original path "${path}". This might indicate an invalid input path.`);
113
+ }
114
+ resolvedPathParts.push(entityId);
115
+ currentCollections = foundCollection.subcollections;
116
+ foundMatch = true;
117
+ if (!currentCollections && remainingPath.length > 0) {
118
+ console.warn(`resolveCollectionPathIds: Path continues after entity ID "${entityId}", but no subcollections are defined for the preceding collection "${foundCollection.path}" in path "${path}". Appending remaining original path.`);
119
+ resolvedPathParts.push(remainingPath);
120
+ remainingPath = "";
121
+ break;
122
+ }
99
123
  }
100
- matchingCollection = matchingCollections[0];
101
- }
102
- const entityId = subpaths[entityIndex];
103
- const remainingPath = subpaths.slice(entityIndex + 1);
104
- if (remainingPath.length > 0) {
105
- const subcollectionId = remainingPath[0];
106
- const subcollection = matchingCollection.subcollections?.find((subcol) => subcol.id === subcollectionId);
107
- if (subcollection) {
108
- return `${matchingCollection.path}/${entityId}/${subcollection.path}`;
124
+ if (!foundMatch) {
125
+ console.warn(`resolveCollectionPathIds: Collection definition not found for segment starting with "${remainingPath}" in original path "${path}". Appending remaining original path.`);
126
+ resolvedPathParts.push(remainingPath);
127
+ remainingPath = "";
128
+ break;
109
129
  }
110
130
  }
111
- if (remainingPath.length === 0) {
112
- return `${matchingCollection.path}/${entityId}`;
113
- }
114
- return `${matchingCollection.path}/${entityId}/${remainingPath.join("/")}`;
131
+ return resolvedPathParts.join("/");
115
132
  }
116
133
  function getCollectionByPathOrId(pathOrId, collections) {
117
134
  const subpaths = removeInitialAndTrailingSlashes(pathOrId).split("/");
@@ -232,31 +249,36 @@
232
249
  return item && typeof item === "object" && !Array.isArray(item);
233
250
  }
234
251
  function mergeDeep(target, source, ignoreUndefined = false) {
235
- const targetIsObject = isObject(target);
236
- const output = targetIsObject ? {
252
+ if (!isObject(target)) {
253
+ return target;
254
+ }
255
+ const output = {
237
256
  ...target
238
- } : target;
239
- if (targetIsObject && isObject(source)) {
240
- Object.keys(source).forEach((key) => {
241
- const sourceElement = source[key];
242
- if (ignoreUndefined && sourceElement === void 0) {
243
- return;
257
+ };
258
+ if (!isObject(source)) {
259
+ return output;
260
+ }
261
+ for (const key in source) {
262
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
263
+ const sourceValue = source[key];
264
+ const outputValue = output[key];
265
+ if (ignoreUndefined && sourceValue === void 0) {
266
+ continue;
244
267
  }
245
- if (sourceElement instanceof Date) {
246
- Object.assign(output, {
247
- [key]: new Date(sourceElement.getTime())
248
- });
249
- } else if (isObject(sourceElement)) {
250
- if (!(key in target)) Object.assign(output, {
251
- [key]: sourceElement
252
- });
253
- else output[key] = mergeDeep(target[key], sourceElement);
268
+ if (sourceValue instanceof Date) {
269
+ output[key] = new Date(sourceValue.getTime());
270
+ } else if (Array.isArray(sourceValue)) {
271
+ output[key] = [...sourceValue];
272
+ } else if (isObject(sourceValue)) {
273
+ if (isObject(outputValue)) {
274
+ output[key] = mergeDeep(outputValue, sourceValue, ignoreUndefined);
275
+ } else {
276
+ output[key] = sourceValue;
277
+ }
254
278
  } else {
255
- Object.assign(output, {
256
- [key]: sourceElement
257
- });
279
+ output[key] = sourceValue;
258
280
  }
259
- });
281
+ }
260
282
  }
261
283
  return output;
262
284
  }
@@ -3748,6 +3770,108 @@
3748
3770
  if (!result) result = randomString() + "_" + file.name;
3749
3771
  return result;
3750
3772
  }
3773
+ const mergeCallbacks = (baseCallbacks = {}, pluginCallbacks = {}) => {
3774
+ if (!baseCallbacks && !pluginCallbacks) {
3775
+ return void 0;
3776
+ }
3777
+ const mergedCallbacks = {};
3778
+ if (baseCallbacks.onFetch || pluginCallbacks.onFetch) {
3779
+ mergedCallbacks.onFetch = async (props) => {
3780
+ let entity = props.entity;
3781
+ if (baseCallbacks.onFetch) {
3782
+ entity = await Promise.resolve(baseCallbacks.onFetch(props));
3783
+ }
3784
+ if (pluginCallbacks.onFetch) {
3785
+ entity = await Promise.resolve(pluginCallbacks.onFetch({
3786
+ ...props,
3787
+ entity
3788
+ }));
3789
+ }
3790
+ return entity;
3791
+ };
3792
+ }
3793
+ if (baseCallbacks.onSaveSuccess || pluginCallbacks.onSaveSuccess) {
3794
+ mergedCallbacks.onSaveSuccess = async (props) => {
3795
+ if (baseCallbacks.onSaveSuccess) {
3796
+ await Promise.resolve(baseCallbacks.onSaveSuccess(props));
3797
+ }
3798
+ if (pluginCallbacks.onSaveSuccess) {
3799
+ await Promise.resolve(pluginCallbacks.onSaveSuccess(props));
3800
+ }
3801
+ };
3802
+ }
3803
+ if (baseCallbacks.onSaveFailure || pluginCallbacks.onSaveFailure) {
3804
+ mergedCallbacks.onSaveFailure = async (props) => {
3805
+ if (baseCallbacks.onSaveFailure) {
3806
+ await Promise.resolve(baseCallbacks.onSaveFailure(props));
3807
+ }
3808
+ if (pluginCallbacks.onSaveFailure) {
3809
+ await Promise.resolve(pluginCallbacks.onSaveFailure(props));
3810
+ }
3811
+ };
3812
+ }
3813
+ if (baseCallbacks.onPreSave || pluginCallbacks.onPreSave) {
3814
+ mergedCallbacks.onPreSave = async (props) => {
3815
+ let values = {
3816
+ ...props.values
3817
+ };
3818
+ if (baseCallbacks.onPreSave) {
3819
+ const baseValues = await Promise.resolve(baseCallbacks.onPreSave(props));
3820
+ values = {
3821
+ ...values,
3822
+ ...baseValues
3823
+ };
3824
+ }
3825
+ if (pluginCallbacks.onPreSave) {
3826
+ const pluginValues = await Promise.resolve(pluginCallbacks.onPreSave({
3827
+ ...props,
3828
+ values
3829
+ }));
3830
+ values = {
3831
+ ...values,
3832
+ ...pluginValues
3833
+ };
3834
+ }
3835
+ return values;
3836
+ };
3837
+ }
3838
+ if (baseCallbacks.onPreDelete || pluginCallbacks.onPreDelete) {
3839
+ mergedCallbacks.onPreDelete = (props) => {
3840
+ if (baseCallbacks.onPreDelete) {
3841
+ baseCallbacks.onPreDelete(props);
3842
+ }
3843
+ if (pluginCallbacks.onPreDelete) {
3844
+ pluginCallbacks.onPreDelete(props);
3845
+ }
3846
+ };
3847
+ }
3848
+ if (baseCallbacks.onDelete || pluginCallbacks.onDelete) {
3849
+ mergedCallbacks.onDelete = (props) => {
3850
+ if (baseCallbacks.onDelete) {
3851
+ baseCallbacks.onDelete(props);
3852
+ }
3853
+ if (pluginCallbacks.onDelete) {
3854
+ pluginCallbacks.onDelete(props);
3855
+ }
3856
+ };
3857
+ }
3858
+ if (baseCallbacks.onIdUpdate || pluginCallbacks.onIdUpdate) {
3859
+ mergedCallbacks.onIdUpdate = async (props) => {
3860
+ let id = props.entityId || "";
3861
+ if (baseCallbacks.onIdUpdate) {
3862
+ id = await Promise.resolve(baseCallbacks.onIdUpdate(props));
3863
+ }
3864
+ if (pluginCallbacks.onIdUpdate) {
3865
+ id = await Promise.resolve(pluginCallbacks.onIdUpdate({
3866
+ ...props,
3867
+ entityId: id
3868
+ }));
3869
+ }
3870
+ return id;
3871
+ };
3872
+ }
3873
+ return Object.keys(mergedCallbacks).length > 0 ? mergedCallbacks : void 0;
3874
+ };
3751
3875
  const CONTAINER_FULL_WIDTH = "100vw";
3752
3876
  const ADDITIONAL_TAB_WIDTH = "55vw";
3753
3877
  const FORM_CONTAINER_WIDTH = "768px";
@@ -4189,7 +4313,7 @@
4189
4313
  }
4190
4314
  } else {
4191
4315
  onEntityUpdate(void 0);
4192
- return _temp3$4;
4316
+ return _temp3$5;
4193
4317
  }
4194
4318
  }
4195
4319
  };
@@ -4230,7 +4354,7 @@
4230
4354
  }
4231
4355
  return t5;
4232
4356
  }
4233
- function _temp3$4() {
4357
+ function _temp3$5() {
4234
4358
  }
4235
4359
  function _temp2$d() {
4236
4360
  }
@@ -4285,11 +4409,6 @@
4285
4409
  } else {
4286
4410
  updatedValues = values;
4287
4411
  }
4288
- console.debug("Saving entity", {
4289
- entityId,
4290
- updatedValues,
4291
- collection
4292
- });
4293
4412
  return dataSource.saveEntity({
4294
4413
  collection,
4295
4414
  path: resolvedPath,
@@ -4324,7 +4443,6 @@
4324
4443
  }
4325
4444
  if (onSaveSuccess) onSaveSuccess(entity);
4326
4445
  }).catch((e) => {
4327
- console.error("!!!", e);
4328
4446
  if (callbacks?.onSaveFailure) {
4329
4447
  const resolvedCollection = resolveCollection({
4330
4448
  collection,
@@ -4640,7 +4758,6 @@
4640
4758
  tooltip
4641
4759
  } = t0;
4642
4760
  const component = error instanceof Error ? error.message : error;
4643
- console.warn("ErrorView", error);
4644
4761
  let t1;
4645
4762
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
4646
4763
  t1 = /* @__PURE__ */ jsxRuntime.jsx(ui.ErrorIcon, { className: "mx-2", size: "small", color: "error" });
@@ -4806,7 +4923,7 @@
4806
4923
  }
4807
4924
  let t7;
4808
4925
  if ($[13] !== url) {
4809
- t7 = navigator && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: "Copy url to clipboard", side: "bottom", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { variant: "filled", size: "small", onClick: (e) => {
4926
+ t7 = navigator && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: "Copy url to clipboard", side: "bottom", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { variant: "filled", size: "smallest", onClick: (e) => {
4810
4927
  e.stopPropagation();
4811
4928
  e.preventDefault();
4812
4929
  return navigator.clipboard.writeText(url);
@@ -4825,7 +4942,7 @@
4825
4942
  }
4826
4943
  let t9;
4827
4944
  if ($[16] !== url) {
4828
- 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 }) });
4945
+ 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: "smallest", onClick: _temp$q, children: t8 }) });
4829
4946
  $[16] = url;
4830
4947
  $[17] = t9;
4831
4948
  } else {
@@ -5178,9 +5295,9 @@
5178
5295
  } else {
5179
5296
  if (arrayProperty.of.dataType === "map" && arrayProperty.of.properties) {
5180
5297
  let t1;
5181
- if ($[10] !== arrayProperty.of.previewProperties || $[11] !== arrayProperty.of.properties || $[12] !== size) {
5182
- t1 = renderArrayOfMaps(arrayProperty.of.properties, size, arrayProperty.of.previewProperties);
5183
- $[10] = arrayProperty.of.previewProperties;
5298
+ if ($[10] !== arrayProperty.of.previewKeys || $[11] !== arrayProperty.of.properties || $[12] !== size) {
5299
+ t1 = renderArrayOfMaps(arrayProperty.of.properties, size, arrayProperty.of.previewKeys);
5300
+ $[10] = arrayProperty.of.previewKeys;
5184
5301
  $[11] = arrayProperty.of.properties;
5185
5302
  $[12] = size;
5186
5303
  $[13] = t1;
@@ -5584,7 +5701,7 @@
5584
5701
  let t1;
5585
5702
  if ($[17] !== size || $[18] !== value) {
5586
5703
  const lines = value.split("\n");
5587
- t1 = value && value.includes("\n") ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("overflow-x-scroll", size === "small" ? "text-sm" : ""), children: lines.map((str, index) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
5704
+ t1 = value && value.includes("\n") ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("overflow-x-scroll overflow-hidden", size === "small" ? "text-sm" : ""), children: lines.map((str, index) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
5588
5705
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: str }),
5589
5706
  index !== lines.length - 1 && /* @__PURE__ */ jsxRuntime.jsx("br", {})
5590
5707
  ] }, `string_preview_${index}`)) }) : size === "small" ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: value }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: value });
@@ -5667,11 +5784,13 @@
5667
5784
  disabled,
5668
5785
  hover,
5669
5786
  collection: collectionProp,
5670
- previewProperties,
5787
+ previewKeys,
5671
5788
  onClick,
5672
5789
  size,
5673
5790
  includeId = true,
5791
+ includeTitle = true,
5674
5792
  includeEntityLink = true,
5793
+ includeImage = true,
5675
5794
  entity
5676
5795
  }) {
5677
5796
  const authController = useAuthController();
@@ -5690,9 +5809,9 @@
5690
5809
  propertyConfigs: customizationController.propertyConfigs,
5691
5810
  authController
5692
5811
  }), [collection]);
5693
- const listProperties = React.useMemo(() => getEntityPreviewKeys(authController, resolvedCollection, customizationController.propertyConfigs, previewProperties, size === "medium" || size === "large" ? 3 : 1), [previewProperties, resolvedCollection, size]);
5694
- const titleProperty = getEntityTitlePropertyKey(resolvedCollection, customizationController.propertyConfigs);
5695
- const imagePropertyKey = getEntityImagePreviewPropertyKey(resolvedCollection);
5812
+ const listProperties = React.useMemo(() => previewKeys ?? getEntityPreviewKeys(authController, resolvedCollection, customizationController.propertyConfigs, previewKeys, size === "medium" || size === "large" ? 3 : 1), [previewKeys, resolvedCollection, size]);
5813
+ const titleProperty = includeTitle ? getEntityTitlePropertyKey(resolvedCollection, customizationController.propertyConfigs) : void 0;
5814
+ const imagePropertyKey = includeImage ? getEntityImagePreviewPropertyKey(resolvedCollection) : void 0;
5696
5815
  const imageProperty = imagePropertyKey ? resolvedCollection.properties[imagePropertyKey] : void 0;
5697
5816
  const usedImageProperty = imageProperty && "of" in imageProperty ? imageProperty.of : imageProperty;
5698
5817
  const restProperties = listProperties.filter((p) => p !== titleProperty && p !== imagePropertyKey);
@@ -5703,18 +5822,17 @@
5703
5822
  usedImageProperty && usedImageValue && /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { property: usedImageProperty, propertyKey: imagePropertyKey, size: "small", value: usedImageValue }),
5704
5823
  (!usedImageProperty || !usedImageValue) && /* @__PURE__ */ jsxRuntime.jsx(IconForView, { collectionOrView: collection, color: "primary", size, className: "m-auto p-1" })
5705
5824
  ] }),
5706
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col grow-1 w-full m-1 shrink-1", style: {
5707
- "maxWidth": "calc(100% - 96px)"
5708
- }, children: [
5825
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col grow w-full m-1 shrink min-w-0", children: [
5709
5826
  size !== "small" && includeId && (entity ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "block whitespace-nowrap overflow-hidden truncate", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "disabled", className: "font-mono", children: entity.id }) }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Skeleton, {})),
5710
5827
  titleProperty && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate my-0.5 text-sm font-medium", children: entity ? /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { propertyKey: titleProperty, value: getValueInPath(entity.values, titleProperty), property: resolvedCollection.properties[titleProperty], size: "large" }) : /* @__PURE__ */ jsxRuntime.jsx(SkeletonPropertyComponent, { property: resolvedCollection.properties[titleProperty], size: "large" }) }),
5711
5828
  restProperties && restProperties.map((key) => {
5712
- const childProperty = resolvedCollection.properties[key];
5829
+ const childProperty = getPropertyInPath(resolvedCollection.properties, key);
5713
5830
  if (!childProperty) return null;
5714
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("truncate", restProperties.length > 1 ? "my-0.5" : "my-0"), children: entity ? /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { propertyKey: key, value: getValueInPath(entity.values, key), property: childProperty, size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(SkeletonPropertyComponent, { property: childProperty, size: "small" }) }, "ref_prev_" + key);
5831
+ const valueInPath = getValueInPath(entity.values, key);
5832
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("truncate", restProperties.length > 1 ? "my-0.5" : "my-0"), children: entity ? /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { propertyKey: key, value: valueInPath, property: childProperty, size: "small" }) : /* @__PURE__ */ jsxRuntime.jsx(SkeletonPropertyComponent, { property: childProperty, size: "small" }) }, "ref_prev_" + key);
5715
5833
  })
5716
5834
  ] }),
5717
- entity && includeEntityLink && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: `See details for ${entity.id}`, className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { color: "inherit", size: "medium", className: size !== "small" ? "self-start" : "", onClick: (e) => {
5835
+ entity && includeEntityLink && /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { title: `See details for ${entity.id}`, className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { color: "inherit", size: "small", className: size !== "small" ? "self-start" : "", onClick: (e) => {
5718
5836
  e.stopPropagation();
5719
5837
  analyticsController.onAnalyticsEvent?.("entity_click_from_reference", {
5720
5838
  path: entity.path,
@@ -5726,7 +5844,7 @@
5726
5844
  collection,
5727
5845
  updateUrl: true
5728
5846
  });
5729
- }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardTabIcon, { size: "medium" }) }) }),
5847
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardTabIcon, { size: "small" }) }) }),
5730
5848
  actions
5731
5849
  ] });
5732
5850
  }
@@ -6062,7 +6180,7 @@
6062
6180
  }
6063
6181
  let t3;
6064
6182
  if ($[25] !== collection || $[26] !== disabled || $[27] !== hover || $[28] !== includeEntityLink || $[29] !== includeId || $[30] !== onClick || $[31] !== previewProperties || $[32] !== size || $[33] !== usedEntity) {
6065
- t3 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreview, { size, previewProperties, disabled, entity: usedEntity, collection, onClick, includeEntityLink, includeId, hover });
6183
+ t3 = /* @__PURE__ */ jsxRuntime.jsx(EntityPreview, { size, previewKeys: previewProperties, disabled, entity: usedEntity, collection, onClick, includeEntityLink, includeId, hover });
6066
6184
  $[25] = collection;
6067
6185
  $[26] = disabled;
6068
6186
  $[27] = hover;
@@ -6497,7 +6615,7 @@
6497
6615
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls(ui.defaultBorderMixin, "last:border-b-0 border-b"), children: [
6498
6616
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-row pt-0.5 pb-0.5 gap-2", children: [
6499
6617
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-[140px] w-[25%] py-1", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", className: "font-mono break-words", color: "secondary", children: key }) }, `table-cell-title-${key}-${key}`),
6500
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow max-w-[75%]", children: childValue && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: childValue.toString() }) }) })
6618
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow max-w-[75%]", children: childValue && typeof childValue !== "object" && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: childValue.toString() }) }) })
6501
6619
  ] }),
6502
6620
  typeof childValue === "object" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls(ui.defaultBorderMixin, "border-l pl-4"), children: /* @__PURE__ */ jsxRuntime.jsx(KeyValuePreview, { value: childValue }) })
6503
6621
  ] }, `map_preview_table_${key}}`);
@@ -6910,7 +7028,7 @@
6910
7028
  throw Error(`You need to specify a 'properties' prop (or specify a custom field) in your map property ${propertyKey}`);
6911
7029
  }
6912
7030
  const values = value;
6913
- const previewProperties = mapProperty.previewProperties;
7031
+ const previewProperties = mapProperty.previewKeys;
6914
7032
  if (!values) {
6915
7033
  t4 = null;
6916
7034
  break bb0;
@@ -7149,7 +7267,6 @@
7149
7267
  width: "100%",
7150
7268
  color: "unset",
7151
7269
  fontWeight: "unset",
7152
- lineHeight: 1.7142857,
7153
7270
  fontSize: "unset",
7154
7271
  fontFamily: "unset",
7155
7272
  background: "unset",
@@ -8736,7 +8853,7 @@
8736
8853
  return t8;
8737
8854
  };
8738
8855
  const EntityTableCell = React.memo(function EntityTableCell2(t0) {
8739
- const $ = reactCompilerRuntime.c(45);
8856
+ const $ = reactCompilerRuntime.c(48);
8740
8857
  const {
8741
8858
  children,
8742
8859
  actions,
@@ -8965,11 +9082,11 @@
8965
9082
  }
8966
9083
  let t25;
8967
9084
  if ($[37] !== actions || $[38] !== onFocus || $[39] !== t16 || $[40] !== t19 || $[41] !== t20 || $[42] !== t23 || $[43] !== t24) {
8968
- t25 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t16, ref, style: t19, tabIndex: t20, onFocus, onMouseEnter: setOnHoverTrue, onMouseMove: setOnHoverTrue, onMouseLeave: setOnHoverFalse, children: [
9085
+ t25 = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t16, ref, style: t19, tabIndex: t20, onFocus, onMouseEnter: setOnHoverTrue, onMouseMove: setOnHoverTrue, onMouseLeave: setOnHoverFalse, children: [
8969
9086
  t23,
8970
9087
  actions,
8971
9088
  t24
8972
- ] });
9089
+ ] }) });
8973
9090
  $[37] = actions;
8974
9091
  $[38] = onFocus;
8975
9092
  $[39] = t16;
@@ -8981,7 +9098,21 @@
8981
9098
  } else {
8982
9099
  t25 = $[44];
8983
9100
  }
8984
- return t25;
9101
+ const result = t25;
9102
+ if (showError) {
9103
+ const t26 = error?.message ?? "Error";
9104
+ let t27;
9105
+ if ($[45] !== result || $[46] !== t26) {
9106
+ t27 = /* @__PURE__ */ jsxRuntime.jsx(ErrorTooltip, { align: "start", title: t26, children: result });
9107
+ $[45] = result;
9108
+ $[46] = t26;
9109
+ $[47] = t27;
9110
+ } else {
9111
+ t27 = $[47];
9112
+ }
9113
+ return t27;
9114
+ }
9115
+ return result;
8985
9116
  }, (a, b) => {
8986
9117
  return a.error === b.error && a.value === b.value && a.disabled === b.disabled && a.saved === b.saved && a.allowScroll === b.allowScroll && a.align === b.align && a.size === b.size && a.disabledTooltip === b.disabledTooltip && a.width === b.width && a.showExpandIcon === b.showExpandIcon && a.removePadding === b.removePadding && a.fullHeight === b.fullHeight && a.selected === b.selected;
8987
9118
  });
@@ -9230,7 +9361,7 @@
9230
9361
  }
9231
9362
  } else if (arrayProperty.of.dataType === "reference") {
9232
9363
  if (typeof arrayProperty.of.path === "string") {
9233
- innerComponent = /* @__PURE__ */ jsxRuntime.jsx(TableReferenceField, { name: propertyKey, disabled, internalValue, updateValue, size, multiselect: true, path: arrayProperty.of.path, previewProperties: arrayProperty.of.previewProperties, title: arrayProperty.name, forceFilter: arrayProperty.of.forceFilter, includeId: arrayProperty.of.includeId, includeEntityLink: arrayProperty.of.includeEntityLink });
9364
+ innerComponent = /* @__PURE__ */ jsxRuntime.jsx(TableReferenceField, { name: propertyKey, disabled, internalValue, updateValue, size, multiselect: true, path: arrayProperty.of.path, previewProperties: arrayProperty.of.previewKeys, title: arrayProperty.name, forceFilter: arrayProperty.of.forceFilter, includeId: arrayProperty.of.includeId, includeEntityLink: arrayProperty.of.includeEntityLink });
9234
9365
  }
9235
9366
  allowScroll = false;
9236
9367
  }
@@ -9493,7 +9624,7 @@
9493
9624
  }
9494
9625
  let t6;
9495
9626
  if ($[6] !== t3 || $[7] !== t4) {
9496
- 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 }) });
9627
+ 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 ml-2", size: "small", onValueChange: t4, renderValue: _temp$j, children: t5 }) });
9497
9628
  $[6] = t3;
9498
9629
  $[7] = t4;
9499
9630
  $[8] = t6;
@@ -9766,7 +9897,7 @@
9766
9897
  }
9767
9898
  function propertiesToColumns({
9768
9899
  properties,
9769
- sortable,
9900
+ sortable: sortable2,
9770
9901
  forceFilter,
9771
9902
  AdditionalHeaderWidget
9772
9903
  }) {
@@ -9783,7 +9914,7 @@
9783
9914
  align: getTableCellAlignment(property),
9784
9915
  icon: getIconForProperty(property, "small"),
9785
9916
  title: property.name ?? key,
9786
- sortable,
9917
+ sortable: sortable2,
9787
9918
  filter: !disabledFilter && filterable,
9788
9919
  width: getTablePropertyColumnWidth(property),
9789
9920
  resizable: true,
@@ -10492,8 +10623,7 @@
10492
10623
  className,
10493
10624
  endAdornment,
10494
10625
  AddColumnComponent,
10495
- initialScroll = 0,
10496
- debug
10626
+ initialScroll = 0
10497
10627
  }) {
10498
10628
  const sortByProperty = sortBy ? sortBy[0] : void 0;
10499
10629
  const currentSort = sortBy ? sortBy[1] : void 0;
@@ -10503,7 +10633,10 @@
10503
10633
  const debouncedScroll = useDebounceCallback(onScrollProp, 200);
10504
10634
  React.useEffect(() => {
10505
10635
  if (tableRef.current && initialScroll) {
10506
- tableRef.current.scrollTo(0, initialScroll);
10636
+ const {
10637
+ scrollLeft
10638
+ } = tableRef.current;
10639
+ tableRef.current.scrollTo(scrollLeft, initialScroll);
10507
10640
  }
10508
10641
  }, [tableRef, initialScroll]);
10509
10642
  React.useEffect(() => {
@@ -10534,11 +10667,9 @@
10534
10667
  offsetSize: true
10535
10668
  });
10536
10669
  const onColumnResizeInternal = React.useCallback((params) => {
10537
- if (debug) console.log("onColumnResizeInternal", params);
10538
- setColumns(columns.map((column) => column.key === params.column.key ? params.column : column));
10539
- }, [columns]);
10670
+ setColumns((prevColumns) => prevColumns.map((column) => column.key === params.column.key ? params.column : column));
10671
+ }, []);
10540
10672
  const onColumnResizeEndInternal = React.useCallback((params_0) => {
10541
- if (debug) console.log("onColumnResizeEndInternal", params_0);
10542
10673
  setColumns(columns.map((column_0) => column_0.key === params_0.column.key ? params_0.column : column_0));
10543
10674
  if (onColumnResize) {
10544
10675
  onColumnResize(params_0);
@@ -10546,18 +10677,15 @@
10546
10677
  }, [columns, onColumnResize]);
10547
10678
  const filterRef = React.useRef();
10548
10679
  React.useEffect(() => {
10549
- if (debug) console.log("Filter updated", filterInput);
10550
10680
  filterRef.current = filterInput;
10551
10681
  }, [filterInput]);
10552
10682
  const scrollToTop = React.useCallback(() => {
10553
- if (debug) console.log("scrollToTop");
10554
10683
  endReachCallbackThreshold.current = 0;
10555
10684
  if (tableRef.current) {
10556
10685
  tableRef.current.scrollTo(tableRef.current?.scrollLeft, 0);
10557
10686
  }
10558
10687
  }, []);
10559
10688
  const onColumnSort = React.useCallback((key) => {
10560
- if (debug) console.log("onColumnSort", key);
10561
10689
  const isDesc = sortByProperty === key && currentSort === "desc";
10562
10690
  const isAsc = sortByProperty === key && currentSort === "asc";
10563
10691
  const newSort = isAsc ? "desc" : isDesc ? void 0 : "asc";
@@ -10578,9 +10706,7 @@
10578
10706
  scrollToTop();
10579
10707
  }, [checkFilterCombination, currentSort, onFilterUpdate, onResetPagination, onSortByUpdate, scrollToTop, sortByProperty]);
10580
10708
  const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);
10581
- if (debug) console.log("maxScroll", maxScroll);
10582
10709
  const onEndReachedInternal = React.useCallback((scrollOffset) => {
10583
- if (debug) console.log("onEndReachedInternal", scrollOffset, endReachCallbackThreshold.current + endOffset);
10584
10710
  if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + endOffset) {
10585
10711
  endReachCallbackThreshold.current = scrollOffset;
10586
10712
  onEndReached();
@@ -10591,11 +10717,6 @@
10591
10717
  scrollOffset: scrollOffset_0,
10592
10718
  scrollUpdateWasRequested
10593
10719
  }) => {
10594
- if (debug) console.log("onScroll", {
10595
- scrollDirection,
10596
- scrollOffset: scrollOffset_0,
10597
- scrollUpdateWasRequested
10598
- });
10599
10720
  if (onScrollProp) {
10600
10721
  debouncedScroll({
10601
10722
  scrollDirection,
@@ -10606,7 +10727,6 @@
10606
10727
  if (!scrollUpdateWasRequested && scrollOffset_0 >= maxScroll - endOffset) onEndReachedInternal(scrollOffset_0);
10607
10728
  }, [maxScroll, onEndReachedInternal]);
10608
10729
  const onFilterUpdateInternal = React.useCallback((column_1, filterForProperty) => {
10609
- if (debug) console.log("onFilterUpdateInternal", column_1, filterForProperty);
10610
10730
  endReachCallbackThreshold.current = 0;
10611
10731
  const filter_0 = filterRef.current;
10612
10732
  let newFilterValue = filter_0 ? {
@@ -10654,7 +10774,6 @@
10654
10774
  endAdornment,
10655
10775
  AddColumnComponent
10656
10776
  };
10657
- if (debug) console.log("VirtualTable render", virtualListController);
10658
10777
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: measureRef, style, className: ui.cls("h-full w-full", className), children: /* @__PURE__ */ jsxRuntime.jsx(VirtualListContext.Provider, { value: virtualListController, children: /* @__PURE__ */ jsxRuntime.jsx(MemoizedList, { outerRef: tableRef, width: bounds.width, height: bounds.height, itemCount: (data?.length ?? 0) + (endAdornment ? 1 : 0), onScroll, includeAddColumn: Boolean(AddColumnComponent), itemSize: rowHeight }, rowHeight) }) });
10659
10778
  }, equal);
10660
10779
  function MemoizedList({
@@ -10990,8 +11109,8 @@
10990
11109
  }
10991
11110
  let t9;
10992
11111
  if ($[34] !== dataType || $[35] !== enumValues || $[36] !== internalValue || $[37] !== multiple || $[38] !== name || $[39] !== operation || $[40] !== updateFilter) {
10993
- t9 = enumValues && multiple && /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelect, { position: "item-aligned", value: Array.isArray(internalValue) ? internalValue.map(_temp3$3) : [], onValueChange: (value_2) => {
10994
- updateFilter(operation, dataType === "number" ? value_2.map(_temp4$2) : value_2);
11112
+ t9 = enumValues && multiple && /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelect, { position: "item-aligned", value: Array.isArray(internalValue) ? internalValue.map(_temp3$4) : [], onValueChange: (value_2) => {
11113
+ updateFilter(operation, dataType === "number" ? value_2.map(_temp4$3) : value_2);
10995
11114
  }, multiple, endAdornment: internalValue && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { className: "absolute right-2 top-3", onClick: (e_2) => updateFilter(operation, void 0), children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, {}) }), children: enumValues.map((enumConfig_0) => /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelectItem, { value: String(enumConfig_0.id), children: /* @__PURE__ */ jsxRuntime.jsx(EnumValuesChip, { enumKey: String(enumConfig_0.id), enumValues, size: "small" }) }, `select_value_${name}_${enumConfig_0.id}`)) });
10996
11115
  $[34] = dataType;
10997
11116
  $[35] = enumValues;
@@ -11054,10 +11173,10 @@
11054
11173
  }
11055
11174
  return t12;
11056
11175
  }
11057
- function _temp4$2(v) {
11176
+ function _temp4$3(v) {
11058
11177
  return parseInt(v);
11059
11178
  }
11060
- function _temp3$3(e_1) {
11179
+ function _temp3$4(e_1) {
11061
11180
  return String(e_1);
11062
11181
  }
11063
11182
  function _temp2$7(op_1) {
@@ -11294,97 +11413,94 @@
11294
11413
  function _temp$g(op_0) {
11295
11414
  return operationLabels[op_0];
11296
11415
  }
11297
- const SelectableTable = React.memo(
11298
- function SelectableTable2({
11299
- onValueChange,
11300
- cellRenderer,
11301
- onEntityClick,
11302
- onColumnResize,
11303
- hoverRow = true,
11304
- size = "m",
11305
- inlineEditing = false,
11306
- tableController: {
11307
- data,
11308
- dataLoading,
11309
- noMoreToLoad,
11310
- dataLoadingError,
11311
- filterValues,
11312
- setFilterValues,
11313
- sortBy,
11314
- setSortBy,
11315
- itemCount,
11316
- setItemCount,
11317
- pageSize = 50,
11318
- paginationEnabled,
11319
- checkFilterCombination,
11320
- setPopupCell
11321
- },
11322
- filterable = true,
11323
- onScroll,
11324
- initialScroll,
11325
- emptyComponent,
11326
- columns,
11327
- forceFilter,
11328
- highlightedRow,
11329
- endAdornment,
11330
- AddColumnComponent
11331
- }) {
11332
- const ref = React.useRef(null);
11333
- const [selectedCell, setSelectedCell] = React.useState(void 0);
11334
- const loadNextPage = () => {
11335
- if (!paginationEnabled || dataLoading || noMoreToLoad) return;
11336
- if (itemCount !== void 0) setItemCount?.(itemCount + pageSize);
11337
- };
11338
- const resetPagination = React.useCallback(() => {
11339
- setItemCount?.(pageSize);
11340
- }, [pageSize]);
11341
- const onRowClick = React.useCallback(({
11342
- rowData
11343
- }) => {
11344
- if (inlineEditing) return;
11345
- return onEntityClick && onEntityClick(rowData);
11346
- }, [onEntityClick, inlineEditing]);
11347
- ui.useOutsideAlerter(ref, () => {
11348
- if (selectedCell) {
11416
+ const SelectableTable = function SelectableTable2({
11417
+ onValueChange,
11418
+ cellRenderer,
11419
+ onEntityClick,
11420
+ onColumnResize,
11421
+ hoverRow = true,
11422
+ size = "m",
11423
+ inlineEditing = false,
11424
+ tableController: {
11425
+ data,
11426
+ dataLoading,
11427
+ noMoreToLoad,
11428
+ dataLoadingError,
11429
+ filterValues,
11430
+ setFilterValues,
11431
+ sortBy,
11432
+ setSortBy,
11433
+ itemCount,
11434
+ setItemCount,
11435
+ pageSize = 50,
11436
+ paginationEnabled,
11437
+ checkFilterCombination,
11438
+ setPopupCell
11439
+ },
11440
+ filterable = true,
11441
+ onScroll,
11442
+ initialScroll,
11443
+ emptyComponent,
11444
+ columns,
11445
+ forceFilter,
11446
+ highlightedRow,
11447
+ endAdornment,
11448
+ AddColumnComponent
11449
+ }) {
11450
+ const ref = React.useRef(null);
11451
+ const [selectedCell, setSelectedCell] = React.useState(void 0);
11452
+ const loadNextPage = () => {
11453
+ if (!paginationEnabled || dataLoading || noMoreToLoad) return;
11454
+ if (itemCount !== void 0) setItemCount?.(itemCount + pageSize);
11455
+ };
11456
+ const resetPagination = React.useCallback(() => {
11457
+ setItemCount?.(pageSize);
11458
+ }, [pageSize]);
11459
+ const onRowClick = React.useCallback(({
11460
+ rowData
11461
+ }) => {
11462
+ if (inlineEditing) return;
11463
+ return onEntityClick && onEntityClick(rowData);
11464
+ }, [onEntityClick, inlineEditing]);
11465
+ ui.useOutsideAlerter(ref, () => {
11466
+ if (selectedCell) {
11467
+ unselect();
11468
+ }
11469
+ }, Boolean(selectedCell));
11470
+ const select = React.useCallback((cell) => {
11471
+ setSelectedCell(cell);
11472
+ }, []);
11473
+ const unselect = React.useCallback(() => {
11474
+ setSelectedCell(void 0);
11475
+ }, []);
11476
+ React.useEffect(() => {
11477
+ const escFunction = (event) => {
11478
+ if (event.keyCode === 27) {
11349
11479
  unselect();
11350
11480
  }
11351
- }, Boolean(selectedCell));
11352
- React.useEffect(() => {
11353
- const escFunction = (event) => {
11354
- if (event.keyCode === 27) {
11355
- unselect();
11356
- }
11357
- };
11358
- document.addEventListener("keydown", escFunction, false);
11359
- return () => {
11360
- document.removeEventListener("keydown", escFunction, false);
11361
- };
11481
+ };
11482
+ document.addEventListener("keydown", escFunction, false);
11483
+ return () => {
11484
+ document.removeEventListener("keydown", escFunction, false);
11485
+ };
11486
+ }, [unselect]);
11487
+ const onFilterUpdate = React.useCallback((updatedFilterValues) => {
11488
+ setFilterValues?.({
11489
+ ...updatedFilterValues,
11490
+ ...forceFilter
11362
11491
  });
11363
- const select = React.useCallback((cell) => {
11364
- setSelectedCell(cell);
11365
- }, []);
11366
- const unselect = React.useCallback(() => {
11367
- setSelectedCell(void 0);
11368
- }, []);
11369
- const onFilterUpdate = React.useCallback((updatedFilterValues) => {
11370
- setFilterValues?.({
11371
- ...updatedFilterValues,
11372
- ...forceFilter
11373
- });
11374
- }, [forceFilter]);
11375
- return /* @__PURE__ */ jsxRuntime.jsx(SelectableTableContext.Provider, { value: {
11376
- setPopupCell,
11377
- select,
11378
- onValueChange,
11379
- size: size ?? "m",
11380
- selectedCell
11381
- }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full flex flex-col bg-white dark:bg-surface-950", ref, children: /* @__PURE__ */ jsxRuntime.jsx(VirtualTable, { data, columns, cellRenderer, onRowClick: inlineEditing ? void 0 : onEntityClick ? onRowClick : void 0, onEndReached: loadNextPage, onResetPagination: resetPagination, error: dataLoadingError, onColumnResize, rowHeight: getRowHeight(size), loading: dataLoading, filter: filterValues, onFilterUpdate: setFilterValues ? onFilterUpdate : void 0, sortBy, onSortByUpdate: setSortBy, hoverRow, initialScroll, onScroll, checkFilterCombination, createFilterField: filterable ? createFilterField : void 0, rowClassName: React.useCallback((entity) => {
11382
- return highlightedRow?.(entity) ? "bg-surface-100 bg-opacity-75 dark:bg-surface-800 dark:bg-opacity-75" : "";
11383
- }, [highlightedRow]), className: "flex-grow", emptyComponent, endAdornment, AddColumnComponent }) }) });
11384
- },
11385
- () => false
11386
- // equal
11387
- );
11492
+ }, [forceFilter]);
11493
+ const contextValue = React.useMemo(() => ({
11494
+ setPopupCell,
11495
+ select,
11496
+ onValueChange,
11497
+ size: size ?? "m",
11498
+ selectedCell
11499
+ }), [setPopupCell, select, onValueChange, size, selectedCell]);
11500
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectableTableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full w-full flex flex-col bg-white dark:bg-surface-950", ref, children: /* @__PURE__ */ jsxRuntime.jsx(VirtualTable, { data, columns, cellRenderer, onRowClick: inlineEditing ? void 0 : onEntityClick ? onRowClick : void 0, onEndReached: loadNextPage, onResetPagination: resetPagination, error: dataLoadingError, onColumnResize, rowHeight: getRowHeight(size), loading: dataLoading, filter: filterValues, onFilterUpdate: setFilterValues ? onFilterUpdate : void 0, sortBy, onSortByUpdate: setSortBy, hoverRow, initialScroll, onScroll, checkFilterCombination, createFilterField: filterable ? createFilterField : void 0, rowClassName: React.useCallback((entity) => {
11501
+ return highlightedRow?.(entity) ? "bg-surface-100 bg-opacity-75 dark:bg-surface-800 dark:bg-opacity-75" : "";
11502
+ }, [highlightedRow]), className: "flex-grow", emptyComponent, endAdornment, AddColumnComponent }) }) });
11503
+ };
11388
11504
  function createFilterField({
11389
11505
  id,
11390
11506
  filterValue,
@@ -11446,7 +11562,7 @@
11446
11562
  properties,
11447
11563
  tableController,
11448
11564
  filterable = true,
11449
- sortable = true,
11565
+ sortable: sortable2 = true,
11450
11566
  endAdornment,
11451
11567
  AddColumnComponent,
11452
11568
  AdditionalHeaderWidget,
@@ -11522,7 +11638,7 @@
11522
11638
  const collectionColumns = (() => {
11523
11639
  const columnsResult = propertiesToColumns({
11524
11640
  properties,
11525
- sortable,
11641
+ sortable: sortable2,
11526
11642
  forceFilter,
11527
11643
  AdditionalHeaderWidget
11528
11644
  });
@@ -12842,7 +12958,7 @@
12842
12958
  const favourite = t4;
12843
12959
  let t5;
12844
12960
  if ($[7] !== collection || $[8] !== context || $[9] !== customizationController.plugins || $[10] !== favourite || $[11] !== path || $[12] !== userConfigurationPersistence) {
12845
- const actionsArray = userConfigurationPersistence ? [/* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: (e) => {
12961
+ const actionsArray = userConfigurationPersistence ? [/* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: (e) => {
12846
12962
  e.preventDefault();
12847
12963
  e.stopPropagation();
12848
12964
  if (favourite) {
@@ -12850,7 +12966,7 @@
12850
12966
  } else {
12851
12967
  userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, path]);
12852
12968
  }
12853
- }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.StarIcon, { size: 18, className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500" }) }, "favourite")] : [];
12969
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.StarIcon, { size: "small", className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500" }) }, "favourite")] : [];
12854
12970
  if (customizationController.plugins && collection) {
12855
12971
  let t62;
12856
12972
  if ($[14] !== collection || $[15] !== context || $[16] !== path) {
@@ -13184,7 +13300,7 @@
13184
13300
  if ($[7] !== additionalActions || $[8] !== additionalChildrenStart || $[9] !== containerRef || $[10] !== context || $[11] !== customizationController.plugins || $[12] !== direction || $[13] !== filteredNavigationEntries || $[14] !== filteredUrls || $[15] !== groups || $[16] !== performingSearch) {
13185
13301
  const filteredGroups = filteredUrls ? filteredNavigationEntries.map(_temp2$5) : [];
13186
13302
  const allGroups = filteredUrls ? filteredGroups.filter((group, index) => filteredGroups.indexOf(group) === index) : [...groups];
13187
- if (filteredNavigationEntries.filter(_temp3$2).length > 0 || filteredNavigationEntries.length === 0) {
13303
+ if (filteredNavigationEntries.filter(_temp3$3).length > 0 || filteredNavigationEntries.length === 0) {
13188
13304
  allGroups.push(void 0);
13189
13305
  }
13190
13306
  let additionalPluginChildrenStart;
@@ -13194,7 +13310,7 @@
13194
13310
  const sectionProps = {
13195
13311
  context
13196
13312
  };
13197
- t143 = customizationController.plugins.filter(_temp4$1).map((plugin_0, i) => {
13313
+ t143 = customizationController.plugins.filter(_temp4$2).map((plugin_0, i) => {
13198
13314
  const section = plugin_0.homePage.includeSection(sectionProps);
13199
13315
  return /* @__PURE__ */ jsxRuntime.jsx(NavigationGroup, { group: section.title, children: section.children }, `plugin_section_${plugin_0.key}`);
13200
13316
  });
@@ -13215,7 +13331,7 @@
13215
13331
  additionalPluginSections = t153;
13216
13332
  let t162;
13217
13333
  if ($[34] !== customizationController.plugins) {
13218
- t162 = customizationController.plugins.filter(_temp5$1).map(_temp6$1);
13334
+ t162 = customizationController.plugins.filter(_temp5$2).map(_temp6$2);
13219
13335
  $[34] = customizationController.plugins;
13220
13336
  $[35] = t162;
13221
13337
  } else {
@@ -13232,7 +13348,7 @@
13232
13348
  additionalPluginChildrenStart = t172;
13233
13349
  let t18;
13234
13350
  if ($[38] !== customizationController.plugins) {
13235
- t18 = customizationController.plugins.filter(_temp7).map(_temp8);
13351
+ t18 = customizationController.plugins.filter(_temp7$1).map(_temp8);
13236
13352
  $[38] = customizationController.plugins;
13237
13353
  $[39] = t18;
13238
13354
  } else {
@@ -13329,7 +13445,7 @@
13329
13445
  context.analyticsController?.onAnalyticsEvent?.(event, {
13330
13446
  path: entry_1.path
13331
13447
  });
13332
- } }) }, `nav_${entry_1.group}_${entry_1.name}`)),
13448
+ } }) }, `nav_${entry_1.group}_${entry_1.path}_${entry_1.name}`)),
13333
13449
  group_0?.toLowerCase() !== "admin" && AdditionalCards && AdditionalCards.map((AdditionalCard, i_2) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(AdditionalCard, { ...actionProps }) }, `nav_${group_0}_add_${i_2}`))
13334
13450
  ] }) }, `plugin_section_${group_0}`);
13335
13451
  };
@@ -13420,19 +13536,19 @@
13420
13536
  function _temp8(plugin_4, i_1) {
13421
13537
  return /* @__PURE__ */ jsxRuntime.jsx("div", { children: plugin_4.homePage.additionalChildrenEnd }, `plugin_children_start_${i_1}`);
13422
13538
  }
13423
- function _temp7(plugin_3) {
13539
+ function _temp7$1(plugin_3) {
13424
13540
  return plugin_3.homePage?.additionalChildrenEnd;
13425
13541
  }
13426
- function _temp6$1(plugin_2, i_0) {
13542
+ function _temp6$2(plugin_2, i_0) {
13427
13543
  return /* @__PURE__ */ jsxRuntime.jsx("div", { children: plugin_2.homePage.additionalChildrenStart }, `plugin_children_start_${i_0}`);
13428
13544
  }
13429
- function _temp5$1(plugin_1) {
13545
+ function _temp5$2(plugin_1) {
13430
13546
  return plugin_1.homePage?.additionalChildrenStart;
13431
13547
  }
13432
- function _temp4$1(plugin) {
13548
+ function _temp4$2(plugin) {
13433
13549
  return plugin.homePage?.includeSection;
13434
13550
  }
13435
- function _temp3$2(e_1) {
13551
+ function _temp3$3(e_1) {
13436
13552
  return !e_1.group;
13437
13553
  }
13438
13554
  function _temp2$5(entry) {
@@ -13610,7 +13726,7 @@
13610
13726
  let relX = 0;
13611
13727
  let relY = 0;
13612
13728
  const listeningRef = React.useRef(false);
13613
- const onMouseDown = (event) => {
13729
+ const onMouseDown = React.useCallback((event) => {
13614
13730
  if (event.button !== 0 || !containerRef.current || event.defaultPrevented || event.innerClicked) {
13615
13731
  return;
13616
13732
  }
@@ -13624,14 +13740,14 @@
13624
13740
  document.addEventListener("mouseup", onMouseUp);
13625
13741
  document.addEventListener("selectstart", onSelect);
13626
13742
  listeningRef.current = true;
13627
- };
13628
- const onMouseDownInner = (event_0) => {
13743
+ }, [containerRef, onMove]);
13744
+ const onMouseDownInner = React.useCallback((event_0) => {
13629
13745
  event_0.innerClicked = true;
13630
- };
13631
- const onSelect = (event_1) => {
13746
+ }, []);
13747
+ const onSelect = React.useCallback((event_1) => {
13632
13748
  event_1.preventDefault();
13633
13749
  event_1.stopPropagation();
13634
- };
13750
+ }, []);
13635
13751
  const onMouseUp = (event_2) => {
13636
13752
  document.removeEventListener("mousemove", onMouseMove);
13637
13753
  document.removeEventListener("mouseup", onMouseUp);
@@ -13664,7 +13780,7 @@
13664
13780
  if (current) current.removeEventListener("mousedown", onMouseDown);
13665
13781
  if (innerCurrent) innerCurrent.removeEventListener("mousedown", onMouseDownInner);
13666
13782
  };
13667
- });
13783
+ }, [containerRef, innerRef, onMouseDownInner, onMouseDown]);
13668
13784
  }
13669
13785
  function useWindowSize() {
13670
13786
  const $ = reactCompilerRuntime.c(3);
@@ -13703,46 +13819,6 @@
13703
13819
  React.useLayoutEffect(t1, t2);
13704
13820
  return size;
13705
13821
  }
13706
- const ElementResizeListener = ({
13707
- onResize
13708
- }) => {
13709
- const rafRef = React.useRef(0);
13710
- const objectRef = React.useRef(null);
13711
- const onResizeRef = React.useRef(onResize);
13712
- onResizeRef.current = onResize;
13713
- const _onResize = React.useCallback((e) => {
13714
- if (rafRef.current) {
13715
- cancelAnimationFrame(rafRef.current);
13716
- }
13717
- rafRef.current = requestAnimationFrame(() => {
13718
- onResizeRef.current(e);
13719
- });
13720
- }, []);
13721
- const onLoad = React.useCallback(() => {
13722
- const obj = objectRef.current;
13723
- if (obj && obj.contentDocument && obj.contentDocument.defaultView) {
13724
- obj.contentDocument.defaultView.addEventListener("resize", _onResize);
13725
- }
13726
- }, [_onResize]);
13727
- React.useEffect(() => {
13728
- const obj_0 = objectRef.current;
13729
- return () => {
13730
- if (obj_0 && obj_0.contentDocument && obj_0.contentDocument.defaultView) {
13731
- obj_0.contentDocument.defaultView.removeEventListener("resize", _onResize);
13732
- }
13733
- };
13734
- }, [_onResize]);
13735
- return /* @__PURE__ */ jsxRuntime.jsx("object", { onLoad, ref: objectRef, tabIndex: -1, type: "text/html", data: "about:blank", title: "", style: {
13736
- position: "absolute",
13737
- top: 0,
13738
- left: 0,
13739
- height: "100%",
13740
- width: "100%",
13741
- pointerEvents: "none",
13742
- zIndex: -1,
13743
- opacity: 0
13744
- } });
13745
- };
13746
13822
  function CustomIdField({
13747
13823
  customId,
13748
13824
  entityId,
@@ -13784,7 +13860,9 @@
13784
13860
  ] }) : void 0
13785
13861
  };
13786
13862
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13787
- enumValues && /* @__PURE__ */ jsxRuntime.jsx(ui.Select, { size: "large", error, fullWidth: true, onValueChange: (v) => onChange(v), ...fieldProps, renderValue: (option) => {
13863
+ enumValues && /* @__PURE__ */ jsxRuntime.jsx(ui.Select, { size: "large", error, fullWidth: true, onValueChange: (v) => {
13864
+ onChange(v);
13865
+ }, ...fieldProps, renderValue: (option) => {
13788
13866
  const enumConfig = enumValues.find((e_1) => e_1.id === option);
13789
13867
  if (!enumConfig) return option;
13790
13868
  return `${enumConfig.id} - ${enumConfig.label}`;
@@ -14363,7 +14441,7 @@
14363
14441
  const formRef = React.useRef(null);
14364
14442
  const formView = /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14365
14443
  !Builder && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full py-2 flex flex-col items-start my-4 lg:my-6", children: [
14366
- /* @__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 }),
14444
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: "my-4 flex-grow line-clamp-1 " + (collection.hideIdFromForm ? "mb-6" : ""), variant: "h4", children: title ?? collection.singularName ?? collection.name }),
14367
14445
  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: [
14368
14446
  entity?.path ?? path,
14369
14447
  "/",
@@ -14516,7 +14594,7 @@
14516
14594
  const t1 = small ? "gap-1" : "gap-2";
14517
14595
  let t2;
14518
14596
  if ($[0] !== className || $[1] !== t1) {
14519
- t2 = ui.cls("inline-flex items-center my-0.5", t1, className);
14597
+ t2 = ui.cls("align-middle inline-flex items-center my-0.5", t1, className);
14520
14598
  $[0] = className;
14521
14599
  $[1] = t1;
14522
14600
  $[2] = t2;
@@ -14852,7 +14930,7 @@
14852
14930
  }
14853
14931
  let t13;
14854
14932
  if ($[20] !== disabled || $[21] !== handleClearClick || $[22] !== property.clearable) {
14855
- t13 = property.clearable && !disabled && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { onClick: handleClearClick, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, {}) });
14933
+ t13 = property.clearable && !disabled && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: handleClearClick, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { size: "small" }) });
14856
14934
  $[20] = disabled;
14857
14935
  $[21] = handleClearClick;
14858
14936
  $[22] = property.clearable;
@@ -14965,7 +15043,7 @@
14965
15043
  ] }, enumKey);
14966
15044
  }, [enumValues, setValue, value]);
14967
15045
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14968
- /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelect, { className: "w-full mt-2", size, value: validValue ? value.map((v_0) => v_0.toString()) : [], disabled, modalPopover: true, label: /* @__PURE__ */ jsxRuntime.jsx(LabelWithIconAndTooltip, { propertyKey, icon: getIconForProperty(property, "small"), required: property.validation?.required, title: property.name, className: "h-8 text-text-secondary dark:text-text-secondary-dark ml-3.5" }), onValueChange: (updatedValue) => {
15046
+ /* @__PURE__ */ jsxRuntime.jsx(ui.MultiSelect, { className: "w-full mt-2", size, value: validValue ? value.map((v_0) => v_0?.toString()) : [], disabled, modalPopover: true, label: /* @__PURE__ */ jsxRuntime.jsx(LabelWithIconAndTooltip, { propertyKey, icon: getIconForProperty(property, "small"), required: property.validation?.required, title: property.name, className: "h-8 text-text-secondary dark:text-text-secondary-dark ml-3.5" }), onValueChange: (updatedValue) => {
14969
15047
  let newValue;
14970
15048
  if (of && of?.dataType === "number") {
14971
15049
  newValue = updatedValue ? updatedValue.map((e_1) => parseFloat(e_1)) : [];
@@ -15046,7 +15124,8 @@
15046
15124
  !collection && /* @__PURE__ */ jsxRuntime.jsx(ErrorView, { error: "The specified collection does not exist. Check console" }),
15047
15125
  collection && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group", children: [
15048
15126
  /* @__PURE__ */ jsxRuntime.jsx(ArrayContainer, { droppableId: propertyKey, value, disabled: isSubmitting, buildEntry, canAddElements: false, addLabel: property.name ? "Add reference to " + property.name : "Add reference", newDefaultEntry: property.of.defaultValue, onValueChange: (value_0) => setFieldValue(propertyKey, value_0) }),
15049
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { className: "my-4 justify-center text-left", variant: "text", color: "primary", disabled: isSubmitting, onClick: onEntryClick, children: [
15127
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { className: "ml-3.5 my-4 justify-center text-left", variant: "text", color: "primary", disabled: isSubmitting, onClick: onEntryClick, children: [
15128
+ /* @__PURE__ */ jsxRuntime.jsx(ui.EditIcon, { size: "small" }),
15050
15129
  "Edit ",
15051
15130
  property.name
15052
15131
  ] })
@@ -15295,15 +15374,161 @@
15295
15374
  }
15296
15375
  return t12;
15297
15376
  }
15377
+ function SortableStorageItem(t0) {
15378
+ const $ = reactCompilerRuntime.c(35);
15379
+ const {
15380
+ id,
15381
+ entry,
15382
+ property,
15383
+ metadata,
15384
+ storagePathBuilder,
15385
+ onFileUploadComplete,
15386
+ onClear,
15387
+ disabled
15388
+ } = t0;
15389
+ let t1;
15390
+ if ($[0] !== id) {
15391
+ t1 = {
15392
+ id
15393
+ };
15394
+ $[0] = id;
15395
+ $[1] = t1;
15396
+ } else {
15397
+ t1 = $[1];
15398
+ }
15399
+ const {
15400
+ attributes,
15401
+ listeners: listeners2,
15402
+ setNodeRef,
15403
+ transform,
15404
+ transition,
15405
+ isDragging
15406
+ } = sortable.useSortable(t1);
15407
+ let t2;
15408
+ if ($[2] !== transform) {
15409
+ t2 = utilities.CSS.Transform.toString(transform);
15410
+ $[2] = transform;
15411
+ $[3] = t2;
15412
+ } else {
15413
+ t2 = $[3];
15414
+ }
15415
+ const t3 = isDragging ? 100 : void 0;
15416
+ const t4 = isDragging ? 0.8 : 1;
15417
+ let t5;
15418
+ if ($[4] !== t2 || $[5] !== t3 || $[6] !== t4 || $[7] !== transition) {
15419
+ t5 = {
15420
+ transform: t2,
15421
+ transition,
15422
+ zIndex: t3,
15423
+ opacity: t4
15424
+ };
15425
+ $[4] = t2;
15426
+ $[5] = t3;
15427
+ $[6] = t4;
15428
+ $[7] = transition;
15429
+ $[8] = t5;
15430
+ } else {
15431
+ t5 = $[8];
15432
+ }
15433
+ const style = t5;
15434
+ const getImageSizeNumber = _temp$a;
15435
+ let child;
15436
+ if (entry.storagePathOrDownloadUrl) {
15437
+ const t62 = `storage_preview_${entry.storagePathOrDownloadUrl}`;
15438
+ let t72;
15439
+ if ($[9] !== entry.storagePathOrDownloadUrl || $[10] !== onClear) {
15440
+ t72 = () => onClear(entry.storagePathOrDownloadUrl);
15441
+ $[9] = entry.storagePathOrDownloadUrl;
15442
+ $[10] = onClear;
15443
+ $[11] = t72;
15444
+ } else {
15445
+ t72 = $[11];
15446
+ }
15447
+ let t8;
15448
+ if ($[12] !== disabled || $[13] !== entry.size || $[14] !== entry.storagePathOrDownloadUrl || $[15] !== property || $[16] !== t62 || $[17] !== t72) {
15449
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(StorageItemPreview, { name: t62, property, disabled, value: entry.storagePathOrDownloadUrl, onRemove: t72, size: entry.size });
15450
+ $[12] = disabled;
15451
+ $[13] = entry.size;
15452
+ $[14] = entry.storagePathOrDownloadUrl;
15453
+ $[15] = property;
15454
+ $[16] = t62;
15455
+ $[17] = t72;
15456
+ $[18] = t8;
15457
+ } else {
15458
+ t8 = $[18];
15459
+ }
15460
+ child = t8;
15461
+ } else {
15462
+ if (entry.file) {
15463
+ let t62;
15464
+ if ($[19] !== entry.file || $[20] !== storagePathBuilder) {
15465
+ t62 = storagePathBuilder(entry.file);
15466
+ $[19] = entry.file;
15467
+ $[20] = storagePathBuilder;
15468
+ $[21] = t62;
15469
+ } else {
15470
+ t62 = $[21];
15471
+ }
15472
+ const t72 = getImageSizeNumber(entry.size);
15473
+ let t8;
15474
+ if ($[22] !== entry || $[23] !== metadata || $[24] !== onFileUploadComplete || $[25] !== t62 || $[26] !== t72) {
15475
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(StorageUploadProgress, { entry, metadata, storagePath: t62, onFileUploadComplete, imageSize: t72, simple: false });
15476
+ $[22] = entry;
15477
+ $[23] = metadata;
15478
+ $[24] = onFileUploadComplete;
15479
+ $[25] = t62;
15480
+ $[26] = t72;
15481
+ $[27] = t8;
15482
+ } else {
15483
+ t8 = $[27];
15484
+ }
15485
+ child = t8;
15486
+ }
15487
+ }
15488
+ let t6;
15489
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
15490
+ t6 = ui.cls("rounded-md m-1");
15491
+ $[28] = t6;
15492
+ } else {
15493
+ t6 = $[28];
15494
+ }
15495
+ let t7;
15496
+ if ($[29] !== attributes || $[30] !== child || $[31] !== listeners2 || $[32] !== setNodeRef || $[33] !== style) {
15497
+ t7 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners2, className: t6, tabIndex: -1, children: child });
15498
+ $[29] = attributes;
15499
+ $[30] = child;
15500
+ $[31] = listeners2;
15501
+ $[32] = setNodeRef;
15502
+ $[33] = style;
15503
+ $[34] = t7;
15504
+ } else {
15505
+ t7 = $[34];
15506
+ }
15507
+ return t7;
15508
+ }
15509
+ function _temp$a(previewSize) {
15510
+ switch (previewSize) {
15511
+ case "small": {
15512
+ return 40;
15513
+ }
15514
+ case "medium": {
15515
+ return 118;
15516
+ }
15517
+ case "large": {
15518
+ return 220;
15519
+ }
15520
+ default: {
15521
+ return 118;
15522
+ }
15523
+ }
15524
+ }
15298
15525
  function FileDropComponent(t0) {
15299
- const $ = reactCompilerRuntime.c(64);
15526
+ const $ = reactCompilerRuntime.c(63);
15300
15527
  const {
15301
15528
  storage,
15302
15529
  disabled,
15303
- isDraggingOver,
15304
15530
  onFilesAdded,
15305
15531
  multipleFilesSupported,
15306
- droppableProvided,
15307
15532
  autoFocus,
15308
15533
  internalValue,
15309
15534
  property,
@@ -15311,23 +15536,23 @@
15311
15536
  metadata,
15312
15537
  storagePathBuilder,
15313
15538
  onFileUploadComplete,
15314
- size,
15315
15539
  name,
15316
- helpText
15540
+ helpText,
15541
+ isDndItemDragging
15317
15542
  } = t0;
15318
15543
  const snackbarContext = useSnackbarController();
15319
15544
  let t1;
15320
15545
  if ($[0] !== storage.acceptedFiles) {
15321
- t1 = storage.acceptedFiles ? storage.acceptedFiles.map(_temp$a).reduce(_temp2$4, {}) : void 0;
15546
+ t1 = storage.acceptedFiles ? storage.acceptedFiles.reduce(_temp2$4, {}) : void 0;
15322
15547
  $[0] = storage.acceptedFiles;
15323
15548
  $[1] = t1;
15324
15549
  } else {
15325
15550
  t1 = $[1];
15326
15551
  }
15327
- const t2 = disabled || isDraggingOver;
15552
+ const t2 = disabled || isDndItemDragging;
15328
15553
  let t3;
15329
15554
  if ($[2] !== snackbarContext || $[3] !== storage.maxSize) {
15330
- t3 = (fileRejections, event) => {
15555
+ t3 = (fileRejections) => {
15331
15556
  for (const fileRejection of fileRejections) {
15332
15557
  for (const error of fileRejection.errors) {
15333
15558
  console.error("Error uploading file: ", error);
@@ -15389,170 +15614,154 @@
15389
15614
  }
15390
15615
  const t6 = disabled ? ui.fieldBackgroundDisabledMixin : ui.fieldBackgroundHoverMixin;
15391
15616
  const t7 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
15392
- const t8 = multipleFilesSupported && internalValue.length ? "" : "flex";
15617
+ const t8 = multipleFilesSupported && internalValue.length === 0 && "flex";
15393
15618
  const t9 = !isDragActive;
15394
- let t10;
15395
- if ($[13] !== disabled || $[14] !== isDragAccept || $[15] !== isDragActive || $[16] !== isDragReject || $[17] !== t6 || $[18] !== t7 || $[19] !== t8 || $[20] !== t9) {
15396
- t10 = ui.cls(ui.fieldBackgroundMixin, t6, t7, dropZoneClasses, t8, {
15619
+ const t10 = disabled || isDndItemDragging;
15620
+ let t11;
15621
+ if ($[13] !== isDragAccept || $[14] !== isDragActive || $[15] !== isDragReject || $[16] !== t10 || $[17] !== t6 || $[18] !== t7 || $[19] !== t8 || $[20] !== t9) {
15622
+ t11 = ui.cls(ui.fieldBackgroundMixin, t6, t7, dropZoneClasses, t8, {
15397
15623
  [nonActiveDropClasses]: t9,
15398
15624
  [activeDropClasses]: isDragActive,
15399
15625
  [rejectDropClasses]: isDragReject,
15400
15626
  [acceptDropClasses]: isDragAccept,
15401
- [disabledClasses]: disabled
15627
+ [disabledClasses]: t10
15402
15628
  });
15403
- $[13] = disabled;
15404
- $[14] = isDragAccept;
15405
- $[15] = isDragActive;
15406
- $[16] = isDragReject;
15629
+ $[13] = isDragAccept;
15630
+ $[14] = isDragActive;
15631
+ $[15] = isDragReject;
15632
+ $[16] = t10;
15407
15633
  $[17] = t6;
15408
15634
  $[18] = t7;
15409
15635
  $[19] = t8;
15410
15636
  $[20] = t9;
15411
- $[21] = t10;
15412
- } else {
15413
- t10 = $[21];
15414
- }
15415
- const t11 = droppableProvided.droppableProps;
15416
- const t12 = droppableProvided.innerRef;
15417
- const t13 = multipleFilesSupported && internalValue.length ? "overflow-auto" : "";
15418
- const t14 = multipleFilesSupported && internalValue.length ? "min-h-[180px]" : "min-h-[250px]";
15419
- let t15;
15420
- if ($[22] !== t13 || $[23] !== t14) {
15421
- t15 = ui.cls("flex items-center p-1 no-scrollbar", t13, t14);
15422
- $[22] = t13;
15423
- $[23] = t14;
15424
- $[24] = t15;
15637
+ $[21] = t11;
15425
15638
  } else {
15426
- t15 = $[24];
15639
+ t11 = $[21];
15427
15640
  }
15641
+ const t12 = multipleFilesSupported && internalValue.length ? "flex-row overflow-x-auto" : "flex-col";
15642
+ const t13 = internalValue.length === 0 && "min-h-[250px] justify-center";
15643
+ const t14 = multipleFilesSupported && internalValue.length > 0 && "min-h-[180px]";
15644
+ const t15 = !multipleFilesSupported && internalValue.length > 0 && "min-h-[250px]";
15428
15645
  let t16;
15429
- if ($[25] !== getInputProps) {
15430
- t16 = getInputProps();
15431
- $[25] = getInputProps;
15646
+ if ($[22] !== t12 || $[23] !== t13 || $[24] !== t14 || $[25] !== t15) {
15647
+ t16 = ui.cls("flex items-center p-1 no-scrollbar", t12, t13, t14, t15);
15648
+ $[22] = t12;
15649
+ $[23] = t13;
15650
+ $[24] = t14;
15651
+ $[25] = t15;
15432
15652
  $[26] = t16;
15433
15653
  } else {
15434
15654
  t16 = $[26];
15435
15655
  }
15436
15656
  let t17;
15437
- if ($[27] !== autoFocus || $[28] !== t16) {
15438
- t17 = /* @__PURE__ */ jsxRuntime.jsx("input", { autoFocus, ...t16 });
15439
- $[27] = autoFocus;
15440
- $[28] = t16;
15441
- $[29] = t17;
15657
+ if ($[27] !== getInputProps) {
15658
+ t17 = getInputProps();
15659
+ $[27] = getInputProps;
15660
+ $[28] = t17;
15442
15661
  } else {
15443
- t17 = $[29];
15662
+ t17 = $[28];
15444
15663
  }
15445
15664
  let t18;
15446
- if ($[30] !== disabled || $[31] !== internalValue || $[32] !== metadata || $[33] !== name || $[34] !== onClear || $[35] !== onFileUploadComplete || $[36] !== property || $[37] !== size || $[38] !== storagePathBuilder) {
15447
- let t192;
15448
- if ($[40] !== disabled || $[41] !== metadata || $[42] !== name || $[43] !== onClear || $[44] !== onFileUploadComplete || $[45] !== property || $[46] !== size || $[47] !== storagePathBuilder) {
15449
- t192 = (entry, index) => {
15450
- let child;
15451
- if (entry.storagePathOrDownloadUrl) {
15452
- child = /* @__PURE__ */ jsxRuntime.jsx(StorageItemPreview, { name: `storage_preview_${entry.storagePathOrDownloadUrl}`, property, disabled, value: entry.storagePathOrDownloadUrl, onRemove: onClear, size: entry.size });
15453
- } else {
15454
- if (entry.file) {
15455
- child = /* @__PURE__ */ jsxRuntime.jsx(StorageUploadProgress, { entry, metadata, storagePath: storagePathBuilder(entry.file), onFileUploadComplete, imageSize: size === "large" ? 220 : 118, simple: false });
15456
- }
15457
- }
15458
- return /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: `array_field_${name}_${entry.id}`, index, children: (provided, snapshot) => /* @__PURE__ */ jsxRuntime.jsx("div", { tabIndex: -1, ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps, className: ui.cls("rounded-md"), style: {
15459
- ...provided.draggableProps.style
15460
- }, children: child }) }, `array_field_${name}_${entry.id}`);
15461
- };
15462
- $[40] = disabled;
15463
- $[41] = metadata;
15464
- $[42] = name;
15465
- $[43] = onClear;
15466
- $[44] = onFileUploadComplete;
15467
- $[45] = property;
15468
- $[46] = size;
15469
- $[47] = storagePathBuilder;
15470
- $[48] = t192;
15471
- } else {
15472
- t192 = $[48];
15473
- }
15474
- t18 = internalValue.map(t192);
15475
- $[30] = disabled;
15476
- $[31] = internalValue;
15477
- $[32] = metadata;
15478
- $[33] = name;
15479
- $[34] = onClear;
15480
- $[35] = onFileUploadComplete;
15481
- $[36] = property;
15482
- $[37] = size;
15483
- $[38] = storagePathBuilder;
15484
- $[39] = t18;
15485
- } else {
15486
- t18 = $[39];
15665
+ if ($[29] !== autoFocus || $[30] !== t17) {
15666
+ t18 = /* @__PURE__ */ jsxRuntime.jsx("input", { autoFocus, ...t17 });
15667
+ $[29] = autoFocus;
15668
+ $[30] = t17;
15669
+ $[31] = t18;
15670
+ } else {
15671
+ t18 = $[31];
15487
15672
  }
15488
15673
  let t19;
15489
- if ($[49] !== droppableProvided.droppableProps || $[50] !== droppableProvided.innerRef || $[51] !== droppableProvided.placeholder || $[52] !== t15 || $[53] !== t17 || $[54] !== t18) {
15490
- t19 = /* @__PURE__ */ jsxRuntime.jsxs("div", { ...t11, ref: t12, className: t15, children: [
15491
- t17,
15674
+ if ($[32] !== disabled || $[33] !== internalValue || $[34] !== metadata || $[35] !== multipleFilesSupported || $[36] !== name || $[37] !== onClear || $[38] !== onFileUploadComplete || $[39] !== property || $[40] !== storagePathBuilder) {
15675
+ let t202;
15676
+ if ($[42] !== disabled || $[43] !== metadata || $[44] !== multipleFilesSupported || $[45] !== name || $[46] !== onClear || $[47] !== onFileUploadComplete || $[48] !== property || $[49] !== storagePathBuilder) {
15677
+ t202 = (entry) => /* @__PURE__ */ jsxRuntime.jsx(SortableStorageItem, { id: entry.id, entry, property, name, metadata, storagePathBuilder, onFileUploadComplete, onClear, disabled, isSortable: multipleFilesSupported }, entry.id);
15678
+ $[42] = disabled;
15679
+ $[43] = metadata;
15680
+ $[44] = multipleFilesSupported;
15681
+ $[45] = name;
15682
+ $[46] = onClear;
15683
+ $[47] = onFileUploadComplete;
15684
+ $[48] = property;
15685
+ $[49] = storagePathBuilder;
15686
+ $[50] = t202;
15687
+ } else {
15688
+ t202 = $[50];
15689
+ }
15690
+ t19 = internalValue.map(t202);
15691
+ $[32] = disabled;
15692
+ $[33] = internalValue;
15693
+ $[34] = metadata;
15694
+ $[35] = multipleFilesSupported;
15695
+ $[36] = name;
15696
+ $[37] = onClear;
15697
+ $[38] = onFileUploadComplete;
15698
+ $[39] = property;
15699
+ $[40] = storagePathBuilder;
15700
+ $[41] = t19;
15701
+ } else {
15702
+ t19 = $[41];
15703
+ }
15704
+ let t20;
15705
+ if ($[51] !== t16 || $[52] !== t18 || $[53] !== t19) {
15706
+ t20 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t16, children: [
15492
15707
  t18,
15493
- droppableProvided.placeholder
15708
+ t19
15494
15709
  ] });
15495
- $[49] = droppableProvided.droppableProps;
15496
- $[50] = droppableProvided.innerRef;
15497
- $[51] = droppableProvided.placeholder;
15498
- $[52] = t15;
15499
- $[53] = t17;
15500
- $[54] = t18;
15501
- $[55] = t19;
15502
- } else {
15503
- t19 = $[55];
15504
- }
15505
- const t20 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
15506
- let t21;
15507
- if ($[56] !== helpText || $[57] !== t20) {
15508
- t21 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow min-h-[38px] box-border m-2 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { align: "center", variant: "label", className: t20, children: helpText }) });
15509
- $[56] = helpText;
15510
- $[57] = t20;
15511
- $[58] = t21;
15710
+ $[51] = t16;
15711
+ $[52] = t18;
15712
+ $[53] = t19;
15713
+ $[54] = t20;
15512
15714
  } else {
15513
- t21 = $[58];
15715
+ t20 = $[54];
15514
15716
  }
15717
+ const t21 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
15515
15718
  let t22;
15516
- if ($[59] !== t10 || $[60] !== t19 || $[61] !== t21 || $[62] !== t5) {
15517
- t22 = /* @__PURE__ */ jsxRuntime.jsxs("div", { ...t5, className: t10, children: [
15518
- t19,
15519
- t21
15719
+ if ($[55] !== helpText || $[56] !== t21) {
15720
+ t22 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow min-h-[38px] box-border m-2 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { align: "center", variant: "label", className: t21, children: helpText }) });
15721
+ $[55] = helpText;
15722
+ $[56] = t21;
15723
+ $[57] = t22;
15724
+ } else {
15725
+ t22 = $[57];
15726
+ }
15727
+ let t23;
15728
+ if ($[58] !== t11 || $[59] !== t20 || $[60] !== t22 || $[61] !== t5) {
15729
+ t23 = /* @__PURE__ */ jsxRuntime.jsxs("div", { ...t5, className: t11, children: [
15730
+ t20,
15731
+ t22
15520
15732
  ] });
15521
- $[59] = t10;
15522
- $[60] = t19;
15523
- $[61] = t21;
15524
- $[62] = t5;
15525
- $[63] = t22;
15733
+ $[58] = t11;
15734
+ $[59] = t20;
15735
+ $[60] = t22;
15736
+ $[61] = t5;
15737
+ $[62] = t23;
15526
15738
  } else {
15527
- t22 = $[63];
15739
+ t23 = $[62];
15528
15740
  }
15529
- return t22;
15741
+ return t23;
15530
15742
  }
15531
- function _temp2$4(a, b) {
15743
+ function _temp2$4(acc, ext) {
15532
15744
  return {
15533
- ...a,
15534
- ...b
15745
+ ...acc,
15746
+ [ext]: []
15535
15747
  };
15536
15748
  }
15537
- function _temp$a(e) {
15538
- return {
15539
- [e]: []
15540
- };
15541
- }
15542
- function StorageUpload({
15543
- property,
15544
- name,
15545
- value,
15546
- setInternalValue,
15547
- onChange,
15548
- multipleFilesSupported,
15549
- onFileUploadComplete,
15550
- disabled,
15551
- onFilesAdded,
15552
- autoFocus,
15553
- storage,
15554
- storagePathBuilder
15555
- }) {
15749
+ function StorageUpload(t0) {
15750
+ const $ = reactCompilerRuntime.c(44);
15751
+ const {
15752
+ property,
15753
+ name,
15754
+ value,
15755
+ setInternalValue,
15756
+ onChange,
15757
+ multipleFilesSupported,
15758
+ onFileUploadComplete,
15759
+ disabled,
15760
+ onFilesAdded,
15761
+ autoFocus,
15762
+ storage,
15763
+ storagePathBuilder
15764
+ } = t0;
15556
15765
  if (multipleFilesSupported) {
15557
15766
  const arrayProperty = property;
15558
15767
  if (arrayProperty.of) {
@@ -15567,41 +15776,208 @@
15567
15776
  }
15568
15777
  }
15569
15778
  const metadata = storage?.metadata;
15570
- const size = multipleFilesSupported ? "medium" : "large";
15571
- const moveItem = React.useCallback((fromIndex, toIndex) => {
15572
- if (!multipleFilesSupported) return;
15573
- const newValue = [...value];
15574
- const item = newValue[fromIndex];
15575
- newValue.splice(fromIndex, 1);
15576
- newValue.splice(toIndex, 0, item);
15577
- setInternalValue(newValue);
15578
- const fieldValue = newValue.filter((e) => !!e.storagePathOrDownloadUrl).map((e_0) => e_0.storagePathOrDownloadUrl);
15579
- onChange(fieldValue);
15580
- }, [multipleFilesSupported, onChange, setInternalValue, value]);
15581
- const onDragEnd = React.useCallback((result) => {
15582
- if (!result.destination) {
15583
- return;
15584
- }
15585
- moveItem(result.source.index, result.destination.index);
15586
- }, [moveItem]);
15587
- const onClear = React.useCallback((clearedStoragePathOrDownloadUrl) => {
15588
- if (multipleFilesSupported) {
15589
- const newValue_0 = value.filter((v) => v.storagePathOrDownloadUrl !== clearedStoragePathOrDownloadUrl);
15590
- onChange(newValue_0.filter((v_0) => !!v_0.storagePathOrDownloadUrl).map((v_1) => v_1.storagePathOrDownloadUrl));
15779
+ const [isDndItemDragging, setIsDndItemDragging] = React.useState(false);
15780
+ let t1;
15781
+ if ($[0] !== multipleFilesSupported || $[1] !== onChange || $[2] !== setInternalValue || $[3] !== value) {
15782
+ t1 = (fromIndex, toIndex) => {
15783
+ if (!multipleFilesSupported || fromIndex === toIndex) {
15784
+ return;
15785
+ }
15786
+ const newValue = [...value];
15787
+ const item = newValue[fromIndex];
15788
+ newValue.splice(fromIndex, 1);
15789
+ newValue.splice(toIndex, 0, item);
15790
+ setInternalValue(newValue);
15791
+ const fieldValue = newValue.filter(_temp3$2).map(_temp4$1);
15792
+ onChange(fieldValue);
15793
+ };
15794
+ $[0] = multipleFilesSupported;
15795
+ $[1] = onChange;
15796
+ $[2] = setInternalValue;
15797
+ $[3] = value;
15798
+ $[4] = t1;
15799
+ } else {
15800
+ t1 = $[4];
15801
+ }
15802
+ const moveItem = t1;
15803
+ let t2;
15804
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
15805
+ t2 = {
15806
+ activationConstraint: {
15807
+ distance: 5
15808
+ }
15809
+ };
15810
+ $[5] = t2;
15811
+ } else {
15812
+ t2 = $[5];
15813
+ }
15814
+ let t3;
15815
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
15816
+ t3 = {
15817
+ coordinateGetter: sortable.sortableKeyboardCoordinates
15818
+ };
15819
+ $[6] = t3;
15820
+ } else {
15821
+ t3 = $[6];
15822
+ }
15823
+ const sensors = core.useSensors(core.useSensor(core.PointerSensor, t2), core.useSensor(core.KeyboardSensor, t3));
15824
+ let t4;
15825
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
15826
+ t4 = (event) => {
15827
+ setIsDndItemDragging(true);
15828
+ };
15829
+ $[7] = t4;
15830
+ } else {
15831
+ t4 = $[7];
15832
+ }
15833
+ const handleDragStart = t4;
15834
+ let t5;
15835
+ if ($[8] !== moveItem || $[9] !== value) {
15836
+ t5 = (event_0) => {
15837
+ setIsDndItemDragging(false);
15838
+ const {
15839
+ active,
15840
+ over
15841
+ } = event_0;
15842
+ if (over && active.id !== over.id) {
15843
+ const oldIndex = value.findIndex((item_0) => item_0.id === active.id);
15844
+ const newIndex = value.findIndex((item_1) => item_1.id === over.id);
15845
+ if (oldIndex !== -1 && newIndex !== -1) {
15846
+ moveItem(oldIndex, newIndex);
15847
+ }
15848
+ }
15849
+ };
15850
+ $[8] = moveItem;
15851
+ $[9] = value;
15852
+ $[10] = t5;
15853
+ } else {
15854
+ t5 = $[10];
15855
+ }
15856
+ const handleDragEnd = t5;
15857
+ let t6;
15858
+ if ($[11] !== multipleFilesSupported || $[12] !== onChange || $[13] !== setInternalValue || $[14] !== value) {
15859
+ t6 = (clearedStoragePathOrDownloadUrl) => {
15860
+ let newValue_0;
15861
+ if (multipleFilesSupported) {
15862
+ newValue_0 = value.filter((v) => v.storagePathOrDownloadUrl !== clearedStoragePathOrDownloadUrl);
15863
+ onChange(newValue_0.filter(_temp5$1).map(_temp6$1));
15864
+ } else {
15865
+ newValue_0 = [];
15866
+ onChange(null);
15867
+ }
15591
15868
  setInternalValue(newValue_0);
15869
+ };
15870
+ $[11] = multipleFilesSupported;
15871
+ $[12] = onChange;
15872
+ $[13] = setInternalValue;
15873
+ $[14] = value;
15874
+ $[15] = t6;
15875
+ } else {
15876
+ t6 = $[15];
15877
+ }
15878
+ const onClear = t6;
15879
+ const helpText = multipleFilesSupported ? "Drag 'n' drop some files here, or click to select files. Drag to reorder." : "Drag 'n' drop a file here, or click to select one";
15880
+ const renderProperty = multipleFilesSupported ? property.of : property;
15881
+ let t7;
15882
+ if ($[16] !== autoFocus || $[17] !== disabled || $[18] !== helpText || $[19] !== isDndItemDragging || $[20] !== metadata || $[21] !== multipleFilesSupported || $[22] !== name || $[23] !== onClear || $[24] !== onFileUploadComplete || $[25] !== onFilesAdded || $[26] !== renderProperty || $[27] !== storage || $[28] !== storagePathBuilder || $[29] !== value) {
15883
+ t7 = {
15884
+ storage,
15885
+ disabled,
15886
+ onFilesAdded,
15887
+ multipleFilesSupported,
15888
+ autoFocus,
15889
+ internalValue: value,
15890
+ property: renderProperty,
15891
+ onClear,
15892
+ metadata,
15893
+ storagePathBuilder,
15894
+ onFileUploadComplete,
15895
+ name,
15896
+ helpText,
15897
+ isDndItemDragging
15898
+ };
15899
+ $[16] = autoFocus;
15900
+ $[17] = disabled;
15901
+ $[18] = helpText;
15902
+ $[19] = isDndItemDragging;
15903
+ $[20] = metadata;
15904
+ $[21] = multipleFilesSupported;
15905
+ $[22] = name;
15906
+ $[23] = onClear;
15907
+ $[24] = onFileUploadComplete;
15908
+ $[25] = onFilesAdded;
15909
+ $[26] = renderProperty;
15910
+ $[27] = storage;
15911
+ $[28] = storagePathBuilder;
15912
+ $[29] = value;
15913
+ $[30] = t7;
15914
+ } else {
15915
+ t7 = $[30];
15916
+ }
15917
+ const fileDropProps = t7;
15918
+ if (multipleFilesSupported) {
15919
+ let t8;
15920
+ if ($[31] !== value) {
15921
+ t8 = value.map(_temp7);
15922
+ $[31] = value;
15923
+ $[32] = t8;
15592
15924
  } else {
15593
- onChange(null);
15594
- setInternalValue([]);
15925
+ t8 = $[32];
15595
15926
  }
15596
- }, [value, multipleFilesSupported, onChange]);
15597
- const helpText = multipleFilesSupported ? "Drag 'n' drop some files here, or click to select files" : "Drag 'n' drop a file here, or click to select one";
15598
- const renderProperty = multipleFilesSupported ? property.of : property;
15599
- return /* @__PURE__ */ jsxRuntime.jsx(dnd.DragDropContext, { onDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(dnd.Droppable, { droppableId: `droppable_${name}`, direction: "horizontal", renderClone: (provided, snapshot, rubric) => {
15600
- const entry = value[rubric.source.index];
15601
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps, style: provided.draggableProps.style, className: "rounded", children: /* @__PURE__ */ jsxRuntime.jsx(StorageItemPreview, { name: `storage_preview_${entry.storagePathOrDownloadUrl}`, placeholder: true, property: renderProperty, disabled: true, value: entry.storagePathOrDownloadUrl, onRemove: onClear, size: entry.size }) });
15602
- }, children: (provided_0, snapshot_0) => {
15603
- return /* @__PURE__ */ jsxRuntime.jsx(FileDropComponent, { storage, disabled, isDraggingOver: snapshot_0.isDraggingOver, droppableProvided: provided_0, onFilesAdded, multipleFilesSupported, autoFocus, internalValue: value, property: renderProperty, onClear, metadata, storagePathBuilder, onFileUploadComplete, size, name, helpText });
15604
- } }) });
15927
+ let t9;
15928
+ if ($[33] !== fileDropProps) {
15929
+ t9 = /* @__PURE__ */ jsxRuntime.jsx(FileDropComponent, { ...fileDropProps });
15930
+ $[33] = fileDropProps;
15931
+ $[34] = t9;
15932
+ } else {
15933
+ t9 = $[34];
15934
+ }
15935
+ let t10;
15936
+ if ($[35] !== t8 || $[36] !== t9) {
15937
+ t10 = /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: t8, strategy: sortable.horizontalListSortingStrategy, children: t9 });
15938
+ $[35] = t8;
15939
+ $[36] = t9;
15940
+ $[37] = t10;
15941
+ } else {
15942
+ t10 = $[37];
15943
+ }
15944
+ let t11;
15945
+ if ($[38] !== handleDragEnd || $[39] !== sensors || $[40] !== t10) {
15946
+ t11 = /* @__PURE__ */ jsxRuntime.jsx(core.DndContext, { sensors, collisionDetection: core.closestCenter, onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: t10 });
15947
+ $[38] = handleDragEnd;
15948
+ $[39] = sensors;
15949
+ $[40] = t10;
15950
+ $[41] = t11;
15951
+ } else {
15952
+ t11 = $[41];
15953
+ }
15954
+ return t11;
15955
+ } else {
15956
+ let t8;
15957
+ if ($[42] !== fileDropProps) {
15958
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(FileDropComponent, { ...fileDropProps, isDndItemDragging: false });
15959
+ $[42] = fileDropProps;
15960
+ $[43] = t8;
15961
+ } else {
15962
+ t8 = $[43];
15963
+ }
15964
+ return t8;
15965
+ }
15966
+ }
15967
+ function _temp7(v_2) {
15968
+ return v_2.id;
15969
+ }
15970
+ function _temp6$1(v_1) {
15971
+ return v_1.storagePathOrDownloadUrl;
15972
+ }
15973
+ function _temp5$1(v_0) {
15974
+ return !!v_0.storagePathOrDownloadUrl;
15975
+ }
15976
+ function _temp4$1(e_0) {
15977
+ return e_0.storagePathOrDownloadUrl;
15978
+ }
15979
+ function _temp3$2(e) {
15980
+ return !!e.storagePathOrDownloadUrl;
15605
15981
  }
15606
15982
  function TextFieldBinding(t0) {
15607
15983
  const $ = reactCompilerRuntime.c(52);
@@ -16420,6 +16796,7 @@
16420
16796
  error,
16421
16797
  disabled,
16422
16798
  property,
16799
+ partOfArray,
16423
16800
  minimalistView: minimalistViewProp,
16424
16801
  includeDescription,
16425
16802
  autoFocus,
@@ -16544,7 +16921,7 @@
16544
16921
  }
16545
16922
  const t6 = minimalistView && mapFormView;
16546
16923
  const t7 = showError ?? false;
16547
- const t8 = error ? typeof error === "string" ? error : "A property of this map has an error" : void 0;
16924
+ const t8 = error && !partOfArray ? typeof error === "string" ? error : "A property of this map has an error" : void 0;
16548
16925
  let t9;
16549
16926
  if ($[31] !== disabled || $[32] !== includeDescription || $[33] !== property || $[34] !== t7 || $[35] !== t8) {
16550
16927
  t9 = /* @__PURE__ */ jsxRuntime.jsx(FieldHelperText, { includeDescription, showError: t7, error: t8, disabled, property });
@@ -17395,6 +17772,7 @@
17395
17772
  minimalistView: false,
17396
17773
  autoFocus: internalId === lastAddedId
17397
17774
  };
17775
+ console.debug("Building entry for", index, fieldProps);
17398
17776
  return /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(PropertyFieldBinding, { ...fieldProps, index }) });
17399
17777
  };
17400
17778
  $[4] = context;
@@ -17411,7 +17789,7 @@
17411
17789
  }
17412
17790
  const buildEntry = t2;
17413
17791
  const canAddElements = !property.disabled && !isSubmitting && !disabled && (property.canAddElements || property.canAddElements === void 0);
17414
- const sortable = property.sortable === void 0 ? true : property.sortable;
17792
+ const sortable2 = property.sortable === void 0 ? true : property.sortable;
17415
17793
  const t3 = property.name ? "Add entry to " + property.name : "Add entry";
17416
17794
  const t4 = isSubmitting || Boolean(property.disabled);
17417
17795
  let t5;
@@ -17433,12 +17811,12 @@
17433
17811
  }
17434
17812
  const t7 = property.widthPercentage !== void 0 ? "mt-8" : void 0;
17435
17813
  let t8;
17436
- if ($[18] !== buildEntry || $[19] !== canAddElements || $[20] !== propertyKey || $[21] !== sortable || $[22] !== t3 || $[23] !== t4 || $[24] !== t5 || $[25] !== t6 || $[26] !== t7 || $[27] !== value) {
17437
- t8 = /* @__PURE__ */ jsxRuntime.jsx(ArrayContainer, { droppableId: propertyKey, addLabel: t3, value, buildEntry, onInternalIdAdded: setLastAddedId, disabled: t4, canAddElements, sortable, newDefaultEntry: t5, onValueChange: t6, className: t7 });
17814
+ if ($[18] !== buildEntry || $[19] !== canAddElements || $[20] !== propertyKey || $[21] !== sortable2 || $[22] !== t3 || $[23] !== t4 || $[24] !== t5 || $[25] !== t6 || $[26] !== t7 || $[27] !== value) {
17815
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(ArrayContainer, { droppableId: propertyKey, addLabel: t3, value, buildEntry, onInternalIdAdded: setLastAddedId, disabled: t4, canAddElements, sortable: sortable2, newDefaultEntry: t5, onValueChange: t6, className: t7 });
17438
17816
  $[18] = buildEntry;
17439
17817
  $[19] = canAddElements;
17440
17818
  $[20] = propertyKey;
17441
- $[21] = sortable;
17819
+ $[21] = sortable2;
17442
17820
  $[22] = t3;
17443
17821
  $[23] = t4;
17444
17822
  $[24] = t5;
@@ -18031,7 +18409,7 @@
18031
18409
  return t0;
18032
18410
  }
18033
18411
  function PopupFormFieldLoading(t0) {
18034
- const $ = reactCompilerRuntime.c(23);
18412
+ const $ = reactCompilerRuntime.c(21);
18035
18413
  const {
18036
18414
  tableKey,
18037
18415
  entityId,
@@ -18048,6 +18426,7 @@
18048
18426
  const dataSource = useDataSource();
18049
18427
  const [entity, setEntity] = React.useState(void 0);
18050
18428
  let t1;
18429
+ let t2;
18051
18430
  if ($[0] !== dataSource || $[1] !== entityId || $[2] !== inputCollection || $[3] !== path) {
18052
18431
  t1 = () => {
18053
18432
  if (entityId && inputCollection) {
@@ -18058,29 +18437,23 @@
18058
18437
  }).then(setEntity);
18059
18438
  }
18060
18439
  };
18440
+ t2 = [entityId, inputCollection, dataSource, path];
18061
18441
  $[0] = dataSource;
18062
18442
  $[1] = entityId;
18063
18443
  $[2] = inputCollection;
18064
18444
  $[3] = path;
18065
18445
  $[4] = t1;
18446
+ $[5] = t2;
18066
18447
  } else {
18067
18448
  t1 = $[4];
18068
- }
18069
- let t2;
18070
- if ($[5] !== entityId || $[6] !== inputCollection) {
18071
- t2 = [entityId, inputCollection];
18072
- $[5] = entityId;
18073
- $[6] = inputCollection;
18074
- $[7] = t2;
18075
- } else {
18076
- t2 = $[7];
18449
+ t2 = $[5];
18077
18450
  }
18078
18451
  React.useEffect(t1, t2);
18079
18452
  if (!entity) {
18080
18453
  return null;
18081
18454
  }
18082
18455
  let t3;
18083
- if ($[8] !== cellRect || $[9] !== container || $[10] !== customFieldValidator || $[11] !== entityId || $[12] !== inputCollection || $[13] !== onCellValueChange || $[14] !== onClose || $[15] !== open || $[16] !== path || $[17] !== propertyKey || $[18] !== tableKey) {
18456
+ if ($[6] !== cellRect || $[7] !== container || $[8] !== customFieldValidator || $[9] !== entityId || $[10] !== inputCollection || $[11] !== onCellValueChange || $[12] !== onClose || $[13] !== open || $[14] !== path || $[15] !== propertyKey || $[16] !== tableKey) {
18084
18457
  t3 = {
18085
18458
  tableKey,
18086
18459
  entityId,
@@ -18094,29 +18467,29 @@
18094
18467
  onCellValueChange,
18095
18468
  container
18096
18469
  };
18097
- $[8] = cellRect;
18098
- $[9] = container;
18099
- $[10] = customFieldValidator;
18100
- $[11] = entityId;
18101
- $[12] = inputCollection;
18102
- $[13] = onCellValueChange;
18103
- $[14] = onClose;
18104
- $[15] = open;
18105
- $[16] = path;
18106
- $[17] = propertyKey;
18107
- $[18] = tableKey;
18108
- $[19] = t3;
18470
+ $[6] = cellRect;
18471
+ $[7] = container;
18472
+ $[8] = customFieldValidator;
18473
+ $[9] = entityId;
18474
+ $[10] = inputCollection;
18475
+ $[11] = onCellValueChange;
18476
+ $[12] = onClose;
18477
+ $[13] = open;
18478
+ $[14] = path;
18479
+ $[15] = propertyKey;
18480
+ $[16] = tableKey;
18481
+ $[17] = t3;
18109
18482
  } else {
18110
- t3 = $[19];
18483
+ t3 = $[17];
18111
18484
  }
18112
18485
  let t4;
18113
- if ($[20] !== entity || $[21] !== t3) {
18486
+ if ($[18] !== entity || $[19] !== t3) {
18114
18487
  t4 = /* @__PURE__ */ jsxRuntime.jsx(PopupFormFieldInternal, { ...t3, entity });
18115
- $[20] = entity;
18116
- $[21] = t3;
18117
- $[22] = t4;
18488
+ $[18] = entity;
18489
+ $[19] = t3;
18490
+ $[20] = t4;
18118
18491
  } else {
18119
- t4 = $[22];
18492
+ t4 = $[20];
18120
18493
  }
18121
18494
  return t4;
18122
18495
  }
@@ -18158,23 +18531,26 @@
18158
18531
  y: cellRect.top < windowSize.height - cellRect.bottom ? cellRect.y + cellRect.height / 2 : cellRect.y - cellRect.height / 2
18159
18532
  };
18160
18533
  }, [cellRect, windowSize.height, windowSize.width]);
18161
- const normalizePosition = React.useCallback(({
18162
- x,
18163
- y
18164
- }) => {
18165
- const draggableBoundingRect = draggableRef.current?.getBoundingClientRect();
18166
- if (!draggableBoundingRect) throw Error("normalizePosition called before draggableBoundingRect is set");
18534
+ const normalizePosition = React.useCallback((pos, draggableBoundingRect, currentWindowSize) => {
18535
+ if (!draggableBoundingRect || draggableBoundingRect.width === 0 || draggableBoundingRect.height === 0) {
18536
+ return pos;
18537
+ }
18167
18538
  return {
18168
- x: Math.max(0, Math.min(x, windowSize.width - draggableBoundingRect.width)),
18169
- y: Math.max(0, Math.min(y, windowSize.height - draggableBoundingRect.height))
18539
+ x: Math.max(0, Math.min(pos.x, currentWindowSize.width - draggableBoundingRect.width)),
18540
+ y: Math.max(0, Math.min(pos.y, currentWindowSize.height - draggableBoundingRect.height))
18170
18541
  };
18171
- }, [windowSize]);
18172
- const updatePopupLocation = React.useCallback((position) => {
18542
+ }, []);
18543
+ const updatePopupLocation = React.useCallback((newPositionCandidate) => {
18173
18544
  const draggableBoundingRect_0 = draggableRef.current?.getBoundingClientRect();
18174
- if (!cellRect || !draggableBoundingRect_0) return;
18175
- const newPosition = position ?? normalizePosition(getInitialLocation());
18176
- if (!popupLocation || newPosition.x !== popupLocation.x || newPosition.y !== popupLocation.y) setPopupLocation(newPosition);
18177
- }, [cellRect, getInitialLocation, normalizePosition, popupLocation]);
18545
+ if (!cellRect || !draggableBoundingRect_0 || draggableBoundingRect_0.width === 0 || draggableBoundingRect_0.height === 0) {
18546
+ return;
18547
+ }
18548
+ const basePosition = newPositionCandidate ?? getInitialLocation();
18549
+ const newNormalizedPosition = normalizePosition(basePosition, draggableBoundingRect_0, windowSize);
18550
+ if (!popupLocation || newNormalizedPosition.x !== popupLocation.x || newNormalizedPosition.y !== popupLocation.y) {
18551
+ setPopupLocation(newNormalizedPosition);
18552
+ }
18553
+ }, [cellRect, getInitialLocation, normalizePosition, popupLocation, windowSize]);
18178
18554
  useDraggable({
18179
18555
  containerRef: draggableRef,
18180
18556
  innerRef,
@@ -18185,15 +18561,22 @@
18185
18561
  React.useEffect(() => {
18186
18562
  initialPositionSet.current = false;
18187
18563
  }, [propertyKey, entity]);
18188
- React.useLayoutEffect(() => {
18189
- const draggableBoundingRect_1 = draggableRef.current?.getBoundingClientRect();
18190
- if (!cellRect || !draggableBoundingRect_1 || initialPositionSet.current) return;
18191
- updatePopupLocation();
18192
- initialPositionSet.current = true;
18193
- }, [cellRect, updatePopupLocation, initialPositionSet.current]);
18564
+ React.useLayoutEffect(
18565
+ () => {
18566
+ if (!cellRect || initialPositionSet.current) return;
18567
+ const draggableBoundingRect_1 = draggableRef.current?.getBoundingClientRect();
18568
+ if (!draggableBoundingRect_1 || draggableBoundingRect_1.width === 0 || draggableBoundingRect_1.height === 0) {
18569
+ return;
18570
+ }
18571
+ updatePopupLocation();
18572
+ initialPositionSet.current = true;
18573
+ },
18574
+ [cellRect, updatePopupLocation]
18575
+ // Removed initialPositionSet.current from deps as it's a ref
18576
+ );
18194
18577
  React.useLayoutEffect(() => {
18195
18578
  updatePopupLocation(popupLocation);
18196
- }, [windowSize, cellRect]);
18579
+ }, [windowSize, cellRect, updatePopupLocation, popupLocation]);
18197
18580
  const validationSchema = React.useMemo(() => {
18198
18581
  if (!collection || !entityId) return;
18199
18582
  return getYupEntitySchema(entityId, propertyKey && collection.properties[propertyKey] ? {
@@ -18203,6 +18586,18 @@
18203
18586
  const adaptResize = React.useCallback(() => {
18204
18587
  return updatePopupLocation(popupLocation);
18205
18588
  }, [popupLocation, updatePopupLocation]);
18589
+ React.useEffect(() => {
18590
+ const element = draggableRef.current;
18591
+ if (!element) return;
18592
+ const observer = new ResizeObserver(() => {
18593
+ adaptResize();
18594
+ });
18595
+ observer.observe(element);
18596
+ return () => {
18597
+ observer.unobserve(element);
18598
+ observer.disconnect();
18599
+ };
18600
+ }, [adaptResize, draggableRef]);
18206
18601
  const saveValue = async (values) => {
18207
18602
  setSavingError(null);
18208
18603
  if (inputCollection && entity && onCellValueChange && propertyKey) {
@@ -18262,7 +18657,7 @@
18262
18657
  underlyingValueHasChanged: false,
18263
18658
  context: formContext,
18264
18659
  partOfArray: false,
18265
- minimalistView: false,
18660
+ minimalistView: true,
18266
18661
  autoFocus: open
18267
18662
  } : void 0;
18268
18663
  let internalForm = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-[700px] max-w-full max-h-[85vh]", children: /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, noValidate: true, children: [
@@ -18283,21 +18678,18 @@
18283
18678
  internalForm,
18284
18679
  savingError && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { color: "error", children: savingError.message })
18285
18680
  ] });
18286
- const draggable = /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
18681
+ const draggable = /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
18287
18682
  boxShadow: "0 0 0 2px rgba(128,128,128,0.2)"
18288
- }, className: `inline-block fixed z-20 shadow-outline rounded-md bg-white dark:bg-surface-950 ${!open ? "invisible" : "visible"} cursor-grab overflow-visible`, ref: draggableRef, children: [
18289
- /* @__PURE__ */ jsxRuntime.jsx(ElementResizeListener, { onResize: adaptResize }),
18290
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-hidden", children: [
18291
- form,
18292
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-3.5 -right-3.5 bg-surface-500 rounded-full", style: {
18293
- width: "32px",
18294
- height: "32px"
18295
- }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: (event) => {
18296
- event.stopPropagation();
18297
- onClose();
18298
- }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { className: "text-white", size: "small" }) }) })
18299
- ] })
18300
- ] }, `draggable_${propertyKey}_${entityId}_${open}`);
18683
+ }, className: `inline-block fixed z-20 shadow-outline rounded-md bg-white dark:bg-surface-950 ${!open ? "invisible" : "visible"} cursor-grab overflow-visible`, ref: draggableRef, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "overflow-hidden", children: [
18684
+ form,
18685
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute -top-3.5 -right-3.5 bg-surface-500 rounded-full", style: {
18686
+ width: "32px",
18687
+ height: "32px"
18688
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", onClick: (event) => {
18689
+ event.stopPropagation();
18690
+ onClose();
18691
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { className: "text-white", size: "small" }) }) })
18692
+ ] }) }, `draggable_${propertyKey}_${entityId}_${open}`);
18301
18693
  return /* @__PURE__ */ jsxRuntime.jsx(Portal__namespace.Root, { asChild: true, container, children: /* @__PURE__ */ jsxRuntime.jsx(formex.Formex, { value: formex$1, children: draggable }) });
18302
18694
  }
18303
18695
  function ClearFilterSortButton(t0) {
@@ -18314,7 +18706,7 @@
18314
18706
  if ((filterIsSet || sortIsSet) && (tableController.clearFilter || tableController.setSortBy)) {
18315
18707
  let label;
18316
18708
  if (filterIsSet && sortIsSet) {
18317
- label = "Clear filter and sort";
18709
+ label = "Clear filter/sort";
18318
18710
  } else {
18319
18711
  if (filterIsSet) {
18320
18712
  label = "Clear filter";
@@ -18692,7 +19084,7 @@
18692
19084
  dependencies: [],
18693
19085
  Builder: ({
18694
19086
  entity: entity_3
18695
- }) => /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { color: "primary", variant: "outlined", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardTabIcon, { size: "small" }), onClick: (event) => {
19087
+ }) => /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { color: "primary", variant: "outlined", className: "max-w-full truncate justify-start", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardTabIcon, { size: "small" }), onClick: (event) => {
18696
19088
  event.stopPropagation();
18697
19089
  navigateToEntity({
18698
19090
  openEntityMode,
@@ -18803,7 +19195,7 @@
18803
19195
  deleteEntityClicked && /* @__PURE__ */ jsxRuntime.jsx(DeleteEntityDialog, { entityOrEntitiesToDelete: deleteEntityClicked, path: fullPath, collection, callbacks: collection.callbacks, open: Boolean(deleteEntityClicked), onEntityDelete: internalOnEntityDelete, onMultipleEntitiesDelete: internalOnMultipleEntitiesDelete, onClose: () => setDeleteEntityClicked(void 0) })
18804
19196
  ] });
18805
19197
  }, (a, b) => {
18806
- return equal(a.path, b.path) && equal(a.parentCollectionIds, b.parentCollectionIds) && equal(a.isSubCollection, b.isSubCollection) && equal(a.className, b.className) && equal(a.properties, b.properties) && equal(a.propertiesOrder, b.propertiesOrder) && equal(a.hideIdFromCollection, b.hideIdFromCollection) && equal(a.inlineEditing, b.inlineEditing) && equal(a.selectionEnabled, b.selectionEnabled) && equal(a.selectionController, b.selectionController) && equal(a.Actions, b.Actions) && equal(a.defaultSize, b.defaultSize) && equal(a.initialFilter, b.initialFilter) && equal(a.initialSort, b.initialSort) && equal(a.textSearchEnabled, b.textSearchEnabled) && equal(a.additionalFields, b.additionalFields) && equal(a.sideDialogWidth, b.sideDialogWidth) && equal(a.openEntityMode, b.openEntityMode) && equal(a.forceFilter, b.forceFilter);
19198
+ return equal(a.path, b.path) && equal(a.parentCollectionIds, b.parentCollectionIds) && equal(a.isSubCollection, b.isSubCollection) && equal(a.className, b.className) && equal(a.properties, b.properties) && equal(a.propertiesOrder, b.propertiesOrder) && equal(a.hideIdFromCollection, b.hideIdFromCollection) && equal(a.inlineEditing, b.inlineEditing) && equal(a.selectionEnabled, b.selectionEnabled) && equal(a.selectionController, b.selectionController) && equal(a.Actions, b.Actions) && equal(a.defaultSize, b.defaultSize) && equal(a.initialFilter, b.initialFilter) && equal(a.initialSort, b.initialSort) && equal(a.includeJsonView, b.includeJsonView) && equal(a.textSearchEnabled, b.textSearchEnabled) && equal(a.additionalFields, b.additionalFields) && equal(a.sideDialogWidth, b.sideDialogWidth) && equal(a.openEntityMode, b.openEntityMode) && equal(a.exportable, b.exportable) && equal(a.history, b.history) && equal(a.forceFilter, b.forceFilter);
18807
19199
  });
18808
19200
  function EntitiesCount({
18809
19201
  fullPath,
@@ -19122,7 +19514,7 @@
19122
19514
  }
19123
19515
  let t5;
19124
19516
  if ($[8] !== loading || $[9] !== onAccept) {
19125
- t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { color: "primary", type: "submit", loading, onClick: onAccept, children: "Ok" });
19517
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { color: "primary", type: "submit", loading, onClick: onAccept, autoFocus: true, children: "Ok" });
19126
19518
  $[8] = loading;
19127
19519
  $[9] = onAccept;
19128
19520
  $[10] = t5;
@@ -19534,227 +19926,182 @@
19534
19926
  ...a,
19535
19927
  ...b
19536
19928
  }), {}) : {};
19537
- function ArrayContainer({
19538
- droppableId,
19539
- addLabel,
19540
- value,
19541
- disabled = false,
19929
+ function SortableItem({
19930
+ id,
19931
+ index,
19932
+ size,
19933
+ disabled,
19542
19934
  buildEntry,
19543
- size = "medium",
19544
- onInternalIdAdded,
19545
- includeAddButton: deprecatedIncludeAddButton,
19546
- canAddElements: canAddElementsProp = true,
19547
- sortable = true,
19548
- newDefaultEntry,
19549
- onValueChange,
19550
- className,
19551
- min = 0,
19552
- max = Infinity
19935
+ remove,
19936
+ copy,
19937
+ addInIndex,
19938
+ canAddElements,
19939
+ sortable: sortable$1,
19940
+ storedProps,
19941
+ updateItemCustomProps
19553
19942
  }) {
19554
- const canAddElements = (canAddElementsProp || canAddElementsProp === void 0) && (deprecatedIncludeAddButton === void 0 || deprecatedIncludeAddButton);
19555
- const hasValue = value && Array.isArray(value) && value.length > 0;
19556
- const internalIdsRef = React.useRef(buildIdsMap(value));
19557
- const [internalIds, setInternalIds] = React.useState(hasValue ? Object.values(internalIdsRef.current) : []);
19558
- const itemCustomPropsRef = React.useRef({});
19559
- const updateItemCustomProps = React.useCallback((internalId, customProps) => {
19560
- itemCustomPropsRef.current[internalId] = customProps;
19561
- }, []);
19562
- React.useEffect(() => {
19563
- if (hasValue && value && value.length !== internalIds.length) {
19564
- const newInternalIds = value.map((v, index) => {
19565
- const hashValue = getHashValue(v) + index;
19566
- if (hashValue in internalIdsRef.current) {
19567
- return internalIdsRef.current[hashValue];
19568
- } else {
19569
- const newInternalId = getRandomId();
19570
- internalIdsRef.current[hashValue] = newInternalId;
19571
- return newInternalId;
19572
- }
19573
- });
19574
- setInternalIds(newInternalIds);
19575
- }
19576
- }, [hasValue, internalIds.length, value]);
19577
- const insertInEnd = (e) => {
19578
- e.preventDefault();
19579
- if (disabled || (value ?? []).length >= max) return;
19580
- const id = getRandomId();
19581
- const newIds = [...internalIds, id];
19582
- if (onInternalIdAdded) onInternalIdAdded(id);
19583
- setInternalIds(newIds);
19584
- onValueChange([...value ?? [], newDefaultEntry]);
19585
- };
19586
- const remove = (index_0) => {
19587
- if ((value ?? []).length <= min) return;
19588
- const newIds_0 = [...internalIds];
19589
- newIds_0.splice(index_0, 1);
19590
- setInternalIds(newIds_0);
19591
- onValueChange(value.filter((_, i) => i !== index_0));
19592
- };
19593
- const copy = (index_1) => {
19594
- if ((value ?? []).length >= max) return;
19595
- const id_0 = getRandomId();
19596
- const copyingItem = value[index_1];
19597
- const newIds_1 = [...internalIds.slice(0, index_1 + 1), id_0, ...internalIds.slice(index_1 + 1)];
19598
- if (onInternalIdAdded) onInternalIdAdded(id_0);
19599
- setInternalIds(newIds_1);
19600
- onValueChange([...value.slice(0, index_1 + 1), copyingItem, ...value.slice(index_1 + 1)]);
19601
- };
19602
- const addInIndex = (index_2) => {
19603
- if ((value ?? []).length >= max) return;
19604
- const id_1 = getRandomId();
19605
- const newIds_2 = [...internalIds.slice(0, index_2), id_1, ...internalIds.slice(index_2)];
19606
- if (onInternalIdAdded) onInternalIdAdded(id_1);
19607
- setInternalIds(newIds_2);
19608
- onValueChange([...value.slice(0, index_2), newDefaultEntry, ...value.slice(index_2)]);
19609
- };
19610
- const onDragEnd = (result) => {
19611
- if (!result.destination) {
19612
- return;
19613
- }
19614
- const sourceIndex = result.source.index;
19615
- const destinationIndex = result.destination.index;
19616
- const newIds_3 = [...internalIds];
19617
- const temp = newIds_3[sourceIndex];
19618
- newIds_3[sourceIndex] = newIds_3[destinationIndex];
19619
- newIds_3[destinationIndex] = temp;
19620
- setInternalIds(newIds_3);
19621
- onValueChange(arrayMove(value, sourceIndex, destinationIndex));
19943
+ const {
19944
+ attributes,
19945
+ listeners: listeners2,
19946
+ setNodeRef,
19947
+ transform,
19948
+ transition,
19949
+ isDragging
19950
+ } = sortable$1 ? sortable.useSortable({
19951
+ id
19952
+ }) : {
19953
+ attributes: {},
19954
+ listeners: {},
19955
+ setNodeRef: (node) => {
19956
+ },
19957
+ transform: null,
19958
+ transition: void 0,
19959
+ isDragging: false
19622
19960
  };
19623
- return /* @__PURE__ */ jsxRuntime.jsx(dnd.DragDropContext, { onDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(dnd.Droppable, { droppableId, renderClone: (provided, snapshot, rubric) => {
19624
- const index_3 = rubric.source.index;
19625
- const internalId_0 = internalIds[index_3];
19626
- return /* @__PURE__ */ jsxRuntime.jsx(ArrayContainerItem, { provided, internalId: internalId_0, index: index_3, size, disabled, buildEntry, remove, copy, isDragging: snapshot.isDragging, storedProps: itemCustomPropsRef.current[internalId_0], updateItemCustomProps, addInIndex, canAddElements, sortable });
19627
- }, children: (droppableProvided, droppableSnapshot) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("space-y-1", className), ...droppableProvided.droppableProps, ref: droppableProvided.innerRef, children: [
19628
- hasValue && internalIds.map((internalId_1, index_4) => {
19629
- return /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: `array_field_${internalId_1}`, isDragDisabled: disabled || !sortable, index: index_4, children: (provided_0, snapshot_0) => /* @__PURE__ */ jsxRuntime.jsx(ArrayContainerItem, { provided: provided_0, internalId: internalId_1, index: index_4, size, disabled, buildEntry, remove, copy, isDragging: snapshot_0.isDragging, storedProps: itemCustomPropsRef.current[internalId_1], updateItemCustomProps, addInIndex, canAddElements, sortable }) }, `array_field_${internalId_1}`);
19630
- }),
19631
- droppableProvided.placeholder,
19632
- canAddElements && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-4 justify-center text-left", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", size: size === "small" ? "small" : "medium", color: "primary", disabled: disabled || value?.length >= max, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: insertInEnd, children: addLabel ?? "Add" }) })
19633
- ] }) }) });
19961
+ const style = transform ? {
19962
+ transform: utilities.CSS.Transform.toString(transform),
19963
+ transition
19964
+ } : {};
19965
+ const dragHandleProps = sortable$1 ? {
19966
+ ...listeners2,
19967
+ ...attributes
19968
+ } : {};
19969
+ return /* @__PURE__ */ jsxRuntime.jsx(ArrayContainerItem, { nodeRef: setNodeRef, style, dragHandleProps, internalId: id, index, size, disabled, buildEntry, remove, copy, addInIndex, canAddElements, sortable: sortable$1, isDragging, storedProps, updateItemCustomProps });
19634
19970
  }
19635
19971
  function ArrayContainerItem(t0) {
19636
19972
  const $ = reactCompilerRuntime.c(30);
19637
19973
  const {
19638
- provided,
19974
+ nodeRef,
19975
+ style,
19976
+ dragHandleProps,
19639
19977
  index,
19640
19978
  internalId,
19641
19979
  size,
19642
19980
  disabled,
19643
19981
  buildEntry,
19644
19982
  remove,
19983
+ copy,
19645
19984
  addInIndex,
19646
19985
  canAddElements,
19647
- sortable,
19648
- copy,
19986
+ sortable: sortable2,
19649
19987
  isDragging,
19650
19988
  storedProps,
19651
19989
  updateItemCustomProps
19652
19990
  } = t0;
19653
- const t1 = provided.innerRef;
19654
- const t2 = provided.draggableProps;
19655
- const t3 = provided.draggableProps.style;
19656
- const t4 = `relative ${!isDragging ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 dark:hover:bg-opacity-20" : ""} rounded-md opacity-100`;
19657
- let t5;
19991
+ const t1 = `relative ${!isDragging ? "hover\\:bg-surface-accent-50 dark\\:hover\\:bg-surface-800 dark\\:hover\\:bg-opacity-20" : ""} rounded-md opacity-100`;
19992
+ let t2;
19658
19993
  if ($[0] !== internalId || $[1] !== updateItemCustomProps) {
19659
- t5 = (props) => updateItemCustomProps(internalId, props);
19994
+ t2 = (props) => updateItemCustomProps(internalId, props);
19660
19995
  $[0] = internalId;
19661
19996
  $[1] = updateItemCustomProps;
19662
- $[2] = t5;
19997
+ $[2] = t2;
19663
19998
  } else {
19664
- t5 = $[2];
19999
+ t2 = $[2];
19665
20000
  }
19666
- let t6;
19667
- if ($[3] !== buildEntry || $[4] !== index || $[5] !== internalId || $[6] !== isDragging || $[7] !== storedProps || $[8] !== t5) {
19668
- t6 = buildEntry({
20001
+ let t3;
20002
+ if ($[3] !== buildEntry || $[4] !== index || $[5] !== internalId || $[6] !== isDragging || $[7] !== storedProps || $[8] !== t2) {
20003
+ t3 = buildEntry({
19669
20004
  index,
19670
20005
  internalId,
19671
20006
  isDragging,
19672
20007
  storedProps,
19673
- storeProps: t5
20008
+ storeProps: t2
19674
20009
  });
19675
20010
  $[3] = buildEntry;
19676
20011
  $[4] = index;
19677
20012
  $[5] = internalId;
19678
20013
  $[6] = isDragging;
19679
20014
  $[7] = storedProps;
19680
- $[8] = t5;
19681
- $[9] = t6;
20015
+ $[8] = t2;
20016
+ $[9] = t3;
19682
20017
  } else {
19683
- t6 = $[9];
20018
+ t3 = $[9];
19684
20019
  }
19685
- let t7;
19686
- if ($[10] !== t6) {
19687
- t7 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark", children: t6 });
19688
- $[10] = t6;
19689
- $[11] = t7;
20020
+ let t4;
20021
+ if ($[10] !== t3) {
20022
+ t4 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark", children: t3 });
20023
+ $[10] = t3;
20024
+ $[11] = t4;
19690
20025
  } else {
19691
- t7 = $[11];
20026
+ t4 = $[11];
19692
20027
  }
19693
- const t8 = size === "small" ? "row" : "column";
19694
- let t9;
19695
- if ($[12] !== addInIndex || $[13] !== canAddElements || $[14] !== copy || $[15] !== disabled || $[16] !== index || $[17] !== provided || $[18] !== remove || $[19] !== sortable || $[20] !== t8) {
19696
- t9 = /* @__PURE__ */ jsxRuntime.jsx(ArrayItemOptions, { direction: t8, disabled, remove, index, provided, addInIndex, canAddElements, sortable, copy });
20028
+ const t5 = size === "small" ? "row" : "column";
20029
+ let t6;
20030
+ if ($[12] !== addInIndex || $[13] !== canAddElements || $[14] !== copy || $[15] !== disabled || $[16] !== dragHandleProps || $[17] !== index || $[18] !== remove || $[19] !== sortable2 || $[20] !== t5) {
20031
+ t6 = /* @__PURE__ */ jsxRuntime.jsx(ArrayItemOptions, { dragHandleProps, direction: t5, disabled, remove, index, copy, canAddElements, sortable: sortable2, addInIndex });
19697
20032
  $[12] = addInIndex;
19698
20033
  $[13] = canAddElements;
19699
20034
  $[14] = copy;
19700
20035
  $[15] = disabled;
19701
- $[16] = index;
19702
- $[17] = provided;
20036
+ $[16] = dragHandleProps;
20037
+ $[17] = index;
19703
20038
  $[18] = remove;
19704
- $[19] = sortable;
19705
- $[20] = t8;
19706
- $[21] = t9;
20039
+ $[19] = sortable2;
20040
+ $[20] = t5;
20041
+ $[21] = t6;
19707
20042
  } else {
19708
- t9 = $[21];
20043
+ t6 = $[21];
19709
20044
  }
19710
- let t10;
19711
- if ($[22] !== t7 || $[23] !== t9) {
19712
- t10 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start", children: [
19713
- t7,
19714
- t9
20045
+ let t7;
20046
+ if ($[22] !== t4 || $[23] !== t6) {
20047
+ t7 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start", children: [
20048
+ t4,
20049
+ t6
19715
20050
  ] });
19716
- $[22] = t7;
19717
- $[23] = t9;
19718
- $[24] = t10;
20051
+ $[22] = t4;
20052
+ $[23] = t6;
20053
+ $[24] = t7;
19719
20054
  } else {
19720
- t10 = $[24];
20055
+ t7 = $[24];
19721
20056
  }
19722
- let t11;
19723
- if ($[25] !== provided.draggableProps || $[26] !== provided.innerRef || $[27] !== t10 || $[28] !== t4) {
19724
- t11 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: t1, ...t2, style: t3, className: t4, children: t10 });
19725
- $[25] = provided.draggableProps;
19726
- $[26] = provided.innerRef;
19727
- $[27] = t10;
19728
- $[28] = t4;
19729
- $[29] = t11;
20057
+ let t8;
20058
+ if ($[25] !== nodeRef || $[26] !== style || $[27] !== t1 || $[28] !== t7) {
20059
+ t8 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: nodeRef, style, className: t1, children: t7 });
20060
+ $[25] = nodeRef;
20061
+ $[26] = style;
20062
+ $[27] = t1;
20063
+ $[28] = t7;
20064
+ $[29] = t8;
19730
20065
  } else {
19731
- t11 = $[29];
20066
+ t8 = $[29];
19732
20067
  }
19733
- return t11;
20068
+ return t8;
19734
20069
  }
19735
20070
  function ArrayItemOptions({
20071
+ dragHandleProps,
19736
20072
  direction,
19737
20073
  disabled,
19738
20074
  remove,
19739
20075
  index,
19740
- provided,
19741
20076
  copy,
19742
20077
  canAddElements,
19743
- sortable,
20078
+ sortable: sortable2,
19744
20079
  addInIndex
19745
20080
  }) {
19746
20081
  const [menuOpen, setMenuOpen] = React.useState(false);
19747
20082
  const iconRef = React.useRef(null);
19748
- ui.useOutsideAlerter(iconRef, () => setMenuOpen(false));
19749
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `pl-2 pt-1 pb-1 flex ${direction === "row" ? "flex-row-reverse" : "flex-col"} items-center`, ref: iconRef, ...provided.dragHandleProps, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Tooltip, { delayDuration: 400, open: menuOpen ? false : void 0, side: direction === "column" ? "left" : void 0, title: !disabled && sortable ? "Drag to move. Click for more options" : void 0, children: [
19750
- /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", disabled: disabled || !canAddElements, onClick: (e) => {
20083
+ ui.useOutsideAlerter(iconRef, () => {
20084
+ if (menuOpen) setMenuOpen(false);
20085
+ });
20086
+ const showMenu = canAddElements ?? false;
20087
+ const handleIconButtonClick = (e) => {
20088
+ if (showMenu) {
20089
+ e.stopPropagation();
19751
20090
  e.preventDefault();
19752
- setMenuOpen(true);
19753
- }, onDragStart: (e_0) => {
19754
- setMenuOpen(false);
19755
- }, className: disabled || !sortable ? "cursor-inherit" : "cursor-grab", children: /* @__PURE__ */ jsxRuntime.jsx(ui.HandleIcon, {}) }),
19756
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Menu, { portalContainer: iconRef.current, open: menuOpen, trigger: /* @__PURE__ */ jsxRuntime.jsx("div", { tabIndex: -1 }), children: [
19757
- /* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { dense: true, onClick: (e_1) => {
20091
+ setMenuOpen((o) => !o);
20092
+ } else if (sortable2) ;
20093
+ else {
20094
+ e.stopPropagation();
20095
+ e.preventDefault();
20096
+ }
20097
+ };
20098
+ const title = !disabled && sortable2 && showMenu ? "Drag to move. Click for options" : !disabled && showMenu ? "Click for options" : !disabled && sortable2 ? "Drag to move" : void 0;
20099
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: iconRef, className: `pl-2 pt-1 pb-1 flex ${direction === "row" ? "flex-row-reverse" : "flex-col"} items-center`, children: [
20100
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { delayDuration: 400, open: menuOpen ? false : void 0, side: direction === "column" ? "left" : void 0, title, children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "small", disabled: disabled || !showMenu && !sortable2, ...sortable2 ? dragHandleProps : {}, onClick: handleIconButtonClick, onFocus: () => {
20101
+ if (sortable2 && menuOpen) setMenuOpen(false);
20102
+ }, className: ui.cls(disabled || !sortable2 && !showMenu ? "cursor-inherit" : "", sortable2 && !disabled ? "cursor-grab" : "", !sortable2 && showMenu && !disabled ? "cursor-pointer" : ""), children: /* @__PURE__ */ jsxRuntime.jsx(ui.HandleIcon, {}) }) }),
20103
+ showMenu && /* @__PURE__ */ jsxRuntime.jsxs(ui.Menu, { portalContainer: iconRef.current, open: menuOpen, trigger: /* @__PURE__ */ jsxRuntime.jsx("div", { tabIndex: -1 }), children: [
20104
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { dense: true, onClick: (e_0) => {
19758
20105
  setMenuOpen(false);
19759
20106
  remove(index);
19760
20107
  }, children: [
@@ -19783,7 +20130,110 @@
19783
20130
  "Add below"
19784
20131
  ] })
19785
20132
  ] })
19786
- ] }) });
20133
+ ] });
20134
+ }
20135
+ function ArrayContainer({
20136
+ droppableId,
20137
+ addLabel,
20138
+ value,
20139
+ disabled = false,
20140
+ buildEntry,
20141
+ size = "medium",
20142
+ onInternalIdAdded,
20143
+ includeAddButton: deprecatedIncludeAddButton,
20144
+ canAddElements: canAddElementsProp = true,
20145
+ sortable: sortable$1 = true,
20146
+ newDefaultEntry,
20147
+ onValueChange,
20148
+ className,
20149
+ min = 0,
20150
+ max = Infinity
20151
+ }) {
20152
+ const canAddElements = (canAddElementsProp === void 0 ? true : canAddElementsProp) && // Default canAddElementsProp to true if undefined
20153
+ (deprecatedIncludeAddButton === void 0 || deprecatedIncludeAddButton);
20154
+ const hasValue = value && Array.isArray(value) && value.length > 0;
20155
+ const internalIdsRef = React.useRef(buildIdsMap(value));
20156
+ const [internalIds, setInternalIds] = React.useState(hasValue ? Object.values(internalIdsRef.current) : []);
20157
+ const itemCustomPropsRef = React.useRef({});
20158
+ const updateItemCustomProps = React.useCallback((internalId, customProps) => {
20159
+ itemCustomPropsRef.current[internalId] = customProps;
20160
+ }, []);
20161
+ const pointerSensor = core.useSensor(core.PointerSensor, {
20162
+ activationConstraint: {
20163
+ distance: 5
20164
+ }
20165
+ });
20166
+ const keyboardSensor = core.useSensor(core.KeyboardSensor, {});
20167
+ const sensors = core.useSensors(pointerSensor, keyboardSensor);
20168
+ React.useEffect(() => {
20169
+ if (hasValue && value && value.length !== internalIds.length) {
20170
+ const newInternalIds = value.map((v, index) => {
20171
+ const hashValue = getHashValue(v) + index;
20172
+ if (hashValue in internalIdsRef.current) {
20173
+ return internalIdsRef.current[hashValue];
20174
+ } else {
20175
+ const newInternalId = getRandomId();
20176
+ internalIdsRef.current[hashValue] = newInternalId;
20177
+ return newInternalId;
20178
+ }
20179
+ });
20180
+ setInternalIds(newInternalIds);
20181
+ }
20182
+ }, [hasValue, internalIds.length, value]);
20183
+ const insertInEnd = (e) => {
20184
+ e.preventDefault();
20185
+ if (disabled || (value ?? []).length >= max) return;
20186
+ const id = getRandomId();
20187
+ const newIds = [...internalIds, id];
20188
+ if (onInternalIdAdded) onInternalIdAdded(id);
20189
+ setInternalIds(newIds);
20190
+ onValueChange([...value ?? [], newDefaultEntry]);
20191
+ };
20192
+ const remove = (index_0) => {
20193
+ if ((value ?? []).length <= min) return;
20194
+ const newIds_0 = [...internalIds];
20195
+ newIds_0.splice(index_0, 1);
20196
+ setInternalIds(newIds_0);
20197
+ onValueChange(value.filter((_, i) => i !== index_0));
20198
+ };
20199
+ const copy = (index_1) => {
20200
+ if ((value ?? []).length >= max) return;
20201
+ const id_0 = getRandomId();
20202
+ const copyingItem = value[index_1];
20203
+ const newIds_1 = [...internalIds.slice(0, index_1 + 1), id_0, ...internalIds.slice(index_1 + 1)];
20204
+ if (onInternalIdAdded) onInternalIdAdded(id_0);
20205
+ setInternalIds(newIds_1);
20206
+ onValueChange([...value.slice(0, index_1 + 1), copyingItem, ...value.slice(index_1 + 1)]);
20207
+ };
20208
+ const addInIndex = (index_2) => {
20209
+ if ((value ?? []).length >= max) return;
20210
+ const id_1 = getRandomId();
20211
+ const newIds_2 = [...internalIds.slice(0, index_2), id_1, ...internalIds.slice(index_2)];
20212
+ if (onInternalIdAdded) onInternalIdAdded(id_1);
20213
+ setInternalIds(newIds_2);
20214
+ onValueChange([...value.slice(0, index_2), newDefaultEntry, ...value.slice(index_2)]);
20215
+ };
20216
+ const onDragEnd = (event) => {
20217
+ const {
20218
+ active,
20219
+ over
20220
+ } = event;
20221
+ if (!over || active.id === over.id) return;
20222
+ const oldIndex = internalIds.indexOf(active.id);
20223
+ const newIndex = internalIds.indexOf(over.id);
20224
+ if (oldIndex === -1 || newIndex === -1) return;
20225
+ const newIds_3 = arrayMove(internalIds, oldIndex, newIndex);
20226
+ setInternalIds(newIds_3);
20227
+ onValueChange(arrayMove(value, oldIndex, newIndex));
20228
+ };
20229
+ return sortable$1 ? /* @__PURE__ */ jsxRuntime.jsx(core.DndContext, { sensors, modifiers: [modifiers.restrictToVerticalAxis], collisionDetection: core.closestCenter, onDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(sortable.SortableContext, { items: internalIds, strategy: sortable.verticalListSortingStrategy, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("space-y-1", className), id: droppableId, children: [
20230
+ hasValue && internalIds.map((internalId_0, index_3) => /* @__PURE__ */ jsxRuntime.jsx(SortableItem, { id: internalId_0, index: index_3, size, disabled, buildEntry, remove, copy, addInIndex, canAddElements, sortable: sortable$1, storedProps: itemCustomPropsRef.current[internalId_0], updateItemCustomProps }, `array_field_${internalId_0}`)),
20231
+ canAddElements && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-4 justify-center text-left", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", size: size === "small" ? "small" : "medium", color: "primary", disabled: disabled || (value?.length ?? 0) >= max, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: insertInEnd, className: "ml-3.5", children: addLabel ?? "Add" }) })
20232
+ ] }) }) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("space-y-1", className), id: droppableId, children: [
20233
+ hasValue && internalIds.map((internalId_1, index_4) => /* @__PURE__ */ jsxRuntime.jsx(ArrayContainerItem, { nodeRef: (node) => {
20234
+ }, style: {}, dragHandleProps: {}, internalId: internalId_1, index: index_4, size, disabled, buildEntry, remove, copy, addInIndex, canAddElements, sortable: false, isDragging: false, storedProps: itemCustomPropsRef.current[internalId_1], updateItemCustomProps }, `array_field_${internalId_1}`)),
20235
+ canAddElements && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-4 justify-center text-left", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", size: size === "small" ? "small" : "medium", color: "primary", disabled: disabled || (value?.length ?? 0) >= max, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: insertInEnd, children: addLabel ?? "Add" }) })
20236
+ ] });
19787
20237
  }
19788
20238
  function arrayMove(value, sourceIndex, destinationIndex) {
19789
20239
  const result = Array.from(value);
@@ -20126,9 +20576,9 @@
20126
20576
  views: viewsProp,
20127
20577
  adminViews: adminViewsProp,
20128
20578
  viewsOrder,
20579
+ plugins,
20129
20580
  userConfigPersistence,
20130
20581
  dataSourceDelegate,
20131
- injectCollections,
20132
20582
  disabled
20133
20583
  } = props;
20134
20584
  const navigate = reactRouterDom.useNavigate();
@@ -20218,7 +20668,7 @@
20218
20668
  if (disabled || authController.initialLoading) return;
20219
20669
  console.debug("Refreshing navigation");
20220
20670
  try {
20221
- const [resolvedCollections = [], resolvedViews, resolvedAdminViews = []] = await Promise.all([resolveCollections(collectionsProp, collectionPermissions, authController, dataSourceDelegate, injectCollections), resolveCMSViews(viewsProp, authController, dataSourceDelegate), resolveCMSViews(adminViewsProp, authController, dataSourceDelegate)]);
20671
+ const [resolvedCollections = [], resolvedViews, resolvedAdminViews = []] = await Promise.all([resolveCollections(collectionsProp, collectionPermissions, authController, dataSourceDelegate, plugins), resolveCMSViews(viewsProp, authController, dataSourceDelegate), resolveCMSViews(adminViewsProp, authController, dataSourceDelegate)]);
20222
20672
  let shouldUpdateTopLevelNav = false;
20223
20673
  if (!areCollectionListsEqual(collectionsRef.current ?? [], resolvedCollections)) {
20224
20674
  collectionsRef.current = resolvedCollections;
@@ -20247,7 +20697,7 @@
20247
20697
  }
20248
20698
  if (navigationLoading) setNavigationLoading(false);
20249
20699
  if (!initialised) setInitialised(true);
20250
- }, [collectionsProp, collectionPermissions, authController.user, authController.initialLoading, disabled, viewsProp, adminViewsProp, computeTopNavigation, injectCollections]);
20700
+ }, [collectionsProp, collectionPermissions, authController.user, authController.initialLoading, disabled, viewsProp, adminViewsProp, computeTopNavigation]);
20251
20701
  React.useEffect(() => {
20252
20702
  refreshNavigation();
20253
20703
  }, [refreshNavigation]);
@@ -20370,7 +20820,8 @@
20370
20820
  getParentReferencesFromPath: getAllParentReferencesForPath,
20371
20821
  getParentCollectionIds,
20372
20822
  convertIdsToPaths,
20373
- navigate
20823
+ navigate,
20824
+ plugins
20374
20825
  };
20375
20826
  }
20376
20827
  function encodePath(input) {
@@ -20389,7 +20840,19 @@
20389
20840
  };
20390
20841
  });
20391
20842
  }
20392
- async function resolveCollections(collections, collectionPermissions, authController, dataSource, injectCollections) {
20843
+ function applyPluginModifyCollection(resolvedCollections, modifyCollection) {
20844
+ return resolvedCollections.map((collection) => {
20845
+ const modifiedCollection = modifyCollection(collection);
20846
+ if (modifiedCollection.subcollections) {
20847
+ return {
20848
+ ...modifiedCollection,
20849
+ subcollections: applyPluginModifyCollection(modifiedCollection.subcollections, modifyCollection)
20850
+ };
20851
+ }
20852
+ return modifiedCollection;
20853
+ });
20854
+ }
20855
+ async function resolveCollections(collections, collectionPermissions, authController, dataSource, plugins) {
20393
20856
  let resolvedCollections = [];
20394
20857
  if (typeof collections === "function") {
20395
20858
  resolvedCollections = await collections({
@@ -20400,8 +20863,15 @@
20400
20863
  } else if (Array.isArray(collections)) {
20401
20864
  resolvedCollections = collections;
20402
20865
  }
20403
- if (injectCollections) {
20404
- resolvedCollections = injectCollections(resolvedCollections ?? []);
20866
+ if (plugins) {
20867
+ for (const plugin of plugins) {
20868
+ if (plugin.collection?.modifyCollection) {
20869
+ resolvedCollections = applyPluginModifyCollection(resolvedCollections, plugin.collection.modifyCollection);
20870
+ }
20871
+ if (plugin.collection?.injectCollections) {
20872
+ resolvedCollections = plugin.collection.injectCollections(resolvedCollections ?? []);
20873
+ }
20874
+ }
20405
20875
  }
20406
20876
  resolvedCollections = applyPermissionsFunctionIfEmpty(resolvedCollections, collectionPermissions);
20407
20877
  resolvedCollections = filterOutNotAllowedCollections(resolvedCollections, authController);
@@ -21322,10 +21792,11 @@
21322
21792
  }, [selectedTabProp]);
21323
21793
  const subcollections = (collection.subcollections ?? []).filter((c) => !c.hideFromNavigation);
21324
21794
  const subcollectionsCount = subcollections?.length ?? 0;
21325
- const customViews = collection.entityViews;
21795
+ const customViews = collection.entityViews ?? [];
21326
21796
  const customViewsCount = customViews?.length ?? 0;
21327
21797
  const includeJsonView = collection.includeJsonView === void 0 ? true : collection.includeJsonView;
21328
21798
  const hasAdditionalViews = customViewsCount > 0 || subcollectionsCount > 0 || includeJsonView;
21799
+ const plugins = customizationController.plugins;
21329
21800
  const {
21330
21801
  resolvedEntityViews,
21331
21802
  selectedEntityView,
@@ -21342,7 +21813,6 @@
21342
21813
  return null;
21343
21814
  }
21344
21815
  if (!entityId) {
21345
- console.error("INTERNAL: entityId is not defined");
21346
21816
  return null;
21347
21817
  }
21348
21818
  const formexStub = createFormexStub(usedEntity?.values ?? {});
@@ -21374,7 +21844,7 @@
21374
21844
  };
21375
21845
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls(ui.defaultBorderMixin, "relative flex-1 w-full h-full overflow-auto", {
21376
21846
  "hidden": selectedTab !== customView.key
21377
- }), role: "tabpanel", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: usedFormContext && /* @__PURE__ */ jsxRuntime.jsx(Builder, { collection, entity: usedEntity, modifiedValues: usedFormContext?.formex?.values ?? usedEntity?.values, formContext: usedFormContext }) }) }, `custom_view_${customView.key}`);
21847
+ }), role: "tabpanel", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: usedFormContext && /* @__PURE__ */ jsxRuntime.jsx(Builder, { collection, parentCollectionIds, entity: usedEntity, modifiedValues: usedFormContext?.formex?.values ?? usedEntity?.values, formContext: usedFormContext }) }) }, `custom_view_${customView.key}`);
21378
21848
  }).filter(Boolean);
21379
21849
  const globalLoading = dataLoading && !usedEntity;
21380
21850
  const jsonView = /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("relative flex-1 h-full overflow-auto w-full", {
@@ -21403,7 +21873,8 @@
21403
21873
  };
21404
21874
  const entityReadOnlyView = !canEdit && entity ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls("flex-1 flex flex-row w-full overflow-y-auto justify-center", canEdit || !mainViewVisible || selectedSecondaryForm ? "hidden" : ""), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("relative flex flex-col max-w-4xl lg:max-w-3xl xl:max-w-4xl 2xl:max-w-6xl w-full h-fit"), children: [
21405
21875
  /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { className: "mt-16 mb-8 mx-8", variant: "h4", children: collection.singularName ?? collection.name }),
21406
- /* @__PURE__ */ jsxRuntime.jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection })
21876
+ /* @__PURE__ */ jsxRuntime.jsx(EntityView, { className: "px-8 h-full overflow-auto", entity, path, collection }),
21877
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-16" })
21407
21878
  ] }) }) : null;
21408
21879
  const entityView = /* @__PURE__ */ jsxRuntime.jsx(EntityForm, { collection, path, entityId: entityId ?? usedEntity?.id, onValuesModified, entity, initialDirtyValues: cachedDirtyValues, openEntityMode: layout, forceActionsAtTheBottom: actionsAtTheBottom, initialStatus: status, className: ui.cls((!mainViewVisible || !canEdit) && !selectedSecondaryForm ? "hidden" : "", formProps?.className), EntityFormActionsComponent: EntityEditViewFormActions, disabled: !canEdit, ...formProps, onEntityChange: (entity_0) => {
21409
21880
  setUsedEntity(entity_0);
@@ -21423,7 +21894,8 @@
21423
21894
  formProps?.onSaved?.(res);
21424
21895
  }, Builder: selectedSecondaryForm?.Builder });
21425
21896
  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}`));
21426
- 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}`));
21897
+ const customViewTabsStart = resolvedEntityViews.filter((view) => view.position === "start").map((view_0) => /* @__PURE__ */ jsxRuntime.jsx(ui.Tab, { className: !view_0.tabComponent ? "text-sm min-w-[120px]" : void 0, value: view_0.key, children: view_0.tabComponent ?? view_0.name }, `entity_detail_collection_tab_${view_0.name}`));
21898
+ const customViewTabsEnd = resolvedEntityViews.filter((view_1) => !view_1.position || view_1.position === "end").map((view_2) => /* @__PURE__ */ jsxRuntime.jsx(ui.Tab, { className: !view_2.tabComponent ? "text-sm min-w-[120px]" : void 0, value: view_2.key, children: view_2.tabComponent ?? view_2.name }, `entity_detail_collection_tab_${view_2.name}`));
21427
21899
  const shouldShowTopBar = Boolean(barActions) || hasAdditionalViews;
21428
21900
  let result = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex flex-col h-full w-full bg-white dark:bg-surface-900", children: [
21429
21901
  shouldShowTopBar && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("h-14 flex overflow-visible overflow-x-scroll w-full no-scrollbar h-14 border-b pl-2 pr-2 pt-1 flex items-end bg-surface-50 dark:bg-surface-900", ui.defaultBorderMixin), children: [
@@ -21433,9 +21905,10 @@
21433
21905
  hasAdditionalViews && /* @__PURE__ */ jsxRuntime.jsxs(ui.Tabs, { value: selectedTab, onValueChange: (value_1) => {
21434
21906
  onSideTabClick(value_1);
21435
21907
  }, children: [
21436
- includeJsonView && /* @__PURE__ */ jsxRuntime.jsx(ui.Tab, { disabled: !hasAdditionalViews, value: JSON_TAB_VALUE, innerClassName: "block", className: "text-sm", children: /* @__PURE__ */ jsxRuntime.jsx(ui.CodeIcon, { size: "small" }) }),
21908
+ includeJsonView && /* @__PURE__ */ jsxRuntime.jsx(ui.Tab, { disabled: !hasAdditionalViews, value: JSON_TAB_VALUE, className: "text-sm", children: /* @__PURE__ */ jsxRuntime.jsx(ui.CodeIcon, { size: "small" }) }),
21909
+ customViewTabsStart,
21437
21910
  /* @__PURE__ */ jsxRuntime.jsx(ui.Tab, { disabled: !hasAdditionalViews, value: MAIN_TAB_VALUE, className: "text-sm min-w-[120px]", children: collection.singularName ?? collection.name }),
21438
- customViewTabs,
21911
+ customViewTabsEnd,
21439
21912
  subcollectionTabs
21440
21913
  ] })
21441
21914
  ] }),
@@ -21447,7 +21920,6 @@
21447
21920
  customViewsView,
21448
21921
  subCollectionsViews
21449
21922
  ] });
21450
- const plugins = customizationController.plugins;
21451
21923
  if (plugins) {
21452
21924
  plugins.forEach((plugin) => {
21453
21925
  if (plugin.form?.provider) {
@@ -21458,6 +21930,12 @@
21458
21930
  return result;
21459
21931
  }
21460
21932
  function EntitySidePanel(props) {
21933
+ const {
21934
+ allowFullScreen = true,
21935
+ path,
21936
+ entityId,
21937
+ formProps
21938
+ } = props;
21461
21939
  const {
21462
21940
  blocked,
21463
21941
  setBlocked,
@@ -21495,19 +21973,9 @@
21495
21973
  }
21496
21974
  };
21497
21975
  const parentCollectionIds = React.useMemo(() => {
21498
- return navigationController.getParentCollectionIds(props.path);
21499
- }, [navigationController, props.path]);
21500
- const collection = React.useMemo(() => {
21501
- if (props.collection) {
21502
- return props.collection;
21503
- }
21504
- const registryCollection = navigationController.getCollection(props.path);
21505
- if (registryCollection) {
21506
- return registryCollection;
21507
- }
21508
- console.error("ERROR: No collection found in path `", props.path, "`. Entity id: ", props.entityId);
21509
- throw Error("ERROR: No collection found in path `" + props.path + "`. Make sure you have defined a collection for this path in the root navigation.");
21510
- }, [navigationController, props.collection]);
21976
+ return navigationController.getParentCollectionIds(path);
21977
+ }, [navigationController, path]);
21978
+ const collection = props.collection ?? navigationController.getCollection(path);
21511
21979
  React.useEffect(() => {
21512
21980
  function beforeunload(e) {
21513
21981
  if (blocked && collection) {
@@ -21533,24 +22001,24 @@
21533
22001
  }
21534
22002
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(EntityEditView, { ...props, layout: "side_panel", collection, parentCollectionIds, onValuesModified, onSaved: onUpdate, barActions: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
21535
22003
  /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { className: "self-center", onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { size: "small" }) }),
21536
- /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { className: "self-center", onClick: () => {
21537
- if (props.entityId) navigate(location.pathname);
22004
+ allowFullScreen && /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { className: "self-center", onClick: () => {
22005
+ if (entityId) navigate(location.pathname);
21538
22006
  else navigate(location.pathname + "#new");
21539
22007
  }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.OpenInFullIcon, { size: "small" }) })
21540
22008
  ] }), onTabChange: ({
21541
- path,
21542
- entityId,
22009
+ path: path_0,
22010
+ entityId: entityId_0,
21543
22011
  selectedTab,
21544
22012
  collection: collection_0
21545
22013
  }) => {
21546
22014
  sideEntityController.replace({
21547
- path,
21548
- entityId,
22015
+ path: path_0,
22016
+ entityId: entityId_0,
21549
22017
  selectedTab,
21550
22018
  updateUrl: true,
21551
22019
  collection: collection_0
21552
22020
  });
21553
- }, formProps: props.formProps }) }) });
22021
+ }, formProps }) }) });
21554
22022
  }
21555
22023
  const NEW_URL_HASH = "new_side";
21556
22024
  const SIDE_URL_HASH = "side";
@@ -21559,7 +22027,7 @@
21559
22027
  const {
21560
22028
  selectedSecondaryForm
21561
22029
  } = resolvedSelectedEntityView(props.collection?.entityViews, customizationController, props.selectedTab);
21562
- const shouldUseSmallLayout = !props.selectedTab || props.selectedTab === JSON_TAB_VALUE || Boolean(selectedSecondaryForm);
22030
+ const shouldUseSmallLayout = !props.selectedTab || props.selectedTab === JSON_TAB_VALUE || props.selectedTab === "__history" || Boolean(selectedSecondaryForm);
21563
22031
  let resolvedWidth;
21564
22032
  if (props.width) {
21565
22033
  resolvedWidth = typeof props.width === "number" ? `${props.width}px` : props.width;
@@ -22283,7 +22751,7 @@
22283
22751
  authController,
22284
22752
  storageSource,
22285
22753
  dataSourceDelegate,
22286
- plugins,
22754
+ plugins: pluginsProp,
22287
22755
  onAnalyticsEvent,
22288
22756
  propertyConfigs,
22289
22757
  entityViews,
@@ -22291,6 +22759,10 @@
22291
22759
  navigationController,
22292
22760
  apiKey
22293
22761
  } = props;
22762
+ if (pluginsProp) {
22763
+ console.warn("The `plugins` prop is deprecated in the FireCMS component. You should pass your plugins to `useBuildNavigationController` instead.");
22764
+ }
22765
+ const plugins = navigationController.plugins ?? pluginsProp;
22294
22766
  const sideDialogsController = useBuildSideDialogsController();
22295
22767
  const sideEntityController = useBuildSideEntityController(navigationController, sideDialogsController, authController);
22296
22768
  const pluginsLoading = plugins?.some((p) => p.loading) ?? false;
@@ -23995,6 +24467,8 @@
23995
24467
  exports2.EntityCollectionView = EntityCollectionView;
23996
24468
  exports2.EntityCollectionViewActions = EntityCollectionViewActions;
23997
24469
  exports2.EntityForm = EntityForm;
24470
+ exports2.EntityPreview = EntityPreview;
24471
+ exports2.EntityPreviewContainer = EntityPreviewContainer;
23998
24472
  exports2.EntityReference = EntityReference;
23999
24473
  exports2.EntityView = EntityView;
24000
24474
  exports2.EnumValuesChip = EnumValuesChip;
@@ -24128,6 +24602,7 @@
24128
24602
  exports2.joinCollectionLists = joinCollectionLists;
24129
24603
  exports2.makePropertiesEditable = makePropertiesEditable;
24130
24604
  exports2.makePropertiesNonEditable = makePropertiesNonEditable;
24605
+ exports2.mergeCallbacks = mergeCallbacks;
24131
24606
  exports2.mergeCollection = mergeCollection;
24132
24607
  exports2.mergeDeep = mergeDeep;
24133
24608
  exports2.mergeEntityActions = mergeEntityActions;