@firecms/collection_editor 3.0.0-canary.42 → 3.0.0-canary.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import { jsx as e, jsxs as a, Fragment as R } from "react/jsx-runtime";
2
- import { FieldCaption as X, SearchIconsView as vr, toSnakeCase as Pt, singular as yr, IconForView as dt, ArrayContainer as br, serializeRegExp as Cr, useSnackbarController as Ie, resolveEnumValues as Nr, isPropertyBuilder as ie, useCustomizationController as Ae, getFieldConfig as Le, ErrorBoundary as me, PropertyConfigBadge as $e, unslugify as wt, useNavigationController as Te, mergeDeep as K, DEFAULT_FIELD_CONFIGS as Kt, isValidRegExp as Pr, getFieldId as Wt, DeleteConfirmationDialog as ct, useLargeLayout as xr, makePropertiesEditable as He, resolveEntityView as wr, useSelectionController as Tr, CircularProgressCenter as ut, EntityCollectionTable as kr, slugify as Or, useAuthController as _e, randomString as Ft, removeUndefined as Et, ErrorView as Zt, removeInitialAndTrailingSlashes as Vr, getDefaultPropertiesOrder as Ir, joinCollectionLists as _r } from "@firecms/core";
2
+ import { FieldCaption as X, SearchIconsView as vr, toSnakeCase as xt, singular as yr, IconForView as dt, ArrayContainer as br, serializeRegExp as Cr, useSnackbarController as Ie, resolveEnumValues as Nr, isPropertyBuilder as ie, useCustomizationController as Ae, getFieldConfig as Le, ErrorBoundary as me, PropertyConfigBadge as $e, unslugify as wt, useNavigationController as Te, mergeDeep as K, DEFAULT_FIELD_CONFIGS as Kt, isValidRegExp as xr, getFieldId as Wt, DeleteConfirmationDialog as ct, useLargeLayout as Pr, makePropertiesEditable as He, resolveEntityView as wr, useSelectionController as Tr, CircularProgressCenter as ut, EntityCollectionTable as kr, slugify as Or, useAuthController as _e, randomString as Ft, removeUndefined as Et, ErrorView as Zt, removeInitialAndTrailingSlashes as Vr, getDefaultPropertiesOrder as Ir, joinCollectionLists as _r } from "@firecms/core";
3
3
  import * as Ue from "react";
4
4
  import Y, { useState as j, useEffect as ue, useMemo as Jt, useCallback as J, useRef as je, useDeferredValue as Fr, useContext as Qt } from "react";
5
5
  import be from "react-fast-compare";
6
- import { useAutoComplete as Er, Container as ht, Typography as V, Tooltip as te, IconButton as ae, Chip as xt, TextField as Oe, cn as fe, DebouncedTextField as W, Autocomplete as Sr, AutocompleteItem as Ar, ExpandablePanel as Tt, SettingsIcon as Ye, Select as Ne, SelectItem as ee, BooleanSwitchWithLabel as pt, Dialog as Fe, AutoAwesomeIcon as ft, Badge as Dr, ListIcon as Br, Button as z, CircularProgress as Ge, Paper as ge, DialogContent as De, DialogActions as Be, RuleIcon as Mr, FileUploadIcon as zr, MultiSelect as Rr, MultiSelectItem as St, Checkbox as At, cardMixin as Xt, cardClickableMixin as er, cardSelectedMixin as tr, FunctionsIcon as Ur, RemoveCircleIcon as jr, defaultBorderMixin as kt, RemoveIcon as qr, DragHandleIcon as Lr, AddIcon as ce, SelectGroup as Dt, InfoLabel as $r, DeleteIcon as mt, ContentCopyIcon as Hr, CodeIcon as Yr, Table as Bt, TableBody as Mt, TableRow as Ct, TableCell as Re, Alert as Gr, Icon as it, Card as rr, coolIconKeys as zt, Tabs as Kr, Tab as Nt, ArrowBackIcon as nt, LoadingButton as Rt, DoneIcon as Wr, Menu as Zr, MoreVertIcon as Jr, MenuItem as Qr, SaveIcon as Xr, UndoIcon as ei } from "@firecms/ui";
6
+ import { useAutoComplete as Er, Container as ht, Typography as V, Tooltip as te, IconButton as ae, Chip as Pt, TextField as Oe, cn as fe, DebouncedTextField as W, Autocomplete as Sr, AutocompleteItem as Ar, ExpandablePanel as Tt, SettingsIcon as Ye, Select as Ne, SelectItem as ee, BooleanSwitchWithLabel as pt, Dialog as Fe, AutoAwesomeIcon as ft, Badge as Dr, ListIcon as Br, Button as z, CircularProgress as Ge, Paper as ge, DialogContent as De, DialogActions as Be, RuleIcon as Mr, FileUploadIcon as zr, MultiSelect as Rr, MultiSelectItem as St, Checkbox as At, cardMixin as Xt, cardClickableMixin as er, cardSelectedMixin as tr, FunctionsIcon as Ur, RemoveCircleIcon as jr, defaultBorderMixin as kt, RemoveIcon as qr, DragHandleIcon as Lr, AddIcon as ce, SelectGroup as Dt, InfoLabel as $r, DeleteIcon as mt, ContentCopyIcon as Hr, CodeIcon as Yr, Table as Bt, TableBody as Mt, TableRow as Ct, TableCell as Re, Alert as Gr, Icon as it, Card as rr, coolIconKeys as zt, Tabs as Kr, Tab as Nt, ArrowBackIcon as nt, LoadingButton as Rt, DoneIcon as Wr, Menu as Zr, MoreVertIcon as Jr, MenuItem as Qr, SaveIcon as Xr, UndoIcon as ei } from "@firecms/ui";
7
7
  import * as at from "yup";
8
8
  import { useFormex as G, Field as $, getIn as I, useCreateFormex as Ot, Formex as Vt } from "@firecms/formex";
9
9
  import { extractEnumFromValues as ti, buildPropertyFromData as ri, buildEntityPropertiesFromData as ii } from "@firecms/schema_inference";
10
10
  import { DragDropContext as ni, Droppable as ai, Draggable as oi } from "@hello-pangea/dnd";
11
11
  import li from "json5";
12
12
  import { Highlight as si, themes as di } from "prism-react-renderer";
