@firecms/collection_editor 3.0.0-beta.13 → 3.0.0-beta.15

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 (44) hide show
  1. package/README.md +165 -1
  2. package/dist/ConfigControllerProvider.d.ts +0 -1
  3. package/dist/index.es.js +1620 -948
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/index.umd.js +1616 -947
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/types/collection_editor_controller.d.ts +0 -1
  8. package/dist/types/collection_inference.d.ts +3 -0
  9. package/dist/types/config_controller.d.ts +3 -1
  10. package/dist/ui/EditorEntityAction.d.ts +2 -0
  11. package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +1 -1
  12. package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -1
  13. package/dist/ui/collection_editor/EntityActionsEditTab.d.ts +4 -0
  14. package/dist/ui/collection_editor/EntityActionsSelectDialog.d.ts +4 -0
  15. package/dist/ui/collection_editor/PropertyTree.d.ts +2 -3
  16. package/dist/ui/collection_editor/properties/ReferencePropertyField.d.ts +2 -1
  17. package/dist/useCollectionEditorPlugin.d.ts +3 -3
  18. package/package.json +8 -9
  19. package/src/ConfigControllerProvider.tsx +0 -5
  20. package/src/types/collection_editor_controller.tsx +0 -2
  21. package/src/types/collection_inference.ts +3 -0
  22. package/src/types/config_controller.tsx +4 -1
  23. package/src/ui/EditorCollectionAction.tsx +2 -7
  24. package/src/ui/EditorEntityAction.tsx +51 -0
  25. package/src/ui/HomePageEditorCollectionAction.tsx +2 -1
  26. package/src/ui/collection_editor/CollectionDetailsForm.tsx +69 -37
  27. package/src/ui/collection_editor/CollectionEditorDialog.tsx +18 -5
  28. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +15 -25
  29. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +8 -6
  30. package/src/ui/collection_editor/EntityActionsEditTab.tsx +163 -0
  31. package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +41 -0
  32. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +5 -2
  33. package/src/ui/collection_editor/GetCodeDialog.tsx +5 -3
  34. package/src/ui/collection_editor/PropertyEditView.tsx +11 -3
  35. package/src/ui/collection_editor/PropertyFieldPreview.tsx +1 -0
  36. package/src/ui/collection_editor/PropertyTree.tsx +183 -139
  37. package/src/ui/collection_editor/UnsavedChangesDialog.tsx +6 -2
  38. package/src/ui/collection_editor/properties/MapPropertyField.tsx +1 -1
  39. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +5 -3
  40. package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +2 -0
  41. package/src/ui/collection_editor/utils/supported_fields.tsx +1 -0
  42. package/src/ui/collection_editor/utils/update_property_for_widget.ts +9 -0
  43. package/src/useCollectionEditorPlugin.tsx +12 -7
  44. package/src/utils/collections.ts +15 -5
package/dist/index.es.js CHANGED
@@ -1,14 +1,17 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
- import { FieldCaption, SearchIconsView, toSnakeCase, singular, IconForView, ArrayContainer, serializeRegExp, useSnackbarController, resolveEnumValues, isPropertyBuilder, useCustomizationController, getFieldConfig, ErrorBoundary, PropertyConfigBadge, unslugify, useNavigationController, mergeDeep, DEFAULT_FIELD_CONFIGS, getFieldId, isValidRegExp, isEmptyObject, ConfirmationDialog, useLargeLayout, makePropertiesEditable, resolveEntityView, useAuthController, useSelectionController, CircularProgressCenter, EntityCollectionTable, slugify, randomString, removeUndefined, ErrorView, removeInitialAndTrailingSlashes, getDefaultPropertiesOrder, joinCollectionLists } from "@firecms/core";
3
+ import { toSnakeCase, singular, IconForView, FieldCaption, SearchIconsView, ArrayContainer, serializeRegExp, useSnackbarController, resolveEnumValues, isPropertyBuilder, useCustomizationController, getFieldConfig, ErrorBoundary, PropertyConfigBadge, unslugify, useNavigationController, mergeDeep, DEFAULT_FIELD_CONFIGS, getFieldId, isValidRegExp, ConfirmationDialog, isEmptyObject, useLargeLayout, makePropertiesEditable, resolveEntityView, useAuthController, useSelectionController, CircularProgressCenter, EntityCollectionTable, slugify, resolveEntityAction, randomString, removeUndefined, ErrorView, removeInitialAndTrailingSlashes, getDefaultPropertiesOrder, joinCollectionLists } from "@firecms/core";
4
4
  import * as React from "react";
5
5
  import React__default, { useContext, useState, useEffect, useMemo, useRef, useDeferredValue } from "react";
6
6
  import equal from "react-fast-compare";
7
- import { cls, Typography, VerticalSplitIcon, Tooltip, Card, SquareIcon, useAutoComplete, Chip, TextField, Autocomplete, AutocompleteItem, SelectItem, Container, IconButton, DebouncedTextField, SettingsIcon, CloseIcon, Select, BooleanSwitchWithLabel, ExpandablePanel, Dialog, Badge, AutorenewIcon, ListIcon, Button, CircularProgress, Paper, DialogTitle, DialogContent, DialogActions, RuleIcon, MultiSelectItem, CloudUploadIcon, MultiSelect, cardMixin, cardClickableMixin, cardSelectedMixin, FunctionsIcon, DoNotDisturbOnIcon, defaultBorderMixin, RemoveIcon, DragHandleIcon, AddIcon, SelectGroup, DeleteIcon, InfoLabel, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, WarningIcon, ContentCopyIcon, CodeIcon, Table, TableBody, TableRow, TableCell, Alert, Icon, coolIconKeys, Tabs, Tab, ArrowBackIcon, LoadingButton, CheckIcon, Menu, MoreVertIcon, MenuItem, UndoIcon, SaveIcon } from "@firecms/ui";
7
+ import { cls, Typography, VerticalSplitIcon, Tooltip, Card, SquareIcon, useAutoComplete, Chip, SelectItem, IconButton, TextField, DebouncedTextField, BooleanSwitchWithLabel, SettingsIcon, CloseIcon, Select, ExpandablePanel, Dialog, Container, Badge, AutorenewIcon, ListIcon, Button, CircularProgress, Paper, DialogTitle, DialogContent, DialogActions, RuleIcon, MultiSelectItem, CloudUploadIcon, MultiSelect, cardMixin, cardClickableMixin, cardSelectedMixin, FunctionsIcon, DoNotDisturbOnIcon, DragHandleIcon, defaultBorderMixin, RemoveIcon, AddIcon, SelectGroup, DeleteIcon, InfoLabel, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, WarningIcon, ContentCopyIcon, CodeIcon, Table, TableBody, TableRow, TableCell, Alert, Icon, coolIconKeys, Tabs, Tab, ArrowBackIcon, LoadingButton, CheckIcon, Menu, MoreVertIcon, MenuItem, UndoIcon, SaveIcon } from "@firecms/ui";
8
8
  import * as Yup from "yup";
9
9
  import { useFormex, getIn, Field, useCreateFormex, Formex, clone } from "@firecms/formex";
10
10
  import { extractEnumFromValues, buildPropertyFromData, buildEntityPropertiesFromData } from "@firecms/schema_inference";
11
- import { Draggable, Droppable, DragDropContext } from "@hello-pangea/dnd";
11
+ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from "@dnd-kit/core";
12
+ import { useSortable, sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy } from "@dnd-kit/sortable";
13
+ import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
14
+ import { CSS } from "@dnd-kit/utilities";
12
15
  import JSON5 from "json5";
13
16
  import { Highlight, themes } from "prism-react-renderer";
14
17
  import { ImportFileUpload, getInferenceType, ImportNewPropertyFieldPreview, DataNewPropertiesMapping, convertDataToEntity, useImportConfig, ImportSaveInProgress } from "@firecms/data_import_export";
@@ -162,7 +165,7 @@ function LayoutModeSwitch(t0) {
162
165
  return t18;
163
166
  }
164
167
  function CollectionDetailsForm(t0) {
165
- const $ = c(176);
168
+ const $ = c(192);
166
169
  const {
167
170
  isNewCollection,
168
171
  reservedGroups,
@@ -178,7 +181,6 @@ function CollectionDetailsForm(t0) {
178
181
  touched,
179
182
  errors,
180
183
  setFieldTouched,
181
- isSubmitting,
182
184
  submitCount
183
185
  } = useFormex();
184
186
  useCollectionEditorController();
@@ -246,7 +248,7 @@ function CollectionDetailsForm(t0) {
246
248
  t5 = $[10];
247
249
  }
248
250
  const collectionIcon = t5;
249
- const groupOptions = groups?.filter((group) => !reservedGroups?.includes(group));
251
+ groups?.filter((group) => !reservedGroups?.includes(group));
250
252
  let t6;
251
253
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
252
254
  t6 = {
@@ -256,10 +258,7 @@ function CollectionDetailsForm(t0) {
256
258
  } else {
257
259
  t6 = $[11];
258
260
  }
259
- const {
260
- autoCompleteOpen,
261
- setAutoCompleteOpen
262
- } = useAutoComplete(t6);
261
+ useAutoComplete(t6);
263
262
  const isSubcollection = !!parentCollection;
264
263
  let customIdValue;
265
264
  if (typeof values.customId === "object") {
@@ -278,290 +277,316 @@ function CollectionDetailsForm(t0) {
278
277
  }
279
278
  }
280
279
  const showErrors = submitCount > 0;
281
- const t7 = "overflow-auto my-auto";
282
- const T0 = Container;
283
- const t8 = "4xl";
284
- const t9 = "flex flex-col gap-4 p-8 m-auto";
285
- const t10 = !isNewCollection ? "h5" : "h4";
286
- const t11 = isNewCollection ? "New collection" : `${values?.name} collection`;
287
- let t12;
288
- if ($[12] !== t10 || $[13] !== t11) {
289
- t12 = /* @__PURE__ */ jsx(Typography, { variant: t10, className: "flex-grow", children: t11 });
290
- $[12] = t10;
291
- $[13] = t11;
292
- $[14] = t12;
280
+ const t7 = !isNewCollection ? "h5" : "h4";
281
+ const t8 = isNewCollection ? "New collection" : `${values?.name} collection`;
282
+ let t9;
283
+ if ($[12] !== t7 || $[13] !== t8) {
284
+ t9 = /* @__PURE__ */ jsx(Typography, { variant: t7, className: "flex-grow", children: t8 });
285
+ $[12] = t7;
286
+ $[13] = t8;
287
+ $[14] = t9;
293
288
  } else {
294
- t12 = $[14];
289
+ t9 = $[14];
295
290
  }
296
- let t13;
291
+ let t10;
297
292
  if ($[15] !== updateDatabaseId || $[16] !== values.databaseId) {
298
- t13 = /* @__PURE__ */ jsx(DefaultDatabaseField, { databaseId: values.databaseId, onDatabaseIdUpdate: updateDatabaseId });
293
+ t10 = /* @__PURE__ */ jsx(DefaultDatabaseField, { databaseId: values.databaseId, onDatabaseIdUpdate: updateDatabaseId });
299
294
  $[15] = updateDatabaseId;
300
295
  $[16] = values.databaseId;
301
- $[17] = t13;
296
+ $[17] = t10;
302
297
  } else {
303
- t13 = $[17];
298
+ t10 = $[17];
304
299
  }
305
- let t14;
300
+ let t11;
306
301
  if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
307
- t14 = () => setIconDialogOpen(true);
308
- $[18] = t14;
302
+ t11 = () => setIconDialogOpen(true);
303
+ $[18] = t11;
309
304
  } else {
310
- t14 = $[18];
305
+ t11 = $[18];
311
306
  }
312
- let t15;
307
+ let t12;
313
308
  if ($[19] !== collectionIcon) {
314
- t15 = /* @__PURE__ */ jsx(Tooltip, { title: "Change icon", asChild: true, children: /* @__PURE__ */ jsx(IconButton, { shape: "square", onClick: t14, children: collectionIcon }) });
309
+ t12 = /* @__PURE__ */ jsx(Tooltip, { title: "Change icon", asChild: true, children: /* @__PURE__ */ jsx(IconButton, { shape: "square", onClick: t11, children: collectionIcon }) });
315
310
  $[19] = collectionIcon;
316
- $[20] = t15;
311
+ $[20] = t12;
317
312
  } else {
318
- t15 = $[20];
313
+ t12 = $[20];
319
314
  }
320
- let t16;
321
- if ($[21] !== t12 || $[22] !== t13 || $[23] !== t15) {
322
- t16 = /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-2 py-2 pt-3 items-center", children: [
323
- t12,
324
- t13,
325
- t15
315
+ let t13;
316
+ if ($[21] !== t10 || $[22] !== t12 || $[23] !== t9) {
317
+ t13 = /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-2 py-2 pt-3 items-center", children: [
318
+ t9,
319
+ t10,
320
+ t12
326
321
  ] });
327
- $[21] = t12;
328
- $[22] = t13;
329
- $[23] = t15;
330
- $[24] = t16;
322
+ $[21] = t10;
323
+ $[22] = t12;
324
+ $[23] = t9;
325
+ $[24] = t13;
331
326
  } else {
332
- t16 = $[24];
327
+ t13 = $[24];
333
328
  }
334
- let t17;
329
+ let t14;
335
330
  if ($[25] !== parentCollection) {
336
- t17 = parentCollection && /* @__PURE__ */ jsx(Chip, { colorScheme: "tealDarker", children: /* @__PURE__ */ jsxs(Typography, { variant: "caption", children: [
331
+ t14 = parentCollection && /* @__PURE__ */ jsx(Chip, { colorScheme: "tealDarker", children: /* @__PURE__ */ jsxs(Typography, { variant: "caption", children: [
337
332
  "This is a subcollection of ",
338
333
  /* @__PURE__ */ jsx("b", { children: parentCollection.name })
339
334
  ] }) });
340
335
  $[25] = parentCollection;
341
- $[26] = t17;
336
+ $[26] = t14;
342
337
  } else {
343
- t17 = $[26];
338
+ t14 = $[26];
344
339
  }
345
- let t18;
346
- if ($[27] !== t16 || $[28] !== t17) {
347
- t18 = /* @__PURE__ */ jsxs("div", { children: [
348
- t16,
349
- t17
340
+ let t15;
341
+ if ($[27] !== t13 || $[28] !== t14) {
342
+ t15 = /* @__PURE__ */ jsxs("div", { children: [
343
+ t13,
344
+ t14
350
345
  ] });
351
- $[27] = t16;
352
- $[28] = t17;
353
- $[29] = t18;
346
+ $[27] = t13;
347
+ $[28] = t14;
348
+ $[29] = t15;
354
349
  } else {
355
- t18 = $[29];
350
+ t15 = $[29];
356
351
  }
357
- const t19 = "grid grid-cols-12 gap-4";
358
- const t20 = values.name ?? "";
359
- let t21;
352
+ const t16 = values.name ?? "";
353
+ let t17;
360
354
  if ($[30] !== updateName) {
361
- t21 = (e) => updateName(e.target.value);
355
+ t17 = (e) => updateName(e.target.value);
362
356
  $[30] = updateName;
363
- $[31] = t21;
357
+ $[31] = t17;
358
+ } else {
359
+ t17 = $[31];
360
+ }
361
+ const t18 = showErrors && Boolean(errors.name);
362
+ let t19;
363
+ if ($[32] !== t16 || $[33] !== t17 || $[34] !== t18) {
364
+ t19 = /* @__PURE__ */ jsx(TextField, { value: t16, onChange: t17, label: "Name", autoFocus: true, required: true, error: t18 });
365
+ $[32] = t16;
366
+ $[33] = t17;
367
+ $[34] = t18;
368
+ $[35] = t19;
364
369
  } else {
365
- t21 = $[31];
370
+ t19 = $[35];
371
+ }
372
+ const t20 = touched.name && Boolean(errors.name);
373
+ const t21 = touched.name && Boolean(errors.name) ? errors.name : "Name of this collection, usually a plural name (e.g. Products)";
374
+ let t22;
375
+ if ($[36] !== t20 || $[37] !== t21) {
376
+ t22 = /* @__PURE__ */ jsx(FieldCaption, { error: t20, children: t21 });
377
+ $[36] = t20;
378
+ $[37] = t21;
379
+ $[38] = t22;
380
+ } else {
381
+ t22 = $[38];
366
382
  }
367
- const t22 = showErrors && Boolean(errors.name);
368
383
  let t23;
369
- if ($[32] !== t20 || $[33] !== t21 || $[34] !== t22) {
370
- t23 = /* @__PURE__ */ jsx(TextField, { value: t20, onChange: t21, label: "Name", autoFocus: true, required: true, error: t22 });
371
- $[32] = t20;
372
- $[33] = t21;
373
- $[34] = t22;
374
- $[35] = t23;
384
+ if ($[39] !== t19 || $[40] !== t22) {
385
+ t23 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
386
+ t19,
387
+ t22
388
+ ] });
389
+ $[39] = t19;
390
+ $[40] = t22;
391
+ $[41] = t23;
375
392
  } else {
376
- t23 = $[35];
393
+ t23 = $[41];
377
394
  }
378
- const t24 = touched.name && Boolean(errors.name);
379
- const t25 = touched.name && Boolean(errors.name) ? errors.name : "Name of this collection, usually a plural name (e.g. Products)";
380
- let t26;
381
- if ($[36] !== t24 || $[37] !== t25) {
382
- t26 = /* @__PURE__ */ jsx(FieldCaption, { error: t24, children: t25 });
383
- $[36] = t24;
384
- $[37] = t25;
385
- $[38] = t26;
395
+ let t24;
396
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
397
+ t24 = cls("col-span-12 ");
398
+ $[42] = t24;
386
399
  } else {
387
- t26 = $[38];
400
+ t24 = $[42];
388
401
  }
402
+ const t25 = !isNewCollection;
403
+ const t26 = showErrors && Boolean(errors.path);
389
404
  let t27;
390
- if ($[39] !== t23 || $[40] !== t26) {
391
- t27 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
392
- t23,
393
- t26
405
+ if ($[43] !== t25 || $[44] !== t26) {
406
+ t27 = /* @__PURE__ */ jsx(Field, { name: "path", as: DebouncedTextField, label: "Path", disabled: t25, required: true, error: t26 });
407
+ $[43] = t25;
408
+ $[44] = t26;
409
+ $[45] = t27;
410
+ } else {
411
+ t27 = $[45];
412
+ }
413
+ const t28 = touched.path && Boolean(errors.path);
414
+ const t29 = touched.path && Boolean(errors.path) ? errors.path : isSubcollection ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database";
415
+ let t30;
416
+ if ($[46] !== t28 || $[47] !== t29) {
417
+ t30 = /* @__PURE__ */ jsx(FieldCaption, { error: t28, children: t29 });
418
+ $[46] = t28;
419
+ $[47] = t29;
420
+ $[48] = t30;
421
+ } else {
422
+ t30 = $[48];
423
+ }
424
+ let t31;
425
+ if ($[49] !== t27 || $[50] !== t30) {
426
+ t31 = /* @__PURE__ */ jsxs("div", { className: t24, children: [
427
+ t27,
428
+ t30
394
429
  ] });
395
- $[39] = t23;
396
- $[40] = t26;
397
- $[41] = t27;
430
+ $[49] = t27;
431
+ $[50] = t30;
432
+ $[51] = t31;
398
433
  } else {
399
- t27 = $[41];
434
+ t31 = $[51];
400
435
  }
401
- const t28 = isSubcollection ? "" : "sm:col-span-8";
402
- let t29;
403
- if ($[42] !== t28) {
404
- t29 = cls("col-span-12 ", t28);
405
- $[42] = t28;
406
- $[43] = t29;
407
- } else {
408
- t29 = $[43];
409
- }
410
- const t30 = !isNewCollection;
411
- const t31 = showErrors && Boolean(errors.path);
412
- let t32;
413
- if ($[44] !== t30 || $[45] !== t31) {
414
- t32 = /* @__PURE__ */ jsx(Field, { name: "path", as: DebouncedTextField, label: "Path", disabled: t30, required: true, error: t31 });
415
- $[44] = t30;
416
- $[45] = t31;
417
- $[46] = t32;
418
- } else {
419
- t32 = $[46];
420
- }
421
- const t33 = touched.path && Boolean(errors.path);
422
- const t34 = touched.path && Boolean(errors.path) ? errors.path : isSubcollection ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database";
423
- let t35;
424
- if ($[47] !== t33 || $[48] !== t34) {
425
- t35 = /* @__PURE__ */ jsx(FieldCaption, { error: t33, children: t34 });
426
- $[47] = t33;
427
- $[48] = t34;
428
- $[49] = t35;
429
- } else {
430
- t35 = $[49];
436
+ const t32 = values.openEntityMode ?? "side_panel";
437
+ let t33;
438
+ if ($[52] !== setFieldValue) {
439
+ t33 = (value) => setFieldValue("openEntityMode", value);
440
+ $[52] = setFieldValue;
441
+ $[53] = t33;
442
+ } else {
443
+ t33 = $[53];
431
444
  }
445
+ let t34;
446
+ if ($[54] !== t32 || $[55] !== t33) {
447
+ t34 = /* @__PURE__ */ jsx(LayoutModeSwitch, { className: "col-span-12", value: t32, onChange: t33 });
448
+ $[54] = t32;
449
+ $[55] = t33;
450
+ $[56] = t34;
451
+ } else {
452
+ t34 = $[56];
453
+ }
454
+ const t35 = values.history === null || values.history === void 0 ? "Document history revisions enabled if enabled globally" : values.history ? "Document history revisions ENABLED" : "Document history revisions NOT enabled";
432
455
  let t36;
433
- if ($[50] !== t29 || $[51] !== t32 || $[52] !== t35) {
434
- t36 = /* @__PURE__ */ jsxs("div", { className: t29, children: [
435
- t32,
436
- t35
437
- ] });
438
- $[50] = t29;
439
- $[51] = t32;
440
- $[52] = t35;
441
- $[53] = t36;
442
- } else {
443
- t36 = $[53];
444
- }
445
- const t37 = !isSubcollection && /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-4 relative", children: [
446
- /* @__PURE__ */ jsx(TextField, { error: showErrors && Boolean(errors.group), disabled: isSubmitting, value: values.group ?? "", autoComplete: "off", onChange: (event) => setFieldValue("group", event.target.value), name: "group", inputRef: groupRef, label: "Group" }),
447
- /* @__PURE__ */ jsx(Autocomplete, { open: autoCompleteOpen && (groupOptions ?? []).length > 0, setOpen: setAutoCompleteOpen, children: groupOptions?.map((group_0, index) => /* @__PURE__ */ jsx(AutocompleteItem, { onClick: () => {
448
- setAutoCompleteOpen(false);
449
- setFieldValue("group", group_0 ?? null);
450
- }, children: /* @__PURE__ */ jsx("div", { className: "flex-grow", children: group_0 }) }, index + "_" + group_0)) }),
451
- /* @__PURE__ */ jsx(FieldCaption, { children: showErrors && Boolean(errors.group) ? errors.group : "Group in the home page" })
452
- ] });
453
- const t38 = values.openEntityMode ?? "side_panel";
456
+ if ($[57] !== setFieldValue) {
457
+ t36 = (v) => setFieldValue("history", v);
458
+ $[57] = setFieldValue;
459
+ $[58] = t36;
460
+ } else {
461
+ t36 = $[58];
462
+ }
463
+ const t37 = values.history === void 0 ? null : values.history;
464
+ let t38;
465
+ if ($[59] !== t35 || $[60] !== t36 || $[61] !== t37) {
466
+ t38 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", allowIndeterminate: true, label: t35, onValueChange: t36, value: t37 });
467
+ $[59] = t35;
468
+ $[60] = t36;
469
+ $[61] = t37;
470
+ $[62] = t38;
471
+ } else {
472
+ t38 = $[62];
473
+ }
454
474
  let t39;
455
- if ($[54] !== setFieldValue) {
456
- t39 = (value) => setFieldValue("openEntityMode", value);
457
- $[54] = setFieldValue;
458
- $[55] = t39;
475
+ if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
476
+ t39 = /* @__PURE__ */ jsxs(FieldCaption, { children: [
477
+ "When enabled, each document in this collection will have a history of changes. This is useful for auditing purposes. The data is stored in a subcollection of the document in your database, called ",
478
+ /* @__PURE__ */ jsx("b", { children: "__history" }),
479
+ "."
480
+ ] });
481
+ $[63] = t39;
459
482
  } else {
460
- t39 = $[55];
483
+ t39 = $[63];
461
484
  }
462
485
  let t40;
463
- if ($[56] !== t38 || $[57] !== t39) {
464
- t40 = /* @__PURE__ */ jsx(LayoutModeSwitch, { className: "col-span-12", value: t38, onChange: t39 });
465
- $[56] = t38;
466
- $[57] = t39;
467
- $[58] = t40;
486
+ if ($[64] !== t38) {
487
+ t40 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
488
+ t38,
489
+ t39
490
+ ] });
491
+ $[64] = t38;
492
+ $[65] = t40;
468
493
  } else {
469
- t40 = $[58];
494
+ t40 = $[65];
470
495
  }
471
496
  let t41;
472
- if ($[59] === Symbol.for("react.memo_cache_sentinel")) {
497
+ if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
473
498
  t41 = /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-surface-500", children: [
474
499
  /* @__PURE__ */ jsx(SettingsIcon, {}),
475
500
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "ml-2", children: "Advanced" })
476
501
  ] });
477
- $[59] = t41;
502
+ $[66] = t41;
478
503
  } else {
479
- t41 = $[59];
504
+ t41 = $[66];
480
505
  }
