@firecms/collection_editor 3.0.0-beta.2-pre.5 → 3.0.0-canary.0
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 +857 -827
- 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/CollectionPropertiesEditorForm.tsx +25 -8
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +68 -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/ReferencePropertyField.tsx +1 -2
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a, Fragment as
|
|
1
|
+
import { jsx as e, jsxs as a, Fragment as j } from "react/jsx-runtime";
|
|
2
2
|
import { SearchIconsView as gr, toSnakeCase as Pt, singular as vr, IconForView as ot, ArrayContainer as yr, serializeRegExp as br, useSnackbarController as Ie, resolveEnumValues as Cr, isPropertyBuilder as ne, useCustomizationController as Ae, getFieldConfig as $e, ErrorBoundary as ge, PropertyConfigBadge as Ye, unslugify as ut, useNavigationController as Pe, mergeDeep as W, DEFAULT_FIELD_CONFIGS as Gt, isValidRegExp as Pr, getFieldId as Kt, DeleteConfirmationDialog as lt, useLargeLayout as Nr, makePropertiesEditable as pt, resolveEntityView as xr, useSelectionController as wr, EntityCollectionTable as Tr, slugify as kr, useAuthController as _e, randomString as _t, CircularProgressCenter as Nt, removeUndefined as Ft, ErrorView as Wt, removeInitialAndTrailingSlashes as Or, getDefaultPropertiesOrder as Vr } from "@firecms/core";
|
|
3
3
|
import * as je from "react";
|
|
4
|
-
import Y, { useState as $, useEffect as
|
|
4
|
+
import Y, { useState as $, useEffect as de, useMemo as Zt, useCallback as Q, useRef as Le, useDeferredValue as Ir, useContext as Jt } from "react";
|
|
5
5
|
import ve from "react-fast-compare";
|
|
6
|
-
import { Typography as
|
|
6
|
+
import { Typography as O, useAutoComplete as _r, Container as mt, Tooltip as te, IconButton as oe, Chip as st, TextField as Oe, cn as me, DebouncedTextField as Z, Autocomplete as Fr, AutocompleteItem as Sr, ExpandablePanel as xt, SettingsIcon as He, Select as be, SelectItem as ee, BooleanSwitchWithLabel as ct, Dialog as Fe, AutoAwesomeIcon as ht, Badge as Er, ListIcon as Ar, Button as z, CircularProgress as De, Paper as Ce, DialogContent as Be, DialogActions as ze, RuleIcon as Dr, FileUploadIcon as Br, MultiSelect as zr, MultiSelectItem as St, Checkbox as Et, cardMixin as Qt, cardClickableMixin as Xt, cardSelectedMixin as er, FunctionsIcon as Mr, RemoveCircleIcon as Rr, defaultBorderMixin as wt, RemoveIcon as Ur, DragHandleIcon as jr, AddIcon as se, SelectGroup as At, InfoLabel as Lr, DeleteIcon as dt, ContentCopyIcon as qr, CodeIcon as $r, Table as Dt, TableBody as Bt, TableRow as bt, TableCell as Ue, Alert as Yr, Icon as et, Card as tr, coolIconKeys as zt, Tabs as Hr, Tab as Ct, ArrowBackIcon as tt, LoadingButton as Mt, DoneIcon as Gr, UndoIcon as Kr, SaveIcon as Wr, Menu as Zr, MoreVertIcon as Jr, MenuItem as Qr, Collapse as Xr } from "@firecms/ui";
|
|
7
7
|
import * as rt from "yup";
|
|
8
8
|
import { useFormex as K, Field as H, getIn as I, useCreateFormex as Tt, Formex as kt } from "@firecms/formex";
|
|
9
9
|
import { extractEnumFromValues as ei, buildPropertyFromData as ti, buildEntityPropertiesFromData as ri } from "@firecms/schema_inference";
|
|
@@ -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), [k, 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
|
+
de(() => {
|
|
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: k,
|
|
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
|
-
return
|
|
331
|
-
r && r(
|
|
332
|
-
}, [
|
|
330
|
+
}), { values: p, errors: h } = u;
|
|
331
|
+
return de(() => {
|
|
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`), k = I(h, `${i}[${r}].label`), b = Y.useRef(k);
|
|
456
457
|
return Y.useEffect(() => {
|
|
457
|
-
(b.current ===
|
|
458
|
-
}, [
|
|
458
|
+
(b.current === P || !P) && y && g(`${i}[${r}].id`, k), b.current = k;
|
|
459
|
+
}, [k]), /* @__PURE__ */ a(j, { 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",
|
|
@@ -551,7 +552,7 @@ function xi({
|
|
|
551
552
|
}
|
|
552
553
|
);
|
|
553
554
|
}
|
|
554
|
-
function
|
|
555
|
+
function ce({
|
|
555
556
|
field: t,
|
|
556
557
|
form: r,
|
|
557
558
|
label: n,
|
|
@@ -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,32 +570,32 @@ 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";
|
|
585
|
-
return /* @__PURE__ */ a(
|
|
586
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
586
587
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
587
588
|
H,
|
|
588
589
|
{
|
|
589
590
|
name: i,
|
|
590
591
|
type: "checkbox",
|
|
591
|
-
children: ({ field: d, form:
|
|
592
|
-
|
|
592
|
+
children: ({ field: d, form: u }) => /* @__PURE__ */ e(
|
|
593
|
+
ce,
|
|
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
|
-
|
|
609
|
+
children: ({ field: d, form: u }) => /* @__PURE__ */ e(
|
|
610
|
+
ce,
|
|
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", k = "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: k,
|
|
656
657
|
type: "checkbox",
|
|
657
|
-
children: ({ field:
|
|
658
|
-
|
|
658
|
+
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
659
|
+
ce,
|
|
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
|
-
|
|
674
|
+
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
675
|
+
ce,
|
|
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
|
-
|
|
690
|
+
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
691
|
+
ce,
|
|
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,10 +825,10 @@ 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
|
-
return /* @__PURE__ */ a(
|
|
831
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
831
832
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
832
833
|
Ci,
|
|
833
834
|
{
|
|
@@ -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((k) => !!k?.id).map((k) => k.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,17 +898,17 @@ 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
|
-
},
|
|
903
|
-
return /* @__PURE__ */ a(
|
|
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", k = typeof c == "function";
|
|
904
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
904
905
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
905
906
|
xt,
|
|
906
907
|
{
|
|
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: k || n,
|
|
978
979
|
size: "small",
|
|
979
|
-
value:
|
|
980
|
+
value: k ? "-" : 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
|
-
|
|
1000
|
+
children: ({ field: b, form: C }) => /* @__PURE__ */ e(
|
|
1001
|
+
ce,
|
|
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(
|
|
1222
|
+
const P = y.source.index, k = y.destination.index, b = Array.from(v), [C] = b.splice(P, 1);
|
|
1223
|
+
b.splice(k, 0, C), p && p(b, r);
|
|
1224
|
+
}, [r, p, v]);
|
|
1225
|
+
return /* @__PURE__ */ e(j, { 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((k, b) => {
|
|
1233
|
+
const C = l[k], N = d?.find((f) => f.key === k);
|
|
1234
|
+
return !C && !N ? (console.warn(`Property ${k} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
1234
1235
|
ai,
|
|
1235
1236
|
{
|
|
1236
|
-
draggableId: `array_field_${r}_${
|
|
1237
|
+
draggableId: `array_field_${r}_${k}}`,
|
|
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: k,
|
|
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}_${k}}`
|
|
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 k = 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: k,
|
|
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: k
|
|
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, k = 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
|
-
return /* @__PURE__ */ a(
|
|
1393
|
+
return /* @__PURE__ */ a(j, { 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(se, {}),
|
|
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: k,
|
|
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
|
-
return /* @__PURE__ */ a(
|
|
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
|
+
}, k = x && $e(x, o);
|
|
1495
|
+
return /* @__PURE__ */ a(j, { 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
|
+
`${k ? k.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), k = "description", b = r && I(u, k);
|
|
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: k,
|
|
1617
|
+
as: Z,
|
|
1615
1618
|
label: "Description",
|
|
1616
1619
|
disabled: i,
|
|
1617
1620
|
error: !!b
|
|
@@ -1628,7 +1631,7 @@ function _i({
|
|
|
1628
1631
|
showErrors: n
|
|
1629
1632
|
}) {
|
|
1630
1633
|
const { values: i, setFieldValue: l } = K();
|
|
1631
|
-
return /* @__PURE__ */ a(
|
|
1634
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1632
1635
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Ne, { children: [
|
|
1633
1636
|
t === "text_field" && /* @__PURE__ */ e(
|
|
1634
1637
|
Ee,
|
|
@@ -1697,14 +1700,14 @@ function _i({
|
|
|
1697
1700
|
}
|
|
1698
1701
|
function Fi({ disabled: t }) {
|
|
1699
1702
|
const { values: r } = K(), n = I(r, "defaultValue");
|
|
1700
|
-
return /* @__PURE__ */ a(
|
|
1703
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1701
1704
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Se, { disabled: t }) }) }),
|
|
1702
1705
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1703
1706
|
H,
|
|
1704
1707
|
{
|
|
1705
1708
|
name: "defaultValue",
|
|
1706
1709
|
children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
1707
|
-
|
|
1710
|
+
ce,
|
|
1708
1711
|
{
|
|
1709
1712
|
label: n == null ? "Default value not set" : "Default value is " + n.toString(),
|
|
1710
1713
|
disabled: t,
|
|
@@ -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]), k = /* @__PURE__ */ a(
|
|
1742
1747
|
z,
|
|
1743
1748
|
{
|
|
1744
1749
|
autoFocus: !0,
|
|
1745
1750
|
color: "primary",
|
|
1746
|
-
onClick: () =>
|
|
1747
|
-
startIcon: /* @__PURE__ */ e(
|
|
1751
|
+
onClick: () => p(!0),
|
|
1752
|
+
startIcon: /* @__PURE__ */ e(se, {}),
|
|
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
|
-
return /* @__PURE__ */ a(
|
|
1761
|
+
return /* @__PURE__ */ a(j, { 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
|
+
k
|
|
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",
|
|
@@ -1866,7 +1871,7 @@ function Ei({ disabled: t }) {
|
|
|
1866
1871
|
name: "validation.positive",
|
|
1867
1872
|
type: "checkbox",
|
|
1868
1873
|
children: ({ field: m, form: c }) => /* @__PURE__ */ e(
|
|
1869
|
-
|
|
1874
|
+
ce,
|
|
1870
1875
|
{
|
|
1871
1876
|
label: "Positive value",
|
|
1872
1877
|
disabled: t,
|
|
@@ -1882,7 +1887,7 @@ function Ei({ disabled: t }) {
|
|
|
1882
1887
|
name: "validation.negative",
|
|
1883
1888
|
type: "checkbox",
|
|
1884
1889
|
children: ({ field: m, form: c }) => /* @__PURE__ */ e(
|
|
1885
|
-
|
|
1890
|
+
ce,
|
|
1886
1891
|
{
|
|
1887
1892
|
label: "Negative value",
|
|
1888
1893
|
disabled: t,
|
|
@@ -1898,7 +1903,7 @@ function Ei({ disabled: t }) {
|
|
|
1898
1903
|
name: "validation.integer",
|
|
1899
1904
|
type: "checkbox",
|
|
1900
1905
|
children: ({ field: m, form: c }) => /* @__PURE__ */ e(
|
|
1901
|
-
|
|
1906
|
+
ce,
|
|
1902
1907
|
{
|
|
1903
1908
|
label: "Integer value",
|
|
1904
1909
|
disabled: t,
|
|
@@ -1912,7 +1917,7 @@ function Ei({ disabled: t }) {
|
|
|
1912
1917
|
}
|
|
1913
1918
|
function Ai({ disabled: t }) {
|
|
1914
1919
|
const { values: r, setFieldValue: n } = K();
|
|
1915
|
-
return /* @__PURE__ */ a(
|
|
1920
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1916
1921
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Ei, { disabled: t }) }) }),
|
|
1917
1922
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1918
1923
|
Oe,
|
|
@@ -1942,14 +1947,14 @@ 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
|
|
1946
|
-
return /* @__PURE__ */ e(
|
|
1950
|
+
const p = r ? "of.path" : "path", h = I(l, p), m = i && I(d, p);
|
|
1951
|
+
return /* @__PURE__ */ e(j, { 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
|
-
disabled: t || n,
|
|
1957
|
+
disabled: t && !!h || n,
|
|
1953
1958
|
value: h,
|
|
1954
1959
|
error: m,
|
|
1955
1960
|
handleChange: o,
|
|
@@ -1968,10 +1973,10 @@ 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 =
|
|
1974
|
-
return /* @__PURE__ */ a(
|
|
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);
|
|
1979
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
1975
1980
|
/* @__PURE__ */ a(
|
|
1976
1981
|
be,
|
|
1977
1982
|
{
|
|
@@ -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,15 +2058,15 @@ function Bi({ disabled: t }) {
|
|
|
2053
2058
|
errors: n,
|
|
2054
2059
|
touched: i,
|
|
2055
2060
|
setFieldValue: l
|
|
2056
|
-
} = K(), o = "mode", d = I(r, o),
|
|
2057
|
-
return /* @__PURE__ */ a(
|
|
2061
|
+
} = K(), o = "mode", d = I(r, o), u = I(i, o) && I(n, o), p = "autoValue", h = I(r, p), m = I(i, p) && I(n, p);
|
|
2062
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
2058
2063
|
/* @__PURE__ */ a("div", { className: "flex flex-col col-span-12", children: [
|
|
2059
2064
|
/* @__PURE__ */ a(
|
|
2060
2065
|
be,
|
|
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":
|
|
@@ -2116,7 +2121,7 @@ function Bi({ disabled: t }) {
|
|
|
2116
2121
|
function zi({ disabled: t }) {
|
|
2117
2122
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
2118
2123
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(H, { type: "checkbox", name: "hideFromCollection", children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
2119
|
-
|
|
2124
|
+
ce,
|
|
2120
2125
|
{
|
|
2121
2126
|
label: "Hide from collection",
|
|
2122
2127
|
disabled: t,
|
|
@@ -2131,7 +2136,7 @@ function zi({ disabled: t }) {
|
|
|
2131
2136
|
name: "readOnly",
|
|
2132
2137
|
type: "checkbox",
|
|
2133
2138
|
children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
2134
|
-
|
|
2139
|
+
ce,
|
|
2135
2140
|
{
|
|
2136
2141
|
label: "Read only",
|
|
2137
2142
|
disabled: t,
|
|
@@ -2145,7 +2150,7 @@ function zi({ disabled: t }) {
|
|
|
2145
2150
|
] });
|
|
2146
2151
|
}
|
|
2147
2152
|
function Mi({ disabled: t }) {
|
|
2148
|
-
return /* @__PURE__ */ e(
|
|
2153
|
+
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Se, { disabled: t }) }) }) });
|
|
2149
2154
|
}
|
|
2150
2155
|
function ar(t, r, n) {
|
|
2151
2156
|
let i;
|
|
@@ -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",
|
|
@@ -2398,7 +2403,7 @@ function Ri({
|
|
|
2398
2403
|
showErrors: r
|
|
2399
2404
|
}) {
|
|
2400
2405
|
const { values: n, setFieldValue: i } = K(), l = I(n, "url");
|
|
2401
|
-
return /* @__PURE__ */ a(
|
|
2406
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
2402
2407
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
2403
2408
|
be,
|
|
2404
2409
|
{
|
|
@@ -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: k,
|
|
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
|
-
return
|
|
2556
|
-
b?.(
|
|
2557
|
-
}, [
|
|
2560
|
+
return de(() => {
|
|
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: k,
|
|
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: k
|
|
2667
2672
|
}) {
|
|
2668
|
-
const [b,
|
|
2669
|
-
|
|
2670
|
-
if (
|
|
2673
|
+
const [b, C] = $(o), [N, f] = $(!1), [w, _] = $(t?.dataType ? Kt(t) : void 0), M = Object.entries(lr).concat(Object.entries(P)), R = v ? M.filter(([q, L]) => !ne(L.property) && L.property?.dataType !== "array") : M, D = Ir(t), A = Le(null), s = Le(t), V = c && I(r, "selectedWidget");
|
|
2674
|
+
de(() => {
|
|
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]), de(() => {
|
|
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: k,
|
|
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: k,
|
|
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: k,
|
|
2785
|
+
propertyConfigs: P
|
|
2781
2786
|
}
|
|
2782
|
-
) :
|
|
2787
|
+
) : w === "key_value" ? B = /* @__PURE__ */ e(Mi, { disabled: g }) : B = null, /* @__PURE__ */ a(j, { 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, ue = Me ? W(Me, J) : J;
|
|
2807
2812
|
return /* @__PURE__ */ a(
|
|
2808
2813
|
"div",
|
|
2809
2814
|
{
|
|
@@ -2815,15 +2820,15 @@ function ji({
|
|
|
2815
2820
|
we ? "w-full pointer-events-none opacity-50" : ""
|
|
2816
2821
|
),
|
|
2817
2822
|
children: [
|
|
2818
|
-
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(Ye, { propertyConfig:
|
|
2823
|
+
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(Ye, { propertyConfig: ue }) }),
|
|
2819
2824
|
/* @__PURE__ */ a("div", { className: "flex flex-col items-start text-base text-left", children: [
|
|
2820
|
-
/* @__PURE__ */ e("div", { children:
|
|
2825
|
+
/* @__PURE__ */ e("div", { children: ue.name }),
|
|
2821
2826
|
/* @__PURE__ */ e(
|
|
2822
|
-
|
|
2827
|
+
O,
|
|
2823
2828
|
{
|
|
2824
2829
|
variant: "caption",
|
|
2825
2830
|
color: "disabled",
|
|
2826
|
-
children: we ? "You can only switch to widgets that use the same data type" :
|
|
2831
|
+
children: we ? "You can only switch to widgets that use the same data type" : ue.description
|
|
2827
2832
|
}
|
|
2828
2833
|
)
|
|
2829
2834
|
] })
|
|
@@ -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,13 +3026,13 @@ function Gi({
|
|
|
3021
3026
|
setFieldValue: v,
|
|
3022
3027
|
setFieldError: x,
|
|
3023
3028
|
setFieldTouched: y,
|
|
3024
|
-
errors:
|
|
3025
|
-
dirty:
|
|
3026
|
-
} = K(), b = Ie(),
|
|
3027
|
-
|
|
3028
|
-
l && l(
|
|
3029
|
-
}, [
|
|
3030
|
-
const
|
|
3029
|
+
errors: P,
|
|
3030
|
+
dirty: k
|
|
3031
|
+
} = K(), b = Ie(), C = Nr(), N = !C, [f, w] = $(), [_, M] = $(), [R, D] = $(), A = _ ? ae(_, R) : void 0, s = A ? I(g.properties, A.replaceAll(".", ".properties.")) : void 0, [V, G] = $(!1), [B, q] = $(!1), [L, J] = $(!1), [le, Me] = $([]), we = Y.useRef(g.propertiesOrder ? { "": g.propertiesOrder } : {});
|
|
3032
|
+
de(() => {
|
|
3033
|
+
l && l(k);
|
|
3034
|
+
}, [k]);
|
|
3035
|
+
const ue = h ? () => {
|
|
3031
3036
|
h && (q(!0), h(g).then((F) => {
|
|
3032
3037
|
if (F && pt(F.properties), !F) {
|
|
3033
3038
|
b.open({
|
|
@@ -3036,8 +3041,8 @@ function Gi({
|
|
|
3036
3041
|
});
|
|
3037
3042
|
return;
|
|
3038
3043
|
}
|
|
3039
|
-
const
|
|
3040
|
-
if (
|
|
3044
|
+
const U = (F.properties ? Object.keys(F.properties) : []).filter((E) => !g.properties[E]);
|
|
3045
|
+
if (U.length === 0) {
|
|
3041
3046
|
b.open({
|
|
3042
3047
|
type: "info",
|
|
3043
3048
|
message: "No new properties found in existing data"
|
|
@@ -3045,81 +3050,87 @@ function Gi({
|
|
|
3045
3050
|
return;
|
|
3046
3051
|
}
|
|
3047
3052
|
const T = {
|
|
3048
|
-
...
|
|
3053
|
+
...U.reduce((E, ie) => (E[ie] = (F.properties ?? {})[ie], E), {}),
|
|
3049
3054
|
...g.properties
|
|
3050
|
-
},
|
|
3051
|
-
...
|
|
3055
|
+
}, S = [
|
|
3056
|
+
...U,
|
|
3052
3057
|
...g.propertiesOrder ?? []
|
|
3053
3058
|
];
|
|
3054
|
-
v("properties", T, !1), he(
|
|
3059
|
+
v("properties", T, !1), he(S), Me(U);
|
|
3055
3060
|
}).finally(() => {
|
|
3056
3061
|
q(!1);
|
|
3057
3062
|
}));
|
|
3058
|
-
} : void 0, re =
|
|
3059
|
-
const T = ye(
|
|
3060
|
-
v(T, F, !1), we.current[
|
|
3061
|
-
}, [v]), Te =
|
|
3062
|
-
const T = F ? ae(F,
|
|
3063
|
+
} : void 0, re = Q((F) => F ? we.current[F] ?? I(g, ye(F)) : we.current[""], [g]), he = Q((F, U) => {
|
|
3064
|
+
const T = ye(U);
|
|
3065
|
+
v(T, F, !1), we.current[U ?? ""] = F;
|
|
3066
|
+
}, [v]), Te = Q((F, U) => {
|
|
3067
|
+
const T = F ? ae(F, U) : void 0;
|
|
3063
3068
|
if (!T)
|
|
3064
3069
|
throw Error("collection editor miss config");
|
|
3065
3070
|
v(pe(T), void 0, !1);
|
|
3066
|
-
const
|
|
3067
|
-
he(
|
|
3068
|
-
}, [re, v, he]), Ge = (F,
|
|
3069
|
-
v(ye(
|
|
3071
|
+
const E = re(U).filter((ie) => ie !== F);
|
|
3072
|
+
he(E, U), J(!1), w(void 0), M(void 0), D(void 0);
|
|
3073
|
+
}, [re, v, he]), Ge = (F, U) => {
|
|
3074
|
+
v(ye(U), F, !1);
|
|
3070
3075
|
}, gt = ({
|
|
3071
3076
|
id: F,
|
|
3072
|
-
property:
|
|
3077
|
+
property: U
|
|
3073
3078
|
}) => {
|
|
3074
3079
|
if (!F)
|
|
3075
3080
|
throw Error("Need to include an ID when creating a new property");
|
|
3076
3081
|
v("properties", {
|
|
3077
3082
|
...g.properties ?? {},
|
|
3078
|
-
[F]:
|
|
3083
|
+
[F]: U
|
|
3079
3084
|
}, !1);
|
|
3080
3085
|
const T = [...g.propertiesOrder ?? Object.keys(g.properties), F];
|
|
3081
|
-
he(T),
|
|
3086
|
+
he(T), J(!1), C && (w(T.indexOf(F)), M(F)), D(void 0);
|
|
3082
3087
|
}, fe = ({
|
|
3083
3088
|
id: F,
|
|
3084
|
-
property:
|
|
3089
|
+
property: U,
|
|
3085
3090
|
previousId: T,
|
|
3086
|
-
namespace:
|
|
3091
|
+
namespace: S
|
|
3087
3092
|
}) => {
|
|
3088
|
-
const
|
|
3093
|
+
const E = F ? ae(F, S) : void 0, ie = E ? pe(E) : void 0;
|
|
3089
3094
|
if (T && T !== F) {
|
|
3090
|
-
|
|
3091
|
-
|
|
3095
|
+
console.debug("onPropertyChanged, id change", {
|
|
3096
|
+
id: F,
|
|
3097
|
+
property: U,
|
|
3098
|
+
previousId: T,
|
|
3099
|
+
namespace: S
|
|
3100
|
+
});
|
|
3101
|
+
const ke = ae(T, S), Vt = pe(ke), It = re(S).map((Xe) => Xe === T ? F : Xe).filter((Xe) => Xe !== void 0);
|
|
3102
|
+
he(It, S), F && (w(It.indexOf(F)), M(F)), v(Vt, void 0, !1), y(Vt, !1, !1);
|
|
3092
3103
|
}
|
|
3093
3104
|
console.debug("onPropertyChanged", {
|
|
3094
3105
|
id: F,
|
|
3095
|
-
property:
|
|
3106
|
+
property: U,
|
|
3096
3107
|
previousId: T,
|
|
3097
|
-
namespace:
|
|
3108
|
+
namespace: S,
|
|
3098
3109
|
propertyPath: ie
|
|
3099
|
-
}), ie && (v(ie,
|
|
3100
|
-
}, Ke =
|
|
3101
|
-
const
|
|
3110
|
+
}), ie && (v(ie, U, !1), y(ie, !0, !1));
|
|
3111
|
+
}, Ke = Q((F, U, T) => {
|
|
3112
|
+
const S = F ? ae(F, U) : void 0;
|
|
3102
3113
|
if (console.debug("onPropertyErrorInternal", {
|
|
3103
3114
|
id: F,
|
|
3104
|
-
namespace:
|
|
3115
|
+
namespace: U,
|
|
3105
3116
|
error: T,
|
|
3106
|
-
propertyPath:
|
|
3107
|
-
}),
|
|
3108
|
-
const
|
|
3109
|
-
i(F,
|
|
3117
|
+
propertyPath: S
|
|
3118
|
+
}), S) {
|
|
3119
|
+
const E = T && Object.keys(T).length > 0;
|
|
3120
|
+
i(F, U, E ? T : void 0), x(pe(S), E ? "Property error" : void 0);
|
|
3110
3121
|
}
|
|
3111
3122
|
}, []), 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(() =>
|
|
3123
|
+
w(void 0), M(void 0);
|
|
3124
|
+
}, Ze = _ && n?.current?.properties ? n.current.properties[_] : void 0, Je = g?.propertiesOrder === void 0 || g.propertiesOrder.length === 0, Re = g.propertiesOrder ? g.propertiesOrder : Object.keys(g.properties), Qe = Zt(() => u(g.ownerId), [u, g.ownerId]), vt = Q((F, U) => {
|
|
3114
3125
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
3115
3126
|
propertyKey: F,
|
|
3116
|
-
namespace:
|
|
3117
|
-
}),
|
|
3127
|
+
namespace: U
|
|
3128
|
+
}), w(Re.indexOf(F)), M(F), D(U);
|
|
3118
3129
|
}, [Re]), yt = /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3119
3130
|
/* @__PURE__ */ a("div", { className: me(
|
|
3120
3131
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
3121
3132
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
3122
|
-
!
|
|
3133
|
+
!N && "border-r " + wt
|
|
3123
3134
|
), children: [
|
|
3124
3135
|
/* @__PURE__ */ a("div", { className: "flex my-2", children: [
|
|
3125
3136
|
/* @__PURE__ */ a("div", { className: "flex-grow mb-4", children: [
|
|
@@ -3127,18 +3138,18 @@ function Gi({
|
|
|
3127
3138
|
H,
|
|
3128
3139
|
{
|
|
3129
3140
|
name: "name",
|
|
3130
|
-
as:
|
|
3141
|
+
as: Z,
|
|
3131
3142
|
invisible: !0,
|
|
3132
3143
|
className: "-ml-1",
|
|
3133
3144
|
inputClassName: "text-2xl font-headers",
|
|
3134
3145
|
placeholder: "Collection name",
|
|
3135
3146
|
size: "small",
|
|
3136
3147
|
required: !0,
|
|
3137
|
-
error: !!
|
|
3148
|
+
error: !!P?.name
|
|
3138
3149
|
}
|
|
3139
3150
|
),
|
|
3140
3151
|
Qe && /* @__PURE__ */ a(
|
|
3141
|
-
|
|
3152
|
+
O,
|
|
3142
3153
|
{
|
|
3143
3154
|
variant: "body2",
|
|
3144
3155
|
className: "ml-2",
|
|
@@ -3156,26 +3167,26 @@ function Gi({
|
|
|
3156
3167
|
oe,
|
|
3157
3168
|
{
|
|
3158
3169
|
variant: "filled",
|
|
3159
|
-
disabled:
|
|
3170
|
+
disabled: B,
|
|
3160
3171
|
onClick: () => G(!0),
|
|
3161
3172
|
children: /* @__PURE__ */ e($r, {})
|
|
3162
3173
|
}
|
|
3163
3174
|
) }),
|
|
3164
|
-
|
|
3175
|
+
ue && /* @__PURE__ */ e(te, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
|
|
3165
3176
|
oe,
|
|
3166
3177
|
{
|
|
3167
3178
|
variant: "filled",
|
|
3168
|
-
disabled:
|
|
3169
|
-
onClick:
|
|
3170
|
-
children:
|
|
3179
|
+
disabled: B,
|
|
3180
|
+
onClick: ue,
|
|
3181
|
+
children: B ? /* @__PURE__ */ e(De, { size: "small" }) : /* @__PURE__ */ e(ht, {})
|
|
3171
3182
|
}
|
|
3172
3183
|
) }),
|
|
3173
3184
|
/* @__PURE__ */ e(te, { title: "Add new property", children: /* @__PURE__ */ e(
|
|
3174
3185
|
z,
|
|
3175
3186
|
{
|
|
3176
3187
|
variant: "outlined",
|
|
3177
|
-
onClick: () =>
|
|
3178
|
-
children: /* @__PURE__ */ e(
|
|
3188
|
+
onClick: () => J(!0),
|
|
3189
|
+
children: /* @__PURE__ */ e(se, {})
|
|
3179
3190
|
}
|
|
3180
3191
|
) })
|
|
3181
3192
|
] })
|
|
@@ -3185,7 +3196,7 @@ function Gi({
|
|
|
3185
3196
|
{
|
|
3186
3197
|
className: "pl-8",
|
|
3187
3198
|
inferredPropertyKeys: le,
|
|
3188
|
-
selectedPropertyKey: _ ? ae(_,
|
|
3199
|
+
selectedPropertyKey: _ ? ae(_, R) : void 0,
|
|
3189
3200
|
properties: g.properties,
|
|
3190
3201
|
additionalFields: g.additionalFields,
|
|
3191
3202
|
propertiesOrder: Re,
|
|
@@ -3193,7 +3204,7 @@ function Gi({
|
|
|
3193
3204
|
onPropertyMove: Ge,
|
|
3194
3205
|
onPropertyRemove: r ? Te : void 0,
|
|
3195
3206
|
collectionEditable: c,
|
|
3196
|
-
errors:
|
|
3207
|
+
errors: P
|
|
3197
3208
|
}
|
|
3198
3209
|
) }),
|
|
3199
3210
|
/* @__PURE__ */ e(
|
|
@@ -3203,18 +3214,18 @@ function Gi({
|
|
|
3203
3214
|
color: "primary",
|
|
3204
3215
|
variant: "outlined",
|
|
3205
3216
|
size: "large",
|
|
3206
|
-
onClick: () =>
|
|
3207
|
-
startIcon: /* @__PURE__ */ e(
|
|
3217
|
+
onClick: () => J(!0),
|
|
3218
|
+
startIcon: /* @__PURE__ */ e(se, {}),
|
|
3208
3219
|
children: "Add new property"
|
|
3209
3220
|
}
|
|
3210
3221
|
)
|
|
3211
3222
|
] }),
|
|
3212
|
-
!
|
|
3223
|
+
!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
3224
|
Ce,
|
|
3214
3225
|
{
|
|
3215
3226
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
3216
3227
|
children: [
|
|
3217
|
-
|
|
3228
|
+
A && s && !ne(s) && /* @__PURE__ */ e(
|
|
3218
3229
|
sr,
|
|
3219
3230
|
{
|
|
3220
3231
|
inArray: !1,
|
|
@@ -3223,25 +3234,38 @@ function Gi({
|
|
|
3223
3234
|
allowDataInference: !r,
|
|
3224
3235
|
autoOpenTypeSelect: !1,
|
|
3225
3236
|
propertyKey: _,
|
|
3226
|
-
propertyNamespace:
|
|
3237
|
+
propertyNamespace: R,
|
|
3227
3238
|
property: s,
|
|
3228
3239
|
onPropertyChanged: fe,
|
|
3229
3240
|
onDelete: Te,
|
|
3230
3241
|
onError: Ke,
|
|
3231
3242
|
forceShowErrors: t,
|
|
3232
3243
|
initialErrors: Ze,
|
|
3233
|
-
getData:
|
|
3244
|
+
getData: p,
|
|
3234
3245
|
propertyConfigs: m,
|
|
3235
3246
|
collectionEditable: c
|
|
3236
3247
|
},
|
|
3237
3248
|
`edit_view_${f}`
|
|
3238
3249
|
),
|
|
3239
|
-
!s && /* @__PURE__ */
|
|
3240
|
-
|
|
3250
|
+
!s && /* @__PURE__ */ a("div", { className: "w-full flex flex-col items-center justify-center h-full gap-4", children: [
|
|
3251
|
+
/* @__PURE__ */ e(O, { variant: "label", className: "", children: Je ? "Now you can add your first property" : "Select a property to edit it" }),
|
|
3252
|
+
/* @__PURE__ */ a(
|
|
3253
|
+
z,
|
|
3254
|
+
{
|
|
3255
|
+
variant: "outlined",
|
|
3256
|
+
onClick: () => J(!0),
|
|
3257
|
+
children: [
|
|
3258
|
+
/* @__PURE__ */ e(se, {}),
|
|
3259
|
+
"Add new property"
|
|
3260
|
+
]
|
|
3261
|
+
}
|
|
3262
|
+
)
|
|
3263
|
+
] }),
|
|
3264
|
+
s && ne(s) && /* @__PURE__ */ e(O, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
|
|
3241
3265
|
]
|
|
3242
3266
|
}
|
|
3243
3267
|
) }),
|
|
3244
|
-
|
|
3268
|
+
N && /* @__PURE__ */ e(
|
|
3245
3269
|
Ve,
|
|
3246
3270
|
{
|
|
3247
3271
|
inArray: !1,
|
|
@@ -3251,22 +3275,22 @@ function Gi({
|
|
|
3251
3275
|
existingProperty: !0,
|
|
3252
3276
|
autoOpenTypeSelect: !1,
|
|
3253
3277
|
propertyKey: _,
|
|
3254
|
-
propertyNamespace:
|
|
3278
|
+
propertyNamespace: R,
|
|
3255
3279
|
property: s,
|
|
3256
3280
|
onPropertyChanged: fe,
|
|
3257
3281
|
onDelete: Te,
|
|
3258
3282
|
onError: Ke,
|
|
3259
3283
|
forceShowErrors: t,
|
|
3260
3284
|
initialErrors: Ze,
|
|
3261
|
-
getData:
|
|
3285
|
+
getData: p,
|
|
3262
3286
|
propertyConfigs: m,
|
|
3263
3287
|
collectionEditable: c,
|
|
3264
|
-
onOkClicked:
|
|
3288
|
+
onOkClicked: N ? We : void 0
|
|
3265
3289
|
},
|
|
3266
3290
|
`edit_view_${f}`
|
|
3267
3291
|
)
|
|
3268
3292
|
] });
|
|
3269
|
-
return /* @__PURE__ */ a(
|
|
3293
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
3270
3294
|
yt,
|
|
3271
3295
|
/* @__PURE__ */ e(
|
|
3272
3296
|
Ve,
|
|
@@ -3277,9 +3301,9 @@ function Gi({
|
|
|
3277
3301
|
autoUpdateId: !0,
|
|
3278
3302
|
forceShowErrors: t,
|
|
3279
3303
|
open: L,
|
|
3280
|
-
onCancel: () =>
|
|
3304
|
+
onCancel: () => J(!1),
|
|
3281
3305
|
onPropertyChanged: gt,
|
|
3282
|
-
getData:
|
|
3306
|
+
getData: p,
|
|
3283
3307
|
allowDataInference: !r,
|
|
3284
3308
|
propertyConfigs: m,
|
|
3285
3309
|
collectionEditable: c,
|
|
@@ -3312,9 +3336,9 @@ function Ki({
|
|
|
3312
3336
|
"aria-describedby": "alert-dialog-description",
|
|
3313
3337
|
children: [
|
|
3314
3338
|
/* @__PURE__ */ a(Be, { children: [
|
|
3315
|
-
/* @__PURE__ */ e(
|
|
3316
|
-
i && /* @__PURE__ */ e(
|
|
3317
|
-
/* @__PURE__ */ e(
|
|
3339
|
+
/* @__PURE__ */ e(O, { variant: "h6", children: l ?? "Unsaved changes" }),
|
|
3340
|
+
i && /* @__PURE__ */ e(O, { children: i }),
|
|
3341
|
+
/* @__PURE__ */ e(O, { children: "Are you sure?" })
|
|
3318
3342
|
] }),
|
|
3319
3343
|
/* @__PURE__ */ a(ze, { children: [
|
|
3320
3344
|
/* @__PURE__ */ e(z, { variant: "text", onClick: n, autoFocus: !0, children: " Cancel " }),
|
|
@@ -3335,7 +3359,7 @@ function Wi({ open: t, onClose: r }) {
|
|
|
3335
3359
|
open: t,
|
|
3336
3360
|
children: [
|
|
3337
3361
|
/* @__PURE__ */ a(Be, { className: "flex flex-col gap-4", children: [
|
|
3338
|
-
/* @__PURE__ */ e(
|
|
3362
|
+
/* @__PURE__ */ e(O, { variant: "h6", children: "Select view" }),
|
|
3339
3363
|
n?.map((i) => /* @__PURE__ */ a(
|
|
3340
3364
|
z,
|
|
3341
3365
|
{
|
|
@@ -3351,7 +3375,7 @@ function Wi({ open: t, onClose: r }) {
|
|
|
3351
3375
|
},
|
|
3352
3376
|
i.key
|
|
3353
3377
|
)),
|
|
3354
|
-
(n ?? []).length === 0 && /* @__PURE__ */ e(
|
|
3378
|
+
(n ?? []).length === 0 && /* @__PURE__ */ e(O, { variant: "body2", children: "No custom views defined" })
|
|
3355
3379
|
] }),
|
|
3356
3380
|
/* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(z, { variant: "outlined", onClick: () => r(), children: "Cancel" }) })
|
|
3357
3381
|
]
|
|
@@ -3366,30 +3390,91 @@ function Zi({
|
|
|
3366
3390
|
getUser: l,
|
|
3367
3391
|
parentCollectionIds: o
|
|
3368
3392
|
}) {
|
|
3369
|
-
const { entityViews: d } = Ae(), [
|
|
3393
|
+
const { entityViews: d } = Ae(), [u, p] = Y.useState(), [h, m] = Y.useState(!1), [c, g] = Y.useState(), [v, x] = Y.useState(), {
|
|
3370
3394
|
values: y,
|
|
3371
|
-
setFieldValue:
|
|
3372
|
-
} = K(),
|
|
3395
|
+
setFieldValue: P
|
|
3396
|
+
} = K(), k = t.subcollections ?? [], b = y.entityViews?.filter((f) => typeof f == "string").map((f) => xr(f, d)).filter(Boolean) ?? [], C = t.entityViews?.filter((f) => typeof f != "string") ?? [], N = b.length + C.length;
|
|
3373
3397
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3374
3398
|
/* @__PURE__ */ e(mt, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-16", children: [
|
|
3375
3399
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3376
|
-
/* @__PURE__ */ a(
|
|
3400
|
+
/* @__PURE__ */ a(O, { variant: "h5", children: [
|
|
3377
3401
|
"Subcollections of ",
|
|
3378
3402
|
y.name
|
|
3379
3403
|
] }),
|
|
3380
|
-
|
|
3381
|
-
|
|
3404
|
+
/* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3405
|
+
k && k.length > 0 && /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(Bt, { children: k.map((f) => /* @__PURE__ */ a(
|
|
3406
|
+
bt,
|
|
3407
|
+
{
|
|
3408
|
+
onClick: () => x({
|
|
3409
|
+
isNewCollection: !1,
|
|
3410
|
+
editedCollectionId: f.id
|
|
3411
|
+
}),
|
|
3412
|
+
children: [
|
|
3413
|
+
/* @__PURE__ */ e(
|
|
3414
|
+
Ue,
|
|
3415
|
+
{
|
|
3416
|
+
align: "left",
|
|
3417
|
+
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: f.name })
|
|
3418
|
+
}
|
|
3419
|
+
),
|
|
3420
|
+
/* @__PURE__ */ e(
|
|
3421
|
+
Ue,
|
|
3422
|
+
{
|
|
3423
|
+
align: "right",
|
|
3424
|
+
children: /* @__PURE__ */ e(te, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3425
|
+
oe,
|
|
3426
|
+
{
|
|
3427
|
+
size: "small",
|
|
3428
|
+
onClick: (w) => {
|
|
3429
|
+
w.preventDefault(), w.stopPropagation(), p(f.id);
|
|
3430
|
+
},
|
|
3431
|
+
color: "inherit",
|
|
3432
|
+
children: /* @__PURE__ */ e(dt, { size: "small" })
|
|
3433
|
+
}
|
|
3434
|
+
) })
|
|
3435
|
+
}
|
|
3436
|
+
)
|
|
3437
|
+
]
|
|
3438
|
+
},
|
|
3439
|
+
f.path
|
|
3440
|
+
)) }) }),
|
|
3441
|
+
/* @__PURE__ */ e(
|
|
3442
|
+
z,
|
|
3443
|
+
{
|
|
3444
|
+
onClick: () => {
|
|
3445
|
+
x({
|
|
3446
|
+
isNewCollection: !0
|
|
3447
|
+
});
|
|
3448
|
+
},
|
|
3449
|
+
variant: "text",
|
|
3450
|
+
startIcon: /* @__PURE__ */ e(se, {}),
|
|
3451
|
+
children: "Add subcollection"
|
|
3452
|
+
}
|
|
3453
|
+
)
|
|
3454
|
+
] })
|
|
3455
|
+
] }),
|
|
3456
|
+
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3457
|
+
/* @__PURE__ */ e(O, { variant: "h5", children: "Custom views" }),
|
|
3458
|
+
N === 0 && /* @__PURE__ */ e(Yr, { action: /* @__PURE__ */ e(
|
|
3459
|
+
z,
|
|
3382
3460
|
{
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3461
|
+
variant: "text",
|
|
3462
|
+
size: "small",
|
|
3463
|
+
href: "https://firecms.co/docs/customization_quickstart",
|
|
3464
|
+
component: "a",
|
|
3465
|
+
rel: "noopener noreferrer",
|
|
3466
|
+
target: "_blank",
|
|
3467
|
+
children: "More info"
|
|
3468
|
+
}
|
|
3469
|
+
), children: "Define your own custom views by uploading them with the CLI." }),
|
|
3470
|
+
/* @__PURE__ */ e(j, { children: /* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3471
|
+
/* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3472
|
+
b.map((f) => /* @__PURE__ */ a(bt, { children: [
|
|
3388
3473
|
/* @__PURE__ */ e(
|
|
3389
3474
|
Ue,
|
|
3390
3475
|
{
|
|
3391
3476
|
align: "left",
|
|
3392
|
-
children: /* @__PURE__ */ e(
|
|
3477
|
+
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: f.name })
|
|
3393
3478
|
}
|
|
3394
3479
|
),
|
|
3395
3480
|
/* @__PURE__ */ e(
|
|
@@ -3400,8 +3485,8 @@ function Zi({
|
|
|
3400
3485
|
oe,
|
|
3401
3486
|
{
|
|
3402
3487
|
size: "small",
|
|
3403
|
-
onClick: (
|
|
3404
|
-
|
|
3488
|
+
onClick: (w) => {
|
|
3489
|
+
w.preventDefault(), w.stopPropagation(), g(f.key);
|
|
3405
3490
|
},
|
|
3406
3491
|
color: "inherit",
|
|
3407
3492
|
children: /* @__PURE__ */ e(dt, { size: "small" })
|
|
@@ -3409,107 +3494,50 @@ function Zi({
|
|
|
3409
3494
|
) })
|
|
3410
3495
|
}
|
|
3411
3496
|
)
|
|
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(
|
|
3497
|
+
] }, f.key)),
|
|
3498
|
+
C.map((f) => /* @__PURE__ */ e(bt, { children: /* @__PURE__ */ a(
|
|
3435
3499
|
Ue,
|
|
3436
3500
|
{
|
|
3437
3501
|
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
|
-
) })
|
|
3502
|
+
children: [
|
|
3503
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: f.name }),
|
|
3504
|
+
/* @__PURE__ */ a(O, { variant: "caption", className: "flex-grow", children: [
|
|
3505
|
+
"This view is defined in code with key ",
|
|
3506
|
+
/* @__PURE__ */ e("code", { children: f.key })
|
|
3507
|
+
] })
|
|
3508
|
+
]
|
|
3456
3509
|
}
|
|
3457
|
-
)
|
|
3458
|
-
] }
|
|
3459
|
-
|
|
3460
|
-
|
|
3510
|
+
) }, f.key))
|
|
3511
|
+
] }) }),
|
|
3512
|
+
/* @__PURE__ */ e(
|
|
3513
|
+
z,
|
|
3461
3514
|
{
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
] })
|
|
3469
|
-
]
|
|
3515
|
+
onClick: () => {
|
|
3516
|
+
m(!0);
|
|
3517
|
+
},
|
|
3518
|
+
variant: "text",
|
|
3519
|
+
startIcon: /* @__PURE__ */ e(se, {}),
|
|
3520
|
+
children: "Add custom entity view"
|
|
3470
3521
|
}
|
|
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
|
-
)
|
|
3522
|
+
)
|
|
3523
|
+
] }) })
|
|
3496
3524
|
] })
|
|
3497
3525
|
] }) }),
|
|
3498
3526
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
3499
|
-
|
|
3527
|
+
u && /* @__PURE__ */ e(
|
|
3500
3528
|
lt,
|
|
3501
3529
|
{
|
|
3502
|
-
open: !!
|
|
3530
|
+
open: !!u,
|
|
3503
3531
|
onAccept: () => {
|
|
3504
3532
|
const f = {
|
|
3505
|
-
id:
|
|
3533
|
+
id: u,
|
|
3506
3534
|
parentCollectionIds: [...o ?? [], t.id]
|
|
3507
3535
|
};
|
|
3508
|
-
console.debug("Deleting subcollection", f), n.deleteCollection(f),
|
|
3536
|
+
console.debug("Deleting subcollection", f), n.deleteCollection(f), p(void 0);
|
|
3509
3537
|
},
|
|
3510
|
-
onCancel: () =>
|
|
3511
|
-
title: /* @__PURE__ */ e(
|
|
3512
|
-
body: /* @__PURE__ */ a(
|
|
3538
|
+
onCancel: () => p(void 0),
|
|
3539
|
+
title: /* @__PURE__ */ e(j, { children: "Delete this subcollection?" }),
|
|
3540
|
+
body: /* @__PURE__ */ a(j, { children: [
|
|
3513
3541
|
" This will ",
|
|
3514
3542
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
3515
3543
|
", only the collection in the CMS"
|
|
@@ -3521,11 +3549,11 @@ function Zi({
|
|
|
3521
3549
|
{
|
|
3522
3550
|
open: !!c,
|
|
3523
3551
|
onAccept: () => {
|
|
3524
|
-
|
|
3552
|
+
P("entityViews", y.entityViews?.filter((f) => f !== c)), g(void 0);
|
|
3525
3553
|
},
|
|
3526
3554
|
onCancel: () => g(void 0),
|
|
3527
|
-
title: /* @__PURE__ */ e(
|
|
3528
|
-
body: /* @__PURE__ */ a(
|
|
3555
|
+
title: /* @__PURE__ */ e(j, { children: "Remove this view?" }),
|
|
3556
|
+
body: /* @__PURE__ */ a(j, { children: [
|
|
3529
3557
|
"This will ",
|
|
3530
3558
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
3531
3559
|
", only the view in the CMS"
|
|
@@ -3553,7 +3581,7 @@ function Zi({
|
|
|
3553
3581
|
{
|
|
3554
3582
|
open: h,
|
|
3555
3583
|
onClose: (f) => {
|
|
3556
|
-
f &&
|
|
3584
|
+
f && P("entityViews", [...y.entityViews ?? [], f]), m(!1);
|
|
3557
3585
|
}
|
|
3558
3586
|
}
|
|
3559
3587
|
)
|
|
@@ -3988,11 +4016,11 @@ function Ji({
|
|
|
3988
4016
|
onContinue: i,
|
|
3989
4017
|
existingCollectionPaths: l
|
|
3990
4018
|
}) {
|
|
3991
|
-
const [o, d] = $(!1), [
|
|
3992
|
-
|
|
4019
|
+
const [o, d] = $(!1), [u, p] = $();
|
|
4020
|
+
de(() => {
|
|
3993
4021
|
r && l && (d(!0), r(t).then((v) => {
|
|
3994
|
-
const x = v.filter((y) => !(l ?? []).find((
|
|
3995
|
-
|
|
4022
|
+
const x = v.filter((y) => !(l ?? []).find((P) => P.trim().toLowerCase() === y.trim().toLowerCase()));
|
|
4023
|
+
p(x);
|
|
3996
4024
|
}).finally(() => d(!1)));
|
|
3997
4025
|
}, [l, t, r]);
|
|
3998
4026
|
const {
|
|
@@ -4006,16 +4034,16 @@ function Ji({
|
|
|
4006
4034
|
"div",
|
|
4007
4035
|
{
|
|
4008
4036
|
className: "flex flex-row py-2 pt-3 items-center",
|
|
4009
|
-
children: /* @__PURE__ */ e(
|
|
4037
|
+
children: /* @__PURE__ */ e(O, { variant: "h4", className: "flex-grow", children: "New collection" })
|
|
4010
4038
|
}
|
|
4011
4039
|
),
|
|
4012
|
-
n && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(
|
|
4040
|
+
n && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
4013
4041
|
"This is a subcollection of ",
|
|
4014
4042
|
/* @__PURE__ */ e("b", { children: n.name })
|
|
4015
4043
|
] }) }),
|
|
4016
4044
|
/* @__PURE__ */ a("div", { className: "my-2", children: [
|
|
4017
4045
|
/* @__PURE__ */ e(
|
|
4018
|
-
|
|
4046
|
+
O,
|
|
4019
4047
|
{
|
|
4020
4048
|
variant: "caption",
|
|
4021
4049
|
color: "secondary",
|
|
@@ -4023,8 +4051,8 @@ function Ji({
|
|
|
4023
4051
|
}
|
|
4024
4052
|
),
|
|
4025
4053
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
|
|
4026
|
-
o && !
|
|
4027
|
-
|
|
4054
|
+
o && !u && /* @__PURE__ */ e(De, { size: "small" }),
|
|
4055
|
+
u?.map((v, x) => /* @__PURE__ */ e(
|
|
4028
4056
|
st,
|
|
4029
4057
|
{
|
|
4030
4058
|
colorScheme: "cyanLighter",
|
|
@@ -4036,12 +4064,12 @@ function Ji({
|
|
|
4036
4064
|
},
|
|
4037
4065
|
v
|
|
4038
4066
|
)),
|
|
4039
|
-
!o && (
|
|
4067
|
+
!o && (u ?? [])?.length === 0 && /* @__PURE__ */ e(O, { variant: "caption", children: "No suggestions" })
|
|
4040
4068
|
] })
|
|
4041
4069
|
] }),
|
|
4042
4070
|
/* @__PURE__ */ a("div", { className: "my-2", children: [
|
|
4043
4071
|
/* @__PURE__ */ e(
|
|
4044
|
-
|
|
4072
|
+
O,
|
|
4045
4073
|
{
|
|
4046
4074
|
variant: "caption",
|
|
4047
4075
|
color: "secondary",
|
|
@@ -4097,7 +4125,7 @@ function Ji({
|
|
|
4097
4125
|
] }),
|
|
4098
4126
|
!n && /* @__PURE__ */ a("div", { children: [
|
|
4099
4127
|
/* @__PURE__ */ e(
|
|
4100
|
-
|
|
4128
|
+
O,
|
|
4101
4129
|
{
|
|
4102
4130
|
variant: "caption",
|
|
4103
4131
|
color: "secondary",
|
|
@@ -4128,7 +4156,7 @@ function nt({
|
|
|
4128
4156
|
),
|
|
4129
4157
|
children: [
|
|
4130
4158
|
n,
|
|
4131
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ e(
|
|
4159
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ e(O, { variant: "subtitle1", children: t }) })
|
|
4132
4160
|
]
|
|
4133
4161
|
}
|
|
4134
4162
|
) });
|
|
@@ -4142,40 +4170,40 @@ function Qi({
|
|
|
4142
4170
|
setFieldValue: i,
|
|
4143
4171
|
setFieldTouched: l,
|
|
4144
4172
|
values: o
|
|
4145
|
-
} = K(), [d,
|
|
4173
|
+
} = K(), [d, u] = $(void 0), p = Y.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), h = d ? d.id : void 0, m = d || void 0, c = ({
|
|
4146
4174
|
id: v,
|
|
4147
4175
|
property: x,
|
|
4148
4176
|
previousId: y,
|
|
4149
|
-
namespace:
|
|
4177
|
+
namespace: P
|
|
4150
4178
|
}) => {
|
|
4151
|
-
const
|
|
4152
|
-
const _ = ye(
|
|
4153
|
-
i(_, f, !1),
|
|
4179
|
+
const k = v ? ae(v, P) : void 0, b = k ? pe(k) : void 0, C = (f) => f ? p.current[f] ?? I(o, ye(f)) : p.current[""], N = (f, w) => {
|
|
4180
|
+
const _ = ye(w);
|
|
4181
|
+
i(_, f, !1), p.current[w ?? ""] = f;
|
|
4154
4182
|
};
|
|
4155
4183
|
if (y && y !== v) {
|
|
4156
|
-
const f = ae(y,
|
|
4157
|
-
|
|
4158
|
-
const
|
|
4159
|
-
Object.keys(
|
|
4160
|
-
|
|
4161
|
-
}), t.setHeadersMapping(
|
|
4184
|
+
const f = ae(y, P), w = pe(f), M = C(P).map((D) => D === y ? v : D).filter((D) => D !== void 0);
|
|
4185
|
+
N(M, P);
|
|
4186
|
+
const R = { ...t.headersMapping };
|
|
4187
|
+
Object.keys(R).forEach((D) => {
|
|
4188
|
+
R[D] === y && (R[D] = v ?? "");
|
|
4189
|
+
}), t.setHeadersMapping(R), i(w, void 0, !1), l(w, !1, !1);
|
|
4162
4190
|
}
|
|
4163
4191
|
b && (i(b, x, !1), l(b, !0, !1));
|
|
4164
4192
|
}, g = async ({
|
|
4165
4193
|
id: v,
|
|
4166
4194
|
importKey: x,
|
|
4167
4195
|
property: y,
|
|
4168
|
-
namespace:
|
|
4196
|
+
namespace: P
|
|
4169
4197
|
}) => {
|
|
4170
|
-
const
|
|
4171
|
-
...ti(
|
|
4198
|
+
const k = v ? ae(v, P) : void 0, b = k ? pe(k) : void 0, C = t.importData.map((f) => I(f, x)), N = {
|
|
4199
|
+
...ti(C, y, rr),
|
|
4172
4200
|
editable: !0
|
|
4173
4201
|
};
|
|
4174
|
-
b && (
|
|
4202
|
+
b && (N ? i(b, N, !1) : i(b, y, !1), l(b, !0, !1));
|
|
4175
4203
|
};
|
|
4176
4204
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
4177
4205
|
/* @__PURE__ */ a(mt, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
4178
|
-
/* @__PURE__ */ e(
|
|
4206
|
+
/* @__PURE__ */ e(O, { variant: "h6", className: "mt-4", children: "Data property mapping" }),
|
|
4179
4207
|
/* @__PURE__ */ e(
|
|
4180
4208
|
di,
|
|
4181
4209
|
{
|
|
@@ -4193,9 +4221,9 @@ function Qi({
|
|
|
4193
4221
|
{
|
|
4194
4222
|
property: v,
|
|
4195
4223
|
propertyKey: x,
|
|
4196
|
-
onPropertyNameChanged: (
|
|
4224
|
+
onPropertyNameChanged: (P, k) => i(`properties.${P}.name`, k, !1),
|
|
4197
4225
|
onEditClick: () => {
|
|
4198
|
-
!x || !v ||
|
|
4226
|
+
!x || !v || u({
|
|
4199
4227
|
...v,
|
|
4200
4228
|
id: x,
|
|
4201
4229
|
editable: !0
|
|
@@ -4206,8 +4234,8 @@ function Qi({
|
|
|
4206
4234
|
{
|
|
4207
4235
|
property: v,
|
|
4208
4236
|
disabled: !1,
|
|
4209
|
-
onPropertyChanged: (
|
|
4210
|
-
...
|
|
4237
|
+
onPropertyChanged: (P) => g({
|
|
4238
|
+
...P,
|
|
4211
4239
|
importKey: y
|
|
4212
4240
|
}),
|
|
4213
4241
|
propertyKey: x,
|
|
@@ -4231,10 +4259,10 @@ function Qi({
|
|
|
4231
4259
|
allowDataInference: !1,
|
|
4232
4260
|
collectionEditable: n,
|
|
4233
4261
|
onOkClicked: () => {
|
|
4234
|
-
|
|
4262
|
+
u(void 0);
|
|
4235
4263
|
},
|
|
4236
4264
|
onCancel: () => {
|
|
4237
|
-
|
|
4265
|
+
u(void 0);
|
|
4238
4266
|
},
|
|
4239
4267
|
autoOpenTypeSelect: !1,
|
|
4240
4268
|
existingProperty: !1,
|
|
@@ -4251,17 +4279,17 @@ function Xi({
|
|
|
4251
4279
|
propertyConfigs: i,
|
|
4252
4280
|
disabled: l
|
|
4253
4281
|
}) {
|
|
4254
|
-
const o = t ? Kt(t) : null, d = t ? $e(t, i) : null, [
|
|
4282
|
+
const o = t ? Kt(t) : null, d = t ? $e(t, i) : null, [u, p] = $(!1);
|
|
4255
4283
|
return /* @__PURE__ */ e(
|
|
4256
4284
|
te,
|
|
4257
4285
|
{
|
|
4258
4286
|
title: t && d ? `${d?.name} - ${t.dataType}` : void 0,
|
|
4259
|
-
open:
|
|
4287
|
+
open: u ? !1 : void 0,
|
|
4260
4288
|
children: /* @__PURE__ */ e(
|
|
4261
4289
|
be,
|
|
4262
4290
|
{
|
|
4263
|
-
open:
|
|
4264
|
-
onOpenChange:
|
|
4291
|
+
open: u,
|
|
4292
|
+
onOpenChange: p,
|
|
4265
4293
|
invisible: !0,
|
|
4266
4294
|
className: "w-full",
|
|
4267
4295
|
disabled: l,
|
|
@@ -4295,7 +4323,7 @@ function Xi({
|
|
|
4295
4323
|
);
|
|
4296
4324
|
}
|
|
4297
4325
|
function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
4298
|
-
|
|
4326
|
+
de(() => {
|
|
4299
4327
|
const l = pi(t.originProperties, r), o = t.importData.map((d) => mi(d, t.idColumn, t.headersMapping, r, l, "TEMP_PATH"));
|
|
4300
4328
|
t.setEntities(o);
|
|
4301
4329
|
}, []);
|
|
@@ -4304,8 +4332,8 @@ function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
|
4304
4332
|
Tr,
|
|
4305
4333
|
{
|
|
4306
4334
|
title: /* @__PURE__ */ a("div", { children: [
|
|
4307
|
-
/* @__PURE__ */ e(
|
|
4308
|
-
/* @__PURE__ */ e(
|
|
4335
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Imported data preview" }),
|
|
4336
|
+
/* @__PURE__ */ e(O, { variant: "caption", children: "Entities with the same id will be overwritten" })
|
|
4309
4337
|
] }),
|
|
4310
4338
|
tableController: {
|
|
4311
4339
|
data: t.entities,
|
|
@@ -4323,15 +4351,15 @@ function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
|
4323
4351
|
}
|
|
4324
4352
|
function dr(t, r = "") {
|
|
4325
4353
|
const n = Object.keys(t).reduce((o, d) => {
|
|
4326
|
-
const
|
|
4327
|
-
if (
|
|
4328
|
-
const g = dr(
|
|
4354
|
+
const u = t[d], p = kr(d), h = r ? `${r}.${p}` : p;
|
|
4355
|
+
if (u.dataType === "map" && u.properties) {
|
|
4356
|
+
const g = dr(u.properties, h);
|
|
4329
4357
|
return {
|
|
4330
4358
|
headersMapping: { ...o.headersMapping, [d]: h },
|
|
4331
4359
|
properties: {
|
|
4332
4360
|
...o.properties,
|
|
4333
|
-
[
|
|
4334
|
-
...
|
|
4361
|
+
[p]: {
|
|
4362
|
+
...u,
|
|
4335
4363
|
properties: g.properties,
|
|
4336
4364
|
propertiesOrder: Object.keys(g.properties)
|
|
4337
4365
|
}
|
|
@@ -4340,7 +4368,7 @@ function dr(t, r = "") {
|
|
|
4340
4368
|
}
|
|
4341
4369
|
const m = {
|
|
4342
4370
|
...o.properties,
|
|
4343
|
-
[
|
|
4371
|
+
[p]: u
|
|
4344
4372
|
};
|
|
4345
4373
|
return {
|
|
4346
4374
|
headersMapping: { ...o.headersMapping, [d]: h },
|
|
@@ -4354,10 +4382,10 @@ function dr(t, r = "") {
|
|
|
4354
4382
|
};
|
|
4355
4383
|
}
|
|
4356
4384
|
function ur(t) {
|
|
4357
|
-
const r = t.open, [n, i] = je.useState(!1), [l, o] = je.useState(!1), d =
|
|
4385
|
+
const r = t.open, [n, i] = je.useState(!1), [l, o] = je.useState(!1), d = Q(() => {
|
|
4358
4386
|
n ? o(!0) : t.handleClose(void 0);
|
|
4359
4387
|
}, [n, t.handleClose]);
|
|
4360
|
-
return
|
|
4388
|
+
return de(() => {
|
|
4361
4389
|
r || (i(!1), o(!1));
|
|
4362
4390
|
}, [r]), /* @__PURE__ */ a(
|
|
4363
4391
|
Fe,
|
|
@@ -4367,7 +4395,7 @@ function ur(t) {
|
|
|
4367
4395
|
fullHeight: !0,
|
|
4368
4396
|
scrollable: !1,
|
|
4369
4397
|
maxWidth: "7xl",
|
|
4370
|
-
onOpenChange: (
|
|
4398
|
+
onOpenChange: (u) => u ? void 0 : d(),
|
|
4371
4399
|
children: [
|
|
4372
4400
|
r && /* @__PURE__ */ e(
|
|
4373
4401
|
tn,
|
|
@@ -4394,8 +4422,8 @@ function tn(t) {
|
|
|
4394
4422
|
const { propertyConfigs: r } = Ae(), n = Pe(), i = _e(), {
|
|
4395
4423
|
topLevelNavigation: l,
|
|
4396
4424
|
collections: o
|
|
4397
|
-
} = n, d = t.initialValues,
|
|
4398
|
-
if (
|
|
4425
|
+
} = n, d = t.initialValues, u = !d?.path && (t.parentCollectionIds ?? []).length === 0, p = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], h = p.map((b) => b.path.trim().toLowerCase()), m = p.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [c, g] = je.useState(), [v, x] = je.useState(!1);
|
|
4426
|
+
if (de(() => {
|
|
4399
4427
|
try {
|
|
4400
4428
|
n.initialised && (t.editedCollectionId ? g(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : g(void 0), x(!0));
|
|
4401
4429
|
} catch (b) {
|
|
@@ -4405,10 +4433,10 @@ function tn(t) {
|
|
|
4405
4433
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
4406
4434
|
const {
|
|
4407
4435
|
groups: y
|
|
4408
|
-
} = l,
|
|
4436
|
+
} = l, P = c ? {
|
|
4409
4437
|
...c,
|
|
4410
4438
|
id: c.id ?? c.path ?? _t(16)
|
|
4411
|
-
} : void 0,
|
|
4439
|
+
} : void 0, k = P ? nn(P, r) : {
|
|
4412
4440
|
id: d?.path ?? _t(16),
|
|
4413
4441
|
path: d?.path ?? "",
|
|
4414
4442
|
name: d?.name ?? "",
|
|
@@ -4422,10 +4450,10 @@ function tn(t) {
|
|
|
4422
4450
|
rn,
|
|
4423
4451
|
{
|
|
4424
4452
|
...t,
|
|
4425
|
-
initialValues:
|
|
4453
|
+
initialValues: k,
|
|
4426
4454
|
existingPaths: h,
|
|
4427
4455
|
existingIds: m,
|
|
4428
|
-
includeTemplates:
|
|
4456
|
+
includeTemplates: u,
|
|
4429
4457
|
collection: c,
|
|
4430
4458
|
setCollection: g,
|
|
4431
4459
|
groups: y,
|
|
@@ -4441,8 +4469,8 @@ function rn({
|
|
|
4441
4469
|
fullPath: l,
|
|
4442
4470
|
collectionInference: o,
|
|
4443
4471
|
handleClose: d,
|
|
4444
|
-
reservedGroups:
|
|
4445
|
-
extraView:
|
|
4472
|
+
reservedGroups: u,
|
|
4473
|
+
extraView: p,
|
|
4446
4474
|
handleCancel: h,
|
|
4447
4475
|
setFormDirty: m,
|
|
4448
4476
|
pathSuggestions: c,
|
|
@@ -4450,67 +4478,65 @@ function rn({
|
|
|
4450
4478
|
parentCollection: v,
|
|
4451
4479
|
getData: x,
|
|
4452
4480
|
existingPaths: y,
|
|
4453
|
-
existingIds:
|
|
4454
|
-
includeTemplates:
|
|
4481
|
+
existingIds: P,
|
|
4482
|
+
includeTemplates: k,
|
|
4455
4483
|
collection: b,
|
|
4456
|
-
setCollection:
|
|
4457
|
-
initialValues:
|
|
4484
|
+
setCollection: C,
|
|
4485
|
+
initialValues: N,
|
|
4458
4486
|
propertyConfigs: f,
|
|
4459
|
-
groups:
|
|
4487
|
+
groups: w
|
|
4460
4488
|
}) {
|
|
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;
|
|
4489
|
+
const _ = hi(), M = Pe(), R = Ie(), D = Le({}), A = t ? k ? "welcome" : "details" : "properties", [s, V] = $(A), [G, B] = je.useState(), q = (T) => {
|
|
4490
|
+
const S = T.id || T.path;
|
|
4465
4491
|
return r.saveCollection({
|
|
4466
|
-
id:
|
|
4492
|
+
id: S,
|
|
4467
4493
|
collectionData: T,
|
|
4468
4494
|
previousId: n,
|
|
4469
4495
|
parentCollectionIds: i
|
|
4470
|
-
}).then(() => (
|
|
4496
|
+
}).then(() => (B(void 0), !0)).catch((E) => (B(E), console.error(E), R.open({
|
|
4471
4497
|
type: "error",
|
|
4472
|
-
message: "Error persisting collection: " + (
|
|
4498
|
+
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4473
4499
|
}), !1));
|
|
4474
|
-
}, L =
|
|
4475
|
-
s === "details" ? _.inUse ? V("import_data_saving") : V(
|
|
4476
|
-
}, [s, _.inUse,
|
|
4500
|
+
}, L = Q(() => {
|
|
4501
|
+
s === "details" ? _.inUse ? V("import_data_saving") : V(p ? "extra_view" : "properties") : V(s === "welcome" ? "details" : s === "import_data_mapping" ? "import_data_preview" : s === "import_data_preview" ? "details" : s === "extra_view" ? "properties" : "details");
|
|
4502
|
+
}, [s, _.inUse, p]), J = Q((T) => {
|
|
4477
4503
|
if (o)
|
|
4478
4504
|
return o?.(T.path, T.collectionGroup ?? !1, i ?? []);
|
|
4479
|
-
}, [o, i]), le =
|
|
4505
|
+
}, [o, i]), le = Q(async (T) => {
|
|
4480
4506
|
try {
|
|
4481
|
-
if (!
|
|
4482
|
-
return
|
|
4507
|
+
if (!J)
|
|
4508
|
+
return C(T), Promise.resolve(T);
|
|
4483
4509
|
V("loading");
|
|
4484
|
-
const
|
|
4485
|
-
if (!
|
|
4486
|
-
return
|
|
4487
|
-
const
|
|
4510
|
+
const S = await J?.(T);
|
|
4511
|
+
if (!S)
|
|
4512
|
+
return C(T), Promise.resolve(T);
|
|
4513
|
+
const E = {
|
|
4488
4514
|
...T ?? {}
|
|
4489
4515
|
};
|
|
4490
|
-
return Object.keys(
|
|
4516
|
+
return Object.keys(S.properties ?? {}).length > 0 && (E.properties = S.properties, E.propertiesOrder = S.propertiesOrder), E.propertiesOrder ? (C(E), console.debug("Inferred collection", {
|
|
4491
4517
|
newCollection: T ?? {},
|
|
4492
|
-
values:
|
|
4493
|
-
}),
|
|
4494
|
-
} catch (
|
|
4495
|
-
return console.error(
|
|
4518
|
+
values: E
|
|
4519
|
+
}), E) : (E.propertiesOrder = Object.keys(E.properties), E);
|
|
4520
|
+
} catch (S) {
|
|
4521
|
+
return console.error(S), R.open({
|
|
4496
4522
|
type: "error",
|
|
4497
|
-
message: "Error inferring collection: " + (
|
|
4523
|
+
message: "Error inferring collection: " + (S.message ?? "Details in the console")
|
|
4498
4524
|
}), T;
|
|
4499
4525
|
}
|
|
4500
|
-
}, [i,
|
|
4501
|
-
initialValues:
|
|
4502
|
-
onSubmit: (T,
|
|
4526
|
+
}, [i, J]), ue = Tt({
|
|
4527
|
+
initialValues: N,
|
|
4528
|
+
onSubmit: (T, S) => {
|
|
4503
4529
|
console.log("Submitting collection", T);
|
|
4504
4530
|
try {
|
|
4505
4531
|
if (!t) {
|
|
4506
4532
|
q(T).then(() => {
|
|
4507
|
-
|
|
4533
|
+
S.resetForm({ values: N }), d(T);
|
|
4508
4534
|
});
|
|
4509
4535
|
return;
|
|
4510
4536
|
}
|
|
4511
|
-
s === "welcome" ? (L(),
|
|
4512
|
-
|
|
4513
|
-
values:
|
|
4537
|
+
s === "welcome" ? (L(), S.resetForm({ values: T })) : s === "details" ? p || _.inUse ? (S.resetForm({ values: T }), L()) : t ? le(T).then((E) => {
|
|
4538
|
+
S.resetForm({
|
|
4539
|
+
values: E ?? T,
|
|
4514
4540
|
touched: {
|
|
4515
4541
|
path: !0,
|
|
4516
4542
|
name: !0
|
|
@@ -4518,34 +4544,34 @@ function rn({
|
|
|
4518
4544
|
});
|
|
4519
4545
|
}).finally(() => {
|
|
4520
4546
|
L();
|
|
4521
|
-
}) : (
|
|
4522
|
-
|
|
4523
|
-
}) : (L(),
|
|
4524
|
-
} catch (
|
|
4525
|
-
|
|
4547
|
+
}) : (S.resetForm({ values: T }), L()) : s === "extra_view" ? (L(), S.resetForm({ values: T })) : s === "import_data_mapping" || s === "import_data_preview" ? L() : s === "properties" ? q(T).then(() => {
|
|
4548
|
+
S.resetForm({ values: N }), L(), d(T);
|
|
4549
|
+
}) : (L(), S.resetForm({ values: T }));
|
|
4550
|
+
} catch (E) {
|
|
4551
|
+
R.open({
|
|
4526
4552
|
type: "error",
|
|
4527
|
-
message: "Error persisting collection: " + (
|
|
4528
|
-
}), console.error(
|
|
4553
|
+
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4554
|
+
}), console.error(E), S.resetForm({ values: T });
|
|
4529
4555
|
}
|
|
4530
4556
|
},
|
|
4531
4557
|
validation: (T) => {
|
|
4532
|
-
let
|
|
4533
|
-
const
|
|
4534
|
-
if (
|
|
4558
|
+
let S = {};
|
|
4559
|
+
const E = (s === "properties" || s === "subcollections" || s === "details") && vi;
|
|
4560
|
+
if (E)
|
|
4535
4561
|
try {
|
|
4536
|
-
|
|
4562
|
+
E.validateSync(T, { abortEarly: !1 });
|
|
4537
4563
|
} catch (ie) {
|
|
4538
4564
|
ie.inner.forEach((ke) => {
|
|
4539
|
-
|
|
4565
|
+
S[ke.path] = ke.message;
|
|
4540
4566
|
});
|
|
4541
4567
|
}
|
|
4542
|
-
if (s === "properties" && (
|
|
4568
|
+
if (s === "properties" && (S = { ...S, ...D.current }), s === "details") {
|
|
4543
4569
|
const ie = Ht(T.path, t, y, T.id);
|
|
4544
|
-
ie && (
|
|
4545
|
-
const ke = an(T.id, t, y,
|
|
4546
|
-
ke && (
|
|
4570
|
+
ie && (S.path = ie);
|
|
4571
|
+
const ke = an(T.id, t, y, P);
|
|
4572
|
+
ke && (S.id = ke);
|
|
4547
4573
|
}
|
|
4548
|
-
return
|
|
4574
|
+
return S;
|
|
4549
4575
|
}
|
|
4550
4576
|
}), {
|
|
4551
4577
|
values: re,
|
|
@@ -4553,21 +4579,21 @@ function rn({
|
|
|
4553
4579
|
isSubmitting: Te,
|
|
4554
4580
|
dirty: Ge,
|
|
4555
4581
|
submitCount: gt
|
|
4556
|
-
} =
|
|
4557
|
-
|
|
4582
|
+
} = ue, fe = re.path ?? n, Ke = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + fe : fe, We = Ht(fe, t, y, re.id), Ze = !We && i ? M.convertIdsToPaths(i) : void 0, Je = We ? void 0 : M.resolveAliasesFrom(Ke), Re = Je && x ? () => x(Je, Ze ?? []) : void 0;
|
|
4583
|
+
de(() => {
|
|
4558
4584
|
m(Ge);
|
|
4559
4585
|
}, [Ge]);
|
|
4560
4586
|
function Qe(T) {
|
|
4561
|
-
_.setInUse(!0), ri(T, rr).then((
|
|
4562
|
-
const
|
|
4563
|
-
he("properties",
|
|
4587
|
+
_.setInUse(!0), ri(T, rr).then((S) => {
|
|
4588
|
+
const E = dr(S);
|
|
4589
|
+
he("properties", E.properties), he("propertiesOrder", Object.keys(E.properties)), _.setIdColumn(E.idColumn), _.setImportData(T), _.setHeadersMapping(E.headersMapping), _.setOriginProperties(E.properties);
|
|
4564
4590
|
});
|
|
4565
4591
|
}
|
|
4566
4592
|
const vt = !!re.name && !!re.id, yt = () => {
|
|
4567
4593
|
const T = { ...re.properties };
|
|
4568
4594
|
_.idColumn && delete T[_.idColumn], he("properties", T), L();
|
|
4569
|
-
},
|
|
4570
|
-
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value:
|
|
4595
|
+
}, U = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4596
|
+
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value: ue, children: /* @__PURE__ */ a(j, { children: [
|
|
4571
4597
|
!t && /* @__PURE__ */ a(
|
|
4572
4598
|
Hr,
|
|
4573
4599
|
{
|
|
@@ -4585,14 +4611,14 @@ function rn({
|
|
|
4585
4611
|
"form",
|
|
4586
4612
|
{
|
|
4587
4613
|
noValidate: !0,
|
|
4588
|
-
onSubmit:
|
|
4614
|
+
onSubmit: ue.handleSubmit,
|
|
4589
4615
|
className: me(
|
|
4590
4616
|
t ? "h-full" : "h-[calc(100%-48px)]",
|
|
4591
4617
|
"flex-grow flex flex-col relative"
|
|
4592
4618
|
),
|
|
4593
4619
|
children: [
|
|
4594
4620
|
s === "loading" && /* @__PURE__ */ e(Nt, {}),
|
|
4595
|
-
s === "extra_view" && fe &&
|
|
4621
|
+
s === "extra_view" && fe && p?.View && /* @__PURE__ */ e(p.View, { path: fe }),
|
|
4596
4622
|
s === "welcome" && /* @__PURE__ */ e(
|
|
4597
4623
|
Ji,
|
|
4598
4624
|
{
|
|
@@ -4609,7 +4635,7 @@ function rn({
|
|
|
4609
4635
|
Qi,
|
|
4610
4636
|
{
|
|
4611
4637
|
importConfig: _,
|
|
4612
|
-
collectionEditable:
|
|
4638
|
+
collectionEditable: U,
|
|
4613
4639
|
propertyConfigs: f
|
|
4614
4640
|
}
|
|
4615
4641
|
),
|
|
@@ -4627,7 +4653,7 @@ function rn({
|
|
|
4627
4653
|
importConfig: _,
|
|
4628
4654
|
collection: re,
|
|
4629
4655
|
onImportSuccess: async (T) => {
|
|
4630
|
-
|
|
4656
|
+
R.open({
|
|
4631
4657
|
type: "info",
|
|
4632
4658
|
message: "Data imported successfully"
|
|
4633
4659
|
}), await q(re), d(T);
|
|
@@ -4638,8 +4664,8 @@ function rn({
|
|
|
4638
4664
|
yi,
|
|
4639
4665
|
{
|
|
4640
4666
|
existingPaths: y,
|
|
4641
|
-
existingIds:
|
|
4642
|
-
groups:
|
|
4667
|
+
existingIds: P,
|
|
4668
|
+
groups: w,
|
|
4643
4669
|
parentCollectionIds: i,
|
|
4644
4670
|
parentCollection: v,
|
|
4645
4671
|
isNewCollection: t
|
|
@@ -4661,25 +4687,25 @@ function rn({
|
|
|
4661
4687
|
{
|
|
4662
4688
|
showErrors: gt > 0,
|
|
4663
4689
|
isNewCollection: t,
|
|
4664
|
-
reservedGroups:
|
|
4665
|
-
onPropertyError: (T,
|
|
4690
|
+
reservedGroups: u,
|
|
4691
|
+
onPropertyError: (T, S, E) => {
|
|
4666
4692
|
const ie = Ft({
|
|
4667
|
-
...
|
|
4668
|
-
[ir(T,
|
|
4693
|
+
...D.current,
|
|
4694
|
+
[ir(T, S)]: Ft(E, !0)
|
|
4669
4695
|
}, !0);
|
|
4670
|
-
|
|
4696
|
+
D.current = ie, ue.validate();
|
|
4671
4697
|
},
|
|
4672
4698
|
getUser: g,
|
|
4673
4699
|
getData: Re,
|
|
4674
|
-
doCollectionInference:
|
|
4700
|
+
doCollectionInference: J,
|
|
4675
4701
|
propertyConfigs: f,
|
|
4676
|
-
collectionEditable:
|
|
4677
|
-
extraIcon:
|
|
4702
|
+
collectionEditable: U,
|
|
4703
|
+
extraIcon: p?.icon && /* @__PURE__ */ e(
|
|
4678
4704
|
oe,
|
|
4679
4705
|
{
|
|
4680
4706
|
color: "primary",
|
|
4681
4707
|
onClick: () => V("extra_view"),
|
|
4682
|
-
children:
|
|
4708
|
+
children: p.icon
|
|
4683
4709
|
}
|
|
4684
4710
|
)
|
|
4685
4711
|
}
|
|
@@ -4690,7 +4716,7 @@ function rn({
|
|
|
4690
4716
|
position: "absolute",
|
|
4691
4717
|
children: [
|
|
4692
4718
|
G && /* @__PURE__ */ e(Wt, { error: G }),
|
|
4693
|
-
t &&
|
|
4719
|
+
t && k && s === "import_data_mapping" && /* @__PURE__ */ a(
|
|
4694
4720
|
z,
|
|
4695
4721
|
{
|
|
4696
4722
|
variant: "text",
|
|
@@ -4702,7 +4728,7 @@ function rn({
|
|
|
4702
4728
|
]
|
|
4703
4729
|
}
|
|
4704
4730
|
),
|
|
4705
|
-
t &&
|
|
4731
|
+
t && k && s === "import_data_preview" && /* @__PURE__ */ a(
|
|
4706
4732
|
z,
|
|
4707
4733
|
{
|
|
4708
4734
|
variant: "text",
|
|
@@ -4716,7 +4742,7 @@ function rn({
|
|
|
4716
4742
|
]
|
|
4717
4743
|
}
|
|
4718
4744
|
),
|
|
4719
|
-
t &&
|
|
4745
|
+
t && k && s === "details" && /* @__PURE__ */ a(
|
|
4720
4746
|
z,
|
|
4721
4747
|
{
|
|
4722
4748
|
variant: "text",
|
|
@@ -4840,102 +4866,102 @@ const Ht = (t, r, n, i) => {
|
|
|
4840
4866
|
reservedGroups: l,
|
|
4841
4867
|
collectionInference: o,
|
|
4842
4868
|
extraView: d,
|
|
4843
|
-
pathSuggestions:
|
|
4844
|
-
getUser:
|
|
4869
|
+
pathSuggestions: u,
|
|
4870
|
+
getUser: p,
|
|
4845
4871
|
getData: h,
|
|
4846
4872
|
onAnalyticsEvent: m
|
|
4847
4873
|
}) {
|
|
4848
4874
|
const c = Pe(), g = gi(), v = Ie(), { propertyConfigs: x } = Ae(), {
|
|
4849
4875
|
collections: y
|
|
4850
|
-
} = c,
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
b(s.filter((V) => !
|
|
4876
|
+
} = c, P = (y ?? []).map((s) => s.path.trim().toLowerCase()), [k, b] = Y.useState();
|
|
4877
|
+
de(() => {
|
|
4878
|
+
u && u().then((s) => {
|
|
4879
|
+
b(s.filter((V) => !P.includes(V.trim().toLowerCase())));
|
|
4854
4880
|
});
|
|
4855
|
-
}, [
|
|
4856
|
-
const [
|
|
4881
|
+
}, [u]);
|
|
4882
|
+
const [C, N] = Y.useState(), [f, w] = Y.useState(), _ = Q(() => ({
|
|
4857
4883
|
createCollections: !0,
|
|
4858
4884
|
editCollections: !0,
|
|
4859
4885
|
deleteCollections: !0
|
|
4860
|
-
}), []),
|
|
4886
|
+
}), []), M = Q(({
|
|
4861
4887
|
id: s,
|
|
4862
4888
|
fullPath: V,
|
|
4863
4889
|
parentCollectionIds: G,
|
|
4864
|
-
parentCollection:
|
|
4890
|
+
parentCollection: B
|
|
4865
4891
|
}) => {
|
|
4866
|
-
console.debug("Edit collection", s, V, G,
|
|
4892
|
+
console.debug("Edit collection", s, V, G, B), m?.("edit_collection", { id: s, fullPath: V }), N({
|
|
4867
4893
|
editedCollectionId: s,
|
|
4868
4894
|
fullPath: V,
|
|
4869
4895
|
parentCollectionIds: G,
|
|
4870
4896
|
isNewCollection: !1,
|
|
4871
|
-
parentCollection:
|
|
4897
|
+
parentCollection: B,
|
|
4872
4898
|
redirect: !1
|
|
4873
4899
|
});
|
|
4874
|
-
}, []),
|
|
4900
|
+
}, []), R = Q(({
|
|
4875
4901
|
propertyKey: s,
|
|
4876
4902
|
property: V,
|
|
4877
4903
|
editedCollectionId: G,
|
|
4878
|
-
currentPropertiesOrder:
|
|
4904
|
+
currentPropertiesOrder: B,
|
|
4879
4905
|
parentCollectionIds: q,
|
|
4880
4906
|
collection: L
|
|
4881
4907
|
}) => {
|
|
4882
|
-
console.debug("edit property", s, V, G,
|
|
4883
|
-
const
|
|
4884
|
-
|
|
4908
|
+
console.debug("edit property", s, V, G, B, q, L), m?.("edit_property", { propertyKey: s, editedCollectionId: G });
|
|
4909
|
+
const J = s && s.includes(".") ? s.substring(0, s.lastIndexOf(".")) : void 0, le = s && s.includes(".") ? s.substring(s.lastIndexOf(".") + 1) : s;
|
|
4910
|
+
w({
|
|
4885
4911
|
propertyKey: le,
|
|
4886
4912
|
property: V,
|
|
4887
|
-
namespace:
|
|
4888
|
-
currentPropertiesOrder:
|
|
4913
|
+
namespace: J,
|
|
4914
|
+
currentPropertiesOrder: B,
|
|
4889
4915
|
editedCollectionId: G,
|
|
4890
4916
|
parentCollectionIds: q,
|
|
4891
4917
|
collectionEditable: L?.editable ?? !1
|
|
4892
4918
|
});
|
|
4893
|
-
}, []),
|
|
4919
|
+
}, []), D = Y.useCallback(({
|
|
4894
4920
|
parentCollectionIds: s,
|
|
4895
4921
|
parentCollection: V,
|
|
4896
4922
|
initialValues: G,
|
|
4897
|
-
redirect:
|
|
4923
|
+
redirect: B,
|
|
4898
4924
|
sourceClick: q
|
|
4899
4925
|
}) => {
|
|
4900
|
-
console.debug("Create collection", { parentCollectionIds: s, parentCollection: V, initialValues: G, redirect:
|
|
4926
|
+
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
4927
|
isNewCollection: !0,
|
|
4902
4928
|
parentCollectionIds: s,
|
|
4903
4929
|
parentCollection: V,
|
|
4904
4930
|
initialValues: G,
|
|
4905
|
-
redirect:
|
|
4931
|
+
redirect: B
|
|
4906
4932
|
});
|
|
4907
|
-
}, []),
|
|
4933
|
+
}, []), A = u ? (s) => !s && k ? Promise.resolve(k) : u?.(s) : void 0;
|
|
4908
4934
|
return /* @__PURE__ */ e(mr.Provider, { value: n, children: /* @__PURE__ */ a(
|
|
4909
4935
|
hr.Provider,
|
|
4910
4936
|
{
|
|
4911
4937
|
value: {
|
|
4912
|
-
editCollection:
|
|
4913
|
-
createCollection:
|
|
4914
|
-
editProperty:
|
|
4938
|
+
editCollection: M,
|
|
4939
|
+
createCollection: D,
|
|
4940
|
+
editProperty: R,
|
|
4915
4941
|
configPermissions: i ?? _,
|
|
4916
|
-
rootPathSuggestions:
|
|
4942
|
+
rootPathSuggestions: k
|
|
4917
4943
|
},
|
|
4918
4944
|
children: [
|
|
4919
4945
|
r,
|
|
4920
4946
|
/* @__PURE__ */ e(
|
|
4921
4947
|
ur,
|
|
4922
4948
|
{
|
|
4923
|
-
open: !!
|
|
4949
|
+
open: !!C,
|
|
4924
4950
|
configController: n,
|
|
4925
4951
|
isNewCollection: !1,
|
|
4926
4952
|
collectionInference: o,
|
|
4927
|
-
...
|
|
4953
|
+
...C,
|
|
4928
4954
|
getData: h,
|
|
4929
4955
|
reservedGroups: l,
|
|
4930
4956
|
extraView: d,
|
|
4931
|
-
pathSuggestions:
|
|
4932
|
-
getUser:
|
|
4957
|
+
pathSuggestions: A,
|
|
4958
|
+
getUser: p,
|
|
4933
4959
|
handleClose: (s) => {
|
|
4934
|
-
if (
|
|
4960
|
+
if (C?.redirect && s && C?.isNewCollection && !C.parentCollectionIds.length) {
|
|
4935
4961
|
const V = c.buildUrlCollectionPath(s.id ?? s.path);
|
|
4936
4962
|
g(V);
|
|
4937
4963
|
}
|
|
4938
|
-
|
|
4964
|
+
N(void 0);
|
|
4939
4965
|
}
|
|
4940
4966
|
}
|
|
4941
4967
|
),
|
|
@@ -4968,9 +4994,9 @@ const Ht = (t, r, n, i) => {
|
|
|
4968
4994
|
newPropertiesOrder: G && f.currentPropertiesOrder ? [...f.currentPropertiesOrder, s] : void 0,
|
|
4969
4995
|
namespace: f.namespace,
|
|
4970
4996
|
parentCollectionIds: f.parentCollectionIds
|
|
4971
|
-
}).catch((
|
|
4997
|
+
}).catch((B) => (console.error(B), v.open({
|
|
4972
4998
|
type: "error",
|
|
4973
|
-
message: "Error persisting property: " + (
|
|
4999
|
+
message: "Error persisting property: " + (B.message ?? "Details in the console")
|
|
4974
5000
|
}), !1));
|
|
4975
5001
|
},
|
|
4976
5002
|
onPropertyChangedImmediate: !1,
|
|
@@ -4985,7 +5011,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4985
5011
|
newPropertiesOrder: s,
|
|
4986
5012
|
parentCollectionIds: f?.parentCollectionIds
|
|
4987
5013
|
}).then(() => {
|
|
4988
|
-
|
|
5014
|
+
w(void 0);
|
|
4989
5015
|
}).catch((V) => (console.error(V), v.open({
|
|
4990
5016
|
type: "error",
|
|
4991
5017
|
message: "Error deleting property: " + (V.message ?? "Details in the console")
|
|
@@ -4994,10 +5020,10 @@ const Ht = (t, r, n, i) => {
|
|
|
4994
5020
|
onError: () => {
|
|
4995
5021
|
},
|
|
4996
5022
|
onOkClicked: () => {
|
|
4997
|
-
|
|
5023
|
+
w(void 0);
|
|
4998
5024
|
},
|
|
4999
5025
|
onCancel: () => {
|
|
5000
|
-
|
|
5026
|
+
w(void 0);
|
|
5001
5027
|
},
|
|
5002
5028
|
initialErrors: {},
|
|
5003
5029
|
forceShowErrors: !1,
|
|
@@ -5020,12 +5046,12 @@ function ln({
|
|
|
5020
5046
|
collection: n,
|
|
5021
5047
|
tableController: i
|
|
5022
5048
|
}) {
|
|
5023
|
-
const l = _e(), o = Pe(), d = xe(),
|
|
5049
|
+
const l = _e(), o = Pe(), d = xe(), u = fr(), p = Ie(), h = o.getCollectionFromIds(r), m = d.configPermissions ? d.configPermissions({
|
|
5024
5050
|
user: l.user,
|
|
5025
5051
|
collection: n
|
|
5026
5052
|
}).editCollections : !0;
|
|
5027
5053
|
let c = null;
|
|
5028
|
-
return (!ve(at(i.filterValues), at(n.initialFilter)) || !ve(at(i.sortBy), at(n.initialSort))) && (c = /* @__PURE__ */ a(
|
|
5054
|
+
return (!ve(at(i.filterValues), at(n.initialFilter)) || !ve(at(i.sortBy), at(n.initialSort))) && (c = /* @__PURE__ */ a(j, { children: [
|
|
5029
5055
|
(n.initialFilter || n.initialSort) && /* @__PURE__ */ e(
|
|
5030
5056
|
te,
|
|
5031
5057
|
{
|
|
@@ -5054,7 +5080,7 @@ function ln({
|
|
|
5054
5080
|
color: "primary",
|
|
5055
5081
|
size: "small",
|
|
5056
5082
|
variant: "outlined",
|
|
5057
|
-
onClick: () =>
|
|
5083
|
+
onClick: () => u?.saveCollection({
|
|
5058
5084
|
id: n.id,
|
|
5059
5085
|
parentCollectionIds: r,
|
|
5060
5086
|
collectionData: W(
|
|
@@ -5065,7 +5091,7 @@ function ln({
|
|
|
5065
5091
|
}
|
|
5066
5092
|
)
|
|
5067
5093
|
}).then(() => {
|
|
5068
|
-
|
|
5094
|
+
p.open({
|
|
5069
5095
|
type: "success",
|
|
5070
5096
|
message: "Default config saved"
|
|
5071
5097
|
});
|
|
@@ -5075,7 +5101,7 @@ function ln({
|
|
|
5075
5101
|
)
|
|
5076
5102
|
}
|
|
5077
5103
|
)
|
|
5078
|
-
] })), /* @__PURE__ */ a(
|
|
5104
|
+
] })), /* @__PURE__ */ a(j, { children: [
|
|
5079
5105
|
m && c,
|
|
5080
5106
|
/* @__PURE__ */ e(
|
|
5081
5107
|
te,
|
|
@@ -5104,9 +5130,9 @@ function sn({
|
|
|
5104
5130
|
const n = Ie(), i = _e(), l = fr(), o = xe(), d = o.configPermissions({
|
|
5105
5131
|
user: i.user,
|
|
5106
5132
|
collection: r
|
|
5107
|
-
}),
|
|
5133
|
+
}), u = Q(() => {
|
|
5108
5134
|
o?.editCollection({ id: r.id, parentCollectionIds: [] });
|
|
5109
|
-
}, [o, t]), [
|
|
5135
|
+
}, [o, t]), [p, h] = $(!1), m = Q(() => {
|
|
5110
5136
|
l?.deleteCollection({ id: r.id }).then(() => {
|
|
5111
5137
|
h(!1), n.open({
|
|
5112
5138
|
message: "Collection deleted",
|
|
@@ -5114,7 +5140,7 @@ function sn({
|
|
|
5114
5140
|
});
|
|
5115
5141
|
});
|
|
5116
5142
|
}, [t, l]);
|
|
5117
|
-
return /* @__PURE__ */ a(
|
|
5143
|
+
return /* @__PURE__ */ a(j, { children: [
|
|
5118
5144
|
/* @__PURE__ */ a("div", { children: [
|
|
5119
5145
|
d.deleteCollections && /* @__PURE__ */ e(
|
|
5120
5146
|
Zr,
|
|
@@ -5132,7 +5158,7 @@ function sn({
|
|
|
5132
5158
|
oe,
|
|
5133
5159
|
{
|
|
5134
5160
|
onClick: (c) => {
|
|
5135
|
-
|
|
5161
|
+
u();
|
|
5136
5162
|
},
|
|
5137
5163
|
children: /* @__PURE__ */ e(He, { size: "small" })
|
|
5138
5164
|
}
|
|
@@ -5141,11 +5167,11 @@ function sn({
|
|
|
5141
5167
|
/* @__PURE__ */ e(
|
|
5142
5168
|
lt,
|
|
5143
5169
|
{
|
|
5144
|
-
open:
|
|
5170
|
+
open: p,
|
|
5145
5171
|
onAccept: m,
|
|
5146
5172
|
onCancel: () => h(!1),
|
|
5147
|
-
title: /* @__PURE__ */ e(
|
|
5148
|
-
body: /* @__PURE__ */ a(
|
|
5173
|
+
title: /* @__PURE__ */ e(j, { children: "Delete this collection?" }),
|
|
5174
|
+
body: /* @__PURE__ */ a(j, { children: [
|
|
5149
5175
|
" This will ",
|
|
5150
5176
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
5151
5177
|
", only the collection in the CMS"
|
|
@@ -5178,9 +5204,9 @@ function cn({
|
|
|
5178
5204
|
{
|
|
5179
5205
|
className: "flex flex-col items-start h-full w-full items-center justify-center h-full w-full flex-grow flex-col",
|
|
5180
5206
|
children: [
|
|
5181
|
-
/* @__PURE__ */ e(
|
|
5207
|
+
/* @__PURE__ */ e(se, { color: "primary", size: "large" }),
|
|
5182
5208
|
/* @__PURE__ */ e(
|
|
5183
|
-
|
|
5209
|
+
O,
|
|
5184
5210
|
{
|
|
5185
5211
|
color: "primary",
|
|
5186
5212
|
variant: "caption",
|
|
@@ -5188,7 +5214,7 @@ function cn({
|
|
|
5188
5214
|
children: "Add new collection".toUpperCase()
|
|
5189
5215
|
}
|
|
5190
5216
|
),
|
|
5191
|
-
!l && /* @__PURE__ */ e(
|
|
5217
|
+
!l && /* @__PURE__ */ e(O, { variant: "caption", children: "You don't have permissions to create collections" })
|
|
5192
5218
|
]
|
|
5193
5219
|
}
|
|
5194
5220
|
)
|
|
@@ -5208,8 +5234,12 @@ function dn({ introMode: t }) {
|
|
|
5208
5234
|
{
|
|
5209
5235
|
className: "flex flex-col gap-1 p-2 my-4",
|
|
5210
5236
|
children: [
|
|
5211
|
-
!t && /* @__PURE__ */
|
|
5212
|
-
|
|
5237
|
+
!t && /* @__PURE__ */ a(O, { variant: "body2", color: "secondary", children: [
|
|
5238
|
+
"Create a collection ",
|
|
5239
|
+
/* @__PURE__ */ e("b", { children: "automatically" }),
|
|
5240
|
+
" from your data:"
|
|
5241
|
+
] }),
|
|
5242
|
+
t === "existing_project" && /* @__PURE__ */ a(O, { children: [
|
|
5213
5243
|
"You will see your ",
|
|
5214
5244
|
/* @__PURE__ */ e("b", { children: "database collections" }),
|
|
5215
5245
|
" here, a few seconds after project creation"
|
|
@@ -5219,23 +5249,23 @@ function dn({ introMode: t }) {
|
|
|
5219
5249
|
{
|
|
5220
5250
|
className: "flex flex-row gap-1 overflow-scroll no-scrollbar ",
|
|
5221
5251
|
children: [
|
|
5222
|
-
(o ?? []).map((
|
|
5252
|
+
(o ?? []).map((p) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
5223
5253
|
st,
|
|
5224
5254
|
{
|
|
5225
|
-
icon: /* @__PURE__ */ e(
|
|
5255
|
+
icon: /* @__PURE__ */ e(se, { size: "small" }),
|
|
5226
5256
|
colorScheme: "cyanLighter",
|
|
5227
5257
|
onClick: i && l ? () => i.createCollection({
|
|
5228
|
-
initialValues: { path:
|
|
5258
|
+
initialValues: { path: p, name: ut(p) },
|
|
5229
5259
|
parentCollectionIds: [],
|
|
5230
5260
|
redirect: !0,
|
|
5231
5261
|
sourceClick: "root_collection_suggestion"
|
|
5232
5262
|
}) : void 0,
|
|
5233
5263
|
size: "small",
|
|
5234
|
-
children:
|
|
5264
|
+
children: p
|
|
5235
5265
|
}
|
|
5236
|
-
) },
|
|
5266
|
+
) }, p)),
|
|
5237
5267
|
o === void 0 && /* @__PURE__ */ e(De, { size: "small" }),
|
|
5238
|
-
o?.length === 0 && /* @__PURE__ */ e(
|
|
5268
|
+
o?.length === 0 && /* @__PURE__ */ e(O, { variant: "caption", children: "No suggestions" })
|
|
5239
5269
|
]
|
|
5240
5270
|
}
|
|
5241
5271
|
)
|
|
@@ -5293,7 +5323,7 @@ function pn({
|
|
|
5293
5323
|
collection: n
|
|
5294
5324
|
});
|
|
5295
5325
|
},
|
|
5296
|
-
children: /* @__PURE__ */ e(
|
|
5326
|
+
children: /* @__PURE__ */ e(se, { color: "inherit" })
|
|
5297
5327
|
}
|
|
5298
5328
|
) });
|
|
5299
5329
|
}
|
|
@@ -5310,7 +5340,7 @@ function mn() {
|
|
|
5310
5340
|
sourceClick: "new_collection_button"
|
|
5311
5341
|
}),
|
|
5312
5342
|
children: [
|
|
5313
|
-
/* @__PURE__ */ e(
|
|
5343
|
+
/* @__PURE__ */ e(se, {}),
|
|
5314
5344
|
"New collection"
|
|
5315
5345
|
]
|
|
5316
5346
|
}
|
|
@@ -5324,8 +5354,8 @@ function In({
|
|
|
5324
5354
|
extraView: l,
|
|
5325
5355
|
pathSuggestions: o,
|
|
5326
5356
|
getUser: d,
|
|
5327
|
-
collectionInference:
|
|
5328
|
-
getData:
|
|
5357
|
+
collectionInference: u,
|
|
5358
|
+
getData: p,
|
|
5329
5359
|
onAnalyticsEvent: h
|
|
5330
5360
|
}) {
|
|
5331
5361
|
return {
|
|
@@ -5339,12 +5369,12 @@ function In({
|
|
|
5339
5369
|
props: {
|
|
5340
5370
|
collectionConfigController: t,
|
|
5341
5371
|
configPermissions: n,
|
|
5342
|
-
collectionInference:
|
|
5372
|
+
collectionInference: u,
|
|
5343
5373
|
reservedGroups: i,
|
|
5344
5374
|
extraView: l,
|
|
5345
5375
|
pathSuggestions: o,
|
|
5346
5376
|
getUser: d,
|
|
5347
|
-
getData:
|
|
5377
|
+
getData: p,
|
|
5348
5378
|
onAnalyticsEvent: h
|
|
5349
5379
|
}
|
|
5350
5380
|
},
|
|
@@ -5368,9 +5398,9 @@ function hn({ introMode: t }) {
|
|
|
5368
5398
|
user: n.user
|
|
5369
5399
|
}).createCollections : !0;
|
|
5370
5400
|
return /* @__PURE__ */ a("div", { className: "mt-8 flex flex-col mt-8 p-2", children: [
|
|
5371
|
-
/* @__PURE__ */ e(
|
|
5372
|
-
/* @__PURE__ */ e(
|
|
5373
|
-
/* @__PURE__ */ e(
|
|
5401
|
+
/* @__PURE__ */ e(O, { variant: "h4", className: "mb-4", children: "Welcome" }),
|
|
5402
|
+
/* @__PURE__ */ e(O, { paragraph: !0, children: "Your admin panel is ready ✌️" }),
|
|
5403
|
+
/* @__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
5404
|
l && /* @__PURE__ */ a(
|
|
5375
5405
|
z,
|
|
5376
5406
|
{
|
|
@@ -5381,7 +5411,7 @@ function hn({ introMode: t }) {
|
|
|
5381
5411
|
sourceClick: "new_collection_card"
|
|
5382
5412
|
}) : void 0,
|
|
5383
5413
|
children: [
|
|
5384
|
-
/* @__PURE__ */ e(
|
|
5414
|
+
/* @__PURE__ */ e(se, {}),
|
|
5385
5415
|
"Create your first collection"
|
|
5386
5416
|
]
|
|
5387
5417
|
}
|