@firecms/collection_editor 3.0.0-beta.14 → 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 (32) hide show
  1. package/dist/index.es.js +1345 -870
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.umd.js +1343 -868
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/types/collection_inference.d.ts +3 -0
  6. package/dist/types/config_controller.d.ts +3 -1
  7. package/dist/ui/EditorEntityAction.d.ts +2 -0
  8. package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -1
  9. package/dist/ui/collection_editor/EntityActionsEditTab.d.ts +4 -0
  10. package/dist/ui/collection_editor/EntityActionsSelectDialog.d.ts +4 -0
  11. package/dist/ui/collection_editor/properties/ReferencePropertyField.d.ts +2 -1
  12. package/package.json +8 -8
  13. package/src/types/collection_inference.ts +3 -0
  14. package/src/types/config_controller.tsx +4 -1
  15. package/src/ui/EditorCollectionAction.tsx +2 -7
  16. package/src/ui/EditorEntityAction.tsx +51 -0
  17. package/src/ui/collection_editor/CollectionDetailsForm.tsx +36 -38
  18. package/src/ui/collection_editor/CollectionEditorDialog.tsx +18 -5
  19. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +10 -4
  20. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +3 -2
  21. package/src/ui/collection_editor/EntityActionsEditTab.tsx +163 -0
  22. package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +41 -0
  23. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +5 -2
  24. package/src/ui/collection_editor/GetCodeDialog.tsx +5 -3
  25. package/src/ui/collection_editor/PropertyEditView.tsx +10 -1
  26. package/src/ui/collection_editor/PropertyFieldPreview.tsx +1 -0
  27. package/src/ui/collection_editor/UnsavedChangesDialog.tsx +6 -2
  28. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +5 -3
  29. package/src/ui/collection_editor/utils/supported_fields.tsx +1 -0
  30. package/src/ui/collection_editor/utils/update_property_for_widget.ts +9 -0
  31. package/src/useCollectionEditorPlugin.tsx +7 -1
  32. package/src/utils/collections.ts +14 -5
package/dist/index.es.js CHANGED
@@ -1,10 +1,10 @@
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, ConfirmationDialog, isEmptyObject, 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, BooleanSwitchWithLabel, SettingsIcon, CloseIcon, Select, ExpandablePanel, Dialog, 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";
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";
@@ -165,7 +165,7 @@ function LayoutModeSwitch(t0) {
165
165
  return t18;
166
166
  }
167
167
  function CollectionDetailsForm(t0) {
168
- const $ = c(196);
168
+ const $ = c(192);
169
169
  const {
170
170
  isNewCollection,
171
171
  reservedGroups,
@@ -181,7 +181,6 @@ function CollectionDetailsForm(t0) {
181
181
  touched,
182
182
  errors,
183
183
  setFieldTouched,
184
- isSubmitting,
185
184
  submitCount
186
185
  } = useFormex();
187
186
  useCollectionEditorController();
@@ -249,7 +248,7 @@ function CollectionDetailsForm(t0) {
249
248
  t5 = $[10];
250
249
  }
251
250
  const collectionIcon = t5;
252
- const groupOptions = groups?.filter((group) => !reservedGroups?.includes(group));
251
+ groups?.filter((group) => !reservedGroups?.includes(group));
253
252
  let t6;
254
253
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
255
254
  t6 = {
@@ -259,10 +258,7 @@ function CollectionDetailsForm(t0) {
259
258
  } else {
260
259
  t6 = $[11];
261
260
  }
262
- const {
263
- autoCompleteOpen,
264
- setAutoCompleteOpen
265
- } = useAutoComplete(t6);
261
+ useAutoComplete(t6);
266
262
  const isSubcollection = !!parentCollection;
267
263
  let customIdValue;
268
264
  if (typeof values.customId === "object") {
@@ -281,333 +277,317 @@ function CollectionDetailsForm(t0) {
281
277
  }
282
278
  }
283
279
  const showErrors = submitCount > 0;
284
- const t7 = "overflow-auto my-auto";
285
- const T0 = Container;
286
- const t8 = "4xl";
287
- const t9 = "flex flex-col gap-4 p-8 m-auto";
288
- const t10 = !isNewCollection ? "h5" : "h4";
289
- const t11 = isNewCollection ? "New collection" : `${values?.name} collection`;
290
- let t12;
291
- if ($[12] !== t10 || $[13] !== t11) {
292
- t12 = /* @__PURE__ */ jsx(Typography, { variant: t10, className: "flex-grow", children: t11 });
293
- $[12] = t10;
294
- $[13] = t11;
295
- $[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;
296
288
  } else {
297
- t12 = $[14];
289
+ t9 = $[14];
298
290
  }
299
- let t13;
291
+ let t10;
300
292
  if ($[15] !== updateDatabaseId || $[16] !== values.databaseId) {
301
- t13 = /* @__PURE__ */ jsx(DefaultDatabaseField, { databaseId: values.databaseId, onDatabaseIdUpdate: updateDatabaseId });
293
+ t10 = /* @__PURE__ */ jsx(DefaultDatabaseField, { databaseId: values.databaseId, onDatabaseIdUpdate: updateDatabaseId });
302
294
  $[15] = updateDatabaseId;
303
295
  $[16] = values.databaseId;
304
- $[17] = t13;
296
+ $[17] = t10;
305
297
  } else {
306
- t13 = $[17];
298
+ t10 = $[17];
307
299
  }
308
- let t14;
300
+ let t11;
309
301
  if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
310
- t14 = () => setIconDialogOpen(true);
311
- $[18] = t14;
302
+ t11 = () => setIconDialogOpen(true);
303
+ $[18] = t11;
312
304
  } else {
313
- t14 = $[18];
305
+ t11 = $[18];
314
306
  }
315
- let t15;
307
+ let t12;
316
308
  if ($[19] !== collectionIcon) {
317
- 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 }) });
318
310
  $[19] = collectionIcon;
319
- $[20] = t15;
311
+ $[20] = t12;
320
312
  } else {
321
- t15 = $[20];
313
+ t12 = $[20];
322
314
  }
323
- let t16;
324
- if ($[21] !== t12 || $[22] !== t13 || $[23] !== t15) {
325
- t16 = /* @__PURE__ */ jsxs("div", { className: "flex flex-row gap-2 py-2 pt-3 items-center", children: [
326
- t12,
327
- t13,
328
- 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
329
321
  ] });
330
- $[21] = t12;
331
- $[22] = t13;
332
- $[23] = t15;
333
- $[24] = t16;
322
+ $[21] = t10;
323
+ $[22] = t12;
324
+ $[23] = t9;
325
+ $[24] = t13;
334
326
  } else {
335
- t16 = $[24];
327
+ t13 = $[24];
336
328
  }
337
- let t17;
329
+ let t14;
338
330
  if ($[25] !== parentCollection) {
339
- 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: [
340
332
  "This is a subcollection of ",
341
333
  /* @__PURE__ */ jsx("b", { children: parentCollection.name })
342
334
  ] }) });
343
335
  $[25] = parentCollection;
344
- $[26] = t17;
336
+ $[26] = t14;
345
337
  } else {
346
- t17 = $[26];
338
+ t14 = $[26];
347
339
  }
