@firecms/collection_editor 3.0.0-beta.2-pre.5 → 3.0.0-beta.2
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 +783 -772
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/ui/RootCollectionSuggestions.tsx +1 -1
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +10 -12
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +0 -1
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +69 -66
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +10 -7
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +18 -16
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as U } from "react/jsx-runtime";
|
|
2
2
|
import { SearchIconsView as gr, toSnakeCase as Pt, singular as vr, IconForView as ot, ArrayContainer as yr, serializeRegExp as br, useSnackbarController as Ie, resolveEnumValues as Cr, isPropertyBuilder as ne, useCustomizationController as Ae, getFieldConfig as $e, ErrorBoundary as ge, PropertyConfigBadge as Ye, unslugify as ut, useNavigationController as Pe, mergeDeep as W, DEFAULT_FIELD_CONFIGS as Gt, isValidRegExp as Pr, getFieldId as Kt, DeleteConfirmationDialog as lt, useLargeLayout as Nr, makePropertiesEditable as pt, resolveEntityView as xr, useSelectionController as wr, EntityCollectionTable as Tr, slugify as kr, useAuthController as _e, randomString as _t, CircularProgressCenter as Nt, removeUndefined as Ft, ErrorView as Wt, removeInitialAndTrailingSlashes as Or, getDefaultPropertiesOrder as Vr } from "@firecms/core";
|
|
3
3
|
import * as je from "react";
|
|
4
|
-
import Y, { useState as $, useEffect as ce, useMemo as Zt, useCallback as
|
|
4
|
+
import Y, { useState as $, useEffect as ce, useMemo as Zt, useCallback as Q, useRef as Le, useDeferredValue as Ir, useContext as Jt } from "react";
|
|
5
5
|
import ve from "react-fast-compare";
|
|
6
|
-
import { Typography as
|
|
6
|
+
import { Typography as O, useAutoComplete as _r, Container as mt, Tooltip as te, IconButton as oe, Chip as st, TextField as Oe, cn as me, DebouncedTextField as Z, Autocomplete as Fr, AutocompleteItem as Sr, ExpandablePanel as xt, SettingsIcon as He, Select as be, SelectItem as ee, BooleanSwitchWithLabel as ct, Dialog as Fe, AutoAwesomeIcon as ht, Badge as Er, ListIcon as Ar, Button as z, CircularProgress as De, Paper as Ce, DialogContent as Be, DialogActions as ze, RuleIcon as Dr, FileUploadIcon as Br, MultiSelect as zr, MultiSelectItem as St, Checkbox as Et, cardMixin as Qt, cardClickableMixin as Xt, cardSelectedMixin as er, FunctionsIcon as Mr, RemoveCircleIcon as Rr, defaultBorderMixin as wt, RemoveIcon as Ur, DragHandleIcon as jr, AddIcon as ue, SelectGroup as At, InfoLabel as Lr, DeleteIcon as dt, ContentCopyIcon as qr, CodeIcon as $r, Table as Dt, TableBody as Bt, TableRow as bt, TableCell as Ue, Alert as Yr, Icon as et, Card as tr, coolIconKeys as zt, Tabs as Hr, Tab as Ct, ArrowBackIcon as tt, LoadingButton as Mt, DoneIcon as Gr, UndoIcon as Kr, SaveIcon as Wr, Menu as Zr, MoreVertIcon as Jr, MenuItem as Qr, Collapse as Xr } from "@firecms/ui";
|
|
7
7
|
import * as rt from "yup";
|
|
8
8
|
import { useFormex as K, Field as H, getIn as I, useCreateFormex as Tt, Formex as kt } from "@firecms/formex";
|
|
9
9
|
import { extractEnumFromValues as ei, buildPropertyFromData as ti, buildEntityPropertiesFromData as ri } from "@firecms/schema_inference";
|
|
@@ -21,7 +21,7 @@ function X({
|
|
|
21
21
|
error: t,
|
|
22
22
|
children: r
|
|
23
23
|
}) {
|
|
24
|
-
return r ? /* @__PURE__ */ e(
|
|
24
|
+
return r ? /* @__PURE__ */ e(O, { variant: "caption", color: t ? "error" : "secondary", className: "ml-3.5 mt-0.5", children: r }) : null;
|
|
25
25
|
}
|
|
26
26
|
function yi({
|
|
27
27
|
isNewCollection: t,
|
|
@@ -32,29 +32,30 @@ function yi({
|
|
|
32
32
|
parentCollection: o
|
|
33
33
|
}) {
|
|
34
34
|
const d = Y.useRef(null), {
|
|
35
|
-
values:
|
|
36
|
-
setFieldValue:
|
|
35
|
+
values: u,
|
|
36
|
+
setFieldValue: p,
|
|
37
37
|
handleChange: h,
|
|
38
38
|
touched: m,
|
|
39
39
|
errors: c,
|
|
40
40
|
setFieldTouched: g,
|
|
41
41
|
isSubmitting: v,
|
|
42
42
|
submitCount: x
|
|
43
|
-
} = K(), [y,
|
|
44
|
-
|
|
43
|
+
} = K(), [y, P] = $(!1), [T, b] = $(!1), C = (s) => {
|
|
44
|
+
p("name", s), !I(m, "path") && t && s && p("path", Pt(s)), !I(m, "id") && t && s && p("id", Pt(s)), !I(m, "singularName") && t && s && p("singularName", vr(s));
|
|
45
45
|
};
|
|
46
46
|
ce(() => {
|
|
47
47
|
c.id && b(!0);
|
|
48
48
|
}, [c.id]);
|
|
49
|
-
const
|
|
50
|
-
inputFocused:
|
|
49
|
+
const N = /* @__PURE__ */ e(ot, { collectionOrView: u }), f = l?.filter((s) => !r?.includes(s)), {
|
|
50
|
+
inputFocused: w,
|
|
51
51
|
autoCompleteOpen: _,
|
|
52
|
-
setAutoCompleteOpen:
|
|
52
|
+
setAutoCompleteOpen: M
|
|
53
53
|
} = _r({
|
|
54
54
|
ref: d
|
|
55
|
-
}),
|
|
56
|
-
let
|
|
57
|
-
|
|
55
|
+
}), R = !!o;
|
|
56
|
+
let D;
|
|
57
|
+
typeof u.customId == "object" ? D = "code_defined" : u.customId === !0 ? D = "true" : u.customId === !1 ? D = "false" : u.customId === "optional" && (D = "optional");
|
|
58
|
+
const A = x > 0;
|
|
58
59
|
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ a(mt, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
59
60
|
/* @__PURE__ */ a("div", { children: [
|
|
60
61
|
/* @__PURE__ */ a(
|
|
@@ -62,19 +63,19 @@ function yi({
|
|
|
62
63
|
{
|
|
63
64
|
className: "flex flex-row py-2 pt-3 items-center",
|
|
64
65
|
children: [
|
|
65
|
-
/* @__PURE__ */ e(
|
|
66
|
+
/* @__PURE__ */ e(O, { variant: t ? "h4" : "h5", className: "flex-grow", children: t ? "New collection" : `${u?.name} collection` }),
|
|
66
67
|
/* @__PURE__ */ e(te, { title: "Change icon", children: /* @__PURE__ */ e(
|
|
67
68
|
oe,
|
|
68
69
|
{
|
|
69
70
|
shape: "square",
|
|
70
|
-
onClick: () =>
|
|
71
|
-
children:
|
|
71
|
+
onClick: () => P(!0),
|
|
72
|
+
children: N
|
|
72
73
|
}
|
|
73
74
|
) })
|
|
74
75
|
]
|
|
75
76
|
}
|
|
76
77
|
),
|
|
77
|
-
o && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(
|
|
78
|
+
o && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
78
79
|
"This is a subcollection of ",
|
|
79
80
|
/* @__PURE__ */ e("b", { children: o.name })
|
|
80
81
|
] }) })
|
|
@@ -84,38 +85,38 @@ function yi({
|
|
|
84
85
|
/* @__PURE__ */ e(
|
|
85
86
|
Oe,
|
|
86
87
|
{
|
|
87
|
-
value:
|
|
88
|
-
onChange: (s) =>
|
|
88
|
+
value: u.name ?? "",
|
|
89
|
+
onChange: (s) => C(s.target.value),
|
|
89
90
|
label: "Name",
|
|
90
91
|
required: !0,
|
|
91
|
-
error:
|
|
92
|
+
error: A && !!c.name
|
|
92
93
|
}
|
|
93
94
|
),
|
|
94
95
|
/* @__PURE__ */ e(X, { error: m.name && !!c.name, children: m.name && c.name ? c.name : "Name of in this collection, usually a plural name (e.g. Products)" })
|
|
95
96
|
] }),
|
|
96
|
-
/* @__PURE__ */ a("div", { className: me("col-span-12 ",
|
|
97
|
+
/* @__PURE__ */ a("div", { className: me("col-span-12 ", R ? "" : "sm:col-span-8"), children: [
|
|
97
98
|
/* @__PURE__ */ e(
|
|
98
99
|
H,
|
|
99
100
|
{
|
|
100
101
|
name: "path",
|
|
101
|
-
as:
|
|
102
|
+
as: Z,
|
|
102
103
|
label: "Path",
|
|
103
104
|
disabled: !t,
|
|
104
105
|
required: !0,
|
|
105
|
-
error:
|
|
106
|
+
error: A && !!c.path
|
|
106
107
|
}
|
|
107
108
|
),
|
|
108
|
-
/* @__PURE__ */ e(X, { error: m.path && !!c.path, children: m.path && c.path ? c.path :
|
|
109
|
+
/* @__PURE__ */ e(X, { error: m.path && !!c.path, children: m.path && c.path ? c.path : R ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database" })
|
|
109
110
|
] }),
|
|
110
|
-
!
|
|
111
|
+
!R && /* @__PURE__ */ a("div", { className: "col-span-12 sm:col-span-4 relative", children: [
|
|
111
112
|
/* @__PURE__ */ e(
|
|
112
113
|
Oe,
|
|
113
114
|
{
|
|
114
|
-
error:
|
|
115
|
+
error: A && !!c.group,
|
|
115
116
|
disabled: v,
|
|
116
|
-
value:
|
|
117
|
+
value: u.group ?? "",
|
|
117
118
|
autoComplete: "off",
|
|
118
|
-
onChange: (s) =>
|
|
119
|
+
onChange: (s) => p("group", s.target.value),
|
|
119
120
|
name: "group",
|
|
120
121
|
inputRef: d,
|
|
121
122
|
label: "Group"
|
|
@@ -125,12 +126,12 @@ function yi({
|
|
|
125
126
|
Fr,
|
|
126
127
|
{
|
|
127
128
|
open: _ && (f ?? []).length > 0,
|
|
128
|
-
setOpen:
|
|
129
|
+
setOpen: M,
|
|
129
130
|
children: f?.map((s, V) => /* @__PURE__ */ e(
|
|
130
131
|
Sr,
|
|
131
132
|
{
|
|
132
133
|
onClick: () => {
|
|
133
|
-
|
|
134
|
+
M(!1), p("group", s ?? null);
|
|
134
135
|
},
|
|
135
136
|
children: /* @__PURE__ */ e("div", { className: "flex-grow", children: s })
|
|
136
137
|
},
|
|
@@ -138,17 +139,17 @@ function yi({
|
|
|
138
139
|
))
|
|
139
140
|
}
|
|
140
141
|
),
|
|
141
|
-
/* @__PURE__ */ e(X, { children:
|
|
142
|
+
/* @__PURE__ */ e(X, { children: A && c.group ? c.group : "Group of the collection" })
|
|
142
143
|
] }),
|
|
143
144
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
144
145
|
xt,
|
|
145
146
|
{
|
|
146
|
-
expanded:
|
|
147
|
+
expanded: T,
|
|
147
148
|
onExpandedChange: b,
|
|
148
149
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
149
150
|
/* @__PURE__ */ e(He, {}),
|
|
150
151
|
/* @__PURE__ */ e(
|
|
151
|
-
|
|
152
|
+
O,
|
|
152
153
|
{
|
|
153
154
|
variant: "subtitle2",
|
|
154
155
|
className: "ml-2",
|
|
@@ -163,10 +164,10 @@ function yi({
|
|
|
163
164
|
H,
|
|
164
165
|
{
|
|
165
166
|
name: "id",
|
|
166
|
-
as:
|
|
167
|
+
as: Z,
|
|
167
168
|
disabled: !t,
|
|
168
169
|
label: "Collection id",
|
|
169
|
-
error:
|
|
170
|
+
error: A && !!c.id
|
|
170
171
|
}
|
|
171
172
|
),
|
|
172
173
|
/* @__PURE__ */ e(X, { error: m.id && !!c.id, children: m.id && c.id ? c.id : "This id identifies this collection" })
|
|
@@ -175,23 +176,23 @@ function yi({
|
|
|
175
176
|
/* @__PURE__ */ e(
|
|
176
177
|
Oe,
|
|
177
178
|
{
|
|
178
|
-
error:
|
|
179
|
-
|
|
179
|
+
error: A && !!c.singularName,
|
|
180
|
+
name: "singularName",
|
|
180
181
|
"aria-describedby": "singularName-helper",
|
|
181
182
|
onChange: (s) => (g("singularName", !0), h(s)),
|
|
182
|
-
value:
|
|
183
|
+
value: u.singularName ?? "",
|
|
183
184
|
label: "Singular name"
|
|
184
185
|
}
|
|
185
186
|
),
|
|
186
|
-
/* @__PURE__ */ e(X, { error:
|
|
187
|
+
/* @__PURE__ */ e(X, { error: A && !!c.singularName, children: A && c.singularName ? c.singularName : "Optionally define a singular name for your entities" })
|
|
187
188
|
] }),
|
|
188
189
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
189
190
|
/* @__PURE__ */ e(
|
|
190
191
|
Oe,
|
|
191
192
|
{
|
|
192
|
-
error:
|
|
193
|
-
|
|
194
|
-
value:
|
|
193
|
+
error: A && !!c.description,
|
|
194
|
+
name: "description",
|
|
195
|
+
value: u.description ?? "",
|
|
195
196
|
onChange: h,
|
|
196
197
|
multiline: !0,
|
|
197
198
|
rows: 2,
|
|
@@ -199,7 +200,7 @@ function yi({
|
|
|
199
200
|
label: "Description"
|
|
200
201
|
}
|
|
201
202
|
),
|
|
202
|
-
/* @__PURE__ */ e(X, { error:
|
|
203
|
+
/* @__PURE__ */ e(X, { error: A && !!c.description, children: A && c.description ? c.description : "Description of the collection, you can use markdown" })
|
|
203
204
|
] }),
|
|
204
205
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
205
206
|
be,
|
|
@@ -208,7 +209,7 @@ function yi({
|
|
|
208
209
|
label: "Default row size",
|
|
209
210
|
position: "item-aligned",
|
|
210
211
|
onChange: h,
|
|
211
|
-
value:
|
|
212
|
+
value: u.defaultSize ?? "",
|
|
212
213
|
renderValue: (s) => s.toUpperCase(),
|
|
213
214
|
children: ["xs", "s", "m", "l", "xl"].map((s) => /* @__PURE__ */ e(
|
|
214
215
|
ee,
|
|
@@ -226,13 +227,13 @@ function yi({
|
|
|
226
227
|
name: "customId",
|
|
227
228
|
label: "Data IDs generation",
|
|
228
229
|
position: "item-aligned",
|
|
229
|
-
disabled:
|
|
230
|
+
disabled: D === "code_defined",
|
|
230
231
|
onValueChange: (s) => {
|
|
231
232
|
if (s === "code_defined")
|
|
232
233
|
throw new Error("This should not happen");
|
|
233
|
-
s === "true" ?
|
|
234
|
+
s === "true" ? p("customId", !0) : s === "false" ? p("customId", !1) : s === "optional" && p("customId", "optional");
|
|
234
235
|
},
|
|
235
|
-
value: "",
|
|
236
|
+
value: D ?? "",
|
|
236
237
|
renderValue: (s) => s === "code_defined" ? "Code defined" : s === "true" ? "Users must define an ID" : s === "optional" ? "Users can define an ID, but it is not required" : "Document ID is generated automatically",
|
|
237
238
|
children: [
|
|
238
239
|
/* @__PURE__ */ e(ee, { value: "false", children: "Document ID is generated automatically" }),
|
|
@@ -247,8 +248,8 @@ function yi({
|
|
|
247
248
|
{
|
|
248
249
|
position: "start",
|
|
249
250
|
label: "Collection group",
|
|
250
|
-
onValueChange: (s) =>
|
|
251
|
-
value:
|
|
251
|
+
onValueChange: (s) => p("collectionGroup", s),
|
|
252
|
+
value: u.collectionGroup ?? !1
|
|
252
253
|
}
|
|
253
254
|
),
|
|
254
255
|
/* @__PURE__ */ e(X, { children: "A collection group consists of all collections with the same path. This allows you to query over multiple collections at once." })
|
|
@@ -259,8 +260,8 @@ function yi({
|
|
|
259
260
|
{
|
|
260
261
|
position: "start",
|
|
261
262
|
label: "Enable text search for this collection",
|
|
262
|
-
onValueChange: (s) =>
|
|
263
|
-
value:
|
|
263
|
+
onValueChange: (s) => p("textSearchEnabled", s),
|
|
264
|
+
value: u.textSearchEnabled ?? !1
|
|
264
265
|
}
|
|
265
266
|
),
|
|
266
267
|
/* @__PURE__ */ e(X, { children: "Allow text search for this collection. If you have not specified a text search delegate, this will use the built-in local text search. This is not recommended for large collections, as it may incur in performance and cost issues." })
|
|
@@ -274,15 +275,15 @@ function yi({
|
|
|
274
275
|
Fe,
|
|
275
276
|
{
|
|
276
277
|
open: y,
|
|
277
|
-
onOpenChange:
|
|
278
|
+
onOpenChange: P,
|
|
278
279
|
maxWidth: "xl",
|
|
279
280
|
fullWidth: !0,
|
|
280
281
|
children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
|
|
281
282
|
gr,
|
|
282
283
|
{
|
|
283
|
-
selectedIcon:
|
|
284
|
+
selectedIcon: u.icon,
|
|
284
285
|
onIconSelected: (s) => {
|
|
285
|
-
|
|
286
|
+
P(!1), p("icon", s);
|
|
286
287
|
}
|
|
287
288
|
}
|
|
288
289
|
) })
|
|
@@ -315,7 +316,7 @@ function Ci({
|
|
|
315
316
|
allowDataInference: o,
|
|
316
317
|
getData: d
|
|
317
318
|
}) {
|
|
318
|
-
const
|
|
319
|
+
const u = Tt({
|
|
319
320
|
initialValues: { enumValues: t },
|
|
320
321
|
validateOnChange: !0,
|
|
321
322
|
validation: (m) => {
|
|
@@ -326,14 +327,14 @@ function Ci({
|
|
|
326
327
|
const g = !!(c?.enumValues && Object.keys(c?.enumValues).length > 0);
|
|
327
328
|
return n?.(g), c;
|
|
328
329
|
}
|
|
329
|
-
}), { values:
|
|
330
|
+
}), { values: p, errors: h } = u;
|
|
330
331
|
return ce(() => {
|
|
331
|
-
r && r(
|
|
332
|
-
}, [
|
|
332
|
+
r && r(p.enumValues);
|
|
333
|
+
}, [p.enumValues]), /* @__PURE__ */ e(kt, { value: u, children: /* @__PURE__ */ e(
|
|
333
334
|
Pi,
|
|
334
335
|
{
|
|
335
336
|
enumValuesPath: "enumValues",
|
|
336
|
-
values:
|
|
337
|
+
values: p,
|
|
337
338
|
errors: h,
|
|
338
339
|
shouldUpdateId: i,
|
|
339
340
|
disabled: l,
|
|
@@ -352,29 +353,29 @@ function Pi({
|
|
|
352
353
|
getData: d
|
|
353
354
|
}) {
|
|
354
355
|
const {
|
|
355
|
-
setFieldValue:
|
|
356
|
-
} = K(), [
|
|
357
|
-
const
|
|
356
|
+
setFieldValue: u
|
|
357
|
+
} = K(), [p, h] = Y.useState(), [m, c] = Y.useState(), [g, v] = Y.useState(!1), y = Y.useRef(/* @__PURE__ */ new Set()).current, P = (b, C) => {
|
|
358
|
+
const N = p === C, f = r?.enumValues && r?.enumValues[b];
|
|
358
359
|
return /* @__PURE__ */ e(
|
|
359
360
|
Ni,
|
|
360
361
|
{
|
|
361
362
|
index: b,
|
|
362
363
|
disabled: n,
|
|
363
364
|
enumValuesPath: i,
|
|
364
|
-
autoFocus:
|
|
365
|
+
autoFocus: N,
|
|
365
366
|
entryError: f,
|
|
366
|
-
shouldUpdateId: l ||
|
|
367
|
+
shouldUpdateId: l || N,
|
|
367
368
|
onDialogOpen: () => c(b),
|
|
368
369
|
inferredEntry: y.has(t.enumValues[b]?.id)
|
|
369
370
|
},
|
|
370
|
-
`${
|
|
371
|
+
`${C}`
|
|
371
372
|
);
|
|
372
373
|
};
|
|
373
374
|
return /* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
374
375
|
/* @__PURE__ */ a("div", { className: "ml-3.5 flex flex-row items-center", children: [
|
|
375
376
|
/* @__PURE__ */ e(Ar, {}),
|
|
376
377
|
/* @__PURE__ */ e(
|
|
377
|
-
|
|
378
|
+
O,
|
|
378
379
|
{
|
|
379
380
|
variant: "subtitle2",
|
|
380
381
|
className: "ml-2 grow",
|
|
@@ -392,10 +393,10 @@ function Pi({
|
|
|
392
393
|
d && (v(!0), d?.().then((b) => {
|
|
393
394
|
if (!b)
|
|
394
395
|
return;
|
|
395
|
-
const
|
|
396
|
-
_.forEach((
|
|
397
|
-
y.add(
|
|
398
|
-
}),
|
|
396
|
+
const C = b.flat(), N = Array.from(new Set(C)), f = t.enumValues, _ = ei(N).filter((M) => !f?.some((R) => R.id === M.id));
|
|
397
|
+
_.forEach((M) => {
|
|
398
|
+
y.add(M.id);
|
|
399
|
+
}), u(i, [..._, ...f], !0);
|
|
399
400
|
}).catch((b) => {
|
|
400
401
|
console.error(b);
|
|
401
402
|
}).finally(() => v(!1)));
|
|
@@ -416,10 +417,10 @@ function Pi({
|
|
|
416
417
|
value: t.enumValues,
|
|
417
418
|
disabled: n,
|
|
418
419
|
size: "small",
|
|
419
|
-
buildEntry:
|
|
420
|
+
buildEntry: P,
|
|
420
421
|
onInternalIdAdded: h,
|
|
421
422
|
includeAddButton: !0,
|
|
422
|
-
onValueChange: (b) =>
|
|
423
|
+
onValueChange: (b) => u(i, b),
|
|
423
424
|
newDefaultEntry: { id: "", label: "" }
|
|
424
425
|
}
|
|
425
426
|
),
|
|
@@ -443,8 +444,8 @@ const Ni = Y.memo(
|
|
|
443
444
|
autoFocus: l,
|
|
444
445
|
onDialogOpen: o,
|
|
445
446
|
disabled: d,
|
|
446
|
-
inferredEntry:
|
|
447
|
-
entryError:
|
|
447
|
+
inferredEntry: u,
|
|
448
|
+
entryError: p
|
|
448
449
|
}) {
|
|
449
450
|
const {
|
|
450
451
|
values: h,
|
|
@@ -452,27 +453,27 @@ const Ni = Y.memo(
|
|
|
452
453
|
errors: c,
|
|
453
454
|
setFieldValue: g,
|
|
454
455
|
touched: v
|
|
455
|
-
} = K(), x = Y.useRef(!I(h, `${i}[${r}].id`)), y = n || x.current,
|
|
456
|
+
} = K(), x = Y.useRef(!I(h, `${i}[${r}].id`)), y = n || x.current, P = I(h, `${i}[${r}].id`), T = I(h, `${i}[${r}].label`), b = Y.useRef(T);
|
|
456
457
|
return Y.useEffect(() => {
|
|
457
|
-
(b.current ===
|
|
458
|
-
}, [
|
|
458
|
+
(b.current === P || !P) && y && g(`${i}[${r}].id`, T), b.current = T;
|
|
459
|
+
}, [T]), /* @__PURE__ */ a(U, { children: [
|
|
459
460
|
/* @__PURE__ */ a("div", { className: "flex w-full align-center justify-center", children: [
|
|
460
461
|
/* @__PURE__ */ e(
|
|
461
462
|
H,
|
|
462
463
|
{
|
|
463
464
|
name: `${i}[${r}].label`,
|
|
464
|
-
as:
|
|
465
|
+
as: Z,
|
|
465
466
|
className: "flex-grow",
|
|
466
467
|
required: !0,
|
|
467
468
|
disabled: d,
|
|
468
469
|
size: "small",
|
|
469
470
|
autoFocus: l,
|
|
470
471
|
autoComplete: "off",
|
|
471
|
-
endAdornment:
|
|
472
|
-
error: !!
|
|
472
|
+
endAdornment: u && /* @__PURE__ */ e(ht, { size: "small" }),
|
|
473
|
+
error: !!p?.label
|
|
473
474
|
}
|
|
474
475
|
),
|
|
475
|
-
!d && /* @__PURE__ */ e(Er, { color: "error", invisible: !
|
|
476
|
+
!d && /* @__PURE__ */ e(Er, { color: "error", invisible: !p?.id, children: /* @__PURE__ */ e(
|
|
476
477
|
oe,
|
|
477
478
|
{
|
|
478
479
|
size: "small",
|
|
@@ -483,20 +484,20 @@ const Ni = Y.memo(
|
|
|
483
484
|
}
|
|
484
485
|
) })
|
|
485
486
|
] }),
|
|
486
|
-
|
|
487
|
-
|
|
487
|
+
p?.label && /* @__PURE__ */ e(
|
|
488
|
+
O,
|
|
488
489
|
{
|
|
489
490
|
variant: "caption",
|
|
490
491
|
className: "ml-3.5 text-red-500 dark:text-red-500",
|
|
491
|
-
children:
|
|
492
|
+
children: p?.label
|
|
492
493
|
}
|
|
493
494
|
),
|
|
494
|
-
|
|
495
|
-
|
|
495
|
+
p?.id && /* @__PURE__ */ e(
|
|
496
|
+
O,
|
|
496
497
|
{
|
|
497
498
|
variant: "caption",
|
|
498
499
|
className: "ml-3.5 text-red-500 dark:text-red-500",
|
|
499
|
-
children:
|
|
500
|
+
children: p?.id
|
|
500
501
|
}
|
|
501
502
|
)
|
|
502
503
|
] });
|
|
@@ -527,7 +528,7 @@ function xi({
|
|
|
527
528
|
H,
|
|
528
529
|
{
|
|
529
530
|
name: `${i}[${t}].id`,
|
|
530
|
-
as:
|
|
531
|
+
as: Z,
|
|
531
532
|
required: !0,
|
|
532
533
|
label: "ID",
|
|
533
534
|
size: "small",
|
|
@@ -560,7 +561,7 @@ function se({
|
|
|
560
561
|
size: o = "small",
|
|
561
562
|
allowIndeterminate: d
|
|
562
563
|
}) {
|
|
563
|
-
const
|
|
564
|
+
const u = /* @__PURE__ */ e(
|
|
564
565
|
ct,
|
|
565
566
|
{
|
|
566
567
|
label: n,
|
|
@@ -569,16 +570,16 @@ function se({
|
|
|
569
570
|
value: t.value,
|
|
570
571
|
disabled: l,
|
|
571
572
|
allowIndeterminate: d,
|
|
572
|
-
onValueChange: (
|
|
573
|
+
onValueChange: (p) => r.setFieldValue(t.name, p)
|
|
573
574
|
}
|
|
574
575
|
);
|
|
575
576
|
return i ? /* @__PURE__ */ e(
|
|
576
577
|
te,
|
|
577
578
|
{
|
|
578
579
|
title: i,
|
|
579
|
-
children:
|
|
580
|
+
children: u
|
|
580
581
|
}
|
|
581
|
-
) :
|
|
582
|
+
) : u;
|
|
582
583
|
}
|
|
583
584
|
function Se({ disabled: t }) {
|
|
584
585
|
const { values: r, handleChange: n } = K(), i = "validation.required", l = "validation.requiredMessage";
|
|
@@ -588,13 +589,13 @@ function Se({ disabled: t }) {
|
|
|
588
589
|
{
|
|
589
590
|
name: i,
|
|
590
591
|
type: "checkbox",
|
|
591
|
-
children: ({ field: d, form:
|
|
592
|
+
children: ({ field: d, form: u }) => /* @__PURE__ */ e(
|
|
592
593
|
se,
|
|
593
594
|
{
|
|
594
595
|
disabled: t,
|
|
595
596
|
label: "Required",
|
|
596
597
|
tooltip: "You won't be able to save this entity if this value is not set",
|
|
597
|
-
form:
|
|
598
|
+
form: u,
|
|
598
599
|
field: d
|
|
599
600
|
}
|
|
600
601
|
)
|
|
@@ -605,20 +606,20 @@ function Se({ disabled: t }) {
|
|
|
605
606
|
{
|
|
606
607
|
name: "validation.unique",
|
|
607
608
|
type: "checkbox",
|
|
608
|
-
children: ({ field: d, form:
|
|
609
|
+
children: ({ field: d, form: u }) => /* @__PURE__ */ e(
|
|
609
610
|
se,
|
|
610
611
|
{
|
|
611
612
|
disabled: t,
|
|
612
613
|
label: "Unique",
|
|
613
614
|
tooltip: "There cannot be multiple entities with the same value",
|
|
614
|
-
form:
|
|
615
|
+
form: u,
|
|
615
616
|
field: d
|
|
616
617
|
}
|
|
617
618
|
)
|
|
618
619
|
}
|
|
619
620
|
) }),
|
|
620
621
|
I(r, i) && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
621
|
-
|
|
622
|
+
Z,
|
|
622
623
|
{
|
|
623
624
|
disabled: t,
|
|
624
625
|
value: I(r, l),
|
|
@@ -638,29 +639,29 @@ function Ee({
|
|
|
638
639
|
min: l,
|
|
639
640
|
trim: o,
|
|
640
641
|
uppercase: d,
|
|
641
|
-
disabled:
|
|
642
|
-
showErrors:
|
|
642
|
+
disabled: u,
|
|
643
|
+
showErrors: p
|
|
643
644
|
}) {
|
|
644
645
|
const {
|
|
645
646
|
values: h,
|
|
646
647
|
handleChange: m,
|
|
647
648
|
errors: c
|
|
648
|
-
} = K(), g = "validation.length", v = "validation.min", x = "validation.max", y = "validation.trim",
|
|
649
|
+
} = K(), g = "validation.length", v = "validation.min", x = "validation.max", y = "validation.trim", P = "validation.matches", T = "validation.lowercase", b = "validation.uppercase", C = I(c, P), N = I(h, P), f = typeof N == "string" ? N : br(N);
|
|
649
650
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
650
|
-
/* @__PURE__ */ e(Se, { disabled:
|
|
651
|
+
/* @__PURE__ */ e(Se, { disabled: u }),
|
|
651
652
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
652
653
|
r && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
653
654
|
H,
|
|
654
655
|
{
|
|
655
|
-
name:
|
|
656
|
+
name: T,
|
|
656
657
|
type: "checkbox",
|
|
657
|
-
children: ({ field:
|
|
658
|
+
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
658
659
|
se,
|
|
659
660
|
{
|
|
660
661
|
label: "Lowercase",
|
|
661
|
-
disabled:
|
|
662
|
+
disabled: u,
|
|
662
663
|
form: _,
|
|
663
|
-
field:
|
|
664
|
+
field: w
|
|
664
665
|
}
|
|
665
666
|
)
|
|
666
667
|
}
|
|
@@ -670,13 +671,13 @@ function Ee({
|
|
|
670
671
|
{
|
|
671
672
|
name: b,
|
|
672
673
|
type: "checkbox",
|
|
673
|
-
children: ({ field:
|
|
674
|
+
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
674
675
|
se,
|
|
675
676
|
{
|
|
676
677
|
label: "Uppercase",
|
|
677
|
-
disabled:
|
|
678
|
+
disabled: u,
|
|
678
679
|
form: _,
|
|
679
|
-
field:
|
|
680
|
+
field: w
|
|
680
681
|
}
|
|
681
682
|
)
|
|
682
683
|
}
|
|
@@ -686,13 +687,13 @@ function Ee({
|
|
|
686
687
|
{
|
|
687
688
|
name: y,
|
|
688
689
|
type: "checkbox",
|
|
689
|
-
children: ({ field:
|
|
690
|
+
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
690
691
|
se,
|
|
691
692
|
{
|
|
692
693
|
label: "Trim",
|
|
693
|
-
disabled:
|
|
694
|
+
disabled: u,
|
|
694
695
|
form: _,
|
|
695
|
-
field:
|
|
696
|
+
field: w
|
|
696
697
|
}
|
|
697
698
|
)
|
|
698
699
|
}
|
|
@@ -700,38 +701,38 @@ function Ee({
|
|
|
700
701
|
] }),
|
|
701
702
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
702
703
|
t && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
703
|
-
|
|
704
|
+
Z,
|
|
704
705
|
{
|
|
705
706
|
value: I(h, g),
|
|
706
707
|
label: "Exact length",
|
|
707
708
|
name: g,
|
|
708
709
|
type: "number",
|
|
709
710
|
size: "small",
|
|
710
|
-
disabled:
|
|
711
|
+
disabled: u,
|
|
711
712
|
onChange: m
|
|
712
713
|
}
|
|
713
714
|
) }),
|
|
714
715
|
l && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
715
|
-
|
|
716
|
+
Z,
|
|
716
717
|
{
|
|
717
718
|
value: I(h, v),
|
|
718
719
|
label: "Min length",
|
|
719
720
|
name: v,
|
|
720
721
|
type: "number",
|
|
721
722
|
size: "small",
|
|
722
|
-
disabled:
|
|
723
|
+
disabled: u,
|
|
723
724
|
onChange: m
|
|
724
725
|
}
|
|
725
726
|
) }),
|
|
726
727
|
i && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
727
|
-
|
|
728
|
+
Z,
|
|
728
729
|
{
|
|
729
730
|
value: I(h, x),
|
|
730
731
|
label: "Max length",
|
|
731
732
|
name: x,
|
|
732
733
|
type: "number",
|
|
733
734
|
size: "small",
|
|
734
|
-
disabled:
|
|
735
|
+
disabled: u,
|
|
735
736
|
onChange: m
|
|
736
737
|
}
|
|
737
738
|
) })
|
|
@@ -740,16 +741,16 @@ function Ee({
|
|
|
740
741
|
/* @__PURE__ */ e(
|
|
741
742
|
H,
|
|
742
743
|
{
|
|
743
|
-
name:
|
|
744
|
-
as:
|
|
744
|
+
name: P,
|
|
745
|
+
as: Z,
|
|
745
746
|
label: "Matches regex",
|
|
746
747
|
size: "small",
|
|
747
|
-
disabled:
|
|
748
|
+
disabled: u,
|
|
748
749
|
value: f,
|
|
749
|
-
error: !!
|
|
750
|
+
error: !!C
|
|
750
751
|
}
|
|
751
752
|
),
|
|
752
|
-
/* @__PURE__ */ e(X, { error: !!
|
|
753
|
+
/* @__PURE__ */ e(X, { error: !!C, children: C ? "Not a valid regexp" : "e.g. /^\\d+$/ for digits only" })
|
|
753
754
|
] })
|
|
754
755
|
] });
|
|
755
756
|
}
|
|
@@ -765,7 +766,7 @@ function Ot({
|
|
|
765
766
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
766
767
|
/* @__PURE__ */ e(Se, { disabled: n }),
|
|
767
768
|
r && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
768
|
-
|
|
769
|
+
Z,
|
|
769
770
|
{
|
|
770
771
|
value: I(i, o),
|
|
771
772
|
disabled: n,
|
|
@@ -777,7 +778,7 @@ function Ot({
|
|
|
777
778
|
}
|
|
778
779
|
) }),
|
|
779
780
|
t && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
780
|
-
|
|
781
|
+
Z,
|
|
781
782
|
{
|
|
782
783
|
value: I(i, d),
|
|
783
784
|
disabled: n,
|
|
@@ -802,7 +803,7 @@ function Ne({
|
|
|
802
803
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
803
804
|
/* @__PURE__ */ e(Dr, {}),
|
|
804
805
|
/* @__PURE__ */ e(
|
|
805
|
-
|
|
806
|
+
O,
|
|
806
807
|
{
|
|
807
808
|
variant: "subtitle2",
|
|
808
809
|
className: "ml-2",
|
|
@@ -824,8 +825,8 @@ function Rt({
|
|
|
824
825
|
}) {
|
|
825
826
|
const {
|
|
826
827
|
values: d,
|
|
827
|
-
setFieldError:
|
|
828
|
-
setFieldValue:
|
|
828
|
+
setFieldError: u,
|
|
829
|
+
setFieldValue: p
|
|
829
830
|
} = K(), h = Ie(), m = t ? "of.enumValues" : "enumValues", c = I(d, "defaultValue"), g = I(d, m), v = Zt(() => !g || typeof g == "boolean" ? [] : Cr(g) ?? [], [g]);
|
|
830
831
|
return /* @__PURE__ */ a(U, { children: [
|
|
831
832
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
@@ -836,13 +837,13 @@ function Rt({
|
|
|
836
837
|
disabled: n,
|
|
837
838
|
allowDataInference: l,
|
|
838
839
|
onError: (y) => {
|
|
839
|
-
|
|
840
|
+
u(m, y ? "This enum property is missing some values" : void 0);
|
|
840
841
|
},
|
|
841
|
-
getData: o ? () => o().then((y) => y.map((
|
|
842
|
+
getData: o ? () => o().then((y) => y.map((P) => d.id && I(P, d.id)).filter(Boolean)) : void 0,
|
|
842
843
|
onValuesChanged: (y) => {
|
|
843
|
-
if (d && (
|
|
844
|
-
const
|
|
845
|
-
c && !
|
|
844
|
+
if (d && (p(m, y), !t)) {
|
|
845
|
+
const P = y.filter((T) => !!T?.id).map((T) => T.id);
|
|
846
|
+
c && !P.includes(c) && (p("defaultValue", void 0), h.open({
|
|
846
847
|
type: "warning",
|
|
847
848
|
message: "Default value was cleared"
|
|
848
849
|
}));
|
|
@@ -866,7 +867,7 @@ function Rt({
|
|
|
866
867
|
disabled: n,
|
|
867
868
|
position: "item-aligned",
|
|
868
869
|
onValueChange: (y) => {
|
|
869
|
-
|
|
870
|
+
p("defaultValue", y);
|
|
870
871
|
},
|
|
871
872
|
label: "Default value",
|
|
872
873
|
value: c ?? "",
|
|
@@ -897,9 +898,9 @@ function Ut({
|
|
|
897
898
|
const {
|
|
898
899
|
values: i,
|
|
899
900
|
setFieldValue: l
|
|
900
|
-
} = K(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`,
|
|
901
|
-
b ? b.includes("all") || b.length >= Object.keys(it).length ? l(d, void 0) : x ? l(d, Object.keys(it).filter((
|
|
902
|
-
},
|
|
901
|
+
} = K(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`, u = `${o}.fileName`, p = `${o}.storagePath`, h = `${o}.storeUrl`, m = I(i, u) ?? "{rand}_{file}", c = I(i, p) ?? "/", g = I(i, d), v = Array.isArray(g) ? g : void 0, x = !v || v.length === 0, y = (b) => {
|
|
902
|
+
b ? b.includes("all") || b.length >= Object.keys(it).length ? l(d, void 0) : x ? l(d, Object.keys(it).filter((C) => !b.includes(C))) : l(d, b) : l(d, void 0);
|
|
903
|
+
}, P = typeof m == "function", T = typeof c == "function";
|
|
903
904
|
return /* @__PURE__ */ a(U, { children: [
|
|
904
905
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
905
906
|
xt,
|
|
@@ -907,7 +908,7 @@ function Ut({
|
|
|
907
908
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
908
909
|
/* @__PURE__ */ e(Br, {}),
|
|
909
910
|
/* @__PURE__ */ e(
|
|
910
|
-
|
|
911
|
+
O,
|
|
911
912
|
{
|
|
912
913
|
variant: "subtitle2",
|
|
913
914
|
className: "ml-2",
|
|
@@ -924,7 +925,7 @@ function Ut({
|
|
|
924
925
|
value: v ?? [],
|
|
925
926
|
onMultiValueChange: y,
|
|
926
927
|
label: x ? void 0 : "Allowed file types",
|
|
927
|
-
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((
|
|
928
|
+
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((C) => it[C]).filter((C) => !!C).join(", "),
|
|
928
929
|
children: [
|
|
929
930
|
/* @__PURE__ */ a(St, { value: "all", className: "flex items-center gap-2", children: [
|
|
930
931
|
/* @__PURE__ */ e(
|
|
@@ -935,20 +936,20 @@ function Ut({
|
|
|
935
936
|
),
|
|
936
937
|
"All"
|
|
937
938
|
] }, "all"),
|
|
938
|
-
Object.entries(it).map(([b,
|
|
939
|
+
Object.entries(it).map(([b, C]) => /* @__PURE__ */ a(St, { value: b, className: "flex items-center gap-2", children: [
|
|
939
940
|
/* @__PURE__ */ e(
|
|
940
941
|
Et,
|
|
941
942
|
{
|
|
942
943
|
checked: x || v.indexOf(b) > -1
|
|
943
944
|
}
|
|
944
945
|
),
|
|
945
|
-
/* @__PURE__ */ e("div", { className: "flex-grow", children:
|
|
946
|
+
/* @__PURE__ */ e("div", { className: "flex-grow", children: C }),
|
|
946
947
|
/* @__PURE__ */ e(
|
|
947
948
|
z,
|
|
948
949
|
{
|
|
949
950
|
size: "small",
|
|
950
951
|
variant: "outlined",
|
|
951
|
-
onClick: (
|
|
952
|
+
onClick: (N) => (N.preventDefault(), N.stopPropagation(), l(d, [b])),
|
|
952
953
|
children: "Only"
|
|
953
954
|
}
|
|
954
955
|
)
|
|
@@ -959,27 +960,27 @@ function Ut({
|
|
|
959
960
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
960
961
|
H,
|
|
961
962
|
{
|
|
962
|
-
name:
|
|
963
|
-
as:
|
|
963
|
+
name: u,
|
|
964
|
+
as: Z,
|
|
964
965
|
label: "File name",
|
|
965
966
|
size: "small",
|
|
966
|
-
disabled:
|
|
967
|
-
value:
|
|
967
|
+
disabled: P || n,
|
|
968
|
+
value: P ? "-" : m
|
|
968
969
|
}
|
|
969
970
|
) }),
|
|
970
971
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
971
972
|
/* @__PURE__ */ e(
|
|
972
973
|
H,
|
|
973
974
|
{
|
|
974
|
-
name:
|
|
975
|
-
as:
|
|
975
|
+
name: p,
|
|
976
|
+
as: Z,
|
|
976
977
|
label: "Storage path",
|
|
977
|
-
disabled:
|
|
978
|
+
disabled: T || n,
|
|
978
979
|
size: "small",
|
|
979
|
-
value:
|
|
980
|
+
value: T ? "-" : c
|
|
980
981
|
}
|
|
981
982
|
),
|
|
982
|
-
/* @__PURE__ */ a(
|
|
983
|
+
/* @__PURE__ */ a(O, { variant: "caption", className: "ml-3.5 mt-1 mb-2", children: [
|
|
983
984
|
/* @__PURE__ */ e("p", { children: "You can use the following placeholders in the file name and storage path values:" }),
|
|
984
985
|
/* @__PURE__ */ a("ul", { children: [
|
|
985
986
|
/* @__PURE__ */ e("li", { children: "{file} - Full name of the uploaded file" }),
|
|
@@ -996,18 +997,18 @@ function Ut({
|
|
|
996
997
|
{
|
|
997
998
|
name: h,
|
|
998
999
|
type: "checkbox",
|
|
999
|
-
children: ({ field: b, form:
|
|
1000
|
+
children: ({ field: b, form: C }) => /* @__PURE__ */ e(
|
|
1000
1001
|
se,
|
|
1001
1002
|
{
|
|
1002
1003
|
label: "Save URL instead of storage path",
|
|
1003
1004
|
disabled: r || n,
|
|
1004
|
-
form:
|
|
1005
|
+
form: C,
|
|
1005
1006
|
field: b
|
|
1006
1007
|
}
|
|
1007
1008
|
)
|
|
1008
1009
|
}
|
|
1009
1010
|
),
|
|
1010
|
-
/* @__PURE__ */ e(
|
|
1011
|
+
/* @__PURE__ */ e(O, { variant: "caption", className: "ml-3.5 mt-1 mb-2", children: "Turn this setting on, if you prefer to save the download URL of the uploaded file instead of the storage path. You can only change this prop upon creation." })
|
|
1011
1012
|
] })
|
|
1012
1013
|
] })
|
|
1013
1014
|
}
|
|
@@ -1046,16 +1047,16 @@ function nr({
|
|
|
1046
1047
|
includeEditButton: l,
|
|
1047
1048
|
selected: o
|
|
1048
1049
|
}) {
|
|
1049
|
-
const { propertyConfigs: d } = Ae(),
|
|
1050
|
+
const { propertyConfigs: d } = Ae(), u = $e(t, d);
|
|
1050
1051
|
qe(t);
|
|
1051
|
-
const
|
|
1052
|
+
const p = n ? "border-red-500 dark:border-red-500 border-opacity-100 dark:border-opacity-100 ring-0 dark:ring-0" : o ? "border-primary" : "border-transparent";
|
|
1052
1053
|
return n && console.log("PropertyFieldPreview", t), /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ a(
|
|
1053
1054
|
"div",
|
|
1054
1055
|
{
|
|
1055
1056
|
onClick: r,
|
|
1056
1057
|
className: "flex flex-row w-full cursor-pointer",
|
|
1057
1058
|
children: [
|
|
1058
|
-
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(Ye, { propertyConfig:
|
|
1059
|
+
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(Ye, { propertyConfig: u }) }),
|
|
1059
1060
|
/* @__PURE__ */ a(
|
|
1060
1061
|
Ce,
|
|
1061
1062
|
{
|
|
@@ -1066,12 +1067,12 @@ function nr({
|
|
|
1066
1067
|
r ? Xt : "",
|
|
1067
1068
|
o ? er : "",
|
|
1068
1069
|
"flex-grow p-4 border transition-colors duration-200",
|
|
1069
|
-
|
|
1070
|
+
p
|
|
1070
1071
|
),
|
|
1071
1072
|
children: [
|
|
1072
1073
|
/* @__PURE__ */ a("div", { className: "w-full flex flex-col", children: [
|
|
1073
1074
|
i && /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1074
|
-
|
|
1075
|
+
O,
|
|
1075
1076
|
{
|
|
1076
1077
|
variant: "body1",
|
|
1077
1078
|
component: "span",
|
|
@@ -1081,17 +1082,17 @@ function nr({
|
|
|
1081
1082
|
) }),
|
|
1082
1083
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center", children: [
|
|
1083
1084
|
/* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1084
|
-
|
|
1085
|
+
O,
|
|
1085
1086
|
{
|
|
1086
1087
|
className: "flex-grow pr-2",
|
|
1087
1088
|
variant: i ? "body2" : "subtitle1",
|
|
1088
1089
|
component: "span",
|
|
1089
1090
|
color: "secondary",
|
|
1090
|
-
children:
|
|
1091
|
+
children: u?.name
|
|
1091
1092
|
}
|
|
1092
1093
|
) }),
|
|
1093
1094
|
/* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1094
|
-
|
|
1095
|
+
O,
|
|
1095
1096
|
{
|
|
1096
1097
|
variant: "body2",
|
|
1097
1098
|
component: "span",
|
|
@@ -1101,7 +1102,7 @@ function nr({
|
|
|
1101
1102
|
) })
|
|
1102
1103
|
] })
|
|
1103
1104
|
] }),
|
|
1104
|
-
l && /* @__PURE__ */ e(
|
|
1105
|
+
l && /* @__PURE__ */ e(O, { variant: "button", children: "EDIT" })
|
|
1105
1106
|
]
|
|
1106
1107
|
}
|
|
1107
1108
|
)
|
|
@@ -1146,7 +1147,7 @@ function Ti({
|
|
|
1146
1147
|
),
|
|
1147
1148
|
children: /* @__PURE__ */ a("div", { className: "w-full flex flex-col", children: [
|
|
1148
1149
|
/* @__PURE__ */ e(
|
|
1149
|
-
|
|
1150
|
+
O,
|
|
1150
1151
|
{
|
|
1151
1152
|
variant: "body1",
|
|
1152
1153
|
component: "span",
|
|
@@ -1156,7 +1157,7 @@ function Ti({
|
|
|
1156
1157
|
),
|
|
1157
1158
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center", children: [
|
|
1158
1159
|
o && /* @__PURE__ */ e(
|
|
1159
|
-
|
|
1160
|
+
O,
|
|
1160
1161
|
{
|
|
1161
1162
|
className: "flex-grow pr-2",
|
|
1162
1163
|
variant: "body2",
|
|
@@ -1166,7 +1167,7 @@ function Ti({
|
|
|
1166
1167
|
}
|
|
1167
1168
|
),
|
|
1168
1169
|
i && !ne(i) && /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1169
|
-
|
|
1170
|
+
O,
|
|
1170
1171
|
{
|
|
1171
1172
|
variant: "body2",
|
|
1172
1173
|
component: "span",
|
|
@@ -1175,7 +1176,7 @@ function Ti({
|
|
|
1175
1176
|
}
|
|
1176
1177
|
) }),
|
|
1177
1178
|
i && ne(i) && /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1178
|
-
|
|
1179
|
+
O,
|
|
1179
1180
|
{
|
|
1180
1181
|
variant: "body2",
|
|
1181
1182
|
component: "span",
|
|
@@ -1184,7 +1185,7 @@ function Ti({
|
|
|
1184
1185
|
}
|
|
1185
1186
|
) }),
|
|
1186
1187
|
!i && /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1187
|
-
|
|
1188
|
+
O,
|
|
1188
1189
|
{
|
|
1189
1190
|
variant: "body2",
|
|
1190
1191
|
component: "span",
|
|
@@ -1208,52 +1209,52 @@ const ft = Y.memo(
|
|
|
1208
1209
|
properties: l,
|
|
1209
1210
|
propertiesOrder: o,
|
|
1210
1211
|
additionalFields: d,
|
|
1211
|
-
errors:
|
|
1212
|
-
onPropertyMove:
|
|
1212
|
+
errors: u,
|
|
1213
|
+
onPropertyMove: p,
|
|
1213
1214
|
onPropertyRemove: h,
|
|
1214
1215
|
className: m,
|
|
1215
1216
|
inferredPropertyKeys: c,
|
|
1216
1217
|
collectionEditable: g
|
|
1217
1218
|
}) {
|
|
1218
|
-
const v = o ?? Object.keys(l), x =
|
|
1219
|
+
const v = o ?? Object.keys(l), x = Q((y) => {
|
|
1219
1220
|
if (!y.destination)
|
|
1220
1221
|
return;
|
|
1221
|
-
const
|
|
1222
|
-
b.splice(
|
|
1223
|
-
}, [r,
|
|
1224
|
-
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(ii, { onDragEnd: x, children: /* @__PURE__ */ e(ni, { droppableId: `droppable_${r}`, children: (y,
|
|
1222
|
+
const P = y.source.index, T = y.destination.index, b = Array.from(v), [C] = b.splice(P, 1);
|
|
1223
|
+
b.splice(T, 0, C), p && p(b, r);
|
|
1224
|
+
}, [r, p, v]);
|
|
1225
|
+
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(ii, { onDragEnd: x, children: /* @__PURE__ */ e(ni, { droppableId: `droppable_${r}`, children: (y, P) => /* @__PURE__ */ a(
|
|
1225
1226
|
"div",
|
|
1226
1227
|
{
|
|
1227
1228
|
...y.droppableProps,
|
|
1228
1229
|
ref: y.innerRef,
|
|
1229
1230
|
className: m,
|
|
1230
1231
|
children: [
|
|
1231
|
-
v && v.map((
|
|
1232
|
-
const
|
|
1233
|
-
return !
|
|
1232
|
+
v && v.map((T, b) => {
|
|
1233
|
+
const C = l[T], N = d?.find((f) => f.key === T);
|
|
1234
|
+
return !C && !N ? (console.warn(`Property ${T} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
1234
1235
|
ai,
|
|
1235
1236
|
{
|
|
1236
|
-
draggableId: `array_field_${r}_${
|
|
1237
|
+
draggableId: `array_field_${r}_${T}}`,
|
|
1237
1238
|
index: b,
|
|
1238
|
-
children: (f,
|
|
1239
|
+
children: (f, w) => /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1239
1240
|
ki,
|
|
1240
1241
|
{
|
|
1241
|
-
propertyKey:
|
|
1242
|
-
propertyOrBuilder:
|
|
1243
|
-
additionalField:
|
|
1242
|
+
propertyKey: T,
|
|
1243
|
+
propertyOrBuilder: C,
|
|
1244
|
+
additionalField: N,
|
|
1244
1245
|
provided: f,
|
|
1245
|
-
errors:
|
|
1246
|
+
errors: u,
|
|
1246
1247
|
namespace: r,
|
|
1247
1248
|
inferredPropertyKeys: c,
|
|
1248
|
-
onPropertyMove:
|
|
1249
|
+
onPropertyMove: p,
|
|
1249
1250
|
onPropertyRemove: h,
|
|
1250
|
-
onPropertyClick:
|
|
1251
|
+
onPropertyClick: w.isDragging ? void 0 : i,
|
|
1251
1252
|
selectedPropertyKey: n,
|
|
1252
1253
|
collectionEditable: g
|
|
1253
1254
|
}
|
|
1254
1255
|
) })
|
|
1255
1256
|
},
|
|
1256
|
-
`array_field_${r}_${
|
|
1257
|
+
`array_field_${r}_${T}}`
|
|
1257
1258
|
);
|
|
1258
1259
|
}).filter(Boolean),
|
|
1259
1260
|
y.placeholder
|
|
@@ -1276,32 +1277,32 @@ function ki({
|
|
|
1276
1277
|
provided: l,
|
|
1277
1278
|
selectedPropertyKey: o,
|
|
1278
1279
|
errors: d,
|
|
1279
|
-
onPropertyClick:
|
|
1280
|
-
onPropertyMove:
|
|
1280
|
+
onPropertyClick: u,
|
|
1281
|
+
onPropertyMove: p,
|
|
1281
1282
|
onPropertyRemove: h,
|
|
1282
1283
|
inferredPropertyKeys: m,
|
|
1283
1284
|
collectionEditable: c
|
|
1284
1285
|
}) {
|
|
1285
1286
|
const g = m?.includes(r ? `${r}.${t}` : t), v = ae(t, r), y = ir(t, r) in d;
|
|
1286
|
-
let
|
|
1287
|
+
let P;
|
|
1287
1288
|
if (typeof n == "object") {
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1289
|
+
const C = n;
|
|
1290
|
+
C.dataType === "map" && C.properties && (P = /* @__PURE__ */ e(
|
|
1290
1291
|
ft,
|
|
1291
1292
|
{
|
|
1292
1293
|
selectedPropertyKey: o,
|
|
1293
1294
|
namespace: v,
|
|
1294
|
-
properties:
|
|
1295
|
-
propertiesOrder:
|
|
1295
|
+
properties: C.properties,
|
|
1296
|
+
propertiesOrder: C.propertiesOrder,
|
|
1296
1297
|
errors: d,
|
|
1297
|
-
onPropertyClick:
|
|
1298
|
-
onPropertyMove:
|
|
1298
|
+
onPropertyClick: u,
|
|
1299
|
+
onPropertyMove: p,
|
|
1299
1300
|
onPropertyRemove: h,
|
|
1300
1301
|
collectionEditable: c
|
|
1301
1302
|
}
|
|
1302
1303
|
));
|
|
1303
1304
|
}
|
|
1304
|
-
const
|
|
1305
|
+
const T = o === v, b = n && (c && !ne(n) || qe(n));
|
|
1305
1306
|
return /* @__PURE__ */ a(
|
|
1306
1307
|
"div",
|
|
1307
1308
|
{
|
|
@@ -1310,7 +1311,7 @@ function ki({
|
|
|
1310
1311
|
...l.dragHandleProps,
|
|
1311
1312
|
className: "relative -ml-8",
|
|
1312
1313
|
children: [
|
|
1313
|
-
|
|
1314
|
+
P && /* @__PURE__ */ e(
|
|
1314
1315
|
"div",
|
|
1315
1316
|
{
|
|
1316
1317
|
className: "absolute border-l " + wt,
|
|
@@ -1325,9 +1326,9 @@ function ki({
|
|
|
1325
1326
|
nr,
|
|
1326
1327
|
{
|
|
1327
1328
|
property: n,
|
|
1328
|
-
onClick:
|
|
1329
|
+
onClick: u ? () => u(t, r) : void 0,
|
|
1329
1330
|
includeName: !0,
|
|
1330
|
-
selected:
|
|
1331
|
+
selected: T,
|
|
1331
1332
|
hasError: y
|
|
1332
1333
|
}
|
|
1333
1334
|
) : /* @__PURE__ */ e(
|
|
@@ -1335,8 +1336,8 @@ function ki({
|
|
|
1335
1336
|
{
|
|
1336
1337
|
name: t,
|
|
1337
1338
|
property: n,
|
|
1338
|
-
onClick:
|
|
1339
|
-
selected:
|
|
1339
|
+
onClick: u ? () => u(t, r) : void 0,
|
|
1340
|
+
selected: T
|
|
1340
1341
|
}
|
|
1341
1342
|
),
|
|
1342
1343
|
/* @__PURE__ */ a("div", { className: "absolute top-2 right-2 flex flex-row ", children: [
|
|
@@ -1350,7 +1351,7 @@ function ki({
|
|
|
1350
1351
|
children: /* @__PURE__ */ e(Ur, { size: "small" })
|
|
1351
1352
|
}
|
|
1352
1353
|
) }),
|
|
1353
|
-
|
|
1354
|
+
p && /* @__PURE__ */ e(te, { title: "Move", children: /* @__PURE__ */ e(
|
|
1354
1355
|
oe,
|
|
1355
1356
|
{
|
|
1356
1357
|
component: "span",
|
|
@@ -1359,7 +1360,7 @@ function ki({
|
|
|
1359
1360
|
}
|
|
1360
1361
|
) })
|
|
1361
1362
|
] }),
|
|
1362
|
-
|
|
1363
|
+
P && /* @__PURE__ */ e("div", { className: "ml-16", children: P })
|
|
1363
1364
|
]
|
|
1364
1365
|
}
|
|
1365
1366
|
);
|
|
@@ -1368,42 +1369,44 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1368
1369
|
const {
|
|
1369
1370
|
values: o,
|
|
1370
1371
|
setFieldValue: d
|
|
1371
|
-
} = K(), [
|
|
1372
|
-
id:
|
|
1373
|
-
property:
|
|
1372
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [c, g] = $(), v = o.propertiesOrder ?? Object.keys(o.properties ?? {}), x = ({
|
|
1373
|
+
id: N,
|
|
1374
|
+
property: f
|
|
1374
1375
|
}) => {
|
|
1375
|
-
if (!
|
|
1376
|
+
if (!N)
|
|
1376
1377
|
throw Error();
|
|
1377
1378
|
d("properties", {
|
|
1378
1379
|
...o.properties ?? {},
|
|
1379
|
-
[
|
|
1380
|
-
}, !1)
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1380
|
+
[N]: f
|
|
1381
|
+
}, !1);
|
|
1382
|
+
const w = o.propertiesOrder ?? Object.keys(o.properties ?? {}), _ = w.includes(N) ? w : [...w, N];
|
|
1383
|
+
d("propertiesOrder", _, !1), p(!1);
|
|
1384
|
+
}, y = Q((N, f) => {
|
|
1385
|
+
const w = N ? ae(N, f) : void 0;
|
|
1386
|
+
if (!w)
|
|
1384
1387
|
throw Error("collection editor miss config");
|
|
1385
|
-
const
|
|
1386
|
-
d(
|
|
1387
|
-
}, [d, o]),
|
|
1388
|
-
|
|
1389
|
-
{
|
|
1390
|
-
color: "primary",
|
|
1391
|
-
variant: "outlined",
|
|
1392
|
-
onClick: () => u(!0),
|
|
1393
|
-
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
1394
|
-
children: [
|
|
1395
|
-
"Add property to ",
|
|
1396
|
-
o.name ?? "this group"
|
|
1397
|
-
]
|
|
1398
|
-
}
|
|
1399
|
-
), P = !v || v.length < 1, O = Z((f, N) => {
|
|
1400
|
-
d(ye(N), f, !1);
|
|
1388
|
+
const _ = pe(w), M = ye(f), R = I(o, M) ?? Object.keys(I(o, bi(f)));
|
|
1389
|
+
d(_, void 0, !1), d(M, R.filter((D) => D !== N), !1), p(!1), m(void 0), g(void 0);
|
|
1390
|
+
}, [d, o]), P = h ? ae(h, c) : void 0, T = P ? I(o.properties, P.replaceAll(".", ".properties.")) : void 0, b = !v || v.length < 1, C = Q((N, f) => {
|
|
1391
|
+
d(ye(f), N, !1);
|
|
1401
1392
|
}, []);
|
|
1402
1393
|
return /* @__PURE__ */ a(U, { children: [
|
|
1403
1394
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1404
1395
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end my-4", children: [
|
|
1405
|
-
/* @__PURE__ */ e(
|
|
1406
|
-
|
|
1396
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Properties in this group" }),
|
|
1397
|
+
/* @__PURE__ */ a(
|
|
1398
|
+
z,
|
|
1399
|
+
{
|
|
1400
|
+
color: "primary",
|
|
1401
|
+
variant: "outlined",
|
|
1402
|
+
onClick: () => p(!0),
|
|
1403
|
+
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
1404
|
+
children: [
|
|
1405
|
+
"Add property to ",
|
|
1406
|
+
o.name ?? "this group"
|
|
1407
|
+
]
|
|
1408
|
+
}
|
|
1409
|
+
)
|
|
1407
1410
|
] }),
|
|
1408
1411
|
/* @__PURE__ */ a(Ce, { className: "p-2 pl-8", children: [
|
|
1409
1412
|
/* @__PURE__ */ e(
|
|
@@ -1413,14 +1416,14 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1413
1416
|
propertiesOrder: v,
|
|
1414
1417
|
errors: {},
|
|
1415
1418
|
collectionEditable: l,
|
|
1416
|
-
onPropertyClick: (
|
|
1417
|
-
m(
|
|
1419
|
+
onPropertyClick: (N, f) => {
|
|
1420
|
+
m(N), g(f), p(!0);
|
|
1418
1421
|
},
|
|
1419
|
-
onPropertyMove:
|
|
1422
|
+
onPropertyMove: C
|
|
1420
1423
|
}
|
|
1421
1424
|
),
|
|
1422
|
-
|
|
1423
|
-
|
|
1425
|
+
b && /* @__PURE__ */ e(
|
|
1426
|
+
O,
|
|
1424
1427
|
{
|
|
1425
1428
|
variant: "label",
|
|
1426
1429
|
className: "h-full flex items-center justify-center p-4",
|
|
@@ -1436,7 +1439,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1436
1439
|
position: "start",
|
|
1437
1440
|
size: "small",
|
|
1438
1441
|
label: "Spread children as columns",
|
|
1439
|
-
onValueChange: (
|
|
1442
|
+
onValueChange: (N) => d("spreadChildren", N),
|
|
1440
1443
|
value: o.spreadChildren ?? !1
|
|
1441
1444
|
}
|
|
1442
1445
|
),
|
|
@@ -1447,20 +1450,20 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1447
1450
|
{
|
|
1448
1451
|
inArray: !1,
|
|
1449
1452
|
forceShowErrors: !1,
|
|
1450
|
-
open:
|
|
1453
|
+
open: u,
|
|
1451
1454
|
allowDataInference: n,
|
|
1452
1455
|
collectionEditable: l,
|
|
1453
1456
|
onCancel: () => {
|
|
1454
|
-
|
|
1457
|
+
p(!1), m(void 0), g(void 0);
|
|
1455
1458
|
},
|
|
1456
1459
|
onOkClicked: () => {
|
|
1457
|
-
|
|
1460
|
+
p(!1), m(void 0), g(void 0);
|
|
1458
1461
|
},
|
|
1459
1462
|
getData: r,
|
|
1460
1463
|
onDelete: y,
|
|
1461
1464
|
propertyKey: h,
|
|
1462
1465
|
propertyNamespace: c,
|
|
1463
|
-
property:
|
|
1466
|
+
property: T,
|
|
1464
1467
|
existingProperty: !!h,
|
|
1465
1468
|
autoUpdateId: !h,
|
|
1466
1469
|
autoOpenTypeSelect: !h,
|
|
@@ -1481,17 +1484,17 @@ function Vi({
|
|
|
1481
1484
|
collectionEditable: d
|
|
1482
1485
|
}) {
|
|
1483
1486
|
const {
|
|
1484
|
-
values:
|
|
1485
|
-
handleChange:
|
|
1487
|
+
values: u,
|
|
1488
|
+
handleChange: p,
|
|
1486
1489
|
errors: h,
|
|
1487
1490
|
setFieldValue: m,
|
|
1488
1491
|
touched: c
|
|
1489
|
-
} = K(), [g, v] = $(!1), x = I(
|
|
1490
|
-
console.log("onPropertyChanged", b,
|
|
1491
|
-
},
|
|
1492
|
+
} = K(), [g, v] = $(!1), x = I(u, "of"), y = I(c, "of") && I(h, "of"), P = ({ id: b, property: C, namespace: N }) => {
|
|
1493
|
+
console.log("onPropertyChanged", b, C, N), m("of", C);
|
|
1494
|
+
}, T = x && $e(x, o);
|
|
1492
1495
|
return /* @__PURE__ */ a(U, { children: [
|
|
1493
1496
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1494
|
-
/* @__PURE__ */ e(
|
|
1497
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Repeat component" }),
|
|
1495
1498
|
/* @__PURE__ */ e(
|
|
1496
1499
|
H,
|
|
1497
1500
|
{
|
|
@@ -1518,7 +1521,7 @@ function Vi({
|
|
|
1518
1521
|
onClick: () => v(!0),
|
|
1519
1522
|
children: [
|
|
1520
1523
|
"Edit ",
|
|
1521
|
-
`${
|
|
1524
|
+
`${T ? T.name : "repeat component"}`
|
|
1522
1525
|
]
|
|
1523
1526
|
}
|
|
1524
1527
|
),
|
|
@@ -1535,7 +1538,7 @@ function Vi({
|
|
|
1535
1538
|
allowDataInference: l,
|
|
1536
1539
|
property: x,
|
|
1537
1540
|
includeIdAndName: !1,
|
|
1538
|
-
onPropertyChanged:
|
|
1541
|
+
onPropertyChanged: P,
|
|
1539
1542
|
forceShowErrors: t,
|
|
1540
1543
|
propertyConfigs: o,
|
|
1541
1544
|
collectionEditable: d
|
|
@@ -1557,13 +1560,13 @@ const Ii = Y.forwardRef(
|
|
|
1557
1560
|
isNewProperty: o
|
|
1558
1561
|
}, d) {
|
|
1559
1562
|
const {
|
|
1560
|
-
errors:
|
|
1561
|
-
values:
|
|
1563
|
+
errors: u,
|
|
1564
|
+
values: p,
|
|
1562
1565
|
setFieldValue: h,
|
|
1563
1566
|
setFieldTouched: m,
|
|
1564
1567
|
touched: c,
|
|
1565
1568
|
validate: g
|
|
1566
|
-
} = K(), v = "name", x = r && I(
|
|
1569
|
+
} = K(), v = "name", x = r && I(u, v), y = "id", P = r && I(u, y), T = "description", b = r && I(u, T);
|
|
1567
1570
|
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
1568
1571
|
/* @__PURE__ */ a("div", { children: [
|
|
1569
1572
|
/* @__PURE__ */ e(
|
|
@@ -1571,11 +1574,11 @@ const Ii = Y.forwardRef(
|
|
|
1571
1574
|
{
|
|
1572
1575
|
name: v,
|
|
1573
1576
|
inputRef: d,
|
|
1574
|
-
as:
|
|
1575
|
-
value:
|
|
1576
|
-
onChange: (
|
|
1577
|
-
const
|
|
1578
|
-
!I(c, y) && l && h(y,
|
|
1577
|
+
as: Z,
|
|
1578
|
+
value: p[v],
|
|
1579
|
+
onChange: (C) => {
|
|
1580
|
+
const N = C.target.value;
|
|
1581
|
+
!I(c, y) && l && h(y, N ? Pt(N) : "", !1), h(v, N, !0), m(v, !0);
|
|
1579
1582
|
},
|
|
1580
1583
|
style: { fontSize: 20 },
|
|
1581
1584
|
placeholder: "Field name",
|
|
@@ -1591,27 +1594,27 @@ const Ii = Y.forwardRef(
|
|
|
1591
1594
|
H,
|
|
1592
1595
|
{
|
|
1593
1596
|
name: y,
|
|
1594
|
-
as:
|
|
1597
|
+
as: Z,
|
|
1595
1598
|
label: "ID",
|
|
1596
|
-
value:
|
|
1597
|
-
onChange: (
|
|
1598
|
-
const
|
|
1599
|
-
!I(c, v) && l && h(v,
|
|
1599
|
+
value: p[y],
|
|
1600
|
+
onChange: (C) => {
|
|
1601
|
+
const N = C.target.value;
|
|
1602
|
+
!I(c, v) && l && h(v, N ? ut(N) : ""), h(y, N, !0), m(y, !0);
|
|
1600
1603
|
},
|
|
1601
1604
|
disabled: n || i,
|
|
1602
1605
|
required: !0,
|
|
1603
1606
|
size: "small",
|
|
1604
|
-
error: !!
|
|
1607
|
+
error: !!P
|
|
1605
1608
|
}
|
|
1606
1609
|
),
|
|
1607
|
-
/* @__PURE__ */ e(X, { error: !!
|
|
1610
|
+
/* @__PURE__ */ e(X, { error: !!P, children: P })
|
|
1608
1611
|
] }),
|
|
1609
1612
|
/* @__PURE__ */ a("div", { children: [
|
|
1610
1613
|
/* @__PURE__ */ e(
|
|
1611
1614
|
H,
|
|
1612
1615
|
{
|
|
1613
|
-
name:
|
|
1614
|
-
as:
|
|
1616
|
+
name: T,
|
|
1617
|
+
as: Z,
|
|
1615
1618
|
label: "Description",
|
|
1616
1619
|
disabled: i,
|
|
1617
1620
|
error: !!b
|
|
@@ -1721,43 +1724,45 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1721
1724
|
const {
|
|
1722
1725
|
values: o,
|
|
1723
1726
|
setFieldValue: d
|
|
1724
|
-
} = K(), [
|
|
1725
|
-
id:
|
|
1726
|
-
property:
|
|
1727
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [c, g] = $(), v = ({
|
|
1728
|
+
id: C,
|
|
1729
|
+
property: N
|
|
1727
1730
|
}) => {
|
|
1728
|
-
if (!
|
|
1731
|
+
if (!C)
|
|
1729
1732
|
throw Error();
|
|
1730
1733
|
d("oneOf.properties", {
|
|
1731
1734
|
...o.oneOf?.properties ?? {},
|
|
1732
|
-
[
|
|
1733
|
-
}, !1)
|
|
1734
|
-
|
|
1735
|
-
|
|
1735
|
+
[C]: N
|
|
1736
|
+
}, !1);
|
|
1737
|
+
const f = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), w = f.includes(C) ? f : [...f, C];
|
|
1738
|
+
d("oneOf.propertiesOrder", w, !1), p(!1);
|
|
1739
|
+
}, x = h ? ae(h, c) : void 0, y = x ? I(o.oneOf?.properties, x.replaceAll(".", ".properties.")) : void 0, P = Q((C, N) => {
|
|
1740
|
+
const f = C ? ae(C, N) : void 0;
|
|
1736
1741
|
if (!f)
|
|
1737
1742
|
throw Error("collection editor miss config");
|
|
1738
1743
|
d(`oneOf.${pe(f)}`, void 0, !1);
|
|
1739
|
-
const
|
|
1740
|
-
d(
|
|
1741
|
-
}, [d, o]),
|
|
1744
|
+
const w = `oneOf.${ye(N)}`, _ = I(o, w);
|
|
1745
|
+
d(w, _.filter((M) => M !== C), !1), p(!1), m(void 0), g(void 0);
|
|
1746
|
+
}, [d, o]), T = /* @__PURE__ */ a(
|
|
1742
1747
|
z,
|
|
1743
1748
|
{
|
|
1744
1749
|
autoFocus: !0,
|
|
1745
1750
|
color: "primary",
|
|
1746
|
-
onClick: () =>
|
|
1751
|
+
onClick: () => p(!0),
|
|
1747
1752
|
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
1748
1753
|
children: [
|
|
1749
1754
|
"Add property to ",
|
|
1750
1755
|
o.name ?? "this block"
|
|
1751
1756
|
]
|
|
1752
1757
|
}
|
|
1753
|
-
), b =
|
|
1754
|
-
d(`oneOf.${ye(
|
|
1758
|
+
), b = Q((C, N) => {
|
|
1759
|
+
d(`oneOf.${ye(N)}`, C, !1);
|
|
1755
1760
|
}, []);
|
|
1756
1761
|
return /* @__PURE__ */ a(U, { children: [
|
|
1757
1762
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1758
1763
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end mt-8 mb-4", children: [
|
|
1759
|
-
/* @__PURE__ */ e(
|
|
1760
|
-
|
|
1764
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Properties in this block" }),
|
|
1765
|
+
T
|
|
1761
1766
|
] }),
|
|
1762
1767
|
/* @__PURE__ */ a(Ce, { className: "p-2 pl-8", children: [
|
|
1763
1768
|
/* @__PURE__ */ e(
|
|
@@ -1767,8 +1772,8 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1767
1772
|
propertiesOrder: o.oneOf?.propertiesOrder,
|
|
1768
1773
|
errors: {},
|
|
1769
1774
|
collectionEditable: l,
|
|
1770
|
-
onPropertyClick: t ? void 0 : (
|
|
1771
|
-
m(
|
|
1775
|
+
onPropertyClick: t ? void 0 : (C, N) => {
|
|
1776
|
+
m(C), g(N), p(!0);
|
|
1772
1777
|
},
|
|
1773
1778
|
onPropertyMove: t ? void 0 : b
|
|
1774
1779
|
}
|
|
@@ -1781,17 +1786,17 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1781
1786
|
{
|
|
1782
1787
|
inArray: !1,
|
|
1783
1788
|
forceShowErrors: !1,
|
|
1784
|
-
open:
|
|
1789
|
+
open: u,
|
|
1785
1790
|
getData: r,
|
|
1786
1791
|
allowDataInference: n,
|
|
1787
1792
|
onCancel: () => {
|
|
1788
|
-
|
|
1793
|
+
p(!1), m(void 0), g(void 0);
|
|
1789
1794
|
},
|
|
1790
1795
|
onOkClicked: () => {
|
|
1791
|
-
|
|
1796
|
+
p(!1), m(void 0), g(void 0);
|
|
1792
1797
|
},
|
|
1793
1798
|
collectionEditable: l,
|
|
1794
|
-
onDelete:
|
|
1799
|
+
onDelete: P,
|
|
1795
1800
|
propertyKey: h,
|
|
1796
1801
|
propertyNamespace: c,
|
|
1797
1802
|
property: y,
|
|
@@ -1813,7 +1818,7 @@ function Ei({ disabled: t }) {
|
|
|
1813
1818
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
1814
1819
|
/* @__PURE__ */ e(Se, { disabled: t }),
|
|
1815
1820
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1816
|
-
|
|
1821
|
+
Z,
|
|
1817
1822
|
{
|
|
1818
1823
|
value: I(r, i),
|
|
1819
1824
|
label: "Min value",
|
|
@@ -1825,7 +1830,7 @@ function Ei({ disabled: t }) {
|
|
|
1825
1830
|
}
|
|
1826
1831
|
) }),
|
|
1827
1832
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1828
|
-
|
|
1833
|
+
Z,
|
|
1829
1834
|
{
|
|
1830
1835
|
value: I(r, l),
|
|
1831
1836
|
label: "Max value",
|
|
@@ -1837,7 +1842,7 @@ function Ei({ disabled: t }) {
|
|
|
1837
1842
|
}
|
|
1838
1843
|
) }),
|
|
1839
1844
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1840
|
-
|
|
1845
|
+
Z,
|
|
1841
1846
|
{
|
|
1842
1847
|
value: I(r, o),
|
|
1843
1848
|
label: "Less than",
|
|
@@ -1849,7 +1854,7 @@ function Ei({ disabled: t }) {
|
|
|
1849
1854
|
}
|
|
1850
1855
|
) }),
|
|
1851
1856
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1852
|
-
|
|
1857
|
+
Z,
|
|
1853
1858
|
{
|
|
1854
1859
|
value: I(r, d),
|
|
1855
1860
|
label: "More than",
|
|
@@ -1942,12 +1947,12 @@ function jt({
|
|
|
1942
1947
|
} = K();
|
|
1943
1948
|
if (!Pe())
|
|
1944
1949
|
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(De, {}) });
|
|
1945
|
-
const
|
|
1950
|
+
const p = r ? "of.path" : "path", h = I(l, p), m = i && I(d, p);
|
|
1946
1951
|
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1947
1952
|
H,
|
|
1948
1953
|
{
|
|
1949
|
-
name:
|
|
1950
|
-
pathPath:
|
|
1954
|
+
name: p,
|
|
1955
|
+
pathPath: p,
|
|
1951
1956
|
type: "select",
|
|
1952
1957
|
disabled: t || n,
|
|
1953
1958
|
value: h,
|
|
@@ -1968,9 +1973,9 @@ function Di({
|
|
|
1968
1973
|
const d = Pe();
|
|
1969
1974
|
if (!d)
|
|
1970
1975
|
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(De, {}) });
|
|
1971
|
-
const
|
|
1972
|
-
Object.values(
|
|
1973
|
-
).values()), h =
|
|
1976
|
+
const u = d?.collections ?? [], p = Array.from(new Set(
|
|
1977
|
+
Object.values(u).map((m) => m.group).filter(Boolean)
|
|
1978
|
+
).values()), h = u.filter((m) => !m.group);
|
|
1974
1979
|
return /* @__PURE__ */ a(U, { children: [
|
|
1975
1980
|
/* @__PURE__ */ a(
|
|
1976
1981
|
be,
|
|
@@ -1983,11 +1988,11 @@ function Di({
|
|
|
1983
1988
|
onChange: i,
|
|
1984
1989
|
label: "Target collection",
|
|
1985
1990
|
renderValue: (m) => {
|
|
1986
|
-
const c =
|
|
1991
|
+
const c = u.find((g) => g.id === m || g.path === m);
|
|
1987
1992
|
return c ? /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
1988
1993
|
/* @__PURE__ */ e(ot, { collectionOrView: c }),
|
|
1989
1994
|
/* @__PURE__ */ e(
|
|
1990
|
-
|
|
1995
|
+
O,
|
|
1991
1996
|
{
|
|
1992
1997
|
variant: "subtitle2",
|
|
1993
1998
|
className: "font-medium ml-4",
|
|
@@ -1998,18 +2003,18 @@ function Di({
|
|
|
1998
2003
|
},
|
|
1999
2004
|
...o,
|
|
2000
2005
|
children: [
|
|
2001
|
-
|
|
2006
|
+
p.flatMap((m) => /* @__PURE__ */ e(
|
|
2002
2007
|
At,
|
|
2003
2008
|
{
|
|
2004
2009
|
label: m || "Views",
|
|
2005
|
-
children:
|
|
2010
|
+
children: u.filter((c) => c.group === m).map((c) => /* @__PURE__ */ e(
|
|
2006
2011
|
ee,
|
|
2007
2012
|
{
|
|
2008
2013
|
value: c.id ?? c.path,
|
|
2009
2014
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2010
2015
|
/* @__PURE__ */ e(ot, { collectionOrView: c }),
|
|
2011
2016
|
/* @__PURE__ */ e(
|
|
2012
|
-
|
|
2017
|
+
O,
|
|
2013
2018
|
{
|
|
2014
2019
|
variant: "subtitle2",
|
|
2015
2020
|
className: "font-medium ml-4",
|
|
@@ -2030,7 +2035,7 @@ function Di({
|
|
|
2030
2035
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2031
2036
|
/* @__PURE__ */ e(ot, { collectionOrView: m }),
|
|
2032
2037
|
/* @__PURE__ */ e(
|
|
2033
|
-
|
|
2038
|
+
O,
|
|
2034
2039
|
{
|
|
2035
2040
|
variant: "subtitle2",
|
|
2036
2041
|
className: "font-medium ml-4",
|
|
@@ -2053,7 +2058,7 @@ function Bi({ disabled: t }) {
|
|
|
2053
2058
|
errors: n,
|
|
2054
2059
|
touched: i,
|
|
2055
2060
|
setFieldValue: l
|
|
2056
|
-
} = K(), o = "mode", d = I(r, o),
|
|
2061
|
+
} = K(), o = "mode", d = I(r, o), u = I(i, o) && I(n, o), p = "autoValue", h = I(r, p), m = I(i, p) && I(n, p);
|
|
2057
2062
|
return /* @__PURE__ */ a(U, { children: [
|
|
2058
2063
|
/* @__PURE__ */ a("div", { className: "flex flex-col col-span-12", children: [
|
|
2059
2064
|
/* @__PURE__ */ a(
|
|
@@ -2061,7 +2066,7 @@ function Bi({ disabled: t }) {
|
|
|
2061
2066
|
{
|
|
2062
2067
|
name: o,
|
|
2063
2068
|
value: d ?? "date",
|
|
2064
|
-
error: !!
|
|
2069
|
+
error: !!u,
|
|
2065
2070
|
onValueChange: (c) => l(o, c),
|
|
2066
2071
|
label: "Mode",
|
|
2067
2072
|
renderValue: (c) => {
|
|
@@ -2081,14 +2086,14 @@ function Bi({ disabled: t }) {
|
|
|
2081
2086
|
]
|
|
2082
2087
|
}
|
|
2083
2088
|
),
|
|
2084
|
-
/* @__PURE__ */ e(X, { error: !!
|
|
2089
|
+
/* @__PURE__ */ e(X, { error: !!u, children: u }),
|
|
2085
2090
|
/* @__PURE__ */ a(
|
|
2086
2091
|
be,
|
|
2087
2092
|
{
|
|
2088
|
-
name:
|
|
2093
|
+
name: p,
|
|
2089
2094
|
disabled: t,
|
|
2090
2095
|
value: h ?? "",
|
|
2091
|
-
onValueChange: (c) => l(
|
|
2096
|
+
onValueChange: (c) => l(p, c),
|
|
2092
2097
|
renderValue: (c) => {
|
|
2093
2098
|
switch (c) {
|
|
2094
2099
|
case "on_create":
|
|
@@ -2378,7 +2383,7 @@ function or({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
|
2378
2383
|
/* @__PURE__ */ a("div", { children: [
|
|
2379
2384
|
/* @__PURE__ */ e("div", { children: n.name }),
|
|
2380
2385
|
/* @__PURE__ */ e(
|
|
2381
|
-
|
|
2386
|
+
O,
|
|
2382
2387
|
{
|
|
2383
2388
|
variant: "caption",
|
|
2384
2389
|
color: "disabled",
|
|
@@ -2482,8 +2487,8 @@ const Ui = [
|
|
|
2482
2487
|
existingProperty: l,
|
|
2483
2488
|
autoUpdateId: o,
|
|
2484
2489
|
inArray: d,
|
|
2485
|
-
propertyKey:
|
|
2486
|
-
existingPropertyKeys:
|
|
2490
|
+
propertyKey: u,
|
|
2491
|
+
existingPropertyKeys: p,
|
|
2487
2492
|
propertyNamespace: h,
|
|
2488
2493
|
property: m,
|
|
2489
2494
|
onPropertyChanged: c,
|
|
@@ -2491,88 +2496,88 @@ const Ui = [
|
|
|
2491
2496
|
onDelete: v,
|
|
2492
2497
|
onError: x,
|
|
2493
2498
|
initialErrors: y,
|
|
2494
|
-
forceShowErrors:
|
|
2495
|
-
allowDataInference:
|
|
2499
|
+
forceShowErrors: P,
|
|
2500
|
+
allowDataInference: T,
|
|
2496
2501
|
getController: b,
|
|
2497
|
-
getData:
|
|
2498
|
-
propertyConfigs:
|
|
2502
|
+
getData: C,
|
|
2503
|
+
propertyConfigs: N,
|
|
2499
2504
|
collectionEditable: f
|
|
2500
|
-
} = r,
|
|
2505
|
+
} = r, w = {
|
|
2501
2506
|
id: "",
|
|
2502
2507
|
name: ""
|
|
2503
|
-
}, _ = !!(m && !qe(m)) && !f,
|
|
2504
|
-
id:
|
|
2505
|
-
previousId:
|
|
2508
|
+
}, _ = !!(m && !qe(m)) && !f, M = Le(m ? {
|
|
2509
|
+
id: u,
|
|
2510
|
+
previousId: u,
|
|
2506
2511
|
property: m
|
|
2507
|
-
} : void 0),
|
|
2508
|
-
id:
|
|
2512
|
+
} : void 0), R = ({
|
|
2513
|
+
id: A,
|
|
2509
2514
|
property: s
|
|
2510
2515
|
}) => {
|
|
2511
2516
|
const V = {
|
|
2512
|
-
id:
|
|
2513
|
-
previousId:
|
|
2517
|
+
id: A,
|
|
2518
|
+
previousId: M.current?.id,
|
|
2514
2519
|
property: s,
|
|
2515
2520
|
namespace: h
|
|
2516
2521
|
};
|
|
2517
|
-
|
|
2518
|
-
},
|
|
2519
|
-
initialValues: m ? { id:
|
|
2522
|
+
M.current = V, c?.(V);
|
|
2523
|
+
}, D = Tt({
|
|
2524
|
+
initialValues: m ? { id: u, ...m } : w,
|
|
2520
2525
|
initialErrors: y,
|
|
2521
2526
|
validateOnChange: !0,
|
|
2522
2527
|
validateOnInitialRender: !0,
|
|
2523
|
-
onSubmit: (
|
|
2524
|
-
console.debug("onSubmit",
|
|
2528
|
+
onSubmit: (A, s) => {
|
|
2529
|
+
console.debug("onSubmit", A);
|
|
2525
2530
|
const {
|
|
2526
2531
|
id: V,
|
|
2527
2532
|
...G
|
|
2528
|
-
} =
|
|
2529
|
-
|
|
2533
|
+
} = A;
|
|
2534
|
+
R({
|
|
2530
2535
|
id: V,
|
|
2531
2536
|
property: { ...G, editable: G.editable ?? !0 }
|
|
2532
|
-
}), l || s.resetForm({ values:
|
|
2537
|
+
}), l || s.resetForm({ values: w });
|
|
2533
2538
|
},
|
|
2534
|
-
validation: (
|
|
2539
|
+
validation: (A) => {
|
|
2535
2540
|
const s = {};
|
|
2536
2541
|
if (n) {
|
|
2537
|
-
if (!
|
|
2542
|
+
if (!A.name)
|
|
2538
2543
|
s.name = "Required";
|
|
2539
2544
|
else {
|
|
2540
|
-
const V = $i(
|
|
2545
|
+
const V = $i(A.name);
|
|
2541
2546
|
V && (s.name = V);
|
|
2542
2547
|
}
|
|
2543
|
-
if (!
|
|
2548
|
+
if (!A.id)
|
|
2544
2549
|
s.id = "Required";
|
|
2545
2550
|
else {
|
|
2546
|
-
const V = qi(
|
|
2551
|
+
const V = qi(A.id, p);
|
|
2547
2552
|
V && (s.id = V);
|
|
2548
2553
|
}
|
|
2549
2554
|
}
|
|
2550
|
-
return
|
|
2555
|
+
return A.dataType === "string" && A.validation?.matches && !Pr(A.validation?.matches.toString()) && (s.validation = {
|
|
2551
2556
|
matches: "Invalid regular expression"
|
|
2552
|
-
}),
|
|
2557
|
+
}), A.dataType === "reference" && !A.path && (s.path = "You must specify a target collection for the field"), A.propertyConfig === "repeat" && (A.of || (s.of = "You need to specify a repeat field")), A.propertyConfig === "block" && (A.oneOf || (s.oneOf = "You need to specify the properties of this block")), s;
|
|
2553
2558
|
}
|
|
2554
2559
|
});
|
|
2555
2560
|
return ce(() => {
|
|
2556
|
-
b?.(
|
|
2557
|
-
}, [
|
|
2561
|
+
b?.(D);
|
|
2562
|
+
}, [D, b]), /* @__PURE__ */ e(kt, { value: D, children: /* @__PURE__ */ e(
|
|
2558
2563
|
ji,
|
|
2559
2564
|
{
|
|
2560
|
-
onPropertyChanged: g ?
|
|
2565
|
+
onPropertyChanged: g ? R : void 0,
|
|
2561
2566
|
onDelete: v,
|
|
2562
2567
|
includeIdAndTitle: n,
|
|
2563
2568
|
propertyNamespace: h,
|
|
2564
2569
|
onError: x,
|
|
2565
|
-
showErrors:
|
|
2570
|
+
showErrors: P || D.submitCount > 0,
|
|
2566
2571
|
existing: l,
|
|
2567
2572
|
autoUpdateId: o,
|
|
2568
2573
|
inArray: d,
|
|
2569
2574
|
autoOpenTypeSelect: i,
|
|
2570
2575
|
disabled: _,
|
|
2571
|
-
getData:
|
|
2572
|
-
allowDataInference:
|
|
2573
|
-
propertyConfigs:
|
|
2576
|
+
getData: C,
|
|
2577
|
+
allowDataInference: T,
|
|
2578
|
+
propertyConfigs: N,
|
|
2574
2579
|
collectionEditable: f,
|
|
2575
|
-
...
|
|
2580
|
+
...D
|
|
2576
2581
|
}
|
|
2577
2582
|
) });
|
|
2578
2583
|
},
|
|
@@ -2587,7 +2592,7 @@ function Ve({
|
|
|
2587
2592
|
collectionEditable: o,
|
|
2588
2593
|
...d
|
|
2589
2594
|
}) {
|
|
2590
|
-
const
|
|
2595
|
+
const u = Le();
|
|
2591
2596
|
return /* @__PURE__ */ e(
|
|
2592
2597
|
Fe,
|
|
2593
2598
|
{
|
|
@@ -2600,7 +2605,7 @@ function Ve({
|
|
|
2600
2605
|
noValidate: !0,
|
|
2601
2606
|
autoComplete: "off",
|
|
2602
2607
|
onSubmit: (h) => {
|
|
2603
|
-
h.preventDefault(), h.stopPropagation(),
|
|
2608
|
+
h.preventDefault(), h.stopPropagation(), u.current?.handleSubmit(h);
|
|
2604
2609
|
},
|
|
2605
2610
|
children: [
|
|
2606
2611
|
/* @__PURE__ */ e(Be, { children: /* @__PURE__ */ e(
|
|
@@ -2613,7 +2618,7 @@ function Ve({
|
|
|
2613
2618
|
collectionEditable: o,
|
|
2614
2619
|
onPropertyChangedImmediate: !1,
|
|
2615
2620
|
getController: (h) => {
|
|
2616
|
-
|
|
2621
|
+
u.current = h;
|
|
2617
2622
|
},
|
|
2618
2623
|
getData: l
|
|
2619
2624
|
}
|
|
@@ -2624,7 +2629,7 @@ function Ve({
|
|
|
2624
2629
|
{
|
|
2625
2630
|
variant: "text",
|
|
2626
2631
|
onClick: () => {
|
|
2627
|
-
r(),
|
|
2632
|
+
r(), u.current?.resetForm();
|
|
2628
2633
|
},
|
|
2629
2634
|
children: "Cancel"
|
|
2630
2635
|
}
|
|
@@ -2653,8 +2658,8 @@ function ji({
|
|
|
2653
2658
|
autoUpdateId: l = !1,
|
|
2654
2659
|
autoOpenTypeSelect: o,
|
|
2655
2660
|
includeIdAndTitle: d,
|
|
2656
|
-
onPropertyChanged:
|
|
2657
|
-
onDelete:
|
|
2661
|
+
onPropertyChanged: u,
|
|
2662
|
+
onDelete: p,
|
|
2658
2663
|
propertyNamespace: h,
|
|
2659
2664
|
onError: m,
|
|
2660
2665
|
showErrors: c,
|
|
@@ -2662,45 +2667,45 @@ function ji({
|
|
|
2662
2667
|
inArray: v,
|
|
2663
2668
|
getData: x,
|
|
2664
2669
|
allowDataInference: y,
|
|
2665
|
-
propertyConfigs:
|
|
2666
|
-
collectionEditable:
|
|
2670
|
+
propertyConfigs: P,
|
|
2671
|
+
collectionEditable: T
|
|
2667
2672
|
}) {
|
|
2668
|
-
const [b,
|
|
2673
|
+
const [b, C] = $(o), [N, f] = $(!1), [w, _] = $(t?.dataType ? Kt(t) : void 0), M = Object.entries(lr).concat(Object.entries(P)), R = v ? M.filter(([q, L]) => !ne(L.property) && L.property?.dataType !== "array") : M, D = Ir(t), A = Le(null), s = Le(t), V = c && I(r, "selectedWidget");
|
|
2669
2674
|
ce(() => {
|
|
2670
|
-
if (
|
|
2675
|
+
if (u && (!d || D.id)) {
|
|
2671
2676
|
const {
|
|
2672
2677
|
id: q,
|
|
2673
2678
|
...L
|
|
2674
|
-
} =
|
|
2675
|
-
ve(
|
|
2679
|
+
} = D;
|
|
2680
|
+
ve(D, s.current) || (u({
|
|
2676
2681
|
id: q,
|
|
2677
2682
|
property: L,
|
|
2678
2683
|
namespace: h
|
|
2679
|
-
}), s.current =
|
|
2684
|
+
}), s.current = D);
|
|
2680
2685
|
}
|
|
2681
|
-
}, [
|
|
2686
|
+
}, [D, d, u, h]), ce(() => {
|
|
2682
2687
|
t?.id && m && m(t?.id, h, r);
|
|
2683
2688
|
}, [r, m, h, t?.id]);
|
|
2684
2689
|
const G = (q) => {
|
|
2685
|
-
_(q), n(ar(t, q,
|
|
2686
|
-
|
|
2690
|
+
_(q), n(ar(t, q, P)), setTimeout(() => {
|
|
2691
|
+
A.current?.focus();
|
|
2687
2692
|
}, 0);
|
|
2688
2693
|
};
|
|
2689
|
-
let
|
|
2690
|
-
return
|
|
2694
|
+
let B;
|
|
2695
|
+
return w === "text_field" || w === "multiline" || w === "markdown" || w === "email" ? B = /* @__PURE__ */ e(
|
|
2691
2696
|
_i,
|
|
2692
2697
|
{
|
|
2693
|
-
widgetId:
|
|
2698
|
+
widgetId: w,
|
|
2694
2699
|
disabled: g,
|
|
2695
2700
|
showErrors: c
|
|
2696
2701
|
}
|
|
2697
|
-
) :
|
|
2702
|
+
) : w === "url" ? B = /* @__PURE__ */ e(
|
|
2698
2703
|
Ri,
|
|
2699
2704
|
{
|
|
2700
2705
|
disabled: g,
|
|
2701
2706
|
showErrors: c
|
|
2702
2707
|
}
|
|
2703
|
-
) :
|
|
2708
|
+
) : w === "select" || w === "number_select" ? B = /* @__PURE__ */ e(
|
|
2704
2709
|
Rt,
|
|
2705
2710
|
{
|
|
2706
2711
|
multiselect: !1,
|
|
@@ -2710,7 +2715,7 @@ function ji({
|
|
|
2710
2715
|
getData: x,
|
|
2711
2716
|
showErrors: c
|
|
2712
2717
|
}
|
|
2713
|
-
) :
|
|
2718
|
+
) : w === "multi_select" || w === "multi_number_select" ? B = /* @__PURE__ */ e(
|
|
2714
2719
|
Rt,
|
|
2715
2720
|
{
|
|
2716
2721
|
multiselect: !0,
|
|
@@ -2720,39 +2725,39 @@ function ji({
|
|
|
2720
2725
|
getData: x,
|
|
2721
2726
|
showErrors: c
|
|
2722
2727
|
}
|
|
2723
|
-
) :
|
|
2728
|
+
) : w === "file_upload" ? B = /* @__PURE__ */ e(
|
|
2724
2729
|
Ut,
|
|
2725
2730
|
{
|
|
2726
2731
|
existing: i,
|
|
2727
2732
|
multiple: !1,
|
|
2728
2733
|
disabled: g
|
|
2729
2734
|
}
|
|
2730
|
-
) :
|
|
2735
|
+
) : w === "multi_file_upload" ? B = /* @__PURE__ */ e(
|
|
2731
2736
|
Ut,
|
|
2732
2737
|
{
|
|
2733
2738
|
existing: i,
|
|
2734
2739
|
multiple: !0,
|
|
2735
2740
|
disabled: g
|
|
2736
2741
|
}
|
|
2737
|
-
) :
|
|
2742
|
+
) : w === "switch" ? B = /* @__PURE__ */ e(Fi, { disabled: g }) : w === "number_input" ? B = /* @__PURE__ */ e(Ai, { disabled: g }) : w === "group" ? B = /* @__PURE__ */ e(
|
|
2738
2743
|
Oi,
|
|
2739
2744
|
{
|
|
2740
2745
|
disabled: g,
|
|
2741
2746
|
getData: x,
|
|
2742
2747
|
allowDataInference: y,
|
|
2743
|
-
collectionEditable:
|
|
2744
|
-
propertyConfigs:
|
|
2748
|
+
collectionEditable: T,
|
|
2749
|
+
propertyConfigs: P
|
|
2745
2750
|
}
|
|
2746
|
-
) :
|
|
2751
|
+
) : w === "block" ? B = /* @__PURE__ */ e(
|
|
2747
2752
|
Si,
|
|
2748
2753
|
{
|
|
2749
2754
|
disabled: g,
|
|
2750
2755
|
getData: x,
|
|
2751
2756
|
allowDataInference: y,
|
|
2752
|
-
collectionEditable:
|
|
2753
|
-
propertyConfigs:
|
|
2757
|
+
collectionEditable: T,
|
|
2758
|
+
propertyConfigs: P
|
|
2754
2759
|
}
|
|
2755
|
-
) :
|
|
2760
|
+
) : w === "reference" ? B = /* @__PURE__ */ e(
|
|
2756
2761
|
jt,
|
|
2757
2762
|
{
|
|
2758
2763
|
showErrors: c,
|
|
@@ -2760,7 +2765,7 @@ function ji({
|
|
|
2760
2765
|
multiple: !1,
|
|
2761
2766
|
disabled: g
|
|
2762
2767
|
}
|
|
2763
|
-
) :
|
|
2768
|
+
) : w === "date_time" ? B = /* @__PURE__ */ e(Bi, { disabled: g }) : w === "multi_references" ? B = /* @__PURE__ */ e(
|
|
2764
2769
|
jt,
|
|
2765
2770
|
{
|
|
2766
2771
|
showErrors: c,
|
|
@@ -2768,7 +2773,7 @@ function ji({
|
|
|
2768
2773
|
multiple: !0,
|
|
2769
2774
|
disabled: g
|
|
2770
2775
|
}
|
|
2771
|
-
) :
|
|
2776
|
+
) : w === "repeat" ? B = /* @__PURE__ */ e(
|
|
2772
2777
|
Vi,
|
|
2773
2778
|
{
|
|
2774
2779
|
showErrors: c,
|
|
@@ -2776,13 +2781,13 @@ function ji({
|
|
|
2776
2781
|
getData: x,
|
|
2777
2782
|
allowDataInference: y,
|
|
2778
2783
|
disabled: g,
|
|
2779
|
-
collectionEditable:
|
|
2780
|
-
propertyConfigs:
|
|
2784
|
+
collectionEditable: T,
|
|
2785
|
+
propertyConfigs: P
|
|
2781
2786
|
}
|
|
2782
|
-
) :
|
|
2787
|
+
) : w === "key_value" ? B = /* @__PURE__ */ e(Mi, { disabled: g }) : B = null, /* @__PURE__ */ a(U, { children: [
|
|
2783
2788
|
g && /* @__PURE__ */ a(Lr, { mode: "warn", children: [
|
|
2784
|
-
/* @__PURE__ */ e(
|
|
2785
|
-
/* @__PURE__ */ a(
|
|
2789
|
+
/* @__PURE__ */ e(O, { children: "This property can't be edited" }),
|
|
2790
|
+
/* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
2786
2791
|
"You may not have permission to edit it or it is defined in code with no ",
|
|
2787
2792
|
/* @__PURE__ */ e("code", { children: "editable" }),
|
|
2788
2793
|
" flag"
|
|
@@ -2794,16 +2799,16 @@ function ji({
|
|
|
2794
2799
|
be,
|
|
2795
2800
|
{
|
|
2796
2801
|
error: !!V,
|
|
2797
|
-
value:
|
|
2802
|
+
value: w ?? "",
|
|
2798
2803
|
placeholder: "Select a property widget",
|
|
2799
2804
|
open: b,
|
|
2800
|
-
onOpenChange:
|
|
2805
|
+
onOpenChange: C,
|
|
2801
2806
|
position: "item-aligned",
|
|
2802
2807
|
disabled: g,
|
|
2803
2808
|
renderValue: (q) => {
|
|
2804
2809
|
if (!q)
|
|
2805
2810
|
return /* @__PURE__ */ e("em", { children: "Select a property widget" });
|
|
2806
|
-
const L = q,
|
|
2811
|
+
const L = q, J = Gt[L] ?? P[L], le = J.property, Me = le && !ne(le) ? $e(le, P) : void 0, we = ne(le) || i && le.dataType !== t?.dataType, de = Me ? W(Me, J) : J;
|
|
2807
2812
|
return /* @__PURE__ */ a(
|
|
2808
2813
|
"div",
|
|
2809
2814
|
{
|
|
@@ -2819,7 +2824,7 @@ function ji({
|
|
|
2819
2824
|
/* @__PURE__ */ a("div", { className: "flex flex-col items-start text-base text-left", children: [
|
|
2820
2825
|
/* @__PURE__ */ e("div", { children: de.name }),
|
|
2821
2826
|
/* @__PURE__ */ e(
|
|
2822
|
-
|
|
2827
|
+
O,
|
|
2823
2828
|
{
|
|
2824
2829
|
variant: "caption",
|
|
2825
2830
|
color: "disabled",
|
|
@@ -2834,8 +2839,8 @@ function ji({
|
|
|
2834
2839
|
onValueChange: (q) => {
|
|
2835
2840
|
G(q);
|
|
2836
2841
|
},
|
|
2837
|
-
children:
|
|
2838
|
-
const
|
|
2842
|
+
children: R.map(([q, L]) => {
|
|
2843
|
+
const J = L.property, le = i && !ne(J) && J.dataType !== t?.dataType;
|
|
2839
2844
|
return /* @__PURE__ */ e(
|
|
2840
2845
|
or,
|
|
2841
2846
|
{
|
|
@@ -2850,7 +2855,7 @@ function ji({
|
|
|
2850
2855
|
}
|
|
2851
2856
|
),
|
|
2852
2857
|
V && /* @__PURE__ */ e(
|
|
2853
|
-
|
|
2858
|
+
O,
|
|
2854
2859
|
{
|
|
2855
2860
|
variant: "caption",
|
|
2856
2861
|
className: "ml-3.5",
|
|
@@ -2859,7 +2864,7 @@ function ji({
|
|
|
2859
2864
|
}
|
|
2860
2865
|
)
|
|
2861
2866
|
] }),
|
|
2862
|
-
|
|
2867
|
+
p && t?.id && /* @__PURE__ */ e(
|
|
2863
2868
|
oe,
|
|
2864
2869
|
{
|
|
2865
2870
|
variant: "ghost",
|
|
@@ -2879,17 +2884,17 @@ function ji({
|
|
|
2879
2884
|
isNewProperty: !i,
|
|
2880
2885
|
disabled: g,
|
|
2881
2886
|
autoUpdateId: l,
|
|
2882
|
-
ref:
|
|
2887
|
+
ref: A
|
|
2883
2888
|
}
|
|
2884
2889
|
),
|
|
2885
|
-
|
|
2890
|
+
B,
|
|
2886
2891
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(zi, { disabled: g }) })
|
|
2887
2892
|
] }),
|
|
2888
|
-
|
|
2893
|
+
p && /* @__PURE__ */ e(
|
|
2889
2894
|
lt,
|
|
2890
2895
|
{
|
|
2891
|
-
open:
|
|
2892
|
-
onAccept: () =>
|
|
2896
|
+
open: N,
|
|
2897
|
+
onAccept: () => p(t?.id, h),
|
|
2893
2898
|
onCancel: () => f(!1),
|
|
2894
2899
|
title: /* @__PURE__ */ e("div", { children: "Delete this property?" }),
|
|
2895
2900
|
body: /* @__PURE__ */ a("div", { children: [
|
|
@@ -2925,11 +2930,11 @@ const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.s
|
|
|
2925
2930
|
maxWidth: "4xl",
|
|
2926
2931
|
children: [
|
|
2927
2932
|
/* @__PURE__ */ a(Be, { children: [
|
|
2928
|
-
/* @__PURE__ */ a(
|
|
2933
|
+
/* @__PURE__ */ a(O, { variant: "h6", className: "my-4", children: [
|
|
2929
2934
|
"Code for ",
|
|
2930
2935
|
t.name
|
|
2931
2936
|
] }),
|
|
2932
|
-
/* @__PURE__ */ a(
|
|
2937
|
+
/* @__PURE__ */ a(O, { variant: "body2", className: "my-4 mb-8", children: [
|
|
2933
2938
|
"If you want to customise the collection in code, you can add this collection code to your CMS app configuration. More info in the ",
|
|
2934
2939
|
/* @__PURE__ */ e(
|
|
2935
2940
|
"a",
|
|
@@ -2947,7 +2952,7 @@ const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.s
|
|
|
2947
2952
|
theme: si.vsDark,
|
|
2948
2953
|
code: l,
|
|
2949
2954
|
language: "typescript",
|
|
2950
|
-
children: ({ className: o, style: d, tokens:
|
|
2955
|
+
children: ({ className: o, style: d, tokens: u, getLineProps: p, getTokenProps: h }) => /* @__PURE__ */ e("pre", { style: d, className: "p-4 rounded text-sm", children: u.map((m, c) => /* @__PURE__ */ e("div", { ...p({ line: m }), children: m.map((g, v) => /* @__PURE__ */ e("span", { ...h({ token: g }) }, v)) }, c)) })
|
|
2951
2956
|
}
|
|
2952
2957
|
)
|
|
2953
2958
|
] }),
|
|
@@ -3010,8 +3015,8 @@ function Gi({
|
|
|
3010
3015
|
setDirty: l,
|
|
3011
3016
|
reservedGroups: o,
|
|
3012
3017
|
extraIcon: d,
|
|
3013
|
-
getUser:
|
|
3014
|
-
getData:
|
|
3018
|
+
getUser: u,
|
|
3019
|
+
getData: p,
|
|
3015
3020
|
doCollectionInference: h,
|
|
3016
3021
|
propertyConfigs: m,
|
|
3017
3022
|
collectionEditable: c
|
|
@@ -3021,12 +3026,12 @@ function Gi({
|
|
|
3021
3026
|
setFieldValue: v,
|
|
3022
3027
|
setFieldError: x,
|
|
3023
3028
|
setFieldTouched: y,
|
|
3024
|
-
errors:
|
|
3025
|
-
dirty:
|
|
3026
|
-
} = K(), b = Ie(),
|
|
3029
|
+
errors: P,
|
|
3030
|
+
dirty: T
|
|
3031
|
+
} = K(), b = Ie(), C = Nr(), N = !C, [f, w] = $(), [_, M] = $(), [R, D] = $(), A = _ ? ae(_, R) : void 0, s = A ? I(g.properties, A.replaceAll(".", ".properties.")) : void 0, [V, G] = $(!1), [B, q] = $(!1), [L, J] = $(!1), [le, Me] = $([]), we = Y.useRef(g.propertiesOrder ? { "": g.propertiesOrder } : {});
|
|
3027
3032
|
ce(() => {
|
|
3028
|
-
l && l(
|
|
3029
|
-
}, [
|
|
3033
|
+
l && l(T);
|
|
3034
|
+
}, [T]);
|
|
3030
3035
|
const de = h ? () => {
|
|
3031
3036
|
h && (q(!0), h(g).then((F) => {
|
|
3032
3037
|
if (F && pt(F.properties), !F) {
|
|
@@ -3036,7 +3041,7 @@ function Gi({
|
|
|
3036
3041
|
});
|
|
3037
3042
|
return;
|
|
3038
3043
|
}
|
|
3039
|
-
const j = (F.properties ? Object.keys(F.properties) : []).filter((
|
|
3044
|
+
const j = (F.properties ? Object.keys(F.properties) : []).filter((E) => !g.properties[E]);
|
|
3040
3045
|
if (j.length === 0) {
|
|
3041
3046
|
b.open({
|
|
3042
3047
|
type: "info",
|
|
@@ -3044,27 +3049,27 @@ function Gi({
|
|
|
3044
3049
|
});
|
|
3045
3050
|
return;
|
|
3046
3051
|
}
|
|
3047
|
-
const
|
|
3048
|
-
...j.reduce((
|
|
3052
|
+
const k = {
|
|
3053
|
+
...j.reduce((E, ie) => (E[ie] = (F.properties ?? {})[ie], E), {}),
|
|
3049
3054
|
...g.properties
|
|
3050
|
-
},
|
|
3055
|
+
}, S = [
|
|
3051
3056
|
...j,
|
|
3052
3057
|
...g.propertiesOrder ?? []
|
|
3053
3058
|
];
|
|
3054
|
-
v("properties",
|
|
3059
|
+
v("properties", k, !1), he(S), Me(j);
|
|
3055
3060
|
}).finally(() => {
|
|
3056
3061
|
q(!1);
|
|
3057
3062
|
}));
|
|
3058
|
-
} : void 0, re =
|
|
3059
|
-
const
|
|
3060
|
-
v(
|
|
3061
|
-
}, [v]), Te =
|
|
3062
|
-
const
|
|
3063
|
-
if (!
|
|
3063
|
+
} : void 0, re = Q((F) => F ? we.current[F] ?? I(g, ye(F)) : we.current[""], [g]), he = Q((F, j) => {
|
|
3064
|
+
const k = ye(j);
|
|
3065
|
+
v(k, F, !1), we.current[j ?? ""] = F;
|
|
3066
|
+
}, [v]), Te = Q((F, j) => {
|
|
3067
|
+
const k = F ? ae(F, j) : void 0;
|
|
3068
|
+
if (!k)
|
|
3064
3069
|
throw Error("collection editor miss config");
|
|
3065
|
-
v(pe(
|
|
3066
|
-
const
|
|
3067
|
-
he(
|
|
3070
|
+
v(pe(k), void 0, !1);
|
|
3071
|
+
const E = re(j).filter((ie) => ie !== F);
|
|
3072
|
+
he(E, j), J(!1), w(void 0), M(void 0), D(void 0);
|
|
3068
3073
|
}, [re, v, he]), Ge = (F, j) => {
|
|
3069
3074
|
v(ye(j), F, !1);
|
|
3070
3075
|
}, gt = ({
|
|
@@ -3077,49 +3082,49 @@ function Gi({
|
|
|
3077
3082
|
...g.properties ?? {},
|
|
3078
3083
|
[F]: j
|
|
3079
3084
|
}, !1);
|
|
3080
|
-
const
|
|
3081
|
-
he(
|
|
3085
|
+
const k = [...g.propertiesOrder ?? Object.keys(g.properties), F];
|
|
3086
|
+
he(k), J(!1), C && (w(k.indexOf(F)), M(F)), D(void 0);
|
|
3082
3087
|
}, fe = ({
|
|
3083
3088
|
id: F,
|
|
3084
3089
|
property: j,
|
|
3085
|
-
previousId:
|
|
3086
|
-
namespace:
|
|
3090
|
+
previousId: k,
|
|
3091
|
+
namespace: S
|
|
3087
3092
|
}) => {
|
|
3088
|
-
const
|
|
3089
|
-
if (
|
|
3090
|
-
const ke = ae(
|
|
3091
|
-
he(It,
|
|
3093
|
+
const E = F ? ae(F, S) : void 0, ie = E ? pe(E) : void 0;
|
|
3094
|
+
if (k && k !== F) {
|
|
3095
|
+
const ke = ae(k, S), Vt = pe(ke), It = re(S).map((Xe) => Xe === k ? F : Xe).filter((Xe) => Xe !== void 0);
|
|
3096
|
+
he(It, S), F && (w(It.indexOf(F)), M(F)), v(Vt, void 0, !1), y(Vt, !1, !1);
|
|
3092
3097
|
}
|
|
3093
3098
|
console.debug("onPropertyChanged", {
|
|
3094
3099
|
id: F,
|
|
3095
3100
|
property: j,
|
|
3096
|
-
previousId:
|
|
3097
|
-
namespace:
|
|
3101
|
+
previousId: k,
|
|
3102
|
+
namespace: S,
|
|
3098
3103
|
propertyPath: ie
|
|
3099
3104
|
}), ie && (v(ie, j, !1), y(ie, !0, !1));
|
|
3100
|
-
}, Ke =
|
|
3101
|
-
const
|
|
3105
|
+
}, Ke = Q((F, j, k) => {
|
|
3106
|
+
const S = F ? ae(F, j) : void 0;
|
|
3102
3107
|
if (console.debug("onPropertyErrorInternal", {
|
|
3103
3108
|
id: F,
|
|
3104
3109
|
namespace: j,
|
|
3105
|
-
error:
|
|
3106
|
-
propertyPath:
|
|
3107
|
-
}),
|
|
3108
|
-
const
|
|
3109
|
-
i(F, j,
|
|
3110
|
+
error: k,
|
|
3111
|
+
propertyPath: S
|
|
3112
|
+
}), S) {
|
|
3113
|
+
const E = k && Object.keys(k).length > 0;
|
|
3114
|
+
i(F, j, E ? k : void 0), x(pe(S), E ? "Property error" : void 0);
|
|
3110
3115
|
}
|
|
3111
3116
|
}, []), We = () => {
|
|
3112
|
-
|
|
3113
|
-
}, Ze = _ && n?.current?.properties ? n.current.properties[_] : void 0, Je = g?.propertiesOrder === void 0 || g.propertiesOrder.length === 0, Re = g.propertiesOrder ? g.propertiesOrder : Object.keys(g.properties), Qe = Zt(() =>
|
|
3117
|
+
w(void 0), M(void 0);
|
|
3118
|
+
}, Ze = _ && n?.current?.properties ? n.current.properties[_] : void 0, Je = g?.propertiesOrder === void 0 || g.propertiesOrder.length === 0, Re = g.propertiesOrder ? g.propertiesOrder : Object.keys(g.properties), Qe = Zt(() => u(g.ownerId), [u, g.ownerId]), vt = Q((F, j) => {
|
|
3114
3119
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
3115
3120
|
propertyKey: F,
|
|
3116
3121
|
namespace: j
|
|
3117
|
-
}),
|
|
3122
|
+
}), w(Re.indexOf(F)), M(F), D(j);
|
|
3118
3123
|
}, [Re]), yt = /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3119
3124
|
/* @__PURE__ */ a("div", { className: me(
|
|
3120
3125
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
3121
3126
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
3122
|
-
!
|
|
3127
|
+
!N && "border-r " + wt
|
|
3123
3128
|
), children: [
|
|
3124
3129
|
/* @__PURE__ */ a("div", { className: "flex my-2", children: [
|
|
3125
3130
|
/* @__PURE__ */ a("div", { className: "flex-grow mb-4", children: [
|
|
@@ -3127,18 +3132,18 @@ function Gi({
|
|
|
3127
3132
|
H,
|
|
3128
3133
|
{
|
|
3129
3134
|
name: "name",
|
|
3130
|
-
as:
|
|
3135
|
+
as: Z,
|
|
3131
3136
|
invisible: !0,
|
|
3132
3137
|
className: "-ml-1",
|
|
3133
3138
|
inputClassName: "text-2xl font-headers",
|
|
3134
3139
|
placeholder: "Collection name",
|
|
3135
3140
|
size: "small",
|
|
3136
3141
|
required: !0,
|
|
3137
|
-
error: !!
|
|
3142
|
+
error: !!P?.name
|
|
3138
3143
|
}
|
|
3139
3144
|
),
|
|
3140
3145
|
Qe && /* @__PURE__ */ a(
|
|
3141
|
-
|
|
3146
|
+
O,
|
|
3142
3147
|
{
|
|
3143
3148
|
variant: "body2",
|
|
3144
3149
|
className: "ml-2",
|
|
@@ -3156,7 +3161,7 @@ function Gi({
|
|
|
3156
3161
|
oe,
|
|
3157
3162
|
{
|
|
3158
3163
|
variant: "filled",
|
|
3159
|
-
disabled:
|
|
3164
|
+
disabled: B,
|
|
3160
3165
|
onClick: () => G(!0),
|
|
3161
3166
|
children: /* @__PURE__ */ e($r, {})
|
|
3162
3167
|
}
|
|
@@ -3165,16 +3170,16 @@ function Gi({
|
|
|
3165
3170
|
oe,
|
|
3166
3171
|
{
|
|
3167
3172
|
variant: "filled",
|
|
3168
|
-
disabled:
|
|
3173
|
+
disabled: B,
|
|
3169
3174
|
onClick: de,
|
|
3170
|
-
children:
|
|
3175
|
+
children: B ? /* @__PURE__ */ e(De, { size: "small" }) : /* @__PURE__ */ e(ht, {})
|
|
3171
3176
|
}
|
|
3172
3177
|
) }),
|
|
3173
3178
|
/* @__PURE__ */ e(te, { title: "Add new property", children: /* @__PURE__ */ e(
|
|
3174
3179
|
z,
|
|
3175
3180
|
{
|
|
3176
3181
|
variant: "outlined",
|
|
3177
|
-
onClick: () =>
|
|
3182
|
+
onClick: () => J(!0),
|
|
3178
3183
|
children: /* @__PURE__ */ e(ue, {})
|
|
3179
3184
|
}
|
|
3180
3185
|
) })
|
|
@@ -3185,7 +3190,7 @@ function Gi({
|
|
|
3185
3190
|
{
|
|
3186
3191
|
className: "pl-8",
|
|
3187
3192
|
inferredPropertyKeys: le,
|
|
3188
|
-
selectedPropertyKey: _ ? ae(_,
|
|
3193
|
+
selectedPropertyKey: _ ? ae(_, R) : void 0,
|
|
3189
3194
|
properties: g.properties,
|
|
3190
3195
|
additionalFields: g.additionalFields,
|
|
3191
3196
|
propertiesOrder: Re,
|
|
@@ -3193,7 +3198,7 @@ function Gi({
|
|
|
3193
3198
|
onPropertyMove: Ge,
|
|
3194
3199
|
onPropertyRemove: r ? Te : void 0,
|
|
3195
3200
|
collectionEditable: c,
|
|
3196
|
-
errors:
|
|
3201
|
+
errors: P
|
|
3197
3202
|
}
|
|
3198
3203
|
) }),
|
|
3199
3204
|
/* @__PURE__ */ e(
|
|
@@ -3203,18 +3208,18 @@ function Gi({
|
|
|
3203
3208
|
color: "primary",
|
|
3204
3209
|
variant: "outlined",
|
|
3205
3210
|
size: "large",
|
|
3206
|
-
onClick: () =>
|
|
3211
|
+
onClick: () => J(!0),
|
|
3207
3212
|
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
3208
3213
|
children: "Add new property"
|
|
3209
3214
|
}
|
|
3210
3215
|
)
|
|
3211
3216
|
] }),
|
|
3212
|
-
!
|
|
3217
|
+
!N && /* @__PURE__ */ e("div", { className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ a(
|
|
3213
3218
|
Ce,
|
|
3214
3219
|
{
|
|
3215
3220
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
3216
3221
|
children: [
|
|
3217
|
-
|
|
3222
|
+
A && s && !ne(s) && /* @__PURE__ */ e(
|
|
3218
3223
|
sr,
|
|
3219
3224
|
{
|
|
3220
3225
|
inArray: !1,
|
|
@@ -3223,25 +3228,25 @@ function Gi({
|
|
|
3223
3228
|
allowDataInference: !r,
|
|
3224
3229
|
autoOpenTypeSelect: !1,
|
|
3225
3230
|
propertyKey: _,
|
|
3226
|
-
propertyNamespace:
|
|
3231
|
+
propertyNamespace: R,
|
|
3227
3232
|
property: s,
|
|
3228
3233
|
onPropertyChanged: fe,
|
|
3229
3234
|
onDelete: Te,
|
|
3230
3235
|
onError: Ke,
|
|
3231
3236
|
forceShowErrors: t,
|
|
3232
3237
|
initialErrors: Ze,
|
|
3233
|
-
getData:
|
|
3238
|
+
getData: p,
|
|
3234
3239
|
propertyConfigs: m,
|
|
3235
3240
|
collectionEditable: c
|
|
3236
3241
|
},
|
|
3237
3242
|
`edit_view_${f}`
|
|
3238
3243
|
),
|
|
3239
|
-
!s && /* @__PURE__ */ e(
|
|
3240
|
-
s && ne(s) && /* @__PURE__ */ e(
|
|
3244
|
+
!s && /* @__PURE__ */ e(O, { variant: "label", className: "flex items-center justify-center h-full", children: Je ? "Now you can add your first property" : "Select a property to edit it" }),
|
|
3245
|
+
s && ne(s) && /* @__PURE__ */ e(O, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
|
|
3241
3246
|
]
|
|
3242
3247
|
}
|
|
3243
3248
|
) }),
|
|
3244
|
-
|
|
3249
|
+
N && /* @__PURE__ */ e(
|
|
3245
3250
|
Ve,
|
|
3246
3251
|
{
|
|
3247
3252
|
inArray: !1,
|
|
@@ -3251,17 +3256,17 @@ function Gi({
|
|
|
3251
3256
|
existingProperty: !0,
|
|
3252
3257
|
autoOpenTypeSelect: !1,
|
|
3253
3258
|
propertyKey: _,
|
|
3254
|
-
propertyNamespace:
|
|
3259
|
+
propertyNamespace: R,
|
|
3255
3260
|
property: s,
|
|
3256
3261
|
onPropertyChanged: fe,
|
|
3257
3262
|
onDelete: Te,
|
|
3258
3263
|
onError: Ke,
|
|
3259
3264
|
forceShowErrors: t,
|
|
3260
3265
|
initialErrors: Ze,
|
|
3261
|
-
getData:
|
|
3266
|
+
getData: p,
|
|
3262
3267
|
propertyConfigs: m,
|
|
3263
3268
|
collectionEditable: c,
|
|
3264
|
-
onOkClicked:
|
|
3269
|
+
onOkClicked: N ? We : void 0
|
|
3265
3270
|
},
|
|
3266
3271
|
`edit_view_${f}`
|
|
3267
3272
|
)
|
|
@@ -3277,9 +3282,9 @@ function Gi({
|
|
|
3277
3282
|
autoUpdateId: !0,
|
|
3278
3283
|
forceShowErrors: t,
|
|
3279
3284
|
open: L,
|
|
3280
|
-
onCancel: () =>
|
|
3285
|
+
onCancel: () => J(!1),
|
|
3281
3286
|
onPropertyChanged: gt,
|
|
3282
|
-
getData:
|
|
3287
|
+
getData: p,
|
|
3283
3288
|
allowDataInference: !r,
|
|
3284
3289
|
propertyConfigs: m,
|
|
3285
3290
|
collectionEditable: c,
|
|
@@ -3312,9 +3317,9 @@ function Ki({
|
|
|
3312
3317
|
"aria-describedby": "alert-dialog-description",
|
|
3313
3318
|
children: [
|
|
3314
3319
|
/* @__PURE__ */ a(Be, { children: [
|
|
3315
|
-
/* @__PURE__ */ e(
|
|
3316
|
-
i && /* @__PURE__ */ e(
|
|
3317
|
-
/* @__PURE__ */ e(
|
|
3320
|
+
/* @__PURE__ */ e(O, { variant: "h6", children: l ?? "Unsaved changes" }),
|
|
3321
|
+
i && /* @__PURE__ */ e(O, { children: i }),
|
|
3322
|
+
/* @__PURE__ */ e(O, { children: "Are you sure?" })
|
|
3318
3323
|
] }),
|
|
3319
3324
|
/* @__PURE__ */ a(ze, { children: [
|
|
3320
3325
|
/* @__PURE__ */ e(z, { variant: "text", onClick: n, autoFocus: !0, children: " Cancel " }),
|
|
@@ -3335,7 +3340,7 @@ function Wi({ open: t, onClose: r }) {
|
|
|
3335
3340
|
open: t,
|
|
3336
3341
|
children: [
|
|
3337
3342
|
/* @__PURE__ */ a(Be, { className: "flex flex-col gap-4", children: [
|
|
3338
|
-
/* @__PURE__ */ e(
|
|
3343
|
+
/* @__PURE__ */ e(O, { variant: "h6", children: "Select view" }),
|
|
3339
3344
|
n?.map((i) => /* @__PURE__ */ a(
|
|
3340
3345
|
z,
|
|
3341
3346
|
{
|
|
@@ -3351,7 +3356,7 @@ function Wi({ open: t, onClose: r }) {
|
|
|
3351
3356
|
},
|
|
3352
3357
|
i.key
|
|
3353
3358
|
)),
|
|
3354
|
-
(n ?? []).length === 0 && /* @__PURE__ */ e(
|
|
3359
|
+
(n ?? []).length === 0 && /* @__PURE__ */ e(O, { variant: "body2", children: "No custom views defined" })
|
|
3355
3360
|
] }),
|
|
3356
3361
|
/* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(z, { variant: "outlined", onClick: () => r(), children: "Cancel" }) })
|
|
3357
3362
|
]
|
|
@@ -3366,30 +3371,91 @@ function Zi({
|
|
|
3366
3371
|
getUser: l,
|
|
3367
3372
|
parentCollectionIds: o
|
|
3368
3373
|
}) {
|
|
3369
|
-
const { entityViews: d } = Ae(), [
|
|
3374
|
+
const { entityViews: d } = Ae(), [u, p] = Y.useState(), [h, m] = Y.useState(!1), [c, g] = Y.useState(), [v, x] = Y.useState(), {
|
|
3370
3375
|
values: y,
|
|
3371
|
-
setFieldValue:
|
|
3372
|
-
} = K(),
|
|
3376
|
+
setFieldValue: P
|
|
3377
|
+
} = K(), T = t.subcollections ?? [], b = y.entityViews?.filter((f) => typeof f == "string").map((f) => xr(f, d)).filter(Boolean) ?? [], C = t.entityViews?.filter((f) => typeof f != "string") ?? [], N = b.length + C.length;
|
|
3373
3378
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3374
3379
|
/* @__PURE__ */ e(mt, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-16", children: [
|
|
3375
3380
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3376
|
-
/* @__PURE__ */ a(
|
|
3381
|
+
/* @__PURE__ */ a(O, { variant: "h5", children: [
|
|
3377
3382
|
"Subcollections of ",
|
|
3378
3383
|
y.name
|
|
3379
3384
|
] }),
|
|
3380
|
-
|
|
3381
|
-
|
|
3385
|
+
/* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3386
|
+
T && T.length > 0 && /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(Bt, { children: T.map((f) => /* @__PURE__ */ a(
|
|
3387
|
+
bt,
|
|
3388
|
+
{
|
|
3389
|
+
onClick: () => x({
|
|
3390
|
+
isNewCollection: !1,
|
|
3391
|
+
editedCollectionId: f.id
|
|
3392
|
+
}),
|
|
3393
|
+
children: [
|
|
3394
|
+
/* @__PURE__ */ e(
|
|
3395
|
+
Ue,
|
|
3396
|
+
{
|
|
3397
|
+
align: "left",
|
|
3398
|
+
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: f.name })
|
|
3399
|
+
}
|
|
3400
|
+
),
|
|
3401
|
+
/* @__PURE__ */ e(
|
|
3402
|
+
Ue,
|
|
3403
|
+
{
|
|
3404
|
+
align: "right",
|
|
3405
|
+
children: /* @__PURE__ */ e(te, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3406
|
+
oe,
|
|
3407
|
+
{
|
|
3408
|
+
size: "small",
|
|
3409
|
+
onClick: (w) => {
|
|
3410
|
+
w.preventDefault(), w.stopPropagation(), p(f.id);
|
|
3411
|
+
},
|
|
3412
|
+
color: "inherit",
|
|
3413
|
+
children: /* @__PURE__ */ e(dt, { size: "small" })
|
|
3414
|
+
}
|
|
3415
|
+
) })
|
|
3416
|
+
}
|
|
3417
|
+
)
|
|
3418
|
+
]
|
|
3419
|
+
},
|
|
3420
|
+
f.path
|
|
3421
|
+
)) }) }),
|
|
3422
|
+
/* @__PURE__ */ e(
|
|
3423
|
+
z,
|
|
3424
|
+
{
|
|
3425
|
+
onClick: () => {
|
|
3426
|
+
x({
|
|
3427
|
+
isNewCollection: !0
|
|
3428
|
+
});
|
|
3429
|
+
},
|
|
3430
|
+
variant: "text",
|
|
3431
|
+
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
3432
|
+
children: "Add subcollection"
|
|
3433
|
+
}
|
|
3434
|
+
)
|
|
3435
|
+
] })
|
|
3436
|
+
] }),
|
|
3437
|
+
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3438
|
+
/* @__PURE__ */ e(O, { variant: "h5", children: "Custom views" }),
|
|
3439
|
+
N === 0 && /* @__PURE__ */ e(Yr, { action: /* @__PURE__ */ e(
|
|
3440
|
+
z,
|
|
3382
3441
|
{
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3442
|
+
variant: "text",
|
|
3443
|
+
size: "small",
|
|
3444
|
+
href: "https://firecms.co/docs/customization_quickstart",
|
|
3445
|
+
component: "a",
|
|
3446
|
+
rel: "noopener noreferrer",
|
|
3447
|
+
target: "_blank",
|
|
3448
|
+
children: "More info"
|
|
3449
|
+
}
|
|
3450
|
+
), children: "Define your own custom views by uploading it with the CLI." }),
|
|
3451
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3452
|
+
/* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3453
|
+
b.map((f) => /* @__PURE__ */ a(bt, { children: [
|
|
3388
3454
|
/* @__PURE__ */ e(
|
|
3389
3455
|
Ue,
|
|
3390
3456
|
{
|
|
3391
3457
|
align: "left",
|
|
3392
|
-
children: /* @__PURE__ */ e(
|
|
3458
|
+
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: f.name })
|
|
3393
3459
|
}
|
|
3394
3460
|
),
|
|
3395
3461
|
/* @__PURE__ */ e(
|
|
@@ -3400,8 +3466,8 @@ function Zi({
|
|
|
3400
3466
|
oe,
|
|
3401
3467
|
{
|
|
3402
3468
|
size: "small",
|
|
3403
|
-
onClick: (
|
|
3404
|
-
|
|
3469
|
+
onClick: (w) => {
|
|
3470
|
+
w.preventDefault(), w.stopPropagation(), g(f.key);
|
|
3405
3471
|
},
|
|
3406
3472
|
color: "inherit",
|
|
3407
3473
|
children: /* @__PURE__ */ e(dt, { size: "small" })
|
|
@@ -3409,105 +3475,48 @@ function Zi({
|
|
|
3409
3475
|
) })
|
|
3410
3476
|
}
|
|
3411
3477
|
)
|
|
3412
|
-
]
|
|
3413
|
-
|
|
3414
|
-
f.path
|
|
3415
|
-
)) }) }) }),
|
|
3416
|
-
/* @__PURE__ */ e(
|
|
3417
|
-
z,
|
|
3418
|
-
{
|
|
3419
|
-
onClick: () => {
|
|
3420
|
-
x({
|
|
3421
|
-
isNewCollection: !0
|
|
3422
|
-
});
|
|
3423
|
-
},
|
|
3424
|
-
variant: "outlined",
|
|
3425
|
-
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
3426
|
-
children: "Add subcollection"
|
|
3427
|
-
}
|
|
3428
|
-
)
|
|
3429
|
-
] }),
|
|
3430
|
-
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3431
|
-
/* @__PURE__ */ e(k, { variant: "h5", children: "Custom views" }),
|
|
3432
|
-
O > 0 && /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3433
|
-
b.map((f) => /* @__PURE__ */ a(bt, { children: [
|
|
3434
|
-
/* @__PURE__ */ e(
|
|
3478
|
+
] }, f.key)),
|
|
3479
|
+
C.map((f) => /* @__PURE__ */ e(bt, { children: /* @__PURE__ */ a(
|
|
3435
3480
|
Ue,
|
|
3436
3481
|
{
|
|
3437
3482
|
align: "left",
|
|
3438
|
-
children:
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
children: /* @__PURE__ */ e(te, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3446
|
-
oe,
|
|
3447
|
-
{
|
|
3448
|
-
size: "small",
|
|
3449
|
-
onClick: (N) => {
|
|
3450
|
-
N.preventDefault(), N.stopPropagation(), g(f.key);
|
|
3451
|
-
},
|
|
3452
|
-
color: "inherit",
|
|
3453
|
-
children: /* @__PURE__ */ e(dt, { size: "small" })
|
|
3454
|
-
}
|
|
3455
|
-
) })
|
|
3483
|
+
children: [
|
|
3484
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: f.name }),
|
|
3485
|
+
/* @__PURE__ */ a(O, { variant: "caption", className: "flex-grow", children: [
|
|
3486
|
+
"This view is defined in code with key ",
|
|
3487
|
+
/* @__PURE__ */ e("code", { children: f.key })
|
|
3488
|
+
] })
|
|
3489
|
+
]
|
|
3456
3490
|
}
|
|
3457
|
-
)
|
|
3458
|
-
] }
|
|
3459
|
-
|
|
3460
|
-
|
|
3491
|
+
) }, f.key))
|
|
3492
|
+
] }) }),
|
|
3493
|
+
/* @__PURE__ */ e(
|
|
3494
|
+
z,
|
|
3461
3495
|
{
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
] })
|
|
3469
|
-
]
|
|
3496
|
+
onClick: () => {
|
|
3497
|
+
m(!0);
|
|
3498
|
+
},
|
|
3499
|
+
variant: "text",
|
|
3500
|
+
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
3501
|
+
children: "Add custom entity view"
|
|
3470
3502
|
}
|
|
3471
|
-
)
|
|
3472
|
-
] }) })
|
|
3473
|
-
O === 0 && /* @__PURE__ */ e(Yr, { action: /* @__PURE__ */ e(
|
|
3474
|
-
z,
|
|
3475
|
-
{
|
|
3476
|
-
variant: "text",
|
|
3477
|
-
size: "small",
|
|
3478
|
-
href: "https://firecms.co/docs/customization_quickstart",
|
|
3479
|
-
component: "a",
|
|
3480
|
-
rel: "noopener noreferrer",
|
|
3481
|
-
target: "_blank",
|
|
3482
|
-
children: "More info"
|
|
3483
|
-
}
|
|
3484
|
-
), children: "Define your own custom views by uploading it with the CLI." }),
|
|
3485
|
-
/* @__PURE__ */ e(
|
|
3486
|
-
z,
|
|
3487
|
-
{
|
|
3488
|
-
onClick: () => {
|
|
3489
|
-
m(!0);
|
|
3490
|
-
},
|
|
3491
|
-
variant: "outlined",
|
|
3492
|
-
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
3493
|
-
children: "Add custom entity view"
|
|
3494
|
-
}
|
|
3495
|
-
)
|
|
3503
|
+
)
|
|
3504
|
+
] }) })
|
|
3496
3505
|
] })
|
|
3497
3506
|
] }) }),
|
|
3498
3507
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
3499
|
-
|
|
3508
|
+
u && /* @__PURE__ */ e(
|
|
3500
3509
|
lt,
|
|
3501
3510
|
{
|
|
3502
|
-
open: !!
|
|
3511
|
+
open: !!u,
|
|
3503
3512
|
onAccept: () => {
|
|
3504
3513
|
const f = {
|
|
3505
|
-
id:
|
|
3514
|
+
id: u,
|
|
3506
3515
|
parentCollectionIds: [...o ?? [], t.id]
|
|
3507
3516
|
};
|
|
3508
|
-
console.debug("Deleting subcollection", f), n.deleteCollection(f),
|
|
3517
|
+
console.debug("Deleting subcollection", f), n.deleteCollection(f), p(void 0);
|
|
3509
3518
|
},
|
|
3510
|
-
onCancel: () =>
|
|
3519
|
+
onCancel: () => p(void 0),
|
|
3511
3520
|
title: /* @__PURE__ */ e(U, { children: "Delete this subcollection?" }),
|
|
3512
3521
|
body: /* @__PURE__ */ a(U, { children: [
|
|
3513
3522
|
" This will ",
|
|
@@ -3521,7 +3530,7 @@ function Zi({
|
|
|
3521
3530
|
{
|
|
3522
3531
|
open: !!c,
|
|
3523
3532
|
onAccept: () => {
|
|
3524
|
-
|
|
3533
|
+
P("entityViews", y.entityViews?.filter((f) => f !== c)), g(void 0);
|
|
3525
3534
|
},
|
|
3526
3535
|
onCancel: () => g(void 0),
|
|
3527
3536
|
title: /* @__PURE__ */ e(U, { children: "Remove this view?" }),
|
|
@@ -3553,7 +3562,7 @@ function Zi({
|
|
|
3553
3562
|
{
|
|
3554
3563
|
open: h,
|
|
3555
3564
|
onClose: (f) => {
|
|
3556
|
-
f &&
|
|
3565
|
+
f && P("entityViews", [...y.entityViews ?? [], f]), m(!1);
|
|
3557
3566
|
}
|
|
3558
3567
|
}
|
|
3559
3568
|
)
|
|
@@ -3988,11 +3997,11 @@ function Ji({
|
|
|
3988
3997
|
onContinue: i,
|
|
3989
3998
|
existingCollectionPaths: l
|
|
3990
3999
|
}) {
|
|
3991
|
-
const [o, d] = $(!1), [
|
|
4000
|
+
const [o, d] = $(!1), [u, p] = $();
|
|
3992
4001
|
ce(() => {
|
|
3993
4002
|
r && l && (d(!0), r(t).then((v) => {
|
|
3994
|
-
const x = v.filter((y) => !(l ?? []).find((
|
|
3995
|
-
|
|
4003
|
+
const x = v.filter((y) => !(l ?? []).find((P) => P.trim().toLowerCase() === y.trim().toLowerCase()));
|
|
4004
|
+
p(x);
|
|
3996
4005
|
}).finally(() => d(!1)));
|
|
3997
4006
|
}, [l, t, r]);
|
|
3998
4007
|
const {
|
|
@@ -4006,16 +4015,16 @@ function Ji({
|
|
|
4006
4015
|
"div",
|
|
4007
4016
|
{
|
|
4008
4017
|
className: "flex flex-row py-2 pt-3 items-center",
|
|
4009
|
-
children: /* @__PURE__ */ e(
|
|
4018
|
+
children: /* @__PURE__ */ e(O, { variant: "h4", className: "flex-grow", children: "New collection" })
|
|
4010
4019
|
}
|
|
4011
4020
|
),
|
|
4012
|
-
n && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(
|
|
4021
|
+
n && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
4013
4022
|
"This is a subcollection of ",
|
|
4014
4023
|
/* @__PURE__ */ e("b", { children: n.name })
|
|
4015
4024
|
] }) }),
|
|
4016
4025
|
/* @__PURE__ */ a("div", { className: "my-2", children: [
|
|
4017
4026
|
/* @__PURE__ */ e(
|
|
4018
|
-
|
|
4027
|
+
O,
|
|
4019
4028
|
{
|
|
4020
4029
|
variant: "caption",
|
|
4021
4030
|
color: "secondary",
|
|
@@ -4023,8 +4032,8 @@ function Ji({
|
|
|
4023
4032
|
}
|
|
4024
4033
|
),
|
|
4025
4034
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
|
|
4026
|
-
o && !
|
|
4027
|
-
|
|
4035
|
+
o && !u && /* @__PURE__ */ e(De, { size: "small" }),
|
|
4036
|
+
u?.map((v, x) => /* @__PURE__ */ e(
|
|
4028
4037
|
st,
|
|
4029
4038
|
{
|
|
4030
4039
|
colorScheme: "cyanLighter",
|
|
@@ -4036,12 +4045,12 @@ function Ji({
|
|
|
4036
4045
|
},
|
|
4037
4046
|
v
|
|
4038
4047
|
)),
|
|
4039
|
-
!o && (
|
|
4048
|
+
!o && (u ?? [])?.length === 0 && /* @__PURE__ */ e(O, { variant: "caption", children: "No suggestions" })
|
|
4040
4049
|
] })
|
|
4041
4050
|
] }),
|
|
4042
4051
|
/* @__PURE__ */ a("div", { className: "my-2", children: [
|
|
4043
4052
|
/* @__PURE__ */ e(
|
|
4044
|
-
|
|
4053
|
+
O,
|
|
4045
4054
|
{
|
|
4046
4055
|
variant: "caption",
|
|
4047
4056
|
color: "secondary",
|
|
@@ -4097,7 +4106,7 @@ function Ji({
|
|
|
4097
4106
|
] }),
|
|
4098
4107
|
!n && /* @__PURE__ */ a("div", { children: [
|
|
4099
4108
|
/* @__PURE__ */ e(
|
|
4100
|
-
|
|
4109
|
+
O,
|
|
4101
4110
|
{
|
|
4102
4111
|
variant: "caption",
|
|
4103
4112
|
color: "secondary",
|
|
@@ -4128,7 +4137,7 @@ function nt({
|
|
|
4128
4137
|
),
|
|
4129
4138
|
children: [
|
|
4130
4139
|
n,
|
|
4131
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ e(
|
|
4140
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ e(O, { variant: "subtitle1", children: t }) })
|
|
4132
4141
|
]
|
|
4133
4142
|
}
|
|
4134
4143
|
) });
|
|
@@ -4142,40 +4151,40 @@ function Qi({
|
|
|
4142
4151
|
setFieldValue: i,
|
|
4143
4152
|
setFieldTouched: l,
|
|
4144
4153
|
values: o
|
|
4145
|
-
} = K(), [d,
|
|
4154
|
+
} = K(), [d, u] = $(void 0), p = Y.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), h = d ? d.id : void 0, m = d || void 0, c = ({
|
|
4146
4155
|
id: v,
|
|
4147
4156
|
property: x,
|
|
4148
4157
|
previousId: y,
|
|
4149
|
-
namespace:
|
|
4158
|
+
namespace: P
|
|
4150
4159
|
}) => {
|
|
4151
|
-
const
|
|
4152
|
-
const _ = ye(
|
|
4153
|
-
i(_, f, !1),
|
|
4160
|
+
const T = v ? ae(v, P) : void 0, b = T ? pe(T) : void 0, C = (f) => f ? p.current[f] ?? I(o, ye(f)) : p.current[""], N = (f, w) => {
|
|
4161
|
+
const _ = ye(w);
|
|
4162
|
+
i(_, f, !1), p.current[w ?? ""] = f;
|
|
4154
4163
|
};
|
|
4155
4164
|
if (y && y !== v) {
|
|
4156
|
-
const f = ae(y,
|
|
4157
|
-
|
|
4158
|
-
const
|
|
4159
|
-
Object.keys(
|
|
4160
|
-
|
|
4161
|
-
}), t.setHeadersMapping(
|
|
4165
|
+
const f = ae(y, P), w = pe(f), M = C(P).map((D) => D === y ? v : D).filter((D) => D !== void 0);
|
|
4166
|
+
N(M, P);
|
|
4167
|
+
const R = { ...t.headersMapping };
|
|
4168
|
+
Object.keys(R).forEach((D) => {
|
|
4169
|
+
R[D] === y && (R[D] = v ?? "");
|
|
4170
|
+
}), t.setHeadersMapping(R), i(w, void 0, !1), l(w, !1, !1);
|
|
4162
4171
|
}
|
|
4163
4172
|
b && (i(b, x, !1), l(b, !0, !1));
|
|
4164
4173
|
}, g = async ({
|
|
4165
4174
|
id: v,
|
|
4166
4175
|
importKey: x,
|
|
4167
4176
|
property: y,
|
|
4168
|
-
namespace:
|
|
4177
|
+
namespace: P
|
|
4169
4178
|
}) => {
|
|
4170
|
-
const
|
|
4171
|
-
...ti(
|
|
4179
|
+
const T = v ? ae(v, P) : void 0, b = T ? pe(T) : void 0, C = t.importData.map((f) => I(f, x)), N = {
|
|
4180
|
+
...ti(C, y, rr),
|
|
4172
4181
|
editable: !0
|
|
4173
4182
|
};
|
|
4174
|
-
b && (
|
|
4183
|
+
b && (N ? i(b, N, !1) : i(b, y, !1), l(b, !0, !1));
|
|
4175
4184
|
};
|
|
4176
4185
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
4177
4186
|
/* @__PURE__ */ a(mt, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
4178
|
-
/* @__PURE__ */ e(
|
|
4187
|
+
/* @__PURE__ */ e(O, { variant: "h6", className: "mt-4", children: "Data property mapping" }),
|
|
4179
4188
|
/* @__PURE__ */ e(
|
|
4180
4189
|
di,
|
|
4181
4190
|
{
|
|
@@ -4193,9 +4202,9 @@ function Qi({
|
|
|
4193
4202
|
{
|
|
4194
4203
|
property: v,
|
|
4195
4204
|
propertyKey: x,
|
|
4196
|
-
onPropertyNameChanged: (
|
|
4205
|
+
onPropertyNameChanged: (P, T) => i(`properties.${P}.name`, T, !1),
|
|
4197
4206
|
onEditClick: () => {
|
|
4198
|
-
!x || !v ||
|
|
4207
|
+
!x || !v || u({
|
|
4199
4208
|
...v,
|
|
4200
4209
|
id: x,
|
|
4201
4210
|
editable: !0
|
|
@@ -4206,8 +4215,8 @@ function Qi({
|
|
|
4206
4215
|
{
|
|
4207
4216
|
property: v,
|
|
4208
4217
|
disabled: !1,
|
|
4209
|
-
onPropertyChanged: (
|
|
4210
|
-
...
|
|
4218
|
+
onPropertyChanged: (P) => g({
|
|
4219
|
+
...P,
|
|
4211
4220
|
importKey: y
|
|
4212
4221
|
}),
|
|
4213
4222
|
propertyKey: x,
|
|
@@ -4231,10 +4240,10 @@ function Qi({
|
|
|
4231
4240
|
allowDataInference: !1,
|
|
4232
4241
|
collectionEditable: n,
|
|
4233
4242
|
onOkClicked: () => {
|
|
4234
|
-
|
|
4243
|
+
u(void 0);
|
|
4235
4244
|
},
|
|
4236
4245
|
onCancel: () => {
|
|
4237
|
-
|
|
4246
|
+
u(void 0);
|
|
4238
4247
|
},
|
|
4239
4248
|
autoOpenTypeSelect: !1,
|
|
4240
4249
|
existingProperty: !1,
|
|
@@ -4251,17 +4260,17 @@ function Xi({
|
|
|
4251
4260
|
propertyConfigs: i,
|
|
4252
4261
|
disabled: l
|
|
4253
4262
|
}) {
|
|
4254
|
-
const o = t ? Kt(t) : null, d = t ? $e(t, i) : null, [
|
|
4263
|
+
const o = t ? Kt(t) : null, d = t ? $e(t, i) : null, [u, p] = $(!1);
|
|
4255
4264
|
return /* @__PURE__ */ e(
|
|
4256
4265
|
te,
|
|
4257
4266
|
{
|
|
4258
4267
|
title: t && d ? `${d?.name} - ${t.dataType}` : void 0,
|
|
4259
|
-
open:
|
|
4268
|
+
open: u ? !1 : void 0,
|
|
4260
4269
|
children: /* @__PURE__ */ e(
|
|
4261
4270
|
be,
|
|
4262
4271
|
{
|
|
4263
|
-
open:
|
|
4264
|
-
onOpenChange:
|
|
4272
|
+
open: u,
|
|
4273
|
+
onOpenChange: p,
|
|
4265
4274
|
invisible: !0,
|
|
4266
4275
|
className: "w-full",
|
|
4267
4276
|
disabled: l,
|
|
@@ -4304,8 +4313,8 @@ function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
|
4304
4313
|
Tr,
|
|
4305
4314
|
{
|
|
4306
4315
|
title: /* @__PURE__ */ a("div", { children: [
|
|
4307
|
-
/* @__PURE__ */ e(
|
|
4308
|
-
/* @__PURE__ */ e(
|
|
4316
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Imported data preview" }),
|
|
4317
|
+
/* @__PURE__ */ e(O, { variant: "caption", children: "Entities with the same id will be overwritten" })
|
|
4309
4318
|
] }),
|
|
4310
4319
|
tableController: {
|
|
4311
4320
|
data: t.entities,
|
|
@@ -4323,15 +4332,15 @@ function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
|
4323
4332
|
}
|
|
4324
4333
|
function dr(t, r = "") {
|
|
4325
4334
|
const n = Object.keys(t).reduce((o, d) => {
|
|
4326
|
-
const
|
|
4327
|
-
if (
|
|
4328
|
-
const g = dr(
|
|
4335
|
+
const u = t[d], p = kr(d), h = r ? `${r}.${p}` : p;
|
|
4336
|
+
if (u.dataType === "map" && u.properties) {
|
|
4337
|
+
const g = dr(u.properties, h);
|
|
4329
4338
|
return {
|
|
4330
4339
|
headersMapping: { ...o.headersMapping, [d]: h },
|
|
4331
4340
|
properties: {
|
|
4332
4341
|
...o.properties,
|
|
4333
|
-
[
|
|
4334
|
-
...
|
|
4342
|
+
[p]: {
|
|
4343
|
+
...u,
|
|
4335
4344
|
properties: g.properties,
|
|
4336
4345
|
propertiesOrder: Object.keys(g.properties)
|
|
4337
4346
|
}
|
|
@@ -4340,7 +4349,7 @@ function dr(t, r = "") {
|
|
|
4340
4349
|
}
|
|
4341
4350
|
const m = {
|
|
4342
4351
|
...o.properties,
|
|
4343
|
-
[
|
|
4352
|
+
[p]: u
|
|
4344
4353
|
};
|
|
4345
4354
|
return {
|
|
4346
4355
|
headersMapping: { ...o.headersMapping, [d]: h },
|
|
@@ -4354,7 +4363,7 @@ function dr(t, r = "") {
|
|
|
4354
4363
|
};
|
|
4355
4364
|
}
|
|
4356
4365
|
function ur(t) {
|
|
4357
|
-
const r = t.open, [n, i] = je.useState(!1), [l, o] = je.useState(!1), d =
|
|
4366
|
+
const r = t.open, [n, i] = je.useState(!1), [l, o] = je.useState(!1), d = Q(() => {
|
|
4358
4367
|
n ? o(!0) : t.handleClose(void 0);
|
|
4359
4368
|
}, [n, t.handleClose]);
|
|
4360
4369
|
return ce(() => {
|
|
@@ -4367,7 +4376,7 @@ function ur(t) {
|
|
|
4367
4376
|
fullHeight: !0,
|
|
4368
4377
|
scrollable: !1,
|
|
4369
4378
|
maxWidth: "7xl",
|
|
4370
|
-
onOpenChange: (
|
|
4379
|
+
onOpenChange: (u) => u ? void 0 : d(),
|
|
4371
4380
|
children: [
|
|
4372
4381
|
r && /* @__PURE__ */ e(
|
|
4373
4382
|
tn,
|
|
@@ -4394,7 +4403,7 @@ function tn(t) {
|
|
|
4394
4403
|
const { propertyConfigs: r } = Ae(), n = Pe(), i = _e(), {
|
|
4395
4404
|
topLevelNavigation: l,
|
|
4396
4405
|
collections: o
|
|
4397
|
-
} = n, d = t.initialValues,
|
|
4406
|
+
} = n, d = t.initialValues, u = !d?.path && (t.parentCollectionIds ?? []).length === 0, p = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], h = p.map((b) => b.path.trim().toLowerCase()), m = p.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [c, g] = je.useState(), [v, x] = je.useState(!1);
|
|
4398
4407
|
if (ce(() => {
|
|
4399
4408
|
try {
|
|
4400
4409
|
n.initialised && (t.editedCollectionId ? g(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : g(void 0), x(!0));
|
|
@@ -4405,10 +4414,10 @@ function tn(t) {
|
|
|
4405
4414
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
4406
4415
|
const {
|
|
4407
4416
|
groups: y
|
|
4408
|
-
} = l,
|
|
4417
|
+
} = l, P = c ? {
|
|
4409
4418
|
...c,
|
|
4410
4419
|
id: c.id ?? c.path ?? _t(16)
|
|
4411
|
-
} : void 0,
|
|
4420
|
+
} : void 0, T = P ? nn(P, r) : {
|
|
4412
4421
|
id: d?.path ?? _t(16),
|
|
4413
4422
|
path: d?.path ?? "",
|
|
4414
4423
|
name: d?.name ?? "",
|
|
@@ -4422,10 +4431,10 @@ function tn(t) {
|
|
|
4422
4431
|
rn,
|
|
4423
4432
|
{
|
|
4424
4433
|
...t,
|
|
4425
|
-
initialValues:
|
|
4434
|
+
initialValues: T,
|
|
4426
4435
|
existingPaths: h,
|
|
4427
4436
|
existingIds: m,
|
|
4428
|
-
includeTemplates:
|
|
4437
|
+
includeTemplates: u,
|
|
4429
4438
|
collection: c,
|
|
4430
4439
|
setCollection: g,
|
|
4431
4440
|
groups: y,
|
|
@@ -4441,8 +4450,8 @@ function rn({
|
|
|
4441
4450
|
fullPath: l,
|
|
4442
4451
|
collectionInference: o,
|
|
4443
4452
|
handleClose: d,
|
|
4444
|
-
reservedGroups:
|
|
4445
|
-
extraView:
|
|
4453
|
+
reservedGroups: u,
|
|
4454
|
+
extraView: p,
|
|
4446
4455
|
handleCancel: h,
|
|
4447
4456
|
setFormDirty: m,
|
|
4448
4457
|
pathSuggestions: c,
|
|
@@ -4450,67 +4459,65 @@ function rn({
|
|
|
4450
4459
|
parentCollection: v,
|
|
4451
4460
|
getData: x,
|
|
4452
4461
|
existingPaths: y,
|
|
4453
|
-
existingIds:
|
|
4454
|
-
includeTemplates:
|
|
4462
|
+
existingIds: P,
|
|
4463
|
+
includeTemplates: T,
|
|
4455
4464
|
collection: b,
|
|
4456
|
-
setCollection:
|
|
4457
|
-
initialValues:
|
|
4465
|
+
setCollection: C,
|
|
4466
|
+
initialValues: N,
|
|
4458
4467
|
propertyConfigs: f,
|
|
4459
|
-
groups:
|
|
4468
|
+
groups: w
|
|
4460
4469
|
}) {
|
|
4461
|
-
const _ = hi(),
|
|
4462
|
-
|
|
4463
|
-
const B = Le({}), S = t ? w ? "welcome" : "details" : "properties", [s, V] = $(S), [G, D] = je.useState(), q = (T) => {
|
|
4464
|
-
const E = T.id || T.path;
|
|
4470
|
+
const _ = hi(), M = Pe(), R = Ie(), D = Le({}), A = t ? T ? "welcome" : "details" : "properties", [s, V] = $(A), [G, B] = je.useState(), q = (k) => {
|
|
4471
|
+
const S = k.id || k.path;
|
|
4465
4472
|
return r.saveCollection({
|
|
4466
|
-
id:
|
|
4467
|
-
collectionData:
|
|
4473
|
+
id: S,
|
|
4474
|
+
collectionData: k,
|
|
4468
4475
|
previousId: n,
|
|
4469
4476
|
parentCollectionIds: i
|
|
4470
|
-
}).then(() => (
|
|
4477
|
+
}).then(() => (B(void 0), !0)).catch((E) => (B(E), console.error(E), R.open({
|
|
4471
4478
|
type: "error",
|
|
4472
|
-
message: "Error persisting collection: " + (
|
|
4479
|
+
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4473
4480
|
}), !1));
|
|
4474
|
-
}, L =
|
|
4475
|
-
s === "details" ? _.inUse ? V("import_data_saving") : V(
|
|
4476
|
-
}, [s, _.inUse,
|
|
4481
|
+
}, L = Q(() => {
|
|
4482
|
+
s === "details" ? _.inUse ? V("import_data_saving") : V(p ? "extra_view" : "properties") : V(s === "welcome" ? "details" : s === "import_data_mapping" ? "import_data_preview" : s === "import_data_preview" ? "details" : s === "extra_view" ? "properties" : "details");
|
|
4483
|
+
}, [s, _.inUse, p]), J = Q((k) => {
|
|
4477
4484
|
if (o)
|
|
4478
|
-
return o?.(
|
|
4479
|
-
}, [o, i]), le =
|
|
4485
|
+
return o?.(k.path, k.collectionGroup ?? !1, i ?? []);
|
|
4486
|
+
}, [o, i]), le = Q(async (k) => {
|
|
4480
4487
|
try {
|
|
4481
|
-
if (!
|
|
4482
|
-
return
|
|
4488
|
+
if (!J)
|
|
4489
|
+
return C(k), Promise.resolve(k);
|
|
4483
4490
|
V("loading");
|
|
4484
|
-
const
|
|
4485
|
-
if (!
|
|
4486
|
-
return
|
|
4487
|
-
const
|
|
4488
|
-
...
|
|
4491
|
+
const S = await J?.(k);
|
|
4492
|
+
if (!S)
|
|
4493
|
+
return C(k), Promise.resolve(k);
|
|
4494
|
+
const E = {
|
|
4495
|
+
...k ?? {}
|
|
4489
4496
|
};
|
|
4490
|
-
return Object.keys(
|
|
4491
|
-
newCollection:
|
|
4492
|
-
values:
|
|
4493
|
-
}),
|
|
4494
|
-
} catch (
|
|
4495
|
-
return console.error(
|
|
4497
|
+
return Object.keys(S.properties ?? {}).length > 0 && (E.properties = S.properties, E.propertiesOrder = S.propertiesOrder), E.propertiesOrder ? (C(E), console.debug("Inferred collection", {
|
|
4498
|
+
newCollection: k ?? {},
|
|
4499
|
+
values: E
|
|
4500
|
+
}), E) : (E.propertiesOrder = Object.keys(E.properties), E);
|
|
4501
|
+
} catch (S) {
|
|
4502
|
+
return console.error(S), R.open({
|
|
4496
4503
|
type: "error",
|
|
4497
|
-
message: "Error inferring collection: " + (
|
|
4498
|
-
}),
|
|
4504
|
+
message: "Error inferring collection: " + (S.message ?? "Details in the console")
|
|
4505
|
+
}), k;
|
|
4499
4506
|
}
|
|
4500
|
-
}, [i,
|
|
4501
|
-
initialValues:
|
|
4502
|
-
onSubmit: (
|
|
4503
|
-
console.log("Submitting collection",
|
|
4507
|
+
}, [i, J]), de = Tt({
|
|
4508
|
+
initialValues: N,
|
|
4509
|
+
onSubmit: (k, S) => {
|
|
4510
|
+
console.log("Submitting collection", k);
|
|
4504
4511
|
try {
|
|
4505
4512
|
if (!t) {
|
|
4506
|
-
q(
|
|
4507
|
-
|
|
4513
|
+
q(k).then(() => {
|
|
4514
|
+
S.resetForm({ values: N }), d(k);
|
|
4508
4515
|
});
|
|
4509
4516
|
return;
|
|
4510
4517
|
}
|
|
4511
|
-
s === "welcome" ? (L(),
|
|
4512
|
-
|
|
4513
|
-
values:
|
|
4518
|
+
s === "welcome" ? (L(), S.resetForm({ values: k })) : s === "details" ? p || _.inUse ? (S.resetForm({ values: k }), L()) : t ? le(k).then((E) => {
|
|
4519
|
+
S.resetForm({
|
|
4520
|
+
values: E ?? k,
|
|
4514
4521
|
touched: {
|
|
4515
4522
|
path: !0,
|
|
4516
4523
|
name: !0
|
|
@@ -4518,34 +4525,34 @@ function rn({
|
|
|
4518
4525
|
});
|
|
4519
4526
|
}).finally(() => {
|
|
4520
4527
|
L();
|
|
4521
|
-
}) : (
|
|
4522
|
-
|
|
4523
|
-
}) : (L(),
|
|
4524
|
-
} catch (
|
|
4525
|
-
|
|
4528
|
+
}) : (S.resetForm({ values: k }), L()) : s === "extra_view" ? (L(), S.resetForm({ values: k })) : s === "import_data_mapping" || s === "import_data_preview" ? L() : s === "properties" ? q(k).then(() => {
|
|
4529
|
+
S.resetForm({ values: N }), L(), d(k);
|
|
4530
|
+
}) : (L(), S.resetForm({ values: k }));
|
|
4531
|
+
} catch (E) {
|
|
4532
|
+
R.open({
|
|
4526
4533
|
type: "error",
|
|
4527
|
-
message: "Error persisting collection: " + (
|
|
4528
|
-
}), console.error(
|
|
4534
|
+
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4535
|
+
}), console.error(E), S.resetForm({ values: k });
|
|
4529
4536
|
}
|
|
4530
4537
|
},
|
|
4531
|
-
validation: (
|
|
4532
|
-
let
|
|
4533
|
-
const
|
|
4534
|
-
if (
|
|
4538
|
+
validation: (k) => {
|
|
4539
|
+
let S = {};
|
|
4540
|
+
const E = (s === "properties" || s === "subcollections" || s === "details") && vi;
|
|
4541
|
+
if (E)
|
|
4535
4542
|
try {
|
|
4536
|
-
|
|
4543
|
+
E.validateSync(k, { abortEarly: !1 });
|
|
4537
4544
|
} catch (ie) {
|
|
4538
4545
|
ie.inner.forEach((ke) => {
|
|
4539
|
-
|
|
4546
|
+
S[ke.path] = ke.message;
|
|
4540
4547
|
});
|
|
4541
4548
|
}
|
|
4542
|
-
if (s === "properties" && (
|
|
4543
|
-
const ie = Ht(
|
|
4544
|
-
ie && (
|
|
4545
|
-
const ke = an(
|
|
4546
|
-
ke && (
|
|
4549
|
+
if (s === "properties" && (S = { ...S, ...D.current }), s === "details") {
|
|
4550
|
+
const ie = Ht(k.path, t, y, k.id);
|
|
4551
|
+
ie && (S.path = ie);
|
|
4552
|
+
const ke = an(k.id, t, y, P);
|
|
4553
|
+
ke && (S.id = ke);
|
|
4547
4554
|
}
|
|
4548
|
-
return
|
|
4555
|
+
return S;
|
|
4549
4556
|
}
|
|
4550
4557
|
}), {
|
|
4551
4558
|
values: re,
|
|
@@ -4553,19 +4560,19 @@ function rn({
|
|
|
4553
4560
|
isSubmitting: Te,
|
|
4554
4561
|
dirty: Ge,
|
|
4555
4562
|
submitCount: gt
|
|
4556
|
-
} = de, fe = re.path ?? n, Ke = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + fe : fe, We = Ht(fe, t, y, re.id), Ze = !We && i ?
|
|
4563
|
+
} = de, fe = re.path ?? n, Ke = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + fe : fe, We = Ht(fe, t, y, re.id), Ze = !We && i ? M.convertIdsToPaths(i) : void 0, Je = We ? void 0 : M.resolveAliasesFrom(Ke), Re = Je && x ? () => x(Je, Ze ?? []) : void 0;
|
|
4557
4564
|
ce(() => {
|
|
4558
4565
|
m(Ge);
|
|
4559
4566
|
}, [Ge]);
|
|
4560
|
-
function Qe(
|
|
4561
|
-
_.setInUse(!0), ri(
|
|
4562
|
-
const
|
|
4563
|
-
he("properties",
|
|
4567
|
+
function Qe(k) {
|
|
4568
|
+
_.setInUse(!0), ri(k, rr).then((S) => {
|
|
4569
|
+
const E = dr(S);
|
|
4570
|
+
he("properties", E.properties), he("propertiesOrder", Object.keys(E.properties)), _.setIdColumn(E.idColumn), _.setImportData(k), _.setHeadersMapping(E.headersMapping), _.setOriginProperties(E.properties);
|
|
4564
4571
|
});
|
|
4565
4572
|
}
|
|
4566
4573
|
const vt = !!re.name && !!re.id, yt = () => {
|
|
4567
|
-
const
|
|
4568
|
-
_.idColumn && delete
|
|
4574
|
+
const k = { ...re.properties };
|
|
4575
|
+
_.idColumn && delete k[_.idColumn], he("properties", k), L();
|
|
4569
4576
|
}, j = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4570
4577
|
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value: de, children: /* @__PURE__ */ a(U, { children: [
|
|
4571
4578
|
!t && /* @__PURE__ */ a(
|
|
@@ -4573,7 +4580,7 @@ function rn({
|
|
|
4573
4580
|
{
|
|
4574
4581
|
value: s,
|
|
4575
4582
|
className: me(wt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
4576
|
-
onValueChange: (
|
|
4583
|
+
onValueChange: (k) => V(k),
|
|
4577
4584
|
children: [
|
|
4578
4585
|
/* @__PURE__ */ e(Ct, { value: "details", children: "Details" }),
|
|
4579
4586
|
/* @__PURE__ */ e(Ct, { value: "properties", children: "Properties" }),
|
|
@@ -4592,13 +4599,13 @@ function rn({
|
|
|
4592
4599
|
),
|
|
4593
4600
|
children: [
|
|
4594
4601
|
s === "loading" && /* @__PURE__ */ e(Nt, {}),
|
|
4595
|
-
s === "extra_view" && fe &&
|
|
4602
|
+
s === "extra_view" && fe && p?.View && /* @__PURE__ */ e(p.View, { path: fe }),
|
|
4596
4603
|
s === "welcome" && /* @__PURE__ */ e(
|
|
4597
4604
|
Ji,
|
|
4598
4605
|
{
|
|
4599
4606
|
path: fe,
|
|
4600
|
-
onContinue: (
|
|
4601
|
-
|
|
4607
|
+
onContinue: (k) => {
|
|
4608
|
+
k ? (Qe(k), V("import_data_mapping")) : V("details");
|
|
4602
4609
|
},
|
|
4603
4610
|
existingCollectionPaths: y,
|
|
4604
4611
|
parentCollection: v,
|
|
@@ -4626,11 +4633,11 @@ function rn({
|
|
|
4626
4633
|
{
|
|
4627
4634
|
importConfig: _,
|
|
4628
4635
|
collection: re,
|
|
4629
|
-
onImportSuccess: async (
|
|
4630
|
-
|
|
4636
|
+
onImportSuccess: async (k) => {
|
|
4637
|
+
R.open({
|
|
4631
4638
|
type: "info",
|
|
4632
4639
|
message: "Data imported successfully"
|
|
4633
|
-
}), await q(re), d(
|
|
4640
|
+
}), await q(re), d(k);
|
|
4634
4641
|
}
|
|
4635
4642
|
}
|
|
4636
4643
|
),
|
|
@@ -4638,8 +4645,8 @@ function rn({
|
|
|
4638
4645
|
yi,
|
|
4639
4646
|
{
|
|
4640
4647
|
existingPaths: y,
|
|
4641
|
-
existingIds:
|
|
4642
|
-
groups:
|
|
4648
|
+
existingIds: P,
|
|
4649
|
+
groups: w,
|
|
4643
4650
|
parentCollectionIds: i,
|
|
4644
4651
|
parentCollection: v,
|
|
4645
4652
|
isNewCollection: t
|
|
@@ -4661,25 +4668,25 @@ function rn({
|
|
|
4661
4668
|
{
|
|
4662
4669
|
showErrors: gt > 0,
|
|
4663
4670
|
isNewCollection: t,
|
|
4664
|
-
reservedGroups:
|
|
4665
|
-
onPropertyError: (
|
|
4671
|
+
reservedGroups: u,
|
|
4672
|
+
onPropertyError: (k, S, E) => {
|
|
4666
4673
|
const ie = Ft({
|
|
4667
|
-
...
|
|
4668
|
-
[ir(
|
|
4674
|
+
...D.current,
|
|
4675
|
+
[ir(k, S)]: Ft(E, !0)
|
|
4669
4676
|
}, !0);
|
|
4670
|
-
|
|
4677
|
+
D.current = ie, de.validate();
|
|
4671
4678
|
},
|
|
4672
4679
|
getUser: g,
|
|
4673
4680
|
getData: Re,
|
|
4674
|
-
doCollectionInference:
|
|
4681
|
+
doCollectionInference: J,
|
|
4675
4682
|
propertyConfigs: f,
|
|
4676
4683
|
collectionEditable: j,
|
|
4677
|
-
extraIcon:
|
|
4684
|
+
extraIcon: p?.icon && /* @__PURE__ */ e(
|
|
4678
4685
|
oe,
|
|
4679
4686
|
{
|
|
4680
4687
|
color: "primary",
|
|
4681
4688
|
onClick: () => V("extra_view"),
|
|
4682
|
-
children:
|
|
4689
|
+
children: p.icon
|
|
4683
4690
|
}
|
|
4684
4691
|
)
|
|
4685
4692
|
}
|
|
@@ -4690,7 +4697,7 @@ function rn({
|
|
|
4690
4697
|
position: "absolute",
|
|
4691
4698
|
children: [
|
|
4692
4699
|
G && /* @__PURE__ */ e(Wt, { error: G }),
|
|
4693
|
-
t &&
|
|
4700
|
+
t && T && s === "import_data_mapping" && /* @__PURE__ */ a(
|
|
4694
4701
|
z,
|
|
4695
4702
|
{
|
|
4696
4703
|
variant: "text",
|
|
@@ -4702,7 +4709,7 @@ function rn({
|
|
|
4702
4709
|
]
|
|
4703
4710
|
}
|
|
4704
4711
|
),
|
|
4705
|
-
t &&
|
|
4712
|
+
t && T && s === "import_data_preview" && /* @__PURE__ */ a(
|
|
4706
4713
|
z,
|
|
4707
4714
|
{
|
|
4708
4715
|
variant: "text",
|
|
@@ -4716,7 +4723,7 @@ function rn({
|
|
|
4716
4723
|
]
|
|
4717
4724
|
}
|
|
4718
4725
|
),
|
|
4719
|
-
t &&
|
|
4726
|
+
t && T && s === "details" && /* @__PURE__ */ a(
|
|
4720
4727
|
z,
|
|
4721
4728
|
{
|
|
4722
4729
|
variant: "text",
|
|
@@ -4840,102 +4847,102 @@ const Ht = (t, r, n, i) => {
|
|
|
4840
4847
|
reservedGroups: l,
|
|
4841
4848
|
collectionInference: o,
|
|
4842
4849
|
extraView: d,
|
|
4843
|
-
pathSuggestions:
|
|
4844
|
-
getUser:
|
|
4850
|
+
pathSuggestions: u,
|
|
4851
|
+
getUser: p,
|
|
4845
4852
|
getData: h,
|
|
4846
4853
|
onAnalyticsEvent: m
|
|
4847
4854
|
}) {
|
|
4848
4855
|
const c = Pe(), g = gi(), v = Ie(), { propertyConfigs: x } = Ae(), {
|
|
4849
4856
|
collections: y
|
|
4850
|
-
} = c,
|
|
4857
|
+
} = c, P = (y ?? []).map((s) => s.path.trim().toLowerCase()), [T, b] = Y.useState();
|
|
4851
4858
|
ce(() => {
|
|
4852
|
-
|
|
4853
|
-
b(s.filter((V) => !
|
|
4859
|
+
u && u().then((s) => {
|
|
4860
|
+
b(s.filter((V) => !P.includes(V.trim().toLowerCase())));
|
|
4854
4861
|
});
|
|
4855
|
-
}, [
|
|
4856
|
-
const [
|
|
4862
|
+
}, [u]);
|
|
4863
|
+
const [C, N] = Y.useState(), [f, w] = Y.useState(), _ = Q(() => ({
|
|
4857
4864
|
createCollections: !0,
|
|
4858
4865
|
editCollections: !0,
|
|
4859
4866
|
deleteCollections: !0
|
|
4860
|
-
}), []),
|
|
4867
|
+
}), []), M = Q(({
|
|
4861
4868
|
id: s,
|
|
4862
4869
|
fullPath: V,
|
|
4863
4870
|
parentCollectionIds: G,
|
|
4864
|
-
parentCollection:
|
|
4871
|
+
parentCollection: B
|
|
4865
4872
|
}) => {
|
|
4866
|
-
console.debug("Edit collection", s, V, G,
|
|
4873
|
+
console.debug("Edit collection", s, V, G, B), m?.("edit_collection", { id: s, fullPath: V }), N({
|
|
4867
4874
|
editedCollectionId: s,
|
|
4868
4875
|
fullPath: V,
|
|
4869
4876
|
parentCollectionIds: G,
|
|
4870
4877
|
isNewCollection: !1,
|
|
4871
|
-
parentCollection:
|
|
4878
|
+
parentCollection: B,
|
|
4872
4879
|
redirect: !1
|
|
4873
4880
|
});
|
|
4874
|
-
}, []),
|
|
4881
|
+
}, []), R = Q(({
|
|
4875
4882
|
propertyKey: s,
|
|
4876
4883
|
property: V,
|
|
4877
4884
|
editedCollectionId: G,
|
|
4878
|
-
currentPropertiesOrder:
|
|
4885
|
+
currentPropertiesOrder: B,
|
|
4879
4886
|
parentCollectionIds: q,
|
|
4880
4887
|
collection: L
|
|
4881
4888
|
}) => {
|
|
4882
|
-
console.debug("edit property", s, V, G,
|
|
4883
|
-
const
|
|
4884
|
-
|
|
4889
|
+
console.debug("edit property", s, V, G, B, q, L), m?.("edit_property", { propertyKey: s, editedCollectionId: G });
|
|
4890
|
+
const J = s && s.includes(".") ? s.substring(0, s.lastIndexOf(".")) : void 0, le = s && s.includes(".") ? s.substring(s.lastIndexOf(".") + 1) : s;
|
|
4891
|
+
w({
|
|
4885
4892
|
propertyKey: le,
|
|
4886
4893
|
property: V,
|
|
4887
|
-
namespace:
|
|
4888
|
-
currentPropertiesOrder:
|
|
4894
|
+
namespace: J,
|
|
4895
|
+
currentPropertiesOrder: B,
|
|
4889
4896
|
editedCollectionId: G,
|
|
4890
4897
|
parentCollectionIds: q,
|
|
4891
4898
|
collectionEditable: L?.editable ?? !1
|
|
4892
4899
|
});
|
|
4893
|
-
}, []),
|
|
4900
|
+
}, []), D = Y.useCallback(({
|
|
4894
4901
|
parentCollectionIds: s,
|
|
4895
4902
|
parentCollection: V,
|
|
4896
4903
|
initialValues: G,
|
|
4897
|
-
redirect:
|
|
4904
|
+
redirect: B,
|
|
4898
4905
|
sourceClick: q
|
|
4899
4906
|
}) => {
|
|
4900
|
-
console.debug("Create collection", { parentCollectionIds: s, parentCollection: V, initialValues: G, redirect:
|
|
4907
|
+
console.debug("Create collection", { parentCollectionIds: s, parentCollection: V, initialValues: G, redirect: B, sourceClick: q }), m?.("create_collection", { parentCollectionIds: s, parentCollection: V, initialValues: G, redirect: B, sourceClick: q }), N({
|
|
4901
4908
|
isNewCollection: !0,
|
|
4902
4909
|
parentCollectionIds: s,
|
|
4903
4910
|
parentCollection: V,
|
|
4904
4911
|
initialValues: G,
|
|
4905
|
-
redirect:
|
|
4912
|
+
redirect: B
|
|
4906
4913
|
});
|
|
4907
|
-
}, []),
|
|
4914
|
+
}, []), A = u ? (s) => !s && T ? Promise.resolve(T) : u?.(s) : void 0;
|
|
4908
4915
|
return /* @__PURE__ */ e(mr.Provider, { value: n, children: /* @__PURE__ */ a(
|
|
4909
4916
|
hr.Provider,
|
|
4910
4917
|
{
|
|
4911
4918
|
value: {
|
|
4912
|
-
editCollection:
|
|
4913
|
-
createCollection:
|
|
4914
|
-
editProperty:
|
|
4919
|
+
editCollection: M,
|
|
4920
|
+
createCollection: D,
|
|
4921
|
+
editProperty: R,
|
|
4915
4922
|
configPermissions: i ?? _,
|
|
4916
|
-
rootPathSuggestions:
|
|
4923
|
+
rootPathSuggestions: T
|
|
4917
4924
|
},
|
|
4918
4925
|
children: [
|
|
4919
4926
|
r,
|
|
4920
4927
|
/* @__PURE__ */ e(
|
|
4921
4928
|
ur,
|
|
4922
4929
|
{
|
|
4923
|
-
open: !!
|
|
4930
|
+
open: !!C,
|
|
4924
4931
|
configController: n,
|
|
4925
4932
|
isNewCollection: !1,
|
|
4926
4933
|
collectionInference: o,
|
|
4927
|
-
...
|
|
4934
|
+
...C,
|
|
4928
4935
|
getData: h,
|
|
4929
4936
|
reservedGroups: l,
|
|
4930
4937
|
extraView: d,
|
|
4931
|
-
pathSuggestions:
|
|
4932
|
-
getUser:
|
|
4938
|
+
pathSuggestions: A,
|
|
4939
|
+
getUser: p,
|
|
4933
4940
|
handleClose: (s) => {
|
|
4934
|
-
if (
|
|
4941
|
+
if (C?.redirect && s && C?.isNewCollection && !C.parentCollectionIds.length) {
|
|
4935
4942
|
const V = c.buildUrlCollectionPath(s.id ?? s.path);
|
|
4936
4943
|
g(V);
|
|
4937
4944
|
}
|
|
4938
|
-
|
|
4945
|
+
N(void 0);
|
|
4939
4946
|
}
|
|
4940
4947
|
}
|
|
4941
4948
|
),
|
|
@@ -4968,9 +4975,9 @@ const Ht = (t, r, n, i) => {
|
|
|
4968
4975
|
newPropertiesOrder: G && f.currentPropertiesOrder ? [...f.currentPropertiesOrder, s] : void 0,
|
|
4969
4976
|
namespace: f.namespace,
|
|
4970
4977
|
parentCollectionIds: f.parentCollectionIds
|
|
4971
|
-
}).catch((
|
|
4978
|
+
}).catch((B) => (console.error(B), v.open({
|
|
4972
4979
|
type: "error",
|
|
4973
|
-
message: "Error persisting property: " + (
|
|
4980
|
+
message: "Error persisting property: " + (B.message ?? "Details in the console")
|
|
4974
4981
|
}), !1));
|
|
4975
4982
|
},
|
|
4976
4983
|
onPropertyChangedImmediate: !1,
|
|
@@ -4985,7 +4992,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4985
4992
|
newPropertiesOrder: s,
|
|
4986
4993
|
parentCollectionIds: f?.parentCollectionIds
|
|
4987
4994
|
}).then(() => {
|
|
4988
|
-
|
|
4995
|
+
w(void 0);
|
|
4989
4996
|
}).catch((V) => (console.error(V), v.open({
|
|
4990
4997
|
type: "error",
|
|
4991
4998
|
message: "Error deleting property: " + (V.message ?? "Details in the console")
|
|
@@ -4994,10 +5001,10 @@ const Ht = (t, r, n, i) => {
|
|
|
4994
5001
|
onError: () => {
|
|
4995
5002
|
},
|
|
4996
5003
|
onOkClicked: () => {
|
|
4997
|
-
|
|
5004
|
+
w(void 0);
|
|
4998
5005
|
},
|
|
4999
5006
|
onCancel: () => {
|
|
5000
|
-
|
|
5007
|
+
w(void 0);
|
|
5001
5008
|
},
|
|
5002
5009
|
initialErrors: {},
|
|
5003
5010
|
forceShowErrors: !1,
|
|
@@ -5020,7 +5027,7 @@ function ln({
|
|
|
5020
5027
|
collection: n,
|
|
5021
5028
|
tableController: i
|
|
5022
5029
|
}) {
|
|
5023
|
-
const l = _e(), o = Pe(), d = xe(),
|
|
5030
|
+
const l = _e(), o = Pe(), d = xe(), u = fr(), p = Ie(), h = o.getCollectionFromIds(r), m = d.configPermissions ? d.configPermissions({
|
|
5024
5031
|
user: l.user,
|
|
5025
5032
|
collection: n
|
|
5026
5033
|
}).editCollections : !0;
|
|
@@ -5054,7 +5061,7 @@ function ln({
|
|
|
5054
5061
|
color: "primary",
|
|
5055
5062
|
size: "small",
|
|
5056
5063
|
variant: "outlined",
|
|
5057
|
-
onClick: () =>
|
|
5064
|
+
onClick: () => u?.saveCollection({
|
|
5058
5065
|
id: n.id,
|
|
5059
5066
|
parentCollectionIds: r,
|
|
5060
5067
|
collectionData: W(
|
|
@@ -5065,7 +5072,7 @@ function ln({
|
|
|
5065
5072
|
}
|
|
5066
5073
|
)
|
|
5067
5074
|
}).then(() => {
|
|
5068
|
-
|
|
5075
|
+
p.open({
|
|
5069
5076
|
type: "success",
|
|
5070
5077
|
message: "Default config saved"
|
|
5071
5078
|
});
|
|
@@ -5104,9 +5111,9 @@ function sn({
|
|
|
5104
5111
|
const n = Ie(), i = _e(), l = fr(), o = xe(), d = o.configPermissions({
|
|
5105
5112
|
user: i.user,
|
|
5106
5113
|
collection: r
|
|
5107
|
-
}),
|
|
5114
|
+
}), u = Q(() => {
|
|
5108
5115
|
o?.editCollection({ id: r.id, parentCollectionIds: [] });
|
|
5109
|
-
}, [o, t]), [
|
|
5116
|
+
}, [o, t]), [p, h] = $(!1), m = Q(() => {
|
|
5110
5117
|
l?.deleteCollection({ id: r.id }).then(() => {
|
|
5111
5118
|
h(!1), n.open({
|
|
5112
5119
|
message: "Collection deleted",
|
|
@@ -5132,7 +5139,7 @@ function sn({
|
|
|
5132
5139
|
oe,
|
|
5133
5140
|
{
|
|
5134
5141
|
onClick: (c) => {
|
|
5135
|
-
|
|
5142
|
+
u();
|
|
5136
5143
|
},
|
|
5137
5144
|
children: /* @__PURE__ */ e(He, { size: "small" })
|
|
5138
5145
|
}
|
|
@@ -5141,7 +5148,7 @@ function sn({
|
|
|
5141
5148
|
/* @__PURE__ */ e(
|
|
5142
5149
|
lt,
|
|
5143
5150
|
{
|
|
5144
|
-
open:
|
|
5151
|
+
open: p,
|
|
5145
5152
|
onAccept: m,
|
|
5146
5153
|
onCancel: () => h(!1),
|
|
5147
5154
|
title: /* @__PURE__ */ e(U, { children: "Delete this collection?" }),
|
|
@@ -5180,7 +5187,7 @@ function cn({
|
|
|
5180
5187
|
children: [
|
|
5181
5188
|
/* @__PURE__ */ e(ue, { color: "primary", size: "large" }),
|
|
5182
5189
|
/* @__PURE__ */ e(
|
|
5183
|
-
|
|
5190
|
+
O,
|
|
5184
5191
|
{
|
|
5185
5192
|
color: "primary",
|
|
5186
5193
|
variant: "caption",
|
|
@@ -5188,7 +5195,7 @@ function cn({
|
|
|
5188
5195
|
children: "Add new collection".toUpperCase()
|
|
5189
5196
|
}
|
|
5190
5197
|
),
|
|
5191
|
-
!l && /* @__PURE__ */ e(
|
|
5198
|
+
!l && /* @__PURE__ */ e(O, { variant: "caption", children: "You don't have permissions to create collections" })
|
|
5192
5199
|
]
|
|
5193
5200
|
}
|
|
5194
5201
|
)
|
|
@@ -5208,8 +5215,12 @@ function dn({ introMode: t }) {
|
|
|
5208
5215
|
{
|
|
5209
5216
|
className: "flex flex-col gap-1 p-2 my-4",
|
|
5210
5217
|
children: [
|
|
5211
|
-
!t && /* @__PURE__ */
|
|
5212
|
-
|
|
5218
|
+
!t && /* @__PURE__ */ a(O, { variant: "body2", color: "secondary", children: [
|
|
5219
|
+
"Create a collection ",
|
|
5220
|
+
/* @__PURE__ */ e("b", { children: "automatically" }),
|
|
5221
|
+
" from your data:"
|
|
5222
|
+
] }),
|
|
5223
|
+
t === "existing_project" && /* @__PURE__ */ a(O, { children: [
|
|
5213
5224
|
"You will see your ",
|
|
5214
5225
|
/* @__PURE__ */ e("b", { children: "database collections" }),
|
|
5215
5226
|
" here, a few seconds after project creation"
|
|
@@ -5219,23 +5230,23 @@ function dn({ introMode: t }) {
|
|
|
5219
5230
|
{
|
|
5220
5231
|
className: "flex flex-row gap-1 overflow-scroll no-scrollbar ",
|
|
5221
5232
|
children: [
|
|
5222
|
-
(o ?? []).map((
|
|
5233
|
+
(o ?? []).map((p) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
5223
5234
|
st,
|
|
5224
5235
|
{
|
|
5225
5236
|
icon: /* @__PURE__ */ e(ue, { size: "small" }),
|
|
5226
5237
|
colorScheme: "cyanLighter",
|
|
5227
5238
|
onClick: i && l ? () => i.createCollection({
|
|
5228
|
-
initialValues: { path:
|
|
5239
|
+
initialValues: { path: p, name: ut(p) },
|
|
5229
5240
|
parentCollectionIds: [],
|
|
5230
5241
|
redirect: !0,
|
|
5231
5242
|
sourceClick: "root_collection_suggestion"
|
|
5232
5243
|
}) : void 0,
|
|
5233
5244
|
size: "small",
|
|
5234
|
-
children:
|
|
5245
|
+
children: p
|
|
5235
5246
|
}
|
|
5236
|
-
) },
|
|
5247
|
+
) }, p)),
|
|
5237
5248
|
o === void 0 && /* @__PURE__ */ e(De, { size: "small" }),
|
|
5238
|
-
o?.length === 0 && /* @__PURE__ */ e(
|
|
5249
|
+
o?.length === 0 && /* @__PURE__ */ e(O, { variant: "caption", children: "No suggestions" })
|
|
5239
5250
|
]
|
|
5240
5251
|
}
|
|
5241
5252
|
)
|
|
@@ -5324,8 +5335,8 @@ function In({
|
|
|
5324
5335
|
extraView: l,
|
|
5325
5336
|
pathSuggestions: o,
|
|
5326
5337
|
getUser: d,
|
|
5327
|
-
collectionInference:
|
|
5328
|
-
getData:
|
|
5338
|
+
collectionInference: u,
|
|
5339
|
+
getData: p,
|
|
5329
5340
|
onAnalyticsEvent: h
|
|
5330
5341
|
}) {
|
|
5331
5342
|
return {
|
|
@@ -5339,12 +5350,12 @@ function In({
|
|
|
5339
5350
|
props: {
|
|
5340
5351
|
collectionConfigController: t,
|
|
5341
5352
|
configPermissions: n,
|
|
5342
|
-
collectionInference:
|
|
5353
|
+
collectionInference: u,
|
|
5343
5354
|
reservedGroups: i,
|
|
5344
5355
|
extraView: l,
|
|
5345
5356
|
pathSuggestions: o,
|
|
5346
5357
|
getUser: d,
|
|
5347
|
-
getData:
|
|
5358
|
+
getData: p,
|
|
5348
5359
|
onAnalyticsEvent: h
|
|
5349
5360
|
}
|
|
5350
5361
|
},
|
|
@@ -5368,9 +5379,9 @@ function hn({ introMode: t }) {
|
|
|
5368
5379
|
user: n.user
|
|
5369
5380
|
}).createCollections : !0;
|
|
5370
5381
|
return /* @__PURE__ */ a("div", { className: "mt-8 flex flex-col mt-8 p-2", children: [
|
|
5371
|
-
/* @__PURE__ */ e(
|
|
5372
|
-
/* @__PURE__ */ e(
|
|
5373
|
-
/* @__PURE__ */ e(
|
|
5382
|
+
/* @__PURE__ */ e(O, { variant: "h4", className: "mb-4", children: "Welcome" }),
|
|
5383
|
+
/* @__PURE__ */ e(O, { paragraph: !0, children: "Your admin panel is ready ✌️" }),
|
|
5384
|
+
/* @__PURE__ */ e(O, { paragraph: !0, children: "Start building collections in FireCMS easily. Map them to your existing database data, import from files, or use our templates. Simplify your data management process now." }),
|
|
5374
5385
|
l && /* @__PURE__ */ a(
|
|
5375
5386
|
z,
|
|
5376
5387
|
{
|