@firecms/collection_editor 3.0.0-canary.45 → 3.0.0-canary.46
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 +772 -753
- 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/ConfigControllerProvider.tsx +24 -24
- package/src/ui/HomePageEditorCollectionAction.tsx +5 -5
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +22 -1
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +10 -10
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +10 -10
- package/src/ui/collection_editor/PropertyEditView.tsx +3 -2
- package/src/ui/collection_editor/PropertyTree.tsx +3 -3
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +5 -5
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +5 -5
package/dist/index.es.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as R } from "react/jsx-runtime";
|
|
2
|
-
import { FieldCaption as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useAutoComplete as Sr, Container as
|
|
7
|
-
import * as
|
|
8
|
-
import { useFormex as
|
|
2
|
+
import { FieldCaption as J, SearchIconsView as vr, toSnakeCase as Nt, singular as yr, IconForView as st, ArrayContainer as br, serializeRegExp as Cr, useSnackbarController as Ve, resolveEnumValues as Nr, isPropertyBuilder as re, useCustomizationController as Se, getFieldConfig as je, ErrorBoundary as pe, PropertyConfigBadge as qe, unslugify as xt, useNavigationController as Te, mergeDeep as G, DEFAULT_FIELD_CONFIGS as Gt, isValidRegExp as Pr, getFieldId as Wt, DeleteConfirmationDialog as dt, useLargeLayout as xr, makePropertiesEditable as Le, resolveEntityView as wr, useSelectionController as Tr, CircularProgressCenter as ct, EntityCollectionTable as kr, slugify as Or, useAuthController as Ie, randomString as _t, removeUndefined as Ft, ErrorView as Kt, removeInitialAndTrailingSlashes as Vr, getDefaultPropertiesOrder as Ir, joinCollectionLists as _r } from "@firecms/core";
|
|
3
|
+
import * as ze from "react";
|
|
4
|
+
import W, { useState as j, useEffect as ce, useMemo as Zt, useRef as Re, useDeferredValue as Fr, useCallback as Er, useContext as Jt } from "react";
|
|
5
|
+
import ve from "react-fast-compare";
|
|
6
|
+
import { useAutoComplete as Sr, Container as mt, Typography as V, Tooltip as ee, IconButton as ne, Chip as Pt, TextField as we, cn as he, DebouncedTextField as K, Autocomplete as Ar, AutocompleteItem as Dr, ExpandablePanel as wt, SettingsIcon as $e, Select as be, SelectItem as X, BooleanSwitchWithLabel as ut, Dialog as _e, AutoAwesomeIcon as ht, Badge as Br, ListIcon as Mr, Button as z, CircularProgress as He, Paper as fe, DialogContent as Ae, DialogActions as De, RuleIcon as zr, FileUploadIcon as Rr, MultiSelect as Ur, MultiSelectItem as Et, Checkbox as St, cardMixin as Qt, cardClickableMixin as Xt, cardSelectedMixin as er, FunctionsIcon as jr, RemoveCircleIcon as qr, defaultBorderMixin as Tt, RemoveIcon as Lr, DragHandleIcon as $r, AddIcon as de, SelectGroup as At, InfoLabel as Hr, DeleteIcon as pt, ContentCopyIcon as Yr, CodeIcon as Gr, Table as Dt, TableBody as Bt, TableRow as bt, TableCell as Me, Alert as Wr, Icon as rt, Card as tr, coolIconKeys as Mt, Tabs as Kr, Tab as Ct, ArrowBackIcon as it, LoadingButton as zt, DoneIcon as Zr, Menu as Jr, MoreVertIcon as Qr, MenuItem as Xr, SaveIcon as ei, UndoIcon as ti } from "@firecms/ui";
|
|
7
|
+
import * as nt from "yup";
|
|
8
|
+
import { useFormex as Y, Field as $, getIn as I, useCreateFormex as kt, Formex as Ot } from "@firecms/formex";
|
|
9
9
|
import { extractEnumFromValues as ri, buildPropertyFromData as ii, buildEntityPropertiesFromData as ni } from "@firecms/schema_inference";
|
|
10
10
|
import { DragDropContext as ai, Droppable as oi, Draggable as li } from "@hello-pangea/dnd";
|
|
11
11
|
import si from "json5";
|
|
12
12
|
import { Highlight as di, themes as ci } from "prism-react-renderer";
|
|
13
|
-
import { ImportFileUpload as ui, DataNewPropertiesMapping as pi, ImportNewPropertyFieldPreview as mi, getInferenceType as
|
|
13
|
+
import { ImportFileUpload as ui, DataNewPropertiesMapping as pi, ImportNewPropertyFieldPreview as mi, getInferenceType as rr, convertDataToEntity as hi, useImportConfig as fi, ImportSaveInProgress as gi } from "@firecms/data_import_export";
|
|
14
14
|
import { useNavigate as vi } from "react-router";
|
|
15
|
-
const yi =
|
|
16
|
-
id:
|
|
17
|
-
name:
|
|
18
|
-
path:
|
|
15
|
+
const yi = nt.object().shape({
|
|
16
|
+
id: nt.string().required("Required"),
|
|
17
|
+
name: nt.string().required("Required"),
|
|
18
|
+
path: nt.string().required("Required")
|
|
19
19
|
});
|
|
20
20
|
function bi({
|
|
21
21
|
isNewCollection: t,
|
|
@@ -25,7 +25,7 @@ function bi({
|
|
|
25
25
|
groups: l,
|
|
26
26
|
parentCollection: o
|
|
27
27
|
}) {
|
|
28
|
-
const d =
|
|
28
|
+
const d = W.useRef(null), {
|
|
29
29
|
values: c,
|
|
30
30
|
setFieldValue: u,
|
|
31
31
|
handleChange: m,
|
|
@@ -34,23 +34,23 @@ function bi({
|
|
|
34
34
|
setFieldTouched: f,
|
|
35
35
|
isSubmitting: g,
|
|
36
36
|
submitCount: x
|
|
37
|
-
} =
|
|
38
|
-
u("name", h), !I(p, "path") && t && h && u("path",
|
|
37
|
+
} = Y(), [y, P] = j(!1), [v, b] = j(!1), T = (h) => {
|
|
38
|
+
u("name", h), !I(p, "path") && t && h && u("path", Nt(h)), !I(p, "id") && t && h && u("id", Nt(h)), !I(p, "singularName") && t && h && u("singularName", yr(h));
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
ce(() => {
|
|
41
41
|
s.id && b(!0);
|
|
42
42
|
}, [s.id]);
|
|
43
|
-
const w = /* @__PURE__ */ e(
|
|
43
|
+
const w = /* @__PURE__ */ e(st, { collectionOrView: c }), C = l?.filter((h) => !r?.includes(h)), {
|
|
44
44
|
inputFocused: O,
|
|
45
45
|
autoCompleteOpen: N,
|
|
46
46
|
setAutoCompleteOpen: F
|
|
47
47
|
} = Sr({
|
|
48
48
|
ref: d
|
|
49
|
-
}),
|
|
49
|
+
}), B = !!o;
|
|
50
50
|
let _;
|
|
51
51
|
typeof c.customId == "object" ? _ = "code_defined" : c.customId === !0 ? _ = "true" : c.customId === !1 ? _ = "false" : c.customId === "optional" && (_ = "optional");
|
|
52
|
-
const
|
|
53
|
-
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ a(
|
|
52
|
+
const E = x > 0;
|
|
53
|
+
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ a(mt, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
54
54
|
/* @__PURE__ */ a("div", { children: [
|
|
55
55
|
/* @__PURE__ */ a(
|
|
56
56
|
"div",
|
|
@@ -58,8 +58,8 @@ function bi({
|
|
|
58
58
|
className: "flex flex-row py-2 pt-3 items-center",
|
|
59
59
|
children: [
|
|
60
60
|
/* @__PURE__ */ e(V, { variant: t ? "h4" : "h5", className: "flex-grow", children: t ? "New collection" : `${c?.name} collection` }),
|
|
61
|
-
/* @__PURE__ */ e(
|
|
62
|
-
|
|
61
|
+
/* @__PURE__ */ e(ee, { title: "Change icon", children: /* @__PURE__ */ e(
|
|
62
|
+
ne,
|
|
63
63
|
{
|
|
64
64
|
shape: "square",
|
|
65
65
|
onClick: () => P(!0),
|
|
@@ -69,7 +69,7 @@ function bi({
|
|
|
69
69
|
]
|
|
70
70
|
}
|
|
71
71
|
),
|
|
72
|
-
o && /* @__PURE__ */ e(
|
|
72
|
+
o && /* @__PURE__ */ e(Pt, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(V, { variant: "caption", children: [
|
|
73
73
|
"This is a subcollection of ",
|
|
74
74
|
/* @__PURE__ */ e("b", { children: o.name })
|
|
75
75
|
] }) })
|
|
@@ -77,36 +77,36 @@ function bi({
|
|
|
77
77
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-4", children: [
|
|
78
78
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
79
79
|
/* @__PURE__ */ e(
|
|
80
|
-
|
|
80
|
+
we,
|
|
81
81
|
{
|
|
82
82
|
value: c.name ?? "",
|
|
83
83
|
onChange: (h) => T(h.target.value),
|
|
84
84
|
label: "Name",
|
|
85
85
|
required: !0,
|
|
86
|
-
error:
|
|
86
|
+
error: E && !!s.name
|
|
87
87
|
}
|
|
88
88
|
),
|
|
89
|
-
/* @__PURE__ */ e(
|
|
89
|
+
/* @__PURE__ */ e(J, { error: p.name && !!s.name, children: p.name && s.name ? s.name : "Name of in this collection, usually a plural name (e.g. Products)" })
|
|
90
90
|
] }),
|
|
91
|
-
/* @__PURE__ */ a("div", { className:
|
|
91
|
+
/* @__PURE__ */ a("div", { className: he("col-span-12 ", B ? "" : "sm:col-span-8"), children: [
|
|
92
92
|
/* @__PURE__ */ e(
|
|
93
93
|
$,
|
|
94
94
|
{
|
|
95
95
|
name: "path",
|
|
96
|
-
as:
|
|
96
|
+
as: K,
|
|
97
97
|
label: "Path",
|
|
98
98
|
disabled: !t,
|
|
99
99
|
required: !0,
|
|
100
|
-
error:
|
|
100
|
+
error: E && !!s.path
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
|
-
/* @__PURE__ */ e(
|
|
103
|
+
/* @__PURE__ */ e(J, { error: p.path && !!s.path, children: p.path && s.path ? s.path : B ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database" })
|
|
104
104
|
] }),
|
|
105
|
-
!
|
|
105
|
+
!B && /* @__PURE__ */ a("div", { className: "col-span-12 sm:col-span-4 relative", children: [
|
|
106
106
|
/* @__PURE__ */ e(
|
|
107
|
-
|
|
107
|
+
we,
|
|
108
108
|
{
|
|
109
|
-
error:
|
|
109
|
+
error: E && !!s.group,
|
|
110
110
|
disabled: g,
|
|
111
111
|
value: c.group ?? "",
|
|
112
112
|
autoComplete: "off",
|
|
@@ -121,7 +121,7 @@ function bi({
|
|
|
121
121
|
{
|
|
122
122
|
open: N && (C ?? []).length > 0,
|
|
123
123
|
setOpen: F,
|
|
124
|
-
children: C?.map((h,
|
|
124
|
+
children: C?.map((h, D) => /* @__PURE__ */ e(
|
|
125
125
|
Dr,
|
|
126
126
|
{
|
|
127
127
|
onClick: () => {
|
|
@@ -129,19 +129,19 @@ function bi({
|
|
|
129
129
|
},
|
|
130
130
|
children: /* @__PURE__ */ e("div", { className: "flex-grow", children: h })
|
|
131
131
|
},
|
|
132
|
-
|
|
132
|
+
D + "_" + h
|
|
133
133
|
))
|
|
134
134
|
}
|
|
135
135
|
),
|
|
136
|
-
/* @__PURE__ */ e(
|
|
136
|
+
/* @__PURE__ */ e(J, { children: E && s.group ? s.group : "Group of the collection" })
|
|
137
137
|
] }),
|
|
138
138
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
139
|
-
|
|
139
|
+
wt,
|
|
140
140
|
{
|
|
141
141
|
expanded: v,
|
|
142
142
|
onExpandedChange: b,
|
|
143
143
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
144
|
-
/* @__PURE__ */ e(
|
|
144
|
+
/* @__PURE__ */ e($e, {}),
|
|
145
145
|
/* @__PURE__ */ e(
|
|
146
146
|
V,
|
|
147
147
|
{
|
|
@@ -158,19 +158,19 @@ function bi({
|
|
|
158
158
|
$,
|
|
159
159
|
{
|
|
160
160
|
name: "id",
|
|
161
|
-
as:
|
|
161
|
+
as: K,
|
|
162
162
|
disabled: !t,
|
|
163
163
|
label: "Collection id",
|
|
164
|
-
error:
|
|
164
|
+
error: E && !!s.id
|
|
165
165
|
}
|
|
166
166
|
),
|
|
167
|
-
/* @__PURE__ */ e(
|
|
167
|
+
/* @__PURE__ */ e(J, { error: p.id && !!s.id, children: p.id && s.id ? s.id : "This id identifies this collection. Typically the same as the path." })
|
|
168
168
|
] }),
|
|
169
169
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
170
170
|
/* @__PURE__ */ e(
|
|
171
|
-
|
|
171
|
+
we,
|
|
172
172
|
{
|
|
173
|
-
error:
|
|
173
|
+
error: E && !!s.singularName,
|
|
174
174
|
name: "singularName",
|
|
175
175
|
"aria-describedby": "singularName-helper",
|
|
176
176
|
onChange: (h) => (f("singularName", !0), m(h)),
|
|
@@ -178,13 +178,32 @@ function bi({
|
|
|
178
178
|
label: "Singular name"
|
|
179
179
|
}
|
|
180
180
|
),
|
|
181
|
-
/* @__PURE__ */ e(
|
|
181
|
+
/* @__PURE__ */ e(J, { error: E && !!s.singularName, children: E && s.singularName ? s.singularName : "Optionally define a singular name for your entities" })
|
|
182
182
|
] }),
|
|
183
183
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
184
184
|
/* @__PURE__ */ e(
|
|
185
|
-
|
|
185
|
+
we,
|
|
186
186
|
{
|
|
187
|
-
error:
|
|
187
|
+
error: E && !!s.sideDialogWidth,
|
|
188
|
+
name: "sideDialogWidth",
|
|
189
|
+
type: "number",
|
|
190
|
+
"aria-describedby": "sideDialogWidth-helper",
|
|
191
|
+
onChange: (h) => {
|
|
192
|
+
f("sideDialogWidth", !0);
|
|
193
|
+
const D = h.target.value;
|
|
194
|
+
D ? isNaN(Number(D)) || u("sideDialogWidth", Number(D)) : u("sideDialogWidth", void 0);
|
|
195
|
+
},
|
|
196
|
+
value: c.sideDialogWidth ?? "",
|
|
197
|
+
label: "Side dialog width"
|
|
198
|
+
}
|
|
199
|
+
),
|
|
200
|
+
/* @__PURE__ */ e(J, { error: E && !!s.singularName, children: E && s.singularName ? s.singularName : "Optionally define the width (in pixels) of entities side dialog. Default is 768px" })
|
|
201
|
+
] }),
|
|
202
|
+
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
203
|
+
/* @__PURE__ */ e(
|
|
204
|
+
we,
|
|
205
|
+
{
|
|
206
|
+
error: E && !!s.description,
|
|
188
207
|
name: "description",
|
|
189
208
|
value: c.description ?? "",
|
|
190
209
|
onChange: m,
|
|
@@ -194,10 +213,10 @@ function bi({
|
|
|
194
213
|
label: "Description"
|
|
195
214
|
}
|
|
196
215
|
),
|
|
197
|
-
/* @__PURE__ */ e(
|
|
216
|
+
/* @__PURE__ */ e(J, { error: E && !!s.description, children: E && s.description ? s.description : "Description of the collection, you can use markdown" })
|
|
198
217
|
] }),
|
|
199
218
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
200
|
-
|
|
219
|
+
be,
|
|
201
220
|
{
|
|
202
221
|
name: "defaultSize",
|
|
203
222
|
label: "Default row size",
|
|
@@ -206,7 +225,7 @@ function bi({
|
|
|
206
225
|
value: c.defaultSize ?? "",
|
|
207
226
|
renderValue: (h) => h.toUpperCase(),
|
|
208
227
|
children: ["xs", "s", "m", "l", "xl"].map((h) => /* @__PURE__ */ e(
|
|
209
|
-
|
|
228
|
+
X,
|
|
210
229
|
{
|
|
211
230
|
value: h,
|
|
212
231
|
children: h.toUpperCase()
|
|
@@ -216,10 +235,10 @@ function bi({
|
|
|
216
235
|
}
|
|
217
236
|
) }),
|
|
218
237
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
219
|
-
|
|
238
|
+
be,
|
|
220
239
|
{
|
|
221
240
|
name: "customId",
|
|
222
|
-
label: "
|
|
241
|
+
label: "Document IDs generation",
|
|
223
242
|
position: "item-aligned",
|
|
224
243
|
disabled: _ === "code_defined",
|
|
225
244
|
onValueChange: (h) => {
|
|
@@ -230,15 +249,15 @@ function bi({
|
|
|
230
249
|
value: _ ?? "",
|
|
231
250
|
renderValue: (h) => h === "code_defined" ? "Code defined" : h === "true" ? "Users must define an ID" : h === "optional" ? "Users can define an ID, but it is not required" : "Document ID is generated automatically",
|
|
232
251
|
children: [
|
|
233
|
-
/* @__PURE__ */ e(
|
|
234
|
-
/* @__PURE__ */ e(
|
|
235
|
-
/* @__PURE__ */ e(
|
|
252
|
+
/* @__PURE__ */ e(X, { value: "false", children: "Document ID is generated automatically" }),
|
|
253
|
+
/* @__PURE__ */ e(X, { value: "true", children: "Users must define an ID" }),
|
|
254
|
+
/* @__PURE__ */ e(X, { value: "optional", children: "Users can define an ID, but it is not required" })
|
|
236
255
|
]
|
|
237
256
|
}
|
|
238
257
|
) }),
|
|
239
258
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
240
259
|
/* @__PURE__ */ e(
|
|
241
|
-
|
|
260
|
+
ut,
|
|
242
261
|
{
|
|
243
262
|
position: "start",
|
|
244
263
|
label: "Collection group",
|
|
@@ -246,11 +265,11 @@ function bi({
|
|
|
246
265
|
value: c.collectionGroup ?? !1
|
|
247
266
|
}
|
|
248
267
|
),
|
|
249
|
-
/* @__PURE__ */ e(
|
|
268
|
+
/* @__PURE__ */ e(J, { children: "A collection group consists of all collections with the same path. This allows you to query over multiple collections at once." })
|
|
250
269
|
] }),
|
|
251
270
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
252
271
|
/* @__PURE__ */ e(
|
|
253
|
-
|
|
272
|
+
ut,
|
|
254
273
|
{
|
|
255
274
|
position: "start",
|
|
256
275
|
label: "Enable text search for this collection",
|
|
@@ -258,7 +277,7 @@ function bi({
|
|
|
258
277
|
value: c.textSearchEnabled ?? !1
|
|
259
278
|
}
|
|
260
279
|
),
|
|
261
|
-
/* @__PURE__ */ e(
|
|
280
|
+
/* @__PURE__ */ e(J, { 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." })
|
|
262
281
|
] })
|
|
263
282
|
] })
|
|
264
283
|
}
|
|
@@ -266,14 +285,14 @@ function bi({
|
|
|
266
285
|
] }),
|
|
267
286
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
268
287
|
/* @__PURE__ */ e(
|
|
269
|
-
|
|
288
|
+
_e,
|
|
270
289
|
{
|
|
271
290
|
open: y,
|
|
272
291
|
onOpenChange: P,
|
|
273
292
|
maxWidth: "xl",
|
|
274
293
|
fullWidth: !0,
|
|
275
294
|
children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
|
|
276
|
-
|
|
295
|
+
vr,
|
|
277
296
|
{
|
|
278
297
|
selectedIcon: c.icon,
|
|
279
298
|
onIconSelected: (h) => {
|
|
@@ -285,21 +304,21 @@ function bi({
|
|
|
285
304
|
)
|
|
286
305
|
] }) });
|
|
287
306
|
}
|
|
288
|
-
function
|
|
307
|
+
function me(t) {
|
|
289
308
|
return "properties." + t.replaceAll(".", ".properties.");
|
|
290
309
|
}
|
|
291
|
-
function
|
|
310
|
+
function ir(t) {
|
|
292
311
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
|
|
293
312
|
}
|
|
294
|
-
function
|
|
313
|
+
function ye(t) {
|
|
295
314
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".propertiesOrder" : "propertiesOrder";
|
|
296
315
|
}
|
|
297
|
-
function
|
|
316
|
+
function ie(t, r) {
|
|
298
317
|
return r ? `${r}.${t}` : t;
|
|
299
318
|
}
|
|
300
|
-
function
|
|
319
|
+
function nr(t, r) {
|
|
301
320
|
const n = r ? `${r}.${t}` : t;
|
|
302
|
-
return
|
|
321
|
+
return me(n);
|
|
303
322
|
}
|
|
304
323
|
function Ci({
|
|
305
324
|
enumValues: t,
|
|
@@ -310,7 +329,7 @@ function Ci({
|
|
|
310
329
|
allowDataInference: o,
|
|
311
330
|
getData: d
|
|
312
331
|
}) {
|
|
313
|
-
const c =
|
|
332
|
+
const c = kt({
|
|
314
333
|
initialValues: { enumValues: t },
|
|
315
334
|
validateOnChange: !0,
|
|
316
335
|
validation: (p) => {
|
|
@@ -322,9 +341,9 @@ function Ci({
|
|
|
322
341
|
return n?.(f), s;
|
|
323
342
|
}
|
|
324
343
|
}), { values: u, errors: m } = c;
|
|
325
|
-
return
|
|
344
|
+
return ce(() => {
|
|
326
345
|
r && r(u.enumValues);
|
|
327
|
-
}, [u.enumValues]), /* @__PURE__ */ e(
|
|
346
|
+
}, [u.enumValues]), /* @__PURE__ */ e(Ot, { value: c, children: /* @__PURE__ */ e(
|
|
328
347
|
Ni,
|
|
329
348
|
{
|
|
330
349
|
enumValuesPath: "enumValues",
|
|
@@ -348,7 +367,7 @@ function Ni({
|
|
|
348
367
|
}) {
|
|
349
368
|
const {
|
|
350
369
|
setFieldValue: c
|
|
351
|
-
} =
|
|
370
|
+
} = Y(), [u, m] = W.useState(), [p, s] = W.useState(), [f, g] = W.useState(!1), y = W.useRef(/* @__PURE__ */ new Set()).current, P = (b, T) => {
|
|
352
371
|
const w = u === T, C = r?.enumValues && r?.enumValues[b];
|
|
353
372
|
return /* @__PURE__ */ e(
|
|
354
373
|
Pi,
|
|
@@ -387,7 +406,7 @@ function Ni({
|
|
|
387
406
|
d && (g(!0), d?.().then((b) => {
|
|
388
407
|
if (!b)
|
|
389
408
|
return;
|
|
390
|
-
const T = b.flat(), w = Array.from(new Set(T)), C = t.enumValues, N = ri(w).filter((F) => !C?.some((
|
|
409
|
+
const T = b.flat(), w = Array.from(new Set(T)), C = t.enumValues, N = ri(w).filter((F) => !C?.some((B) => B.id === F.id));
|
|
391
410
|
N.forEach((F) => {
|
|
392
411
|
y.add(F.id);
|
|
393
412
|
}), c(i, [...N, ...C], !0);
|
|
@@ -396,15 +415,15 @@ function Ni({
|
|
|
396
415
|
}).finally(() => g(!1)));
|
|
397
416
|
},
|
|
398
417
|
children: [
|
|
399
|
-
f ? /* @__PURE__ */ e(
|
|
418
|
+
f ? /* @__PURE__ */ e(He, { size: "small" }) : /* @__PURE__ */ e(ht, {}),
|
|
400
419
|
"Infer values from data"
|
|
401
420
|
]
|
|
402
421
|
}
|
|
403
422
|
)
|
|
404
423
|
] }),
|
|
405
|
-
/* @__PURE__ */ a(
|
|
424
|
+
/* @__PURE__ */ a(fe, { className: "p-4 m-1", children: [
|
|
406
425
|
/* @__PURE__ */ e(
|
|
407
|
-
|
|
426
|
+
br,
|
|
408
427
|
{
|
|
409
428
|
droppableId: i,
|
|
410
429
|
addLabel: "Add enum value",
|
|
@@ -430,7 +449,7 @@ function Ni({
|
|
|
430
449
|
] })
|
|
431
450
|
] });
|
|
432
451
|
}
|
|
433
|
-
const Pi =
|
|
452
|
+
const Pi = W.memo(
|
|
434
453
|
function({
|
|
435
454
|
index: r,
|
|
436
455
|
shouldUpdateId: n,
|
|
@@ -447,8 +466,8 @@ const Pi = Y.memo(
|
|
|
447
466
|
errors: s,
|
|
448
467
|
setFieldValue: f,
|
|
449
468
|
touched: g
|
|
450
|
-
} =
|
|
451
|
-
return
|
|
469
|
+
} = Y(), x = W.useRef(!I(m, `${i}[${r}].id`)), y = n || x.current, P = I(m, `${i}[${r}].id`), v = I(m, `${i}[${r}].label`), b = W.useRef(v);
|
|
470
|
+
return W.useEffect(() => {
|
|
452
471
|
(b.current === P || !P) && y && f(`${i}[${r}].id`, v), b.current = v;
|
|
453
472
|
}, [v]), /* @__PURE__ */ a(R, { children: [
|
|
454
473
|
/* @__PURE__ */ a("div", { className: "flex w-full align-center justify-center", children: [
|
|
@@ -456,25 +475,25 @@ const Pi = Y.memo(
|
|
|
456
475
|
$,
|
|
457
476
|
{
|
|
458
477
|
name: `${i}[${r}].label`,
|
|
459
|
-
as:
|
|
478
|
+
as: K,
|
|
460
479
|
className: "flex-grow",
|
|
461
480
|
required: !0,
|
|
462
481
|
disabled: d,
|
|
463
482
|
size: "small",
|
|
464
483
|
autoFocus: l,
|
|
465
484
|
autoComplete: "off",
|
|
466
|
-
endAdornment: c && /* @__PURE__ */ e(
|
|
485
|
+
endAdornment: c && /* @__PURE__ */ e(ht, { size: "small" }),
|
|
467
486
|
error: !!u?.label
|
|
468
487
|
}
|
|
469
488
|
),
|
|
470
489
|
!d && /* @__PURE__ */ e(Br, { color: "error", invisible: !u?.id, children: /* @__PURE__ */ e(
|
|
471
|
-
|
|
490
|
+
ne,
|
|
472
491
|
{
|
|
473
492
|
size: "small",
|
|
474
493
|
"aria-label": "edit",
|
|
475
494
|
className: "m-1",
|
|
476
495
|
onClick: () => o(),
|
|
477
|
-
children: /* @__PURE__ */ e(
|
|
496
|
+
children: /* @__PURE__ */ e($e, { size: "small" })
|
|
478
497
|
}
|
|
479
498
|
) })
|
|
480
499
|
] }),
|
|
@@ -497,7 +516,7 @@ const Pi = Y.memo(
|
|
|
497
516
|
] });
|
|
498
517
|
},
|
|
499
518
|
function(r, n) {
|
|
500
|
-
return r.index === n.index && r.enumValuesPath === n.enumValuesPath && r.shouldUpdateId === n.shouldUpdateId && r.inferredEntry === n.inferredEntry &&
|
|
519
|
+
return r.index === n.index && r.enumValuesPath === n.enumValuesPath && r.shouldUpdateId === n.shouldUpdateId && r.inferredEntry === n.inferredEntry && ve(r.entryError, n.entryError) && r.autoFocus === n.autoFocus;
|
|
501
520
|
}
|
|
502
521
|
);
|
|
503
522
|
function xi({
|
|
@@ -508,21 +527,21 @@ function xi({
|
|
|
508
527
|
}) {
|
|
509
528
|
const {
|
|
510
529
|
errors: l
|
|
511
|
-
} =
|
|
530
|
+
} = Y(), o = t !== void 0 ? I(l, `${i}[${t}].id`) : void 0;
|
|
512
531
|
return /* @__PURE__ */ a(
|
|
513
|
-
|
|
532
|
+
_e,
|
|
514
533
|
{
|
|
515
534
|
maxWidth: "md",
|
|
516
535
|
"aria-labelledby": "enum-edit-dialog",
|
|
517
536
|
open: r,
|
|
518
537
|
onOpenChange: (d) => d ? void 0 : n(),
|
|
519
538
|
children: [
|
|
520
|
-
/* @__PURE__ */ e(
|
|
539
|
+
/* @__PURE__ */ e(Ae, { children: t !== void 0 && /* @__PURE__ */ a("div", { children: [
|
|
521
540
|
/* @__PURE__ */ e(
|
|
522
541
|
$,
|
|
523
542
|
{
|
|
524
543
|
name: `${i}[${t}].id`,
|
|
525
|
-
as:
|
|
544
|
+
as: K,
|
|
526
545
|
required: !0,
|
|
527
546
|
label: "ID",
|
|
528
547
|
size: "small",
|
|
@@ -530,9 +549,9 @@ function xi({
|
|
|
530
549
|
error: !!o
|
|
531
550
|
}
|
|
532
551
|
),
|
|
533
|
-
/* @__PURE__ */ e(
|
|
552
|
+
/* @__PURE__ */ e(J, { error: !!o, children: o ?? "Value saved in the data source" })
|
|
534
553
|
] }) }),
|
|
535
|
-
/* @__PURE__ */ e(
|
|
554
|
+
/* @__PURE__ */ e(De, { children: /* @__PURE__ */ e(
|
|
536
555
|
z,
|
|
537
556
|
{
|
|
538
557
|
autoFocus: !0,
|
|
@@ -546,7 +565,7 @@ function xi({
|
|
|
546
565
|
}
|
|
547
566
|
);
|
|
548
567
|
}
|
|
549
|
-
function
|
|
568
|
+
function oe({
|
|
550
569
|
field: t,
|
|
551
570
|
form: r,
|
|
552
571
|
label: n,
|
|
@@ -556,7 +575,7 @@ function le({
|
|
|
556
575
|
allowIndeterminate: d
|
|
557
576
|
}) {
|
|
558
577
|
const c = /* @__PURE__ */ e(
|
|
559
|
-
|
|
578
|
+
ut,
|
|
560
579
|
{
|
|
561
580
|
label: n,
|
|
562
581
|
size: o,
|
|
@@ -568,15 +587,15 @@ function le({
|
|
|
568
587
|
}
|
|
569
588
|
);
|
|
570
589
|
return i ? /* @__PURE__ */ e(
|
|
571
|
-
|
|
590
|
+
ee,
|
|
572
591
|
{
|
|
573
592
|
title: i,
|
|
574
593
|
children: c
|
|
575
594
|
}
|
|
576
595
|
) : c;
|
|
577
596
|
}
|
|
578
|
-
function
|
|
579
|
-
const { values: r, handleChange: n } =
|
|
597
|
+
function Fe({ disabled: t }) {
|
|
598
|
+
const { values: r, handleChange: n } = Y(), i = "validation.required", l = "validation.requiredMessage";
|
|
580
599
|
return /* @__PURE__ */ a(R, { children: [
|
|
581
600
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
582
601
|
$,
|
|
@@ -584,7 +603,7 @@ function Ee({ disabled: t }) {
|
|
|
584
603
|
name: i,
|
|
585
604
|
type: "checkbox",
|
|
586
605
|
children: ({ field: d, form: c }) => /* @__PURE__ */ e(
|
|
587
|
-
|
|
606
|
+
oe,
|
|
588
607
|
{
|
|
589
608
|
disabled: t,
|
|
590
609
|
label: "Required",
|
|
@@ -601,7 +620,7 @@ function Ee({ disabled: t }) {
|
|
|
601
620
|
name: "validation.unique",
|
|
602
621
|
type: "checkbox",
|
|
603
622
|
children: ({ field: d, form: c }) => /* @__PURE__ */ e(
|
|
604
|
-
|
|
623
|
+
oe,
|
|
605
624
|
{
|
|
606
625
|
disabled: t,
|
|
607
626
|
label: "Unique",
|
|
@@ -613,7 +632,7 @@ function Ee({ disabled: t }) {
|
|
|
613
632
|
}
|
|
614
633
|
) }),
|
|
615
634
|
I(r, i) && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
616
|
-
|
|
635
|
+
K,
|
|
617
636
|
{
|
|
618
637
|
disabled: t,
|
|
619
638
|
value: I(r, l),
|
|
@@ -625,7 +644,7 @@ function Ee({ disabled: t }) {
|
|
|
625
644
|
) })
|
|
626
645
|
] });
|
|
627
646
|
}
|
|
628
|
-
function
|
|
647
|
+
function Ee({
|
|
629
648
|
length: t,
|
|
630
649
|
lowercase: r,
|
|
631
650
|
matches: n,
|
|
@@ -640,9 +659,9 @@ function Se({
|
|
|
640
659
|
values: m,
|
|
641
660
|
handleChange: p,
|
|
642
661
|
errors: s
|
|
643
|
-
} =
|
|
662
|
+
} = Y(), f = "validation.length", g = "validation.min", x = "validation.max", y = "validation.trim", P = "validation.matches", v = "validation.lowercase", b = "validation.uppercase", T = I(s, P), w = I(m, P), C = typeof w == "string" ? w : Cr(w);
|
|
644
663
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
645
|
-
/* @__PURE__ */ e(
|
|
664
|
+
/* @__PURE__ */ e(Fe, { disabled: c }),
|
|
646
665
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
647
666
|
r && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
648
667
|
$,
|
|
@@ -650,7 +669,7 @@ function Se({
|
|
|
650
669
|
name: v,
|
|
651
670
|
type: "checkbox",
|
|
652
671
|
children: ({ field: O, form: N }) => /* @__PURE__ */ e(
|
|
653
|
-
|
|
672
|
+
oe,
|
|
654
673
|
{
|
|
655
674
|
label: "Lowercase",
|
|
656
675
|
disabled: c,
|
|
@@ -666,7 +685,7 @@ function Se({
|
|
|
666
685
|
name: b,
|
|
667
686
|
type: "checkbox",
|
|
668
687
|
children: ({ field: O, form: N }) => /* @__PURE__ */ e(
|
|
669
|
-
|
|
688
|
+
oe,
|
|
670
689
|
{
|
|
671
690
|
label: "Uppercase",
|
|
672
691
|
disabled: c,
|
|
@@ -682,7 +701,7 @@ function Se({
|
|
|
682
701
|
name: y,
|
|
683
702
|
type: "checkbox",
|
|
684
703
|
children: ({ field: O, form: N }) => /* @__PURE__ */ e(
|
|
685
|
-
|
|
704
|
+
oe,
|
|
686
705
|
{
|
|
687
706
|
label: "Trim",
|
|
688
707
|
disabled: c,
|
|
@@ -695,7 +714,7 @@ function Se({
|
|
|
695
714
|
] }),
|
|
696
715
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
697
716
|
t && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
698
|
-
|
|
717
|
+
K,
|
|
699
718
|
{
|
|
700
719
|
value: I(m, f),
|
|
701
720
|
label: "Exact length",
|
|
@@ -707,7 +726,7 @@ function Se({
|
|
|
707
726
|
}
|
|
708
727
|
) }),
|
|
709
728
|
l && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
710
|
-
|
|
729
|
+
K,
|
|
711
730
|
{
|
|
712
731
|
value: I(m, g),
|
|
713
732
|
label: "Min length",
|
|
@@ -719,7 +738,7 @@ function Se({
|
|
|
719
738
|
}
|
|
720
739
|
) }),
|
|
721
740
|
i && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
722
|
-
|
|
741
|
+
K,
|
|
723
742
|
{
|
|
724
743
|
value: I(m, x),
|
|
725
744
|
label: "Max length",
|
|
@@ -736,7 +755,7 @@ function Se({
|
|
|
736
755
|
$,
|
|
737
756
|
{
|
|
738
757
|
name: P,
|
|
739
|
-
as:
|
|
758
|
+
as: K,
|
|
740
759
|
label: "Matches regex",
|
|
741
760
|
size: "small",
|
|
742
761
|
disabled: c,
|
|
@@ -744,11 +763,11 @@ function Se({
|
|
|
744
763
|
error: !!T
|
|
745
764
|
}
|
|
746
765
|
),
|
|
747
|
-
/* @__PURE__ */ e(
|
|
766
|
+
/* @__PURE__ */ e(J, { error: !!T, children: T ? "Not a valid regexp" : "e.g. /^\\d+$/ for digits only" })
|
|
748
767
|
] })
|
|
749
768
|
] });
|
|
750
769
|
}
|
|
751
|
-
function
|
|
770
|
+
function Vt({
|
|
752
771
|
max: t = !0,
|
|
753
772
|
min: r = !0,
|
|
754
773
|
disabled: n
|
|
@@ -756,11 +775,11 @@ function It({
|
|
|
756
775
|
const {
|
|
757
776
|
values: i,
|
|
758
777
|
handleChange: l
|
|
759
|
-
} =
|
|
778
|
+
} = Y(), o = "validation.min", d = "validation.max";
|
|
760
779
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
761
|
-
/* @__PURE__ */ e(
|
|
780
|
+
/* @__PURE__ */ e(Fe, { disabled: n }),
|
|
762
781
|
r && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
763
|
-
|
|
782
|
+
K,
|
|
764
783
|
{
|
|
765
784
|
value: I(i, o),
|
|
766
785
|
disabled: n,
|
|
@@ -772,7 +791,7 @@ function It({
|
|
|
772
791
|
}
|
|
773
792
|
) }),
|
|
774
793
|
t && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
775
|
-
|
|
794
|
+
K,
|
|
776
795
|
{
|
|
777
796
|
value: I(i, d),
|
|
778
797
|
disabled: n,
|
|
@@ -785,11 +804,11 @@ function It({
|
|
|
785
804
|
) })
|
|
786
805
|
] });
|
|
787
806
|
}
|
|
788
|
-
function
|
|
807
|
+
function Ce({
|
|
789
808
|
children: t
|
|
790
809
|
}) {
|
|
791
810
|
return /* @__PURE__ */ e(
|
|
792
|
-
|
|
811
|
+
wt,
|
|
793
812
|
{
|
|
794
813
|
initiallyExpanded: !1,
|
|
795
814
|
asField: !0,
|
|
@@ -809,7 +828,7 @@ function Pe({
|
|
|
809
828
|
}
|
|
810
829
|
);
|
|
811
830
|
}
|
|
812
|
-
function
|
|
831
|
+
function Rt({
|
|
813
832
|
multiselect: t,
|
|
814
833
|
updateIds: r,
|
|
815
834
|
disabled: n,
|
|
@@ -821,7 +840,7 @@ function Ut({
|
|
|
821
840
|
values: d,
|
|
822
841
|
setFieldError: c,
|
|
823
842
|
setFieldValue: u
|
|
824
|
-
} =
|
|
843
|
+
} = Y(), m = Ve(), p = t ? "of.enumValues" : "enumValues", s = I(d, "defaultValue"), f = I(d, p), g = Zt(() => !f || typeof f == "boolean" ? [] : Nr(f) ?? [], [f]);
|
|
825
844
|
return /* @__PURE__ */ a(R, { children: [
|
|
826
845
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
827
846
|
Ci,
|
|
@@ -845,18 +864,18 @@ function Ut({
|
|
|
845
864
|
}
|
|
846
865
|
}
|
|
847
866
|
) }),
|
|
848
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
867
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Ce, { children: [
|
|
849
868
|
!t && /* @__PURE__ */ e(
|
|
850
|
-
|
|
869
|
+
Ee,
|
|
851
870
|
{
|
|
852
871
|
disabled: n,
|
|
853
872
|
showErrors: i
|
|
854
873
|
}
|
|
855
874
|
),
|
|
856
|
-
t && /* @__PURE__ */ e(
|
|
875
|
+
t && /* @__PURE__ */ e(Vt, { disabled: n })
|
|
857
876
|
] }) }),
|
|
858
877
|
!t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
859
|
-
|
|
878
|
+
be,
|
|
860
879
|
{
|
|
861
880
|
disabled: n,
|
|
862
881
|
position: "item-aligned",
|
|
@@ -866,7 +885,7 @@ function Ut({
|
|
|
866
885
|
label: "Default value",
|
|
867
886
|
value: s ?? "",
|
|
868
887
|
children: g.filter((y) => !!y?.id).map((y) => /* @__PURE__ */ e(
|
|
869
|
-
|
|
888
|
+
X,
|
|
870
889
|
{
|
|
871
890
|
value: y.id?.toString(),
|
|
872
891
|
children: y.label
|
|
@@ -877,14 +896,14 @@ function Ut({
|
|
|
877
896
|
) })
|
|
878
897
|
] });
|
|
879
898
|
}
|
|
880
|
-
const
|
|
899
|
+
const at = {
|
|
881
900
|
"image/*": "Images",
|
|
882
901
|
"video/*": "Videos",
|
|
883
902
|
"audio/*": "Audio files",
|
|
884
903
|
"application/*": "Files (pdf, zip, csv, excel...)",
|
|
885
904
|
"text/*": "Text files"
|
|
886
905
|
};
|
|
887
|
-
function
|
|
906
|
+
function Ut({
|
|
888
907
|
multiple: t,
|
|
889
908
|
existing: r,
|
|
890
909
|
disabled: n
|
|
@@ -892,12 +911,12 @@ function jt({
|
|
|
892
911
|
const {
|
|
893
912
|
values: i,
|
|
894
913
|
setFieldValue: l
|
|
895
|
-
} =
|
|
896
|
-
b ? b.includes("all") || b.length >= Object.keys(
|
|
914
|
+
} = Y(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`, c = `${o}.fileName`, u = `${o}.storagePath`, m = `${o}.storeUrl`, p = I(i, c) ?? "{rand}_{file}", s = I(i, u) ?? "/", f = I(i, d), g = Array.isArray(f) ? f : void 0, x = !g || g.length === 0, y = (b) => {
|
|
915
|
+
b ? b.includes("all") || b.length >= Object.keys(at).length ? l(d, void 0) : x ? l(d, Object.keys(at).filter((T) => !b.includes(T))) : l(d, b) : l(d, void 0);
|
|
897
916
|
}, P = typeof p == "function", v = typeof s == "function";
|
|
898
917
|
return /* @__PURE__ */ a(R, { children: [
|
|
899
918
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
900
|
-
|
|
919
|
+
wt,
|
|
901
920
|
{
|
|
902
921
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
903
922
|
/* @__PURE__ */ e(Rr, {}),
|
|
@@ -919,20 +938,20 @@ function jt({
|
|
|
919
938
|
value: g ?? [],
|
|
920
939
|
onMultiValueChange: y,
|
|
921
940
|
label: x ? void 0 : "Allowed file types",
|
|
922
|
-
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((T) =>
|
|
941
|
+
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((T) => at[T]).filter((T) => !!T).join(", "),
|
|
923
942
|
children: [
|
|
924
|
-
/* @__PURE__ */ a(
|
|
943
|
+
/* @__PURE__ */ a(Et, { value: "all", className: "flex items-center gap-2", children: [
|
|
925
944
|
/* @__PURE__ */ e(
|
|
926
|
-
|
|
945
|
+
St,
|
|
927
946
|
{
|
|
928
947
|
checked: !g
|
|
929
948
|
}
|
|
930
949
|
),
|
|
931
950
|
"All"
|
|
932
951
|
] }, "all"),
|
|
933
|
-
Object.entries(
|
|
952
|
+
Object.entries(at).map(([b, T]) => /* @__PURE__ */ a(Et, { value: b, className: "flex items-center gap-2", children: [
|
|
934
953
|
/* @__PURE__ */ e(
|
|
935
|
-
|
|
954
|
+
St,
|
|
936
955
|
{
|
|
937
956
|
checked: x || g.indexOf(b) > -1
|
|
938
957
|
}
|
|
@@ -955,7 +974,7 @@ function jt({
|
|
|
955
974
|
$,
|
|
956
975
|
{
|
|
957
976
|
name: c,
|
|
958
|
-
as:
|
|
977
|
+
as: K,
|
|
959
978
|
label: "File name",
|
|
960
979
|
size: "small",
|
|
961
980
|
disabled: P || n,
|
|
@@ -967,7 +986,7 @@ function jt({
|
|
|
967
986
|
$,
|
|
968
987
|
{
|
|
969
988
|
name: u,
|
|
970
|
-
as:
|
|
989
|
+
as: K,
|
|
971
990
|
label: "Storage path",
|
|
972
991
|
disabled: v || n,
|
|
973
992
|
size: "small",
|
|
@@ -992,7 +1011,7 @@ function jt({
|
|
|
992
1011
|
name: m,
|
|
993
1012
|
type: "checkbox",
|
|
994
1013
|
children: ({ field: b, form: T }) => /* @__PURE__ */ e(
|
|
995
|
-
|
|
1014
|
+
oe,
|
|
996
1015
|
{
|
|
997
1016
|
label: "Save URL instead of storage path",
|
|
998
1017
|
disabled: r || n,
|
|
@@ -1007,14 +1026,14 @@ function jt({
|
|
|
1007
1026
|
] })
|
|
1008
1027
|
}
|
|
1009
1028
|
) }),
|
|
1010
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
1011
|
-
!t && /* @__PURE__ */ e("div", { className: "grid grid-cols-12 gap-2", children: /* @__PURE__ */ e(
|
|
1012
|
-
t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1029
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Ce, { children: [
|
|
1030
|
+
!t && /* @__PURE__ */ e("div", { className: "grid grid-cols-12 gap-2", children: /* @__PURE__ */ e(Fe, { disabled: n }) }),
|
|
1031
|
+
t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Vt, { disabled: n }) })
|
|
1013
1032
|
] }) })
|
|
1014
1033
|
] });
|
|
1015
1034
|
}
|
|
1016
|
-
function
|
|
1017
|
-
if (
|
|
1035
|
+
function Ue(t) {
|
|
1036
|
+
if (re(t) || re(t))
|
|
1018
1037
|
return !1;
|
|
1019
1038
|
{
|
|
1020
1039
|
const r = t;
|
|
@@ -1022,9 +1041,9 @@ function qe(t) {
|
|
|
1022
1041
|
}
|
|
1023
1042
|
}
|
|
1024
1043
|
function wi(t) {
|
|
1025
|
-
return Object.entries(t).filter(([r, n]) =>
|
|
1044
|
+
return Object.entries(t).filter(([r, n]) => Ue(n)).map(([r, n]) => {
|
|
1026
1045
|
const i = n;
|
|
1027
|
-
if (
|
|
1046
|
+
if (Ue(i))
|
|
1028
1047
|
return i.dataType === "map" && i.properties ? {
|
|
1029
1048
|
[r]: {
|
|
1030
1049
|
...i,
|
|
@@ -1033,7 +1052,7 @@ function wi(t) {
|
|
|
1033
1052
|
} : { [r]: i };
|
|
1034
1053
|
}).filter((r) => !!r).reduce((r, n) => ({ ...r, ...n }), {});
|
|
1035
1054
|
}
|
|
1036
|
-
function
|
|
1055
|
+
function ar({
|
|
1037
1056
|
property: t,
|
|
1038
1057
|
onClick: r,
|
|
1039
1058
|
hasError: n,
|
|
@@ -1041,31 +1060,31 @@ function or({
|
|
|
1041
1060
|
includeEditButton: l,
|
|
1042
1061
|
selected: o
|
|
1043
1062
|
}) {
|
|
1044
|
-
const { propertyConfigs: d } =
|
|
1045
|
-
|
|
1063
|
+
const { propertyConfigs: d } = Se(), c = je(t, d);
|
|
1064
|
+
Ue(t);
|
|
1046
1065
|
const u = 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";
|
|
1047
|
-
return n && console.log("PropertyFieldPreview", t), /* @__PURE__ */ e(
|
|
1066
|
+
return n && console.log("PropertyFieldPreview", t), /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ a(
|
|
1048
1067
|
"div",
|
|
1049
1068
|
{
|
|
1050
1069
|
onClick: r,
|
|
1051
1070
|
className: "flex flex-row w-full cursor-pointer",
|
|
1052
1071
|
children: [
|
|
1053
|
-
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(
|
|
1072
|
+
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(qe, { propertyConfig: c }) }),
|
|
1054
1073
|
/* @__PURE__ */ a(
|
|
1055
|
-
|
|
1074
|
+
fe,
|
|
1056
1075
|
{
|
|
1057
|
-
className:
|
|
1076
|
+
className: he(
|
|
1058
1077
|
"border",
|
|
1059
1078
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1060
|
-
|
|
1061
|
-
r ?
|
|
1062
|
-
o ?
|
|
1079
|
+
Qt,
|
|
1080
|
+
r ? Xt : "",
|
|
1081
|
+
o ? er : "",
|
|
1063
1082
|
"flex-grow p-4 border transition-colors duration-200",
|
|
1064
1083
|
u
|
|
1065
1084
|
),
|
|
1066
1085
|
children: [
|
|
1067
1086
|
/* @__PURE__ */ a("div", { className: "w-full flex flex-col", children: [
|
|
1068
|
-
i && /* @__PURE__ */ e(
|
|
1087
|
+
i && /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
|
|
1069
1088
|
V,
|
|
1070
1089
|
{
|
|
1071
1090
|
variant: "body1",
|
|
@@ -1075,7 +1094,7 @@ function or({
|
|
|
1075
1094
|
}
|
|
1076
1095
|
) }),
|
|
1077
1096
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center", children: [
|
|
1078
|
-
/* @__PURE__ */ e(
|
|
1097
|
+
/* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
|
|
1079
1098
|
V,
|
|
1080
1099
|
{
|
|
1081
1100
|
className: "flex-grow pr-2",
|
|
@@ -1085,7 +1104,7 @@ function or({
|
|
|
1085
1104
|
children: c?.name
|
|
1086
1105
|
}
|
|
1087
1106
|
) }),
|
|
1088
|
-
/* @__PURE__ */ e(
|
|
1107
|
+
/* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
|
|
1089
1108
|
V,
|
|
1090
1109
|
{
|
|
1091
1110
|
variant: "body2",
|
|
@@ -1110,7 +1129,7 @@ function Ti({
|
|
|
1110
1129
|
onClick: n,
|
|
1111
1130
|
property: i
|
|
1112
1131
|
}) {
|
|
1113
|
-
const { propertyConfigs: l } =
|
|
1132
|
+
const { propertyConfigs: l } = Se(), o = !re(i) && i ? je(i, l) : void 0;
|
|
1114
1133
|
return /* @__PURE__ */ a(
|
|
1115
1134
|
"div",
|
|
1116
1135
|
{
|
|
@@ -1118,7 +1137,7 @@ function Ti({
|
|
|
1118
1137
|
className: "flex flex-row w-full cursor-pointer",
|
|
1119
1138
|
children: [
|
|
1120
1139
|
/* @__PURE__ */ a("div", { className: "relative m-4", children: [
|
|
1121
|
-
o && /* @__PURE__ */ e(
|
|
1140
|
+
o && /* @__PURE__ */ e(qe, { propertyConfig: o }),
|
|
1122
1141
|
!o && /* @__PURE__ */ e(
|
|
1123
1142
|
"div",
|
|
1124
1143
|
{
|
|
@@ -1129,13 +1148,13 @@ function Ti({
|
|
|
1129
1148
|
/* @__PURE__ */ e(qr, { color: "disabled", size: "small", className: "absolute -right-2 -top-2" })
|
|
1130
1149
|
] }),
|
|
1131
1150
|
/* @__PURE__ */ e(
|
|
1132
|
-
|
|
1151
|
+
fe,
|
|
1133
1152
|
{
|
|
1134
|
-
className:
|
|
1153
|
+
className: he(
|
|
1135
1154
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1136
|
-
|
|
1137
|
-
n ?
|
|
1138
|
-
r ?
|
|
1155
|
+
Qt,
|
|
1156
|
+
n ? Xt : "",
|
|
1157
|
+
r ? er : "",
|
|
1139
1158
|
"flex-grow p-4 border transition-colors duration-200",
|
|
1140
1159
|
r ? "border-primary" : "border-transparent"
|
|
1141
1160
|
),
|
|
@@ -1160,7 +1179,7 @@ function Ti({
|
|
|
1160
1179
|
children: o?.name
|
|
1161
1180
|
}
|
|
1162
1181
|
),
|
|
1163
|
-
i && !
|
|
1182
|
+
i && !re(i) && /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
|
|
1164
1183
|
V,
|
|
1165
1184
|
{
|
|
1166
1185
|
variant: "body2",
|
|
@@ -1169,7 +1188,7 @@ function Ti({
|
|
|
1169
1188
|
children: i.dataType
|
|
1170
1189
|
}
|
|
1171
1190
|
) }),
|
|
1172
|
-
i &&
|
|
1191
|
+
i && re(i) && /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
|
|
1173
1192
|
V,
|
|
1174
1193
|
{
|
|
1175
1194
|
variant: "body2",
|
|
@@ -1178,7 +1197,7 @@ function Ti({
|
|
|
1178
1197
|
children: "This property is defined as a property builder in code"
|
|
1179
1198
|
}
|
|
1180
1199
|
) }),
|
|
1181
|
-
!i && /* @__PURE__ */ e(
|
|
1200
|
+
!i && /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
|
|
1182
1201
|
V,
|
|
1183
1202
|
{
|
|
1184
1203
|
variant: "body2",
|
|
@@ -1195,7 +1214,7 @@ function Ti({
|
|
|
1195
1214
|
}
|
|
1196
1215
|
);
|
|
1197
1216
|
}
|
|
1198
|
-
const
|
|
1217
|
+
const ft = W.memo(
|
|
1199
1218
|
function({
|
|
1200
1219
|
namespace: r,
|
|
1201
1220
|
selectedPropertyKey: n,
|
|
@@ -1210,13 +1229,13 @@ const gt = Y.memo(
|
|
|
1210
1229
|
inferredPropertyKeys: s,
|
|
1211
1230
|
collectionEditable: f
|
|
1212
1231
|
}) {
|
|
1213
|
-
const g = o ?? Object.keys(l)
|
|
1232
|
+
const g = o ?? Object.keys(l);
|
|
1233
|
+
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(ai, { onDragEnd: (y) => {
|
|
1214
1234
|
if (!y.destination)
|
|
1215
1235
|
return;
|
|
1216
1236
|
const P = y.source.index, v = y.destination.index, b = Array.from(g), [T] = b.splice(P, 1);
|
|
1217
1237
|
b.splice(v, 0, T), u && u(b, r);
|
|
1218
|
-
},
|
|
1219
|
-
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(ai, { onDragEnd: x, children: /* @__PURE__ */ e(oi, { droppableId: `droppable_${r}`, children: (y, P) => /* @__PURE__ */ a(
|
|
1238
|
+
}, children: /* @__PURE__ */ e(oi, { droppableId: `droppable_${r}`, children: (y, P) => /* @__PURE__ */ a(
|
|
1220
1239
|
"div",
|
|
1221
1240
|
{
|
|
1222
1241
|
...y.droppableProps,
|
|
@@ -1230,7 +1249,7 @@ const gt = Y.memo(
|
|
|
1230
1249
|
{
|
|
1231
1250
|
draggableId: `array_field_${r}_${v}}`,
|
|
1232
1251
|
index: b,
|
|
1233
|
-
children: (C, O) => /* @__PURE__ */ e(
|
|
1252
|
+
children: (C, O) => /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
|
|
1234
1253
|
ki,
|
|
1235
1254
|
{
|
|
1236
1255
|
propertyKey: v,
|
|
@@ -1258,7 +1277,7 @@ const gt = Y.memo(
|
|
|
1258
1277
|
},
|
|
1259
1278
|
(t, r) => {
|
|
1260
1279
|
const n = r.selectedPropertyKey?.startsWith(r.namespace ?? ""), i = t.selectedPropertyKey?.startsWith(t.namespace ?? "");
|
|
1261
|
-
return n || i ? !1 :
|
|
1280
|
+
return n || i ? !1 : ve(t.properties, r.properties) && t.propertiesOrder === r.propertiesOrder && ve(t.additionalFields, r.additionalFields) && ve(t.errors, r.errors) && ve(t.onPropertyClick, r.onPropertyClick) && // equal(prevProps.onPropertyMove, nextProps.onPropertyMove) &&
|
|
1262
1281
|
// equal(prevProps.onPropertyRemove, nextProps.onPropertyRemove) &&
|
|
1263
1282
|
t.namespace === r.namespace && t.collectionEditable === r.collectionEditable;
|
|
1264
1283
|
}
|
|
@@ -1277,12 +1296,12 @@ function ki({
|
|
|
1277
1296
|
inferredPropertyKeys: p,
|
|
1278
1297
|
collectionEditable: s
|
|
1279
1298
|
}) {
|
|
1280
|
-
const f = p?.includes(r ? `${r}.${t}` : t), g =
|
|
1299
|
+
const f = p?.includes(r ? `${r}.${t}` : t), g = ie(t, r), y = nr(t, r) in d;
|
|
1281
1300
|
let P;
|
|
1282
1301
|
if (typeof n == "object") {
|
|
1283
1302
|
const T = n;
|
|
1284
1303
|
T.dataType === "map" && T.properties && (P = /* @__PURE__ */ e(
|
|
1285
|
-
|
|
1304
|
+
ft,
|
|
1286
1305
|
{
|
|
1287
1306
|
selectedPropertyKey: o,
|
|
1288
1307
|
namespace: g,
|
|
@@ -1296,7 +1315,7 @@ function ki({
|
|
|
1296
1315
|
}
|
|
1297
1316
|
));
|
|
1298
1317
|
}
|
|
1299
|
-
const v = o === g, b = n && (s && !
|
|
1318
|
+
const v = o === g, b = n && (s && !re(n) || Ue(n));
|
|
1300
1319
|
return /* @__PURE__ */ a(
|
|
1301
1320
|
"div",
|
|
1302
1321
|
{
|
|
@@ -1308,7 +1327,7 @@ function ki({
|
|
|
1308
1327
|
P && /* @__PURE__ */ e(
|
|
1309
1328
|
"div",
|
|
1310
1329
|
{
|
|
1311
|
-
className: "absolute border-l " +
|
|
1330
|
+
className: "absolute border-l " + Tt,
|
|
1312
1331
|
style: {
|
|
1313
1332
|
left: "32px",
|
|
1314
1333
|
top: "64px",
|
|
@@ -1316,8 +1335,8 @@ function ki({
|
|
|
1316
1335
|
}
|
|
1317
1336
|
}
|
|
1318
1337
|
),
|
|
1319
|
-
!
|
|
1320
|
-
|
|
1338
|
+
!re(n) && !i && b ? /* @__PURE__ */ e(
|
|
1339
|
+
ar,
|
|
1321
1340
|
{
|
|
1322
1341
|
property: n,
|
|
1323
1342
|
onClick: c ? () => c(t, r) : void 0,
|
|
@@ -1335,9 +1354,9 @@ function ki({
|
|
|
1335
1354
|
}
|
|
1336
1355
|
),
|
|
1337
1356
|
/* @__PURE__ */ a("div", { className: "absolute top-2 right-2 flex flex-row ", children: [
|
|
1338
|
-
f && /* @__PURE__ */ e(
|
|
1339
|
-
m && /* @__PURE__ */ e(
|
|
1340
|
-
|
|
1357
|
+
f && /* @__PURE__ */ e(ee, { title: "Inferred property", children: /* @__PURE__ */ e(ht, { size: "small", className: "p-2" }) }),
|
|
1358
|
+
m && /* @__PURE__ */ e(ee, { title: "Remove", children: /* @__PURE__ */ e(
|
|
1359
|
+
ne,
|
|
1341
1360
|
{
|
|
1342
1361
|
size: "small",
|
|
1343
1362
|
color: "inherit",
|
|
@@ -1345,8 +1364,8 @@ function ki({
|
|
|
1345
1364
|
children: /* @__PURE__ */ e(Lr, { size: "small" })
|
|
1346
1365
|
}
|
|
1347
1366
|
) }),
|
|
1348
|
-
u && /* @__PURE__ */ e(
|
|
1349
|
-
|
|
1367
|
+
u && /* @__PURE__ */ e(ee, { title: "Move", children: /* @__PURE__ */ e(
|
|
1368
|
+
ne,
|
|
1350
1369
|
{
|
|
1351
1370
|
component: "span",
|
|
1352
1371
|
size: "small",
|
|
@@ -1363,7 +1382,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1363
1382
|
const {
|
|
1364
1383
|
values: o,
|
|
1365
1384
|
setFieldValue: d
|
|
1366
|
-
} =
|
|
1385
|
+
} = Y(), [c, u] = j(!1), [m, p] = j(), [s, f] = j(), g = o.propertiesOrder ?? Object.keys(o.properties ?? {}), x = ({
|
|
1367
1386
|
id: w,
|
|
1368
1387
|
property: C
|
|
1369
1388
|
}) => {
|
|
@@ -1375,15 +1394,15 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1375
1394
|
}, !1);
|
|
1376
1395
|
const O = o.propertiesOrder ?? Object.keys(o.properties ?? {}), N = O.includes(w) ? O : [...O, w];
|
|
1377
1396
|
d("propertiesOrder", N, !1), u(!1);
|
|
1378
|
-
}, y =
|
|
1379
|
-
const O = w ?
|
|
1397
|
+
}, y = (w, C) => {
|
|
1398
|
+
const O = w ? ie(w, C) : void 0;
|
|
1380
1399
|
if (!O)
|
|
1381
1400
|
throw Error("collection editor miss config");
|
|
1382
|
-
const N =
|
|
1383
|
-
d(N, void 0, !1), d(F,
|
|
1384
|
-
},
|
|
1385
|
-
d(
|
|
1386
|
-
}
|
|
1401
|
+
const N = me(O), F = ye(C), B = I(o, F) ?? Object.keys(I(o, ir(C)));
|
|
1402
|
+
d(N, void 0, !1), d(F, B.filter((_) => _ !== w), !1), u(!1), p(void 0), f(void 0);
|
|
1403
|
+
}, P = m ? ie(m, s) : void 0, v = P ? I(o.properties, P.replaceAll(".", ".properties.")) : void 0, b = !g || g.length < 1, T = (w, C) => {
|
|
1404
|
+
d(ye(C), w, !1);
|
|
1405
|
+
};
|
|
1387
1406
|
return /* @__PURE__ */ a(R, { children: [
|
|
1388
1407
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1389
1408
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end my-4", children: [
|
|
@@ -1394,7 +1413,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1394
1413
|
color: "primary",
|
|
1395
1414
|
variant: "outlined",
|
|
1396
1415
|
onClick: () => u(!0),
|
|
1397
|
-
startIcon: /* @__PURE__ */ e(
|
|
1416
|
+
startIcon: /* @__PURE__ */ e(de, {}),
|
|
1398
1417
|
children: [
|
|
1399
1418
|
"Add property to ",
|
|
1400
1419
|
o.name ?? "this group"
|
|
@@ -1402,9 +1421,9 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1402
1421
|
}
|
|
1403
1422
|
)
|
|
1404
1423
|
] }),
|
|
1405
|
-
/* @__PURE__ */ a(
|
|
1424
|
+
/* @__PURE__ */ a(fe, { className: "p-2 pl-8", children: [
|
|
1406
1425
|
/* @__PURE__ */ e(
|
|
1407
|
-
|
|
1426
|
+
ft,
|
|
1408
1427
|
{
|
|
1409
1428
|
properties: o.properties ?? {},
|
|
1410
1429
|
propertiesOrder: g,
|
|
@@ -1428,7 +1447,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1428
1447
|
] }),
|
|
1429
1448
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1430
1449
|
/* @__PURE__ */ e(
|
|
1431
|
-
|
|
1450
|
+
ut,
|
|
1432
1451
|
{
|
|
1433
1452
|
position: "start",
|
|
1434
1453
|
size: "small",
|
|
@@ -1437,10 +1456,10 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1437
1456
|
value: o.spreadChildren ?? !1
|
|
1438
1457
|
}
|
|
1439
1458
|
),
|
|
1440
|
-
/* @__PURE__ */ e(
|
|
1459
|
+
/* @__PURE__ */ e(J, { children: "Set this flag to true if you want to display the children of this group as individual columns." })
|
|
1441
1460
|
] }),
|
|
1442
1461
|
/* @__PURE__ */ e(
|
|
1443
|
-
|
|
1462
|
+
Oe,
|
|
1444
1463
|
{
|
|
1445
1464
|
inArray: !1,
|
|
1446
1465
|
forceShowErrors: !1,
|
|
@@ -1483,9 +1502,9 @@ function Vi({
|
|
|
1483
1502
|
errors: m,
|
|
1484
1503
|
setFieldValue: p,
|
|
1485
1504
|
touched: s
|
|
1486
|
-
} =
|
|
1505
|
+
} = Y(), [f, g] = j(!1), x = I(c, "of"), y = I(s, "of") && I(m, "of"), P = ({ id: b, property: T, namespace: w }) => {
|
|
1487
1506
|
console.log("onPropertyChanged", b, T, w), p("of", T);
|
|
1488
|
-
}, v = x &&
|
|
1507
|
+
}, v = x && je(x, o);
|
|
1489
1508
|
return /* @__PURE__ */ a(R, { children: [
|
|
1490
1509
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1491
1510
|
/* @__PURE__ */ e(V, { variant: "subtitle2", children: "Repeat component" }),
|
|
@@ -1494,9 +1513,9 @@ function Vi({
|
|
|
1494
1513
|
{
|
|
1495
1514
|
name: "of",
|
|
1496
1515
|
value: x,
|
|
1497
|
-
children: ({}) => /* @__PURE__ */ a(
|
|
1516
|
+
children: ({}) => /* @__PURE__ */ a(fe, { className: "p-2 mt-4", children: [
|
|
1498
1517
|
x && /* @__PURE__ */ e(
|
|
1499
|
-
|
|
1518
|
+
ar,
|
|
1500
1519
|
{
|
|
1501
1520
|
property: x,
|
|
1502
1521
|
onClick: n ? void 0 : () => g(!0),
|
|
@@ -1520,7 +1539,7 @@ function Vi({
|
|
|
1520
1539
|
}
|
|
1521
1540
|
),
|
|
1522
1541
|
/* @__PURE__ */ e(
|
|
1523
|
-
|
|
1542
|
+
Oe,
|
|
1524
1543
|
{
|
|
1525
1544
|
inArray: !0,
|
|
1526
1545
|
open: f,
|
|
@@ -1542,10 +1561,10 @@ function Vi({
|
|
|
1542
1561
|
}
|
|
1543
1562
|
)
|
|
1544
1563
|
] }),
|
|
1545
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1564
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(Vt, { disabled: n }) }) })
|
|
1546
1565
|
] });
|
|
1547
1566
|
}
|
|
1548
|
-
const Ii =
|
|
1567
|
+
const Ii = W.forwardRef(
|
|
1549
1568
|
function({
|
|
1550
1569
|
showErrors: r,
|
|
1551
1570
|
disabledId: n,
|
|
@@ -1560,7 +1579,7 @@ const Ii = Y.forwardRef(
|
|
|
1560
1579
|
setFieldTouched: p,
|
|
1561
1580
|
touched: s,
|
|
1562
1581
|
validate: f
|
|
1563
|
-
} =
|
|
1582
|
+
} = Y(), g = "name", x = r && I(c, g), y = "id", P = r && I(c, y), v = "description", b = r && I(c, v);
|
|
1564
1583
|
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
1565
1584
|
/* @__PURE__ */ a("div", { children: [
|
|
1566
1585
|
/* @__PURE__ */ e(
|
|
@@ -1568,11 +1587,11 @@ const Ii = Y.forwardRef(
|
|
|
1568
1587
|
{
|
|
1569
1588
|
name: g,
|
|
1570
1589
|
inputRef: d,
|
|
1571
|
-
as:
|
|
1590
|
+
as: K,
|
|
1572
1591
|
value: u[g],
|
|
1573
1592
|
onChange: (T) => {
|
|
1574
1593
|
const w = T.target.value;
|
|
1575
|
-
!I(s, y) && l && m(y, w ?
|
|
1594
|
+
!I(s, y) && l && m(y, w ? Nt(w) : "", !1), m(g, w, !0), p(g, !0);
|
|
1576
1595
|
},
|
|
1577
1596
|
style: { fontSize: 20 },
|
|
1578
1597
|
placeholder: "Field name",
|
|
@@ -1581,19 +1600,19 @@ const Ii = Y.forwardRef(
|
|
|
1581
1600
|
error: !!x
|
|
1582
1601
|
}
|
|
1583
1602
|
),
|
|
1584
|
-
/* @__PURE__ */ e(
|
|
1603
|
+
/* @__PURE__ */ e(J, { error: !!x, children: x })
|
|
1585
1604
|
] }),
|
|
1586
1605
|
/* @__PURE__ */ a("div", { children: [
|
|
1587
1606
|
/* @__PURE__ */ e(
|
|
1588
1607
|
$,
|
|
1589
1608
|
{
|
|
1590
1609
|
name: y,
|
|
1591
|
-
as:
|
|
1610
|
+
as: K,
|
|
1592
1611
|
label: "ID",
|
|
1593
1612
|
value: u[y],
|
|
1594
1613
|
onChange: (T) => {
|
|
1595
1614
|
const w = T.target.value;
|
|
1596
|
-
!I(s, g) && l && m(g, w ?
|
|
1615
|
+
!I(s, g) && l && m(g, w ? xt(w) : ""), m(y, w, !0), p(y, !0);
|
|
1597
1616
|
},
|
|
1598
1617
|
disabled: n || i,
|
|
1599
1618
|
required: !0,
|
|
@@ -1601,20 +1620,20 @@ const Ii = Y.forwardRef(
|
|
|
1601
1620
|
error: !!P
|
|
1602
1621
|
}
|
|
1603
1622
|
),
|
|
1604
|
-
/* @__PURE__ */ e(
|
|
1623
|
+
/* @__PURE__ */ e(J, { error: !!P, children: P })
|
|
1605
1624
|
] }),
|
|
1606
1625
|
/* @__PURE__ */ a("div", { children: [
|
|
1607
1626
|
/* @__PURE__ */ e(
|
|
1608
1627
|
$,
|
|
1609
1628
|
{
|
|
1610
1629
|
name: v,
|
|
1611
|
-
as:
|
|
1630
|
+
as: K,
|
|
1612
1631
|
label: "Description",
|
|
1613
1632
|
disabled: i,
|
|
1614
1633
|
error: !!b
|
|
1615
1634
|
}
|
|
1616
1635
|
),
|
|
1617
|
-
/* @__PURE__ */ e(
|
|
1636
|
+
/* @__PURE__ */ e(J, { error: !!b, children: b })
|
|
1618
1637
|
] })
|
|
1619
1638
|
] });
|
|
1620
1639
|
}
|
|
@@ -1624,11 +1643,11 @@ function _i({
|
|
|
1624
1643
|
disabled: r,
|
|
1625
1644
|
showErrors: n
|
|
1626
1645
|
}) {
|
|
1627
|
-
const { values: i, setFieldValue: l } =
|
|
1646
|
+
const { values: i, setFieldValue: l } = Y();
|
|
1628
1647
|
return /* @__PURE__ */ a(R, { children: [
|
|
1629
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
1648
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Ce, { children: [
|
|
1630
1649
|
t === "text_field" && /* @__PURE__ */ e(
|
|
1631
|
-
|
|
1650
|
+
Ee,
|
|
1632
1651
|
{
|
|
1633
1652
|
disabled: r,
|
|
1634
1653
|
length: !0,
|
|
@@ -1642,7 +1661,7 @@ function _i({
|
|
|
1642
1661
|
}
|
|
1643
1662
|
),
|
|
1644
1663
|
t === "multiline" && /* @__PURE__ */ e(
|
|
1645
|
-
|
|
1664
|
+
Ee,
|
|
1646
1665
|
{
|
|
1647
1666
|
disabled: r,
|
|
1648
1667
|
length: !0,
|
|
@@ -1655,7 +1674,7 @@ function _i({
|
|
|
1655
1674
|
}
|
|
1656
1675
|
),
|
|
1657
1676
|
t === "markdown" && /* @__PURE__ */ e(
|
|
1658
|
-
|
|
1677
|
+
Ee,
|
|
1659
1678
|
{
|
|
1660
1679
|
disabled: r,
|
|
1661
1680
|
length: !0,
|
|
@@ -1668,7 +1687,7 @@ function _i({
|
|
|
1668
1687
|
}
|
|
1669
1688
|
),
|
|
1670
1689
|
t === "email" && /* @__PURE__ */ e(
|
|
1671
|
-
|
|
1690
|
+
Ee,
|
|
1672
1691
|
{
|
|
1673
1692
|
disabled: r,
|
|
1674
1693
|
max: !0,
|
|
@@ -1679,7 +1698,7 @@ function _i({
|
|
|
1679
1698
|
)
|
|
1680
1699
|
] }) }),
|
|
1681
1700
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1682
|
-
|
|
1701
|
+
we,
|
|
1683
1702
|
{
|
|
1684
1703
|
name: "defaultValue",
|
|
1685
1704
|
disabled: r,
|
|
@@ -1693,15 +1712,15 @@ function _i({
|
|
|
1693
1712
|
] });
|
|
1694
1713
|
}
|
|
1695
1714
|
function Fi({ disabled: t }) {
|
|
1696
|
-
const { values: r } =
|
|
1715
|
+
const { values: r } = Y(), n = I(r, "defaultValue");
|
|
1697
1716
|
return /* @__PURE__ */ a(R, { children: [
|
|
1698
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1717
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(Fe, { disabled: t }) }) }),
|
|
1699
1718
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1700
1719
|
$,
|
|
1701
1720
|
{
|
|
1702
1721
|
name: "defaultValue",
|
|
1703
1722
|
children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
1704
|
-
|
|
1723
|
+
oe,
|
|
1705
1724
|
{
|
|
1706
1725
|
label: n == null ? "Default value not set" : "Default value is " + n.toString(),
|
|
1707
1726
|
disabled: t,
|
|
@@ -1724,7 +1743,7 @@ function Ei({
|
|
|
1724
1743
|
const {
|
|
1725
1744
|
values: o,
|
|
1726
1745
|
setFieldValue: d
|
|
1727
|
-
} =
|
|
1746
|
+
} = Y(), [c, u] = j(!1), [m, p] = j(), [s, f] = j(), g = ({
|
|
1728
1747
|
id: T,
|
|
1729
1748
|
property: w
|
|
1730
1749
|
}) => {
|
|
@@ -1736,37 +1755,37 @@ function Ei({
|
|
|
1736
1755
|
}, !1);
|
|
1737
1756
|
const C = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), O = C.includes(T) ? C : [...C, T];
|
|
1738
1757
|
d("oneOf.propertiesOrder", O, !1), u(!1);
|
|
1739
|
-
}, x = m ?
|
|
1740
|
-
const C = T ?
|
|
1758
|
+
}, x = m ? ie(m, s) : void 0, y = x ? I(o.oneOf?.properties, x.replaceAll(".", ".properties.")) : void 0, P = (T, w) => {
|
|
1759
|
+
const C = T ? ie(T, w) : void 0;
|
|
1741
1760
|
if (!C)
|
|
1742
1761
|
throw Error("collection editor miss config");
|
|
1743
|
-
d(`oneOf.${
|
|
1744
|
-
const O = `oneOf.${
|
|
1762
|
+
d(`oneOf.${me(C)}`, void 0, !1);
|
|
1763
|
+
const O = `oneOf.${ye(w)}`, N = I(o, O) ?? Object.keys(I(o, ir(w)));
|
|
1745
1764
|
d(O, N.filter((F) => F !== T), !1), u(!1), p(void 0), f(void 0);
|
|
1746
|
-
},
|
|
1765
|
+
}, v = /* @__PURE__ */ a(
|
|
1747
1766
|
z,
|
|
1748
1767
|
{
|
|
1749
1768
|
autoFocus: !0,
|
|
1750
1769
|
color: "primary",
|
|
1751
1770
|
onClick: () => u(!0),
|
|
1752
|
-
startIcon: /* @__PURE__ */ e(
|
|
1771
|
+
startIcon: /* @__PURE__ */ e(de, {}),
|
|
1753
1772
|
children: [
|
|
1754
1773
|
"Add property to ",
|
|
1755
1774
|
o.name ?? "this block"
|
|
1756
1775
|
]
|
|
1757
1776
|
}
|
|
1758
|
-
), b =
|
|
1759
|
-
d(`oneOf.${
|
|
1760
|
-
}
|
|
1777
|
+
), b = (T, w) => {
|
|
1778
|
+
d(`oneOf.${ye(w)}`, T, !1);
|
|
1779
|
+
};
|
|
1761
1780
|
return /* @__PURE__ */ a(R, { children: [
|
|
1762
1781
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1763
1782
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end mt-8 mb-4", children: [
|
|
1764
1783
|
/* @__PURE__ */ e(V, { variant: "subtitle2", children: "Properties in this block" }),
|
|
1765
1784
|
v
|
|
1766
1785
|
] }),
|
|
1767
|
-
/* @__PURE__ */ a(
|
|
1786
|
+
/* @__PURE__ */ a(fe, { className: "p-2 pl-8", children: [
|
|
1768
1787
|
/* @__PURE__ */ e(
|
|
1769
|
-
|
|
1788
|
+
ft,
|
|
1770
1789
|
{
|
|
1771
1790
|
properties: o.oneOf?.properties ?? {},
|
|
1772
1791
|
propertiesOrder: o.oneOf?.propertiesOrder,
|
|
@@ -1782,7 +1801,7 @@ function Ei({
|
|
|
1782
1801
|
] })
|
|
1783
1802
|
] }),
|
|
1784
1803
|
!t && /* @__PURE__ */ e(
|
|
1785
|
-
|
|
1804
|
+
Oe,
|
|
1786
1805
|
{
|
|
1787
1806
|
inArray: !1,
|
|
1788
1807
|
forceShowErrors: !1,
|
|
@@ -1814,11 +1833,11 @@ function Si({ disabled: t }) {
|
|
|
1814
1833
|
const {
|
|
1815
1834
|
values: r,
|
|
1816
1835
|
handleChange: n
|
|
1817
|
-
} =
|
|
1836
|
+
} = Y(), i = "validation.min", l = "validation.max", o = "validation.lessThan", d = "validation.moreThan";
|
|
1818
1837
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
1819
|
-
/* @__PURE__ */ e(
|
|
1838
|
+
/* @__PURE__ */ e(Fe, { disabled: t }),
|
|
1820
1839
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1821
|
-
|
|
1840
|
+
K,
|
|
1822
1841
|
{
|
|
1823
1842
|
value: I(r, i),
|
|
1824
1843
|
label: "Min value",
|
|
@@ -1830,7 +1849,7 @@ function Si({ disabled: t }) {
|
|
|
1830
1849
|
}
|
|
1831
1850
|
) }),
|
|
1832
1851
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1833
|
-
|
|
1852
|
+
K,
|
|
1834
1853
|
{
|
|
1835
1854
|
value: I(r, l),
|
|
1836
1855
|
label: "Max value",
|
|
@@ -1842,7 +1861,7 @@ function Si({ disabled: t }) {
|
|
|
1842
1861
|
}
|
|
1843
1862
|
) }),
|
|
1844
1863
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1845
|
-
|
|
1864
|
+
K,
|
|
1846
1865
|
{
|
|
1847
1866
|
value: I(r, o),
|
|
1848
1867
|
label: "Less than",
|
|
@@ -1854,7 +1873,7 @@ function Si({ disabled: t }) {
|
|
|
1854
1873
|
}
|
|
1855
1874
|
) }),
|
|
1856
1875
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1857
|
-
|
|
1876
|
+
K,
|
|
1858
1877
|
{
|
|
1859
1878
|
value: I(r, d),
|
|
1860
1879
|
label: "More than",
|
|
@@ -1871,7 +1890,7 @@ function Si({ disabled: t }) {
|
|
|
1871
1890
|
name: "validation.positive",
|
|
1872
1891
|
type: "checkbox",
|
|
1873
1892
|
children: ({ field: p, form: s }) => /* @__PURE__ */ e(
|
|
1874
|
-
|
|
1893
|
+
oe,
|
|
1875
1894
|
{
|
|
1876
1895
|
label: "Positive value",
|
|
1877
1896
|
disabled: t,
|
|
@@ -1887,7 +1906,7 @@ function Si({ disabled: t }) {
|
|
|
1887
1906
|
name: "validation.negative",
|
|
1888
1907
|
type: "checkbox",
|
|
1889
1908
|
children: ({ field: p, form: s }) => /* @__PURE__ */ e(
|
|
1890
|
-
|
|
1909
|
+
oe,
|
|
1891
1910
|
{
|
|
1892
1911
|
label: "Negative value",
|
|
1893
1912
|
disabled: t,
|
|
@@ -1903,7 +1922,7 @@ function Si({ disabled: t }) {
|
|
|
1903
1922
|
name: "validation.integer",
|
|
1904
1923
|
type: "checkbox",
|
|
1905
1924
|
children: ({ field: p, form: s }) => /* @__PURE__ */ e(
|
|
1906
|
-
|
|
1925
|
+
oe,
|
|
1907
1926
|
{
|
|
1908
1927
|
label: "Integer value",
|
|
1909
1928
|
disabled: t,
|
|
@@ -1916,11 +1935,11 @@ function Si({ disabled: t }) {
|
|
|
1916
1935
|
] });
|
|
1917
1936
|
}
|
|
1918
1937
|
function Ai({ disabled: t }) {
|
|
1919
|
-
const { values: r, setFieldValue: n } =
|
|
1938
|
+
const { values: r, setFieldValue: n } = Y();
|
|
1920
1939
|
return /* @__PURE__ */ a(R, { children: [
|
|
1921
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1940
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(Si, { disabled: t }) }) }),
|
|
1922
1941
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1923
|
-
|
|
1942
|
+
we,
|
|
1924
1943
|
{
|
|
1925
1944
|
name: "defaultValue",
|
|
1926
1945
|
disabled: t,
|
|
@@ -1934,7 +1953,7 @@ function Ai({ disabled: t }) {
|
|
|
1934
1953
|
) })
|
|
1935
1954
|
] });
|
|
1936
1955
|
}
|
|
1937
|
-
function
|
|
1956
|
+
function jt({
|
|
1938
1957
|
existing: t,
|
|
1939
1958
|
multiple: r,
|
|
1940
1959
|
disabled: n,
|
|
@@ -1944,9 +1963,9 @@ function qt({
|
|
|
1944
1963
|
values: l,
|
|
1945
1964
|
handleChange: o,
|
|
1946
1965
|
errors: d
|
|
1947
|
-
} =
|
|
1966
|
+
} = Y();
|
|
1948
1967
|
if (!Te())
|
|
1949
|
-
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1968
|
+
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(He, {}) });
|
|
1950
1969
|
const u = r ? "of.path" : "path", m = I(l, u), p = i && I(d, u);
|
|
1951
1970
|
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1952
1971
|
$,
|
|
@@ -1972,13 +1991,13 @@ function Di({
|
|
|
1972
1991
|
}) {
|
|
1973
1992
|
const d = Te();
|
|
1974
1993
|
if (!d)
|
|
1975
|
-
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1994
|
+
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(He, {}) });
|
|
1976
1995
|
const c = d?.collections ?? [], u = Array.from(new Set(
|
|
1977
1996
|
Object.values(c).map((p) => p.group).filter(Boolean)
|
|
1978
1997
|
).values()), m = c.filter((p) => !p.group);
|
|
1979
1998
|
return /* @__PURE__ */ a(R, { children: [
|
|
1980
1999
|
/* @__PURE__ */ a(
|
|
1981
|
-
|
|
2000
|
+
be,
|
|
1982
2001
|
{
|
|
1983
2002
|
error: !!l,
|
|
1984
2003
|
disabled: t,
|
|
@@ -1990,7 +2009,7 @@ function Di({
|
|
|
1990
2009
|
renderValue: (p) => {
|
|
1991
2010
|
const s = c.find((f) => f.id === p || f.path === p);
|
|
1992
2011
|
return s ? /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
1993
|
-
/* @__PURE__ */ e(
|
|
2012
|
+
/* @__PURE__ */ e(st, { collectionOrView: s }),
|
|
1994
2013
|
/* @__PURE__ */ e(
|
|
1995
2014
|
V,
|
|
1996
2015
|
{
|
|
@@ -2004,15 +2023,15 @@ function Di({
|
|
|
2004
2023
|
...o,
|
|
2005
2024
|
children: [
|
|
2006
2025
|
u.flatMap((p) => /* @__PURE__ */ e(
|
|
2007
|
-
|
|
2026
|
+
At,
|
|
2008
2027
|
{
|
|
2009
2028
|
label: p || "Views",
|
|
2010
2029
|
children: c.filter((s) => s.group === p).map((s) => /* @__PURE__ */ e(
|
|
2011
|
-
|
|
2030
|
+
X,
|
|
2012
2031
|
{
|
|
2013
2032
|
value: s.id ?? s.path,
|
|
2014
2033
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2015
|
-
/* @__PURE__ */ e(
|
|
2034
|
+
/* @__PURE__ */ e(st, { collectionOrView: s }),
|
|
2016
2035
|
/* @__PURE__ */ e(
|
|
2017
2036
|
V,
|
|
2018
2037
|
{
|
|
@@ -2028,12 +2047,12 @@ function Di({
|
|
|
2028
2047
|
},
|
|
2029
2048
|
`group_${p}`
|
|
2030
2049
|
)),
|
|
2031
|
-
m && /* @__PURE__ */ e(
|
|
2032
|
-
|
|
2050
|
+
m && /* @__PURE__ */ e(At, { label: "Views", children: m.map((p) => /* @__PURE__ */ e(
|
|
2051
|
+
X,
|
|
2033
2052
|
{
|
|
2034
2053
|
value: p.id ?? p.path,
|
|
2035
2054
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2036
|
-
/* @__PURE__ */ e(
|
|
2055
|
+
/* @__PURE__ */ e(st, { collectionOrView: p }),
|
|
2037
2056
|
/* @__PURE__ */ e(
|
|
2038
2057
|
V,
|
|
2039
2058
|
{
|
|
@@ -2049,7 +2068,7 @@ function Di({
|
|
|
2049
2068
|
]
|
|
2050
2069
|
}
|
|
2051
2070
|
),
|
|
2052
|
-
/* @__PURE__ */ e(
|
|
2071
|
+
/* @__PURE__ */ e(J, { children: "You can only edit the reference collection upon field creation." })
|
|
2053
2072
|
] });
|
|
2054
2073
|
}
|
|
2055
2074
|
function Bi({ disabled: t }) {
|
|
@@ -2058,11 +2077,11 @@ function Bi({ disabled: t }) {
|
|
|
2058
2077
|
errors: n,
|
|
2059
2078
|
touched: i,
|
|
2060
2079
|
setFieldValue: l
|
|
2061
|
-
} =
|
|
2080
|
+
} = Y(), o = "mode", d = I(r, o), c = I(i, o) && I(n, o), u = "autoValue", m = I(r, u), p = I(i, u) && I(n, u);
|
|
2062
2081
|
return /* @__PURE__ */ a(R, { children: [
|
|
2063
2082
|
/* @__PURE__ */ a("div", { className: "flex flex-col col-span-12", children: [
|
|
2064
2083
|
/* @__PURE__ */ a(
|
|
2065
|
-
|
|
2084
|
+
be,
|
|
2066
2085
|
{
|
|
2067
2086
|
name: o,
|
|
2068
2087
|
value: d ?? "date",
|
|
@@ -2081,14 +2100,14 @@ function Bi({ disabled: t }) {
|
|
|
2081
2100
|
},
|
|
2082
2101
|
disabled: t,
|
|
2083
2102
|
children: [
|
|
2084
|
-
/* @__PURE__ */ e(
|
|
2085
|
-
/* @__PURE__ */ e(
|
|
2103
|
+
/* @__PURE__ */ e(X, { value: "date_time", children: " Date/Time " }),
|
|
2104
|
+
/* @__PURE__ */ e(X, { value: "date", children: " Date " })
|
|
2086
2105
|
]
|
|
2087
2106
|
}
|
|
2088
2107
|
),
|
|
2089
|
-
/* @__PURE__ */ e(
|
|
2108
|
+
/* @__PURE__ */ e(J, { error: !!c, children: c }),
|
|
2090
2109
|
/* @__PURE__ */ a(
|
|
2091
|
-
|
|
2110
|
+
be,
|
|
2092
2111
|
{
|
|
2093
2112
|
name: u,
|
|
2094
2113
|
disabled: t,
|
|
@@ -2107,21 +2126,21 @@ function Bi({ disabled: t }) {
|
|
|
2107
2126
|
error: !!p,
|
|
2108
2127
|
label: "Automatic value",
|
|
2109
2128
|
children: [
|
|
2110
|
-
/* @__PURE__ */ e(
|
|
2111
|
-
/* @__PURE__ */ e(
|
|
2112
|
-
/* @__PURE__ */ e(
|
|
2129
|
+
/* @__PURE__ */ e(X, { value: "none", children: " None " }),
|
|
2130
|
+
/* @__PURE__ */ e(X, { value: "on_create", children: " On create " }),
|
|
2131
|
+
/* @__PURE__ */ e(X, { value: "on_update", children: " On any update " })
|
|
2113
2132
|
]
|
|
2114
2133
|
}
|
|
2115
2134
|
),
|
|
2116
|
-
/* @__PURE__ */ e(
|
|
2135
|
+
/* @__PURE__ */ e(J, { error: !!p, children: p ?? "Update this field automatically when creating or updating the entity" })
|
|
2117
2136
|
] }),
|
|
2118
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2137
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(Fe, { disabled: t }) }) })
|
|
2119
2138
|
] });
|
|
2120
2139
|
}
|
|
2121
2140
|
function Mi({ disabled: t }) {
|
|
2122
2141
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
2123
2142
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e($, { type: "checkbox", name: "hideFromCollection", children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
2124
|
-
|
|
2143
|
+
oe,
|
|
2125
2144
|
{
|
|
2126
2145
|
label: "Hide from collection",
|
|
2127
2146
|
disabled: t,
|
|
@@ -2136,7 +2155,7 @@ function Mi({ disabled: t }) {
|
|
|
2136
2155
|
name: "readOnly",
|
|
2137
2156
|
type: "checkbox",
|
|
2138
2157
|
children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
2139
|
-
|
|
2158
|
+
oe,
|
|
2140
2159
|
{
|
|
2141
2160
|
label: "Read only",
|
|
2142
2161
|
disabled: t,
|
|
@@ -2150,11 +2169,11 @@ function Mi({ disabled: t }) {
|
|
|
2150
2169
|
] });
|
|
2151
2170
|
}
|
|
2152
2171
|
function zi({ disabled: t }) {
|
|
2153
|
-
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2172
|
+
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(Fe, { disabled: t }) }) }) });
|
|
2154
2173
|
}
|
|
2155
|
-
function
|
|
2174
|
+
function or(t, r, n) {
|
|
2156
2175
|
let i;
|
|
2157
|
-
return r === "text_field" ? i =
|
|
2176
|
+
return r === "text_field" ? i = G(
|
|
2158
2177
|
t,
|
|
2159
2178
|
{
|
|
2160
2179
|
dataType: "string",
|
|
@@ -2167,7 +2186,7 @@ function lr(t, r, n) {
|
|
|
2167
2186
|
url: void 0,
|
|
2168
2187
|
enumValues: void 0
|
|
2169
2188
|
}
|
|
2170
|
-
) : r === "multiline" ? i =
|
|
2189
|
+
) : r === "multiline" ? i = G(
|
|
2171
2190
|
t,
|
|
2172
2191
|
{
|
|
2173
2192
|
dataType: "string",
|
|
@@ -2180,7 +2199,7 @@ function lr(t, r, n) {
|
|
|
2180
2199
|
url: void 0,
|
|
2181
2200
|
enumValues: void 0
|
|
2182
2201
|
}
|
|
2183
|
-
) : r === "markdown" ? i =
|
|
2202
|
+
) : r === "markdown" ? i = G(
|
|
2184
2203
|
t,
|
|
2185
2204
|
{
|
|
2186
2205
|
dataType: "string",
|
|
@@ -2192,7 +2211,7 @@ function lr(t, r, n) {
|
|
|
2192
2211
|
email: void 0,
|
|
2193
2212
|
url: void 0
|
|
2194
2213
|
}
|
|
2195
|
-
) : r === "url" ? i =
|
|
2214
|
+
) : r === "url" ? i = G(
|
|
2196
2215
|
t,
|
|
2197
2216
|
{
|
|
2198
2217
|
dataType: "string",
|
|
@@ -2205,7 +2224,7 @@ function lr(t, r, n) {
|
|
|
2205
2224
|
url: !0,
|
|
2206
2225
|
enumValues: void 0
|
|
2207
2226
|
}
|
|
2208
|
-
) : r === "email" ? i =
|
|
2227
|
+
) : r === "email" ? i = G(
|
|
2209
2228
|
t,
|
|
2210
2229
|
{
|
|
2211
2230
|
dataType: "string",
|
|
@@ -2218,7 +2237,7 @@ function lr(t, r, n) {
|
|
|
2218
2237
|
url: void 0,
|
|
2219
2238
|
enumValues: void 0
|
|
2220
2239
|
}
|
|
2221
|
-
) : r === "select" ? i =
|
|
2240
|
+
) : r === "select" ? i = G(
|
|
2222
2241
|
t,
|
|
2223
2242
|
{
|
|
2224
2243
|
dataType: "string",
|
|
@@ -2231,7 +2250,7 @@ function lr(t, r, n) {
|
|
|
2231
2250
|
url: void 0,
|
|
2232
2251
|
enumValues: t.enumValues ?? []
|
|
2233
2252
|
}
|
|
2234
|
-
) : r === "multi_select" ? i =
|
|
2253
|
+
) : r === "multi_select" ? i = G(
|
|
2235
2254
|
t,
|
|
2236
2255
|
{
|
|
2237
2256
|
dataType: "array",
|
|
@@ -2242,7 +2261,7 @@ function lr(t, r, n) {
|
|
|
2242
2261
|
enumValues: t.of?.enumValues ?? []
|
|
2243
2262
|
}
|
|
2244
2263
|
}
|
|
2245
|
-
) : r === "number_input" ? i =
|
|
2264
|
+
) : r === "number_input" ? i = G(
|
|
2246
2265
|
t,
|
|
2247
2266
|
{
|
|
2248
2267
|
dataType: "number",
|
|
@@ -2250,7 +2269,7 @@ function lr(t, r, n) {
|
|
|
2250
2269
|
editable: t.editable !== void 0 ? t.editable : !0,
|
|
2251
2270
|
enumValues: void 0
|
|
2252
2271
|
}
|
|
2253
|
-
) : r === "number_select" ? i =
|
|
2272
|
+
) : r === "number_select" ? i = G(
|
|
2254
2273
|
t,
|
|
2255
2274
|
{
|
|
2256
2275
|
dataType: "number",
|
|
@@ -2258,7 +2277,7 @@ function lr(t, r, n) {
|
|
|
2258
2277
|
editable: t.editable !== void 0 ? t.editable : !0,
|
|
2259
2278
|
enumValues: t.enumValues ?? []
|
|
2260
2279
|
}
|
|
2261
|
-
) : r === "multi_number_select" ? i =
|
|
2280
|
+
) : r === "multi_number_select" ? i = G(
|
|
2262
2281
|
t,
|
|
2263
2282
|
{
|
|
2264
2283
|
dataType: "array",
|
|
@@ -2269,7 +2288,7 @@ function lr(t, r, n) {
|
|
|
2269
2288
|
enumValues: t.of?.enumValues ?? []
|
|
2270
2289
|
}
|
|
2271
2290
|
}
|
|
2272
|
-
) : r === "file_upload" ? i =
|
|
2291
|
+
) : r === "file_upload" ? i = G(
|
|
2273
2292
|
t,
|
|
2274
2293
|
{
|
|
2275
2294
|
dataType: "string",
|
|
@@ -2279,7 +2298,7 @@ function lr(t, r, n) {
|
|
|
2279
2298
|
storagePath: "/"
|
|
2280
2299
|
}
|
|
2281
2300
|
}
|
|
2282
|
-
) : r === "multi_file_upload" ? i =
|
|
2301
|
+
) : r === "multi_file_upload" ? i = G(
|
|
2283
2302
|
t,
|
|
2284
2303
|
{
|
|
2285
2304
|
dataType: "array",
|
|
@@ -2292,7 +2311,7 @@ function lr(t, r, n) {
|
|
|
2292
2311
|
}
|
|
2293
2312
|
}
|
|
2294
2313
|
}
|
|
2295
|
-
) : r === "group" ? i =
|
|
2314
|
+
) : r === "group" ? i = G(
|
|
2296
2315
|
t,
|
|
2297
2316
|
{
|
|
2298
2317
|
dataType: "map",
|
|
@@ -2301,7 +2320,7 @@ function lr(t, r, n) {
|
|
|
2301
2320
|
keyValue: !1,
|
|
2302
2321
|
properties: t.properties ?? {}
|
|
2303
2322
|
}
|
|
2304
|
-
) : r === "key_value" ? i =
|
|
2323
|
+
) : r === "key_value" ? i = G(
|
|
2305
2324
|
t,
|
|
2306
2325
|
{
|
|
2307
2326
|
dataType: "map",
|
|
@@ -2310,14 +2329,14 @@ function lr(t, r, n) {
|
|
|
2310
2329
|
keyValue: !0,
|
|
2311
2330
|
properties: void 0
|
|
2312
2331
|
}
|
|
2313
|
-
) : r === "reference" ? i =
|
|
2332
|
+
) : r === "reference" ? i = G(
|
|
2314
2333
|
t,
|
|
2315
2334
|
{
|
|
2316
2335
|
dataType: "reference",
|
|
2317
2336
|
propertyConfig: "reference",
|
|
2318
2337
|
editable: t.editable !== void 0 ? t.editable : !0
|
|
2319
2338
|
}
|
|
2320
|
-
) : r === "multi_references" ? i =
|
|
2339
|
+
) : r === "multi_references" ? i = G(
|
|
2321
2340
|
t,
|
|
2322
2341
|
{
|
|
2323
2342
|
dataType: "array",
|
|
@@ -2327,14 +2346,14 @@ function lr(t, r, n) {
|
|
|
2327
2346
|
dataType: "reference"
|
|
2328
2347
|
}
|
|
2329
2348
|
}
|
|
2330
|
-
) : r === "switch" ? i =
|
|
2349
|
+
) : r === "switch" ? i = G(
|
|
2331
2350
|
t,
|
|
2332
2351
|
{
|
|
2333
2352
|
dataType: "boolean",
|
|
2334
2353
|
propertyConfig: "switch",
|
|
2335
2354
|
editable: t.editable !== void 0 ? t.editable : !0
|
|
2336
2355
|
}
|
|
2337
|
-
) : r === "date_time" ? i =
|
|
2356
|
+
) : r === "date_time" ? i = G(
|
|
2338
2357
|
t,
|
|
2339
2358
|
{
|
|
2340
2359
|
dataType: "date",
|
|
@@ -2342,14 +2361,14 @@ function lr(t, r, n) {
|
|
|
2342
2361
|
editable: t.editable !== void 0 ? t.editable : !0,
|
|
2343
2362
|
mode: "date_time"
|
|
2344
2363
|
}
|
|
2345
|
-
) : r === "repeat" ? i =
|
|
2364
|
+
) : r === "repeat" ? i = G(
|
|
2346
2365
|
t,
|
|
2347
2366
|
{
|
|
2348
2367
|
dataType: "array",
|
|
2349
2368
|
propertyConfig: "repeat",
|
|
2350
2369
|
editable: t.editable !== void 0 ? t.editable : !0
|
|
2351
2370
|
}
|
|
2352
|
-
) : r === "block" ? i =
|
|
2371
|
+
) : r === "block" ? i = G(
|
|
2353
2372
|
t,
|
|
2354
2373
|
{
|
|
2355
2374
|
dataType: "array",
|
|
@@ -2364,9 +2383,9 @@ function lr(t, r, n) {
|
|
|
2364
2383
|
propertyConfig: r
|
|
2365
2384
|
}), i;
|
|
2366
2385
|
}
|
|
2367
|
-
function
|
|
2386
|
+
function lr({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
2368
2387
|
return /* @__PURE__ */ e(
|
|
2369
|
-
|
|
2388
|
+
X,
|
|
2370
2389
|
{
|
|
2371
2390
|
value: t,
|
|
2372
2391
|
disabled: r,
|
|
@@ -2374,12 +2393,12 @@ function sr({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
|
2374
2393
|
children: /* @__PURE__ */ a(
|
|
2375
2394
|
"div",
|
|
2376
2395
|
{
|
|
2377
|
-
className:
|
|
2396
|
+
className: he(
|
|
2378
2397
|
"flex flex-row items-center text-base min-h-[52px]",
|
|
2379
2398
|
r ? "w-full" : ""
|
|
2380
2399
|
),
|
|
2381
2400
|
children: [
|
|
2382
|
-
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(
|
|
2401
|
+
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(qe, { propertyConfig: n }) }),
|
|
2383
2402
|
/* @__PURE__ */ a("div", { children: [
|
|
2384
2403
|
/* @__PURE__ */ e("div", { children: n.name }),
|
|
2385
2404
|
/* @__PURE__ */ e(
|
|
@@ -2402,10 +2421,10 @@ function Ri({
|
|
|
2402
2421
|
disabled: t,
|
|
2403
2422
|
showErrors: r
|
|
2404
2423
|
}) {
|
|
2405
|
-
const { values: n, setFieldValue: i } =
|
|
2424
|
+
const { values: n, setFieldValue: i } = Y(), l = I(n, "url");
|
|
2406
2425
|
return /* @__PURE__ */ a(R, { children: [
|
|
2407
2426
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
2408
|
-
|
|
2427
|
+
be,
|
|
2409
2428
|
{
|
|
2410
2429
|
disabled: t,
|
|
2411
2430
|
position: "item-aligned",
|
|
@@ -2427,15 +2446,15 @@ function Ri({
|
|
|
2427
2446
|
},
|
|
2428
2447
|
value: l ?? "[NONE]",
|
|
2429
2448
|
children: [
|
|
2430
|
-
/* @__PURE__ */ e(
|
|
2431
|
-
/* @__PURE__ */ e(
|
|
2432
|
-
/* @__PURE__ */ e(
|
|
2433
|
-
/* @__PURE__ */ e(
|
|
2449
|
+
/* @__PURE__ */ e(X, { value: "[NONE]", children: "Display URL" }),
|
|
2450
|
+
/* @__PURE__ */ e(X, { value: "image", children: "Image" }),
|
|
2451
|
+
/* @__PURE__ */ e(X, { value: "video", children: "Video" }),
|
|
2452
|
+
/* @__PURE__ */ e(X, { value: "audio", children: "Audio" })
|
|
2434
2453
|
]
|
|
2435
2454
|
}
|
|
2436
2455
|
) }),
|
|
2437
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2438
|
-
|
|
2456
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(
|
|
2457
|
+
Ee,
|
|
2439
2458
|
{
|
|
2440
2459
|
disabled: t,
|
|
2441
2460
|
max: !0,
|
|
@@ -2445,7 +2464,7 @@ function Ri({
|
|
|
2445
2464
|
}
|
|
2446
2465
|
) }) }),
|
|
2447
2466
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2448
|
-
|
|
2467
|
+
we,
|
|
2449
2468
|
{
|
|
2450
2469
|
name: "defaultValue",
|
|
2451
2470
|
disabled: t,
|
|
@@ -2479,7 +2498,7 @@ const Ui = [
|
|
|
2479
2498
|
"key_value",
|
|
2480
2499
|
"repeat",
|
|
2481
2500
|
"block"
|
|
2482
|
-
],
|
|
2501
|
+
], sr = Object.entries(Gt).filter(([t]) => Ui.includes(t)).map(([t, r]) => ({ [t]: r })).reduce((t, r) => ({ ...t, ...r }), {}), dr = W.memo(
|
|
2483
2502
|
function(r) {
|
|
2484
2503
|
const {
|
|
2485
2504
|
includeIdAndName: n = !0,
|
|
@@ -2505,64 +2524,64 @@ const Ui = [
|
|
|
2505
2524
|
} = r, O = {
|
|
2506
2525
|
id: "",
|
|
2507
2526
|
name: ""
|
|
2508
|
-
}, N = !!(p && !
|
|
2527
|
+
}, N = !!(p && !Ue(p)) && !C, F = Re(p ? {
|
|
2509
2528
|
id: c,
|
|
2510
2529
|
previousId: c,
|
|
2511
2530
|
property: p
|
|
2512
|
-
} : void 0),
|
|
2513
|
-
id:
|
|
2531
|
+
} : void 0), B = ({
|
|
2532
|
+
id: E,
|
|
2514
2533
|
property: h
|
|
2515
2534
|
}) => {
|
|
2516
|
-
const
|
|
2517
|
-
id:
|
|
2535
|
+
const D = {
|
|
2536
|
+
id: E,
|
|
2518
2537
|
previousId: F.current?.id,
|
|
2519
2538
|
property: h,
|
|
2520
2539
|
namespace: m
|
|
2521
2540
|
};
|
|
2522
|
-
F.current =
|
|
2523
|
-
}, _ =
|
|
2541
|
+
F.current = D, s?.(D);
|
|
2542
|
+
}, _ = kt({
|
|
2524
2543
|
initialValues: p ? { id: c, ...p } : O,
|
|
2525
2544
|
initialErrors: y,
|
|
2526
2545
|
validateOnChange: !0,
|
|
2527
2546
|
validateOnInitialRender: !0,
|
|
2528
|
-
onSubmit: (
|
|
2529
|
-
console.debug("onSubmit",
|
|
2547
|
+
onSubmit: (E, h) => {
|
|
2548
|
+
console.debug("onSubmit", E);
|
|
2530
2549
|
const {
|
|
2531
|
-
id:
|
|
2532
|
-
...
|
|
2533
|
-
} =
|
|
2534
|
-
|
|
2535
|
-
id:
|
|
2536
|
-
property: { ...
|
|
2550
|
+
id: D,
|
|
2551
|
+
...ae
|
|
2552
|
+
} = E;
|
|
2553
|
+
B({
|
|
2554
|
+
id: D,
|
|
2555
|
+
property: { ...ae, editable: ae.editable ?? !0 }
|
|
2537
2556
|
}), l || h.resetForm({ values: O });
|
|
2538
2557
|
},
|
|
2539
|
-
validation: (
|
|
2558
|
+
validation: (E) => {
|
|
2540
2559
|
const h = {};
|
|
2541
2560
|
if (n) {
|
|
2542
|
-
if (!
|
|
2561
|
+
if (!E.name)
|
|
2543
2562
|
h.name = "Required";
|
|
2544
2563
|
else {
|
|
2545
|
-
const
|
|
2546
|
-
|
|
2564
|
+
const D = $i(E.name);
|
|
2565
|
+
D && (h.name = D);
|
|
2547
2566
|
}
|
|
2548
|
-
if (!
|
|
2567
|
+
if (!E.id)
|
|
2549
2568
|
h.id = "Required";
|
|
2550
2569
|
else {
|
|
2551
|
-
const
|
|
2552
|
-
|
|
2570
|
+
const D = Li(E.id, u);
|
|
2571
|
+
D && (h.id = D);
|
|
2553
2572
|
}
|
|
2554
2573
|
}
|
|
2555
|
-
return
|
|
2574
|
+
return E.dataType === "string" && E.validation?.matches && !Pr(E.validation?.matches.toString()) && (h.validation = {
|
|
2556
2575
|
matches: "Invalid regular expression"
|
|
2557
|
-
}),
|
|
2576
|
+
}), E.dataType === "reference" && !E.path && (h.path = "You must specify a target collection for the field"), E.propertyConfig === "repeat" && (E.of || (h.of = "You need to specify a repeat field")), E.propertyConfig === "block" && (E.oneOf || (h.oneOf = "You need to specify the properties of this block")), h;
|
|
2558
2577
|
}
|
|
2559
2578
|
});
|
|
2560
|
-
return
|
|
2579
|
+
return ce(() => {
|
|
2561
2580
|
b?.(_);
|
|
2562
|
-
}, [_, b]), /* @__PURE__ */ e(
|
|
2581
|
+
}, [_, b]), /* @__PURE__ */ e(Ot, { value: _, children: /* @__PURE__ */ e(
|
|
2563
2582
|
ji,
|
|
2564
2583
|
{
|
|
2565
|
-
onPropertyChanged: f ?
|
|
2584
|
+
onPropertyChanged: f ? B : void 0,
|
|
2566
2585
|
onDelete: g,
|
|
2567
2586
|
includeIdAndTitle: n,
|
|
2568
2587
|
propertyNamespace: m,
|
|
@@ -2581,9 +2600,9 @@ const Ui = [
|
|
|
2581
2600
|
}
|
|
2582
2601
|
) });
|
|
2583
2602
|
},
|
|
2584
|
-
(t, r) => t.getData === r.getData && t.propertyKey === r.propertyKey && t.propertyNamespace === r.propertyNamespace && t.includeIdAndName === r.includeIdAndName && t.autoOpenTypeSelect === r.autoOpenTypeSelect && t.autoUpdateId === r.autoUpdateId && t.existingProperty === r.existingProperty
|
|
2603
|
+
(t, r) => t.getData === r.getData && t.propertyKey === r.propertyKey && t.propertyNamespace === r.propertyNamespace && t.includeIdAndName === r.includeIdAndName && t.autoOpenTypeSelect === r.autoOpenTypeSelect && t.autoUpdateId === r.autoUpdateId && t.existingPropertyKeys === r.existingPropertyKeys && t.existingProperty === r.existingProperty
|
|
2585
2604
|
);
|
|
2586
|
-
function
|
|
2605
|
+
function Oe({
|
|
2587
2606
|
open: t,
|
|
2588
2607
|
onCancel: r,
|
|
2589
2608
|
onOkClicked: n,
|
|
@@ -2592,9 +2611,9 @@ function Ve({
|
|
|
2592
2611
|
collectionEditable: o,
|
|
2593
2612
|
...d
|
|
2594
2613
|
}) {
|
|
2595
|
-
const c =
|
|
2614
|
+
const c = Re();
|
|
2596
2615
|
return /* @__PURE__ */ e(
|
|
2597
|
-
|
|
2616
|
+
_e,
|
|
2598
2617
|
{
|
|
2599
2618
|
open: t ?? !1,
|
|
2600
2619
|
maxWidth: "xl",
|
|
@@ -2608,8 +2627,8 @@ function Ve({
|
|
|
2608
2627
|
m.preventDefault(), m.stopPropagation(), c.current?.handleSubmit(m);
|
|
2609
2628
|
},
|
|
2610
2629
|
children: [
|
|
2611
|
-
/* @__PURE__ */ e(
|
|
2612
|
-
|
|
2630
|
+
/* @__PURE__ */ e(Ae, { children: /* @__PURE__ */ e(
|
|
2631
|
+
dr,
|
|
2613
2632
|
{
|
|
2614
2633
|
...d,
|
|
2615
2634
|
onPropertyChanged: (m) => {
|
|
@@ -2623,7 +2642,7 @@ function Ve({
|
|
|
2623
2642
|
getData: l
|
|
2624
2643
|
}
|
|
2625
2644
|
) }),
|
|
2626
|
-
/* @__PURE__ */ a(
|
|
2645
|
+
/* @__PURE__ */ a(De, { children: [
|
|
2627
2646
|
r && /* @__PURE__ */ e(
|
|
2628
2647
|
z,
|
|
2629
2648
|
{
|
|
@@ -2670,25 +2689,25 @@ function ji({
|
|
|
2670
2689
|
propertyConfigs: P,
|
|
2671
2690
|
collectionEditable: v
|
|
2672
2691
|
}) {
|
|
2673
|
-
const [b, T] = j(o), [w, C] = j(!1), [O, N] = j(t?.dataType ? Wt(t) : void 0), F = Object.entries(
|
|
2674
|
-
|
|
2692
|
+
const [b, T] = j(o), [w, C] = j(!1), [O, N] = j(t?.dataType ? Wt(t) : void 0), F = Object.entries(sr).concat(Object.entries(P)), B = g ? F.filter(([Z, H]) => !re(H.property) && H.property?.dataType !== "array") : F, _ = Fr(t), E = Re(null), h = Re(t), D = s && I(r, "selectedWidget");
|
|
2693
|
+
ce(() => {
|
|
2675
2694
|
if (c && (!d || _.id)) {
|
|
2676
2695
|
const {
|
|
2677
2696
|
id: Z,
|
|
2678
2697
|
...H
|
|
2679
2698
|
} = _;
|
|
2680
|
-
|
|
2699
|
+
ve(_, h.current) || (c({
|
|
2681
2700
|
id: Z,
|
|
2682
2701
|
property: H,
|
|
2683
2702
|
namespace: m
|
|
2684
2703
|
}), h.current = _);
|
|
2685
2704
|
}
|
|
2686
|
-
}, [_, d,
|
|
2705
|
+
}, [_, d, m]), ce(() => {
|
|
2687
2706
|
t?.id && p && p(t?.id, m, r);
|
|
2688
|
-
}, [r,
|
|
2689
|
-
const
|
|
2690
|
-
N(Z), n(
|
|
2691
|
-
|
|
2707
|
+
}, [r, m, t?.id]);
|
|
2708
|
+
const ae = (Z) => {
|
|
2709
|
+
N(Z), n(or(t, Z, P)), setTimeout(() => {
|
|
2710
|
+
E.current?.focus();
|
|
2692
2711
|
}, 0);
|
|
2693
2712
|
};
|
|
2694
2713
|
let q;
|
|
@@ -2706,7 +2725,7 @@ function ji({
|
|
|
2706
2725
|
showErrors: s
|
|
2707
2726
|
}
|
|
2708
2727
|
) : O === "select" || O === "number_select" ? q = /* @__PURE__ */ e(
|
|
2709
|
-
|
|
2728
|
+
Rt,
|
|
2710
2729
|
{
|
|
2711
2730
|
multiselect: !1,
|
|
2712
2731
|
allowDataInference: y,
|
|
@@ -2716,7 +2735,7 @@ function ji({
|
|
|
2716
2735
|
showErrors: s
|
|
2717
2736
|
}
|
|
2718
2737
|
) : O === "multi_select" || O === "multi_number_select" ? q = /* @__PURE__ */ e(
|
|
2719
|
-
|
|
2738
|
+
Rt,
|
|
2720
2739
|
{
|
|
2721
2740
|
multiselect: !0,
|
|
2722
2741
|
updateIds: !i,
|
|
@@ -2726,14 +2745,14 @@ function ji({
|
|
|
2726
2745
|
showErrors: s
|
|
2727
2746
|
}
|
|
2728
2747
|
) : O === "file_upload" ? q = /* @__PURE__ */ e(
|
|
2729
|
-
|
|
2748
|
+
Ut,
|
|
2730
2749
|
{
|
|
2731
2750
|
existing: i,
|
|
2732
2751
|
multiple: !1,
|
|
2733
2752
|
disabled: f
|
|
2734
2753
|
}
|
|
2735
2754
|
) : O === "multi_file_upload" ? q = /* @__PURE__ */ e(
|
|
2736
|
-
|
|
2755
|
+
Ut,
|
|
2737
2756
|
{
|
|
2738
2757
|
existing: i,
|
|
2739
2758
|
multiple: !0,
|
|
@@ -2758,7 +2777,7 @@ function ji({
|
|
|
2758
2777
|
propertyConfigs: P
|
|
2759
2778
|
}
|
|
2760
2779
|
) : O === "reference" ? q = /* @__PURE__ */ e(
|
|
2761
|
-
|
|
2780
|
+
jt,
|
|
2762
2781
|
{
|
|
2763
2782
|
showErrors: s,
|
|
2764
2783
|
existing: i,
|
|
@@ -2766,7 +2785,7 @@ function ji({
|
|
|
2766
2785
|
disabled: f
|
|
2767
2786
|
}
|
|
2768
2787
|
) : O === "date_time" ? q = /* @__PURE__ */ e(Bi, { disabled: f }) : O === "multi_references" ? q = /* @__PURE__ */ e(
|
|
2769
|
-
|
|
2788
|
+
jt,
|
|
2770
2789
|
{
|
|
2771
2790
|
showErrors: s,
|
|
2772
2791
|
existing: i,
|
|
@@ -2796,9 +2815,9 @@ function ji({
|
|
|
2796
2815
|
/* @__PURE__ */ a("div", { className: "flex mt-2 justify-between", children: [
|
|
2797
2816
|
/* @__PURE__ */ a("div", { className: "w-full flex flex-col gap-2", children: [
|
|
2798
2817
|
/* @__PURE__ */ e(
|
|
2799
|
-
|
|
2818
|
+
be,
|
|
2800
2819
|
{
|
|
2801
|
-
error: !!
|
|
2820
|
+
error: !!D,
|
|
2802
2821
|
value: O ?? "",
|
|
2803
2822
|
placeholder: "Select a property widget",
|
|
2804
2823
|
open: b,
|
|
@@ -2808,27 +2827,27 @@ function ji({
|
|
|
2808
2827
|
renderValue: (Z) => {
|
|
2809
2828
|
if (!Z)
|
|
2810
2829
|
return /* @__PURE__ */ e("em", { children: "Select a property widget" });
|
|
2811
|
-
const H = Z, Q =
|
|
2830
|
+
const H = Z, Q = Gt[H] ?? P[H], le = Q.property, Be = le && !re(le) ? je(le, P) : void 0, Pe = re(le) || i && le.dataType !== t?.dataType, se = Be ? G(Be, Q) : Q;
|
|
2812
2831
|
return /* @__PURE__ */ a(
|
|
2813
2832
|
"div",
|
|
2814
2833
|
{
|
|
2815
|
-
onClick: (
|
|
2816
|
-
|
|
2834
|
+
onClick: (te) => {
|
|
2835
|
+
Pe && (te.stopPropagation(), te.preventDefault());
|
|
2817
2836
|
},
|
|
2818
|
-
className:
|
|
2837
|
+
className: he(
|
|
2819
2838
|
"flex items-center",
|
|
2820
|
-
|
|
2839
|
+
Pe ? "w-full pointer-events-none opacity-50" : ""
|
|
2821
2840
|
),
|
|
2822
2841
|
children: [
|
|
2823
|
-
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(
|
|
2842
|
+
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(qe, { propertyConfig: se }) }),
|
|
2824
2843
|
/* @__PURE__ */ a("div", { className: "flex flex-col items-start text-base text-left", children: [
|
|
2825
|
-
/* @__PURE__ */ e("div", { children:
|
|
2844
|
+
/* @__PURE__ */ e("div", { children: se.name }),
|
|
2826
2845
|
/* @__PURE__ */ e(
|
|
2827
2846
|
V,
|
|
2828
2847
|
{
|
|
2829
2848
|
variant: "caption",
|
|
2830
2849
|
color: "disabled",
|
|
2831
|
-
children:
|
|
2850
|
+
children: Pe ? "You can only switch to widgets that use the same data type" : se.description
|
|
2832
2851
|
}
|
|
2833
2852
|
)
|
|
2834
2853
|
] })
|
|
@@ -2837,15 +2856,15 @@ function ji({
|
|
|
2837
2856
|
);
|
|
2838
2857
|
},
|
|
2839
2858
|
onValueChange: (Z) => {
|
|
2840
|
-
|
|
2859
|
+
ae(Z);
|
|
2841
2860
|
},
|
|
2842
|
-
children:
|
|
2843
|
-
const Q = H.property,
|
|
2861
|
+
children: B.map(([Z, H]) => {
|
|
2862
|
+
const Q = H.property, le = i && !re(Q) && Q.dataType !== t?.dataType;
|
|
2844
2863
|
return /* @__PURE__ */ e(
|
|
2845
|
-
|
|
2864
|
+
lr,
|
|
2846
2865
|
{
|
|
2847
2866
|
value: Z,
|
|
2848
|
-
optionDisabled:
|
|
2867
|
+
optionDisabled: le,
|
|
2849
2868
|
propertyConfig: H,
|
|
2850
2869
|
existing: i
|
|
2851
2870
|
},
|
|
@@ -2854,7 +2873,7 @@ function ji({
|
|
|
2854
2873
|
})
|
|
2855
2874
|
}
|
|
2856
2875
|
),
|
|
2857
|
-
|
|
2876
|
+
D && /* @__PURE__ */ e(
|
|
2858
2877
|
V,
|
|
2859
2878
|
{
|
|
2860
2879
|
variant: "caption",
|
|
@@ -2865,13 +2884,13 @@ function ji({
|
|
|
2865
2884
|
)
|
|
2866
2885
|
] }),
|
|
2867
2886
|
u && t?.id && /* @__PURE__ */ e(
|
|
2868
|
-
|
|
2887
|
+
ne,
|
|
2869
2888
|
{
|
|
2870
2889
|
variant: "ghost",
|
|
2871
2890
|
className: "m-4",
|
|
2872
2891
|
disabled: f,
|
|
2873
2892
|
onClick: () => C(!0),
|
|
2874
|
-
children: /* @__PURE__ */ e(
|
|
2893
|
+
children: /* @__PURE__ */ e(pt, {})
|
|
2875
2894
|
}
|
|
2876
2895
|
)
|
|
2877
2896
|
] }),
|
|
@@ -2884,14 +2903,14 @@ function ji({
|
|
|
2884
2903
|
isNewProperty: !i,
|
|
2885
2904
|
disabled: f,
|
|
2886
2905
|
autoUpdateId: l,
|
|
2887
|
-
ref:
|
|
2906
|
+
ref: E
|
|
2888
2907
|
}
|
|
2889
2908
|
),
|
|
2890
2909
|
q,
|
|
2891
2910
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Mi, { disabled: f }) })
|
|
2892
2911
|
] }),
|
|
2893
2912
|
u && /* @__PURE__ */ e(
|
|
2894
|
-
|
|
2913
|
+
dt,
|
|
2895
2914
|
{
|
|
2896
2915
|
open: w,
|
|
2897
2916
|
onAccept: () => u(t?.id, m),
|
|
@@ -2923,17 +2942,17 @@ function Yi({
|
|
|
2923
2942
|
onOpenChange: r,
|
|
2924
2943
|
open: n
|
|
2925
2944
|
}) {
|
|
2926
|
-
const i =
|
|
2945
|
+
const i = Ve(), l = t ? `import { EntityCollection } from "firecms";
|
|
2927
2946
|
|
|
2928
|
-
const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + si.stringify(
|
|
2947
|
+
const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + si.stringify(cr(t), null, " ") : "No collection selected";
|
|
2929
2948
|
return /* @__PURE__ */ a(
|
|
2930
|
-
|
|
2949
|
+
_e,
|
|
2931
2950
|
{
|
|
2932
2951
|
open: n,
|
|
2933
2952
|
onOpenChange: r,
|
|
2934
2953
|
maxWidth: "4xl",
|
|
2935
2954
|
children: [
|
|
2936
|
-
/* @__PURE__ */ a(
|
|
2955
|
+
/* @__PURE__ */ a(Ae, { children: [
|
|
2937
2956
|
/* @__PURE__ */ a(V, { variant: "h6", className: "my-4", children: [
|
|
2938
2957
|
"Code for ",
|
|
2939
2958
|
t.name
|
|
@@ -2966,7 +2985,7 @@ const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + si.
|
|
|
2966
2985
|
}
|
|
2967
2986
|
)
|
|
2968
2987
|
] }),
|
|
2969
|
-
/* @__PURE__ */ a(
|
|
2988
|
+
/* @__PURE__ */ a(De, { children: [
|
|
2970
2989
|
/* @__PURE__ */ a(
|
|
2971
2990
|
z,
|
|
2972
2991
|
{
|
|
@@ -2988,7 +3007,7 @@ const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + si.
|
|
|
2988
3007
|
}
|
|
2989
3008
|
);
|
|
2990
3009
|
}
|
|
2991
|
-
function
|
|
3010
|
+
function cr(t) {
|
|
2992
3011
|
const r = (n) => {
|
|
2993
3012
|
const i = {
|
|
2994
3013
|
...n
|
|
@@ -3014,7 +3033,7 @@ function ur(t) {
|
|
|
3014
3033
|
properties: Object.entries(t.properties ?? {}).map(([n, i]) => ({
|
|
3015
3034
|
[n]: r(i)
|
|
3016
3035
|
})).reduce((n, i) => ({ ...n, ...i }), {}),
|
|
3017
|
-
subcollections: (t.subcollections ?? []).map(
|
|
3036
|
+
subcollections: (t.subcollections ?? []).map(cr)
|
|
3018
3037
|
};
|
|
3019
3038
|
}
|
|
3020
3039
|
function Gi({
|
|
@@ -3038,13 +3057,13 @@ function Gi({
|
|
|
3038
3057
|
setFieldTouched: y,
|
|
3039
3058
|
errors: P,
|
|
3040
3059
|
dirty: v
|
|
3041
|
-
} =
|
|
3042
|
-
|
|
3060
|
+
} = Y(), b = Ve(), T = xr(), w = !T, [C, O] = j(), [N, F] = j(), [B, _] = j(), E = N ? ie(N, B) : void 0, h = E ? I(f.properties, E.replaceAll(".", ".properties.")) : void 0, [D, ae] = j(!1), [q, Z] = j(!1), [H, Q] = j(!1), [le, Be] = j([]), Pe = W.useRef(f.propertiesOrder ? { "": f.propertiesOrder } : {});
|
|
3061
|
+
ce(() => {
|
|
3043
3062
|
l && l(v);
|
|
3044
3063
|
}, [v]);
|
|
3045
|
-
const
|
|
3064
|
+
const se = m ? () => {
|
|
3046
3065
|
m && (Z(!0), m(f).then((A) => {
|
|
3047
|
-
if (A &&
|
|
3066
|
+
if (A && Le(A.properties), !A) {
|
|
3048
3067
|
b.open({
|
|
3049
3068
|
type: "error",
|
|
3050
3069
|
message: "Could not infer properties from data"
|
|
@@ -3062,27 +3081,27 @@ function Gi({
|
|
|
3062
3081
|
const k = {
|
|
3063
3082
|
...U.reduce((M, L) => (M[L] = (A.properties ?? {})[L], M), {}),
|
|
3064
3083
|
...f.properties
|
|
3065
|
-
},
|
|
3084
|
+
}, S = [
|
|
3066
3085
|
...U,
|
|
3067
3086
|
...f.propertiesOrder ?? []
|
|
3068
3087
|
];
|
|
3069
|
-
g("properties", k, !1),
|
|
3088
|
+
g("properties", k, !1), xe(S), Be(U);
|
|
3070
3089
|
}).finally(() => {
|
|
3071
3090
|
Z(!1);
|
|
3072
3091
|
}));
|
|
3073
|
-
} : void 0,
|
|
3074
|
-
const k =
|
|
3075
|
-
g(k, A, !1),
|
|
3076
|
-
},
|
|
3077
|
-
const k = A ?
|
|
3092
|
+
} : void 0, te = (A) => A ? Pe.current[A] ?? I(f, ye(A)) : Pe.current[""], xe = (A, U) => {
|
|
3093
|
+
const k = ye(U);
|
|
3094
|
+
g(k, A, !1), Pe.current[U ?? ""] = A;
|
|
3095
|
+
}, ke = (A, U) => {
|
|
3096
|
+
const k = A ? ie(A, U) : void 0;
|
|
3078
3097
|
if (!k)
|
|
3079
3098
|
throw Error("collection editor miss config");
|
|
3080
|
-
g(
|
|
3081
|
-
const M =
|
|
3082
|
-
|
|
3083
|
-
},
|
|
3084
|
-
g(
|
|
3085
|
-
},
|
|
3099
|
+
g(me(k), void 0, !1);
|
|
3100
|
+
const M = te(U).filter((L) => L !== A);
|
|
3101
|
+
xe(M, U), Q(!1), O(void 0), F(void 0), _(void 0);
|
|
3102
|
+
}, Ye = (A, U) => {
|
|
3103
|
+
g(ye(U), A, !1);
|
|
3104
|
+
}, gt = ({
|
|
3086
3105
|
id: A,
|
|
3087
3106
|
property: U
|
|
3088
3107
|
}) => {
|
|
@@ -3093,54 +3112,54 @@ function Gi({
|
|
|
3093
3112
|
[A]: U
|
|
3094
3113
|
}, !1);
|
|
3095
3114
|
const k = [...f.propertiesOrder ?? Object.keys(f.properties), A];
|
|
3096
|
-
|
|
3097
|
-
},
|
|
3115
|
+
xe(k), Q(!1), T && (O(k.indexOf(A)), F(A)), _(void 0);
|
|
3116
|
+
}, ue = ({
|
|
3098
3117
|
id: A,
|
|
3099
3118
|
property: U,
|
|
3100
3119
|
previousId: k,
|
|
3101
|
-
namespace:
|
|
3120
|
+
namespace: S
|
|
3102
3121
|
}) => {
|
|
3103
|
-
const M = A ?
|
|
3122
|
+
const M = A ? ie(A, S) : void 0, L = M ? me(M) : void 0;
|
|
3104
3123
|
if (k && k !== A) {
|
|
3105
3124
|
console.debug("onPropertyChanged, id change", {
|
|
3106
3125
|
id: A,
|
|
3107
3126
|
property: U,
|
|
3108
3127
|
previousId: k,
|
|
3109
|
-
namespace:
|
|
3128
|
+
namespace: S
|
|
3110
3129
|
});
|
|
3111
|
-
const
|
|
3112
|
-
|
|
3130
|
+
const ge = ie(k, S), Xe = me(ge), It = te(S).map((tt) => tt === k ? A : tt).filter((tt) => tt !== void 0);
|
|
3131
|
+
xe(It, S), A && (O(It.indexOf(A)), F(A)), g(Xe, void 0, !1), y(Xe, !1, !1);
|
|
3113
3132
|
}
|
|
3114
3133
|
console.debug("onPropertyChanged", {
|
|
3115
3134
|
id: A,
|
|
3116
3135
|
property: U,
|
|
3117
3136
|
previousId: k,
|
|
3118
|
-
namespace:
|
|
3137
|
+
namespace: S,
|
|
3119
3138
|
propertyPath: L
|
|
3120
3139
|
}), L && (g(L, U, !1), y(L, !0, !1));
|
|
3121
|
-
},
|
|
3122
|
-
const
|
|
3140
|
+
}, Ge = (A, U, k) => {
|
|
3141
|
+
const S = A ? ie(A, U) : void 0;
|
|
3123
3142
|
if (console.debug("onPropertyErrorInternal", {
|
|
3124
3143
|
id: A,
|
|
3125
3144
|
namespace: U,
|
|
3126
3145
|
error: k,
|
|
3127
|
-
propertyPath:
|
|
3128
|
-
}),
|
|
3146
|
+
propertyPath: S
|
|
3147
|
+
}), S) {
|
|
3129
3148
|
const M = k && Object.keys(k).length > 0;
|
|
3130
|
-
i(A, U, M ? k : void 0), x(
|
|
3149
|
+
i(A, U, M ? k : void 0), x(me(S), M ? "Property error" : void 0);
|
|
3131
3150
|
}
|
|
3132
|
-
},
|
|
3151
|
+
}, We = () => {
|
|
3133
3152
|
O(void 0), F(void 0);
|
|
3134
|
-
},
|
|
3153
|
+
}, Ke = N && n?.current?.properties ? n.current.properties[N] : void 0, Ze = f?.propertiesOrder === void 0 || f.propertiesOrder.length === 0, Je = f.propertiesOrder ? f.propertiesOrder : Object.keys(f.properties), Qe = Zt(() => f.ownerId && c ? c(f.ownerId) : null, [c, f.ownerId]), vt = (A, U) => {
|
|
3135
3154
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
3136
3155
|
propertyKey: A,
|
|
3137
3156
|
namespace: U
|
|
3138
|
-
}), O(
|
|
3139
|
-
},
|
|
3140
|
-
/* @__PURE__ */ a("div", { className:
|
|
3157
|
+
}), O(Je.indexOf(A)), F(A), _(U);
|
|
3158
|
+
}, yt = /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3159
|
+
/* @__PURE__ */ a("div", { className: he(
|
|
3141
3160
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
3142
3161
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
3143
|
-
!w && "border-r " +
|
|
3162
|
+
!w && "border-r " + Tt
|
|
3144
3163
|
), children: [
|
|
3145
3164
|
/* @__PURE__ */ a("div", { className: "flex my-2", children: [
|
|
3146
3165
|
/* @__PURE__ */ a("div", { className: "flex-grow mb-4", children: [
|
|
@@ -3148,7 +3167,7 @@ function Gi({
|
|
|
3148
3167
|
$,
|
|
3149
3168
|
{
|
|
3150
3169
|
name: "name",
|
|
3151
|
-
as:
|
|
3170
|
+
as: K,
|
|
3152
3171
|
invisible: !0,
|
|
3153
3172
|
className: "-ml-1",
|
|
3154
3173
|
inputClassName: "text-2xl font-headers",
|
|
@@ -3158,7 +3177,7 @@ function Gi({
|
|
|
3158
3177
|
error: !!P?.name
|
|
3159
3178
|
}
|
|
3160
3179
|
),
|
|
3161
|
-
|
|
3180
|
+
Qe && /* @__PURE__ */ a(
|
|
3162
3181
|
V,
|
|
3163
3182
|
{
|
|
3164
3183
|
variant: "body2",
|
|
@@ -3166,52 +3185,52 @@ function Gi({
|
|
|
3166
3185
|
color: "secondary",
|
|
3167
3186
|
children: [
|
|
3168
3187
|
"Created by ",
|
|
3169
|
-
|
|
3188
|
+
Qe.displayName
|
|
3170
3189
|
]
|
|
3171
3190
|
}
|
|
3172
3191
|
)
|
|
3173
3192
|
] }),
|
|
3174
3193
|
d && /* @__PURE__ */ e("div", { className: "ml-4", children: d }),
|
|
3175
3194
|
/* @__PURE__ */ a("div", { className: "ml-1 mt-2 flex flex-row gap-2", children: [
|
|
3176
|
-
/* @__PURE__ */ e(
|
|
3177
|
-
|
|
3195
|
+
/* @__PURE__ */ e(ee, { title: "Get the code for this collection", children: /* @__PURE__ */ e(
|
|
3196
|
+
ne,
|
|
3178
3197
|
{
|
|
3179
3198
|
variant: "filled",
|
|
3180
3199
|
disabled: q,
|
|
3181
|
-
onClick: () =>
|
|
3200
|
+
onClick: () => ae(!0),
|
|
3182
3201
|
children: /* @__PURE__ */ e(Gr, {})
|
|
3183
3202
|
}
|
|
3184
3203
|
) }),
|
|
3185
|
-
|
|
3186
|
-
|
|
3204
|
+
se && /* @__PURE__ */ e(ee, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
|
|
3205
|
+
ne,
|
|
3187
3206
|
{
|
|
3188
3207
|
variant: "filled",
|
|
3189
3208
|
disabled: q,
|
|
3190
|
-
onClick:
|
|
3191
|
-
children: q ? /* @__PURE__ */ e(
|
|
3209
|
+
onClick: se,
|
|
3210
|
+
children: q ? /* @__PURE__ */ e(He, { size: "small" }) : /* @__PURE__ */ e(ht, {})
|
|
3192
3211
|
}
|
|
3193
3212
|
) }),
|
|
3194
|
-
/* @__PURE__ */ e(
|
|
3213
|
+
/* @__PURE__ */ e(ee, { title: "Add new property", children: /* @__PURE__ */ e(
|
|
3195
3214
|
z,
|
|
3196
3215
|
{
|
|
3197
3216
|
variant: "outlined",
|
|
3198
3217
|
onClick: () => Q(!0),
|
|
3199
|
-
children: /* @__PURE__ */ e(
|
|
3218
|
+
children: /* @__PURE__ */ e(de, {})
|
|
3200
3219
|
}
|
|
3201
3220
|
) })
|
|
3202
3221
|
] })
|
|
3203
3222
|
] }),
|
|
3204
|
-
/* @__PURE__ */ e(
|
|
3205
|
-
|
|
3223
|
+
/* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
|
|
3224
|
+
ft,
|
|
3206
3225
|
{
|
|
3207
3226
|
className: "pl-8",
|
|
3208
|
-
inferredPropertyKeys:
|
|
3209
|
-
selectedPropertyKey: N ?
|
|
3227
|
+
inferredPropertyKeys: le,
|
|
3228
|
+
selectedPropertyKey: N ? ie(N, B) : void 0,
|
|
3210
3229
|
properties: f.properties,
|
|
3211
3230
|
additionalFields: f.additionalFields,
|
|
3212
|
-
propertiesOrder:
|
|
3213
|
-
onPropertyClick:
|
|
3214
|
-
onPropertyMove:
|
|
3231
|
+
propertiesOrder: Je,
|
|
3232
|
+
onPropertyClick: vt,
|
|
3233
|
+
onPropertyMove: Ye,
|
|
3215
3234
|
onPropertyRemove: r ? ke : void 0,
|
|
3216
3235
|
collectionEditable: s,
|
|
3217
3236
|
errors: P
|
|
@@ -3225,18 +3244,18 @@ function Gi({
|
|
|
3225
3244
|
variant: "outlined",
|
|
3226
3245
|
size: "large",
|
|
3227
3246
|
onClick: () => Q(!0),
|
|
3228
|
-
startIcon: /* @__PURE__ */ e(
|
|
3247
|
+
startIcon: /* @__PURE__ */ e(de, {}),
|
|
3229
3248
|
children: "Add new property"
|
|
3230
3249
|
}
|
|
3231
3250
|
)
|
|
3232
3251
|
] }),
|
|
3233
3252
|
!w && /* @__PURE__ */ e("div", { className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ a(
|
|
3234
|
-
|
|
3253
|
+
fe,
|
|
3235
3254
|
{
|
|
3236
3255
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
3237
3256
|
children: [
|
|
3238
|
-
|
|
3239
|
-
|
|
3257
|
+
E && h && !re(h) && /* @__PURE__ */ e(
|
|
3258
|
+
dr,
|
|
3240
3259
|
{
|
|
3241
3260
|
inArray: !1,
|
|
3242
3261
|
existingProperty: !r,
|
|
@@ -3244,13 +3263,13 @@ function Gi({
|
|
|
3244
3263
|
allowDataInference: !r,
|
|
3245
3264
|
autoOpenTypeSelect: !1,
|
|
3246
3265
|
propertyKey: N,
|
|
3247
|
-
propertyNamespace:
|
|
3266
|
+
propertyNamespace: B,
|
|
3248
3267
|
property: h,
|
|
3249
|
-
onPropertyChanged:
|
|
3268
|
+
onPropertyChanged: ue,
|
|
3250
3269
|
onDelete: ke,
|
|
3251
|
-
onError:
|
|
3270
|
+
onError: Ge,
|
|
3252
3271
|
forceShowErrors: t,
|
|
3253
|
-
initialErrors:
|
|
3272
|
+
initialErrors: Ke,
|
|
3254
3273
|
getData: u,
|
|
3255
3274
|
propertyConfigs: p,
|
|
3256
3275
|
collectionEditable: s
|
|
@@ -3258,25 +3277,25 @@ function Gi({
|
|
|
3258
3277
|
`edit_view_${C}`
|
|
3259
3278
|
),
|
|
3260
3279
|
!h && /* @__PURE__ */ a("div", { className: "w-full flex flex-col items-center justify-center h-full gap-4", children: [
|
|
3261
|
-
/* @__PURE__ */ e(V, { variant: "label", className: "", children:
|
|
3280
|
+
/* @__PURE__ */ e(V, { variant: "label", className: "", children: Ze ? "Now you can add your first property" : "Select a property to edit it" }),
|
|
3262
3281
|
/* @__PURE__ */ a(
|
|
3263
3282
|
z,
|
|
3264
3283
|
{
|
|
3265
3284
|
variant: "outlined",
|
|
3266
3285
|
onClick: () => Q(!0),
|
|
3267
3286
|
children: [
|
|
3268
|
-
/* @__PURE__ */ e(
|
|
3287
|
+
/* @__PURE__ */ e(de, {}),
|
|
3269
3288
|
"Add new property"
|
|
3270
3289
|
]
|
|
3271
3290
|
}
|
|
3272
3291
|
)
|
|
3273
3292
|
] }),
|
|
3274
|
-
h &&
|
|
3293
|
+
h && re(h) && /* @__PURE__ */ e(V, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
|
|
3275
3294
|
]
|
|
3276
3295
|
}
|
|
3277
3296
|
) }),
|
|
3278
3297
|
w && /* @__PURE__ */ e(
|
|
3279
|
-
|
|
3298
|
+
Oe,
|
|
3280
3299
|
{
|
|
3281
3300
|
inArray: !1,
|
|
3282
3301
|
open: C !== void 0,
|
|
@@ -3285,25 +3304,25 @@ function Gi({
|
|
|
3285
3304
|
existingProperty: !0,
|
|
3286
3305
|
autoOpenTypeSelect: !1,
|
|
3287
3306
|
propertyKey: N,
|
|
3288
|
-
propertyNamespace:
|
|
3307
|
+
propertyNamespace: B,
|
|
3289
3308
|
property: h,
|
|
3290
|
-
onPropertyChanged:
|
|
3309
|
+
onPropertyChanged: ue,
|
|
3291
3310
|
onDelete: ke,
|
|
3292
|
-
onError:
|
|
3311
|
+
onError: Ge,
|
|
3293
3312
|
forceShowErrors: t,
|
|
3294
|
-
initialErrors:
|
|
3313
|
+
initialErrors: Ke,
|
|
3295
3314
|
getData: u,
|
|
3296
3315
|
propertyConfigs: p,
|
|
3297
3316
|
collectionEditable: s,
|
|
3298
|
-
onOkClicked: w ?
|
|
3317
|
+
onOkClicked: w ? We : void 0
|
|
3299
3318
|
},
|
|
3300
3319
|
`edit_view_${C}`
|
|
3301
3320
|
)
|
|
3302
3321
|
] });
|
|
3303
3322
|
return /* @__PURE__ */ a(R, { children: [
|
|
3304
|
-
|
|
3323
|
+
yt,
|
|
3305
3324
|
/* @__PURE__ */ e(
|
|
3306
|
-
|
|
3325
|
+
Oe,
|
|
3307
3326
|
{
|
|
3308
3327
|
inArray: !1,
|
|
3309
3328
|
existingProperty: !1,
|
|
@@ -3312,7 +3331,7 @@ function Gi({
|
|
|
3312
3331
|
forceShowErrors: t,
|
|
3313
3332
|
open: H,
|
|
3314
3333
|
onCancel: () => Q(!1),
|
|
3315
|
-
onPropertyChanged:
|
|
3334
|
+
onPropertyChanged: gt,
|
|
3316
3335
|
getData: u,
|
|
3317
3336
|
allowDataInference: !r,
|
|
3318
3337
|
propertyConfigs: p,
|
|
@@ -3320,17 +3339,17 @@ function Gi({
|
|
|
3320
3339
|
existingPropertyKeys: f.propertiesOrder
|
|
3321
3340
|
}
|
|
3322
3341
|
),
|
|
3323
|
-
/* @__PURE__ */ e(
|
|
3342
|
+
/* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(
|
|
3324
3343
|
Yi,
|
|
3325
3344
|
{
|
|
3326
3345
|
collection: f,
|
|
3327
|
-
open:
|
|
3328
|
-
onOpenChange:
|
|
3346
|
+
open: D,
|
|
3347
|
+
onOpenChange: ae
|
|
3329
3348
|
}
|
|
3330
3349
|
) })
|
|
3331
3350
|
] });
|
|
3332
3351
|
}
|
|
3333
|
-
function
|
|
3352
|
+
function Wi({
|
|
3334
3353
|
open: t,
|
|
3335
3354
|
handleOk: r,
|
|
3336
3355
|
handleCancel: n,
|
|
@@ -3338,19 +3357,19 @@ function Ki({
|
|
|
3338
3357
|
title: l
|
|
3339
3358
|
}) {
|
|
3340
3359
|
return /* @__PURE__ */ a(
|
|
3341
|
-
|
|
3360
|
+
_e,
|
|
3342
3361
|
{
|
|
3343
3362
|
open: t,
|
|
3344
3363
|
onOpenChange: (o) => o ? n() : r(),
|
|
3345
3364
|
"aria-labelledby": "alert-dialog-title",
|
|
3346
3365
|
"aria-describedby": "alert-dialog-description",
|
|
3347
3366
|
children: [
|
|
3348
|
-
/* @__PURE__ */ a(
|
|
3367
|
+
/* @__PURE__ */ a(Ae, { children: [
|
|
3349
3368
|
/* @__PURE__ */ e(V, { variant: "h6", children: l ?? "Unsaved changes" }),
|
|
3350
3369
|
i && /* @__PURE__ */ e(V, { children: i }),
|
|
3351
3370
|
/* @__PURE__ */ e(V, { children: "Are you sure?" })
|
|
3352
3371
|
] }),
|
|
3353
|
-
/* @__PURE__ */ a(
|
|
3372
|
+
/* @__PURE__ */ a(De, { children: [
|
|
3354
3373
|
/* @__PURE__ */ e(z, { variant: "text", onClick: n, autoFocus: !0, children: " Cancel " }),
|
|
3355
3374
|
/* @__PURE__ */ e(z, { onClick: r, children: " Ok " })
|
|
3356
3375
|
] })
|
|
@@ -3358,17 +3377,17 @@ function Ki({
|
|
|
3358
3377
|
}
|
|
3359
3378
|
);
|
|
3360
3379
|
}
|
|
3361
|
-
function
|
|
3380
|
+
function Ki({ open: t, onClose: r }) {
|
|
3362
3381
|
const {
|
|
3363
3382
|
entityViews: n
|
|
3364
|
-
} =
|
|
3383
|
+
} = Se();
|
|
3365
3384
|
return /* @__PURE__ */ a(
|
|
3366
|
-
|
|
3385
|
+
_e,
|
|
3367
3386
|
{
|
|
3368
3387
|
maxWidth: "md",
|
|
3369
3388
|
open: t,
|
|
3370
3389
|
children: [
|
|
3371
|
-
/* @__PURE__ */ a(
|
|
3390
|
+
/* @__PURE__ */ a(Ae, { className: "flex flex-col gap-4", children: [
|
|
3372
3391
|
/* @__PURE__ */ e(V, { variant: "h6", children: "Select view" }),
|
|
3373
3392
|
n?.map((i) => /* @__PURE__ */ a(
|
|
3374
3393
|
z,
|
|
@@ -3387,7 +3406,7 @@ function Wi({ open: t, onClose: r }) {
|
|
|
3387
3406
|
)),
|
|
3388
3407
|
(n ?? []).length === 0 && /* @__PURE__ */ e(V, { variant: "body2", children: "No custom views defined" })
|
|
3389
3408
|
] }),
|
|
3390
|
-
/* @__PURE__ */ e(
|
|
3409
|
+
/* @__PURE__ */ e(De, { children: /* @__PURE__ */ e(z, { variant: "outlined", onClick: () => r(), children: "Cancel" }) })
|
|
3391
3410
|
]
|
|
3392
3411
|
}
|
|
3393
3412
|
);
|
|
@@ -3400,20 +3419,20 @@ function Zi({
|
|
|
3400
3419
|
getUser: l,
|
|
3401
3420
|
parentCollectionIds: o
|
|
3402
3421
|
}) {
|
|
3403
|
-
const { entityViews: d } =
|
|
3422
|
+
const { entityViews: d } = Se(), [c, u] = W.useState(), [m, p] = W.useState(!1), [s, f] = W.useState(), [g, x] = W.useState(), {
|
|
3404
3423
|
values: y,
|
|
3405
3424
|
setFieldValue: P
|
|
3406
|
-
} =
|
|
3425
|
+
} = Y(), v = t.subcollections ?? [], b = y.entityViews?.filter((C) => typeof C == "string").map((C) => wr(C, d)).filter(Boolean) ?? [], T = t.entityViews?.filter((C) => typeof C != "string") ?? [], w = b.length + T.length;
|
|
3407
3426
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3408
|
-
/* @__PURE__ */ e(
|
|
3427
|
+
/* @__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: [
|
|
3409
3428
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3410
3429
|
/* @__PURE__ */ a(V, { variant: "h5", children: [
|
|
3411
3430
|
"Subcollections of ",
|
|
3412
3431
|
y.name
|
|
3413
3432
|
] }),
|
|
3414
|
-
/* @__PURE__ */ a(
|
|
3415
|
-
v && v.length > 0 && /* @__PURE__ */ e(
|
|
3416
|
-
|
|
3433
|
+
/* @__PURE__ */ a(fe, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3434
|
+
v && v.length > 0 && /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(Bt, { children: v.map((C) => /* @__PURE__ */ a(
|
|
3435
|
+
bt,
|
|
3417
3436
|
{
|
|
3418
3437
|
onClick: () => x({
|
|
3419
3438
|
isNewCollection: !1,
|
|
@@ -3421,25 +3440,25 @@ function Zi({
|
|
|
3421
3440
|
}),
|
|
3422
3441
|
children: [
|
|
3423
3442
|
/* @__PURE__ */ e(
|
|
3424
|
-
|
|
3443
|
+
Me,
|
|
3425
3444
|
{
|
|
3426
3445
|
align: "left",
|
|
3427
3446
|
children: /* @__PURE__ */ e(V, { variant: "subtitle2", className: "flex-grow", children: C.name })
|
|
3428
3447
|
}
|
|
3429
3448
|
),
|
|
3430
3449
|
/* @__PURE__ */ e(
|
|
3431
|
-
|
|
3450
|
+
Me,
|
|
3432
3451
|
{
|
|
3433
3452
|
align: "right",
|
|
3434
|
-
children: /* @__PURE__ */ e(
|
|
3435
|
-
|
|
3453
|
+
children: /* @__PURE__ */ e(ee, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3454
|
+
ne,
|
|
3436
3455
|
{
|
|
3437
3456
|
size: "small",
|
|
3438
3457
|
onClick: (O) => {
|
|
3439
3458
|
O.preventDefault(), O.stopPropagation(), u(C.id);
|
|
3440
3459
|
},
|
|
3441
3460
|
color: "inherit",
|
|
3442
|
-
children: /* @__PURE__ */ e(
|
|
3461
|
+
children: /* @__PURE__ */ e(pt, { size: "small" })
|
|
3443
3462
|
}
|
|
3444
3463
|
) })
|
|
3445
3464
|
}
|
|
@@ -3457,7 +3476,7 @@ function Zi({
|
|
|
3457
3476
|
});
|
|
3458
3477
|
},
|
|
3459
3478
|
variant: "text",
|
|
3460
|
-
startIcon: /* @__PURE__ */ e(
|
|
3479
|
+
startIcon: /* @__PURE__ */ e(de, {}),
|
|
3461
3480
|
children: "Add subcollection"
|
|
3462
3481
|
}
|
|
3463
3482
|
)
|
|
@@ -3465,7 +3484,7 @@ function Zi({
|
|
|
3465
3484
|
] }),
|
|
3466
3485
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3467
3486
|
/* @__PURE__ */ e(V, { variant: "h5", children: "Custom views" }),
|
|
3468
|
-
w === 0 && /* @__PURE__ */ e(
|
|
3487
|
+
w === 0 && /* @__PURE__ */ e(Wr, { action: /* @__PURE__ */ e(
|
|
3469
3488
|
z,
|
|
3470
3489
|
{
|
|
3471
3490
|
variant: "text",
|
|
@@ -3477,36 +3496,36 @@ function Zi({
|
|
|
3477
3496
|
children: "More info"
|
|
3478
3497
|
}
|
|
3479
3498
|
), children: "Define your own custom views by uploading them with the CLI." }),
|
|
3480
|
-
/* @__PURE__ */ e(R, { children: /* @__PURE__ */ a(
|
|
3481
|
-
/* @__PURE__ */ e(
|
|
3482
|
-
b.map((C) => /* @__PURE__ */ a(
|
|
3499
|
+
/* @__PURE__ */ e(R, { children: /* @__PURE__ */ a(fe, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3500
|
+
/* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3501
|
+
b.map((C) => /* @__PURE__ */ a(bt, { children: [
|
|
3483
3502
|
/* @__PURE__ */ e(
|
|
3484
|
-
|
|
3503
|
+
Me,
|
|
3485
3504
|
{
|
|
3486
3505
|
align: "left",
|
|
3487
3506
|
children: /* @__PURE__ */ e(V, { variant: "subtitle2", className: "flex-grow", children: C.name })
|
|
3488
3507
|
}
|
|
3489
3508
|
),
|
|
3490
3509
|
/* @__PURE__ */ e(
|
|
3491
|
-
|
|
3510
|
+
Me,
|
|
3492
3511
|
{
|
|
3493
3512
|
align: "right",
|
|
3494
|
-
children: /* @__PURE__ */ e(
|
|
3495
|
-
|
|
3513
|
+
children: /* @__PURE__ */ e(ee, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3514
|
+
ne,
|
|
3496
3515
|
{
|
|
3497
3516
|
size: "small",
|
|
3498
3517
|
onClick: (O) => {
|
|
3499
3518
|
O.preventDefault(), O.stopPropagation(), f(C.key);
|
|
3500
3519
|
},
|
|
3501
3520
|
color: "inherit",
|
|
3502
|
-
children: /* @__PURE__ */ e(
|
|
3521
|
+
children: /* @__PURE__ */ e(pt, { size: "small" })
|
|
3503
3522
|
}
|
|
3504
3523
|
) })
|
|
3505
3524
|
}
|
|
3506
3525
|
)
|
|
3507
3526
|
] }, C.key)),
|
|
3508
|
-
T.map((C) => /* @__PURE__ */ e(
|
|
3509
|
-
|
|
3527
|
+
T.map((C) => /* @__PURE__ */ e(bt, { children: /* @__PURE__ */ a(
|
|
3528
|
+
Me,
|
|
3510
3529
|
{
|
|
3511
3530
|
align: "left",
|
|
3512
3531
|
children: [
|
|
@@ -3526,7 +3545,7 @@ function Zi({
|
|
|
3526
3545
|
p(!0);
|
|
3527
3546
|
},
|
|
3528
3547
|
variant: "text",
|
|
3529
|
-
startIcon: /* @__PURE__ */ e(
|
|
3548
|
+
startIcon: /* @__PURE__ */ e(de, {}),
|
|
3530
3549
|
children: "Add custom entity view"
|
|
3531
3550
|
}
|
|
3532
3551
|
)
|
|
@@ -3535,7 +3554,7 @@ function Zi({
|
|
|
3535
3554
|
] }) }),
|
|
3536
3555
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
3537
3556
|
c && /* @__PURE__ */ e(
|
|
3538
|
-
|
|
3557
|
+
dt,
|
|
3539
3558
|
{
|
|
3540
3559
|
open: !!c,
|
|
3541
3560
|
onAccept: () => {
|
|
@@ -3555,7 +3574,7 @@ function Zi({
|
|
|
3555
3574
|
}
|
|
3556
3575
|
),
|
|
3557
3576
|
s && /* @__PURE__ */ e(
|
|
3558
|
-
|
|
3577
|
+
dt,
|
|
3559
3578
|
{
|
|
3560
3579
|
open: !!s,
|
|
3561
3580
|
onAccept: () => {
|
|
@@ -3571,7 +3590,7 @@ function Zi({
|
|
|
3571
3590
|
}
|
|
3572
3591
|
),
|
|
3573
3592
|
/* @__PURE__ */ e(
|
|
3574
|
-
|
|
3593
|
+
pr,
|
|
3575
3594
|
{
|
|
3576
3595
|
open: !!g,
|
|
3577
3596
|
configController: n,
|
|
@@ -3587,7 +3606,7 @@ function Zi({
|
|
|
3587
3606
|
}
|
|
3588
3607
|
),
|
|
3589
3608
|
/* @__PURE__ */ e(
|
|
3590
|
-
|
|
3609
|
+
Ki,
|
|
3591
3610
|
{
|
|
3592
3611
|
open: m,
|
|
3593
3612
|
onClose: (C) => {
|
|
@@ -3597,14 +3616,14 @@ function Zi({
|
|
|
3597
3616
|
)
|
|
3598
3617
|
] });
|
|
3599
3618
|
}
|
|
3600
|
-
const
|
|
3619
|
+
const qt = {
|
|
3601
3620
|
id: "products",
|
|
3602
3621
|
path: "products",
|
|
3603
3622
|
name: "Products",
|
|
3604
3623
|
singularName: "Product",
|
|
3605
3624
|
icon: "shopping_cart",
|
|
3606
3625
|
description: "List of the products currently sold in your shop",
|
|
3607
|
-
properties:
|
|
3626
|
+
properties: Le({
|
|
3608
3627
|
name: {
|
|
3609
3628
|
dataType: "string",
|
|
3610
3629
|
name: "Name",
|
|
@@ -3682,7 +3701,7 @@ const Lt = {
|
|
|
3682
3701
|
autoValue: "on_create"
|
|
3683
3702
|
}
|
|
3684
3703
|
})
|
|
3685
|
-
},
|
|
3704
|
+
}, Lt = {
|
|
3686
3705
|
id: "blog",
|
|
3687
3706
|
path: "blog",
|
|
3688
3707
|
name: "Blog",
|
|
@@ -3690,7 +3709,7 @@ const Lt = {
|
|
|
3690
3709
|
icon: "article",
|
|
3691
3710
|
description: "A collection of blog entries",
|
|
3692
3711
|
defaultSize: "l",
|
|
3693
|
-
properties:
|
|
3712
|
+
properties: Le({
|
|
3694
3713
|
name: {
|
|
3695
3714
|
name: "Name",
|
|
3696
3715
|
validation: { required: !0 },
|
|
@@ -3794,14 +3813,14 @@ const Lt = {
|
|
|
3794
3813
|
initialFilter: {
|
|
3795
3814
|
status: ["==", "published"]
|
|
3796
3815
|
}
|
|
3797
|
-
},
|
|
3816
|
+
}, $t = {
|
|
3798
3817
|
id: "users",
|
|
3799
3818
|
path: "users",
|
|
3800
3819
|
name: "Users",
|
|
3801
3820
|
singularName: "User",
|
|
3802
3821
|
description: "Registered users in the app/web",
|
|
3803
3822
|
icon: "person",
|
|
3804
|
-
properties:
|
|
3823
|
+
properties: Le({
|
|
3805
3824
|
displayName: {
|
|
3806
3825
|
name: "Display name",
|
|
3807
3826
|
dataType: "string"
|
|
@@ -3833,7 +3852,7 @@ const Lt = {
|
|
|
3833
3852
|
url: "image"
|
|
3834
3853
|
}
|
|
3835
3854
|
})
|
|
3836
|
-
},
|
|
3855
|
+
}, Ht = {
|
|
3837
3856
|
id: "pages",
|
|
3838
3857
|
path: "pages",
|
|
3839
3858
|
name: "Pages",
|
|
@@ -4027,7 +4046,7 @@ function Ji({
|
|
|
4027
4046
|
existingCollectionPaths: l
|
|
4028
4047
|
}) {
|
|
4029
4048
|
const [o, d] = j(!1), [c, u] = j();
|
|
4030
|
-
|
|
4049
|
+
ce(() => {
|
|
4031
4050
|
r && l && (d(!0), r(t).then((g) => {
|
|
4032
4051
|
const x = g.filter((y) => !(l ?? []).find((P) => P.trim().toLowerCase() === y.trim().toLowerCase()));
|
|
4033
4052
|
u(x);
|
|
@@ -4038,8 +4057,8 @@ function Ji({
|
|
|
4038
4057
|
setFieldValue: p,
|
|
4039
4058
|
setValues: s,
|
|
4040
4059
|
submitCount: f
|
|
4041
|
-
} =
|
|
4042
|
-
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ a(
|
|
4060
|
+
} = Y();
|
|
4061
|
+
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: [
|
|
4043
4062
|
/* @__PURE__ */ e(
|
|
4044
4063
|
"div",
|
|
4045
4064
|
{
|
|
@@ -4047,7 +4066,7 @@ function Ji({
|
|
|
4047
4066
|
children: /* @__PURE__ */ e(V, { variant: "h4", className: "flex-grow", children: "New collection" })
|
|
4048
4067
|
}
|
|
4049
4068
|
),
|
|
4050
|
-
n && /* @__PURE__ */ e(
|
|
4069
|
+
n && /* @__PURE__ */ e(Pt, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(V, { variant: "caption", children: [
|
|
4051
4070
|
"This is a subcollection of ",
|
|
4052
4071
|
/* @__PURE__ */ e("b", { children: n.name })
|
|
4053
4072
|
] }) }),
|
|
@@ -4061,13 +4080,13 @@ function Ji({
|
|
|
4061
4080
|
}
|
|
4062
4081
|
),
|
|
4063
4082
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
|
|
4064
|
-
o && !c && /* @__PURE__ */ e(
|
|
4083
|
+
o && !c && /* @__PURE__ */ e(He, { size: "small" }),
|
|
4065
4084
|
c?.map((g, x) => /* @__PURE__ */ e(
|
|
4066
|
-
|
|
4085
|
+
Pt,
|
|
4067
4086
|
{
|
|
4068
4087
|
colorScheme: "cyanLighter",
|
|
4069
4088
|
onClick: () => {
|
|
4070
|
-
p("name",
|
|
4089
|
+
p("name", xt(g)), p("id", g), p("path", g), p("properties", void 0), i();
|
|
4071
4090
|
},
|
|
4072
4091
|
size: "small",
|
|
4073
4092
|
children: g
|
|
@@ -4088,46 +4107,46 @@ function Ji({
|
|
|
4088
4107
|
),
|
|
4089
4108
|
/* @__PURE__ */ a("div", { className: "flex gap-4", children: [
|
|
4090
4109
|
/* @__PURE__ */ e(
|
|
4091
|
-
|
|
4110
|
+
ot,
|
|
4092
4111
|
{
|
|
4093
4112
|
title: "Products",
|
|
4094
4113
|
subtitle: "A collection of products with images, prices and stock",
|
|
4095
|
-
icon: /* @__PURE__ */ e(
|
|
4114
|
+
icon: /* @__PURE__ */ e(rt, { size: "small", iconKey: qt.icon }),
|
|
4096
4115
|
onClick: () => {
|
|
4097
|
-
s(
|
|
4116
|
+
s(qt), i();
|
|
4098
4117
|
}
|
|
4099
4118
|
}
|
|
4100
4119
|
),
|
|
4101
4120
|
/* @__PURE__ */ e(
|
|
4102
|
-
|
|
4121
|
+
ot,
|
|
4103
4122
|
{
|
|
4104
4123
|
title: "Users",
|
|
4105
4124
|
subtitle: "A collection of users with emails, names and roles",
|
|
4106
|
-
icon: /* @__PURE__ */ e(
|
|
4125
|
+
icon: /* @__PURE__ */ e(rt, { size: "small", iconKey: $t.icon }),
|
|
4107
4126
|
onClick: () => {
|
|
4108
|
-
s(
|
|
4127
|
+
s($t), i();
|
|
4109
4128
|
}
|
|
4110
4129
|
}
|
|
4111
4130
|
),
|
|
4112
4131
|
/* @__PURE__ */ e(
|
|
4113
|
-
|
|
4132
|
+
ot,
|
|
4114
4133
|
{
|
|
4115
4134
|
title: "Blog posts",
|
|
4116
4135
|
subtitle: "A collection of blog posts with images, authors and complex content",
|
|
4117
|
-
icon: /* @__PURE__ */ e(
|
|
4136
|
+
icon: /* @__PURE__ */ e(rt, { size: "small", iconKey: Lt.icon }),
|
|
4118
4137
|
onClick: () => {
|
|
4119
|
-
s(
|
|
4138
|
+
s(Lt), i();
|
|
4120
4139
|
}
|
|
4121
4140
|
}
|
|
4122
4141
|
),
|
|
4123
4142
|
/* @__PURE__ */ e(
|
|
4124
|
-
|
|
4143
|
+
ot,
|
|
4125
4144
|
{
|
|
4126
4145
|
title: "Pages",
|
|
4127
4146
|
subtitle: "A collection of pages with images, authors and complex content",
|
|
4128
|
-
icon: /* @__PURE__ */ e(
|
|
4147
|
+
icon: /* @__PURE__ */ e(rt, { size: "small", iconKey: Ht.icon }),
|
|
4129
4148
|
onClick: () => {
|
|
4130
|
-
s(
|
|
4149
|
+
s(Ht), i();
|
|
4131
4150
|
}
|
|
4132
4151
|
}
|
|
4133
4152
|
)
|
|
@@ -4148,17 +4167,17 @@ function Ji({
|
|
|
4148
4167
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(z, { variant: "text", onClick: () => i(), className: "my-2", children: "Continue from scratch" }) })
|
|
4149
4168
|
] }) });
|
|
4150
4169
|
}
|
|
4151
|
-
function
|
|
4170
|
+
function ot({
|
|
4152
4171
|
title: t,
|
|
4153
4172
|
subtitle: r,
|
|
4154
4173
|
icon: n,
|
|
4155
4174
|
onClick: i
|
|
4156
4175
|
}) {
|
|
4157
|
-
return /* @__PURE__ */ e(
|
|
4158
|
-
|
|
4176
|
+
return /* @__PURE__ */ e(ee, { title: r, children: /* @__PURE__ */ a(
|
|
4177
|
+
tr,
|
|
4159
4178
|
{
|
|
4160
4179
|
onClick: i,
|
|
4161
|
-
className:
|
|
4180
|
+
className: he(
|
|
4162
4181
|
"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center",
|
|
4163
4182
|
"text-gray-700 dark:text-slate-300",
|
|
4164
4183
|
"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary",
|
|
@@ -4180,23 +4199,23 @@ function Qi({
|
|
|
4180
4199
|
setFieldValue: i,
|
|
4181
4200
|
setFieldTouched: l,
|
|
4182
4201
|
values: o
|
|
4183
|
-
} =
|
|
4202
|
+
} = Y(), [d, c] = j(void 0), u = W.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), m = d ? d.id : void 0, p = d || void 0, s = ({
|
|
4184
4203
|
id: g,
|
|
4185
4204
|
property: x,
|
|
4186
4205
|
previousId: y,
|
|
4187
4206
|
namespace: P
|
|
4188
4207
|
}) => {
|
|
4189
|
-
const v = g ?
|
|
4190
|
-
const N =
|
|
4208
|
+
const v = g ? ie(g, P) : void 0, b = v ? me(v) : void 0, T = (C) => C ? u.current[C] ?? I(o, ye(C)) : u.current[""], w = (C, O) => {
|
|
4209
|
+
const N = ye(O);
|
|
4191
4210
|
i(N, C, !1), u.current[O ?? ""] = C;
|
|
4192
4211
|
};
|
|
4193
4212
|
if (y && y !== g) {
|
|
4194
|
-
const C =
|
|
4213
|
+
const C = ie(y, P), O = me(C), F = T(P).map((_) => _ === y ? g : _).filter((_) => _ !== void 0);
|
|
4195
4214
|
w(F, P);
|
|
4196
|
-
const
|
|
4197
|
-
Object.keys(
|
|
4198
|
-
|
|
4199
|
-
}), t.setHeadersMapping(
|
|
4215
|
+
const B = { ...t.headersMapping };
|
|
4216
|
+
Object.keys(B).forEach((_) => {
|
|
4217
|
+
B[_] === y && (B[_] = g ?? "");
|
|
4218
|
+
}), t.setHeadersMapping(B), i(O, void 0, !1), l(O, !1, !1);
|
|
4200
4219
|
}
|
|
4201
4220
|
b && (i(b, x, !1), l(b, !0, !1));
|
|
4202
4221
|
}, f = async ({
|
|
@@ -4205,14 +4224,14 @@ function Qi({
|
|
|
4205
4224
|
property: y,
|
|
4206
4225
|
namespace: P
|
|
4207
4226
|
}) => {
|
|
4208
|
-
const v = g ?
|
|
4209
|
-
...ii(T, y,
|
|
4227
|
+
const v = g ? ie(g, P) : void 0, b = v ? me(v) : void 0, T = t.importData.map((C) => I(C, x)), w = {
|
|
4228
|
+
...ii(T, y, rr),
|
|
4210
4229
|
editable: !0
|
|
4211
4230
|
};
|
|
4212
4231
|
b && (w ? i(b, w, !1) : i(b, y, !1), l(b, !0, !1));
|
|
4213
4232
|
};
|
|
4214
4233
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
4215
|
-
/* @__PURE__ */ a(
|
|
4234
|
+
/* @__PURE__ */ a(mt, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
4216
4235
|
/* @__PURE__ */ e(V, { variant: "h6", className: "my-4 ml-3.5", children: "Data property mapping" }),
|
|
4217
4236
|
/* @__PURE__ */ e(
|
|
4218
4237
|
pi,
|
|
@@ -4256,7 +4275,7 @@ function Qi({
|
|
|
4256
4275
|
)
|
|
4257
4276
|
] }),
|
|
4258
4277
|
/* @__PURE__ */ e(
|
|
4259
|
-
|
|
4278
|
+
Oe,
|
|
4260
4279
|
{
|
|
4261
4280
|
open: d !== void 0,
|
|
4262
4281
|
propertyKey: m,
|
|
@@ -4287,14 +4306,14 @@ function Xi({
|
|
|
4287
4306
|
propertyConfigs: i,
|
|
4288
4307
|
disabled: l
|
|
4289
4308
|
}) {
|
|
4290
|
-
const o = t ? Wt(t) : null, d = t ?
|
|
4309
|
+
const o = t ? Wt(t) : null, d = t ? je(t, i) : null, [c, u] = j(!1);
|
|
4291
4310
|
return /* @__PURE__ */ e(
|
|
4292
|
-
|
|
4311
|
+
ee,
|
|
4293
4312
|
{
|
|
4294
4313
|
title: t && d ? `${d?.name} - ${t.dataType}` : void 0,
|
|
4295
4314
|
open: c ? !1 : void 0,
|
|
4296
4315
|
children: /* @__PURE__ */ e(
|
|
4297
|
-
|
|
4316
|
+
be,
|
|
4298
4317
|
{
|
|
4299
4318
|
open: c,
|
|
4300
4319
|
onOpenChange: u,
|
|
@@ -4305,9 +4324,9 @@ function Xi({
|
|
|
4305
4324
|
value: o ?? "",
|
|
4306
4325
|
placeholder: "Select a property widget",
|
|
4307
4326
|
position: "item-aligned",
|
|
4308
|
-
renderValue: (m) => d ? /* @__PURE__ */ e(
|
|
4327
|
+
renderValue: (m) => d ? /* @__PURE__ */ e(qe, { propertyConfig: d }) : null,
|
|
4309
4328
|
onValueChange: (m) => {
|
|
4310
|
-
const p =
|
|
4329
|
+
const p = or(t, m, i);
|
|
4311
4330
|
n && r({
|
|
4312
4331
|
id: n,
|
|
4313
4332
|
property: p,
|
|
@@ -4315,8 +4334,8 @@ function Xi({
|
|
|
4315
4334
|
namespace: void 0
|
|
4316
4335
|
});
|
|
4317
4336
|
},
|
|
4318
|
-
children: Object.entries(
|
|
4319
|
-
|
|
4337
|
+
children: Object.entries(sr).map(([m, p]) => /* @__PURE__ */ e(
|
|
4338
|
+
lr,
|
|
4320
4339
|
{
|
|
4321
4340
|
value: m,
|
|
4322
4341
|
optionDisabled: !1,
|
|
@@ -4340,12 +4359,12 @@ function en({
|
|
|
4340
4359
|
const c = t.importData.map((u) => hi(u, t.idColumn, t.headersMapping, r, "TEMP_PATH", t.defaultValues));
|
|
4341
4360
|
t.setEntities(c);
|
|
4342
4361
|
}
|
|
4343
|
-
|
|
4362
|
+
ce(() => {
|
|
4344
4363
|
o().finally(() => l(!1));
|
|
4345
4364
|
}, []);
|
|
4346
|
-
const d =
|
|
4347
|
-
return i ? /* @__PURE__ */ e(
|
|
4348
|
-
|
|
4365
|
+
const d = Tr();
|
|
4366
|
+
return i ? /* @__PURE__ */ e(ct, {}) : /* @__PURE__ */ e(
|
|
4367
|
+
kr,
|
|
4349
4368
|
{
|
|
4350
4369
|
title: /* @__PURE__ */ a("div", { children: [
|
|
4351
4370
|
/* @__PURE__ */ e(V, { variant: "subtitle2", children: "Imported data preview" }),
|
|
@@ -4369,11 +4388,11 @@ function en({
|
|
|
4369
4388
|
}
|
|
4370
4389
|
);
|
|
4371
4390
|
}
|
|
4372
|
-
function
|
|
4391
|
+
function ur(t, r = "") {
|
|
4373
4392
|
const n = Object.keys(t).reduce((o, d) => {
|
|
4374
|
-
const c = t[d], u =
|
|
4393
|
+
const c = t[d], u = Or(d), m = r ? `${r}.${u}` : u;
|
|
4375
4394
|
if (c.dataType === "map" && c.properties) {
|
|
4376
|
-
const f =
|
|
4395
|
+
const f = ur(c.properties, m);
|
|
4377
4396
|
return {
|
|
4378
4397
|
headersMapping: { ...o.headersMapping, [d]: m },
|
|
4379
4398
|
properties: {
|
|
@@ -4401,14 +4420,14 @@ function pr(t, r = "") {
|
|
|
4401
4420
|
idColumn: l
|
|
4402
4421
|
};
|
|
4403
4422
|
}
|
|
4404
|
-
function
|
|
4405
|
-
const r = t.open, [n, i] =
|
|
4423
|
+
function pr(t) {
|
|
4424
|
+
const r = t.open, [n, i] = ze.useState(!1), [l, o] = ze.useState(!1), d = () => {
|
|
4406
4425
|
n ? o(!0) : t.handleClose(void 0);
|
|
4407
|
-
}
|
|
4408
|
-
return
|
|
4426
|
+
};
|
|
4427
|
+
return ce(() => {
|
|
4409
4428
|
r || (i(!1), o(!1));
|
|
4410
4429
|
}, [r]), /* @__PURE__ */ a(
|
|
4411
|
-
|
|
4430
|
+
_e,
|
|
4412
4431
|
{
|
|
4413
4432
|
open: r,
|
|
4414
4433
|
fullWidth: !0,
|
|
@@ -4426,7 +4445,7 @@ function mr(t) {
|
|
|
4426
4445
|
}
|
|
4427
4446
|
),
|
|
4428
4447
|
/* @__PURE__ */ e(
|
|
4429
|
-
|
|
4448
|
+
Wi,
|
|
4430
4449
|
{
|
|
4431
4450
|
open: l,
|
|
4432
4451
|
handleOk: () => t.handleClose(void 0),
|
|
@@ -4439,34 +4458,34 @@ function mr(t) {
|
|
|
4439
4458
|
);
|
|
4440
4459
|
}
|
|
4441
4460
|
function tn(t) {
|
|
4442
|
-
const { propertyConfigs: r } =
|
|
4461
|
+
const { propertyConfigs: r } = Se(), n = Te(), i = Ie(), {
|
|
4443
4462
|
topLevelNavigation: l,
|
|
4444
4463
|
collections: o
|
|
4445
|
-
} = n, d = t.initialValues, c = !d?.path && (t.parentCollectionIds ?? []).length === 0, u = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], m = u.map((b) => b.path.trim().toLowerCase()), p = u.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [s, f] =
|
|
4446
|
-
if (
|
|
4464
|
+
} = n, d = t.initialValues, c = !d?.path && (t.parentCollectionIds ?? []).length === 0, u = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], m = u.map((b) => b.path.trim().toLowerCase()), p = u.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [s, f] = ze.useState(), [g, x] = ze.useState(!1);
|
|
4465
|
+
if (ce(() => {
|
|
4447
4466
|
try {
|
|
4448
4467
|
n.initialised && (t.editedCollectionId ? f(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : f(void 0), x(!0));
|
|
4449
4468
|
} catch (b) {
|
|
4450
4469
|
console.error(b);
|
|
4451
4470
|
}
|
|
4452
|
-
}, [t.editedCollectionId, t.parentCollectionIds, n]), !l)
|
|
4471
|
+
}, [t.editedCollectionId, t.parentCollectionIds, n.initialised, n.getCollectionFromPaths]), !l)
|
|
4453
4472
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
4454
4473
|
const {
|
|
4455
4474
|
groups: y
|
|
4456
4475
|
} = l, P = s ? {
|
|
4457
4476
|
...s,
|
|
4458
|
-
id: s.id ?? s.path ??
|
|
4477
|
+
id: s.id ?? s.path ?? _t(16)
|
|
4459
4478
|
} : void 0, v = P ? nn(P, r) : {
|
|
4460
|
-
id: d?.path ??
|
|
4479
|
+
id: d?.path ?? _t(16),
|
|
4461
4480
|
path: d?.path ?? "",
|
|
4462
4481
|
name: d?.name ?? "",
|
|
4463
4482
|
group: d?.group ?? "",
|
|
4464
4483
|
properties: {},
|
|
4465
4484
|
propertiesOrder: [],
|
|
4466
|
-
icon:
|
|
4485
|
+
icon: Mt[Math.floor(Math.random() * Mt.length)],
|
|
4467
4486
|
ownerId: i.user?.uid ?? ""
|
|
4468
4487
|
};
|
|
4469
|
-
return g ? !t.isNewCollection && (!n.initialised || !g) ? /* @__PURE__ */ e(
|
|
4488
|
+
return g ? !t.isNewCollection && (!n.initialised || !g) ? /* @__PURE__ */ e(ct, {}) : /* @__PURE__ */ e(
|
|
4470
4489
|
rn,
|
|
4471
4490
|
{
|
|
4472
4491
|
...t,
|
|
@@ -4479,7 +4498,7 @@ function tn(t) {
|
|
|
4479
4498
|
groups: y,
|
|
4480
4499
|
propertyConfigs: r
|
|
4481
4500
|
}
|
|
4482
|
-
) : /* @__PURE__ */ e(
|
|
4501
|
+
) : /* @__PURE__ */ e(ct, {});
|
|
4483
4502
|
}
|
|
4484
4503
|
function rn({
|
|
4485
4504
|
isNewCollection: t,
|
|
@@ -4506,56 +4525,56 @@ function rn({
|
|
|
4506
4525
|
propertyConfigs: C,
|
|
4507
4526
|
groups: O
|
|
4508
4527
|
}) {
|
|
4509
|
-
const N = fi(), F = Te(),
|
|
4510
|
-
const
|
|
4528
|
+
const N = fi(), F = Te(), B = Ve(), _ = Re({}), E = t ? v ? "welcome" : "details" : "properties", [h, D] = j(E), [ae, q] = ze.useState(), Z = (k) => {
|
|
4529
|
+
const S = k.id || k.path;
|
|
4511
4530
|
return r.saveCollection({
|
|
4512
|
-
id:
|
|
4531
|
+
id: S,
|
|
4513
4532
|
collectionData: k,
|
|
4514
4533
|
previousId: n,
|
|
4515
4534
|
parentCollectionIds: i
|
|
4516
|
-
}).then(() => (q(void 0), !0)).catch((M) => (q(M), console.error(M),
|
|
4535
|
+
}).then(() => (q(void 0), !0)).catch((M) => (q(M), console.error(M), B.open({
|
|
4517
4536
|
type: "error",
|
|
4518
4537
|
message: "Error persisting collection: " + (M.message ?? "Details in the console")
|
|
4519
4538
|
}), !1));
|
|
4520
|
-
}, H =
|
|
4521
|
-
h === "details" ? N.inUse ?
|
|
4522
|
-
},
|
|
4539
|
+
}, H = () => {
|
|
4540
|
+
h === "details" ? N.inUse ? D("import_data_saving") : D(u ? "extra_view" : "properties") : D(h === "welcome" ? "details" : h === "import_data_mapping" ? "import_data_preview" : h === "import_data_preview" ? "details" : h === "extra_view" ? "properties" : "details");
|
|
4541
|
+
}, Q = (k) => {
|
|
4523
4542
|
if (o)
|
|
4524
4543
|
return o?.(k.path, k.collectionGroup ?? !1, i ?? []);
|
|
4525
|
-
},
|
|
4544
|
+
}, le = async (k) => {
|
|
4526
4545
|
try {
|
|
4527
4546
|
if (!Q)
|
|
4528
4547
|
return T(k), Promise.resolve(k);
|
|
4529
|
-
|
|
4530
|
-
const
|
|
4531
|
-
if (!
|
|
4548
|
+
D("loading");
|
|
4549
|
+
const S = await Q?.(k);
|
|
4550
|
+
if (!S)
|
|
4532
4551
|
return T(k), Promise.resolve(k);
|
|
4533
4552
|
const M = {
|
|
4534
4553
|
...k ?? {}
|
|
4535
4554
|
};
|
|
4536
|
-
return Object.keys(
|
|
4555
|
+
return Object.keys(S.properties ?? {}).length > 0 && (M.properties = S.properties, M.propertiesOrder = S.propertiesOrder), M.propertiesOrder ? (T(M), console.debug("Inferred collection", {
|
|
4537
4556
|
newCollection: k ?? {},
|
|
4538
4557
|
values: M
|
|
4539
4558
|
}), M) : (M.propertiesOrder = Object.keys(M.properties), M);
|
|
4540
|
-
} catch (
|
|
4541
|
-
return console.error(
|
|
4559
|
+
} catch (S) {
|
|
4560
|
+
return console.error(S), B.open({
|
|
4542
4561
|
type: "error",
|
|
4543
|
-
message: "Error inferring collection: " + (
|
|
4562
|
+
message: "Error inferring collection: " + (S.message ?? "Details in the console")
|
|
4544
4563
|
}), k;
|
|
4545
4564
|
}
|
|
4546
|
-
},
|
|
4565
|
+
}, se = kt({
|
|
4547
4566
|
initialValues: w,
|
|
4548
|
-
onSubmit: (k,
|
|
4567
|
+
onSubmit: (k, S) => {
|
|
4549
4568
|
console.log("Submitting collection", k);
|
|
4550
4569
|
try {
|
|
4551
4570
|
if (!t) {
|
|
4552
4571
|
Z(k).then(() => {
|
|
4553
|
-
|
|
4572
|
+
S.resetForm({ values: w }), d(k);
|
|
4554
4573
|
});
|
|
4555
4574
|
return;
|
|
4556
4575
|
}
|
|
4557
|
-
h === "welcome" ? (H(),
|
|
4558
|
-
|
|
4576
|
+
h === "welcome" ? (H(), S.resetForm({ values: k })) : h === "details" ? u || N.inUse ? (S.resetForm({ values: k }), H()) : t ? le(k).then((M) => {
|
|
4577
|
+
S.resetForm({
|
|
4559
4578
|
values: M ?? k,
|
|
4560
4579
|
touched: {
|
|
4561
4580
|
path: !0,
|
|
@@ -4564,70 +4583,70 @@ function rn({
|
|
|
4564
4583
|
});
|
|
4565
4584
|
}).finally(() => {
|
|
4566
4585
|
H();
|
|
4567
|
-
}) : (
|
|
4568
|
-
|
|
4569
|
-
}) : (H(),
|
|
4586
|
+
}) : (S.resetForm({ values: k }), H()) : h === "extra_view" ? (H(), S.resetForm({ values: k })) : h === "import_data_mapping" || h === "import_data_preview" ? H() : h === "properties" ? Z(k).then(() => {
|
|
4587
|
+
S.resetForm({ values: w }), H(), d(k);
|
|
4588
|
+
}) : (H(), S.resetForm({ values: k }));
|
|
4570
4589
|
} catch (M) {
|
|
4571
|
-
|
|
4590
|
+
B.open({
|
|
4572
4591
|
type: "error",
|
|
4573
4592
|
message: "Error persisting collection: " + (M.message ?? "Details in the console")
|
|
4574
|
-
}), console.error(M),
|
|
4593
|
+
}), console.error(M), S.resetForm({ values: k });
|
|
4575
4594
|
}
|
|
4576
4595
|
},
|
|
4577
4596
|
validation: (k) => {
|
|
4578
|
-
let
|
|
4597
|
+
let S = {};
|
|
4579
4598
|
const M = (h === "properties" || h === "subcollections" || h === "details") && yi;
|
|
4580
4599
|
if (M)
|
|
4581
4600
|
try {
|
|
4582
4601
|
M.validateSync(k, { abortEarly: !1 });
|
|
4583
4602
|
} catch (L) {
|
|
4584
|
-
L.inner.forEach((
|
|
4585
|
-
|
|
4603
|
+
L.inner.forEach((ge) => {
|
|
4604
|
+
S[ge.path] = ge.message;
|
|
4586
4605
|
});
|
|
4587
4606
|
}
|
|
4588
|
-
if (h === "properties" && (
|
|
4589
|
-
const L =
|
|
4590
|
-
L && (
|
|
4591
|
-
const
|
|
4592
|
-
|
|
4607
|
+
if (h === "properties" && (S = { ...S, ..._.current }), h === "details") {
|
|
4608
|
+
const L = Yt(k.path, t, y, k.id);
|
|
4609
|
+
L && (S.path = L);
|
|
4610
|
+
const ge = an(k.id, t, y, P);
|
|
4611
|
+
ge && (S.id = ge);
|
|
4593
4612
|
}
|
|
4594
|
-
return
|
|
4613
|
+
return S;
|
|
4595
4614
|
}
|
|
4596
4615
|
}), {
|
|
4597
|
-
values:
|
|
4598
|
-
setFieldValue:
|
|
4616
|
+
values: te,
|
|
4617
|
+
setFieldValue: xe,
|
|
4599
4618
|
isSubmitting: ke,
|
|
4600
|
-
dirty:
|
|
4601
|
-
submitCount:
|
|
4602
|
-
} =
|
|
4603
|
-
|
|
4604
|
-
p(
|
|
4605
|
-
}, [
|
|
4606
|
-
function
|
|
4607
|
-
N.setInUse(!0), ni(k,
|
|
4608
|
-
const L =
|
|
4619
|
+
dirty: Ye,
|
|
4620
|
+
submitCount: gt
|
|
4621
|
+
} = se, ue = te.path, Ge = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + ue : ue, We = Yt(ue, t, y, te.id), Ke = !We && i ? F.convertIdsToPaths(i) : void 0, Ze = We ? void 0 : F.resolveAliasesFrom(Ge), Je = Ze && x ? () => x(Ze, Ke ?? []) : void 0;
|
|
4622
|
+
ce(() => {
|
|
4623
|
+
p(Ye);
|
|
4624
|
+
}, [Ye]);
|
|
4625
|
+
function Qe(k, S) {
|
|
4626
|
+
N.setInUse(!0), ni(k, rr).then((M) => {
|
|
4627
|
+
const L = ur(M);
|
|
4609
4628
|
N.setIdColumn(L.idColumn), N.setImportData(k), N.setHeadersMapping(L.headersMapping);
|
|
4610
|
-
const
|
|
4611
|
-
N.setHeadingsOrder(
|
|
4612
|
-
const
|
|
4613
|
-
|
|
4629
|
+
const ge = (S ?? []).filter((et) => L.headersMapping[et]) ?? Object.keys(L.properties);
|
|
4630
|
+
N.setHeadingsOrder(ge), N.setOriginProperties(L.properties);
|
|
4631
|
+
const Xe = (S ?? []).map((et) => L.headersMapping[et]).filter(Boolean) ?? Object.keys(L.properties);
|
|
4632
|
+
xe("properties", L.properties), xe("propertiesOrder", Xe);
|
|
4614
4633
|
});
|
|
4615
4634
|
}
|
|
4616
|
-
const
|
|
4617
|
-
const k = { ...
|
|
4618
|
-
N.idColumn && delete k[N.idColumn],
|
|
4635
|
+
const vt = !!te.name && !!te.id, yt = () => {
|
|
4636
|
+
const k = { ...te.properties };
|
|
4637
|
+
N.idColumn && delete k[N.idColumn], xe("properties", k), H();
|
|
4619
4638
|
}, U = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4620
|
-
return /* @__PURE__ */ e(
|
|
4639
|
+
return /* @__PURE__ */ e(Ae, { fullHeight: !0, children: /* @__PURE__ */ e(Ot, { value: se, children: /* @__PURE__ */ a(R, { children: [
|
|
4621
4640
|
!t && /* @__PURE__ */ a(
|
|
4622
|
-
|
|
4641
|
+
Kr,
|
|
4623
4642
|
{
|
|
4624
4643
|
value: h,
|
|
4625
|
-
className:
|
|
4626
|
-
onValueChange: (k) =>
|
|
4644
|
+
className: he(Tt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
4645
|
+
onValueChange: (k) => D(k),
|
|
4627
4646
|
children: [
|
|
4628
|
-
/* @__PURE__ */ e(
|
|
4629
|
-
/* @__PURE__ */ e(
|
|
4630
|
-
/* @__PURE__ */ e(
|
|
4647
|
+
/* @__PURE__ */ e(Ct, { value: "details", children: "Details" }),
|
|
4648
|
+
/* @__PURE__ */ e(Ct, { value: "properties", children: "Properties" }),
|
|
4649
|
+
/* @__PURE__ */ e(Ct, { value: "subcollections", children: "Additional views" })
|
|
4631
4650
|
]
|
|
4632
4651
|
}
|
|
4633
4652
|
),
|
|
@@ -4635,20 +4654,20 @@ function rn({
|
|
|
4635
4654
|
"form",
|
|
4636
4655
|
{
|
|
4637
4656
|
noValidate: !0,
|
|
4638
|
-
onSubmit:
|
|
4639
|
-
className:
|
|
4657
|
+
onSubmit: se.handleSubmit,
|
|
4658
|
+
className: he(
|
|
4640
4659
|
t ? "h-full" : "h-[calc(100%-48px)]",
|
|
4641
4660
|
"flex-grow flex flex-col relative"
|
|
4642
4661
|
),
|
|
4643
4662
|
children: [
|
|
4644
|
-
h === "loading" && /* @__PURE__ */ e(
|
|
4645
|
-
h === "extra_view" &&
|
|
4663
|
+
h === "loading" && /* @__PURE__ */ e(ct, {}),
|
|
4664
|
+
h === "extra_view" && ue && u?.View && /* @__PURE__ */ e(u.View, { path: ue }),
|
|
4646
4665
|
h === "welcome" && /* @__PURE__ */ e(
|
|
4647
4666
|
Ji,
|
|
4648
4667
|
{
|
|
4649
|
-
path:
|
|
4650
|
-
onContinue: (k,
|
|
4651
|
-
k ? (
|
|
4668
|
+
path: ue,
|
|
4669
|
+
onContinue: (k, S) => {
|
|
4670
|
+
k ? (Qe(k, S), D("import_data_mapping")) : D("details");
|
|
4652
4671
|
},
|
|
4653
4672
|
existingCollectionPaths: y,
|
|
4654
4673
|
parentCollection: g,
|
|
@@ -4667,21 +4686,21 @@ function rn({
|
|
|
4667
4686
|
en,
|
|
4668
4687
|
{
|
|
4669
4688
|
importConfig: N,
|
|
4670
|
-
properties:
|
|
4671
|
-
propertiesOrder:
|
|
4689
|
+
properties: te.properties,
|
|
4690
|
+
propertiesOrder: te.propertiesOrder
|
|
4672
4691
|
}
|
|
4673
4692
|
),
|
|
4674
4693
|
h === "import_data_saving" && N && /* @__PURE__ */ e(
|
|
4675
4694
|
gi,
|
|
4676
4695
|
{
|
|
4677
4696
|
importConfig: N,
|
|
4678
|
-
collection:
|
|
4679
|
-
path:
|
|
4697
|
+
collection: te,
|
|
4698
|
+
path: ue,
|
|
4680
4699
|
onImportSuccess: async (k) => {
|
|
4681
|
-
|
|
4700
|
+
B.open({
|
|
4682
4701
|
type: "info",
|
|
4683
4702
|
message: "Data imported successfully"
|
|
4684
|
-
}), await Z(
|
|
4703
|
+
}), await Z(te), d(k);
|
|
4685
4704
|
}
|
|
4686
4705
|
}
|
|
4687
4706
|
),
|
|
@@ -4710,45 +4729,45 @@ function rn({
|
|
|
4710
4729
|
h === "properties" && /* @__PURE__ */ e(
|
|
4711
4730
|
Gi,
|
|
4712
4731
|
{
|
|
4713
|
-
showErrors:
|
|
4732
|
+
showErrors: gt > 0,
|
|
4714
4733
|
isNewCollection: t,
|
|
4715
4734
|
reservedGroups: c,
|
|
4716
|
-
onPropertyError: (k,
|
|
4717
|
-
const L =
|
|
4735
|
+
onPropertyError: (k, S, M) => {
|
|
4736
|
+
const L = Ft({
|
|
4718
4737
|
..._.current,
|
|
4719
|
-
[
|
|
4738
|
+
[nr(k, S)]: Ft(M, !0)
|
|
4720
4739
|
}, !0);
|
|
4721
|
-
_.current = L,
|
|
4740
|
+
_.current = L, se.validate();
|
|
4722
4741
|
},
|
|
4723
4742
|
getUser: f,
|
|
4724
|
-
getData:
|
|
4743
|
+
getData: Je,
|
|
4725
4744
|
doCollectionInference: Q,
|
|
4726
4745
|
propertyConfigs: C,
|
|
4727
4746
|
collectionEditable: U,
|
|
4728
4747
|
extraIcon: u?.icon && /* @__PURE__ */ e(
|
|
4729
|
-
|
|
4748
|
+
ne,
|
|
4730
4749
|
{
|
|
4731
4750
|
color: "primary",
|
|
4732
|
-
onClick: () =>
|
|
4751
|
+
onClick: () => D("extra_view"),
|
|
4733
4752
|
children: u.icon
|
|
4734
4753
|
}
|
|
4735
4754
|
)
|
|
4736
4755
|
}
|
|
4737
4756
|
),
|
|
4738
4757
|
h !== "welcome" && /* @__PURE__ */ a(
|
|
4739
|
-
|
|
4758
|
+
De,
|
|
4740
4759
|
{
|
|
4741
4760
|
position: "absolute",
|
|
4742
4761
|
children: [
|
|
4743
|
-
|
|
4762
|
+
ae && /* @__PURE__ */ e(Kt, { error: ae }),
|
|
4744
4763
|
t && v && h === "import_data_mapping" && /* @__PURE__ */ a(
|
|
4745
4764
|
z,
|
|
4746
4765
|
{
|
|
4747
4766
|
variant: "text",
|
|
4748
4767
|
type: "button",
|
|
4749
|
-
onClick: () => (N.setInUse(!1),
|
|
4768
|
+
onClick: () => (N.setInUse(!1), D("welcome")),
|
|
4750
4769
|
children: [
|
|
4751
|
-
/* @__PURE__ */ e(
|
|
4770
|
+
/* @__PURE__ */ e(it, {}),
|
|
4752
4771
|
"Back"
|
|
4753
4772
|
]
|
|
4754
4773
|
}
|
|
@@ -4759,10 +4778,10 @@ function rn({
|
|
|
4759
4778
|
variant: "text",
|
|
4760
4779
|
type: "button",
|
|
4761
4780
|
onClick: () => {
|
|
4762
|
-
|
|
4781
|
+
D("import_data_mapping");
|
|
4763
4782
|
},
|
|
4764
4783
|
children: [
|
|
4765
|
-
/* @__PURE__ */ e(
|
|
4784
|
+
/* @__PURE__ */ e(it, {}),
|
|
4766
4785
|
"Back"
|
|
4767
4786
|
]
|
|
4768
4787
|
}
|
|
@@ -4772,9 +4791,9 @@ function rn({
|
|
|
4772
4791
|
{
|
|
4773
4792
|
variant: "text",
|
|
4774
4793
|
type: "button",
|
|
4775
|
-
onClick: () =>
|
|
4794
|
+
onClick: () => D("welcome"),
|
|
4776
4795
|
children: [
|
|
4777
|
-
/* @__PURE__ */ e(
|
|
4796
|
+
/* @__PURE__ */ e(it, {}),
|
|
4778
4797
|
"Back"
|
|
4779
4798
|
]
|
|
4780
4799
|
}
|
|
@@ -4784,9 +4803,9 @@ function rn({
|
|
|
4784
4803
|
{
|
|
4785
4804
|
variant: "text",
|
|
4786
4805
|
type: "button",
|
|
4787
|
-
onClick: () =>
|
|
4806
|
+
onClick: () => D("details"),
|
|
4788
4807
|
children: [
|
|
4789
|
-
/* @__PURE__ */ e(
|
|
4808
|
+
/* @__PURE__ */ e(it, {}),
|
|
4790
4809
|
"Back"
|
|
4791
4810
|
]
|
|
4792
4811
|
}
|
|
@@ -4806,7 +4825,7 @@ function rn({
|
|
|
4806
4825
|
{
|
|
4807
4826
|
variant: "filled",
|
|
4808
4827
|
color: "primary",
|
|
4809
|
-
onClick:
|
|
4828
|
+
onClick: yt,
|
|
4810
4829
|
children: "Next"
|
|
4811
4830
|
}
|
|
4812
4831
|
),
|
|
@@ -4822,13 +4841,13 @@ function rn({
|
|
|
4822
4841
|
}
|
|
4823
4842
|
),
|
|
4824
4843
|
t && (h === "details" || h === "properties") && /* @__PURE__ */ a(
|
|
4825
|
-
|
|
4844
|
+
zt,
|
|
4826
4845
|
{
|
|
4827
4846
|
variant: "filled",
|
|
4828
4847
|
color: "primary",
|
|
4829
4848
|
type: "submit",
|
|
4830
4849
|
loading: ke,
|
|
4831
|
-
disabled: ke || h === "details" && !
|
|
4850
|
+
disabled: ke || h === "details" && !vt,
|
|
4832
4851
|
startIcon: h === "properties" ? /* @__PURE__ */ e(Zr, {}) : void 0,
|
|
4833
4852
|
children: [
|
|
4834
4853
|
h === "details" && "Next",
|
|
@@ -4837,7 +4856,7 @@ function rn({
|
|
|
4837
4856
|
}
|
|
4838
4857
|
),
|
|
4839
4858
|
!t && /* @__PURE__ */ e(
|
|
4840
|
-
|
|
4859
|
+
zt,
|
|
4841
4860
|
{
|
|
4842
4861
|
variant: "filled",
|
|
4843
4862
|
color: "primary",
|
|
@@ -4860,22 +4879,22 @@ function nn(t, r) {
|
|
|
4860
4879
|
...i
|
|
4861
4880
|
} = t, l = {};
|
|
4862
4881
|
return n && Object.keys(n).forEach((o) => {
|
|
4863
|
-
l[o] =
|
|
4882
|
+
l[o] = mr(n[o], r);
|
|
4864
4883
|
}), {
|
|
4865
4884
|
...i,
|
|
4866
4885
|
properties: l
|
|
4867
4886
|
};
|
|
4868
4887
|
}
|
|
4869
|
-
function
|
|
4888
|
+
function mr(t, r) {
|
|
4870
4889
|
let n = t;
|
|
4871
4890
|
if (r && typeof n == "object" && n.propertyConfig) {
|
|
4872
4891
|
const i = r[n.propertyConfig];
|
|
4873
|
-
if (i &&
|
|
4892
|
+
if (i && re(i.property))
|
|
4874
4893
|
n = i.property;
|
|
4875
|
-
else if (i && (n =
|
|
4894
|
+
else if (i && (n = G(i.property, n)), !re(n) && n.dataType === "map" && n.properties) {
|
|
4876
4895
|
const l = {};
|
|
4877
4896
|
Object.keys(n.properties).forEach((o) => {
|
|
4878
|
-
l[o] =
|
|
4897
|
+
l[o] = mr(n.properties[o], r);
|
|
4879
4898
|
}), n = {
|
|
4880
4899
|
...n,
|
|
4881
4900
|
properties: l
|
|
@@ -4884,15 +4903,15 @@ function hr(t, r) {
|
|
|
4884
4903
|
}
|
|
4885
4904
|
return n;
|
|
4886
4905
|
}
|
|
4887
|
-
const
|
|
4906
|
+
const Yt = (t, r, n, i) => {
|
|
4888
4907
|
let l;
|
|
4889
|
-
return t || (l = "You must specify a path in the database for this collection"), r && n?.includes(t.trim().toLowerCase()) && !i && (l = "There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids"),
|
|
4908
|
+
return t || (l = "You must specify a path in the database for this collection"), r && n?.includes(t.trim().toLowerCase()) && !i && (l = "There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids"), Vr(t).split("/").length % 2 === 0 && (l = `Collection paths must have an odd number of segments: ${t}`), l;
|
|
4890
4909
|
}, an = (t, r, n, i) => {
|
|
4891
4910
|
if (!t)
|
|
4892
4911
|
return;
|
|
4893
4912
|
let l;
|
|
4894
4913
|
return r && n?.includes(t.trim().toLowerCase()) && (l = "There is already a collection that uses this value as a path"), r && i?.includes(t.trim().toLowerCase()) && (l = "There is already a collection which uses this id"), l;
|
|
4895
|
-
},
|
|
4914
|
+
}, hr = W.createContext({}), fr = W.createContext({}), on = W.memo(
|
|
4896
4915
|
function({
|
|
4897
4916
|
children: r,
|
|
4898
4917
|
collectionConfigController: n,
|
|
@@ -4905,78 +4924,78 @@ const Gt = (t, r, n, i) => {
|
|
|
4905
4924
|
getData: m,
|
|
4906
4925
|
onAnalyticsEvent: p
|
|
4907
4926
|
}) {
|
|
4908
|
-
const s = Te(), f = vi(), g =
|
|
4927
|
+
const s = Te(), f = vi(), g = Ve(), { propertyConfigs: x } = Se(), [y, P] = W.useState(), [v, b] = W.useState(), T = Er(() => ({
|
|
4909
4928
|
createCollections: !0,
|
|
4910
4929
|
editCollections: !0,
|
|
4911
4930
|
deleteCollections: !0
|
|
4912
|
-
}), []), w =
|
|
4931
|
+
}), []), w = ({
|
|
4913
4932
|
id: N,
|
|
4914
4933
|
fullPath: F,
|
|
4915
|
-
parentCollectionIds:
|
|
4934
|
+
parentCollectionIds: B,
|
|
4916
4935
|
parentCollection: _
|
|
4917
4936
|
}) => {
|
|
4918
|
-
console.debug("Edit collection", N, F,
|
|
4937
|
+
console.debug("Edit collection", N, F, B, _), p?.("edit_collection", {
|
|
4919
4938
|
id: N,
|
|
4920
4939
|
fullPath: F
|
|
4921
4940
|
}), P({
|
|
4922
4941
|
editedCollectionId: N,
|
|
4923
4942
|
fullPath: F,
|
|
4924
|
-
parentCollectionIds:
|
|
4943
|
+
parentCollectionIds: B,
|
|
4925
4944
|
isNewCollection: !1,
|
|
4926
4945
|
parentCollection: _,
|
|
4927
4946
|
redirect: !1
|
|
4928
4947
|
});
|
|
4929
|
-
},
|
|
4948
|
+
}, C = ({
|
|
4930
4949
|
propertyKey: N,
|
|
4931
4950
|
property: F,
|
|
4932
|
-
editedCollectionId:
|
|
4951
|
+
editedCollectionId: B,
|
|
4933
4952
|
currentPropertiesOrder: _,
|
|
4934
|
-
parentCollectionIds:
|
|
4953
|
+
parentCollectionIds: E,
|
|
4935
4954
|
collection: h
|
|
4936
4955
|
}) => {
|
|
4937
|
-
console.debug("Edit property", N, F,
|
|
4956
|
+
console.debug("Edit property", N, F, B, _, E, h), p?.("edit_property", {
|
|
4938
4957
|
propertyKey: N,
|
|
4939
|
-
editedCollectionId:
|
|
4958
|
+
editedCollectionId: B
|
|
4940
4959
|
});
|
|
4941
|
-
const
|
|
4960
|
+
const D = N && N.includes(".") ? N.substring(0, N.lastIndexOf(".")) : void 0, ae = N && N.includes(".") ? N.substring(N.lastIndexOf(".") + 1) : N;
|
|
4942
4961
|
b({
|
|
4943
|
-
propertyKey:
|
|
4962
|
+
propertyKey: ae,
|
|
4944
4963
|
property: F,
|
|
4945
|
-
namespace:
|
|
4964
|
+
namespace: D,
|
|
4946
4965
|
currentPropertiesOrder: _,
|
|
4947
|
-
editedCollectionId:
|
|
4948
|
-
parentCollectionIds:
|
|
4966
|
+
editedCollectionId: B,
|
|
4967
|
+
parentCollectionIds: E,
|
|
4949
4968
|
collectionEditable: h?.editable ?? !1
|
|
4950
4969
|
});
|
|
4951
|
-
},
|
|
4970
|
+
}, O = ({
|
|
4952
4971
|
parentCollectionIds: N,
|
|
4953
4972
|
parentCollection: F,
|
|
4954
|
-
initialValues:
|
|
4973
|
+
initialValues: B,
|
|
4955
4974
|
redirect: _,
|
|
4956
|
-
sourceClick:
|
|
4975
|
+
sourceClick: E
|
|
4957
4976
|
}) => {
|
|
4958
4977
|
console.debug("Create collection", {
|
|
4959
4978
|
parentCollectionIds: N,
|
|
4960
4979
|
parentCollection: F,
|
|
4961
|
-
initialValues:
|
|
4980
|
+
initialValues: B,
|
|
4962
4981
|
redirect: _,
|
|
4963
|
-
sourceClick:
|
|
4982
|
+
sourceClick: E
|
|
4964
4983
|
}), p?.("create_collection", {
|
|
4965
4984
|
parentCollectionIds: N,
|
|
4966
4985
|
parentCollection: F,
|
|
4967
|
-
initialValues:
|
|
4986
|
+
initialValues: B,
|
|
4968
4987
|
redirect: _,
|
|
4969
|
-
sourceClick:
|
|
4988
|
+
sourceClick: E
|
|
4970
4989
|
}), P({
|
|
4971
4990
|
isNewCollection: !0,
|
|
4972
4991
|
parentCollectionIds: N,
|
|
4973
4992
|
parentCollection: F,
|
|
4974
|
-
initialValues:
|
|
4993
|
+
initialValues: B,
|
|
4975
4994
|
redirect: _
|
|
4976
4995
|
});
|
|
4977
|
-
}
|
|
4978
|
-
return /* @__PURE__ */ e(
|
|
4979
|
-
|
|
4996
|
+
};
|
|
4997
|
+
return /* @__PURE__ */ e(hr.Provider, { value: n, children: /* @__PURE__ */ a(
|
|
4998
|
+
fr.Provider,
|
|
4980
4999
|
{
|
|
4981
5000
|
value: {
|
|
4982
5001
|
editCollection: w,
|
|
@@ -4988,7 +5007,7 @@ const Gt = (t, r, n, i) => {
|
|
|
4988
5007
|
children: [
|
|
4989
5008
|
r,
|
|
4990
5009
|
/* @__PURE__ */ e(
|
|
4991
|
-
|
|
5010
|
+
pr,
|
|
4992
5011
|
{
|
|
4993
5012
|
open: !!y,
|
|
4994
5013
|
configController: n,
|
|
@@ -5010,7 +5029,7 @@ const Gt = (t, r, n, i) => {
|
|
|
5010
5029
|
}
|
|
5011
5030
|
),
|
|
5012
5031
|
/* @__PURE__ */ e(
|
|
5013
|
-
|
|
5032
|
+
Oe,
|
|
5014
5033
|
{
|
|
5015
5034
|
open: !!v,
|
|
5016
5035
|
includeIdAndName: !0,
|
|
@@ -5030,12 +5049,12 @@ const Gt = (t, r, n, i) => {
|
|
|
5030
5049
|
}) => {
|
|
5031
5050
|
if (!v || !N)
|
|
5032
5051
|
return;
|
|
5033
|
-
const
|
|
5052
|
+
const B = !v.propertyKey;
|
|
5034
5053
|
return n.saveProperty({
|
|
5035
5054
|
path: v?.editedCollectionId,
|
|
5036
5055
|
property: F,
|
|
5037
5056
|
propertyKey: N,
|
|
5038
|
-
newPropertiesOrder:
|
|
5057
|
+
newPropertiesOrder: B && v.currentPropertiesOrder ? [...v.currentPropertiesOrder, N] : void 0,
|
|
5039
5058
|
namespace: v.namespace,
|
|
5040
5059
|
parentCollectionIds: v.parentCollectionIds
|
|
5041
5060
|
}).catch((_) => (console.error(_), g.open({
|
|
@@ -5082,78 +5101,78 @@ const Gt = (t, r, n, i) => {
|
|
|
5082
5101
|
}
|
|
5083
5102
|
) });
|
|
5084
5103
|
},
|
|
5085
|
-
|
|
5086
|
-
),
|
|
5104
|
+
ve
|
|
5105
|
+
), Ne = () => Jt(fr);
|
|
5087
5106
|
function ln({
|
|
5088
5107
|
path: t,
|
|
5089
5108
|
parentCollectionIds: r,
|
|
5090
5109
|
collection: n,
|
|
5091
5110
|
tableController: i
|
|
5092
5111
|
}) {
|
|
5093
|
-
const l =
|
|
5112
|
+
const l = Ie(), o = Te(), d = Ne(), c = o.getCollectionFromIds(r), u = d.configPermissions ? d.configPermissions({
|
|
5094
5113
|
user: l.user,
|
|
5095
5114
|
collection: n
|
|
5096
5115
|
}).editCollections : !0;
|
|
5097
5116
|
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
|
|
5098
|
-
|
|
5117
|
+
ee,
|
|
5099
5118
|
{
|
|
5100
5119
|
title: u ? "Edit collection" : "You don't have permissions to edit this collection",
|
|
5101
5120
|
children: /* @__PURE__ */ e(
|
|
5102
|
-
|
|
5121
|
+
ne,
|
|
5103
5122
|
{
|
|
5104
5123
|
color: "primary",
|
|
5105
5124
|
disabled: !u,
|
|
5106
5125
|
onClick: u ? () => d?.editCollection({ id: n.id, fullPath: t, parentCollectionIds: r, parentCollection: c }) : void 0,
|
|
5107
|
-
children: /* @__PURE__ */ e(
|
|
5126
|
+
children: /* @__PURE__ */ e($e, {})
|
|
5108
5127
|
}
|
|
5109
5128
|
)
|
|
5110
5129
|
}
|
|
5111
5130
|
) });
|
|
5112
5131
|
}
|
|
5113
|
-
const
|
|
5132
|
+
const gr = () => Jt(hr);
|
|
5114
5133
|
function sn({
|
|
5115
5134
|
path: t,
|
|
5116
5135
|
collection: r
|
|
5117
5136
|
}) {
|
|
5118
|
-
const n =
|
|
5137
|
+
const n = Ve(), i = Ie(), l = gr(), o = Ne(), d = o.configPermissions({
|
|
5119
5138
|
user: i.user,
|
|
5120
5139
|
collection: r
|
|
5121
|
-
}), c =
|
|
5140
|
+
}), c = () => {
|
|
5122
5141
|
o?.editCollection({ id: r.id, parentCollectionIds: [] });
|
|
5123
|
-
}, [
|
|
5142
|
+
}, [u, m] = j(!1), p = () => {
|
|
5124
5143
|
l?.deleteCollection({ id: r.id }).then(() => {
|
|
5125
5144
|
m(!1), n.open({
|
|
5126
5145
|
message: "Collection deleted",
|
|
5127
5146
|
type: "success"
|
|
5128
5147
|
});
|
|
5129
5148
|
});
|
|
5130
|
-
}
|
|
5149
|
+
};
|
|
5131
5150
|
return /* @__PURE__ */ a(R, { children: [
|
|
5132
5151
|
/* @__PURE__ */ a("div", { children: [
|
|
5133
5152
|
d.deleteCollections && /* @__PURE__ */ e(
|
|
5134
5153
|
Jr,
|
|
5135
5154
|
{
|
|
5136
|
-
trigger: /* @__PURE__ */ e(
|
|
5155
|
+
trigger: /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(Qr, { size: "small" }) }),
|
|
5137
5156
|
children: /* @__PURE__ */ a(Xr, { onClick: (s) => {
|
|
5138
5157
|
s.preventDefault(), s.stopPropagation(), m(!0);
|
|
5139
5158
|
}, children: [
|
|
5140
|
-
/* @__PURE__ */ e(
|
|
5159
|
+
/* @__PURE__ */ e(pt, {}),
|
|
5141
5160
|
"Delete"
|
|
5142
5161
|
] })
|
|
5143
5162
|
}
|
|
5144
5163
|
),
|
|
5145
5164
|
d.editCollections && /* @__PURE__ */ e(
|
|
5146
|
-
|
|
5165
|
+
ne,
|
|
5147
5166
|
{
|
|
5148
5167
|
onClick: (s) => {
|
|
5149
5168
|
c();
|
|
5150
5169
|
},
|
|
5151
|
-
children: /* @__PURE__ */ e(
|
|
5170
|
+
children: /* @__PURE__ */ e($e, { size: "small" })
|
|
5152
5171
|
}
|
|
5153
5172
|
)
|
|
5154
5173
|
] }),
|
|
5155
5174
|
/* @__PURE__ */ e(
|
|
5156
|
-
|
|
5175
|
+
dt,
|
|
5157
5176
|
{
|
|
5158
5177
|
open: u,
|
|
5159
5178
|
onAccept: p,
|
|
@@ -5176,9 +5195,9 @@ function dn({
|
|
|
5176
5195
|
parentCollectionIds: l,
|
|
5177
5196
|
collection: o
|
|
5178
5197
|
}) {
|
|
5179
|
-
const d =
|
|
5180
|
-
return /* @__PURE__ */ e(
|
|
5181
|
-
|
|
5198
|
+
const d = Ne();
|
|
5199
|
+
return /* @__PURE__ */ e(ee, { title: "Edit", children: /* @__PURE__ */ e(
|
|
5200
|
+
ne,
|
|
5182
5201
|
{
|
|
5183
5202
|
className: r ? "bg-white dark:bg-gray-950" : "hidden",
|
|
5184
5203
|
onClick: () => {
|
|
@@ -5191,7 +5210,7 @@ function dn({
|
|
|
5191
5210
|
});
|
|
5192
5211
|
},
|
|
5193
5212
|
size: "small",
|
|
5194
|
-
children: /* @__PURE__ */ e(
|
|
5213
|
+
children: /* @__PURE__ */ e($e, { size: "small" })
|
|
5195
5214
|
}
|
|
5196
5215
|
) });
|
|
5197
5216
|
}
|
|
@@ -5200,11 +5219,11 @@ function cn({
|
|
|
5200
5219
|
parentCollectionIds: r,
|
|
5201
5220
|
collection: n
|
|
5202
5221
|
}) {
|
|
5203
|
-
const i =
|
|
5222
|
+
const i = Ie(), l = Ne(), o = l.configPermissions ? l.configPermissions({
|
|
5204
5223
|
user: i.user,
|
|
5205
5224
|
collection: n
|
|
5206
5225
|
}).editCollections : !0;
|
|
5207
|
-
return /* @__PURE__ */ e(
|
|
5226
|
+
return /* @__PURE__ */ e(ee, { title: o ? "Add new property" : "You don't have permission to add new properties", children: /* @__PURE__ */ e(
|
|
5208
5227
|
"div",
|
|
5209
5228
|
{
|
|
5210
5229
|
className: "p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-gray-100 bg-opacity-40 hover:bg-gray-100 dark:bg-gray-950 dark:bg-opacity-40 dark:hover:bg-gray-950",
|
|
@@ -5212,16 +5231,16 @@ function cn({
|
|
|
5212
5231
|
l.editProperty({
|
|
5213
5232
|
editedCollectionId: n.id,
|
|
5214
5233
|
parentCollectionIds: r,
|
|
5215
|
-
currentPropertiesOrder:
|
|
5234
|
+
currentPropertiesOrder: Ir(n),
|
|
5216
5235
|
collection: n
|
|
5217
5236
|
});
|
|
5218
5237
|
},
|
|
5219
|
-
children: /* @__PURE__ */ e(
|
|
5238
|
+
children: /* @__PURE__ */ e(de, { color: "inherit" })
|
|
5220
5239
|
}
|
|
5221
5240
|
) });
|
|
5222
5241
|
}
|
|
5223
5242
|
function un() {
|
|
5224
|
-
const t =
|
|
5243
|
+
const t = Ne();
|
|
5225
5244
|
return /* @__PURE__ */ e("div", { className: "bg-gray-50 dark:bg-gray-900 min-w-fit rounded", children: /* @__PURE__ */ a(
|
|
5226
5245
|
z,
|
|
5227
5246
|
{
|
|
@@ -5233,7 +5252,7 @@ function un() {
|
|
|
5233
5252
|
sourceClick: "new_collection_button"
|
|
5234
5253
|
}),
|
|
5235
5254
|
children: [
|
|
5236
|
-
/* @__PURE__ */ e(
|
|
5255
|
+
/* @__PURE__ */ e(de, {}),
|
|
5237
5256
|
"New collection"
|
|
5238
5257
|
]
|
|
5239
5258
|
}
|
|
@@ -5245,14 +5264,14 @@ function pn({
|
|
|
5245
5264
|
collection: n,
|
|
5246
5265
|
tableController: i
|
|
5247
5266
|
}) {
|
|
5248
|
-
const l =
|
|
5267
|
+
const l = Ie(), o = Ne(), d = gr(), c = Ve(), u = o.configPermissions ? o.configPermissions({
|
|
5249
5268
|
user: l.user,
|
|
5250
5269
|
collection: n
|
|
5251
5270
|
}).editCollections : !0;
|
|
5252
5271
|
let m = null;
|
|
5253
|
-
return (!
|
|
5272
|
+
return (!ve(lt(i.filterValues), lt(n.initialFilter)) || !ve(lt(i.sortBy), lt(n.initialSort))) && (m = /* @__PURE__ */ a(R, { children: [
|
|
5254
5273
|
/* @__PURE__ */ e(
|
|
5255
|
-
|
|
5274
|
+
ee,
|
|
5256
5275
|
{
|
|
5257
5276
|
title: i.sortBy || i.filterValues ? "Save default filter and sort" : "Clear default filter and sort",
|
|
5258
5277
|
children: /* @__PURE__ */ e(
|
|
@@ -5264,7 +5283,7 @@ function pn({
|
|
|
5264
5283
|
onClick: () => d?.saveCollection({
|
|
5265
5284
|
id: n.id,
|
|
5266
5285
|
parentCollectionIds: r,
|
|
5267
|
-
collectionData:
|
|
5286
|
+
collectionData: G(
|
|
5268
5287
|
n,
|
|
5269
5288
|
{
|
|
5270
5289
|
initialFilter: i.filterValues ?? null,
|
|
@@ -5283,7 +5302,7 @@ function pn({
|
|
|
5283
5302
|
}
|
|
5284
5303
|
),
|
|
5285
5304
|
(n.initialFilter || n.initialSort) && /* @__PURE__ */ e(
|
|
5286
|
-
|
|
5305
|
+
ee,
|
|
5287
5306
|
{
|
|
5288
5307
|
title: "Reset to default filter and sort",
|
|
5289
5308
|
children: /* @__PURE__ */ e(
|
|
@@ -5302,7 +5321,7 @@ function pn({
|
|
|
5302
5321
|
)
|
|
5303
5322
|
] })), /* @__PURE__ */ e(R, { children: u && m });
|
|
5304
5323
|
}
|
|
5305
|
-
function
|
|
5324
|
+
function lt(t) {
|
|
5306
5325
|
return t && Object.keys(t).length === 0 ? t : t ?? null;
|
|
5307
5326
|
}
|
|
5308
5327
|
function mn({
|
|
@@ -5311,13 +5330,13 @@ function mn({
|
|
|
5311
5330
|
}) {
|
|
5312
5331
|
if (!r.navigation.topLevelNavigation)
|
|
5313
5332
|
throw Error("Navigation not ready in FireCMSHomePage");
|
|
5314
|
-
const n =
|
|
5333
|
+
const n = Ie(), i = Ne(), l = i.configPermissions ? i.configPermissions({
|
|
5315
5334
|
user: n.user
|
|
5316
5335
|
}).createCollections : !0;
|
|
5317
5336
|
return /* @__PURE__ */ e(
|
|
5318
|
-
|
|
5337
|
+
tr,
|
|
5319
5338
|
{
|
|
5320
|
-
className:
|
|
5339
|
+
className: he("h-full p-4 min-h-[124px]"),
|
|
5321
5340
|
onClick: i && l ? () => i.createCollection({
|
|
5322
5341
|
initialValues: t ? { group: t } : void 0,
|
|
5323
5342
|
parentCollectionIds: [],
|
|
@@ -5329,7 +5348,7 @@ function mn({
|
|
|
5329
5348
|
{
|
|
5330
5349
|
className: "flex flex-col items-start h-full w-full items-center justify-center h-full w-full flex-grow flex-col",
|
|
5331
5350
|
children: [
|
|
5332
|
-
/* @__PURE__ */ e(
|
|
5351
|
+
/* @__PURE__ */ e(de, { color: "primary", size: "large" }),
|
|
5333
5352
|
/* @__PURE__ */ e(
|
|
5334
5353
|
V,
|
|
5335
5354
|
{
|
|
@@ -5393,11 +5412,11 @@ function hn({}) {
|
|
|
5393
5412
|
const t = Te();
|
|
5394
5413
|
if (!t.topLevelNavigation)
|
|
5395
5414
|
throw Error("Navigation not ready in FireCMSHomePage");
|
|
5396
|
-
const r =
|
|
5415
|
+
const r = Ie(), n = Ne(), i = n.configPermissions ? n.configPermissions({
|
|
5397
5416
|
user: r.user
|
|
5398
5417
|
}).createCollections : !0;
|
|
5399
5418
|
return !t.initialised || t.collections === void 0 || (t.collections ?? []).length > 0 ? null : /* @__PURE__ */ a(
|
|
5400
|
-
|
|
5419
|
+
fe,
|
|
5401
5420
|
{
|
|
5402
5421
|
className: "my-4 px-4 py-6 flex flex-col bg-white dark:bg-slate-800 gap-2",
|
|
5403
5422
|
children: [
|
|
@@ -5412,7 +5431,7 @@ function hn({}) {
|
|
|
5412
5431
|
sourceClick: "new_collection_card"
|
|
5413
5432
|
}) : void 0,
|
|
5414
5433
|
children: [
|
|
5415
|
-
/* @__PURE__ */ e(
|
|
5434
|
+
/* @__PURE__ */ e(de, {}),
|
|
5416
5435
|
"Create your first collection"
|
|
5417
5436
|
]
|
|
5418
5437
|
}
|
|
@@ -5424,16 +5443,16 @@ function hn({}) {
|
|
|
5424
5443
|
}
|
|
5425
5444
|
const In = (t, r, n) => {
|
|
5426
5445
|
const i = (d) => {
|
|
5427
|
-
|
|
5446
|
+
Le(d.properties), d.subcollections?.forEach(i);
|
|
5428
5447
|
}, l = r ?? [];
|
|
5429
5448
|
l.forEach(i), console.debug("Collections specified in code:", t), console.debug("Collections stored in the backend", l);
|
|
5430
|
-
const o =
|
|
5449
|
+
const o = _r(t, l, [], n);
|
|
5431
5450
|
return console.debug("Collections after joining:", o), o;
|
|
5432
5451
|
};
|
|
5433
5452
|
function _n({ path: t }) {
|
|
5434
|
-
const r = Te(), n = fn(t), i = r.getParentCollectionIds(t), l =
|
|
5453
|
+
const r = Te(), n = fn(t), i = r.getParentCollectionIds(t), l = Ne();
|
|
5435
5454
|
return /* @__PURE__ */ a("div", { className: "p-1 flex flex-col items-center", children: [
|
|
5436
|
-
/* @__PURE__ */ e(
|
|
5455
|
+
/* @__PURE__ */ e(Kt, { error: "No collection for path: " + n }),
|
|
5437
5456
|
/* @__PURE__ */ e(
|
|
5438
5457
|
z,
|
|
5439
5458
|
{
|
|
@@ -5442,7 +5461,7 @@ function _n({ path: t }) {
|
|
|
5442
5461
|
size: "small",
|
|
5443
5462
|
onClick: () => {
|
|
5444
5463
|
l.createCollection({
|
|
5445
|
-
initialValues: { path: n, name:
|
|
5464
|
+
initialValues: { path: n, name: xt(n) },
|
|
5446
5465
|
parentCollectionIds: i,
|
|
5447
5466
|
redirect: !1,
|
|
5448
5467
|
sourceClick: "missing_reference"
|
|
@@ -5459,16 +5478,16 @@ function fn(t) {
|
|
|
5459
5478
|
}
|
|
5460
5479
|
export {
|
|
5461
5480
|
_n as MissingReferenceWidget,
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5481
|
+
Ue as editableProperty,
|
|
5482
|
+
ie as getFullId,
|
|
5483
|
+
nr as getFullIdPath,
|
|
5484
|
+
me as idToPropertiesPath,
|
|
5466
5485
|
In as mergeCollections,
|
|
5467
|
-
|
|
5468
|
-
|
|
5486
|
+
ye as namespaceToPropertiesOrderPath,
|
|
5487
|
+
ir as namespaceToPropertiesPath,
|
|
5469
5488
|
wi as removeNonEditableProperties,
|
|
5470
|
-
|
|
5489
|
+
Ne as useCollectionEditorController,
|
|
5471
5490
|
Vn as useCollectionEditorPlugin,
|
|
5472
|
-
|
|
5491
|
+
gr as useCollectionsConfigController
|
|
5473
5492
|
};
|
|
5474
5493
|
//# sourceMappingURL=index.es.js.map
|