348
- let t18;
349
- if ($[27] !== t16 || $[28] !== t17) {
350
- t18 = /* @__PURE__ */ jsxs("div", { children: [
351
- t16,
352
- t17
340
+ let t15;
341
+ if ($[27] !== t13 || $[28] !== t14) {
342
+ t15 = /* @__PURE__ */ jsxs("div", { children: [
343
+ t13,
344
+ t14
353
345
  ] });
354
- $[27] = t16;
355
- $[28] = t17;
356
- $[29] = t18;
346
+ $[27] = t13;
347
+ $[28] = t14;
348
+ $[29] = t15;
357
349
  } else {
358
- t18 = $[29];
350
+ t15 = $[29];
359
351
  }
360
- const t19 = "grid grid-cols-12 gap-4";
361
- const t20 = values.name ?? "";
362
- let t21;
352
+ const t16 = values.name ?? "";
353
+ let t17;
363
354
  if ($[30] !== updateName) {
364
- t21 = (e) => updateName(e.target.value);
355
+ t17 = (e) => updateName(e.target.value);
365
356
  $[30] = updateName;
366
- $[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;
369
+ } else {
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;
367
380
  } else {
368
- t21 = $[31];
381
+ t22 = $[38];
369
382
  }
370
- const t22 = showErrors && Boolean(errors.name);
371
383
  let t23;
372
- if ($[32] !== t20 || $[33] !== t21 || $[34] !== t22) {
373
- t23 = /* @__PURE__ */ jsx(TextField, { value: t20, onChange: t21, label: "Name", autoFocus: true, required: true, error: t22 });
374
- $[32] = t20;
375
- $[33] = t21;
376
- $[34] = t22;
377
- $[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;
378
392
  } else {
379
- t23 = $[35];
393
+ t23 = $[41];
380
394
  }
381
- const t24 = touched.name && Boolean(errors.name);
382
- const t25 = touched.name && Boolean(errors.name) ? errors.name : "Name of this collection, usually a plural name (e.g. Products)";
383
- let t26;
384
- if ($[36] !== t24 || $[37] !== t25) {
385
- t26 = /* @__PURE__ */ jsx(FieldCaption, { error: t24, children: t25 });
386
- $[36] = t24;
387
- $[37] = t25;
388
- $[38] = t26;
395
+ let t24;
396
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
397
+ t24 = cls("col-span-12 ");
398
+ $[42] = t24;
389
399
  } else {
390
- t26 = $[38];
400
+ t24 = $[42];
391
401
  }
402
+ const t25 = !isNewCollection;
403
+ const t26 = showErrors && Boolean(errors.path);
392
404
  let t27;
393
- if ($[39] !== t23 || $[40] !== t26) {
394
- t27 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
395
- t23,
396
- 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
397
429
  ] });
398
- $[39] = t23;
399
- $[40] = t26;
400
- $[41] = t27;
430
+ $[49] = t27;
431
+ $[50] = t30;
432
+ $[51] = t31;
401
433
  } else {
402
- t27 = $[41];
434
+ t31 = $[51];
403
435
  }
404
- const t28 = isSubcollection ? "" : "sm:col-span-8";
405
- let t29;
406
- if ($[42] !== t28) {
407
- t29 = cls("col-span-12 ", t28);
408
- $[42] = t28;
409
- $[43] = t29;
410
- } else {
411
- t29 = $[43];
412
- }
413
- const t30 = !isNewCollection;
414
- const t31 = showErrors && Boolean(errors.path);
415
- let t32;
416
- if ($[44] !== t30 || $[45] !== t31) {
417
- t32 = /* @__PURE__ */ jsx(Field, { name: "path", as: DebouncedTextField, label: "Path", disabled: t30, required: true, error: t31 });
418
- $[44] = t30;
419
- $[45] = t31;
420
- $[46] = t32;
421
- } else {
422
- t32 = $[46];
423
- }
424
- const t33 = touched.path && Boolean(errors.path);
425
- 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";
426
- let t35;
427
- if ($[47] !== t33 || $[48] !== t34) {
428
- t35 = /* @__PURE__ */ jsx(FieldCaption, { error: t33, children: t34 });
429
- $[47] = t33;
430
- $[48] = t34;
431
- $[49] = t35;
432
- } else {
433
- 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];
434
444
  }
435
- let t36;
436
- if ($[50] !== t29 || $[51] !== t32 || $[52] !== t35) {
437
- t36 = /* @__PURE__ */ jsxs("div", { className: t29, children: [
438
- t32,
439
- t35
440
- ] });
441
- $[50] = t29;
442
- $[51] = t32;
443
- $[52] = t35;
444
- $[53] = t36;
445
- } else {
446
- t36 = $[53];
447
- }
448
- const t37 = !isSubcollection && /* @__PURE__ */ jsxs("div", { className: "col-span-12 sm:col-span-4 relative", children: [
449
- /* @__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" }),
450
- /* @__PURE__ */ jsx(Autocomplete, { open: autoCompleteOpen && (groupOptions ?? []).length > 0, setOpen: setAutoCompleteOpen, children: groupOptions?.map((group_0, index) => /* @__PURE__ */ jsx(AutocompleteItem, { className: "pr-6 pl-14", onClick: () => {
451
- setAutoCompleteOpen(false);
452
- setFieldValue("group", group_0 ?? null);
453
- }, children: /* @__PURE__ */ jsx("div", { className: "flex-grow", children: group_0 }) }, index + "_" + group_0)) }),
454
- /* @__PURE__ */ jsx(FieldCaption, { children: showErrors && Boolean(errors.group) ? errors.group : "Group in the home page" })
455
- ] });
456
- const t38 = values.openEntityMode ?? "side_panel";
457
- let t39;
458
- if ($[54] !== setFieldValue) {
459
- t39 = (value) => setFieldValue("openEntityMode", value);
460
- $[54] = setFieldValue;
461
- $[55] = t39;
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;
462
451
  } else {
463
- t39 = $[55];
452
+ t34 = $[56];
464
453
  }
465
- let t40;
466
- if ($[56] !== t38 || $[57] !== t39) {
467
- t40 = /* @__PURE__ */ jsx(LayoutModeSwitch, { className: "col-span-12", value: t38, onChange: t39 });
468
- $[56] = t38;
469
- $[57] = t39;
470
- $[58] = t40;
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";
455
+ let t36;
456
+ if ($[57] !== setFieldValue) {
457
+ t36 = (v) => setFieldValue("history", v);
458
+ $[57] = setFieldValue;
459
+ $[58] = t36;
471
460
  } else {
472
- t40 = $[58];
461
+ t36 = $[58];
473
462
  }
474
- const t41 = 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";
475
- let t42;
476
- if ($[59] !== setFieldValue) {
477
- t42 = (v) => setFieldValue("history", v);
478
- $[59] = setFieldValue;
479
- $[60] = t42;
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;
480
471
  } else {
481
- t42 = $[60];
472
+ t38 = $[62];
482
473
  }
483
- const t43 = values.history === void 0 ? null : values.history;
484
- let t44;
485
- if ($[61] !== t41 || $[62] !== t42 || $[63] !== t43) {
486
- t44 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", allowIndeterminate: true, label: t41, onValueChange: t42, value: t43 });
487
- $[61] = t41;
488
- $[62] = t42;
489
- $[63] = t43;
490
- $[64] = t44;
491
- } else {
492
- t44 = $[64];
493
- }
494
- let t45;
495
- if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
496
- t45 = /* @__PURE__ */ jsxs(FieldCaption, { children: [
474
+ let t39;
475
+ if ($[63] === Symbol.for("react.memo_cache_sentinel")) {
476
+ t39 = /* @__PURE__ */ jsxs(FieldCaption, { children: [
497
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 ",
498
478
  /* @__PURE__ */ jsx("b", { children: "__history" }),
499
479
  "."
500
480
  ] });
501
- $[65] = t45;
481
+ $[63] = t39;
502
482
  } else {
503
- t45 = $[65];
483
+ t39 = $[63];
504
484
  }
505
- let t46;
506
- if ($[66] !== t44) {
507
- t46 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
508
- t44,
509
- t45
485
+ let t40;
486
+ if ($[64] !== t38) {
487
+ t40 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
488
+ t38,
489
+ t39
510
490
  ] });
511
- $[66] = t44;
512
- $[67] = t46;
491
+ $[64] = t38;
492
+ $[65] = t40;
513
493
  } else {
514
- t46 = $[67];
494
+ t40 = $[65];
515
495
  }
516
- let t47;
517
- if ($[68] === Symbol.for("react.memo_cache_sentinel")) {
518
- t47 = /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-surface-500", children: [
496
+ let t41;
497
+ if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
498
+ t41 = /* @__PURE__ */ jsxs("div", { className: "flex flex-row text-surface-500", children: [
519
499
  /* @__PURE__ */ jsx(SettingsIcon, {}),
520
500
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "ml-2", children: "Advanced" })
521
501
  ] });
522
- $[68] = t47;
502
+ $[66] = t41;
523
503
  } else {
524
- t47 = $[68];
504
+ t41 = $[66];
525
505
  }
526
- const t48 = !isNewCollection;
527
- const t49 = showErrors && Boolean(errors.id);
528
- let t50;
529
- if ($[69] !== t48 || $[70] !== t49) {
530
- t50 = /* @__PURE__ */ jsx(Field, { name: "id", as: DebouncedTextField, disabled: t48, label: "Collection id", error: t49 });
531
- $[69] = t48;
532
- $[70] = t49;
533
- $[71] = t50;
534
- } else {
535
- t50 = $[71];
536
- }
537
- const t51 = touched.id && Boolean(errors.id);
538
- const t52 = touched.id && Boolean(errors.id) ? errors.id : "This id identifies this collection. Typically the same as the path.";
539
- let t53;
540
- if ($[72] !== t51 || $[73] !== t52) {
541
- t53 = /* @__PURE__ */ jsx(FieldCaption, { error: t51, children: t52 });
542
- $[72] = t51;
543
- $[73] = t52;
544
- $[74] = t53;
545
- } else {
546
- t53 = $[74];
547
- }
548
- let t54;
549
- if ($[75] !== t50 || $[76] !== t53) {
550
- t54 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
551
- t50,
552
- t53
553
- ] });
554
- $[75] = t50;
555
- $[76] = t53;
556
- $[77] = t54;
557
- } else {
558
- t54 = $[77];
559
- }
560
- const t55 = showErrors && Boolean(errors.singularName);
561
- let t56;
562
- if ($[78] !== handleChange || $[79] !== setFieldTouched) {
563
- t56 = (e_0) => {
564
- setFieldTouched("singularName", true);
565
- return handleChange(e_0);
566
- };
567
- $[78] = handleChange;
568
- $[79] = setFieldTouched;
569
- $[80] = t56;
506
+ const t42 = !isNewCollection;
507
+ const t43 = showErrors && Boolean(errors.id);
508
+ let t44;
509
+ if ($[67] !== t42 || $[68] !== t43) {
510
+ t44 = /* @__PURE__ */ jsx(Field, { name: "id", as: DebouncedTextField, disabled: t42, label: "Collection id", error: t43 });
511
+ $[67] = t42;
512
+ $[68] = t43;
513
+ $[69] = t44;
570
514
  } else {
571
- t56 = $[80];
515
+ t44 = $[69];
572
516
  }
573
- const t57 = values.singularName ?? "";
574
- let t58;
575
- if ($[81] !== t55 || $[82] !== t56 || $[83] !== t57) {
576
- t58 = /* @__PURE__ */ jsx(TextField, { error: t55, name: "singularName", "aria-describedby": "singularName-helper", onChange: t56, value: t57, label: "Singular name" });
577
- $[81] = t55;
578
- $[82] = t56;
579
- $[83] = t57;
580
- $[84] = t58;
517
+ const t45 = touched.id && Boolean(errors.id);
518
+ const t46 = touched.id && Boolean(errors.id) ? errors.id : "This id identifies this collection. Typically the same as the path.";
519
+ let t47;
520
+ if ($[70] !== t45 || $[71] !== t46) {
521
+ t47 = /* @__PURE__ */ jsx(FieldCaption, { error: t45, children: t46 });
522
+ $[70] = t45;
523
+ $[71] = t46;
524
+ $[72] = t47;
581
525
  } else {
582
- t58 = $[84];
526
+ t47 = $[72];
583
527
  }
584
- const t59 = showErrors && Boolean(errors.singularName);
585
- const t60 = showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define a singular name for your entities";
586
- let t61;
587
- if ($[85] !== t59 || $[86] !== t60) {
588
- t61 = /* @__PURE__ */ jsx(FieldCaption, { error: t59, children: t60 });
589
- $[85] = t59;
590
- $[86] = t60;
591
- $[87] = t61;
528
+ let t48;
529
+ if ($[73] !== t44 || $[74] !== t47) {
530
+ t48 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
531
+ t44,
532
+ t47
533
+ ] });
534
+ $[73] = t44;
535
+ $[74] = t47;
536
+ $[75] = t48;
592
537
  } else {
593
- t61 = $[87];
538
+ t48 = $[75];
594
539
  }
595
- let t62;
596
- if ($[88] !== t58 || $[89] !== t61) {
597
- t62 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
598
- t58,
599
- t61
540
+ const t49 = showErrors && Boolean(errors.singularName);
541
+ let t50;
542
+ if ($[76] !== handleChange || $[77] !== setFieldTouched) {
543
+ t50 = (e_0) => {
544
+ setFieldTouched("singularName", true);
545
+ return handleChange(e_0);
546
+ };
547
+ $[76] = handleChange;
548
+ $[77] = setFieldTouched;
549
+ $[78] = t50;
550
+ } else {
551
+ t50 = $[78];
552
+ }
553
+ const t51 = values.singularName ?? "";
554
+ let t52;
555
+ if ($[79] !== t49 || $[80] !== t50 || $[81] !== t51) {
556
+ t52 = /* @__PURE__ */ jsx(TextField, { error: t49, name: "singularName", "aria-describedby": "singularName-helper", onChange: t50, value: t51, label: "Singular name" });
557
+ $[79] = t49;
558
+ $[80] = t50;
559
+ $[81] = t51;
560
+ $[82] = t52;
561
+ } else {
562
+ t52 = $[82];
563
+ }
564
+ const t53 = showErrors && Boolean(errors.singularName);
565
+ const t54 = showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define a singular name for your entities";
566
+ let t55;
567
+ if ($[83] !== t53 || $[84] !== t54) {
568
+ t55 = /* @__PURE__ */ jsx(FieldCaption, { error: t53, children: t54 });
569
+ $[83] = t53;
570
+ $[84] = t54;
571
+ $[85] = t55;
572
+ } else {
573
+ t55 = $[85];
574
+ }
575
+ let t56;
576
+ if ($[86] !== t52 || $[87] !== t55) {
577
+ t56 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
578
+ t52,
579
+ t55
600
580
  ] });
601
- $[88] = t58;
602
- $[89] = t61;
603
- $[90] = t62;
581
+ $[86] = t52;
582
+ $[87] = t55;
583
+ $[88] = t56;
604
584
  } else {
605
- t62 = $[90];
585
+ t56 = $[88];
606
586
  }
607
- const t63 = showErrors && Boolean(errors.sideDialogWidth);
608
- let t64;
609
- if ($[91] !== setFieldTouched || $[92] !== setFieldValue) {
610
- t64 = (e_1) => {
587
+ const t57 = showErrors && Boolean(errors.sideDialogWidth);
588
+ let t58;
589
+ if ($[89] !== setFieldTouched || $[90] !== setFieldValue) {
590
+ t58 = (e_1) => {
611
591
  setFieldTouched("sideDialogWidth", true);
612
592
  const value_0 = e_1.target.value;
613
593
  if (!value_0) {
@@ -618,404 +598,402 @@ function CollectionDetailsForm(t0) {
618
598
  }
619
599
  }
620
600
  };
621
- $[91] = setFieldTouched;
622
- $[92] = setFieldValue;
623
- $[93] = t64;
601
+ $[89] = setFieldTouched;
602
+ $[90] = setFieldValue;
603
+ $[91] = t58;
624
604
  } else {
625
- t64 = $[93];
605
+ t58 = $[91];
626
606
  }
627
- let t65;
628
- if ($[94] !== setFieldValue) {
629
- t65 = () => {
607
+ let t59;
608
+ if ($[92] !== setFieldValue) {
609
+ t59 = () => {
630
610
  setFieldValue("sideDialogWidth", null);
631
611
  };
632
- $[94] = setFieldValue;
633
- $[95] = t65;
612
+ $[92] = setFieldValue;
613
+ $[93] = t59;
614
+ } else {
615
+ t59 = $[93];
616
+ }
617
+ const t60 = !values.sideDialogWidth;
618
+ let t61;
619
+ if ($[94] === Symbol.for("react.memo_cache_sentinel")) {
620
+ t61 = /* @__PURE__ */ jsx(CloseIcon, { size: "small" });
621
+ $[94] = t61;
622
+ } else {
623
+ t61 = $[94];
624
+ }
625
+ let t62;
626
+ if ($[95] !== t59 || $[96] !== t60) {
627
+ t62 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t59, disabled: t60, children: t61 });
628
+ $[95] = t59;
629
+ $[96] = t60;
630
+ $[97] = t62;
634
631
  } else {
635
- t65 = $[95];
632
+ t62 = $[97];
636
633
  }
637
- const t66 = !values.sideDialogWidth;
634
+ const t63 = values.sideDialogWidth ?? "";
635
+ let t64;
636
+ if ($[98] !== t57 || $[99] !== t58 || $[100] !== t62 || $[101] !== t63) {
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" });
638
+ $[98] = t57;
639
+ $[99] = t58;
640
+ $[100] = t62;
641
+ $[101] = t63;
642
+ $[102] = t64;
643
+ } else {
644
+ t64 = $[102];
645
+ }
646
+ const t65 = showErrors && Boolean(errors.singularName);
647
+ const t66 = showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define the width (in pixels) of entities side dialog. Default is 768px";
638
648
  let t67;
639
- if ($[96] === Symbol.for("react.memo_cache_sentinel")) {
640
- t67 = /* @__PURE__ */ jsx(CloseIcon, { size: "small" });
641
- $[96] = t67;
649
+ if ($[103] !== t65 || $[104] !== t66) {
650
+ t67 = /* @__PURE__ */ jsx(FieldCaption, { error: t65, children: t66 });
651
+ $[103] = t65;
652
+ $[104] = t66;
653
+ $[105] = t67;
642
654
  } else {
643
- t67 = $[96];
655
+ t67 = $[105];
644
656
  }
645
657
  let t68;
646
- if ($[97] !== t65 || $[98] !== t66) {
647
- t68 = /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: t65, disabled: t66, children: t67 });
648
- $[97] = t65;
649
- $[98] = t66;
650
- $[99] = t68;
651
- } else {
652
- t68 = $[99];
653
- }
654
- const t69 = values.sideDialogWidth ?? "";
655
- let t70;
656
- if ($[100] !== t63 || $[101] !== t64 || $[102] !== t68 || $[103] !== t69) {
657
- t70 = /* @__PURE__ */ jsx(TextField, { error: t63, name: "sideDialogWidth", type: "number", "aria-describedby": "sideDialogWidth-helper", onChange: t64, endAdornment: t68, value: t69, label: "Side dialog width" });
658
- $[100] = t63;
659
- $[101] = t64;
660
- $[102] = t68;
661
- $[103] = t69;
662
- $[104] = t70;
663
- } else {
664
- t70 = $[104];
665
- }
666
- const t71 = showErrors && Boolean(errors.singularName);
667
- const t72 = showErrors && Boolean(errors.singularName) ? errors.singularName : "Optionally define the width (in pixels) of entities side dialog. Default is 768px";
668
- let t73;
669
- if ($[105] !== t71 || $[106] !== t72) {
670
- t73 = /* @__PURE__ */ jsx(FieldCaption, { error: t71, children: t72 });
671
- $[105] = t71;
672
- $[106] = t72;
673
- $[107] = t73;
674
- } else {
675
- t73 = $[107];
676
- }
658
+ if ($[106] !== t64 || $[107] !== t67) {
659
+ t68 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
660
+ t64,
661
+ t67
662
+ ] });
663
+ $[106] = t64;
664
+ $[107] = t67;
665
+ $[108] = t68;
666
+ } else {
667
+ t68 = $[108];
668
+ }
669
+ const t69 = showErrors && Boolean(errors.description);
670
+ const t70 = values.description ?? "";
671
+ let t71;
672
+ if ($[109] !== handleChange || $[110] !== t69 || $[111] !== t70) {
673
+ t71 = /* @__PURE__ */ jsx(TextField, { error: t69, name: "description", value: t70, onChange: handleChange, multiline: true, minRows: 2, "aria-describedby": "description-helper-text", label: "Description" });
674
+ $[109] = handleChange;
675
+ $[110] = t69;
676
+ $[111] = t70;
677
+ $[112] = t71;
678
+ } else {
679
+ t71 = $[112];
680
+ }
681
+ const t72 = showErrors && Boolean(errors.description);
682
+ const t73 = showErrors && Boolean(errors.description) ? errors.description : "Description of the collection, you can use markdown";
677
683
  let t74;
