@firecms/collection_editor 3.0.0-beta.2 → 3.0.0-canary.1
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 +231 -212
- 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 +14 -6
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +25 -8
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +1 -2
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +1 -2
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a, Fragment as
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as j } from "react/jsx-runtime";
|
|
2
2
|
import { SearchIconsView as gr, toSnakeCase as Pt, singular as vr, IconForView as ot, ArrayContainer as yr, serializeRegExp as br, useSnackbarController as Ie, resolveEnumValues as Cr, isPropertyBuilder as ne, useCustomizationController as Ae, getFieldConfig as $e, ErrorBoundary as ge, PropertyConfigBadge as Ye, unslugify as ut, useNavigationController as Pe, mergeDeep as W, DEFAULT_FIELD_CONFIGS as Gt, isValidRegExp as Pr, getFieldId as Kt, DeleteConfirmationDialog as lt, useLargeLayout as Nr, makePropertiesEditable as pt, resolveEntityView as xr, useSelectionController as wr, EntityCollectionTable as Tr, slugify as kr, useAuthController as _e, randomString as _t, CircularProgressCenter as Nt, removeUndefined as Ft, ErrorView as Wt, removeInitialAndTrailingSlashes as Or, getDefaultPropertiesOrder as Vr } from "@firecms/core";
|
|
3
3
|
import * as je from "react";
|
|
4
|
-
import Y, { useState as $, useEffect as
|
|
4
|
+
import Y, { useState as $, useEffect as de, useMemo as Zt, useCallback as Q, useRef as Le, useDeferredValue as Ir, useContext as Jt } from "react";
|
|
5
5
|
import ve from "react-fast-compare";
|
|
6
|
-
import { Typography as O, useAutoComplete as _r, Container as mt, Tooltip as te, IconButton as oe, Chip as st, TextField as Oe, cn as me, DebouncedTextField as Z, Autocomplete as Fr, AutocompleteItem as Sr, ExpandablePanel as xt, SettingsIcon as He, Select as be, SelectItem as ee, BooleanSwitchWithLabel as ct, Dialog as Fe, AutoAwesomeIcon as ht, Badge as Er, ListIcon as Ar, Button as z, CircularProgress as De, Paper as Ce, DialogContent as Be, DialogActions as ze, RuleIcon as Dr, FileUploadIcon as Br, MultiSelect as zr, MultiSelectItem as St, Checkbox as Et, cardMixin as Qt, cardClickableMixin as Xt, cardSelectedMixin as er, FunctionsIcon as Mr, RemoveCircleIcon as Rr, defaultBorderMixin as wt, RemoveIcon as Ur, DragHandleIcon as jr, AddIcon as
|
|
6
|
+
import { Typography as O, useAutoComplete as _r, Container as mt, Tooltip as te, IconButton as oe, Chip as st, TextField as Oe, cn as me, DebouncedTextField as Z, Autocomplete as Fr, AutocompleteItem as Sr, ExpandablePanel as xt, SettingsIcon as He, Select as be, SelectItem as ee, BooleanSwitchWithLabel as ct, Dialog as Fe, AutoAwesomeIcon as ht, Badge as Er, ListIcon as Ar, Button as z, CircularProgress as De, Paper as Ce, DialogContent as Be, DialogActions as ze, RuleIcon as Dr, FileUploadIcon as Br, MultiSelect as zr, MultiSelectItem as St, Checkbox as Et, cardMixin as Qt, cardClickableMixin as Xt, cardSelectedMixin as er, FunctionsIcon as Mr, RemoveCircleIcon as Rr, defaultBorderMixin as wt, RemoveIcon as Ur, DragHandleIcon as jr, AddIcon as se, SelectGroup as At, InfoLabel as Lr, DeleteIcon as dt, ContentCopyIcon as qr, CodeIcon as $r, Table as Dt, TableBody as Bt, TableRow as bt, TableCell as Ue, Alert as Yr, Icon as et, Card as tr, coolIconKeys as zt, Tabs as Hr, Tab as Ct, ArrowBackIcon as tt, LoadingButton as Mt, DoneIcon as Gr, UndoIcon as Kr, SaveIcon as Wr, Menu as Zr, MoreVertIcon as Jr, MenuItem as Qr, Collapse as Xr } from "@firecms/ui";
|
|
7
7
|
import * as rt from "yup";
|
|
8
8
|
import { useFormex as K, Field as H, getIn as I, useCreateFormex as Tt, Formex as kt } from "@firecms/formex";
|
|
9
9
|
import { extractEnumFromValues as ei, buildPropertyFromData as ti, buildEntityPropertiesFromData as ri } from "@firecms/schema_inference";
|
|
@@ -40,10 +40,10 @@ function yi({
|
|
|
40
40
|
setFieldTouched: g,
|
|
41
41
|
isSubmitting: v,
|
|
42
42
|
submitCount: x
|
|
43
|
-
} = K(), [y, P] = $(!1), [
|
|
43
|
+
} = K(), [y, P] = $(!1), [k, b] = $(!1), C = (s) => {
|
|
44
44
|
p("name", s), !I(m, "path") && t && s && p("path", Pt(s)), !I(m, "id") && t && s && p("id", Pt(s)), !I(m, "singularName") && t && s && p("singularName", vr(s));
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
de(() => {
|
|
47
47
|
c.id && b(!0);
|
|
48
48
|
}, [c.id]);
|
|
49
49
|
const N = /* @__PURE__ */ e(ot, { collectionOrView: u }), f = l?.filter((s) => !r?.includes(s)), {
|
|
@@ -144,7 +144,7 @@ function yi({
|
|
|
144
144
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
145
145
|
xt,
|
|
146
146
|
{
|
|
147
|
-
expanded:
|
|
147
|
+
expanded: k,
|
|
148
148
|
onExpandedChange: b,
|
|
149
149
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
150
150
|
/* @__PURE__ */ e(He, {}),
|
|
@@ -328,7 +328,7 @@ function Ci({
|
|
|
328
328
|
return n?.(g), c;
|
|
329
329
|
}
|
|
330
330
|
}), { values: p, errors: h } = u;
|
|
331
|
-
return
|
|
331
|
+
return de(() => {
|
|
332
332
|
r && r(p.enumValues);
|
|
333
333
|
}, [p.enumValues]), /* @__PURE__ */ e(kt, { value: u, children: /* @__PURE__ */ e(
|
|
334
334
|
Pi,
|
|
@@ -453,10 +453,10 @@ const Ni = Y.memo(
|
|
|
453
453
|
errors: c,
|
|
454
454
|
setFieldValue: g,
|
|
455
455
|
touched: v
|
|
456
|
-
} = K(), x = Y.useRef(!I(h, `${i}[${r}].id`)), y = n || x.current, P = I(h, `${i}[${r}].id`),
|
|
456
|
+
} = K(), x = Y.useRef(!I(h, `${i}[${r}].id`)), y = n || x.current, P = I(h, `${i}[${r}].id`), k = I(h, `${i}[${r}].label`), b = Y.useRef(k);
|
|
457
457
|
return Y.useEffect(() => {
|
|
458
|
-
(b.current === P || !P) && y && g(`${i}[${r}].id`,
|
|
459
|
-
}, [
|
|
458
|
+
(b.current === P || !P) && y && g(`${i}[${r}].id`, k), b.current = k;
|
|
459
|
+
}, [k]), /* @__PURE__ */ a(j, { children: [
|
|
460
460
|
/* @__PURE__ */ a("div", { className: "flex w-full align-center justify-center", children: [
|
|
461
461
|
/* @__PURE__ */ e(
|
|
462
462
|
H,
|
|
@@ -552,7 +552,7 @@ function xi({
|
|
|
552
552
|
}
|
|
553
553
|
);
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function ce({
|
|
556
556
|
field: t,
|
|
557
557
|
form: r,
|
|
558
558
|
label: n,
|
|
@@ -583,14 +583,14 @@ function se({
|
|
|
583
583
|
}
|
|
584
584
|
function Se({ disabled: t }) {
|
|
585
585
|
const { values: r, handleChange: n } = K(), i = "validation.required", l = "validation.requiredMessage";
|
|
586
|
-
return /* @__PURE__ */ a(
|
|
586
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
587
587
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
588
588
|
H,
|
|
589
589
|
{
|
|
590
590
|
name: i,
|
|
591
591
|
type: "checkbox",
|
|
592
592
|
children: ({ field: d, form: u }) => /* @__PURE__ */ e(
|
|
593
|
-
|
|
593
|
+
ce,
|
|
594
594
|
{
|
|
595
595
|
disabled: t,
|
|
596
596
|
label: "Required",
|
|
@@ -607,7 +607,7 @@ function Se({ disabled: t }) {
|
|
|
607
607
|
name: "validation.unique",
|
|
608
608
|
type: "checkbox",
|
|
609
609
|
children: ({ field: d, form: u }) => /* @__PURE__ */ e(
|
|
610
|
-
|
|
610
|
+
ce,
|
|
611
611
|
{
|
|
612
612
|
disabled: t,
|
|
613
613
|
label: "Unique",
|
|
@@ -646,17 +646,17 @@ function Ee({
|
|
|
646
646
|
values: h,
|
|
647
647
|
handleChange: m,
|
|
648
648
|
errors: c
|
|
649
|
-
} = K(), g = "validation.length", v = "validation.min", x = "validation.max", y = "validation.trim", P = "validation.matches",
|
|
649
|
+
} = K(), g = "validation.length", v = "validation.min", x = "validation.max", y = "validation.trim", P = "validation.matches", k = "validation.lowercase", b = "validation.uppercase", C = I(c, P), N = I(h, P), f = typeof N == "string" ? N : br(N);
|
|
650
650
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
651
651
|
/* @__PURE__ */ e(Se, { disabled: u }),
|
|
652
652
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
653
653
|
r && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
654
654
|
H,
|
|
655
655
|
{
|
|
656
|
-
name:
|
|
656
|
+
name: k,
|
|
657
657
|
type: "checkbox",
|
|
658
658
|
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
659
|
-
|
|
659
|
+
ce,
|
|
660
660
|
{
|
|
661
661
|
label: "Lowercase",
|
|
662
662
|
disabled: u,
|
|
@@ -672,7 +672,7 @@ function Ee({
|
|
|
672
672
|
name: b,
|
|
673
673
|
type: "checkbox",
|
|
674
674
|
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
675
|
-
|
|
675
|
+
ce,
|
|
676
676
|
{
|
|
677
677
|
label: "Uppercase",
|
|
678
678
|
disabled: u,
|
|
@@ -688,7 +688,7 @@ function Ee({
|
|
|
688
688
|
name: y,
|
|
689
689
|
type: "checkbox",
|
|
690
690
|
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
691
|
-
|
|
691
|
+
ce,
|
|
692
692
|
{
|
|
693
693
|
label: "Trim",
|
|
694
694
|
disabled: u,
|
|
@@ -828,7 +828,7 @@ function Rt({
|
|
|
828
828
|
setFieldError: u,
|
|
829
829
|
setFieldValue: p
|
|
830
830
|
} = K(), h = Ie(), m = t ? "of.enumValues" : "enumValues", c = I(d, "defaultValue"), g = I(d, m), v = Zt(() => !g || typeof g == "boolean" ? [] : Cr(g) ?? [], [g]);
|
|
831
|
-
return /* @__PURE__ */ a(
|
|
831
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
832
832
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
833
833
|
Ci,
|
|
834
834
|
{
|
|
@@ -842,7 +842,7 @@ function Rt({
|
|
|
842
842
|
getData: o ? () => o().then((y) => y.map((P) => d.id && I(P, d.id)).filter(Boolean)) : void 0,
|
|
843
843
|
onValuesChanged: (y) => {
|
|
844
844
|
if (d && (p(m, y), !t)) {
|
|
845
|
-
const P = y.filter((
|
|
845
|
+
const P = y.filter((k) => !!k?.id).map((k) => k.id);
|
|
846
846
|
c && !P.includes(c) && (p("defaultValue", void 0), h.open({
|
|
847
847
|
type: "warning",
|
|
848
848
|
message: "Default value was cleared"
|
|
@@ -900,8 +900,8 @@ function Ut({
|
|
|
900
900
|
setFieldValue: l
|
|
901
901
|
} = K(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`, u = `${o}.fileName`, p = `${o}.storagePath`, h = `${o}.storeUrl`, m = I(i, u) ?? "{rand}_{file}", c = I(i, p) ?? "/", g = I(i, d), v = Array.isArray(g) ? g : void 0, x = !v || v.length === 0, y = (b) => {
|
|
902
902
|
b ? b.includes("all") || b.length >= Object.keys(it).length ? l(d, void 0) : x ? l(d, Object.keys(it).filter((C) => !b.includes(C))) : l(d, b) : l(d, void 0);
|
|
903
|
-
}, P = typeof m == "function",
|
|
904
|
-
return /* @__PURE__ */ a(
|
|
903
|
+
}, P = typeof m == "function", k = typeof c == "function";
|
|
904
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
905
905
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
906
906
|
xt,
|
|
907
907
|
{
|
|
@@ -975,9 +975,9 @@ function Ut({
|
|
|
975
975
|
name: p,
|
|
976
976
|
as: Z,
|
|
977
977
|
label: "Storage path",
|
|
978
|
-
disabled:
|
|
978
|
+
disabled: k || n,
|
|
979
979
|
size: "small",
|
|
980
|
-
value:
|
|
980
|
+
value: k ? "-" : c
|
|
981
981
|
}
|
|
982
982
|
),
|
|
983
983
|
/* @__PURE__ */ a(O, { variant: "caption", className: "ml-3.5 mt-1 mb-2", children: [
|
|
@@ -998,7 +998,7 @@ function Ut({
|
|
|
998
998
|
name: h,
|
|
999
999
|
type: "checkbox",
|
|
1000
1000
|
children: ({ field: b, form: C }) => /* @__PURE__ */ e(
|
|
1001
|
-
|
|
1001
|
+
ce,
|
|
1002
1002
|
{
|
|
1003
1003
|
label: "Save URL instead of storage path",
|
|
1004
1004
|
disabled: r || n,
|
|
@@ -1219,27 +1219,27 @@ const ft = Y.memo(
|
|
|
1219
1219
|
const v = o ?? Object.keys(l), x = Q((y) => {
|
|
1220
1220
|
if (!y.destination)
|
|
1221
1221
|
return;
|
|
1222
|
-
const P = y.source.index,
|
|
1223
|
-
b.splice(
|
|
1222
|
+
const P = y.source.index, k = y.destination.index, b = Array.from(v), [C] = b.splice(P, 1);
|
|
1223
|
+
b.splice(k, 0, C), p && p(b, r);
|
|
1224
1224
|
}, [r, p, v]);
|
|
1225
|
-
return /* @__PURE__ */ e(
|
|
1225
|
+
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(ii, { onDragEnd: x, children: /* @__PURE__ */ e(ni, { droppableId: `droppable_${r}`, children: (y, P) => /* @__PURE__ */ a(
|
|
1226
1226
|
"div",
|
|
1227
1227
|
{
|
|
1228
1228
|
...y.droppableProps,
|
|
1229
1229
|
ref: y.innerRef,
|
|
1230
1230
|
className: m,
|
|
1231
1231
|
children: [
|
|
1232
|
-
v && v.map((
|
|
1233
|
-
const C = l[
|
|
1234
|
-
return !C && !N ? (console.warn(`Property ${
|
|
1232
|
+
v && v.map((k, b) => {
|
|
1233
|
+
const C = l[k], N = d?.find((f) => f.key === k);
|
|
1234
|
+
return !C && !N ? (console.warn(`Property ${k} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
1235
1235
|
ai,
|
|
1236
1236
|
{
|
|
1237
|
-
draggableId: `array_field_${r}_${
|
|
1237
|
+
draggableId: `array_field_${r}_${k}}`,
|
|
1238
1238
|
index: b,
|
|
1239
1239
|
children: (f, w) => /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1240
1240
|
ki,
|
|
1241
1241
|
{
|
|
1242
|
-
propertyKey:
|
|
1242
|
+
propertyKey: k,
|
|
1243
1243
|
propertyOrBuilder: C,
|
|
1244
1244
|
additionalField: N,
|
|
1245
1245
|
provided: f,
|
|
@@ -1254,7 +1254,7 @@ const ft = Y.memo(
|
|
|
1254
1254
|
}
|
|
1255
1255
|
) })
|
|
1256
1256
|
},
|
|
1257
|
-
`array_field_${r}_${
|
|
1257
|
+
`array_field_${r}_${k}}`
|
|
1258
1258
|
);
|
|
1259
1259
|
}).filter(Boolean),
|
|
1260
1260
|
y.placeholder
|
|
@@ -1302,7 +1302,7 @@ function ki({
|
|
|
1302
1302
|
}
|
|
1303
1303
|
));
|
|
1304
1304
|
}
|
|
1305
|
-
const
|
|
1305
|
+
const k = o === v, b = n && (c && !ne(n) || qe(n));
|
|
1306
1306
|
return /* @__PURE__ */ a(
|
|
1307
1307
|
"div",
|
|
1308
1308
|
{
|
|
@@ -1328,7 +1328,7 @@ function ki({
|
|
|
1328
1328
|
property: n,
|
|
1329
1329
|
onClick: u ? () => u(t, r) : void 0,
|
|
1330
1330
|
includeName: !0,
|
|
1331
|
-
selected:
|
|
1331
|
+
selected: k,
|
|
1332
1332
|
hasError: y
|
|
1333
1333
|
}
|
|
1334
1334
|
) : /* @__PURE__ */ e(
|
|
@@ -1337,7 +1337,7 @@ function ki({
|
|
|
1337
1337
|
name: t,
|
|
1338
1338
|
property: n,
|
|
1339
1339
|
onClick: u ? () => u(t, r) : void 0,
|
|
1340
|
-
selected:
|
|
1340
|
+
selected: k
|
|
1341
1341
|
}
|
|
1342
1342
|
),
|
|
1343
1343
|
/* @__PURE__ */ a("div", { className: "absolute top-2 right-2 flex flex-row ", children: [
|
|
@@ -1387,10 +1387,10 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1387
1387
|
throw Error("collection editor miss config");
|
|
1388
1388
|
const _ = pe(w), M = ye(f), R = I(o, M) ?? Object.keys(I(o, bi(f)));
|
|
1389
1389
|
d(_, void 0, !1), d(M, R.filter((D) => D !== N), !1), p(!1), m(void 0), g(void 0);
|
|
1390
|
-
}, [d, o]), P = h ? ae(h, c) : void 0,
|
|
1390
|
+
}, [d, o]), P = h ? ae(h, c) : void 0, k = P ? I(o.properties, P.replaceAll(".", ".properties.")) : void 0, b = !v || v.length < 1, C = Q((N, f) => {
|
|
1391
1391
|
d(ye(f), N, !1);
|
|
1392
1392
|
}, []);
|
|
1393
|
-
return /* @__PURE__ */ a(
|
|
1393
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1394
1394
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1395
1395
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end my-4", children: [
|
|
1396
1396
|
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Properties in this group" }),
|
|
@@ -1400,7 +1400,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1400
1400
|
color: "primary",
|
|
1401
1401
|
variant: "outlined",
|
|
1402
1402
|
onClick: () => p(!0),
|
|
1403
|
-
startIcon: /* @__PURE__ */ e(
|
|
1403
|
+
startIcon: /* @__PURE__ */ e(se, {}),
|
|
1404
1404
|
children: [
|
|
1405
1405
|
"Add property to ",
|
|
1406
1406
|
o.name ?? "this group"
|
|
@@ -1463,7 +1463,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1463
1463
|
onDelete: y,
|
|
1464
1464
|
propertyKey: h,
|
|
1465
1465
|
propertyNamespace: c,
|
|
1466
|
-
property:
|
|
1466
|
+
property: k,
|
|
1467
1467
|
existingProperty: !!h,
|
|
1468
1468
|
autoUpdateId: !h,
|
|
1469
1469
|
autoOpenTypeSelect: !h,
|
|
@@ -1491,8 +1491,8 @@ function Vi({
|
|
|
1491
1491
|
touched: c
|
|
1492
1492
|
} = K(), [g, v] = $(!1), x = I(u, "of"), y = I(c, "of") && I(h, "of"), P = ({ id: b, property: C, namespace: N }) => {
|
|
1493
1493
|
console.log("onPropertyChanged", b, C, N), m("of", C);
|
|
1494
|
-
},
|
|
1495
|
-
return /* @__PURE__ */ a(
|
|
1494
|
+
}, k = x && $e(x, o);
|
|
1495
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1496
1496
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1497
1497
|
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Repeat component" }),
|
|
1498
1498
|
/* @__PURE__ */ e(
|
|
@@ -1521,7 +1521,7 @@ function Vi({
|
|
|
1521
1521
|
onClick: () => v(!0),
|
|
1522
1522
|
children: [
|
|
1523
1523
|
"Edit ",
|
|
1524
|
-
`${
|
|
1524
|
+
`${k ? k.name : "repeat component"}`
|
|
1525
1525
|
]
|
|
1526
1526
|
}
|
|
1527
1527
|
),
|
|
@@ -1566,7 +1566,7 @@ const Ii = Y.forwardRef(
|
|
|
1566
1566
|
setFieldTouched: m,
|
|
1567
1567
|
touched: c,
|
|
1568
1568
|
validate: g
|
|
1569
|
-
} = K(), v = "name", x = r && I(u, v), y = "id", P = r && I(u, y),
|
|
1569
|
+
} = K(), v = "name", x = r && I(u, v), y = "id", P = r && I(u, y), k = "description", b = r && I(u, k);
|
|
1570
1570
|
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
1571
1571
|
/* @__PURE__ */ a("div", { children: [
|
|
1572
1572
|
/* @__PURE__ */ e(
|
|
@@ -1613,7 +1613,7 @@ const Ii = Y.forwardRef(
|
|
|
1613
1613
|
/* @__PURE__ */ e(
|
|
1614
1614
|
H,
|
|
1615
1615
|
{
|
|
1616
|
-
name:
|
|
1616
|
+
name: k,
|
|
1617
1617
|
as: Z,
|
|
1618
1618
|
label: "Description",
|
|
1619
1619
|
disabled: i,
|
|
@@ -1631,7 +1631,7 @@ function _i({
|
|
|
1631
1631
|
showErrors: n
|
|
1632
1632
|
}) {
|
|
1633
1633
|
const { values: i, setFieldValue: l } = K();
|
|
1634
|
-
return /* @__PURE__ */ a(
|
|
1634
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1635
1635
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Ne, { children: [
|
|
1636
1636
|
t === "text_field" && /* @__PURE__ */ e(
|
|
1637
1637
|
Ee,
|
|
@@ -1700,14 +1700,14 @@ function _i({
|
|
|
1700
1700
|
}
|
|
1701
1701
|
function Fi({ disabled: t }) {
|
|
1702
1702
|
const { values: r } = K(), n = I(r, "defaultValue");
|
|
1703
|
-
return /* @__PURE__ */ a(
|
|
1703
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1704
1704
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Se, { disabled: t }) }) }),
|
|
1705
1705
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1706
1706
|
H,
|
|
1707
1707
|
{
|
|
1708
1708
|
name: "defaultValue",
|
|
1709
1709
|
children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
1710
|
-
|
|
1710
|
+
ce,
|
|
1711
1711
|
{
|
|
1712
1712
|
label: n == null ? "Default value not set" : "Default value is " + n.toString(),
|
|
1713
1713
|
disabled: t,
|
|
@@ -1743,13 +1743,13 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1743
1743
|
d(`oneOf.${pe(f)}`, void 0, !1);
|
|
1744
1744
|
const w = `oneOf.${ye(N)}`, _ = I(o, w);
|
|
1745
1745
|
d(w, _.filter((M) => M !== C), !1), p(!1), m(void 0), g(void 0);
|
|
1746
|
-
}, [d, o]),
|
|
1746
|
+
}, [d, o]), k = /* @__PURE__ */ a(
|
|
1747
1747
|
z,
|
|
1748
1748
|
{
|
|
1749
1749
|
autoFocus: !0,
|
|
1750
1750
|
color: "primary",
|
|
1751
1751
|
onClick: () => p(!0),
|
|
1752
|
-
startIcon: /* @__PURE__ */ e(
|
|
1752
|
+
startIcon: /* @__PURE__ */ e(se, {}),
|
|
1753
1753
|
children: [
|
|
1754
1754
|
"Add property to ",
|
|
1755
1755
|
o.name ?? "this block"
|
|
@@ -1758,11 +1758,11 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1758
1758
|
), b = Q((C, N) => {
|
|
1759
1759
|
d(`oneOf.${ye(N)}`, C, !1);
|
|
1760
1760
|
}, []);
|
|
1761
|
-
return /* @__PURE__ */ a(
|
|
1761
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1762
1762
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1763
1763
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end mt-8 mb-4", children: [
|
|
1764
1764
|
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Properties in this block" }),
|
|
1765
|
-
|
|
1765
|
+
k
|
|
1766
1766
|
] }),
|
|
1767
1767
|
/* @__PURE__ */ a(Ce, { className: "p-2 pl-8", children: [
|
|
1768
1768
|
/* @__PURE__ */ e(
|
|
@@ -1871,7 +1871,7 @@ function Ei({ disabled: t }) {
|
|
|
1871
1871
|
name: "validation.positive",
|
|
1872
1872
|
type: "checkbox",
|
|
1873
1873
|
children: ({ field: m, form: c }) => /* @__PURE__ */ e(
|
|
1874
|
-
|
|
1874
|
+
ce,
|
|
1875
1875
|
{
|
|
1876
1876
|
label: "Positive value",
|
|
1877
1877
|
disabled: t,
|
|
@@ -1887,7 +1887,7 @@ function Ei({ disabled: t }) {
|
|
|
1887
1887
|
name: "validation.negative",
|
|
1888
1888
|
type: "checkbox",
|
|
1889
1889
|
children: ({ field: m, form: c }) => /* @__PURE__ */ e(
|
|
1890
|
-
|
|
1890
|
+
ce,
|
|
1891
1891
|
{
|
|
1892
1892
|
label: "Negative value",
|
|
1893
1893
|
disabled: t,
|
|
@@ -1903,7 +1903,7 @@ function Ei({ disabled: t }) {
|
|
|
1903
1903
|
name: "validation.integer",
|
|
1904
1904
|
type: "checkbox",
|
|
1905
1905
|
children: ({ field: m, form: c }) => /* @__PURE__ */ e(
|
|
1906
|
-
|
|
1906
|
+
ce,
|
|
1907
1907
|
{
|
|
1908
1908
|
label: "Integer value",
|
|
1909
1909
|
disabled: t,
|
|
@@ -1917,7 +1917,7 @@ function Ei({ disabled: t }) {
|
|
|
1917
1917
|
}
|
|
1918
1918
|
function Ai({ disabled: t }) {
|
|
1919
1919
|
const { values: r, setFieldValue: n } = K();
|
|
1920
|
-
return /* @__PURE__ */ a(
|
|
1920
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1921
1921
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Ei, { disabled: t }) }) }),
|
|
1922
1922
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1923
1923
|
Oe,
|
|
@@ -1948,13 +1948,13 @@ function jt({
|
|
|
1948
1948
|
if (!Pe())
|
|
1949
1949
|
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(De, {}) });
|
|
1950
1950
|
const p = r ? "of.path" : "path", h = I(l, p), m = i && I(d, p);
|
|
1951
|
-
return /* @__PURE__ */ e(
|
|
1951
|
+
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1952
1952
|
H,
|
|
1953
1953
|
{
|
|
1954
1954
|
name: p,
|
|
1955
1955
|
pathPath: p,
|
|
1956
1956
|
type: "select",
|
|
1957
|
-
disabled: t || n,
|
|
1957
|
+
disabled: t && !!h || n,
|
|
1958
1958
|
value: h,
|
|
1959
1959
|
error: m,
|
|
1960
1960
|
handleChange: o,
|
|
@@ -1976,7 +1976,7 @@ function Di({
|
|
|
1976
1976
|
const u = d?.collections ?? [], p = Array.from(new Set(
|
|
1977
1977
|
Object.values(u).map((m) => m.group).filter(Boolean)
|
|
1978
1978
|
).values()), h = u.filter((m) => !m.group);
|
|
1979
|
-
return /* @__PURE__ */ a(
|
|
1979
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1980
1980
|
/* @__PURE__ */ a(
|
|
1981
1981
|
be,
|
|
1982
1982
|
{
|
|
@@ -2059,7 +2059,7 @@ function Bi({ disabled: t }) {
|
|
|
2059
2059
|
touched: i,
|
|
2060
2060
|
setFieldValue: l
|
|
2061
2061
|
} = K(), o = "mode", d = I(r, o), u = I(i, o) && I(n, o), p = "autoValue", h = I(r, p), m = I(i, p) && I(n, p);
|
|
2062
|
-
return /* @__PURE__ */ a(
|
|
2062
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
2063
2063
|
/* @__PURE__ */ a("div", { className: "flex flex-col col-span-12", children: [
|
|
2064
2064
|
/* @__PURE__ */ a(
|
|
2065
2065
|
be,
|
|
@@ -2121,7 +2121,7 @@ function Bi({ disabled: t }) {
|
|
|
2121
2121
|
function zi({ disabled: t }) {
|
|
2122
2122
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
2123
2123
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(H, { type: "checkbox", name: "hideFromCollection", children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
2124
|
-
|
|
2124
|
+
ce,
|
|
2125
2125
|
{
|
|
2126
2126
|
label: "Hide from collection",
|
|
2127
2127
|
disabled: t,
|
|
@@ -2136,7 +2136,7 @@ function zi({ disabled: t }) {
|
|
|
2136
2136
|
name: "readOnly",
|
|
2137
2137
|
type: "checkbox",
|
|
2138
2138
|
children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
2139
|
-
|
|
2139
|
+
ce,
|
|
2140
2140
|
{
|
|
2141
2141
|
label: "Read only",
|
|
2142
2142
|
disabled: t,
|
|
@@ -2150,7 +2150,7 @@ function zi({ disabled: t }) {
|
|
|
2150
2150
|
] });
|
|
2151
2151
|
}
|
|
2152
2152
|
function Mi({ disabled: t }) {
|
|
2153
|
-
return /* @__PURE__ */ e(
|
|
2153
|
+
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Se, { disabled: t }) }) }) });
|
|
2154
2154
|
}
|
|
2155
2155
|
function ar(t, r, n) {
|
|
2156
2156
|
let i;
|
|
@@ -2403,7 +2403,7 @@ function Ri({
|
|
|
2403
2403
|
showErrors: r
|
|
2404
2404
|
}) {
|
|
2405
2405
|
const { values: n, setFieldValue: i } = K(), l = I(n, "url");
|
|
2406
|
-
return /* @__PURE__ */ a(
|
|
2406
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
2407
2407
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
2408
2408
|
be,
|
|
2409
2409
|
{
|
|
@@ -2497,7 +2497,7 @@ const Ui = [
|
|
|
2497
2497
|
onError: x,
|
|
2498
2498
|
initialErrors: y,
|
|
2499
2499
|
forceShowErrors: P,
|
|
2500
|
-
allowDataInference:
|
|
2500
|
+
allowDataInference: k,
|
|
2501
2501
|
getController: b,
|
|
2502
2502
|
getData: C,
|
|
2503
2503
|
propertyConfigs: N,
|
|
@@ -2557,7 +2557,7 @@ const Ui = [
|
|
|
2557
2557
|
}), A.dataType === "reference" && !A.path && (s.path = "You must specify a target collection for the field"), A.propertyConfig === "repeat" && (A.of || (s.of = "You need to specify a repeat field")), A.propertyConfig === "block" && (A.oneOf || (s.oneOf = "You need to specify the properties of this block")), s;
|
|
2558
2558
|
}
|
|
2559
2559
|
});
|
|
2560
|
-
return
|
|
2560
|
+
return de(() => {
|
|
2561
2561
|
b?.(D);
|
|
2562
2562
|
}, [D, b]), /* @__PURE__ */ e(kt, { value: D, children: /* @__PURE__ */ e(
|
|
2563
2563
|
ji,
|
|
@@ -2574,7 +2574,7 @@ const Ui = [
|
|
|
2574
2574
|
autoOpenTypeSelect: i,
|
|
2575
2575
|
disabled: _,
|
|
2576
2576
|
getData: C,
|
|
2577
|
-
allowDataInference:
|
|
2577
|
+
allowDataInference: k,
|
|
2578
2578
|
propertyConfigs: N,
|
|
2579
2579
|
collectionEditable: f,
|
|
2580
2580
|
...D
|
|
@@ -2668,10 +2668,10 @@ function ji({
|
|
|
2668
2668
|
getData: x,
|
|
2669
2669
|
allowDataInference: y,
|
|
2670
2670
|
propertyConfigs: P,
|
|
2671
|
-
collectionEditable:
|
|
2671
|
+
collectionEditable: k
|
|
2672
2672
|
}) {
|
|
2673
2673
|
const [b, C] = $(o), [N, f] = $(!1), [w, _] = $(t?.dataType ? Kt(t) : void 0), M = Object.entries(lr).concat(Object.entries(P)), R = v ? M.filter(([q, L]) => !ne(L.property) && L.property?.dataType !== "array") : M, D = Ir(t), A = Le(null), s = Le(t), V = c && I(r, "selectedWidget");
|
|
2674
|
-
|
|
2674
|
+
de(() => {
|
|
2675
2675
|
if (u && (!d || D.id)) {
|
|
2676
2676
|
const {
|
|
2677
2677
|
id: q,
|
|
@@ -2683,7 +2683,7 @@ function ji({
|
|
|
2683
2683
|
namespace: h
|
|
2684
2684
|
}), s.current = D);
|
|
2685
2685
|
}
|
|
2686
|
-
}, [D, d, u, h]),
|
|
2686
|
+
}, [D, d, u, h]), de(() => {
|
|
2687
2687
|
t?.id && m && m(t?.id, h, r);
|
|
2688
2688
|
}, [r, m, h, t?.id]);
|
|
2689
2689
|
const G = (q) => {
|
|
@@ -2745,7 +2745,7 @@ function ji({
|
|
|
2745
2745
|
disabled: g,
|
|
2746
2746
|
getData: x,
|
|
2747
2747
|
allowDataInference: y,
|
|
2748
|
-
collectionEditable:
|
|
2748
|
+
collectionEditable: k,
|
|
2749
2749
|
propertyConfigs: P
|
|
2750
2750
|
}
|
|
2751
2751
|
) : w === "block" ? B = /* @__PURE__ */ e(
|
|
@@ -2754,7 +2754,7 @@ function ji({
|
|
|
2754
2754
|
disabled: g,
|
|
2755
2755
|
getData: x,
|
|
2756
2756
|
allowDataInference: y,
|
|
2757
|
-
collectionEditable:
|
|
2757
|
+
collectionEditable: k,
|
|
2758
2758
|
propertyConfigs: P
|
|
2759
2759
|
}
|
|
2760
2760
|
) : w === "reference" ? B = /* @__PURE__ */ e(
|
|
@@ -2781,10 +2781,10 @@ function ji({
|
|
|
2781
2781
|
getData: x,
|
|
2782
2782
|
allowDataInference: y,
|
|
2783
2783
|
disabled: g,
|
|
2784
|
-
collectionEditable:
|
|
2784
|
+
collectionEditable: k,
|
|
2785
2785
|
propertyConfigs: P
|
|
2786
2786
|
}
|
|
2787
|
-
) : w === "key_value" ? B = /* @__PURE__ */ e(Mi, { disabled: g }) : B = null, /* @__PURE__ */ a(
|
|
2787
|
+
) : w === "key_value" ? B = /* @__PURE__ */ e(Mi, { disabled: g }) : B = null, /* @__PURE__ */ a(j, { children: [
|
|
2788
2788
|
g && /* @__PURE__ */ a(Lr, { mode: "warn", children: [
|
|
2789
2789
|
/* @__PURE__ */ e(O, { children: "This property can't be edited" }),
|
|
2790
2790
|
/* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
@@ -2808,7 +2808,7 @@ function ji({
|
|
|
2808
2808
|
renderValue: (q) => {
|
|
2809
2809
|
if (!q)
|
|
2810
2810
|
return /* @__PURE__ */ e("em", { children: "Select a property widget" });
|
|
2811
|
-
const L = q, J = Gt[L] ?? P[L], le = J.property, Me = le && !ne(le) ? $e(le, P) : void 0, we = ne(le) || i && le.dataType !== t?.dataType,
|
|
2811
|
+
const L = q, J = Gt[L] ?? P[L], le = J.property, Me = le && !ne(le) ? $e(le, P) : void 0, we = ne(le) || i && le.dataType !== t?.dataType, ue = Me ? W(Me, J) : J;
|
|
2812
2812
|
return /* @__PURE__ */ a(
|
|
2813
2813
|
"div",
|
|
2814
2814
|
{
|
|
@@ -2820,15 +2820,15 @@ function ji({
|
|
|
2820
2820
|
we ? "w-full pointer-events-none opacity-50" : ""
|
|
2821
2821
|
),
|
|
2822
2822
|
children: [
|
|
2823
|
-
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(Ye, { propertyConfig:
|
|
2823
|
+
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(Ye, { propertyConfig: ue }) }),
|
|
2824
2824
|
/* @__PURE__ */ a("div", { className: "flex flex-col items-start text-base text-left", children: [
|
|
2825
|
-
/* @__PURE__ */ e("div", { children:
|
|
2825
|
+
/* @__PURE__ */ e("div", { children: ue.name }),
|
|
2826
2826
|
/* @__PURE__ */ e(
|
|
2827
2827
|
O,
|
|
2828
2828
|
{
|
|
2829
2829
|
variant: "caption",
|
|
2830
2830
|
color: "disabled",
|
|
2831
|
-
children: we ? "You can only switch to widgets that use the same data type" :
|
|
2831
|
+
children: we ? "You can only switch to widgets that use the same data type" : ue.description
|
|
2832
2832
|
}
|
|
2833
2833
|
)
|
|
2834
2834
|
] })
|
|
@@ -3027,12 +3027,12 @@ function Gi({
|
|
|
3027
3027
|
setFieldError: x,
|
|
3028
3028
|
setFieldTouched: y,
|
|
3029
3029
|
errors: P,
|
|
3030
|
-
dirty:
|
|
3030
|
+
dirty: k
|
|
3031
3031
|
} = K(), b = Ie(), C = Nr(), N = !C, [f, w] = $(), [_, M] = $(), [R, D] = $(), A = _ ? ae(_, R) : void 0, s = A ? I(g.properties, A.replaceAll(".", ".properties.")) : void 0, [V, G] = $(!1), [B, q] = $(!1), [L, J] = $(!1), [le, Me] = $([]), we = Y.useRef(g.propertiesOrder ? { "": g.propertiesOrder } : {});
|
|
3032
|
-
|
|
3033
|
-
l && l(
|
|
3034
|
-
}, [
|
|
3035
|
-
const
|
|
3032
|
+
de(() => {
|
|
3033
|
+
l && l(k);
|
|
3034
|
+
}, [k]);
|
|
3035
|
+
const ue = h ? () => {
|
|
3036
3036
|
h && (q(!0), h(g).then((F) => {
|
|
3037
3037
|
if (F && pt(F.properties), !F) {
|
|
3038
3038
|
b.open({
|
|
@@ -3041,85 +3041,91 @@ function Gi({
|
|
|
3041
3041
|
});
|
|
3042
3042
|
return;
|
|
3043
3043
|
}
|
|
3044
|
-
const
|
|
3045
|
-
if (
|
|
3044
|
+
const U = (F.properties ? Object.keys(F.properties) : []).filter((E) => !g.properties[E]);
|
|
3045
|
+
if (U.length === 0) {
|
|
3046
3046
|
b.open({
|
|
3047
3047
|
type: "info",
|
|
3048
3048
|
message: "No new properties found in existing data"
|
|
3049
3049
|
});
|
|
3050
3050
|
return;
|
|
3051
3051
|
}
|
|
3052
|
-
const
|
|
3053
|
-
...
|
|
3052
|
+
const T = {
|
|
3053
|
+
...U.reduce((E, ie) => (E[ie] = (F.properties ?? {})[ie], E), {}),
|
|
3054
3054
|
...g.properties
|
|
3055
3055
|
}, S = [
|
|
3056
|
-
...
|
|
3056
|
+
...U,
|
|
3057
3057
|
...g.propertiesOrder ?? []
|
|
3058
3058
|
];
|
|
3059
|
-
v("properties",
|
|
3059
|
+
v("properties", T, !1), he(S), Me(U);
|
|
3060
3060
|
}).finally(() => {
|
|
3061
3061
|
q(!1);
|
|
3062
3062
|
}));
|
|
3063
|
-
} : void 0, re = Q((F) => F ? we.current[F] ?? I(g, ye(F)) : we.current[""], [g]), he = Q((F,
|
|
3064
|
-
const
|
|
3065
|
-
v(
|
|
3066
|
-
}, [v]), Te = Q((F,
|
|
3067
|
-
const
|
|
3068
|
-
if (!
|
|
3063
|
+
} : void 0, re = Q((F) => F ? we.current[F] ?? I(g, ye(F)) : we.current[""], [g]), he = Q((F, U) => {
|
|
3064
|
+
const T = ye(U);
|
|
3065
|
+
v(T, F, !1), we.current[U ?? ""] = F;
|
|
3066
|
+
}, [v]), Te = Q((F, U) => {
|
|
3067
|
+
const T = F ? ae(F, U) : void 0;
|
|
3068
|
+
if (!T)
|
|
3069
3069
|
throw Error("collection editor miss config");
|
|
3070
|
-
v(pe(
|
|
3071
|
-
const E = re(
|
|
3072
|
-
he(E,
|
|
3073
|
-
}, [re, v, he]), Ge = (F,
|
|
3074
|
-
v(ye(
|
|
3070
|
+
v(pe(T), void 0, !1);
|
|
3071
|
+
const E = re(U).filter((ie) => ie !== F);
|
|
3072
|
+
he(E, U), J(!1), w(void 0), M(void 0), D(void 0);
|
|
3073
|
+
}, [re, v, he]), Ge = (F, U) => {
|
|
3074
|
+
v(ye(U), F, !1);
|
|
3075
3075
|
}, gt = ({
|
|
3076
3076
|
id: F,
|
|
3077
|
-
property:
|
|
3077
|
+
property: U
|
|
3078
3078
|
}) => {
|
|
3079
3079
|
if (!F)
|
|
3080
3080
|
throw Error("Need to include an ID when creating a new property");
|
|
3081
3081
|
v("properties", {
|
|
3082
3082
|
...g.properties ?? {},
|
|
3083
|
-
[F]:
|
|
3083
|
+
[F]: U
|
|
3084
3084
|
}, !1);
|
|
3085
|
-
const
|
|
3086
|
-
he(
|
|
3085
|
+
const T = [...g.propertiesOrder ?? Object.keys(g.properties), F];
|
|
3086
|
+
he(T), J(!1), C && (w(T.indexOf(F)), M(F)), D(void 0);
|
|
3087
3087
|
}, fe = ({
|
|
3088
3088
|
id: F,
|
|
3089
|
-
property:
|
|
3090
|
-
previousId:
|
|
3089
|
+
property: U,
|
|
3090
|
+
previousId: T,
|
|
3091
3091
|
namespace: S
|
|
3092
3092
|
}) => {
|
|
3093
3093
|
const E = F ? ae(F, S) : void 0, ie = E ? pe(E) : void 0;
|
|
3094
|
-
if (
|
|
3095
|
-
|
|
3094
|
+
if (T && T !== F) {
|
|
3095
|
+
console.debug("onPropertyChanged, id change", {
|
|
3096
|
+
id: F,
|
|
3097
|
+
property: U,
|
|
3098
|
+
previousId: T,
|
|
3099
|
+
namespace: S
|
|
3100
|
+
});
|
|
3101
|
+
const ke = ae(T, S), Vt = pe(ke), It = re(S).map((Xe) => Xe === T ? F : Xe).filter((Xe) => Xe !== void 0);
|
|
3096
3102
|
he(It, S), F && (w(It.indexOf(F)), M(F)), v(Vt, void 0, !1), y(Vt, !1, !1);
|
|
3097
3103
|
}
|
|
3098
3104
|
console.debug("onPropertyChanged", {
|
|
3099
3105
|
id: F,
|
|
3100
|
-
property:
|
|
3101
|
-
previousId:
|
|
3106
|
+
property: U,
|
|
3107
|
+
previousId: T,
|
|
3102
3108
|
namespace: S,
|
|
3103
3109
|
propertyPath: ie
|
|
3104
|
-
}), ie && (v(ie,
|
|
3105
|
-
}, Ke = Q((F,
|
|
3106
|
-
const S = F ? ae(F,
|
|
3110
|
+
}), ie && (v(ie, U, !1), y(ie, !0, !1));
|
|
3111
|
+
}, Ke = Q((F, U, T) => {
|
|
3112
|
+
const S = F ? ae(F, U) : void 0;
|
|
3107
3113
|
if (console.debug("onPropertyErrorInternal", {
|
|
3108
3114
|
id: F,
|
|
3109
|
-
namespace:
|
|
3110
|
-
error:
|
|
3115
|
+
namespace: U,
|
|
3116
|
+
error: T,
|
|
3111
3117
|
propertyPath: S
|
|
3112
3118
|
}), S) {
|
|
3113
|
-
const E =
|
|
3114
|
-
i(F,
|
|
3119
|
+
const E = T && Object.keys(T).length > 0;
|
|
3120
|
+
i(F, U, E ? T : void 0), x(pe(S), E ? "Property error" : void 0);
|
|
3115
3121
|
}
|
|
3116
3122
|
}, []), We = () => {
|
|
3117
3123
|
w(void 0), M(void 0);
|
|
3118
|
-
}, Ze = _ && n?.current?.properties ? n.current.properties[_] : void 0, Je = g?.propertiesOrder === void 0 || g.propertiesOrder.length === 0, Re = g.propertiesOrder ? g.propertiesOrder : Object.keys(g.properties), Qe = Zt(() => u(g.ownerId), [u, g.ownerId]), vt = Q((F,
|
|
3124
|
+
}, Ze = _ && n?.current?.properties ? n.current.properties[_] : void 0, Je = g?.propertiesOrder === void 0 || g.propertiesOrder.length === 0, Re = g.propertiesOrder ? g.propertiesOrder : Object.keys(g.properties), Qe = Zt(() => u(g.ownerId), [u, g.ownerId]), vt = Q((F, U) => {
|
|
3119
3125
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
3120
3126
|
propertyKey: F,
|
|
3121
|
-
namespace:
|
|
3122
|
-
}), w(Re.indexOf(F)), M(F), D(
|
|
3127
|
+
namespace: U
|
|
3128
|
+
}), w(Re.indexOf(F)), M(F), D(U);
|
|
3123
3129
|
}, [Re]), yt = /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3124
3130
|
/* @__PURE__ */ a("div", { className: me(
|
|
3125
3131
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
@@ -3166,12 +3172,12 @@ function Gi({
|
|
|
3166
3172
|
children: /* @__PURE__ */ e($r, {})
|
|
3167
3173
|
}
|
|
3168
3174
|
) }),
|
|
3169
|
-
|
|
3175
|
+
ue && /* @__PURE__ */ e(te, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
|
|
3170
3176
|
oe,
|
|
3171
3177
|
{
|
|
3172
3178
|
variant: "filled",
|
|
3173
3179
|
disabled: B,
|
|
3174
|
-
onClick:
|
|
3180
|
+
onClick: ue,
|
|
3175
3181
|
children: B ? /* @__PURE__ */ e(De, { size: "small" }) : /* @__PURE__ */ e(ht, {})
|
|
3176
3182
|
}
|
|
3177
3183
|
) }),
|
|
@@ -3180,7 +3186,7 @@ function Gi({
|
|
|
3180
3186
|
{
|
|
3181
3187
|
variant: "outlined",
|
|
3182
3188
|
onClick: () => J(!0),
|
|
3183
|
-
children: /* @__PURE__ */ e(
|
|
3189
|
+
children: /* @__PURE__ */ e(se, {})
|
|
3184
3190
|
}
|
|
3185
3191
|
) })
|
|
3186
3192
|
] })
|
|
@@ -3209,7 +3215,7 @@ function Gi({
|
|
|
3209
3215
|
variant: "outlined",
|
|
3210
3216
|
size: "large",
|
|
3211
3217
|
onClick: () => J(!0),
|
|
3212
|
-
startIcon: /* @__PURE__ */ e(
|
|
3218
|
+
startIcon: /* @__PURE__ */ e(se, {}),
|
|
3213
3219
|
children: "Add new property"
|
|
3214
3220
|
}
|
|
3215
3221
|
)
|
|
@@ -3241,7 +3247,20 @@ function Gi({
|
|
|
3241
3247
|
},
|
|
3242
3248
|
`edit_view_${f}`
|
|
3243
3249
|
),
|
|
3244
|
-
!s && /* @__PURE__ */
|
|
3250
|
+
!s && /* @__PURE__ */ a("div", { className: "w-full flex flex-col items-center justify-center h-full gap-4", children: [
|
|
3251
|
+
/* @__PURE__ */ e(O, { variant: "label", className: "", children: Je ? "Now you can add your first property" : "Select a property to edit it" }),
|
|
3252
|
+
/* @__PURE__ */ a(
|
|
3253
|
+
z,
|
|
3254
|
+
{
|
|
3255
|
+
variant: "outlined",
|
|
3256
|
+
onClick: () => J(!0),
|
|
3257
|
+
children: [
|
|
3258
|
+
/* @__PURE__ */ e(se, {}),
|
|
3259
|
+
"Add new property"
|
|
3260
|
+
]
|
|
3261
|
+
}
|
|
3262
|
+
)
|
|
3263
|
+
] }),
|
|
3245
3264
|
s && ne(s) && /* @__PURE__ */ e(O, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
|
|
3246
3265
|
]
|
|
3247
3266
|
}
|
|
@@ -3271,7 +3290,7 @@ function Gi({
|
|
|
3271
3290
|
`edit_view_${f}`
|
|
3272
3291
|
)
|
|
3273
3292
|
] });
|
|
3274
|
-
return /* @__PURE__ */ a(
|
|
3293
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
3275
3294
|
yt,
|
|
3276
3295
|
/* @__PURE__ */ e(
|
|
3277
3296
|
Ve,
|
|
@@ -3374,7 +3393,7 @@ function Zi({
|
|
|
3374
3393
|
const { entityViews: d } = Ae(), [u, p] = Y.useState(), [h, m] = Y.useState(!1), [c, g] = Y.useState(), [v, x] = Y.useState(), {
|
|
3375
3394
|
values: y,
|
|
3376
3395
|
setFieldValue: P
|
|
3377
|
-
} = K(),
|
|
3396
|
+
} = K(), k = t.subcollections ?? [], b = y.entityViews?.filter((f) => typeof f == "string").map((f) => xr(f, d)).filter(Boolean) ?? [], C = t.entityViews?.filter((f) => typeof f != "string") ?? [], N = b.length + C.length;
|
|
3378
3397
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3379
3398
|
/* @__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: [
|
|
3380
3399
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
@@ -3383,7 +3402,7 @@ function Zi({
|
|
|
3383
3402
|
y.name
|
|
3384
3403
|
] }),
|
|
3385
3404
|
/* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3386
|
-
|
|
3405
|
+
k && k.length > 0 && /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(Bt, { children: k.map((f) => /* @__PURE__ */ a(
|
|
3387
3406
|
bt,
|
|
3388
3407
|
{
|
|
3389
3408
|
onClick: () => x({
|
|
@@ -3428,7 +3447,7 @@ function Zi({
|
|
|
3428
3447
|
});
|
|
3429
3448
|
},
|
|
3430
3449
|
variant: "text",
|
|
3431
|
-
startIcon: /* @__PURE__ */ e(
|
|
3450
|
+
startIcon: /* @__PURE__ */ e(se, {}),
|
|
3432
3451
|
children: "Add subcollection"
|
|
3433
3452
|
}
|
|
3434
3453
|
)
|
|
@@ -3447,8 +3466,8 @@ function Zi({
|
|
|
3447
3466
|
target: "_blank",
|
|
3448
3467
|
children: "More info"
|
|
3449
3468
|
}
|
|
3450
|
-
), children: "Define your own custom views by uploading
|
|
3451
|
-
/* @__PURE__ */ e(
|
|
3469
|
+
), children: "Define your own custom views by uploading them with the CLI." }),
|
|
3470
|
+
/* @__PURE__ */ e(j, { children: /* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3452
3471
|
/* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3453
3472
|
b.map((f) => /* @__PURE__ */ a(bt, { children: [
|
|
3454
3473
|
/* @__PURE__ */ e(
|
|
@@ -3497,7 +3516,7 @@ function Zi({
|
|
|
3497
3516
|
m(!0);
|
|
3498
3517
|
},
|
|
3499
3518
|
variant: "text",
|
|
3500
|
-
startIcon: /* @__PURE__ */ e(
|
|
3519
|
+
startIcon: /* @__PURE__ */ e(se, {}),
|
|
3501
3520
|
children: "Add custom entity view"
|
|
3502
3521
|
}
|
|
3503
3522
|
)
|
|
@@ -3517,8 +3536,8 @@ function Zi({
|
|
|
3517
3536
|
console.debug("Deleting subcollection", f), n.deleteCollection(f), p(void 0);
|
|
3518
3537
|
},
|
|
3519
3538
|
onCancel: () => p(void 0),
|
|
3520
|
-
title: /* @__PURE__ */ e(
|
|
3521
|
-
body: /* @__PURE__ */ a(
|
|
3539
|
+
title: /* @__PURE__ */ e(j, { children: "Delete this subcollection?" }),
|
|
3540
|
+
body: /* @__PURE__ */ a(j, { children: [
|
|
3522
3541
|
" This will ",
|
|
3523
3542
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
3524
3543
|
", only the collection in the CMS"
|
|
@@ -3533,8 +3552,8 @@ function Zi({
|
|
|
3533
3552
|
P("entityViews", y.entityViews?.filter((f) => f !== c)), g(void 0);
|
|
3534
3553
|
},
|
|
3535
3554
|
onCancel: () => g(void 0),
|
|
3536
|
-
title: /* @__PURE__ */ e(
|
|
3537
|
-
body: /* @__PURE__ */ a(
|
|
3555
|
+
title: /* @__PURE__ */ e(j, { children: "Remove this view?" }),
|
|
3556
|
+
body: /* @__PURE__ */ a(j, { children: [
|
|
3538
3557
|
"This will ",
|
|
3539
3558
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
3540
3559
|
", only the view in the CMS"
|
|
@@ -3998,7 +4017,7 @@ function Ji({
|
|
|
3998
4017
|
existingCollectionPaths: l
|
|
3999
4018
|
}) {
|
|
4000
4019
|
const [o, d] = $(!1), [u, p] = $();
|
|
4001
|
-
|
|
4020
|
+
de(() => {
|
|
4002
4021
|
r && l && (d(!0), r(t).then((v) => {
|
|
4003
4022
|
const x = v.filter((y) => !(l ?? []).find((P) => P.trim().toLowerCase() === y.trim().toLowerCase()));
|
|
4004
4023
|
p(x);
|
|
@@ -4157,7 +4176,7 @@ function Qi({
|
|
|
4157
4176
|
previousId: y,
|
|
4158
4177
|
namespace: P
|
|
4159
4178
|
}) => {
|
|
4160
|
-
const
|
|
4179
|
+
const k = v ? ae(v, P) : void 0, b = k ? pe(k) : void 0, C = (f) => f ? p.current[f] ?? I(o, ye(f)) : p.current[""], N = (f, w) => {
|
|
4161
4180
|
const _ = ye(w);
|
|
4162
4181
|
i(_, f, !1), p.current[w ?? ""] = f;
|
|
4163
4182
|
};
|
|
@@ -4176,7 +4195,7 @@ function Qi({
|
|
|
4176
4195
|
property: y,
|
|
4177
4196
|
namespace: P
|
|
4178
4197
|
}) => {
|
|
4179
|
-
const
|
|
4198
|
+
const k = v ? ae(v, P) : void 0, b = k ? pe(k) : void 0, C = t.importData.map((f) => I(f, x)), N = {
|
|
4180
4199
|
...ti(C, y, rr),
|
|
4181
4200
|
editable: !0
|
|
4182
4201
|
};
|
|
@@ -4202,7 +4221,7 @@ function Qi({
|
|
|
4202
4221
|
{
|
|
4203
4222
|
property: v,
|
|
4204
4223
|
propertyKey: x,
|
|
4205
|
-
onPropertyNameChanged: (P,
|
|
4224
|
+
onPropertyNameChanged: (P, k) => i(`properties.${P}.name`, k, !1),
|
|
4206
4225
|
onEditClick: () => {
|
|
4207
4226
|
!x || !v || u({
|
|
4208
4227
|
...v,
|
|
@@ -4304,7 +4323,7 @@ function Xi({
|
|
|
4304
4323
|
);
|
|
4305
4324
|
}
|
|
4306
4325
|
function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
4307
|
-
|
|
4326
|
+
de(() => {
|
|
4308
4327
|
const l = pi(t.originProperties, r), o = t.importData.map((d) => mi(d, t.idColumn, t.headersMapping, r, l, "TEMP_PATH"));
|
|
4309
4328
|
t.setEntities(o);
|
|
4310
4329
|
}, []);
|
|
@@ -4366,7 +4385,7 @@ function ur(t) {
|
|
|
4366
4385
|
const r = t.open, [n, i] = je.useState(!1), [l, o] = je.useState(!1), d = Q(() => {
|
|
4367
4386
|
n ? o(!0) : t.handleClose(void 0);
|
|
4368
4387
|
}, [n, t.handleClose]);
|
|
4369
|
-
return
|
|
4388
|
+
return de(() => {
|
|
4370
4389
|
r || (i(!1), o(!1));
|
|
4371
4390
|
}, [r]), /* @__PURE__ */ a(
|
|
4372
4391
|
Fe,
|
|
@@ -4404,7 +4423,7 @@ function tn(t) {
|
|
|
4404
4423
|
topLevelNavigation: l,
|
|
4405
4424
|
collections: o
|
|
4406
4425
|
} = n, d = t.initialValues, u = !d?.path && (t.parentCollectionIds ?? []).length === 0, p = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], h = p.map((b) => b.path.trim().toLowerCase()), m = p.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [c, g] = je.useState(), [v, x] = je.useState(!1);
|
|
4407
|
-
if (
|
|
4426
|
+
if (de(() => {
|
|
4408
4427
|
try {
|
|
4409
4428
|
n.initialised && (t.editedCollectionId ? g(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : g(void 0), x(!0));
|
|
4410
4429
|
} catch (b) {
|
|
@@ -4417,7 +4436,7 @@ function tn(t) {
|
|
|
4417
4436
|
} = l, P = c ? {
|
|
4418
4437
|
...c,
|
|
4419
4438
|
id: c.id ?? c.path ?? _t(16)
|
|
4420
|
-
} : void 0,
|
|
4439
|
+
} : void 0, k = P ? nn(P, r) : {
|
|
4421
4440
|
id: d?.path ?? _t(16),
|
|
4422
4441
|
path: d?.path ?? "",
|
|
4423
4442
|
name: d?.name ?? "",
|
|
@@ -4431,7 +4450,7 @@ function tn(t) {
|
|
|
4431
4450
|
rn,
|
|
4432
4451
|
{
|
|
4433
4452
|
...t,
|
|
4434
|
-
initialValues:
|
|
4453
|
+
initialValues: k,
|
|
4435
4454
|
existingPaths: h,
|
|
4436
4455
|
existingIds: m,
|
|
4437
4456
|
includeTemplates: u,
|
|
@@ -4460,18 +4479,18 @@ function rn({
|
|
|
4460
4479
|
getData: x,
|
|
4461
4480
|
existingPaths: y,
|
|
4462
4481
|
existingIds: P,
|
|
4463
|
-
includeTemplates:
|
|
4482
|
+
includeTemplates: k,
|
|
4464
4483
|
collection: b,
|
|
4465
4484
|
setCollection: C,
|
|
4466
4485
|
initialValues: N,
|
|
4467
4486
|
propertyConfigs: f,
|
|
4468
4487
|
groups: w
|
|
4469
4488
|
}) {
|
|
4470
|
-
const _ = hi(), M = Pe(), R = Ie(), D = Le({}), A = t ?
|
|
4471
|
-
const S =
|
|
4489
|
+
const _ = hi(), M = Pe(), R = Ie(), D = Le({}), A = t ? k ? "welcome" : "details" : "properties", [s, V] = $(A), [G, B] = je.useState(), q = (T) => {
|
|
4490
|
+
const S = T.id || T.path;
|
|
4472
4491
|
return r.saveCollection({
|
|
4473
4492
|
id: S,
|
|
4474
|
-
collectionData:
|
|
4493
|
+
collectionData: T,
|
|
4475
4494
|
previousId: n,
|
|
4476
4495
|
parentCollectionIds: i
|
|
4477
4496
|
}).then(() => (B(void 0), !0)).catch((E) => (B(E), console.error(E), R.open({
|
|
@@ -4480,44 +4499,44 @@ function rn({
|
|
|
4480
4499
|
}), !1));
|
|
4481
4500
|
}, L = Q(() => {
|
|
4482
4501
|
s === "details" ? _.inUse ? V("import_data_saving") : V(p ? "extra_view" : "properties") : V(s === "welcome" ? "details" : s === "import_data_mapping" ? "import_data_preview" : s === "import_data_preview" ? "details" : s === "extra_view" ? "properties" : "details");
|
|
4483
|
-
}, [s, _.inUse, p]), J = Q((
|
|
4502
|
+
}, [s, _.inUse, p]), J = Q((T) => {
|
|
4484
4503
|
if (o)
|
|
4485
|
-
return o?.(
|
|
4486
|
-
}, [o, i]), le = Q(async (
|
|
4504
|
+
return o?.(T.path, T.collectionGroup ?? !1, i ?? []);
|
|
4505
|
+
}, [o, i]), le = Q(async (T) => {
|
|
4487
4506
|
try {
|
|
4488
4507
|
if (!J)
|
|
4489
|
-
return C(
|
|
4508
|
+
return C(T), Promise.resolve(T);
|
|
4490
4509
|
V("loading");
|
|
4491
|
-
const S = await J?.(
|
|
4510
|
+
const S = await J?.(T);
|
|
4492
4511
|
if (!S)
|
|
4493
|
-
return C(
|
|
4512
|
+
return C(T), Promise.resolve(T);
|
|
4494
4513
|
const E = {
|
|
4495
|
-
...
|
|
4514
|
+
...T ?? {}
|
|
4496
4515
|
};
|
|
4497
4516
|
return Object.keys(S.properties ?? {}).length > 0 && (E.properties = S.properties, E.propertiesOrder = S.propertiesOrder), E.propertiesOrder ? (C(E), console.debug("Inferred collection", {
|
|
4498
|
-
newCollection:
|
|
4517
|
+
newCollection: T ?? {},
|
|
4499
4518
|
values: E
|
|
4500
4519
|
}), E) : (E.propertiesOrder = Object.keys(E.properties), E);
|
|
4501
4520
|
} catch (S) {
|
|
4502
4521
|
return console.error(S), R.open({
|
|
4503
4522
|
type: "error",
|
|
4504
4523
|
message: "Error inferring collection: " + (S.message ?? "Details in the console")
|
|
4505
|
-
}),
|
|
4524
|
+
}), T;
|
|
4506
4525
|
}
|
|
4507
|
-
}, [i, J]),
|
|
4526
|
+
}, [i, J]), ue = Tt({
|
|
4508
4527
|
initialValues: N,
|
|
4509
|
-
onSubmit: (
|
|
4510
|
-
console.log("Submitting collection",
|
|
4528
|
+
onSubmit: (T, S) => {
|
|
4529
|
+
console.log("Submitting collection", T);
|
|
4511
4530
|
try {
|
|
4512
4531
|
if (!t) {
|
|
4513
|
-
q(
|
|
4514
|
-
S.resetForm({ values: N }), d(
|
|
4532
|
+
q(T).then(() => {
|
|
4533
|
+
S.resetForm({ values: N }), d(T);
|
|
4515
4534
|
});
|
|
4516
4535
|
return;
|
|
4517
4536
|
}
|
|
4518
|
-
s === "welcome" ? (L(), S.resetForm({ values:
|
|
4537
|
+
s === "welcome" ? (L(), S.resetForm({ values: T })) : s === "details" ? p || _.inUse ? (S.resetForm({ values: T }), L()) : t ? le(T).then((E) => {
|
|
4519
4538
|
S.resetForm({
|
|
4520
|
-
values: E ??
|
|
4539
|
+
values: E ?? T,
|
|
4521
4540
|
touched: {
|
|
4522
4541
|
path: !0,
|
|
4523
4542
|
name: !0
|
|
@@ -4525,31 +4544,31 @@ function rn({
|
|
|
4525
4544
|
});
|
|
4526
4545
|
}).finally(() => {
|
|
4527
4546
|
L();
|
|
4528
|
-
}) : (S.resetForm({ values:
|
|
4529
|
-
S.resetForm({ values: N }), L(), d(
|
|
4530
|
-
}) : (L(), S.resetForm({ values:
|
|
4547
|
+
}) : (S.resetForm({ values: T }), L()) : s === "extra_view" ? (L(), S.resetForm({ values: T })) : s === "import_data_mapping" || s === "import_data_preview" ? L() : s === "properties" ? q(T).then(() => {
|
|
4548
|
+
S.resetForm({ values: N }), L(), d(T);
|
|
4549
|
+
}) : (L(), S.resetForm({ values: T }));
|
|
4531
4550
|
} catch (E) {
|
|
4532
4551
|
R.open({
|
|
4533
4552
|
type: "error",
|
|
4534
4553
|
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4535
|
-
}), console.error(E), S.resetForm({ values:
|
|
4554
|
+
}), console.error(E), S.resetForm({ values: T });
|
|
4536
4555
|
}
|
|
4537
4556
|
},
|
|
4538
|
-
validation: (
|
|
4557
|
+
validation: (T) => {
|
|
4539
4558
|
let S = {};
|
|
4540
4559
|
const E = (s === "properties" || s === "subcollections" || s === "details") && vi;
|
|
4541
4560
|
if (E)
|
|
4542
4561
|
try {
|
|
4543
|
-
E.validateSync(
|
|
4562
|
+
E.validateSync(T, { abortEarly: !1 });
|
|
4544
4563
|
} catch (ie) {
|
|
4545
4564
|
ie.inner.forEach((ke) => {
|
|
4546
4565
|
S[ke.path] = ke.message;
|
|
4547
4566
|
});
|
|
4548
4567
|
}
|
|
4549
4568
|
if (s === "properties" && (S = { ...S, ...D.current }), s === "details") {
|
|
4550
|
-
const ie = Ht(
|
|
4569
|
+
const ie = Ht(T.path, t, y, T.id);
|
|
4551
4570
|
ie && (S.path = ie);
|
|
4552
|
-
const ke = an(
|
|
4571
|
+
const ke = an(T.id, t, y, P);
|
|
4553
4572
|
ke && (S.id = ke);
|
|
4554
4573
|
}
|
|
4555
4574
|
return S;
|
|
@@ -4560,27 +4579,27 @@ function rn({
|
|
|
4560
4579
|
isSubmitting: Te,
|
|
4561
4580
|
dirty: Ge,
|
|
4562
4581
|
submitCount: gt
|
|
4563
|
-
} =
|
|
4564
|
-
|
|
4582
|
+
} = ue, fe = re.path ?? n, Ke = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + fe : fe, We = Ht(fe, t, y, re.id), Ze = !We && i ? M.convertIdsToPaths(i) : void 0, Je = We ? void 0 : M.resolveAliasesFrom(Ke), Re = Je && x ? () => x(Je, Ze ?? []) : void 0;
|
|
4583
|
+
de(() => {
|
|
4565
4584
|
m(Ge);
|
|
4566
4585
|
}, [Ge]);
|
|
4567
|
-
function Qe(
|
|
4568
|
-
_.setInUse(!0), ri(
|
|
4586
|
+
function Qe(T) {
|
|
4587
|
+
_.setInUse(!0), ri(T, rr).then((S) => {
|
|
4569
4588
|
const E = dr(S);
|
|
4570
|
-
he("properties", E.properties), he("propertiesOrder", Object.keys(E.properties)), _.setIdColumn(E.idColumn), _.setImportData(
|
|
4589
|
+
he("properties", E.properties), he("propertiesOrder", Object.keys(E.properties)), _.setIdColumn(E.idColumn), _.setImportData(T), _.setHeadersMapping(E.headersMapping), _.setOriginProperties(E.properties);
|
|
4571
4590
|
});
|
|
4572
4591
|
}
|
|
4573
4592
|
const vt = !!re.name && !!re.id, yt = () => {
|
|
4574
|
-
const
|
|
4575
|
-
_.idColumn && delete
|
|
4576
|
-
},
|
|
4577
|
-
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value:
|
|
4593
|
+
const T = { ...re.properties };
|
|
4594
|
+
_.idColumn && delete T[_.idColumn], he("properties", T), L();
|
|
4595
|
+
}, U = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4596
|
+
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value: ue, children: /* @__PURE__ */ a(j, { children: [
|
|
4578
4597
|
!t && /* @__PURE__ */ a(
|
|
4579
4598
|
Hr,
|
|
4580
4599
|
{
|
|
4581
4600
|
value: s,
|
|
4582
4601
|
className: me(wt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
4583
|
-
onValueChange: (
|
|
4602
|
+
onValueChange: (T) => V(T),
|
|
4584
4603
|
children: [
|
|
4585
4604
|
/* @__PURE__ */ e(Ct, { value: "details", children: "Details" }),
|
|
4586
4605
|
/* @__PURE__ */ e(Ct, { value: "properties", children: "Properties" }),
|
|
@@ -4592,7 +4611,7 @@ function rn({
|
|
|
4592
4611
|
"form",
|
|
4593
4612
|
{
|
|
4594
4613
|
noValidate: !0,
|
|
4595
|
-
onSubmit:
|
|
4614
|
+
onSubmit: ue.handleSubmit,
|
|
4596
4615
|
className: me(
|
|
4597
4616
|
t ? "h-full" : "h-[calc(100%-48px)]",
|
|
4598
4617
|
"flex-grow flex flex-col relative"
|
|
@@ -4604,8 +4623,8 @@ function rn({
|
|
|
4604
4623
|
Ji,
|
|
4605
4624
|
{
|
|
4606
4625
|
path: fe,
|
|
4607
|
-
onContinue: (
|
|
4608
|
-
|
|
4626
|
+
onContinue: (T) => {
|
|
4627
|
+
T ? (Qe(T), V("import_data_mapping")) : V("details");
|
|
4609
4628
|
},
|
|
4610
4629
|
existingCollectionPaths: y,
|
|
4611
4630
|
parentCollection: v,
|
|
@@ -4616,7 +4635,7 @@ function rn({
|
|
|
4616
4635
|
Qi,
|
|
4617
4636
|
{
|
|
4618
4637
|
importConfig: _,
|
|
4619
|
-
collectionEditable:
|
|
4638
|
+
collectionEditable: U,
|
|
4620
4639
|
propertyConfigs: f
|
|
4621
4640
|
}
|
|
4622
4641
|
),
|
|
@@ -4633,11 +4652,11 @@ function rn({
|
|
|
4633
4652
|
{
|
|
4634
4653
|
importConfig: _,
|
|
4635
4654
|
collection: re,
|
|
4636
|
-
onImportSuccess: async (
|
|
4655
|
+
onImportSuccess: async (T) => {
|
|
4637
4656
|
R.open({
|
|
4638
4657
|
type: "info",
|
|
4639
4658
|
message: "Data imported successfully"
|
|
4640
|
-
}), await q(re), d(
|
|
4659
|
+
}), await q(re), d(T);
|
|
4641
4660
|
}
|
|
4642
4661
|
}
|
|
4643
4662
|
),
|
|
@@ -4669,18 +4688,18 @@ function rn({
|
|
|
4669
4688
|
showErrors: gt > 0,
|
|
4670
4689
|
isNewCollection: t,
|
|
4671
4690
|
reservedGroups: u,
|
|
4672
|
-
onPropertyError: (
|
|
4691
|
+
onPropertyError: (T, S, E) => {
|
|
4673
4692
|
const ie = Ft({
|
|
4674
4693
|
...D.current,
|
|
4675
|
-
[ir(
|
|
4694
|
+
[ir(T, S)]: Ft(E, !0)
|
|
4676
4695
|
}, !0);
|
|
4677
|
-
D.current = ie,
|
|
4696
|
+
D.current = ie, ue.validate();
|
|
4678
4697
|
},
|
|
4679
4698
|
getUser: g,
|
|
4680
4699
|
getData: Re,
|
|
4681
4700
|
doCollectionInference: J,
|
|
4682
4701
|
propertyConfigs: f,
|
|
4683
|
-
collectionEditable:
|
|
4702
|
+
collectionEditable: U,
|
|
4684
4703
|
extraIcon: p?.icon && /* @__PURE__ */ e(
|
|
4685
4704
|
oe,
|
|
4686
4705
|
{
|
|
@@ -4697,7 +4716,7 @@ function rn({
|
|
|
4697
4716
|
position: "absolute",
|
|
4698
4717
|
children: [
|
|
4699
4718
|
G && /* @__PURE__ */ e(Wt, { error: G }),
|
|
4700
|
-
t &&
|
|
4719
|
+
t && k && s === "import_data_mapping" && /* @__PURE__ */ a(
|
|
4701
4720
|
z,
|
|
4702
4721
|
{
|
|
4703
4722
|
variant: "text",
|
|
@@ -4709,7 +4728,7 @@ function rn({
|
|
|
4709
4728
|
]
|
|
4710
4729
|
}
|
|
4711
4730
|
),
|
|
4712
|
-
t &&
|
|
4731
|
+
t && k && s === "import_data_preview" && /* @__PURE__ */ a(
|
|
4713
4732
|
z,
|
|
4714
4733
|
{
|
|
4715
4734
|
variant: "text",
|
|
@@ -4723,7 +4742,7 @@ function rn({
|
|
|
4723
4742
|
]
|
|
4724
4743
|
}
|
|
4725
4744
|
),
|
|
4726
|
-
t &&
|
|
4745
|
+
t && k && s === "details" && /* @__PURE__ */ a(
|
|
4727
4746
|
z,
|
|
4728
4747
|
{
|
|
4729
4748
|
variant: "text",
|
|
@@ -4854,8 +4873,8 @@ const Ht = (t, r, n, i) => {
|
|
|
4854
4873
|
}) {
|
|
4855
4874
|
const c = Pe(), g = gi(), v = Ie(), { propertyConfigs: x } = Ae(), {
|
|
4856
4875
|
collections: y
|
|
4857
|
-
} = c, P = (y ?? []).map((s) => s.path.trim().toLowerCase()), [
|
|
4858
|
-
|
|
4876
|
+
} = c, P = (y ?? []).map((s) => s.path.trim().toLowerCase()), [k, b] = Y.useState();
|
|
4877
|
+
de(() => {
|
|
4859
4878
|
u && u().then((s) => {
|
|
4860
4879
|
b(s.filter((V) => !P.includes(V.trim().toLowerCase())));
|
|
4861
4880
|
});
|
|
@@ -4911,7 +4930,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4911
4930
|
initialValues: G,
|
|
4912
4931
|
redirect: B
|
|
4913
4932
|
});
|
|
4914
|
-
}, []), A = u ? (s) => !s &&
|
|
4933
|
+
}, []), A = u ? (s) => !s && k ? Promise.resolve(k) : u?.(s) : void 0;
|
|
4915
4934
|
return /* @__PURE__ */ e(mr.Provider, { value: n, children: /* @__PURE__ */ a(
|
|
4916
4935
|
hr.Provider,
|
|
4917
4936
|
{
|
|
@@ -4920,7 +4939,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4920
4939
|
createCollection: D,
|
|
4921
4940
|
editProperty: R,
|
|
4922
4941
|
configPermissions: i ?? _,
|
|
4923
|
-
rootPathSuggestions:
|
|
4942
|
+
rootPathSuggestions: k
|
|
4924
4943
|
},
|
|
4925
4944
|
children: [
|
|
4926
4945
|
r,
|
|
@@ -5032,7 +5051,7 @@ function ln({
|
|
|
5032
5051
|
collection: n
|
|
5033
5052
|
}).editCollections : !0;
|
|
5034
5053
|
let c = null;
|
|
5035
|
-
return (!ve(at(i.filterValues), at(n.initialFilter)) || !ve(at(i.sortBy), at(n.initialSort))) && (c = /* @__PURE__ */ a(
|
|
5054
|
+
return (!ve(at(i.filterValues), at(n.initialFilter)) || !ve(at(i.sortBy), at(n.initialSort))) && (c = /* @__PURE__ */ a(j, { children: [
|
|
5036
5055
|
(n.initialFilter || n.initialSort) && /* @__PURE__ */ e(
|
|
5037
5056
|
te,
|
|
5038
5057
|
{
|
|
@@ -5082,7 +5101,7 @@ function ln({
|
|
|
5082
5101
|
)
|
|
5083
5102
|
}
|
|
5084
5103
|
)
|
|
5085
|
-
] })), /* @__PURE__ */ a(
|
|
5104
|
+
] })), /* @__PURE__ */ a(j, { children: [
|
|
5086
5105
|
m && c,
|
|
5087
5106
|
/* @__PURE__ */ e(
|
|
5088
5107
|
te,
|
|
@@ -5121,7 +5140,7 @@ function sn({
|
|
|
5121
5140
|
});
|
|
5122
5141
|
});
|
|
5123
5142
|
}, [t, l]);
|
|
5124
|
-
return /* @__PURE__ */ a(
|
|
5143
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
5125
5144
|
/* @__PURE__ */ a("div", { children: [
|
|
5126
5145
|
d.deleteCollections && /* @__PURE__ */ e(
|
|
5127
5146
|
Zr,
|
|
@@ -5151,8 +5170,8 @@ function sn({
|
|
|
5151
5170
|
open: p,
|
|
5152
5171
|
onAccept: m,
|
|
5153
5172
|
onCancel: () => h(!1),
|
|
5154
|
-
title: /* @__PURE__ */ e(
|
|
5155
|
-
body: /* @__PURE__ */ a(
|
|
5173
|
+
title: /* @__PURE__ */ e(j, { children: "Delete this collection?" }),
|
|
5174
|
+
body: /* @__PURE__ */ a(j, { children: [
|
|
5156
5175
|
" This will ",
|
|
5157
5176
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
5158
5177
|
", only the collection in the CMS"
|
|
@@ -5185,7 +5204,7 @@ function cn({
|
|
|
5185
5204
|
{
|
|
5186
5205
|
className: "flex flex-col items-start h-full w-full items-center justify-center h-full w-full flex-grow flex-col",
|
|
5187
5206
|
children: [
|
|
5188
|
-
/* @__PURE__ */ e(
|
|
5207
|
+
/* @__PURE__ */ e(se, { color: "primary", size: "large" }),
|
|
5189
5208
|
/* @__PURE__ */ e(
|
|
5190
5209
|
O,
|
|
5191
5210
|
{
|
|
@@ -5233,7 +5252,7 @@ function dn({ introMode: t }) {
|
|
|
5233
5252
|
(o ?? []).map((p) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
5234
5253
|
st,
|
|
5235
5254
|
{
|
|
5236
|
-
icon: /* @__PURE__ */ e(
|
|
5255
|
+
icon: /* @__PURE__ */ e(se, { size: "small" }),
|
|
5237
5256
|
colorScheme: "cyanLighter",
|
|
5238
5257
|
onClick: i && l ? () => i.createCollection({
|
|
5239
5258
|
initialValues: { path: p, name: ut(p) },
|
|
@@ -5304,7 +5323,7 @@ function pn({
|
|
|
5304
5323
|
collection: n
|
|
5305
5324
|
});
|
|
5306
5325
|
},
|
|
5307
|
-
children: /* @__PURE__ */ e(
|
|
5326
|
+
children: /* @__PURE__ */ e(se, { color: "inherit" })
|
|
5308
5327
|
}
|
|
5309
5328
|
) });
|
|
5310
5329
|
}
|
|
@@ -5321,7 +5340,7 @@ function mn() {
|
|
|
5321
5340
|
sourceClick: "new_collection_button"
|
|
5322
5341
|
}),
|
|
5323
5342
|
children: [
|
|
5324
|
-
/* @__PURE__ */ e(
|
|
5343
|
+
/* @__PURE__ */ e(se, {}),
|
|
5325
5344
|
"New collection"
|
|
5326
5345
|
]
|
|
5327
5346
|
}
|
|
@@ -5392,7 +5411,7 @@ function hn({ introMode: t }) {
|
|
|
5392
5411
|
sourceClick: "new_collection_card"
|
|
5393
5412
|
}) : void 0,
|
|
5394
5413
|
children: [
|
|
5395
|
-
/* @__PURE__ */ e(
|
|
5414
|
+
/* @__PURE__ */ e(se, {}),
|
|
5396
5415
|
"Create your first collection"
|
|
5397
5416
|
]
|
|
5398
5417
|
}
|