481
506
  const t42 = !isNewCollection;
482
507
  const t43 = showErrors && Boolean(errors.id);
483
508
  let t44;
484
- if ($[60] !== t42 || $[61] !== t43) {
509
+ if ($[67] !== t42 || $[68] !== t43) {
485
510
  t44 = /* @__PURE__ */ jsx(Field, { name: "id", as: DebouncedTextField, disabled: t42, label: "Collection id", error: t43 });
486
- $[60] = t42;
487
- $[61] = t43;
488
- $[62] = t44;
511
+ $[67] = t42;
512
+ $[68] = t43;
513
+ $[69] = t44;
489
514
  } else {
490
- t44 = $[62];
515
+ t44 = $[69];
491
516
  }
492
517
  const t45 = touched.id && Boolean(errors.id);
493
518
  const t46 = touched.id && Boolean(errors.id) ? errors.id : "This id identifies this collection. Typically the same as the path.";
494
519
  let t47;
495
- if ($[63] !== t45 || $[64] !== t46) {
520
+ if ($[70] !== t45 || $[71] !== t46) {
496
521
  t47 = /* @__PURE__ */ jsx(FieldCaption, { error: t45, children: t46 });
497
- $[63] = t45;
498
- $[64] = t46;
499
- $[65] = t47;
522
+ $[70] = t45;
523
+ $[71] = t46;
524
+ $[72] = t47;
500
525
  } else {
501
- t47 = $[65];
526
+ t47 = $[72];
502
527
  }
503
528
  let t48;
504
- if ($[66] !== t44 || $[67] !== t47) {
529
+ if ($[73] !== t44 || $[74] !== t47) {
505
530
  t48 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
506
531
  t44,
507
532
  t47
508
533
  ] });
509
- $[66] = t44;
510
- $[67] = t47;
511
- $[68] = t48;
534
+ $[73] = t44;
535
+ $[74] = t47;
536
+ $[75] = t48;
512
537
  } else {
513
- t48 = $[68];
538
+ t48 = $[75];
514
539
  }
515
540
  const t49 = showErrors && Boolean(errors.singularName);
516
541
  let t50;
517
- if ($[69] !== handleChange || $[70] !== setFieldTouched) {
542
+ if ($[76] !== handleChange || $[77] !== setFieldTouched) {
518
543
  t50 = (e_0) => {
519
544
  setFieldTouched("singularName", true);
520
545
  return handleChange(e_0);
521
546
  };
522
- $[69] = handleChange;
523
- $[70] = setFieldTouched;
524
- $[71] = t50;
547
+ $[76] = handleChange;
548
+ $[77] = setFieldTouched;
549
+ $[78] = t50;
525
550
  } else {
526
- t50 = $[71];
551
+ t50 = $[78];
527
552
  }
528
553
  const t51 = values.singularName ?? "";
529
554
  let t52;
530
- if ($[72] !== t49 || $[73] !== t50 || $[74] !== t51) {
555
+ if ($[79] !== t49 || $[80] !== t50 || $[81] !== t51) {
531
556
  t52 = /* @__PURE__ */ jsx(TextField, { error: t49, name: "singularName", "aria-describedby": "singularName-helper", onChange: t50, value: t51, label: "Singular name" });
532
- $[72] = t49;
533
- $[73] = t50;
534
- $[74] = t51;
535
- $[75] = t52;
557
+ $[79] = t49;
558
+ $[80] = t50;
559
+ $[81] = t51;
560
+ $[82] = t52;
536
561
  } else {
537
- t52 = $[75];
562
+ t52 = $[82];
538
563
  }
539
564
  const t53 = showErrors && Boolean(errors.singularName);
540
565
  const t54 = showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define a singular name for your entities";
541
566
  let t55;
542
- if ($[76] !== t53 || $[77] !== t54) {
567
+ if ($[83] !== t53 || $[84] !== t54) {
543
568
  t55 = /* @__PURE__ */ jsx(FieldCaption, { error: t53, children: t54 });
544
- $[76] = t53;
545
- $[77] = t54;
546
- $[78] = t55;
569
+ $[83] = t53;
570
+ $[84] = t54;
571
+ $[85] = t55;
547
572
  } else {
548
- t55 = $[78];
573
+ t55 = $[85];
549
574
  }
550
575
  let t56;
551
- if ($[79] !== t52 || $[80] !== t55) {
576
+ if ($[86] !== t52 || $[87] !== t55) {
552
577
  t56 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
553
578
  t52,
554
579
  t55
555
580
  ] });
556
- $[79] = t52;
557
- $[80] = t55;
558
- $[81] = t56;
581
+ $[86] = t52;
582
+ $[87] = t55;
583
+ $[88] = t56;
559
584
  } else {
560
- t56 = $[81];
585
+ t56 = $[88];
561
586
  }
562
587
  const t57 = showErrors && Boolean(errors.sideDialogWidth);
563
588
  let t58;
564
- if ($[82] !== setFieldTouched || $[83] !== setFieldValue) {
589
+ if ($[89] !== setFieldTouched || $[90] !== setFieldValue) {
565
590
  t58 = (e_1) => {
566
591
  setFieldTouched("sideDialogWidth", true);
567
592
  const value_0 = e_1.target.value;
@@ -573,362 +598,402 @@ function CollectionDetailsForm(t0) {
573
598
  }
574
599
  }
575
600
  };
576
- $[82] = setFieldTouched;
577
- $[83] = setFieldValue;
578
- $[84] = t58;
601
+ $[89] = setFieldTouched;
602
+ $[90] = setFieldValue;
603
+ $[91] = t58;
579
604
  } else {
580
- t58 = $[84];
605
+ t58 = $[91];
581
606
  }
582
607
  let t59;
583
- if ($[85] !== setFieldValue) {
608
+ if ($[92] !== setFieldValue) {
584
609
  t59 = () => {
585
610
  setFieldValue("sideDialogWidth", null);
586
611
  };
587
- $[85] = setFieldValue;
588
- $[86] = t59;
612
+ $[92] = setFieldValue;
613
+ $[93] = t59;
589
614
  } else {
590
- t59 = $[86];
615
+ t59 = $[93];
591
616
  }
592
617
  const t60 = !values.sideDialogWidth;
593
618
  let t61;
594
- if ($[87] === Symbol.for("react.memo_cache_sentinel")) {
619
+ if ($[94] === Symbol.for("react.memo_cache_sentinel")) {
595
620
  t61 = /* @__PURE__ */ jsx(CloseIcon, { size: "small" });
596
- $[87] = t61;
621
+ $[94] = t61;
597
622
  } else {
598
- t61 = $[87];
623
+ t61 = $[94];
599
624
  }
600
625
  let t62;
601
- if ($[88] !== t59 || $[89] !== t60) {
626
+ if ($[95] !== t59 || $[96] !== t60) {
602
627
  t62 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t59, disabled: t60, children: t61 });
603
- $[88] = t59;
604
- $[89] = t60;
605
- $[90] = t62;
628
+ $[95] = t59;
629
+ $[96] = t60;
630
+ $[97] = t62;
606
631
  } else {
607
- t62 = $[90];
632
+ t62 = $[97];
608
633
  }
609
634
  const t63 = values.sideDialogWidth ?? "";
610
635
  let t64;
611
- if ($[91] !== t57 || $[92] !== t58 || $[93] !== t62 || $[94] !== t63) {
636
+ if ($[98] !== t57 || $[99] !== t58 || $[100] !== t62 || $[101] !== t63) {
612
637
  t64 = /* @__PURE__ */ jsx(TextField, { error: t57, name: "sideDialogWidth", type: "number", "aria-describedby": "sideDialogWidth-helper", onChange: t58, endAdornment: t62, value: t63, label: "Side dialog width" });
613
- $[91] = t57;
614
- $[92] = t58;
615
- $[93] = t62;
616
- $[94] = t63;
617
- $[95] = t64;
638
+ $[98] = t57;
639
+ $[99] = t58;
640
+ $[100] = t62;
641
+ $[101] = t63;
642
+ $[102] = t64;
618
643
  } else {
619
- t64 = $[95];
644
+ t64 = $[102];
620
645
  }
621
646
  const t65 = showErrors && Boolean(errors.singularName);
622
647
  const t66 = showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define the width (in pixels) of entities side dialog. Default is 768px";
623
648
  let t67;
624
- if ($[96] !== t65 || $[97] !== t66) {
649
+ if ($[103] !== t65 || $[104] !== t66) {
625
650
  t67 = /* @__PURE__ */ jsx(FieldCaption, { error: t65, children: t66 });
626
- $[96] = t65;
627
- $[97] = t66;
628
- $[98] = t67;
651
+ $[103] = t65;
652
+ $[104] = t66;
653
+ $[105] = t67;
629
654
  } else {
630
- t67 = $[98];
655
+ t67 = $[105];
631
656
  }
632
657
  let t68;
633
- if ($[99] !== t64 || $[100] !== t67) {
658
+ if ($[106] !== t64 || $[107] !== t67) {
634
659
  t68 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
635
660
  t64,
636
661
  t67
637
662
  ] });
638
- $[99] = t64;
639
- $[100] = t67;
640
- $[101] = t68;
663
+ $[106] = t64;
664
+ $[107] = t67;
665
+ $[108] = t68;
641
666
  } else {
642
- t68 = $[101];
667
+ t68 = $[108];
643
668
  }
644
669
  const t69 = showErrors && Boolean(errors.description);
645
670
  const t70 = values.description ?? "";
646
671
  let t71;
647
- if ($[102] !== handleChange || $[103] !== t69 || $[104] !== t70) {
672
+ if ($[109] !== handleChange || $[110] !== t69 || $[111] !== t70) {
648
673
  t71 = /* @__PURE__ */ jsx(TextField, { error: t69, name: "description", value: t70, onChange: handleChange, multiline: true, minRows: 2, "aria-describedby": "description-helper-text", label: "Description" });
649
- $[102] = handleChange;
650
- $[103] = t69;
651
- $[104] = t70;
652
- $[105] = t71;
674
+ $[109] = handleChange;
675
+ $[110] = t69;
676
+ $[111] = t70;
677
+ $[112] = t71;
653
678
  } else {
654
- t71 = $[105];
679
+ t71 = $[112];
655
680
  }
656
681
  const t72 = showErrors && Boolean(errors.description);
657
682
  const t73 = showErrors && Boolean(errors.description) ? errors.description : "Description of the collection, you can use markdown";
658
683
  let t74;
659
- if ($[106] !== t72 || $[107] !== t73) {
684
+ if ($[113] !== t72 || $[114] !== t73) {
660
685
  t74 = /* @__PURE__ */ jsx(FieldCaption, { error: t72, children: t73 });
661
- $[106] = t72;
662
- $[107] = t73;
663
- $[108] = t74;
686
+ $[113] = t72;
687
+ $[114] = t73;
688
+ $[115] = t74;
664
689
  } else {
665
- t74 = $[108];
690
+ t74 = $[115];
666
691
  }
667
692
  let t75;
668
- if ($[109] !== t71 || $[110] !== t74) {
693
+ if ($[116] !== t71 || $[117] !== t74) {
669
694
  t75 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
670
695
  t71,
671
696
  t74
672
697
  ] });
673
- $[109] = t71;
674
- $[110] = t74;
675
- $[111] = t75;
698
+ $[116] = t71;
699
+ $[117] = t74;
700
+ $[118] = t75;
676
701
  } else {
677
- t75 = $[111];
702
+ t75 = $[118];
678
703
  }
679
704
  const t76 = values.defaultSize ?? "";
680
705
  let t77;
681
- if ($[112] === Symbol.for("react.memo_cache_sentinel")) {
682
- t77 = ["xs", "s", "m", "l", "xl"].map(_temp2$7);
683
- $[112] = t77;
706
+ if ($[119] === Symbol.for("react.memo_cache_sentinel")) {
707
+ t77 = ["xs", "s", "m", "l", "xl"].map(_temp2$8);
708
+ $[119] = t77;
684
709
  } else {
685
- t77 = $[112];
710
+ t77 = $[119];
686
711
  }
687
712
  let t78;
688
- if ($[113] !== handleChange || $[114] !== t76) {
689
- t78 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(Select, { name: "defaultSize", size: "large", fullWidth: true, label: "Default row size", position: "item-aligned", onChange: handleChange, value: t76, renderValue: _temp$b, children: t77 }) });
690
- $[113] = handleChange;
691
- $[114] = t76;
692
- $[115] = t78;
713
+ if ($[120] !== handleChange || $[121] !== t76) {
714
+ t78 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(Select, { name: "defaultSize", size: "large", fullWidth: true, label: "Default row size", position: "item-aligned", onChange: handleChange, value: t76, renderValue: _temp$c, children: t77 }) });
715
+ $[120] = handleChange;
716
+ $[121] = t76;
717
+ $[122] = t78;
693
718
  } else {
694
- t78 = $[115];
719
+ t78 = $[122];
695
720
  }
696
- const t79 = customIdValue === "code_defined";
721
+ const t79 = values.includeJsonView === void 0 || values.includeJsonView ? "Include JSON view" : "Do not include JSON view";
697
722
  let t80;
698
- if ($[116] !== setFieldValue) {
699
- t80 = (v) => {
700
- if (v === "code_defined") {
701
- throw new Error("This should not happen");
702
- }
703
- setFieldValue("customId", v);
704
- };
705
- $[116] = setFieldValue;
706
- $[117] = t80;
723
+ if ($[123] !== setFieldValue) {
724
+ t80 = (v_0) => setFieldValue("includeJsonView", v_0);
725
+ $[123] = setFieldValue;
726
+ $[124] = t80;
707
727
  } else {
708
- t80 = $[117];
728
+ t80 = $[124];
709
729
  }
710
- const t81 = customIdValue ?? "";
730
+ const t81 = values.includeJsonView === void 0 ? true : values.includeJsonView;
711
731
  let t82;
732
+ if ($[125] !== t79 || $[126] !== t80 || $[127] !== t81) {
733
+ t82 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", label: t79, onValueChange: t80, value: t81 });
734
+ $[125] = t79;
735
+ $[126] = t80;
736
+ $[127] = t81;
737
+ $[128] = t82;
738
+ } else {
739
+ t82 = $[128];
740
+ }
712
741
  let t83;
742
+ if ($[129] === Symbol.for("react.memo_cache_sentinel")) {
743
+ t83 = /* @__PURE__ */ jsx(FieldCaption, { children: "Include the JSON representation of the document." });
744
+ $[129] = t83;
745
+ } else {
746
+ t83 = $[129];
747
+ }
713
748
  let t84;
714
- if ($[118] === Symbol.for("react.memo_cache_sentinel")) {
715
- t82 = /* @__PURE__ */ jsx(SelectItem, { value: "false", children: "Document ID is generated automatically" });
716
- t83 = /* @__PURE__ */ jsx(SelectItem, { value: "true", children: "Users must define an ID" });
717
- t84 = /* @__PURE__ */ jsx(SelectItem, { value: "optional", children: "Users can define an ID, but it is not required" });
718
- $[118] = t82;
719
- $[119] = t83;
720
- $[120] = t84;
721
- } else {
722
- t82 = $[118];
723
- t83 = $[119];
724
- t84 = $[120];
725
- }
726
- let t85;
727
- if ($[121] !== t79 || $[122] !== t80 || $[123] !== t81) {
728
- t85 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxs(Select, { name: "customId", label: "Document IDs generation", position: "item-aligned", size: "large", fullWidth: true, disabled: t79, onValueChange: t80, value: t81, renderValue: _temp3$4, children: [
749
+ if ($[130] !== t82) {
750
+ t84 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
729
751
  t82,
730
- t83,
731
- t84
732
- ] }) });
733
- $[121] = t79;
734
- $[122] = t80;
735
- $[123] = t81;
736
- $[124] = t85;
752
+ t83
753
+ ] });
754
+ $[130] = t82;
755
+ $[131] = t84;
737
756
  } else {
738
- t85 = $[124];
757
+ t84 = $[131];
739
758
  }
759
+ const t85 = customIdValue === "code_defined";
740
760
  let t86;
741
- if ($[125] !== setFieldValue) {
742
- t86 = (v_0) => setFieldValue("collectionGroup", v_0);
743
- $[125] = setFieldValue;
744
- $[126] = t86;
761
+ if ($[132] !== setFieldValue) {
762
+ t86 = (v_1) => {
763
+ if (v_1 === "code_defined") {
764
+ throw new Error("This should not happen");
765
+ }
766
+ setFieldValue("customId", v_1);
767
+ };
768
+ $[132] = setFieldValue;
769
+ $[133] = t86;
745
770
  } else {
746
- t86 = $[126];
771
+ t86 = $[133];
747
772
  }
748
- const t87 = values.collectionGroup ?? false;
773
+ const t87 = customIdValue ?? "";
749
774
  let t88;
750
- if ($[127] !== t86 || $[128] !== t87) {
751
- t88 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", label: "Collection group", onValueChange: t86, value: t87 });
752
- $[127] = t86;
753
- $[128] = t87;
754
- $[129] = t88;
775
+ let t89;
776
+ let t90;
777
+ if ($[134] === Symbol.for("react.memo_cache_sentinel")) {
778
+ t88 = /* @__PURE__ */ jsx(SelectItem, { value: "false", children: "Document ID is generated automatically" });
779
+ t89 = /* @__PURE__ */ jsx(SelectItem, { value: "true", children: "Users must define an ID" });
780
+ t90 = /* @__PURE__ */ jsx(SelectItem, { value: "optional", children: "Users can define an ID, but it is not required" });
781
+ $[134] = t88;
782
+ $[135] = t89;
783
+ $[136] = t90;
784
+ } else {
785
+ t88 = $[134];
786
+ t89 = $[135];
787
+ t90 = $[136];
788
+ }
789
+ let t91;
790
+ if ($[137] !== t85 || $[138] !== t86 || $[139] !== t87) {
791
+ t91 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxs(Select, { name: "customId", label: "Document IDs generation", position: "item-aligned", size: "large", fullWidth: true, disabled: t85, onValueChange: t86, value: t87, renderValue: _temp3$5, children: [
792
+ t88,
793
+ t89,
794
+ t90
795
+ ] }) });
796
+ $[137] = t85;
797
+ $[138] = t86;
798
+ $[139] = t87;
799
+ $[140] = t91;
755
800
  } else {
756
- t88 = $[129];
801
+ t91 = $[140];
757
802
  }
758
- let t89;
759
- if ($[130] === Symbol.for("react.memo_cache_sentinel")) {
760
- t89 = /* @__PURE__ */ jsx(FieldCaption, { children: "A collection group consists of all collections with the same path. This allows you to query over multiple collections at once." });
761
- $[130] = t89;
803
+ let t92;
804
+ if ($[141] !== setFieldValue) {
805
+ t92 = (v_2) => setFieldValue("collectionGroup", v_2);
806
+ $[141] = setFieldValue;
807
+ $[142] = t92;
762
808
  } else {
763
- t89 = $[130];
809
+ t92 = $[142];
764
810
  }
765
- let t90;
766
- if ($[131] !== t88) {
767
- t90 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 mt-4", children: [
768
- t88,
769
- t89
811
+ const t93 = values.collectionGroup ?? false;
812
+ let t94;
813
+ if ($[143] !== t92 || $[144] !== t93) {
814
+ t94 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", label: "Collection group", onValueChange: t92, value: t93 });
815
+ $[143] = t92;
816
+ $[144] = t93;
817
+ $[145] = t94;
818
+ } else {
819
+ t94 = $[145];
820
+ }
821
+ let t95;
822
+ if ($[146] === Symbol.for("react.memo_cache_sentinel")) {
823
+ t95 = /* @__PURE__ */ jsx(FieldCaption, { children: "A collection group consists of all collections with the same path. This allows you to query over multiple collections at once." });
824
+ $[146] = t95;
825
+ } else {
826
+ t95 = $[146];
827
+ }
828
+ let t96;
829
+ if ($[147] !== t94) {
830
+ t96 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 mt-4", children: [
831
+ t94,
832
+ t95
770
833
  ] });
771
- $[131] = t88;
772
- $[132] = t90;
834
+ $[147] = t94;
835
+ $[148] = t96;
773
836
  } else {
774
- t90 = $[132];
837
+ t96 = $[148];
775
838
  }