678
- if ($[108] !== t70 || $[109] !== t73) {
679
- t74 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
680
- t70,
681
- t73
684
+ if ($[113] !== t72 || $[114] !== t73) {
685
+ t74 = /* @__PURE__ */ jsx(FieldCaption, { error: t72, children: t73 });
686
+ $[113] = t72;
687
+ $[114] = t73;
688
+ $[115] = t74;
689
+ } else {
690
+ t74 = $[115];
691
+ }
692
+ let t75;
693
+ if ($[116] !== t71 || $[117] !== t74) {
694
+ t75 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
695
+ t71,
696
+ t74
682
697
  ] });
683
- $[108] = t70;
684
- $[109] = t73;
685
- $[110] = t74;
698
+ $[116] = t71;
699
+ $[117] = t74;
700
+ $[118] = t75;
686
701
  } else {
687
- t74 = $[110];
702
+ t75 = $[118];
688
703
  }
689
- const t75 = showErrors && Boolean(errors.description);
690
- const t76 = values.description ?? "";
704
+ const t76 = values.defaultSize ?? "";
691
705
  let t77;
692
- if ($[111] !== handleChange || $[112] !== t75 || $[113] !== t76) {
693
- t77 = /* @__PURE__ */ jsx(TextField, { error: t75, name: "description", value: t76, onChange: handleChange, multiline: true, minRows: 2, "aria-describedby": "description-helper-text", label: "Description" });
694
- $[111] = handleChange;
695
- $[112] = t75;
696
- $[113] = t76;
697
- $[114] = t77;
706
+ if ($[119] === Symbol.for("react.memo_cache_sentinel")) {
707
+ t77 = ["xs", "s", "m", "l", "xl"].map(_temp2$8);
708
+ $[119] = t77;
709
+ } else {
710
+ t77 = $[119];
711
+ }
712
+ let 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;
698
718
  } else {
699
- t77 = $[114];
719
+ t78 = $[122];
700
720
  }
701
- const t78 = showErrors && Boolean(errors.description);
702
- const t79 = showErrors && Boolean(errors.description) ? errors.description : "Description of the collection, you can use markdown";
721
+ const t79 = values.includeJsonView === void 0 || values.includeJsonView ? "Include JSON view" : "Do not include JSON view";
703
722
  let t80;
704
- if ($[115] !== t78 || $[116] !== t79) {
705
- t80 = /* @__PURE__ */ jsx(FieldCaption, { error: t78, children: t79 });
706
- $[115] = t78;
707
- $[116] = t79;
708
- $[117] = t80;
723
+ if ($[123] !== setFieldValue) {
724
+ t80 = (v_0) => setFieldValue("includeJsonView", v_0);
725
+ $[123] = setFieldValue;
726
+ $[124] = t80;
709
727
  } else {
710
- t80 = $[117];
728
+ t80 = $[124];
711
729
  }
712
- let t81;
713
- if ($[118] !== t77 || $[119] !== t80) {
714
- t81 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
715
- t77,
716
- t80
717
- ] });
718
- $[118] = t77;
719
- $[119] = t80;
720
- $[120] = t81;
730
+ const t81 = values.includeJsonView === void 0 ? true : values.includeJsonView;
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;
721
738
  } else {
722
- t81 = $[120];
739
+ t82 = $[128];
723
740
  }
724
- const t82 = values.defaultSize ?? "";
725
741
  let t83;
726
- if ($[121] === Symbol.for("react.memo_cache_sentinel")) {
727
- t83 = ["xs", "s", "m", "l", "xl"].map(_temp2$7);
728
- $[121] = 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;
729
745
  } else {
730
- t83 = $[121];
746
+ t83 = $[129];
731
747
  }
732
748
  let t84;
733
- if ($[122] !== handleChange || $[123] !== t82) {
734
- t84 = /* @__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: t82, renderValue: _temp$b, children: t83 }) });
735
- $[122] = handleChange;
736
- $[123] = t82;
737
- $[124] = t84;
749
+ if ($[130] !== t82) {
750
+ t84 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
751
+ t82,
752
+ t83
753
+ ] });
754
+ $[130] = t82;
755
+ $[131] = t84;
738
756
  } else {
739
- t84 = $[124];
757
+ t84 = $[131];
740
758
  }
741
- const t85 = values.includeJsonView === void 0 || values.includeJsonView ? "Include JSON view" : "Do not include JSON view";
759
+ const t85 = customIdValue === "code_defined";
742
760
  let t86;
743
- if ($[125] !== setFieldValue) {
744
- t86 = (v_0) => setFieldValue("includeJsonView", v_0);
745
- $[125] = setFieldValue;
746
- $[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;
747
770
  } else {
748
- t86 = $[126];
771
+ t86 = $[133];
749
772
  }
750
- const t87 = values.includeJsonView === void 0 ? true : values.includeJsonView;
773
+ const t87 = customIdValue ?? "";
751
774
  let t88;
752
- if ($[127] !== t85 || $[128] !== t86 || $[129] !== t87) {
753
- t88 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", label: t85, onValueChange: t86, value: t87 });
754
- $[127] = t85;
755
- $[128] = t86;
756
- $[129] = t87;
757
- $[130] = t88;
758
- } else {
759
- t88 = $[130];
760
- }
761
775
  let t89;
762
- if ($[131] === Symbol.for("react.memo_cache_sentinel")) {
763
- t89 = /* @__PURE__ */ jsx(FieldCaption, { children: "Include the JSON representation of the document." });
764
- $[131] = t89;
765
- } else {
766
- t89 = $[131];
767
- }
768
776
  let t90;
769
- if ($[132] !== t88) {
770
- t90 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
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: [
771
792
  t88,
772
- t89
773
- ] });
774
- $[132] = t88;
775
- $[133] = t90;
793
+ t89,
794
+ t90
795
+ ] }) });
796
+ $[137] = t85;
797
+ $[138] = t86;
798
+ $[139] = t87;
799
+ $[140] = t91;
776
800
  } else {
777
- t90 = $[133];
801
+ t91 = $[140];
778
802
  }
779
- const t91 = customIdValue === "code_defined";
780
803
  let t92;
781
- if ($[134] !== setFieldValue) {
782
- t92 = (v_1) => {
783
- if (v_1 === "code_defined") {
784
- throw new Error("This should not happen");
785
- }
786
- setFieldValue("customId", v_1);
787
- };
788
- $[134] = setFieldValue;
789
- $[135] = t92;
804
+ if ($[141] !== setFieldValue) {
805
+ t92 = (v_2) => setFieldValue("collectionGroup", v_2);
806
+ $[141] = setFieldValue;
807
+ $[142] = t92;
790
808
  } else {
791
- t92 = $[135];
809
+ t92 = $[142];
792
810
  }
793
- const t93 = customIdValue ?? "";
811
+ const t93 = values.collectionGroup ?? false;
794
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
+ }
795
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
+ }
796
828
  let t96;
797
- if ($[136] === Symbol.for("react.memo_cache_sentinel")) {
798
- t94 = /* @__PURE__ */ jsx(SelectItem, { value: "false", children: "Document ID is generated automatically" });
799
- t95 = /* @__PURE__ */ jsx(SelectItem, { value: "true", children: "Users must define an ID" });
800
- t96 = /* @__PURE__ */ jsx(SelectItem, { value: "optional", children: "Users can define an ID, but it is not required" });
801
- $[136] = t94;
802
- $[137] = t95;
803
- $[138] = t96;
804
- } else {
805
- t94 = $[136];
806
- t95 = $[137];
807
- t96 = $[138];
829
+ if ($[147] !== t94) {
830
+ t96 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 mt-4", children: [
831
+ t94,
832
+ t95
833
+ ] });
834
+ $[147] = t94;
835
+ $[148] = t96;
836
+ } else {
837
+ t96 = $[148];
808
838
  }
809
839
  let t97;