13
- import { ImportFileUpload as ci, DataNewPropertiesMapping as ui, ImportNewPropertyFieldPreview as pi, getInferenceType as ir, getPropertiesMapping as mi, convertDataToEntity as hi, useImportConfig as fi, ImportSaveInProgress as gi } from "@firecms/data_import_export";
14
- import { useNavigate as vi } from "react-router";
15
- const yi = at.object().shape({
13
+ import { ImportFileUpload as ci, DataNewPropertiesMapping as ui, ImportNewPropertyFieldPreview as pi, getInferenceType as ir, convertDataToEntity as mi, useImportConfig as hi, ImportSaveInProgress as fi } from "@firecms/data_import_export";
14
+ import { useNavigate as gi } from "react-router";
15
+ const vi = at.object().shape({
16
16
  id: at.string().required("Required"),
17
17
  name: at.string().required("Required"),
18
18
  path: at.string().required("Required")
19
19
  });
20
- function bi({
20
+ function yi({
21
21
  isNewCollection: t,
22
22
  reservedGroups: r,
23
23
  existingPaths: n,
@@ -33,9 +33,9 @@ function bi({
33
33
  errors: s,
34
34
  setFieldTouched: f,
35
35
  isSubmitting: g,
36
- submitCount: x
37
- } = G(), [y, P] = j(!1), [v, b] = j(!1), w = (h) => {
38
- u("name", h), !I(p, "path") && t && h && u("path", Pt(h)), !I(p, "id") && t && h && u("id", Pt(h)), !I(p, "singularName") && t && h && u("singularName", yr(h));
36
+ submitCount: P
37
+ } = G(), [y, x] = j(!1), [v, b] = j(!1), w = (h) => {
38
+ u("name", h), !I(p, "path") && t && h && u("path", xt(h)), !I(p, "id") && t && h && u("id", xt(h)), !I(p, "singularName") && t && h && u("singularName", yr(h));
39
39
  };
40
40
  ue(() => {
41
41
  s.id && b(!0);
@@ -49,7 +49,7 @@ function bi({
49
49
  }), D = !!o;
50
50
  let _;
51
51
  typeof c.customId == "object" ? _ = "code_defined" : c.customId === !0 ? _ = "true" : c.customId === !1 ? _ = "false" : c.customId === "optional" && (_ = "optional");
52
- const S = x > 0;
52
+ const S = P > 0;
53
53
  return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ a(ht, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
54
54
  /* @__PURE__ */ a("div", { children: [
55
55
  /* @__PURE__ */ a(
@@ -62,14 +62,14 @@ function bi({
62
62
  ae,
63
63
  {
64
64
  shape: "square",
65
- onClick: () => P(!0),
65
+ onClick: () => x(!0),
66
66
  children: T
67
67
  }
68
68
  ) })
69
69
  ]
70
70
  }
71
71
  ),
72
- o && /* @__PURE__ */ e(xt, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(V, { variant: "caption", children: [
72
+ o && /* @__PURE__ */ e(Pt, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(V, { variant: "caption", children: [
73
73
  "This is a subcollection of ",
74
74
  /* @__PURE__ */ e("b", { children: o.name })
75
75
  ] }) })
@@ -269,7 +269,7 @@ function bi({
269
269
  Fe,
270
270
  {
271
271
  open: y,
272
- onOpenChange: P,
272
+ onOpenChange: x,
273
273
  maxWidth: "xl",
274
274
  fullWidth: !0,
275
275
  children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
@@ -277,7 +277,7 @@ function bi({
277
277
  {
278
278
  selectedIcon: c.icon,
279
279
  onIconSelected: (h) => {
280
- P(!1), u("icon", h);
280
+ x(!1), u("icon", h);
281
281
  }
282
282
  }
283
283
  ) })
@@ -288,7 +288,7 @@ function bi({
288
288
  function he(t) {
289
289
  return "properties." + t.replaceAll(".", ".properties.");
290
290
  }
291
- function Ci(t) {
291
+ function bi(t) {
292
292
  return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
293
293
  }
294
294
  function Ce(t) {
@@ -301,7 +301,7 @@ function nr(t, r) {
301
301
  const n = r ? `${r}.${t}` : t;
302
302
  return he(n);
303
303
  }
304
- function Ni({
304
+ function Ci({
305
305
  enumValues: t,
306
306
  onValuesChanged: r,
307
307
  onError: n,
@@ -315,8 +315,8 @@ function Ni({
315
315
  validateOnChange: !0,
316
316
  validation: (p) => {
317
317
  const s = {};
318
- p.enumValues && p.enumValues.forEach((g, x) => {
319
- g?.label || (s.enumValues = s.enumValues ?? [], s.enumValues[x] = s.enumValues[x] ?? {}, s.enumValues[x].label = "You must specify a label for this enum value entry"), g?.id || (s.enumValues = s.enumValues ?? [], s.enumValues[x] = s.enumValues[x] ?? {}, s.enumValues[x].id = "You must specify an ID for this enum value entry");
318
+ p.enumValues && p.enumValues.forEach((g, P) => {
319
+ g?.label || (s.enumValues = s.enumValues ?? [], s.enumValues[P] = s.enumValues[P] ?? {}, s.enumValues[P].label = "You must specify a label for this enum value entry"), g?.id || (s.enumValues = s.enumValues ?? [], s.enumValues[P] = s.enumValues[P] ?? {}, s.enumValues[P].id = "You must specify an ID for this enum value entry");
320
320
  });
321
321
  const f = !!(s?.enumValues && Object.keys(s?.enumValues).length > 0);
322
322
  return n?.(f), s;
@@ -325,7 +325,7 @@ function Ni({
325
325
  return ue(() => {
326
326
  r && r(u.enumValues);
327
327
  }, [u.enumValues]), /* @__PURE__ */ e(Vt, { value: c, children: /* @__PURE__ */ e(
328
- Pi,
328
+ Ni,
329
329
  {
330
330
  enumValuesPath: "enumValues",
331
331
  values: u,
@@ -337,7 +337,7 @@ function Ni({
337
337
  }
338
338
  ) });
339
339
  }
340
- function Pi({
340
+ function Ni({
341
341
  values: t,
342
342
  errors: r,
343
343
  disabled: n,
@@ -348,7 +348,7 @@ function Pi({
348
348
  }) {
349
349
  const {
350
350
  setFieldValue: c
351
- } = G(), [u, m] = Y.useState(), [p, s] = Y.useState(), [f, g] = Y.useState(!1), y = Y.useRef(/* @__PURE__ */ new Set()).current, P = (b, w) => {
351
+ } = G(), [u, m] = Y.useState(), [p, s] = Y.useState(), [f, g] = Y.useState(!1), y = Y.useRef(/* @__PURE__ */ new Set()).current, x = (b, w) => {
352
352
  const T = u === w, C = r?.enumValues && r?.enumValues[b];
353
353
  return /* @__PURE__ */ e(
354
354
  xi,
@@ -411,7 +411,7 @@ function Pi({
411
411
  value: t.enumValues,
412
412
  disabled: n,
413
413
  size: "small",
414
- buildEntry: P,
414
+ buildEntry: x,
415
415
  onInternalIdAdded: m,
416
416
  includeAddButton: !0,
417
417
  onValueChange: (b) => c(i, b),
@@ -419,7 +419,7 @@ function Pi({
419
419
  }
420
420
  ),
421
421
  /* @__PURE__ */ e(
422
- wi,
422
+ Pi,
423
423
  {
424
424
  index: p,
425
425
  open: p !== void 0,
@@ -447,9 +447,9 @@ const xi = Y.memo(
447
447
  errors: s,
448
448
  setFieldValue: f,
449
449
  touched: g
450
- } = G(), x = Y.useRef(!I(m, `${i}[${r}].id`)), y = n || x.current, P = I(m, `${i}[${r}].id`), v = I(m, `${i}[${r}].label`), b = Y.useRef(v);
450
+ } = G(), P = Y.useRef(!I(m, `${i}[${r}].id`)), y = n || P.current, x = I(m, `${i}[${r}].id`), v = I(m, `${i}[${r}].label`), b = Y.useRef(v);
451
451
  return Y.useEffect(() => {
452
- (b.current === P || !P) && y && f(`${i}[${r}].id`, v), b.current = v;
452
+ (b.current === x || !x) && y && f(`${i}[${r}].id`, v), b.current = v;
453
453
  }, [v]), /* @__PURE__ */ a(R, { children: [
454
454
  /* @__PURE__ */ a("div", { className: "flex w-full align-center justify-center", children: [
455
455
  /* @__PURE__ */ e(
@@ -500,7 +500,7 @@ const xi = Y.memo(
500
500
  return r.index === n.index && r.enumValuesPath === n.enumValuesPath && r.shouldUpdateId === n.shouldUpdateId && r.inferredEntry === n.inferredEntry && be(r.entryError, n.entryError) && r.autoFocus === n.autoFocus;
501
501
  }
502
502
  );
503
- function wi({
503
+ function Pi({
504
504
  index: t,
505
505
  open: r,
506
506
  onClose: n,
@@ -640,7 +640,7 @@ function Se({
640
640
  values: m,
641
641
  handleChange: p,
642
642
  errors: s
643
- } = G(), f = "validation.length", g = "validation.min", x = "validation.max", y = "validation.trim", P = "validation.matches", v = "validation.lowercase", b = "validation.uppercase", w = I(s, P), T = I(m, P), C = typeof T == "string" ? T : Cr(T);
643
+ } = G(), f = "validation.length", g = "validation.min", P = "validation.max", y = "validation.trim", x = "validation.matches", v = "validation.lowercase", b = "validation.uppercase", w = I(s, x), T = I(m, x), C = typeof T == "string" ? T : Cr(T);
644
644
  return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
645
645
  /* @__PURE__ */ e(Ee, { disabled: c }),
646
646
  /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
@@ -721,9 +721,9 @@ function Se({
721
721
  i && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
722
722
  W,
723
723
  {
724
- value: I(m, x),
724
+ value: I(m, P),
725
725
  label: "Max length",
726
- name: x,
726
+ name: P,
727
727
  type: "number",
728
728
  size: "small",
729
729
  disabled: c,
@@ -735,7 +735,7 @@ function Se({
735
735
  /* @__PURE__ */ e(
736
736
  $,
737
737
  {
738
- name: P,
738
+ name: x,
739
739
  as: W,
740
740
  label: "Matches regex",
741
741
  size: "small",
@@ -785,7 +785,7 @@ function It({
785
785
  ) })
786
786
  ] });
787
787
  }
788
- function Pe({
788
+ function xe({
789
789
  children: t
790
790
  }) {
791
791
  return /* @__PURE__ */ e(
@@ -824,7 +824,7 @@ function Ut({
824
824
  } = G(), m = Ie(), p = t ? "of.enumValues" : "enumValues", s = I(d, "defaultValue"), f = I(d, p), g = Jt(() => !f || typeof f == "boolean" ? [] : Nr(f) ?? [], [f]);
825
825
  return /* @__PURE__ */ a(R, { children: [
826
826
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
827
- Ni,
827
+ Ci,
828
828
  {
829
829
  enumValues: g,
830
830
  updateIds: r,
@@ -833,11 +833,11 @@ function Ut({
833
833
  onError: (y) => {
834
834
  c(p, y ? "This enum property is missing some values" : void 0);
835
835
  },
836
- getData: o ? () => o().then((y) => y.map((P) => d.id && I(P, d.id)).filter(Boolean)) : void 0,
836
+ getData: o ? () => o().then((y) => y.map((x) => d.id && I(x, d.id)).filter(Boolean)) : void 0,
837
837
  onValuesChanged: (y) => {
838
838
  if (d && (u(p, y), !t)) {
839
- const P = y.filter((v) => !!v?.id).map((v) => v.id);
840
- s && !P.includes(s) && (u("defaultValue", void 0), m.open({
839
+ const x = y.filter((v) => !!v?.id).map((v) => v.id);
840
+ s && !x.includes(s) && (u("defaultValue", void 0), m.open({
841
841
  type: "warning",
842
842
  message: "Default value was cleared"
843
843
  }));
@@ -845,7 +845,7 @@ function Ut({
845
845
  }
846
846
  }
847
847
  ) }),
848
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Pe, { children: [
848
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(xe, { children: [
849
849
  !t && /* @__PURE__ */ e(
850
850
  Se,
851
851
  {
@@ -892,9 +892,9 @@ function jt({
892
892
  const {
893
893
  values: i,
894
894
  setFieldValue: l
895
- } = G(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`, c = `${o}.fileName`, u = `${o}.storagePath`, m = `${o}.storeUrl`, p = I(i, c) ?? "{rand}_{file}", s = I(i, u) ?? "/", f = I(i, d), g = Array.isArray(f) ? f : void 0, x = !g || g.length === 0, y = (b) => {
896
- b ? b.includes("all") || b.length >= Object.keys(ot).length ? l(d, void 0) : x ? l(d, Object.keys(ot).filter((w) => !b.includes(w))) : l(d, b) : l(d, void 0);
897
- }, P = typeof p == "function", v = typeof s == "function";
895
+ } = G(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`, c = `${o}.fileName`, u = `${o}.storagePath`, m = `${o}.storeUrl`, p = I(i, c) ?? "{rand}_{file}", s = I(i, u) ?? "/", f = I(i, d), g = Array.isArray(f) ? f : void 0, P = !g || g.length === 0, y = (b) => {
896
+ b ? b.includes("all") || b.length >= Object.keys(ot).length ? l(d, void 0) : P ? l(d, Object.keys(ot).filter((w) => !b.includes(w))) : l(d, b) : l(d, void 0);
897
+ }, x = typeof p == "function", v = typeof s == "function";
898
898
  return /* @__PURE__ */ a(R, { children: [
899
899
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
900
900
  Tt,
@@ -918,7 +918,7 @@ function jt({
918
918
  name: d,
919
919
  value: g ?? [],
920
920
  onMultiValueChange: y,
921
- label: x ? void 0 : "Allowed file types",
921
+ label: P ? void 0 : "Allowed file types",
922
922
  renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((w) => ot[w]).filter((w) => !!w).join(", "),
923
923
  children: [
924
924
  /* @__PURE__ */ a(St, { value: "all", className: "flex items-center gap-2", children: [
@@ -934,7 +934,7 @@ function jt({
934
934
  /* @__PURE__ */ e(
935
935
  At,
936
936
  {
937
- checked: x || g.indexOf(b) > -1
937
+ checked: P || g.indexOf(b) > -1
938
938
  }
939
939
  ),
940
940
  /* @__PURE__ */ e("div", { className: "flex-grow", children: w }),
@@ -958,8 +958,8 @@ function jt({
958
958
  as: W,
959
959
  label: "File name",
960
960
  size: "small",
961
- disabled: P || n,
962
- value: P ? "-" : p
961
+ disabled: x || n,
962
+ value: x ? "-" : p
963
963
  }
964
964
  ) }),
965
965
  /* @__PURE__ */ a("div", { className: "col-span-12", children: [
@@ -1007,7 +1007,7 @@ function jt({
1007
1007
  ] })
1008
1008
  }
1009
1009
  ) }),
1010
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Pe, { children: [
1010
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(xe, { children: [
1011
1011
  !t && /* @__PURE__ */ e("div", { className: "grid grid-cols-12 gap-2", children: /* @__PURE__ */ e(Ee, { disabled: n }) }),
1012
1012
  t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(It, { disabled: n }) })
1013
1013
  ] }) })
@@ -1021,14 +1021,14 @@ function qe(t) {
1021
1021
  return r.dataType === "array" && typeof r.of == "function" || r.dataType === "array" && Array.isArray(r.of) ? !1 : !!r.editable;
1022
1022
  }
1023
1023
  }
1024
- function Ti(t) {
1024
+ function wi(t) {
1025
1025
  return Object.entries(t).filter(([r, n]) => qe(n)).map(([r, n]) => {
1026
1026
  const i = n;
1027
1027
  if (qe(i))
1028
1028
  return i.dataType === "map" && i.properties ? {
1029
1029
  [r]: {
1030
1030
  ...i,
1031
- properties: Ti(i.properties)
1031
+ properties: wi(i.properties)
1032
1032
  }
1033
1033
  } : { [r]: i };
1034
1034
  }).filter((r) => !!r).reduce((r, n) => ({ ...r, ...n }), {});
@@ -1104,7 +1104,7 @@ function ar({
1104
1104
  }
1105
1105
  ) });
1106
1106
  }
1107
- function ki({
1107
+ function Ti({
1108
1108
  name: t,
1109
1109
  selected: r,
1110
1110
  onClick: n,
@@ -1210,13 +1210,13 @@ const gt = Y.memo(
1210
1210
  inferredPropertyKeys: s,
1211
1211
  collectionEditable: f
1212
1212
  }) {
1213
- const g = o ?? Object.keys(l), x = J((y) => {
1213
+ const g = o ?? Object.keys(l), P = J((y) => {
1214
1214
  if (!y.destination)
1215
1215
  return;
1216
- const P = y.source.index, v = y.destination.index, b = Array.from(g), [w] = b.splice(P, 1);
1216
+ const x = y.source.index, v = y.destination.index, b = Array.from(g), [w] = b.splice(x, 1);
1217
1217
  b.splice(v, 0, w), u && u(b, r);
1218
1218
  }, [r, u, g]);
1219
- return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(ni, { onDragEnd: x, children: /* @__PURE__ */ e(ai, { droppableId: `droppable_${r}`, children: (y, P) => /* @__PURE__ */ a(
1219
+ return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(ni, { onDragEnd: P, children: /* @__PURE__ */ e(ai, { droppableId: `droppable_${r}`, children: (y, x) => /* @__PURE__ */ a(
1220
1220
  "div",
1221
1221
  {
1222
1222
  ...y.droppableProps,
@@ -1231,7 +1231,7 @@ const gt = Y.memo(
1231
1231
  draggableId: `array_field_${r}_${v}}`,
1232
1232
  index: b,
1233
1233
  children: (C, O) => /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
1234
- Oi,
1234
+ ki,
1235
1235
  {
1236
1236
  propertyKey: v,
1237
1237
  propertyOrBuilder: w,
@@ -1263,7 +1263,7 @@ const gt = Y.memo(
1263
1263
  t.namespace === r.namespace && t.collectionEditable === r.collectionEditable;
1264
1264
  }
1265
1265
  );
1266
- function Oi({
1266
+ function ki({
1267
1267
  propertyKey: t,
1268
1268
  namespace: r,
1269
1269
  propertyOrBuilder: n,
@@ -1278,10 +1278,10 @@ function Oi({
1278
1278
  collectionEditable: s
1279
1279
  }) {
1280
1280
  const f = p?.includes(r ? `${r}.${t}` : t), g = ne(t, r), y = nr(t, r) in d;
1281
- let P;
1281
+ let x;
1282
1282
  if (typeof n == "object") {
1283
1283
  const w = n;
1284
- w.dataType === "map" && w.properties && (P = /* @__PURE__ */ e(
1284
+ w.dataType === "map" && w.properties && (x = /* @__PURE__ */ e(
1285
1285
  gt,
1286
1286
  {
1287
1287
  selectedPropertyKey: o,
@@ -1305,7 +1305,7 @@ function Oi({
1305
1305
  ...l.dragHandleProps,
1306
1306
  className: "relative -ml-8",
1307
1307
  children: [
1308
- P && /* @__PURE__ */ e(
1308
+ x && /* @__PURE__ */ e(
1309
1309
  "div",
1310
1310
  {
1311
1311
  className: "absolute border-l " + kt,
@@ -1326,7 +1326,7 @@ function Oi({
1326
1326
  hasError: y
1327
1327
  }
1328
1328
  ) : /* @__PURE__ */ e(
1329
- ki,
1329
+ Ti,
1330
1330
  {
1331
1331
  name: t,
1332
1332
  property: n,
@@ -1354,16 +1354,16 @@ function Oi({
1354
1354
  }
1355
1355
  ) })
1356
1356
  ] }),
1357
- P && /* @__PURE__ */ e("div", { className: "ml-16", children: P })
1357
+ x && /* @__PURE__ */ e("div", { className: "ml-16", children: x })
1358
1358
  ]
1359
1359
  }
1360
1360
  );
1361
1361
  }
1362
- function Vi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i, collectionEditable: l }) {
1362
+ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i, collectionEditable: l }) {
1363
1363
  const {
1364
1364
  values: o,
1365
1365
  setFieldValue: d
1366
- } = G(), [c, u] = j(!1), [m, p] = j(), [s, f] = j(), g = o.propertiesOrder ?? Object.keys(o.properties ?? {}), x = ({
1366
+ } = G(), [c, u] = j(!1), [m, p] = j(), [s, f] = j(), g = o.propertiesOrder ?? Object.keys(o.properties ?? {}), P = ({
1367
1367
  id: T,
1368
1368
  property: C
1369
1369
  }) => {
@@ -1379,9 +1379,9 @@ function Vi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
1379
1379
  const O = T ? ne(T, C) : void 0;
1380
1380
  if (!O)
1381
1381
  throw Error("collection editor miss config");
1382
- const N = he(O), F = Ce(C), D = I(o, F) ?? Object.keys(I(o, Ci(C)));
1382
+ const N = he(O), F = Ce(C), D = I(o, F) ?? Object.keys(I(o, bi(C)));
1383
1383
  d(N, void 0, !1), d(F, D.filter((_) => _ !== T), !1), u(!1), p(void 0), f(void 0);
1384
- }, [d, o]), P = m ? ne(m, s) : void 0, v = P ? I(o.properties, P.replaceAll(".", ".properties.")) : void 0, b = !g || g.length < 1, w = J((T, C) => {
1384
+ }, [d, o]), x = m ? ne(m, s) : void 0, v = x ? I(o.properties, x.replaceAll(".", ".properties.")) : void 0, b = !g || g.length < 1, w = J((T, C) => {
1385
1385
  d(Ce(C), T, !1);
1386
1386
  }, []);
1387
1387
  return /* @__PURE__ */ a(R, { children: [
@@ -1461,14 +1461,14 @@ function Vi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
1461
1461
  existingProperty: !!m,
1462
1462
  autoUpdateId: !m,
1463
1463
  autoOpenTypeSelect: !m,
1464
- onPropertyChanged: x,
1464
+ onPropertyChanged: P,
1465
1465
  existingPropertyKeys: m ? void 0 : g,
1466
1466
  propertyConfigs: i
1467
1467
  }
1468
1468
  )
1469
1469
  ] });
1470
1470
  }
1471
- function Ii({
1471
+ function Vi({
1472
1472
  showErrors: t,
1473
1473
  existing: r,
1474
1474
  disabled: n,
@@ -1483,9 +1483,9 @@ function Ii({
1483
1483
  errors: m,
1484
1484
  setFieldValue: p,
1485
1485
  touched: s
1486
- } = G(), [f, g] = j(!1), x = I(c, "of"), y = I(s, "of") && I(m, "of"), P = ({ id: b, property: w, namespace: T }) => {
1486
+ } = G(), [f, g] = j(!1), P = I(c, "of"), y = I(s, "of") && I(m, "of"), x = ({ id: b, property: w, namespace: T }) => {
1487
1487
  console.log("onPropertyChanged", b, w, T), p("of", w);
1488
- }, v = x && Le(x, o);
1488
+ }, v = P && Le(P, o);
1489
1489
  return /* @__PURE__ */ a(R, { children: [
1490
1490
  /* @__PURE__ */ a("div", { className: "col-span-12", children: [
1491
1491
  /* @__PURE__ */ e(V, { variant: "subtitle2", children: "Repeat component" }),
@@ -1493,12 +1493,12 @@ function Ii({
1493
1493
  $,
1494
1494
  {
1495
1495
  name: "of",
1496
- value: x,
1496
+ value: P,
1497
1497
  children: ({}) => /* @__PURE__ */ a(ge, { className: "p-2 mt-4", children: [
1498
- x && /* @__PURE__ */ e(
1498
+ P && /* @__PURE__ */ e(
1499
1499
  ar,
1500
1500
  {
1501
- property: x,
1501
+ property: P,
1502
1502
  onClick: n ? void 0 : () => g(!0),
1503
1503
  includeName: !1,
1504
1504
  includeEditButton: !0,
@@ -1506,7 +1506,7 @@ function Ii({
1506
1506
  hasError: !1
1507
1507
  }
1508
1508
  ),
1509
- !n && !x && /* @__PURE__ */ a(
1509
+ !n && !P && /* @__PURE__ */ a(
1510
1510
  z,
1511
1511
  {
1512
1512
  variant: "text",
@@ -1530,9 +1530,9 @@ function Ii({
1530
1530
  autoOpenTypeSelect: !r,
1531
1531
  onOkClicked: () => g(!1),
1532
1532
  allowDataInference: l,
1533
- property: x,
1533
+ property: P,
1534
1534
  includeIdAndName: !1,
1535
- onPropertyChanged: P,
1535
+ onPropertyChanged: x,
1536
1536
  forceShowErrors: t,
1537
1537
  propertyConfigs: o,
1538
1538
  collectionEditable: d
@@ -1542,10 +1542,10 @@ function Ii({
1542
1542
  }
1543
1543
  )
1544
1544
  ] }),
1545
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(It, { disabled: n }) }) })
1545
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(It, { disabled: n }) }) })
1546
1546
  ] });
1547
1547
  }
1548
- const _i = Y.forwardRef(
1548
+ const Ii = Y.forwardRef(
1549
1549
  function({
1550
1550
  showErrors: r,
1551
1551
  disabledId: n,
@@ -1560,7 +1560,7 @@ const _i = Y.forwardRef(
1560
1560
  setFieldTouched: p,
1561
1561
  touched: s,
1562
1562
  validate: f
1563
- } = G(), g = "name", x = r && I(c, g), y = "id", P = r && I(c, y), v = "description", b = r && I(c, v);
1563
+ } = G(), g = "name", P = r && I(c, g), y = "id", x = r && I(c, y), v = "description", b = r && I(c, v);
1564
1564
  return /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 col-span-12", children: [
1565
1565
  /* @__PURE__ */ a("div", { children: [
1566
1566
  /* @__PURE__ */ e(
@@ -1572,16 +1572,16 @@ const _i = Y.forwardRef(
1572
1572
  value: u[g],
1573
1573
  onChange: (w) => {
1574
1574
  const T = w.target.value;
1575
- !I(s, y) && l && m(y, T ? Pt(T) : "", !1), m(g, T, !0), p(g, !0);
1575
+ !I(s, y) && l && m(y, T ? xt(T) : "", !1), m(g, T, !0), p(g, !0);
1576
1576
  },
1577
1577
  style: { fontSize: 20 },
1578
1578
  placeholder: "Field name",
1579
1579
  required: !0,
1580
1580
  disabled: i,
1581
- error: !!x
1581
+ error: !!P
1582
1582
  }
1583
1583
  ),
1584
- /* @__PURE__ */ e(X, { error: !!x, children: x })
1584
+ /* @__PURE__ */ e(X, { error: !!P, children: P })
1585
1585
  ] }),
1586
1586
  /* @__PURE__ */ a("div", { children: [
1587
1587
  /* @__PURE__ */ e(
@@ -1598,10 +1598,10 @@ const _i = Y.forwardRef(
1598
1598
  disabled: n || i,
1599
1599
  required: !0,
1600
1600
  size: "small",
1601
- error: !!P
1601
+ error: !!x
1602
1602
  }
1603
1603
  ),
1604
- /* @__PURE__ */ e(X, { error: !!P, children: P })
1604
+ /* @__PURE__ */ e(X, { error: !!x, children: x })
1605
1605
  ] }),
1606
1606
  /* @__PURE__ */ a("div", { children: [
1607
1607
  /* @__PURE__ */ e(
@@ -1619,14 +1619,14 @@ const _i = Y.forwardRef(
1619
1619
  ] });
1620
1620
  }
1621
1621
  );
1622
- function Fi({
1622
+ function _i({
1623
1623
  widgetId: t,
1624
1624
  disabled: r,
1625
1625
  showErrors: n
1626
1626
  }) {
1627
1627
  const { values: i, setFieldValue: l } = G();
1628
1628
  return /* @__PURE__ */ a(R, { children: [
1629
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Pe, { children: [
1629
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(xe, { children: [
1630
1630
  t === "text_field" && /* @__PURE__ */ e(
1631
1631
  Se,
1632
1632
  {
@@ -1692,10 +1692,10 @@ function Fi({
1692
1692
  ) })
1693
1693
  ] });
1694
1694
  }
1695
- function Ei({ disabled: t }) {
1695
+ function Fi({ disabled: t }) {
1696
1696
  const { values: r } = G(), n = I(r, "defaultValue");
1697
1697
  return /* @__PURE__ */ a(R, { children: [
1698
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) }),
1698
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) }),
1699
1699
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
1700
1700
  $,
1701
1701
  {
@@ -1714,7 +1714,7 @@ function Ei({ disabled: t }) {
1714
1714
  ) })
1715
1715
  ] });
1716
1716
  }
1717
- function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i, collectionEditable: l }) {
1717
+ function Ei({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i, collectionEditable: l }) {
1718
1718
  const {
1719
1719
  values: o,
1720
1720
  setFieldValue: d
@@ -1730,7 +1730,7 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
1730
1730
  }, !1);
1731
1731
  const C = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), O = C.includes(w) ? C : [...C, w];
1732
1732
  d("oneOf.propertiesOrder", O, !1), u(!1);
1733
- }, x = m ? ne(m, s) : void 0, y = x ? I(o.oneOf?.properties, x.replaceAll(".", ".properties.")) : void 0, P = J((w, T) => {
1733
+ }, P = m ? ne(m, s) : void 0, y = P ? I(o.oneOf?.properties, P.replaceAll(".", ".properties.")) : void 0, x = J((w, T) => {
1734
1734
  const C = w ? ne(w, T) : void 0;
1735
1735
  if (!C)
1736
1736
  throw Error("collection editor miss config");
@@ -1790,7 +1790,7 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
1790
1790
  u(!1), p(void 0), f(void 0);
1791
1791
  },
1792
1792
  collectionEditable: l,
1793
- onDelete: P,
1793
+ onDelete: x,
1794
1794
  propertyKey: m,
1795
1795
  propertyNamespace: s,
1796
1796
  property: y,
@@ -1804,7 +1804,7 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
1804
1804
  )
1805
1805
  ] });
1806
1806
  }
1807
- function Ai({ disabled: t }) {
1807
+ function Si({ disabled: t }) {
1808
1808
  const {
1809
1809
  values: r,
1810
1810
  handleChange: n
@@ -1909,10 +1909,10 @@ function Ai({ disabled: t }) {
1909
1909
  ) })
1910
1910
  ] });
1911
1911
  }
1912
- function Di({ disabled: t }) {
1912
+ function Ai({ disabled: t }) {
1913
1913
  const { values: r, setFieldValue: n } = G();
1914
1914
  return /* @__PURE__ */ a(R, { children: [
1915
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(Ai, { disabled: t }) }) }),
1915
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Si, { disabled: t }) }) }),
1916
1916
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
1917
1917
  Oe,
1918
1918
  {
@@ -1952,11 +1952,11 @@ function qt({
1952
1952
  value: m,
1953
1953
  error: p,
1954
1954
  handleChange: o,
1955
- as: Bi
1955
+ as: Di
1956
1956
  }
1957
1957
  ) }) });
1958
1958
  }
1959
- function Bi({
1959
+ function Di({
1960
1960
  disabled: t,
1961
1961
  pathPath: r,
1962
1962
  value: n,
@@ -2046,7 +2046,7 @@ function Bi({
2046
2046
  /* @__PURE__ */ e(X, { children: "You can only edit the reference collection upon field creation." })
2047
2047
  ] });
2048
2048
  }
2049
- function Mi({ disabled: t }) {
2049
+ function Bi({ disabled: t }) {
2050
2050
  const {
2051
2051
  values: r,
2052
2052
  errors: n,
@@ -2109,10 +2109,10 @@ function Mi({ disabled: t }) {
2109
2109
  ),
2110
2110
  /* @__PURE__ */ e(X, { error: !!p, children: p ?? "Update this field automatically when creating or updating the entity" })
2111
2111
  ] }),
2112
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) })
2112
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) })
2113
2113
  ] });
2114
2114
  }
2115
- function zi({ disabled: t }) {
2115
+ function Mi({ disabled: t }) {
2116
2116
  return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
2117
2117
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e($, { type: "checkbox", name: "hideFromCollection", children: ({ field: i, form: l }) => /* @__PURE__ */ e(
2118
2118
  le,
@@ -2143,8 +2143,8 @@ function zi({ disabled: t }) {
2143
2143
  ) })
2144
2144
  ] });
2145
2145
  }
2146
- function Ri({ disabled: t }) {
2147
- return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) }) });
2146
+ function zi({ disabled: t }) {
2147
+ return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) }) });
2148
2148
  }
2149
2149
  function or(t, r, n) {
2150
2150
  let i;
@@ -2392,7 +2392,7 @@ function lr({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
2392
2392
  }
2393
2393
  );
2394
2394
  }
2395
- function Ui({
2395
+ function Ri({
2396
2396
  disabled: t,
2397
2397
  showErrors: r
2398
2398
  }) {
@@ -2428,7 +2428,7 @@ function Ui({
2428
2428
  ]
2429
2429
  }
2430
2430
  ) }),
2431
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
2431
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(
2432
2432
  Se,
2433
2433
  {
2434
2434
  disabled: t,
@@ -2452,7 +2452,7 @@ function Ui({
2452
2452
  ) })
2453
2453
  ] });
2454
2454
  }
2455
- const ji = [
2455
+ const Ui = [
2456
2456
  "text_field",
2457
2457
  "multiline",
2458
2458
  "markdown",
@@ -2473,7 +2473,7 @@ const ji = [
2473
2473
  "key_value",
2474
2474
  "repeat",
2475
2475
  "block"
2476
- ], sr = Object.entries(Kt).filter(([t]) => ji.includes(t)).map(([t, r]) => ({ [t]: r })).reduce((t, r) => ({ ...t, ...r }), {}), dr = Y.memo(
2476
+ ], sr = Object.entries(Kt).filter(([t]) => Ui.includes(t)).map(([t, r]) => ({ [t]: r })).reduce((t, r) => ({ ...t, ...r }), {}), dr = Y.memo(
2477
2477
  function(r) {
2478
2478
  const {
2479
2479
  includeIdAndName: n = !0,
@@ -2488,9 +2488,9 @@ const ji = [
2488
2488
  onPropertyChanged: s,
2489
2489
  onPropertyChangedImmediate: f = !0,
2490
2490
  onDelete: g,
2491
- onError: x,
2491
+ onError: P,
2492
2492
  initialErrors: y,
2493
- forceShowErrors: P,
2493
+ forceShowErrors: x,
2494
2494
  allowDataInference: v,
2495
2495
  getController: b,
2496
2496
  getData: w,
@@ -2536,17 +2536,17 @@ const ji = [
2536
2536
  if (!S.name)
2537
2537
  h.name = "Required";
2538
2538
  else {
2539
- const B = Hi(S.name);
2539
+ const B = $i(S.name);
2540
2540
  B && (h.name = B);
2541
2541
  }
2542
2542
  if (!S.id)
2543
2543
  h.id = "Required";
2544
2544
  else {
2545
- const B = $i(S.id, u);
2545
+ const B = Li(S.id, u);
2546
2546
  B && (h.id = B);
2547
2547
  }
2548
2548
  }
2549
- return S.dataType === "string" && S.validation?.matches && !Pr(S.validation?.matches.toString()) && (h.validation = {
2549
+ return S.dataType === "string" && S.validation?.matches && !xr(S.validation?.matches.toString()) && (h.validation = {
2550
2550
  matches: "Invalid regular expression"
2551
2551
  }), S.dataType === "reference" && !S.path && (h.path = "You must specify a target collection for the field"), S.propertyConfig === "repeat" && (S.of || (h.of = "You need to specify a repeat field")), S.propertyConfig === "block" && (S.oneOf || (h.oneOf = "You need to specify the properties of this block")), h;
2552
2552
  }
@@ -2554,14 +2554,14 @@ const ji = [
2554
2554
  return ue(() => {
2555
2555
  b?.(_);
2556
2556
  }, [_, b]), /* @__PURE__ */ e(Vt, { value: _, children: /* @__PURE__ */ e(
2557
- qi,
2557
+ ji,
2558
2558
  {
2559
2559
  onPropertyChanged: f ? D : void 0,
2560
2560
  onDelete: g,
2561
2561
  includeIdAndTitle: n,
2562
2562
  propertyNamespace: m,
2563
- onError: x,
2564
- showErrors: P || _.submitCount > 0,
2563
+ onError: P,
2564
+ showErrors: x || _.submitCount > 0,
2565
2565
  existing: l,
2566
2566
  autoUpdateId: o,
2567
2567
  inArray: d,
@@ -2644,7 +2644,7 @@ function Ve({
2644
2644
  }
2645
2645
  );
2646
2646
  }
2647
- function qi({
2647
+ function ji({
2648
2648
  values: t,
2649
2649
  errors: r,
2650
2650
  setValues: n,
@@ -2659,12 +2659,12 @@ function qi({
2659
2659
  showErrors: s,
2660
2660
  disabled: f,
2661
2661
  inArray: g,
2662
- getData: x,
2662
+ getData: P,
2663
2663
  allowDataInference: y,
2664
- propertyConfigs: P,
2664
+ propertyConfigs: x,
2665
2665
  collectionEditable: v
2666
2666
  }) {
2667
- const [b, w] = j(o), [T, C] = j(!1), [O, N] = j(t?.dataType ? Wt(t) : void 0), F = Object.entries(sr).concat(Object.entries(P)), D = g ? F.filter(([Z, H]) => !ie(H.property) && H.property?.dataType !== "array") : F, _ = Fr(t), S = je(null), h = je(t), B = s && I(r, "selectedWidget");
2667
+ const [b, w] = j(o), [T, C] = j(!1), [O, N] = j(t?.dataType ? Wt(t) : void 0), F = Object.entries(sr).concat(Object.entries(x)), D = g ? F.filter(([Z, H]) => !ie(H.property) && H.property?.dataType !== "array") : F, _ = Fr(t), S = je(null), h = je(t), B = s && I(r, "selectedWidget");
2668
2668
  ue(() => {
2669
2669
  if (c && (!d || _.id)) {
2670
2670
  const {
@@ -2681,20 +2681,20 @@ function qi({
2681
2681
  t?.id && p && p(t?.id, m, r);
2682
2682
  }, [r, p, m, t?.id]);
2683
2683
  const oe = (Z) => {
2684
- N(Z), n(or(t, Z, P)), setTimeout(() => {
2684
+ N(Z), n(or(t, Z, x)), setTimeout(() => {
2685
2685
  S.current?.focus();
2686
2686
  }, 0);
2687
2687
  };
2688
2688
  let q;
2689
2689
  return O === "text_field" || O === "multiline" || O === "markdown" || O === "email" ? q = /* @__PURE__ */ e(
2690
- Fi,
2690
+ _i,
2691
2691
  {
2692
2692
  widgetId: O,
2693
2693
  disabled: f,
2694
2694
  showErrors: s
2695
2695
  }
2696
2696
  ) : O === "url" ? q = /* @__PURE__ */ e(
2697
- Ui,
2697
+ Ri,
2698
2698
  {
2699
2699
  disabled: f,
2700
2700
  showErrors: s
@@ -2706,7 +2706,7 @@ function qi({
2706
2706
  allowDataInference: y,
2707
2707
  updateIds: !i,
2708
2708
  disabled: f,
2709
- getData: x,
2709
+ getData: P,
2710
2710
  showErrors: s
2711
2711
  }
2712
2712
  ) : O === "multi_select" || O === "multi_number_select" ? q = /* @__PURE__ */ e(
@@ -2716,7 +2716,7 @@ function qi({
2716
2716
  updateIds: !i,
2717
2717
  disabled: f,
2718
2718
  allowDataInference: y,
2719
- getData: x,
2719
+ getData: P,
2720
2720
  showErrors: s
2721
2721
  }
2722
2722
  ) : O === "file_upload" ? q = /* @__PURE__ */ e(
@@ -2733,23 +2733,23 @@ function qi({
2733
2733
  multiple: !0,
2734
2734
  disabled: f
2735
2735
  }
2736
- ) : O === "switch" ? q = /* @__PURE__ */ e(Ei, { disabled: f }) : O === "number_input" ? q = /* @__PURE__ */ e(Di, { disabled: f }) : O === "group" ? q = /* @__PURE__ */ e(
2737
- Vi,
2736
+ ) : O === "switch" ? q = /* @__PURE__ */ e(Fi, { disabled: f }) : O === "number_input" ? q = /* @__PURE__ */ e(Ai, { disabled: f }) : O === "group" ? q = /* @__PURE__ */ e(
2737
+ Oi,
2738
2738
  {
2739
2739
  disabled: f,
2740
- getData: x,
2740
+ getData: P,
2741
2741
  allowDataInference: y,
2742
2742
  collectionEditable: v,
2743
- propertyConfigs: P
2743
+ propertyConfigs: x
2744
2744
  }
2745
2745
  ) : O === "block" ? q = /* @__PURE__ */ e(
2746
- Si,
2746
+ Ei,
2747
2747
  {
2748
2748
  disabled: f,
2749
- getData: x,
2749
+ getData: P,
2750
2750
  allowDataInference: y,
2751
2751
  collectionEditable: v,
2752
- propertyConfigs: P
2752
+ propertyConfigs: x
2753
2753
  }
2754
2754
  ) : O === "reference" ? q = /* @__PURE__ */ e(
2755
2755
  qt,
@@ -2759,7 +2759,7 @@ function qi({
2759
2759
  multiple: !1,
2760
2760
  disabled: f
2761
2761
  }
2762
- ) : O === "date_time" ? q = /* @__PURE__ */ e(Mi, { disabled: f }) : O === "multi_references" ? q = /* @__PURE__ */ e(
2762
+ ) : O === "date_time" ? q = /* @__PURE__ */ e(Bi, { disabled: f }) : O === "multi_references" ? q = /* @__PURE__ */ e(
2763
2763
  qt,
2764
2764
  {
2765
2765
  showErrors: s,
@@ -2768,17 +2768,17 @@ function qi({
2768
2768
  disabled: f
2769
2769
  }
2770
2770
  ) : O === "repeat" ? q = /* @__PURE__ */ e(
2771
- Ii,
2771
+ Vi,
2772
2772
  {
2773
2773
  showErrors: s,
2774
2774
  existing: i,
2775
- getData: x,
2775
+ getData: P,
2776
2776
  allowDataInference: y,
2777
2777
  disabled: f,
2778
2778
  collectionEditable: v,
2779
- propertyConfigs: P
2779
+ propertyConfigs: x
2780
2780
  }
2781
- ) : O === "key_value" ? q = /* @__PURE__ */ e(Ri, { disabled: f }) : q = null, /* @__PURE__ */ a(R, { children: [
2781
+ ) : O === "key_value" ? q = /* @__PURE__ */ e(zi, { disabled: f }) : q = null, /* @__PURE__ */ a(R, { children: [
2782
2782
  f && /* @__PURE__ */ a($r, { mode: "warn", children: [
2783
2783
  /* @__PURE__ */ e(V, { children: "This property can't be edited" }),
2784
2784
  /* @__PURE__ */ a(V, { variant: "caption", children: [
@@ -2802,7 +2802,7 @@ function qi({
2802
2802
  renderValue: (Z) => {
2803
2803
  if (!Z)
2804
2804
  return /* @__PURE__ */ e("em", { children: "Select a property widget" });
2805
- const H = Z, Q = Kt[H] ?? P[H], se = Q.property, Me = se && !ie(se) ? Le(se, P) : void 0, we = ie(se) || i && se.dataType !== t?.dataType, de = Me ? K(Me, Q) : Q;
2805
+ const H = Z, Q = Kt[H] ?? x[H], se = Q.property, Me = se && !ie(se) ? Le(se, x) : void 0, we = ie(se) || i && se.dataType !== t?.dataType, de = Me ? K(Me, Q) : Q;
2806
2806
  return /* @__PURE__ */ a(
2807
2807
  "div",
2808
2808
  {
@@ -2871,7 +2871,7 @@ function qi({
2871
2871
  ] }),
2872
2872
  /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-y-12 mt-8 mb-8", children: [
2873
2873
  d && /* @__PURE__ */ e(
2874
- _i,
2874
+ Ii,
2875
2875
  {
2876
2876
  showErrors: s,
2877
2877
  disabledId: i,
@@ -2882,7 +2882,7 @@ function qi({
2882
2882
  }
2883
2883
  ),
2884
2884
  q,
2885
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(zi, { disabled: f }) })
2885
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Mi, { disabled: f }) })
2886
2886
  ] }),
2887
2887
  u && /* @__PURE__ */ e(
2888
2888
  ct,
@@ -2900,26 +2900,26 @@ function qi({
2900
2900
  )
2901
2901
  ] });
2902
2902
  }
2903
- const Li = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
2904
- function $i(t, r) {
2903
+ const qi = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
2904
+ function Li(t, r) {
2905
2905
  let n;
2906
- return t || (n = "You must specify an id for the field"), t && !t.match(Li) && (n = "The id can only contain letters, numbers and underscores (_), and not start with a number"), t && r && r.includes(t) && (n = "There is another field with this ID already"), n;
2906
+ return t || (n = "You must specify an id for the field"), t && !t.match(qi) && (n = "The id can only contain letters, numbers and underscores (_), and not start with a number"), t && r && r.includes(t) && (n = "There is another field with this ID already"), n;
2907
2907
  }
2908
- function Hi(t) {
2908
+ function $i(t) {
2909
2909
  let r;
2910
2910
  return t || (r = "You must specify a title for the field"), r;
2911
2911
  }
2912
- function Yi(t) {
2912
+ function Hi(t) {
2913
2913
  return t ? (t.slice(0, 1).toLowerCase() + t.slice(1)).replace(/([-_ ]){1,}/g, " ").split(/[-_ ]/).reduce((r, n) => r + n[0].toUpperCase() + n.substring(1), "") : "";
2914
2914
  }
2915
- function Gi({
2915
+ function Yi({
2916
2916
  collection: t,
2917
2917
  onOpenChange: r,
2918
2918
  open: n
2919
2919
  }) {
2920
2920
  const i = Ie(), l = t ? `import { EntityCollection } from "firecms";
2921
2921
 
2922
- const ` + (t?.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + li.stringify(cr(t), null, " ") : "No collection selected";
2922
+ const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + li.stringify(cr(t), null, " ") : "No collection selected";
2923
2923
  return /* @__PURE__ */ a(
2924
2924
  Fe,
2925
2925
  {
@@ -3011,7 +3011,7 @@ function cr(t) {
3011
3011
  subcollections: (t.subcollections ?? []).map(cr)
3012
3012
  };
3013
3013
  }
3014
- function Ki({
3014
+ function Gi({
3015
3015
  showErrors: t,
3016
3016
  isNewCollection: r,
3017
3017
  propertyErrorsRef: n,
@@ -3028,11 +3028,11 @@ function Ki({
3028
3028
  const {
3029
3029
  values: f,
3030
3030
  setFieldValue: g,
3031
- setFieldError: x,
3031
+ setFieldError: P,
3032
3032
  setFieldTouched: y,
3033
- errors: P,
3033
+ errors: x,
3034
3034
  dirty: v
3035
- } = G(), b = Ie(), w = xr(), T = !w, [C, O] = j(), [N, F] = j(), [D, _] = j(), S = N ? ne(N, D) : void 0, h = S ? I(f.properties, S.replaceAll(".", ".properties.")) : void 0, [B, oe] = j(!1), [q, Z] = j(!1), [H, Q] = j(!1), [se, Me] = j([]), we = Y.useRef(f.propertiesOrder ? { "": f.propertiesOrder } : {});
3035
+ } = G(), b = Ie(), w = Pr(), T = !w, [C, O] = j(), [N, F] = j(), [D, _] = j(), S = N ? ne(N, D) : void 0, h = S ? I(f.properties, S.replaceAll(".", ".properties.")) : void 0, [B, oe] = j(!1), [q, Z] = j(!1), [H, Q] = j(!1), [se, Me] = j([]), we = Y.useRef(f.propertiesOrder ? { "": f.propertiesOrder } : {});
3036
3036
  ue(() => {
3037
3037
  l && l(v);
3038
3038
  }, [v]);
@@ -3121,7 +3121,7 @@ function Ki({
3121
3121
  propertyPath: E
3122
3122
  }), E) {
3123
3123
  const M = k && Object.keys(k).length > 0;
3124
- i(A, U, M ? k : void 0), x(he(E), M ? "Property error" : void 0);
3124
+ i(A, U, M ? k : void 0), P(he(E), M ? "Property error" : void 0);
3125
3125
  }
3126
3126
  }, []), Ze = () => {
3127
3127
  O(void 0), F(void 0);
@@ -3149,7 +3149,7 @@ function Ki({
3149
3149
  placeholder: "Collection name",
3150
3150
  size: "small",
3151
3151
  required: !0,
3152
- error: !!P?.name
3152
+ error: !!x?.name
3153
3153
  }
3154
3154
  ),
3155
3155
  Xe && /* @__PURE__ */ a(
@@ -3208,7 +3208,7 @@ function Ki({
3208
3208
  onPropertyMove: Ke,
3209
3209
  onPropertyRemove: r ? ke : void 0,
3210
3210
  collectionEditable: s,
3211
- errors: P
3211
+ errors: x
3212
3212
  }
3213
3213
  ) }),
3214
3214
  /* @__PURE__ */ e(
@@ -3315,7 +3315,7 @@ function Ki({
3315
3315
  }
3316
3316
  ),
3317
3317
  /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
3318
- Gi,
3318
+ Yi,
3319
3319
  {
3320
3320
  collection: f,
3321
3321
  open: B,
@@ -3324,7 +3324,7 @@ function Ki({
3324
3324
  ) })
3325
3325
  ] });
3326
3326
  }
3327
- function Wi({
3327
+ function Ki({
3328
3328
  open: t,
3329
3329
  handleOk: r,
3330
3330
  handleCancel: n,
@@ -3352,7 +3352,7 @@ function Wi({
3352
3352
  }
3353
3353
  );
3354
3354
  }
3355
- function Zi({ open: t, onClose: r }) {
3355
+ function Wi({ open: t, onClose: r }) {
3356
3356
  const {
3357
3357
  entityViews: n
3358
3358
  } = Ae();
@@ -3386,7 +3386,7 @@ function Zi({ open: t, onClose: r }) {
3386
3386
  }
3387
3387
  );
3388
3388
  }
3389
- function Ji({
3389
+ function Zi({
3390
3390
  collection: t,
3391
3391
  parentCollection: r,
3392
3392
  configController: n,
@@ -3394,9 +3394,9 @@ function Ji({
3394
3394
  getUser: l,
3395
3395
  parentCollectionIds: o
3396
3396
  }) {
3397
- const { entityViews: d } = Ae(), [c, u] = Y.useState(), [m, p] = Y.useState(!1), [s, f] = Y.useState(), [g, x] = Y.useState(), {
3397
+ const { entityViews: d } = Ae(), [c, u] = Y.useState(), [m, p] = Y.useState(!1), [s, f] = Y.useState(), [g, P] = Y.useState(), {
3398
3398
  values: y,
3399
- setFieldValue: P
3399
+ setFieldValue: x
3400
3400
  } = G(), v = t.subcollections ?? [], b = y.entityViews?.filter((C) => typeof C == "string").map((C) => wr(C, d)).filter(Boolean) ?? [], w = t.entityViews?.filter((C) => typeof C != "string") ?? [], T = b.length + w.length;
3401
3401
  return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
3402
3402
  /* @__PURE__ */ e(ht, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-16", children: [
@@ -3409,7 +3409,7 @@ function Ji({
3409
3409
  v && v.length > 0 && /* @__PURE__ */ e(Bt, { children: /* @__PURE__ */ e(Mt, { children: v.map((C) => /* @__PURE__ */ a(
3410
3410
  Ct,
3411
3411
  {
3412
- onClick: () => x({
3412
+ onClick: () => P({
3413
3413
  isNewCollection: !1,
3414
3414
  editedCollectionId: C.id
3415
3415
  }),
@@ -3446,7 +3446,7 @@ function Ji({
3446
3446
  z,
3447
3447
  {
3448
3448
  onClick: () => {
3449
- x({
3449
+ P({
3450
3450
  isNewCollection: !0
3451
3451
  });
3452
3452
  },
@@ -3553,7 +3553,7 @@ function Ji({
3553
3553
  {
3554
3554
  open: !!s,
3555
3555
  onAccept: () => {
3556
- P("entityViews", y.entityViews?.filter((C) => C !== s)), f(void 0);
3556
+ x("entityViews", y.entityViews?.filter((C) => C !== s)), f(void 0);
3557
3557
  },
3558
3558
  onCancel: () => f(void 0),
3559
3559
  title: /* @__PURE__ */ e(R, { children: "Remove this view?" }),
@@ -3576,16 +3576,16 @@ function Ji({
3576
3576
  ...g,
3577
3577
  getUser: l,
3578
3578
  handleClose: () => {
3579
- x(void 0);
3579
+ P(void 0);
3580
3580
  }
3581
3581
  }
3582
3582
  ),
3583
3583
  /* @__PURE__ */ e(
3584
- Zi,
3584
+ Wi,
3585
3585
  {
3586
3586
  open: m,
3587
3587
  onClose: (C) => {
3588
- C && P("entityViews", [...y.entityViews ?? [], C]), p(!1);
3588
+ C && x("entityViews", [...y.entityViews ?? [], C]), p(!1);
3589
3589
  }
3590
3590
  }
3591
3591
  )
@@ -4013,7 +4013,7 @@ const Lt = {
4013
4013
  }
4014
4014
  }
4015
4015
  };
4016
- function Qi({
4016
+ function Ji({
4017
4017
  path: t,
4018
4018
  pathSuggestions: r,
4019
4019
  parentCollection: n,
@@ -4023,8 +4023,8 @@ function Qi({
4023
4023
  const [o, d] = j(!1), [c, u] = j();
4024
4024
  ue(() => {
4025
4025
  r && l && (d(!0), r(t).then((g) => {
4026
- const x = g.filter((y) => !(l ?? []).find((P) => P.trim().toLowerCase() === y.trim().toLowerCase()));
4027
- u(x);
4026
+ const P = g.filter((y) => !(l ?? []).find((x) => x.trim().toLowerCase() === y.trim().toLowerCase()));
4027
+ u(P);
4028
4028
  }).finally(() => d(!1)));
4029
4029
  }, [l, t, r]);
4030
4030
  const {
@@ -4041,7 +4041,7 @@ function Qi({
4041
4041
  children: /* @__PURE__ */ e(V, { variant: "h4", className: "flex-grow", children: "New collection" })
4042
4042
  }
4043
4043
  ),
4044
- n && /* @__PURE__ */ e(xt, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(V, { variant: "caption", children: [
4044
+ n && /* @__PURE__ */ e(Pt, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(V, { variant: "caption", children: [
4045
4045
  "This is a subcollection of ",
4046
4046
  /* @__PURE__ */ e("b", { children: n.name })
4047
4047
  ] }) }),
@@ -4056,8 +4056,8 @@ function Qi({
4056
4056
  ),
4057
4057
  /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
4058
4058
  o && !c && /* @__PURE__ */ e(Ge, { size: "small" }),
4059
- c?.map((g, x) => /* @__PURE__ */ e(
4060
- xt,
4059
+ c?.map((g, P) => /* @__PURE__ */ e(
4060
+ Pt,
4061
4061
  {
4062
4062
  colorScheme: "cyanLighter",
4063
4063
  onClick: () => {
@@ -4137,7 +4137,7 @@ function Qi({
4137
4137
  children: "● Create a collection from a file (csv, json, xls, xslx...)"
4138
4138
  }
4139
4139
  ),
4140
- /* @__PURE__ */ e(ci, { onDataAdded: (g, x) => i(g, x) })
4140
+ /* @__PURE__ */ e(ci, { onDataAdded: (g, P) => i(g, P) })
4141
4141
  ] }),
4142
4142
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(z, { variant: "text", onClick: () => i(), className: "my-2", children: "Continue from scratch" }) })
4143
4143
  ] }) });
@@ -4165,7 +4165,7 @@ function lt({
4165
4165
  }
4166
4166
  ) });
4167
4167
  }
4168
- function Xi({
4168
+ function Qi({
4169
4169
  importConfig: t,
4170
4170
  propertyConfigs: r,
4171
4171
  collectionEditable: n
@@ -4176,30 +4176,30 @@ function Xi({
4176
4176
  values: o
4177
4177
  } = G(), [d, c] = j(void 0), u = Y.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), m = d ? d.id : void 0, p = d || void 0, s = ({
4178
4178
  id: g,
4179
- property: x,
4179
+ property: P,
4180
4180
  previousId: y,
4181
- namespace: P
4181
+ namespace: x
4182
4182
  }) => {
4183
- const v = g ? ne(g, P) : void 0, b = v ? he(v) : void 0, w = (C) => C ? u.current[C] ?? I(o, Ce(C)) : u.current[""], T = (C, O) => {
4183
+ const v = g ? ne(g, x) : void 0, b = v ? he(v) : void 0, w = (C) => C ? u.current[C] ?? I(o, Ce(C)) : u.current[""], T = (C, O) => {
4184
4184
  const N = Ce(O);
4185
4185
  i(N, C, !1), u.current[O ?? ""] = C;
4186
4186
  };
4187
4187
  if (y && y !== g) {
4188
- const C = ne(y, P), O = he(C), F = w(P).map((_) => _ === y ? g : _).filter((_) => _ !== void 0);
4189
- T(F, P);
4188
+ const C = ne(y, x), O = he(C), F = w(x).map((_) => _ === y ? g : _).filter((_) => _ !== void 0);
4189
+ T(F, x);
4190
4190
  const D = { ...t.headersMapping };
4191
4191
  Object.keys(D).forEach((_) => {
4192
4192
  D[_] === y && (D[_] = g ?? "");
4193
4193
  }), t.setHeadersMapping(D), i(O, void 0, !1), l(O, !1, !1);
4194
4194
  }
4195
- b && (i(b, x, !1), l(b, !0, !1));
4195
+ b && (i(b, P, !1), l(b, !0, !1));
4196
4196
  }, f = async ({
4197
4197
  id: g,
4198
- importKey: x,
4198
+ importKey: P,
4199
4199
  property: y,
4200
- namespace: P
4200
+ namespace: x
4201
4201
  }) => {
4202
- const v = g ? ne(g, P) : void 0, b = v ? he(v) : void 0, w = t.importData.map((C) => I(C, x)), T = {
4202
+ const v = g ? ne(g, x) : void 0, b = v ? he(v) : void 0, w = t.importData.map((C) => I(C, P)), T = {
4203
4203
  ...ri(w, y, ir),
4204
4204
  editable: !0
4205
4205
  };
@@ -4211,32 +4211,28 @@ function Xi({
4211
4211
  /* @__PURE__ */ e(
4212
4212
  ui,
4213
4213
  {
4214
- headersMapping: t.headersMapping,
4215
- headingsOrder: t.headingsOrder,
4216
- idColumn: t.idColumn,
4217
- originProperties: t.originProperties,
4214
+ importConfig: t,
4218
4215
  destinationProperties: o.properties,
4219
- onIdPropertyChanged: (g) => t.setIdColumn(g ?? void 0),
4220
4216
  buildPropertyView: ({
4221
4217
  property: g,
4222
- propertyKey: x,
4218
+ propertyKey: P,
4223
4219
  importKey: y,
4224
- isIdColumn: P
4225
- }) => P ? /* @__PURE__ */ e(V, { children: " This column will be used as ID" }) : /* @__PURE__ */ e(
4220
+ isIdColumn: x
4221
+ }) => x ? /* @__PURE__ */ e(V, { children: " This column will be used as ID" }) : /* @__PURE__ */ e(
4226
4222
  pi,
4227
4223
  {
4228
4224
  property: g,
4229
- propertyKey: x,
4225
+ propertyKey: P,
4230
4226
  onPropertyNameChanged: (v, b) => i(`properties.${v}.name`, b, !1),
4231
4227
  onEditClick: () => {
4232
- !x || !g || c({
4228
+ !P || !g || c({
4233
4229
  ...g,
4234
- id: x,
4230
+ id: P,
4235
4231
  editable: !0
4236
4232
  });
4237
4233
  },
4238
4234
  propertyTypeView: /* @__PURE__ */ e(
4239
- en,
4235
+ Xi,
4240
4236
  {
4241
4237
  property: g,
4242
4238
  disabled: !1,
@@ -4244,7 +4240,7 @@ function Xi({
4244
4240
  ...v,
4245
4241
  importKey: y
4246
4242
  }),
4247
- propertyKey: x,
4243
+ propertyKey: P,
4248
4244
  propertyConfigs: r
4249
4245
  }
4250
4246
  )
@@ -4278,7 +4274,7 @@ function Xi({
4278
4274
  /* @__PURE__ */ e("div", { style: { height: "52px" } })
4279
4275
  ] });
4280
4276
  }
4281
- function en({
4277
+ function Xi({
4282
4278
  property: t,
4283
4279
  onPropertyChanged: r,
4284
4280
  propertyKey: n,
@@ -4328,15 +4324,15 @@ function en({
4328
4324
  }
4329
4325
  );
4330
4326
  }
4331
- function tn({
4327
+ function en({
4332
4328
  importConfig: t,
4333
4329
  properties: r,
4334
4330
  propertiesOrder: n
4335
4331
  }) {
4336
4332
  const [i, l] = j(!1);
4337
4333
  async function o() {
4338
- const c = mi(t.originProperties, r), u = t.importData.map((m) => hi(m, t.idColumn, t.headersMapping, r, c, "TEMP_PATH"));
4339
- t.setEntities(u);
4334
+ const c = t.importData.map((u) => mi(u, t.idColumn, t.headersMapping, r, "TEMP_PATH", t.defaultValues));
4335
+ t.setEntities(c);
4340
4336
  }
4341
4337
  ue(() => {
4342
4338
  o().finally(() => l(!1));
@@ -4415,7 +4411,7 @@ function pr(t) {
4415
4411
  onOpenChange: (c) => c ? void 0 : d(),
4416
4412
  children: [
4417
4413
  r && /* @__PURE__ */ e(
4418
- rn,
4414
+ tn,
4419
4415
  {
4420
4416
  ...t,
4421
4417
  handleCancel: d,
@@ -4423,7 +4419,7 @@ function pr(t) {
4423
4419
  }
4424
4420
  ),
4425
4421
  /* @__PURE__ */ e(
4426
- Wi,
4422
+ Ki,
4427
4423
  {
4428
4424
  open: l,
4429
4425
  handleOk: () => t.handleClose(void 0),
@@ -4435,14 +4431,14 @@ function pr(t) {
4435
4431
  }
4436
4432
  );
4437
4433
  }
4438
- function rn(t) {
4434
+ function tn(t) {
4439
4435
  const { propertyConfigs: r } = Ae(), n = Te(), i = _e(), {
4440
4436
  topLevelNavigation: l,
4441
4437
  collections: o
4442
- } = n, d = t.initialValues, c = !d?.path && (t.parentCollectionIds ?? []).length === 0, u = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], m = u.map((b) => b.path.trim().toLowerCase()), p = u.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [s, f] = Ue.useState(), [g, x] = Ue.useState(!1);
4438
+ } = n, d = t.initialValues, c = !d?.path && (t.parentCollectionIds ?? []).length === 0, u = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], m = u.map((b) => b.path.trim().toLowerCase()), p = u.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [s, f] = Ue.useState(), [g, P] = Ue.useState(!1);
4443
4439
  if (ue(() => {
4444
4440
  try {
4445
- n.initialised && (t.editedCollectionId ? f(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : f(void 0), x(!0));
4441
+ n.initialised && (t.editedCollectionId ? f(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : f(void 0), P(!0));
4446
4442
  } catch (b) {
4447
4443
  console.error(b);
4448
4444
  }
@@ -4450,10 +4446,10 @@ function rn(t) {
4450
4446
  throw Error("Internal: Navigation not ready in collection editor");
4451
4447
  const {
4452
4448
  groups: y
4453
- } = l, P = s ? {
4449
+ } = l, x = s ? {
4454
4450
  ...s,
4455
4451
  id: s.id ?? s.path ?? Ft(16)
4456
- } : void 0, v = P ? an(P, r) : {
4452
+ } : void 0, v = x ? nn(x, r) : {
4457
4453
  id: d?.path ?? Ft(16),
4458
4454
  path: d?.path ?? "",
4459
4455
  name: d?.name ?? "",
@@ -4464,7 +4460,7 @@ function rn(t) {
4464
4460
  ownerId: i.user?.uid ?? ""
4465
4461
  };
4466
4462
  return g ? !t.isNewCollection && (!n.initialised || !g) ? /* @__PURE__ */ e(ut, {}) : /* @__PURE__ */ e(
4467
- nn,
4463
+ rn,
4468
4464
  {
4469
4465
  ...t,
4470
4466
  initialValues: v,
@@ -4478,7 +4474,7 @@ function rn(t) {
4478
4474
  }
4479
4475
  ) : /* @__PURE__ */ e(ut, {});
4480
4476
  }
4481
- function nn({
4477
+ function rn({
4482
4478
  isNewCollection: t,
4483
4479
  configController: r,
4484
4480
  editedCollectionId: n,
@@ -4493,9 +4489,9 @@ function nn({
4493
4489
  pathSuggestions: s,
4494
4490
  getUser: f,
4495
4491
  parentCollection: g,
4496
- getData: x,
4492
+ getData: P,
4497
4493
  existingPaths: y,
4498
- existingIds: P,
4494
+ existingIds: x,
4499
4495
  includeTemplates: v,
4500
4496
  collection: b,
4501
4497
  setCollection: w,
@@ -4503,7 +4499,7 @@ function nn({
4503
4499
  propertyConfigs: C,
4504
4500
  groups: O
4505
4501
  }) {
4506
- const N = fi(), F = Te(), D = Ie(), _ = je({}), S = t ? v ? "welcome" : "details" : "properties", [h, B] = j(S), [oe, q] = Ue.useState(), Z = (k) => {
4502
+ const N = hi(), F = Te(), D = Ie(), _ = je({}), S = t ? v ? "welcome" : "details" : "properties", [h, B] = j(S), [oe, q] = Ue.useState(), Z = (k) => {
4507
4503
  const E = k.id || k.path;
4508
4504
  return r.saveCollection({
4509
4505
  id: E,
@@ -4573,7 +4569,7 @@ function nn({
4573
4569
  },
4574
4570
  validation: (k) => {
4575
4571
  let E = {};
4576
- const M = (h === "properties" || h === "subcollections" || h === "details") && yi;
4572
+ const M = (h === "properties" || h === "subcollections" || h === "details") && vi;
4577
4573
  if (M)
4578
4574
  try {
4579
4575
  M.validateSync(k, { abortEarly: !1 });
@@ -4585,7 +4581,7 @@ function nn({
4585
4581
  if (h === "properties" && (E = { ...E, ..._.current }), h === "details") {
4586
4582
  const L = Gt(k.path, t, y, k.id);
4587
4583
  L && (E.path = L);
4588
- const ye = on(k.id, t, y, P);
4584
+ const ye = an(k.id, t, y, x);
4589
4585
  ye && (E.id = ye);
4590
4586
  }
4591
4587
  return E;
@@ -4596,7 +4592,7 @@ function nn({
4596
4592
  isSubmitting: ke,
4597
4593
  dirty: Ke,
4598
4594
  submitCount: vt
4599
- } = de, pe = re.path, We = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + pe : pe, Ze = Gt(pe, t, y, re.id), Je = !Ze && i ? F.convertIdsToPaths(i) : void 0, Qe = Ze ? void 0 : F.resolveAliasesFrom(We), ze = Qe && x ? () => x(Qe, Je ?? []) : void 0;
4595
+ } = de, pe = re.path, We = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + pe : pe, Ze = Gt(pe, t, y, re.id), Je = !Ze && i ? F.convertIdsToPaths(i) : void 0, Qe = Ze ? void 0 : F.resolveAliasesFrom(We), ze = Qe && P ? () => P(Qe, Je ?? []) : void 0;
4600
4596
  ue(() => {
4601
4597
  p(Ke);
4602
4598
  }, [Ke]);
@@ -4641,7 +4637,7 @@ function nn({
4641
4637
  h === "loading" && /* @__PURE__ */ e(ut, {}),
4642
4638
  h === "extra_view" && pe && u?.View && /* @__PURE__ */ e(u.View, { path: pe }),
4643
4639
  h === "welcome" && /* @__PURE__ */ e(
4644
- Qi,
4640
+ Ji,
4645
4641
  {
4646
4642
  path: pe,
4647
4643
  onContinue: (k, E) => {
@@ -4653,7 +4649,7 @@ function nn({
4653
4649
  }
4654
4650
  ),
4655
4651
  h === "import_data_mapping" && N && /* @__PURE__ */ e(
4656
- Xi,
4652
+ Qi,
4657
4653
  {
4658
4654
  importConfig: N,
4659
4655
  collectionEditable: U,
@@ -4661,7 +4657,7 @@ function nn({
4661
4657
  }
4662
4658
  ),
4663
4659
  h === "import_data_preview" && N && /* @__PURE__ */ e(
4664
- tn,
4660
+ en,
4665
4661
  {
4666
4662
  importConfig: N,
4667
4663
  properties: re.properties,
@@ -4669,7 +4665,7 @@ function nn({
4669
4665
  }
4670
4666
  ),
4671
4667
  h === "import_data_saving" && N && /* @__PURE__ */ e(
4672
- gi,
4668
+ fi,
4673
4669
  {
4674
4670
  importConfig: N,
4675
4671
  collection: re,
@@ -4683,10 +4679,10 @@ function nn({
4683
4679
  }
4684
4680
  ),
4685
4681
  h === "details" && /* @__PURE__ */ e(
4686
- bi,
4682
+ yi,
4687
4683
  {
4688
4684
  existingPaths: y,
4689
- existingIds: P,
4685
+ existingIds: x,
4690
4686
  groups: O,
4691
4687
  parentCollectionIds: i,
4692
4688
  parentCollection: g,
@@ -4694,7 +4690,7 @@ function nn({
4694
4690
  }
4695
4691
  ),
4696
4692
  h === "subcollections" && b && /* @__PURE__ */ e(
4697
- Ji,
4693
+ Zi,
4698
4694
  {
4699
4695
  parentCollection: g,
4700
4696
  configController: r,
@@ -4705,7 +4701,7 @@ function nn({
4705
4701
  }
4706
4702
  ),
4707
4703
  h === "properties" && /* @__PURE__ */ e(
4708
- Ki,
4704
+ Gi,
4709
4705
  {
4710
4706
  showErrors: vt > 0,
4711
4707
  isNewCollection: t,
@@ -4851,7 +4847,7 @@ function nn({
4851
4847
  )
4852
4848
  ] }) }) });
4853
4849
  }
4854
- function an(t, r) {
4850
+ function nn(t, r) {
4855
4851
  const {
4856
4852
  properties: n,
4857
4853
  ...i
@@ -4884,12 +4880,12 @@ function mr(t, r) {
4884
4880
  const Gt = (t, r, n, i) => {
4885
4881
  let l;
4886
4882
  return t || (l = "You must specify a path in the database for this collection"), r && n?.includes(t.trim().toLowerCase()) && !i && (l = "There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids"), Vr(t).split("/").length % 2 === 0 && (l = `Collection paths must have an odd number of segments: ${t}`), l;
4887
- }, on = (t, r, n, i) => {
4883
+ }, an = (t, r, n, i) => {
4888
4884
  if (!t)
4889
4885
  return;
4890
4886
  let l;
4891
4887
  return r && n?.includes(t.trim().toLowerCase()) && (l = "There is already a collection that uses this value as a path"), r && i?.includes(t.trim().toLowerCase()) && (l = "There is already a collection which uses this id"), l;
4892
- }, hr = Y.createContext({}), fr = Y.createContext({}), ln = Y.memo(
4888
+ }, hr = Y.createContext({}), fr = Y.createContext({}), on = Y.memo(
4893
4889
  function({
4894
4890
  children: r,
4895
4891
  collectionConfigController: n,
@@ -4902,7 +4898,7 @@ const Gt = (t, r, n, i) => {
4902
4898
  getData: m,
4903
4899
  onAnalyticsEvent: p
4904
4900
  }) {
4905
- const s = Te(), f = vi(), g = Ie(), { propertyConfigs: x } = Ae(), [y, P] = Y.useState(), [v, b] = Y.useState(), w = J(() => ({
4901
+ const s = Te(), f = gi(), g = Ie(), { propertyConfigs: P } = Ae(), [y, x] = Y.useState(), [v, b] = Y.useState(), w = J(() => ({
4906
4902
  createCollections: !0,
4907
4903
  editCollections: !0,
4908
4904
  deleteCollections: !0
@@ -4915,7 +4911,7 @@ const Gt = (t, r, n, i) => {
4915
4911
  console.debug("Edit collection", N, F, D, _), p?.("edit_collection", {
4916
4912
  id: N,
4917
4913
  fullPath: F
4918
- }), P({
4914
+ }), x({
4919
4915
  editedCollectionId: N,
4920
4916
  fullPath: F,
4921
4917
  parentCollectionIds: D,
@@ -4964,7 +4960,7 @@ const Gt = (t, r, n, i) => {
4964
4960
  initialValues: D,
4965
4961
  redirect: _,
4966
4962
  sourceClick: S
4967
- }), P({
4963
+ }), x({
4968
4964
  isNewCollection: !0,
4969
4965
  parentCollectionIds: N,
4970
4966
  parentCollection: F,
@@ -5002,7 +4998,7 @@ const Gt = (t, r, n, i) => {
5002
4998
  const F = s.buildUrlCollectionPath(N.id ?? N.path);
5003
4999
  f(F);
5004
5000
  }
5005
- P(void 0);
5001
+ x(void 0);
5006
5002
  }
5007
5003
  }
5008
5004
  ),
@@ -5070,7 +5066,7 @@ const Gt = (t, r, n, i) => {
5070
5066
  forceShowErrors: !1,
5071
5067
  existingPropertyKeys: [],
5072
5068
  allowDataInference: !0,
5073
- propertyConfigs: x,
5069
+ propertyConfigs: P,
5074
5070
  property: v?.property,
5075
5071
  propertyKey: v?.propertyKey
5076
5072
  }
@@ -5080,14 +5076,14 @@ const Gt = (t, r, n, i) => {
5080
5076
  ) });
5081
5077
  },
5082
5078
  be
5083
- ), xe = () => Qt(fr);
5084
- function sn({
5079
+ ), Pe = () => Qt(fr);
5080
+ function ln({
5085
5081
  path: t,
5086
5082
  parentCollectionIds: r,
5087
5083
  collection: n,
5088
5084
  tableController: i
5089
5085
  }) {
5090
- const l = _e(), o = Te(), d = xe(), c = o.getCollectionFromIds(r), u = d.configPermissions ? d.configPermissions({
5086
+ const l = _e(), o = Te(), d = Pe(), c = o.getCollectionFromIds(r), u = d.configPermissions ? d.configPermissions({
5091
5087
  user: l.user,
5092
5088
  collection: n
5093
5089
  }).editCollections : !0;
@@ -5108,11 +5104,11 @@ function sn({
5108
5104
  ) });
5109
5105
  }
5110
5106
  const gr = () => Qt(hr);
5111
- function dn({
5107
+ function sn({
5112
5108
  path: t,
5113
5109
  collection: r
5114
5110
  }) {
5115
- const n = Ie(), i = _e(), l = gr(), o = xe(), d = o.configPermissions({
5111
+ const n = Ie(), i = _e(), l = gr(), o = Pe(), d = o.configPermissions({
5116
5112
  user: i.user,
5117
5113
  collection: r
5118
5114
  }), c = J(() => {
@@ -5165,7 +5161,7 @@ function dn({
5165
5161
  )
5166
5162
  ] });
5167
5163
  }
5168
- function cn({
5164
+ function dn({
5169
5165
  propertyKey: t,
5170
5166
  onHover: r,
5171
5167
  property: n,
@@ -5173,7 +5169,7 @@ function cn({
5173
5169
  parentCollectionIds: l,
5174
5170
  collection: o
5175
5171
  }) {
5176
- const d = xe();
5172
+ const d = Pe();
5177
5173
  return /* @__PURE__ */ e(te, { title: "Edit", children: /* @__PURE__ */ e(
5178
5174
  ae,
5179
5175
  {
@@ -5192,12 +5188,12 @@ function cn({
5192
5188
  }
5193
5189
  ) });
5194
5190
  }
5195
- function un({
5191
+ function cn({
5196
5192
  fullPath: t,
5197
5193
  parentCollectionIds: r,
5198
5194
  collection: n
5199
5195
  }) {
5200
- const i = _e(), l = xe(), o = l.configPermissions ? l.configPermissions({
5196
+ const i = _e(), l = Pe(), o = l.configPermissions ? l.configPermissions({
5201
5197
  user: i.user,
5202
5198
  collection: n
5203
5199
  }).editCollections : !0;
@@ -5217,8 +5213,8 @@ function un({
5217
5213
  }
5218
5214
  ) });
5219
5215
  }
5220
- function pn() {
5221
- const t = xe();
5216
+ function un() {
5217
+ const t = Pe();
5222
5218
  return /* @__PURE__ */ e("div", { className: "bg-gray-50 dark:bg-gray-900 min-w-fit rounded", children: /* @__PURE__ */ a(
5223
5219
  z,
5224
5220
  {
@@ -5236,13 +5232,13 @@ function pn() {
5236
5232
  }
5237
5233
  ) });
5238
5234
  }
5239
- function mn({
5235
+ function pn({
5240
5236
  path: t,
5241
5237
  parentCollectionIds: r,
5242
5238
  collection: n,
5243
5239
  tableController: i
5244
5240
  }) {
5245
- const l = _e(), o = xe(), d = gr(), c = Ie(), u = o.configPermissions ? o.configPermissions({
5241
+ const l = _e(), o = Pe(), d = gr(), c = Ie(), u = o.configPermissions ? o.configPermissions({
5246
5242
  user: l.user,
5247
5243
  collection: n
5248
5244
  }).editCollections : !0;
@@ -5302,13 +5298,13 @@ function mn({
5302
5298
  function st(t) {
5303
5299
  return t && Object.keys(t).length === 0 ? t : t ?? null;
5304
5300
  }
5305
- function hn({
5301
+ function mn({
5306
5302
  group: t,
5307
5303
  context: r
5308
5304
  }) {
5309
5305
  if (!r.navigation.topLevelNavigation)
5310
5306
  throw Error("Navigation not ready in FireCMSHomePage");
5311
- const n = _e(), i = xe(), l = i.configPermissions ? i.configPermissions({
5307
+ const n = _e(), i = Pe(), l = i.configPermissions ? i.configPermissions({
5312
5308
  user: n.user
5313
5309
  }).createCollections : !0;
5314
5310
  return /* @__PURE__ */ e(
@@ -5343,7 +5339,7 @@ function hn({
5343
5339
  }
5344
5340
  );
5345
5341
  }
5346
- function In({
5342
+ function Vn({
5347
5343
  collectionConfigController: t,
5348
5344
  configPermissions: r,
5349
5345
  reservedGroups: n,
@@ -5358,7 +5354,7 @@ function In({
5358
5354
  key: "collection_editor",
5359
5355
  loading: t.loading,
5360
5356
  provider: {
5361
- Component: ln,
5357
+ Component: on,
5362
5358
  props: {
5363
5359
  collectionConfigController: t,
5364
5360
  configPermissions: r,
@@ -5372,38 +5368,38 @@ function In({
5372
5368
  }
5373
5369
  },
5374
5370
  homePage: {
5375
- additionalActions: /* @__PURE__ */ e(pn, {}),
5376
- additionalChildrenStart: /* @__PURE__ */ e(fn, {}),
5371
+ additionalActions: /* @__PURE__ */ e(un, {}),
5372
+ additionalChildrenStart: /* @__PURE__ */ e(hn, {}),
5377
5373
  // additionalChildrenEnd: <RootCollectionSuggestions introMode={introMode}/>,
5378
- CollectionActions: dn,
5379
- AdditionalCards: hn
5374
+ CollectionActions: sn,
5375
+ AdditionalCards: mn
5380
5376
  },
5381
5377
  collectionView: {
5382
- CollectionActionsStart: mn,
5383
- CollectionActions: sn,
5384
- HeaderAction: cn,
5385
- AddColumnComponent: un
5378
+ CollectionActionsStart: pn,
5379
+ CollectionActions: ln,
5380
+ HeaderAction: dn,
5381
+ AddColumnComponent: cn
5386
5382
  }
5387
5383
  };
5388
5384
  }
5389
- function fn({ introMode: t }) {
5390
- const r = Te();
5391
- if (!r.topLevelNavigation)
5385
+ function hn({}) {
5386
+ const t = Te();
5387
+ if (!t.topLevelNavigation)
5392
5388
  throw Error("Navigation not ready in FireCMSHomePage");
5393
- const n = _e(), i = xe(), l = i.configPermissions ? i.configPermissions({
5394
- user: n.user
5389
+ const r = _e(), n = Pe(), i = n.configPermissions ? n.configPermissions({
5390
+ user: r.user
5395
5391
  }).createCollections : !0;
5396
- return (r.collections ?? []).length > 0 ? null : /* @__PURE__ */ a(
5392
+ return !t.initialised || t.collections === void 0 || (t.collections ?? []).length > 0 ? null : /* @__PURE__ */ a(
5397
5393
  ge,
5398
5394
  {
5399
5395
  className: "my-4 px-4 py-6 flex flex-col bg-white dark:bg-slate-800 gap-2",
5400
5396
  children: [
5401
5397
  /* @__PURE__ */ e(V, { variant: "subtitle2", className: "uppercase", children: "No collections found" }),
5402
5398
  /* @__PURE__ */ e(V, { children: "Start building collections in FireCMS easily. Map them to your existing database data, import from files, or use our templates." }),
5403
- l && /* @__PURE__ */ a(
5399
+ i && /* @__PURE__ */ a(
5404
5400
  z,
5405
5401
  {
5406
- onClick: i && l ? () => i.createCollection({
5402
+ onClick: n && i ? () => n.createCollection({
5407
5403
  parentCollectionIds: [],
5408
5404
  redirect: !0,
5409
5405
  sourceClick: "new_collection_card"
@@ -5419,7 +5415,7 @@ function fn({ introMode: t }) {
5419
5415
  }
5420
5416
  );
5421
5417
  }
5422
- const _n = (t, r, n) => {
5418
+ const In = (t, r, n) => {
5423
5419
  const i = (d) => {
5424
5420
  He(d.properties), d.subcollections?.forEach(i);
5425
5421
  }, l = r ?? [];
@@ -5427,8 +5423,8 @@ const _n = (t, r, n) => {
5427
5423
  const o = _r(t, l, [], n);
5428
5424
  return console.debug("Collections after joining:", o), o;
5429
5425
  };
5430
- function Fn({ path: t }) {
5431
- const r = Te(), n = gn(t), i = r.getParentCollectionIds(t), l = xe();
5426
+ function _n({ path: t }) {
5427
+ const r = Te(), n = fn(t), i = r.getParentCollectionIds(t), l = Pe();
5432
5428
  return /* @__PURE__ */ a("div", { className: "p-1 flex flex-col items-center", children: [
5433
5429
  /* @__PURE__ */ e(Zt, { error: "No collection for path: " + n }),
5434
5430
  /* @__PURE__ */ e(
@@ -5450,22 +5446,22 @@ function Fn({ path: t }) {
5450
5446
  )
5451
5447
  ] });
5452
5448
  }
5453
- function gn(t) {
5449
+ function fn(t) {
5454
5450
  const r = t.split("/");
5455
5451
  return r[r.length - 1];
5456
5452
  }
5457
5453
  export {
5458
- Fn as MissingReferenceWidget,
5454
+ _n as MissingReferenceWidget,
5459
5455
  qe as editableProperty,
5460
5456
  ne as getFullId,
5461
5457
  nr as getFullIdPath,
5462
5458
  he as idToPropertiesPath,
5463
- _n as mergeCollections,
5459
+ In as mergeCollections,
5464
5460
  Ce as namespaceToPropertiesOrderPath,
5465
- Ci as namespaceToPropertiesPath,
5466
- Ti as removeNonEditableProperties,
5467
- xe as useCollectionEditorController,
5468
- In as useCollectionEditorPlugin,
5461
+ bi as namespaceToPropertiesPath,
5462
+ wi as removeNonEditableProperties,
5463
+ Pe as useCollectionEditorController,
5464
+ Vn as useCollectionEditorPlugin,
5469
5465
  gr as useCollectionsConfigController
5470
5466
  };
5471
5467
  //# sourceMappingURL=index.es.js.map