776
- let t91;
777
- if ($[133] !== setFieldValue) {
778
- t91 = (v_1) => setFieldValue("textSearchEnabled", v_1);
779
- $[133] = setFieldValue;
780
- $[134] = t91;
839
+ let t97;
840
+ if ($[149] !== setFieldValue) {
841
+ t97 = (v_3) => setFieldValue("textSearchEnabled", v_3);
842
+ $[149] = setFieldValue;
843
+ $[150] = t97;
781
844
  } else {
782
- t91 = $[134];
845
+ t97 = $[150];
783
846
  }
784
- const t92 = values.textSearchEnabled ?? false;
785
- let t93;
786
- if ($[135] !== t91 || $[136] !== t92) {
787
- t93 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", label: "Enable text search for this collection", onValueChange: t91, value: t92 });
788
- $[135] = t91;
789
- $[136] = t92;
790
- $[137] = t93;
847
+ const t98 = values.textSearchEnabled ?? false;
848
+ let t99;
849
+ if ($[151] !== t97 || $[152] !== t98) {
850
+ t99 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", label: "Enable text search for this collection", onValueChange: t97, value: t98 });
851
+ $[151] = t97;
852
+ $[152] = t98;
853
+ $[153] = t99;
791
854
  } else {
792
- t93 = $[137];
855
+ t99 = $[153];
793
856
  }
794
- let t94;
795
- if ($[138] === Symbol.for("react.memo_cache_sentinel")) {
796
- t94 = /* @__PURE__ */ jsx(FieldCaption, { children: "Allow text search for this collection. If you have not specified a text search delegate, this will use the built-in local text search. This is not recommended for large collections, as it may incur in performance and cost issues." });
797
- $[138] = t94;
857
+ let t100;
858
+ if ($[154] === Symbol.for("react.memo_cache_sentinel")) {
859
+ t100 = /* @__PURE__ */ jsx(FieldCaption, { children: "Allow text search for this collection. If you have not specified a text search delegate, this will use the built-in local text search. This is not recommended for large collections, as it may incur in performance and cost issues." });
860
+ $[154] = t100;
798
861
  } else {
799
- t94 = $[138];
862
+ t100 = $[154];
800
863
  }
801
- let t95;
802
- if ($[139] !== t93) {
803
- t95 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
804
- t93,
805
- t94
864
+ let t101;
865
+ if ($[155] !== t99) {
866
+ t101 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
867
+ t99,
868
+ t100
806
869
  ] });
807
- $[139] = t93;
808
- $[140] = t95;
870
+ $[155] = t99;
871
+ $[156] = t101;
809
872
  } else {
810
- t95 = $[140];
873
+ t101 = $[156];
811
874
  }
812
- let t96;
813
- if ($[141] !== t48 || $[142] !== t56 || $[143] !== t68 || $[144] !== t75 || $[145] !== t78 || $[146] !== t85 || $[147] !== t90 || $[148] !== t95) {
814
- t96 = /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 p-4", children: [
875
+ let t102;
876
+ if ($[157] !== t101 || $[158] !== t48 || $[159] !== t56 || $[160] !== t68 || $[161] !== t75 || $[162] !== t78 || $[163] !== t84 || $[164] !== t91 || $[165] !== t96) {
877
+ t102 = /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 p-4", children: [
815
878
  t48,
816
879
  t56,
817
880
  t68,
818
881
  t75,
819
882
  t78,
820
- t85,
821
- t90,
822
- t95
883
+ t84,
884
+ t91,
885
+ t96,
886
+ t101
823
887
  ] });
824
- $[141] = t48;
825
- $[142] = t56;
826
- $[143] = t68;
827
- $[144] = t75;
828
- $[145] = t78;
829
- $[146] = t85;
830
- $[147] = t90;
831
- $[148] = t95;
832
- $[149] = t96;
888
+ $[157] = t101;
889
+ $[158] = t48;
890
+ $[159] = t56;
891
+ $[160] = t68;
892
+ $[161] = t75;
893
+ $[162] = t78;
894
+ $[163] = t84;
895
+ $[164] = t91;
896
+ $[165] = t96;
897
+ $[166] = t102;
898
+ } else {
899
+ t102 = $[166];
900
+ }
901
+ let t103;
902
+ if ($[167] !== advancedPanelExpanded || $[168] !== t102) {
903
+ t103 = /* @__PURE__ */ jsx(ExpandablePanel, { expanded: advancedPanelExpanded, onExpandedChange: setAdvancedPanelExpanded, title: t41, initiallyExpanded: false, children: t102 });
904
+ $[167] = advancedPanelExpanded;
905
+ $[168] = t102;
906
+ $[169] = t103;
833
907
  } else {
834
- t96 = $[149];
908
+ t103 = $[169];
835
909
  }
836
- let t97;
837
- if ($[150] !== advancedPanelExpanded || $[151] !== t96) {
838
- t97 = /* @__PURE__ */ jsx(ExpandablePanel, { expanded: advancedPanelExpanded, onExpandedChange: setAdvancedPanelExpanded, title: t41, initiallyExpanded: false, children: t96 });
839
- $[150] = advancedPanelExpanded;
840
- $[151] = t96;
841
- $[152] = t97;
842
- } else {
843
- t97 = $[152];
844
- }
845
- let t98;
846
- if ($[153] !== children || $[154] !== t97) {
847
- t98 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 mt-8", children: [
848
- t97,
910
+ let t104;
911
+ if ($[170] !== children || $[171] !== t103) {
912
+ t104 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 mt-8", children: [
913
+ t103,
849
914
  children
850
915
  ] });
851
- $[153] = children;
852
- $[154] = t97;
853
- $[155] = t98;
916
+ $[170] = children;
917
+ $[171] = t103;
918
+ $[172] = t104;
854
919
  } else {
855
- t98 = $[155];
920
+ t104 = $[172];
856
921
  }
