@firecms/collection_editor 3.0.0-canary.49 → 3.0.0-canary.50
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 +282 -278
- 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/CollectionPropertiesEditorForm.tsx +7 -5
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as R } from "react/jsx-runtime";
|
|
2
|
-
import { FieldCaption as J, SearchIconsView as vr, toSnakeCase as Nt, singular as yr, IconForView as st, ArrayContainer as br, serializeRegExp as Cr, useSnackbarController as Ve, resolveEnumValues as Nr, isPropertyBuilder as re, useCustomizationController as Se, getFieldConfig as je, ErrorBoundary as pe, PropertyConfigBadge as qe, unslugify as
|
|
2
|
+
import { FieldCaption as J, SearchIconsView as vr, toSnakeCase as Nt, singular as yr, IconForView as st, ArrayContainer as br, serializeRegExp as Cr, useSnackbarController as Ve, resolveEnumValues as Nr, isPropertyBuilder as re, useCustomizationController as Se, getFieldConfig as je, ErrorBoundary as pe, PropertyConfigBadge as qe, unslugify as Pt, useNavigationController as Te, mergeDeep as W, DEFAULT_FIELD_CONFIGS as Wt, isValidRegExp as xr, getFieldId as Gt, DeleteConfirmationDialog as dt, useLargeLayout as Pr, makePropertiesEditable as Le, resolveEntityView as wr, useSelectionController as Tr, CircularProgressCenter as ct, EntityCollectionTable as kr, slugify as Or, useAuthController as Ie, randomString as _t, removeUndefined as Ft, ErrorView as Kt, removeInitialAndTrailingSlashes as Vr, getDefaultPropertiesOrder as Ir, joinCollectionLists as _r } from "@firecms/core";
|
|
3
3
|
import * as ze from "react";
|
|
4
4
|
import G, { useState as j, useEffect as ce, useMemo as Zt, useRef as Re, useDeferredValue as Fr, useCallback as Er, useContext as Jt } from "react";
|
|
5
|
-
import
|
|
6
|
-
import { useAutoComplete as Sr, Container as mt, Typography as V, Tooltip as ee, IconButton as ie, Chip as
|
|
5
|
+
import ye from "react-fast-compare";
|
|
6
|
+
import { useAutoComplete as Sr, Container as mt, Typography as V, Tooltip as ee, IconButton as ie, Chip as xt, TextField as we, cn as fe, DebouncedTextField as K, Autocomplete as Ar, AutocompleteItem as Dr, ExpandablePanel as wt, SettingsIcon as $e, ClearIcon as Br, Select as be, SelectItem as X, BooleanSwitchWithLabel as ut, Dialog as _e, AutoAwesomeIcon as ht, Badge as Mr, ListIcon as zr, Button as z, CircularProgress as He, Paper as ge, DialogContent as Ae, DialogActions as De, RuleIcon as Rr, FileUploadIcon as Ur, MultiSelect as jr, MultiSelectItem as Et, Checkbox as St, cardMixin as Qt, cardClickableMixin as Xt, cardSelectedMixin as er, FunctionsIcon as qr, RemoveCircleIcon as Lr, defaultBorderMixin as Tt, RemoveIcon as $r, DragHandleIcon as Hr, AddIcon as de, SelectGroup as At, InfoLabel as Yr, DeleteIcon as pt, ContentCopyIcon as Wr, CodeIcon as Gr, Table as Dt, TableBody as Bt, TableRow as bt, TableCell as Me, Alert as Kr, Icon as rt, Card as tr, coolIconKeys as Mt, Tabs as Zr, Tab as Ct, ArrowBackIcon as it, LoadingButton as zt, DoneIcon as Jr, Menu as Qr, MoreVertIcon as Xr, MenuItem as ei, SaveIcon as ti, UndoIcon as ri } from "@firecms/ui";
|
|
7
7
|
import * as nt from "yup";
|
|
8
8
|
import { useFormex as Y, Field as $, getIn as I, useCreateFormex as kt, Formex as Ot } from "@firecms/formex";
|
|
9
9
|
import { extractEnumFromValues as ii, buildPropertyFromData as ni, buildEntityPropertiesFromData as ai } from "@firecms/schema_inference";
|
|
@@ -33,8 +33,8 @@ function Ci({
|
|
|
33
33
|
errors: s,
|
|
34
34
|
setFieldTouched: f,
|
|
35
35
|
isSubmitting: g,
|
|
36
|
-
submitCount:
|
|
37
|
-
} = Y(), [y,
|
|
36
|
+
submitCount: P
|
|
37
|
+
} = Y(), [y, x] = j(!1), [v, b] = j(!1), T = (h) => {
|
|
38
38
|
u("name", h), !I(p, "path") && t && h && u("path", Nt(h)), !I(p, "id") && t && h && u("id", Nt(h)), !I(p, "singularName") && t && h && u("singularName", yr(h));
|
|
39
39
|
};
|
|
40
40
|
ce(() => {
|
|
@@ -43,13 +43,13 @@ function Ci({
|
|
|
43
43
|
const w = /* @__PURE__ */ e(st, { collectionOrView: c }), C = l?.filter((h) => !r?.includes(h)), {
|
|
44
44
|
inputFocused: O,
|
|
45
45
|
autoCompleteOpen: N,
|
|
46
|
-
setAutoCompleteOpen:
|
|
46
|
+
setAutoCompleteOpen: E
|
|
47
47
|
} = Sr({
|
|
48
48
|
ref: d
|
|
49
49
|
}), B = !!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
|
|
52
|
+
const S = P > 0;
|
|
53
53
|
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ a(mt, { 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 Ci({
|
|
|
62
62
|
ie,
|
|
63
63
|
{
|
|
64
64
|
shape: "square",
|
|
65
|
-
onClick: () =>
|
|
65
|
+
onClick: () => x(!0),
|
|
66
66
|
children: w
|
|
67
67
|
}
|
|
68
68
|
) })
|
|
69
69
|
]
|
|
70
70
|
}
|
|
71
71
|
),
|
|
72
|
-
o && /* @__PURE__ */ e(
|
|
72
|
+
o && /* @__PURE__ */ e(xt, { 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
|
] }) })
|
|
@@ -83,12 +83,12 @@ function Ci({
|
|
|
83
83
|
onChange: (h) => T(h.target.value),
|
|
84
84
|
label: "Name",
|
|
85
85
|
required: !0,
|
|
86
|
-
error:
|
|
86
|
+
error: S && !!s.name
|
|
87
87
|
}
|
|
88
88
|
),
|
|
89
89
|
/* @__PURE__ */ e(J, { error: p.name && !!s.name, children: p.name && s.name ? s.name : "Name of in this collection, usually a plural name (e.g. Products)" })
|
|
90
90
|
] }),
|
|
91
|
-
/* @__PURE__ */ a("div", { className:
|
|
91
|
+
/* @__PURE__ */ a("div", { className: fe("col-span-12 ", B ? "" : "sm:col-span-8"), children: [
|
|
92
92
|
/* @__PURE__ */ e(
|
|
93
93
|
$,
|
|
94
94
|
{
|
|
@@ -97,7 +97,7 @@ function Ci({
|
|
|
97
97
|
label: "Path",
|
|
98
98
|
disabled: !t,
|
|
99
99
|
required: !0,
|
|
100
|
-
error:
|
|
100
|
+
error: S && !!s.path
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
103
|
/* @__PURE__ */ e(J, { error: p.path && !!s.path, children: p.path && s.path ? s.path : B ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database" })
|
|
@@ -106,7 +106,7 @@ function Ci({
|
|
|
106
106
|
/* @__PURE__ */ e(
|
|
107
107
|
we,
|
|
108
108
|
{
|
|
109
|
-
error:
|
|
109
|
+
error: S && !!s.group,
|
|
110
110
|
disabled: g,
|
|
111
111
|
value: c.group ?? "",
|
|
112
112
|
autoComplete: "off",
|
|
@@ -120,12 +120,12 @@ function Ci({
|
|
|
120
120
|
Ar,
|
|
121
121
|
{
|
|
122
122
|
open: N && (C ?? []).length > 0,
|
|
123
|
-
setOpen:
|
|
123
|
+
setOpen: E,
|
|
124
124
|
children: C?.map((h, D) => /* @__PURE__ */ e(
|
|
125
125
|
Dr,
|
|
126
126
|
{
|
|
127
127
|
onClick: () => {
|
|
128
|
-
|
|
128
|
+
E(!1), u("group", h ?? null);
|
|
129
129
|
},
|
|
130
130
|
children: /* @__PURE__ */ e("div", { className: "flex-grow", children: h })
|
|
131
131
|
},
|
|
@@ -133,7 +133,7 @@ function Ci({
|
|
|
133
133
|
))
|
|
134
134
|
}
|
|
135
135
|
),
|
|
136
|
-
/* @__PURE__ */ e(J, { children:
|
|
136
|
+
/* @__PURE__ */ e(J, { children: S && s.group ? s.group : "Group of the collection" })
|
|
137
137
|
] }),
|
|
138
138
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
139
139
|
wt,
|
|
@@ -161,7 +161,7 @@ function Ci({
|
|
|
161
161
|
as: K,
|
|
162
162
|
disabled: !t,
|
|
163
163
|
label: "Collection id",
|
|
164
|
-
error:
|
|
164
|
+
error: S && !!s.id
|
|
165
165
|
}
|
|
166
166
|
),
|
|
167
167
|
/* @__PURE__ */ e(J, { error: p.id && !!s.id, children: p.id && s.id ? s.id : "This id identifies this collection. Typically the same as the path." })
|
|
@@ -170,7 +170,7 @@ function Ci({
|
|
|
170
170
|
/* @__PURE__ */ e(
|
|
171
171
|
we,
|
|
172
172
|
{
|
|
173
|
-
error:
|
|
173
|
+
error: S && !!s.singularName,
|
|
174
174
|
name: "singularName",
|
|
175
175
|
"aria-describedby": "singularName-helper",
|
|
176
176
|
onChange: (h) => (f("singularName", !0), m(h)),
|
|
@@ -178,13 +178,13 @@ function Ci({
|
|
|
178
178
|
label: "Singular name"
|
|
179
179
|
}
|
|
180
180
|
),
|
|
181
|
-
/* @__PURE__ */ e(J, { error:
|
|
181
|
+
/* @__PURE__ */ e(J, { error: S && !!s.singularName, children: S && s.singularName ? s.singularName : "Optionally define a singular name for your entities" })
|
|
182
182
|
] }),
|
|
183
183
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
184
184
|
/* @__PURE__ */ e(
|
|
185
185
|
we,
|
|
186
186
|
{
|
|
187
|
-
error:
|
|
187
|
+
error: S && !!s.sideDialogWidth,
|
|
188
188
|
name: "sideDialogWidth",
|
|
189
189
|
type: "number",
|
|
190
190
|
"aria-describedby": "sideDialogWidth-helper",
|
|
@@ -208,13 +208,13 @@ function Ci({
|
|
|
208
208
|
label: "Side dialog width"
|
|
209
209
|
}
|
|
210
210
|
),
|
|
211
|
-
/* @__PURE__ */ e(J, { error:
|
|
211
|
+
/* @__PURE__ */ e(J, { error: S && !!s.singularName, children: S && s.singularName ? s.singularName : "Optionally define the width (in pixels) of entities side dialog. Default is 768px" })
|
|
212
212
|
] }),
|
|
213
213
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
214
214
|
/* @__PURE__ */ e(
|
|
215
215
|
we,
|
|
216
216
|
{
|
|
217
|
-
error:
|
|
217
|
+
error: S && !!s.description,
|
|
218
218
|
name: "description",
|
|
219
219
|
value: c.description ?? "",
|
|
220
220
|
onChange: m,
|
|
@@ -224,7 +224,7 @@ function Ci({
|
|
|
224
224
|
label: "Description"
|
|
225
225
|
}
|
|
226
226
|
),
|
|
227
|
-
/* @__PURE__ */ e(J, { error:
|
|
227
|
+
/* @__PURE__ */ e(J, { error: S && !!s.description, children: S && s.description ? s.description : "Description of the collection, you can use markdown" })
|
|
228
228
|
] }),
|
|
229
229
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
230
230
|
be,
|
|
@@ -299,7 +299,7 @@ function Ci({
|
|
|
299
299
|
_e,
|
|
300
300
|
{
|
|
301
301
|
open: y,
|
|
302
|
-
onOpenChange:
|
|
302
|
+
onOpenChange: x,
|
|
303
303
|
maxWidth: "xl",
|
|
304
304
|
fullWidth: !0,
|
|
305
305
|
children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
|
|
@@ -307,7 +307,7 @@ function Ci({
|
|
|
307
307
|
{
|
|
308
308
|
selectedIcon: c.icon,
|
|
309
309
|
onIconSelected: (h) => {
|
|
310
|
-
|
|
310
|
+
x(!1), u("icon", h);
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
) })
|
|
@@ -321,7 +321,7 @@ function me(t) {
|
|
|
321
321
|
function ir(t) {
|
|
322
322
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function he(t) {
|
|
325
325
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".propertiesOrder" : "propertiesOrder";
|
|
326
326
|
}
|
|
327
327
|
function ne(t, r) {
|
|
@@ -345,8 +345,8 @@ function Ni({
|
|
|
345
345
|
validateOnChange: !0,
|
|
346
346
|
validation: (p) => {
|
|
347
347
|
const s = {};
|
|
348
|
-
p.enumValues && p.enumValues.forEach((g,
|
|
349
|
-
g?.label || (s.enumValues = s.enumValues ?? [], s.enumValues[
|
|
348
|
+
p.enumValues && p.enumValues.forEach((g, P) => {
|
|
349
|
+
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");
|
|
350
350
|
});
|
|
351
351
|
const f = !!(s?.enumValues && Object.keys(s?.enumValues).length > 0);
|
|
352
352
|
return n?.(f), s;
|
|
@@ -355,7 +355,7 @@ function Ni({
|
|
|
355
355
|
return ce(() => {
|
|
356
356
|
r && r(u.enumValues);
|
|
357
357
|
}, [u.enumValues]), /* @__PURE__ */ e(Ot, { value: c, children: /* @__PURE__ */ e(
|
|
358
|
-
|
|
358
|
+
xi,
|
|
359
359
|
{
|
|
360
360
|
enumValuesPath: "enumValues",
|
|
361
361
|
values: u,
|
|
@@ -367,7 +367,7 @@ function Ni({
|
|
|
367
367
|
}
|
|
368
368
|
) });
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function xi({
|
|
371
371
|
values: t,
|
|
372
372
|
errors: r,
|
|
373
373
|
disabled: n,
|
|
@@ -378,10 +378,10 @@ function Pi({
|
|
|
378
378
|
}) {
|
|
379
379
|
const {
|
|
380
380
|
setFieldValue: c
|
|
381
|
-
} = Y(), [u, m] = G.useState(), [p, s] = G.useState(), [f, g] = G.useState(!1), y = G.useRef(/* @__PURE__ */ new Set()).current,
|
|
381
|
+
} = Y(), [u, m] = G.useState(), [p, s] = G.useState(), [f, g] = G.useState(!1), y = G.useRef(/* @__PURE__ */ new Set()).current, x = (b, T) => {
|
|
382
382
|
const w = u === T, C = r?.enumValues && r?.enumValues[b];
|
|
383
383
|
return /* @__PURE__ */ e(
|
|
384
|
-
|
|
384
|
+
Pi,
|
|
385
385
|
{
|
|
386
386
|
index: b,
|
|
387
387
|
disabled: n,
|
|
@@ -417,9 +417,9 @@ function Pi({
|
|
|
417
417
|
d && (g(!0), d?.().then((b) => {
|
|
418
418
|
if (!b)
|
|
419
419
|
return;
|
|
420
|
-
const T = b.flat(), w = Array.from(new Set(T)), C = t.enumValues, N = ii(w).filter((
|
|
421
|
-
N.forEach((
|
|
422
|
-
y.add(
|
|
420
|
+
const T = b.flat(), w = Array.from(new Set(T)), C = t.enumValues, N = ii(w).filter((E) => !C?.some((B) => B.id === E.id));
|
|
421
|
+
N.forEach((E) => {
|
|
422
|
+
y.add(E.id);
|
|
423
423
|
}), c(i, [...N, ...C], !0);
|
|
424
424
|
}).catch((b) => {
|
|
425
425
|
console.error(b);
|
|
@@ -432,7 +432,7 @@ function Pi({
|
|
|
432
432
|
}
|
|
433
433
|
)
|
|
434
434
|
] }),
|
|
435
|
-
/* @__PURE__ */ a(
|
|
435
|
+
/* @__PURE__ */ a(ge, { className: "p-4 m-1", children: [
|
|
436
436
|
/* @__PURE__ */ e(
|
|
437
437
|
br,
|
|
438
438
|
{
|
|
@@ -441,7 +441,7 @@ function Pi({
|
|
|
441
441
|
value: t.enumValues,
|
|
442
442
|
disabled: n,
|
|
443
443
|
size: "small",
|
|
444
|
-
buildEntry:
|
|
444
|
+
buildEntry: x,
|
|
445
445
|
onInternalIdAdded: m,
|
|
446
446
|
includeAddButton: !0,
|
|
447
447
|
onValueChange: (b) => c(i, b),
|
|
@@ -460,7 +460,7 @@ function Pi({
|
|
|
460
460
|
] })
|
|
461
461
|
] });
|
|
462
462
|
}
|
|
463
|
-
const
|
|
463
|
+
const Pi = G.memo(
|
|
464
464
|
function({
|
|
465
465
|
index: r,
|
|
466
466
|
shouldUpdateId: n,
|
|
@@ -477,9 +477,9 @@ const xi = G.memo(
|
|
|
477
477
|
errors: s,
|
|
478
478
|
setFieldValue: f,
|
|
479
479
|
touched: g
|
|
480
|
-
} = Y(),
|
|
480
|
+
} = Y(), P = G.useRef(!I(m, `${i}[${r}].id`)), y = n || P.current, x = I(m, `${i}[${r}].id`), v = I(m, `${i}[${r}].label`), b = G.useRef(v);
|
|
481
481
|
return G.useEffect(() => {
|
|
482
|
-
(b.current ===
|
|
482
|
+
(b.current === x || !x) && y && f(`${i}[${r}].id`, v), b.current = v;
|
|
483
483
|
}, [v]), /* @__PURE__ */ a(R, { children: [
|
|
484
484
|
/* @__PURE__ */ a("div", { className: "flex w-full align-center justify-center", children: [
|
|
485
485
|
/* @__PURE__ */ e(
|
|
@@ -527,7 +527,7 @@ const xi = G.memo(
|
|
|
527
527
|
] });
|
|
528
528
|
},
|
|
529
529
|
function(r, n) {
|
|
530
|
-
return r.index === n.index && r.enumValuesPath === n.enumValuesPath && r.shouldUpdateId === n.shouldUpdateId && r.inferredEntry === n.inferredEntry &&
|
|
530
|
+
return r.index === n.index && r.enumValuesPath === n.enumValuesPath && r.shouldUpdateId === n.shouldUpdateId && r.inferredEntry === n.inferredEntry && ye(r.entryError, n.entryError) && r.autoFocus === n.autoFocus;
|
|
531
531
|
}
|
|
532
532
|
);
|
|
533
533
|
function wi({
|
|
@@ -670,7 +670,7 @@ function Ee({
|
|
|
670
670
|
values: m,
|
|
671
671
|
handleChange: p,
|
|
672
672
|
errors: s
|
|
673
|
-
} = Y(), f = "validation.length", g = "validation.min",
|
|
673
|
+
} = Y(), 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 : Cr(w);
|
|
674
674
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
675
675
|
/* @__PURE__ */ e(Fe, { disabled: c }),
|
|
676
676
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
@@ -751,9 +751,9 @@ function Ee({
|
|
|
751
751
|
i && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
752
752
|
K,
|
|
753
753
|
{
|
|
754
|
-
value: I(m,
|
|
754
|
+
value: I(m, P),
|
|
755
755
|
label: "Max length",
|
|
756
|
-
name:
|
|
756
|
+
name: P,
|
|
757
757
|
type: "number",
|
|
758
758
|
size: "small",
|
|
759
759
|
disabled: c,
|
|
@@ -765,7 +765,7 @@ function Ee({
|
|
|
765
765
|
/* @__PURE__ */ e(
|
|
766
766
|
$,
|
|
767
767
|
{
|
|
768
|
-
name:
|
|
768
|
+
name: x,
|
|
769
769
|
as: K,
|
|
770
770
|
label: "Matches regex",
|
|
771
771
|
size: "small",
|
|
@@ -863,11 +863,11 @@ function Rt({
|
|
|
863
863
|
onError: (y) => {
|
|
864
864
|
c(p, y ? "This enum property is missing some values" : void 0);
|
|
865
865
|
},
|
|
866
|
-
getData: o ? () => o().then((y) => y.map((
|
|
866
|
+
getData: o ? () => o().then((y) => y.map((x) => d.id && I(x, d.id)).filter(Boolean)) : void 0,
|
|
867
867
|
onValuesChanged: (y) => {
|
|
868
868
|
if (d && (u(p, y), !t)) {
|
|
869
|
-
const
|
|
870
|
-
s && !
|
|
869
|
+
const x = y.filter((v) => !!v?.id).map((v) => v.id);
|
|
870
|
+
s && !x.includes(s) && (u("defaultValue", void 0), m.open({
|
|
871
871
|
type: "warning",
|
|
872
872
|
message: "Default value was cleared"
|
|
873
873
|
}));
|
|
@@ -922,9 +922,9 @@ function Ut({
|
|
|
922
922
|
const {
|
|
923
923
|
values: i,
|
|
924
924
|
setFieldValue: l
|
|
925
|
-
} = Y(), 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,
|
|
926
|
-
b ? b.includes("all") || b.length >= Object.keys(at).length ? l(d, void 0) :
|
|
927
|
-
},
|
|
925
|
+
} = Y(), 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) => {
|
|
926
|
+
b ? b.includes("all") || b.length >= Object.keys(at).length ? l(d, void 0) : P ? l(d, Object.keys(at).filter((T) => !b.includes(T))) : l(d, b) : l(d, void 0);
|
|
927
|
+
}, x = typeof p == "function", v = typeof s == "function";
|
|
928
928
|
return /* @__PURE__ */ a(R, { children: [
|
|
929
929
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
930
930
|
wt,
|
|
@@ -948,7 +948,7 @@ function Ut({
|
|
|
948
948
|
name: d,
|
|
949
949
|
value: g ?? [],
|
|
950
950
|
onMultiValueChange: y,
|
|
951
|
-
label:
|
|
951
|
+
label: P ? void 0 : "Allowed file types",
|
|
952
952
|
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((T) => at[T]).filter((T) => !!T).join(", "),
|
|
953
953
|
children: [
|
|
954
954
|
/* @__PURE__ */ a(Et, { value: "all", className: "flex items-center gap-2", children: [
|
|
@@ -964,7 +964,7 @@ function Ut({
|
|
|
964
964
|
/* @__PURE__ */ e(
|
|
965
965
|
St,
|
|
966
966
|
{
|
|
967
|
-
checked:
|
|
967
|
+
checked: P || g.indexOf(b) > -1
|
|
968
968
|
}
|
|
969
969
|
),
|
|
970
970
|
/* @__PURE__ */ e("div", { className: "flex-grow", children: T }),
|
|
@@ -988,8 +988,8 @@ function Ut({
|
|
|
988
988
|
as: K,
|
|
989
989
|
label: "File name",
|
|
990
990
|
size: "small",
|
|
991
|
-
disabled:
|
|
992
|
-
value:
|
|
991
|
+
disabled: x || n,
|
|
992
|
+
value: x ? "-" : p
|
|
993
993
|
}
|
|
994
994
|
) }),
|
|
995
995
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -1082,9 +1082,9 @@ function ar({
|
|
|
1082
1082
|
children: [
|
|
1083
1083
|
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(qe, { propertyConfig: c }) }),
|
|
1084
1084
|
/* @__PURE__ */ a(
|
|
1085
|
-
|
|
1085
|
+
ge,
|
|
1086
1086
|
{
|
|
1087
|
-
className:
|
|
1087
|
+
className: fe(
|
|
1088
1088
|
"border",
|
|
1089
1089
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1090
1090
|
Qt,
|
|
@@ -1159,9 +1159,9 @@ function ki({
|
|
|
1159
1159
|
/* @__PURE__ */ e(Lr, { color: "disabled", size: "small", className: "absolute -right-2 -top-2" })
|
|
1160
1160
|
] }),
|
|
1161
1161
|
/* @__PURE__ */ e(
|
|
1162
|
-
|
|
1162
|
+
ge,
|
|
1163
1163
|
{
|
|
1164
|
-
className:
|
|
1164
|
+
className: fe(
|
|
1165
1165
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1166
1166
|
Qt,
|
|
1167
1167
|
n ? Xt : "",
|
|
@@ -1244,9 +1244,9 @@ const ft = G.memo(
|
|
|
1244
1244
|
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(oi, { onDragEnd: (y) => {
|
|
1245
1245
|
if (!y.destination)
|
|
1246
1246
|
return;
|
|
1247
|
-
const
|
|
1247
|
+
const x = y.source.index, v = y.destination.index, b = Array.from(g), [T] = b.splice(x, 1);
|
|
1248
1248
|
b.splice(v, 0, T), u && u(b, r);
|
|
1249
|
-
}, children: /* @__PURE__ */ e(li, { droppableId: `droppable_${r}`, children: (y,
|
|
1249
|
+
}, children: /* @__PURE__ */ e(li, { droppableId: `droppable_${r}`, children: (y, x) => /* @__PURE__ */ a(
|
|
1250
1250
|
"div",
|
|
1251
1251
|
{
|
|
1252
1252
|
...y.droppableProps,
|
|
@@ -1288,7 +1288,7 @@ const ft = G.memo(
|
|
|
1288
1288
|
},
|
|
1289
1289
|
(t, r) => {
|
|
1290
1290
|
const n = r.selectedPropertyKey?.startsWith(r.namespace ?? ""), i = t.selectedPropertyKey?.startsWith(t.namespace ?? "");
|
|
1291
|
-
return n || i ? !1 :
|
|
1291
|
+
return n || i ? !1 : ye(t.properties, r.properties) && t.propertiesOrder === r.propertiesOrder && ye(t.additionalFields, r.additionalFields) && ye(t.errors, r.errors) && ye(t.onPropertyClick, r.onPropertyClick) && // equal(prevProps.onPropertyMove, nextProps.onPropertyMove) &&
|
|
1292
1292
|
// equal(prevProps.onPropertyRemove, nextProps.onPropertyRemove) &&
|
|
1293
1293
|
t.namespace === r.namespace && t.collectionEditable === r.collectionEditable;
|
|
1294
1294
|
}
|
|
@@ -1308,10 +1308,10 @@ function Oi({
|
|
|
1308
1308
|
collectionEditable: s
|
|
1309
1309
|
}) {
|
|
1310
1310
|
const f = p?.includes(r ? `${r}.${t}` : t), g = ne(t, r), y = nr(t, r) in d;
|
|
1311
|
-
let
|
|
1311
|
+
let x;
|
|
1312
1312
|
if (typeof n == "object") {
|
|
1313
1313
|
const T = n;
|
|
1314
|
-
T.dataType === "map" && T.properties && (
|
|
1314
|
+
T.dataType === "map" && T.properties && (x = /* @__PURE__ */ e(
|
|
1315
1315
|
ft,
|
|
1316
1316
|
{
|
|
1317
1317
|
selectedPropertyKey: o,
|
|
@@ -1335,7 +1335,7 @@ function Oi({
|
|
|
1335
1335
|
...l.dragHandleProps,
|
|
1336
1336
|
className: "relative -ml-8",
|
|
1337
1337
|
children: [
|
|
1338
|
-
|
|
1338
|
+
x && /* @__PURE__ */ e(
|
|
1339
1339
|
"div",
|
|
1340
1340
|
{
|
|
1341
1341
|
className: "absolute border-l " + Tt,
|
|
@@ -1384,7 +1384,7 @@ function Oi({
|
|
|
1384
1384
|
}
|
|
1385
1385
|
) })
|
|
1386
1386
|
] }),
|
|
1387
|
-
|
|
1387
|
+
x && /* @__PURE__ */ e("div", { className: "ml-16", children: x })
|
|
1388
1388
|
]
|
|
1389
1389
|
}
|
|
1390
1390
|
);
|
|
@@ -1393,7 +1393,7 @@ function Vi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1393
1393
|
const {
|
|
1394
1394
|
values: o,
|
|
1395
1395
|
setFieldValue: d
|
|
1396
|
-
} = Y(), [c, u] = j(!1), [m, p] = j(), [s, f] = j(), g = o.propertiesOrder ?? Object.keys(o.properties ?? {}),
|
|
1396
|
+
} = Y(), [c, u] = j(!1), [m, p] = j(), [s, f] = j(), g = o.propertiesOrder ?? Object.keys(o.properties ?? {}), P = ({
|
|
1397
1397
|
id: w,
|
|
1398
1398
|
property: C
|
|
1399
1399
|
}) => {
|
|
@@ -1409,10 +1409,10 @@ function Vi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1409
1409
|
const O = w ? ne(w, C) : void 0;
|
|
1410
1410
|
if (!O)
|
|
1411
1411
|
throw Error("collection editor miss config");
|
|
1412
|
-
const N = me(O),
|
|
1413
|
-
d(N, void 0, !1), d(
|
|
1414
|
-
},
|
|
1415
|
-
d(
|
|
1412
|
+
const N = me(O), E = he(C), B = I(o, E) ?? Object.keys(I(o, ir(C)));
|
|
1413
|
+
d(N, void 0, !1), d(E, B.filter((_) => _ !== w), !1), u(!1), p(void 0), f(void 0);
|
|
1414
|
+
}, x = m ? ne(m, s) : void 0, v = x ? I(o.properties, x.replaceAll(".", ".properties.")) : void 0, b = !g || g.length < 1, T = (w, C) => {
|
|
1415
|
+
d(he(C), w, !1);
|
|
1416
1416
|
};
|
|
1417
1417
|
return /* @__PURE__ */ a(R, { children: [
|
|
1418
1418
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -1432,7 +1432,7 @@ function Vi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1432
1432
|
}
|
|
1433
1433
|
)
|
|
1434
1434
|
] }),
|
|
1435
|
-
/* @__PURE__ */ a(
|
|
1435
|
+
/* @__PURE__ */ a(ge, { className: "p-2 pl-8", children: [
|
|
1436
1436
|
/* @__PURE__ */ e(
|
|
1437
1437
|
ft,
|
|
1438
1438
|
{
|
|
@@ -1491,7 +1491,7 @@ function Vi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1491
1491
|
existingProperty: !!m,
|
|
1492
1492
|
autoUpdateId: !m,
|
|
1493
1493
|
autoOpenTypeSelect: !m,
|
|
1494
|
-
onPropertyChanged:
|
|
1494
|
+
onPropertyChanged: P,
|
|
1495
1495
|
existingPropertyKeys: m ? void 0 : g,
|
|
1496
1496
|
propertyConfigs: i
|
|
1497
1497
|
}
|
|
@@ -1513,9 +1513,9 @@ function Ii({
|
|
|
1513
1513
|
errors: m,
|
|
1514
1514
|
setFieldValue: p,
|
|
1515
1515
|
touched: s
|
|
1516
|
-
} = Y(), [f, g] = j(!1),
|
|
1517
|
-
|
|
1518
|
-
}, v =
|
|
1516
|
+
} = Y(), [f, g] = j(!1), P = I(c, "of"), y = I(s, "of") && I(m, "of"), x = ({ id: b, property: T, namespace: w }) => {
|
|
1517
|
+
p("of", T);
|
|
1518
|
+
}, v = P && je(P, o);
|
|
1519
1519
|
return /* @__PURE__ */ a(R, { children: [
|
|
1520
1520
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1521
1521
|
/* @__PURE__ */ e(V, { variant: "subtitle2", children: "Repeat component" }),
|
|
@@ -1523,12 +1523,12 @@ function Ii({
|
|
|
1523
1523
|
$,
|
|
1524
1524
|
{
|
|
1525
1525
|
name: "of",
|
|
1526
|
-
value:
|
|
1527
|
-
children: ({}) => /* @__PURE__ */ a(
|
|
1528
|
-
|
|
1526
|
+
value: P,
|
|
1527
|
+
children: ({}) => /* @__PURE__ */ a(ge, { className: "p-2 mt-4", children: [
|
|
1528
|
+
P && /* @__PURE__ */ e(
|
|
1529
1529
|
ar,
|
|
1530
1530
|
{
|
|
1531
|
-
property:
|
|
1531
|
+
property: P,
|
|
1532
1532
|
onClick: n ? void 0 : () => g(!0),
|
|
1533
1533
|
includeName: !1,
|
|
1534
1534
|
includeEditButton: !0,
|
|
@@ -1536,7 +1536,7 @@ function Ii({
|
|
|
1536
1536
|
hasError: !1
|
|
1537
1537
|
}
|
|
1538
1538
|
),
|
|
1539
|
-
!n && !
|
|
1539
|
+
!n && !P && /* @__PURE__ */ a(
|
|
1540
1540
|
z,
|
|
1541
1541
|
{
|
|
1542
1542
|
variant: "text",
|
|
@@ -1560,9 +1560,9 @@ function Ii({
|
|
|
1560
1560
|
autoOpenTypeSelect: !r,
|
|
1561
1561
|
onOkClicked: () => g(!1),
|
|
1562
1562
|
allowDataInference: l,
|
|
1563
|
-
property:
|
|
1563
|
+
property: P,
|
|
1564
1564
|
includeIdAndName: !1,
|
|
1565
|
-
onPropertyChanged:
|
|
1565
|
+
onPropertyChanged: x,
|
|
1566
1566
|
forceShowErrors: t,
|
|
1567
1567
|
propertyConfigs: o,
|
|
1568
1568
|
collectionEditable: d
|
|
@@ -1590,7 +1590,7 @@ const _i = G.forwardRef(
|
|
|
1590
1590
|
setFieldTouched: p,
|
|
1591
1591
|
touched: s,
|
|
1592
1592
|
validate: f
|
|
1593
|
-
} = Y(), g = "name",
|
|
1593
|
+
} = Y(), g = "name", P = r && I(c, g), y = "id", x = r && I(c, y), v = "description", b = r && I(c, v);
|
|
1594
1594
|
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
1595
1595
|
/* @__PURE__ */ a("div", { children: [
|
|
1596
1596
|
/* @__PURE__ */ e(
|
|
@@ -1608,10 +1608,10 @@ const _i = G.forwardRef(
|
|
|
1608
1608
|
placeholder: "Field name",
|
|
1609
1609
|
required: !0,
|
|
1610
1610
|
disabled: i,
|
|
1611
|
-
error: !!
|
|
1611
|
+
error: !!P
|
|
1612
1612
|
}
|
|
1613
1613
|
),
|
|
1614
|
-
/* @__PURE__ */ e(J, { error: !!
|
|
1614
|
+
/* @__PURE__ */ e(J, { error: !!P, children: P })
|
|
1615
1615
|
] }),
|
|
1616
1616
|
/* @__PURE__ */ a("div", { children: [
|
|
1617
1617
|
/* @__PURE__ */ e(
|
|
@@ -1623,15 +1623,15 @@ const _i = G.forwardRef(
|
|
|
1623
1623
|
value: u[y],
|
|
1624
1624
|
onChange: (T) => {
|
|
1625
1625
|
const w = T.target.value;
|
|
1626
|
-
!I(s, g) && l && m(g, w ?
|
|
1626
|
+
!I(s, g) && l && m(g, w ? Pt(w) : ""), m(y, w, !0), p(y, !0);
|
|
1627
1627
|
},
|
|
1628
1628
|
disabled: n || i,
|
|
1629
1629
|
required: !0,
|
|
1630
1630
|
size: "small",
|
|
1631
|
-
error: !!
|
|
1631
|
+
error: !!x
|
|
1632
1632
|
}
|
|
1633
1633
|
),
|
|
1634
|
-
/* @__PURE__ */ e(J, { error: !!
|
|
1634
|
+
/* @__PURE__ */ e(J, { error: !!x, children: x })
|
|
1635
1635
|
] }),
|
|
1636
1636
|
/* @__PURE__ */ a("div", { children: [
|
|
1637
1637
|
/* @__PURE__ */ e(
|
|
@@ -1766,13 +1766,13 @@ function Si({
|
|
|
1766
1766
|
}, !1);
|
|
1767
1767
|
const C = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), O = C.includes(T) ? C : [...C, T];
|
|
1768
1768
|
d("oneOf.propertiesOrder", O, !1), u(!1);
|
|
1769
|
-
},
|
|
1769
|
+
}, P = m ? ne(m, s) : void 0, y = P ? I(o.oneOf?.properties, P.replaceAll(".", ".properties.")) : void 0, x = (T, w) => {
|
|
1770
1770
|
const C = T ? ne(T, w) : void 0;
|
|
1771
1771
|
if (!C)
|
|
1772
1772
|
throw Error("collection editor miss config");
|
|
1773
1773
|
d(`oneOf.${me(C)}`, void 0, !1);
|
|
1774
|
-
const O = `oneOf.${
|
|
1775
|
-
d(O, N.filter((
|
|
1774
|
+
const O = `oneOf.${he(w)}`, N = I(o, O) ?? Object.keys(I(o, ir(w)));
|
|
1775
|
+
d(O, N.filter((E) => E !== T), !1), u(!1), p(void 0), f(void 0);
|
|
1776
1776
|
}, v = /* @__PURE__ */ a(
|
|
1777
1777
|
z,
|
|
1778
1778
|
{
|
|
@@ -1786,7 +1786,7 @@ function Si({
|
|
|
1786
1786
|
]
|
|
1787
1787
|
}
|
|
1788
1788
|
), b = (T, w) => {
|
|
1789
|
-
d(`oneOf.${
|
|
1789
|
+
d(`oneOf.${he(w)}`, T, !1);
|
|
1790
1790
|
};
|
|
1791
1791
|
return /* @__PURE__ */ a(R, { children: [
|
|
1792
1792
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -1794,7 +1794,7 @@ function Si({
|
|
|
1794
1794
|
/* @__PURE__ */ e(V, { variant: "subtitle2", children: "Properties in this block" }),
|
|
1795
1795
|
v
|
|
1796
1796
|
] }),
|
|
1797
|
-
/* @__PURE__ */ a(
|
|
1797
|
+
/* @__PURE__ */ a(ge, { className: "p-2 pl-8", children: [
|
|
1798
1798
|
/* @__PURE__ */ e(
|
|
1799
1799
|
ft,
|
|
1800
1800
|
{
|
|
@@ -1826,7 +1826,7 @@ function Si({
|
|
|
1826
1826
|
u(!1), p(void 0), f(void 0);
|
|
1827
1827
|
},
|
|
1828
1828
|
collectionEditable: l,
|
|
1829
|
-
onDelete:
|
|
1829
|
+
onDelete: x,
|
|
1830
1830
|
propertyKey: m,
|
|
1831
1831
|
propertyNamespace: s,
|
|
1832
1832
|
property: y,
|
|
@@ -2404,7 +2404,7 @@ function lr({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
|
2404
2404
|
children: /* @__PURE__ */ a(
|
|
2405
2405
|
"div",
|
|
2406
2406
|
{
|
|
2407
|
-
className:
|
|
2407
|
+
className: fe(
|
|
2408
2408
|
"flex flex-row items-center text-base min-h-[52px]",
|
|
2409
2409
|
r ? "w-full" : ""
|
|
2410
2410
|
),
|
|
@@ -2524,9 +2524,9 @@ const ji = [
|
|
|
2524
2524
|
onPropertyChanged: s,
|
|
2525
2525
|
onPropertyChangedImmediate: f = !0,
|
|
2526
2526
|
onDelete: g,
|
|
2527
|
-
onError:
|
|
2527
|
+
onError: P,
|
|
2528
2528
|
initialErrors: y,
|
|
2529
|
-
forceShowErrors:
|
|
2529
|
+
forceShowErrors: x,
|
|
2530
2530
|
allowDataInference: v,
|
|
2531
2531
|
getController: b,
|
|
2532
2532
|
getData: T,
|
|
@@ -2535,56 +2535,56 @@ const ji = [
|
|
|
2535
2535
|
} = r, O = {
|
|
2536
2536
|
id: "",
|
|
2537
2537
|
name: ""
|
|
2538
|
-
}, N = !!(p && !Ue(p)) && !C,
|
|
2538
|
+
}, N = !!(p && !Ue(p)) && !C, E = Re(p ? {
|
|
2539
2539
|
id: c,
|
|
2540
2540
|
previousId: c,
|
|
2541
2541
|
property: p
|
|
2542
2542
|
} : void 0), B = ({
|
|
2543
|
-
id:
|
|
2543
|
+
id: S,
|
|
2544
2544
|
property: h
|
|
2545
2545
|
}) => {
|
|
2546
2546
|
const D = {
|
|
2547
|
-
id:
|
|
2548
|
-
previousId:
|
|
2547
|
+
id: S,
|
|
2548
|
+
previousId: E.current?.id,
|
|
2549
2549
|
property: h,
|
|
2550
2550
|
namespace: m
|
|
2551
2551
|
};
|
|
2552
|
-
|
|
2552
|
+
E.current = D, s?.(D);
|
|
2553
2553
|
}, _ = kt({
|
|
2554
2554
|
initialValues: p ? { id: c, ...p } : O,
|
|
2555
2555
|
initialErrors: y,
|
|
2556
2556
|
validateOnChange: !0,
|
|
2557
2557
|
validateOnInitialRender: !0,
|
|
2558
|
-
onSubmit: (
|
|
2559
|
-
console.debug("onSubmit",
|
|
2558
|
+
onSubmit: (S, h) => {
|
|
2559
|
+
console.debug("onSubmit", S);
|
|
2560
2560
|
const {
|
|
2561
2561
|
id: D,
|
|
2562
2562
|
...ae
|
|
2563
|
-
} =
|
|
2563
|
+
} = S;
|
|
2564
2564
|
B({
|
|
2565
2565
|
id: D,
|
|
2566
2566
|
property: { ...ae, editable: ae.editable ?? !0 }
|
|
2567
2567
|
}), l || h.resetForm({ values: O });
|
|
2568
2568
|
},
|
|
2569
|
-
validation: (
|
|
2569
|
+
validation: (S) => {
|
|
2570
2570
|
const h = {};
|
|
2571
2571
|
if (n) {
|
|
2572
|
-
if (!
|
|
2572
|
+
if (!S.name)
|
|
2573
2573
|
h.name = "Required";
|
|
2574
2574
|
else {
|
|
2575
|
-
const D = Hi(
|
|
2575
|
+
const D = Hi(S.name);
|
|
2576
2576
|
D && (h.name = D);
|
|
2577
2577
|
}
|
|
2578
|
-
if (!
|
|
2578
|
+
if (!S.id)
|
|
2579
2579
|
h.id = "Required";
|
|
2580
2580
|
else {
|
|
2581
|
-
const D = $i(
|
|
2581
|
+
const D = $i(S.id, u);
|
|
2582
2582
|
D && (h.id = D);
|
|
2583
2583
|
}
|
|
2584
2584
|
}
|
|
2585
|
-
return
|
|
2585
|
+
return S.dataType === "string" && S.validation?.matches && !xr(S.validation?.matches.toString()) && (h.validation = {
|
|
2586
2586
|
matches: "Invalid regular expression"
|
|
2587
|
-
}),
|
|
2587
|
+
}), 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;
|
|
2588
2588
|
}
|
|
2589
2589
|
});
|
|
2590
2590
|
return ce(() => {
|
|
@@ -2596,8 +2596,8 @@ const ji = [
|
|
|
2596
2596
|
onDelete: g,
|
|
2597
2597
|
includeIdAndTitle: n,
|
|
2598
2598
|
propertyNamespace: m,
|
|
2599
|
-
onError:
|
|
2600
|
-
showErrors:
|
|
2599
|
+
onError: P,
|
|
2600
|
+
showErrors: x || _.submitCount > 0,
|
|
2601
2601
|
existing: l,
|
|
2602
2602
|
autoUpdateId: o,
|
|
2603
2603
|
inArray: d,
|
|
@@ -2695,19 +2695,19 @@ function qi({
|
|
|
2695
2695
|
showErrors: s,
|
|
2696
2696
|
disabled: f,
|
|
2697
2697
|
inArray: g,
|
|
2698
|
-
getData:
|
|
2698
|
+
getData: P,
|
|
2699
2699
|
allowDataInference: y,
|
|
2700
|
-
propertyConfigs:
|
|
2700
|
+
propertyConfigs: x,
|
|
2701
2701
|
collectionEditable: v
|
|
2702
2702
|
}) {
|
|
2703
|
-
const [b, T] = j(o), [w, C] = j(!1), [O, N] = j(t?.dataType ? Gt(t) : void 0),
|
|
2703
|
+
const [b, T] = j(o), [w, C] = j(!1), [O, N] = j(t?.dataType ? Gt(t) : void 0), E = Object.entries(sr).concat(Object.entries(x)), B = g ? E.filter(([Z, H]) => !re(H.property) && H.property?.dataType !== "array") : E, _ = Fr(t), S = Re(null), h = Re(t), D = s && I(r, "selectedWidget");
|
|
2704
2704
|
ce(() => {
|
|
2705
2705
|
if (c && (!d || _.id)) {
|
|
2706
2706
|
const {
|
|
2707
2707
|
id: Z,
|
|
2708
2708
|
...H
|
|
2709
2709
|
} = _;
|
|
2710
|
-
|
|
2710
|
+
ye(_, h.current) || (c({
|
|
2711
2711
|
id: Z,
|
|
2712
2712
|
property: H,
|
|
2713
2713
|
namespace: m
|
|
@@ -2717,8 +2717,8 @@ function qi({
|
|
|
2717
2717
|
t?.id && p && p(t?.id, m, r);
|
|
2718
2718
|
}, [r, m, t?.id]);
|
|
2719
2719
|
const ae = (Z) => {
|
|
2720
|
-
N(Z), n(or(t, Z,
|
|
2721
|
-
|
|
2720
|
+
N(Z), n(or(t, Z, x)), setTimeout(() => {
|
|
2721
|
+
S.current?.focus();
|
|
2722
2722
|
}, 0);
|
|
2723
2723
|
};
|
|
2724
2724
|
let q;
|
|
@@ -2742,7 +2742,7 @@ function qi({
|
|
|
2742
2742
|
allowDataInference: y,
|
|
2743
2743
|
updateIds: !i,
|
|
2744
2744
|
disabled: f,
|
|
2745
|
-
getData:
|
|
2745
|
+
getData: P,
|
|
2746
2746
|
showErrors: s
|
|
2747
2747
|
}
|
|
2748
2748
|
) : O === "multi_select" || O === "multi_number_select" ? q = /* @__PURE__ */ e(
|
|
@@ -2752,7 +2752,7 @@ function qi({
|
|
|
2752
2752
|
updateIds: !i,
|
|
2753
2753
|
disabled: f,
|
|
2754
2754
|
allowDataInference: y,
|
|
2755
|
-
getData:
|
|
2755
|
+
getData: P,
|
|
2756
2756
|
showErrors: s
|
|
2757
2757
|
}
|
|
2758
2758
|
) : O === "file_upload" ? q = /* @__PURE__ */ e(
|
|
@@ -2773,19 +2773,19 @@ function qi({
|
|
|
2773
2773
|
Vi,
|
|
2774
2774
|
{
|
|
2775
2775
|
disabled: f,
|
|
2776
|
-
getData:
|
|
2776
|
+
getData: P,
|
|
2777
2777
|
allowDataInference: y,
|
|
2778
2778
|
collectionEditable: v,
|
|
2779
|
-
propertyConfigs:
|
|
2779
|
+
propertyConfigs: x
|
|
2780
2780
|
}
|
|
2781
2781
|
) : O === "block" ? q = /* @__PURE__ */ e(
|
|
2782
2782
|
Si,
|
|
2783
2783
|
{
|
|
2784
2784
|
disabled: f,
|
|
2785
|
-
getData:
|
|
2785
|
+
getData: P,
|
|
2786
2786
|
allowDataInference: y,
|
|
2787
2787
|
collectionEditable: v,
|
|
2788
|
-
propertyConfigs:
|
|
2788
|
+
propertyConfigs: x
|
|
2789
2789
|
}
|
|
2790
2790
|
) : O === "reference" ? q = /* @__PURE__ */ e(
|
|
2791
2791
|
jt,
|
|
@@ -2808,11 +2808,11 @@ function qi({
|
|
|
2808
2808
|
{
|
|
2809
2809
|
showErrors: s,
|
|
2810
2810
|
existing: i,
|
|
2811
|
-
getData:
|
|
2811
|
+
getData: P,
|
|
2812
2812
|
allowDataInference: y,
|
|
2813
2813
|
disabled: f,
|
|
2814
2814
|
collectionEditable: v,
|
|
2815
|
-
propertyConfigs:
|
|
2815
|
+
propertyConfigs: x
|
|
2816
2816
|
}
|
|
2817
2817
|
) : O === "key_value" ? q = /* @__PURE__ */ e(Ri, { disabled: f }) : q = null, /* @__PURE__ */ a(R, { children: [
|
|
2818
2818
|
f && /* @__PURE__ */ a(Yr, { mode: "warn", children: [
|
|
@@ -2838,16 +2838,16 @@ function qi({
|
|
|
2838
2838
|
renderValue: (Z) => {
|
|
2839
2839
|
if (!Z)
|
|
2840
2840
|
return /* @__PURE__ */ e("em", { children: "Select a property widget" });
|
|
2841
|
-
const H = Z, Q = Wt[H] ??
|
|
2841
|
+
const H = Z, Q = Wt[H] ?? x[H], le = Q.property, Be = le && !re(le) ? je(le, x) : void 0, xe = re(le) || i && le.dataType !== t?.dataType, se = Be ? W(Be, Q) : Q;
|
|
2842
2842
|
return /* @__PURE__ */ a(
|
|
2843
2843
|
"div",
|
|
2844
2844
|
{
|
|
2845
2845
|
onClick: (te) => {
|
|
2846
|
-
|
|
2846
|
+
xe && (te.stopPropagation(), te.preventDefault());
|
|
2847
2847
|
},
|
|
2848
|
-
className:
|
|
2848
|
+
className: fe(
|
|
2849
2849
|
"flex items-center",
|
|
2850
|
-
|
|
2850
|
+
xe ? "w-full pointer-events-none opacity-50" : ""
|
|
2851
2851
|
),
|
|
2852
2852
|
children: [
|
|
2853
2853
|
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(qe, { propertyConfig: se }) }),
|
|
@@ -2858,7 +2858,7 @@ function qi({
|
|
|
2858
2858
|
{
|
|
2859
2859
|
variant: "caption",
|
|
2860
2860
|
color: "disabled",
|
|
2861
|
-
children:
|
|
2861
|
+
children: xe ? "You can only switch to widgets that use the same data type" : se.description
|
|
2862
2862
|
}
|
|
2863
2863
|
)
|
|
2864
2864
|
] })
|
|
@@ -2914,7 +2914,7 @@ function qi({
|
|
|
2914
2914
|
isNewProperty: !i,
|
|
2915
2915
|
disabled: f,
|
|
2916
2916
|
autoUpdateId: l,
|
|
2917
|
-
ref:
|
|
2917
|
+
ref: S
|
|
2918
2918
|
}
|
|
2919
2919
|
),
|
|
2920
2920
|
q,
|
|
@@ -3064,11 +3064,11 @@ function Gi({
|
|
|
3064
3064
|
const {
|
|
3065
3065
|
values: f,
|
|
3066
3066
|
setFieldValue: g,
|
|
3067
|
-
setFieldError:
|
|
3067
|
+
setFieldError: P,
|
|
3068
3068
|
setFieldTouched: y,
|
|
3069
|
-
errors:
|
|
3069
|
+
errors: x,
|
|
3070
3070
|
dirty: v
|
|
3071
|
-
} = Y(), b = Ve(), T =
|
|
3071
|
+
} = Y(), b = Ve(), T = Pr(), w = !T, [C, O] = j(), [N, E] = j(), [B, _] = j(), S = N ? ne(N, B) : void 0, h = S ? I(f.properties, S.replaceAll(".", ".properties.")) : void 0, [D, ae] = j(!1), [q, Z] = j(!1), [H, Q] = j(!1), [le, Be] = j([]), xe = G.useRef(f.propertiesOrder ? { "": f.propertiesOrder } : {});
|
|
3072
3072
|
ce(() => {
|
|
3073
3073
|
l && l(v);
|
|
3074
3074
|
}, [v]);
|
|
@@ -3092,26 +3092,30 @@ function Gi({
|
|
|
3092
3092
|
const k = {
|
|
3093
3093
|
...U.reduce((M, L) => (M[L] = (A.properties ?? {})[L], M), {}),
|
|
3094
3094
|
...f.properties
|
|
3095
|
-
},
|
|
3095
|
+
}, F = [
|
|
3096
3096
|
...U,
|
|
3097
3097
|
...f.propertiesOrder ?? []
|
|
3098
3098
|
];
|
|
3099
|
-
g("properties", k, !1),
|
|
3099
|
+
g("properties", k, !1), Pe(F), Be(U);
|
|
3100
3100
|
}).finally(() => {
|
|
3101
3101
|
Z(!1);
|
|
3102
3102
|
}));
|
|
3103
|
-
} : void 0, te = (A) => A ?
|
|
3104
|
-
const k =
|
|
3105
|
-
g(k, A, !1),
|
|
3103
|
+
} : void 0, te = (A) => A ? xe.current[A] ?? I(f, he(A)) : xe.current[""] ?? I(f, he()), Pe = (A, U) => {
|
|
3104
|
+
const k = he(U);
|
|
3105
|
+
g(k, A, !1), xe.current[U ?? ""] = A;
|
|
3106
3106
|
}, ke = (A, U) => {
|
|
3107
3107
|
const k = A ? ne(A, U) : void 0;
|
|
3108
3108
|
if (!k)
|
|
3109
3109
|
throw Error("collection editor miss config");
|
|
3110
3110
|
g(me(k), void 0, !1);
|
|
3111
|
-
const
|
|
3112
|
-
|
|
3111
|
+
const F = te(U);
|
|
3112
|
+
if (F) {
|
|
3113
|
+
const M = F.filter((L) => L !== A);
|
|
3114
|
+
Pe(M, U);
|
|
3115
|
+
}
|
|
3116
|
+
Q(!1), O(void 0), E(void 0), _(void 0);
|
|
3113
3117
|
}, Ye = (A, U) => {
|
|
3114
|
-
g(
|
|
3118
|
+
g(he(U), A, !1);
|
|
3115
3119
|
}, gt = ({
|
|
3116
3120
|
id: A,
|
|
3117
3121
|
property: U
|
|
@@ -3123,51 +3127,51 @@ function Gi({
|
|
|
3123
3127
|
[A]: U
|
|
3124
3128
|
}, !1);
|
|
3125
3129
|
const k = [...f.propertiesOrder ?? Object.keys(f.properties), A];
|
|
3126
|
-
|
|
3130
|
+
Pe(k), Q(!1), T && (O(k.indexOf(A)), E(A)), _(void 0);
|
|
3127
3131
|
}, ue = ({
|
|
3128
3132
|
id: A,
|
|
3129
3133
|
property: U,
|
|
3130
3134
|
previousId: k,
|
|
3131
|
-
namespace:
|
|
3135
|
+
namespace: F
|
|
3132
3136
|
}) => {
|
|
3133
|
-
const M = A ? ne(A,
|
|
3137
|
+
const M = A ? ne(A, F) : void 0, L = M ? me(M) : void 0;
|
|
3134
3138
|
if (k && k !== A) {
|
|
3135
3139
|
console.debug("onPropertyChanged, id change", {
|
|
3136
3140
|
id: A,
|
|
3137
3141
|
property: U,
|
|
3138
3142
|
previousId: k,
|
|
3139
|
-
namespace:
|
|
3143
|
+
namespace: F
|
|
3140
3144
|
});
|
|
3141
|
-
const
|
|
3142
|
-
|
|
3145
|
+
const ve = ne(k, F), Xe = me(ve), It = te(F).map((tt) => tt === k ? A : tt).filter((tt) => tt !== void 0);
|
|
3146
|
+
Pe(It, F), A && (O(It.indexOf(A)), E(A)), g(Xe, void 0, !1), y(Xe, !1, !1);
|
|
3143
3147
|
}
|
|
3144
3148
|
console.debug("onPropertyChanged", {
|
|
3145
3149
|
id: A,
|
|
3146
3150
|
property: U,
|
|
3147
3151
|
previousId: k,
|
|
3148
|
-
namespace:
|
|
3152
|
+
namespace: F,
|
|
3149
3153
|
propertyPath: L
|
|
3150
3154
|
}), L && (g(L, U, !1), y(L, !0, !1));
|
|
3151
3155
|
}, We = (A, U, k) => {
|
|
3152
|
-
const
|
|
3156
|
+
const F = A ? ne(A, U) : void 0;
|
|
3153
3157
|
if (console.debug("onPropertyErrorInternal", {
|
|
3154
3158
|
id: A,
|
|
3155
3159
|
namespace: U,
|
|
3156
3160
|
error: k,
|
|
3157
|
-
propertyPath:
|
|
3158
|
-
}),
|
|
3161
|
+
propertyPath: F
|
|
3162
|
+
}), F) {
|
|
3159
3163
|
const M = k && Object.keys(k).length > 0;
|
|
3160
|
-
i(A, U, M ? k : void 0),
|
|
3164
|
+
i(A, U, M ? k : void 0), P(me(F), M ? "Property error" : void 0);
|
|
3161
3165
|
}
|
|
3162
3166
|
}, Ge = () => {
|
|
3163
|
-
O(void 0),
|
|
3167
|
+
O(void 0), E(void 0);
|
|
3164
3168
|
}, Ke = N && n?.current?.properties ? n.current.properties[N] : void 0, Ze = f?.propertiesOrder === void 0 || f.propertiesOrder.length === 0, Je = f.propertiesOrder ? f.propertiesOrder : Object.keys(f.properties), Qe = Zt(() => f.ownerId && c ? c(f.ownerId) : null, [c, f.ownerId]), vt = (A, U) => {
|
|
3165
3169
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
3166
3170
|
propertyKey: A,
|
|
3167
3171
|
namespace: U
|
|
3168
|
-
}), O(Je.indexOf(A)),
|
|
3172
|
+
}), O(Je.indexOf(A)), E(A), _(U);
|
|
3169
3173
|
}, yt = /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3170
|
-
/* @__PURE__ */ a("div", { className:
|
|
3174
|
+
/* @__PURE__ */ a("div", { className: fe(
|
|
3171
3175
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
3172
3176
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
3173
3177
|
!w && "border-r " + Tt
|
|
@@ -3185,7 +3189,7 @@ function Gi({
|
|
|
3185
3189
|
placeholder: "Collection name",
|
|
3186
3190
|
size: "small",
|
|
3187
3191
|
required: !0,
|
|
3188
|
-
error: !!
|
|
3192
|
+
error: !!x?.name
|
|
3189
3193
|
}
|
|
3190
3194
|
),
|
|
3191
3195
|
Qe && /* @__PURE__ */ a(
|
|
@@ -3244,7 +3248,7 @@ function Gi({
|
|
|
3244
3248
|
onPropertyMove: Ye,
|
|
3245
3249
|
onPropertyRemove: r ? ke : void 0,
|
|
3246
3250
|
collectionEditable: s,
|
|
3247
|
-
errors:
|
|
3251
|
+
errors: x
|
|
3248
3252
|
}
|
|
3249
3253
|
) }),
|
|
3250
3254
|
/* @__PURE__ */ e(
|
|
@@ -3261,11 +3265,11 @@ function Gi({
|
|
|
3261
3265
|
)
|
|
3262
3266
|
] }),
|
|
3263
3267
|
!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(
|
|
3264
|
-
|
|
3268
|
+
ge,
|
|
3265
3269
|
{
|
|
3266
3270
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
3267
3271
|
children: [
|
|
3268
|
-
|
|
3272
|
+
S && h && !re(h) && /* @__PURE__ */ e(
|
|
3269
3273
|
dr,
|
|
3270
3274
|
{
|
|
3271
3275
|
inArray: !1,
|
|
@@ -3430,9 +3434,9 @@ function Ji({
|
|
|
3430
3434
|
getUser: l,
|
|
3431
3435
|
parentCollectionIds: o
|
|
3432
3436
|
}) {
|
|
3433
|
-
const { entityViews: d } = Se(), [c, u] = G.useState(), [m, p] = G.useState(!1), [s, f] = G.useState(), [g,
|
|
3437
|
+
const { entityViews: d } = Se(), [c, u] = G.useState(), [m, p] = G.useState(!1), [s, f] = G.useState(), [g, P] = G.useState(), {
|
|
3434
3438
|
values: y,
|
|
3435
|
-
setFieldValue:
|
|
3439
|
+
setFieldValue: x
|
|
3436
3440
|
} = Y(), v = t.subcollections ?? [], b = y.entityViews?.filter((C) => typeof C == "string").map((C) => wr(C, d)).filter(Boolean) ?? [], T = t.entityViews?.filter((C) => typeof C != "string") ?? [], w = b.length + T.length;
|
|
3437
3441
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3438
3442
|
/* @__PURE__ */ e(mt, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-16", children: [
|
|
@@ -3441,11 +3445,11 @@ function Ji({
|
|
|
3441
3445
|
"Subcollections of ",
|
|
3442
3446
|
y.name
|
|
3443
3447
|
] }),
|
|
3444
|
-
/* @__PURE__ */ a(
|
|
3448
|
+
/* @__PURE__ */ a(ge, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3445
3449
|
v && v.length > 0 && /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(Bt, { children: v.map((C) => /* @__PURE__ */ a(
|
|
3446
3450
|
bt,
|
|
3447
3451
|
{
|
|
3448
|
-
onClick: () =>
|
|
3452
|
+
onClick: () => P({
|
|
3449
3453
|
isNewCollection: !1,
|
|
3450
3454
|
editedCollectionId: C.id
|
|
3451
3455
|
}),
|
|
@@ -3482,7 +3486,7 @@ function Ji({
|
|
|
3482
3486
|
z,
|
|
3483
3487
|
{
|
|
3484
3488
|
onClick: () => {
|
|
3485
|
-
|
|
3489
|
+
P({
|
|
3486
3490
|
isNewCollection: !0
|
|
3487
3491
|
});
|
|
3488
3492
|
},
|
|
@@ -3507,7 +3511,7 @@ function Ji({
|
|
|
3507
3511
|
children: "More info"
|
|
3508
3512
|
}
|
|
3509
3513
|
), children: "Define your own custom views by uploading them with the CLI." }),
|
|
3510
|
-
/* @__PURE__ */ e(R, { children: /* @__PURE__ */ a(
|
|
3514
|
+
/* @__PURE__ */ e(R, { children: /* @__PURE__ */ a(ge, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3511
3515
|
/* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3512
3516
|
b.map((C) => /* @__PURE__ */ a(bt, { children: [
|
|
3513
3517
|
/* @__PURE__ */ e(
|
|
@@ -3589,7 +3593,7 @@ function Ji({
|
|
|
3589
3593
|
{
|
|
3590
3594
|
open: !!s,
|
|
3591
3595
|
onAccept: () => {
|
|
3592
|
-
|
|
3596
|
+
x("entityViews", y.entityViews?.filter((C) => C !== s)), f(void 0);
|
|
3593
3597
|
},
|
|
3594
3598
|
onCancel: () => f(void 0),
|
|
3595
3599
|
title: /* @__PURE__ */ e(R, { children: "Remove this view?" }),
|
|
@@ -3612,7 +3616,7 @@ function Ji({
|
|
|
3612
3616
|
...g,
|
|
3613
3617
|
getUser: l,
|
|
3614
3618
|
handleClose: () => {
|
|
3615
|
-
|
|
3619
|
+
P(void 0);
|
|
3616
3620
|
}
|
|
3617
3621
|
}
|
|
3618
3622
|
),
|
|
@@ -3621,7 +3625,7 @@ function Ji({
|
|
|
3621
3625
|
{
|
|
3622
3626
|
open: m,
|
|
3623
3627
|
onClose: (C) => {
|
|
3624
|
-
C &&
|
|
3628
|
+
C && x("entityViews", [...y.entityViews ?? [], C]), p(!1);
|
|
3625
3629
|
}
|
|
3626
3630
|
}
|
|
3627
3631
|
)
|
|
@@ -4059,8 +4063,8 @@ function Qi({
|
|
|
4059
4063
|
const [o, d] = j(!1), [c, u] = j();
|
|
4060
4064
|
ce(() => {
|
|
4061
4065
|
r && l && (d(!0), r(t).then((g) => {
|
|
4062
|
-
const
|
|
4063
|
-
u(
|
|
4066
|
+
const P = g.filter((y) => !(l ?? []).find((x) => x.trim().toLowerCase() === y.trim().toLowerCase()));
|
|
4067
|
+
u(P);
|
|
4064
4068
|
}).finally(() => d(!1)));
|
|
4065
4069
|
}, [l, t, r]);
|
|
4066
4070
|
const {
|
|
@@ -4077,7 +4081,7 @@ function Qi({
|
|
|
4077
4081
|
children: /* @__PURE__ */ e(V, { variant: "h4", className: "flex-grow", children: "New collection" })
|
|
4078
4082
|
}
|
|
4079
4083
|
),
|
|
4080
|
-
n && /* @__PURE__ */ e(
|
|
4084
|
+
n && /* @__PURE__ */ e(xt, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(V, { variant: "caption", children: [
|
|
4081
4085
|
"This is a subcollection of ",
|
|
4082
4086
|
/* @__PURE__ */ e("b", { children: n.name })
|
|
4083
4087
|
] }) }),
|
|
@@ -4092,12 +4096,12 @@ function Qi({
|
|
|
4092
4096
|
),
|
|
4093
4097
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
|
|
4094
4098
|
o && !c && /* @__PURE__ */ e(He, { size: "small" }),
|
|
4095
|
-
c?.map((g,
|
|
4096
|
-
|
|
4099
|
+
c?.map((g, P) => /* @__PURE__ */ e(
|
|
4100
|
+
xt,
|
|
4097
4101
|
{
|
|
4098
4102
|
colorScheme: "cyanLighter",
|
|
4099
4103
|
onClick: () => {
|
|
4100
|
-
p("name",
|
|
4104
|
+
p("name", Pt(g)), p("id", g), p("path", g), p("properties", void 0), i();
|
|
4101
4105
|
},
|
|
4102
4106
|
size: "small",
|
|
4103
4107
|
children: g
|
|
@@ -4173,7 +4177,7 @@ function Qi({
|
|
|
4173
4177
|
children: "● Create a collection from a file (csv, json, xls, xslx...)"
|
|
4174
4178
|
}
|
|
4175
4179
|
),
|
|
4176
|
-
/* @__PURE__ */ e(pi, { onDataAdded: (g,
|
|
4180
|
+
/* @__PURE__ */ e(pi, { onDataAdded: (g, P) => i(g, P) })
|
|
4177
4181
|
] }),
|
|
4178
4182
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(z, { variant: "text", onClick: () => i(), className: "my-2", children: "Continue from scratch" }) })
|
|
4179
4183
|
] }) });
|
|
@@ -4188,7 +4192,7 @@ function ot({
|
|
|
4188
4192
|
tr,
|
|
4189
4193
|
{
|
|
4190
4194
|
onClick: i,
|
|
4191
|
-
className:
|
|
4195
|
+
className: fe(
|
|
4192
4196
|
"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center",
|
|
4193
4197
|
"text-gray-700 dark:text-slate-300",
|
|
4194
4198
|
"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary",
|
|
@@ -4212,30 +4216,30 @@ function Xi({
|
|
|
4212
4216
|
values: o
|
|
4213
4217
|
} = Y(), [d, c] = j(void 0), u = G.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), m = d ? d.id : void 0, p = d || void 0, s = ({
|
|
4214
4218
|
id: g,
|
|
4215
|
-
property:
|
|
4219
|
+
property: P,
|
|
4216
4220
|
previousId: y,
|
|
4217
|
-
namespace:
|
|
4221
|
+
namespace: x
|
|
4218
4222
|
}) => {
|
|
4219
|
-
const v = g ? ne(g,
|
|
4220
|
-
const N =
|
|
4223
|
+
const v = g ? ne(g, x) : void 0, b = v ? me(v) : void 0, T = (C) => C ? u.current[C] ?? I(o, he(C)) : u.current[""], w = (C, O) => {
|
|
4224
|
+
const N = he(O);
|
|
4221
4225
|
i(N, C, !1), u.current[O ?? ""] = C;
|
|
4222
4226
|
};
|
|
4223
4227
|
if (y && y !== g) {
|
|
4224
|
-
const C = ne(y,
|
|
4225
|
-
w(
|
|
4228
|
+
const C = ne(y, x), O = me(C), E = T(x).map((_) => _ === y ? g : _).filter((_) => _ !== void 0);
|
|
4229
|
+
w(E, x);
|
|
4226
4230
|
const B = { ...t.headersMapping };
|
|
4227
4231
|
Object.keys(B).forEach((_) => {
|
|
4228
4232
|
B[_] === y && (B[_] = g ?? "");
|
|
4229
4233
|
}), t.setHeadersMapping(B), i(O, void 0, !1), l(O, !1, !1);
|
|
4230
4234
|
}
|
|
4231
|
-
b && (i(b,
|
|
4235
|
+
b && (i(b, P, !1), l(b, !0, !1));
|
|
4232
4236
|
}, f = async ({
|
|
4233
4237
|
id: g,
|
|
4234
|
-
importKey:
|
|
4238
|
+
importKey: P,
|
|
4235
4239
|
property: y,
|
|
4236
|
-
namespace:
|
|
4240
|
+
namespace: x
|
|
4237
4241
|
}) => {
|
|
4238
|
-
const v = g ? ne(g,
|
|
4242
|
+
const v = g ? ne(g, x) : void 0, b = v ? me(v) : void 0, T = t.importData.map((C) => I(C, P)), w = {
|
|
4239
4243
|
...ni(T, y, rr),
|
|
4240
4244
|
editable: !0
|
|
4241
4245
|
};
|
|
@@ -4251,19 +4255,19 @@ function Xi({
|
|
|
4251
4255
|
destinationProperties: o.properties,
|
|
4252
4256
|
buildPropertyView: ({
|
|
4253
4257
|
property: g,
|
|
4254
|
-
propertyKey:
|
|
4258
|
+
propertyKey: P,
|
|
4255
4259
|
importKey: y,
|
|
4256
|
-
isIdColumn:
|
|
4257
|
-
}) =>
|
|
4260
|
+
isIdColumn: x
|
|
4261
|
+
}) => x ? /* @__PURE__ */ e(V, { children: " This column will be used as ID" }) : /* @__PURE__ */ e(
|
|
4258
4262
|
hi,
|
|
4259
4263
|
{
|
|
4260
4264
|
property: g,
|
|
4261
|
-
propertyKey:
|
|
4265
|
+
propertyKey: P,
|
|
4262
4266
|
onPropertyNameChanged: (v, b) => i(`properties.${v}.name`, b, !1),
|
|
4263
4267
|
onEditClick: () => {
|
|
4264
|
-
!
|
|
4268
|
+
!P || !g || c({
|
|
4265
4269
|
...g,
|
|
4266
|
-
id:
|
|
4270
|
+
id: P,
|
|
4267
4271
|
editable: !0
|
|
4268
4272
|
});
|
|
4269
4273
|
},
|
|
@@ -4276,7 +4280,7 @@ function Xi({
|
|
|
4276
4280
|
...v,
|
|
4277
4281
|
importKey: y
|
|
4278
4282
|
}),
|
|
4279
|
-
propertyKey:
|
|
4283
|
+
propertyKey: P,
|
|
4280
4284
|
propertyConfigs: r
|
|
4281
4285
|
}
|
|
4282
4286
|
)
|
|
@@ -4472,10 +4476,10 @@ function rn(t) {
|
|
|
4472
4476
|
const { propertyConfigs: r } = Se(), n = Te(), i = Ie(), {
|
|
4473
4477
|
topLevelNavigation: l,
|
|
4474
4478
|
collections: o
|
|
4475
|
-
} = 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] = ze.useState(), [g,
|
|
4479
|
+
} = 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] = ze.useState(), [g, P] = ze.useState(!1);
|
|
4476
4480
|
if (ce(() => {
|
|
4477
4481
|
try {
|
|
4478
|
-
n.initialised && (t.editedCollectionId ? f(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : f(void 0),
|
|
4482
|
+
n.initialised && (t.editedCollectionId ? f(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : f(void 0), P(!0));
|
|
4479
4483
|
} catch (b) {
|
|
4480
4484
|
console.error(b);
|
|
4481
4485
|
}
|
|
@@ -4483,10 +4487,10 @@ function rn(t) {
|
|
|
4483
4487
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
4484
4488
|
const {
|
|
4485
4489
|
groups: y
|
|
4486
|
-
} = l,
|
|
4490
|
+
} = l, x = s ? {
|
|
4487
4491
|
...s,
|
|
4488
4492
|
id: s.id ?? s.path ?? _t(16)
|
|
4489
|
-
} : void 0, v =
|
|
4493
|
+
} : void 0, v = x ? an(x, r) : {
|
|
4490
4494
|
id: d?.path ?? _t(16),
|
|
4491
4495
|
path: d?.path ?? "",
|
|
4492
4496
|
name: d?.name ?? "",
|
|
@@ -4526,9 +4530,9 @@ function nn({
|
|
|
4526
4530
|
pathSuggestions: s,
|
|
4527
4531
|
getUser: f,
|
|
4528
4532
|
parentCollection: g,
|
|
4529
|
-
getData:
|
|
4533
|
+
getData: P,
|
|
4530
4534
|
existingPaths: y,
|
|
4531
|
-
existingIds:
|
|
4535
|
+
existingIds: x,
|
|
4532
4536
|
includeTemplates: v,
|
|
4533
4537
|
collection: b,
|
|
4534
4538
|
setCollection: T,
|
|
@@ -4536,10 +4540,10 @@ function nn({
|
|
|
4536
4540
|
propertyConfigs: C,
|
|
4537
4541
|
groups: O
|
|
4538
4542
|
}) {
|
|
4539
|
-
const N = gi(),
|
|
4540
|
-
const
|
|
4543
|
+
const N = gi(), E = Te(), B = Ve(), _ = Re({}), S = t ? v ? "welcome" : "details" : "properties", [h, D] = j(S), [ae, q] = ze.useState(), Z = (k) => {
|
|
4544
|
+
const F = k.id || k.path;
|
|
4541
4545
|
return r.saveCollection({
|
|
4542
|
-
id:
|
|
4546
|
+
id: F,
|
|
4543
4547
|
collectionData: k,
|
|
4544
4548
|
previousId: n,
|
|
4545
4549
|
parentCollectionIds: i
|
|
@@ -4557,35 +4561,35 @@ function nn({
|
|
|
4557
4561
|
if (!Q)
|
|
4558
4562
|
return T(k), Promise.resolve(k);
|
|
4559
4563
|
D("loading");
|
|
4560
|
-
const
|
|
4561
|
-
if (!
|
|
4564
|
+
const F = await Q?.(k);
|
|
4565
|
+
if (!F)
|
|
4562
4566
|
return T(k), Promise.resolve(k);
|
|
4563
4567
|
const M = {
|
|
4564
4568
|
...k ?? {}
|
|
4565
4569
|
};
|
|
4566
|
-
return Object.keys(
|
|
4570
|
+
return Object.keys(F.properties ?? {}).length > 0 && (M.properties = F.properties, M.propertiesOrder = F.propertiesOrder), M.propertiesOrder ? (T(M), console.debug("Inferred collection", {
|
|
4567
4571
|
newCollection: k ?? {},
|
|
4568
4572
|
values: M
|
|
4569
4573
|
}), M) : (M.propertiesOrder = Object.keys(M.properties), M);
|
|
4570
|
-
} catch (
|
|
4571
|
-
return console.error(
|
|
4574
|
+
} catch (F) {
|
|
4575
|
+
return console.error(F), B.open({
|
|
4572
4576
|
type: "error",
|
|
4573
|
-
message: "Error inferring collection: " + (
|
|
4577
|
+
message: "Error inferring collection: " + (F.message ?? "Details in the console")
|
|
4574
4578
|
}), k;
|
|
4575
4579
|
}
|
|
4576
4580
|
}, se = kt({
|
|
4577
4581
|
initialValues: w,
|
|
4578
|
-
onSubmit: (k,
|
|
4582
|
+
onSubmit: (k, F) => {
|
|
4579
4583
|
console.log("Submitting collection", k);
|
|
4580
4584
|
try {
|
|
4581
4585
|
if (!t) {
|
|
4582
4586
|
Z(k).then(() => {
|
|
4583
|
-
|
|
4587
|
+
F.resetForm({ values: w }), d(k);
|
|
4584
4588
|
});
|
|
4585
4589
|
return;
|
|
4586
4590
|
}
|
|
4587
|
-
h === "welcome" ? (H(),
|
|
4588
|
-
|
|
4591
|
+
h === "welcome" ? (H(), F.resetForm({ values: k })) : h === "details" ? u || N.inUse ? (F.resetForm({ values: k }), H()) : t ? le(k).then((M) => {
|
|
4592
|
+
F.resetForm({
|
|
4589
4593
|
values: M ?? k,
|
|
4590
4594
|
touched: {
|
|
4591
4595
|
path: !0,
|
|
@@ -4594,65 +4598,65 @@ function nn({
|
|
|
4594
4598
|
});
|
|
4595
4599
|
}).finally(() => {
|
|
4596
4600
|
H();
|
|
4597
|
-
}) : (
|
|
4598
|
-
|
|
4599
|
-
}) : (H(),
|
|
4601
|
+
}) : (F.resetForm({ values: k }), H()) : h === "extra_view" ? (H(), F.resetForm({ values: k })) : h === "import_data_mapping" || h === "import_data_preview" ? H() : h === "properties" ? Z(k).then(() => {
|
|
4602
|
+
F.resetForm({ values: w }), H(), d(k);
|
|
4603
|
+
}) : (H(), F.resetForm({ values: k }));
|
|
4600
4604
|
} catch (M) {
|
|
4601
4605
|
B.open({
|
|
4602
4606
|
type: "error",
|
|
4603
4607
|
message: "Error persisting collection: " + (M.message ?? "Details in the console")
|
|
4604
|
-
}), console.error(M),
|
|
4608
|
+
}), console.error(M), F.resetForm({ values: k });
|
|
4605
4609
|
}
|
|
4606
4610
|
},
|
|
4607
4611
|
validation: (k) => {
|
|
4608
|
-
let
|
|
4612
|
+
let F = {};
|
|
4609
4613
|
const M = (h === "properties" || h === "subcollections" || h === "details") && bi;
|
|
4610
4614
|
if (M)
|
|
4611
4615
|
try {
|
|
4612
4616
|
M.validateSync(k, { abortEarly: !1 });
|
|
4613
4617
|
} catch (L) {
|
|
4614
|
-
L.inner.forEach((
|
|
4615
|
-
|
|
4618
|
+
L.inner.forEach((ve) => {
|
|
4619
|
+
F[ve.path] = ve.message;
|
|
4616
4620
|
});
|
|
4617
4621
|
}
|
|
4618
|
-
if (h === "properties" && (
|
|
4622
|
+
if (h === "properties" && (F = { ...F, ..._.current }), h === "details") {
|
|
4619
4623
|
const L = Yt(k.path, t, y, k.id);
|
|
4620
|
-
L && (
|
|
4621
|
-
const
|
|
4622
|
-
|
|
4624
|
+
L && (F.path = L);
|
|
4625
|
+
const ve = on(k.id, t, y, x);
|
|
4626
|
+
ve && (F.id = ve);
|
|
4623
4627
|
}
|
|
4624
|
-
return
|
|
4628
|
+
return F;
|
|
4625
4629
|
}
|
|
4626
4630
|
}), {
|
|
4627
4631
|
values: te,
|
|
4628
|
-
setFieldValue:
|
|
4632
|
+
setFieldValue: Pe,
|
|
4629
4633
|
isSubmitting: ke,
|
|
4630
4634
|
dirty: Ye,
|
|
4631
4635
|
submitCount: gt
|
|
4632
|
-
} = se, ue = te.path, We = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + ue : ue, Ge = Yt(ue, t, y, te.id), Ke = !Ge && i ?
|
|
4636
|
+
} = se, ue = te.path, We = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + ue : ue, Ge = Yt(ue, t, y, te.id), Ke = !Ge && i ? E.convertIdsToPaths(i) : void 0, Ze = Ge ? void 0 : E.resolveAliasesFrom(We), Je = Ze && P ? () => P(Ze, Ke ?? []) : void 0;
|
|
4633
4637
|
ce(() => {
|
|
4634
4638
|
p(Ye);
|
|
4635
4639
|
}, [Ye]);
|
|
4636
|
-
function Qe(k,
|
|
4640
|
+
function Qe(k, F) {
|
|
4637
4641
|
N.setInUse(!0), ai(k, rr).then((M) => {
|
|
4638
4642
|
const L = ur(M);
|
|
4639
4643
|
N.setIdColumn(L.idColumn), N.setImportData(k), N.setHeadersMapping(L.headersMapping);
|
|
4640
|
-
const
|
|
4641
|
-
N.setHeadingsOrder(
|
|
4642
|
-
const Xe = (
|
|
4643
|
-
|
|
4644
|
+
const ve = (F ?? []).filter((et) => L.headersMapping[et]) ?? Object.keys(L.properties);
|
|
4645
|
+
N.setHeadingsOrder(ve), N.setOriginProperties(L.properties);
|
|
4646
|
+
const Xe = (F ?? []).map((et) => L.headersMapping[et]).filter(Boolean) ?? Object.keys(L.properties);
|
|
4647
|
+
Pe("properties", L.properties), Pe("propertiesOrder", Xe);
|
|
4644
4648
|
});
|
|
4645
4649
|
}
|
|
4646
4650
|
const vt = !!te.name && !!te.id, yt = () => {
|
|
4647
4651
|
const k = { ...te.properties };
|
|
4648
|
-
N.idColumn && delete k[N.idColumn],
|
|
4652
|
+
N.idColumn && delete k[N.idColumn], Pe("properties", k), H();
|
|
4649
4653
|
}, U = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4650
4654
|
return /* @__PURE__ */ e(Ae, { fullHeight: !0, children: /* @__PURE__ */ e(Ot, { value: se, children: /* @__PURE__ */ a(R, { children: [
|
|
4651
4655
|
!t && /* @__PURE__ */ a(
|
|
4652
4656
|
Zr,
|
|
4653
4657
|
{
|
|
4654
4658
|
value: h,
|
|
4655
|
-
className:
|
|
4659
|
+
className: fe(Tt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
4656
4660
|
onValueChange: (k) => D(k),
|
|
4657
4661
|
children: [
|
|
4658
4662
|
/* @__PURE__ */ e(Ct, { value: "details", children: "Details" }),
|
|
@@ -4666,7 +4670,7 @@ function nn({
|
|
|
4666
4670
|
{
|
|
4667
4671
|
noValidate: !0,
|
|
4668
4672
|
onSubmit: se.handleSubmit,
|
|
4669
|
-
className:
|
|
4673
|
+
className: fe(
|
|
4670
4674
|
t ? "h-full" : "h-[calc(100%-48px)]",
|
|
4671
4675
|
"flex-grow flex flex-col relative"
|
|
4672
4676
|
),
|
|
@@ -4677,8 +4681,8 @@ function nn({
|
|
|
4677
4681
|
Qi,
|
|
4678
4682
|
{
|
|
4679
4683
|
path: ue,
|
|
4680
|
-
onContinue: (k,
|
|
4681
|
-
k ? (Qe(k,
|
|
4684
|
+
onContinue: (k, F) => {
|
|
4685
|
+
k ? (Qe(k, F), D("import_data_mapping")) : D("details");
|
|
4682
4686
|
},
|
|
4683
4687
|
existingCollectionPaths: y,
|
|
4684
4688
|
parentCollection: g,
|
|
@@ -4719,7 +4723,7 @@ function nn({
|
|
|
4719
4723
|
Ci,
|
|
4720
4724
|
{
|
|
4721
4725
|
existingPaths: y,
|
|
4722
|
-
existingIds:
|
|
4726
|
+
existingIds: x,
|
|
4723
4727
|
groups: O,
|
|
4724
4728
|
parentCollectionIds: i,
|
|
4725
4729
|
parentCollection: g,
|
|
@@ -4743,10 +4747,10 @@ function nn({
|
|
|
4743
4747
|
showErrors: gt > 0,
|
|
4744
4748
|
isNewCollection: t,
|
|
4745
4749
|
reservedGroups: c,
|
|
4746
|
-
onPropertyError: (k,
|
|
4750
|
+
onPropertyError: (k, F, M) => {
|
|
4747
4751
|
const L = Ft({
|
|
4748
4752
|
..._.current,
|
|
4749
|
-
[nr(k,
|
|
4753
|
+
[nr(k, F)]: Ft(M, !0)
|
|
4750
4754
|
}, !0);
|
|
4751
4755
|
_.current = L, se.validate();
|
|
4752
4756
|
},
|
|
@@ -4935,22 +4939,22 @@ const Yt = (t, r, n, i) => {
|
|
|
4935
4939
|
getData: m,
|
|
4936
4940
|
onAnalyticsEvent: p
|
|
4937
4941
|
}) {
|
|
4938
|
-
const s = Te(), f = yi(), g = Ve(), { propertyConfigs:
|
|
4942
|
+
const s = Te(), f = yi(), g = Ve(), { propertyConfigs: P } = Se(), [y, x] = G.useState(), [v, b] = G.useState(), T = Er(() => ({
|
|
4939
4943
|
createCollections: !0,
|
|
4940
4944
|
editCollections: !0,
|
|
4941
4945
|
deleteCollections: !0
|
|
4942
4946
|
}), []), w = ({
|
|
4943
4947
|
id: N,
|
|
4944
|
-
fullPath:
|
|
4948
|
+
fullPath: E,
|
|
4945
4949
|
parentCollectionIds: B,
|
|
4946
4950
|
parentCollection: _
|
|
4947
4951
|
}) => {
|
|
4948
|
-
console.debug("Edit collection", N,
|
|
4952
|
+
console.debug("Edit collection", N, E, B, _), p?.("edit_collection", {
|
|
4949
4953
|
id: N,
|
|
4950
|
-
fullPath:
|
|
4951
|
-
}),
|
|
4954
|
+
fullPath: E
|
|
4955
|
+
}), x({
|
|
4952
4956
|
editedCollectionId: N,
|
|
4953
|
-
fullPath:
|
|
4957
|
+
fullPath: E,
|
|
4954
4958
|
parentCollectionIds: B,
|
|
4955
4959
|
isNewCollection: !1,
|
|
4956
4960
|
parentCollection: _,
|
|
@@ -4958,49 +4962,49 @@ const Yt = (t, r, n, i) => {
|
|
|
4958
4962
|
});
|
|
4959
4963
|
}, C = ({
|
|
4960
4964
|
propertyKey: N,
|
|
4961
|
-
property:
|
|
4965
|
+
property: E,
|
|
4962
4966
|
editedCollectionId: B,
|
|
4963
4967
|
currentPropertiesOrder: _,
|
|
4964
|
-
parentCollectionIds:
|
|
4968
|
+
parentCollectionIds: S,
|
|
4965
4969
|
collection: h
|
|
4966
4970
|
}) => {
|
|
4967
|
-
console.debug("Edit property", N,
|
|
4971
|
+
console.debug("Edit property", N, E, B, _, S, h), p?.("edit_property", {
|
|
4968
4972
|
propertyKey: N,
|
|
4969
4973
|
editedCollectionId: B
|
|
4970
4974
|
});
|
|
4971
4975
|
const D = N && N.includes(".") ? N.substring(0, N.lastIndexOf(".")) : void 0, ae = N && N.includes(".") ? N.substring(N.lastIndexOf(".") + 1) : N;
|
|
4972
4976
|
b({
|
|
4973
4977
|
propertyKey: ae,
|
|
4974
|
-
property:
|
|
4978
|
+
property: E,
|
|
4975
4979
|
namespace: D,
|
|
4976
4980
|
currentPropertiesOrder: _,
|
|
4977
4981
|
editedCollectionId: B,
|
|
4978
|
-
parentCollectionIds:
|
|
4982
|
+
parentCollectionIds: S,
|
|
4979
4983
|
collectionEditable: h?.editable ?? !1
|
|
4980
4984
|
});
|
|
4981
4985
|
}, O = ({
|
|
4982
4986
|
parentCollectionIds: N,
|
|
4983
|
-
parentCollection:
|
|
4987
|
+
parentCollection: E,
|
|
4984
4988
|
initialValues: B,
|
|
4985
4989
|
redirect: _,
|
|
4986
|
-
sourceClick:
|
|
4990
|
+
sourceClick: S
|
|
4987
4991
|
}) => {
|
|
4988
4992
|
console.debug("Create collection", {
|
|
4989
4993
|
parentCollectionIds: N,
|
|
4990
|
-
parentCollection:
|
|
4994
|
+
parentCollection: E,
|
|
4991
4995
|
initialValues: B,
|
|
4992
4996
|
redirect: _,
|
|
4993
|
-
sourceClick:
|
|
4997
|
+
sourceClick: S
|
|
4994
4998
|
}), p?.("create_collection", {
|
|
4995
4999
|
parentCollectionIds: N,
|
|
4996
|
-
parentCollection:
|
|
5000
|
+
parentCollection: E,
|
|
4997
5001
|
initialValues: B,
|
|
4998
5002
|
redirect: _,
|
|
4999
|
-
sourceClick:
|
|
5000
|
-
}),
|
|
5003
|
+
sourceClick: S
|
|
5004
|
+
}), x({
|
|
5001
5005
|
isNewCollection: !0,
|
|
5002
5006
|
parentCollectionIds: N,
|
|
5003
|
-
parentCollection:
|
|
5007
|
+
parentCollection: E,
|
|
5004
5008
|
initialValues: B,
|
|
5005
5009
|
redirect: _
|
|
5006
5010
|
});
|
|
@@ -5032,10 +5036,10 @@ const Yt = (t, r, n, i) => {
|
|
|
5032
5036
|
getUser: u,
|
|
5033
5037
|
handleClose: (N) => {
|
|
5034
5038
|
if (y?.redirect && N && y?.isNewCollection && !y.parentCollectionIds.length) {
|
|
5035
|
-
const
|
|
5036
|
-
f(
|
|
5039
|
+
const E = s.buildUrlCollectionPath(N.id ?? N.path);
|
|
5040
|
+
f(E);
|
|
5037
5041
|
}
|
|
5038
|
-
|
|
5042
|
+
x(void 0);
|
|
5039
5043
|
}
|
|
5040
5044
|
}
|
|
5041
5045
|
),
|
|
@@ -5056,14 +5060,14 @@ const Yt = (t, r, n, i) => {
|
|
|
5056
5060
|
} : void 0,
|
|
5057
5061
|
onPropertyChanged: ({
|
|
5058
5062
|
id: N,
|
|
5059
|
-
property:
|
|
5063
|
+
property: E
|
|
5060
5064
|
}) => {
|
|
5061
5065
|
if (!v || !N)
|
|
5062
5066
|
return;
|
|
5063
5067
|
const B = !v.propertyKey;
|
|
5064
5068
|
return n.saveProperty({
|
|
5065
5069
|
path: v?.editedCollectionId,
|
|
5066
|
-
property:
|
|
5070
|
+
property: E,
|
|
5067
5071
|
propertyKey: N,
|
|
5068
5072
|
newPropertiesOrder: B && v.currentPropertiesOrder ? [...v.currentPropertiesOrder, N] : void 0,
|
|
5069
5073
|
namespace: v.namespace,
|
|
@@ -5077,7 +5081,7 @@ const Yt = (t, r, n, i) => {
|
|
|
5077
5081
|
onDelete: () => {
|
|
5078
5082
|
if (!v?.propertyKey)
|
|
5079
5083
|
return;
|
|
5080
|
-
const N = v?.currentPropertiesOrder?.filter((
|
|
5084
|
+
const N = v?.currentPropertiesOrder?.filter((E) => E !== v?.propertyKey);
|
|
5081
5085
|
return n.deleteProperty({
|
|
5082
5086
|
path: v?.editedCollectionId,
|
|
5083
5087
|
propertyKey: v?.propertyKey,
|
|
@@ -5086,9 +5090,9 @@ const Yt = (t, r, n, i) => {
|
|
|
5086
5090
|
parentCollectionIds: v?.parentCollectionIds
|
|
5087
5091
|
}).then(() => {
|
|
5088
5092
|
b(void 0);
|
|
5089
|
-
}).catch((
|
|
5093
|
+
}).catch((E) => (console.error(E), g.open({
|
|
5090
5094
|
type: "error",
|
|
5091
|
-
message: "Error deleting property: " + (
|
|
5095
|
+
message: "Error deleting property: " + (E.message ?? "Details in the console")
|
|
5092
5096
|
}), !1));
|
|
5093
5097
|
},
|
|
5094
5098
|
onError: () => {
|
|
@@ -5103,7 +5107,7 @@ const Yt = (t, r, n, i) => {
|
|
|
5103
5107
|
forceShowErrors: !1,
|
|
5104
5108
|
existingPropertyKeys: [],
|
|
5105
5109
|
allowDataInference: !0,
|
|
5106
|
-
propertyConfigs:
|
|
5110
|
+
propertyConfigs: P,
|
|
5107
5111
|
property: v?.property,
|
|
5108
5112
|
propertyKey: v?.propertyKey
|
|
5109
5113
|
}
|
|
@@ -5112,7 +5116,7 @@ const Yt = (t, r, n, i) => {
|
|
|
5112
5116
|
}
|
|
5113
5117
|
) });
|
|
5114
5118
|
},
|
|
5115
|
-
|
|
5119
|
+
ye
|
|
5116
5120
|
), Ne = () => Jt(fr);
|
|
5117
5121
|
function sn({
|
|
5118
5122
|
path: t,
|
|
@@ -5280,7 +5284,7 @@ function mn({
|
|
|
5280
5284
|
collection: n
|
|
5281
5285
|
}).editCollections : !0;
|
|
5282
5286
|
let m = null;
|
|
5283
|
-
return (!
|
|
5287
|
+
return (!ye(lt(i.filterValues), lt(n.initialFilter)) || !ye(lt(i.sortBy), lt(n.initialSort))) && (m = /* @__PURE__ */ a(R, { children: [
|
|
5284
5288
|
/* @__PURE__ */ e(
|
|
5285
5289
|
ee,
|
|
5286
5290
|
{
|
|
@@ -5347,7 +5351,7 @@ function hn({
|
|
|
5347
5351
|
return /* @__PURE__ */ e(
|
|
5348
5352
|
tr,
|
|
5349
5353
|
{
|
|
5350
|
-
className:
|
|
5354
|
+
className: fe("h-full p-4 min-h-[124px]"),
|
|
5351
5355
|
onClick: i && l ? () => i.createCollection({
|
|
5352
5356
|
initialValues: t ? { group: t } : void 0,
|
|
5353
5357
|
parentCollectionIds: [],
|
|
@@ -5427,7 +5431,7 @@ function fn({}) {
|
|
|
5427
5431
|
user: r.user
|
|
5428
5432
|
}).createCollections : !0;
|
|
5429
5433
|
return !t.initialised || t.collections === void 0 || (t.collections ?? []).length > 0 ? null : /* @__PURE__ */ a(
|
|
5430
|
-
|
|
5434
|
+
ge,
|
|
5431
5435
|
{
|
|
5432
5436
|
className: "my-4 px-4 py-6 flex flex-col bg-white dark:bg-slate-800 gap-2",
|
|
5433
5437
|
children: [
|
|
@@ -5472,7 +5476,7 @@ function Fn({ path: t }) {
|
|
|
5472
5476
|
size: "small",
|
|
5473
5477
|
onClick: () => {
|
|
5474
5478
|
l.createCollection({
|
|
5475
|
-
initialValues: { path: n, name:
|
|
5479
|
+
initialValues: { path: n, name: Pt(n) },
|
|
5476
5480
|
parentCollectionIds: i,
|
|
5477
5481
|
redirect: !1,
|
|
5478
5482
|
sourceClick: "missing_reference"
|
|
@@ -5494,7 +5498,7 @@ export {
|
|
|
5494
5498
|
nr as getFullIdPath,
|
|
5495
5499
|
me as idToPropertiesPath,
|
|
5496
5500
|
_n as mergeCollections,
|
|
5497
|
-
|
|
5501
|
+
he as namespaceToPropertiesOrderPath,
|
|
5498
5502
|
ir as namespaceToPropertiesPath,
|
|
5499
5503
|
Ti as removeNonEditableProperties,
|
|
5500
5504
|
Ne as useCollectionEditorController,
|