@firecms/collection_editor 3.0.0-alpha.52 → 3.0.0-alpha.53
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 +495 -509
- 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 +4 -4
- package/src/ConfigControllerProvider.tsx +0 -1
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +0 -4
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +0 -9
- package/src/ui/collection_editor/PropertyEditView.tsx +0 -1
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +0 -1
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +0 -1
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +0 -5
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +0 -2
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as n, Fragment as
|
|
1
|
+
import { jsxs as n, Fragment as U, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import * as _e from "react";
|
|
3
|
-
import K, { useState as L, useEffect as pe, useMemo as Kt, useCallback as
|
|
4
|
-
import { iconKeys as Gt, debounce as ya, SearchBar as va, Tooltip as re, IconButton as ne, Icon as lt, coolIconKeys as xt, Typography as C, getIconForView as ct, useAutoComplete as wa, Container as ht, Chip as dt, TextField as Te, cn as xe, DebouncedTextField as
|
|
3
|
+
import K, { useState as L, useEffect as pe, useMemo as Kt, useCallback as Q, useRef as He, useDeferredValue as ba, useContext as Yt } from "react";
|
|
4
|
+
import { iconKeys as Gt, debounce as ya, SearchBar as va, Tooltip as re, IconButton as ne, Icon as lt, coolIconKeys as xt, Typography as C, getIconForView as ct, useAutoComplete as wa, Container as ht, Chip as dt, TextField as Te, cn as xe, DebouncedTextField as W, Autocomplete as _a, AutocompleteItem as ka, ExpandablePanel as Ot, SettingsIcon as Je, Select as Se, SelectItem as ee, BooleanSwitchWithLabel as Ht, Dialog as Ee, toSnakeCase as Ct, singular as xa, ListIcon as Ca, Button as R, CircularProgress as Qe, AutoAwesomeIcon as gt, Paper as qe, FormikArrayContainer as Oa, DialogContent as $e, DialogActions as Le, SwitchControl as he, serializeRegExp as Na, isValidRegExp as Pa, RuleIcon as Sa, useSnackbarController as De, resolveEnumValues as qa, FileUploadIcon as Aa, MultiSelect as za, MultiSelectItem as zt, Checkbox as Tt, isPropertyBuilder as oe, useFireCMSContext as Ke, getFieldConfig as Ze, ErrorBoundary as Ne, FieldConfigBadge as Xe, cardMixin as Wt, cardClickableMixin as Jt, cardSelectedMixin as Qt, FunctionsIcon as Ta, RemoveCircleIcon as Va, defaultBorderMixin as Nt, RemoveIcon as Ia, DragHandleIcon as Fa, AddIcon as Ae, useNavigationController as Be, SelectGroup as Vt, mergeDeep as G, DEFAULT_FIELD_CONFIGS as Zt, getFieldId as Xt, InfoLabel as ea, DeleteIcon as pt, DeleteConfirmationDialog as mt, ContentCopyIcon as ja, useLargeLayout as Ea, CodeIcon as Da, makePropertiesEditable as et, resolveEntityView as Ba, Table as It, TableBody as Ft, TableRow as wt, TableCell as Ge, unslugify as Pt, Card as ta, useSelectionController as Ma, EntityCollectionTable as Ra, slugify as Ua, useAuthController as Ye, randomString as jt, CircularProgressCenter as Et, Tabs as $a, Tab as _t, removeUndefined as La, ErrorView as aa, ArrowBackIcon as rt, LoadingButton as Dt, DoneIcon as Ka, SaveIcon as Ya, Menu as Ga, MoreVertIcon as Ha, MenuItem as Wa, Collapse as Ja, getDefaultPropertiesOrder as Qa, joinCollectionLists as Za } from "@firecms/core";
|
|
5
5
|
import ut from "react-fast-compare";
|
|
6
|
-
import { useFormikContext as Y, Field as
|
|
6
|
+
import { useFormikContext as Y, Field as be, getIn as N, Formik as St, FastField as de, Form as Xa } from "formik";
|
|
7
7
|
import * as ot from "yup";
|
|
8
8
|
import * as ei from "js-search";
|
|
9
9
|
import { extractEnumFromValues as ti, buildPropertyFromData as ai, buildEntityPropertiesFromData as ii } from "@firecms/schema_inference";
|
|
@@ -1990,7 +1990,7 @@ function wi({ selectedIcon: t = "", onIconSelected: a }) {
|
|
|
1990
1990
|
);
|
|
1991
1991
|
return _e.useEffect(() => (l(s), () => {
|
|
1992
1992
|
l.clear();
|
|
1993
|
-
}), [s, l]), /* @__PURE__ */ n(
|
|
1993
|
+
}), [s, l]), /* @__PURE__ */ n(U, { children: [
|
|
1994
1994
|
/* @__PURE__ */ e(
|
|
1995
1995
|
va,
|
|
1996
1996
|
{
|
|
@@ -2033,13 +2033,13 @@ function _i({
|
|
|
2033
2033
|
touched: d,
|
|
2034
2034
|
errors: c,
|
|
2035
2035
|
setFieldTouched: y,
|
|
2036
|
-
isSubmitting:
|
|
2036
|
+
isSubmitting: f,
|
|
2037
2037
|
submitCount: b
|
|
2038
|
-
} = Y(), [
|
|
2039
|
-
m("name", S), !
|
|
2038
|
+
} = Y(), [P, w] = L(!1), [k, g] = L(!1), v = (S) => {
|
|
2039
|
+
m("name", S), !N(d, "path") && t && S && m("path", Ct(S)), !N(d, "id") && t && S && m("id", Ct(S)), !N(d, "singularName") && t && S && m("singularName", xa(S));
|
|
2040
2040
|
};
|
|
2041
2041
|
pe(() => {
|
|
2042
|
-
c.id &&
|
|
2042
|
+
c.id && g(!0);
|
|
2043
2043
|
}, [c.id]);
|
|
2044
2044
|
const _ = ct(p), h = s?.filter((S) => !a?.includes(S)), {
|
|
2045
2045
|
inputFocused: A,
|
|
@@ -2089,10 +2089,10 @@ function _i({
|
|
|
2089
2089
|
] }),
|
|
2090
2090
|
/* @__PURE__ */ n("div", { className: xe("col-span-12 ", q ? "" : "sm:col-span-8"), children: [
|
|
2091
2091
|
/* @__PURE__ */ e(
|
|
2092
|
-
|
|
2092
|
+
be,
|
|
2093
2093
|
{
|
|
2094
2094
|
name: "path",
|
|
2095
|
-
as:
|
|
2095
|
+
as: W,
|
|
2096
2096
|
label: "Path",
|
|
2097
2097
|
disabled: !t,
|
|
2098
2098
|
required: !0,
|
|
@@ -2106,7 +2106,7 @@ function _i({
|
|
|
2106
2106
|
Te,
|
|
2107
2107
|
{
|
|
2108
2108
|
error: d.group && !!c.group,
|
|
2109
|
-
disabled:
|
|
2109
|
+
disabled: f,
|
|
2110
2110
|
value: p.group ?? "",
|
|
2111
2111
|
autoComplete: "off",
|
|
2112
2112
|
onChange: (S) => m("group", S.target.value),
|
|
@@ -2120,7 +2120,7 @@ function _i({
|
|
|
2120
2120
|
{
|
|
2121
2121
|
open: E && (h ?? []).length > 0,
|
|
2122
2122
|
setOpen: z,
|
|
2123
|
-
children: h?.map((S,
|
|
2123
|
+
children: h?.map((S, O) => /* @__PURE__ */ e(
|
|
2124
2124
|
ka,
|
|
2125
2125
|
{
|
|
2126
2126
|
onClick: () => {
|
|
@@ -2128,7 +2128,7 @@ function _i({
|
|
|
2128
2128
|
},
|
|
2129
2129
|
children: /* @__PURE__ */ e("div", { className: "flex-grow", children: S })
|
|
2130
2130
|
},
|
|
2131
|
-
|
|
2131
|
+
O + "_" + S
|
|
2132
2132
|
))
|
|
2133
2133
|
}
|
|
2134
2134
|
),
|
|
@@ -2138,9 +2138,9 @@ function _i({
|
|
|
2138
2138
|
Ot,
|
|
2139
2139
|
{
|
|
2140
2140
|
expanded: k,
|
|
2141
|
-
onExpandedChange:
|
|
2141
|
+
onExpandedChange: g,
|
|
2142
2142
|
title: /* @__PURE__ */ n("div", { className: "flex flex-row text-gray-500", children: [
|
|
2143
|
-
/* @__PURE__ */ e(
|
|
2143
|
+
/* @__PURE__ */ e(Je, {}),
|
|
2144
2144
|
/* @__PURE__ */ e(
|
|
2145
2145
|
C,
|
|
2146
2146
|
{
|
|
@@ -2184,10 +2184,10 @@ function _i({
|
|
|
2184
2184
|
] }),
|
|
2185
2185
|
/* @__PURE__ */ n("div", { className: "col-span-12", children: [
|
|
2186
2186
|
/* @__PURE__ */ e(
|
|
2187
|
-
|
|
2187
|
+
be,
|
|
2188
2188
|
{
|
|
2189
2189
|
name: "id",
|
|
2190
|
-
as:
|
|
2190
|
+
as: W,
|
|
2191
2191
|
disabled: !t,
|
|
2192
2192
|
label: "Collection id",
|
|
2193
2193
|
error: d.id && !!c.id
|
|
@@ -2255,7 +2255,7 @@ function _i({
|
|
|
2255
2255
|
/* @__PURE__ */ e(
|
|
2256
2256
|
Ee,
|
|
2257
2257
|
{
|
|
2258
|
-
open:
|
|
2258
|
+
open: P,
|
|
2259
2259
|
onOpenChange: w,
|
|
2260
2260
|
maxWidth: "xl",
|
|
2261
2261
|
fullWidth: !0,
|
|
@@ -2338,18 +2338,18 @@ function Ci({
|
|
|
2338
2338
|
}) {
|
|
2339
2339
|
const {
|
|
2340
2340
|
setFieldValue: p
|
|
2341
|
-
} = Y(), [m, u] = K.useState(), [d, c] = K.useState(), [y,
|
|
2341
|
+
} = Y(), [m, u] = K.useState(), [d, c] = K.useState(), [y, f] = K.useState(!1), P = K.useRef(/* @__PURE__ */ new Set()).current, w = (g, v) => {
|
|
2342
2342
|
const _ = m === v;
|
|
2343
2343
|
return /* @__PURE__ */ e(
|
|
2344
2344
|
Oi,
|
|
2345
2345
|
{
|
|
2346
|
-
index:
|
|
2346
|
+
index: g,
|
|
2347
2347
|
disabled: i,
|
|
2348
2348
|
enumValuesPath: r,
|
|
2349
2349
|
autoFocus: _,
|
|
2350
2350
|
shouldUpdateId: s || _,
|
|
2351
|
-
onDialogOpen: () => c(
|
|
2352
|
-
inferredEntry:
|
|
2351
|
+
onDialogOpen: () => c(g),
|
|
2352
|
+
inferredEntry: P.has(t.enumValues[g]?.id)
|
|
2353
2353
|
},
|
|
2354
2354
|
`${v}`
|
|
2355
2355
|
);
|
|
@@ -2366,26 +2366,26 @@ function Ci({
|
|
|
2366
2366
|
}
|
|
2367
2367
|
),
|
|
2368
2368
|
o && /* @__PURE__ */ n(
|
|
2369
|
-
|
|
2369
|
+
R,
|
|
2370
2370
|
{
|
|
2371
2371
|
loading: y,
|
|
2372
2372
|
disabled: i || y,
|
|
2373
2373
|
variant: "text",
|
|
2374
2374
|
size: "small",
|
|
2375
2375
|
onClick: async () => {
|
|
2376
|
-
l && (
|
|
2377
|
-
if (!
|
|
2376
|
+
l && (f(!0), l?.().then((g) => {
|
|
2377
|
+
if (!g)
|
|
2378
2378
|
return;
|
|
2379
|
-
const v =
|
|
2379
|
+
const v = g.flat(), _ = Array.from(new Set(v)), h = t.enumValues, E = ti(_).filter((z) => !h?.some((q) => q.id === z.id));
|
|
2380
2380
|
E.forEach((z) => {
|
|
2381
|
-
|
|
2381
|
+
P.add(z.id);
|
|
2382
2382
|
}), p(r, [...E, ...h]);
|
|
2383
|
-
}).catch((
|
|
2384
|
-
console.error(
|
|
2385
|
-
}).finally(() =>
|
|
2383
|
+
}).catch((g) => {
|
|
2384
|
+
console.error(g);
|
|
2385
|
+
}).finally(() => f(!1)));
|
|
2386
2386
|
},
|
|
2387
2387
|
children: [
|
|
2388
|
-
y ? /* @__PURE__ */ e(
|
|
2388
|
+
y ? /* @__PURE__ */ e(Qe, { size: "small" }) : /* @__PURE__ */ e(gt, {}),
|
|
2389
2389
|
"Infer values from data"
|
|
2390
2390
|
]
|
|
2391
2391
|
}
|
|
@@ -2434,15 +2434,15 @@ const Oi = K.memo(
|
|
|
2434
2434
|
errors: d,
|
|
2435
2435
|
setFieldValue: c,
|
|
2436
2436
|
touched: y
|
|
2437
|
-
} = Y(),
|
|
2437
|
+
} = Y(), f = K.useRef(!N(m, `${r}[${a}].id`)), b = i || f.current, P = N(m, `${r}[${a}].id`), w = N(m, `${r}[${a}].label`), k = N(d, `${r}[${a}].label`), g = K.useRef(w);
|
|
2438
2438
|
return K.useEffect(() => {
|
|
2439
|
-
(
|
|
2439
|
+
(g.current === P || !P) && b && c(`${r}[${a}].id`, w), g.current = w;
|
|
2440
2440
|
}, [w]), /* @__PURE__ */ n("div", { className: "flex w-full align-center justify-center", children: [
|
|
2441
2441
|
/* @__PURE__ */ e(
|
|
2442
2442
|
de,
|
|
2443
2443
|
{
|
|
2444
2444
|
name: `${r}[${a}].label`,
|
|
2445
|
-
as:
|
|
2445
|
+
as: W,
|
|
2446
2446
|
className: "flex-grow",
|
|
2447
2447
|
required: !0,
|
|
2448
2448
|
disabled: l,
|
|
@@ -2461,7 +2461,7 @@ const Oi = K.memo(
|
|
|
2461
2461
|
"aria-label": "edit",
|
|
2462
2462
|
className: "m-1",
|
|
2463
2463
|
onClick: () => o(),
|
|
2464
|
-
children: /* @__PURE__ */ e(
|
|
2464
|
+
children: /* @__PURE__ */ e(Je, { size: "small" })
|
|
2465
2465
|
}
|
|
2466
2466
|
)
|
|
2467
2467
|
] });
|
|
@@ -2482,7 +2482,7 @@ function Ni({
|
|
|
2482
2482
|
errors: l,
|
|
2483
2483
|
setFieldValue: p,
|
|
2484
2484
|
touched: m
|
|
2485
|
-
} = Y(), u = t !== void 0 ?
|
|
2485
|
+
} = Y(), u = t !== void 0 ? N(l, `${r}[${t}].id`) : void 0;
|
|
2486
2486
|
return /* @__PURE__ */ n(
|
|
2487
2487
|
Ee,
|
|
2488
2488
|
{
|
|
@@ -2496,7 +2496,7 @@ function Ni({
|
|
|
2496
2496
|
de,
|
|
2497
2497
|
{
|
|
2498
2498
|
name: `${r}[${t}]id`,
|
|
2499
|
-
as:
|
|
2499
|
+
as: W,
|
|
2500
2500
|
required: !0,
|
|
2501
2501
|
validate: Si,
|
|
2502
2502
|
label: "ID",
|
|
@@ -2508,7 +2508,7 @@ function Ni({
|
|
|
2508
2508
|
/* @__PURE__ */ e(ie, { error: !!u, children: u ?? "Value saved in the data source" })
|
|
2509
2509
|
] }) }),
|
|
2510
2510
|
/* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e(
|
|
2511
|
-
|
|
2511
|
+
R,
|
|
2512
2512
|
{
|
|
2513
2513
|
autoFocus: !0,
|
|
2514
2514
|
variant: "outlined",
|
|
@@ -2531,7 +2531,7 @@ function Si(t) {
|
|
|
2531
2531
|
}
|
|
2532
2532
|
function Me({ disabled: t }) {
|
|
2533
2533
|
const { values: a, handleChange: i } = Y(), r = "validation.required", s = "validation.requiredMessage";
|
|
2534
|
-
return /* @__PURE__ */ n(
|
|
2534
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
2535
2535
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
2536
2536
|
de,
|
|
2537
2537
|
{
|
|
@@ -2554,11 +2554,11 @@ function Me({ disabled: t }) {
|
|
|
2554
2554
|
component: he
|
|
2555
2555
|
}
|
|
2556
2556
|
) }),
|
|
2557
|
-
|
|
2558
|
-
|
|
2557
|
+
N(a, r) && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2558
|
+
W,
|
|
2559
2559
|
{
|
|
2560
2560
|
disabled: t,
|
|
2561
|
-
value:
|
|
2561
|
+
value: N(a, s),
|
|
2562
2562
|
label: "Required message",
|
|
2563
2563
|
name: s,
|
|
2564
2564
|
size: "small",
|
|
@@ -2582,7 +2582,7 @@ function Ue({
|
|
|
2582
2582
|
values: u,
|
|
2583
2583
|
handleChange: d,
|
|
2584
2584
|
errors: c
|
|
2585
|
-
} = Y(), y = "validation.length",
|
|
2585
|
+
} = Y(), y = "validation.length", f = "validation.min", b = "validation.max", P = "validation.trim", w = "validation.matches", k = "validation.lowercase", g = "validation.uppercase", v = N(c, w), _ = N(u, w), h = typeof _ == "string" ? _ : Na(_);
|
|
2586
2586
|
return /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
2587
2587
|
/* @__PURE__ */ e(Me, { disabled: p }),
|
|
2588
2588
|
/* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
@@ -2600,7 +2600,7 @@ function Ue({
|
|
|
2600
2600
|
de,
|
|
2601
2601
|
{
|
|
2602
2602
|
type: "checkbox",
|
|
2603
|
-
name:
|
|
2603
|
+
name: g,
|
|
2604
2604
|
label: "Uppercase",
|
|
2605
2605
|
disabled: p,
|
|
2606
2606
|
component: he
|
|
@@ -2610,7 +2610,7 @@ function Ue({
|
|
|
2610
2610
|
de,
|
|
2611
2611
|
{
|
|
2612
2612
|
type: "checkbox",
|
|
2613
|
-
name:
|
|
2613
|
+
name: P,
|
|
2614
2614
|
label: "Trim",
|
|
2615
2615
|
disabled: p,
|
|
2616
2616
|
component: he
|
|
@@ -2619,9 +2619,9 @@ function Ue({
|
|
|
2619
2619
|
] }),
|
|
2620
2620
|
/* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
2621
2621
|
t && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
2622
|
-
|
|
2622
|
+
W,
|
|
2623
2623
|
{
|
|
2624
|
-
value:
|
|
2624
|
+
value: N(u, y),
|
|
2625
2625
|
label: "Exact length",
|
|
2626
2626
|
name: y,
|
|
2627
2627
|
type: "number",
|
|
@@ -2631,11 +2631,11 @@ function Ue({
|
|
|
2631
2631
|
}
|
|
2632
2632
|
) }),
|
|
2633
2633
|
s && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
2634
|
-
|
|
2634
|
+
W,
|
|
2635
2635
|
{
|
|
2636
|
-
value:
|
|
2636
|
+
value: N(u, f),
|
|
2637
2637
|
label: "Min length",
|
|
2638
|
-
name:
|
|
2638
|
+
name: f,
|
|
2639
2639
|
type: "number",
|
|
2640
2640
|
size: "small",
|
|
2641
2641
|
disabled: p,
|
|
@@ -2643,9 +2643,9 @@ function Ue({
|
|
|
2643
2643
|
}
|
|
2644
2644
|
) }),
|
|
2645
2645
|
r && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
2646
|
-
|
|
2646
|
+
W,
|
|
2647
2647
|
{
|
|
2648
|
-
value:
|
|
2648
|
+
value: N(u, b),
|
|
2649
2649
|
label: "Max length",
|
|
2650
2650
|
name: b,
|
|
2651
2651
|
type: "number",
|
|
@@ -2660,7 +2660,7 @@ function Ue({
|
|
|
2660
2660
|
de,
|
|
2661
2661
|
{
|
|
2662
2662
|
name: w,
|
|
2663
|
-
as:
|
|
2663
|
+
as: W,
|
|
2664
2664
|
validate: (A) => A && !Pa(A),
|
|
2665
2665
|
label: "Matches regex",
|
|
2666
2666
|
size: "small",
|
|
@@ -2685,9 +2685,9 @@ function At({
|
|
|
2685
2685
|
return /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
2686
2686
|
/* @__PURE__ */ e(Me, { disabled: i }),
|
|
2687
2687
|
a && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
2688
|
-
|
|
2688
|
+
W,
|
|
2689
2689
|
{
|
|
2690
|
-
value:
|
|
2690
|
+
value: N(r, o),
|
|
2691
2691
|
disabled: i,
|
|
2692
2692
|
label: "Min length",
|
|
2693
2693
|
name: o,
|
|
@@ -2697,9 +2697,9 @@ function At({
|
|
|
2697
2697
|
}
|
|
2698
2698
|
) }),
|
|
2699
2699
|
t && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
2700
|
-
|
|
2700
|
+
W,
|
|
2701
2701
|
{
|
|
2702
|
-
value:
|
|
2702
|
+
value: N(r, l),
|
|
2703
2703
|
disabled: i,
|
|
2704
2704
|
label: "Max length",
|
|
2705
2705
|
name: l,
|
|
@@ -2749,8 +2749,8 @@ function Bt({
|
|
|
2749
2749
|
touched: u,
|
|
2750
2750
|
setFieldError: d,
|
|
2751
2751
|
setFieldValue: c
|
|
2752
|
-
} = Y(), y = De(),
|
|
2753
|
-
return /* @__PURE__ */ n(
|
|
2752
|
+
} = Y(), y = De(), f = t ? "of.enumValues" : "enumValues", b = N(l, "defaultValue"), P = N(l, f), w = Kt(() => !P || typeof P == "boolean" ? [] : qa(P) ?? [], [P]);
|
|
2753
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
2754
2754
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2755
2755
|
xi,
|
|
2756
2756
|
{
|
|
@@ -2758,13 +2758,13 @@ function Bt({
|
|
|
2758
2758
|
updateIds: a,
|
|
2759
2759
|
disabled: i,
|
|
2760
2760
|
allowDataInference: s,
|
|
2761
|
-
onError: (
|
|
2762
|
-
d(
|
|
2761
|
+
onError: (g) => {
|
|
2762
|
+
d(f, g ? "" : void 0);
|
|
2763
2763
|
},
|
|
2764
|
-
getData: o ? () => o().then((
|
|
2765
|
-
onValuesChanged: (
|
|
2766
|
-
if (l && (c(
|
|
2767
|
-
const v =
|
|
2764
|
+
getData: o ? () => o().then((g) => g.map((v) => l.id && N(v, l.id)).filter(Boolean)) : void 0,
|
|
2765
|
+
onValuesChanged: (g) => {
|
|
2766
|
+
if (l && (c(f, g), !t)) {
|
|
2767
|
+
const v = g.filter((_) => !!_?.id).map((_) => _.id);
|
|
2768
2768
|
b && !v.includes(b) && (c("defaultValue", void 0), y.open({
|
|
2769
2769
|
type: "warning",
|
|
2770
2770
|
message: "Default value was cleared"
|
|
@@ -2788,18 +2788,18 @@ function Bt({
|
|
|
2788
2788
|
{
|
|
2789
2789
|
disabled: i,
|
|
2790
2790
|
position: "item-aligned",
|
|
2791
|
-
onValueChange: (
|
|
2792
|
-
c("defaultValue",
|
|
2791
|
+
onValueChange: (g) => {
|
|
2792
|
+
c("defaultValue", g);
|
|
2793
2793
|
},
|
|
2794
2794
|
label: "Default value",
|
|
2795
2795
|
value: b ?? "",
|
|
2796
|
-
children: w.filter((
|
|
2796
|
+
children: w.filter((g) => !!g?.id).map((g) => /* @__PURE__ */ e(
|
|
2797
2797
|
ee,
|
|
2798
2798
|
{
|
|
2799
|
-
value:
|
|
2800
|
-
children:
|
|
2799
|
+
value: g.id?.toString(),
|
|
2800
|
+
children: g.label
|
|
2801
2801
|
},
|
|
2802
|
-
|
|
2802
|
+
g.id
|
|
2803
2803
|
))
|
|
2804
2804
|
}
|
|
2805
2805
|
) })
|
|
@@ -2820,10 +2820,10 @@ function Mt({
|
|
|
2820
2820
|
const {
|
|
2821
2821
|
values: r,
|
|
2822
2822
|
setFieldValue: s
|
|
2823
|
-
} = Y(), o = t ? "of.storage" : "storage", l = `${o}.acceptedFiles`, p = `${o}.fileName`, m = `${o}.storagePath`, u = `${o}.storeUrl`, d =
|
|
2824
|
-
|
|
2823
|
+
} = Y(), o = t ? "of.storage" : "storage", l = `${o}.acceptedFiles`, p = `${o}.fileName`, m = `${o}.storagePath`, u = `${o}.storeUrl`, d = N(r, p) ?? "{rand}_{file}", c = N(r, m) ?? "/", y = N(r, l), f = Array.isArray(y) ? y : void 0, b = !f || f.length === 0, P = (g) => {
|
|
2824
|
+
g ? g.includes("all") || g.length >= Object.keys(nt).length ? s(l, void 0) : b ? s(l, Object.keys(nt).filter((v) => !g.includes(v))) : s(l, g) : s(l, void 0);
|
|
2825
2825
|
}, w = typeof d == "function", k = typeof c == "function";
|
|
2826
|
-
return /* @__PURE__ */ n(
|
|
2826
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
2827
2827
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2828
2828
|
Ot,
|
|
2829
2829
|
{
|
|
@@ -2844,46 +2844,46 @@ function Mt({
|
|
|
2844
2844
|
{
|
|
2845
2845
|
disabled: i,
|
|
2846
2846
|
name: l,
|
|
2847
|
-
value:
|
|
2848
|
-
onMultiValueChange:
|
|
2847
|
+
value: f ?? [],
|
|
2848
|
+
onMultiValueChange: P,
|
|
2849
2849
|
label: b ? void 0 : "Allowed file types",
|
|
2850
|
-
renderValues: (
|
|
2850
|
+
renderValues: (g) => !g || g.length === 0 ? "All file types allowed" : g.map((v) => nt[v]).filter((v) => !!v).join(", "),
|
|
2851
2851
|
children: [
|
|
2852
2852
|
/* @__PURE__ */ n(zt, { value: "all", className: "flex items-center gap-2", children: [
|
|
2853
2853
|
/* @__PURE__ */ e(
|
|
2854
2854
|
Tt,
|
|
2855
2855
|
{
|
|
2856
|
-
checked: !
|
|
2856
|
+
checked: !f
|
|
2857
2857
|
}
|
|
2858
2858
|
),
|
|
2859
2859
|
"All"
|
|
2860
2860
|
] }, "all"),
|
|
2861
|
-
Object.entries(nt).map(([
|
|
2861
|
+
Object.entries(nt).map(([g, v]) => /* @__PURE__ */ n(zt, { value: g, className: "flex items-center gap-2", children: [
|
|
2862
2862
|
/* @__PURE__ */ e(
|
|
2863
2863
|
Tt,
|
|
2864
2864
|
{
|
|
2865
|
-
checked: b ||
|
|
2865
|
+
checked: b || f.indexOf(g) > -1
|
|
2866
2866
|
}
|
|
2867
2867
|
),
|
|
2868
2868
|
/* @__PURE__ */ e("div", { className: "flex-grow", children: v }),
|
|
2869
2869
|
/* @__PURE__ */ e(
|
|
2870
|
-
|
|
2870
|
+
R,
|
|
2871
2871
|
{
|
|
2872
2872
|
size: "small",
|
|
2873
2873
|
variant: "outlined",
|
|
2874
|
-
onClick: (_) => (_.preventDefault(), _.stopPropagation(), s(l, [
|
|
2874
|
+
onClick: (_) => (_.preventDefault(), _.stopPropagation(), s(l, [g])),
|
|
2875
2875
|
children: "Only"
|
|
2876
2876
|
}
|
|
2877
2877
|
)
|
|
2878
|
-
] },
|
|
2878
|
+
] }, g))
|
|
2879
2879
|
]
|
|
2880
2880
|
}
|
|
2881
2881
|
) }),
|
|
2882
2882
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2883
|
-
|
|
2883
|
+
be,
|
|
2884
2884
|
{
|
|
2885
2885
|
name: p,
|
|
2886
|
-
as:
|
|
2886
|
+
as: W,
|
|
2887
2887
|
label: "File name",
|
|
2888
2888
|
size: "small",
|
|
2889
2889
|
disabled: w || i,
|
|
@@ -2892,10 +2892,10 @@ function Mt({
|
|
|
2892
2892
|
) }),
|
|
2893
2893
|
/* @__PURE__ */ n("div", { className: "col-span-12", children: [
|
|
2894
2894
|
/* @__PURE__ */ e(
|
|
2895
|
-
|
|
2895
|
+
be,
|
|
2896
2896
|
{
|
|
2897
2897
|
name: m,
|
|
2898
|
-
as:
|
|
2898
|
+
as: W,
|
|
2899
2899
|
label: "Storage path",
|
|
2900
2900
|
disabled: k || i,
|
|
2901
2901
|
size: "small",
|
|
@@ -2915,7 +2915,7 @@ function Mt({
|
|
|
2915
2915
|
] })
|
|
2916
2916
|
] }),
|
|
2917
2917
|
/* @__PURE__ */ e(
|
|
2918
|
-
|
|
2918
|
+
be,
|
|
2919
2919
|
{
|
|
2920
2920
|
type: "checkbox",
|
|
2921
2921
|
name: u,
|
|
@@ -2936,7 +2936,7 @@ function Mt({
|
|
|
2936
2936
|
] }) })
|
|
2937
2937
|
] });
|
|
2938
2938
|
}
|
|
2939
|
-
function
|
|
2939
|
+
function We(t) {
|
|
2940
2940
|
if (oe(t) || oe(t))
|
|
2941
2941
|
return !1;
|
|
2942
2942
|
{
|
|
@@ -2945,9 +2945,9 @@ function Je(t) {
|
|
|
2945
2945
|
}
|
|
2946
2946
|
}
|
|
2947
2947
|
function qi(t) {
|
|
2948
|
-
return Object.entries(t).filter(([a, i]) =>
|
|
2948
|
+
return Object.entries(t).filter(([a, i]) => We(i)).map(([a, i]) => {
|
|
2949
2949
|
const r = i;
|
|
2950
|
-
if (
|
|
2950
|
+
if (We(r))
|
|
2951
2951
|
return r.dataType === "map" && r.properties ? {
|
|
2952
2952
|
[a]: {
|
|
2953
2953
|
...r,
|
|
@@ -2965,7 +2965,7 @@ function oa({
|
|
|
2965
2965
|
selected: o
|
|
2966
2966
|
}) {
|
|
2967
2967
|
const { propertyConfigs: l } = Ke(), p = Ze(t, l);
|
|
2968
|
-
return
|
|
2968
|
+
return We(t), /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ n(
|
|
2969
2969
|
"div",
|
|
2970
2970
|
{
|
|
2971
2971
|
onClick: a,
|
|
@@ -2977,9 +2977,9 @@ function oa({
|
|
|
2977
2977
|
{
|
|
2978
2978
|
className: xe(
|
|
2979
2979
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
2980
|
-
|
|
2981
|
-
a ?
|
|
2982
|
-
o ?
|
|
2980
|
+
Wt,
|
|
2981
|
+
a ? Jt : "",
|
|
2982
|
+
o ? Qt : "",
|
|
2983
2983
|
"flex-grow p-4 border transition-colors duration-200",
|
|
2984
2984
|
i ? "border-red-500" : o ? "border-blue-500" : "border-transparent"
|
|
2985
2985
|
),
|
|
@@ -3053,9 +3053,9 @@ function Ai({
|
|
|
3053
3053
|
{
|
|
3054
3054
|
className: xe(
|
|
3055
3055
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
3056
|
-
|
|
3057
|
-
i ?
|
|
3058
|
-
a ?
|
|
3056
|
+
Wt,
|
|
3057
|
+
i ? Jt : "",
|
|
3058
|
+
a ? Qt : "",
|
|
3059
3059
|
"flex-grow p-4 border transition-colors duration-200",
|
|
3060
3060
|
a ? "border-blue-500" : "border-transparent"
|
|
3061
3061
|
),
|
|
@@ -3129,13 +3129,13 @@ function ft({
|
|
|
3129
3129
|
inferredPropertyKeys: d,
|
|
3130
3130
|
collectionEditable: c
|
|
3131
3131
|
}) {
|
|
3132
|
-
const y = s ?? Object.keys(r),
|
|
3132
|
+
const y = s ?? Object.keys(r), f = Q((b) => {
|
|
3133
3133
|
if (!b.destination)
|
|
3134
3134
|
return;
|
|
3135
|
-
const
|
|
3136
|
-
k.splice(w, 0,
|
|
3135
|
+
const P = b.source.index, w = b.destination.index, k = Array.from(y), [g] = k.splice(P, 1);
|
|
3136
|
+
k.splice(w, 0, g), p && p(k, t);
|
|
3137
3137
|
}, [t, p, y]);
|
|
3138
|
-
return /* @__PURE__ */ e(
|
|
3138
|
+
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(ri, { onDragEnd: f, children: /* @__PURE__ */ e(oi, { droppableId: `droppable_${t}`, children: (b, P) => /* @__PURE__ */ n(
|
|
3139
3139
|
"div",
|
|
3140
3140
|
{
|
|
3141
3141
|
...b.droppableProps,
|
|
@@ -3143,8 +3143,8 @@ function ft({
|
|
|
3143
3143
|
className: u,
|
|
3144
3144
|
children: [
|
|
3145
3145
|
y && y.map((w, k) => {
|
|
3146
|
-
const
|
|
3147
|
-
return !
|
|
3146
|
+
const g = r[w], v = o?.find((_) => _.key === w);
|
|
3147
|
+
return !g && !v ? (console.warn(`Property ${w} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
3148
3148
|
ni,
|
|
3149
3149
|
{
|
|
3150
3150
|
draggableId: `array_field_${t}_${w}}`,
|
|
@@ -3153,7 +3153,7 @@ function ft({
|
|
|
3153
3153
|
zi,
|
|
3154
3154
|
{
|
|
3155
3155
|
propertyKey: w,
|
|
3156
|
-
propertyOrBuilder:
|
|
3156
|
+
propertyOrBuilder: g,
|
|
3157
3157
|
additionalField: v,
|
|
3158
3158
|
provided: _,
|
|
3159
3159
|
errors: l,
|
|
@@ -3189,17 +3189,17 @@ function zi({
|
|
|
3189
3189
|
inferredPropertyKeys: d,
|
|
3190
3190
|
collectionEditable: c
|
|
3191
3191
|
}) {
|
|
3192
|
-
const y = d?.includes(a ? `${a}.${t}` : t),
|
|
3192
|
+
const y = d?.includes(a ? `${a}.${t}` : t), f = ce(t, a);
|
|
3193
3193
|
let b;
|
|
3194
3194
|
if (typeof i == "object") {
|
|
3195
|
-
const
|
|
3196
|
-
|
|
3195
|
+
const g = i;
|
|
3196
|
+
g.dataType === "map" && g.properties && (b = /* @__PURE__ */ e(
|
|
3197
3197
|
ft,
|
|
3198
3198
|
{
|
|
3199
3199
|
selectedPropertyKey: o,
|
|
3200
|
-
namespace:
|
|
3201
|
-
properties:
|
|
3202
|
-
propertiesOrder:
|
|
3200
|
+
namespace: f,
|
|
3201
|
+
properties: g.properties,
|
|
3202
|
+
propertiesOrder: g.propertiesOrder,
|
|
3203
3203
|
errors: l,
|
|
3204
3204
|
onPropertyClick: p,
|
|
3205
3205
|
onPropertyMove: m,
|
|
@@ -3208,7 +3208,7 @@ function zi({
|
|
|
3208
3208
|
}
|
|
3209
3209
|
));
|
|
3210
3210
|
}
|
|
3211
|
-
const
|
|
3211
|
+
const P = f ? N(l, ke(f)) : !1, w = o === f, k = i && (c && !oe(i) || We(i));
|
|
3212
3212
|
return /* @__PURE__ */ n(
|
|
3213
3213
|
"div",
|
|
3214
3214
|
{
|
|
@@ -3235,7 +3235,7 @@ function zi({
|
|
|
3235
3235
|
onClick: p ? () => p(t, a) : void 0,
|
|
3236
3236
|
includeName: !0,
|
|
3237
3237
|
selected: w,
|
|
3238
|
-
hasError:
|
|
3238
|
+
hasError: P
|
|
3239
3239
|
}
|
|
3240
3240
|
) : /* @__PURE__ */ e(
|
|
3241
3241
|
Ai,
|
|
@@ -3275,7 +3275,7 @@ function Ti({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3275
3275
|
const {
|
|
3276
3276
|
values: o,
|
|
3277
3277
|
setFieldValue: l
|
|
3278
|
-
} = Y(), [p, m] = L(!1), [u, d] = L(), [c, y] = L(),
|
|
3278
|
+
} = Y(), [p, m] = L(!1), [u, d] = L(), [c, y] = L(), f = o.propertiesOrder ?? Object.keys(o.properties ?? {}), b = Q(({
|
|
3279
3279
|
id: h,
|
|
3280
3280
|
property: A
|
|
3281
3281
|
}) => {
|
|
@@ -3284,15 +3284,15 @@ function Ti({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3284
3284
|
l("properties", {
|
|
3285
3285
|
...o.properties ?? {},
|
|
3286
3286
|
[h]: A
|
|
3287
|
-
}, !1), l("propertiesOrder", [...
|
|
3288
|
-
}, [o.properties,
|
|
3287
|
+
}, !1), l("propertiesOrder", [...f, h], !1), m(!1);
|
|
3288
|
+
}, [o.properties, f]), P = Q((h, A) => {
|
|
3289
3289
|
const E = h ? ce(h, A) : void 0;
|
|
3290
3290
|
if (!E)
|
|
3291
3291
|
throw Error("collection editor miss config");
|
|
3292
|
-
const z = ke(E), q = Pe(A), B =
|
|
3292
|
+
const z = ke(E), q = Pe(A), B = N(o, q) ?? Object.keys(N(o, ki(A)));
|
|
3293
3293
|
l(z, void 0, !1), l(q, B.filter((S) => S !== h), !1), m(!1), d(void 0), y(void 0);
|
|
3294
|
-
}, [l, o]), w = u ? ce(u, c) : void 0, k = w ?
|
|
3295
|
-
|
|
3294
|
+
}, [l, o]), w = u ? ce(u, c) : void 0, k = w ? N(o.properties, w.replaceAll(".", ".properties.")) : void 0, g = /* @__PURE__ */ n(
|
|
3295
|
+
R,
|
|
3296
3296
|
{
|
|
3297
3297
|
color: "primary",
|
|
3298
3298
|
variant: "outlined",
|
|
@@ -3303,21 +3303,21 @@ function Ti({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3303
3303
|
o.name ?? "this group"
|
|
3304
3304
|
]
|
|
3305
3305
|
}
|
|
3306
|
-
), v = !
|
|
3306
|
+
), v = !f || f.length < 1, _ = Q((h, A) => {
|
|
3307
3307
|
l(Pe(A), h, !1);
|
|
3308
3308
|
}, []);
|
|
3309
|
-
return /* @__PURE__ */ n(
|
|
3309
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
3310
3310
|
/* @__PURE__ */ n("div", { className: "col-span-12", children: [
|
|
3311
3311
|
/* @__PURE__ */ n("div", { className: "flex justify-between items-end my-4", children: [
|
|
3312
3312
|
/* @__PURE__ */ e(C, { variant: "subtitle2", children: "Properties in this group" }),
|
|
3313
|
-
|
|
3313
|
+
g
|
|
3314
3314
|
] }),
|
|
3315
3315
|
/* @__PURE__ */ n(qe, { className: "p-2 pl-8", children: [
|
|
3316
3316
|
/* @__PURE__ */ e(
|
|
3317
3317
|
ft,
|
|
3318
3318
|
{
|
|
3319
3319
|
properties: o.properties ?? {},
|
|
3320
|
-
propertiesOrder:
|
|
3320
|
+
propertiesOrder: f,
|
|
3321
3321
|
errors: {},
|
|
3322
3322
|
collectionEditable: s,
|
|
3323
3323
|
onPropertyClick: (h, A) => {
|
|
@@ -3364,7 +3364,7 @@ function Ti({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3364
3364
|
m(!1), d(void 0), y(void 0);
|
|
3365
3365
|
},
|
|
3366
3366
|
getData: a,
|
|
3367
|
-
onDelete:
|
|
3367
|
+
onDelete: P,
|
|
3368
3368
|
propertyKey: u,
|
|
3369
3369
|
propertyNamespace: c,
|
|
3370
3370
|
property: k,
|
|
@@ -3372,7 +3372,7 @@ function Ti({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3372
3372
|
autoUpdateId: !u,
|
|
3373
3373
|
autoOpenTypeSelect: !u,
|
|
3374
3374
|
onPropertyChanged: b,
|
|
3375
|
-
existingPropertyKeys: u ? void 0 :
|
|
3375
|
+
existingPropertyKeys: u ? void 0 : f,
|
|
3376
3376
|
propertyConfigs: r
|
|
3377
3377
|
}
|
|
3378
3378
|
)
|
|
@@ -3393,24 +3393,24 @@ function Vi({
|
|
|
3393
3393
|
errors: u,
|
|
3394
3394
|
setFieldValue: d,
|
|
3395
3395
|
touched: c
|
|
3396
|
-
} = Y(), [y,
|
|
3396
|
+
} = Y(), [y, f] = L(!1), b = N(p, "of"), P = N(c, "of") && N(u, "of"), w = Q(({ id: g, property: v, namespace: _ }) => {
|
|
3397
3397
|
d("of", v);
|
|
3398
3398
|
}, []), k = b && Ze(b, o);
|
|
3399
|
-
return /* @__PURE__ */ n(
|
|
3399
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
3400
3400
|
/* @__PURE__ */ n("div", { className: "col-span-12", children: [
|
|
3401
3401
|
/* @__PURE__ */ e(C, { variant: "subtitle2", children: "Repeat component" }),
|
|
3402
3402
|
/* @__PURE__ */ e(
|
|
3403
|
-
|
|
3403
|
+
be,
|
|
3404
3404
|
{
|
|
3405
3405
|
name: "of",
|
|
3406
3406
|
value: b,
|
|
3407
|
-
validate: (
|
|
3407
|
+
validate: (g) => g?.dataType ? void 0 : "You need to specify a repeat field",
|
|
3408
3408
|
children: () => /* @__PURE__ */ n(qe, { className: "p-2 mt-4", children: [
|
|
3409
3409
|
b && /* @__PURE__ */ e(
|
|
3410
3410
|
oa,
|
|
3411
3411
|
{
|
|
3412
3412
|
property: b,
|
|
3413
|
-
onClick: i ? void 0 : () =>
|
|
3413
|
+
onClick: i ? void 0 : () => f(!0),
|
|
3414
3414
|
includeName: !1,
|
|
3415
3415
|
includeEditButton: !0,
|
|
3416
3416
|
selected: !1,
|
|
@@ -3418,12 +3418,12 @@ function Vi({
|
|
|
3418
3418
|
}
|
|
3419
3419
|
),
|
|
3420
3420
|
!i && !b && /* @__PURE__ */ n(
|
|
3421
|
-
|
|
3421
|
+
R,
|
|
3422
3422
|
{
|
|
3423
3423
|
variant: "text",
|
|
3424
3424
|
size: "large",
|
|
3425
|
-
color:
|
|
3426
|
-
onClick: () =>
|
|
3425
|
+
color: P ? "error" : "primary",
|
|
3426
|
+
onClick: () => f(!0),
|
|
3427
3427
|
children: [
|
|
3428
3428
|
"Edit ",
|
|
3429
3429
|
`${k ? k.name : "repeat component"}`
|
|
@@ -3439,7 +3439,7 @@ function Vi({
|
|
|
3439
3439
|
getData: r,
|
|
3440
3440
|
autoUpdateId: !a,
|
|
3441
3441
|
autoOpenTypeSelect: !a,
|
|
3442
|
-
onOkClicked: () =>
|
|
3442
|
+
onOkClicked: () => f(!1),
|
|
3443
3443
|
allowDataInference: s,
|
|
3444
3444
|
property: b,
|
|
3445
3445
|
includeIdAndName: !1,
|
|
@@ -3466,15 +3466,15 @@ const Ii = K.forwardRef(
|
|
|
3466
3466
|
}, l) {
|
|
3467
3467
|
const {
|
|
3468
3468
|
errors: p
|
|
3469
|
-
} = Y(), m = "name", u = a &&
|
|
3469
|
+
} = Y(), m = "name", u = a && N(p, m), d = "id", c = a && N(p, d), y = "description", f = a && N(p, y);
|
|
3470
3470
|
return /* @__PURE__ */ n("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
3471
3471
|
/* @__PURE__ */ n("div", { children: [
|
|
3472
3472
|
/* @__PURE__ */ e(
|
|
3473
|
-
|
|
3473
|
+
be,
|
|
3474
3474
|
{
|
|
3475
3475
|
inputRef: l,
|
|
3476
3476
|
name: m,
|
|
3477
|
-
as:
|
|
3477
|
+
as: W,
|
|
3478
3478
|
style: { fontSize: 20 },
|
|
3479
3479
|
validate: Ei,
|
|
3480
3480
|
placeholder: "Field name",
|
|
@@ -3487,7 +3487,7 @@ const Ii = K.forwardRef(
|
|
|
3487
3487
|
] }),
|
|
3488
3488
|
/* @__PURE__ */ n("div", { children: [
|
|
3489
3489
|
/* @__PURE__ */ e(
|
|
3490
|
-
|
|
3490
|
+
be,
|
|
3491
3491
|
{
|
|
3492
3492
|
name: d,
|
|
3493
3493
|
as: Te,
|
|
@@ -3503,16 +3503,16 @@ const Ii = K.forwardRef(
|
|
|
3503
3503
|
] }),
|
|
3504
3504
|
/* @__PURE__ */ n("div", { children: [
|
|
3505
3505
|
/* @__PURE__ */ e(
|
|
3506
|
-
|
|
3506
|
+
be,
|
|
3507
3507
|
{
|
|
3508
3508
|
name: y,
|
|
3509
|
-
as:
|
|
3509
|
+
as: W,
|
|
3510
3510
|
label: "Description",
|
|
3511
3511
|
disabled: s,
|
|
3512
|
-
error: !!
|
|
3512
|
+
error: !!f
|
|
3513
3513
|
}
|
|
3514
3514
|
),
|
|
3515
|
-
/* @__PURE__ */ e(ie, { error: !!
|
|
3515
|
+
/* @__PURE__ */ e(ie, { error: !!f, children: f })
|
|
3516
3516
|
] })
|
|
3517
3517
|
] });
|
|
3518
3518
|
}
|
|
@@ -3531,7 +3531,7 @@ function Di({
|
|
|
3531
3531
|
showErrors: i
|
|
3532
3532
|
}) {
|
|
3533
3533
|
const { values: r, setFieldValue: s } = Y();
|
|
3534
|
-
return /* @__PURE__ */ n(
|
|
3534
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
3535
3535
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ n(ze, { children: [
|
|
3536
3536
|
t === "text_field" && /* @__PURE__ */ e(
|
|
3537
3537
|
Ue,
|
|
@@ -3593,14 +3593,14 @@ function Di({
|
|
|
3593
3593
|
s("defaultValue", o.target.value === "" ? void 0 : o.target.value);
|
|
3594
3594
|
},
|
|
3595
3595
|
label: "Default value",
|
|
3596
|
-
value:
|
|
3596
|
+
value: N(r, "defaultValue") ?? ""
|
|
3597
3597
|
}
|
|
3598
3598
|
) })
|
|
3599
3599
|
] });
|
|
3600
3600
|
}
|
|
3601
3601
|
function Bi({ disabled: t }) {
|
|
3602
|
-
const { values: a } = Y(), i =
|
|
3603
|
-
return /* @__PURE__ */ n(
|
|
3602
|
+
const { values: a } = Y(), i = N(a, "defaultValue");
|
|
3603
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
3604
3604
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Me, { disabled: t }) }) }),
|
|
3605
3605
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
3606
3606
|
de,
|
|
@@ -3619,7 +3619,7 @@ function Mi({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3619
3619
|
const {
|
|
3620
3620
|
values: o,
|
|
3621
3621
|
setFieldValue: l
|
|
3622
|
-
} = Y(), [p, m] = L(!1), [u, d] = L(), [c, y] = L(),
|
|
3622
|
+
} = Y(), [p, m] = L(!1), [u, d] = L(), [c, y] = L(), f = Q(({
|
|
3623
3623
|
id: v,
|
|
3624
3624
|
property: _
|
|
3625
3625
|
}) => {
|
|
@@ -3629,15 +3629,15 @@ function Mi({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3629
3629
|
...o.oneOf?.properties ?? {},
|
|
3630
3630
|
[v]: _
|
|
3631
3631
|
}, !1), l("oneOf.propertiesOrder", [...o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), v], !1), m(!1);
|
|
3632
|
-
}, [o.oneOf?.properties, o.oneOf?.propertiesOrder]), b = u ? ce(u, c) : void 0,
|
|
3632
|
+
}, [o.oneOf?.properties, o.oneOf?.propertiesOrder]), b = u ? ce(u, c) : void 0, P = b ? N(o.oneOf?.properties, b.replaceAll(".", ".properties.")) : void 0, w = Q((v, _) => {
|
|
3633
3633
|
const h = v ? ce(v, _) : void 0;
|
|
3634
3634
|
if (!h)
|
|
3635
3635
|
throw Error("collection editor miss config");
|
|
3636
3636
|
l(`oneOf.${ke(h)}`, void 0, !1);
|
|
3637
|
-
const A = `oneOf.${Pe(_)}`, E =
|
|
3637
|
+
const A = `oneOf.${Pe(_)}`, E = N(o, A);
|
|
3638
3638
|
l(A, E.filter((z) => z !== v), !1), m(!1), d(void 0), y(void 0);
|
|
3639
3639
|
}, [l, o]), k = /* @__PURE__ */ n(
|
|
3640
|
-
|
|
3640
|
+
R,
|
|
3641
3641
|
{
|
|
3642
3642
|
autoFocus: !0,
|
|
3643
3643
|
color: "primary",
|
|
@@ -3648,10 +3648,10 @@ function Mi({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3648
3648
|
o.name ?? "this block"
|
|
3649
3649
|
]
|
|
3650
3650
|
}
|
|
3651
|
-
),
|
|
3651
|
+
), g = Q((v, _) => {
|
|
3652
3652
|
l(`oneOf.${Pe(_)}`, v, !1);
|
|
3653
3653
|
}, []);
|
|
3654
|
-
return /* @__PURE__ */ n(
|
|
3654
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
3655
3655
|
/* @__PURE__ */ n("div", { className: "col-span-12", children: [
|
|
3656
3656
|
/* @__PURE__ */ n("div", { className: "flex justify-between items-end mt-8 mb-4", children: [
|
|
3657
3657
|
/* @__PURE__ */ e(C, { variant: "subtitle2", children: "Properties in this block" }),
|
|
@@ -3668,7 +3668,7 @@ function Mi({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3668
3668
|
onPropertyClick: t ? void 0 : (v, _) => {
|
|
3669
3669
|
d(v), y(_), m(!0);
|
|
3670
3670
|
},
|
|
3671
|
-
onPropertyMove: t ? void 0 :
|
|
3671
|
+
onPropertyMove: t ? void 0 : g
|
|
3672
3672
|
}
|
|
3673
3673
|
),
|
|
3674
3674
|
!t && !o.oneOf?.propertiesOrder?.length && /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center p-4", children: "Add the first property to this block" })
|
|
@@ -3692,11 +3692,11 @@ function Mi({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
|
|
|
3692
3692
|
onDelete: w,
|
|
3693
3693
|
propertyKey: u,
|
|
3694
3694
|
propertyNamespace: c,
|
|
3695
|
-
property:
|
|
3695
|
+
property: P,
|
|
3696
3696
|
existingProperty: !!u,
|
|
3697
3697
|
autoUpdateId: !u,
|
|
3698
3698
|
autoOpenTypeSelect: !u,
|
|
3699
|
-
onPropertyChanged:
|
|
3699
|
+
onPropertyChanged: f,
|
|
3700
3700
|
existingPropertyKeys: u ? void 0 : o.oneOf?.propertiesOrder,
|
|
3701
3701
|
propertyConfigs: r
|
|
3702
3702
|
}
|
|
@@ -3711,9 +3711,9 @@ function Ri({ disabled: t }) {
|
|
|
3711
3711
|
return /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
3712
3712
|
/* @__PURE__ */ e(Me, { disabled: t }),
|
|
3713
3713
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
3714
|
-
|
|
3714
|
+
W,
|
|
3715
3715
|
{
|
|
3716
|
-
value:
|
|
3716
|
+
value: N(a, r),
|
|
3717
3717
|
label: "Min value",
|
|
3718
3718
|
name: r,
|
|
3719
3719
|
type: "number",
|
|
@@ -3723,9 +3723,9 @@ function Ri({ disabled: t }) {
|
|
|
3723
3723
|
}
|
|
3724
3724
|
) }),
|
|
3725
3725
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
3726
|
-
|
|
3726
|
+
W,
|
|
3727
3727
|
{
|
|
3728
|
-
value:
|
|
3728
|
+
value: N(a, s),
|
|
3729
3729
|
label: "Max value",
|
|
3730
3730
|
name: s,
|
|
3731
3731
|
type: "number",
|
|
@@ -3735,9 +3735,9 @@ function Ri({ disabled: t }) {
|
|
|
3735
3735
|
}
|
|
3736
3736
|
) }),
|
|
3737
3737
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
3738
|
-
|
|
3738
|
+
W,
|
|
3739
3739
|
{
|
|
3740
|
-
value:
|
|
3740
|
+
value: N(a, o),
|
|
3741
3741
|
label: "Less than",
|
|
3742
3742
|
name: o,
|
|
3743
3743
|
type: "number",
|
|
@@ -3747,9 +3747,9 @@ function Ri({ disabled: t }) {
|
|
|
3747
3747
|
}
|
|
3748
3748
|
) }),
|
|
3749
3749
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
3750
|
-
|
|
3750
|
+
W,
|
|
3751
3751
|
{
|
|
3752
|
-
value:
|
|
3752
|
+
value: N(a, l),
|
|
3753
3753
|
label: "More than",
|
|
3754
3754
|
name: l,
|
|
3755
3755
|
type: "number",
|
|
@@ -3792,7 +3792,7 @@ function Ri({ disabled: t }) {
|
|
|
3792
3792
|
}
|
|
3793
3793
|
function Ui({ disabled: t }) {
|
|
3794
3794
|
const { values: a, setFieldValue: i } = Y();
|
|
3795
|
-
return /* @__PURE__ */ n(
|
|
3795
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
3796
3796
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Ri, { disabled: t }) }) }),
|
|
3797
3797
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
3798
3798
|
Te,
|
|
@@ -3804,7 +3804,7 @@ function Ui({ disabled: t }) {
|
|
|
3804
3804
|
i("defaultValue", r.target.value === "" ? void 0 : parseFloat(r.target.value));
|
|
3805
3805
|
},
|
|
3806
3806
|
label: "Default value",
|
|
3807
|
-
value:
|
|
3807
|
+
value: N(a, "defaultValue") ?? ""
|
|
3808
3808
|
}
|
|
3809
3809
|
) })
|
|
3810
3810
|
] });
|
|
@@ -3824,10 +3824,10 @@ function Rt({
|
|
|
3824
3824
|
setFieldValue: u
|
|
3825
3825
|
} = Y();
|
|
3826
3826
|
if (!Be())
|
|
3827
|
-
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
3828
|
-
const c = a ? "of.path" : "path", y =
|
|
3829
|
-
return
|
|
3830
|
-
|
|
3827
|
+
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Qe, {}) });
|
|
3828
|
+
const c = a ? "of.path" : "path", y = N(s, c), f = r && N(l, c);
|
|
3829
|
+
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
3830
|
+
be,
|
|
3831
3831
|
{
|
|
3832
3832
|
required: !0,
|
|
3833
3833
|
name: c,
|
|
@@ -3836,7 +3836,7 @@ function Rt({
|
|
|
3836
3836
|
validate: $i,
|
|
3837
3837
|
disabled: t || i,
|
|
3838
3838
|
value: y,
|
|
3839
|
-
error:
|
|
3839
|
+
error: f,
|
|
3840
3840
|
handleChange: o,
|
|
3841
3841
|
component: Li
|
|
3842
3842
|
}
|
|
@@ -3857,11 +3857,11 @@ function Li({
|
|
|
3857
3857
|
console.log("error", s);
|
|
3858
3858
|
const l = Be();
|
|
3859
3859
|
if (!l)
|
|
3860
|
-
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
3860
|
+
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Qe, {}) });
|
|
3861
3861
|
const p = l?.collections ?? [], m = Array.from(new Set(
|
|
3862
3862
|
Object.values(p).map((d) => d.group).filter(Boolean)
|
|
3863
3863
|
).values()), u = p.filter((d) => !d.group);
|
|
3864
|
-
return /* @__PURE__ */ n(
|
|
3864
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
3865
3865
|
/* @__PURE__ */ n(
|
|
3866
3866
|
Se,
|
|
3867
3867
|
{
|
|
@@ -3873,7 +3873,7 @@ function Li({
|
|
|
3873
3873
|
onChange: r,
|
|
3874
3874
|
label: "Target collection",
|
|
3875
3875
|
renderValue: (d) => {
|
|
3876
|
-
const c = p.find((
|
|
3876
|
+
const c = p.find((f) => f.id === d || f.path === d);
|
|
3877
3877
|
if (!c)
|
|
3878
3878
|
return null;
|
|
3879
3879
|
const y = ct(c);
|
|
@@ -3952,8 +3952,8 @@ function Ki({ disabled: t }) {
|
|
|
3952
3952
|
errors: i,
|
|
3953
3953
|
touched: r,
|
|
3954
3954
|
setFieldValue: s
|
|
3955
|
-
} = Y(), o = "mode", l =
|
|
3956
|
-
return /* @__PURE__ */ n(
|
|
3955
|
+
} = Y(), o = "mode", l = N(a, o), p = N(r, o) && N(i, o), m = "autoValue", u = N(a, m), d = N(r, m) && N(i, m);
|
|
3956
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
3957
3957
|
/* @__PURE__ */ n("div", { className: "flex flex-col col-span-12", children: [
|
|
3958
3958
|
/* @__PURE__ */ n(
|
|
3959
3959
|
Se,
|
|
@@ -4039,7 +4039,7 @@ function Yi({ disabled: t }) {
|
|
|
4039
4039
|
] });
|
|
4040
4040
|
}
|
|
4041
4041
|
function Gi({ disabled: t }) {
|
|
4042
|
-
return /* @__PURE__ */ e(
|
|
4042
|
+
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Me, { disabled: t }) }) }) });
|
|
4043
4043
|
}
|
|
4044
4044
|
function na(t, a, i) {
|
|
4045
4045
|
let r;
|
|
@@ -4291,8 +4291,8 @@ function Hi({
|
|
|
4291
4291
|
disabled: t,
|
|
4292
4292
|
showErrors: a
|
|
4293
4293
|
}) {
|
|
4294
|
-
const { values: i, setFieldValue: r } = Y(), s =
|
|
4295
|
-
return /* @__PURE__ */ n(
|
|
4294
|
+
const { values: i, setFieldValue: r } = Y(), s = N(i, "url");
|
|
4295
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
4296
4296
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ n(
|
|
4297
4297
|
Se,
|
|
4298
4298
|
{
|
|
@@ -4342,12 +4342,12 @@ function Hi({
|
|
|
4342
4342
|
r("defaultValue", o.target.value === "" ? void 0 : o.target.value);
|
|
4343
4343
|
},
|
|
4344
4344
|
label: "Default value",
|
|
4345
|
-
value:
|
|
4345
|
+
value: N(i, "defaultValue") ?? ""
|
|
4346
4346
|
}
|
|
4347
4347
|
) })
|
|
4348
4348
|
] });
|
|
4349
4349
|
}
|
|
4350
|
-
const
|
|
4350
|
+
const Wi = [
|
|
4351
4351
|
"text_field",
|
|
4352
4352
|
"multiline",
|
|
4353
4353
|
"markdown",
|
|
@@ -4368,7 +4368,7 @@ const Ji = [
|
|
|
4368
4368
|
"key_value",
|
|
4369
4369
|
"repeat",
|
|
4370
4370
|
"block"
|
|
4371
|
-
], la = Object.entries(Zt).filter(([t]) =>
|
|
4371
|
+
], la = Object.entries(Zt).filter(([t]) => Wi.includes(t)).map(([t, a]) => ({ [t]: a })).reduce((t, a) => ({ ...t, ...a }), {}), ca = K.memo(
|
|
4372
4372
|
function({
|
|
4373
4373
|
includeIdAndName: a = !0,
|
|
4374
4374
|
autoOpenTypeSelect: i,
|
|
@@ -4382,19 +4382,19 @@ const Ji = [
|
|
|
4382
4382
|
onPropertyChangedImmediate: d = !0,
|
|
4383
4383
|
onDelete: c,
|
|
4384
4384
|
onError: y,
|
|
4385
|
-
initialErrors:
|
|
4385
|
+
initialErrors: f,
|
|
4386
4386
|
forceShowErrors: b,
|
|
4387
|
-
existingPropertyKeys:
|
|
4387
|
+
existingPropertyKeys: P,
|
|
4388
4388
|
allowDataInference: w,
|
|
4389
4389
|
getHelpers: k,
|
|
4390
|
-
getData:
|
|
4390
|
+
getData: g,
|
|
4391
4391
|
propertyConfigs: v,
|
|
4392
4392
|
collectionEditable: _
|
|
4393
4393
|
}) {
|
|
4394
4394
|
const h = {
|
|
4395
4395
|
id: "",
|
|
4396
4396
|
name: ""
|
|
4397
|
-
}, A = !!(m && !
|
|
4397
|
+
}, A = !!(m && !We(m)) && !_, E = He(m ? {
|
|
4398
4398
|
id: l,
|
|
4399
4399
|
previousId: l,
|
|
4400
4400
|
property: m
|
|
@@ -4413,23 +4413,22 @@ const Ji = [
|
|
|
4413
4413
|
return /* @__PURE__ */ e(
|
|
4414
4414
|
St,
|
|
4415
4415
|
{
|
|
4416
|
-
initialErrors:
|
|
4416
|
+
initialErrors: f,
|
|
4417
4417
|
initialValues: m ? { id: l, ...m } : h,
|
|
4418
4418
|
onSubmit: (q, B) => {
|
|
4419
|
-
console.log("Submitting property", q);
|
|
4420
4419
|
const {
|
|
4421
4420
|
id: S,
|
|
4422
|
-
...
|
|
4421
|
+
...O
|
|
4423
4422
|
} = q;
|
|
4424
4423
|
z({
|
|
4425
4424
|
id: S,
|
|
4426
|
-
property: { ...
|
|
4425
|
+
property: { ...O, editable: O.editable ?? !0 }
|
|
4427
4426
|
}), r || B.resetForm({ values: h });
|
|
4428
4427
|
},
|
|
4429
4428
|
children: (q) => (pe(() => {
|
|
4430
4429
|
k?.(q);
|
|
4431
4430
|
}, [q]), /* @__PURE__ */ e(
|
|
4432
|
-
|
|
4431
|
+
Ji,
|
|
4433
4432
|
{
|
|
4434
4433
|
onPropertyChanged: d ? z : void 0,
|
|
4435
4434
|
onDelete: c,
|
|
@@ -4441,9 +4440,9 @@ const Ji = [
|
|
|
4441
4440
|
autoUpdateId: s,
|
|
4442
4441
|
inArray: o,
|
|
4443
4442
|
autoOpenTypeSelect: i,
|
|
4444
|
-
existingPropertyKeys:
|
|
4443
|
+
existingPropertyKeys: P,
|
|
4445
4444
|
disabled: A,
|
|
4446
|
-
getData:
|
|
4445
|
+
getData: g,
|
|
4447
4446
|
allowDataInference: w,
|
|
4448
4447
|
propertyConfigs: v,
|
|
4449
4448
|
collectionEditable: _,
|
|
@@ -4490,7 +4489,7 @@ function je({
|
|
|
4490
4489
|
) }),
|
|
4491
4490
|
/* @__PURE__ */ n(Le, { children: [
|
|
4492
4491
|
a && /* @__PURE__ */ e(
|
|
4493
|
-
|
|
4492
|
+
R,
|
|
4494
4493
|
{
|
|
4495
4494
|
variant: "text",
|
|
4496
4495
|
onClick: () => {
|
|
@@ -4500,7 +4499,7 @@ function je({
|
|
|
4500
4499
|
}
|
|
4501
4500
|
),
|
|
4502
4501
|
/* @__PURE__ */ e(
|
|
4503
|
-
|
|
4502
|
+
R,
|
|
4504
4503
|
{
|
|
4505
4504
|
variant: "outlined",
|
|
4506
4505
|
color: "primary",
|
|
@@ -4513,7 +4512,7 @@ function je({
|
|
|
4513
4512
|
}
|
|
4514
4513
|
);
|
|
4515
4514
|
}
|
|
4516
|
-
function
|
|
4515
|
+
function Ji({
|
|
4517
4516
|
values: t,
|
|
4518
4517
|
errors: a,
|
|
4519
4518
|
touched: i,
|
|
@@ -4527,26 +4526,26 @@ function Qi({
|
|
|
4527
4526
|
onDelete: d,
|
|
4528
4527
|
propertyNamespace: c,
|
|
4529
4528
|
onError: y,
|
|
4530
|
-
showErrors:
|
|
4529
|
+
showErrors: f,
|
|
4531
4530
|
disabled: b,
|
|
4532
|
-
inArray:
|
|
4531
|
+
inArray: P,
|
|
4533
4532
|
existingPropertyKeys: w,
|
|
4534
4533
|
getData: k,
|
|
4535
|
-
allowDataInference:
|
|
4534
|
+
allowDataInference: g,
|
|
4536
4535
|
propertyConfigs: v,
|
|
4537
4536
|
collectionEditable: _
|
|
4538
4537
|
}) {
|
|
4539
|
-
const [h, A] = L(p), [E, z] = L(!1), [q, B] = L(t?.dataType ? Xt(t) : void 0), S = Object.entries(la).concat(Object.entries(v)),
|
|
4538
|
+
const [h, A] = L(p), [E, z] = L(!1), [q, B] = L(t?.dataType ? Xt(t) : void 0), S = Object.entries(la).concat(Object.entries(v)), O = P ? S.filter(([J, te]) => !oe(te.property) && te.property?.dataType !== "array") : S, j = ba(t), x = He(null), I = He(t), ge = "id", ye = f && N(a, "selectedWidget");
|
|
4540
4539
|
pe(() => {
|
|
4541
|
-
!
|
|
4540
|
+
!N(i, ge) && l && t?.name && s(ge, Ct(t.name));
|
|
4542
4541
|
}, [l, i, t?.name]), pe(() => {
|
|
4543
4542
|
if (u && (!m || j.id)) {
|
|
4544
4543
|
const {
|
|
4545
|
-
id:
|
|
4544
|
+
id: J,
|
|
4546
4545
|
...te
|
|
4547
4546
|
} = j;
|
|
4548
4547
|
ut(j, I.current) || (u({
|
|
4549
|
-
id:
|
|
4548
|
+
id: J,
|
|
4550
4549
|
property: te,
|
|
4551
4550
|
namespace: c
|
|
4552
4551
|
}), I.current = j);
|
|
@@ -4554,105 +4553,105 @@ function Qi({
|
|
|
4554
4553
|
}, [j, m, u, c]), pe(() => {
|
|
4555
4554
|
t?.id && y && Object.keys(a).length > 0 && y(t?.id, c, a);
|
|
4556
4555
|
}, [a, y, c, t?.id]);
|
|
4557
|
-
const
|
|
4558
|
-
B(
|
|
4556
|
+
const Z = (J) => {
|
|
4557
|
+
B(J), r(na(t, J, v)), setTimeout(() => {
|
|
4559
4558
|
x.current?.focus();
|
|
4560
4559
|
}, 0);
|
|
4561
4560
|
};
|
|
4562
|
-
let
|
|
4563
|
-
return q === "text_field" || q === "multiline" || q === "markdown" || q === "email" ?
|
|
4561
|
+
let $;
|
|
4562
|
+
return q === "text_field" || q === "multiline" || q === "markdown" || q === "email" ? $ = /* @__PURE__ */ e(
|
|
4564
4563
|
Di,
|
|
4565
4564
|
{
|
|
4566
4565
|
widgetId: q,
|
|
4567
4566
|
disabled: b,
|
|
4568
|
-
showErrors:
|
|
4567
|
+
showErrors: f
|
|
4569
4568
|
}
|
|
4570
|
-
) : q === "url" ?
|
|
4569
|
+
) : q === "url" ? $ = /* @__PURE__ */ e(
|
|
4571
4570
|
Hi,
|
|
4572
4571
|
{
|
|
4573
4572
|
disabled: b,
|
|
4574
|
-
showErrors:
|
|
4573
|
+
showErrors: f
|
|
4575
4574
|
}
|
|
4576
|
-
) : q === "select" || q === "number_select" ?
|
|
4575
|
+
) : q === "select" || q === "number_select" ? $ = /* @__PURE__ */ e(
|
|
4577
4576
|
Bt,
|
|
4578
4577
|
{
|
|
4579
4578
|
multiselect: !1,
|
|
4580
|
-
allowDataInference:
|
|
4579
|
+
allowDataInference: g,
|
|
4581
4580
|
updateIds: !o,
|
|
4582
4581
|
disabled: b,
|
|
4583
4582
|
getData: k,
|
|
4584
|
-
showErrors:
|
|
4583
|
+
showErrors: f
|
|
4585
4584
|
}
|
|
4586
|
-
) : q === "multi_select" || q === "multi_number_select" ?
|
|
4585
|
+
) : q === "multi_select" || q === "multi_number_select" ? $ = /* @__PURE__ */ e(
|
|
4587
4586
|
Bt,
|
|
4588
4587
|
{
|
|
4589
4588
|
multiselect: !0,
|
|
4590
4589
|
updateIds: !o,
|
|
4591
4590
|
disabled: b,
|
|
4592
|
-
allowDataInference:
|
|
4591
|
+
allowDataInference: g,
|
|
4593
4592
|
getData: k,
|
|
4594
|
-
showErrors:
|
|
4593
|
+
showErrors: f
|
|
4595
4594
|
}
|
|
4596
|
-
) : q === "file_upload" ?
|
|
4595
|
+
) : q === "file_upload" ? $ = /* @__PURE__ */ e(
|
|
4597
4596
|
Mt,
|
|
4598
4597
|
{
|
|
4599
4598
|
existing: o,
|
|
4600
4599
|
multiple: !1,
|
|
4601
4600
|
disabled: b
|
|
4602
4601
|
}
|
|
4603
|
-
) : q === "multi_file_upload" ?
|
|
4602
|
+
) : q === "multi_file_upload" ? $ = /* @__PURE__ */ e(
|
|
4604
4603
|
Mt,
|
|
4605
4604
|
{
|
|
4606
4605
|
existing: o,
|
|
4607
4606
|
multiple: !0,
|
|
4608
4607
|
disabled: b
|
|
4609
4608
|
}
|
|
4610
|
-
) : q === "switch" ?
|
|
4609
|
+
) : q === "switch" ? $ = /* @__PURE__ */ e(Bi, { disabled: b }) : q === "number_input" ? $ = /* @__PURE__ */ e(Ui, { disabled: b }) : q === "group" ? $ = /* @__PURE__ */ e(
|
|
4611
4610
|
Ti,
|
|
4612
4611
|
{
|
|
4613
4612
|
disabled: b,
|
|
4614
4613
|
getData: k,
|
|
4615
|
-
allowDataInference:
|
|
4614
|
+
allowDataInference: g,
|
|
4616
4615
|
collectionEditable: _,
|
|
4617
4616
|
propertyConfigs: v
|
|
4618
4617
|
}
|
|
4619
|
-
) : q === "block" ?
|
|
4618
|
+
) : q === "block" ? $ = /* @__PURE__ */ e(
|
|
4620
4619
|
Mi,
|
|
4621
4620
|
{
|
|
4622
4621
|
disabled: b,
|
|
4623
4622
|
getData: k,
|
|
4624
|
-
allowDataInference:
|
|
4623
|
+
allowDataInference: g,
|
|
4625
4624
|
collectionEditable: _,
|
|
4626
4625
|
propertyConfigs: v
|
|
4627
4626
|
}
|
|
4628
|
-
) : q === "reference" ?
|
|
4627
|
+
) : q === "reference" ? $ = /* @__PURE__ */ e(
|
|
4629
4628
|
Rt,
|
|
4630
4629
|
{
|
|
4631
|
-
showErrors:
|
|
4630
|
+
showErrors: f,
|
|
4632
4631
|
existing: o,
|
|
4633
4632
|
multiple: !1,
|
|
4634
4633
|
disabled: b
|
|
4635
4634
|
}
|
|
4636
|
-
) : q === "date_time" ?
|
|
4635
|
+
) : q === "date_time" ? $ = /* @__PURE__ */ e(Ki, { disabled: b }) : q === "multi_references" ? $ = /* @__PURE__ */ e(
|
|
4637
4636
|
Rt,
|
|
4638
4637
|
{
|
|
4639
|
-
showErrors:
|
|
4638
|
+
showErrors: f,
|
|
4640
4639
|
existing: o,
|
|
4641
4640
|
multiple: !0,
|
|
4642
4641
|
disabled: b
|
|
4643
4642
|
}
|
|
4644
|
-
) : q === "repeat" ?
|
|
4643
|
+
) : q === "repeat" ? $ = /* @__PURE__ */ e(
|
|
4645
4644
|
Vi,
|
|
4646
4645
|
{
|
|
4647
|
-
showErrors:
|
|
4646
|
+
showErrors: f,
|
|
4648
4647
|
existing: o,
|
|
4649
4648
|
getData: k,
|
|
4650
|
-
allowDataInference:
|
|
4649
|
+
allowDataInference: g,
|
|
4651
4650
|
disabled: b,
|
|
4652
4651
|
collectionEditable: _,
|
|
4653
4652
|
propertyConfigs: v
|
|
4654
4653
|
}
|
|
4655
|
-
) : q === "key_value" ?
|
|
4654
|
+
) : q === "key_value" ? $ = /* @__PURE__ */ e(Gi, { disabled: b }) : $ = null, /* @__PURE__ */ n(U, { children: [
|
|
4656
4655
|
b && /* @__PURE__ */ n(ea, { mode: "warn", children: [
|
|
4657
4656
|
/* @__PURE__ */ e(C, { children: "This property can't be edited" }),
|
|
4658
4657
|
/* @__PURE__ */ n(C, { variant: "caption", children: [
|
|
@@ -4666,17 +4665,17 @@ function Qi({
|
|
|
4666
4665
|
/* @__PURE__ */ e(
|
|
4667
4666
|
Se,
|
|
4668
4667
|
{
|
|
4669
|
-
error: !!
|
|
4668
|
+
error: !!ye,
|
|
4670
4669
|
value: q ?? "",
|
|
4671
4670
|
placeholder: "Select a property widget",
|
|
4672
4671
|
open: h,
|
|
4673
4672
|
onOpenChange: A,
|
|
4674
4673
|
position: "item-aligned",
|
|
4675
4674
|
disabled: b,
|
|
4676
|
-
renderValue: (
|
|
4677
|
-
if (!
|
|
4675
|
+
renderValue: (J) => {
|
|
4676
|
+
if (!J)
|
|
4678
4677
|
return /* @__PURE__ */ e("em", { children: "Select a property widget" });
|
|
4679
|
-
const te =
|
|
4678
|
+
const te = J, me = Zt[te] ?? v[te], ue = me.property, fe = ue && !oe(ue) ? Ze(ue, v) : void 0, ve = oe(ue) || o && ue.dataType !== t?.dataType, Ce = fe ? G(fe, me) : me;
|
|
4680
4679
|
return /* @__PURE__ */ n(
|
|
4681
4680
|
"div",
|
|
4682
4681
|
{
|
|
@@ -4704,25 +4703,25 @@ function Qi({
|
|
|
4704
4703
|
}
|
|
4705
4704
|
);
|
|
4706
4705
|
},
|
|
4707
|
-
onValueChange: (
|
|
4708
|
-
|
|
4706
|
+
onValueChange: (J) => {
|
|
4707
|
+
Z(J);
|
|
4709
4708
|
},
|
|
4710
|
-
children:
|
|
4709
|
+
children: O.map(([J, te]) => {
|
|
4711
4710
|
const me = te.property, ue = o && !oe(me) && me.dataType !== t?.dataType;
|
|
4712
4711
|
return /* @__PURE__ */ e(
|
|
4713
4712
|
sa,
|
|
4714
4713
|
{
|
|
4715
|
-
value:
|
|
4714
|
+
value: J,
|
|
4716
4715
|
optionDisabled: ue,
|
|
4717
4716
|
propertyConfig: te,
|
|
4718
4717
|
existing: o
|
|
4719
4718
|
},
|
|
4720
|
-
|
|
4719
|
+
J
|
|
4721
4720
|
);
|
|
4722
4721
|
})
|
|
4723
4722
|
}
|
|
4724
4723
|
),
|
|
4725
|
-
|
|
4724
|
+
ye && /* @__PURE__ */ e(
|
|
4726
4725
|
C,
|
|
4727
4726
|
{
|
|
4728
4727
|
variant: "caption",
|
|
@@ -4747,7 +4746,7 @@ function Qi({
|
|
|
4747
4746
|
m && /* @__PURE__ */ e(
|
|
4748
4747
|
Ii,
|
|
4749
4748
|
{
|
|
4750
|
-
showErrors:
|
|
4749
|
+
showErrors: f,
|
|
4751
4750
|
disabledId: o,
|
|
4752
4751
|
isNewProperty: !o,
|
|
4753
4752
|
existingPropertyKeys: w,
|
|
@@ -4755,7 +4754,7 @@ function Qi({
|
|
|
4755
4754
|
ref: x
|
|
4756
4755
|
}
|
|
4757
4756
|
),
|
|
4758
|
-
|
|
4757
|
+
$,
|
|
4759
4758
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Yi, { disabled: b }) })
|
|
4760
4759
|
] }),
|
|
4761
4760
|
d && /* @__PURE__ */ e(
|
|
@@ -4774,13 +4773,13 @@ function Qi({
|
|
|
4774
4773
|
)
|
|
4775
4774
|
] });
|
|
4776
4775
|
}
|
|
4777
|
-
function
|
|
4776
|
+
function Qi(t) {
|
|
4778
4777
|
return (t.slice(0, 1).toLowerCase() + t.slice(1)).replace(/([-_ ]){1,}/g, " ").split(/[-_ ]/).reduce((a, i) => a + i[0].toUpperCase() + i.substring(1));
|
|
4779
4778
|
}
|
|
4780
4779
|
function Zi({ collection: t, onOpenChange: a, open: i }) {
|
|
4781
4780
|
const r = De(), s = `import { EntityCollection } from "firecms";
|
|
4782
4781
|
|
|
4783
|
-
const ` +
|
|
4782
|
+
const ` + Qi(t.name) + "Collection:EntityCollection = " + si.stringify(da(t), null, " ");
|
|
4784
4783
|
return /* @__PURE__ */ n(
|
|
4785
4784
|
Ee,
|
|
4786
4785
|
{
|
|
@@ -4811,13 +4810,13 @@ const ` + Wi(t.name) + "Collection:EntityCollection = " + si.stringify(da(t), nu
|
|
|
4811
4810
|
theme: ci.vsDark,
|
|
4812
4811
|
code: s,
|
|
4813
4812
|
language: "typescript",
|
|
4814
|
-
children: ({ className: o, style: l, tokens: p, getLineProps: m, getTokenProps: u }) => /* @__PURE__ */ e("pre", { style: l, className: "p-4 rounded text-sm", children: p.map((d, c) => /* @__PURE__ */ e("div", { ...m({ line: d }), children: d.map((y,
|
|
4813
|
+
children: ({ className: o, style: l, tokens: p, getLineProps: m, getTokenProps: u }) => /* @__PURE__ */ e("pre", { style: l, className: "p-4 rounded text-sm", children: p.map((d, c) => /* @__PURE__ */ e("div", { ...m({ line: d }), children: d.map((y, f) => /* @__PURE__ */ e("span", { ...u({ token: y }) }, f)) }, c)) })
|
|
4815
4814
|
}
|
|
4816
4815
|
)
|
|
4817
4816
|
] }),
|
|
4818
4817
|
/* @__PURE__ */ n(Le, { children: [
|
|
4819
4818
|
/* @__PURE__ */ n(
|
|
4820
|
-
|
|
4819
|
+
R,
|
|
4821
4820
|
{
|
|
4822
4821
|
variant: "text",
|
|
4823
4822
|
size: "small",
|
|
@@ -4831,7 +4830,7 @@ const ` + Wi(t.name) + "Collection:EntityCollection = " + si.stringify(da(t), nu
|
|
|
4831
4830
|
]
|
|
4832
4831
|
}
|
|
4833
4832
|
),
|
|
4834
|
-
/* @__PURE__ */ e(
|
|
4833
|
+
/* @__PURE__ */ e(R, { onClick: () => a(!1), children: "Close" })
|
|
4835
4834
|
] })
|
|
4836
4835
|
]
|
|
4837
4836
|
}
|
|
@@ -4882,100 +4881,93 @@ function Xi({
|
|
|
4882
4881
|
}) {
|
|
4883
4882
|
const {
|
|
4884
4883
|
values: y,
|
|
4885
|
-
setFieldValue:
|
|
4884
|
+
setFieldValue: f,
|
|
4886
4885
|
setFieldError: b,
|
|
4887
|
-
setFieldTouched:
|
|
4886
|
+
setFieldTouched: P,
|
|
4888
4887
|
errors: w,
|
|
4889
4888
|
dirty: k
|
|
4890
|
-
} = Y(),
|
|
4889
|
+
} = Y(), g = De(), v = Ea("lg"), _ = !v, [h, A] = L(), [E, z] = L(), [q, B] = L(), S = E ? ce(E, q) : void 0, O = S ? N(y.properties, S.replaceAll(".", ".properties.")) : void 0, [j, x] = L(!1), [I, ge] = L(!1), [ye, Z] = L(!1), [$, J] = L([]), te = K.useRef(y.propertiesOrder ? { "": y.propertiesOrder } : {});
|
|
4891
4890
|
pe(() => {
|
|
4892
4891
|
s && s(k);
|
|
4893
4892
|
}, [k]);
|
|
4894
4893
|
const me = u ? () => {
|
|
4895
|
-
u && (ge(!0), u(y).then((
|
|
4896
|
-
if (
|
|
4897
|
-
|
|
4894
|
+
u && (ge(!0), u(y).then((V) => {
|
|
4895
|
+
if (V && et(V.properties), !V) {
|
|
4896
|
+
g.open({
|
|
4898
4897
|
type: "error",
|
|
4899
4898
|
message: "Could not infer properties from data"
|
|
4900
4899
|
});
|
|
4901
4900
|
return;
|
|
4902
4901
|
}
|
|
4903
|
-
const D = (
|
|
4902
|
+
const D = (V.properties ? Object.keys(V.properties) : []).filter((le) => !y.properties[le]);
|
|
4904
4903
|
if (D.length === 0) {
|
|
4905
|
-
|
|
4904
|
+
g.open({
|
|
4906
4905
|
type: "info",
|
|
4907
4906
|
message: "No new properties found in existing data"
|
|
4908
4907
|
});
|
|
4909
4908
|
return;
|
|
4910
4909
|
}
|
|
4911
4910
|
const H = {
|
|
4912
|
-
...D.reduce((le, we) => (le[we] = (
|
|
4911
|
+
...D.reduce((le, we) => (le[we] = (V.properties ?? {})[we], le), {}),
|
|
4913
4912
|
...y.properties
|
|
4914
4913
|
}, se = [
|
|
4915
4914
|
...D,
|
|
4916
4915
|
...y.propertiesOrder ?? []
|
|
4917
4916
|
];
|
|
4918
|
-
|
|
4917
|
+
f("properties", H, !1), fe(se), J(D);
|
|
4919
4918
|
}).finally(() => {
|
|
4920
4919
|
ge(!1);
|
|
4921
4920
|
}));
|
|
4922
|
-
} : void 0, ue = (
|
|
4921
|
+
} : void 0, ue = (V) => V ? te.current[V] ?? N(y, Pe(V)) : te.current[""], fe = (V, D) => {
|
|
4923
4922
|
const H = Pe(D);
|
|
4924
|
-
|
|
4925
|
-
}, ve = (
|
|
4926
|
-
const H =
|
|
4923
|
+
f(H, V, !1), te.current[D ?? ""] = V;
|
|
4924
|
+
}, ve = (V, D) => {
|
|
4925
|
+
const H = V ? ce(V, D) : void 0;
|
|
4927
4926
|
if (!H)
|
|
4928
4927
|
throw Error("collection editor miss config");
|
|
4929
|
-
|
|
4930
|
-
const le = ue(D).filter((we) => we !==
|
|
4931
|
-
|
|
4932
|
-
}, Ce = (
|
|
4933
|
-
|
|
4928
|
+
f(ke(H), void 0, !1);
|
|
4929
|
+
const le = ue(D).filter((we) => we !== V);
|
|
4930
|
+
fe(le, D), Z(!1), A(void 0), z(void 0), B(void 0);
|
|
4931
|
+
}, Ce = (V, D) => {
|
|
4932
|
+
f(Pe(D), V, !1);
|
|
4934
4933
|
}, ae = ({
|
|
4935
|
-
id:
|
|
4934
|
+
id: V,
|
|
4936
4935
|
property: D
|
|
4937
4936
|
}) => {
|
|
4938
|
-
if (
|
|
4939
|
-
id: T,
|
|
4940
|
-
property: D
|
|
4941
|
-
}), !T)
|
|
4937
|
+
if (!V)
|
|
4942
4938
|
throw Error("Need to include an ID when creating a new property");
|
|
4943
|
-
|
|
4939
|
+
f("properties", {
|
|
4944
4940
|
...y.properties ?? {},
|
|
4945
|
-
[
|
|
4941
|
+
[V]: D
|
|
4946
4942
|
}, !1);
|
|
4947
|
-
const H = [...y.propertiesOrder ?? Object.keys(y.properties),
|
|
4948
|
-
|
|
4949
|
-
id: T,
|
|
4950
|
-
property: D,
|
|
4951
|
-
newPropertiesOrder: H
|
|
4952
|
-
}), be(H), X(!1), v && (A(H.indexOf(T)), z(T)), B(void 0);
|
|
4943
|
+
const H = [...y.propertiesOrder ?? Object.keys(y.properties), V];
|
|
4944
|
+
fe(H), Z(!1), v && (A(H.indexOf(V)), z(V)), B(void 0);
|
|
4953
4945
|
}, Ve = ({
|
|
4954
|
-
id:
|
|
4946
|
+
id: V,
|
|
4955
4947
|
property: D,
|
|
4956
4948
|
previousId: H,
|
|
4957
4949
|
namespace: se
|
|
4958
4950
|
}) => {
|
|
4959
|
-
const le =
|
|
4960
|
-
if (H && H !==
|
|
4961
|
-
const yt = ce(H, se), it = ke(yt),
|
|
4962
|
-
|
|
4951
|
+
const le = V ? ce(V, se) : void 0, we = le ? ke(le) : void 0;
|
|
4952
|
+
if (H && H !== V) {
|
|
4953
|
+
const yt = ce(H, se), it = ke(yt), X = ue(se).map((Ie) => Ie === H ? V : Ie).filter((Ie) => Ie !== void 0);
|
|
4954
|
+
fe(X, se), V && (A(X.indexOf(V)), z(V)), f(it, void 0, !1), P(it, !1, !1);
|
|
4963
4955
|
}
|
|
4964
|
-
we && (
|
|
4965
|
-
}, tt = (
|
|
4966
|
-
const se =
|
|
4956
|
+
we && (f(we, D, !1), P(we, !0, !1));
|
|
4957
|
+
}, tt = (V, D, H) => {
|
|
4958
|
+
const se = V ? ce(V, D) : void 0;
|
|
4967
4959
|
if (console.warn("onPropertyErrorInternal", {
|
|
4968
|
-
id:
|
|
4960
|
+
id: V,
|
|
4969
4961
|
namespace: D,
|
|
4970
4962
|
error: H,
|
|
4971
4963
|
propertyPath: se
|
|
4972
4964
|
}), se) {
|
|
4973
4965
|
const le = H && Object.keys(H).length > 0;
|
|
4974
|
-
r(
|
|
4966
|
+
r(V, D, le ? H : void 0), b(ke(se), le ? "Property error" : void 0);
|
|
4975
4967
|
}
|
|
4976
4968
|
}, bt = () => {
|
|
4977
4969
|
A(void 0), z(void 0);
|
|
4978
|
-
},
|
|
4970
|
+
}, T = E && i?.current?.properties ? i.current.properties[E] : void 0, F = y?.propertiesOrder === void 0 || y.propertiesOrder.length === 0, M = y.propertiesOrder ? y.propertiesOrder : Object.keys(y.properties), Oe = Kt(() => p(y.ownerId), [p, y.ownerId]), at = /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
4979
4971
|
/* @__PURE__ */ n("div", { className: xe(
|
|
4980
4972
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
4981
4973
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
@@ -4984,10 +4976,10 @@ function Xi({
|
|
|
4984
4976
|
/* @__PURE__ */ n("div", { className: "flex my-2", children: [
|
|
4985
4977
|
/* @__PURE__ */ n("div", { className: "flex-grow mb-4", children: [
|
|
4986
4978
|
/* @__PURE__ */ e(
|
|
4987
|
-
|
|
4979
|
+
be,
|
|
4988
4980
|
{
|
|
4989
4981
|
name: "name",
|
|
4990
|
-
as:
|
|
4982
|
+
as: W,
|
|
4991
4983
|
invisible: !0,
|
|
4992
4984
|
className: "-ml-1",
|
|
4993
4985
|
inputClassName: "text-2xl font-headers",
|
|
@@ -5027,14 +5019,14 @@ function Xi({
|
|
|
5027
5019
|
variant: "filled",
|
|
5028
5020
|
disabled: I,
|
|
5029
5021
|
onClick: me,
|
|
5030
|
-
children: I ? /* @__PURE__ */ e(
|
|
5022
|
+
children: I ? /* @__PURE__ */ e(Qe, { size: "small" }) : /* @__PURE__ */ e(gt, {})
|
|
5031
5023
|
}
|
|
5032
5024
|
) }),
|
|
5033
5025
|
/* @__PURE__ */ e(re, { title: "Add new property", children: /* @__PURE__ */ e(
|
|
5034
|
-
|
|
5026
|
+
R,
|
|
5035
5027
|
{
|
|
5036
5028
|
variant: "outlined",
|
|
5037
|
-
onClick: () =>
|
|
5029
|
+
onClick: () => Z(!0),
|
|
5038
5030
|
children: /* @__PURE__ */ e(Ae, {})
|
|
5039
5031
|
}
|
|
5040
5032
|
) })
|
|
@@ -5044,14 +5036,14 @@ function Xi({
|
|
|
5044
5036
|
ft,
|
|
5045
5037
|
{
|
|
5046
5038
|
className: "pl-8",
|
|
5047
|
-
onPropertyClick: (
|
|
5048
|
-
A(
|
|
5039
|
+
onPropertyClick: (V, D) => {
|
|
5040
|
+
A(M.indexOf(V)), z(V), B(D);
|
|
5049
5041
|
},
|
|
5050
|
-
inferredPropertyKeys:
|
|
5042
|
+
inferredPropertyKeys: $,
|
|
5051
5043
|
selectedPropertyKey: E ? ce(E, q) : void 0,
|
|
5052
5044
|
properties: y.properties,
|
|
5053
5045
|
additionalFields: y.additionalFields,
|
|
5054
|
-
propertiesOrder:
|
|
5046
|
+
propertiesOrder: M,
|
|
5055
5047
|
onPropertyMove: Ce,
|
|
5056
5048
|
onPropertyRemove: a ? ve : void 0,
|
|
5057
5049
|
collectionEditable: c,
|
|
@@ -5059,13 +5051,13 @@ function Xi({
|
|
|
5059
5051
|
}
|
|
5060
5052
|
) }),
|
|
5061
5053
|
/* @__PURE__ */ e(
|
|
5062
|
-
|
|
5054
|
+
R,
|
|
5063
5055
|
{
|
|
5064
5056
|
className: "mt-8 w-full",
|
|
5065
5057
|
color: "primary",
|
|
5066
5058
|
variant: "outlined",
|
|
5067
5059
|
size: "large",
|
|
5068
|
-
onClick: () =>
|
|
5060
|
+
onClick: () => Z(!0),
|
|
5069
5061
|
startIcon: /* @__PURE__ */ e(Ae, {}),
|
|
5070
5062
|
children: "Add new property"
|
|
5071
5063
|
}
|
|
@@ -5076,7 +5068,7 @@ function Xi({
|
|
|
5076
5068
|
{
|
|
5077
5069
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
5078
5070
|
children: [
|
|
5079
|
-
S &&
|
|
5071
|
+
S && O && !oe(O) && /* @__PURE__ */ e(
|
|
5080
5072
|
ca,
|
|
5081
5073
|
{
|
|
5082
5074
|
inArray: !1,
|
|
@@ -5086,20 +5078,20 @@ function Xi({
|
|
|
5086
5078
|
autoOpenTypeSelect: !1,
|
|
5087
5079
|
propertyKey: E,
|
|
5088
5080
|
propertyNamespace: q,
|
|
5089
|
-
property:
|
|
5081
|
+
property: O,
|
|
5090
5082
|
onPropertyChanged: Ve,
|
|
5091
5083
|
onDelete: ve,
|
|
5092
5084
|
onError: tt,
|
|
5093
5085
|
forceShowErrors: t,
|
|
5094
|
-
initialErrors:
|
|
5086
|
+
initialErrors: T,
|
|
5095
5087
|
getData: m,
|
|
5096
5088
|
propertyConfigs: d,
|
|
5097
5089
|
collectionEditable: c
|
|
5098
5090
|
},
|
|
5099
5091
|
`edit_view_${h}`
|
|
5100
5092
|
),
|
|
5101
|
-
!
|
|
5102
|
-
|
|
5093
|
+
!O && /* @__PURE__ */ e(C, { variant: "label", className: "flex items-center justify-center h-full", children: F ? "Now you can add your first property" : "Select a property to edit it" }),
|
|
5094
|
+
O && oe(O) && /* @__PURE__ */ e(C, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
|
|
5103
5095
|
]
|
|
5104
5096
|
}
|
|
5105
5097
|
) }),
|
|
@@ -5114,12 +5106,12 @@ function Xi({
|
|
|
5114
5106
|
autoOpenTypeSelect: !1,
|
|
5115
5107
|
propertyKey: E,
|
|
5116
5108
|
propertyNamespace: q,
|
|
5117
|
-
property:
|
|
5109
|
+
property: O,
|
|
5118
5110
|
onPropertyChanged: Ve,
|
|
5119
5111
|
onDelete: ve,
|
|
5120
5112
|
onError: tt,
|
|
5121
5113
|
forceShowErrors: t,
|
|
5122
|
-
initialErrors:
|
|
5114
|
+
initialErrors: T,
|
|
5123
5115
|
getData: m,
|
|
5124
5116
|
propertyConfigs: d,
|
|
5125
5117
|
collectionEditable: c,
|
|
@@ -5128,7 +5120,7 @@ function Xi({
|
|
|
5128
5120
|
`edit_view_${h}`
|
|
5129
5121
|
)
|
|
5130
5122
|
] });
|
|
5131
|
-
return /* @__PURE__ */ n(
|
|
5123
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
5132
5124
|
at,
|
|
5133
5125
|
/* @__PURE__ */ e(
|
|
5134
5126
|
je,
|
|
@@ -5138,8 +5130,8 @@ function Xi({
|
|
|
5138
5130
|
autoOpenTypeSelect: !0,
|
|
5139
5131
|
autoUpdateId: !0,
|
|
5140
5132
|
forceShowErrors: t,
|
|
5141
|
-
open:
|
|
5142
|
-
onCancel: () =>
|
|
5133
|
+
open: ye,
|
|
5134
|
+
onCancel: () => Z(!1),
|
|
5143
5135
|
onPropertyChanged: ae,
|
|
5144
5136
|
getData: m,
|
|
5145
5137
|
allowDataInference: !a,
|
|
@@ -5179,8 +5171,8 @@ function er({
|
|
|
5179
5171
|
/* @__PURE__ */ e(C, { children: "Are you sure?" })
|
|
5180
5172
|
] }),
|
|
5181
5173
|
/* @__PURE__ */ n(Le, { children: [
|
|
5182
|
-
/* @__PURE__ */ e(
|
|
5183
|
-
/* @__PURE__ */ e(
|
|
5174
|
+
/* @__PURE__ */ e(R, { variant: "text", onClick: i, autoFocus: !0, children: " Cancel " }),
|
|
5175
|
+
/* @__PURE__ */ e(R, { onClick: a, children: " Ok " })
|
|
5184
5176
|
] })
|
|
5185
5177
|
]
|
|
5186
5178
|
}
|
|
@@ -5199,7 +5191,7 @@ function tr({ open: t, onClose: a }) {
|
|
|
5199
5191
|
/* @__PURE__ */ n($e, { children: [
|
|
5200
5192
|
/* @__PURE__ */ e(C, { variant: "h6", children: "Select view" }),
|
|
5201
5193
|
i?.map((r) => /* @__PURE__ */ n(
|
|
5202
|
-
|
|
5194
|
+
R,
|
|
5203
5195
|
{
|
|
5204
5196
|
onClick: () => a(r.key),
|
|
5205
5197
|
fullWidth: !0,
|
|
@@ -5215,7 +5207,7 @@ function tr({ open: t, onClose: a }) {
|
|
|
5215
5207
|
)),
|
|
5216
5208
|
(i ?? []).length === 0 && /* @__PURE__ */ e(C, { variant: "body2", children: "No custom views defined" })
|
|
5217
5209
|
] }),
|
|
5218
|
-
/* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e(
|
|
5210
|
+
/* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e(R, { onClick: () => a(), children: "Cancel" }) })
|
|
5219
5211
|
]
|
|
5220
5212
|
}
|
|
5221
5213
|
);
|
|
@@ -5228,16 +5220,16 @@ function ar({
|
|
|
5228
5220
|
getUser: s,
|
|
5229
5221
|
parentCollectionIds: o
|
|
5230
5222
|
}) {
|
|
5231
|
-
const { entityViews: l } = Ke(), [p, m] = K.useState(), [u, d] = K.useState(!1), [c, y] = K.useState(), [
|
|
5232
|
-
values:
|
|
5223
|
+
const { entityViews: l } = Ke(), [p, m] = K.useState(), [u, d] = K.useState(!1), [c, y] = K.useState(), [f, b] = K.useState(), {
|
|
5224
|
+
values: P,
|
|
5233
5225
|
setFieldValue: w
|
|
5234
|
-
} = Y(), k = t.subcollections ?? [],
|
|
5226
|
+
} = Y(), k = t.subcollections ?? [], g = P.entityViews?.filter((h) => typeof h == "string").map((h) => Ba(h, l)).filter(Boolean) ?? [], v = t.entityViews?.filter((h) => typeof h != "string") ?? [], _ = g.length + v.length;
|
|
5235
5227
|
return /* @__PURE__ */ n("div", { className: "overflow-auto my-auto", children: [
|
|
5236
5228
|
/* @__PURE__ */ e(ht, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ n("div", { className: "flex flex-col gap-16", children: [
|
|
5237
5229
|
/* @__PURE__ */ n("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
5238
5230
|
/* @__PURE__ */ n(C, { variant: "h5", children: [
|
|
5239
5231
|
"Subcollections of ",
|
|
5240
|
-
|
|
5232
|
+
P.name
|
|
5241
5233
|
] }),
|
|
5242
5234
|
k && k.length > 0 && /* @__PURE__ */ e(qe, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(It, { children: /* @__PURE__ */ e(Ft, { children: k.map((h) => /* @__PURE__ */ n(
|
|
5243
5235
|
wt,
|
|
@@ -5276,7 +5268,7 @@ function ar({
|
|
|
5276
5268
|
h.path
|
|
5277
5269
|
)) }) }) }),
|
|
5278
5270
|
/* @__PURE__ */ e(
|
|
5279
|
-
|
|
5271
|
+
R,
|
|
5280
5272
|
{
|
|
5281
5273
|
onClick: () => {
|
|
5282
5274
|
b({
|
|
@@ -5291,8 +5283,8 @@ function ar({
|
|
|
5291
5283
|
] }),
|
|
5292
5284
|
/* @__PURE__ */ n("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
5293
5285
|
/* @__PURE__ */ e(C, { variant: "h5", children: "Custom views" }),
|
|
5294
|
-
_ > 0 && /* @__PURE__ */ e(
|
|
5295
|
-
|
|
5286
|
+
_ > 0 && /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(qe, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(It, { children: /* @__PURE__ */ n(Ft, { children: [
|
|
5287
|
+
g.map((h) => /* @__PURE__ */ n(wt, { children: [
|
|
5296
5288
|
/* @__PURE__ */ e(
|
|
5297
5289
|
Ge,
|
|
5298
5290
|
{
|
|
@@ -5337,7 +5329,7 @@ function ar({
|
|
|
5337
5329
|
" Define your own custom views by uploading it with the CLI"
|
|
5338
5330
|
] }),
|
|
5339
5331
|
/* @__PURE__ */ e(
|
|
5340
|
-
|
|
5332
|
+
R,
|
|
5341
5333
|
{
|
|
5342
5334
|
onClick: () => {
|
|
5343
5335
|
d(!0);
|
|
@@ -5361,8 +5353,8 @@ function ar({
|
|
|
5361
5353
|
}), m(void 0);
|
|
5362
5354
|
},
|
|
5363
5355
|
onCancel: () => m(void 0),
|
|
5364
|
-
title: /* @__PURE__ */ e(
|
|
5365
|
-
body: /* @__PURE__ */ n(
|
|
5356
|
+
title: /* @__PURE__ */ e(U, { children: "Delete this subcollection?" }),
|
|
5357
|
+
body: /* @__PURE__ */ n(U, { children: [
|
|
5366
5358
|
" This will ",
|
|
5367
5359
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
5368
5360
|
", only the collection in the CMS"
|
|
@@ -5374,11 +5366,11 @@ function ar({
|
|
|
5374
5366
|
{
|
|
5375
5367
|
open: !!c,
|
|
5376
5368
|
onAccept: () => {
|
|
5377
|
-
w("entityViews",
|
|
5369
|
+
w("entityViews", P.entityViews?.filter((h) => h !== c)), y(void 0);
|
|
5378
5370
|
},
|
|
5379
5371
|
onCancel: () => y(void 0),
|
|
5380
|
-
title: /* @__PURE__ */ e(
|
|
5381
|
-
body: /* @__PURE__ */ n(
|
|
5372
|
+
title: /* @__PURE__ */ e(U, { children: "Remove this view?" }),
|
|
5373
|
+
body: /* @__PURE__ */ n(U, { children: [
|
|
5382
5374
|
"This will ",
|
|
5383
5375
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
5384
5376
|
", only the view in the CMS"
|
|
@@ -5388,13 +5380,13 @@ function ar({
|
|
|
5388
5380
|
/* @__PURE__ */ e(
|
|
5389
5381
|
ma,
|
|
5390
5382
|
{
|
|
5391
|
-
open: !!
|
|
5383
|
+
open: !!f,
|
|
5392
5384
|
configController: i,
|
|
5393
5385
|
parentCollection: t,
|
|
5394
5386
|
collectionInference: r,
|
|
5395
|
-
parentCollectionIds: [...o ?? [],
|
|
5387
|
+
parentCollectionIds: [...o ?? [], P.id],
|
|
5396
5388
|
isNewCollection: !1,
|
|
5397
|
-
...
|
|
5389
|
+
...f,
|
|
5398
5390
|
getUser: s,
|
|
5399
5391
|
handleClose: () => {
|
|
5400
5392
|
b(void 0);
|
|
@@ -5406,7 +5398,7 @@ function ar({
|
|
|
5406
5398
|
{
|
|
5407
5399
|
open: u,
|
|
5408
5400
|
onClose: (h) => {
|
|
5409
|
-
h &&
|
|
5401
|
+
h && w("entityViews", [...P.entityViews ?? [], h]), d(!1);
|
|
5410
5402
|
}
|
|
5411
5403
|
}
|
|
5412
5404
|
)
|
|
@@ -5650,8 +5642,8 @@ function ir({
|
|
|
5650
5642
|
}) {
|
|
5651
5643
|
const [o, l] = L(!1), [p, m] = L();
|
|
5652
5644
|
pe(() => {
|
|
5653
|
-
a && s && (l(!0), a(t).then((
|
|
5654
|
-
const v =
|
|
5645
|
+
a && s && (l(!0), a(t).then((g) => {
|
|
5646
|
+
const v = g.filter((_) => !s.find((h) => h.path.trim().toLowerCase() === _.trim().toLowerCase()));
|
|
5655
5647
|
m(v);
|
|
5656
5648
|
}).finally(() => l(!1)));
|
|
5657
5649
|
}, [s, t, a]);
|
|
@@ -5660,9 +5652,9 @@ function ir({
|
|
|
5660
5652
|
setFieldValue: d,
|
|
5661
5653
|
setValues: c,
|
|
5662
5654
|
handleChange: y,
|
|
5663
|
-
touched:
|
|
5655
|
+
touched: f,
|
|
5664
5656
|
errors: b,
|
|
5665
|
-
setFieldTouched:
|
|
5657
|
+
setFieldTouched: P,
|
|
5666
5658
|
isSubmitting: w,
|
|
5667
5659
|
submitCount: k
|
|
5668
5660
|
} = Y();
|
|
@@ -5688,18 +5680,18 @@ function ir({
|
|
|
5688
5680
|
}
|
|
5689
5681
|
),
|
|
5690
5682
|
/* @__PURE__ */ n("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
|
|
5691
|
-
o && !p && /* @__PURE__ */ e(
|
|
5692
|
-
p?.map((
|
|
5683
|
+
o && !p && /* @__PURE__ */ e(Qe, { size: "small" }),
|
|
5684
|
+
p?.map((g, v) => /* @__PURE__ */ e(
|
|
5693
5685
|
dt,
|
|
5694
5686
|
{
|
|
5695
5687
|
colorScheme: "cyanLighter",
|
|
5696
5688
|
onClick: () => {
|
|
5697
|
-
d("name", Pt(
|
|
5689
|
+
d("name", Pt(g)), d("path", g), d("properties", void 0), r();
|
|
5698
5690
|
},
|
|
5699
5691
|
size: "small",
|
|
5700
|
-
children:
|
|
5692
|
+
children: g
|
|
5701
5693
|
},
|
|
5702
|
-
|
|
5694
|
+
g
|
|
5703
5695
|
)),
|
|
5704
5696
|
!o && p?.length === 0 && /* @__PURE__ */ e(C, { variant: "caption", children: "No suggestions" })
|
|
5705
5697
|
] })
|
|
@@ -5759,9 +5751,9 @@ function ir({
|
|
|
5759
5751
|
children: "● Create a collection from a file (csv, json, xls, xslx...)"
|
|
5760
5752
|
}
|
|
5761
5753
|
),
|
|
5762
|
-
/* @__PURE__ */ e(di, { onDataAdded: (
|
|
5754
|
+
/* @__PURE__ */ e(di, { onDataAdded: (g) => r(g) })
|
|
5763
5755
|
] }),
|
|
5764
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
5756
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(R, { variant: "text", onClick: () => r(), className: "my-2", children: "Continue from scratch" }) })
|
|
5765
5757
|
] }) });
|
|
5766
5758
|
}
|
|
5767
5759
|
function kt({
|
|
@@ -5805,38 +5797,35 @@ function rr({
|
|
|
5805
5797
|
setFieldTouched: s,
|
|
5806
5798
|
values: o
|
|
5807
5799
|
} = Y(), [l, p] = L(void 0), m = K.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), u = l ? l.id : void 0, d = l || void 0, c = ({
|
|
5808
|
-
id:
|
|
5800
|
+
id: f,
|
|
5809
5801
|
property: b,
|
|
5810
|
-
previousId:
|
|
5802
|
+
previousId: P,
|
|
5811
5803
|
namespace: w
|
|
5812
5804
|
}) => {
|
|
5813
|
-
const k =
|
|
5805
|
+
const k = f ? ce(f, w) : void 0, g = k ? ke(k) : void 0, v = (h) => h ? m.current[h] ?? N(o, Pe(h)) : m.current[""], _ = (h, A) => {
|
|
5814
5806
|
const E = Pe(A);
|
|
5815
5807
|
r(E, h, !1), m.current[A ?? ""] = h;
|
|
5816
5808
|
};
|
|
5817
|
-
if (
|
|
5818
|
-
const h = ce(
|
|
5809
|
+
if (P && P !== f) {
|
|
5810
|
+
const h = ce(P, w), A = ke(h), z = v(w).map((B) => B === P ? f : B).filter((B) => B !== void 0);
|
|
5819
5811
|
_(z, w);
|
|
5820
5812
|
const q = { ...t.headersMapping };
|
|
5821
5813
|
Object.keys(q).forEach((B) => {
|
|
5822
|
-
q[B] ===
|
|
5814
|
+
q[B] === P && (q[B] = f ?? "");
|
|
5823
5815
|
}), t.setHeadersMapping(q), r(A, void 0, !1), s(A, !1, !1);
|
|
5824
5816
|
}
|
|
5825
|
-
|
|
5817
|
+
g && (r(g, b, !1), s(g, !0, !1));
|
|
5826
5818
|
}, y = async ({
|
|
5827
|
-
id:
|
|
5819
|
+
id: f,
|
|
5828
5820
|
importKey: b,
|
|
5829
|
-
property:
|
|
5821
|
+
property: P,
|
|
5830
5822
|
namespace: w
|
|
5831
5823
|
}) => {
|
|
5832
|
-
const k =
|
|
5833
|
-
...ai(v,
|
|
5824
|
+
const k = f ? ce(f, w) : void 0, g = k ? ke(k) : void 0, v = t.importData.map((h) => N(h, b)), _ = {
|
|
5825
|
+
...ai(v, P, ia),
|
|
5834
5826
|
editable: !0
|
|
5835
5827
|
};
|
|
5836
|
-
|
|
5837
|
-
property: O,
|
|
5838
|
-
inferredNewProperty: _
|
|
5839
|
-
}), r(f, _, !1)) : r(f, O, !1), s(f, !0, !1));
|
|
5828
|
+
g && (_ ? r(g, _, !1) : r(g, P, !1), s(g, !0, !1));
|
|
5840
5829
|
};
|
|
5841
5830
|
return /* @__PURE__ */ n("div", { className: "overflow-auto my-auto bg-gray-50 dark:bg-gray-900", children: [
|
|
5842
5831
|
/* @__PURE__ */ n(ht, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
@@ -5848,20 +5837,20 @@ function rr({
|
|
|
5848
5837
|
idColumn: t.idColumn,
|
|
5849
5838
|
originProperties: t.originProperties,
|
|
5850
5839
|
destinationProperties: o.properties,
|
|
5851
|
-
onIdPropertyChanged: (
|
|
5840
|
+
onIdPropertyChanged: (f) => t.setIdColumn(f),
|
|
5852
5841
|
buildPropertyView: ({
|
|
5853
|
-
property:
|
|
5842
|
+
property: f,
|
|
5854
5843
|
propertyKey: b,
|
|
5855
|
-
importKey:
|
|
5844
|
+
importKey: P
|
|
5856
5845
|
}) => /* @__PURE__ */ e(
|
|
5857
5846
|
mi,
|
|
5858
5847
|
{
|
|
5859
|
-
property:
|
|
5848
|
+
property: f,
|
|
5860
5849
|
propertyKey: b,
|
|
5861
5850
|
onPropertyNameChanged: (w, k) => r(`properties.${w}.name`, k, !1),
|
|
5862
5851
|
onEditClick: () => {
|
|
5863
|
-
!b || !
|
|
5864
|
-
...
|
|
5852
|
+
!b || !f || p({
|
|
5853
|
+
...f,
|
|
5865
5854
|
id: b,
|
|
5866
5855
|
editable: !0
|
|
5867
5856
|
});
|
|
@@ -5869,11 +5858,11 @@ function rr({
|
|
|
5869
5858
|
propertyTypeView: /* @__PURE__ */ e(
|
|
5870
5859
|
or,
|
|
5871
5860
|
{
|
|
5872
|
-
property:
|
|
5861
|
+
property: f,
|
|
5873
5862
|
disabled: !1,
|
|
5874
5863
|
onPropertyChanged: (w) => y({
|
|
5875
5864
|
...w,
|
|
5876
|
-
importKey:
|
|
5865
|
+
importKey: P
|
|
5877
5866
|
}),
|
|
5878
5867
|
propertyKey: b,
|
|
5879
5868
|
propertyConfigs: a
|
|
@@ -5937,12 +5926,12 @@ function or({
|
|
|
5937
5926
|
renderValue: (u) => l ? /* @__PURE__ */ e(Xe, { propertyConfig: l }) : null,
|
|
5938
5927
|
onValueChange: (u) => {
|
|
5939
5928
|
const d = na(t, u, r);
|
|
5940
|
-
i &&
|
|
5929
|
+
i && a({
|
|
5941
5930
|
id: i,
|
|
5942
5931
|
property: d,
|
|
5943
5932
|
previousId: i,
|
|
5944
5933
|
namespace: void 0
|
|
5945
|
-
})
|
|
5934
|
+
});
|
|
5946
5935
|
},
|
|
5947
5936
|
children: Object.entries(la).map(([u, d]) => /* @__PURE__ */ e(
|
|
5948
5937
|
sa,
|
|
@@ -5962,7 +5951,7 @@ function or({
|
|
|
5962
5951
|
function nr({ importConfig: t, properties: a, propertiesOrder: i }) {
|
|
5963
5952
|
pe(() => {
|
|
5964
5953
|
const s = ui(t.originProperties, a), o = t.importData.map((l) => hi(l, t.idColumn, t.headersMapping, a, s, "TEMP_PATH"));
|
|
5965
|
-
t.setEntities(o)
|
|
5954
|
+
t.setEntities(o);
|
|
5966
5955
|
}, []);
|
|
5967
5956
|
const r = Ma();
|
|
5968
5957
|
return /* @__PURE__ */ e(
|
|
@@ -6019,7 +6008,7 @@ function pa(t, a = "") {
|
|
|
6019
6008
|
};
|
|
6020
6009
|
}
|
|
6021
6010
|
function ma(t) {
|
|
6022
|
-
const a = t.open, [i, r] = _e.useState(!1), [s, o] = _e.useState(!1), l =
|
|
6011
|
+
const a = t.open, [i, r] = _e.useState(!1), [s, o] = _e.useState(!1), l = Q(() => {
|
|
6023
6012
|
i ? o(!0) : t.handleClose(void 0);
|
|
6024
6013
|
}, [i, t.handleClose]);
|
|
6025
6014
|
return pe(() => {
|
|
@@ -6069,40 +6058,40 @@ function sr({
|
|
|
6069
6058
|
handleCancel: d,
|
|
6070
6059
|
setFormDirty: c,
|
|
6071
6060
|
pathSuggestions: y,
|
|
6072
|
-
getUser:
|
|
6061
|
+
getUser: f,
|
|
6073
6062
|
parentCollection: b,
|
|
6074
|
-
getData:
|
|
6063
|
+
getData: P
|
|
6075
6064
|
}) {
|
|
6076
6065
|
const { propertyConfigs: w } = Ke(), k = Be(), {
|
|
6077
|
-
topLevelNavigation:
|
|
6066
|
+
topLevelNavigation: g,
|
|
6078
6067
|
collections: v
|
|
6079
|
-
} = k, _ = !a?.path && (s ?? []).length === 0, h = (b ? b.subcollections : v) ?? [], A = h.map((
|
|
6080
|
-
if (!
|
|
6068
|
+
} = k, _ = !a?.path && (s ?? []).length === 0, h = (b ? b.subcollections : v) ?? [], A = h.map((T) => T.path.trim().toLowerCase()), E = h.map((T) => T.id?.trim().toLowerCase()).filter(Boolean), z = gi();
|
|
6069
|
+
if (!g)
|
|
6081
6070
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
6082
6071
|
const {
|
|
6083
6072
|
groups: q
|
|
6084
|
-
} =
|
|
6073
|
+
} = g, B = De(), S = Ye(), O = He({}), j = t ? _ ? "welcome" : "details" : "properties", [x, I] = L(j), [ge, ye] = _e.useState(), [Z, $] = _e.useState(), [J, te] = _e.useState(!1), [me, ue] = _e.useState();
|
|
6085
6074
|
pe(() => {
|
|
6086
6075
|
try {
|
|
6087
|
-
k.initialised && (
|
|
6088
|
-
} catch (
|
|
6089
|
-
console.error(
|
|
6076
|
+
k.initialised && ($(r ? k.getCollectionFromPaths([...s ?? [], r]) : void 0), te(!0));
|
|
6077
|
+
} catch (T) {
|
|
6078
|
+
console.error(T), ue(me);
|
|
6090
6079
|
}
|
|
6091
6080
|
}, [k.getCollectionFromPaths, r, me, k.initialised]);
|
|
6092
|
-
const
|
|
6093
|
-
const F =
|
|
6081
|
+
const fe = (T) => {
|
|
6082
|
+
const F = T.id || T.path;
|
|
6094
6083
|
return i.saveCollection({
|
|
6095
6084
|
id: F,
|
|
6096
|
-
collectionData:
|
|
6085
|
+
collectionData: T,
|
|
6097
6086
|
previousPath: r,
|
|
6098
6087
|
parentCollectionIds: s
|
|
6099
|
-
}).then(() => (
|
|
6088
|
+
}).then(() => (ye(void 0), !0)).catch((M) => (ye(M), console.error(M), B.open({
|
|
6100
6089
|
type: "error",
|
|
6101
|
-
message: "Error persisting collection: " + (
|
|
6090
|
+
message: "Error persisting collection: " + (M.message ?? "Details in the console")
|
|
6102
6091
|
}), !1));
|
|
6103
|
-
}, ve =
|
|
6104
|
-
...
|
|
6105
|
-
id:
|
|
6092
|
+
}, ve = Z ? {
|
|
6093
|
+
...Z,
|
|
6094
|
+
id: Z.id ?? Z.path ?? jt(16)
|
|
6106
6095
|
} : void 0, Ce = ve ? lr(ve, w) : {
|
|
6107
6096
|
id: a?.path ?? jt(16),
|
|
6108
6097
|
path: a?.path ?? "",
|
|
@@ -6112,43 +6101,43 @@ function sr({
|
|
|
6112
6101
|
propertiesOrder: [],
|
|
6113
6102
|
icon: xt[Math.floor(Math.random() * xt.length)],
|
|
6114
6103
|
ownerId: S.user?.uid ?? ""
|
|
6115
|
-
}, ae =
|
|
6104
|
+
}, ae = Q(() => {
|
|
6116
6105
|
x === "details" ? z.inUse ? I("import_data_saving") : I(u ? "extra_view" : "properties") : I(x === "welcome" ? "details" : x === "import_data_mapping" ? "import_data_preview" : x === "import_data_preview" ? "details" : x === "extra_view" ? "properties" : "details");
|
|
6117
|
-
}, [x, z.inUse, u]), Ve =
|
|
6106
|
+
}, [x, z.inUse, u]), Ve = Q((T) => {
|
|
6118
6107
|
if (l)
|
|
6119
|
-
return l?.(
|
|
6120
|
-
}, [l, s]), tt =
|
|
6108
|
+
return l?.(T.path, T.collectionGroup ?? !1, s ?? []);
|
|
6109
|
+
}, [l, s]), tt = Q(async (T) => {
|
|
6121
6110
|
try {
|
|
6122
6111
|
if (!Ve)
|
|
6123
|
-
return
|
|
6112
|
+
return $(T), Promise.resolve(T);
|
|
6124
6113
|
I("loading");
|
|
6125
|
-
const F = await Ve?.(
|
|
6114
|
+
const F = await Ve?.(T);
|
|
6126
6115
|
if (!F)
|
|
6127
|
-
return
|
|
6128
|
-
const
|
|
6129
|
-
...
|
|
6116
|
+
return $(T), Promise.resolve(T);
|
|
6117
|
+
const M = {
|
|
6118
|
+
...T ?? {}
|
|
6130
6119
|
};
|
|
6131
|
-
return Object.keys(F.properties ?? {}).length > 0 && (
|
|
6132
|
-
newCollection:
|
|
6133
|
-
values:
|
|
6134
|
-
}),
|
|
6120
|
+
return Object.keys(F.properties ?? {}).length > 0 && (M.properties = F.properties, M.propertiesOrder = F.propertiesOrder), M.propertiesOrder ? ($(M), console.log("Inferred collection", {
|
|
6121
|
+
newCollection: T ?? {},
|
|
6122
|
+
values: M
|
|
6123
|
+
}), M) : (M.propertiesOrder = Object.keys(M.properties), M);
|
|
6135
6124
|
} catch (F) {
|
|
6136
6125
|
return console.error(F), B.open({
|
|
6137
6126
|
type: "error",
|
|
6138
6127
|
message: "Error inferring collection: " + (F.message ?? "Details in the console")
|
|
6139
|
-
}),
|
|
6128
|
+
}), T;
|
|
6140
6129
|
}
|
|
6141
|
-
}, [s, Ve]), bt = (
|
|
6130
|
+
}, [s, Ve]), bt = (T, F) => {
|
|
6142
6131
|
try {
|
|
6143
|
-
if (console.log("Submitting collection",
|
|
6144
|
-
|
|
6145
|
-
F.resetForm({ values: Ce }), p(
|
|
6132
|
+
if (console.log("Submitting collection", T), !t) {
|
|
6133
|
+
fe(T).then(() => {
|
|
6134
|
+
F.resetForm({ values: Ce }), p(T);
|
|
6146
6135
|
});
|
|
6147
6136
|
return;
|
|
6148
6137
|
}
|
|
6149
|
-
x === "welcome" ? (ae(), F.resetForm({ values:
|
|
6138
|
+
x === "welcome" ? (ae(), F.resetForm({ values: T })) : x === "details" ? u || z.inUse ? (F.resetForm({ values: T }), ae()) : t ? tt(T).then((M) => {
|
|
6150
6139
|
F.resetForm({
|
|
6151
|
-
values:
|
|
6140
|
+
values: M ?? T,
|
|
6152
6141
|
touched: {
|
|
6153
6142
|
path: !0,
|
|
6154
6143
|
name: !0
|
|
@@ -6156,65 +6145,62 @@ function sr({
|
|
|
6156
6145
|
});
|
|
6157
6146
|
}).finally(() => {
|
|
6158
6147
|
ae();
|
|
6159
|
-
}) : (F.resetForm({ values:
|
|
6160
|
-
F.resetForm({ values: Ce }), ae(), p(
|
|
6161
|
-
}) : (ae(), F.resetForm({ values:
|
|
6162
|
-
} catch (
|
|
6148
|
+
}) : (F.resetForm({ values: T }), ae()) : x === "extra_view" ? (ae(), F.resetForm({ values: T })) : x === "import_data_mapping" || x === "import_data_preview" ? ae() : x === "properties" ? fe(T).then(() => {
|
|
6149
|
+
F.resetForm({ values: Ce }), ae(), p(T);
|
|
6150
|
+
}) : (ae(), F.resetForm({ values: T }));
|
|
6151
|
+
} catch (M) {
|
|
6163
6152
|
B.open({
|
|
6164
6153
|
type: "error",
|
|
6165
|
-
message: "Error persisting collection: " + (
|
|
6166
|
-
}), console.error(
|
|
6154
|
+
message: "Error persisting collection: " + (M.message ?? "Details in the console")
|
|
6155
|
+
}), console.error(M), F.resetForm({ values: T });
|
|
6167
6156
|
}
|
|
6168
6157
|
};
|
|
6169
|
-
return !t && (!k.initialised || !
|
|
6158
|
+
return !t && (!k.initialised || !J) ? /* @__PURE__ */ e(Et, {}) : /* @__PURE__ */ e($e, { fullHeight: !0, children: /* @__PURE__ */ e(
|
|
6170
6159
|
St,
|
|
6171
6160
|
{
|
|
6172
6161
|
initialValues: Ce,
|
|
6173
6162
|
validationSchema: (x === "properties" || x === "subcollections" || x === "details") && yi,
|
|
6174
|
-
validate: (
|
|
6163
|
+
validate: (T) => {
|
|
6175
6164
|
if (x === "properties")
|
|
6176
|
-
return
|
|
6165
|
+
return O.current;
|
|
6177
6166
|
const F = {};
|
|
6178
6167
|
if (x === "details") {
|
|
6179
|
-
const
|
|
6180
|
-
|
|
6181
|
-
const Oe = dr(
|
|
6168
|
+
const M = cr(T.path, t, A, T.id);
|
|
6169
|
+
M && (F.path = M);
|
|
6170
|
+
const Oe = dr(T.id, t, A, E);
|
|
6182
6171
|
Oe && (F.id = Oe);
|
|
6183
6172
|
}
|
|
6184
6173
|
return F;
|
|
6185
6174
|
},
|
|
6186
6175
|
onSubmit: bt,
|
|
6187
|
-
children: (
|
|
6176
|
+
children: (T) => {
|
|
6188
6177
|
const {
|
|
6189
6178
|
values: F,
|
|
6190
|
-
setFieldValue:
|
|
6179
|
+
setFieldValue: M,
|
|
6191
6180
|
isSubmitting: Oe,
|
|
6192
6181
|
dirty: at,
|
|
6193
|
-
submitCount:
|
|
6194
|
-
} =
|
|
6182
|
+
submitCount: V
|
|
6183
|
+
} = T, D = F.path ?? r, H = o?.includes("/") ? o?.split("/").slice(0, -1).join("/") + "/" + D : D, se = k.resolveAliasesFrom(H), le = se && P ? () => P(se) : void 0;
|
|
6195
6184
|
pe(() => {
|
|
6196
6185
|
c(at);
|
|
6197
6186
|
}, [at]);
|
|
6198
|
-
function we(
|
|
6199
|
-
z.setInUse(!0), ii(
|
|
6187
|
+
function we(X) {
|
|
6188
|
+
z.setInUse(!0), ii(X, ia).then((Ie) => {
|
|
6200
6189
|
const Fe = pa(Ie);
|
|
6201
|
-
|
|
6190
|
+
M("properties", Fe.properties), M("propertiesOrder", Object.keys(Fe.properties)), z.setIdColumn(Fe.idColumn), z.setImportData(X), z.setHeadersMapping(Fe.headersMapping), z.setOriginProperties(Fe.properties);
|
|
6202
6191
|
});
|
|
6203
6192
|
}
|
|
6204
6193
|
const yt = !!F.name && !!F.id, it = () => {
|
|
6205
|
-
const
|
|
6206
|
-
z.idColumn && delete
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
});
|
|
6210
|
-
}, vt = X?.editable || t;
|
|
6211
|
-
return /* @__PURE__ */ n($, { children: [
|
|
6194
|
+
const X = { ...F.properties };
|
|
6195
|
+
z.idColumn && delete X[z.idColumn], M("properties", X), ae();
|
|
6196
|
+
}, vt = Z?.editable || t;
|
|
6197
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
6212
6198
|
!t && /* @__PURE__ */ n(
|
|
6213
6199
|
$a,
|
|
6214
6200
|
{
|
|
6215
6201
|
value: x,
|
|
6216
6202
|
className: xe(Nt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
6217
|
-
onValueChange: (
|
|
6203
|
+
onValueChange: (X) => I(X),
|
|
6218
6204
|
children: [
|
|
6219
6205
|
/* @__PURE__ */ e(_t, { value: "details", children: "Details" }),
|
|
6220
6206
|
/* @__PURE__ */ e(_t, { value: "properties", children: "Properties" }),
|
|
@@ -6237,8 +6223,8 @@ function sr({
|
|
|
6237
6223
|
ir,
|
|
6238
6224
|
{
|
|
6239
6225
|
path: D,
|
|
6240
|
-
onContinue: (
|
|
6241
|
-
|
|
6226
|
+
onContinue: (X) => {
|
|
6227
|
+
X ? (we(X), I("import_data_mapping")) : I("details");
|
|
6242
6228
|
},
|
|
6243
6229
|
collections: v,
|
|
6244
6230
|
parentCollection: b,
|
|
@@ -6266,8 +6252,8 @@ function sr({
|
|
|
6266
6252
|
{
|
|
6267
6253
|
importConfig: z,
|
|
6268
6254
|
collection: F,
|
|
6269
|
-
onImportSuccess: (
|
|
6270
|
-
p(
|
|
6255
|
+
onImportSuccess: (X) => {
|
|
6256
|
+
p(X), B.open({
|
|
6271
6257
|
type: "info",
|
|
6272
6258
|
message: "Data imported successfully"
|
|
6273
6259
|
});
|
|
@@ -6284,30 +6270,30 @@ function sr({
|
|
|
6284
6270
|
isNewCollection: t
|
|
6285
6271
|
}
|
|
6286
6272
|
),
|
|
6287
|
-
x === "subcollections" &&
|
|
6273
|
+
x === "subcollections" && Z && /* @__PURE__ */ e(
|
|
6288
6274
|
ar,
|
|
6289
6275
|
{
|
|
6290
6276
|
parentCollection: b,
|
|
6291
6277
|
configController: i,
|
|
6292
|
-
getUser:
|
|
6278
|
+
getUser: f,
|
|
6293
6279
|
collectionInference: l,
|
|
6294
6280
|
parentCollectionIds: s,
|
|
6295
|
-
collection:
|
|
6281
|
+
collection: Z
|
|
6296
6282
|
}
|
|
6297
6283
|
),
|
|
6298
6284
|
x === "properties" && /* @__PURE__ */ e(
|
|
6299
6285
|
Xi,
|
|
6300
6286
|
{
|
|
6301
|
-
showErrors:
|
|
6287
|
+
showErrors: V > 0,
|
|
6302
6288
|
isNewCollection: t,
|
|
6303
6289
|
reservedGroups: m,
|
|
6304
|
-
onPropertyError: (
|
|
6305
|
-
|
|
6306
|
-
...
|
|
6307
|
-
[
|
|
6290
|
+
onPropertyError: (X, Ie, Fe) => {
|
|
6291
|
+
O.current = La({
|
|
6292
|
+
...O.current,
|
|
6293
|
+
[X]: Fe
|
|
6308
6294
|
}, !0);
|
|
6309
6295
|
},
|
|
6310
|
-
getUser:
|
|
6296
|
+
getUser: f,
|
|
6311
6297
|
getData: le,
|
|
6312
6298
|
doCollectionInference: Ve,
|
|
6313
6299
|
propertyConfigs: w,
|
|
@@ -6329,7 +6315,7 @@ function sr({
|
|
|
6329
6315
|
children: [
|
|
6330
6316
|
ge && /* @__PURE__ */ e(aa, { error: ge }),
|
|
6331
6317
|
t && _ && x === "import_data_mapping" && /* @__PURE__ */ n(
|
|
6332
|
-
|
|
6318
|
+
R,
|
|
6333
6319
|
{
|
|
6334
6320
|
variant: "text",
|
|
6335
6321
|
type: "button",
|
|
@@ -6341,12 +6327,12 @@ function sr({
|
|
|
6341
6327
|
}
|
|
6342
6328
|
),
|
|
6343
6329
|
t && _ && x === "import_data_preview" && /* @__PURE__ */ n(
|
|
6344
|
-
|
|
6330
|
+
R,
|
|
6345
6331
|
{
|
|
6346
6332
|
variant: "text",
|
|
6347
6333
|
type: "button",
|
|
6348
6334
|
onClick: () => {
|
|
6349
|
-
|
|
6335
|
+
fe(F), I("import_data_mapping");
|
|
6350
6336
|
},
|
|
6351
6337
|
children: [
|
|
6352
6338
|
/* @__PURE__ */ e(rt, {}),
|
|
@@ -6355,7 +6341,7 @@ function sr({
|
|
|
6355
6341
|
}
|
|
6356
6342
|
),
|
|
6357
6343
|
t && _ && x === "details" && /* @__PURE__ */ n(
|
|
6358
|
-
|
|
6344
|
+
R,
|
|
6359
6345
|
{
|
|
6360
6346
|
variant: "text",
|
|
6361
6347
|
type: "button",
|
|
@@ -6367,7 +6353,7 @@ function sr({
|
|
|
6367
6353
|
}
|
|
6368
6354
|
),
|
|
6369
6355
|
t && x === "properties" && /* @__PURE__ */ n(
|
|
6370
|
-
|
|
6356
|
+
R,
|
|
6371
6357
|
{
|
|
6372
6358
|
variant: "text",
|
|
6373
6359
|
type: "button",
|
|
@@ -6379,7 +6365,7 @@ function sr({
|
|
|
6379
6365
|
}
|
|
6380
6366
|
),
|
|
6381
6367
|
/* @__PURE__ */ e(
|
|
6382
|
-
|
|
6368
|
+
R,
|
|
6383
6369
|
{
|
|
6384
6370
|
variant: "text",
|
|
6385
6371
|
onClick: () => {
|
|
@@ -6389,7 +6375,7 @@ function sr({
|
|
|
6389
6375
|
}
|
|
6390
6376
|
),
|
|
6391
6377
|
t && x === "import_data_mapping" && /* @__PURE__ */ e(
|
|
6392
|
-
|
|
6378
|
+
R,
|
|
6393
6379
|
{
|
|
6394
6380
|
variant: "filled",
|
|
6395
6381
|
color: "primary",
|
|
@@ -6398,7 +6384,7 @@ function sr({
|
|
|
6398
6384
|
}
|
|
6399
6385
|
),
|
|
6400
6386
|
t && x === "import_data_preview" && /* @__PURE__ */ e(
|
|
6401
|
-
|
|
6387
|
+
R,
|
|
6402
6388
|
{
|
|
6403
6389
|
variant: "filled",
|
|
6404
6390
|
color: "primary",
|
|
@@ -6486,65 +6472,65 @@ const cr = (t, a, i, r) => {
|
|
|
6486
6472
|
getData: u,
|
|
6487
6473
|
onAnalyticsEvent: d
|
|
6488
6474
|
}) {
|
|
6489
|
-
const c = Be(), y = bi(),
|
|
6490
|
-
collections:
|
|
6491
|
-
} = c, w =
|
|
6475
|
+
const c = Be(), y = bi(), f = De(), { propertyConfigs: b } = Ke(), {
|
|
6476
|
+
collections: P
|
|
6477
|
+
} = c, w = P.map((O) => O.path.trim().toLowerCase()), [k, g] = K.useState();
|
|
6492
6478
|
pe(() => {
|
|
6493
|
-
p && p().then((
|
|
6494
|
-
|
|
6479
|
+
p && p().then((O) => {
|
|
6480
|
+
g(O.filter((j) => !w.includes(j.trim().toLowerCase())));
|
|
6495
6481
|
});
|
|
6496
6482
|
}, [p]);
|
|
6497
|
-
const [v, _] = K.useState(), [h, A] = K.useState(), E =
|
|
6483
|
+
const [v, _] = K.useState(), [h, A] = K.useState(), E = Q(() => ({
|
|
6498
6484
|
createCollections: !0,
|
|
6499
6485
|
editCollections: !0,
|
|
6500
6486
|
deleteCollections: !0
|
|
6501
|
-
}), []), z =
|
|
6502
|
-
path:
|
|
6487
|
+
}), []), z = Q(({
|
|
6488
|
+
path: O,
|
|
6503
6489
|
fullPath: j,
|
|
6504
6490
|
parentCollectionIds: x,
|
|
6505
6491
|
parentCollection: I
|
|
6506
6492
|
}) => {
|
|
6507
|
-
console.debug("edit collection",
|
|
6508
|
-
editedCollectionPath:
|
|
6493
|
+
console.debug("edit collection", O, j, x, I), d?.("edit_collection", { path: O, fullPath: j }), _({
|
|
6494
|
+
editedCollectionPath: O,
|
|
6509
6495
|
fullPath: j,
|
|
6510
6496
|
parentCollectionIds: x,
|
|
6511
6497
|
isNewCollection: !1,
|
|
6512
6498
|
parentCollection: I,
|
|
6513
6499
|
redirect: !1
|
|
6514
6500
|
});
|
|
6515
|
-
}, []), q =
|
|
6516
|
-
propertyKey:
|
|
6501
|
+
}, []), q = Q(({
|
|
6502
|
+
propertyKey: O,
|
|
6517
6503
|
property: j,
|
|
6518
6504
|
editedCollectionPath: x,
|
|
6519
6505
|
currentPropertiesOrder: I,
|
|
6520
6506
|
parentCollectionIds: ge,
|
|
6521
|
-
collection:
|
|
6507
|
+
collection: ye
|
|
6522
6508
|
}) => {
|
|
6523
|
-
console.debug("edit property",
|
|
6524
|
-
const
|
|
6525
|
-
|
|
6526
|
-
propertyKey:
|
|
6509
|
+
console.debug("edit property", O, j, x, I, ge, ye), d?.("edit_property", { propertyKey: O, editedCollectionPath: x });
|
|
6510
|
+
const Z = O && O.includes(".") ? O.substring(0, O.lastIndexOf(".")) : void 0, $ = O && O.includes(".") ? O.substring(O.lastIndexOf(".") + 1) : O;
|
|
6511
|
+
A({
|
|
6512
|
+
propertyKey: $,
|
|
6527
6513
|
property: j,
|
|
6528
|
-
namespace:
|
|
6514
|
+
namespace: Z,
|
|
6529
6515
|
currentPropertiesOrder: I,
|
|
6530
6516
|
editedCollectionPath: x,
|
|
6531
6517
|
parentCollectionIds: ge,
|
|
6532
|
-
collectionEditable:
|
|
6518
|
+
collectionEditable: ye?.editable ?? !1
|
|
6533
6519
|
});
|
|
6534
6520
|
}, []), B = K.useCallback(({
|
|
6535
|
-
parentCollectionIds:
|
|
6521
|
+
parentCollectionIds: O,
|
|
6536
6522
|
parentCollection: j,
|
|
6537
6523
|
initialValues: x,
|
|
6538
6524
|
redirect: I
|
|
6539
6525
|
}) => {
|
|
6540
|
-
console.debug("create collection",
|
|
6526
|
+
console.debug("create collection", O, j, x, I), d?.("create_collection", { parentCollectionIds: O, parentCollection: j, initialValues: x, redirect: I }), _({
|
|
6541
6527
|
isNewCollection: !0,
|
|
6542
|
-
parentCollectionIds:
|
|
6528
|
+
parentCollectionIds: O,
|
|
6543
6529
|
parentCollection: j,
|
|
6544
6530
|
initialValues: x,
|
|
6545
6531
|
redirect: I
|
|
6546
6532
|
});
|
|
6547
|
-
}, []), S = p ? (
|
|
6533
|
+
}, []), S = p ? (O) => !O && k ? Promise.resolve(k) : p?.(O) : void 0;
|
|
6548
6534
|
return /* @__PURE__ */ e(ha.Provider, { value: i, children: /* @__PURE__ */ n(
|
|
6549
6535
|
ga.Provider,
|
|
6550
6536
|
{
|
|
@@ -6570,9 +6556,9 @@ const cr = (t, a, i, r) => {
|
|
|
6570
6556
|
extraView: l,
|
|
6571
6557
|
pathSuggestions: S,
|
|
6572
6558
|
getUser: m,
|
|
6573
|
-
handleClose: (
|
|
6574
|
-
if (v?.redirect &&
|
|
6575
|
-
const j = c.buildUrlCollectionPath(
|
|
6559
|
+
handleClose: (O) => {
|
|
6560
|
+
if (v?.redirect && O && v?.isNewCollection && !v.parentCollectionIds.length) {
|
|
6561
|
+
const j = c.buildUrlCollectionPath(O.id ?? O.path);
|
|
6576
6562
|
y(j);
|
|
6577
6563
|
}
|
|
6578
6564
|
_(void 0);
|
|
@@ -6590,24 +6576,24 @@ const cr = (t, a, i, r) => {
|
|
|
6590
6576
|
inArray: !1,
|
|
6591
6577
|
collectionEditable: h?.collectionEditable ?? !1,
|
|
6592
6578
|
getData: u && h?.editedCollectionPath ? () => {
|
|
6593
|
-
const
|
|
6594
|
-
return u(
|
|
6579
|
+
const O = c.resolveAliasesFrom(h.editedCollectionPath);
|
|
6580
|
+
return u(O);
|
|
6595
6581
|
} : void 0,
|
|
6596
6582
|
onPropertyChanged: ({
|
|
6597
|
-
id:
|
|
6583
|
+
id: O,
|
|
6598
6584
|
property: j
|
|
6599
6585
|
}) => {
|
|
6600
|
-
if (!h || !
|
|
6586
|
+
if (!h || !O)
|
|
6601
6587
|
return;
|
|
6602
6588
|
const x = !h.propertyKey;
|
|
6603
6589
|
return i.saveProperty({
|
|
6604
6590
|
path: h?.editedCollectionPath,
|
|
6605
6591
|
property: j,
|
|
6606
|
-
propertyKey:
|
|
6607
|
-
newPropertiesOrder: x && h.currentPropertiesOrder ? [...h.currentPropertiesOrder,
|
|
6592
|
+
propertyKey: O,
|
|
6593
|
+
newPropertiesOrder: x && h.currentPropertiesOrder ? [...h.currentPropertiesOrder, O] : void 0,
|
|
6608
6594
|
namespace: h.namespace,
|
|
6609
6595
|
parentCollectionIds: h.parentCollectionIds
|
|
6610
|
-
}).catch((I) => (console.error(I),
|
|
6596
|
+
}).catch((I) => (console.error(I), f.open({
|
|
6611
6597
|
type: "error",
|
|
6612
6598
|
message: "Error persisting property: " + (I.message ?? "Details in the console")
|
|
6613
6599
|
}), !1));
|
|
@@ -6616,16 +6602,16 @@ const cr = (t, a, i, r) => {
|
|
|
6616
6602
|
onDelete: () => {
|
|
6617
6603
|
if (!h?.propertyKey)
|
|
6618
6604
|
return;
|
|
6619
|
-
const
|
|
6605
|
+
const O = h?.currentPropertiesOrder?.filter((j) => j !== h?.propertyKey);
|
|
6620
6606
|
return i.deleteProperty({
|
|
6621
6607
|
path: h?.editedCollectionPath,
|
|
6622
6608
|
propertyKey: h?.propertyKey,
|
|
6623
6609
|
namespace: h?.namespace,
|
|
6624
|
-
newPropertiesOrder:
|
|
6610
|
+
newPropertiesOrder: O,
|
|
6625
6611
|
parentCollectionIds: h?.parentCollectionIds
|
|
6626
6612
|
}).then(() => {
|
|
6627
6613
|
A(void 0);
|
|
6628
|
-
}).catch((j) => (console.error(j),
|
|
6614
|
+
}).catch((j) => (console.error(j), f.open({
|
|
6629
6615
|
type: "error",
|
|
6630
6616
|
message: "Error deleting property: " + (j.message ?? "Details in the console")
|
|
6631
6617
|
}), !1));
|
|
@@ -6669,7 +6655,7 @@ function mr({
|
|
|
6669
6655
|
{
|
|
6670
6656
|
title: r.sortBy || r.filterValues ? "Save default filter and sort" : "Clear default filter and sort",
|
|
6671
6657
|
children: /* @__PURE__ */ e(
|
|
6672
|
-
|
|
6658
|
+
R,
|
|
6673
6659
|
{
|
|
6674
6660
|
color: "primary",
|
|
6675
6661
|
size: "small",
|
|
@@ -6694,7 +6680,7 @@ function mr({
|
|
|
6694
6680
|
}
|
|
6695
6681
|
)
|
|
6696
6682
|
}
|
|
6697
|
-
)), /* @__PURE__ */ n(
|
|
6683
|
+
)), /* @__PURE__ */ n(U, { children: [
|
|
6698
6684
|
d && c,
|
|
6699
6685
|
/* @__PURE__ */ e(
|
|
6700
6686
|
re,
|
|
@@ -6706,7 +6692,7 @@ function mr({
|
|
|
6706
6692
|
color: "primary",
|
|
6707
6693
|
disabled: !d,
|
|
6708
6694
|
onClick: d ? () => l?.editCollection({ path: i.path, fullPath: t, parentCollectionIds: a, parentCollection: u }) : void 0,
|
|
6709
|
-
children: /* @__PURE__ */ e(
|
|
6695
|
+
children: /* @__PURE__ */ e(Je, {})
|
|
6710
6696
|
}
|
|
6711
6697
|
)
|
|
6712
6698
|
}
|
|
@@ -6723,9 +6709,9 @@ function ur({
|
|
|
6723
6709
|
const i = De(), r = Ye(), s = fa(), o = Re(), l = o.configPermissions({
|
|
6724
6710
|
user: r.user,
|
|
6725
6711
|
collection: a
|
|
6726
|
-
}), p =
|
|
6712
|
+
}), p = Q(() => {
|
|
6727
6713
|
o?.editCollection({ path: t, parentCollectionIds: [] });
|
|
6728
|
-
}, [o, t]), [m, u] = L(!1), d =
|
|
6714
|
+
}, [o, t]), [m, u] = L(!1), d = Q(() => {
|
|
6729
6715
|
s?.deleteCollection({ path: t }).then(() => {
|
|
6730
6716
|
u(!1), i.open({
|
|
6731
6717
|
message: "Collection deleted",
|
|
@@ -6733,13 +6719,13 @@ function ur({
|
|
|
6733
6719
|
});
|
|
6734
6720
|
});
|
|
6735
6721
|
}, [t, s]);
|
|
6736
|
-
return /* @__PURE__ */ n(
|
|
6722
|
+
return /* @__PURE__ */ n(U, { children: [
|
|
6737
6723
|
/* @__PURE__ */ n("div", { children: [
|
|
6738
6724
|
l.deleteCollections && /* @__PURE__ */ e(
|
|
6739
6725
|
Ga,
|
|
6740
6726
|
{
|
|
6741
6727
|
trigger: /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(Ha, { size: "small" }) }),
|
|
6742
|
-
children: /* @__PURE__ */ n(
|
|
6728
|
+
children: /* @__PURE__ */ n(Wa, { onClick: (c) => {
|
|
6743
6729
|
c.preventDefault(), c.stopPropagation(), u(!0);
|
|
6744
6730
|
}, children: [
|
|
6745
6731
|
/* @__PURE__ */ e(pt, {}),
|
|
@@ -6753,7 +6739,7 @@ function ur({
|
|
|
6753
6739
|
onClick: (c) => {
|
|
6754
6740
|
p();
|
|
6755
6741
|
},
|
|
6756
|
-
children: /* @__PURE__ */ e(
|
|
6742
|
+
children: /* @__PURE__ */ e(Je, { size: "small" })
|
|
6757
6743
|
}
|
|
6758
6744
|
)
|
|
6759
6745
|
] }),
|
|
@@ -6763,8 +6749,8 @@ function ur({
|
|
|
6763
6749
|
open: m,
|
|
6764
6750
|
onAccept: d,
|
|
6765
6751
|
onCancel: () => u(!1),
|
|
6766
|
-
title: /* @__PURE__ */ e(
|
|
6767
|
-
body: /* @__PURE__ */ n(
|
|
6752
|
+
title: /* @__PURE__ */ e(U, { children: "Delete this collection?" }),
|
|
6753
|
+
body: /* @__PURE__ */ n(U, { children: [
|
|
6768
6754
|
" This will ",
|
|
6769
6755
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
6770
6756
|
", only the collection in the CMS"
|
|
@@ -6818,7 +6804,7 @@ function gr() {
|
|
|
6818
6804
|
user: t.user
|
|
6819
6805
|
}).createCollections : !0, s = i.rootPathSuggestions ?? [], o = s.length > 3 || a.collections.length === 0 && s.length > 0;
|
|
6820
6806
|
return /* @__PURE__ */ e(
|
|
6821
|
-
|
|
6807
|
+
Ja,
|
|
6822
6808
|
{
|
|
6823
6809
|
in: o,
|
|
6824
6810
|
children: /* @__PURE__ */ n(
|
|
@@ -6876,7 +6862,7 @@ function fr({
|
|
|
6876
6862
|
});
|
|
6877
6863
|
},
|
|
6878
6864
|
size: "small",
|
|
6879
|
-
children: /* @__PURE__ */ e(
|
|
6865
|
+
children: /* @__PURE__ */ e(Je, { size: "small" })
|
|
6880
6866
|
}
|
|
6881
6867
|
) });
|
|
6882
6868
|
}
|
|
@@ -6897,7 +6883,7 @@ function br({
|
|
|
6897
6883
|
s.editProperty({
|
|
6898
6884
|
editedCollectionPath: t,
|
|
6899
6885
|
parentCollectionIds: a,
|
|
6900
|
-
currentPropertiesOrder:
|
|
6886
|
+
currentPropertiesOrder: Qa(i),
|
|
6901
6887
|
collection: i
|
|
6902
6888
|
});
|
|
6903
6889
|
},
|
|
@@ -6917,12 +6903,12 @@ function Ar({
|
|
|
6917
6903
|
getData: m,
|
|
6918
6904
|
onAnalyticsEvent: u
|
|
6919
6905
|
}) {
|
|
6920
|
-
const d =
|
|
6906
|
+
const d = Q(
|
|
6921
6907
|
(c) => {
|
|
6922
6908
|
const y = (b) => {
|
|
6923
6909
|
et(b.properties), b.subcollections?.forEach(y);
|
|
6924
|
-
},
|
|
6925
|
-
return
|
|
6910
|
+
}, f = t.collections ?? [];
|
|
6911
|
+
return f.forEach(y), Za(c, f, [], a);
|
|
6926
6912
|
},
|
|
6927
6913
|
[t.collections, a]
|
|
6928
6914
|
);
|
|
@@ -6963,7 +6949,7 @@ function zr({ path: t }) {
|
|
|
6963
6949
|
return /* @__PURE__ */ n("div", { className: "p-1 flex flex-col items-center", children: [
|
|
6964
6950
|
/* @__PURE__ */ e(aa, { error: "No collection for path: " + i }),
|
|
6965
6951
|
/* @__PURE__ */ e(
|
|
6966
|
-
|
|
6952
|
+
R,
|
|
6967
6953
|
{
|
|
6968
6954
|
className: "mx-2",
|
|
6969
6955
|
variant: "outlined",
|
|
@@ -6986,7 +6972,7 @@ function yr(t) {
|
|
|
6986
6972
|
}
|
|
6987
6973
|
export {
|
|
6988
6974
|
zr as MissingReferenceWidget,
|
|
6989
|
-
|
|
6975
|
+
We as editableProperty,
|
|
6990
6976
|
ce as getFullId,
|
|
6991
6977
|
ke as idToPropertiesPath,
|
|
6992
6978
|
Pe as namespaceToPropertiesOrderPath,
|