857
- let t99;
858
- if ($[156] !== t27 || $[157] !== t36 || $[158] !== t37 || $[159] !== t40 || $[160] !== t98) {
859
- t99 = /* @__PURE__ */ jsxs("div", { className: t19, children: [
860
- t27,
861
- t36,
862
- t37,
922
+ let t105;
923
+ if ($[173] !== t104 || $[174] !== t23 || $[175] !== t31 || $[176] !== t34 || $[177] !== t40) {
924
+ t105 = /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4", children: [
925
+ t23,
926
+ t31,
927
+ t34,
863
928
  t40,
864
- t98
929
+ t104
865
930
  ] });
866
- $[156] = t27;
867
- $[157] = t36;
868
- $[158] = t37;
869
- $[159] = t40;
870
- $[160] = t98;
871
- $[161] = t99;
872
- } else {
873
- t99 = $[161];
874
- }
875
- let t100;
876
- if ($[162] === Symbol.for("react.memo_cache_sentinel")) {
877
- t100 = /* @__PURE__ */ jsx("div", { style: {
931
+ $[173] = t104;
932
+ $[174] = t23;
933
+ $[175] = t31;
934
+ $[176] = t34;
935
+ $[177] = t40;
936
+ $[178] = t105;
937
+ } else {
938
+ t105 = $[178];
939
+ }
940
+ let t106;
941
+ if ($[179] === Symbol.for("react.memo_cache_sentinel")) {
942
+ t106 = /* @__PURE__ */ jsx("div", { style: {
878
943
  height: "52px"
879
944
  } });
880
- $[162] = t100;
945
+ $[179] = t106;
881
946
  } else {
882
- t100 = $[162];
947
+ t106 = $[179];
883
948
  }
884
- let t101;
885
- if ($[163] !== setFieldValue) {
886
- t101 = (icon) => {
949
+ const t107 = typeof values.icon === "string" ? values.icon : void 0;
950
+ let t108;
951
+ if ($[180] !== setFieldValue) {
952
+ t108 = (icon) => {
887
953
  setIconDialogOpen(false);
888
954
  setFieldValue("icon", icon);
889
955
  };
890
- $[163] = setFieldValue;
891
- $[164] = t101;
956
+ $[180] = setFieldValue;
957
+ $[181] = t108;
892
958
  } else {
893
- t101 = $[164];
959
+ t108 = $[181];
894
960
  }
895
- let t102;
896
- if ($[165] !== t101 || $[166] !== values.icon) {
897
- t102 = /* @__PURE__ */ jsx("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ jsx(SearchIconsView, { selectedIcon: values.icon, onIconSelected: t101 }) });
898
- $[165] = t101;
899
- $[166] = values.icon;
900
- $[167] = t102;
961
+ let t109;
962
+ if ($[182] !== t107 || $[183] !== t108) {
963
+ t109 = /* @__PURE__ */ jsx("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ jsx(SearchIconsView, { selectedIcon: t107, onIconSelected: t108 }) });
964
+ $[182] = t107;
965
+ $[183] = t108;
966
+ $[184] = t109;
901
967
  } else {
902
- t102 = $[167];
968
+ t109 = $[184];
903
969
  }
904
- let t103;
905
- if ($[168] !== iconDialogOpen || $[169] !== t102) {
906
- t103 = /* @__PURE__ */ jsx(Dialog, { open: iconDialogOpen, onOpenChange: setIconDialogOpen, maxWidth: "xl", fullWidth: true, children: t102 });
907
- $[168] = iconDialogOpen;
908
- $[169] = t102;
909
- $[170] = t103;
970
+ let t110;
971
+ if ($[185] !== iconDialogOpen || $[186] !== t109) {
972
+ t110 = /* @__PURE__ */ jsx(Dialog, { open: iconDialogOpen, onOpenChange: setIconDialogOpen, maxWidth: "xl", fullWidth: true, children: t109 });
973
+ $[185] = iconDialogOpen;
974
+ $[186] = t109;
975
+ $[187] = t110;
910
976
  } else {
911
- t103 = $[170];
977
+ t110 = $[187];
912
978
  }
913
- let t104;
914
- if ($[171] !== T0 || $[172] !== t103 || $[173] !== t18 || $[174] !== t99) {
915
- t104 = /* @__PURE__ */ jsx("div", { className: t7, children: /* @__PURE__ */ jsxs(T0, { maxWidth: t8, className: t9, children: [
916
- t18,
917
- t99,
918
- t100,
919
- t103
979
+ let t111;
980
+ if ($[188] !== t105 || $[189] !== t110 || $[190] !== t15) {
981
+ t111 = /* @__PURE__ */ jsx("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ jsxs(Container, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
982
+ t15,
983
+ t105,
984
+ t106,
985
+ t110
920
986
  ] }) });
921
- $[171] = T0;
922
- $[172] = t103;
923
- $[173] = t18;
924
- $[174] = t99;
925
- $[175] = t104;
987
+ $[188] = t105;
988
+ $[189] = t110;
989
+ $[190] = t15;
990
+ $[191] = t111;
926
991
  } else {
927
- t104 = $[175];
992
+ t111 = $[191];
928
993
  }
929
- return t104;
994
+ return t111;
930
995
  }
931
- function _temp3$4(value_3) {
996
+ function _temp3$5(value_3) {
932
997
  if (value_3 === "code_defined") {
933
998
  return "Code defined";
934
999
  } else {
@@ -943,10 +1008,10 @@ function _temp3$4(value_3) {
943
1008
  }
944
1009
  }
945
1010
  }
946
- function _temp2$7(value_2) {
1011
+ function _temp2$8(value_2) {
947
1012
  return /* @__PURE__ */ jsx(SelectItem, { value: value_2, children: value_2.toUpperCase() }, `size-select-${value_2}`);
948
1013
  }
949
- function _temp$b(value_1) {
1014
+ function _temp$c(value_1) {
950
1015
  return value_1.toUpperCase();
951
1016
  }
952
1017
  function DefaultDatabaseField(t0) {
@@ -1171,7 +1236,7 @@ function EnumFormFields(t0) {
1171
1236
  inferredValues.add(enumValue_0.id);
1172
1237
  });
1173
1238
  setFieldValue(enumValuesPath, [...newEnumValues, ...currentEnumValues], true);
1174
- }).catch(_temp$a).finally(() => setInferring(false));
1239
+ }).catch(_temp$b).finally(() => setInferring(false));
1175
1240
  };
1176
1241
  $[8] = enumValuesPath;
1177
1242
  $[9] = getData;
@@ -1294,7 +1359,7 @@ function EnumFormFields(t0) {
1294
1359
  }
1295
1360
  return t15;
1296
1361
  }
1297
- function _temp$a(e) {
1362
+ function _temp$b(e) {
1298
1363
  console.error(e);
1299
1364
  }
1300
1365
  const EnumEntry = React__default.memo(function EnumEntryInternal(t0) {
@@ -2083,7 +2148,7 @@ function StoragePropertyField(t0) {
2083
2148
  t192 = $[42];
2084
2149
  }
2085
2150
  if ($[43] !== acceptedFiles || $[44] !== disabled || $[45] !== handleTypesChange || $[46] !== t172 || $[47] !== t182 || $[48] !== t192) {
2086
- t10 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(MultiSelect, { className: "w-full", placeholder: "All file types allowed", disabled, name: acceptedFiles, value: t172, onValueChange: handleTypesChange, label: t182, renderValues: _temp3$3, children: t192 }) });
2151
+ t10 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(MultiSelect, { className: "w-full", placeholder: "All file types allowed", disabled, name: acceptedFiles, value: t172, onValueChange: handleTypesChange, label: t182, renderValues: _temp3$4, children: t192 }) });
2087
2152
  $[43] = acceptedFiles;
2088
2153
  $[44] = disabled;
2089
2154
  $[45] = handleTypesChange;
@@ -2346,16 +2411,16 @@ function StoragePropertyField(t0) {
2346
2411
  }
2347
2412
  return t24;
2348
2413
  }
2349
- function _temp3$3(selected) {
2414
+ function _temp3$4(selected) {
2350
2415
  if (!selected || selected.length === 0) {
2351
2416
  return "All file types allowed";
2352
2417
  }
2353
- return selected.map(_temp$9).filter(_temp2$6).join(", ");
2418
+ return selected.map(_temp$a).filter(_temp2$7).join(", ");
2354
2419
  }
2355
- function _temp2$6(v_0) {
2420
+ function _temp2$7(v_0) {
2356
2421
  return Boolean(v_0);
2357
2422
  }
2358
- function _temp$9(v) {
2423
+ function _temp$a(v) {
2359
2424
  return fileTypes[v];
2360
2425
  }
2361
2426
  function editableProperty(property) {
@@ -2427,7 +2492,7 @@ function PropertyFieldPreview(t0) {
2427
2492
  const t4 = selected ? cardSelectedMixin : "";
2428
2493
  let t5;
2429
2494
  if ($[5] !== borderColorClass || $[6] !== t3 || $[7] !== t4) {
2430
- t5 = cls("border", "pl-2 w-full flex flex-row gap-4 items-center", cardMixin, t3, t4, "flex-grow p-4 border transition-colors duration-200", borderColorClass);
2495
+ t5 = cls("m-1", "border", "pl-2 w-full flex flex-row gap-4 items-center", cardMixin, t3, t4, "flex-grow p-4 border transition-colors duration-200", borderColorClass);
2431
2496
  $[5] = borderColorClass;
2432
2497
  $[6] = t3;
2433
2498
  $[7] = t4;
@@ -2687,7 +2752,7 @@ function NonEditablePropertyPreview(t0) {
2687
2752
  return t19;
2688
2753
  }
2689
2754
  const PropertyTree = React__default.memo(function PropertyTree2(t0) {
2690
- const $ = c(26);
2755
+ const $ = c(37);
2691
2756
  const {
2692
2757
  namespace,
2693
2758
  selectedPropertyKey,
@@ -2713,94 +2778,152 @@ const PropertyTree = React__default.memo(function PropertyTree2(t0) {
2713
2778
  }
2714
2779
  const propertiesOrder = t1;
2715
2780
  let t2;
2716
- if ($[3] !== namespace || $[4] !== onPropertyMove || $[5] !== propertiesOrder) {
2717
- t2 = (result) => {
2718
- if (!result.destination) {
2719
- return;
2720
- }
2721
- const startIndex = result.source.index;
2722
- const endIndex = result.destination.index;
2723
- const newPropertiesOrder = Array.from(propertiesOrder);
2724
- const [removed] = newPropertiesOrder.splice(startIndex, 1);
2725
- newPropertiesOrder.splice(endIndex, 0, removed);
2726
- if (onPropertyMove) {
2727
- onPropertyMove(newPropertiesOrder, namespace);
2781
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2782
+ t2 = {
2783
+ activationConstraint: {
2784
+ distance: 5
2728
2785
  }
2729
2786
  };
2730
- $[3] = namespace;
2731
- $[4] = onPropertyMove;
2732
- $[5] = propertiesOrder;
2733
- $[6] = t2;
2787
+ $[3] = t2;
2734
2788
  } else {
2735
- t2 = $[6];
2789
+ t2 = $[3];
2790
+ }
2791
+ let t3;
2792
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
2793
+ t3 = {
2794
+ coordinateGetter: sortableKeyboardCoordinates
2795
+ };
2796
+ $[4] = t3;
2797
+ } else {
2798
+ t3 = $[4];
2736
2799
  }
2737
- const onDragEnd = t2;
2738
- const t3 = `droppable_${namespace}`;
2800
+ const sensors = useSensors(useSensor(PointerSensor, t2), useSensor(KeyboardSensor, t3));
2739
2801
  let t4;
2740
- if ($[7] !== additionalFields || $[8] !== className || $[9] !== collectionEditable || $[10] !== errors || $[11] !== inferredPropertyKeys || $[12] !== namespace || $[13] !== onPropertyClick || $[14] !== onPropertyMove || $[15] !== onPropertyRemove || $[16] !== properties || $[17] !== propertiesOrder || $[18] !== selectedPropertyKey) {
2741
- t4 = (droppableProvided, droppableSnapshot) => /* @__PURE__ */ jsxs("div", { ...droppableProvided.droppableProps, ref: droppableProvided.innerRef, className, children: [
2742
- propertiesOrder && propertiesOrder.map((propertyKey, index) => {
2743
- const property = properties[propertyKey];
2744
- const additionalField = additionalFields?.find((field) => field.key === propertyKey);
2745
- if (!property && !additionalField) {
2746
- console.warn(`Property ${propertyKey} not found in properties or additionalFields`);
2747
- return null;
2802
+ if ($[5] !== namespace || $[6] !== onPropertyMove || $[7] !== propertiesOrder) {
2803
+ t4 = (event) => {
2804
+ const {
2805
+ active,
2806
+ over
2807
+ } = event;
2808
+ if (!over || active.id === over.id) {
2809
+ return;
2810
+ }
2811
+ const activeId = String(active.id);
2812
+ const overId = String(over.id);
2813
+ const activeKey = activeId.includes(".") ? activeId.split(".").pop() : activeId;
2814
+ const overKey = overId.includes(".") ? overId.split(".").pop() : overId;
2815
+ if (!activeKey || !overKey) {
2816
+ return;
2817
+ }
2818
+ const oldIndex = propertiesOrder.indexOf(activeKey);
2819
+ const newIndex = propertiesOrder.indexOf(overKey);
2820
+ if (oldIndex !== -1 && newIndex !== -1) {
2821
+ const newPropertiesOrder = [...propertiesOrder];
2822
+ const [removed] = newPropertiesOrder.splice(oldIndex, 1);
2823
+ newPropertiesOrder.splice(newIndex, 0, removed);
2824
+ if (onPropertyMove) {
2825
+ onPropertyMove(newPropertiesOrder, namespace);
2748
2826
  }
2749
- return /* @__PURE__ */ jsx(Draggable, { draggableId: `array_field_${namespace}_${propertyKey}}`, index, children: (provided, snapshot) => /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyTreeEntry, { propertyKey, propertyOrBuilder: property, additionalField, provided, errors, namespace, inferredPropertyKeys, onPropertyMove, onPropertyRemove, onPropertyClick: snapshot.isDragging ? void 0 : onPropertyClick, selectedPropertyKey, collectionEditable }) }) }, `array_field_${namespace}_${propertyKey}}`);
2750
- }).filter(Boolean),
2751
- droppableProvided.placeholder
2752
- ] });
2753
- $[7] = additionalFields;
2754
- $[8] = className;
2755
- $[9] = collectionEditable;
2756
- $[10] = errors;
2757
- $[11] = inferredPropertyKeys;
2758
- $[12] = namespace;
2759
- $[13] = onPropertyClick;
2760
- $[14] = onPropertyMove;
2761
- $[15] = onPropertyRemove;
2762
- $[16] = properties;
2763
- $[17] = propertiesOrder;
2764
- $[18] = selectedPropertyKey;
2765
- $[19] = t4;
2766
- } else {
2767
- t4 = $[19];
2827
+ }
2828
+ };
2829
+ $[5] = namespace;
2830
+ $[6] = onPropertyMove;
2831
+ $[7] = propertiesOrder;
2832
+ $[8] = t4;
2833
+ } else {
2834
+ t4 = $[8];
2768
2835
  }
2836
+ const handleDragEnd = t4;
2769
2837
  let t5;
2770
- if ($[20] !== t3 || $[21] !== t4) {
2771
- t5 = /* @__PURE__ */ jsx(Droppable, { droppableId: t3, children: t4 });
2772
- $[20] = t3;
2773
- $[21] = t4;
2774
- $[22] = t5;
2838
+ if ($[9] !== namespace || $[10] !== propertiesOrder) {
2839
+ let t62;
2840
+ if ($[12] !== namespace) {
2841
+ t62 = (key) => getFullId(key, namespace);
2842
+ $[12] = namespace;
2843
+ $[13] = t62;
2844
+ } else {
2845
+ t62 = $[13];
2846
+ }
2847
+ t5 = propertiesOrder.map(t62);
2848
+ $[9] = namespace;
2849
+ $[10] = propertiesOrder;
2850
+ $[11] = t5;
2775
2851
  } else {
2776
- t5 = $[22];
2852
+ t5 = $[11];
2777
2853
  }
2854
+ const items = t5;
2778
2855
  let t6;
2779
- if ($[23] !== onDragEnd || $[24] !== t5) {
2780
- t6 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(DragDropContext, { onDragEnd, children: t5 }) });
2781
- $[23] = onDragEnd;
2782
- $[24] = t5;
2783
- $[25] = t6;
2856
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
2857
+ t6 = [restrictToVerticalAxis];
2858
+ $[14] = t6;
2784
2859
  } else {
2785
- t6 = $[25];
2860
+ t6 = $[14];
2786
2861
  }
2787
- return t6;
2788
- }, (prevProps, nextProps) => {
2789
- const isSelected = nextProps.selectedPropertyKey?.startsWith(nextProps.namespace ?? "");
2790
- const wasSelected = prevProps.selectedPropertyKey?.startsWith(prevProps.namespace ?? "");
2791
- if (isSelected || wasSelected) return false;
2792
- return equal(prevProps.properties, nextProps.properties) && prevProps.propertiesOrder === nextProps.propertiesOrder && equal(prevProps.additionalFields, nextProps.additionalFields) && equal(prevProps.errors, nextProps.errors) && equal(prevProps.onPropertyClick, nextProps.onPropertyClick) && // equal(prevProps.onPropertyMove, nextProps.onPropertyMove) &&
2793
- // equal(prevProps.onPropertyRemove, nextProps.onPropertyRemove) &&
2794
- prevProps.namespace === nextProps.namespace && prevProps.collectionEditable === nextProps.collectionEditable;
2795
- });
2862
+ let t7;
2863
+ if ($[15] !== additionalFields || $[16] !== collectionEditable || $[17] !== errors || $[18] !== inferredPropertyKeys || $[19] !== namespace || $[20] !== onPropertyClick || $[21] !== onPropertyMove || $[22] !== onPropertyRemove || $[23] !== properties || $[24] !== propertiesOrder || $[25] !== selectedPropertyKey) {
2864
+ t7 = propertiesOrder && propertiesOrder.map((propertyKey, index) => {
2865
+ const property = properties[propertyKey];
2866
+ const additionalField = additionalFields?.find((field) => field.key === propertyKey);
2867
+ if (!property && !additionalField) {
2868
+ console.warn(`Property ${propertyKey} not found in properties or additionalFields`);
2869
+ return null;
2870
+ }
2871
+ const id = getFullId(propertyKey, namespace);
2872
+ return /* @__PURE__ */ jsx(PropertyTreeEntry, { id, propertyKey, propertyOrBuilder: property, additionalField, errors, namespace, inferredPropertyKeys, onPropertyMove, onPropertyRemove, onPropertyClick, selectedPropertyKey, collectionEditable }, id);
2873
+ }).filter(Boolean);
2874
+ $[15] = additionalFields;
2875
+ $[16] = collectionEditable;
2876
+ $[17] = errors;
2877
+ $[18] = inferredPropertyKeys;
2878
+ $[19] = namespace;
2879
+ $[20] = onPropertyClick;
2880
+ $[21] = onPropertyMove;
2881
+ $[22] = onPropertyRemove;
2882
+ $[23] = properties;
2883
+ $[24] = propertiesOrder;
2884
+ $[25] = selectedPropertyKey;
2885
+ $[26] = t7;
2886
+ } else {
2887
+ t7 = $[26];
2888
+ }
2889
+ let t8;
2890
+ if ($[27] !== className || $[28] !== t7) {
2891
+ t8 = /* @__PURE__ */ jsx("div", { className, children: t7 });
2892
+ $[27] = className;
2893
+ $[28] = t7;
2894
+ $[29] = t8;
2895
+ } else {
2896
+ t8 = $[29];
2897
+ }
2898
+ let t9;
2899
+ if ($[30] !== items || $[31] !== t8) {
2900
+ t9 = /* @__PURE__ */ jsx(SortableContext, { items, strategy: verticalListSortingStrategy, children: t8 });
2901
+ $[30] = items;
2902
+ $[31] = t8;
2903
+ $[32] = t9;
2904
+ } else {
2905
+ t9 = $[32];
2906
+ }
2907
+ let t10;
2908
+ if ($[33] !== handleDragEnd || $[34] !== sensors || $[35] !== t9) {
2909
+ t10 = /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, modifiers: t6, children: t9 });
2910
+ $[33] = handleDragEnd;
2911
+ $[34] = sensors;
2912
+ $[35] = t9;
2913
+ $[36] = t10;
2914
+ } else {
2915
+ t10 = $[36];
2916
+ }
2917
+ return t10;
2918
+ }, equal);
2796
2919
  function PropertyTreeEntry(t0) {
2797
- const $ = c(53);
2920
+ const $ = c(62);
2798
2921
  const {
2922
+ id,
2799
2923
  propertyKey,
2800
2924
  namespace,
2801
2925
  propertyOrBuilder,
2802
2926
  additionalField,
2803
- provided,
2804
2927
  selectedPropertyKey,
2805
2928
  errors,
2806
2929
  onPropertyClick,
@@ -2810,157 +2933,201 @@ function PropertyTreeEntry(t0) {
2810
2933
  collectionEditable
2811
2934
  } = t0;
2812
2935
  let t1;
2813
- if ($[0] !== inferredPropertyKeys || $[1] !== namespace || $[2] !== propertyKey) {
2814
- t1 = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);
2815
- $[0] = inferredPropertyKeys;
2816
- $[1] = namespace;
2817
- $[2] = propertyKey;
2818
- $[3] = t1;
2936
+ if ($[0] !== id) {
2937
+ t1 = {
2938
+ id
2939
+ };
2940
+ $[0] = id;
2941
+ $[1] = t1;
2819
2942
  } else {
2820
- t1 = $[3];
2943
+ t1 = $[1];
2821
2944
  }
2822
- const isPropertyInferred = t1;
2945
+ const {
2946
+ attributes,
2947
+ listeners,
2948
+ setNodeRef,
2949
+ transform,
2950
+ transition,
2951
+ isDragging
2952
+ } = useSortable(t1);
2823
2953
  let t2;
2824
- if ($[4] !== namespace || $[5] !== propertyKey) {
2825
- t2 = getFullId(propertyKey, namespace);
2826
- $[4] = namespace;
2827
- $[5] = propertyKey;
2828
- $[6] = t2;
2954
+ if ($[2] !== transform) {
2955
+ t2 = CSS.Translate.toString(transform);
2956
+ $[2] = transform;
2957
+ $[3] = t2;
2829
2958
  } else {
2830
- t2 = $[6];
2959
+ t2 = $[3];
2960
+ }
2961
+ const t3 = isDragging ? 10 : void 0;
2962
+ let t4;
2963
+ if ($[4] !== t2 || $[5] !== t3 || $[6] !== transition) {
2964
+ t4 = {
2965
+ transform: t2,
2966
+ transition,
2967
+ zIndex: t3,
2968
+ position: "relative"
2969
+ };
2970
+ $[4] = t2;
2971
+ $[5] = t3;
2972
+ $[6] = transition;
2973
+ $[7] = t4;
2974
+ } else {
2975
+ t4 = $[7];
2976
+ }
2977
+ const style = t4;
2978
+ let t5;
2979
+ if ($[8] !== inferredPropertyKeys || $[9] !== namespace || $[10] !== propertyKey) {
2980
+ t5 = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);
2981
+ $[8] = inferredPropertyKeys;
2982
+ $[9] = namespace;
2983
+ $[10] = propertyKey;
2984
+ $[11] = t5;
2985
+ } else {
2986
+ t5 = $[11];
2831
2987
  }
2832
- const fullId = t2;
2988
+ const isPropertyInferred = t5;
2989
+ const fullId = id;
2833
2990
  const fullIdPath = getFullIdPath(propertyKey, namespace);
2834
2991
  const hasError = fullIdPath in errors;
2835
2992
  let subtree;
2836
2993
  if (typeof propertyOrBuilder === "object") {
2837
2994
  const property = propertyOrBuilder;
2838
2995
  if (property.dataType === "map" && property.properties) {
2839
- let t32;
2840
- if ($[7] !== collectionEditable || $[8] !== errors || $[9] !== fullId || $[10] !== onPropertyClick || $[11] !== onPropertyMove || $[12] !== onPropertyRemove || $[13] !== property.properties || $[14] !== property.propertiesOrder || $[15] !== selectedPropertyKey) {
2841
- t32 = /* @__PURE__ */ jsx(PropertyTree, { selectedPropertyKey, namespace: fullId, properties: property.properties, propertiesOrder: property.propertiesOrder, errors, onPropertyClick, onPropertyMove, onPropertyRemove, collectionEditable });
2842
- $[7] = collectionEditable;
2843
- $[8] = errors;
2844
- $[9] = fullId;
2845
- $[10] = onPropertyClick;
2846
- $[11] = onPropertyMove;
2847
- $[12] = onPropertyRemove;
2848
- $[13] = property.properties;
2849
- $[14] = property.propertiesOrder;
2850
- $[15] = selectedPropertyKey;
2851
- $[16] = t32;
2996
+ let t62;
2997
+ if ($[12] !== collectionEditable || $[13] !== errors || $[14] !== fullId || $[15] !== onPropertyClick || $[16] !== onPropertyMove || $[17] !== onPropertyRemove || $[18] !== property.properties || $[19] !== property.propertiesOrder || $[20] !== selectedPropertyKey) {
2998
+ t62 = /* @__PURE__ */ jsx(PropertyTree, { selectedPropertyKey, namespace: fullId, properties: property.properties, propertiesOrder: property.propertiesOrder, errors, onPropertyClick, onPropertyMove, onPropertyRemove, collectionEditable });
2999
+ $[12] = collectionEditable;
3000
+ $[13] = errors;
3001
+ $[14] = fullId;
3002
+ $[15] = onPropertyClick;
3003
+ $[16] = onPropertyMove;
3004
+ $[17] = onPropertyRemove;
3005
+ $[18] = property.properties;
3006
+ $[19] = property.propertiesOrder;
3007
+ $[20] = selectedPropertyKey;
3008
+ $[21] = t62;
2852
3009
  } else {
2853
- t32 = $[16];
3010
+ t62 = $[21];
2854
3011
  }
2855
- subtree = t32;
3012
+ subtree = t62;
2856
3013
  }
2857
3014
  }
2858
3015
  const selected = selectedPropertyKey === fullId;
2859
- let t3;
2860
- if ($[17] !== collectionEditable || $[18] !== propertyOrBuilder) {
2861
- t3 = propertyOrBuilder && (collectionEditable && !isPropertyBuilder(propertyOrBuilder) || editableProperty(propertyOrBuilder));
2862
- $[17] = collectionEditable;
2863
- $[18] = propertyOrBuilder;
2864
- $[19] = t3;
3016
+ let t6;
3017
+ if ($[22] !== collectionEditable || $[23] !== propertyOrBuilder) {
3018
+ t6 = propertyOrBuilder && (collectionEditable && !isPropertyBuilder(propertyOrBuilder) || editableProperty(propertyOrBuilder));
3019
+ $[22] = collectionEditable;
3020
+ $[23] = propertyOrBuilder;
3021
+ $[24] = t6;
2865
3022
  } else {
2866
- t3 = $[19];
3023
+ t6 = $[24];
2867
3024
  }
2868
- const editable = t3;
2869
- let t4;
2870
- if ($[20] !== subtree) {
2871
- t4 = subtree && /* @__PURE__ */ jsx("div", { className: "absolute border-l " + defaultBorderMixin, style: {
3025
+ const editable = t6;
3026
+ let t7;
3027
+ if ($[25] !== subtree) {
3028
+ t7 = subtree && /* @__PURE__ */ jsx("div", { className: "absolute border-l " + defaultBorderMixin, style: {
2872
3029
  left: "32px",
2873
3030
  top: "64px",
2874
3031
  bottom: "16px"
2875
3032
  } });
2876
- $[20] = subtree;
2877
- $[21] = t4;
3033
+ $[25] = subtree;
3034
+ $[26] = t7;
2878
3035
  } else {
2879
- t4 = $[21];
2880
- }
2881
- let t5;
2882
- if ($[22] !== additionalField || $[23] !== editable || $[24] !== hasError || $[25] !== namespace || $[26] !== onPropertyClick || $[27] !== propertyKey || $[28] !== propertyOrBuilder || $[29] !== selected) {
2883
- t5 = !isPropertyBuilder(propertyOrBuilder) && !additionalField && editable ? /* @__PURE__ */ jsx(PropertyFieldPreview, { property: propertyOrBuilder, onClick: onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : void 0, includeName: true, selected, hasError }) : /* @__PURE__ */ jsx(NonEditablePropertyPreview, { name: propertyKey, property: propertyOrBuilder, onClick: onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : void 0, selected });
2884
- $[22] = additionalField;
2885
- $[23] = editable;
2886
- $[24] = hasError;
2887
- $[25] = namespace;
2888
- $[26] = onPropertyClick;
2889
- $[27] = propertyKey;
2890
- $[28] = propertyOrBuilder;
2891
- $[29] = selected;
2892
- $[30] = t5;
2893
- } else {
2894
- t5 = $[30];
2895
- }
2896
- let t6;
2897
- if ($[31] !== isPropertyInferred) {
2898
- t6 = isPropertyInferred && /* @__PURE__ */ jsx(Tooltip, { title: "Inferred property", children: /* @__PURE__ */ jsx(AutorenewIcon, { size: "small", className: "p-2" }) });
2899
- $[31] = isPropertyInferred;
2900
- $[32] = t6;
2901
- } else {
2902
- t6 = $[32];
2903
- }
2904
- let t7;
2905
- if ($[33] !== namespace || $[34] !== onPropertyRemove || $[35] !== propertyKey) {
2906
- t7 = onPropertyRemove && /* @__PURE__ */ jsx(Tooltip, { title: "Remove", asChild: true, children: /* @__PURE__ */ jsx(IconButton, { size: "small", color: "inherit", onClick: () => onPropertyRemove(propertyKey, namespace), children: /* @__PURE__ */ jsx(RemoveIcon, { size: "small" }) }) });
2907
- $[33] = namespace;
2908
- $[34] = onPropertyRemove;
2909
- $[35] = propertyKey;
2910
- $[36] = t7;
2911
- } else {
2912
- t7 = $[36];
3036
+ t7 = $[26];
2913
3037
  }
2914
3038
  let t8;
2915
- if ($[37] !== onPropertyMove) {
2916
- t8 = onPropertyMove && /* @__PURE__ */ jsx(Tooltip, { title: "Move", asChild: true, children: /* @__PURE__ */ jsx(IconButton, { component: "span", size: "small", children: /* @__PURE__ */ jsx(DragHandleIcon, { size: "small" }) }) });
2917
- $[37] = onPropertyMove;
2918
- $[38] = t8;
3039
+ if ($[27] !== additionalField || $[28] !== editable || $[29] !== hasError || $[30] !== namespace || $[31] !== onPropertyClick || $[32] !== propertyKey || $[33] !== propertyOrBuilder || $[34] !== selected) {
3040
+ t8 = /* @__PURE__ */ jsx("div", { children: !isPropertyBuilder(propertyOrBuilder) && !additionalField && editable ? /* @__PURE__ */ jsx(PropertyFieldPreview, { property: propertyOrBuilder, onClick: onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : void 0, includeName: true, selected, hasError }) : /* @__PURE__ */ jsx(NonEditablePropertyPreview, { name: propertyKey, property: propertyOrBuilder, onClick: onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : void 0, selected }) });
3041
+ $[27] = additionalField;
3042
+ $[28] = editable;
3043
+ $[29] = hasError;
3044
+ $[30] = namespace;
3045
+ $[31] = onPropertyClick;
3046
+ $[32] = propertyKey;
3047
+ $[33] = propertyOrBuilder;
3048
+ $[34] = selected;
3049
+ $[35] = t8;
2919
3050
  } else {
2920
- t8 = $[38];
3051
+ t8 = $[35];
2921
3052
  }
2922
3053
  let t9;
2923
- if ($[39] !== t6 || $[40] !== t7 || $[41] !== t8) {
2924
- t9 = /* @__PURE__ */ jsxs("div", { className: "absolute top-2 right-2 flex flex-row ", children: [
2925
- t6,
2926
- t7,
2927
- t8
2928
- ] });
2929
- $[39] = t6;
2930
- $[40] = t7;
2931
- $[41] = t8;
2932
- $[42] = t9;
3054
+ if ($[36] !== isPropertyInferred) {
3055
+ t9 = isPropertyInferred && /* @__PURE__ */ jsx(Tooltip, { title: "Inferred property", children: /* @__PURE__ */ jsx(AutorenewIcon, { size: "small", className: "p-2" }) });
3056
+ $[36] = isPropertyInferred;
3057
+ $[37] = t9;
2933
3058
  } else {
2934
- t9 = $[42];
3059
+ t9 = $[37];
2935
3060
  }
2936
3061
  let t10;
2937
- if ($[43] !== subtree) {
2938
- t10 = subtree && /* @__PURE__ */ jsx("div", { className: "ml-16", children: subtree });
2939
- $[43] = subtree;
2940
- $[44] = t10;
3062
+ if ($[38] !== isPropertyInferred || $[39] !== namespace || $[40] !== onPropertyRemove || $[41] !== propertyKey) {
3063
+ t10 = onPropertyRemove && !isPropertyInferred && /* @__PURE__ */ jsx(Tooltip, { title: "Remove", asChild: true, children: /* @__PURE__ */ jsx(IconButton, { size: "small", color: "inherit", onClick: () => onPropertyRemove(propertyKey, namespace), children: /* @__PURE__ */ jsx(RemoveIcon, { size: "small" }) }) });
3064
+ $[38] = isPropertyInferred;
3065
+ $[39] = namespace;
3066
+ $[40] = onPropertyRemove;
3067
+ $[41] = propertyKey;
3068
+ $[42] = t10;
2941
3069
  } else {
2942
- t10 = $[44];
3070
+ t10 = $[42];
2943
3071
  }
2944
3072
  let t11;
2945
- if ($[45] !== provided.dragHandleProps || $[46] !== provided.draggableProps || $[47] !== provided.innerRef || $[48] !== t10 || $[49] !== t4 || $[50] !== t5 || $[51] !== t9) {
2946
- t11 = /* @__PURE__ */ jsxs("div", { ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps, className: "relative -ml-8", children: [
2947
- t4,
2948
- t5,
3073
+ if ($[43] !== attributes || $[44] !== listeners || $[45] !== onPropertyMove) {
3074
+ t11 = onPropertyMove && /* @__PURE__ */ jsx(Tooltip, { title: "Move", asChild: true, children: /* @__PURE__ */ jsx(IconButton, { component: "span", size: "small", ...attributes, ...listeners, children: /* @__PURE__ */ jsx(DragHandleIcon, { size: "small" }) }) });
3075
+ $[43] = attributes;
3076
+ $[44] = listeners;
3077
+ $[45] = onPropertyMove;
3078
+ $[46] = t11;
3079
+ } else {
3080
+ t11 = $[46];
3081
+ }
3082
+ let t12;
3083
+ if ($[47] !== t10 || $[48] !== t11 || $[49] !== t9) {
3084
+ t12 = /* @__PURE__ */ jsxs("div", { className: "absolute top-2 right-2 flex flex-row", children: [
2949
3085
  t9,
2950
- t10
3086
+ t10,
3087
+ t11
2951
3088
  ] });
2952
- $[45] = provided.dragHandleProps;
2953
- $[46] = provided.draggableProps;
2954
- $[47] = provided.innerRef;
2955
- $[48] = t10;
2956
- $[49] = t4;
2957
- $[50] = t5;
2958
- $[51] = t9;
2959
- $[52] = t11;
3089
+ $[47] = t10;
3090
+ $[48] = t11;
3091
+ $[49] = t9;
3092
+ $[50] = t12;
2960
3093
  } else {
2961
- t11 = $[52];
3094
+ t12 = $[50];
2962
3095
  }
2963
- return t11;
3096
+ let t13;
3097
+ if ($[51] !== subtree) {
3098
+ t13 = subtree && /* @__PURE__ */ jsx("div", { className: "ml-16", children: subtree });
3099
+ $[51] = subtree;
3100
+ $[52] = t13;
3101
+ } else {
3102
+ t13 = $[52];
3103
+ }
3104
+ let t14;
3105
+ if ($[53] !== t12 || $[54] !== t13 || $[55] !== t7 || $[56] !== t8) {
3106
+ t14 = /* @__PURE__ */ jsxs("div", { className: "relative", children: [
3107
+ t7,
3108
+ t8,
3109
+ t12,
3110
+ t13
3111
+ ] });
3112
+ $[53] = t12;
3113
+ $[54] = t13;
3114
+ $[55] = t7;
3115
+ $[56] = t8;
3116
+ $[57] = t14;
3117
+ } else {
3118
+ t14 = $[57];
3119
+ }
3120
+ let t15;
3121
+ if ($[58] !== setNodeRef || $[59] !== style || $[60] !== t14) {
3122
+ t15 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, className: "relative -ml-8", children: t14 });
3123
+ $[58] = setNodeRef;
3124
+ $[59] = style;
3125
+ $[60] = t14;
3126
+ $[61] = t15;
3127
+ } else {
3128
+ t15 = $[61];
3129
+ }
3130
+ return t15;
2964
3131
  }
2965
3132
  function MapPropertyField(t0) {
2966
3133
  const $ = c(67);
@@ -3174,7 +3341,7 @@ function MapPropertyField(t0) {
3174
3341
  const t19 = values.spreadChildren ?? false;
3175
3342
  let t20;
3176
3343
  if ($[40] !== t18 || $[41] !== t19) {
3177
- t20 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "small", label: "Spread children as columns", onValueChange: t18, value: t19 });
3344
+ t20 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "medium", label: "Spread children as columns", onValueChange: t18, value: t19 });
3178
3345
  $[40] = t18;
3179
3346
  $[41] = t19;
3180
3347
  $[42] = t20;
@@ -4219,7 +4386,8 @@ function ReferencePropertyField(t0) {
4219
4386
  existing,
4220
4387
  multiple,
4221
4388
  disabled,
4222
- showErrors
4389
+ showErrors,
4390
+ asString
4223
4391
  } = t0;
4224
4392
  const {
4225
4393
  values,
@@ -4237,7 +4405,7 @@ function ReferencePropertyField(t0) {
4237
4405
  }
4238
4406
  return t12;
4239
4407
  }
4240
- const pathPath = multiple ? "of.path" : "path";
4408
+ const pathPath = asString ? "reference.path" : multiple ? "of.path" : "path";
4241
4409
  let t1;
4242
4410
  if ($[1] !== pathPath || $[2] !== values) {
4243
4411
  t1 = getIn(values, pathPath);
@@ -4328,8 +4496,8 @@ function CollectionsSelect(t0) {
4328
4496
  const collections = t1;
4329
4497
  let t2;
4330
4498
  if ($[10] !== collections || $[11] !== disabled || $[12] !== error || $[13] !== handleChange || $[14] !== pathPath || $[15] !== props || $[16] !== value) {
4331
- const groups = Array.from(new Set(Object.values(collections).map(_temp$8).filter(Boolean)).values());
4332
- const ungroupedCollections = collections.filter(_temp2$5);
4499
+ const groups = Array.from(new Set(Object.values(collections).map(_temp$9).filter(Boolean)).values());
4500
+ const ungroupedCollections = collections.filter(_temp2$6);
4333
4501
  let t32;
4334
4502
  if ($[18] !== collections) {
4335
4503
  t32 = (selected) => {
@@ -4360,7 +4528,7 @@ function CollectionsSelect(t0) {
4360
4528
  }
4361
4529
  t2 = /* @__PURE__ */ jsxs(Select, { error: Boolean(error), disabled, value: value ?? "", position: "item-aligned", name: pathPath, size: "large", fullWidth: true, onChange: handleChange, label: "Target collection", renderValue: t32, ...props, children: [
4362
4530
  groups.flatMap(t42),
4363
- ungroupedCollections && /* @__PURE__ */ jsx(SelectGroup, { label: "Views", children: ungroupedCollections.map(_temp3$2) })
4531
+ ungroupedCollections && /* @__PURE__ */ jsx(SelectGroup, { label: "Views", children: ungroupedCollections.map(_temp3$3) })
4364
4532
  ] });
4365
4533
  $[10] = collections;
4366
4534
  $[11] = disabled;
@@ -4393,16 +4561,16 @@ function CollectionsSelect(t0) {
4393
4561
  }
4394
4562
  return t4;
4395
4563
  }
4396
- function _temp3$2(collection_2) {
4564
+ function _temp3$3(collection_2) {
4397
4565
  return /* @__PURE__ */ jsx(SelectItem, { value: collection_2.id ?? collection_2.path, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row", children: [
4398
4566
  /* @__PURE__ */ jsx(IconForView, { collectionOrView: collection_2 }),
4399
4567
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "font-medium ml-4", children: collection_2?.name.toUpperCase() })
4400
4568
  ] }) }, collection_2.id ?? collection_2.path);
4401
4569
  }
4402
- function _temp2$5(col) {
4570
+ function _temp2$6(col) {
4403
4571
  return !col.group;
4404
4572
  }
4405
- function _temp$8(e) {
4573
+ function _temp$9(e) {
4406
4574
  return e.group;
4407
4575
  }
4408
4576
  function DateTimePropertyField(t0) {
@@ -4477,7 +4645,7 @@ function DateTimePropertyField(t0) {
4477
4645
  }
4478
4646
  let t10;
4479
4647
  if ($[14] !== disabled || $[15] !== t5 || $[16] !== t6 || $[17] !== t7) {
4480
- t10 = /* @__PURE__ */ jsxs(Select, { name: "mode", value: t5, error: t6, size: "large", onValueChange: t7, label: "Mode", fullWidth: true, renderValue: _temp$7, disabled, children: [
4648
+ t10 = /* @__PURE__ */ jsxs(Select, { name: "mode", value: t5, error: t6, size: "large", onValueChange: t7, label: "Mode", fullWidth: true, renderValue: _temp$8, disabled, children: [
4481
4649
  t8,
4482
4650
  t9
4483
4651
  ] });
@@ -4538,7 +4706,7 @@ function DateTimePropertyField(t0) {
4538
4706
  }
4539
4707
  let t20;
4540
4708
  if ($[30] !== disabled || $[31] !== t14 || $[32] !== t15 || $[33] !== t16) {
4541
- t20 = /* @__PURE__ */ jsxs(Select, { name: "autoValue", disabled, size: "large", fullWidth: true, value: t14, onValueChange: t15, renderValue: _temp2$4, error: t16, label: "Automatic value", children: [
4709
+ t20 = /* @__PURE__ */ jsxs(Select, { name: "autoValue", disabled, size: "large", fullWidth: true, value: t14, onValueChange: t15, renderValue: _temp2$5, error: t16, label: "Automatic value", children: [
4542
4710
  t17,
4543
4711
  t18,
4544
4712
  t19
@@ -4608,7 +4776,7 @@ function DateTimePropertyField(t0) {
4608
4776
  }
4609
4777
  return t27;
4610
4778
  }
4611
- function _temp2$4(v_2) {
4779
+ function _temp2$5(v_2) {
4612
4780
  switch (v_2) {
4613
4781
  case "on_create": {
4614
4782
  return "On create";
@@ -4621,7 +4789,7 @@ function _temp2$4(v_2) {
4621
4789
  }
4622
4790
  }
4623
4791
  }
4624
- function _temp$7(v_0) {
4792
+ function _temp$8(v_0) {
4625
4793
  switch (v_0) {
4626
4794
  case "date_time": {
4627
4795
  return "Date/Time";
@@ -4646,7 +4814,7 @@ function AdvancedPropertyValidation(t0) {
4646
4814
  field,
4647
4815
  form
4648
4816
  } = t22;
4649
- return /* @__PURE__ */ jsx(SwitchControl, { label: "Hide from collection", disabled, form, tooltip: "Hide this field from the collection view. It will still be visible in the form view", field });
4817
+ return /* @__PURE__ */ jsx(SwitchControl, { label: "Hide from collection", size: "medium", disabled, form, tooltip: "Hide this field from the collection view. It will still be visible in the form view", field });
4650
4818
  } }) });
4651
4819
  $[0] = disabled;
4652
4820
  $[1] = t1;
@@ -4660,7 +4828,7 @@ function AdvancedPropertyValidation(t0) {
4660
4828
  field: field_0,
4661
4829
  form: form_0
4662
4830
  } = t32;
4663
- return /* @__PURE__ */ jsx(SwitchControl, { label: "Read only", disabled, tooltip: "Is this a read only field. Display only as a preview", form: form_0, field: field_0 });
4831
+ return /* @__PURE__ */ jsx(SwitchControl, { label: "Read only", size: "medium", disabled, tooltip: "Is this a read only field. Display only as a preview", form: form_0, field: field_0 });
4664
4832
  } }) });
4665
4833
  $[2] = disabled;
4666
4834
  $[3] = t2;
@@ -4846,6 +5014,12 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
4846
5014
  propertyConfig: "reference",
4847
5015
  editable: propertyData.editable !== void 0 ? propertyData.editable : true
4848
5016
  });
5017
+ } else if (selectedWidgetId === "reference_as_string") {
5018
+ updatedProperty = mergeDeep(propertyData, {
5019
+ dataType: "string",
5020
+ propertyConfig: "reference_as_string",
5021
+ editable: propertyData.editable !== void 0 ? propertyData.editable : true
5022
+ });
4849
5023
  } else if (selectedWidgetId === "multi_references") {
4850
5024
  updatedProperty = mergeDeep(propertyData, {
4851
5025
  dataType: "array",
@@ -4946,7 +5120,7 @@ function UrlPropertyField(t0) {
4946
5120
  }
4947
5121
  let t8;
4948
5122
  if ($[8] !== disabled || $[9] !== t2 || $[10] !== t3) {
4949
- t8 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxs(Select, { disabled, position: "item-aligned", fullWidth: true, onValueChange: t2, label: "Preview type", renderValue: _temp$6, value: t3, children: [
5123
+ t8 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsxs(Select, { disabled, position: "item-aligned", fullWidth: true, onValueChange: t2, label: "Preview type", renderValue: _temp$7, value: t3, children: [
4950
5124
  t4,
4951
5125
  t5,
4952
5126
  t6,
@@ -5012,7 +5186,7 @@ function UrlPropertyField(t0) {
5012
5186
  }
5013
5187
  return t13;
5014
5188
  }
5015
- function _temp$6(value_0) {
5189
+ function _temp$7(value_0) {
5016
5190
  switch (value_0) {
5017
5191
  case "image": {
5018
5192
  return "Image";
@@ -5028,7 +5202,7 @@ function _temp$6(value_0) {
5028
5202
  }
5029
5203
  }
5030
5204
  }
5031
- const supportedFieldsIds = ["text_field", "multiline", "markdown", "url", "email", "select", "multi_select", "number_input", "number_select", "multi_number_select", "file_upload", "multi_file_upload", "reference", "multi_references", "switch", "date_time", "group", "key_value", "repeat", "block"];
5205
+ const supportedFieldsIds = ["text_field", "multiline", "markdown", "url", "email", "select", "multi_select", "number_input", "number_select", "multi_number_select", "file_upload", "multi_file_upload", "reference", "reference_as_string", "multi_references", "switch", "date_time", "group", "key_value", "repeat", "block"];
5032
5206
  const supportedFields = Object.entries(DEFAULT_FIELD_CONFIGS).filter(([id]) => supportedFieldsIds.includes(id)).map(([id, config]) => ({
5033
5207
  [id]: config
5034
5208
  })).reduce((a, b) => ({
@@ -5652,7 +5826,7 @@ function PropertyFormDialog(t0) {
5652
5826
  }
5653
5827
  let t7;
5654
5828
  if ($[20] !== onCancel) {
5655
- t7 = onCancel && /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => {
5829
+ t7 = onCancel && /* @__PURE__ */ jsx(Button, { variant: "text", color: "primary", onClick: () => {
5656
5830
  onCancel();
5657
5831
  formexRef.current?.resetForm();
5658
5832
  }, children: "Cancel" });
@@ -5704,7 +5878,7 @@ function PropertyFormDialog(t0) {
5704
5878
  return t11;
5705
5879
  }
5706
5880
  function PropertyEditFormFields(t0) {
5707
- const $ = c(142);
5881
+ const $ = c(146);
5708
5882
  const {
5709
5883
  values,
5710
5884
  errors,
@@ -5793,7 +5967,7 @@ function PropertyEditFormFields(t0) {
5793
5967
  let t6;
5794
5968
  if ($[14] !== errors || $[15] !== onError || $[16] !== propertyNamespace || $[17] !== values?.id) {
5795
5969
  t6 = () => {
5796
- if (values?.id && onError && !isEmptyObject(errors)) {
5970
+ if (values?.id && onError) {
5797
5971
  onError(values?.id, propertyNamespace, errors);
5798
5972
  }
5799
5973
  };
@@ -5993,59 +6167,73 @@ function PropertyEditFormFields(t0) {
5993
6167
  }
5994
6168
  childComponent = t102;
5995
6169
  } else {
5996
- if (selectedFieldConfigId === "date_time") {
6170
+ if (selectedFieldConfigId === "reference_as_string") {
5997
6171
  let t102;
5998
- if ($[75] !== disabled) {
5999
- t102 = /* @__PURE__ */ jsx(DateTimePropertyField, { disabled });
6172
+ if ($[75] !== disabled || $[76] !== existing || $[77] !== showErrors) {
6173
+ t102 = /* @__PURE__ */ jsx(ReferencePropertyField, { showErrors, existing, asString: true, multiple: false, disabled });
6000
6174
  $[75] = disabled;
6001
- $[76] = t102;
6175
+ $[76] = existing;
6176
+ $[77] = showErrors;
6177
+ $[78] = t102;
6002
6178
  } else {
6003
- t102 = $[76];
6179
+ t102 = $[78];
6004
6180
  }
6005
6181
  childComponent = t102;
6006
6182
  } else {
6007
- if (selectedFieldConfigId === "multi_references") {
6183
+ if (selectedFieldConfigId === "date_time") {
6008
6184
  let t102;
6009
- if ($[77] !== disabled || $[78] !== existing || $[79] !== showErrors) {
6010
- t102 = /* @__PURE__ */ jsx(ReferencePropertyField, { showErrors, existing, multiple: true, disabled });
6011
- $[77] = disabled;
6012
- $[78] = existing;
6013
- $[79] = showErrors;
6185
+ if ($[79] !== disabled) {
6186
+ t102 = /* @__PURE__ */ jsx(DateTimePropertyField, { disabled });
6187
+ $[79] = disabled;
6014
6188
  $[80] = t102;
6015
6189
  } else {
6016
6190
  t102 = $[80];
6017
6191
  }
6018
6192
  childComponent = t102;
6019
6193
  } else {
6020
- if (selectedFieldConfigId === "repeat") {
6194
+ if (selectedFieldConfigId === "multi_references") {
6021
6195
  let t102;
6022
- if ($[81] !== allowDataInference || $[82] !== collectionEditable || $[83] !== disabled || $[84] !== existing || $[85] !== getData || $[86] !== propertyConfigs || $[87] !== showErrors) {
6023
- t102 = /* @__PURE__ */ jsx(RepeatPropertyField, { showErrors, existing, getData, allowDataInference, disabled, collectionEditable, propertyConfigs });
6024
- $[81] = allowDataInference;
6025
- $[82] = collectionEditable;
6026
- $[83] = disabled;
6027
- $[84] = existing;
6028
- $[85] = getData;
6029
- $[86] = propertyConfigs;
6030
- $[87] = showErrors;
6031
- $[88] = t102;
6196
+ if ($[81] !== disabled || $[82] !== existing || $[83] !== showErrors) {
6197
+ t102 = /* @__PURE__ */ jsx(ReferencePropertyField, { showErrors, existing, multiple: true, disabled });
6198
+ $[81] = disabled;
6199
+ $[82] = existing;
6200
+ $[83] = showErrors;
6201
+ $[84] = t102;
6032
6202
  } else {
6033
- t102 = $[88];
6203
+ t102 = $[84];
6034
6204
  }
6035
6205
  childComponent = t102;
6036
6206
  } else {
6037
- if (selectedFieldConfigId === "key_value") {
6207
+ if (selectedFieldConfigId === "repeat") {
6038
6208
  let t102;
6039
- if ($[89] !== disabled) {
6040
- t102 = /* @__PURE__ */ jsx(KeyValuePropertyField, { disabled });
6041
- $[89] = disabled;
6042
- $[90] = t102;
6209
+ if ($[85] !== allowDataInference || $[86] !== collectionEditable || $[87] !== disabled || $[88] !== existing || $[89] !== getData || $[90] !== propertyConfigs || $[91] !== showErrors) {
6210
+ t102 = /* @__PURE__ */ jsx(RepeatPropertyField, { showErrors, existing, getData, allowDataInference, disabled, collectionEditable, propertyConfigs });
6211
+ $[85] = allowDataInference;
6212
+ $[86] = collectionEditable;
6213
+ $[87] = disabled;
6214
+ $[88] = existing;
6215
+ $[89] = getData;
6216
+ $[90] = propertyConfigs;
6217
+ $[91] = showErrors;
6218
+ $[92] = t102;
6043
6219
  } else {
6044
- t102 = $[90];
6220
+ t102 = $[92];
6045
6221
  }
6046
6222
  childComponent = t102;
6047
6223
  } else {
6048
- childComponent = null;
6224
+ if (selectedFieldConfigId === "key_value") {
6225
+ let t102;
6226
+ if ($[93] !== disabled) {
6227
+ t102 = /* @__PURE__ */ jsx(KeyValuePropertyField, { disabled });
6228
+ $[93] = disabled;
6229
+ $[94] = t102;
6230
+ } else {
6231
+ t102 = $[94];
6232
+ }
6233
+ childComponent = t102;
6234
+ } else {
6235
+ childComponent = null;
6236
+ }
6049
6237
  }
6050
6238
  }
6051
6239
  }
@@ -6063,7 +6251,7 @@ function PropertyEditFormFields(t0) {
6063
6251
  }
6064
6252
  }
6065
6253
  let t10;
6066
- if ($[91] !== disabled) {
6254
+ if ($[95] !== disabled) {
6067
6255
  t10 = disabled && /* @__PURE__ */ jsxs(InfoLabel, { mode: "warn", children: [
6068
6256
  /* @__PURE__ */ jsx(Typography, { children: "This property can't be edited" }),
6069
6257
  /* @__PURE__ */ jsxs(Typography, { variant: "caption", children: [
@@ -6072,157 +6260,157 @@ function PropertyEditFormFields(t0) {
6072
6260
  " flag"
6073
6261
  ] })
6074
6262
  ] });
6075
- $[91] = disabled;
6076
- $[92] = t10;
6263
+ $[95] = disabled;
6264
+ $[96] = t10;
6077
6265
  } else {
6078
- t10 = $[92];
6266
+ t10 = $[96];
6079
6267
  }
6080
6268
  const t11 = selectedFieldConfigId;
6081
6269
  let t12;
6082
- if ($[93] !== onWidgetSelectChanged) {
6270
+ if ($[97] !== onWidgetSelectChanged) {
6083
6271
  t12 = (value) => onWidgetSelectChanged(value);
6084
- $[93] = onWidgetSelectChanged;
6085
- $[94] = t12;
6272
+ $[97] = onWidgetSelectChanged;
6273
+ $[98] = t12;
6086
6274
  } else {
6087
- t12 = $[94];
6275
+ t12 = $[98];
6088
6276
  }
6089
6277
  let t13;
6090
- if ($[95] !== onDismiss) {
6278
+ if ($[99] !== onDismiss) {
6091
6279
  t13 = (open, hasValue) => {
6092
6280
  if (!hasValue) {
6093
6281
  onDismiss?.();
6094
6282
  }
6095
6283
  setSelectOpen(open);
6096
6284
  };
6097
- $[95] = onDismiss;
6098
- $[96] = t13;
6285
+ $[99] = onDismiss;
6286
+ $[100] = t13;
6099
6287
  } else {
6100
- t13 = $[96];
6288
+ t13 = $[100];
6101
6289
  }
6102
6290
  const t14 = Boolean(selectedWidgetError);
6103
6291
  let t15;
6104
- if ($[97] !== disabled || $[98] !== existing || $[99] !== inArray || $[100] !== propertyConfigs || $[101] !== selectOpen || $[102] !== t11 || $[103] !== t12 || $[104] !== t13 || $[105] !== t14 || $[106] !== values) {
6292
+ if ($[101] !== disabled || $[102] !== existing || $[103] !== inArray || $[104] !== propertyConfigs || $[105] !== selectOpen || $[106] !== t11 || $[107] !== t12 || $[108] !== t13 || $[109] !== t14 || $[110] !== values) {
6105
6293
  t15 = /* @__PURE__ */ jsx(WidgetSelectView, { initialProperty: values, value: t11, onValueChange: t12, open: selectOpen, onOpenChange: t13, disabled, showError: t14, existing, propertyConfigs, inArray });
6106
- $[97] = disabled;
6107
- $[98] = existing;
6108
- $[99] = inArray;
6109
- $[100] = propertyConfigs;
6110
- $[101] = selectOpen;
6111
- $[102] = t11;
6112
- $[103] = t12;
6113
- $[104] = t13;
6114
- $[105] = t14;
6115
- $[106] = values;
6116
- $[107] = t15;
6117
- } else {
6118
- t15 = $[107];
6294
+ $[101] = disabled;
6295
+ $[102] = existing;
6296
+ $[103] = inArray;
6297
+ $[104] = propertyConfigs;
6298
+ $[105] = selectOpen;
6299
+ $[106] = t11;
6300
+ $[107] = t12;
6301
+ $[108] = t13;
6302
+ $[109] = t14;
6303
+ $[110] = values;
6304
+ $[111] = t15;
6305
+ } else {
6306
+ t15 = $[111];
6119
6307
  }
6120
6308
  let t16;
6121
- if ($[108] !== selectedWidgetError) {
6309
+ if ($[112] !== selectedWidgetError) {
6122
6310
  t16 = selectedWidgetError && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "ml-3.5", color: "error", children: "Required" });
6123
- $[108] = selectedWidgetError;
6124
- $[109] = t16;
6311
+ $[112] = selectedWidgetError;
6312
+ $[113] = t16;
6125
6313
  } else {
6126
- t16 = $[109];
6314
+ t16 = $[113];
6127
6315
  }
6128
6316
  let t17;
6129
- if ($[110] !== t15 || $[111] !== t16) {
6317
+ if ($[114] !== t15 || $[115] !== t16) {
6130
6318
  t17 = /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col gap-2", children: [
6131
6319
  t15,
6132
6320
  t16
6133
6321
  ] });
6134
- $[110] = t15;
6135
- $[111] = t16;
6136
- $[112] = t17;
6322
+ $[114] = t15;
6323
+ $[115] = t16;
6324
+ $[116] = t17;
6137
6325
  } else {
6138
- t17 = $[112];
6326
+ t17 = $[116];
6139
6327
  }
6140
6328
  let t18;
6141
- if ($[113] !== disabled || $[114] !== onDelete || $[115] !== values?.id) {
6329
+ if ($[117] !== disabled || $[118] !== onDelete || $[119] !== values?.id) {
6142
6330
  t18 = onDelete && values?.id && /* @__PURE__ */ jsx(IconButton, { variant: "ghost", className: "m-4", disabled, onClick: () => setDeleteDialogOpen(true), children: /* @__PURE__ */ jsx(DeleteIcon, {}) });
6143
- $[113] = disabled;
6144
- $[114] = onDelete;
6145
- $[115] = values?.id;
6146
- $[116] = t18;
6331
+ $[117] = disabled;
6332
+ $[118] = onDelete;
6333
+ $[119] = values?.id;
6334
+ $[120] = t18;
6147
6335
  } else {
6148
- t18 = $[116];
6336
+ t18 = $[120];
6149
6337
  }
6150
6338
  let t19;
6151
- if ($[117] !== t17 || $[118] !== t18) {
6339
+ if ($[121] !== t17 || $[122] !== t18) {
6152
6340
  t19 = /* @__PURE__ */ jsxs("div", { className: "flex mt-2 justify-between", children: [
6153
6341
  t17,
6154
6342
  t18
6155
6343
  ] });
6156
- $[117] = t17;
6157
- $[118] = t18;
6158
- $[119] = t19;
6344
+ $[121] = t17;
6345
+ $[122] = t18;
6346
+ $[123] = t19;
6159
6347
  } else {
6160
- t19 = $[119];
6348
+ t19 = $[123];
6161
6349
  }
6162
6350
  let t20;
6163
- if ($[120] !== autoUpdateId || $[121] !== disabled || $[122] !== existing || $[123] !== includeIdAndTitle || $[124] !== showErrors) {
6351
+ if ($[124] !== autoUpdateId || $[125] !== disabled || $[126] !== existing || $[127] !== includeIdAndTitle || $[128] !== showErrors) {
6164
6352
  t20 = includeIdAndTitle && /* @__PURE__ */ jsx(CommonPropertyFields, { showErrors, disabledId: existing, isNewProperty: !existing, disabled, autoUpdateId, ref: nameFieldRef });
6165
- $[120] = autoUpdateId;
6166
- $[121] = disabled;
6167
- $[122] = existing;
6168
- $[123] = includeIdAndTitle;
6169
- $[124] = showErrors;
6170
- $[125] = t20;
6353
+ $[124] = autoUpdateId;
6354
+ $[125] = disabled;
6355
+ $[126] = existing;
6356
+ $[127] = includeIdAndTitle;
6357
+ $[128] = showErrors;
6358
+ $[129] = t20;
6171
6359
  } else {
6172
- t20 = $[125];
6360
+ t20 = $[129];
6173
6361
  }
6174
6362
  let t21;
6175
- if ($[126] !== disabled) {
6363
+ if ($[130] !== disabled) {
6176
6364
  t21 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(AdvancedPropertyValidation, { disabled }) });
6177
- $[126] = disabled;
6178
- $[127] = t21;
6365
+ $[130] = disabled;
6366
+ $[131] = t21;
6179
6367
  } else {
6180
- t21 = $[127];
6368
+ t21 = $[131];
6181
6369
  }
6182
6370
  let t22;
6183
- if ($[128] !== childComponent || $[129] !== t20 || $[130] !== t21) {
6371
+ if ($[132] !== childComponent || $[133] !== t20 || $[134] !== t21) {
6184
6372
  t22 = /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-y-12 mt-8 mb-8", children: [
6185
6373
  t20,
6186
6374
  childComponent,
6187
6375
  t21
6188
6376
  ] });
6189
- $[128] = childComponent;
6190
- $[129] = t20;
6191
- $[130] = t21;
6192
- $[131] = t22;
6377
+ $[132] = childComponent;
6378
+ $[133] = t20;
6379
+ $[134] = t21;
6380
+ $[135] = t22;
6193
6381
  } else {
6194
- t22 = $[131];
6382
+ t22 = $[135];
6195
6383
  }
6196
6384
  let t23;
6197
- if ($[132] !== deleteDialogOpen || $[133] !== onDelete || $[134] !== propertyNamespace || $[135] !== values?.id) {
6385
+ if ($[136] !== deleteDialogOpen || $[137] !== onDelete || $[138] !== propertyNamespace || $[139] !== values?.id) {
6198
6386
  t23 = onDelete && /* @__PURE__ */ jsx(ConfirmationDialog, { open: deleteDialogOpen, onAccept: () => onDelete(values?.id, propertyNamespace), onCancel: () => setDeleteDialogOpen(false), title: /* @__PURE__ */ jsx("div", { children: "Delete this property?" }), body: /* @__PURE__ */ jsxs("div", { children: [
6199
6387
  " This will ",
6200
6388
  /* @__PURE__ */ jsx("b", { children: "not delete any data" }),
6201
6389
  ", only modify the collection."
6202
6390
  ] }) });
6203
- $[132] = deleteDialogOpen;
6204
- $[133] = onDelete;
6205
- $[134] = propertyNamespace;
6206
- $[135] = values?.id;
6207
- $[136] = t23;
6391
+ $[136] = deleteDialogOpen;
6392
+ $[137] = onDelete;
6393
+ $[138] = propertyNamespace;
6394
+ $[139] = values?.id;
6395
+ $[140] = t23;
6208
6396
  } else {
6209
- t23 = $[136];
6397
+ t23 = $[140];
6210
6398
  }
6211
6399
  let t24;
6212
- if ($[137] !== t10 || $[138] !== t19 || $[139] !== t22 || $[140] !== t23) {
6400
+ if ($[141] !== t10 || $[142] !== t19 || $[143] !== t22 || $[144] !== t23) {
6213
6401
  t24 = /* @__PURE__ */ jsxs(Fragment, { children: [
6214
6402
  t10,
6215
6403
  t19,
6216
6404
  t22,
6217
6405
  t23
6218
6406
  ] });
6219
- $[137] = t10;
6220
- $[138] = t19;
6221
- $[139] = t22;
6222
- $[140] = t23;
6223
- $[141] = t24;
6407
+ $[141] = t10;
6408
+ $[142] = t19;
6409
+ $[143] = t22;
6410
+ $[144] = t23;
6411
+ $[145] = t24;
6224
6412
  } else {
6225
- t24 = $[141];
6413
+ t24 = $[145];
6226
6414
  }
6227
6415
  return t24;
6228
6416
  }
@@ -6262,6 +6450,7 @@ const WIDGET_TYPE_MAP = {
6262
6450
  file_upload: "File",
6263
6451
  multi_file_upload: "File",
6264
6452
  reference: "Reference",
6453
+ reference_as_string: "Text",
6265
6454
  multi_references: "Reference",
6266
6455
  date_time: "Date",
6267
6456
  group: "Group",
@@ -6293,7 +6482,7 @@ function WidgetSelectView(t0) {
6293
6482
  let t6;
6294
6483
  if ($[0] !== disabled || $[1] !== existing || $[2] !== inArray || $[3] !== initialProperty || $[4] !== onOpenChange || $[5] !== onValueChange || $[6] !== open || $[7] !== propertyConfigs || $[8] !== value) {
6295
6484
  const allSupportedFields = Object.entries(supportedFields).concat(Object.entries(propertyConfigs));
6296
- const displayedWidgets = (inArray ? allSupportedFields.filter(_temp$5) : allSupportedFields).map(_temp2$3).reduce(_temp3$1, {});
6485
+ const displayedWidgets = (inArray ? allSupportedFields.filter(_temp$6) : allSupportedFields).map(_temp2$4).reduce(_temp3$2, {});
6297
6486
  const key_0 = value;
6298
6487
  const propertyConfig_1 = key_0 ? DEFAULT_FIELD_CONFIGS[key_0] ?? propertyConfigs[key_0] : void 0;
6299
6488
  const baseProperty = propertyConfig_1?.property;
@@ -6475,19 +6664,19 @@ function _temp4$1(key_1) {
6475
6664
  }
6476
6665
  return "Custom/Other";
6477
6666
  }
6478
- function _temp3$1(a, b) {
6667
+ function _temp3$2(a, b) {
6479
6668
  return {
6480
6669
  ...a,
6481
6670
  ...b
6482
6671
  };
6483
6672
  }
6484
- function _temp2$3(t0) {
6673
+ function _temp2$4(t0) {
6485
6674
  const [key, propertyConfig_0] = t0;
6486
6675
  return {
6487
6676
  [key]: propertyConfig_0
6488
6677
  };
6489
6678
  }
6490
- function _temp$5(t0) {
6679
+ function _temp$6(t0) {
6491
6680
  const [, propertyConfig] = t0;
6492
6681
  return !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.dataType !== "array";
6493
6682
  }
@@ -6581,7 +6770,7 @@ function WidgetSelectViewItem(t0) {
6581
6770
  }
6582
6771
  let t10;
6583
6772
  if ($[20] !== onClick || $[21] !== t9) {
6584
- t10 = /* @__PURE__ */ jsx(Card, { onClick, className: "flex flex-row items-center px-4 py-2", children: t9 });
6773
+ t10 = /* @__PURE__ */ jsx(Card, { onClick, className: "flex flex-row items-center px-4 py-2 m-1", children: t9 });
6585
6774
  $[20] = onClick;
6586
6775
  $[21] = t9;
6587
6776
  $[22] = t10;
@@ -6635,7 +6824,7 @@ function GetCodeDialog(t0) {
6635
6824
  if ($[3] !== code) {
6636
6825
  t3 = /* @__PURE__ */ jsxs(DialogContent, { children: [
6637
6826
  t2,
6638
- /* @__PURE__ */ jsx(Highlight, { theme: themes.vsDark, code, language: "typescript", children: _temp$4 })
6827
+ /* @__PURE__ */ jsx(Highlight, { theme: themes.vsDark, code, language: "typescript", children: _temp$5 })
6639
6828
  ] });
6640
6829
  $[3] = code;
6641
6830
  $[4] = t3;
@@ -6649,7 +6838,7 @@ function GetCodeDialog(t0) {
6649
6838
  e.preventDefault();
6650
6839
  snackbarController.open({
6651
6840
  type: "success",
6652
- message: `Copied`
6841
+ message: "Copied"
6653
6842
  });
6654
6843
  return navigator.clipboard.writeText(code);
6655
6844
  };
@@ -6668,7 +6857,7 @@ function GetCodeDialog(t0) {
6668
6857
  }
6669
6858
  let t6;
6670
6859
  if ($[9] !== t4) {
6671
- t6 = /* @__PURE__ */ jsxs(Button, { variant: "text", size: "small", onClick: t4, children: [
6860
+ t6 = /* @__PURE__ */ jsxs(Button, { variant: "text", size: "small", color: "primary", onClick: t4, children: [
6672
6861
  t5,
6673
6862
  "Copy to clipboard"
6674
6863
  ] });
@@ -6715,7 +6904,7 @@ function GetCodeDialog(t0) {
6715
6904
  }
6716
6905
  return t9;
6717
6906
  }
6718
- function _temp$4(t0) {
6907
+ function _temp$5(t0) {
6719
6908
  const {
6720
6909
  style,
6721
6910
  tokens,
@@ -6828,6 +7017,7 @@ function CollectionPropertiesEditorForm({
6828
7017
  const inferPropertiesFromData = doCollectionInference ? () => {
6829
7018
  if (!doCollectionInference) return;
6830
7019
  setInferringProperties(true);
7020
+ console.debug("CollectionEditor: inferring properties from data", doCollectionInference, values);
6831
7021
  doCollectionInference(values).then((newCollection) => {
6832
7022
  if (newCollection) makePropertiesEditable(newCollection.properties);
6833
7023
  if (!newCollection) {
@@ -6970,8 +7160,8 @@ function CollectionPropertiesEditorForm({
6970
7160
  setSelectedPropertyKey(propertyKey_2);
6971
7161
  setSelectedPropertyNamespace(namespace_5);
6972
7162
  };
6973
- const body = /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-2 h-full bg-surface-50 dark:bg-surface-900", children: [
6974
- /* @__PURE__ */ jsxs("div", { className: cls("p-4 md:p-8 pb-20 md:pb-20", "col-span-12 lg:col-span-5 h-full overflow-auto", !asDialog && "border-r " + defaultBorderMixin), children: [
7163
+ const body = /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-2 h-full bg-white dark:bg-surface-950", children: [
7164
+ /* @__PURE__ */ jsxs("div", { className: cls("bg-surface-50 dark:bg-surface-900", "p-4 md:p-8 pb-20 md:pb-20", "col-span-12 lg:col-span-5 h-full overflow-auto", !asDialog && "border-r " + defaultBorderMixin), children: [
6975
7165
  /* @__PURE__ */ jsxs("div", { className: "flex my-2", children: [
6976
7166
  /* @__PURE__ */ jsxs("div", { className: "flex-grow mb-4", children: [
6977
7167
  /* @__PURE__ */ jsx(Field, { name: "name", as: DebouncedTextField, invisible: true, className: "-ml-1", inputClassName: "text-2xl font-headers", placeholder: "Collection name", size: "small", required: true, error: Boolean(errors?.name) }),
@@ -6990,7 +7180,7 @@ function CollectionPropertiesEditorForm({
6990
7180
  /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyTree, { className: "pl-8", inferredPropertyKeys, selectedPropertyKey: selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : void 0, properties: values.properties, additionalFields: values.additionalFields, propertiesOrder: usedPropertiesOrder, onPropertyClick, onPropertyMove, onPropertyRemove: isNewCollection ? deleteProperty : void 0, collectionEditable, errors }) }),
6991
7181
  /* @__PURE__ */ jsx(Button, { className: "mt-8 w-full", color: "primary", variant: "outlined", size: "large", onClick: () => setNewPropertyDialogOpen(true), startIcon: /* @__PURE__ */ jsx(AddIcon, {}), children: "Add new property" })
6992
7182
  ] }),
6993
- !asDialog && /* @__PURE__ */ jsx("div", { className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ jsxs(Paper, { className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ", children: [
7183
+ !asDialog && /* @__PURE__ */ jsx("div", { className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ jsxs("div", { className: "sticky top-8 min-h-full w-full flex flex-col justify-center", children: [
6994
7184
  selectedPropertyFullId && selectedProperty && !isPropertyBuilder(selectedProperty) && /* @__PURE__ */ jsx(PropertyForm, { inArray: false, existingProperty: !isNewCollection, autoUpdateId: false, allowDataInference: !isNewCollection, autoOpenTypeSelect: false, propertyKey: selectedPropertyKey, propertyNamespace: selectedPropertyNamespace, property: selectedProperty, onPropertyChanged, onDelete: deleteProperty, onError: onPropertyErrorInternal, forceShowErrors: showErrors, initialErrors, getData, propertyConfigs, collectionEditable }, `edit_view_${selectedPropertyIndex}`),
6995
7185
  !selectedProperty && /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col items-center justify-center h-full gap-4", children: [
6996
7186
  /* @__PURE__ */ jsx(Typography, { variant: "label", className: "", children: emptyCollection ? "Now you can add your first property" : "Select a property to edit it" }),
@@ -7064,7 +7254,7 @@ function UnsavedChangesDialog(t0) {
7064
7254
  }
7065
7255
  let t7;
7066
7256
  if ($[10] !== handleCancel) {
7067
- t7 = /* @__PURE__ */ jsx(Button, { variant: "text", onClick: handleCancel, autoFocus: true, children: " Cancel " });
7257
+ t7 = /* @__PURE__ */ jsx(Button, { variant: "text", color: "primary", onClick: handleCancel, autoFocus: true, children: " Cancel " });
7068
7258
  $[10] = handleCancel;
7069
7259
  $[11] = t7;
7070
7260
  } else {
@@ -7072,7 +7262,7 @@ function UnsavedChangesDialog(t0) {
7072
7262
  }
7073
7263
  let t8;
7074
7264
  if ($[12] !== handleOk) {
7075
- t8 = /* @__PURE__ */ jsx(Button, { onClick: handleOk, children: " Ok " });
7265
+ t8 = /* @__PURE__ */ jsx(Button, { color: "primary", onClick: handleOk, children: " Ok " });
7076
7266
  $[12] = handleOk;
7077
7267
  $[13] = t8;
7078
7268
  } else {
@@ -7140,7 +7330,7 @@ function EntityCustomViewsSelectDialog(t0) {
7140
7330
  }
7141
7331
  let t3;
7142
7332
  if ($[4] !== entityViews) {
7143
- t3 = (entityViews ?? []).length === 0 && /* @__PURE__ */ jsx(Typography, { variant: "body2", children: "No custom views defined" });
7333
+ t3 = (entityViews ?? []).length === 0 && /* @__PURE__ */ jsx(Typography, { variant: "body2", children: "No custom views defined. Define your custom views in the customization settings, before using this dialog." });
7144
7334
  $[4] = entityViews;
7145
7335
  $[5] = t3;
7146
7336
  } else {
@@ -7160,7 +7350,7 @@ function EntityCustomViewsSelectDialog(t0) {
7160
7350
  }
7161
7351
  let t5;
7162
7352
  if ($[9] !== onClose) {
7163
- t5 = /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { variant: "outlined", onClick: () => onClose(), children: "Cancel" }) });
7353
+ t5 = /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: () => onClose(), children: "Cancel" }) });
7164
7354
  $[9] = onClose;
7165
7355
  $[10] = t5;
7166
7356
  } else {
@@ -7227,8 +7417,8 @@ function SubcollectionsEditTab(t0) {
7227
7417
  let t8;
7228
7418
  let t9;
7229
7419
  if ($[2] !== collection.entityViews || $[3] !== contextEntityViews || $[4] !== subcollections || $[5] !== values.entityViews || $[6] !== values.name) {
7230
- const resolvedEntityViews = values.entityViews?.filter(_temp$3).map((e_0) => resolveEntityView(e_0, contextEntityViews)).filter(Boolean) ?? [];
7231
- const hardCodedEntityViews = collection.entityViews?.filter(_temp2$2) ?? [];
7420
+ const resolvedEntityViews = values.entityViews?.filter(_temp$4).map((e_0) => resolveEntityView(e_0, contextEntityViews)).filter(Boolean) ?? [];
7421
+ const hardCodedEntityViews = collection.entityViews?.filter(_temp2$3) ?? [];
7232
7422
  const totalEntityViews = resolvedEntityViews.length + hardCodedEntityViews.length;
7233
7423
  t12 = "overflow-auto my-auto";
7234
7424
  T3 = Container;
@@ -7337,7 +7527,7 @@ function SubcollectionsEditTab(t0) {
7337
7527
  t182 = $[36];
7338
7528
  }
7339
7529
  t2 = resolvedEntityViews.map(t182);
7340
- t3 = hardCodedEntityViews.map(_temp3);
7530
+ t3 = hardCodedEntityViews.map(_temp3$1);
7341
7531
  $[2] = collection.entityViews;
7342
7532
  $[3] = contextEntityViews;
7343
7533
  $[4] = subcollections;
@@ -7611,7 +7801,7 @@ function SubcollectionsEditTab(t0) {
7611
7801
  function _temp4(e_6) {
7612
7802
  return e_6.id;
7613
7803
  }
7614
- function _temp3(view_0) {
7804
+ function _temp3$1(view_0) {
7615
7805
  return /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsxs(TableCell, { align: "left", children: [
7616
7806
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "flex-grow", children: view_0.name }),
7617
7807
  /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "flex-grow", children: [
@@ -7620,10 +7810,10 @@ function _temp3(view_0) {
7620
7810
  ] })
7621
7811
  ] }) }, view_0.key);
7622
7812
  }
7623
- function _temp2$2(e_1) {
7813
+ function _temp2$3(e_1) {
7624
7814
  return typeof e_1 !== "string";
7625
7815
  }
7626
- function _temp$3(e) {
7816
+ function _temp$4(e) {
7627
7817
  return typeof e === "string";
7628
7818
  }
7629
7819
  const productsCollectionTemplate = {
@@ -8102,6 +8292,10 @@ function CollectionEditorWelcomeView(t0) {
8102
8292
  setFieldValue,
8103
8293
  setValues
8104
8294
  } = useFormex();
8295
+ const noSuggestions = !loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0;
8296
+ if (!noSuggestions) {
8297
+ return null;
8298
+ }
8105
8299
  let t3;
8106
8300
  if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
8107
8301
  t3 = /* @__PURE__ */ jsx("div", { className: "flex flex-row py-2 pt-3 items-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "flex-grow", children: "New collection" }) });
@@ -8154,7 +8348,7 @@ function CollectionEditorWelcomeView(t0) {
8154
8348
  }
8155
8349
  let t8;
8156
8350
  if ($[16] !== filteredPathSuggestions || $[17] !== loadingPathSuggestions) {
8157
- t8 = !loadingPathSuggestions && (filteredPathSuggestions ?? [])?.length === 0 && /* @__PURE__ */ jsx(Typography, { variant: "caption", children: "No suggestions" });
8351
+ t8 = (filteredPathSuggestions ?? []).length === 0 && !loadingPathSuggestions && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: "No existing paths found" });
8158
8352
  $[16] = filteredPathSuggestions;
8159
8353
  $[17] = loadingPathSuggestions;
8160
8354
  $[18] = t8;
@@ -8420,7 +8614,7 @@ function CollectionEditorImportMapping(t0) {
8420
8614
  const previousFullId = getFullId(previousId, namespace);
8421
8615
  const previousPropertyPath = idToPropertiesPath(previousFullId);
8422
8616
  const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);
8423
- const newPropertiesOrder_0 = currentPropertiesOrder.map((p) => p === previousId ? id : p).filter(_temp$2);
8617
+ const newPropertiesOrder_0 = currentPropertiesOrder.map((p) => p === previousId ? id : p).filter(_temp$3);
8424
8618
  updatePropertiesOrder(newPropertiesOrder_0, namespace);
8425
8619
  const newHeadersMapping = {
8426
8620
  ...importConfig.headersMapping
@@ -8586,7 +8780,7 @@ function CollectionEditorImportMapping(t0) {
8586
8780
  }
8587
8781
  return t13;
8588
8782
  }
8589
- function _temp$2(p_0) {
8783
+ function _temp$3(p_0) {
8590
8784
  return p_0 !== void 0;
8591
8785
  }
8592
8786
  function PropertySelect(t0) {
@@ -8659,7 +8853,7 @@ function PropertySelect(t0) {
8659
8853
  }
8660
8854
  let t9;
8661
8855
  if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
8662
- t9 = Object.entries(supportedFields).map(_temp2$1);
8856
+ t9 = Object.entries(supportedFields).map(_temp2$2);
8663
8857
  $[12] = t9;
8664
8858
  } else {
8665
8859
  t9 = $[12];
@@ -8689,7 +8883,7 @@ function PropertySelect(t0) {
8689
8883
  }
8690
8884
  return t11;
8691
8885
  }
8692
- function _temp2$1(t0) {
8886
+ function _temp2$2(t0) {
8693
8887
  const [key, widget_0] = t0;
8694
8888
  return /* @__PURE__ */ jsx(PropertySelectItem, { value: key, optionDisabled: false, propertyConfig: widget_0, existing: false }, key);
8695
8889
  }
@@ -8855,7 +9049,7 @@ function CollectionEditorImportDataPreview(t0) {
8855
9049
  }
8856
9050
  let t7;
8857
9051
  if ($[12] !== propertiesOrder) {
8858
- t7 = propertiesOrder.map(_temp$1);
9052
+ t7 = propertiesOrder.map(_temp$2);
8859
9053
  $[12] = propertiesOrder;
8860
9054
  $[13] = t7;
8861
9055
  } else {
@@ -8874,7 +9068,7 @@ function CollectionEditorImportDataPreview(t0) {
8874
9068
  }
8875
9069
  return t8;
8876
9070
  }
8877
- function _temp$1(p) {
9071
+ function _temp$2(p) {
8878
9072
  return {
8879
9073
  key: p,
8880
9074
  disabled: false
@@ -8928,6 +9122,355 @@ function cleanPropertiesFromImport(properties, parentSlug = "") {
8928
9122
  idColumn
8929
9123
  };
8930
9124
  }
9125
+ function EntityActionsSelectDialog(t0) {
9126
+ const $ = c(15);
9127
+ const {
9128
+ open,
9129
+ onClose
9130
+ } = t0;
9131
+ const {
9132
+ entityActions
9133
+ } = useCustomizationController();
9134
+ let t1;
9135
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
9136
+ t1 = /* @__PURE__ */ jsx(DialogTitle, { children: "Select custom action" });
9137
+ $[0] = t1;
9138
+ } else {
9139
+ t1 = $[0];
9140
+ }
9141
+ let t2;
9142
+ if ($[1] !== entityActions || $[2] !== onClose) {
9143
+ t2 = entityActions?.map((action) => /* @__PURE__ */ jsxs(Button, { onClick: () => onClose(action.key), fullWidth: true, variant: "text", children: [
9144
+ action.name,
9145
+ " (",
9146
+ action.key,
9147
+ ")"
9148
+ ] }, action.key));
9149
+ $[1] = entityActions;
9150
+ $[2] = onClose;
9151
+ $[3] = t2;
9152
+ } else {
9153
+ t2 = $[3];
9154
+ }
9155
+ let t3;
9156
+ if ($[4] !== entityActions) {
9157
+ t3 = (entityActions ?? []).length === 0 && /* @__PURE__ */ jsx(Typography, { variant: "body2", children: "No custom actions defined. Define your custom actions in the customization settings, before using this dialog." });
9158
+ $[4] = entityActions;
9159
+ $[5] = t3;
9160
+ } else {
9161
+ t3 = $[5];
9162
+ }
9163
+ let t4;
9164
+ if ($[6] !== t2 || $[7] !== t3) {
9165
+ t4 = /* @__PURE__ */ jsxs(DialogContent, { className: "flex flex-col gap-4", children: [
9166
+ t2,
9167
+ t3
9168
+ ] });
9169
+ $[6] = t2;
9170
+ $[7] = t3;
9171
+ $[8] = t4;
9172
+ } else {
9173
+ t4 = $[8];
9174
+ }
9175
+ let t5;
9176
+ if ($[9] !== onClose) {
9177
+ t5 = /* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: () => onClose(), children: "Cancel" }) });
9178
+ $[9] = onClose;
9179
+ $[10] = t5;
9180
+ } else {
9181
+ t5 = $[10];
9182
+ }
9183
+ let t6;
9184
+ if ($[11] !== open || $[12] !== t4 || $[13] !== t5) {
9185
+ t6 = /* @__PURE__ */ jsxs(Dialog, { maxWidth: "md", open, children: [
9186
+ t1,
9187
+ t4,
9188
+ t5
9189
+ ] });
9190
+ $[11] = open;
9191
+ $[12] = t4;
9192
+ $[13] = t5;
9193
+ $[14] = t6;
9194
+ } else {
9195
+ t6 = $[14];
9196
+ }
9197
+ return t6;
9198
+ }
9199
+ function EntityActionsEditTab(t0) {
9200
+ const $ = c(64);
9201
+ const {
9202
+ collection
9203
+ } = t0;
9204
+ const {
9205
+ entityActions: contextEntityActions
9206
+ } = useCustomizationController();
9207
+ const [addEntityActionDialogOpen, setAddEntityActionDialogOpen] = React__default.useState(false);
9208
+ const [actionToDelete, setActionToDelete] = React__default.useState();
9209
+ const {
9210
+ values,
9211
+ setFieldValue
9212
+ } = useFormex();
9213
+ let T0;
9214
+ let T1;
9215
+ let T2;
9216
+ let T3;
9217
+ let t1;
9218
+ let t10;
9219
+ let t2;
9220
+ let t3;
9221
+ let t4;
9222
+ let t5;
9223
+ let t6;
9224
+ let t7;
9225
+ let t8;
9226
+ let t9;
9227
+ if ($[0] !== collection.entityActions || $[1] !== contextEntityActions || $[2] !== values.entityActions) {
9228
+ const resolvedEntityActions = values.entityActions?.filter(_temp$1).map((e_0) => resolveEntityAction(e_0, contextEntityActions)).filter(Boolean) ?? [];
9229
+ const hardCodedEntityActions = collection.entityActions?.filter(_temp2$1) ?? [];
9230
+ const totalEntityActions = resolvedEntityActions.length + hardCodedEntityActions.length;
9231
+ t10 = "overflow-auto my-auto";
9232
+ T3 = Container;
9233
+ t8 = "2xl";
9234
+ t9 = "flex flex-col gap-4 p-8 m-auto";
9235
+ t7 = "flex flex-col gap-16";
9236
+ t4 = "flex-grow flex flex-col gap-4 items-start";
9237
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
9238
+ t5 = /* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Custom actions" });
9239
+ $[17] = t5;
9240
+ } else {
9241
+ t5 = $[17];
9242
+ }
9243
+ if ($[18] !== totalEntityActions) {
9244
+ t6 = totalEntityActions === 0 && /* @__PURE__ */ jsx(Alert, { action: /* @__PURE__ */ jsx(Button, { variant: "text", size: "small", href: "https://firecms.co/docs/custom_actions", component: "a", rel: "noopener noreferrer", target: "_blank", children: "More info" }), children: "Define your own custom actions by uploading them with the CLI." });
9245
+ $[18] = totalEntityActions;
9246
+ $[19] = t6;
9247
+ } else {
9248
+ t6 = $[19];
9249
+ }
9250
+ T2 = Paper;
9251
+ t3 = "flex flex-col gap-4 p-2 w-full";
9252
+ T1 = Table;
9253
+ T0 = TableBody;
9254
+ let t112;
9255
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
9256
+ t112 = (action) => /* @__PURE__ */ jsxs(TableRow, { children: [
9257
+ /* @__PURE__ */ jsx(TableCell, { align: "left", children: /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "flex-grow", children: action.name }) }),
9258
+ /* @__PURE__ */ jsx(TableCell, { align: "right", children: /* @__PURE__ */ jsx(Tooltip, { title: "Remove", asChild: true, children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e_2) => {
9259
+ e_2.preventDefault();
9260
+ e_2.stopPropagation();
9261
+ setActionToDelete(action.key);
9262
+ }, color: "inherit", children: /* @__PURE__ */ jsx(DeleteIcon, { size: "small" }) }) }) })
9263
+ ] }, action.key);
9264
+ $[20] = t112;
9265
+ } else {
9266
+ t112 = $[20];
9267
+ }
9268
+ t1 = resolvedEntityActions.map(t112);
9269
+ t2 = hardCodedEntityActions.map(_temp3);
9270
+ $[0] = collection.entityActions;
9271
+ $[1] = contextEntityActions;
9272
+ $[2] = values.entityActions;
9273
+ $[3] = T0;
9274
+ $[4] = T1;
9275
+ $[5] = T2;
9276
+ $[6] = T3;
9277
+ $[7] = t1;
9278
+ $[8] = t10;
9279
+ $[9] = t2;
9280
+ $[10] = t3;
9281
+ $[11] = t4;
9282
+ $[12] = t5;
9283
+ $[13] = t6;
9284
+ $[14] = t7;
9285
+ $[15] = t8;
9286
+ $[16] = t9;
9287
+ } else {
9288
+ T0 = $[3];
9289
+ T1 = $[4];
9290
+ T2 = $[5];
9291
+ T3 = $[6];
9292
+ t1 = $[7];
9293
+ t10 = $[8];
9294
+ t2 = $[9];
9295
+ t3 = $[10];
9296
+ t4 = $[11];
9297
+ t5 = $[12];
9298
+ t6 = $[13];
9299
+ t7 = $[14];
9300
+ t8 = $[15];
9301
+ t9 = $[16];
9302
+ }
9303
+ let t11;
9304
+ if ($[21] !== T0 || $[22] !== t1 || $[23] !== t2) {
9305
+ t11 = /* @__PURE__ */ jsxs(T0, { children: [
9306
+ t1,
9307
+ t2
9308
+ ] });
9309
+ $[21] = T0;
9310
+ $[22] = t1;
9311
+ $[23] = t2;
9312
+ $[24] = t11;
9313
+ } else {
9314
+ t11 = $[24];
9315
+ }
9316
+ let t12;
9317
+ if ($[25] !== T1 || $[26] !== t11) {
9318
+ t12 = /* @__PURE__ */ jsx(T1, { children: t11 });
9319
+ $[25] = T1;
9320
+ $[26] = t11;
9321
+ $[27] = t12;
9322
+ } else {
9323
+ t12 = $[27];
9324
+ }
9325
+ let t13;
9326
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
9327
+ t13 = () => {
9328
+ setAddEntityActionDialogOpen(true);
9329
+ };
9330
+ $[28] = t13;
9331
+ } else {
9332
+ t13 = $[28];
9333
+ }
9334
+ let t14;
9335
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
9336
+ t14 = /* @__PURE__ */ jsx(Button, { onClick: t13, variant: "text", startIcon: /* @__PURE__ */ jsx(AddIcon, {}), children: "Add custom entity action" });
9337
+ $[29] = t14;
9338
+ } else {
9339
+ t14 = $[29];
9340
+ }
9341
+ let t15;
9342
+ if ($[30] !== T2 || $[31] !== t12 || $[32] !== t3) {
9343
+ t15 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(T2, { className: t3, children: [
9344
+ t12,
9345
+ t14
9346
+ ] }) });
9347
+ $[30] = T2;
9348
+ $[31] = t12;
9349
+ $[32] = t3;
9350
+ $[33] = t15;
9351
+ } else {
9352
+ t15 = $[33];
9353
+ }
9354
+ let t16;
9355
+ if ($[34] !== t15 || $[35] !== t4 || $[36] !== t5 || $[37] !== t6) {
9356
+ t16 = /* @__PURE__ */ jsxs("div", { className: t4, children: [
9357
+ t5,
9358
+ t6,
9359
+ t15
9360
+ ] });
9361
+ $[34] = t15;
9362
+ $[35] = t4;
9363
+ $[36] = t5;
9364
+ $[37] = t6;
9365
+ $[38] = t16;
9366
+ } else {
9367
+ t16 = $[38];
9368
+ }
9369
+ let t17;
9370
+ if ($[39] !== t16 || $[40] !== t7) {
9371
+ t17 = /* @__PURE__ */ jsx("div", { className: t7, children: t16 });
9372
+ $[39] = t16;
9373
+ $[40] = t7;
9374
+ $[41] = t17;
9375
+ } else {
9376
+ t17 = $[41];
9377
+ }
9378
+ let t18;
9379
+ if ($[42] !== T3 || $[43] !== t17 || $[44] !== t8 || $[45] !== t9) {
9380
+ t18 = /* @__PURE__ */ jsx(T3, { maxWidth: t8, className: t9, children: t17 });
9381
+ $[42] = T3;
9382
+ $[43] = t17;
9383
+ $[44] = t8;
9384
+ $[45] = t9;
9385
+ $[46] = t18;
9386
+ } else {
9387
+ t18 = $[46];
9388
+ }
9389
+ let t19;
9390
+ if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
9391
+ t19 = /* @__PURE__ */ jsx("div", { style: {
9392
+ height: "52px"
9393
+ } });
9394
+ $[47] = t19;
9395
+ } else {
9396
+ t19 = $[47];
9397
+ }
9398
+ let t20;
9399
+ if ($[48] !== actionToDelete || $[49] !== setFieldValue || $[50] !== values.entityActions) {
9400
+ t20 = actionToDelete && /* @__PURE__ */ jsx(ConfirmationDialog, { open: Boolean(actionToDelete), onAccept: () => {
9401
+ setFieldValue("entityActions", values.entityActions?.filter((e_3) => e_3 !== actionToDelete));
9402
+ setActionToDelete(void 0);
9403
+ }, onCancel: () => setActionToDelete(void 0), title: /* @__PURE__ */ jsx(Fragment, { children: "Remove this action?" }), body: /* @__PURE__ */ jsxs(Fragment, { children: [
9404
+ "This will ",
9405
+ /* @__PURE__ */ jsx("b", { children: "not delete any data" }),
9406
+ ", only the action in the CMS"
9407
+ ] }) });
9408
+ $[48] = actionToDelete;
9409
+ $[49] = setFieldValue;
9410
+ $[50] = values.entityActions;
9411
+ $[51] = t20;
9412
+ } else {
9413
+ t20 = $[51];
9414
+ }
9415
+ let t21;
9416
+ if ($[52] !== contextEntityActions || $[53] !== setFieldValue || $[54] !== values.entityActions) {
9417
+ t21 = (selectedActionKey) => {
9418
+ if (selectedActionKey) {
9419
+ console.log("Selected action key:", selectedActionKey);
9420
+ const value = [...values.entityActions ?? [], selectedActionKey].filter((e_4) => typeof e_4 === "string" && (contextEntityActions ?? []).some((action_1) => action_1.key === e_4));
9421
+ setFieldValue("entityActions", value);
9422
+ }
9423
+ setAddEntityActionDialogOpen(false);
9424
+ };
9425
+ $[52] = contextEntityActions;
9426
+ $[53] = setFieldValue;
9427
+ $[54] = values.entityActions;
9428
+ $[55] = t21;
9429
+ } else {
9430
+ t21 = $[55];
9431
+ }
9432
+ let t22;
9433
+ if ($[56] !== addEntityActionDialogOpen || $[57] !== t21) {
9434
+ t22 = /* @__PURE__ */ jsx(EntityActionsSelectDialog, { open: addEntityActionDialogOpen, onClose: t21 });
9435
+ $[56] = addEntityActionDialogOpen;
9436
+ $[57] = t21;
9437
+ $[58] = t22;
9438
+ } else {
9439
+ t22 = $[58];
9440
+ }
9441
+ let t23;
9442
+ if ($[59] !== t10 || $[60] !== t18 || $[61] !== t20 || $[62] !== t22) {
9443
+ t23 = /* @__PURE__ */ jsxs("div", { className: t10, children: [
9444
+ t18,
9445
+ t19,
9446
+ t20,
9447
+ t22
9448
+ ] });
9449
+ $[59] = t10;
9450
+ $[60] = t18;
9451
+ $[61] = t20;
9452
+ $[62] = t22;
9453
+ $[63] = t23;
9454
+ } else {
9455
+ t23 = $[63];
9456
+ }
9457
+ return t23;
9458
+ }
9459
+ function _temp3(action_0) {
9460
+ return /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsxs(TableCell, { align: "left", children: [
9461
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "flex-grow", children: action_0.name }),
9462
+ /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "flex-grow", children: [
9463
+ "This action is defined in code with key ",
9464
+ /* @__PURE__ */ jsx("code", { children: action_0.key })
9465
+ ] })
9466
+ ] }) }, action_0.key);
9467
+ }
9468
+ function _temp2$1(e_1) {
9469
+ return typeof e_1 !== "string";
9470
+ }
9471
+ function _temp$1(e) {
9472
+ return typeof e === "string";
9473
+ }
8931
9474
  function CollectionEditorDialog(props) {
8932
9475
  const $ = c(24);
8933
9476
  const open = props.open;
@@ -9166,10 +9709,10 @@ function CollectionEditorInternal({
9166
9709
  setCurrentView("details");
9167
9710
  }
9168
9711
  };
9169
- const doCollectionInference = (collection_0) => {
9712
+ const doCollectionInference = collectionInference ? (collection_0) => {
9170
9713
  if (!collectionInference) return void 0;
9171
9714
  return collectionInference?.(collection_0.path, collection_0.collectionGroup ?? false, parentPaths ?? []);
9172
- };
9715
+ } : void 0;
9173
9716
  const inferCollectionFromData = async (newCollection) => {
9174
9717
  try {
9175
9718
  if (!doCollectionInference) {
@@ -9388,7 +9931,8 @@ function CollectionEditorInternal({
9388
9931
  !isNewCollection && /* @__PURE__ */ jsxs(Tabs, { value: currentView, innerClassName: cls(defaultBorderMixin, "px-4 h-14 w-full justify-end bg-surface-50 dark:bg-surface-950 border-b"), onValueChange: (v) => setCurrentView(v), children: [
9389
9932
  /* @__PURE__ */ jsx(Tab, { value: "details", children: "Details" }),
9390
9933
  /* @__PURE__ */ jsx(Tab, { value: "properties", children: "Properties" }),
9391
- /* @__PURE__ */ jsx(Tab, { value: "subcollections", children: "Additional views" })
9934
+ /* @__PURE__ */ jsx(Tab, { value: "subcollections", children: "Additional views" }),
9935
+ /* @__PURE__ */ jsx(Tab, { value: "custom_actions", children: "Custom actions" })
9392
9936
  ] }),
9393
9937
  /* @__PURE__ */ jsxs("form", { noValidate: true, onSubmit: formController.handleSubmit, className: cls(isNewCollection ? "h-full" : "h-[calc(100%-48px)]", "flex-grow flex flex-col relative"), children: [
9394
9938
  currentView === "loading" && /* @__PURE__ */ jsx(CircularProgressCenter, {}),
@@ -9417,6 +9961,7 @@ function CollectionEditorInternal({
9417
9961
  setDeleteRequested(true);
9418
9962
  }, children: "Reset to code" })
9419
9963
  ] }) }),
9964
+ currentView === "custom_actions" && collection && /* @__PURE__ */ jsx(EntityActionsEditTab, { collection }),
9420
9965
  currentView === "subcollections" && collection && /* @__PURE__ */ jsx(SubcollectionsEditTab, { parentCollection, configController, getUser, collectionInference, parentCollectionIds, collection }),
9421
9966
  currentView === "properties" && /* @__PURE__ */ jsx(CollectionPropertiesEditorForm, { showErrors: submitCount > 0, isNewCollection, reservedGroups, onPropertyError: (propertyKey, namespace, error_0) => {
9422
9967
  const current = removeUndefined({
@@ -9428,28 +9973,28 @@ function CollectionEditorInternal({
9428
9973
  }, getUser, getData: getDataWithPath, doCollectionInference, propertyConfigs, collectionEditable, extraIcon: extraView?.icon && /* @__PURE__ */ jsx(IconButton, { color: "primary", onClick: () => setCurrentView("extra_view"), children: extraView.icon }) }),
9429
9974
  currentView !== "welcome" && /* @__PURE__ */ jsxs(DialogActions, { position: "absolute", children: [
9430
9975
  error && /* @__PURE__ */ jsx(ErrorView, { error }),
9431
- isNewCollection && includeTemplates && currentView === "import_data_mapping" && /* @__PURE__ */ jsxs(Button, { variant: "text", type: "button", onClick: () => {
9976
+ isNewCollection && includeTemplates && currentView === "import_data_mapping" && /* @__PURE__ */ jsxs(Button, { variant: "text", type: "button", color: "primary", onClick: () => {
9432
9977
  importConfig.setInUse(false);
9433
9978
  return setCurrentView("welcome");
9434
9979
  }, children: [
9435
9980
  /* @__PURE__ */ jsx(ArrowBackIcon, {}),
9436
9981
  "Back"
9437
9982
  ] }),
9438
- isNewCollection && includeTemplates && currentView === "import_data_preview" && /* @__PURE__ */ jsxs(Button, { variant: "text", type: "button", onClick: () => {
9983
+ isNewCollection && includeTemplates && currentView === "import_data_preview" && /* @__PURE__ */ jsxs(Button, { variant: "text", type: "button", color: "primary", onClick: () => {
9439
9984
  setCurrentView("import_data_mapping");
9440
9985
  }, children: [
9441
9986
  /* @__PURE__ */ jsx(ArrowBackIcon, {}),
9442
9987
  "Back"
9443
9988
  ] }),
9444
- isNewCollection && includeTemplates && currentView === "details" && /* @__PURE__ */ jsxs(Button, { variant: "text", type: "button", onClick: () => setCurrentView("welcome"), children: [
9989
+ isNewCollection && includeTemplates && currentView === "details" && /* @__PURE__ */ jsxs(Button, { variant: "text", color: "primary", type: "button", onClick: () => setCurrentView("welcome"), children: [
9445
9990
  /* @__PURE__ */ jsx(ArrowBackIcon, {}),
9446
9991
  "Back"
9447
9992
  ] }),
9448
- isNewCollection && currentView === "properties" && /* @__PURE__ */ jsxs(Button, { variant: "text", type: "button", onClick: () => setCurrentView("details"), children: [
9993
+ isNewCollection && currentView === "properties" && /* @__PURE__ */ jsxs(Button, { variant: "text", type: "button", color: "primary", onClick: () => setCurrentView("details"), children: [
9449
9994
  /* @__PURE__ */ jsx(ArrowBackIcon, {}),
9450
9995
  "Back"
9451
9996
  ] }),
9452
- /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => {
9997
+ /* @__PURE__ */ jsx(Button, { variant: "text", color: "primary", onClick: () => {
9453
9998
  handleCancel();
9454
9999
  }, children: "Cancel" }),
9455
10000
  isNewCollection && currentView === "import_data_mapping" && /* @__PURE__ */ jsx(Button, { variant: "filled", color: "primary", onClick: onImportMappingComplete, children: "Next" }),
@@ -9533,7 +10078,7 @@ const validateId = (value, isNewCollection, existingPaths, existingIds) => {
9533
10078
  const ConfigControllerContext = React__default.createContext({});
9534
10079
  const CollectionEditorContext = React__default.createContext({});
9535
10080
  const ConfigControllerProvider = React__default.memo(function ConfigControllerProvider2(t0) {
9536
- const $ = c(67);
10081
+ const $ = c(65);
9537
10082
  const {
9538
10083
  children,
9539
10084
  collectionConfigController,
@@ -9541,7 +10086,6 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
9541
10086
  reservedGroups,
9542
10087
  collectionInference,
9543
10088
  extraView,
9544
- getPathSuggestions,
9545
10089
  getUser,
9546
10090
  getData,
9547
10091
  onAnalyticsEvent
@@ -9662,26 +10206,24 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
9662
10206
  const createCollection = t3;
9663
10207
  const t4 = configPermissions ?? defaultConfigPermissions;
9664
10208
  let t5;
9665
- if ($[6] !== createCollection || $[7] !== editCollection || $[8] !== editProperty || $[9] !== getPathSuggestions || $[10] !== t4) {
10209
+ if ($[6] !== createCollection || $[7] !== editCollection || $[8] !== editProperty || $[9] !== t4) {
9666
10210
  t5 = {
9667
10211
  editCollection,
9668
10212
  createCollection,
9669
10213
  editProperty,
9670
- configPermissions: t4,
9671
- getPathSuggestions
10214
+ configPermissions: t4
9672
10215
  };
9673
10216
  $[6] = createCollection;
9674
10217
  $[7] = editCollection;
9675
10218
  $[8] = editProperty;
9676
- $[9] = getPathSuggestions;
9677
- $[10] = t4;
9678
- $[11] = t5;
10219
+ $[9] = t4;
10220
+ $[10] = t5;
9679
10221
  } else {
9680
- t5 = $[11];
10222
+ t5 = $[10];
9681
10223
  }
9682
10224
  const t6 = Boolean(currentDialog);
9683
10225
  let t7;
9684
- if ($[12] !== currentDialog || $[13] !== navigate || $[14] !== navigation) {
10226
+ if ($[11] !== currentDialog || $[12] !== navigate || $[13] !== navigation) {
9685
10227
  t7 = (collection_0) => {
9686
10228
  if (currentDialog?.redirect) {
9687
10229
  if (collection_0 && currentDialog?.isNewCollection && !currentDialog.parentCollectionIds.length) {
@@ -9691,29 +10233,28 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
9691
10233
  }
9692
10234
  setCurrentDialog(void 0);
9693
10235
  };
9694
- $[12] = currentDialog;
9695
- $[13] = navigate;
9696
- $[14] = navigation;
9697
- $[15] = t7;
10236
+ $[11] = currentDialog;
10237
+ $[12] = navigate;
10238
+ $[13] = navigation;
10239
+ $[14] = t7;
9698
10240
  } else {
9699
- t7 = $[15];
10241
+ t7 = $[14];
9700
10242
  }
9701
10243
  let t8;
9702
- if ($[16] !== collectionConfigController || $[17] !== collectionInference || $[18] !== currentDialog || $[19] !== extraView || $[20] !== getData || $[21] !== getPathSuggestions || $[22] !== getUser || $[23] !== reservedGroups || $[24] !== t6 || $[25] !== t7) {
9703
- t8 = /* @__PURE__ */ jsx(CollectionEditorDialog, { open: t6, configController: collectionConfigController, isNewCollection: false, collectionInference, ...currentDialog, getData, reservedGroups, extraView, pathSuggestions: getPathSuggestions, getUser, handleClose: t7 });
9704
- $[16] = collectionConfigController;
9705
- $[17] = collectionInference;
9706
- $[18] = currentDialog;
9707
- $[19] = extraView;
9708
- $[20] = getData;
9709
- $[21] = getPathSuggestions;
9710
- $[22] = getUser;
9711
- $[23] = reservedGroups;
9712
- $[24] = t6;
9713
- $[25] = t7;
9714
- $[26] = t8;
10244
+ if ($[15] !== collectionConfigController || $[16] !== collectionInference || $[17] !== currentDialog || $[18] !== extraView || $[19] !== getData || $[20] !== getUser || $[21] !== reservedGroups || $[22] !== t6 || $[23] !== t7) {
10245
+ t8 = /* @__PURE__ */ jsx(CollectionEditorDialog, { open: t6, configController: collectionConfigController, isNewCollection: false, collectionInference, ...currentDialog, getData, reservedGroups, extraView, getUser, handleClose: t7 });
10246
+ $[15] = collectionConfigController;
10247
+ $[16] = collectionInference;
10248
+ $[17] = currentDialog;
10249
+ $[18] = extraView;
10250
+ $[19] = getData;
10251
+ $[20] = getUser;
10252
+ $[21] = reservedGroups;
10253
+ $[22] = t6;
10254
+ $[23] = t7;
10255
+ $[24] = t8;
9715
10256
  } else {
9716
- t8 = $[26];
10257
+ t8 = $[24];
9717
10258
  }
9718
10259
  const t9 = Boolean(currentPropertyDialog);
9719
10260
  const t10 = Boolean(currentPropertyDialog?.propertyKey);
@@ -9721,21 +10262,21 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
9721
10262
  const t12 = !currentPropertyDialog ? false : !currentPropertyDialog?.propertyKey;
9722
10263
  const t13 = currentPropertyDialog?.collectionEditable ?? false;
9723
10264
  let t14;
9724
- if ($[27] !== currentPropertyDialog || $[28] !== getData || $[29] !== navigation) {
10265
+ if ($[25] !== currentPropertyDialog || $[26] !== getData || $[27] !== navigation) {
9725
10266
  t14 = getData && currentPropertyDialog?.editedCollectionId ? () => {
9726
10267
  console.debug("get data for property", currentPropertyDialog?.editedCollectionId);
9727
10268
  const resolvedPath = navigation.resolveIdsFrom(currentPropertyDialog.editedCollectionId);
9728
10269
  return getData(resolvedPath, []);
9729
10270
  } : void 0;
9730
- $[27] = currentPropertyDialog;
9731
- $[28] = getData;
9732
- $[29] = navigation;
9733
- $[30] = t14;
10271
+ $[25] = currentPropertyDialog;
10272
+ $[26] = getData;
10273
+ $[27] = navigation;
10274
+ $[28] = t14;
9734
10275
  } else {
9735
- t14 = $[30];
10276
+ t14 = $[28];
9736
10277
  }
9737
10278
  let t15;
9738
- if ($[31] !== collectionConfigController || $[32] !== currentPropertyDialog || $[33] !== snackbarController) {
10279
+ if ($[29] !== collectionConfigController || $[30] !== currentPropertyDialog || $[31] !== snackbarController) {
9739
10280
  t15 = (t162) => {
9740
10281
  const {
9741
10282
  id: id_0,
@@ -9764,15 +10305,15 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
9764
10305
  return false;
9765
10306
  });
9766
10307
  };
9767
- $[31] = collectionConfigController;
9768
- $[32] = currentPropertyDialog;
9769
- $[33] = snackbarController;
9770
- $[34] = t15;
10308
+ $[29] = collectionConfigController;
10309
+ $[30] = currentPropertyDialog;
10310
+ $[31] = snackbarController;
10311
+ $[32] = t15;
9771
10312
  } else {
9772
- t15 = $[34];
10313
+ t15 = $[32];
9773
10314
  }
9774
10315
  let t16;
9775
- if ($[35] !== collectionConfigController || $[36] !== currentPropertyDialog?.currentPropertiesOrder || $[37] !== currentPropertyDialog?.editedCollectionId || $[38] !== currentPropertyDialog?.namespace || $[39] !== currentPropertyDialog?.parentCollectionIds || $[40] !== currentPropertyDialog?.propertyKey || $[41] !== snackbarController) {
10316
+ if ($[33] !== collectionConfigController || $[34] !== currentPropertyDialog?.currentPropertiesOrder || $[35] !== currentPropertyDialog?.editedCollectionId || $[36] !== currentPropertyDialog?.namespace || $[37] !== currentPropertyDialog?.parentCollectionIds || $[38] !== currentPropertyDialog?.propertyKey || $[39] !== snackbarController) {
9776
10317
  t16 = () => {
9777
10318
  if (!currentPropertyDialog?.propertyKey) {
9778
10319
  return;
@@ -9795,21 +10336,21 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
9795
10336
  return false;
9796
10337
  });
9797
10338
  };
9798
- $[35] = collectionConfigController;
9799
- $[36] = currentPropertyDialog?.currentPropertiesOrder;
9800
- $[37] = currentPropertyDialog?.editedCollectionId;
9801
- $[38] = currentPropertyDialog?.namespace;
9802
- $[39] = currentPropertyDialog?.parentCollectionIds;
9803
- $[40] = currentPropertyDialog?.propertyKey;
9804
- $[41] = snackbarController;
9805
- $[42] = t16;
10339
+ $[33] = collectionConfigController;
10340
+ $[34] = currentPropertyDialog?.currentPropertiesOrder;
10341
+ $[35] = currentPropertyDialog?.editedCollectionId;
10342
+ $[36] = currentPropertyDialog?.namespace;
10343
+ $[37] = currentPropertyDialog?.parentCollectionIds;
10344
+ $[38] = currentPropertyDialog?.propertyKey;
10345
+ $[39] = snackbarController;
10346
+ $[40] = t16;
9806
10347
  } else {
9807
- t16 = $[42];
10348
+ t16 = $[40];
9808
10349
  }
9809
10350
  let t17;
9810
10351
  let t18;
9811
10352
  let t19;
9812
- if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
10353
+ if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
9813
10354
  t17 = () => {
9814
10355
  setCurrentPropertyDialog(void 0);
9815
10356
  };
@@ -9817,64 +10358,64 @@ const ConfigControllerProvider = React__default.memo(function ConfigControllerPr
9817
10358
  setCurrentPropertyDialog(void 0);
9818
10359
  };
9819
10360
  t19 = {};
9820
- $[43] = t17;
9821
- $[44] = t18;
9822
- $[45] = t19;
10361
+ $[41] = t17;
10362
+ $[42] = t18;
10363
+ $[43] = t19;
9823
10364
  } else {
9824
- t17 = $[43];
9825
- t18 = $[44];
9826
- t19 = $[45];
10365
+ t17 = $[41];
10366
+ t18 = $[42];
10367
+ t19 = $[43];
9827
10368
  }
9828
10369
  let t20;
9829
- if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
10370
+ if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
9830
10371
  t20 = [];
9831
- $[46] = t20;
10372
+ $[44] = t20;
9832
10373
  } else {
9833
- t20 = $[46];
10374
+ t20 = $[44];
9834
10375
  }
9835
10376
  const t21 = currentPropertyDialog?.property;
9836
10377
  const t22 = currentPropertyDialog?.propertyKey;
9837
10378
  let t23;
9838
- if ($[47] !== propertyConfigs || $[48] !== t10 || $[49] !== t11 || $[50] !== t12 || $[51] !== t13 || $[52] !== t14 || $[53] !== t15 || $[54] !== t16 || $[55] !== t21 || $[56] !== t22 || $[57] !== t9) {
10379
+ if ($[45] !== propertyConfigs || $[46] !== t10 || $[47] !== t11 || $[48] !== t12 || $[49] !== t13 || $[50] !== t14 || $[51] !== t15 || $[52] !== t16 || $[53] !== t21 || $[54] !== t22 || $[55] !== t9) {
9839
10380
  t23 = /* @__PURE__ */ jsx(PropertyFormDialog, { open: t9, includeIdAndName: true, existingProperty: t10, autoUpdateId: t11, autoOpenTypeSelect: t12, inArray: false, collectionEditable: t13, getData: t14, onPropertyChanged: t15, onPropertyChangedImmediate: false, onDelete: t16, onError: _temp2, onOkClicked: t17, onCancel: t18, initialErrors: t19, forceShowErrors: false, existingPropertyKeys: t20, allowDataInference: true, propertyConfigs, property: t21, propertyKey: t22 });
9840
- $[47] = propertyConfigs;
9841
- $[48] = t10;
9842
- $[49] = t11;
9843
- $[50] = t12;
9844
- $[51] = t13;
9845
- $[52] = t14;
9846
- $[53] = t15;
9847
- $[54] = t16;
9848
- $[55] = t21;
9849
- $[56] = t22;
9850
- $[57] = t9;
9851
- $[58] = t23;
9852
- } else {
9853
- t23 = $[58];
10381
+ $[45] = propertyConfigs;
10382
+ $[46] = t10;
10383
+ $[47] = t11;
10384
+ $[48] = t12;
10385
+ $[49] = t13;
10386
+ $[50] = t14;
10387
+ $[51] = t15;
10388
+ $[52] = t16;
10389
+ $[53] = t21;
10390
+ $[54] = t22;
10391
+ $[55] = t9;
10392
+ $[56] = t23;
10393
+ } else {
10394
+ t23 = $[56];
9854
10395
  }
9855
10396
  let t24;
9856
- if ($[59] !== children || $[60] !== t23 || $[61] !== t5 || $[62] !== t8) {
10397
+ if ($[57] !== children || $[58] !== t23 || $[59] !== t5 || $[60] !== t8) {
9857
10398
  t24 = /* @__PURE__ */ jsxs(CollectionEditorContext.Provider, { value: t5, children: [
9858
10399
  children,
9859
10400
  t8,
9860
10401
  t23
9861
10402
  ] });
9862
- $[59] = children;
9863
- $[60] = t23;
9864
- $[61] = t5;
9865
- $[62] = t8;
9866
- $[63] = t24;
10403
+ $[57] = children;
10404
+ $[58] = t23;
10405
+ $[59] = t5;
10406
+ $[60] = t8;
10407
+ $[61] = t24;
9867
10408
  } else {
9868
- t24 = $[63];
10409
+ t24 = $[61];
9869
10410
  }
9870
10411
  let t25;
9871
- if ($[64] !== collectionConfigController || $[65] !== t24) {
10412
+ if ($[62] !== collectionConfigController || $[63] !== t24) {
9872
10413
  t25 = /* @__PURE__ */ jsx(ConfigControllerContext.Provider, { value: collectionConfigController, children: t24 });
9873
- $[64] = collectionConfigController;
9874
- $[65] = t24;
9875
- $[66] = t25;
10414
+ $[62] = collectionConfigController;
10415
+ $[63] = t24;
10416
+ $[64] = t25;
9876
10417
  } else {
9877
- t25 = $[66];
10418
+ t25 = $[64];
9878
10419
  }
9879
10420
  return t25;
9880
10421
  }, equal);
@@ -9946,14 +10487,14 @@ function EditorCollectionAction(t0) {
9946
10487
  }
9947
10488
  let t6;
9948
10489
  if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
9949
- t6 = /* @__PURE__ */ jsx(SettingsIcon, {});
10490
+ t6 = /* @__PURE__ */ jsx(SettingsIcon, { size: "small" });
9950
10491
  $[15] = t6;
9951
10492
  } else {
9952
10493
  t6 = $[15];
9953
10494
  }
9954
10495
  let t7;
9955
10496
  if ($[16] !== t4 || $[17] !== t5) {
9956
- t7 = /* @__PURE__ */ jsx(IconButton, { color: "primary", disabled: t4, onClick: t5, children: t6 });
10497
+ t7 = /* @__PURE__ */ jsx(IconButton, { size: "small", color: "primary", disabled: t4, onClick: t5, children: t6 });
9957
10498
  $[16] = t4;
9958
10499
  $[17] = t5;
9959
10500
  $[18] = t7;
@@ -10045,7 +10586,7 @@ function HomePageEditorCollectionAction(t0) {
10045
10586
  const deleteCollection = t3;
10046
10587
  let t4;
10047
10588
  if ($[11] !== permissions.deleteCollections) {
10048
- t4 = permissions.deleteCollections && /* @__PURE__ */ jsx(Menu, { trigger: /* @__PURE__ */ jsx(IconButton, { children: /* @__PURE__ */ jsx(MoreVertIcon, { size: "small" }) }), children: /* @__PURE__ */ jsxs(MenuItem, { dense: true, onClick: (event) => {
10589
+ t4 = permissions.deleteCollections && /* @__PURE__ */ jsx(Menu, { trigger: /* @__PURE__ */ jsx(IconButton, { size: "small", children: /* @__PURE__ */ jsx(MoreVertIcon, { size: "small" }) }), children: /* @__PURE__ */ jsxs(MenuItem, { dense: true, onClick: (event) => {
10049
10590
  event.preventDefault();
10050
10591
  event.stopPropagation();
10051
10592
  setDeleteRequested(true);
@@ -10060,7 +10601,7 @@ function HomePageEditorCollectionAction(t0) {
10060
10601
  }
10061
10602
  let t5;
10062
10603
  if ($[13] !== onEditCollectionClicked || $[14] !== permissions.editCollections) {
10063
- t5 = permissions.editCollections && /* @__PURE__ */ jsx(IconButton, { onClick: (event_0) => {
10604
+ t5 = permissions.editCollections && /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (event_0) => {
10064
10605
  onEditCollectionClicked();
10065
10606
  }, children: /* @__PURE__ */ jsx(SettingsIcon, { size: "small" }) });
10066
10607
  $[13] = onEditCollectionClicked;
@@ -10488,22 +11029,115 @@ function NewCollectionCard(t0) {
10488
11029
  }
10489
11030
  return t8;
10490
11031
  }
11032
+ function EditorEntityAction(t0) {
11033
+ const $ = c(23);
11034
+ const {
11035
+ path: fullPath,
11036
+ parentCollectionIds,
11037
+ collection,
11038
+ formContext
11039
+ } = t0;
11040
+ const authController = useAuthController();
11041
+ const navigationController = useNavigationController();
11042
+ const collectionEditorController = useCollectionEditorController();
11043
+ let t1;
11044
+ if ($[0] !== navigationController || $[1] !== parentCollectionIds) {
11045
+ t1 = navigationController.getCollectionFromIds(parentCollectionIds);
11046
+ $[0] = navigationController;
11047
+ $[1] = parentCollectionIds;
11048
+ $[2] = t1;
11049
+ } else {
11050
+ t1 = $[2];
11051
+ }
11052
+ const parentCollection = t1;
11053
+ let t2;
11054
+ if ($[3] !== authController || $[4] !== collection || $[5] !== collectionEditorController) {
11055
+ t2 = collectionEditorController.configPermissions ? collectionEditorController.configPermissions({
11056
+ user: authController.user,
11057
+ collection
11058
+ }).editCollections : true;
11059
+ $[3] = authController;
11060
+ $[4] = collection;
11061
+ $[5] = collectionEditorController;
11062
+ $[6] = t2;
11063
+ } else {
11064
+ t2 = $[6];
11065
+ }
11066
+ const canEditCollection = t2;
11067
+ const isDirty = formContext?.formex.dirty ?? false;
11068
+ const t3 = canEditCollection ? isDirty ? "You need to save the document before changing the schema" : "Edit schema for this form" : "You don't have permissions to edit this collection";
11069
+ const t4 = !canEditCollection || isDirty;
11070
+ let t5;
11071
+ if ($[7] !== canEditCollection || $[8] !== collection || $[9] !== collectionEditorController || $[10] !== fullPath || $[11] !== parentCollection || $[12] !== parentCollectionIds) {
11072
+ t5 = canEditCollection ? () => collectionEditorController?.editCollection({
11073
+ id: collection.id,
11074
+ fullPath,
11075
+ parentCollectionIds,
11076
+ parentCollection
11077
+ }) : void 0;
11078
+ $[7] = canEditCollection;
11079
+ $[8] = collection;
11080
+ $[9] = collectionEditorController;
11081
+ $[10] = fullPath;
11082
+ $[11] = parentCollection;
11083
+ $[12] = parentCollectionIds;
11084
+ $[13] = t5;
11085
+ } else {
11086
+ t5 = $[13];
11087
+ }
11088
+ let t6;
11089
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
11090
+ t6 = /* @__PURE__ */ jsx(SettingsIcon, { size: "small" });
11091
+ $[14] = t6;
11092
+ } else {
11093
+ t6 = $[14];
11094
+ }
11095
+ let t7;
11096
+ if ($[15] !== t4 || $[16] !== t5) {
11097
+ t7 = /* @__PURE__ */ jsx(IconButton, { color: "primary", disabled: t4, onClick: t5, children: t6 });
11098
+ $[15] = t4;
11099
+ $[16] = t5;
11100
+ $[17] = t7;
11101
+ } else {
11102
+ t7 = $[17];
11103
+ }
11104
+ let t8;
11105
+ if ($[18] !== t3 || $[19] !== t7) {
11106
+ t8 = /* @__PURE__ */ jsx(Tooltip, { asChild: true, title: t3, children: t7 });
11107
+ $[18] = t3;
11108
+ $[19] = t7;
11109
+ $[20] = t8;
11110
+ } else {
11111
+ t8 = $[20];
11112
+ }
11113
+ const editorButton = t8;
11114
+ let t9;
11115
+ if ($[21] !== editorButton) {
11116
+ t9 = /* @__PURE__ */ jsx(Fragment, { children: editorButton });
11117
+ $[21] = editorButton;
11118
+ $[22] = t9;
11119
+ } else {
11120
+ t9 = $[22];
11121
+ }
11122
+ return t9;
11123
+ }
10491
11124
  function useCollectionEditorPlugin(t0) {
10492
- const $ = c(15);
11125
+ const $ = c(22);
10493
11126
  const {
10494
11127
  collectionConfigController,
10495
11128
  configPermissions,
10496
11129
  reservedGroups,
10497
11130
  extraView,
10498
- getPathSuggestions,
10499
11131
  getUser,
10500
11132
  collectionInference,
10501
11133
  getData,
10502
- onAnalyticsEvent
11134
+ onAnalyticsEvent,
11135
+ includeIntroView: t1
10503
11136
  } = t0;
10504
- let t1;
10505
- if ($[0] !== collectionConfigController || $[1] !== collectionInference || $[2] !== configPermissions || $[3] !== extraView || $[4] !== getData || $[5] !== getPathSuggestions || $[6] !== getUser || $[7] !== onAnalyticsEvent || $[8] !== reservedGroups) {
10506
- t1 = {
11137
+ const includeIntroView = t1 === void 0 ? true : t1;
11138
+ let t2;
11139
+ if ($[0] !== collectionConfigController || $[1] !== collectionInference || $[2] !== configPermissions || $[3] !== extraView || $[4] !== getData || $[5] !== getUser || $[6] !== onAnalyticsEvent || $[7] !== reservedGroups) {
11140
+ t2 = {
10507
11141
  Component: ConfigControllerProvider,
10508
11142
  props: {
10509
11143
  collectionConfigController,
@@ -10511,7 +11145,6 @@ function useCollectionEditorPlugin(t0) {
10511
11145
  collectionInference,
10512
11146
  reservedGroups,
10513
11147
  extraView,
10514
- getPathSuggestions,
10515
11148
  getUser,
10516
11149
  getData,
10517
11150
  onAnalyticsEvent
@@ -10522,53 +11155,84 @@ function useCollectionEditorPlugin(t0) {
10522
11155
  $[2] = configPermissions;
10523
11156
  $[3] = extraView;
10524
11157
  $[4] = getData;
10525
- $[5] = getPathSuggestions;
10526
- $[6] = getUser;
10527
- $[7] = onAnalyticsEvent;
10528
- $[8] = reservedGroups;
10529
- $[9] = t1;
11158
+ $[5] = getUser;
11159
+ $[6] = onAnalyticsEvent;
11160
+ $[7] = reservedGroups;
11161
+ $[8] = t2;
10530
11162
  } else {
10531
- t1 = $[9];
11163
+ t2 = $[8];
10532
11164
  }
10533
- let t2;
10534
11165
  let t3;
10535
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
10536
- t2 = {
10537
- additionalActions: /* @__PURE__ */ jsx(NewCollectionButton, {}),
10538
- additionalChildrenStart: /* @__PURE__ */ jsx(IntroWidget, {}),
11166
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
11167
+ t3 = /* @__PURE__ */ jsx(NewCollectionButton, {});
11168
+ $[9] = t3;
11169
+ } else {
11170
+ t3 = $[9];
11171
+ }
11172
+ let t4;
11173
+ if ($[10] !== includeIntroView) {
11174
+ t4 = includeIntroView ? /* @__PURE__ */ jsx(IntroWidget, {}) : void 0;
11175
+ $[10] = includeIntroView;
11176
+ $[11] = t4;
11177
+ } else {
11178
+ t4 = $[11];
11179
+ }
11180
+ let t5;
11181
+ if ($[12] !== collectionConfigController.navigationEntries || $[13] !== collectionConfigController.saveNavigationEntries || $[14] !== t4) {
11182
+ t5 = {
11183
+ additionalActions: t3,
11184
+ additionalChildrenStart: t4,
10539
11185
  CollectionActions: HomePageEditorCollectionAction,
10540
- AdditionalCards: NewCollectionCard
11186
+ AdditionalCards: NewCollectionCard,
11187
+ allowDragAndDrop: true,
11188
+ navigationEntries: collectionConfigController.navigationEntries,
11189
+ onNavigationEntriesUpdate: collectionConfigController.saveNavigationEntries
10541
11190
  };
10542
- t3 = {
11191
+ $[12] = collectionConfigController.navigationEntries;
11192
+ $[13] = collectionConfigController.saveNavigationEntries;
11193
+ $[14] = t4;
11194
+ $[15] = t5;
11195
+ } else {
11196
+ t5 = $[15];
11197
+ }
11198
+ let t6;
11199
+ let t7;
11200
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
11201
+ t6 = {
10543
11202
  CollectionActionsStart: EditorCollectionActionStart,
10544
11203
  CollectionActions: EditorCollectionAction,
10545
11204
  HeaderAction: CollectionViewHeaderAction,
10546
11205
  AddColumnComponent: PropertyAddColumnComponent
10547
11206
  };
10548
- $[10] = t2;
10549
- $[11] = t3;
11207
+ t7 = {
11208
+ ActionsTop: EditorEntityAction
11209
+ };
11210
+ $[16] = t6;
11211
+ $[17] = t7;
10550
11212
  } else {
10551
- t2 = $[10];
10552
- t3 = $[11];
11213
+ t6 = $[16];
11214
+ t7 = $[17];
10553
11215
  }
10554
- let t4;
10555
- if ($[12] !== collectionConfigController.loading || $[13] !== t1) {
10556
- t4 = {
11216
+ let t8;
11217
+ if ($[18] !== collectionConfigController.loading || $[19] !== t2 || $[20] !== t5) {
11218
+ t8 = {
10557
11219
  key: "collection_editor",
10558
11220
  loading: collectionConfigController.loading,
10559
- provider: t1,
10560
- homePage: t2,
10561
- collectionView: t3
11221
+ provider: t2,
11222
+ homePage: t5,
11223
+ collectionView: t6,
11224
+ form: t7
10562
11225
  };
10563
- $[12] = collectionConfigController.loading;
10564
- $[13] = t1;
10565
- $[14] = t4;
11226
+ $[18] = collectionConfigController.loading;
11227
+ $[19] = t2;
11228
+ $[20] = t5;
11229
+ $[21] = t8;
10566
11230
  } else {
10567
- t4 = $[14];
11231
+ t8 = $[21];
10568
11232
  }
10569
- return t4;
11233
+ return t8;
10570
11234
  }
10571
- function IntroWidget(t0) {
11235
+ function IntroWidget() {
10572
11236
  const $ = c(11);
10573
11237
  const navigation = useNavigationController();
10574
11238
  if (!navigation.topLevelNavigation) {
@@ -10576,35 +11240,35 @@ function IntroWidget(t0) {
10576
11240
  }
10577
11241
  const authController = useAuthController();
10578
11242
  const collectionEditorController = useCollectionEditorController();
10579
- let t1;
11243
+ let t0;
10580
11244
  if ($[0] !== authController || $[1] !== collectionEditorController) {
10581
- t1 = collectionEditorController.configPermissions ? collectionEditorController.configPermissions({
11245
+ t0 = collectionEditorController.configPermissions ? collectionEditorController.configPermissions({
10582
11246
  user: authController.user
10583
11247
  }).createCollections : true;
10584
11248
  $[0] = authController;
10585
11249
  $[1] = collectionEditorController;
10586
- $[2] = t1;
11250
+ $[2] = t0;
10587
11251
  } else {
10588
- t1 = $[2];
11252
+ t0 = $[2];
10589
11253
  }
10590
- const canCreateCollections = t1;
11254
+ const canCreateCollections = t0;
10591
11255
  if (!navigation.initialised || (navigation.collections ?? []).length > 0) {
10592
11256
  return null;
10593
11257
  }
11258
+ let t1;
10594
11259
  let t2;
10595
- let t3;
10596
11260
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
10597
- t2 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "uppercase", children: "No collections found" });
10598
- t3 = /* @__PURE__ */ jsx(Typography, { children: "Start building collections in FireCMS easily. Map them to your existing database data, import from files, or use our templates." });
10599
- $[3] = t2;
10600
- $[4] = t3;
11261
+ t1 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "uppercase", children: "No collections found" });
11262
+ t2 = /* @__PURE__ */ jsx(Typography, { children: "Start building collections in FireCMS easily. Map them to your existing database data, import from files, or use our templates." });
11263
+ $[3] = t1;
11264
+ $[4] = t2;
10601
11265
  } else {
10602
- t2 = $[3];
10603
- t3 = $[4];
11266
+ t1 = $[3];
11267
+ t2 = $[4];
10604
11268
  }
10605
- let t4;
11269
+ let t3;
10606
11270
  if ($[5] !== canCreateCollections || $[6] !== collectionEditorController) {
10607
- t4 = canCreateCollections && /* @__PURE__ */ jsxs(Button, { onClick: collectionEditorController && canCreateCollections ? () => collectionEditorController.createCollection({
11271
+ t3 = canCreateCollections && /* @__PURE__ */ jsxs(Button, { onClick: collectionEditorController && canCreateCollections ? () => collectionEditorController.createCollection({
10608
11272
  parentCollectionIds: [],
10609
11273
  redirect: true,
10610
11274
  sourceClick: "new_collection_card"
@@ -10614,31 +11278,31 @@ function IntroWidget(t0) {
10614
11278
  ] });
10615
11279
  $[5] = canCreateCollections;
10616
11280
  $[6] = collectionEditorController;
10617
- $[7] = t4;
11281
+ $[7] = t3;
10618
11282
  } else {
10619
- t4 = $[7];
11283
+ t3 = $[7];
10620
11284
  }
10621
- let t5;
11285
+ let t4;
10622
11286
  if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
10623
- t5 = /* @__PURE__ */ jsx(Typography, { color: "secondary", children: "You can also define collections programmatically." });
10624
- $[8] = t5;
11287
+ t4 = /* @__PURE__ */ jsx(Typography, { color: "secondary", children: "You can also define collections programmatically." });
11288
+ $[8] = t4;
10625
11289
  } else {
10626
- t5 = $[8];
11290
+ t4 = $[8];
10627
11291
  }
10628
- let t6;
10629
- if ($[9] !== t4) {
10630
- t6 = /* @__PURE__ */ jsxs(Paper, { className: "my-4 px-4 py-6 flex flex-col bg-white dark:bg-surface-accent-800 gap-2", children: [
11292
+ let t5;
11293
+ if ($[9] !== t3) {
11294
+ t5 = /* @__PURE__ */ jsxs(Paper, { className: "my-4 px-4 py-6 flex flex-col bg-white dark:bg-surface-accent-800 gap-2", children: [
11295
+ t1,
10631
11296
  t2,
10632
11297
  t3,
10633
- t4,
10634
- t5
11298
+ t4
10635
11299
  ] });
10636
- $[9] = t4;
10637
- $[10] = t6;
11300
+ $[9] = t3;
11301
+ $[10] = t5;
10638
11302
  } else {
10639
- t6 = $[10];
11303
+ t5 = $[10];
10640
11304
  }
10641
- return t6;
11305
+ return t5;
10642
11306
  }
10643
11307
  const mergeCollections = (baseCollections, backendCollections = [], modifyCollection) => {
10644
11308
  const markAsEditable = (c2) => {
@@ -10647,11 +11311,19 @@ const mergeCollections = (baseCollections, backendCollections = [], modifyCollec
10647
11311
  };
10648
11312
  backendCollections.forEach(markAsEditable);
10649
11313
  const result = joinCollectionLists(baseCollections, backendCollections, [], modifyCollection);
10650
- result.sort((a, b) => baseCollections.findIndex((c2) => c2.id === a.id) - baseCollections.findIndex((c2) => c2.id === b.id));
10651
- console.debug("Collections result", {
10652
- baseCollections,
10653
- backendCollections,
10654
- result
11314
+ result.sort((a, b) => {
11315
+ const indexA = baseCollections.findIndex((c2) => c2.id === a.id);
11316
+ const indexB = baseCollections.findIndex((c2) => c2.id === b.id);
11317
+ if (indexA === -1 && indexB === -1) {
11318
+ return 0;
11319
+ }
11320
+ if (indexA === -1) {
11321
+ return 1;
11322
+ }
11323
+ if (indexB === -1) {
11324
+ return -1;
11325
+ }
11326
+ return indexA - indexB;
10655
11327
  });
10656
11328
  return result;
10657
11329
  };