810
- if ($[139] !== t91 || $[140] !== t92 || $[141] !== t93) {
811
- t97 = /* @__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: t91, onValueChange: t92, value: t93, renderValue: _temp3$4, children: [
812
- t94,
813
- t95,
814
- t96
815
- ] }) });
816
- $[139] = t91;
817
- $[140] = t92;
818
- $[141] = t93;
819
- $[142] = t97;
840
+ if ($[149] !== setFieldValue) {
841
+ t97 = (v_3) => setFieldValue("textSearchEnabled", v_3);
842
+ $[149] = setFieldValue;
843
+ $[150] = t97;
820
844
  } else {
821
- t97 = $[142];
845
+ t97 = $[150];
822
846
  }
823
- let t98;
824
- if ($[143] !== setFieldValue) {
825
- t98 = (v_2) => setFieldValue("collectionGroup", v_2);
826
- $[143] = setFieldValue;
827
- $[144] = t98;
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;
828
854
  } else {
829
- t98 = $[144];
855
+ t99 = $[153];
830
856
  }
831
- const t99 = values.collectionGroup ?? false;
832
857
  let t100;
833
- if ($[145] !== t98 || $[146] !== t99) {
834
- t100 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", label: "Collection group", onValueChange: t98, value: t99 });
835
- $[145] = t98;
836
- $[146] = t99;
837
- $[147] = 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;
838
861
  } else {
839
- t100 = $[147];
862
+ t100 = $[154];
840
863
  }
841
864
  let t101;
842
- if ($[148] === Symbol.for("react.memo_cache_sentinel")) {
843
- t101 = /* @__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." });
844
- $[148] = t101;
865
+ if ($[155] !== t99) {
866
+ t101 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
867
+ t99,
868
+ t100
869
+ ] });
870
+ $[155] = t99;
871
+ $[156] = t101;
845
872
  } else {
846
- t101 = $[148];
873
+ t101 = $[156];
847
874
  }
848
875
  let t102;
849
- if ($[149] !== t100) {
850
- t102 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 mt-4", children: [
851
- t100,
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: [
878
+ t48,
879
+ t56,
880
+ t68,
881
+ t75,
882
+ t78,
883
+ t84,
884
+ t91,
885
+ t96,
852
886
  t101
853
887
  ] });
854
- $[149] = t100;
855
- $[150] = t102;
856
- } else {
857
- t102 = $[150];
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];
858
900
  }
859
901
  let t103;
860
- if ($[151] !== setFieldValue) {
861
- t103 = (v_3) => setFieldValue("textSearchEnabled", v_3);
862
- $[151] = setFieldValue;
863
- $[152] = t103;
864
- } else {
865
- t103 = $[152];
866
- }
867
- const t104 = values.textSearchEnabled ?? false;
868
- let t105;
869
- if ($[153] !== t103 || $[154] !== t104) {
870
- t105 = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, { position: "start", size: "large", label: "Enable text search for this collection", onValueChange: t103, value: t104 });
871
- $[153] = t103;
872
- $[154] = t104;
873
- $[155] = t105;
874
- } else {
875
- t105 = $[155];
876
- }
877
- let t106;
878
- if ($[156] === Symbol.for("react.memo_cache_sentinel")) {
879
- t106 = /* @__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." });
880
- $[156] = t106;
881
- } else {
882
- t106 = $[156];
883
- }
884
- let t107;
885
- if ($[157] !== t105) {
886
- t107 = /* @__PURE__ */ jsxs("div", { className: "col-span-12", children: [
887
- t105,
888
- t106
889
- ] });
890
- $[157] = t105;
891
- $[158] = t107;
892
- } else {
893
- t107 = $[158];
894
- }
895
- let t108;
896
- if ($[159] !== t102 || $[160] !== t107 || $[161] !== t54 || $[162] !== t62 || $[163] !== t74 || $[164] !== t81 || $[165] !== t84 || $[166] !== t90 || $[167] !== t97) {
897
- t108 = /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 p-4", children: [
898
- t54,
899
- t62,
900
- t74,
901
- t81,
902
- t84,
903
- t90,
904
- t97,
905
- t102,
906
- t107
907
- ] });
908
- $[159] = t102;
909
- $[160] = t107;
910
- $[161] = t54;
911
- $[162] = t62;
912
- $[163] = t74;
913
- $[164] = t81;
914
- $[165] = t84;
915
- $[166] = t90;
916
- $[167] = t97;
917
- $[168] = t108;
918
- } else {
919
- t108 = $[168];
920
- }
921
- let t109;
922
- if ($[169] !== advancedPanelExpanded || $[170] !== t108) {
923
- t109 = /* @__PURE__ */ jsx(ExpandablePanel, { expanded: advancedPanelExpanded, onExpandedChange: setAdvancedPanelExpanded, title: t47, initiallyExpanded: false, children: t108 });
924
- $[169] = advancedPanelExpanded;
925
- $[170] = t108;
926
- $[171] = t109;
927
- } else {
928
- t109 = $[171];
929
- }
930
- let t110;
931
- if ($[172] !== children || $[173] !== t109) {
932
- t110 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 mt-8", children: [
933
- t109,
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;
907
+ } else {
908
+ t103 = $[169];
909
+ }
910
+ let t104;
911
+ if ($[170] !== children || $[171] !== t103) {
912
+ t104 = /* @__PURE__ */ jsxs("div", { className: "col-span-12 mt-8", children: [
913
+ t103,
934
914
  children
935
915
  ] });
936
- $[172] = children;
937
- $[173] = t109;
938
- $[174] = t110;
916
+ $[170] = children;
917
+ $[171] = t103;
918
+ $[172] = t104;
939
919
  } else {
940
- t110 = $[174];
920
+ t104 = $[172];
941
921
  }
942
- let t111;
943
- if ($[175] !== t110 || $[176] !== t27 || $[177] !== t36 || $[178] !== t37 || $[179] !== t40 || $[180] !== t46) {
944
- t111 = /* @__PURE__ */ jsxs("div", { className: t19, children: [
945
- t27,
946
- t36,
947
- 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,
948
928
  t40,
949
- t46,
950
- t110
929
+ t104
951
930
  ] });
952
- $[175] = t110;
953
- $[176] = t27;
954
- $[177] = t36;
955
- $[178] = t37;
956
- $[179] = t40;
957
- $[180] = t46;
958
- $[181] = t111;
931
+ $[173] = t104;
932
+ $[174] = t23;
933
+ $[175] = t31;
934
+ $[176] = t34;
935
+ $[177] = t40;
936
+ $[178] = t105;
959
937
  } else {
960
- t111 = $[181];
938
+ t105 = $[178];
961
939
  }
