@firecms/collection_editor 3.0.0-canary.43 → 3.0.0-canary.44
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 +203 -197
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +2 -1
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +9 -3
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
|
|
2
|
+
import { FieldCaption as X, SearchIconsView as yr, toSnakeCase as xt, singular as br, IconForView as dt, ArrayContainer as Cr, serializeRegExp as Nr, useSnackbarController as Ie, resolveEnumValues as xr, 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 wr, makePropertiesEditable as He, resolveEntityView as Tr, useSelectionController as kr, CircularProgressCenter as ut, EntityCollectionTable as Or, slugify as Vr, useAuthController as _e, randomString as Ft, removeUndefined as Et, ErrorView as Zt, removeInitialAndTrailingSlashes as Ir, getDefaultPropertiesOrder as _r, joinCollectionLists as Fr } from "@firecms/core";
|
|
3
3
|
import * as Ue from "react";
|
|
4
|
-
import Y, { useState as j, useEffect as ue, useMemo as Jt, useCallback as J, useRef as je, useDeferredValue as
|
|
4
|
+
import Y, { useState as j, useEffect as ue, useMemo as Jt, useCallback as J, useRef as je, useDeferredValue as Er, useContext as Qt } from "react";
|
|
5
5
|
import be from "react-fast-compare";
|
|
6
|
-
import { useAutoComplete as
|
|
6
|
+
import { useAutoComplete as Sr, 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 Ar, AutocompleteItem as Dr, ExpandablePanel as Tt, SettingsIcon as Ye, Select as Ne, SelectItem as ee, BooleanSwitchWithLabel as pt, Dialog as Fe, AutoAwesomeIcon as ft, Badge as Br, ListIcon as Mr, Button as z, CircularProgress as Ge, Paper as ge, DialogContent as De, DialogActions as Be, RuleIcon as zr, FileUploadIcon as Rr, MultiSelect as Ur, MultiSelectItem as St, Checkbox as At, cardMixin as Xt, cardClickableMixin as er, cardSelectedMixin as tr, FunctionsIcon as jr, RemoveCircleIcon as qr, defaultBorderMixin as kt, RemoveIcon as Lr, DragHandleIcon as $r, AddIcon as ce, SelectGroup as Dt, InfoLabel as Hr, DeleteIcon as mt, ContentCopyIcon as Yr, CodeIcon as Gr, Table as Bt, TableBody as Mt, TableRow as Ct, TableCell as Re, Alert as Kr, Icon as it, Card as rr, coolIconKeys as zt, Tabs as Wr, Tab as Nt, ArrowBackIcon as nt, LoadingButton as Rt, DoneIcon as Zr, Menu as Jr, MoreVertIcon as Qr, MenuItem as Xr, SaveIcon as ei, UndoIcon as ti } 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
|
-
import { extractEnumFromValues as
|
|
10
|
-
import { DragDropContext as
|
|
11
|
-
import
|
|
12
|
-
import { Highlight as
|
|
13
|
-
import { ImportFileUpload as
|
|
14
|
-
import { useNavigate as
|
|
15
|
-
const
|
|
9
|
+
import { extractEnumFromValues as ri, buildPropertyFromData as ii, buildEntityPropertiesFromData as ni } from "@firecms/schema_inference";
|
|
10
|
+
import { DragDropContext as ai, Droppable as oi, Draggable as li } from "@hello-pangea/dnd";
|
|
11
|
+
import si from "json5";
|
|
12
|
+
import { Highlight as di, themes as ci } from "prism-react-renderer";
|
|
13
|
+
import { ImportFileUpload as ui, DataNewPropertiesMapping as pi, ImportNewPropertyFieldPreview as mi, getInferenceType as ir, 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({
|
|
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
|
|
20
|
+
function bi({
|
|
21
21
|
isNewCollection: t,
|
|
22
22
|
reservedGroups: r,
|
|
23
23
|
existingPaths: n,
|
|
@@ -34,17 +34,17 @@ function yi({
|
|
|
34
34
|
setFieldTouched: f,
|
|
35
35
|
isSubmitting: g,
|
|
36
36
|
submitCount: P
|
|
37
|
-
} = G(), [y, x] = j(!1), [v, b] = j(!1),
|
|
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",
|
|
37
|
+
} = G(), [y, x] = j(!1), [v, b] = j(!1), T = (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", br(h));
|
|
39
39
|
};
|
|
40
40
|
ue(() => {
|
|
41
41
|
s.id && b(!0);
|
|
42
42
|
}, [s.id]);
|
|
43
|
-
const
|
|
43
|
+
const w = /* @__PURE__ */ e(dt, { collectionOrView: c }), C = l?.filter((h) => !r?.includes(h)), {
|
|
44
44
|
inputFocused: O,
|
|
45
45
|
autoCompleteOpen: N,
|
|
46
46
|
setAutoCompleteOpen: F
|
|
47
|
-
} =
|
|
47
|
+
} = Sr({
|
|
48
48
|
ref: d
|
|
49
49
|
}), D = !!o;
|
|
50
50
|
let _;
|
|
@@ -63,7 +63,7 @@ function yi({
|
|
|
63
63
|
{
|
|
64
64
|
shape: "square",
|
|
65
65
|
onClick: () => x(!0),
|
|
66
|
-
children:
|
|
66
|
+
children: w
|
|
67
67
|
}
|
|
68
68
|
) })
|
|
69
69
|
]
|
|
@@ -80,7 +80,7 @@ function yi({
|
|
|
80
80
|
Oe,
|
|
81
81
|
{
|
|
82
82
|
value: c.name ?? "",
|
|
83
|
-
onChange: (h) =>
|
|
83
|
+
onChange: (h) => T(h.target.value),
|
|
84
84
|
label: "Name",
|
|
85
85
|
required: !0,
|
|
86
86
|
error: S && !!s.name
|
|
@@ -117,12 +117,12 @@ function yi({
|
|
|
117
117
|
}
|
|
118
118
|
),
|
|
119
119
|
/* @__PURE__ */ e(
|
|
120
|
-
|
|
120
|
+
Ar,
|
|
121
121
|
{
|
|
122
122
|
open: N && (C ?? []).length > 0,
|
|
123
123
|
setOpen: F,
|
|
124
124
|
children: C?.map((h, B) => /* @__PURE__ */ e(
|
|
125
|
-
|
|
125
|
+
Dr,
|
|
126
126
|
{
|
|
127
127
|
onClick: () => {
|
|
128
128
|
F(!1), u("group", h ?? null);
|
|
@@ -219,7 +219,7 @@ function yi({
|
|
|
219
219
|
Ne,
|
|
220
220
|
{
|
|
221
221
|
name: "customId",
|
|
222
|
-
label: "
|
|
222
|
+
label: "Document IDs generation",
|
|
223
223
|
position: "item-aligned",
|
|
224
224
|
disabled: _ === "code_defined",
|
|
225
225
|
onValueChange: (h) => {
|
|
@@ -273,7 +273,7 @@ function yi({
|
|
|
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(
|
|
276
|
-
|
|
276
|
+
yr,
|
|
277
277
|
{
|
|
278
278
|
selectedIcon: c.icon,
|
|
279
279
|
onIconSelected: (h) => {
|
|
@@ -288,7 +288,7 @@ function yi({
|
|
|
288
288
|
function he(t) {
|
|
289
289
|
return "properties." + t.replaceAll(".", ".properties.");
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function nr(t) {
|
|
292
292
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
|
|
293
293
|
}
|
|
294
294
|
function Ce(t) {
|
|
@@ -297,7 +297,7 @@ function Ce(t) {
|
|
|
297
297
|
function ne(t, r) {
|
|
298
298
|
return r ? `${r}.${t}` : t;
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function ar(t, r) {
|
|
301
301
|
const n = r ? `${r}.${t}` : t;
|
|
302
302
|
return he(n);
|
|
303
303
|
}
|
|
@@ -348,26 +348,26 @@ function Ni({
|
|
|
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, x = (b,
|
|
352
|
-
const
|
|
351
|
+
} = G(), [u, m] = Y.useState(), [p, s] = Y.useState(), [f, g] = Y.useState(!1), y = Y.useRef(/* @__PURE__ */ new Set()).current, x = (b, T) => {
|
|
352
|
+
const w = u === T, C = r?.enumValues && r?.enumValues[b];
|
|
353
353
|
return /* @__PURE__ */ e(
|
|
354
354
|
xi,
|
|
355
355
|
{
|
|
356
356
|
index: b,
|
|
357
357
|
disabled: n,
|
|
358
358
|
enumValuesPath: i,
|
|
359
|
-
autoFocus:
|
|
359
|
+
autoFocus: w,
|
|
360
360
|
entryError: C,
|
|
361
|
-
shouldUpdateId: l ||
|
|
361
|
+
shouldUpdateId: l || w,
|
|
362
362
|
onDialogOpen: () => s(b),
|
|
363
363
|
inferredEntry: y.has(t.enumValues[b]?.id)
|
|
364
364
|
},
|
|
365
|
-
`${
|
|
365
|
+
`${T}`
|
|
366
366
|
);
|
|
367
367
|
};
|
|
368
368
|
return /* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
369
369
|
/* @__PURE__ */ a("div", { className: "ml-3.5 flex flex-row items-center", children: [
|
|
370
|
-
/* @__PURE__ */ e(
|
|
370
|
+
/* @__PURE__ */ e(Mr, {}),
|
|
371
371
|
/* @__PURE__ */ e(
|
|
372
372
|
V,
|
|
373
373
|
{
|
|
@@ -387,7 +387,7 @@ function Ni({
|
|
|
387
387
|
d && (g(!0), d?.().then((b) => {
|
|
388
388
|
if (!b)
|
|
389
389
|
return;
|
|
390
|
-
const
|
|
390
|
+
const T = b.flat(), w = Array.from(new Set(T)), C = t.enumValues, N = ri(w).filter((F) => !C?.some((D) => D.id === F.id));
|
|
391
391
|
N.forEach((F) => {
|
|
392
392
|
y.add(F.id);
|
|
393
393
|
}), c(i, [...N, ...C], !0);
|
|
@@ -404,7 +404,7 @@ function Ni({
|
|
|
404
404
|
] }),
|
|
405
405
|
/* @__PURE__ */ a(ge, { className: "p-4 m-1", children: [
|
|
406
406
|
/* @__PURE__ */ e(
|
|
407
|
-
|
|
407
|
+
Cr,
|
|
408
408
|
{
|
|
409
409
|
droppableId: i,
|
|
410
410
|
addLabel: "Add enum value",
|
|
@@ -467,7 +467,7 @@ const xi = Y.memo(
|
|
|
467
467
|
error: !!u?.label
|
|
468
468
|
}
|
|
469
469
|
),
|
|
470
|
-
!d && /* @__PURE__ */ e(
|
|
470
|
+
!d && /* @__PURE__ */ e(Br, { color: "error", invisible: !u?.id, children: /* @__PURE__ */ e(
|
|
471
471
|
ae,
|
|
472
472
|
{
|
|
473
473
|
size: "small",
|
|
@@ -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", P = "validation.max", y = "validation.trim", x = "validation.matches", v = "validation.lowercase", b = "validation.uppercase",
|
|
643
|
+
} = G(), f = "validation.length", g = "validation.min", P = "validation.max", y = "validation.trim", x = "validation.matches", v = "validation.lowercase", b = "validation.uppercase", T = I(s, x), w = I(m, x), C = typeof w == "string" ? w : Nr(w);
|
|
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: [
|
|
@@ -741,10 +741,10 @@ function Se({
|
|
|
741
741
|
size: "small",
|
|
742
742
|
disabled: c,
|
|
743
743
|
value: C,
|
|
744
|
-
error: !!
|
|
744
|
+
error: !!T
|
|
745
745
|
}
|
|
746
746
|
),
|
|
747
|
-
/* @__PURE__ */ e(X, { error: !!
|
|
747
|
+
/* @__PURE__ */ e(X, { error: !!T, children: T ? "Not a valid regexp" : "e.g. /^\\d+$/ for digits only" })
|
|
748
748
|
] })
|
|
749
749
|
] });
|
|
750
750
|
}
|
|
@@ -795,7 +795,7 @@ function xe({
|
|
|
795
795
|
asField: !0,
|
|
796
796
|
className: "p-4",
|
|
797
797
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
798
|
-
/* @__PURE__ */ e(
|
|
798
|
+
/* @__PURE__ */ e(zr, {}),
|
|
799
799
|
/* @__PURE__ */ e(
|
|
800
800
|
V,
|
|
801
801
|
{
|
|
@@ -821,7 +821,7 @@ function Ut({
|
|
|
821
821
|
values: d,
|
|
822
822
|
setFieldError: c,
|
|
823
823
|
setFieldValue: u
|
|
824
|
-
} = G(), m = Ie(), p = t ? "of.enumValues" : "enumValues", s = I(d, "defaultValue"), f = I(d, p), g = Jt(() => !f || typeof f == "boolean" ? [] :
|
|
824
|
+
} = G(), m = Ie(), p = t ? "of.enumValues" : "enumValues", s = I(d, "defaultValue"), f = I(d, p), g = Jt(() => !f || typeof f == "boolean" ? [] : xr(f) ?? [], [f]);
|
|
825
825
|
return /* @__PURE__ */ a(R, { children: [
|
|
826
826
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
827
827
|
Ci,
|
|
@@ -893,14 +893,14 @@ function jt({
|
|
|
893
893
|
values: i,
|
|
894
894
|
setFieldValue: l
|
|
895
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((
|
|
896
|
+
b ? b.includes("all") || b.length >= Object.keys(ot).length ? l(d, void 0) : P ? l(d, Object.keys(ot).filter((T) => !b.includes(T))) : l(d, b) : l(d, void 0);
|
|
897
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,
|
|
901
901
|
{
|
|
902
902
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
903
|
-
/* @__PURE__ */ e(
|
|
903
|
+
/* @__PURE__ */ e(Rr, {}),
|
|
904
904
|
/* @__PURE__ */ e(
|
|
905
905
|
V,
|
|
906
906
|
{
|
|
@@ -912,14 +912,14 @@ function jt({
|
|
|
912
912
|
] }),
|
|
913
913
|
children: /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 p-4", children: [
|
|
914
914
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
915
|
-
|
|
915
|
+
Ur,
|
|
916
916
|
{
|
|
917
917
|
disabled: n,
|
|
918
918
|
name: d,
|
|
919
919
|
value: g ?? [],
|
|
920
920
|
onMultiValueChange: y,
|
|
921
921
|
label: P ? void 0 : "Allowed file types",
|
|
922
|
-
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((
|
|
922
|
+
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((T) => ot[T]).filter((T) => !!T).join(", "),
|
|
923
923
|
children: [
|
|
924
924
|
/* @__PURE__ */ a(St, { value: "all", className: "flex items-center gap-2", children: [
|
|
925
925
|
/* @__PURE__ */ e(
|
|
@@ -930,20 +930,20 @@ function jt({
|
|
|
930
930
|
),
|
|
931
931
|
"All"
|
|
932
932
|
] }, "all"),
|
|
933
|
-
Object.entries(ot).map(([b,
|
|
933
|
+
Object.entries(ot).map(([b, T]) => /* @__PURE__ */ a(St, { value: b, className: "flex items-center gap-2", children: [
|
|
934
934
|
/* @__PURE__ */ e(
|
|
935
935
|
At,
|
|
936
936
|
{
|
|
937
937
|
checked: P || g.indexOf(b) > -1
|
|
938
938
|
}
|
|
939
939
|
),
|
|
940
|
-
/* @__PURE__ */ e("div", { className: "flex-grow", children:
|
|
940
|
+
/* @__PURE__ */ e("div", { className: "flex-grow", children: T }),
|
|
941
941
|
/* @__PURE__ */ e(
|
|
942
942
|
z,
|
|
943
943
|
{
|
|
944
944
|
size: "small",
|
|
945
945
|
variant: "outlined",
|
|
946
|
-
onClick: (
|
|
946
|
+
onClick: (w) => (w.preventDefault(), w.stopPropagation(), l(d, [b])),
|
|
947
947
|
children: "Only"
|
|
948
948
|
}
|
|
949
949
|
)
|
|
@@ -991,12 +991,12 @@ function jt({
|
|
|
991
991
|
{
|
|
992
992
|
name: m,
|
|
993
993
|
type: "checkbox",
|
|
994
|
-
children: ({ field: b, form:
|
|
994
|
+
children: ({ field: b, form: T }) => /* @__PURE__ */ e(
|
|
995
995
|
le,
|
|
996
996
|
{
|
|
997
997
|
label: "Save URL instead of storage path",
|
|
998
998
|
disabled: r || n,
|
|
999
|
-
form:
|
|
999
|
+
form: T,
|
|
1000
1000
|
field: b
|
|
1001
1001
|
}
|
|
1002
1002
|
)
|
|
@@ -1033,7 +1033,7 @@ function wi(t) {
|
|
|
1033
1033
|
} : { [r]: i };
|
|
1034
1034
|
}).filter((r) => !!r).reduce((r, n) => ({ ...r, ...n }), {});
|
|
1035
1035
|
}
|
|
1036
|
-
function
|
|
1036
|
+
function or({
|
|
1037
1037
|
property: t,
|
|
1038
1038
|
onClick: r,
|
|
1039
1039
|
hasError: n,
|
|
@@ -1123,10 +1123,10 @@ function Ti({
|
|
|
1123
1123
|
"div",
|
|
1124
1124
|
{
|
|
1125
1125
|
className: "h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500",
|
|
1126
|
-
children: /* @__PURE__ */ e(
|
|
1126
|
+
children: /* @__PURE__ */ e(jr, { color: "inherit", size: "medium" })
|
|
1127
1127
|
}
|
|
1128
1128
|
),
|
|
1129
|
-
/* @__PURE__ */ e(
|
|
1129
|
+
/* @__PURE__ */ e(qr, { color: "disabled", size: "small", className: "absolute -right-2 -top-2" })
|
|
1130
1130
|
] }),
|
|
1131
1131
|
/* @__PURE__ */ e(
|
|
1132
1132
|
ge,
|
|
@@ -1213,10 +1213,10 @@ const gt = Y.memo(
|
|
|
1213
1213
|
const g = o ?? Object.keys(l), P = J((y) => {
|
|
1214
1214
|
if (!y.destination)
|
|
1215
1215
|
return;
|
|
1216
|
-
const x = y.source.index, v = y.destination.index, b = Array.from(g), [
|
|
1217
|
-
b.splice(v, 0,
|
|
1216
|
+
const x = y.source.index, v = y.destination.index, b = Array.from(g), [T] = b.splice(x, 1);
|
|
1217
|
+
b.splice(v, 0, T), u && u(b, r);
|
|
1218
1218
|
}, [r, u, g]);
|
|
1219
|
-
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
|
|
1219
|
+
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(ai, { onDragEnd: P, children: /* @__PURE__ */ e(oi, { droppableId: `droppable_${r}`, children: (y, x) => /* @__PURE__ */ a(
|
|
1220
1220
|
"div",
|
|
1221
1221
|
{
|
|
1222
1222
|
...y.droppableProps,
|
|
@@ -1224,9 +1224,9 @@ const gt = Y.memo(
|
|
|
1224
1224
|
className: p,
|
|
1225
1225
|
children: [
|
|
1226
1226
|
g && g.map((v, b) => {
|
|
1227
|
-
const
|
|
1228
|
-
return !
|
|
1229
|
-
|
|
1227
|
+
const T = l[v], w = d?.find((C) => C.key === v);
|
|
1228
|
+
return !T && !w ? (console.warn(`Property ${v} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
1229
|
+
li,
|
|
1230
1230
|
{
|
|
1231
1231
|
draggableId: `array_field_${r}_${v}}`,
|
|
1232
1232
|
index: b,
|
|
@@ -1234,8 +1234,8 @@ const gt = Y.memo(
|
|
|
1234
1234
|
ki,
|
|
1235
1235
|
{
|
|
1236
1236
|
propertyKey: v,
|
|
1237
|
-
propertyOrBuilder:
|
|
1238
|
-
additionalField:
|
|
1237
|
+
propertyOrBuilder: T,
|
|
1238
|
+
additionalField: w,
|
|
1239
1239
|
provided: C,
|
|
1240
1240
|
errors: c,
|
|
1241
1241
|
namespace: r,
|
|
@@ -1277,17 +1277,17 @@ function ki({
|
|
|
1277
1277
|
inferredPropertyKeys: p,
|
|
1278
1278
|
collectionEditable: s
|
|
1279
1279
|
}) {
|
|
1280
|
-
const f = p?.includes(r ? `${r}.${t}` : t), g = ne(t, r), y =
|
|
1280
|
+
const f = p?.includes(r ? `${r}.${t}` : t), g = ne(t, r), y = ar(t, r) in d;
|
|
1281
1281
|
let x;
|
|
1282
1282
|
if (typeof n == "object") {
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1283
|
+
const T = n;
|
|
1284
|
+
T.dataType === "map" && T.properties && (x = /* @__PURE__ */ e(
|
|
1285
1285
|
gt,
|
|
1286
1286
|
{
|
|
1287
1287
|
selectedPropertyKey: o,
|
|
1288
1288
|
namespace: g,
|
|
1289
|
-
properties:
|
|
1290
|
-
propertiesOrder:
|
|
1289
|
+
properties: T.properties,
|
|
1290
|
+
propertiesOrder: T.propertiesOrder,
|
|
1291
1291
|
errors: d,
|
|
1292
1292
|
onPropertyClick: c,
|
|
1293
1293
|
onPropertyMove: u,
|
|
@@ -1317,7 +1317,7 @@ function ki({
|
|
|
1317
1317
|
}
|
|
1318
1318
|
),
|
|
1319
1319
|
!ie(n) && !i && b ? /* @__PURE__ */ e(
|
|
1320
|
-
|
|
1320
|
+
or,
|
|
1321
1321
|
{
|
|
1322
1322
|
property: n,
|
|
1323
1323
|
onClick: c ? () => c(t, r) : void 0,
|
|
@@ -1342,7 +1342,7 @@ function ki({
|
|
|
1342
1342
|
size: "small",
|
|
1343
1343
|
color: "inherit",
|
|
1344
1344
|
onClick: () => m(t, r),
|
|
1345
|
-
children: /* @__PURE__ */ e(
|
|
1345
|
+
children: /* @__PURE__ */ e(Lr, { size: "small" })
|
|
1346
1346
|
}
|
|
1347
1347
|
) }),
|
|
1348
1348
|
u && /* @__PURE__ */ e(te, { title: "Move", children: /* @__PURE__ */ e(
|
|
@@ -1350,7 +1350,7 @@ function ki({
|
|
|
1350
1350
|
{
|
|
1351
1351
|
component: "span",
|
|
1352
1352
|
size: "small",
|
|
1353
|
-
children: /* @__PURE__ */ e(
|
|
1353
|
+
children: /* @__PURE__ */ e($r, { size: "small" })
|
|
1354
1354
|
}
|
|
1355
1355
|
) })
|
|
1356
1356
|
] }),
|
|
@@ -1364,25 +1364,25 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1364
1364
|
values: o,
|
|
1365
1365
|
setFieldValue: d
|
|
1366
1366
|
} = G(), [c, u] = j(!1), [m, p] = j(), [s, f] = j(), g = o.propertiesOrder ?? Object.keys(o.properties ?? {}), P = ({
|
|
1367
|
-
id:
|
|
1367
|
+
id: w,
|
|
1368
1368
|
property: C
|
|
1369
1369
|
}) => {
|
|
1370
|
-
if (!
|
|
1370
|
+
if (!w)
|
|
1371
1371
|
throw Error();
|
|
1372
1372
|
d("properties", {
|
|
1373
1373
|
...o.properties ?? {},
|
|
1374
|
-
[
|
|
1374
|
+
[w]: C
|
|
1375
1375
|
}, !1);
|
|
1376
|
-
const O = o.propertiesOrder ?? Object.keys(o.properties ?? {}), N = O.includes(
|
|
1376
|
+
const O = o.propertiesOrder ?? Object.keys(o.properties ?? {}), N = O.includes(w) ? O : [...O, w];
|
|
1377
1377
|
d("propertiesOrder", N, !1), u(!1);
|
|
1378
|
-
}, y = J((
|
|
1379
|
-
const O =
|
|
1378
|
+
}, y = J((w, C) => {
|
|
1379
|
+
const O = w ? ne(w, 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,
|
|
1383
|
-
d(N, void 0, !1), d(F, D.filter((_) => _ !==
|
|
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,
|
|
1385
|
-
d(Ce(C),
|
|
1382
|
+
const N = he(O), F = Ce(C), D = I(o, F) ?? Object.keys(I(o, nr(C)));
|
|
1383
|
+
d(N, void 0, !1), d(F, D.filter((_) => _ !== w), !1), u(!1), p(void 0), f(void 0);
|
|
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, T = J((w, C) => {
|
|
1385
|
+
d(Ce(C), w, !1);
|
|
1386
1386
|
}, []);
|
|
1387
1387
|
return /* @__PURE__ */ a(R, { children: [
|
|
1388
1388
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -1410,10 +1410,10 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1410
1410
|
propertiesOrder: g,
|
|
1411
1411
|
errors: {},
|
|
1412
1412
|
collectionEditable: l,
|
|
1413
|
-
onPropertyClick: (
|
|
1414
|
-
p(
|
|
1413
|
+
onPropertyClick: (w, C) => {
|
|
1414
|
+
p(w), f(C), u(!0);
|
|
1415
1415
|
},
|
|
1416
|
-
onPropertyMove:
|
|
1416
|
+
onPropertyMove: T
|
|
1417
1417
|
}
|
|
1418
1418
|
),
|
|
1419
1419
|
b && /* @__PURE__ */ e(
|
|
@@ -1433,7 +1433,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1433
1433
|
position: "start",
|
|
1434
1434
|
size: "small",
|
|
1435
1435
|
label: "Spread children as columns",
|
|
1436
|
-
onValueChange: (
|
|
1436
|
+
onValueChange: (w) => d("spreadChildren", w),
|
|
1437
1437
|
value: o.spreadChildren ?? !1
|
|
1438
1438
|
}
|
|
1439
1439
|
),
|
|
@@ -1483,8 +1483,8 @@ function Vi({
|
|
|
1483
1483
|
errors: m,
|
|
1484
1484
|
setFieldValue: p,
|
|
1485
1485
|
touched: s
|
|
1486
|
-
} = G(), [f, g] = j(!1), P = I(c, "of"), y = I(s, "of") && I(m, "of"), x = ({ id: b, property:
|
|
1487
|
-
console.log("onPropertyChanged", b,
|
|
1486
|
+
} = G(), [f, g] = j(!1), P = I(c, "of"), y = I(s, "of") && I(m, "of"), x = ({ id: b, property: T, namespace: w }) => {
|
|
1487
|
+
console.log("onPropertyChanged", b, T, w), p("of", T);
|
|
1488
1488
|
}, v = P && Le(P, o);
|
|
1489
1489
|
return /* @__PURE__ */ a(R, { children: [
|
|
1490
1490
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -1496,7 +1496,7 @@ function Vi({
|
|
|
1496
1496
|
value: P,
|
|
1497
1497
|
children: ({}) => /* @__PURE__ */ a(ge, { className: "p-2 mt-4", children: [
|
|
1498
1498
|
P && /* @__PURE__ */ e(
|
|
1499
|
-
|
|
1499
|
+
or,
|
|
1500
1500
|
{
|
|
1501
1501
|
property: P,
|
|
1502
1502
|
onClick: n ? void 0 : () => g(!0),
|
|
@@ -1570,9 +1570,9 @@ const Ii = Y.forwardRef(
|
|
|
1570
1570
|
inputRef: d,
|
|
1571
1571
|
as: W,
|
|
1572
1572
|
value: u[g],
|
|
1573
|
-
onChange: (
|
|
1574
|
-
const
|
|
1575
|
-
!I(s, y) && l && m(y,
|
|
1573
|
+
onChange: (T) => {
|
|
1574
|
+
const w = T.target.value;
|
|
1575
|
+
!I(s, y) && l && m(y, w ? xt(w) : "", !1), m(g, w, !0), p(g, !0);
|
|
1576
1576
|
},
|
|
1577
1577
|
style: { fontSize: 20 },
|
|
1578
1578
|
placeholder: "Field name",
|
|
@@ -1591,9 +1591,9 @@ const Ii = Y.forwardRef(
|
|
|
1591
1591
|
as: W,
|
|
1592
1592
|
label: "ID",
|
|
1593
1593
|
value: u[y],
|
|
1594
|
-
onChange: (
|
|
1595
|
-
const
|
|
1596
|
-
!I(s, g) && l && m(g,
|
|
1594
|
+
onChange: (T) => {
|
|
1595
|
+
const w = T.target.value;
|
|
1596
|
+
!I(s, g) && l && m(g, w ? wt(w) : ""), m(y, w, !0), p(y, !0);
|
|
1597
1597
|
},
|
|
1598
1598
|
disabled: n || i,
|
|
1599
1599
|
required: !0,
|
|
@@ -1714,29 +1714,35 @@ function Fi({ disabled: t }) {
|
|
|
1714
1714
|
) })
|
|
1715
1715
|
] });
|
|
1716
1716
|
}
|
|
1717
|
-
function Ei({
|
|
1717
|
+
function Ei({
|
|
1718
|
+
disabled: t,
|
|
1719
|
+
getData: r,
|
|
1720
|
+
allowDataInference: n,
|
|
1721
|
+
propertyConfigs: i,
|
|
1722
|
+
collectionEditable: l
|
|
1723
|
+
}) {
|
|
1718
1724
|
const {
|
|
1719
1725
|
values: o,
|
|
1720
1726
|
setFieldValue: d
|
|
1721
1727
|
} = G(), [c, u] = j(!1), [m, p] = j(), [s, f] = j(), g = ({
|
|
1722
|
-
id:
|
|
1723
|
-
property:
|
|
1728
|
+
id: T,
|
|
1729
|
+
property: w
|
|
1724
1730
|
}) => {
|
|
1725
|
-
if (!
|
|
1731
|
+
if (!T)
|
|
1726
1732
|
throw Error();
|
|
1727
1733
|
d("oneOf.properties", {
|
|
1728
1734
|
...o.oneOf?.properties ?? {},
|
|
1729
|
-
[
|
|
1735
|
+
[T]: w
|
|
1730
1736
|
}, !1);
|
|
1731
|
-
const C = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), O = C.includes(
|
|
1737
|
+
const C = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), O = C.includes(T) ? C : [...C, T];
|
|
1732
1738
|
d("oneOf.propertiesOrder", O, !1), u(!1);
|
|
1733
|
-
}, P = m ? ne(m, s) : void 0, y = P ? I(o.oneOf?.properties, P.replaceAll(".", ".properties.")) : void 0, x = J((
|
|
1734
|
-
const C =
|
|
1739
|
+
}, P = m ? ne(m, s) : void 0, y = P ? I(o.oneOf?.properties, P.replaceAll(".", ".properties.")) : void 0, x = J((T, w) => {
|
|
1740
|
+
const C = T ? ne(T, w) : void 0;
|
|
1735
1741
|
if (!C)
|
|
1736
1742
|
throw Error("collection editor miss config");
|
|
1737
1743
|
d(`oneOf.${he(C)}`, void 0, !1);
|
|
1738
|
-
const O = `oneOf.${Ce(
|
|
1739
|
-
d(O, N.filter((F) => F !==
|
|
1744
|
+
const O = `oneOf.${Ce(w)}`, N = I(o, O) ?? Object.keys(I(o, nr(w)));
|
|
1745
|
+
d(O, N.filter((F) => F !== T), !1), u(!1), p(void 0), f(void 0);
|
|
1740
1746
|
}, [d, o]), v = /* @__PURE__ */ a(
|
|
1741
1747
|
z,
|
|
1742
1748
|
{
|
|
@@ -1749,8 +1755,8 @@ function Ei({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1749
1755
|
o.name ?? "this block"
|
|
1750
1756
|
]
|
|
1751
1757
|
}
|
|
1752
|
-
), b = J((
|
|
1753
|
-
d(`oneOf.${Ce(
|
|
1758
|
+
), b = J((T, w) => {
|
|
1759
|
+
d(`oneOf.${Ce(w)}`, T, !1);
|
|
1754
1760
|
}, []);
|
|
1755
1761
|
return /* @__PURE__ */ a(R, { children: [
|
|
1756
1762
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -1766,8 +1772,8 @@ function Ei({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1766
1772
|
propertiesOrder: o.oneOf?.propertiesOrder,
|
|
1767
1773
|
errors: {},
|
|
1768
1774
|
collectionEditable: l,
|
|
1769
|
-
onPropertyClick: t ? void 0 : (
|
|
1770
|
-
p(
|
|
1775
|
+
onPropertyClick: t ? void 0 : (T, w) => {
|
|
1776
|
+
p(T), f(w), u(!0);
|
|
1771
1777
|
},
|
|
1772
1778
|
onPropertyMove: t ? void 0 : b
|
|
1773
1779
|
}
|
|
@@ -2146,7 +2152,7 @@ function Mi({ disabled: t }) {
|
|
|
2146
2152
|
function zi({ disabled: t }) {
|
|
2147
2153
|
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) }) });
|
|
2148
2154
|
}
|
|
2149
|
-
function
|
|
2155
|
+
function lr(t, r, n) {
|
|
2150
2156
|
let i;
|
|
2151
2157
|
return r === "text_field" ? i = K(
|
|
2152
2158
|
t,
|
|
@@ -2358,7 +2364,7 @@ function or(t, r, n) {
|
|
|
2358
2364
|
propertyConfig: r
|
|
2359
2365
|
}), i;
|
|
2360
2366
|
}
|
|
2361
|
-
function
|
|
2367
|
+
function sr({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
2362
2368
|
return /* @__PURE__ */ e(
|
|
2363
2369
|
ee,
|
|
2364
2370
|
{
|
|
@@ -2473,7 +2479,7 @@ const Ui = [
|
|
|
2473
2479
|
"key_value",
|
|
2474
2480
|
"repeat",
|
|
2475
2481
|
"block"
|
|
2476
|
-
],
|
|
2482
|
+
], dr = Object.entries(Kt).filter(([t]) => Ui.includes(t)).map(([t, r]) => ({ [t]: r })).reduce((t, r) => ({ ...t, ...r }), {}), cr = Y.memo(
|
|
2477
2483
|
function(r) {
|
|
2478
2484
|
const {
|
|
2479
2485
|
includeIdAndName: n = !0,
|
|
@@ -2493,8 +2499,8 @@ const Ui = [
|
|
|
2493
2499
|
forceShowErrors: x,
|
|
2494
2500
|
allowDataInference: v,
|
|
2495
2501
|
getController: b,
|
|
2496
|
-
getData:
|
|
2497
|
-
propertyConfigs:
|
|
2502
|
+
getData: T,
|
|
2503
|
+
propertyConfigs: w,
|
|
2498
2504
|
collectionEditable: C
|
|
2499
2505
|
} = r, O = {
|
|
2500
2506
|
id: "",
|
|
@@ -2546,7 +2552,7 @@ const Ui = [
|
|
|
2546
2552
|
B && (h.id = B);
|
|
2547
2553
|
}
|
|
2548
2554
|
}
|
|
2549
|
-
return S.dataType === "string" && S.validation?.matches && !
|
|
2555
|
+
return S.dataType === "string" && S.validation?.matches && !Pr(S.validation?.matches.toString()) && (h.validation = {
|
|
2550
2556
|
matches: "Invalid regular expression"
|
|
2551
2557
|
}), 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
2558
|
}
|
|
@@ -2567,9 +2573,9 @@ const Ui = [
|
|
|
2567
2573
|
inArray: d,
|
|
2568
2574
|
autoOpenTypeSelect: i,
|
|
2569
2575
|
disabled: N,
|
|
2570
|
-
getData:
|
|
2576
|
+
getData: T,
|
|
2571
2577
|
allowDataInference: v,
|
|
2572
|
-
propertyConfigs:
|
|
2578
|
+
propertyConfigs: w,
|
|
2573
2579
|
collectionEditable: C,
|
|
2574
2580
|
..._
|
|
2575
2581
|
}
|
|
@@ -2603,7 +2609,7 @@ function Ve({
|
|
|
2603
2609
|
},
|
|
2604
2610
|
children: [
|
|
2605
2611
|
/* @__PURE__ */ e(De, { children: /* @__PURE__ */ e(
|
|
2606
|
-
|
|
2612
|
+
cr,
|
|
2607
2613
|
{
|
|
2608
2614
|
...d,
|
|
2609
2615
|
onPropertyChanged: (m) => {
|
|
@@ -2664,7 +2670,7 @@ function ji({
|
|
|
2664
2670
|
propertyConfigs: x,
|
|
2665
2671
|
collectionEditable: v
|
|
2666
2672
|
}) {
|
|
2667
|
-
const [b,
|
|
2673
|
+
const [b, T] = j(o), [w, C] = j(!1), [O, N] = j(t?.dataType ? Wt(t) : void 0), F = Object.entries(dr).concat(Object.entries(x)), D = g ? F.filter(([Z, H]) => !ie(H.property) && H.property?.dataType !== "array") : F, _ = Er(t), S = je(null), h = je(t), B = s && I(r, "selectedWidget");
|
|
2668
2674
|
ue(() => {
|
|
2669
2675
|
if (c && (!d || _.id)) {
|
|
2670
2676
|
const {
|
|
@@ -2681,7 +2687,7 @@ function ji({
|
|
|
2681
2687
|
t?.id && p && p(t?.id, m, r);
|
|
2682
2688
|
}, [r, p, m, t?.id]);
|
|
2683
2689
|
const oe = (Z) => {
|
|
2684
|
-
N(Z), n(
|
|
2690
|
+
N(Z), n(lr(t, Z, x)), setTimeout(() => {
|
|
2685
2691
|
S.current?.focus();
|
|
2686
2692
|
}, 0);
|
|
2687
2693
|
};
|
|
@@ -2779,7 +2785,7 @@ function ji({
|
|
|
2779
2785
|
propertyConfigs: x
|
|
2780
2786
|
}
|
|
2781
2787
|
) : O === "key_value" ? q = /* @__PURE__ */ e(zi, { disabled: f }) : q = null, /* @__PURE__ */ a(R, { children: [
|
|
2782
|
-
f && /* @__PURE__ */ a(
|
|
2788
|
+
f && /* @__PURE__ */ a(Hr, { mode: "warn", children: [
|
|
2783
2789
|
/* @__PURE__ */ e(V, { children: "This property can't be edited" }),
|
|
2784
2790
|
/* @__PURE__ */ a(V, { variant: "caption", children: [
|
|
2785
2791
|
"You may not have permission to edit it or it is defined in code with no ",
|
|
@@ -2796,7 +2802,7 @@ function ji({
|
|
|
2796
2802
|
value: O ?? "",
|
|
2797
2803
|
placeholder: "Select a property widget",
|
|
2798
2804
|
open: b,
|
|
2799
|
-
onOpenChange:
|
|
2805
|
+
onOpenChange: T,
|
|
2800
2806
|
position: "item-aligned",
|
|
2801
2807
|
disabled: f,
|
|
2802
2808
|
renderValue: (Z) => {
|
|
@@ -2836,7 +2842,7 @@ function ji({
|
|
|
2836
2842
|
children: D.map(([Z, H]) => {
|
|
2837
2843
|
const Q = H.property, se = i && !ie(Q) && Q.dataType !== t?.dataType;
|
|
2838
2844
|
return /* @__PURE__ */ e(
|
|
2839
|
-
|
|
2845
|
+
sr,
|
|
2840
2846
|
{
|
|
2841
2847
|
value: Z,
|
|
2842
2848
|
optionDisabled: se,
|
|
@@ -2887,7 +2893,7 @@ function ji({
|
|
|
2887
2893
|
u && /* @__PURE__ */ e(
|
|
2888
2894
|
ct,
|
|
2889
2895
|
{
|
|
2890
|
-
open:
|
|
2896
|
+
open: w,
|
|
2891
2897
|
onAccept: () => u(t?.id, m),
|
|
2892
2898
|
onCancel: () => C(!1),
|
|
2893
2899
|
title: /* @__PURE__ */ e("div", { children: "Delete this property?" }),
|
|
@@ -2919,7 +2925,7 @@ function Yi({
|
|
|
2919
2925
|
}) {
|
|
2920
2926
|
const i = Ie(), l = t ? `import { EntityCollection } from "firecms";
|
|
2921
2927
|
|
|
2922
|
-
const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " +
|
|
2928
|
+
const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + si.stringify(ur(t), null, " ") : "No collection selected";
|
|
2923
2929
|
return /* @__PURE__ */ a(
|
|
2924
2930
|
Fe,
|
|
2925
2931
|
{
|
|
@@ -2945,9 +2951,9 @@ const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + li.
|
|
|
2945
2951
|
"."
|
|
2946
2952
|
] }),
|
|
2947
2953
|
/* @__PURE__ */ e(
|
|
2948
|
-
|
|
2954
|
+
di,
|
|
2949
2955
|
{
|
|
2950
|
-
theme:
|
|
2956
|
+
theme: ci.vsDark,
|
|
2951
2957
|
code: l,
|
|
2952
2958
|
language: "typescript",
|
|
2953
2959
|
children: ({
|
|
@@ -2971,7 +2977,7 @@ const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + li.
|
|
|
2971
2977
|
message: "Copied"
|
|
2972
2978
|
}), navigator.clipboard.writeText(l)),
|
|
2973
2979
|
children: [
|
|
2974
|
-
/* @__PURE__ */ e(
|
|
2980
|
+
/* @__PURE__ */ e(Yr, { size: "small" }),
|
|
2975
2981
|
"Copy to clipboard"
|
|
2976
2982
|
]
|
|
2977
2983
|
}
|
|
@@ -2982,7 +2988,7 @@ const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + li.
|
|
|
2982
2988
|
}
|
|
2983
2989
|
);
|
|
2984
2990
|
}
|
|
2985
|
-
function
|
|
2991
|
+
function ur(t) {
|
|
2986
2992
|
const r = (n) => {
|
|
2987
2993
|
const i = {
|
|
2988
2994
|
...n
|
|
@@ -3008,7 +3014,7 @@ function cr(t) {
|
|
|
3008
3014
|
properties: Object.entries(t.properties ?? {}).map(([n, i]) => ({
|
|
3009
3015
|
[n]: r(i)
|
|
3010
3016
|
})).reduce((n, i) => ({ ...n, ...i }), {}),
|
|
3011
|
-
subcollections: (t.subcollections ?? []).map(
|
|
3017
|
+
subcollections: (t.subcollections ?? []).map(ur)
|
|
3012
3018
|
};
|
|
3013
3019
|
}
|
|
3014
3020
|
function Gi({
|
|
@@ -3032,7 +3038,7 @@ function Gi({
|
|
|
3032
3038
|
setFieldTouched: y,
|
|
3033
3039
|
errors: x,
|
|
3034
3040
|
dirty: v
|
|
3035
|
-
} = G(), b = Ie(),
|
|
3041
|
+
} = G(), b = Ie(), T = wr(), w = !T, [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
3042
|
ue(() => {
|
|
3037
3043
|
l && l(v);
|
|
3038
3044
|
}, [v]);
|
|
@@ -3087,7 +3093,7 @@ function Gi({
|
|
|
3087
3093
|
[A]: U
|
|
3088
3094
|
}, !1);
|
|
3089
3095
|
const k = [...f.propertiesOrder ?? Object.keys(f.properties), A];
|
|
3090
|
-
ve(k), Q(!1),
|
|
3096
|
+
ve(k), Q(!1), T && (O(k.indexOf(A)), F(A)), _(void 0);
|
|
3091
3097
|
}, pe = ({
|
|
3092
3098
|
id: A,
|
|
3093
3099
|
property: U,
|
|
@@ -3134,7 +3140,7 @@ function Gi({
|
|
|
3134
3140
|
/* @__PURE__ */ a("div", { className: fe(
|
|
3135
3141
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
3136
3142
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
3137
|
-
!
|
|
3143
|
+
!w && "border-r " + kt
|
|
3138
3144
|
), children: [
|
|
3139
3145
|
/* @__PURE__ */ a("div", { className: "flex my-2", children: [
|
|
3140
3146
|
/* @__PURE__ */ a("div", { className: "flex-grow mb-4", children: [
|
|
@@ -3173,7 +3179,7 @@ function Gi({
|
|
|
3173
3179
|
variant: "filled",
|
|
3174
3180
|
disabled: q,
|
|
3175
3181
|
onClick: () => oe(!0),
|
|
3176
|
-
children: /* @__PURE__ */ e(
|
|
3182
|
+
children: /* @__PURE__ */ e(Gr, {})
|
|
3177
3183
|
}
|
|
3178
3184
|
) }),
|
|
3179
3185
|
de && /* @__PURE__ */ e(te, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
|
|
@@ -3224,13 +3230,13 @@ function Gi({
|
|
|
3224
3230
|
}
|
|
3225
3231
|
)
|
|
3226
3232
|
] }),
|
|
3227
|
-
!
|
|
3233
|
+
!w && /* @__PURE__ */ e("div", { className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ a(
|
|
3228
3234
|
ge,
|
|
3229
3235
|
{
|
|
3230
3236
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
3231
3237
|
children: [
|
|
3232
3238
|
S && h && !ie(h) && /* @__PURE__ */ e(
|
|
3233
|
-
|
|
3239
|
+
cr,
|
|
3234
3240
|
{
|
|
3235
3241
|
inArray: !1,
|
|
3236
3242
|
existingProperty: !r,
|
|
@@ -3269,7 +3275,7 @@ function Gi({
|
|
|
3269
3275
|
]
|
|
3270
3276
|
}
|
|
3271
3277
|
) }),
|
|
3272
|
-
|
|
3278
|
+
w && /* @__PURE__ */ e(
|
|
3273
3279
|
Ve,
|
|
3274
3280
|
{
|
|
3275
3281
|
inArray: !1,
|
|
@@ -3289,7 +3295,7 @@ function Gi({
|
|
|
3289
3295
|
getData: u,
|
|
3290
3296
|
propertyConfigs: p,
|
|
3291
3297
|
collectionEditable: s,
|
|
3292
|
-
onOkClicked:
|
|
3298
|
+
onOkClicked: w ? Ze : void 0
|
|
3293
3299
|
},
|
|
3294
3300
|
`edit_view_${C}`
|
|
3295
3301
|
)
|
|
@@ -3397,7 +3403,7 @@ function Zi({
|
|
|
3397
3403
|
const { entityViews: d } = Ae(), [c, u] = Y.useState(), [m, p] = Y.useState(!1), [s, f] = Y.useState(), [g, P] = Y.useState(), {
|
|
3398
3404
|
values: y,
|
|
3399
3405
|
setFieldValue: x
|
|
3400
|
-
} = G(), v = t.subcollections ?? [], b = y.entityViews?.filter((C) => typeof C == "string").map((C) =>
|
|
3406
|
+
} = G(), v = t.subcollections ?? [], b = y.entityViews?.filter((C) => typeof C == "string").map((C) => Tr(C, d)).filter(Boolean) ?? [], T = t.entityViews?.filter((C) => typeof C != "string") ?? [], w = b.length + T.length;
|
|
3401
3407
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3402
3408
|
/* @__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: [
|
|
3403
3409
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
@@ -3459,7 +3465,7 @@ function Zi({
|
|
|
3459
3465
|
] }),
|
|
3460
3466
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3461
3467
|
/* @__PURE__ */ e(V, { variant: "h5", children: "Custom views" }),
|
|
3462
|
-
|
|
3468
|
+
w === 0 && /* @__PURE__ */ e(Kr, { action: /* @__PURE__ */ e(
|
|
3463
3469
|
z,
|
|
3464
3470
|
{
|
|
3465
3471
|
variant: "text",
|
|
@@ -3499,7 +3505,7 @@ function Zi({
|
|
|
3499
3505
|
}
|
|
3500
3506
|
)
|
|
3501
3507
|
] }, C.key)),
|
|
3502
|
-
|
|
3508
|
+
T.map((C) => /* @__PURE__ */ e(Ct, { children: /* @__PURE__ */ a(
|
|
3503
3509
|
Re,
|
|
3504
3510
|
{
|
|
3505
3511
|
align: "left",
|
|
@@ -3565,7 +3571,7 @@ function Zi({
|
|
|
3565
3571
|
}
|
|
3566
3572
|
),
|
|
3567
3573
|
/* @__PURE__ */ e(
|
|
3568
|
-
|
|
3574
|
+
mr,
|
|
3569
3575
|
{
|
|
3570
3576
|
open: !!g,
|
|
3571
3577
|
configController: n,
|
|
@@ -4137,7 +4143,7 @@ function Ji({
|
|
|
4137
4143
|
children: "● Create a collection from a file (csv, json, xls, xslx...)"
|
|
4138
4144
|
}
|
|
4139
4145
|
),
|
|
4140
|
-
/* @__PURE__ */ e(
|
|
4146
|
+
/* @__PURE__ */ e(ui, { onDataAdded: (g, P) => i(g, P) })
|
|
4141
4147
|
] }),
|
|
4142
4148
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(z, { variant: "text", onClick: () => i(), className: "my-2", children: "Continue from scratch" }) })
|
|
4143
4149
|
] }) });
|
|
@@ -4180,13 +4186,13 @@ function Qi({
|
|
|
4180
4186
|
previousId: y,
|
|
4181
4187
|
namespace: x
|
|
4182
4188
|
}) => {
|
|
4183
|
-
const v = g ? ne(g, x) : void 0, b = v ? he(v) : void 0,
|
|
4189
|
+
const v = g ? ne(g, x) : void 0, b = v ? he(v) : void 0, T = (C) => C ? u.current[C] ?? I(o, Ce(C)) : u.current[""], w = (C, O) => {
|
|
4184
4190
|
const N = Ce(O);
|
|
4185
4191
|
i(N, C, !1), u.current[O ?? ""] = C;
|
|
4186
4192
|
};
|
|
4187
4193
|
if (y && y !== g) {
|
|
4188
|
-
const C = ne(y, x), O = he(C), F =
|
|
4189
|
-
|
|
4194
|
+
const C = ne(y, x), O = he(C), F = T(x).map((_) => _ === y ? g : _).filter((_) => _ !== void 0);
|
|
4195
|
+
w(F, x);
|
|
4190
4196
|
const D = { ...t.headersMapping };
|
|
4191
4197
|
Object.keys(D).forEach((_) => {
|
|
4192
4198
|
D[_] === y && (D[_] = g ?? "");
|
|
@@ -4199,17 +4205,17 @@ function Qi({
|
|
|
4199
4205
|
property: y,
|
|
4200
4206
|
namespace: x
|
|
4201
4207
|
}) => {
|
|
4202
|
-
const v = g ? ne(g, x) : void 0, b = v ? he(v) : void 0,
|
|
4203
|
-
...
|
|
4208
|
+
const v = g ? ne(g, x) : void 0, b = v ? he(v) : void 0, T = t.importData.map((C) => I(C, P)), w = {
|
|
4209
|
+
...ii(T, y, ir),
|
|
4204
4210
|
editable: !0
|
|
4205
4211
|
};
|
|
4206
|
-
b && (
|
|
4212
|
+
b && (w ? i(b, w, !1) : i(b, y, !1), l(b, !0, !1));
|
|
4207
4213
|
};
|
|
4208
4214
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
4209
4215
|
/* @__PURE__ */ a(ht, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
4210
4216
|
/* @__PURE__ */ e(V, { variant: "h6", className: "my-4 ml-3.5", children: "Data property mapping" }),
|
|
4211
4217
|
/* @__PURE__ */ e(
|
|
4212
|
-
|
|
4218
|
+
pi,
|
|
4213
4219
|
{
|
|
4214
4220
|
importConfig: t,
|
|
4215
4221
|
destinationProperties: o.properties,
|
|
@@ -4219,7 +4225,7 @@ function Qi({
|
|
|
4219
4225
|
importKey: y,
|
|
4220
4226
|
isIdColumn: x
|
|
4221
4227
|
}) => x ? /* @__PURE__ */ e(V, { children: " This column will be used as ID" }) : /* @__PURE__ */ e(
|
|
4222
|
-
|
|
4228
|
+
mi,
|
|
4223
4229
|
{
|
|
4224
4230
|
property: g,
|
|
4225
4231
|
propertyKey: P,
|
|
@@ -4301,7 +4307,7 @@ function Xi({
|
|
|
4301
4307
|
position: "item-aligned",
|
|
4302
4308
|
renderValue: (m) => d ? /* @__PURE__ */ e($e, { propertyConfig: d }) : null,
|
|
4303
4309
|
onValueChange: (m) => {
|
|
4304
|
-
const p =
|
|
4310
|
+
const p = lr(t, m, i);
|
|
4305
4311
|
n && r({
|
|
4306
4312
|
id: n,
|
|
4307
4313
|
property: p,
|
|
@@ -4309,8 +4315,8 @@ function Xi({
|
|
|
4309
4315
|
namespace: void 0
|
|
4310
4316
|
});
|
|
4311
4317
|
},
|
|
4312
|
-
children: Object.entries(
|
|
4313
|
-
|
|
4318
|
+
children: Object.entries(dr).map(([m, p]) => /* @__PURE__ */ e(
|
|
4319
|
+
sr,
|
|
4314
4320
|
{
|
|
4315
4321
|
value: m,
|
|
4316
4322
|
optionDisabled: !1,
|
|
@@ -4331,15 +4337,15 @@ function en({
|
|
|
4331
4337
|
}) {
|
|
4332
4338
|
const [i, l] = j(!1);
|
|
4333
4339
|
async function o() {
|
|
4334
|
-
const c = t.importData.map((u) =>
|
|
4340
|
+
const c = t.importData.map((u) => hi(u, t.idColumn, t.headersMapping, r, "TEMP_PATH", t.defaultValues));
|
|
4335
4341
|
t.setEntities(c);
|
|
4336
4342
|
}
|
|
4337
4343
|
ue(() => {
|
|
4338
4344
|
o().finally(() => l(!1));
|
|
4339
4345
|
}, []);
|
|
4340
|
-
const d =
|
|
4346
|
+
const d = kr();
|
|
4341
4347
|
return i ? /* @__PURE__ */ e(ut, {}) : /* @__PURE__ */ e(
|
|
4342
|
-
|
|
4348
|
+
Or,
|
|
4343
4349
|
{
|
|
4344
4350
|
title: /* @__PURE__ */ a("div", { children: [
|
|
4345
4351
|
/* @__PURE__ */ e(V, { variant: "subtitle2", children: "Imported data preview" }),
|
|
@@ -4362,11 +4368,11 @@ function en({
|
|
|
4362
4368
|
}
|
|
4363
4369
|
);
|
|
4364
4370
|
}
|
|
4365
|
-
function
|
|
4371
|
+
function pr(t, r = "") {
|
|
4366
4372
|
const n = Object.keys(t).reduce((o, d) => {
|
|
4367
|
-
const c = t[d], u =
|
|
4373
|
+
const c = t[d], u = Vr(d), m = r ? `${r}.${u}` : u;
|
|
4368
4374
|
if (c.dataType === "map" && c.properties) {
|
|
4369
|
-
const f =
|
|
4375
|
+
const f = pr(c.properties, m);
|
|
4370
4376
|
return {
|
|
4371
4377
|
headersMapping: { ...o.headersMapping, [d]: m },
|
|
4372
4378
|
properties: {
|
|
@@ -4394,7 +4400,7 @@ function ur(t, r = "") {
|
|
|
4394
4400
|
idColumn: l
|
|
4395
4401
|
};
|
|
4396
4402
|
}
|
|
4397
|
-
function
|
|
4403
|
+
function mr(t) {
|
|
4398
4404
|
const r = t.open, [n, i] = Ue.useState(!1), [l, o] = Ue.useState(!1), d = J(() => {
|
|
4399
4405
|
n ? o(!0) : t.handleClose(void 0);
|
|
4400
4406
|
}, [n, t.handleClose]);
|
|
@@ -4494,12 +4500,12 @@ function rn({
|
|
|
4494
4500
|
existingIds: x,
|
|
4495
4501
|
includeTemplates: v,
|
|
4496
4502
|
collection: b,
|
|
4497
|
-
setCollection:
|
|
4498
|
-
initialValues:
|
|
4503
|
+
setCollection: T,
|
|
4504
|
+
initialValues: w,
|
|
4499
4505
|
propertyConfigs: C,
|
|
4500
4506
|
groups: O
|
|
4501
4507
|
}) {
|
|
4502
|
-
const N =
|
|
4508
|
+
const N = fi(), F = Te(), D = Ie(), _ = je({}), S = t ? v ? "welcome" : "details" : "properties", [h, B] = j(S), [oe, q] = Ue.useState(), Z = (k) => {
|
|
4503
4509
|
const E = k.id || k.path;
|
|
4504
4510
|
return r.saveCollection({
|
|
4505
4511
|
id: E,
|
|
@@ -4518,15 +4524,15 @@ function rn({
|
|
|
4518
4524
|
}, [o, i]), se = J(async (k) => {
|
|
4519
4525
|
try {
|
|
4520
4526
|
if (!Q)
|
|
4521
|
-
return
|
|
4527
|
+
return T(k), Promise.resolve(k);
|
|
4522
4528
|
B("loading");
|
|
4523
4529
|
const E = await Q?.(k);
|
|
4524
4530
|
if (!E)
|
|
4525
|
-
return
|
|
4531
|
+
return T(k), Promise.resolve(k);
|
|
4526
4532
|
const M = {
|
|
4527
4533
|
...k ?? {}
|
|
4528
4534
|
};
|
|
4529
|
-
return Object.keys(E.properties ?? {}).length > 0 && (M.properties = E.properties, M.propertiesOrder = E.propertiesOrder), M.propertiesOrder ? (
|
|
4535
|
+
return Object.keys(E.properties ?? {}).length > 0 && (M.properties = E.properties, M.propertiesOrder = E.propertiesOrder), M.propertiesOrder ? (T(M), console.debug("Inferred collection", {
|
|
4530
4536
|
newCollection: k ?? {},
|
|
4531
4537
|
values: M
|
|
4532
4538
|
}), M) : (M.propertiesOrder = Object.keys(M.properties), M);
|
|
@@ -4537,13 +4543,13 @@ function rn({
|
|
|
4537
4543
|
}), k;
|
|
4538
4544
|
}
|
|
4539
4545
|
}, [i, Q]), de = Ot({
|
|
4540
|
-
initialValues:
|
|
4546
|
+
initialValues: w,
|
|
4541
4547
|
onSubmit: (k, E) => {
|
|
4542
4548
|
console.log("Submitting collection", k);
|
|
4543
4549
|
try {
|
|
4544
4550
|
if (!t) {
|
|
4545
4551
|
Z(k).then(() => {
|
|
4546
|
-
E.resetForm({ values:
|
|
4552
|
+
E.resetForm({ values: w }), d(k);
|
|
4547
4553
|
});
|
|
4548
4554
|
return;
|
|
4549
4555
|
}
|
|
@@ -4558,7 +4564,7 @@ function rn({
|
|
|
4558
4564
|
}).finally(() => {
|
|
4559
4565
|
H();
|
|
4560
4566
|
}) : (E.resetForm({ values: k }), H()) : h === "extra_view" ? (H(), E.resetForm({ values: k })) : h === "import_data_mapping" || h === "import_data_preview" ? H() : h === "properties" ? Z(k).then(() => {
|
|
4561
|
-
E.resetForm({ values:
|
|
4567
|
+
E.resetForm({ values: w }), H(), d(k);
|
|
4562
4568
|
}) : (H(), E.resetForm({ values: k }));
|
|
4563
4569
|
} catch (M) {
|
|
4564
4570
|
D.open({
|
|
@@ -4569,7 +4575,7 @@ function rn({
|
|
|
4569
4575
|
},
|
|
4570
4576
|
validation: (k) => {
|
|
4571
4577
|
let E = {};
|
|
4572
|
-
const M = (h === "properties" || h === "subcollections" || h === "details") &&
|
|
4578
|
+
const M = (h === "properties" || h === "subcollections" || h === "details") && yi;
|
|
4573
4579
|
if (M)
|
|
4574
4580
|
try {
|
|
4575
4581
|
M.validateSync(k, { abortEarly: !1 });
|
|
@@ -4597,8 +4603,8 @@ function rn({
|
|
|
4597
4603
|
p(Ke);
|
|
4598
4604
|
}, [Ke]);
|
|
4599
4605
|
function Xe(k, E) {
|
|
4600
|
-
N.setInUse(!0),
|
|
4601
|
-
const L =
|
|
4606
|
+
N.setInUse(!0), ni(k, ir).then((M) => {
|
|
4607
|
+
const L = pr(M);
|
|
4602
4608
|
N.setIdColumn(L.idColumn), N.setImportData(k), N.setHeadersMapping(L.headersMapping);
|
|
4603
4609
|
const ye = (E ?? []).filter((tt) => L.headersMapping[tt]) ?? Object.keys(L.properties);
|
|
4604
4610
|
N.setHeadingsOrder(ye), N.setOriginProperties(L.properties);
|
|
@@ -4612,7 +4618,7 @@ function rn({
|
|
|
4612
4618
|
}, U = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4613
4619
|
return /* @__PURE__ */ e(De, { fullHeight: !0, children: /* @__PURE__ */ e(Vt, { value: de, children: /* @__PURE__ */ a(R, { children: [
|
|
4614
4620
|
!t && /* @__PURE__ */ a(
|
|
4615
|
-
|
|
4621
|
+
Wr,
|
|
4616
4622
|
{
|
|
4617
4623
|
value: h,
|
|
4618
4624
|
className: fe(kt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
@@ -4665,7 +4671,7 @@ function rn({
|
|
|
4665
4671
|
}
|
|
4666
4672
|
),
|
|
4667
4673
|
h === "import_data_saving" && N && /* @__PURE__ */ e(
|
|
4668
|
-
|
|
4674
|
+
gi,
|
|
4669
4675
|
{
|
|
4670
4676
|
importConfig: N,
|
|
4671
4677
|
collection: re,
|
|
@@ -4679,7 +4685,7 @@ function rn({
|
|
|
4679
4685
|
}
|
|
4680
4686
|
),
|
|
4681
4687
|
h === "details" && /* @__PURE__ */ e(
|
|
4682
|
-
|
|
4688
|
+
bi,
|
|
4683
4689
|
{
|
|
4684
4690
|
existingPaths: y,
|
|
4685
4691
|
existingIds: x,
|
|
@@ -4709,7 +4715,7 @@ function rn({
|
|
|
4709
4715
|
onPropertyError: (k, E, M) => {
|
|
4710
4716
|
const L = Et({
|
|
4711
4717
|
..._.current,
|
|
4712
|
-
[
|
|
4718
|
+
[ar(k, E)]: Et(M, !0)
|
|
4713
4719
|
}, !0);
|
|
4714
4720
|
_.current = L, de.validate();
|
|
4715
4721
|
},
|
|
@@ -4822,7 +4828,7 @@ function rn({
|
|
|
4822
4828
|
type: "submit",
|
|
4823
4829
|
loading: ke,
|
|
4824
4830
|
disabled: ke || h === "details" && !yt,
|
|
4825
|
-
startIcon: h === "properties" ? /* @__PURE__ */ e(
|
|
4831
|
+
startIcon: h === "properties" ? /* @__PURE__ */ e(Zr, {}) : void 0,
|
|
4826
4832
|
children: [
|
|
4827
4833
|
h === "details" && "Next",
|
|
4828
4834
|
h === "properties" && "Create collection"
|
|
@@ -4853,13 +4859,13 @@ function nn(t, r) {
|
|
|
4853
4859
|
...i
|
|
4854
4860
|
} = t, l = {};
|
|
4855
4861
|
return n && Object.keys(n).forEach((o) => {
|
|
4856
|
-
l[o] =
|
|
4862
|
+
l[o] = hr(n[o], r);
|
|
4857
4863
|
}), {
|
|
4858
4864
|
...i,
|
|
4859
4865
|
properties: l
|
|
4860
4866
|
};
|
|
4861
4867
|
}
|
|
4862
|
-
function
|
|
4868
|
+
function hr(t, r) {
|
|
4863
4869
|
let n = t;
|
|
4864
4870
|
if (r && typeof n == "object" && n.propertyConfig) {
|
|
4865
4871
|
const i = r[n.propertyConfig];
|
|
@@ -4868,7 +4874,7 @@ function mr(t, r) {
|
|
|
4868
4874
|
else if (i && (n = K(i.property, n)), !ie(n) && n.dataType === "map" && n.properties) {
|
|
4869
4875
|
const l = {};
|
|
4870
4876
|
Object.keys(n.properties).forEach((o) => {
|
|
4871
|
-
l[o] =
|
|
4877
|
+
l[o] = hr(n.properties[o], r);
|
|
4872
4878
|
}), n = {
|
|
4873
4879
|
...n,
|
|
4874
4880
|
properties: l
|
|
@@ -4879,13 +4885,13 @@ function mr(t, r) {
|
|
|
4879
4885
|
}
|
|
4880
4886
|
const Gt = (t, r, n, i) => {
|
|
4881
4887
|
let l;
|
|
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"),
|
|
4888
|
+
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"), Ir(t).split("/").length % 2 === 0 && (l = `Collection paths must have an odd number of segments: ${t}`), l;
|
|
4883
4889
|
}, an = (t, r, n, i) => {
|
|
4884
4890
|
if (!t)
|
|
4885
4891
|
return;
|
|
4886
4892
|
let l;
|
|
4887
4893
|
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;
|
|
4888
|
-
},
|
|
4894
|
+
}, fr = Y.createContext({}), gr = Y.createContext({}), on = Y.memo(
|
|
4889
4895
|
function({
|
|
4890
4896
|
children: r,
|
|
4891
4897
|
collectionConfigController: n,
|
|
@@ -4898,11 +4904,11 @@ const Gt = (t, r, n, i) => {
|
|
|
4898
4904
|
getData: m,
|
|
4899
4905
|
onAnalyticsEvent: p
|
|
4900
4906
|
}) {
|
|
4901
|
-
const s = Te(), f =
|
|
4907
|
+
const s = Te(), f = vi(), g = Ie(), { propertyConfigs: P } = Ae(), [y, x] = Y.useState(), [v, b] = Y.useState(), T = J(() => ({
|
|
4902
4908
|
createCollections: !0,
|
|
4903
4909
|
editCollections: !0,
|
|
4904
4910
|
deleteCollections: !0
|
|
4905
|
-
}), []),
|
|
4911
|
+
}), []), w = J(({
|
|
4906
4912
|
id: N,
|
|
4907
4913
|
fullPath: F,
|
|
4908
4914
|
parentCollectionIds: D,
|
|
@@ -4968,20 +4974,20 @@ const Gt = (t, r, n, i) => {
|
|
|
4968
4974
|
redirect: _
|
|
4969
4975
|
});
|
|
4970
4976
|
}, []);
|
|
4971
|
-
return /* @__PURE__ */ e(
|
|
4972
|
-
|
|
4977
|
+
return /* @__PURE__ */ e(fr.Provider, { value: n, children: /* @__PURE__ */ a(
|
|
4978
|
+
gr.Provider,
|
|
4973
4979
|
{
|
|
4974
4980
|
value: {
|
|
4975
|
-
editCollection:
|
|
4981
|
+
editCollection: w,
|
|
4976
4982
|
createCollection: O,
|
|
4977
4983
|
editProperty: C,
|
|
4978
|
-
configPermissions: i ??
|
|
4984
|
+
configPermissions: i ?? T,
|
|
4979
4985
|
getPathSuggestions: c
|
|
4980
4986
|
},
|
|
4981
4987
|
children: [
|
|
4982
4988
|
r,
|
|
4983
4989
|
/* @__PURE__ */ e(
|
|
4984
|
-
|
|
4990
|
+
mr,
|
|
4985
4991
|
{
|
|
4986
4992
|
open: !!y,
|
|
4987
4993
|
configController: n,
|
|
@@ -5076,7 +5082,7 @@ const Gt = (t, r, n, i) => {
|
|
|
5076
5082
|
) });
|
|
5077
5083
|
},
|
|
5078
5084
|
be
|
|
5079
|
-
), Pe = () => Qt(
|
|
5085
|
+
), Pe = () => Qt(gr);
|
|
5080
5086
|
function ln({
|
|
5081
5087
|
path: t,
|
|
5082
5088
|
parentCollectionIds: r,
|
|
@@ -5103,12 +5109,12 @@ function ln({
|
|
|
5103
5109
|
}
|
|
5104
5110
|
) });
|
|
5105
5111
|
}
|
|
5106
|
-
const
|
|
5112
|
+
const vr = () => Qt(fr);
|
|
5107
5113
|
function sn({
|
|
5108
5114
|
path: t,
|
|
5109
5115
|
collection: r
|
|
5110
5116
|
}) {
|
|
5111
|
-
const n = Ie(), i = _e(), l =
|
|
5117
|
+
const n = Ie(), i = _e(), l = vr(), o = Pe(), d = o.configPermissions({
|
|
5112
5118
|
user: i.user,
|
|
5113
5119
|
collection: r
|
|
5114
5120
|
}), c = J(() => {
|
|
@@ -5124,10 +5130,10 @@ function sn({
|
|
|
5124
5130
|
return /* @__PURE__ */ a(R, { children: [
|
|
5125
5131
|
/* @__PURE__ */ a("div", { children: [
|
|
5126
5132
|
d.deleteCollections && /* @__PURE__ */ e(
|
|
5127
|
-
|
|
5133
|
+
Jr,
|
|
5128
5134
|
{
|
|
5129
|
-
trigger: /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(
|
|
5130
|
-
children: /* @__PURE__ */ a(
|
|
5135
|
+
trigger: /* @__PURE__ */ e(ae, { children: /* @__PURE__ */ e(Qr, { size: "small" }) }),
|
|
5136
|
+
children: /* @__PURE__ */ a(Xr, { onClick: (s) => {
|
|
5131
5137
|
s.preventDefault(), s.stopPropagation(), m(!0);
|
|
5132
5138
|
}, children: [
|
|
5133
5139
|
/* @__PURE__ */ e(mt, {}),
|
|
@@ -5205,7 +5211,7 @@ function cn({
|
|
|
5205
5211
|
l.editProperty({
|
|
5206
5212
|
editedCollectionId: n.id,
|
|
5207
5213
|
parentCollectionIds: r,
|
|
5208
|
-
currentPropertiesOrder:
|
|
5214
|
+
currentPropertiesOrder: _r(n),
|
|
5209
5215
|
collection: n
|
|
5210
5216
|
});
|
|
5211
5217
|
},
|
|
@@ -5238,7 +5244,7 @@ function pn({
|
|
|
5238
5244
|
collection: n,
|
|
5239
5245
|
tableController: i
|
|
5240
5246
|
}) {
|
|
5241
|
-
const l = _e(), o = Pe(), d =
|
|
5247
|
+
const l = _e(), o = Pe(), d = vr(), c = Ie(), u = o.configPermissions ? o.configPermissions({
|
|
5242
5248
|
user: l.user,
|
|
5243
5249
|
collection: n
|
|
5244
5250
|
}).editCollections : !0;
|
|
@@ -5270,7 +5276,7 @@ function pn({
|
|
|
5270
5276
|
message: "Default config saved"
|
|
5271
5277
|
});
|
|
5272
5278
|
}),
|
|
5273
|
-
children: /* @__PURE__ */ e(
|
|
5279
|
+
children: /* @__PURE__ */ e(ei, {})
|
|
5274
5280
|
}
|
|
5275
5281
|
)
|
|
5276
5282
|
}
|
|
@@ -5288,7 +5294,7 @@ function pn({
|
|
|
5288
5294
|
onClick: () => {
|
|
5289
5295
|
i.clearFilter?.(), n?.initialFilter && i.setFilterValues?.(n?.initialFilter), n?.initialSort && i.setSortBy?.(n?.initialSort);
|
|
5290
5296
|
},
|
|
5291
|
-
children: /* @__PURE__ */ e(
|
|
5297
|
+
children: /* @__PURE__ */ e(ti, {})
|
|
5292
5298
|
}
|
|
5293
5299
|
)
|
|
5294
5300
|
}
|
|
@@ -5420,7 +5426,7 @@ const In = (t, r, n) => {
|
|
|
5420
5426
|
He(d.properties), d.subcollections?.forEach(i);
|
|
5421
5427
|
}, l = r ?? [];
|
|
5422
5428
|
l.forEach(i), console.debug("Collections specified in code:", t), console.debug("Collections stored in the backend", l);
|
|
5423
|
-
const o =
|
|
5429
|
+
const o = Fr(t, l, [], n);
|
|
5424
5430
|
return console.debug("Collections after joining:", o), o;
|
|
5425
5431
|
};
|
|
5426
5432
|
function _n({ path: t }) {
|
|
@@ -5454,14 +5460,14 @@ export {
|
|
|
5454
5460
|
_n as MissingReferenceWidget,
|
|
5455
5461
|
qe as editableProperty,
|
|
5456
5462
|
ne as getFullId,
|
|
5457
|
-
|
|
5463
|
+
ar as getFullIdPath,
|
|
5458
5464
|
he as idToPropertiesPath,
|
|
5459
5465
|
In as mergeCollections,
|
|
5460
5466
|
Ce as namespaceToPropertiesOrderPath,
|
|
5461
|
-
|
|
5467
|
+
nr as namespaceToPropertiesPath,
|
|
5462
5468
|
wi as removeNonEditableProperties,
|
|
5463
5469
|
Pe as useCollectionEditorController,
|
|
5464
5470
|
Vn as useCollectionEditorPlugin,
|
|
5465
|
-
|
|
5471
|
+
vr as useCollectionsConfigController
|
|
5466
5472
|
};
|
|
5467
5473
|
//# sourceMappingURL=index.es.js.map
|