962
- let t112;
963
- if ($[182] === Symbol.for("react.memo_cache_sentinel")) {
964
- t112 = /* @__PURE__ */ jsx("div", { style: {
940
+ let t106;
941
+ if ($[179] === Symbol.for("react.memo_cache_sentinel")) {
942
+ t106 = /* @__PURE__ */ jsx("div", { style: {
965
943
  height: "52px"
966
944
  } });
967
- $[182] = t112;
945
+ $[179] = t106;
968
946
  } else {
969
- t112 = $[182];
947
+ t106 = $[179];
970
948
  }
971
- let t113;
972
- if ($[183] !== setFieldValue) {
973
- t113 = (icon) => {
949
+ const t107 = typeof values.icon === "string" ? values.icon : void 0;
950
+ let t108;
951
+ if ($[180] !== setFieldValue) {
952
+ t108 = (icon) => {
974
953
  setIconDialogOpen(false);
975
954
  setFieldValue("icon", icon);
976
955
  };
977
- $[183] = setFieldValue;
978
- $[184] = t113;
956
+ $[180] = setFieldValue;
957
+ $[181] = t108;
979
958
  } else {
980
- t113 = $[184];
959
+ t108 = $[181];
981
960
  }
982
- let t114;
983
- if ($[185] !== t113 || $[186] !== values.icon) {
984
- t114 = /* @__PURE__ */ jsx("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ jsx(SearchIconsView, { selectedIcon: values.icon, onIconSelected: t113 }) });
985
- $[185] = t113;
986
- $[186] = values.icon;
987
- $[187] = t114;
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;
988
967
  } else {
989
- t114 = $[187];
968
+ t109 = $[184];
990
969
  }
991
- let t115;
992
- if ($[188] !== iconDialogOpen || $[189] !== t114) {
993
- t115 = /* @__PURE__ */ jsx(Dialog, { open: iconDialogOpen, onOpenChange: setIconDialogOpen, maxWidth: "xl", fullWidth: true, children: t114 });
994
- $[188] = iconDialogOpen;
995
- $[189] = t114;
996
- $[190] = t115;
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;
997
976
  } else {
998
- t115 = $[190];
977
+ t110 = $[187];
999
978
  }
1000
- let t116;
1001
- if ($[191] !== T0 || $[192] !== t111 || $[193] !== t115 || $[194] !== t18) {
1002
- t116 = /* @__PURE__ */ jsx("div", { className: t7, children: /* @__PURE__ */ jsxs(T0, { maxWidth: t8, className: t9, children: [
1003
- t18,
1004
- t111,
1005
- t112,
1006
- t115
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
1007
986
  ] }) });
1008
- $[191] = T0;
1009
- $[192] = t111;
1010
- $[193] = t115;
1011
- $[194] = t18;
1012
- $[195] = t116;
987
+ $[188] = t105;
988
+ $[189] = t110;
989
+ $[190] = t15;
990
+ $[191] = t111;
1013
991
  } else {
1014
- t116 = $[195];
992
+ t111 = $[191];
1015
993
  }
1016
- return t116;
994
+ return t111;
1017
995
  }
1018
- function _temp3$4(value_3) {
996
+ function _temp3$5(value_3) {
1019
997
  if (value_3 === "code_defined") {
1020
998
  return "Code defined";
1021
999
  } else {
@@ -1030,10 +1008,10 @@ function _temp3$4(value_3) {
1030
1008
  }
1031
1009
  }
1032
1010
  }
1033
- function _temp2$7(value_2) {
1011
+ function _temp2$8(value_2) {
1034
1012
  return /* @__PURE__ */ jsx(SelectItem, { value: value_2, children: value_2.toUpperCase() }, `size-select-${value_2}`);
1035
1013
  }
1036
- function _temp$b(value_1) {
1014
+ function _temp$c(value_1) {
1037
1015
  return value_1.toUpperCase();
1038
1016
  }
1039
1017
  function DefaultDatabaseField(t0) {
@@ -1258,7 +1236,7 @@ function EnumFormFields(t0) {
1258
1236
  inferredValues.add(enumValue_0.id);
1259
1237
  });
1260
1238
  setFieldValue(enumValuesPath, [...newEnumValues, ...currentEnumValues], true);
1261
- }).catch(_temp$a).finally(() => setInferring(false));
1239
+ }).catch(_temp$b).finally(() => setInferring(false));
1262
1240
  };
1263
1241
  $[8] = enumValuesPath;
1264
1242
  $[9] = getData;
@@ -1381,7 +1359,7 @@ function EnumFormFields(t0) {
1381
1359
  }
1382
1360
  return t15;
1383
1361
  }
1384
- function _temp$a(e) {
1362
+ function _temp$b(e) {
1385
1363
  console.error(e);
1386
1364
  }
1387
1365
  const EnumEntry = React__default.memo(function EnumEntryInternal(t0) {
@@ -2170,7 +2148,7 @@ function StoragePropertyField(t0) {
2170
2148
  t192 = $[42];
2171
2149
  }
2172
2150
  if ($[43] !== acceptedFiles || $[44] !== disabled || $[45] !== handleTypesChange || $[46] !== t172 || $[47] !== t182 || $[48] !== t192) {
2173
- 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 }) });
2174
2152
  $[43] = acceptedFiles;
2175
2153
  $[44] = disabled;
2176
2154
  $[45] = handleTypesChange;
@@ -2433,16 +2411,16 @@ function StoragePropertyField(t0) {
2433
2411
  }
2434
2412
  return t24;
2435
2413
  }
2436
- function _temp3$3(selected) {
2414
+ function _temp3$4(selected) {
2437
2415
  if (!selected || selected.length === 0) {
2438
2416
  return "All file types allowed";
2439
2417
  }
2440
- return selected.map(_temp$9).filter(_temp2$6).join(", ");
2418
+ return selected.map(_temp$a).filter(_temp2$7).join(", ");
2441
2419
  }
2442
- function _temp2$6(v_0) {
2420
+ function _temp2$7(v_0) {
2443
2421
  return Boolean(v_0);
2444
2422
  }
2445
- function _temp$9(v) {
2423
+ function _temp$a(v) {
2446
2424
  return fileTypes[v];
2447
2425
  }
2448
2426
  function editableProperty(property) {
@@ -2514,7 +2492,7 @@ function PropertyFieldPreview(t0) {
2514
2492
  const t4 = selected ? cardSelectedMixin : "";
2515
2493
  let t5;
2516
2494
  if ($[5] !== borderColorClass || $[6] !== t3 || $[7] !== t4) {
2517
- 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);
2518
2496
  $[5] = borderColorClass;
2519
2497
  $[6] = t3;
2520
2498
  $[7] = t4;
@@ -4408,7 +4386,8 @@ function ReferencePropertyField(t0) {
4408
4386
  existing,
4409
4387
  multiple,
4410
4388
  disabled,
4411
- showErrors
4389
+ showErrors,
4390
+ asString
4412
4391
  } = t0;
4413
4392
  const {
4414
4393
  values,
@@ -4426,7 +4405,7 @@ function ReferencePropertyField(t0) {
4426
4405
  }
4427
4406
  return t12;
4428
4407
  }
4429
- const pathPath = multiple ? "of.path" : "path";
4408
+ const pathPath = asString ? "reference.path" : multiple ? "of.path" : "path";
4430
4409
  let t1;
4431
4410
  if ($[1] !== pathPath || $[2] !== values) {
4432
4411
  t1 = getIn(values, pathPath);
@@ -4517,8 +4496,8 @@ function CollectionsSelect(t0) {
4517
4496
  const collections = t1;
4518
4497
  let t2;
4519
4498
  if ($[10] !== collections || $[11] !== disabled || $[12] !== error || $[13] !== handleChange || $[14] !== pathPath || $[15] !== props || $[16] !== value) {
4520
- const groups = Array.from(new Set(Object.values(collections).map(_temp$8).filter(Boolean)).values());
4521
- 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);
4522
4501
  let t32;
4523
4502
  if ($[18] !== collections) {
4524
4503
  t32 = (selected) => {
@@ -4549,7 +4528,7 @@ function CollectionsSelect(t0) {
4549
4528
  }
4550
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: [
4551
4530
  groups.flatMap(t42),
4552
- ungroupedCollections && /* @__PURE__ */ jsx(SelectGroup, { label: "Views", children: ungroupedCollections.map(_temp3$2) })
4531
+ ungroupedCollections && /* @__PURE__ */ jsx(SelectGroup, { label: "Views", children: ungroupedCollections.map(_temp3$3) })
4553
4532
  ] });
4554
4533
  $[10] = collections;
4555
4534
  $[11] = disabled;
@@ -4582,16 +4561,16 @@ function CollectionsSelect(t0) {
4582
4561
  }
4583
4562
  return t4;
4584
4563
  }
4585
- function _temp3$2(collection_2) {
4564
+ function _temp3$3(collection_2) {
4586
4565
  return /* @__PURE__ */ jsx(SelectItem, { value: collection_2.id ?? collection_2.path, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-row", children: [
4587
4566
  /* @__PURE__ */ jsx(IconForView, { collectionOrView: collection_2 }),
4588
4567
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "font-medium ml-4", children: collection_2?.name.toUpperCase() })
4589
4568
  ] }) }, collection_2.id ?? collection_2.path);
4590
4569
  }
4591
- function _temp2$5(col) {
4570
+ function _temp2$6(col) {
4592
4571
  return !col.group;
4593
4572
  }
4594
- function _temp$8(e) {
4573
+ function _temp$9(e) {
4595
4574
  return e.group;
4596
4575
  }
4597
4576
  function DateTimePropertyField(t0) {
@@ -4666,7 +4645,7 @@ function DateTimePropertyField(t0) {
4666
4645
  }
4667
4646
  let t10;
4668
4647
  if ($[14] !== disabled || $[15] !== t5 || $[16] !== t6 || $[17] !== t7) {
4669
- 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: [
4670
4649
  t8,
4671
4650
  t9
4672
4651
  ] });
@@ -4727,7 +4706,7 @@ function DateTimePropertyField(t0) {
4727
4706
  }
4728
4707
  let t20;
4729
4708
  if ($[30] !== disabled || $[31] !== t14 || $[32] !== t15 || $[33] !== t16) {
4730
- 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: [
4731
4710
  t17,
4732
4711
  t18,
4733
4712
  t19
@@ -4797,7 +4776,7 @@ function DateTimePropertyField(t0) {
4797
4776
  }
4798
4777
  return t27;
4799
4778
  }
4800
- function _temp2$4(v_2) {
4779
+ function _temp2$5(v_2) {
4801
4780
  switch (v_2) {
4802
4781
  case "on_create": {
4803
4782
  return "On create";
@@ -4810,7 +4789,7 @@ function _temp2$4(v_2) {
4810
4789
  }
4811
4790
  }
4812
4791
  }
4813
- function _temp$7(v_0) {
4792
+ function _temp$8(v_0) {
4814
4793
  switch (v_0) {
4815
4794
  case "date_time": {
4816
4795
  return "Date/Time";
@@ -5035,6 +5014,12 @@ function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfig
5035
5014
  propertyConfig: "reference",
5036
5015
  editable: propertyData.editable !== void 0 ? propertyData.editable : true
5037
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
+ });
5038
5023
  } else if (selectedWidgetId === "multi_references") {
5039
5024
  updatedProperty = mergeDeep(propertyData, {
5040
5025
  dataType: "array",
@@ -5135,7 +5120,7 @@ function UrlPropertyField(t0) {
5135
5120
  }
5136
5121
  let t8;
5137
5122
  if ($[8] !== disabled || $[9] !== t2 || $[10] !== t3) {
5138
- 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: [
5139
5124
  t4,
5140
5125
  t5,
5141
5126
  t6,
@@ -5201,7 +5186,7 @@ function UrlPropertyField(t0) {
5201
5186
  }
5202
5187
  return t13;
5203
5188
  }
5204
- function _temp$6(value_0) {
5189
+ function _temp$7(value_0) {
5205
5190
  switch (value_0) {
5206
5191
  case "image": {
5207
5192
  return "Image";
@@ -5217,7 +5202,7 @@ function _temp$6(value_0) {
5217
5202
  }
5218
5203
  }
5219
5204
  }
5220
- 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"];
5221
5206
  const supportedFields = Object.entries(DEFAULT_FIELD_CONFIGS).filter(([id]) => supportedFieldsIds.includes(id)).map(([id, config]) => ({
5222
5207
  [id]: config
5223
5208
  })).reduce((a, b) => ({
@@ -5841,7 +5826,7 @@ function PropertyFormDialog(t0) {
5841
5826
  }
5842
5827
  let t7;
5843
5828
  if ($[20] !== onCancel) {
5844
- t7 = onCancel && /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => {
5829
+ t7 = onCancel && /* @__PURE__ */ jsx(Button, { variant: "text", color: "primary", onClick: () => {
5845
5830
  onCancel();
5846
5831
  formexRef.current?.resetForm();
5847
5832
  }, children: "Cancel" });
@@ -5893,7 +5878,7 @@ function PropertyFormDialog(t0) {
5893
5878
  return t11;
5894
5879
  }
5895
5880
  function PropertyEditFormFields(t0) {
5896
- const $ = c(142);
5881
+ const $ = c(146);
5897
5882
  const {
5898
5883
  values,
5899
5884
  errors,
@@ -6182,59 +6167,73 @@ function PropertyEditFormFields(t0) {
6182
6167
  }
6183
6168
  childComponent = t102;
6184
6169
  } else {
6185
- if (selectedFieldConfigId === "date_time") {
6170
+ if (selectedFieldConfigId === "reference_as_string") {
6186
6171
  let t102;
6187
- if ($[75] !== disabled) {
6188
- 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 });
6189
6174
  $[75] = disabled;
6190
- $[76] = t102;
6175
+ $[76] = existing;
6176
+ $[77] = showErrors;
6177
+ $[78] = t102;
6191
6178
  } else {
6192
- t102 = $[76];
6179
+ t102 = $[78];
6193
6180
  }
6194
6181
  childComponent = t102;
6195
6182
  } else {
6196
- if (selectedFieldConfigId === "multi_references") {
6183
+ if (selectedFieldConfigId === "date_time") {
6197
6184
  let t102;
6198
- if ($[77] !== disabled || $[78] !== existing || $[79] !== showErrors) {
6199
- t102 = /* @__PURE__ */ jsx(ReferencePropertyField, { showErrors, existing, multiple: true, disabled });
6200
- $[77] = disabled;
6201
- $[78] = existing;
6202
- $[79] = showErrors;
6185
+ if ($[79] !== disabled) {
6186
+ t102 = /* @__PURE__ */ jsx(DateTimePropertyField, { disabled });
6187
+ $[79] = disabled;
6203
6188
  $[80] = t102;
6204
6189
  } else {
6205
6190
  t102 = $[80];
6206
6191
  }
6207
6192
  childComponent = t102;
6208
6193
  } else {
6209
- if (selectedFieldConfigId === "repeat") {
6194
+ if (selectedFieldConfigId === "multi_references") {
6210
6195
  let t102;
6211
- if ($[81] !== allowDataInference || $[82] !== collectionEditable || $[83] !== disabled || $[84] !== existing || $[85] !== getData || $[86] !== propertyConfigs || $[87] !== showErrors) {
6212
- t102 = /* @__PURE__ */ jsx(RepeatPropertyField, { showErrors, existing, getData, allowDataInference, disabled, collectionEditable, propertyConfigs });
6213
- $[81] = allowDataInference;
6214
- $[82] = collectionEditable;
6215
- $[83] = disabled;
6216
- $[84] = existing;
6217
- $[85] = getData;
6218
- $[86] = propertyConfigs;
6219
- $[87] = showErrors;
6220
- $[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;
6221
6202
  } else {
6222
- t102 = $[88];
6203
+ t102 = $[84];
6223
6204
  }
6224
6205
  childComponent = t102;
6225
6206
  } else {
6226
- if (selectedFieldConfigId === "key_value") {
6207
+ if (selectedFieldConfigId === "repeat") {
6227
6208
  let t102;
6228
- if ($[89] !== disabled) {
6229
- t102 = /* @__PURE__ */ jsx(KeyValuePropertyField, { disabled });
6230
- $[89] = disabled;
6231
- $[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;
6232
6219
  } else {
6233
- t102 = $[90];
6220
+ t102 = $[92];
6234
6221
  }
6235
6222
  childComponent = t102;
6236
6223
  } else {
6237
- 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
+ }
6238
6237
  }
6239
6238
  }
6240
6239
  }
@@ -6252,7 +6251,7 @@ function PropertyEditFormFields(t0) {
6252
6251
  }
6253
6252
  }
6254
6253
  let t10;
6255
- if ($[91] !== disabled) {
6254
+ if ($[95] !== disabled) {
6256
6255
  t10 = disabled && /* @__PURE__ */ jsxs(InfoLabel, { mode: "warn", children: [
6257
6256
  /* @__PURE__ */ jsx(Typography, { children: "This property can't be edited" }),
6258
6257
  /* @__PURE__ */ jsxs(Typography, { variant: "caption", children: [
@@ -6261,157 +6260,157 @@ function PropertyEditFormFields(t0) {
6261
6260
  " flag"
6262
6261
  ] })
6263
6262
  ] });
6264
- $[91] = disabled;
6265
- $[92] = t10;
6263
+ $[95] = disabled;
6264
+ $[96] = t10;
6266
6265
  } else {
6267
- t10 = $[92];
6266
+ t10 = $[96];
6268
6267
  }
6269
6268
  const t11 = selectedFieldConfigId;
6270
6269
  let t12;
6271
- if ($[93] !== onWidgetSelectChanged) {
6270
+ if ($[97] !== onWidgetSelectChanged) {
6272
6271
  t12 = (value) => onWidgetSelectChanged(value);
6273
- $[93] = onWidgetSelectChanged;
6274
- $[94] = t12;
6272
+ $[97] = onWidgetSelectChanged;
6273
+ $[98] = t12;
6275
6274
  } else {
6276
- t12 = $[94];
6275
+ t12 = $[98];
6277
6276
  }
6278
6277
  let t13;
6279
- if ($[95] !== onDismiss) {
6278
+ if ($[99] !== onDismiss) {
6280
6279
  t13 = (open, hasValue) => {
6281
6280
  if (!hasValue) {
6282
6281
  onDismiss?.();
6283
6282
  }
6284
6283
  setSelectOpen(open);
6285
6284
  };
6286
- $[95] = onDismiss;
6287
- $[96] = t13;
6285
+ $[99] = onDismiss;
6286
+ $[100] = t13;
6288
6287
  } else {
6289
- t13 = $[96];
6288
+ t13 = $[100];
6290
6289
  }
6291
6290
  const t14 = Boolean(selectedWidgetError);
6292
6291
  let t15;
6293
- 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) {
6294
6293
  t15 = /* @__PURE__ */ jsx(WidgetSelectView, { initialProperty: values, value: t11, onValueChange: t12, open: selectOpen, onOpenChange: t13, disabled, showError: t14, existing, propertyConfigs, inArray });
6295
- $[97] = disabled;
6296
- $[98] = existing;
6297
- $[99] = inArray;
6298
- $[100] = propertyConfigs;
6299
- $[101] = selectOpen;
6300
- $[102] = t11;
6301
- $[103] = t12;
6302
- $[104] = t13;
6303
- $[105] = t14;
6304
- $[106] = values;
6305
- $[107] = t15;
6306
- } else {
6307
- 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];
6308
6307
  }
6309
6308
  let t16;
6310
- if ($[108] !== selectedWidgetError) {
6309
+ if ($[112] !== selectedWidgetError) {
6311
6310
  t16 = selectedWidgetError && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "ml-3.5", color: "error", children: "Required" });
6312
- $[108] = selectedWidgetError;
6313
- $[109] = t16;
6311
+ $[112] = selectedWidgetError;
6312
+ $[113] = t16;
6314
6313
  } else {
6315
- t16 = $[109];
6314
+ t16 = $[113];
6316
6315
  }
6317
6316
  let t17;
6318
- if ($[110] !== t15 || $[111] !== t16) {
6317
+ if ($[114] !== t15 || $[115] !== t16) {
6319
6318
  t17 = /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col gap-2", children: [
6320
6319
  t15,
6321
6320
  t16
6322
6321
  ] });
6323
- $[110] = t15;
6324
- $[111] = t16;
6325
- $[112] = t17;
6322
+ $[114] = t15;
6323
+ $[115] = t16;
6324
+ $[116] = t17;
6326
6325
  } else {
6327
- t17 = $[112];
6326
+ t17 = $[116];
6328
6327
  }
6329
6328
  let t18;
6330
- if ($[113] !== disabled || $[114] !== onDelete || $[115] !== values?.id) {
6329
+ if ($[117] !== disabled || $[118] !== onDelete || $[119] !== values?.id) {
6331
6330
  t18 = onDelete && values?.id && /* @__PURE__ */ jsx(IconButton, { variant: "ghost", className: "m-4", disabled, onClick: () => setDeleteDialogOpen(true), children: /* @__PURE__ */ jsx(DeleteIcon, {}) });
6332
- $[113] = disabled;
6333
- $[114] = onDelete;
6334
- $[115] = values?.id;
6335
- $[116] = t18;
6331
+ $[117] = disabled;
6332
+ $[118] = onDelete;
6333
+ $[119] = values?.id;
6334
+ $[120] = t18;
6336
6335
  } else {
6337
- t18 = $[116];
6336
+ t18 = $[120];
6338
6337
  }
6339
6338
  let t19;
6340
- if ($[117] !== t17 || $[118] !== t18) {
6339
+ if ($[121] !== t17 || $[122] !== t18) {
6341
6340
  t19 = /* @__PURE__ */ jsxs("div", { className: "flex mt-2 justify-between", children: [
6342
6341
  t17,
6343
6342
  t18
6344
6343
  ] });
6345
- $[117] = t17;
6346
- $[118] = t18;
6347
- $[119] = t19;
6344
+ $[121] = t17;
6345
+ $[122] = t18;
6346
+ $[123] = t19;
6348
6347
  } else {
6349
- t19 = $[119];
6348
+ t19 = $[123];
6350
6349
  }
6351
6350
  let t20;
6352
- if ($[120] !== autoUpdateId || $[121] !== disabled || $[122] !== existing || $[123] !== includeIdAndTitle || $[124] !== showErrors) {
6351
+ if ($[124] !== autoUpdateId || $[125] !== disabled || $[126] !== existing || $[127] !== includeIdAndTitle || $[128] !== showErrors) {
6353
6352
  t20 = includeIdAndTitle && /* @__PURE__ */ jsx(CommonPropertyFields, { showErrors, disabledId: existing, isNewProperty: !existing, disabled, autoUpdateId, ref: nameFieldRef });
6354
- $[120] = autoUpdateId;
6355
- $[121] = disabled;
6356
- $[122] = existing;
6357
- $[123] = includeIdAndTitle;
6358
- $[124] = showErrors;
6359
- $[125] = t20;
6353
+ $[124] = autoUpdateId;
6354
+ $[125] = disabled;
6355
+ $[126] = existing;
6356
+ $[127] = includeIdAndTitle;
6357
+ $[128] = showErrors;
6358
+ $[129] = t20;
6360
6359
  } else {
6361
- t20 = $[125];
6360
+ t20 = $[129];
6362
6361
  }
6363
6362
  let t21;
6364
- if ($[126] !== disabled) {
6363
+ if ($[130] !== disabled) {
6365
6364
  t21 = /* @__PURE__ */ jsx("div", { className: "col-span-12", children: /* @__PURE__ */ jsx(AdvancedPropertyValidation, { disabled }) });
6366
- $[126] = disabled;
6367
- $[127] = t21;
6365
+ $[130] = disabled;
6366
+ $[131] = t21;
6368
6367
  } else {
6369
- t21 = $[127];
6368
+ t21 = $[131];
6370
6369
  }
6371
6370
  let t22;
6372
- if ($[128] !== childComponent || $[129] !== t20 || $[130] !== t21) {
6371
+ if ($[132] !== childComponent || $[133] !== t20 || $[134] !== t21) {
6373
6372
  t22 = /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-y-12 mt-8 mb-8", children: [
6374
6373
  t20,
6375
6374
  childComponent,
6376
6375
  t21
6377
6376
  ] });
6378
- $[128] = childComponent;
6379
- $[129] = t20;
6380
- $[130] = t21;
6381
- $[131] = t22;
6377
+ $[132] = childComponent;
6378
+ $[133] = t20;
6379
+ $[134] = t21;
6380
+ $[135] = t22;
6382
6381
  } else {
6383
- t22 = $[131];
6382
+ t22 = $[135];
6384
6383
  }
6385
6384
  let t23;
6386
- if ($[132] !== deleteDialogOpen || $[133] !== onDelete || $[134] !== propertyNamespace || $[135] !== values?.id) {
6385
+ if ($[136] !== deleteDialogOpen || $[137] !== onDelete || $[138] !== propertyNamespace || $[139] !== values?.id) {
6387
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: [
6388
6387
  " This will ",
6389
6388
  /* @__PURE__ */ jsx("b", { children: "not delete any data" }),
6390
6389
  ", only modify the collection."
6391
6390
  ] }) });
6392
- $[132] = deleteDialogOpen;
6393
- $[133] = onDelete;
6394
- $[134] = propertyNamespace;
6395
- $[135] = values?.id;
6396
- $[136] = t23;
6391
+ $[136] = deleteDialogOpen;
6392
+ $[137] = onDelete;
6393
+ $[138] = propertyNamespace;
6394
+ $[139] = values?.id;
6395
+ $[140] = t23;
6397
6396
  } else {
6398
- t23 = $[136];
6397
+ t23 = $[140];
6399
6398
  }
6400
6399
  let t24;
6401
- if ($[137] !== t10 || $[138] !== t19 || $[139] !== t22 || $[140] !== t23) {
6400
+ if ($[141] !== t10 || $[142] !== t19 || $[143] !== t22 || $[144] !== t23) {
6402
6401
  t24 = /* @__PURE__ */ jsxs(Fragment, { children: [
6403
6402
  t10,
6404
6403
  t19,
6405
6404
  t22,
6406
6405
  t23
6407
6406
  ] });
6408
- $[137] = t10;
6409
- $[138] = t19;
6410
- $[139] = t22;
6411
- $[140] = t23;
6412
- $[141] = t24;
6407
+ $[141] = t10;
6408
+ $[142] = t19;
6409
+ $[143] = t22;
6410
+ $[144] = t23;
6411
+ $[145] = t24;
6413
6412
  } else {
6414
- t24 = $[141];
6413
+ t24 = $[145];
6415
6414
  }
6416
6415
  return t24;
6417
6416
  }
@@ -6451,6 +6450,7 @@ const WIDGET_TYPE_MAP = {
6451
6450
  file_upload: "File",
6452
6451
  multi_file_upload: "File",
6453
6452
  reference: "Reference",
6453
+ reference_as_string: "Text",
6454
6454
  multi_references: "Reference",
6455
6455
  date_time: "Date",
6456
6456
  group: "Group",
@@ -6482,7 +6482,7 @@ function WidgetSelectView(t0) {
6482
6482
  let t6;
6483
6483
  if ($[0] !== disabled || $[1] !== existing || $[2] !== inArray || $[3] !== initialProperty || $[4] !== onOpenChange || $[5] !== onValueChange || $[6] !== open || $[7] !== propertyConfigs || $[8] !== value) {
6484
6484
  const allSupportedFields = Object.entries(supportedFields).concat(Object.entries(propertyConfigs));
6485
- 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, {});
6486
6486
  const key_0 = value;
6487
6487
  const propertyConfig_1 = key_0 ? DEFAULT_FIELD_CONFIGS[key_0] ?? propertyConfigs[key_0] : void 0;
6488
6488
  const baseProperty = propertyConfig_1?.property;
@@ -6664,19 +6664,19 @@ function _temp4$1(key_1) {
6664
6664
  }
6665
6665
  return "Custom/Other";
6666
6666
  }
6667
- function _temp3$1(a, b) {
6667
+ function _temp3$2(a, b) {
6668
6668
  return {
6669
6669
  ...a,
6670
6670
  ...b
6671
6671
  };
6672
6672
  }
6673
- function _temp2$3(t0) {
6673
+ function _temp2$4(t0) {
6674
6674
  const [key, propertyConfig_0] = t0;
6675
6675
  return {
6676
6676
  [key]: propertyConfig_0
6677
6677
  };
6678
6678
  }
6679
- function _temp$5(t0) {
6679
+ function _temp$6(t0) {
6680
6680
  const [, propertyConfig] = t0;
6681
6681
  return !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.dataType !== "array";
6682
6682
  }
@@ -6770,7 +6770,7 @@ function WidgetSelectViewItem(t0) {
6770
6770
  }
6771
6771
  let t10;
6772
6772
  if ($[20] !== onClick || $[21] !== t9) {
6773
- 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 });
6774
6774
  $[20] = onClick;
6775
6775
  $[21] = t9;
6776
6776
  $[22] = t10;
@@ -6824,7 +6824,7 @@ function GetCodeDialog(t0) {
6824
6824
  if ($[3] !== code) {
6825
6825
  t3 = /* @__PURE__ */ jsxs(DialogContent, { children: [
6826
6826
  t2,
6827
- /* @__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 })
6828
6828
  ] });
6829
6829
  $[3] = code;
6830
6830
  $[4] = t3;
@@ -6838,7 +6838,7 @@ function GetCodeDialog(t0) {
6838
6838
  e.preventDefault();
6839
6839
  snackbarController.open({
6840
6840
  type: "success",
6841
- message: `Copied`
6841
+ message: "Copied"
6842
6842
  });
6843
6843
  return navigator.clipboard.writeText(code);
6844
6844
  };
@@ -6857,7 +6857,7 @@ function GetCodeDialog(t0) {
6857
6857
  }
6858
6858
  let t6;
6859
6859
  if ($[9] !== t4) {
6860
- 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: [
6861
6861
  t5,
6862
6862
  "Copy to clipboard"
6863
6863
  ] });
@@ -6904,7 +6904,7 @@ function GetCodeDialog(t0) {
6904
6904
  }
6905
6905
  return t9;
6906
6906
  }
6907
- function _temp$4(t0) {
6907
+ function _temp$5(t0) {
6908
6908
  const {
6909
6909
  style,
6910
6910
  tokens,
@@ -7017,6 +7017,7 @@ function CollectionPropertiesEditorForm({
7017
7017
  const inferPropertiesFromData = doCollectionInference ? () => {
7018
7018
  if (!doCollectionInference) return;
7019
7019
  setInferringProperties(true);
7020
+ console.debug("CollectionEditor: inferring properties from data", doCollectionInference, values);
7020
7021
  doCollectionInference(values).then((newCollection) => {
7021
7022
  if (newCollection) makePropertiesEditable(newCollection.properties);
7022
7023
  if (!newCollection) {
@@ -7253,7 +7254,7 @@ function UnsavedChangesDialog(t0) {
7253
7254
  }
7254
7255
  let t7;
7255
7256
  if ($[10] !== handleCancel) {
7256
- 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 " });
7257
7258
  $[10] = handleCancel;
7258
7259
  $[11] = t7;
7259
7260
  } else {
@@ -7261,7 +7262,7 @@ function UnsavedChangesDialog(t0) {
7261
7262
  }
7262
7263
  let t8;
7263
7264
  if ($[12] !== handleOk) {
7264
- t8 = /* @__PURE__ */ jsx(Button, { onClick: handleOk, children: " Ok " });
7265
+ t8 = /* @__PURE__ */ jsx(Button, { color: "primary", onClick: handleOk, children: " Ok " });
7265
7266
  $[12] = handleOk;
7266
7267
  $[13] = t8;
7267
7268
  } else {
@@ -7329,7 +7330,7 @@ function EntityCustomViewsSelectDialog(t0) {
7329
7330
  }
7330
7331
  let t3;
7331
7332
  if ($[4] !== entityViews) {
7332
- 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." });
7333
7334
  $[4] = entityViews;
7334
7335
  $[5] = t3;
7335
7336
  } else {
@@ -7349,7 +7350,7 @@ function EntityCustomViewsSelectDialog(t0) {
7349
7350
  }
7350
7351
  let t5;
7351
7352
  if ($[9] !== onClose) {
7352
- 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" }) });
7353
7354
  $[9] = onClose;
7354
7355
  $[10] = t5;
7355
7356
  } else {
@@ -7416,8 +7417,8 @@ function SubcollectionsEditTab(t0) {
7416
7417
  let t8;
7417
7418
  let t9;
7418
7419
  if ($[2] !== collection.entityViews || $[3] !== contextEntityViews || $[4] !== subcollections || $[5] !== values.entityViews || $[6] !== values.name) {
7419
- const resolvedEntityViews = values.entityViews?.filter(_temp$3).map((e_0) => resolveEntityView(e_0, contextEntityViews)).filter(Boolean) ?? [];
7420
- 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) ?? [];
7421
7422
  const totalEntityViews = resolvedEntityViews.length + hardCodedEntityViews.length;
7422
7423
  t12 = "overflow-auto my-auto";
7423
7424
  T3 = Container;
@@ -7526,7 +7527,7 @@ function SubcollectionsEditTab(t0) {
7526
7527
  t182 = $[36];
7527
7528
  }
7528
7529
  t2 = resolvedEntityViews.map(t182);
7529
- t3 = hardCodedEntityViews.map(_temp3);
7530
+ t3 = hardCodedEntityViews.map(_temp3$1);
7530
7531
  $[2] = collection.entityViews;
7531
7532
  $[3] = contextEntityViews;
7532
7533
  $[4] = subcollections;
@@ -7800,7 +7801,7 @@ function SubcollectionsEditTab(t0) {
7800
7801
  function _temp4(e_6) {
7801
7802
  return e_6.id;
7802
7803
  }
7803
- function _temp3(view_0) {
7804
+ function _temp3$1(view_0) {
7804
7805
  return /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsxs(TableCell, { align: "left", children: [
7805
7806
  /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", className: "flex-grow", children: view_0.name }),
7806
7807
  /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "flex-grow", children: [
@@ -7809,10 +7810,10 @@ function _temp3(view_0) {
7809
7810
  ] })
7810
7811
  ] }) }, view_0.key);
7811
7812
  }
7812
- function _temp2$2(e_1) {
7813
+ function _temp2$3(e_1) {
7813
7814
  return typeof e_1 !== "string";
7814
7815
  }
7815
- function _temp$3(e) {
7816
+ function _temp$4(e) {
7816
7817
  return typeof e === "string";
7817
7818
  }
7818
7819
  const productsCollectionTemplate = {
@@ -8254,7 +8255,7 @@ const pagesCollectionTemplate = {
8254
8255
  }
8255
8256
  };
8256
8257
  function CollectionEditorWelcomeView(t0) {
8257
- const $ = c(52);
8258
+ const $ = c(56);
8258
8259
  const {
8259
8260
  path,
8260
8261
  pathSuggestions,
@@ -8346,162 +8347,173 @@ function CollectionEditorWelcomeView(t0) {
8346
8347
  t7 = $[15];
8347
8348
  }
8348
8349
  let t8;
8349
- if ($[16] !== t6 || $[17] !== t7) {
8350
- t8 = /* @__PURE__ */ jsxs("div", { className: "my-2", children: [
8351
- t5,
8352
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
8353
- t6,
8354
- t7
8355
- ] })
8356
- ] });
8357
- $[16] = t6;
8358
- $[17] = t7;
8350
+ if ($[16] !== filteredPathSuggestions || $[17] !== loadingPathSuggestions) {
8351
+ t8 = (filteredPathSuggestions ?? []).length === 0 && !loadingPathSuggestions && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: "No existing paths found" });
8352
+ $[16] = filteredPathSuggestions;
8353
+ $[17] = loadingPathSuggestions;
8359
8354
  $[18] = t8;
8360
8355
  } else {
8361
8356
  t8 = $[18];
8362
8357
  }
8363
8358
  let t9;
8364
- if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
8365
- t9 = /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: "● Select a template:" });
8366
- $[19] = t9;
8359
+ if ($[19] !== t6 || $[20] !== t7 || $[21] !== t8) {
8360
+ t9 = /* @__PURE__ */ jsxs("div", { className: "my-2", children: [
8361
+ t5,
8362
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
8363
+ t6,
8364
+ t7,
8365
+ t8
8366
+ ] })
8367
+ ] });
8368
+ $[19] = t6;
8369
+ $[20] = t7;
8370
+ $[21] = t8;
8371
+ $[22] = t9;
8367
8372
  } else {
8368
- t9 = $[19];
8373
+ t9 = $[22];
8369
8374
  }
8370
8375
  let t10;
8371
- if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
8372
- t10 = /* @__PURE__ */ jsx(Icon, { size: "small", iconKey: productsCollectionTemplate.icon });
8373
- $[20] = t10;
8376
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
8377
+ t10 = /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", children: "● Select a template:" });
8378
+ $[23] = t10;
8374
8379
  } else {
8375
- t10 = $[20];
8380
+ t10 = $[23];
8376
8381
  }
8377
8382
  let t11;
8378
- if ($[21] !== onContinue || $[22] !== setValues) {
8379
- t11 = /* @__PURE__ */ jsx(TemplateButton, { title: "Products", subtitle: "A collection of products with images, prices and stock", icon: t10, onClick: () => {
8380
- setValues(productsCollectionTemplate);
8381
- onContinue();
8382
- } });
8383
- $[21] = onContinue;
8384
- $[22] = setValues;
8385
- $[23] = t11;
8386
- } else {
8387
- t11 = $[23];
8388
- }
8389
- let t12;
8390
8383
  if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
8391
- t12 = /* @__PURE__ */ jsx(Icon, { size: "small", iconKey: usersCollectionTemplate.icon });
8392
- $[24] = t12;
8384
+ t11 = /* @__PURE__ */ jsx(Icon, { size: "small", iconKey: productsCollectionTemplate.icon });
8385
+ $[24] = t11;
8393
8386
  } else {
8394
- t12 = $[24];
8387
+ t11 = $[24];
8395
8388
  }
8396
- let t13;
8389
+ let t12;
8397
8390
  if ($[25] !== onContinue || $[26] !== setValues) {
8398
- t13 = /* @__PURE__ */ jsx(TemplateButton, { title: "Users", subtitle: "A collection of users with emails, names and roles", icon: t12, onClick: () => {
8399
- setValues(usersCollectionTemplate);
8391
+ t12 = /* @__PURE__ */ jsx(TemplateButton, { title: "Products", subtitle: "A collection of products with images, prices and stock", icon: t11, onClick: () => {
8392
+ setValues(productsCollectionTemplate);
8400
8393
  onContinue();
8401
8394
  } });
8402
8395
  $[25] = onContinue;
8403
8396
  $[26] = setValues;
8404
- $[27] = t13;
8397
+ $[27] = t12;
8405
8398
  } else {
8406
- t13 = $[27];
8399
+ t12 = $[27];
8407
8400
  }
8408
- let t14;
8401
+ let t13;
8409
8402
  if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
8410
- t14 = /* @__PURE__ */ jsx(Icon, { size: "small", iconKey: blogCollectionTemplate.icon });
8411
- $[28] = t14;
8403
+ t13 = /* @__PURE__ */ jsx(Icon, { size: "small", iconKey: usersCollectionTemplate.icon });
8404
+ $[28] = t13;
8412
8405
  } else {
8413
- t14 = $[28];
8406
+ t13 = $[28];
8414
8407
  }
8415
- let t15;
8408
+ let t14;
8416
8409
  if ($[29] !== onContinue || $[30] !== setValues) {
8417
- t15 = /* @__PURE__ */ jsx(TemplateButton, { title: "Blog posts", subtitle: "A collection of blog posts with images, authors and complex content", icon: t14, onClick: () => {
8418
- setValues(blogCollectionTemplate);
8410
+ t14 = /* @__PURE__ */ jsx(TemplateButton, { title: "Users", subtitle: "A collection of users with emails, names and roles", icon: t13, onClick: () => {
8411
+ setValues(usersCollectionTemplate);
8419
8412
  onContinue();
8420
8413
  } });
8421
8414
  $[29] = onContinue;
8422
8415
  $[30] = setValues;
8423
- $[31] = t15;
8416
+ $[31] = t14;
8424
8417
  } else {
8425
- t15 = $[31];
8418
+ t14 = $[31];
8426
8419
  }
8427
- let t16;
8420
+ let t15;
8428
8421
  if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
8429
- t16 = /* @__PURE__ */ jsx(Icon, { size: "small", iconKey: pagesCollectionTemplate.icon });
8430
- $[32] = t16;
8422
+ t15 = /* @__PURE__ */ jsx(Icon, { size: "small", iconKey: blogCollectionTemplate.icon });
8423
+ $[32] = t15;
8431
8424
  } else {
8432
- t16 = $[32];
8425
+ t15 = $[32];
8433
8426
  }
8434
- let t17;
8427
+ let t16;
8435
8428
  if ($[33] !== onContinue || $[34] !== setValues) {
8436
- t17 = /* @__PURE__ */ jsx(TemplateButton, { title: "Pages", subtitle: "A collection of pages with images, authors and complex content", icon: t16, onClick: () => {
8437
- setValues(pagesCollectionTemplate);
8429
+ t16 = /* @__PURE__ */ jsx(TemplateButton, { title: "Blog posts", subtitle: "A collection of blog posts with images, authors and complex content", icon: t15, onClick: () => {
8430
+ setValues(blogCollectionTemplate);
8438
8431
  onContinue();
8439
8432
  } });
8440
8433
  $[33] = onContinue;
8441
8434
  $[34] = setValues;
8442
- $[35] = t17;
8435
+ $[35] = t16;
8436
+ } else {
8437
+ t16 = $[35];
8438
+ }
8439
+ let t17;
8440
+ if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
8441
+ t17 = /* @__PURE__ */ jsx(Icon, { size: "small", iconKey: pagesCollectionTemplate.icon });
8442
+ $[36] = t17;
8443
8443
  } else {
8444
- t17 = $[35];
8444
+ t17 = $[36];
8445
8445
  }
8446
8446
  let t18;
8447
- if ($[36] !== t11 || $[37] !== t13 || $[38] !== t15 || $[39] !== t17) {
8448
- t18 = /* @__PURE__ */ jsxs("div", { className: "my-2", children: [
8449
- t9,
8447
+ if ($[37] !== onContinue || $[38] !== setValues) {
8448
+ t18 = /* @__PURE__ */ jsx(TemplateButton, { title: "Pages", subtitle: "A collection of pages with images, authors and complex content", icon: t17, onClick: () => {
8449
+ setValues(pagesCollectionTemplate);
8450
+ onContinue();
8451
+ } });
8452
+ $[37] = onContinue;
8453
+ $[38] = setValues;
8454
+ $[39] = t18;
8455
+ } else {
8456
+ t18 = $[39];
8457
+ }
8458
+ let t19;
8459
+ if ($[40] !== t12 || $[41] !== t14 || $[42] !== t16 || $[43] !== t18) {
8460
+ t19 = /* @__PURE__ */ jsxs("div", { className: "my-2", children: [
8461
+ t10,
8450
8462
  /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
8451
- t11,
8452
- t13,
8453
- t15,
8454
- t17
8463
+ t12,
8464
+ t14,
8465
+ t16,
8466
+ t18
8455
8467
  ] })
8456
8468
  ] });
8457
- $[36] = t11;
8458
- $[37] = t13;
8459
- $[38] = t15;
8460
- $[39] = t17;
8461
- $[40] = t18;
8469
+ $[40] = t12;
8470
+ $[41] = t14;
8471
+ $[42] = t16;
8472
+ $[43] = t18;
8473
+ $[44] = t19;
8462
8474
  } else {
8463
- t18 = $[40];
8475
+ t19 = $[44];
8464
8476
  }
8465
- let t19;
8466
- if ($[41] !== onContinue || $[42] !== parentCollection) {
8467
- t19 = !parentCollection && /* @__PURE__ */ jsxs("div", { children: [
8477
+ let t20;
8478
+ if ($[45] !== onContinue || $[46] !== parentCollection) {
8479
+ t20 = !parentCollection && /* @__PURE__ */ jsxs("div", { children: [
8468
8480
  /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", className: "mb-2", children: "● Create a collection from a file (csv, json, xls, xslx...)" }),
8469
8481
  /* @__PURE__ */ jsx(ImportFileUpload, { onDataAdded: (data, propertiesOrder) => onContinue(data, propertiesOrder) })
8470
8482
  ] });
8471
- $[41] = onContinue;
8472
- $[42] = parentCollection;
8473
- $[43] = t19;
8483
+ $[45] = onContinue;
8484
+ $[46] = parentCollection;
8485
+ $[47] = t20;
8474
8486
  } else {
8475
- t19 = $[43];
8487
+ t20 = $[47];
8476
8488
  }
8477
- let t20;
8478
- if ($[44] !== onContinue) {
8479
- t20 = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => onContinue(), className: "my-2", children: "Continue from scratch" }) });
8480
- $[44] = onContinue;
8481
- $[45] = t20;
8489
+ let t21;
8490
+ if ($[48] !== onContinue) {
8491
+ t21 = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => onContinue(), className: "my-2", children: "Continue from scratch" }) });
8492
+ $[48] = onContinue;
8493
+ $[49] = t21;
8482
8494
  } else {
8483
- t20 = $[45];
8495
+ t21 = $[49];
8484
8496
  }
8485
- let t21;
8486
- if ($[46] !== t18 || $[47] !== t19 || $[48] !== t20 || $[49] !== t4 || $[50] !== t8) {
8487
- t21 = /* @__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: [
8497
+ let t22;
8498
+ if ($[50] !== t19 || $[51] !== t20 || $[52] !== t21 || $[53] !== t4 || $[54] !== t9) {
8499
+ t22 = /* @__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: [
8488
8500
  t3,
8489
8501
  t4,
8490
- t8,
8491
- t18,
8502
+ t9,
8492
8503
  t19,
8493
- t20
8504
+ t20,
8505
+ t21
8494
8506
  ] }) });
8495
- $[46] = t18;
8496
- $[47] = t19;
8497
- $[48] = t20;
8498
- $[49] = t4;
8499
- $[50] = t8;
8500
- $[51] = t21;
8507
+ $[50] = t19;
8508
+ $[51] = t20;
8509
+ $[52] = t21;
8510
+ $[53] = t4;
8511
+ $[54] = t9;
8512
+ $[55] = t22;
8501
8513
  } else {
8502
- t21 = $[51];
8514
+ t22 = $[55];
8503
8515
  }
8504
- return t21;
8516
+ return t22;
8505
8517
  }
8506
8518
  function TemplateButton(t0) {
8507
8519
  const $ = c(10);
@@ -8602,7 +8614,7 @@ function CollectionEditorImportMapping(t0) {
8602
8614
  const previousFullId = getFullId(previousId, namespace);
8603
8615
  const previousPropertyPath = idToPropertiesPath(previousFullId);
8604
8616
  const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);
8605
- 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);
8606
8618
  updatePropertiesOrder(newPropertiesOrder_0, namespace);
8607
8619
  const newHeadersMapping = {
8608
8620
  ...importConfig.headersMapping
@@ -8768,7 +8780,7 @@ function CollectionEditorImportMapping(t0) {
8768
8780
  }
8769
8781
  return t13;
8770
8782
  }
8771
- function _temp$2(p_0) {
8783
+ function _temp$3(p_0) {
8772
8784
  return p_0 !== void 0;
8773
8785
  }
8774
8786
  function PropertySelect(t0) {
@@ -8841,7 +8853,7 @@ function PropertySelect(t0) {
8841
8853
  }
8842
8854
  let t9;
8843
8855
  if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
8844
- t9 = Object.entries(supportedFields).map(_temp2$1);
8856
+ t9 = Object.entries(supportedFields).map(_temp2$2);
8845
8857
  $[12] = t9;
8846
8858
  } else {
8847
8859
  t9 = $[12];
@@ -8871,7 +8883,7 @@ function PropertySelect(t0) {
8871
8883
  }
8872
8884
  return t11;
8873
8885
  }
8874
- function _temp2$1(t0) {
8886
+ function _temp2$2(t0) {
8875
8887
  const [key, widget_0] = t0;
8876
8888
  return /* @__PURE__ */ jsx(PropertySelectItem, { value: key, optionDisabled: false, propertyConfig: widget_0, existing: false }, key);
8877
8889
  }
@@ -9037,7 +9049,7 @@ function CollectionEditorImportDataPreview(t0) {
9037
9049
  }
9038
9050
  let t7;
9039
9051
  if ($[12] !== propertiesOrder) {
9040
- t7 = propertiesOrder.map(_temp$1);
9052
+ t7 = propertiesOrder.map(_temp$2);
9041
9053
  $[12] = propertiesOrder;
9042
9054
  $[13] = t7;
9043
9055
  } else {
@@ -9056,7 +9068,7 @@ function CollectionEditorImportDataPreview(t0) {
9056
9068
  }
9057
9069
  return t8;
9058
9070
  }
9059
- function _temp$1(p) {
9071
+ function _temp$2(p) {
9060
9072
  return {
9061
9073
  key: p,
9062
9074
  disabled: false
@@ -9110,6 +9122,355 @@ function cleanPropertiesFromImport(properties, parentSlug = "") {
9110
9122
  idColumn
9111
9123
  };
9112
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
+ }
9113
9474
  function CollectionEditorDialog(props) {
9114
9475
  const $ = c(24);
9115
9476
  const open = props.open;
@@ -9348,10 +9709,10 @@ function CollectionEditorInternal({
9348
9709
  setCurrentView("details");
9349
9710
  }
9350
9711
  };
9351
- const doCollectionInference = (collection_0) => {
9712
+ const doCollectionInference = collectionInference ? (collection_0) => {
9352
9713
  if (!collectionInference) return void 0;
9353
9714
  return collectionInference?.(collection_0.path, collection_0.collectionGroup ?? false, parentPaths ?? []);
9354
- };
9715
+ } : void 0;
9355
9716
  const inferCollectionFromData = async (newCollection) => {
9356
9717
  try {
9357
9718
  if (!doCollectionInference) {
@@ -9570,7 +9931,8 @@ function CollectionEditorInternal({
9570
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: [
9571
9932
  /* @__PURE__ */ jsx(Tab, { value: "details", children: "Details" }),
9572
9933
  /* @__PURE__ */ jsx(Tab, { value: "properties", children: "Properties" }),
9573
- /* @__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" })
9574
9936
  ] }),
9575
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: [
9576
9938
  currentView === "loading" && /* @__PURE__ */ jsx(CircularProgressCenter, {}),
@@ -9599,6 +9961,7 @@ function CollectionEditorInternal({
9599
9961
  setDeleteRequested(true);
9600
9962
  }, children: "Reset to code" })
9601
9963
  ] }) }),
9964
+ currentView === "custom_actions" && collection && /* @__PURE__ */ jsx(EntityActionsEditTab, { collection }),
9602
9965
  currentView === "subcollections" && collection && /* @__PURE__ */ jsx(SubcollectionsEditTab, { parentCollection, configController, getUser, collectionInference, parentCollectionIds, collection }),
9603
9966
  currentView === "properties" && /* @__PURE__ */ jsx(CollectionPropertiesEditorForm, { showErrors: submitCount > 0, isNewCollection, reservedGroups, onPropertyError: (propertyKey, namespace, error_0) => {
9604
9967
  const current = removeUndefined({
@@ -9610,28 +9973,28 @@ function CollectionEditorInternal({
9610
9973
  }, getUser, getData: getDataWithPath, doCollectionInference, propertyConfigs, collectionEditable, extraIcon: extraView?.icon && /* @__PURE__ */ jsx(IconButton, { color: "primary", onClick: () => setCurrentView("extra_view"), children: extraView.icon }) }),
9611
9974
  currentView !== "welcome" && /* @__PURE__ */ jsxs(DialogActions, { position: "absolute", children: [
9612
9975
  error && /* @__PURE__ */ jsx(ErrorView, { error }),
9613
- 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: () => {
9614
9977
  importConfig.setInUse(false);
9615
9978
  return setCurrentView("welcome");
9616
9979
  }, children: [
9617
9980
  /* @__PURE__ */ jsx(ArrowBackIcon, {}),
9618
9981
  "Back"
9619
9982
  ] }),
9620
- 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: () => {
9621
9984
  setCurrentView("import_data_mapping");
9622
9985
  }, children: [
9623
9986
  /* @__PURE__ */ jsx(ArrowBackIcon, {}),
9624
9987
  "Back"
9625
9988
  ] }),
9626
- 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: [
9627
9990
  /* @__PURE__ */ jsx(ArrowBackIcon, {}),
9628
9991
  "Back"
9629
9992
  ] }),
9630
- 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: [
9631
9994
  /* @__PURE__ */ jsx(ArrowBackIcon, {}),
9632
9995
  "Back"
9633
9996
  ] }),
9634
- /* @__PURE__ */ jsx(Button, { variant: "text", onClick: () => {
9997
+ /* @__PURE__ */ jsx(Button, { variant: "text", color: "primary", onClick: () => {
9635
9998
  handleCancel();
9636
9999
  }, children: "Cancel" }),
9637
10000
  isNewCollection && currentView === "import_data_mapping" && /* @__PURE__ */ jsx(Button, { variant: "filled", color: "primary", onClick: onImportMappingComplete, children: "Next" }),
@@ -10124,14 +10487,14 @@ function EditorCollectionAction(t0) {
10124
10487
  }
10125
10488
  let t6;
10126
10489
  if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
10127
- t6 = /* @__PURE__ */ jsx(SettingsIcon, {});
10490
+ t6 = /* @__PURE__ */ jsx(SettingsIcon, { size: "small" });
10128
10491
  $[15] = t6;
10129
10492
  } else {
10130
10493
  t6 = $[15];
10131
10494
  }
10132
10495
  let t7;
10133
10496
  if ($[16] !== t4 || $[17] !== t5) {
10134
- 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 });
10135
10498
  $[16] = t4;
10136
10499
  $[17] = t5;
10137
10500
  $[18] = t7;
@@ -10666,8 +11029,100 @@ function NewCollectionCard(t0) {
10666
11029
  }
10667
11030
  return t8;
10668
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
+ }
10669
11124
  function useCollectionEditorPlugin(t0) {
10670
- const $ = c(19);
11125
+ const $ = c(22);
10671
11126
  const {
10672
11127
  collectionConfigController,
10673
11128
  configPermissions,
@@ -10723,47 +11178,59 @@ function useCollectionEditorPlugin(t0) {
10723
11178
  t4 = $[11];
10724
11179
  }
10725
11180
  let t5;
10726
- if ($[12] !== t4) {
11181
+ if ($[12] !== collectionConfigController.navigationEntries || $[13] !== collectionConfigController.saveNavigationEntries || $[14] !== t4) {
10727
11182
  t5 = {
10728
11183
  additionalActions: t3,
10729
11184
  additionalChildrenStart: t4,
10730
11185
  CollectionActions: HomePageEditorCollectionAction,
10731
- AdditionalCards: NewCollectionCard
11186
+ AdditionalCards: NewCollectionCard,
11187
+ allowDragAndDrop: true,
11188
+ navigationEntries: collectionConfigController.navigationEntries,
11189
+ onNavigationEntriesUpdate: collectionConfigController.saveNavigationEntries
10732
11190
  };
10733
- $[12] = t4;
10734
- $[13] = t5;
11191
+ $[12] = collectionConfigController.navigationEntries;
11192
+ $[13] = collectionConfigController.saveNavigationEntries;
11193
+ $[14] = t4;
11194
+ $[15] = t5;
10735
11195
  } else {
10736
- t5 = $[13];
11196
+ t5 = $[15];
10737
11197
  }
10738
11198
  let t6;
10739
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
11199
+ let t7;
11200
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
10740
11201
  t6 = {
10741
11202
  CollectionActionsStart: EditorCollectionActionStart,
10742
11203
  CollectionActions: EditorCollectionAction,
10743
11204
  HeaderAction: CollectionViewHeaderAction,
10744
11205
  AddColumnComponent: PropertyAddColumnComponent
10745
11206
  };
10746
- $[14] = t6;
11207
+ t7 = {
11208
+ ActionsTop: EditorEntityAction
11209
+ };
11210
+ $[16] = t6;
11211
+ $[17] = t7;
10747
11212
  } else {
10748
- t6 = $[14];
11213
+ t6 = $[16];
11214
+ t7 = $[17];
10749
11215
  }
10750
- let t7;
10751
- if ($[15] !== collectionConfigController.loading || $[16] !== t2 || $[17] !== t5) {
10752
- t7 = {
11216
+ let t8;
11217
+ if ($[18] !== collectionConfigController.loading || $[19] !== t2 || $[20] !== t5) {
11218
+ t8 = {
10753
11219
  key: "collection_editor",
10754
11220
  loading: collectionConfigController.loading,
10755
11221
  provider: t2,
10756
11222
  homePage: t5,
10757
- collectionView: t6
11223
+ collectionView: t6,
11224
+ form: t7
10758
11225
  };
10759
- $[15] = collectionConfigController.loading;
10760
- $[16] = t2;
10761
- $[17] = t5;
10762
- $[18] = t7;
11226
+ $[18] = collectionConfigController.loading;
11227
+ $[19] = t2;
11228
+ $[20] = t5;
11229
+ $[21] = t8;
10763
11230
  } else {
10764
- t7 = $[18];
11231
+ t8 = $[21];
10765
11232
  }
10766
- return t7;
11233
+ return t8;
10767
11234
  }
10768
11235
  function IntroWidget() {
10769
11236
  const $ = c(11);
@@ -10844,11 +11311,19 @@ const mergeCollections = (baseCollections, backendCollections = [], modifyCollec
10844
11311
  };
10845
11312
  backendCollections.forEach(markAsEditable);
10846
11313
  const result = joinCollectionLists(baseCollections, backendCollections, [], modifyCollection);
10847
- result.sort((a, b) => baseCollections.findIndex((c2) => c2.id === a.id) - baseCollections.findIndex((c2) => c2.id === b.id));
10848
- console.debug("Collections result", {
10849
- baseCollections,
10850
- backendCollections,
10851
- 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;
10852
11327
  });
10853
11328
  return result;
10854
11329
  };