@firecms/collection_editor 3.0.0-alpha.72 → 3.0.0-alpha.73
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 +600 -594
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/ui/collection_editor/templates/pages_template.d.ts +2 -0
- package/package.json +5 -5
- package/src/ui/EditorCollectionAction.tsx +2 -2
- package/src/ui/PropertyAddColumnComponent.tsx +1 -1
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +11 -3
- package/src/ui/collection_editor/PropertyEditView.tsx +1 -1
- package/src/ui/collection_editor/templates/pages_template.ts +153 -0
package/dist/index.es.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsx as e, jsxs as l, Fragment as j } from "react/jsx-runtime";
|
|
2
|
-
import { getIconForView as dt, SearchIconsView as
|
|
2
|
+
import { getIconForView as dt, SearchIconsView as yr, toSnakeCase as wt, singular as br, FormikArrayContainer as Cr, SwitchControl as he, serializeRegExp as xr, isValidRegExp as Nr, useSnackbarController as De, resolveEnumValues as Pr, isPropertyBuilder as re, useFireCMSContext as Le, getFieldConfig as Qe, ErrorBoundary as we, FieldConfigBadge as We, unslugify as ft, useNavigationController as Me, mergeDeep as J, DEFAULT_FIELD_CONFIGS as Jt, getFieldId as Kt, DeleteConfirmationDialog as ut, useLargeLayout as wr, makePropertiesEditable as Xe, resolveEntityView as Or, useSelectionController as Tr, EntityCollectionTable as kr, slugify as Vr, useAuthController as qe, randomString as St, CircularProgressCenter as At, removeUndefined as Fr, ErrorView as Qt, removeInitialAndTrailingSlashes as Ir, getDefaultPropertiesOrder as Er, joinCollectionLists as _r } from "@firecms/core";
|
|
3
3
|
import * as je from "react";
|
|
4
|
-
import G, { useState as Y, useEffect as ue, useMemo as
|
|
4
|
+
import G, { useState as Y, useEffect as ue, useMemo as Wt, useCallback as Q, useRef as Je, useDeferredValue as Sr, useContext as Xt } from "react";
|
|
5
5
|
import pt from "react-fast-compare";
|
|
6
|
-
import { Typography as T, useAutoComplete as
|
|
7
|
-
import { useFormikContext as H, Field as ve, getIn as k, Formik as Vt, FastField as
|
|
6
|
+
import { Typography as T, useAutoComplete as Ar, Container as gt, Tooltip as ee, IconButton as se, Chip as mt, TextField as Ae, cn as Ce, DebouncedTextField as K, Autocomplete as Br, AutocompleteItem as Dr, ExpandablePanel as Tt, SettingsIcon as et, Select as Te, SelectItem as X, BooleanSwitchWithLabel as Ot, Dialog as ze, ListIcon as Mr, Button as R, CircularProgress as tt, AutoAwesomeIcon as vt, Paper as ke, DialogContent as Ye, DialogActions as Ge, RuleIcon as zr, FileUploadIcon as Rr, MultiSelect as Ur, MultiSelectItem as Bt, Checkbox as Dt, cardMixin as er, cardClickableMixin as tr, cardSelectedMixin as rr, FunctionsIcon as jr, RemoveCircleIcon as $r, defaultBorderMixin as kt, RemoveIcon as Lr, DragHandleIcon as qr, AddIcon as xe, SelectGroup as Mt, InfoLabel as ir, DeleteIcon as ht, ContentCopyIcon as Yr, CodeIcon as Gr, Table as zt, TableBody as Rt, TableRow as Ct, TableCell as Ze, Icon as xt, Card as nr, coolIconKeys as Ut, Tabs as Hr, Tab as Nt, ArrowBackIcon as lt, LoadingButton as jt, DoneIcon as Zr, UndoIcon as Jr, SaveIcon as Kr, Menu as Qr, MoreVertIcon as Wr, MenuItem as Xr, Collapse as ei } from "@firecms/ui";
|
|
7
|
+
import { useFormikContext as H, Field as ve, getIn as k, Formik as Vt, FastField as ae, Form as ti } from "formik";
|
|
8
8
|
import * as at from "yup";
|
|
9
|
-
import { extractEnumFromValues as
|
|
10
|
-
import { DragDropContext as
|
|
11
|
-
import
|
|
12
|
-
import { Highlight as
|
|
13
|
-
import { ImportFileUpload as
|
|
14
|
-
import { useNavigate as
|
|
15
|
-
const
|
|
9
|
+
import { extractEnumFromValues as ri, buildPropertyFromData as ii, buildEntityPropertiesFromData as ni } from "@firecms/schema_inference";
|
|
10
|
+
import { DragDropContext as oi, Droppable as li, Draggable as ai } from "@hello-pangea/dnd";
|
|
11
|
+
import si from "json5";
|
|
12
|
+
import { Highlight as ci, themes as di } from "prism-react-renderer";
|
|
13
|
+
import { ImportFileUpload as ui, DataNewPropertiesMapping as pi, ImportNewPropertyFieldPreview as mi, getInferenceType as or, getPropertiesMapping as hi, convertDataToEntity as fi, useImportConfig as gi, ImportSaveInProgress as vi } from "@firecms/data_import_export";
|
|
14
|
+
import { useNavigate as yi } from "react-router";
|
|
15
|
+
const bi = at.object().shape({
|
|
16
16
|
id: at.string().required("Required"),
|
|
17
17
|
name: at.string().required("Required"),
|
|
18
18
|
path: at.string().required("Required")
|
|
19
19
|
});
|
|
20
|
-
function
|
|
20
|
+
function W({
|
|
21
21
|
error: t,
|
|
22
22
|
children: r
|
|
23
23
|
}) {
|
|
24
24
|
return r ? /* @__PURE__ */ e(T, { variant: "caption", color: t ? "error" : "secondary", className: "ml-3.5 mt-0.5", children: r }) : null;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Ci({
|
|
27
27
|
isNewCollection: t,
|
|
28
28
|
reservedGroups: r,
|
|
29
29
|
existingPaths: i,
|
|
@@ -38,10 +38,10 @@ function bi({
|
|
|
38
38
|
touched: c,
|
|
39
39
|
errors: d,
|
|
40
40
|
setFieldTouched: y,
|
|
41
|
-
isSubmitting:
|
|
42
|
-
submitCount:
|
|
41
|
+
isSubmitting: g,
|
|
42
|
+
submitCount: v
|
|
43
43
|
} = H(), [N, x] = Y(!1), [P, h] = Y(!1), b = (V) => {
|
|
44
|
-
p("name", V), !k(c, "path") && t && V && p("path", wt(V)), !k(c, "id") && t && V && p("id", wt(V)), !k(c, "singularName") && t && V && p("singularName",
|
|
44
|
+
p("name", V), !k(c, "path") && t && V && p("path", wt(V)), !k(c, "id") && t && V && p("id", wt(V)), !k(c, "singularName") && t && V && p("singularName", br(V));
|
|
45
45
|
};
|
|
46
46
|
ue(() => {
|
|
47
47
|
d.id && h(!0);
|
|
@@ -49,12 +49,12 @@ function bi({
|
|
|
49
49
|
const C = dt(u), f = a?.filter((V) => !r?.includes(V)), {
|
|
50
50
|
inputFocused: I,
|
|
51
51
|
autoCompleteOpen: z,
|
|
52
|
-
setAutoCompleteOpen:
|
|
53
|
-
} =
|
|
52
|
+
setAutoCompleteOpen: _
|
|
53
|
+
} = Ar({
|
|
54
54
|
ref: s
|
|
55
55
|
}), F = !!o;
|
|
56
56
|
let U;
|
|
57
|
-
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ l(
|
|
57
|
+
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ l(gt, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
58
58
|
/* @__PURE__ */ l("div", { children: [
|
|
59
59
|
/* @__PURE__ */ l(
|
|
60
60
|
"div",
|
|
@@ -63,7 +63,7 @@ function bi({
|
|
|
63
63
|
children: [
|
|
64
64
|
/* @__PURE__ */ e(T, { variant: t ? "h4" : "h5", className: "flex-grow", children: t ? "New collection" : `${u?.name} collection` }),
|
|
65
65
|
/* @__PURE__ */ e(ee, { title: "Change icon", children: /* @__PURE__ */ e(
|
|
66
|
-
|
|
66
|
+
se,
|
|
67
67
|
{
|
|
68
68
|
shape: "square",
|
|
69
69
|
onClick: () => x(!0),
|
|
@@ -90,7 +90,7 @@ function bi({
|
|
|
90
90
|
error: c.name && !!d.name
|
|
91
91
|
}
|
|
92
92
|
),
|
|
93
|
-
/* @__PURE__ */ e(
|
|
93
|
+
/* @__PURE__ */ e(W, { error: c.name && !!d.name, children: c.name && d.name ? d.name : "Name of in this collection, usually a plural name (e.g. Products)" })
|
|
94
94
|
] }),
|
|
95
95
|
/* @__PURE__ */ l("div", { className: Ce("col-span-12 ", F ? "" : "sm:col-span-8"), children: [
|
|
96
96
|
/* @__PURE__ */ e(
|
|
@@ -104,14 +104,14 @@ function bi({
|
|
|
104
104
|
error: c.path && !!d.path
|
|
105
105
|
}
|
|
106
106
|
),
|
|
107
|
-
/* @__PURE__ */ e(
|
|
107
|
+
/* @__PURE__ */ e(W, { error: c.path && !!d.path, children: c.path && d.path ? d.path : F ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database" })
|
|
108
108
|
] }),
|
|
109
109
|
!F && /* @__PURE__ */ l("div", { className: "col-span-12 sm:col-span-4 relative", children: [
|
|
110
110
|
/* @__PURE__ */ e(
|
|
111
111
|
Ae,
|
|
112
112
|
{
|
|
113
113
|
error: c.group && !!d.group,
|
|
114
|
-
disabled:
|
|
114
|
+
disabled: g,
|
|
115
115
|
value: u.group ?? "",
|
|
116
116
|
autoComplete: "off",
|
|
117
117
|
onChange: (V) => p("group", V.target.value),
|
|
@@ -121,15 +121,15 @@ function bi({
|
|
|
121
121
|
}
|
|
122
122
|
),
|
|
123
123
|
/* @__PURE__ */ e(
|
|
124
|
-
|
|
124
|
+
Br,
|
|
125
125
|
{
|
|
126
126
|
open: z && (f ?? []).length > 0,
|
|
127
|
-
setOpen:
|
|
127
|
+
setOpen: _,
|
|
128
128
|
children: f?.map((V, O) => /* @__PURE__ */ e(
|
|
129
|
-
|
|
129
|
+
Dr,
|
|
130
130
|
{
|
|
131
131
|
onClick: () => {
|
|
132
|
-
|
|
132
|
+
_(!1), p("group", V ?? null);
|
|
133
133
|
},
|
|
134
134
|
children: /* @__PURE__ */ e("div", { className: "flex-grow", children: V })
|
|
135
135
|
},
|
|
@@ -137,7 +137,7 @@ function bi({
|
|
|
137
137
|
))
|
|
138
138
|
}
|
|
139
139
|
),
|
|
140
|
-
/* @__PURE__ */ e(
|
|
140
|
+
/* @__PURE__ */ e(W, { children: c.group && d.group ? d.group : "Group of the collection" })
|
|
141
141
|
] }),
|
|
142
142
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
143
143
|
Tt,
|
|
@@ -168,7 +168,7 @@ function bi({
|
|
|
168
168
|
error: c.id && !!d.id
|
|
169
169
|
}
|
|
170
170
|
),
|
|
171
|
-
/* @__PURE__ */ e(
|
|
171
|
+
/* @__PURE__ */ e(W, { error: c.id && !!d.id, children: c.id && d.id ? d.id : "This id identifies this collection" })
|
|
172
172
|
] }),
|
|
173
173
|
/* @__PURE__ */ l("div", { className: "col-span-12", children: [
|
|
174
174
|
/* @__PURE__ */ e(
|
|
@@ -182,7 +182,7 @@ function bi({
|
|
|
182
182
|
label: "Singular name"
|
|
183
183
|
}
|
|
184
184
|
),
|
|
185
|
-
/* @__PURE__ */ e(
|
|
185
|
+
/* @__PURE__ */ e(W, { error: c.singularName && !!d.singularName, children: c.singularName && d.singularName ? d.singularName : "Optionally define a singular name for your entities" })
|
|
186
186
|
] }),
|
|
187
187
|
/* @__PURE__ */ l("div", { className: "col-span-12", children: [
|
|
188
188
|
/* @__PURE__ */ e(
|
|
@@ -198,7 +198,7 @@ function bi({
|
|
|
198
198
|
label: "Description"
|
|
199
199
|
}
|
|
200
200
|
),
|
|
201
|
-
/* @__PURE__ */ e(
|
|
201
|
+
/* @__PURE__ */ e(W, { error: c.description && !!d.description, children: c.description && d.description ? d.description : "Description of the collection, you can use markdown" })
|
|
202
202
|
] }),
|
|
203
203
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
204
204
|
Te,
|
|
@@ -210,7 +210,7 @@ function bi({
|
|
|
210
210
|
value: u.defaultSize ?? "",
|
|
211
211
|
renderValue: (V) => V.toUpperCase(),
|
|
212
212
|
children: ["xs", "s", "m", "l", "xl"].map((V) => /* @__PURE__ */ e(
|
|
213
|
-
|
|
213
|
+
X,
|
|
214
214
|
{
|
|
215
215
|
value: V,
|
|
216
216
|
children: V.toUpperCase()
|
|
@@ -234,9 +234,9 @@ function bi({
|
|
|
234
234
|
value: "",
|
|
235
235
|
renderValue: (V) => V === "code_defined" ? "Code defined" : V === "true" ? "Users must define an ID" : V === "optional" ? "Users can define an ID, but it is not required" : "Document ID is generated automatically",
|
|
236
236
|
children: [
|
|
237
|
-
/* @__PURE__ */ e(
|
|
238
|
-
/* @__PURE__ */ e(
|
|
239
|
-
/* @__PURE__ */ e(
|
|
237
|
+
/* @__PURE__ */ e(X, { value: "false", children: "Document ID is generated automatically" }),
|
|
238
|
+
/* @__PURE__ */ e(X, { value: "true", children: "Users must define an ID" }),
|
|
239
|
+
/* @__PURE__ */ e(X, { value: "optional", children: "Users can define an ID, but it is not required" })
|
|
240
240
|
]
|
|
241
241
|
}
|
|
242
242
|
) }),
|
|
@@ -250,7 +250,7 @@ function bi({
|
|
|
250
250
|
value: u.collectionGroup ?? !1
|
|
251
251
|
}
|
|
252
252
|
),
|
|
253
|
-
/* @__PURE__ */ e(
|
|
253
|
+
/* @__PURE__ */ e(W, { children: "A collection group consists of all collections with the same path. This allows you to query over multiple collections at once." })
|
|
254
254
|
] }),
|
|
255
255
|
/* @__PURE__ */ l("div", { className: "col-span-12", children: [
|
|
256
256
|
/* @__PURE__ */ e(
|
|
@@ -262,7 +262,7 @@ function bi({
|
|
|
262
262
|
value: u.textSearchEnabled ?? !1
|
|
263
263
|
}
|
|
264
264
|
),
|
|
265
|
-
/* @__PURE__ */ e(
|
|
265
|
+
/* @__PURE__ */ e(W, { 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." })
|
|
266
266
|
] })
|
|
267
267
|
] })
|
|
268
268
|
}
|
|
@@ -277,7 +277,7 @@ function bi({
|
|
|
277
277
|
maxWidth: "xl",
|
|
278
278
|
fullWidth: !0,
|
|
279
279
|
children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
|
|
280
|
-
|
|
280
|
+
yr,
|
|
281
281
|
{
|
|
282
282
|
selectedIcon: u.icon,
|
|
283
283
|
onIconSelected: (V) => {
|
|
@@ -292,16 +292,16 @@ function bi({
|
|
|
292
292
|
function be(t) {
|
|
293
293
|
return "properties." + t.replaceAll(".", ".properties.");
|
|
294
294
|
}
|
|
295
|
-
function
|
|
295
|
+
function xi(t) {
|
|
296
296
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
|
|
297
297
|
}
|
|
298
298
|
function Oe(t) {
|
|
299
299
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".propertiesOrder" : "propertiesOrder";
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function le(t, r) {
|
|
302
302
|
return r ? `${r}.${t}` : t;
|
|
303
303
|
}
|
|
304
|
-
const
|
|
304
|
+
const Ni = G.memo(
|
|
305
305
|
function({
|
|
306
306
|
enumValues: r,
|
|
307
307
|
onValuesChanged: i,
|
|
@@ -326,7 +326,7 @@ const xi = G.memo(
|
|
|
326
326
|
}, [p.enumValues]), ue(() => {
|
|
327
327
|
n && n(!!(m?.enumValues ?? !1));
|
|
328
328
|
}, [m]), /* @__PURE__ */ e(
|
|
329
|
-
|
|
329
|
+
Pi,
|
|
330
330
|
{
|
|
331
331
|
enumValuesPath: "enumValues",
|
|
332
332
|
values: p,
|
|
@@ -344,7 +344,7 @@ const xi = G.memo(
|
|
|
344
344
|
return r.enumValues.length === i.enumValues.length && r.onValuesChanged === i.onValuesChanged && r.getData === i.getData;
|
|
345
345
|
}
|
|
346
346
|
);
|
|
347
|
-
function
|
|
347
|
+
function Pi({
|
|
348
348
|
values: t,
|
|
349
349
|
errors: r,
|
|
350
350
|
disabled: i,
|
|
@@ -355,10 +355,10 @@ function Ni({
|
|
|
355
355
|
}) {
|
|
356
356
|
const {
|
|
357
357
|
setFieldValue: u
|
|
358
|
-
} = H(), [p, m] = G.useState(), [c, d] = G.useState(), [y,
|
|
358
|
+
} = H(), [p, m] = G.useState(), [c, d] = G.useState(), [y, g] = G.useState(!1), N = G.useRef(/* @__PURE__ */ new Set()).current, x = (h, b) => {
|
|
359
359
|
const C = p === b;
|
|
360
360
|
return /* @__PURE__ */ e(
|
|
361
|
-
|
|
361
|
+
wi,
|
|
362
362
|
{
|
|
363
363
|
index: h,
|
|
364
364
|
disabled: i,
|
|
@@ -373,7 +373,7 @@ function Ni({
|
|
|
373
373
|
};
|
|
374
374
|
return /* @__PURE__ */ l("div", { className: "col-span-12", children: [
|
|
375
375
|
/* @__PURE__ */ l("div", { className: "ml-3.5 flex flex-row items-center", children: [
|
|
376
|
-
/* @__PURE__ */ e(
|
|
376
|
+
/* @__PURE__ */ e(Mr, {}),
|
|
377
377
|
/* @__PURE__ */ e(
|
|
378
378
|
T,
|
|
379
379
|
{
|
|
@@ -390,19 +390,19 @@ function Ni({
|
|
|
390
390
|
variant: "text",
|
|
391
391
|
size: "small",
|
|
392
392
|
onClick: async () => {
|
|
393
|
-
s && (
|
|
393
|
+
s && (g(!0), s?.().then((h) => {
|
|
394
394
|
if (!h)
|
|
395
395
|
return;
|
|
396
|
-
const b = h.flat(), C = Array.from(new Set(b)), f = t.enumValues, z =
|
|
397
|
-
z.forEach((
|
|
398
|
-
N.add(
|
|
396
|
+
const b = h.flat(), C = Array.from(new Set(b)), f = t.enumValues, z = ri(C).filter((_) => !f?.some((F) => F.id === _.id));
|
|
397
|
+
z.forEach((_) => {
|
|
398
|
+
N.add(_.id);
|
|
399
399
|
}), u(n, [...z, ...f]);
|
|
400
400
|
}).catch((h) => {
|
|
401
401
|
console.error(h);
|
|
402
|
-
}).finally(() =>
|
|
402
|
+
}).finally(() => g(!1)));
|
|
403
403
|
},
|
|
404
404
|
children: [
|
|
405
|
-
y ? /* @__PURE__ */ e(tt, { size: "small" }) : /* @__PURE__ */ e(
|
|
405
|
+
y ? /* @__PURE__ */ e(tt, { size: "small" }) : /* @__PURE__ */ e(vt, {}),
|
|
406
406
|
"Infer values from data"
|
|
407
407
|
]
|
|
408
408
|
}
|
|
@@ -410,7 +410,7 @@ function Ni({
|
|
|
410
410
|
] }),
|
|
411
411
|
/* @__PURE__ */ l(ke, { className: "p-4 m-1", children: [
|
|
412
412
|
/* @__PURE__ */ e(
|
|
413
|
-
|
|
413
|
+
Cr,
|
|
414
414
|
{
|
|
415
415
|
value: t.enumValues,
|
|
416
416
|
addLabel: "Add enum value",
|
|
@@ -424,7 +424,7 @@ function Ni({
|
|
|
424
424
|
}
|
|
425
425
|
),
|
|
426
426
|
/* @__PURE__ */ e(
|
|
427
|
-
|
|
427
|
+
Oi,
|
|
428
428
|
{
|
|
429
429
|
index: c,
|
|
430
430
|
open: c !== void 0,
|
|
@@ -435,7 +435,7 @@ function Ni({
|
|
|
435
435
|
] })
|
|
436
436
|
] });
|
|
437
437
|
}
|
|
438
|
-
const
|
|
438
|
+
const wi = G.memo(
|
|
439
439
|
function({
|
|
440
440
|
index: r,
|
|
441
441
|
shouldUpdateId: i,
|
|
@@ -451,12 +451,12 @@ const Pi = G.memo(
|
|
|
451
451
|
errors: c,
|
|
452
452
|
setFieldValue: d,
|
|
453
453
|
touched: y
|
|
454
|
-
} = H(),
|
|
454
|
+
} = H(), g = G.useRef(!k(p, `${n}[${r}].id`)), v = i || g.current, N = k(p, `${n}[${r}].id`), x = k(p, `${n}[${r}].label`), P = k(c, `${n}[${r}].label`), h = G.useRef(x);
|
|
455
455
|
return G.useEffect(() => {
|
|
456
|
-
(h.current === N || !N) &&
|
|
456
|
+
(h.current === N || !N) && v && d(`${n}[${r}].id`, x), h.current = x;
|
|
457
457
|
}, [x]), /* @__PURE__ */ l("div", { className: "flex w-full align-center justify-center", children: [
|
|
458
458
|
/* @__PURE__ */ e(
|
|
459
|
-
|
|
459
|
+
ae,
|
|
460
460
|
{
|
|
461
461
|
name: `${n}[${r}].label`,
|
|
462
462
|
as: K,
|
|
@@ -464,15 +464,15 @@ const Pi = G.memo(
|
|
|
464
464
|
required: !0,
|
|
465
465
|
disabled: s,
|
|
466
466
|
size: "small",
|
|
467
|
-
validate:
|
|
467
|
+
validate: Ti,
|
|
468
468
|
autoFocus: a,
|
|
469
469
|
autoComplete: "off",
|
|
470
|
-
endAdornment: u && /* @__PURE__ */ e(
|
|
470
|
+
endAdornment: u && /* @__PURE__ */ e(vt, { size: "small" }),
|
|
471
471
|
error: !!P
|
|
472
472
|
}
|
|
473
473
|
),
|
|
474
474
|
!s && /* @__PURE__ */ e(
|
|
475
|
-
|
|
475
|
+
se,
|
|
476
476
|
{
|
|
477
477
|
size: "small",
|
|
478
478
|
"aria-label": "edit",
|
|
@@ -487,7 +487,7 @@ const Pi = G.memo(
|
|
|
487
487
|
return r.index === i.index && r.enumValuesPath === i.enumValuesPath && r.shouldUpdateId === i.shouldUpdateId && r.inferredEntry === i.inferredEntry && r.autoFocus === i.autoFocus;
|
|
488
488
|
}
|
|
489
489
|
);
|
|
490
|
-
function
|
|
490
|
+
function Oi({
|
|
491
491
|
index: t,
|
|
492
492
|
open: r,
|
|
493
493
|
onClose: i,
|
|
@@ -510,19 +510,19 @@ function wi({
|
|
|
510
510
|
children: [
|
|
511
511
|
/* @__PURE__ */ e(Ye, { children: t !== void 0 && /* @__PURE__ */ l("div", { children: [
|
|
512
512
|
/* @__PURE__ */ e(
|
|
513
|
-
|
|
513
|
+
ae,
|
|
514
514
|
{
|
|
515
515
|
name: `${n}[${t}]id`,
|
|
516
516
|
as: K,
|
|
517
517
|
required: !0,
|
|
518
|
-
validate:
|
|
518
|
+
validate: ki,
|
|
519
519
|
label: "ID",
|
|
520
520
|
size: "small",
|
|
521
521
|
autoComplete: "off",
|
|
522
522
|
error: !!m
|
|
523
523
|
}
|
|
524
524
|
),
|
|
525
|
-
/* @__PURE__ */ e(
|
|
525
|
+
/* @__PURE__ */ e(W, { error: !!m, children: m ?? "Value saved in the data source" })
|
|
526
526
|
] }) }),
|
|
527
527
|
/* @__PURE__ */ e(Ge, { children: /* @__PURE__ */ e(
|
|
528
528
|
R,
|
|
@@ -538,11 +538,11 @@ function wi({
|
|
|
538
538
|
}
|
|
539
539
|
);
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function Ti(t) {
|
|
542
542
|
let r;
|
|
543
543
|
return t || (r = "You must specify a label"), r;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function ki(t) {
|
|
546
546
|
let r;
|
|
547
547
|
return t || (r = "You must specify an ID"), r;
|
|
548
548
|
}
|
|
@@ -550,7 +550,7 @@ function Re({ disabled: t }) {
|
|
|
550
550
|
const { values: r, handleChange: i } = H(), n = "validation.required", a = "validation.requiredMessage";
|
|
551
551
|
return /* @__PURE__ */ l(j, { children: [
|
|
552
552
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
553
|
-
|
|
553
|
+
ae,
|
|
554
554
|
{
|
|
555
555
|
type: "checkbox",
|
|
556
556
|
disabled: t,
|
|
@@ -561,7 +561,7 @@ function Re({ disabled: t }) {
|
|
|
561
561
|
}
|
|
562
562
|
) }),
|
|
563
563
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
564
|
-
|
|
564
|
+
ae,
|
|
565
565
|
{
|
|
566
566
|
type: "checkbox",
|
|
567
567
|
disabled: t,
|
|
@@ -599,12 +599,12 @@ function $e({
|
|
|
599
599
|
values: m,
|
|
600
600
|
handleChange: c,
|
|
601
601
|
errors: d
|
|
602
|
-
} = H(), y = "validation.length",
|
|
602
|
+
} = H(), y = "validation.length", g = "validation.min", v = "validation.max", N = "validation.trim", x = "validation.matches", P = "validation.lowercase", h = "validation.uppercase", b = k(d, x), C = k(m, x), f = typeof C == "string" ? C : xr(C);
|
|
603
603
|
return /* @__PURE__ */ l("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
604
604
|
/* @__PURE__ */ e(Re, { disabled: u }),
|
|
605
605
|
/* @__PURE__ */ l("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
606
606
|
r && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
607
|
-
|
|
607
|
+
ae,
|
|
608
608
|
{
|
|
609
609
|
type: "checkbox",
|
|
610
610
|
name: P,
|
|
@@ -614,7 +614,7 @@ function $e({
|
|
|
614
614
|
}
|
|
615
615
|
) }),
|
|
616
616
|
s && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
617
|
-
|
|
617
|
+
ae,
|
|
618
618
|
{
|
|
619
619
|
type: "checkbox",
|
|
620
620
|
name: h,
|
|
@@ -624,7 +624,7 @@ function $e({
|
|
|
624
624
|
}
|
|
625
625
|
) }),
|
|
626
626
|
o && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
627
|
-
|
|
627
|
+
ae,
|
|
628
628
|
{
|
|
629
629
|
type: "checkbox",
|
|
630
630
|
name: N,
|
|
@@ -650,9 +650,9 @@ function $e({
|
|
|
650
650
|
a && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
651
651
|
K,
|
|
652
652
|
{
|
|
653
|
-
value: k(m,
|
|
653
|
+
value: k(m, g),
|
|
654
654
|
label: "Min length",
|
|
655
|
-
name:
|
|
655
|
+
name: g,
|
|
656
656
|
type: "number",
|
|
657
657
|
size: "small",
|
|
658
658
|
disabled: u,
|
|
@@ -662,9 +662,9 @@ function $e({
|
|
|
662
662
|
n && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
663
663
|
K,
|
|
664
664
|
{
|
|
665
|
-
value: k(m,
|
|
665
|
+
value: k(m, v),
|
|
666
666
|
label: "Max length",
|
|
667
|
-
name:
|
|
667
|
+
name: v,
|
|
668
668
|
type: "number",
|
|
669
669
|
size: "small",
|
|
670
670
|
disabled: u,
|
|
@@ -674,11 +674,11 @@ function $e({
|
|
|
674
674
|
] }),
|
|
675
675
|
i && /* @__PURE__ */ l("div", { className: "col-span-12", children: [
|
|
676
676
|
/* @__PURE__ */ e(
|
|
677
|
-
|
|
677
|
+
ae,
|
|
678
678
|
{
|
|
679
679
|
name: x,
|
|
680
680
|
as: K,
|
|
681
|
-
validate: (I) => I && !
|
|
681
|
+
validate: (I) => I && !Nr(I),
|
|
682
682
|
label: "Matches regex",
|
|
683
683
|
size: "small",
|
|
684
684
|
disabled: u,
|
|
@@ -686,7 +686,7 @@ function $e({
|
|
|
686
686
|
error: !!b
|
|
687
687
|
}
|
|
688
688
|
),
|
|
689
|
-
/* @__PURE__ */ e(
|
|
689
|
+
/* @__PURE__ */ e(W, { error: !!b, children: b ? "Not a valid regexp" : "e.g. /^\\d+$/ for digits only" })
|
|
690
690
|
] })
|
|
691
691
|
] });
|
|
692
692
|
}
|
|
@@ -737,7 +737,7 @@ function Ve({
|
|
|
737
737
|
asField: !0,
|
|
738
738
|
className: "p-4",
|
|
739
739
|
title: /* @__PURE__ */ l("div", { className: "flex flex-row text-gray-500", children: [
|
|
740
|
-
/* @__PURE__ */ e(
|
|
740
|
+
/* @__PURE__ */ e(zr, {}),
|
|
741
741
|
/* @__PURE__ */ e(
|
|
742
742
|
T,
|
|
743
743
|
{
|
|
@@ -751,7 +751,7 @@ function Ve({
|
|
|
751
751
|
}
|
|
752
752
|
);
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function $t({
|
|
755
755
|
multiselect: t,
|
|
756
756
|
updateIds: r,
|
|
757
757
|
disabled: i,
|
|
@@ -766,23 +766,23 @@ function Lt({
|
|
|
766
766
|
touched: m,
|
|
767
767
|
setFieldError: c,
|
|
768
768
|
setFieldValue: d
|
|
769
|
-
} = H(), y = De(),
|
|
769
|
+
} = H(), y = De(), g = t ? "of.enumValues" : "enumValues", v = k(s, "defaultValue"), N = k(s, g), x = Wt(() => !N || typeof N == "boolean" ? [] : Pr(N) ?? [], [N]);
|
|
770
770
|
return /* @__PURE__ */ l(j, { children: [
|
|
771
771
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
772
|
-
|
|
772
|
+
Ni,
|
|
773
773
|
{
|
|
774
774
|
enumValues: x,
|
|
775
775
|
updateIds: r,
|
|
776
776
|
disabled: i,
|
|
777
777
|
allowDataInference: a,
|
|
778
778
|
onError: (h) => {
|
|
779
|
-
c(
|
|
779
|
+
c(g, h ? "" : void 0);
|
|
780
780
|
},
|
|
781
781
|
getData: o ? () => o().then((h) => h.map((b) => s.id && k(b, s.id)).filter(Boolean)) : void 0,
|
|
782
782
|
onValuesChanged: (h) => {
|
|
783
|
-
if (s && (d(
|
|
783
|
+
if (s && (d(g, h), !t)) {
|
|
784
784
|
const b = h.filter((C) => !!C?.id).map((C) => C.id);
|
|
785
|
-
|
|
785
|
+
v && !b.includes(v) && (d("defaultValue", void 0), y.open({
|
|
786
786
|
type: "warning",
|
|
787
787
|
message: "Default value was cleared"
|
|
788
788
|
}));
|
|
@@ -809,9 +809,9 @@ function Lt({
|
|
|
809
809
|
d("defaultValue", h);
|
|
810
810
|
},
|
|
811
811
|
label: "Default value",
|
|
812
|
-
value:
|
|
812
|
+
value: v ?? "",
|
|
813
813
|
children: x.filter((h) => !!h?.id).map((h) => /* @__PURE__ */ e(
|
|
814
|
-
|
|
814
|
+
X,
|
|
815
815
|
{
|
|
816
816
|
value: h.id?.toString(),
|
|
817
817
|
children: h.label
|
|
@@ -829,7 +829,7 @@ const st = {
|
|
|
829
829
|
"application/*": "Files (pdf, zip, csv, excel...)",
|
|
830
830
|
"text/*": "Text files"
|
|
831
831
|
};
|
|
832
|
-
function
|
|
832
|
+
function Lt({
|
|
833
833
|
multiple: t,
|
|
834
834
|
existing: r,
|
|
835
835
|
disabled: i
|
|
@@ -837,15 +837,15 @@ function qt({
|
|
|
837
837
|
const {
|
|
838
838
|
values: n,
|
|
839
839
|
setFieldValue: a
|
|
840
|
-
} = H(), o = t ? "of.storage" : "storage", s = `${o}.acceptedFiles`, u = `${o}.fileName`, p = `${o}.storagePath`, m = `${o}.storeUrl`, c = k(n, u) ?? "{rand}_{file}", d = k(n, p) ?? "/", y = k(n, s),
|
|
841
|
-
h ? h.includes("all") || h.length >= Object.keys(st).length ? a(s, void 0) :
|
|
840
|
+
} = H(), o = t ? "of.storage" : "storage", s = `${o}.acceptedFiles`, u = `${o}.fileName`, p = `${o}.storagePath`, m = `${o}.storeUrl`, c = k(n, u) ?? "{rand}_{file}", d = k(n, p) ?? "/", y = k(n, s), g = Array.isArray(y) ? y : void 0, v = !g || g.length === 0, N = (h) => {
|
|
841
|
+
h ? h.includes("all") || h.length >= Object.keys(st).length ? a(s, void 0) : v ? a(s, Object.keys(st).filter((b) => !h.includes(b))) : a(s, h) : a(s, void 0);
|
|
842
842
|
}, x = typeof c == "function", P = typeof d == "function";
|
|
843
843
|
return /* @__PURE__ */ l(j, { children: [
|
|
844
844
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
845
845
|
Tt,
|
|
846
846
|
{
|
|
847
847
|
title: /* @__PURE__ */ l("div", { className: "flex flex-row text-gray-500", children: [
|
|
848
|
-
/* @__PURE__ */ e(
|
|
848
|
+
/* @__PURE__ */ e(Rr, {}),
|
|
849
849
|
/* @__PURE__ */ e(
|
|
850
850
|
T,
|
|
851
851
|
{
|
|
@@ -857,20 +857,20 @@ function qt({
|
|
|
857
857
|
] }),
|
|
858
858
|
children: /* @__PURE__ */ l("div", { className: "grid grid-cols-12 gap-2 p-4", children: [
|
|
859
859
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ l(
|
|
860
|
-
|
|
860
|
+
Ur,
|
|
861
861
|
{
|
|
862
862
|
disabled: i,
|
|
863
863
|
name: s,
|
|
864
|
-
value:
|
|
864
|
+
value: g ?? [],
|
|
865
865
|
onMultiValueChange: N,
|
|
866
|
-
label:
|
|
866
|
+
label: v ? void 0 : "Allowed file types",
|
|
867
867
|
renderValues: (h) => !h || h.length === 0 ? "All file types allowed" : h.map((b) => st[b]).filter((b) => !!b).join(", "),
|
|
868
868
|
children: [
|
|
869
869
|
/* @__PURE__ */ l(Bt, { value: "all", className: "flex items-center gap-2", children: [
|
|
870
870
|
/* @__PURE__ */ e(
|
|
871
871
|
Dt,
|
|
872
872
|
{
|
|
873
|
-
checked: !
|
|
873
|
+
checked: !g
|
|
874
874
|
}
|
|
875
875
|
),
|
|
876
876
|
"All"
|
|
@@ -879,7 +879,7 @@ function qt({
|
|
|
879
879
|
/* @__PURE__ */ e(
|
|
880
880
|
Dt,
|
|
881
881
|
{
|
|
882
|
-
checked:
|
|
882
|
+
checked: v || g.indexOf(h) > -1
|
|
883
883
|
}
|
|
884
884
|
),
|
|
885
885
|
/* @__PURE__ */ e("div", { className: "flex-grow", children: b }),
|
|
@@ -961,19 +961,19 @@ function Ke(t) {
|
|
|
961
961
|
return r.dataType === "array" && typeof r.of == "function" || r.dataType === "array" && Array.isArray(r.of) ? !1 : !!r.editable;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function Vi(t) {
|
|
965
965
|
return Object.entries(t).filter(([r, i]) => Ke(i)).map(([r, i]) => {
|
|
966
966
|
const n = i;
|
|
967
967
|
if (Ke(n))
|
|
968
968
|
return n.dataType === "map" && n.properties ? {
|
|
969
969
|
[r]: {
|
|
970
970
|
...n,
|
|
971
|
-
properties:
|
|
971
|
+
properties: Vi(n.properties)
|
|
972
972
|
}
|
|
973
973
|
} : { [r]: n };
|
|
974
974
|
}).filter((r) => !!r).reduce((r, i) => ({ ...r, ...i }), {});
|
|
975
975
|
}
|
|
976
|
-
function
|
|
976
|
+
function lr({
|
|
977
977
|
property: t,
|
|
978
978
|
onClick: r,
|
|
979
979
|
hasError: i,
|
|
@@ -994,9 +994,9 @@ function ar({
|
|
|
994
994
|
{
|
|
995
995
|
className: Ce(
|
|
996
996
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
997
|
-
|
|
998
|
-
r ?
|
|
999
|
-
o ?
|
|
997
|
+
er,
|
|
998
|
+
r ? tr : "",
|
|
999
|
+
o ? rr : "",
|
|
1000
1000
|
"flex-grow p-4 border transition-colors duration-200",
|
|
1001
1001
|
i ? "border-red-500" : o ? "border-blue-500" : "border-transparent"
|
|
1002
1002
|
),
|
|
@@ -1041,7 +1041,7 @@ function ar({
|
|
|
1041
1041
|
}
|
|
1042
1042
|
) });
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1044
|
+
function Fi({
|
|
1045
1045
|
name: t,
|
|
1046
1046
|
selected: r,
|
|
1047
1047
|
onClick: i,
|
|
@@ -1060,19 +1060,19 @@ function Vi({
|
|
|
1060
1060
|
"div",
|
|
1061
1061
|
{
|
|
1062
1062
|
className: "h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500",
|
|
1063
|
-
children: /* @__PURE__ */ e(
|
|
1063
|
+
children: /* @__PURE__ */ e(jr, { color: "inherit", size: "medium" })
|
|
1064
1064
|
}
|
|
1065
1065
|
),
|
|
1066
|
-
/* @__PURE__ */ e(
|
|
1066
|
+
/* @__PURE__ */ e($r, { color: "disabled", size: "small", className: "absolute -right-2 -top-2" })
|
|
1067
1067
|
] }),
|
|
1068
1068
|
/* @__PURE__ */ e(
|
|
1069
1069
|
ke,
|
|
1070
1070
|
{
|
|
1071
1071
|
className: Ce(
|
|
1072
1072
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1073
|
-
|
|
1074
|
-
i ?
|
|
1075
|
-
r ?
|
|
1073
|
+
er,
|
|
1074
|
+
i ? tr : "",
|
|
1075
|
+
r ? rr : "",
|
|
1076
1076
|
"flex-grow p-4 border transition-colors duration-200",
|
|
1077
1077
|
r ? "border-blue-500" : "border-transparent"
|
|
1078
1078
|
),
|
|
@@ -1146,28 +1146,28 @@ function yt({
|
|
|
1146
1146
|
inferredPropertyKeys: c,
|
|
1147
1147
|
collectionEditable: d
|
|
1148
1148
|
}) {
|
|
1149
|
-
const y = a ?? Object.keys(n),
|
|
1150
|
-
if (!
|
|
1149
|
+
const y = a ?? Object.keys(n), g = Q((v) => {
|
|
1150
|
+
if (!v.destination)
|
|
1151
1151
|
return;
|
|
1152
|
-
const N =
|
|
1152
|
+
const N = v.source.index, x = v.destination.index, P = Array.from(y), [h] = P.splice(N, 1);
|
|
1153
1153
|
P.splice(x, 0, h), u && u(P, t);
|
|
1154
1154
|
}, [t, u, y]);
|
|
1155
|
-
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
|
|
1155
|
+
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(oi, { onDragEnd: g, children: /* @__PURE__ */ e(li, { droppableId: `droppable_${t}`, children: (v, N) => /* @__PURE__ */ l(
|
|
1156
1156
|
"div",
|
|
1157
1157
|
{
|
|
1158
|
-
...
|
|
1159
|
-
ref:
|
|
1158
|
+
...v.droppableProps,
|
|
1159
|
+
ref: v.innerRef,
|
|
1160
1160
|
className: m,
|
|
1161
1161
|
children: [
|
|
1162
1162
|
y && y.map((x, P) => {
|
|
1163
1163
|
const h = n[x], b = o?.find((C) => C.key === x);
|
|
1164
1164
|
return !h && !b ? (console.warn(`Property ${x} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
1165
|
-
|
|
1165
|
+
ai,
|
|
1166
1166
|
{
|
|
1167
1167
|
draggableId: `array_field_${t}_${x}}`,
|
|
1168
1168
|
index: P,
|
|
1169
1169
|
children: (C, f) => /* @__PURE__ */ e(we, { children: /* @__PURE__ */ e(
|
|
1170
|
-
|
|
1170
|
+
Ii,
|
|
1171
1171
|
{
|
|
1172
1172
|
propertyKey: x,
|
|
1173
1173
|
propertyOrBuilder: h,
|
|
@@ -1187,12 +1187,12 @@ function yt({
|
|
|
1187
1187
|
`array_field_${t}_${x}}`
|
|
1188
1188
|
);
|
|
1189
1189
|
}).filter(Boolean),
|
|
1190
|
-
|
|
1190
|
+
v.placeholder
|
|
1191
1191
|
]
|
|
1192
1192
|
}
|
|
1193
1193
|
) }) }) });
|
|
1194
1194
|
}
|
|
1195
|
-
function
|
|
1195
|
+
function Ii({
|
|
1196
1196
|
propertyKey: t,
|
|
1197
1197
|
namespace: r,
|
|
1198
1198
|
propertyOrBuilder: i,
|
|
@@ -1206,15 +1206,15 @@ function Fi({
|
|
|
1206
1206
|
inferredPropertyKeys: c,
|
|
1207
1207
|
collectionEditable: d
|
|
1208
1208
|
}) {
|
|
1209
|
-
const y = c?.includes(r ? `${r}.${t}` : t),
|
|
1210
|
-
let
|
|
1209
|
+
const y = c?.includes(r ? `${r}.${t}` : t), g = le(t, r);
|
|
1210
|
+
let v;
|
|
1211
1211
|
if (typeof i == "object") {
|
|
1212
1212
|
const h = i;
|
|
1213
|
-
h.dataType === "map" && h.properties && (
|
|
1213
|
+
h.dataType === "map" && h.properties && (v = /* @__PURE__ */ e(
|
|
1214
1214
|
yt,
|
|
1215
1215
|
{
|
|
1216
1216
|
selectedPropertyKey: o,
|
|
1217
|
-
namespace:
|
|
1217
|
+
namespace: g,
|
|
1218
1218
|
properties: h.properties,
|
|
1219
1219
|
propertiesOrder: h.propertiesOrder,
|
|
1220
1220
|
errors: s,
|
|
@@ -1225,7 +1225,7 @@ function Fi({
|
|
|
1225
1225
|
}
|
|
1226
1226
|
));
|
|
1227
1227
|
}
|
|
1228
|
-
const N =
|
|
1228
|
+
const N = g ? k(s, be(g)) : !1, x = o === g, P = i && (d && !re(i) || Ke(i));
|
|
1229
1229
|
return /* @__PURE__ */ l(
|
|
1230
1230
|
"div",
|
|
1231
1231
|
{
|
|
@@ -1234,7 +1234,7 @@ function Fi({
|
|
|
1234
1234
|
...a.dragHandleProps,
|
|
1235
1235
|
className: "relative -ml-8",
|
|
1236
1236
|
children: [
|
|
1237
|
-
|
|
1237
|
+
v && /* @__PURE__ */ e(
|
|
1238
1238
|
"div",
|
|
1239
1239
|
{
|
|
1240
1240
|
className: "absolute border-l " + kt,
|
|
@@ -1246,7 +1246,7 @@ function Fi({
|
|
|
1246
1246
|
}
|
|
1247
1247
|
),
|
|
1248
1248
|
!re(i) && !n && P ? /* @__PURE__ */ e(
|
|
1249
|
-
|
|
1249
|
+
lr,
|
|
1250
1250
|
{
|
|
1251
1251
|
property: i,
|
|
1252
1252
|
onClick: u ? () => u(t, r) : void 0,
|
|
@@ -1255,7 +1255,7 @@ function Fi({
|
|
|
1255
1255
|
hasError: N
|
|
1256
1256
|
}
|
|
1257
1257
|
) : /* @__PURE__ */ e(
|
|
1258
|
-
|
|
1258
|
+
Fi,
|
|
1259
1259
|
{
|
|
1260
1260
|
name: t,
|
|
1261
1261
|
property: i,
|
|
@@ -1264,35 +1264,35 @@ function Fi({
|
|
|
1264
1264
|
}
|
|
1265
1265
|
),
|
|
1266
1266
|
/* @__PURE__ */ l("div", { className: "absolute top-2 right-2 flex flex-row ", children: [
|
|
1267
|
-
y && /* @__PURE__ */ e(ee, { title: "Inferred property", children: /* @__PURE__ */ e(
|
|
1267
|
+
y && /* @__PURE__ */ e(ee, { title: "Inferred property", children: /* @__PURE__ */ e(vt, { size: "small", className: "p-2" }) }),
|
|
1268
1268
|
m && /* @__PURE__ */ e(ee, { title: "Remove", children: /* @__PURE__ */ e(
|
|
1269
|
-
|
|
1269
|
+
se,
|
|
1270
1270
|
{
|
|
1271
1271
|
size: "small",
|
|
1272
1272
|
color: "inherit",
|
|
1273
1273
|
onClick: () => m(t, r),
|
|
1274
|
-
children: /* @__PURE__ */ e(
|
|
1274
|
+
children: /* @__PURE__ */ e(Lr, { size: "small" })
|
|
1275
1275
|
}
|
|
1276
1276
|
) }),
|
|
1277
1277
|
p && /* @__PURE__ */ e(ee, { title: "Move", children: /* @__PURE__ */ e(
|
|
1278
|
-
|
|
1278
|
+
se,
|
|
1279
1279
|
{
|
|
1280
1280
|
component: "span",
|
|
1281
1281
|
size: "small",
|
|
1282
|
-
children: /* @__PURE__ */ e(
|
|
1282
|
+
children: /* @__PURE__ */ e(qr, { size: "small" })
|
|
1283
1283
|
}
|
|
1284
1284
|
) })
|
|
1285
1285
|
] }),
|
|
1286
|
-
|
|
1286
|
+
v && /* @__PURE__ */ e("div", { className: "ml-16", children: v })
|
|
1287
1287
|
]
|
|
1288
1288
|
}
|
|
1289
1289
|
);
|
|
1290
1290
|
}
|
|
1291
|
-
function
|
|
1291
|
+
function Ei({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n, collectionEditable: a }) {
|
|
1292
1292
|
const {
|
|
1293
1293
|
values: o,
|
|
1294
1294
|
setFieldValue: s
|
|
1295
|
-
} = H(), [u, p] = Y(!1), [m, c] = Y(), [d, y] = Y(),
|
|
1295
|
+
} = H(), [u, p] = Y(!1), [m, c] = Y(), [d, y] = Y(), g = o.propertiesOrder ?? Object.keys(o.properties ?? {}), v = Q(({
|
|
1296
1296
|
id: f,
|
|
1297
1297
|
property: I
|
|
1298
1298
|
}) => {
|
|
@@ -1301,14 +1301,14 @@ function Ii({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n
|
|
|
1301
1301
|
s("properties", {
|
|
1302
1302
|
...o.properties ?? {},
|
|
1303
1303
|
[f]: I
|
|
1304
|
-
}, !1), s("propertiesOrder", [...
|
|
1305
|
-
}, [o.properties,
|
|
1306
|
-
const z = f ?
|
|
1304
|
+
}, !1), s("propertiesOrder", [...g, f], !1), p(!1);
|
|
1305
|
+
}, [o.properties, g]), N = Q((f, I) => {
|
|
1306
|
+
const z = f ? le(f, I) : void 0;
|
|
1307
1307
|
if (!z)
|
|
1308
1308
|
throw Error("collection editor miss config");
|
|
1309
|
-
const
|
|
1310
|
-
s(
|
|
1311
|
-
}, [s, o]), x = m ?
|
|
1309
|
+
const _ = be(z), F = Oe(I), U = k(o, F) ?? Object.keys(k(o, xi(I)));
|
|
1310
|
+
s(_, void 0, !1), s(F, U.filter((V) => V !== f), !1), p(!1), c(void 0), y(void 0);
|
|
1311
|
+
}, [s, o]), x = m ? le(m, d) : void 0, P = x ? k(o.properties, x.replaceAll(".", ".properties.")) : void 0, h = /* @__PURE__ */ l(
|
|
1312
1312
|
R,
|
|
1313
1313
|
{
|
|
1314
1314
|
color: "primary",
|
|
@@ -1320,7 +1320,7 @@ function Ii({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n
|
|
|
1320
1320
|
o.name ?? "this group"
|
|
1321
1321
|
]
|
|
1322
1322
|
}
|
|
1323
|
-
), b = !
|
|
1323
|
+
), b = !g || g.length < 1, C = Q((f, I) => {
|
|
1324
1324
|
s(Oe(I), f, !1);
|
|
1325
1325
|
}, []);
|
|
1326
1326
|
return /* @__PURE__ */ l(j, { children: [
|
|
@@ -1334,7 +1334,7 @@ function Ii({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n
|
|
|
1334
1334
|
yt,
|
|
1335
1335
|
{
|
|
1336
1336
|
properties: o.properties ?? {},
|
|
1337
|
-
propertiesOrder:
|
|
1337
|
+
propertiesOrder: g,
|
|
1338
1338
|
errors: {},
|
|
1339
1339
|
collectionEditable: a,
|
|
1340
1340
|
onPropertyClick: (f, I) => {
|
|
@@ -1364,7 +1364,7 @@ function Ii({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n
|
|
|
1364
1364
|
value: o.spreadChildren ?? !1
|
|
1365
1365
|
}
|
|
1366
1366
|
),
|
|
1367
|
-
/* @__PURE__ */ e(
|
|
1367
|
+
/* @__PURE__ */ e(W, { children: "Set this flag to true if you want to display the children of this group as individual columns." })
|
|
1368
1368
|
] }),
|
|
1369
1369
|
/* @__PURE__ */ e(
|
|
1370
1370
|
Be,
|
|
@@ -1388,14 +1388,14 @@ function Ii({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n
|
|
|
1388
1388
|
existingProperty: !!m,
|
|
1389
1389
|
autoUpdateId: !m,
|
|
1390
1390
|
autoOpenTypeSelect: !m,
|
|
1391
|
-
onPropertyChanged:
|
|
1392
|
-
existingPropertyKeys: m ? void 0 :
|
|
1391
|
+
onPropertyChanged: v,
|
|
1392
|
+
existingPropertyKeys: m ? void 0 : g,
|
|
1393
1393
|
propertyConfigs: n
|
|
1394
1394
|
}
|
|
1395
1395
|
)
|
|
1396
1396
|
] });
|
|
1397
1397
|
}
|
|
1398
|
-
function
|
|
1398
|
+
function _i({
|
|
1399
1399
|
showErrors: t,
|
|
1400
1400
|
existing: r,
|
|
1401
1401
|
disabled: i,
|
|
@@ -1410,9 +1410,9 @@ function Ei({
|
|
|
1410
1410
|
errors: m,
|
|
1411
1411
|
setFieldValue: c,
|
|
1412
1412
|
touched: d
|
|
1413
|
-
} = H(), [y,
|
|
1413
|
+
} = H(), [y, g] = Y(!1), v = k(u, "of"), N = k(d, "of") && k(m, "of"), x = Q(({ id: h, property: b, namespace: C }) => {
|
|
1414
1414
|
c("of", b);
|
|
1415
|
-
}, []), P =
|
|
1415
|
+
}, []), P = v && Qe(v, o);
|
|
1416
1416
|
return /* @__PURE__ */ l(j, { children: [
|
|
1417
1417
|
/* @__PURE__ */ l("div", { className: "col-span-12", children: [
|
|
1418
1418
|
/* @__PURE__ */ e(T, { variant: "subtitle2", children: "Repeat component" }),
|
|
@@ -1420,27 +1420,27 @@ function Ei({
|
|
|
1420
1420
|
ve,
|
|
1421
1421
|
{
|
|
1422
1422
|
name: "of",
|
|
1423
|
-
value:
|
|
1423
|
+
value: v,
|
|
1424
1424
|
validate: (h) => h?.dataType ? void 0 : "You need to specify a repeat field",
|
|
1425
1425
|
children: () => /* @__PURE__ */ l(ke, { className: "p-2 mt-4", children: [
|
|
1426
|
-
|
|
1427
|
-
|
|
1426
|
+
v && /* @__PURE__ */ e(
|
|
1427
|
+
lr,
|
|
1428
1428
|
{
|
|
1429
|
-
property:
|
|
1430
|
-
onClick: i ? void 0 : () =>
|
|
1429
|
+
property: v,
|
|
1430
|
+
onClick: i ? void 0 : () => g(!0),
|
|
1431
1431
|
includeName: !1,
|
|
1432
1432
|
includeEditButton: !0,
|
|
1433
1433
|
selected: !1,
|
|
1434
1434
|
hasError: !1
|
|
1435
1435
|
}
|
|
1436
1436
|
),
|
|
1437
|
-
!i && !
|
|
1437
|
+
!i && !v && /* @__PURE__ */ l(
|
|
1438
1438
|
R,
|
|
1439
1439
|
{
|
|
1440
1440
|
variant: "text",
|
|
1441
1441
|
size: "large",
|
|
1442
1442
|
color: N ? "error" : "primary",
|
|
1443
|
-
onClick: () =>
|
|
1443
|
+
onClick: () => g(!0),
|
|
1444
1444
|
children: [
|
|
1445
1445
|
"Edit ",
|
|
1446
1446
|
`${P ? P.name : "repeat component"}`
|
|
@@ -1456,9 +1456,9 @@ function Ei({
|
|
|
1456
1456
|
getData: n,
|
|
1457
1457
|
autoUpdateId: !r,
|
|
1458
1458
|
autoOpenTypeSelect: !r,
|
|
1459
|
-
onOkClicked: () =>
|
|
1459
|
+
onOkClicked: () => g(!1),
|
|
1460
1460
|
allowDataInference: a,
|
|
1461
|
-
property:
|
|
1461
|
+
property: v,
|
|
1462
1462
|
includeIdAndName: !1,
|
|
1463
1463
|
onPropertyChanged: x,
|
|
1464
1464
|
forceShowErrors: t,
|
|
@@ -1473,7 +1473,7 @@ function Ei({
|
|
|
1473
1473
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(Ft, { disabled: i }) }) })
|
|
1474
1474
|
] });
|
|
1475
1475
|
}
|
|
1476
|
-
const
|
|
1476
|
+
const Si = G.forwardRef(
|
|
1477
1477
|
function({
|
|
1478
1478
|
showErrors: r,
|
|
1479
1479
|
disabledId: i,
|
|
@@ -1488,7 +1488,7 @@ const _i = G.forwardRef(
|
|
|
1488
1488
|
setFieldValue: c,
|
|
1489
1489
|
setFieldTouched: d,
|
|
1490
1490
|
touched: y
|
|
1491
|
-
} = H(),
|
|
1491
|
+
} = H(), g = "name", v = r && k(p, g), N = "id", x = r && k(p, N), P = "description", h = r && k(p, P);
|
|
1492
1492
|
return /* @__PURE__ */ l("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
1493
1493
|
/* @__PURE__ */ l("div", { children: [
|
|
1494
1494
|
/* @__PURE__ */ e(
|
|
@@ -1496,20 +1496,20 @@ const _i = G.forwardRef(
|
|
|
1496
1496
|
{
|
|
1497
1497
|
inputRef: u,
|
|
1498
1498
|
as: K,
|
|
1499
|
-
value: m[
|
|
1499
|
+
value: m[g],
|
|
1500
1500
|
onChange: (b) => {
|
|
1501
1501
|
const C = b.target.value;
|
|
1502
|
-
c(
|
|
1502
|
+
c(g, C), d(g, !0, !0), !k(y, N) && o && c(N, C ? wt(C) : "");
|
|
1503
1503
|
},
|
|
1504
1504
|
style: { fontSize: 20 },
|
|
1505
|
-
validate:
|
|
1505
|
+
validate: Di,
|
|
1506
1506
|
placeholder: "Field name",
|
|
1507
1507
|
required: !0,
|
|
1508
1508
|
disabled: a,
|
|
1509
|
-
error: !!
|
|
1509
|
+
error: !!v
|
|
1510
1510
|
}
|
|
1511
1511
|
),
|
|
1512
|
-
/* @__PURE__ */ e(
|
|
1512
|
+
/* @__PURE__ */ e(W, { error: !!v, children: v })
|
|
1513
1513
|
] }),
|
|
1514
1514
|
/* @__PURE__ */ l("div", { children: [
|
|
1515
1515
|
/* @__PURE__ */ e(
|
|
@@ -1520,16 +1520,16 @@ const _i = G.forwardRef(
|
|
|
1520
1520
|
value: m[N],
|
|
1521
1521
|
onChange: (b) => {
|
|
1522
1522
|
const C = b.target.value;
|
|
1523
|
-
c(N, C), d(N, !0, !0), !k(y,
|
|
1523
|
+
c(N, C), d(N, !0, !0), !k(y, g) && o && c(g, C ? ft(C) : "");
|
|
1524
1524
|
},
|
|
1525
|
-
validate: () =>
|
|
1525
|
+
validate: () => Bi(m[N], n),
|
|
1526
1526
|
disabled: i || a,
|
|
1527
1527
|
required: !0,
|
|
1528
1528
|
size: "small",
|
|
1529
1529
|
error: !!x
|
|
1530
1530
|
}
|
|
1531
1531
|
),
|
|
1532
|
-
/* @__PURE__ */ e(
|
|
1532
|
+
/* @__PURE__ */ e(W, { error: !!x, children: x })
|
|
1533
1533
|
] }),
|
|
1534
1534
|
/* @__PURE__ */ l("div", { children: [
|
|
1535
1535
|
/* @__PURE__ */ e(
|
|
@@ -1542,20 +1542,20 @@ const _i = G.forwardRef(
|
|
|
1542
1542
|
error: !!h
|
|
1543
1543
|
}
|
|
1544
1544
|
),
|
|
1545
|
-
/* @__PURE__ */ e(
|
|
1545
|
+
/* @__PURE__ */ e(W, { error: !!h, children: h })
|
|
1546
1546
|
] })
|
|
1547
1547
|
] });
|
|
1548
1548
|
}
|
|
1549
|
-
),
|
|
1550
|
-
function
|
|
1549
|
+
), Ai = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
1550
|
+
function Bi(t, r) {
|
|
1551
1551
|
let i;
|
|
1552
|
-
return t || (i = "You must specify an id for the field"), t && !t.match(
|
|
1552
|
+
return t || (i = "You must specify an id for the field"), t && !t.match(Ai) && (i = "The id can only contain letters, numbers and underscores (_), and not start with a number"), t && r && r.includes(t) && (i = "There is another field with this ID already"), i;
|
|
1553
1553
|
}
|
|
1554
|
-
function
|
|
1554
|
+
function Di(t) {
|
|
1555
1555
|
let r;
|
|
1556
1556
|
return t || (r = "You must specify a title for the field"), r;
|
|
1557
1557
|
}
|
|
1558
|
-
function
|
|
1558
|
+
function Mi({
|
|
1559
1559
|
widgetId: t,
|
|
1560
1560
|
disabled: r,
|
|
1561
1561
|
showErrors: i
|
|
@@ -1628,12 +1628,12 @@ function Di({
|
|
|
1628
1628
|
) })
|
|
1629
1629
|
] });
|
|
1630
1630
|
}
|
|
1631
|
-
function
|
|
1631
|
+
function zi({ disabled: t }) {
|
|
1632
1632
|
const { values: r } = H(), i = k(r, "defaultValue");
|
|
1633
1633
|
return /* @__PURE__ */ l(j, { children: [
|
|
1634
1634
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(Re, { disabled: t }) }) }),
|
|
1635
1635
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1636
|
-
|
|
1636
|
+
ae,
|
|
1637
1637
|
{
|
|
1638
1638
|
type: "checkbox",
|
|
1639
1639
|
name: "defaultValue",
|
|
@@ -1645,11 +1645,11 @@ function Mi({ disabled: t }) {
|
|
|
1645
1645
|
) })
|
|
1646
1646
|
] });
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1648
|
+
function Ri({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n, collectionEditable: a }) {
|
|
1649
1649
|
const {
|
|
1650
1650
|
values: o,
|
|
1651
1651
|
setFieldValue: s
|
|
1652
|
-
} = H(), [u, p] = Y(!1), [m, c] = Y(), [d, y] = Y(),
|
|
1652
|
+
} = H(), [u, p] = Y(!1), [m, c] = Y(), [d, y] = Y(), g = Q(({
|
|
1653
1653
|
id: b,
|
|
1654
1654
|
property: C
|
|
1655
1655
|
}) => {
|
|
@@ -1659,13 +1659,13 @@ function zi({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n
|
|
|
1659
1659
|
...o.oneOf?.properties ?? {},
|
|
1660
1660
|
[b]: C
|
|
1661
1661
|
}, !1), s("oneOf.propertiesOrder", [...o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), b], !1), p(!1);
|
|
1662
|
-
}, [o.oneOf?.properties, o.oneOf?.propertiesOrder]),
|
|
1663
|
-
const f = b ?
|
|
1662
|
+
}, [o.oneOf?.properties, o.oneOf?.propertiesOrder]), v = m ? le(m, d) : void 0, N = v ? k(o.oneOf?.properties, v.replaceAll(".", ".properties.")) : void 0, x = Q((b, C) => {
|
|
1663
|
+
const f = b ? le(b, C) : void 0;
|
|
1664
1664
|
if (!f)
|
|
1665
1665
|
throw Error("collection editor miss config");
|
|
1666
1666
|
s(`oneOf.${be(f)}`, void 0, !1);
|
|
1667
1667
|
const I = `oneOf.${Oe(C)}`, z = k(o, I);
|
|
1668
|
-
s(I, z.filter((
|
|
1668
|
+
s(I, z.filter((_) => _ !== b), !1), p(!1), c(void 0), y(void 0);
|
|
1669
1669
|
}, [s, o]), P = /* @__PURE__ */ l(
|
|
1670
1670
|
R,
|
|
1671
1671
|
{
|
|
@@ -1678,7 +1678,7 @@ function zi({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n
|
|
|
1678
1678
|
o.name ?? "this block"
|
|
1679
1679
|
]
|
|
1680
1680
|
}
|
|
1681
|
-
), h =
|
|
1681
|
+
), h = Q((b, C) => {
|
|
1682
1682
|
s(`oneOf.${Oe(C)}`, b, !1);
|
|
1683
1683
|
}, []);
|
|
1684
1684
|
return /* @__PURE__ */ l(j, { children: [
|
|
@@ -1726,14 +1726,14 @@ function zi({ disabled: t, getData: r, allowDataInference: i, propertyConfigs: n
|
|
|
1726
1726
|
existingProperty: !!m,
|
|
1727
1727
|
autoUpdateId: !m,
|
|
1728
1728
|
autoOpenTypeSelect: !m,
|
|
1729
|
-
onPropertyChanged:
|
|
1729
|
+
onPropertyChanged: g,
|
|
1730
1730
|
existingPropertyKeys: m ? void 0 : o.oneOf?.propertiesOrder,
|
|
1731
1731
|
propertyConfigs: n
|
|
1732
1732
|
}
|
|
1733
1733
|
)
|
|
1734
1734
|
] });
|
|
1735
1735
|
}
|
|
1736
|
-
function
|
|
1736
|
+
function Ui({ disabled: t }) {
|
|
1737
1737
|
const {
|
|
1738
1738
|
values: r,
|
|
1739
1739
|
handleChange: i
|
|
@@ -1789,7 +1789,7 @@ function Ri({ disabled: t }) {
|
|
|
1789
1789
|
}
|
|
1790
1790
|
) }),
|
|
1791
1791
|
/* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
1792
|
-
|
|
1792
|
+
ae,
|
|
1793
1793
|
{
|
|
1794
1794
|
type: "checkbox",
|
|
1795
1795
|
name: u,
|
|
@@ -1799,7 +1799,7 @@ function Ri({ disabled: t }) {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
) }),
|
|
1801
1801
|
/* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
1802
|
-
|
|
1802
|
+
ae,
|
|
1803
1803
|
{
|
|
1804
1804
|
type: "checkbox",
|
|
1805
1805
|
name: p,
|
|
@@ -1809,7 +1809,7 @@ function Ri({ disabled: t }) {
|
|
|
1809
1809
|
}
|
|
1810
1810
|
) }),
|
|
1811
1811
|
/* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
1812
|
-
|
|
1812
|
+
ae,
|
|
1813
1813
|
{
|
|
1814
1814
|
type: "checkbox",
|
|
1815
1815
|
name: m,
|
|
@@ -1820,10 +1820,10 @@ function Ri({ disabled: t }) {
|
|
|
1820
1820
|
) })
|
|
1821
1821
|
] });
|
|
1822
1822
|
}
|
|
1823
|
-
function
|
|
1823
|
+
function ji({ disabled: t }) {
|
|
1824
1824
|
const { values: r, setFieldValue: i } = H();
|
|
1825
1825
|
return /* @__PURE__ */ l(j, { children: [
|
|
1826
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(
|
|
1826
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(Ui, { disabled: t }) }) }),
|
|
1827
1827
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1828
1828
|
Ae,
|
|
1829
1829
|
{
|
|
@@ -1839,7 +1839,7 @@ function Ui({ disabled: t }) {
|
|
|
1839
1839
|
) })
|
|
1840
1840
|
] });
|
|
1841
1841
|
}
|
|
1842
|
-
function
|
|
1842
|
+
function qt({
|
|
1843
1843
|
existing: t,
|
|
1844
1844
|
multiple: r,
|
|
1845
1845
|
disabled: i,
|
|
@@ -1855,7 +1855,7 @@ function Yt({
|
|
|
1855
1855
|
} = H();
|
|
1856
1856
|
if (!Me())
|
|
1857
1857
|
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(tt, {}) });
|
|
1858
|
-
const d = r ? "of.path" : "path", y = k(a, d),
|
|
1858
|
+
const d = r ? "of.path" : "path", y = k(a, d), g = n && k(s, d);
|
|
1859
1859
|
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1860
1860
|
ve,
|
|
1861
1861
|
{
|
|
@@ -1863,20 +1863,20 @@ function Yt({
|
|
|
1863
1863
|
name: d,
|
|
1864
1864
|
pathPath: d,
|
|
1865
1865
|
type: "select",
|
|
1866
|
-
validate:
|
|
1866
|
+
validate: $i,
|
|
1867
1867
|
disabled: t || i,
|
|
1868
1868
|
value: y,
|
|
1869
|
-
error:
|
|
1869
|
+
error: g,
|
|
1870
1870
|
handleChange: o,
|
|
1871
|
-
component:
|
|
1871
|
+
component: Li
|
|
1872
1872
|
}
|
|
1873
1873
|
) }) });
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function $i(t) {
|
|
1876
1876
|
let r;
|
|
1877
1877
|
return t || (r = "You must specify a target collection for the field"), r;
|
|
1878
1878
|
}
|
|
1879
|
-
function
|
|
1879
|
+
function Li({
|
|
1880
1880
|
disabled: t,
|
|
1881
1881
|
pathPath: r,
|
|
1882
1882
|
value: i,
|
|
@@ -1903,7 +1903,7 @@ function $i({
|
|
|
1903
1903
|
onChange: n,
|
|
1904
1904
|
label: "Target collection",
|
|
1905
1905
|
renderValue: (c) => {
|
|
1906
|
-
const d = u.find((
|
|
1906
|
+
const d = u.find((g) => g.id === c || g.path === c);
|
|
1907
1907
|
if (!d)
|
|
1908
1908
|
return null;
|
|
1909
1909
|
const y = dt(d);
|
|
@@ -1928,7 +1928,7 @@ function $i({
|
|
|
1928
1928
|
children: u.filter((d) => d.group === c).map((d) => {
|
|
1929
1929
|
const y = dt(d);
|
|
1930
1930
|
return /* @__PURE__ */ e(
|
|
1931
|
-
|
|
1931
|
+
X,
|
|
1932
1932
|
{
|
|
1933
1933
|
value: d.id ?? d.path,
|
|
1934
1934
|
children: /* @__PURE__ */ l("div", { className: "flex flex-row", children: [
|
|
@@ -1952,7 +1952,7 @@ function $i({
|
|
|
1952
1952
|
m && /* @__PURE__ */ e(Mt, { label: "Views", children: m.map((c) => {
|
|
1953
1953
|
const d = dt(c);
|
|
1954
1954
|
return /* @__PURE__ */ e(
|
|
1955
|
-
|
|
1955
|
+
X,
|
|
1956
1956
|
{
|
|
1957
1957
|
value: c.id ?? c.path,
|
|
1958
1958
|
children: /* @__PURE__ */ l("div", { className: "flex flex-row", children: [
|
|
@@ -1973,10 +1973,10 @@ function $i({
|
|
|
1973
1973
|
]
|
|
1974
1974
|
}
|
|
1975
1975
|
),
|
|
1976
|
-
/* @__PURE__ */ e(
|
|
1976
|
+
/* @__PURE__ */ e(W, { children: "You can only edit the reference collection upon field creation." })
|
|
1977
1977
|
] });
|
|
1978
1978
|
}
|
|
1979
|
-
function
|
|
1979
|
+
function qi({ disabled: t }) {
|
|
1980
1980
|
const {
|
|
1981
1981
|
values: r,
|
|
1982
1982
|
errors: i,
|
|
@@ -2005,12 +2005,12 @@ function Li({ disabled: t }) {
|
|
|
2005
2005
|
},
|
|
2006
2006
|
disabled: t,
|
|
2007
2007
|
children: [
|
|
2008
|
-
/* @__PURE__ */ e(
|
|
2009
|
-
/* @__PURE__ */ e(
|
|
2008
|
+
/* @__PURE__ */ e(X, { value: "date_time", children: " Date/Time " }),
|
|
2009
|
+
/* @__PURE__ */ e(X, { value: "date", children: " Date " })
|
|
2010
2010
|
]
|
|
2011
2011
|
}
|
|
2012
2012
|
),
|
|
2013
|
-
/* @__PURE__ */ e(
|
|
2013
|
+
/* @__PURE__ */ e(W, { error: !!u, children: u }),
|
|
2014
2014
|
/* @__PURE__ */ l(
|
|
2015
2015
|
Te,
|
|
2016
2016
|
{
|
|
@@ -2031,21 +2031,21 @@ function Li({ disabled: t }) {
|
|
|
2031
2031
|
error: !!c,
|
|
2032
2032
|
label: "Automatic value",
|
|
2033
2033
|
children: [
|
|
2034
|
-
/* @__PURE__ */ e(
|
|
2035
|
-
/* @__PURE__ */ e(
|
|
2036
|
-
/* @__PURE__ */ e(
|
|
2034
|
+
/* @__PURE__ */ e(X, { value: "", children: " None " }),
|
|
2035
|
+
/* @__PURE__ */ e(X, { value: "on_create", children: " On create " }),
|
|
2036
|
+
/* @__PURE__ */ e(X, { value: "on_update", children: " On any update " })
|
|
2037
2037
|
]
|
|
2038
2038
|
}
|
|
2039
2039
|
),
|
|
2040
|
-
/* @__PURE__ */ e(
|
|
2040
|
+
/* @__PURE__ */ e(W, { error: !!c, children: c ?? "Update this field automatically when creating or updating the entity" })
|
|
2041
2041
|
] }),
|
|
2042
2042
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(Re, { disabled: t }) }) })
|
|
2043
2043
|
] });
|
|
2044
2044
|
}
|
|
2045
|
-
function
|
|
2045
|
+
function Yi({ disabled: t }) {
|
|
2046
2046
|
return H(), /* @__PURE__ */ l("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
2047
2047
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2048
|
-
|
|
2048
|
+
ae,
|
|
2049
2049
|
{
|
|
2050
2050
|
type: "checkbox",
|
|
2051
2051
|
name: "hideFromCollection",
|
|
@@ -2056,7 +2056,7 @@ function qi({ disabled: t }) {
|
|
|
2056
2056
|
}
|
|
2057
2057
|
) }),
|
|
2058
2058
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2059
|
-
|
|
2059
|
+
ae,
|
|
2060
2060
|
{
|
|
2061
2061
|
type: "checkbox",
|
|
2062
2062
|
name: "readOnly",
|
|
@@ -2068,10 +2068,10 @@ function qi({ disabled: t }) {
|
|
|
2068
2068
|
) })
|
|
2069
2069
|
] });
|
|
2070
2070
|
}
|
|
2071
|
-
function
|
|
2071
|
+
function Gi({ disabled: t }) {
|
|
2072
2072
|
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(Re, { disabled: t }) }) }) });
|
|
2073
2073
|
}
|
|
2074
|
-
function
|
|
2074
|
+
function ar(t, r, i) {
|
|
2075
2075
|
let n;
|
|
2076
2076
|
return r === "text_field" ? n = J(
|
|
2077
2077
|
t,
|
|
@@ -2283,9 +2283,9 @@ function sr(t, r, i) {
|
|
|
2283
2283
|
propertyConfig: r
|
|
2284
2284
|
}), n;
|
|
2285
2285
|
}
|
|
2286
|
-
function
|
|
2286
|
+
function sr({ value: t, optionDisabled: r, propertyConfig: i, existing: n }) {
|
|
2287
2287
|
return /* @__PURE__ */ e(
|
|
2288
|
-
|
|
2288
|
+
X,
|
|
2289
2289
|
{
|
|
2290
2290
|
value: t,
|
|
2291
2291
|
disabled: r,
|
|
@@ -2317,7 +2317,7 @@ function cr({ value: t, optionDisabled: r, propertyConfig: i, existing: n }) {
|
|
|
2317
2317
|
}
|
|
2318
2318
|
);
|
|
2319
2319
|
}
|
|
2320
|
-
function
|
|
2320
|
+
function Hi({
|
|
2321
2321
|
disabled: t,
|
|
2322
2322
|
showErrors: r
|
|
2323
2323
|
}) {
|
|
@@ -2346,10 +2346,10 @@ function Gi({
|
|
|
2346
2346
|
},
|
|
2347
2347
|
value: a ?? "[NONE]",
|
|
2348
2348
|
children: [
|
|
2349
|
-
/* @__PURE__ */ e(
|
|
2350
|
-
/* @__PURE__ */ e(
|
|
2351
|
-
/* @__PURE__ */ e(
|
|
2352
|
-
/* @__PURE__ */ e(
|
|
2349
|
+
/* @__PURE__ */ e(X, { value: "[NONE]", children: "Display URL" }),
|
|
2350
|
+
/* @__PURE__ */ e(X, { value: "image", children: "Image" }),
|
|
2351
|
+
/* @__PURE__ */ e(X, { value: "video", children: "Video" }),
|
|
2352
|
+
/* @__PURE__ */ e(X, { value: "audio", children: "Audio" })
|
|
2353
2353
|
]
|
|
2354
2354
|
}
|
|
2355
2355
|
) }),
|
|
@@ -2377,7 +2377,7 @@ function Gi({
|
|
|
2377
2377
|
) })
|
|
2378
2378
|
] });
|
|
2379
2379
|
}
|
|
2380
|
-
const
|
|
2380
|
+
const Zi = [
|
|
2381
2381
|
"text_field",
|
|
2382
2382
|
"multiline",
|
|
2383
2383
|
"markdown",
|
|
@@ -2398,7 +2398,7 @@ const Hi = [
|
|
|
2398
2398
|
"key_value",
|
|
2399
2399
|
"repeat",
|
|
2400
2400
|
"block"
|
|
2401
|
-
],
|
|
2401
|
+
], cr = Object.entries(Jt).filter(([t]) => Zi.includes(t)).map(([t, r]) => ({ [t]: r })).reduce((t, r) => ({ ...t, ...r }), {}), dr = G.memo(
|
|
2402
2402
|
function({
|
|
2403
2403
|
includeIdAndName: r = !0,
|
|
2404
2404
|
autoOpenTypeSelect: i,
|
|
@@ -2412,8 +2412,8 @@ const Hi = [
|
|
|
2412
2412
|
onPropertyChangedImmediate: c = !0,
|
|
2413
2413
|
onDelete: d,
|
|
2414
2414
|
onError: y,
|
|
2415
|
-
initialErrors:
|
|
2416
|
-
forceShowErrors:
|
|
2415
|
+
initialErrors: g,
|
|
2416
|
+
forceShowErrors: v,
|
|
2417
2417
|
existingPropertyKeys: N,
|
|
2418
2418
|
allowDataInference: x,
|
|
2419
2419
|
getHelpers: P,
|
|
@@ -2428,7 +2428,7 @@ const Hi = [
|
|
|
2428
2428
|
id: s,
|
|
2429
2429
|
previousId: s,
|
|
2430
2430
|
property: p
|
|
2431
|
-
} : void 0),
|
|
2431
|
+
} : void 0), _ = ({
|
|
2432
2432
|
id: F,
|
|
2433
2433
|
property: U
|
|
2434
2434
|
}) => {
|
|
@@ -2443,15 +2443,15 @@ const Hi = [
|
|
|
2443
2443
|
return /* @__PURE__ */ e(
|
|
2444
2444
|
Vt,
|
|
2445
2445
|
{
|
|
2446
|
-
initialErrors:
|
|
2446
|
+
initialErrors: g,
|
|
2447
2447
|
initialValues: p ? { id: s, ...p } : f,
|
|
2448
2448
|
onSubmit: (F, U) => {
|
|
2449
|
-
console.
|
|
2449
|
+
console.debug("onSubmit", F);
|
|
2450
2450
|
const {
|
|
2451
2451
|
id: V,
|
|
2452
2452
|
...O
|
|
2453
2453
|
} = F;
|
|
2454
|
-
|
|
2454
|
+
_({
|
|
2455
2455
|
id: V,
|
|
2456
2456
|
property: { ...O, editable: O.editable ?? !0 }
|
|
2457
2457
|
}), n || U.resetForm({ values: f });
|
|
@@ -2459,14 +2459,14 @@ const Hi = [
|
|
|
2459
2459
|
children: (F) => (ue(() => {
|
|
2460
2460
|
P?.(F);
|
|
2461
2461
|
}, [F]), /* @__PURE__ */ e(
|
|
2462
|
-
|
|
2462
|
+
Ji,
|
|
2463
2463
|
{
|
|
2464
|
-
onPropertyChanged: c ?
|
|
2464
|
+
onPropertyChanged: c ? _ : void 0,
|
|
2465
2465
|
onDelete: d,
|
|
2466
2466
|
includeIdAndTitle: r,
|
|
2467
2467
|
propertyNamespace: u,
|
|
2468
2468
|
onError: y,
|
|
2469
|
-
showErrors:
|
|
2469
|
+
showErrors: v || F.submitCount > 0,
|
|
2470
2470
|
existing: n,
|
|
2471
2471
|
autoUpdateId: a,
|
|
2472
2472
|
inArray: o,
|
|
@@ -2504,7 +2504,7 @@ function Be({
|
|
|
2504
2504
|
fullWidth: !0,
|
|
2505
2505
|
children: [
|
|
2506
2506
|
/* @__PURE__ */ e(Ye, { children: /* @__PURE__ */ e(
|
|
2507
|
-
|
|
2507
|
+
dr,
|
|
2508
2508
|
{
|
|
2509
2509
|
...s,
|
|
2510
2510
|
onPropertyChanged: (m) => {
|
|
@@ -2543,7 +2543,7 @@ function Be({
|
|
|
2543
2543
|
}
|
|
2544
2544
|
);
|
|
2545
2545
|
}
|
|
2546
|
-
function
|
|
2546
|
+
function Ji({
|
|
2547
2547
|
values: t,
|
|
2548
2548
|
errors: r,
|
|
2549
2549
|
touched: i,
|
|
@@ -2557,8 +2557,8 @@ function Zi({
|
|
|
2557
2557
|
onDelete: c,
|
|
2558
2558
|
propertyNamespace: d,
|
|
2559
2559
|
onError: y,
|
|
2560
|
-
showErrors:
|
|
2561
|
-
disabled:
|
|
2560
|
+
showErrors: g,
|
|
2561
|
+
disabled: v,
|
|
2562
2562
|
inArray: N,
|
|
2563
2563
|
existingPropertyKeys: x,
|
|
2564
2564
|
getData: P,
|
|
@@ -2566,7 +2566,7 @@ function Zi({
|
|
|
2566
2566
|
propertyConfigs: b,
|
|
2567
2567
|
collectionEditable: C
|
|
2568
2568
|
}) {
|
|
2569
|
-
const [f, I] = Y(u), [z,
|
|
2569
|
+
const [f, I] = Y(u), [z, _] = Y(!1), [F, U] = Y(t?.dataType ? Kt(t) : void 0), V = Object.entries(cr).concat(Object.entries(b)), O = N ? V.filter(([Z, ie]) => !re(ie.property) && ie.property?.dataType !== "array") : V, M = Sr(t), w = Je(null), A = Je(t), fe = g && k(r, "selectedWidget");
|
|
2570
2570
|
ue(() => {
|
|
2571
2571
|
if (m && (!p || M.id)) {
|
|
2572
2572
|
const {
|
|
@@ -2583,105 +2583,105 @@ function Zi({
|
|
|
2583
2583
|
t?.id && y && Object.keys(r).length > 0 && y(t?.id, d, r);
|
|
2584
2584
|
}, [r, y, d, t?.id]);
|
|
2585
2585
|
const Ne = (Z) => {
|
|
2586
|
-
U(Z), n(
|
|
2586
|
+
U(Z), n(ar(t, Z, b)), setTimeout(() => {
|
|
2587
2587
|
w.current?.focus();
|
|
2588
2588
|
}, 0);
|
|
2589
2589
|
};
|
|
2590
2590
|
let D;
|
|
2591
2591
|
return F === "text_field" || F === "multiline" || F === "markdown" || F === "email" ? D = /* @__PURE__ */ e(
|
|
2592
|
-
|
|
2592
|
+
Mi,
|
|
2593
2593
|
{
|
|
2594
2594
|
widgetId: F,
|
|
2595
|
-
disabled:
|
|
2596
|
-
showErrors:
|
|
2595
|
+
disabled: v,
|
|
2596
|
+
showErrors: g
|
|
2597
2597
|
}
|
|
2598
2598
|
) : F === "url" ? D = /* @__PURE__ */ e(
|
|
2599
|
-
|
|
2599
|
+
Hi,
|
|
2600
2600
|
{
|
|
2601
|
-
disabled:
|
|
2602
|
-
showErrors:
|
|
2601
|
+
disabled: v,
|
|
2602
|
+
showErrors: g
|
|
2603
2603
|
}
|
|
2604
2604
|
) : F === "select" || F === "number_select" ? D = /* @__PURE__ */ e(
|
|
2605
|
-
|
|
2605
|
+
$t,
|
|
2606
2606
|
{
|
|
2607
2607
|
multiselect: !1,
|
|
2608
2608
|
allowDataInference: h,
|
|
2609
2609
|
updateIds: !o,
|
|
2610
|
-
disabled:
|
|
2610
|
+
disabled: v,
|
|
2611
2611
|
getData: P,
|
|
2612
|
-
showErrors:
|
|
2612
|
+
showErrors: g
|
|
2613
2613
|
}
|
|
2614
2614
|
) : F === "multi_select" || F === "multi_number_select" ? D = /* @__PURE__ */ e(
|
|
2615
|
-
|
|
2615
|
+
$t,
|
|
2616
2616
|
{
|
|
2617
2617
|
multiselect: !0,
|
|
2618
2618
|
updateIds: !o,
|
|
2619
|
-
disabled:
|
|
2619
|
+
disabled: v,
|
|
2620
2620
|
allowDataInference: h,
|
|
2621
2621
|
getData: P,
|
|
2622
|
-
showErrors:
|
|
2622
|
+
showErrors: g
|
|
2623
2623
|
}
|
|
2624
2624
|
) : F === "file_upload" ? D = /* @__PURE__ */ e(
|
|
2625
|
-
|
|
2625
|
+
Lt,
|
|
2626
2626
|
{
|
|
2627
2627
|
existing: o,
|
|
2628
2628
|
multiple: !1,
|
|
2629
|
-
disabled:
|
|
2629
|
+
disabled: v
|
|
2630
2630
|
}
|
|
2631
2631
|
) : F === "multi_file_upload" ? D = /* @__PURE__ */ e(
|
|
2632
|
-
|
|
2632
|
+
Lt,
|
|
2633
2633
|
{
|
|
2634
2634
|
existing: o,
|
|
2635
2635
|
multiple: !0,
|
|
2636
|
-
disabled:
|
|
2636
|
+
disabled: v
|
|
2637
2637
|
}
|
|
2638
|
-
) : F === "switch" ? D = /* @__PURE__ */ e(
|
|
2639
|
-
|
|
2638
|
+
) : F === "switch" ? D = /* @__PURE__ */ e(zi, { disabled: v }) : F === "number_input" ? D = /* @__PURE__ */ e(ji, { disabled: v }) : F === "group" ? D = /* @__PURE__ */ e(
|
|
2639
|
+
Ei,
|
|
2640
2640
|
{
|
|
2641
|
-
disabled:
|
|
2641
|
+
disabled: v,
|
|
2642
2642
|
getData: P,
|
|
2643
2643
|
allowDataInference: h,
|
|
2644
2644
|
collectionEditable: C,
|
|
2645
2645
|
propertyConfigs: b
|
|
2646
2646
|
}
|
|
2647
2647
|
) : F === "block" ? D = /* @__PURE__ */ e(
|
|
2648
|
-
|
|
2648
|
+
Ri,
|
|
2649
2649
|
{
|
|
2650
|
-
disabled:
|
|
2650
|
+
disabled: v,
|
|
2651
2651
|
getData: P,
|
|
2652
2652
|
allowDataInference: h,
|
|
2653
2653
|
collectionEditable: C,
|
|
2654
2654
|
propertyConfigs: b
|
|
2655
2655
|
}
|
|
2656
2656
|
) : F === "reference" ? D = /* @__PURE__ */ e(
|
|
2657
|
-
|
|
2657
|
+
qt,
|
|
2658
2658
|
{
|
|
2659
|
-
showErrors:
|
|
2659
|
+
showErrors: g,
|
|
2660
2660
|
existing: o,
|
|
2661
2661
|
multiple: !1,
|
|
2662
|
-
disabled:
|
|
2662
|
+
disabled: v
|
|
2663
2663
|
}
|
|
2664
|
-
) : F === "date_time" ? D = /* @__PURE__ */ e(
|
|
2665
|
-
|
|
2664
|
+
) : F === "date_time" ? D = /* @__PURE__ */ e(qi, { disabled: v }) : F === "multi_references" ? D = /* @__PURE__ */ e(
|
|
2665
|
+
qt,
|
|
2666
2666
|
{
|
|
2667
|
-
showErrors:
|
|
2667
|
+
showErrors: g,
|
|
2668
2668
|
existing: o,
|
|
2669
2669
|
multiple: !0,
|
|
2670
|
-
disabled:
|
|
2670
|
+
disabled: v
|
|
2671
2671
|
}
|
|
2672
2672
|
) : F === "repeat" ? D = /* @__PURE__ */ e(
|
|
2673
|
-
|
|
2673
|
+
_i,
|
|
2674
2674
|
{
|
|
2675
|
-
showErrors:
|
|
2675
|
+
showErrors: g,
|
|
2676
2676
|
existing: o,
|
|
2677
2677
|
getData: P,
|
|
2678
2678
|
allowDataInference: h,
|
|
2679
|
-
disabled:
|
|
2679
|
+
disabled: v,
|
|
2680
2680
|
collectionEditable: C,
|
|
2681
2681
|
propertyConfigs: b
|
|
2682
2682
|
}
|
|
2683
|
-
) : F === "key_value" ? D = /* @__PURE__ */ e(
|
|
2684
|
-
|
|
2683
|
+
) : F === "key_value" ? D = /* @__PURE__ */ e(Gi, { disabled: v }) : D = null, /* @__PURE__ */ l(j, { children: [
|
|
2684
|
+
v && /* @__PURE__ */ l(ir, { mode: "warn", children: [
|
|
2685
2685
|
/* @__PURE__ */ e(T, { children: "This property can't be edited" }),
|
|
2686
2686
|
/* @__PURE__ */ l(T, { variant: "caption", children: [
|
|
2687
2687
|
"You may not have permission to edit it or it is defined in code with no ",
|
|
@@ -2700,11 +2700,11 @@ function Zi({
|
|
|
2700
2700
|
open: f,
|
|
2701
2701
|
onOpenChange: I,
|
|
2702
2702
|
position: "item-aligned",
|
|
2703
|
-
disabled:
|
|
2703
|
+
disabled: v,
|
|
2704
2704
|
renderValue: (Z) => {
|
|
2705
2705
|
if (!Z)
|
|
2706
2706
|
return /* @__PURE__ */ e("em", { children: "Select a property widget" });
|
|
2707
|
-
const ie = Z, pe =
|
|
2707
|
+
const ie = Z, pe = Jt[ie] ?? b[ie], ce = pe.property, Ee = ce && !re(ce) ? Qe(ce, b) : void 0, me = re(ce) || o && ce.dataType !== t?.dataType, ye = Ee ? J(Ee, pe) : pe;
|
|
2708
2708
|
return /* @__PURE__ */ l(
|
|
2709
2709
|
"div",
|
|
2710
2710
|
{
|
|
@@ -2716,15 +2716,15 @@ function Zi({
|
|
|
2716
2716
|
me ? "w-full pointer-events-none opacity-50" : ""
|
|
2717
2717
|
),
|
|
2718
2718
|
children: [
|
|
2719
|
-
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(We, { propertyConfig:
|
|
2719
|
+
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(We, { propertyConfig: ye }) }),
|
|
2720
2720
|
/* @__PURE__ */ l("div", { className: "flex flex-col items-start text-base text-left", children: [
|
|
2721
|
-
/* @__PURE__ */ e("div", { children:
|
|
2721
|
+
/* @__PURE__ */ e("div", { children: ye.name }),
|
|
2722
2722
|
/* @__PURE__ */ e(
|
|
2723
2723
|
T,
|
|
2724
2724
|
{
|
|
2725
2725
|
variant: "caption",
|
|
2726
2726
|
color: "disabled",
|
|
2727
|
-
children: me ? "You can only switch to widgets that use the same data type" :
|
|
2727
|
+
children: me ? "You can only switch to widgets that use the same data type" : ye.description
|
|
2728
2728
|
}
|
|
2729
2729
|
)
|
|
2730
2730
|
] })
|
|
@@ -2736,12 +2736,12 @@ function Zi({
|
|
|
2736
2736
|
Ne(Z);
|
|
2737
2737
|
},
|
|
2738
2738
|
children: O.map(([Z, ie]) => {
|
|
2739
|
-
const pe = ie.property,
|
|
2739
|
+
const pe = ie.property, ce = o && !re(pe) && pe.dataType !== t?.dataType;
|
|
2740
2740
|
return /* @__PURE__ */ e(
|
|
2741
|
-
|
|
2741
|
+
sr,
|
|
2742
2742
|
{
|
|
2743
2743
|
value: Z,
|
|
2744
|
-
optionDisabled:
|
|
2744
|
+
optionDisabled: ce,
|
|
2745
2745
|
propertyConfig: ie,
|
|
2746
2746
|
existing: o
|
|
2747
2747
|
},
|
|
@@ -2761,38 +2761,38 @@ function Zi({
|
|
|
2761
2761
|
)
|
|
2762
2762
|
] }),
|
|
2763
2763
|
c && t?.id && /* @__PURE__ */ e(
|
|
2764
|
-
|
|
2764
|
+
se,
|
|
2765
2765
|
{
|
|
2766
2766
|
variant: "ghost",
|
|
2767
2767
|
className: "m-4",
|
|
2768
|
-
disabled:
|
|
2769
|
-
onClick: () =>
|
|
2768
|
+
disabled: v,
|
|
2769
|
+
onClick: () => _(!0),
|
|
2770
2770
|
children: /* @__PURE__ */ e(ht, {})
|
|
2771
2771
|
}
|
|
2772
2772
|
)
|
|
2773
2773
|
] }),
|
|
2774
2774
|
/* @__PURE__ */ l("div", { className: "grid grid-cols-12 gap-y-12 mt-8 mb-8", children: [
|
|
2775
2775
|
p && /* @__PURE__ */ e(
|
|
2776
|
-
|
|
2776
|
+
Si,
|
|
2777
2777
|
{
|
|
2778
|
-
showErrors:
|
|
2778
|
+
showErrors: g,
|
|
2779
2779
|
disabledId: o,
|
|
2780
2780
|
isNewProperty: !o,
|
|
2781
2781
|
existingPropertyKeys: x,
|
|
2782
|
-
disabled:
|
|
2782
|
+
disabled: v,
|
|
2783
2783
|
autoUpdateId: s,
|
|
2784
2784
|
ref: w
|
|
2785
2785
|
}
|
|
2786
2786
|
),
|
|
2787
2787
|
D,
|
|
2788
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2788
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Yi, { disabled: v }) })
|
|
2789
2789
|
] }),
|
|
2790
2790
|
c && /* @__PURE__ */ e(
|
|
2791
2791
|
ut,
|
|
2792
2792
|
{
|
|
2793
2793
|
open: z,
|
|
2794
2794
|
onAccept: () => c(t?.id, d),
|
|
2795
|
-
onCancel: () =>
|
|
2795
|
+
onCancel: () => _(!1),
|
|
2796
2796
|
title: /* @__PURE__ */ e("div", { children: "Delete this property?" }),
|
|
2797
2797
|
body: /* @__PURE__ */ l("div", { children: [
|
|
2798
2798
|
" This will ",
|
|
@@ -2803,13 +2803,13 @@ function Zi({
|
|
|
2803
2803
|
)
|
|
2804
2804
|
] });
|
|
2805
2805
|
}
|
|
2806
|
-
function
|
|
2806
|
+
function Ki(t) {
|
|
2807
2807
|
return (t.slice(0, 1).toLowerCase() + t.slice(1)).replace(/([-_ ]){1,}/g, " ").split(/[-_ ]/).reduce((r, i) => r + i[0].toUpperCase() + i.substring(1), "");
|
|
2808
2808
|
}
|
|
2809
|
-
function
|
|
2809
|
+
function Qi({ collection: t, onOpenChange: r, open: i }) {
|
|
2810
2810
|
const n = De(), a = `import { EntityCollection } from "firecms";
|
|
2811
2811
|
|
|
2812
|
-
const ` +
|
|
2812
|
+
const ` + Ki(t.name) + "Collection:EntityCollection = " + si.stringify(ur(t), null, " ");
|
|
2813
2813
|
return /* @__PURE__ */ l(
|
|
2814
2814
|
ze,
|
|
2815
2815
|
{
|
|
@@ -2835,12 +2835,12 @@ const ` + Ji(t.name) + "Collection:EntityCollection = " + ai.stringify(pr(t), nu
|
|
|
2835
2835
|
"."
|
|
2836
2836
|
] }),
|
|
2837
2837
|
/* @__PURE__ */ e(
|
|
2838
|
-
|
|
2838
|
+
ci,
|
|
2839
2839
|
{
|
|
2840
|
-
theme:
|
|
2840
|
+
theme: di.vsDark,
|
|
2841
2841
|
code: a,
|
|
2842
2842
|
language: "typescript",
|
|
2843
|
-
children: ({ className: o, style: s, tokens: u, getLineProps: p, getTokenProps: m }) => /* @__PURE__ */ e("pre", { style: s, className: "p-4 rounded text-sm", children: u.map((c, d) => /* @__PURE__ */ e("div", { ...p({ line: c }), children: c.map((y,
|
|
2843
|
+
children: ({ className: o, style: s, tokens: u, getLineProps: p, getTokenProps: m }) => /* @__PURE__ */ e("pre", { style: s, className: "p-4 rounded text-sm", children: u.map((c, d) => /* @__PURE__ */ e("div", { ...p({ line: c }), children: c.map((y, g) => /* @__PURE__ */ e("span", { ...m({ token: y }) }, g)) }, d)) })
|
|
2844
2844
|
}
|
|
2845
2845
|
)
|
|
2846
2846
|
] }),
|
|
@@ -2855,7 +2855,7 @@ const ` + Ji(t.name) + "Collection:EntityCollection = " + ai.stringify(pr(t), nu
|
|
|
2855
2855
|
message: "Copied"
|
|
2856
2856
|
}), navigator.clipboard.writeText(a)),
|
|
2857
2857
|
children: [
|
|
2858
|
-
/* @__PURE__ */ e(
|
|
2858
|
+
/* @__PURE__ */ e(Yr, { size: "small" }),
|
|
2859
2859
|
"Copy to clipboard"
|
|
2860
2860
|
]
|
|
2861
2861
|
}
|
|
@@ -2866,7 +2866,7 @@ const ` + Ji(t.name) + "Collection:EntityCollection = " + ai.stringify(pr(t), nu
|
|
|
2866
2866
|
}
|
|
2867
2867
|
);
|
|
2868
2868
|
}
|
|
2869
|
-
function
|
|
2869
|
+
function ur(t) {
|
|
2870
2870
|
const r = (i) => {
|
|
2871
2871
|
const n = {
|
|
2872
2872
|
...i
|
|
@@ -2892,10 +2892,10 @@ function pr(t) {
|
|
|
2892
2892
|
properties: Object.entries(t.properties).map(([i, n]) => ({
|
|
2893
2893
|
[i]: r(n)
|
|
2894
2894
|
})).reduce((i, n) => ({ ...i, ...n }), {}),
|
|
2895
|
-
subcollections: (t.subcollections ?? []).map(
|
|
2895
|
+
subcollections: (t.subcollections ?? []).map(ur)
|
|
2896
2896
|
};
|
|
2897
2897
|
}
|
|
2898
|
-
function
|
|
2898
|
+
function Wi({
|
|
2899
2899
|
showErrors: t,
|
|
2900
2900
|
isNewCollection: r,
|
|
2901
2901
|
propertyErrorsRef: i,
|
|
@@ -2911,26 +2911,26 @@ function Qi({
|
|
|
2911
2911
|
}) {
|
|
2912
2912
|
const {
|
|
2913
2913
|
values: y,
|
|
2914
|
-
setFieldValue:
|
|
2915
|
-
setFieldError:
|
|
2914
|
+
setFieldValue: g,
|
|
2915
|
+
setFieldError: v,
|
|
2916
2916
|
setFieldTouched: N,
|
|
2917
2917
|
errors: x,
|
|
2918
2918
|
dirty: P
|
|
2919
|
-
} = H(), h = De(), b =
|
|
2919
|
+
} = H(), h = De(), b = wr("lg"), C = !b, [f, I] = Y(), [z, _] = Y(), [F, U] = Y(), V = z ? le(z, F) : void 0, O = V ? k(y.properties, V.replaceAll(".", ".properties.")) : void 0, [M, w] = Y(!1), [A, fe] = Y(!1), [Ne, D] = Y(!1), [Z, ie] = Y([]), pe = G.useRef(y.propertiesOrder ? { "": y.propertiesOrder } : {});
|
|
2920
2920
|
ue(() => {
|
|
2921
2921
|
a && a(P);
|
|
2922
2922
|
}, [P]);
|
|
2923
|
-
const
|
|
2924
|
-
m && (fe(!0), m(y).then((
|
|
2925
|
-
if (
|
|
2923
|
+
const ce = m ? () => {
|
|
2924
|
+
m && (fe(!0), m(y).then((E) => {
|
|
2925
|
+
if (E && Xe(E.properties), !E) {
|
|
2926
2926
|
h.open({
|
|
2927
2927
|
type: "error",
|
|
2928
2928
|
message: "Could not infer properties from data"
|
|
2929
2929
|
});
|
|
2930
2930
|
return;
|
|
2931
2931
|
}
|
|
2932
|
-
const
|
|
2933
|
-
if (
|
|
2932
|
+
const L = (E.properties ? Object.keys(E.properties) : []).filter((te) => !y.properties[te]);
|
|
2933
|
+
if (L.length === 0) {
|
|
2934
2934
|
h.open({
|
|
2935
2935
|
type: "info",
|
|
2936
2936
|
message: "No new properties found in existing data"
|
|
@@ -2938,66 +2938,72 @@ function Qi({
|
|
|
2938
2938
|
return;
|
|
2939
2939
|
}
|
|
2940
2940
|
const $ = {
|
|
2941
|
-
...
|
|
2941
|
+
...L.reduce((te, ge) => (te[ge] = (E.properties ?? {})[ge], te), {}),
|
|
2942
2942
|
...y.properties
|
|
2943
|
-
},
|
|
2944
|
-
...
|
|
2943
|
+
}, ne = [
|
|
2944
|
+
...L,
|
|
2945
2945
|
...y.propertiesOrder ?? []
|
|
2946
2946
|
];
|
|
2947
|
-
|
|
2947
|
+
g("properties", $, !1), me(ne), ie(L);
|
|
2948
2948
|
}).finally(() => {
|
|
2949
2949
|
fe(!1);
|
|
2950
2950
|
}));
|
|
2951
|
-
} : void 0, Ee = (
|
|
2952
|
-
const $ = Oe(
|
|
2953
|
-
|
|
2954
|
-
},
|
|
2955
|
-
const $ =
|
|
2951
|
+
} : void 0, Ee = (E) => E ? pe.current[E] ?? k(y, Oe(E)) : pe.current[""], me = (E, L) => {
|
|
2952
|
+
const $ = Oe(L);
|
|
2953
|
+
g($, E, !1), pe.current[L ?? ""] = E;
|
|
2954
|
+
}, ye = (E, L) => {
|
|
2955
|
+
const $ = E ? le(E, L) : void 0;
|
|
2956
2956
|
if (!$)
|
|
2957
2957
|
throw Error("collection editor miss config");
|
|
2958
|
-
|
|
2959
|
-
const te = Ee(
|
|
2960
|
-
me(te,
|
|
2961
|
-
}, Fe = (
|
|
2962
|
-
|
|
2963
|
-
},
|
|
2964
|
-
id:
|
|
2965
|
-
property:
|
|
2958
|
+
g(be($), void 0, !1);
|
|
2959
|
+
const te = Ee(L).filter((ge) => ge !== E);
|
|
2960
|
+
me(te, L), D(!1), I(void 0), _(void 0), U(void 0);
|
|
2961
|
+
}, Fe = (E, L) => {
|
|
2962
|
+
g(Oe(L), E, !1);
|
|
2963
|
+
}, de = ({
|
|
2964
|
+
id: E,
|
|
2965
|
+
property: L
|
|
2966
2966
|
}) => {
|
|
2967
|
-
if (!
|
|
2967
|
+
if (!E)
|
|
2968
2968
|
throw Error("Need to include an ID when creating a new property");
|
|
2969
|
-
|
|
2969
|
+
g("properties", {
|
|
2970
2970
|
...y.properties ?? {},
|
|
2971
|
-
[
|
|
2971
|
+
[E]: L
|
|
2972
2972
|
}, !1);
|
|
2973
|
-
const $ = [...y.propertiesOrder ?? Object.keys(y.properties),
|
|
2974
|
-
me($), D(!1), b && (I($.indexOf(
|
|
2973
|
+
const $ = [...y.propertiesOrder ?? Object.keys(y.properties), E];
|
|
2974
|
+
me($), D(!1), b && (I($.indexOf(E)), _(E)), U(void 0);
|
|
2975
2975
|
}, _e = ({
|
|
2976
|
-
id:
|
|
2977
|
-
property:
|
|
2976
|
+
id: E,
|
|
2977
|
+
property: L,
|
|
2978
2978
|
previousId: $,
|
|
2979
|
-
namespace:
|
|
2979
|
+
namespace: ne
|
|
2980
2980
|
}) => {
|
|
2981
|
-
const te =
|
|
2982
|
-
if ($ && $ !==
|
|
2983
|
-
const it =
|
|
2984
|
-
me(ot,
|
|
2981
|
+
const te = E ? le(E, ne) : void 0, ge = te ? be(te) : void 0;
|
|
2982
|
+
if ($ && $ !== E) {
|
|
2983
|
+
const it = le($, ne), nt = be(it), ot = Ee(ne).map((Ue) => Ue === $ ? E : Ue).filter((Ue) => Ue !== void 0);
|
|
2984
|
+
me(ot, ne), E && (I(ot.indexOf(E)), _(E)), g(nt, void 0, !1), N(nt, !1, !1);
|
|
2985
2985
|
}
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2986
|
+
console.debug("onPropertyChanged", {
|
|
2987
|
+
id: E,
|
|
2988
|
+
property: L,
|
|
2989
|
+
previousId: $,
|
|
2990
|
+
namespace: ne,
|
|
2991
|
+
propertyPath: ge
|
|
2992
|
+
}), ge && (g(ge, L, !1), N(ge, !0, !1));
|
|
2993
|
+
}, rt = Q((E, L, $) => {
|
|
2994
|
+
const ne = E ? le(E, L) : void 0;
|
|
2989
2995
|
if (console.warn("onPropertyErrorInternal", {
|
|
2990
|
-
id:
|
|
2991
|
-
namespace:
|
|
2996
|
+
id: E,
|
|
2997
|
+
namespace: L,
|
|
2992
2998
|
error: $,
|
|
2993
|
-
propertyPath:
|
|
2994
|
-
}),
|
|
2999
|
+
propertyPath: ne
|
|
3000
|
+
}), ne) {
|
|
2995
3001
|
const te = $ && Object.keys($).length > 0;
|
|
2996
|
-
n(
|
|
3002
|
+
n(E, L, te ? $ : void 0), v(be(ne), te ? "Property error" : void 0);
|
|
2997
3003
|
}
|
|
2998
|
-
}, bt = () => {
|
|
2999
|
-
I(void 0),
|
|
3000
|
-
},
|
|
3004
|
+
}, []), bt = () => {
|
|
3005
|
+
I(void 0), _(void 0);
|
|
3006
|
+
}, S = z && i?.current?.properties ? i.current.properties[z] : void 0, B = y?.propertiesOrder === void 0 || y.propertiesOrder.length === 0, q = y.propertiesOrder ? y.propertiesOrder : Object.keys(y.properties), Pe = Wt(() => u(y.ownerId), [u, y.ownerId]), He = /* @__PURE__ */ l("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3001
3007
|
/* @__PURE__ */ l("div", { className: Ce(
|
|
3002
3008
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
3003
3009
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
@@ -3035,21 +3041,21 @@ function Qi({
|
|
|
3035
3041
|
s && /* @__PURE__ */ e("div", { className: "ml-4", children: s }),
|
|
3036
3042
|
/* @__PURE__ */ l("div", { className: "ml-1 mt-2 flex flex-row gap-2", children: [
|
|
3037
3043
|
/* @__PURE__ */ e(ee, { title: "Get the code for this collection", children: /* @__PURE__ */ e(
|
|
3038
|
-
|
|
3044
|
+
se,
|
|
3039
3045
|
{
|
|
3040
3046
|
variant: "filled",
|
|
3041
3047
|
disabled: A,
|
|
3042
3048
|
onClick: () => w(!0),
|
|
3043
|
-
children: /* @__PURE__ */ e(
|
|
3049
|
+
children: /* @__PURE__ */ e(Gr, {})
|
|
3044
3050
|
}
|
|
3045
3051
|
) }),
|
|
3046
|
-
|
|
3047
|
-
|
|
3052
|
+
ce && /* @__PURE__ */ e(ee, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
|
|
3053
|
+
se,
|
|
3048
3054
|
{
|
|
3049
3055
|
variant: "filled",
|
|
3050
3056
|
disabled: A,
|
|
3051
|
-
onClick:
|
|
3052
|
-
children: A ? /* @__PURE__ */ e(tt, { size: "small" }) : /* @__PURE__ */ e(
|
|
3057
|
+
onClick: ce,
|
|
3058
|
+
children: A ? /* @__PURE__ */ e(tt, { size: "small" }) : /* @__PURE__ */ e(vt, {})
|
|
3053
3059
|
}
|
|
3054
3060
|
) }),
|
|
3055
3061
|
/* @__PURE__ */ e(ee, { title: "Add new property", children: /* @__PURE__ */ e(
|
|
@@ -3066,16 +3072,16 @@ function Qi({
|
|
|
3066
3072
|
yt,
|
|
3067
3073
|
{
|
|
3068
3074
|
className: "pl-8",
|
|
3069
|
-
onPropertyClick: (
|
|
3070
|
-
I(
|
|
3075
|
+
onPropertyClick: (E, L) => {
|
|
3076
|
+
I(q.indexOf(E)), _(E), U(L);
|
|
3071
3077
|
},
|
|
3072
3078
|
inferredPropertyKeys: Z,
|
|
3073
|
-
selectedPropertyKey: z ?
|
|
3079
|
+
selectedPropertyKey: z ? le(z, F) : void 0,
|
|
3074
3080
|
properties: y.properties,
|
|
3075
3081
|
additionalFields: y.additionalFields,
|
|
3076
|
-
propertiesOrder:
|
|
3082
|
+
propertiesOrder: q,
|
|
3077
3083
|
onPropertyMove: Fe,
|
|
3078
|
-
onPropertyRemove: r ?
|
|
3084
|
+
onPropertyRemove: r ? ye : void 0,
|
|
3079
3085
|
collectionEditable: d,
|
|
3080
3086
|
errors: t ? x : {}
|
|
3081
3087
|
}
|
|
@@ -3099,7 +3105,7 @@ function Qi({
|
|
|
3099
3105
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
3100
3106
|
children: [
|
|
3101
3107
|
V && O && !re(O) && /* @__PURE__ */ e(
|
|
3102
|
-
|
|
3108
|
+
dr,
|
|
3103
3109
|
{
|
|
3104
3110
|
inArray: !1,
|
|
3105
3111
|
existingProperty: !r,
|
|
@@ -3110,10 +3116,10 @@ function Qi({
|
|
|
3110
3116
|
propertyNamespace: F,
|
|
3111
3117
|
property: O,
|
|
3112
3118
|
onPropertyChanged: _e,
|
|
3113
|
-
onDelete:
|
|
3119
|
+
onDelete: ye,
|
|
3114
3120
|
onError: rt,
|
|
3115
3121
|
forceShowErrors: t,
|
|
3116
|
-
initialErrors:
|
|
3122
|
+
initialErrors: S,
|
|
3117
3123
|
getData: p,
|
|
3118
3124
|
propertyConfigs: c,
|
|
3119
3125
|
collectionEditable: d
|
|
@@ -3138,10 +3144,10 @@ function Qi({
|
|
|
3138
3144
|
propertyNamespace: F,
|
|
3139
3145
|
property: O,
|
|
3140
3146
|
onPropertyChanged: _e,
|
|
3141
|
-
onDelete:
|
|
3147
|
+
onDelete: ye,
|
|
3142
3148
|
onError: rt,
|
|
3143
3149
|
forceShowErrors: t,
|
|
3144
|
-
initialErrors:
|
|
3150
|
+
initialErrors: S,
|
|
3145
3151
|
getData: p,
|
|
3146
3152
|
propertyConfigs: c,
|
|
3147
3153
|
collectionEditable: d,
|
|
@@ -3162,7 +3168,7 @@ function Qi({
|
|
|
3162
3168
|
forceShowErrors: t,
|
|
3163
3169
|
open: Ne,
|
|
3164
3170
|
onCancel: () => D(!1),
|
|
3165
|
-
onPropertyChanged:
|
|
3171
|
+
onPropertyChanged: de,
|
|
3166
3172
|
getData: p,
|
|
3167
3173
|
allowDataInference: !r,
|
|
3168
3174
|
propertyConfigs: c,
|
|
@@ -3171,7 +3177,7 @@ function Qi({
|
|
|
3171
3177
|
}
|
|
3172
3178
|
),
|
|
3173
3179
|
/* @__PURE__ */ e(
|
|
3174
|
-
|
|
3180
|
+
Qi,
|
|
3175
3181
|
{
|
|
3176
3182
|
collection: y,
|
|
3177
3183
|
open: M,
|
|
@@ -3180,7 +3186,7 @@ function Qi({
|
|
|
3180
3186
|
)
|
|
3181
3187
|
] });
|
|
3182
3188
|
}
|
|
3183
|
-
function
|
|
3189
|
+
function Xi({
|
|
3184
3190
|
open: t,
|
|
3185
3191
|
handleOk: r,
|
|
3186
3192
|
handleCancel: i,
|
|
@@ -3208,7 +3214,7 @@ function Wi({
|
|
|
3208
3214
|
}
|
|
3209
3215
|
);
|
|
3210
3216
|
}
|
|
3211
|
-
function
|
|
3217
|
+
function en({ open: t, onClose: r }) {
|
|
3212
3218
|
const {
|
|
3213
3219
|
entityViews: i
|
|
3214
3220
|
} = Le();
|
|
@@ -3242,7 +3248,7 @@ function Xi({ open: t, onClose: r }) {
|
|
|
3242
3248
|
}
|
|
3243
3249
|
);
|
|
3244
3250
|
}
|
|
3245
|
-
function
|
|
3251
|
+
function tn({
|
|
3246
3252
|
collection: t,
|
|
3247
3253
|
parentCollection: r,
|
|
3248
3254
|
configController: i,
|
|
@@ -3250,12 +3256,12 @@ function en({
|
|
|
3250
3256
|
getUser: a,
|
|
3251
3257
|
parentCollectionIds: o
|
|
3252
3258
|
}) {
|
|
3253
|
-
const { entityViews: s } = Le(), [u, p] = G.useState(), [m, c] = G.useState(!1), [d, y] = G.useState(), [
|
|
3259
|
+
const { entityViews: s } = Le(), [u, p] = G.useState(), [m, c] = G.useState(!1), [d, y] = G.useState(), [g, v] = G.useState(), {
|
|
3254
3260
|
values: N,
|
|
3255
3261
|
setFieldValue: x
|
|
3256
|
-
} = H(), P = t.subcollections ?? [], h = N.entityViews?.filter((f) => typeof f == "string").map((f) =>
|
|
3262
|
+
} = H(), P = t.subcollections ?? [], h = N.entityViews?.filter((f) => typeof f == "string").map((f) => Or(f, s)).filter(Boolean) ?? [], b = t.entityViews?.filter((f) => typeof f != "string") ?? [], C = h.length + b.length;
|
|
3257
3263
|
return /* @__PURE__ */ l("div", { className: "overflow-auto my-auto", children: [
|
|
3258
|
-
/* @__PURE__ */ e(
|
|
3264
|
+
/* @__PURE__ */ e(gt, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ l("div", { className: "flex flex-col gap-16", children: [
|
|
3259
3265
|
/* @__PURE__ */ l("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3260
3266
|
/* @__PURE__ */ l(T, { variant: "h5", children: [
|
|
3261
3267
|
"Subcollections of ",
|
|
@@ -3264,7 +3270,7 @@ function en({
|
|
|
3264
3270
|
P && P.length > 0 && /* @__PURE__ */ e(ke, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(zt, { children: /* @__PURE__ */ e(Rt, { children: P.map((f) => /* @__PURE__ */ l(
|
|
3265
3271
|
Ct,
|
|
3266
3272
|
{
|
|
3267
|
-
onClick: () =>
|
|
3273
|
+
onClick: () => v({
|
|
3268
3274
|
isNewCollection: !1,
|
|
3269
3275
|
editedCollectionPath: f.path
|
|
3270
3276
|
}),
|
|
@@ -3281,7 +3287,7 @@ function en({
|
|
|
3281
3287
|
{
|
|
3282
3288
|
align: "right",
|
|
3283
3289
|
children: /* @__PURE__ */ e(ee, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3284
|
-
|
|
3290
|
+
se,
|
|
3285
3291
|
{
|
|
3286
3292
|
size: "small",
|
|
3287
3293
|
onClick: (I) => {
|
|
@@ -3301,7 +3307,7 @@ function en({
|
|
|
3301
3307
|
R,
|
|
3302
3308
|
{
|
|
3303
3309
|
onClick: () => {
|
|
3304
|
-
|
|
3310
|
+
v({
|
|
3305
3311
|
isNewCollection: !0
|
|
3306
3312
|
});
|
|
3307
3313
|
},
|
|
@@ -3327,7 +3333,7 @@ function en({
|
|
|
3327
3333
|
{
|
|
3328
3334
|
align: "right",
|
|
3329
3335
|
children: /* @__PURE__ */ e(ee, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3330
|
-
|
|
3336
|
+
se,
|
|
3331
3337
|
{
|
|
3332
3338
|
size: "small",
|
|
3333
3339
|
onClick: (I) => {
|
|
@@ -3354,7 +3360,7 @@ function en({
|
|
|
3354
3360
|
}
|
|
3355
3361
|
) }, f.key))
|
|
3356
3362
|
] }) }) }) }),
|
|
3357
|
-
C === 0 && /* @__PURE__ */ l(
|
|
3363
|
+
C === 0 && /* @__PURE__ */ l(ir, { children: [
|
|
3358
3364
|
/* @__PURE__ */ e("b", { children: "COMING SOON" }),
|
|
3359
3365
|
" Define your own custom views by uploading it with the CLI"
|
|
3360
3366
|
] }),
|
|
@@ -3408,23 +3414,23 @@ function en({
|
|
|
3408
3414
|
}
|
|
3409
3415
|
),
|
|
3410
3416
|
/* @__PURE__ */ e(
|
|
3411
|
-
|
|
3417
|
+
mr,
|
|
3412
3418
|
{
|
|
3413
|
-
open: !!
|
|
3419
|
+
open: !!g,
|
|
3414
3420
|
configController: i,
|
|
3415
3421
|
parentCollection: t,
|
|
3416
3422
|
collectionInference: n,
|
|
3417
3423
|
parentCollectionIds: [...o ?? [], N.id],
|
|
3418
3424
|
isNewCollection: !1,
|
|
3419
|
-
...
|
|
3425
|
+
...g,
|
|
3420
3426
|
getUser: a,
|
|
3421
3427
|
handleClose: () => {
|
|
3422
|
-
|
|
3428
|
+
v(void 0);
|
|
3423
3429
|
}
|
|
3424
3430
|
}
|
|
3425
3431
|
),
|
|
3426
3432
|
/* @__PURE__ */ e(
|
|
3427
|
-
|
|
3433
|
+
en,
|
|
3428
3434
|
{
|
|
3429
3435
|
open: m,
|
|
3430
3436
|
onClose: (f) => {
|
|
@@ -3434,7 +3440,7 @@ function en({
|
|
|
3434
3440
|
)
|
|
3435
3441
|
] });
|
|
3436
3442
|
}
|
|
3437
|
-
const
|
|
3443
|
+
const Yt = {
|
|
3438
3444
|
id: "products",
|
|
3439
3445
|
path: "products",
|
|
3440
3446
|
name: "Products",
|
|
@@ -3519,7 +3525,7 @@ const Gt = {
|
|
|
3519
3525
|
autoValue: "on_create"
|
|
3520
3526
|
}
|
|
3521
3527
|
})
|
|
3522
|
-
},
|
|
3528
|
+
}, Gt = {
|
|
3523
3529
|
id: "blog",
|
|
3524
3530
|
path: "blog",
|
|
3525
3531
|
name: "Blog",
|
|
@@ -3631,7 +3637,7 @@ const Gt = {
|
|
|
3631
3637
|
initialFilter: {
|
|
3632
3638
|
status: ["==", "published"]
|
|
3633
3639
|
}
|
|
3634
|
-
},
|
|
3640
|
+
}, Ht = {
|
|
3635
3641
|
id: "users",
|
|
3636
3642
|
path: "users",
|
|
3637
3643
|
name: "Users",
|
|
@@ -3663,7 +3669,7 @@ const Gt = {
|
|
|
3663
3669
|
}
|
|
3664
3670
|
})
|
|
3665
3671
|
};
|
|
3666
|
-
function
|
|
3672
|
+
function rn({
|
|
3667
3673
|
path: t,
|
|
3668
3674
|
pathSuggestions: r,
|
|
3669
3675
|
parentCollection: i,
|
|
@@ -3682,13 +3688,13 @@ function tn({
|
|
|
3682
3688
|
setFieldValue: c,
|
|
3683
3689
|
setValues: d,
|
|
3684
3690
|
handleChange: y,
|
|
3685
|
-
touched:
|
|
3686
|
-
errors:
|
|
3691
|
+
touched: g,
|
|
3692
|
+
errors: v,
|
|
3687
3693
|
setFieldTouched: N,
|
|
3688
3694
|
isSubmitting: x,
|
|
3689
3695
|
submitCount: P
|
|
3690
3696
|
} = H();
|
|
3691
|
-
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ l(
|
|
3697
|
+
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ l(gt, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
3692
3698
|
/* @__PURE__ */ e(
|
|
3693
3699
|
"div",
|
|
3694
3700
|
{
|
|
@@ -3741,9 +3747,9 @@ function tn({
|
|
|
3741
3747
|
{
|
|
3742
3748
|
title: "Products",
|
|
3743
3749
|
subtitle: "A collection of products with images, prices and stock",
|
|
3744
|
-
icon: /* @__PURE__ */ e(xt, { size: "small", iconKey:
|
|
3750
|
+
icon: /* @__PURE__ */ e(xt, { size: "small", iconKey: Yt.icon }),
|
|
3745
3751
|
onClick: () => {
|
|
3746
|
-
d(
|
|
3752
|
+
d(Yt), n();
|
|
3747
3753
|
}
|
|
3748
3754
|
}
|
|
3749
3755
|
),
|
|
@@ -3752,9 +3758,9 @@ function tn({
|
|
|
3752
3758
|
{
|
|
3753
3759
|
title: "Blog posts",
|
|
3754
3760
|
subtitle: "A collection of blog posts with images, authors and complex content",
|
|
3755
|
-
icon: /* @__PURE__ */ e(xt, { size: "small", iconKey:
|
|
3761
|
+
icon: /* @__PURE__ */ e(xt, { size: "small", iconKey: Gt.icon }),
|
|
3756
3762
|
onClick: () => {
|
|
3757
|
-
d(
|
|
3763
|
+
d(Gt), n();
|
|
3758
3764
|
}
|
|
3759
3765
|
}
|
|
3760
3766
|
),
|
|
@@ -3763,9 +3769,9 @@ function tn({
|
|
|
3763
3769
|
{
|
|
3764
3770
|
title: "Users",
|
|
3765
3771
|
subtitle: "A collection of users with emails, names and roles",
|
|
3766
|
-
icon: /* @__PURE__ */ e(xt, { size: "small", iconKey:
|
|
3772
|
+
icon: /* @__PURE__ */ e(xt, { size: "small", iconKey: Ht.icon }),
|
|
3767
3773
|
onClick: () => {
|
|
3768
|
-
d(
|
|
3774
|
+
d(Ht), n();
|
|
3769
3775
|
}
|
|
3770
3776
|
}
|
|
3771
3777
|
)
|
|
@@ -3781,7 +3787,7 @@ function tn({
|
|
|
3781
3787
|
children: "● Create a collection from a file (csv, json, xls, xslx...)"
|
|
3782
3788
|
}
|
|
3783
3789
|
),
|
|
3784
|
-
/* @__PURE__ */ e(
|
|
3790
|
+
/* @__PURE__ */ e(ui, { onDataAdded: (h) => n(h) })
|
|
3785
3791
|
] }),
|
|
3786
3792
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(R, { variant: "text", onClick: () => n(), className: "my-2", children: "Continue from scratch" }) })
|
|
3787
3793
|
] }) });
|
|
@@ -3793,7 +3799,7 @@ function Pt({
|
|
|
3793
3799
|
onClick: n
|
|
3794
3800
|
}) {
|
|
3795
3801
|
return /* @__PURE__ */ e(ee, { title: r, children: /* @__PURE__ */ l(
|
|
3796
|
-
|
|
3802
|
+
nr,
|
|
3797
3803
|
{
|
|
3798
3804
|
onClick: n,
|
|
3799
3805
|
className: Ce(
|
|
@@ -3817,7 +3823,7 @@ function Pt({
|
|
|
3817
3823
|
}
|
|
3818
3824
|
) });
|
|
3819
3825
|
}
|
|
3820
|
-
function
|
|
3826
|
+
function nn({
|
|
3821
3827
|
importConfig: t,
|
|
3822
3828
|
propertyConfigs: r,
|
|
3823
3829
|
collectionEditable: i
|
|
@@ -3827,74 +3833,74 @@ function rn({
|
|
|
3827
3833
|
setFieldTouched: a,
|
|
3828
3834
|
values: o
|
|
3829
3835
|
} = H(), [s, u] = Y(void 0), p = G.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), m = s ? s.id : void 0, c = s || void 0, d = ({
|
|
3830
|
-
id:
|
|
3831
|
-
property:
|
|
3836
|
+
id: g,
|
|
3837
|
+
property: v,
|
|
3832
3838
|
previousId: N,
|
|
3833
3839
|
namespace: x
|
|
3834
3840
|
}) => {
|
|
3835
|
-
const P =
|
|
3841
|
+
const P = g ? le(g, x) : void 0, h = P ? be(P) : void 0, b = (f) => f ? p.current[f] ?? k(o, Oe(f)) : p.current[""], C = (f, I) => {
|
|
3836
3842
|
const z = Oe(I);
|
|
3837
3843
|
n(z, f, !1), p.current[I ?? ""] = f;
|
|
3838
3844
|
};
|
|
3839
|
-
if (N && N !==
|
|
3840
|
-
const f =
|
|
3841
|
-
C(
|
|
3845
|
+
if (N && N !== g) {
|
|
3846
|
+
const f = le(N, x), I = be(f), _ = b(x).map((U) => U === N ? g : U).filter((U) => U !== void 0);
|
|
3847
|
+
C(_, x);
|
|
3842
3848
|
const F = { ...t.headersMapping };
|
|
3843
3849
|
Object.keys(F).forEach((U) => {
|
|
3844
|
-
F[U] === N && (F[U] =
|
|
3850
|
+
F[U] === N && (F[U] = g ?? "");
|
|
3845
3851
|
}), t.setHeadersMapping(F), n(I, void 0, !1), a(I, !1, !1);
|
|
3846
3852
|
}
|
|
3847
|
-
h && (n(h,
|
|
3853
|
+
h && (n(h, v, !1), a(h, !0, !1));
|
|
3848
3854
|
}, y = async ({
|
|
3849
|
-
id:
|
|
3850
|
-
importKey:
|
|
3855
|
+
id: g,
|
|
3856
|
+
importKey: v,
|
|
3851
3857
|
property: N,
|
|
3852
3858
|
namespace: x
|
|
3853
3859
|
}) => {
|
|
3854
|
-
const P =
|
|
3855
|
-
...
|
|
3860
|
+
const P = g ? le(g, x) : void 0, h = P ? be(P) : void 0, b = t.importData.map((f) => k(f, v)), C = {
|
|
3861
|
+
...ii(b, N, or),
|
|
3856
3862
|
editable: !0
|
|
3857
3863
|
};
|
|
3858
3864
|
h && (C ? n(h, C, !1) : n(h, N, !1), a(h, !0, !1));
|
|
3859
3865
|
};
|
|
3860
3866
|
return /* @__PURE__ */ l("div", { className: "overflow-auto my-auto bg-gray-50 dark:bg-gray-900", children: [
|
|
3861
|
-
/* @__PURE__ */ l(
|
|
3867
|
+
/* @__PURE__ */ l(gt, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
3862
3868
|
/* @__PURE__ */ e(T, { variant: "h6", className: "mt-4", children: "Data property mapping" }),
|
|
3863
3869
|
/* @__PURE__ */ e(
|
|
3864
|
-
|
|
3870
|
+
pi,
|
|
3865
3871
|
{
|
|
3866
3872
|
headersMapping: t.headersMapping,
|
|
3867
3873
|
idColumn: t.idColumn,
|
|
3868
3874
|
originProperties: t.originProperties,
|
|
3869
3875
|
destinationProperties: o.properties,
|
|
3870
|
-
onIdPropertyChanged: (
|
|
3876
|
+
onIdPropertyChanged: (g) => t.setIdColumn(g),
|
|
3871
3877
|
buildPropertyView: ({
|
|
3872
|
-
property:
|
|
3873
|
-
propertyKey:
|
|
3878
|
+
property: g,
|
|
3879
|
+
propertyKey: v,
|
|
3874
3880
|
importKey: N
|
|
3875
3881
|
}) => /* @__PURE__ */ e(
|
|
3876
|
-
|
|
3882
|
+
mi,
|
|
3877
3883
|
{
|
|
3878
|
-
property:
|
|
3879
|
-
propertyKey:
|
|
3884
|
+
property: g,
|
|
3885
|
+
propertyKey: v,
|
|
3880
3886
|
onPropertyNameChanged: (x, P) => n(`properties.${x}.name`, P, !1),
|
|
3881
3887
|
onEditClick: () => {
|
|
3882
|
-
!
|
|
3883
|
-
...
|
|
3884
|
-
id:
|
|
3888
|
+
!v || !g || u({
|
|
3889
|
+
...g,
|
|
3890
|
+
id: v,
|
|
3885
3891
|
editable: !0
|
|
3886
3892
|
});
|
|
3887
3893
|
},
|
|
3888
3894
|
propertyTypeView: /* @__PURE__ */ e(
|
|
3889
|
-
|
|
3895
|
+
on,
|
|
3890
3896
|
{
|
|
3891
|
-
property:
|
|
3897
|
+
property: g,
|
|
3892
3898
|
disabled: !1,
|
|
3893
3899
|
onPropertyChanged: (x) => y({
|
|
3894
3900
|
...x,
|
|
3895
3901
|
importKey: N
|
|
3896
3902
|
}),
|
|
3897
|
-
propertyKey:
|
|
3903
|
+
propertyKey: v,
|
|
3898
3904
|
propertyConfigs: r
|
|
3899
3905
|
}
|
|
3900
3906
|
)
|
|
@@ -3928,14 +3934,14 @@ function rn({
|
|
|
3928
3934
|
/* @__PURE__ */ e("div", { style: { height: "52px" } })
|
|
3929
3935
|
] });
|
|
3930
3936
|
}
|
|
3931
|
-
function
|
|
3937
|
+
function on({
|
|
3932
3938
|
property: t,
|
|
3933
3939
|
onPropertyChanged: r,
|
|
3934
3940
|
propertyKey: i,
|
|
3935
3941
|
propertyConfigs: n,
|
|
3936
3942
|
disabled: a
|
|
3937
3943
|
}) {
|
|
3938
|
-
const o = t ?
|
|
3944
|
+
const o = t ? Kt(t) : null, s = t ? Qe(t, n) : null, [u, p] = Y(!1);
|
|
3939
3945
|
return /* @__PURE__ */ e(
|
|
3940
3946
|
ee,
|
|
3941
3947
|
{
|
|
@@ -3955,7 +3961,7 @@ function nn({
|
|
|
3955
3961
|
position: "item-aligned",
|
|
3956
3962
|
renderValue: (m) => s ? /* @__PURE__ */ e(We, { propertyConfig: s }) : null,
|
|
3957
3963
|
onValueChange: (m) => {
|
|
3958
|
-
const c =
|
|
3964
|
+
const c = ar(t, m, n);
|
|
3959
3965
|
i && r({
|
|
3960
3966
|
id: i,
|
|
3961
3967
|
property: c,
|
|
@@ -3963,8 +3969,8 @@ function nn({
|
|
|
3963
3969
|
namespace: void 0
|
|
3964
3970
|
});
|
|
3965
3971
|
},
|
|
3966
|
-
children: Object.entries(
|
|
3967
|
-
|
|
3972
|
+
children: Object.entries(cr).map(([m, c]) => /* @__PURE__ */ e(
|
|
3973
|
+
sr,
|
|
3968
3974
|
{
|
|
3969
3975
|
value: m,
|
|
3970
3976
|
optionDisabled: !1,
|
|
@@ -3978,14 +3984,14 @@ function nn({
|
|
|
3978
3984
|
}
|
|
3979
3985
|
);
|
|
3980
3986
|
}
|
|
3981
|
-
function
|
|
3987
|
+
function ln({ importConfig: t, properties: r, propertiesOrder: i }) {
|
|
3982
3988
|
ue(() => {
|
|
3983
|
-
const a =
|
|
3989
|
+
const a = hi(t.originProperties, r), o = t.importData.map((s) => fi(s, t.idColumn, t.headersMapping, r, a, "TEMP_PATH"));
|
|
3984
3990
|
t.setEntities(o);
|
|
3985
3991
|
}, []);
|
|
3986
|
-
const n =
|
|
3992
|
+
const n = Tr();
|
|
3987
3993
|
return /* @__PURE__ */ e(
|
|
3988
|
-
|
|
3994
|
+
kr,
|
|
3989
3995
|
{
|
|
3990
3996
|
title: /* @__PURE__ */ l("div", { children: [
|
|
3991
3997
|
/* @__PURE__ */ e(T, { variant: "subtitle2", children: "Imported data preview" }),
|
|
@@ -4005,11 +4011,11 @@ function on({ importConfig: t, properties: r, propertiesOrder: i }) {
|
|
|
4005
4011
|
}
|
|
4006
4012
|
);
|
|
4007
4013
|
}
|
|
4008
|
-
function
|
|
4014
|
+
function pr(t, r = "") {
|
|
4009
4015
|
const i = Object.keys(t).reduce((o, s) => {
|
|
4010
|
-
const u = t[s], p =
|
|
4016
|
+
const u = t[s], p = Vr(s), m = r ? `${r}.${p}` : p;
|
|
4011
4017
|
if (u.dataType === "map" && u.properties) {
|
|
4012
|
-
const y =
|
|
4018
|
+
const y = pr(u.properties, m);
|
|
4013
4019
|
return {
|
|
4014
4020
|
headersMapping: { ...o.headersMapping, [s]: m },
|
|
4015
4021
|
properties: {
|
|
@@ -4037,8 +4043,8 @@ function mr(t, r = "") {
|
|
|
4037
4043
|
idColumn: a
|
|
4038
4044
|
};
|
|
4039
4045
|
}
|
|
4040
|
-
function
|
|
4041
|
-
const r = t.open, [i, n] = je.useState(!1), [a, o] = je.useState(!1), s =
|
|
4046
|
+
function mr(t) {
|
|
4047
|
+
const r = t.open, [i, n] = je.useState(!1), [a, o] = je.useState(!1), s = Q(() => {
|
|
4042
4048
|
i ? o(!0) : t.handleClose(void 0);
|
|
4043
4049
|
}, [i, t.handleClose]);
|
|
4044
4050
|
return ue(() => {
|
|
@@ -4054,7 +4060,7 @@ function hr(t) {
|
|
|
4054
4060
|
onOpenChange: (u) => u ? void 0 : s(),
|
|
4055
4061
|
children: [
|
|
4056
4062
|
r && /* @__PURE__ */ e(
|
|
4057
|
-
|
|
4063
|
+
an,
|
|
4058
4064
|
{
|
|
4059
4065
|
...t,
|
|
4060
4066
|
handleCancel: s,
|
|
@@ -4062,7 +4068,7 @@ function hr(t) {
|
|
|
4062
4068
|
}
|
|
4063
4069
|
),
|
|
4064
4070
|
/* @__PURE__ */ e(
|
|
4065
|
-
|
|
4071
|
+
Xi,
|
|
4066
4072
|
{
|
|
4067
4073
|
open: a,
|
|
4068
4074
|
handleOk: () => t.handleClose(void 0),
|
|
@@ -4074,7 +4080,7 @@ function hr(t) {
|
|
|
4074
4080
|
}
|
|
4075
4081
|
);
|
|
4076
4082
|
}
|
|
4077
|
-
function
|
|
4083
|
+
function an({
|
|
4078
4084
|
isNewCollection: t,
|
|
4079
4085
|
initialValues: r,
|
|
4080
4086
|
configController: i,
|
|
@@ -4088,41 +4094,41 @@ function ln({
|
|
|
4088
4094
|
handleCancel: c,
|
|
4089
4095
|
setFormDirty: d,
|
|
4090
4096
|
pathSuggestions: y,
|
|
4091
|
-
getUser:
|
|
4092
|
-
parentCollection:
|
|
4097
|
+
getUser: g,
|
|
4098
|
+
parentCollection: v,
|
|
4093
4099
|
getData: N
|
|
4094
4100
|
}) {
|
|
4095
4101
|
const { propertyConfigs: x } = Le(), P = Me(), {
|
|
4096
4102
|
topLevelNavigation: h,
|
|
4097
4103
|
collections: b
|
|
4098
|
-
} = P, C = !r?.path && (a ?? []).length === 0, f = (
|
|
4104
|
+
} = P, C = !r?.path && (a ?? []).length === 0, f = (v ? v.subcollections : b) ?? [], I = f.map((S) => S.path.trim().toLowerCase()), z = f.map((S) => S.id?.trim().toLowerCase()).filter(Boolean), _ = gi();
|
|
4099
4105
|
if (!h)
|
|
4100
4106
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
4101
4107
|
const {
|
|
4102
4108
|
groups: F
|
|
4103
|
-
} = h, U = De(), V = qe(), O = Je({}), M = t ? C ? "welcome" : "details" : "properties", [w, A] = Y(M), [fe, Ne] = je.useState(), [D, Z] = je.useState(), [ie, pe] = je.useState(!1), [
|
|
4109
|
+
} = h, U = De(), V = qe(), O = Je({}), M = t ? C ? "welcome" : "details" : "properties", [w, A] = Y(M), [fe, Ne] = je.useState(), [D, Z] = je.useState(), [ie, pe] = je.useState(!1), [ce, Ee] = je.useState();
|
|
4104
4110
|
ue(() => {
|
|
4105
4111
|
try {
|
|
4106
4112
|
P.initialised && (Z(n ? P.getCollectionFromPaths([...a ?? [], n]) : void 0), pe(!0));
|
|
4107
|
-
} catch (
|
|
4108
|
-
console.error(
|
|
4113
|
+
} catch (S) {
|
|
4114
|
+
console.error(S), Ee(ce);
|
|
4109
4115
|
}
|
|
4110
|
-
}, [P.getCollectionFromPaths, n,
|
|
4111
|
-
const me = (
|
|
4112
|
-
const B =
|
|
4116
|
+
}, [P.getCollectionFromPaths, n, ce, P.initialised]);
|
|
4117
|
+
const me = (S) => {
|
|
4118
|
+
const B = S.id || S.path;
|
|
4113
4119
|
return i.saveCollection({
|
|
4114
4120
|
id: B,
|
|
4115
|
-
collectionData:
|
|
4121
|
+
collectionData: S,
|
|
4116
4122
|
previousPath: n,
|
|
4117
4123
|
parentCollectionIds: a
|
|
4118
|
-
}).then(() => (Ne(void 0), !0)).catch((
|
|
4124
|
+
}).then(() => (Ne(void 0), !0)).catch((q) => (Ne(q), console.error(q), U.open({
|
|
4119
4125
|
type: "error",
|
|
4120
|
-
message: "Error persisting collection: " + (
|
|
4126
|
+
message: "Error persisting collection: " + (q.message ?? "Details in the console")
|
|
4121
4127
|
}), !1));
|
|
4122
|
-
},
|
|
4128
|
+
}, ye = D ? {
|
|
4123
4129
|
...D,
|
|
4124
4130
|
id: D.id ?? D.path ?? St(16)
|
|
4125
|
-
} : void 0, Fe =
|
|
4131
|
+
} : void 0, Fe = ye ? sn(ye, x) : {
|
|
4126
4132
|
id: r?.path ?? St(16),
|
|
4127
4133
|
path: r?.path ?? "",
|
|
4128
4134
|
name: r?.name ?? "",
|
|
@@ -4131,107 +4137,107 @@ function ln({
|
|
|
4131
4137
|
propertiesOrder: [],
|
|
4132
4138
|
icon: Ut[Math.floor(Math.random() * Ut.length)],
|
|
4133
4139
|
ownerId: V.user?.uid ?? ""
|
|
4134
|
-
},
|
|
4135
|
-
w === "details" ?
|
|
4136
|
-
}, [w,
|
|
4140
|
+
}, de = Q(() => {
|
|
4141
|
+
w === "details" ? _.inUse ? A("import_data_saving") : A(m ? "extra_view" : "properties") : A(w === "welcome" ? "details" : w === "import_data_mapping" ? "import_data_preview" : w === "import_data_preview" ? "details" : w === "extra_view" ? "properties" : "details");
|
|
4142
|
+
}, [w, _.inUse, m]), _e = Q((S) => {
|
|
4137
4143
|
if (s)
|
|
4138
|
-
return s?.(
|
|
4139
|
-
}, [s, a]), rt =
|
|
4144
|
+
return s?.(S.path, S.collectionGroup ?? !1, a ?? []);
|
|
4145
|
+
}, [s, a]), rt = Q(async (S) => {
|
|
4140
4146
|
try {
|
|
4141
4147
|
if (!_e)
|
|
4142
|
-
return Z(
|
|
4148
|
+
return Z(S), Promise.resolve(S);
|
|
4143
4149
|
A("loading");
|
|
4144
|
-
const B = await _e?.(
|
|
4150
|
+
const B = await _e?.(S);
|
|
4145
4151
|
if (!B)
|
|
4146
|
-
return Z(
|
|
4147
|
-
const
|
|
4148
|
-
...
|
|
4152
|
+
return Z(S), Promise.resolve(S);
|
|
4153
|
+
const q = {
|
|
4154
|
+
...S ?? {}
|
|
4149
4155
|
};
|
|
4150
|
-
return Object.keys(B.properties ?? {}).length > 0 && (
|
|
4151
|
-
newCollection:
|
|
4152
|
-
values:
|
|
4153
|
-
}),
|
|
4156
|
+
return Object.keys(B.properties ?? {}).length > 0 && (q.properties = B.properties, q.propertiesOrder = B.propertiesOrder), q.propertiesOrder ? (Z(q), console.log("Inferred collection", {
|
|
4157
|
+
newCollection: S ?? {},
|
|
4158
|
+
values: q
|
|
4159
|
+
}), q) : (q.propertiesOrder = Object.keys(q.properties), q);
|
|
4154
4160
|
} catch (B) {
|
|
4155
4161
|
return console.error(B), U.open({
|
|
4156
4162
|
type: "error",
|
|
4157
4163
|
message: "Error inferring collection: " + (B.message ?? "Details in the console")
|
|
4158
|
-
}),
|
|
4164
|
+
}), S;
|
|
4159
4165
|
}
|
|
4160
|
-
}, [a, _e]), bt = (
|
|
4166
|
+
}, [a, _e]), bt = (S, B) => {
|
|
4161
4167
|
try {
|
|
4162
|
-
if (console.log("Submitting collection",
|
|
4163
|
-
me(
|
|
4164
|
-
B.resetForm({ values: Fe }), u(
|
|
4168
|
+
if (console.log("Submitting collection", S), !t) {
|
|
4169
|
+
me(S).then(() => {
|
|
4170
|
+
B.resetForm({ values: Fe }), u(S);
|
|
4165
4171
|
});
|
|
4166
4172
|
return;
|
|
4167
4173
|
}
|
|
4168
|
-
w === "welcome" ? (
|
|
4174
|
+
w === "welcome" ? (de(), B.resetForm({ values: S })) : w === "details" ? m || _.inUse ? (B.resetForm({ values: S }), de()) : t ? rt(S).then((q) => {
|
|
4169
4175
|
B.resetForm({
|
|
4170
|
-
values:
|
|
4176
|
+
values: q ?? S,
|
|
4171
4177
|
touched: {
|
|
4172
4178
|
path: !0,
|
|
4173
4179
|
name: !0
|
|
4174
4180
|
}
|
|
4175
4181
|
});
|
|
4176
4182
|
}).finally(() => {
|
|
4177
|
-
|
|
4178
|
-
}) : (B.resetForm({ values:
|
|
4179
|
-
B.resetForm({ values: Fe }),
|
|
4180
|
-
}) : (
|
|
4181
|
-
} catch (
|
|
4183
|
+
de();
|
|
4184
|
+
}) : (B.resetForm({ values: S }), de()) : w === "extra_view" ? (de(), B.resetForm({ values: S })) : w === "import_data_mapping" || w === "import_data_preview" ? de() : w === "properties" ? me(S).then(() => {
|
|
4185
|
+
B.resetForm({ values: Fe }), de(), u(S);
|
|
4186
|
+
}) : (de(), B.resetForm({ values: S }));
|
|
4187
|
+
} catch (q) {
|
|
4182
4188
|
U.open({
|
|
4183
4189
|
type: "error",
|
|
4184
|
-
message: "Error persisting collection: " + (
|
|
4185
|
-
}), console.error(
|
|
4190
|
+
message: "Error persisting collection: " + (q.message ?? "Details in the console")
|
|
4191
|
+
}), console.error(q), B.resetForm({ values: S });
|
|
4186
4192
|
}
|
|
4187
4193
|
};
|
|
4188
4194
|
return !t && (!P.initialised || !ie) ? /* @__PURE__ */ e(At, {}) : /* @__PURE__ */ e(Ye, { fullHeight: !0, children: /* @__PURE__ */ e(
|
|
4189
4195
|
Vt,
|
|
4190
4196
|
{
|
|
4191
4197
|
initialValues: Fe,
|
|
4192
|
-
validationSchema: (w === "properties" || w === "subcollections" || w === "details") &&
|
|
4193
|
-
validate: (
|
|
4198
|
+
validationSchema: (w === "properties" || w === "subcollections" || w === "details") && bi,
|
|
4199
|
+
validate: (S) => {
|
|
4194
4200
|
if (w === "properties")
|
|
4195
4201
|
return O.current;
|
|
4196
4202
|
const B = {};
|
|
4197
4203
|
if (w === "details") {
|
|
4198
|
-
const
|
|
4199
|
-
|
|
4200
|
-
const Pe =
|
|
4204
|
+
const q = Zt(S.path, t, I, S.id);
|
|
4205
|
+
q && (B.path = q);
|
|
4206
|
+
const Pe = cn(S.id, t, I, z);
|
|
4201
4207
|
Pe && (B.id = Pe);
|
|
4202
4208
|
}
|
|
4203
4209
|
return B;
|
|
4204
4210
|
},
|
|
4205
4211
|
onSubmit: bt,
|
|
4206
|
-
children: (
|
|
4212
|
+
children: (S) => {
|
|
4207
4213
|
const {
|
|
4208
4214
|
values: B,
|
|
4209
|
-
errors:
|
|
4215
|
+
errors: q,
|
|
4210
4216
|
setFieldValue: Pe,
|
|
4211
4217
|
isSubmitting: He,
|
|
4212
|
-
dirty:
|
|
4213
|
-
submitCount:
|
|
4214
|
-
} =
|
|
4218
|
+
dirty: E,
|
|
4219
|
+
submitCount: L
|
|
4220
|
+
} = S, $ = B.path ?? n, ne = o?.includes("/") ? o?.split("/").slice(0, -1).join("/") + "/" + $ : $, te = Zt($, t, I, B.id), ge = !te && a ? P.convertIdsToPaths(a) : void 0, it = te ? void 0 : P.resolveAliasesFrom(ne), nt = it && N ? () => N(it, ge ?? []) : void 0;
|
|
4215
4221
|
ue(() => {
|
|
4216
|
-
d(
|
|
4217
|
-
}, [
|
|
4218
|
-
function It(
|
|
4219
|
-
|
|
4220
|
-
const Se =
|
|
4221
|
-
Pe("properties", Se.properties), Pe("propertiesOrder", Object.keys(Se.properties)),
|
|
4222
|
+
d(E);
|
|
4223
|
+
}, [E]);
|
|
4224
|
+
function It(oe) {
|
|
4225
|
+
_.setInUse(!0), ni(oe, or).then((_t) => {
|
|
4226
|
+
const Se = pr(_t);
|
|
4227
|
+
Pe("properties", Se.properties), Pe("propertiesOrder", Object.keys(Se.properties)), _.setIdColumn(Se.idColumn), _.setImportData(oe), _.setHeadersMapping(Se.headersMapping), _.setOriginProperties(Se.properties);
|
|
4222
4228
|
});
|
|
4223
4229
|
}
|
|
4224
4230
|
const ot = !!B.name && !!B.id, Ue = () => {
|
|
4225
|
-
const
|
|
4226
|
-
|
|
4231
|
+
const oe = { ...B.properties };
|
|
4232
|
+
_.idColumn && delete oe[_.idColumn], Pe("properties", oe), de();
|
|
4227
4233
|
}, Et = D?.editable === void 0 || D?.editable === !0 || t;
|
|
4228
4234
|
return /* @__PURE__ */ l(j, { children: [
|
|
4229
4235
|
!t && /* @__PURE__ */ l(
|
|
4230
|
-
|
|
4236
|
+
Hr,
|
|
4231
4237
|
{
|
|
4232
4238
|
value: w,
|
|
4233
4239
|
className: Ce(kt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
4234
|
-
onValueChange: (
|
|
4240
|
+
onValueChange: (oe) => A(oe),
|
|
4235
4241
|
children: [
|
|
4236
4242
|
/* @__PURE__ */ e(Nt, { value: "details", children: "Details" }),
|
|
4237
4243
|
/* @__PURE__ */ e(Nt, { value: "properties", children: "Properties" }),
|
|
@@ -4240,7 +4246,7 @@ function ln({
|
|
|
4240
4246
|
}
|
|
4241
4247
|
),
|
|
4242
4248
|
/* @__PURE__ */ l(
|
|
4243
|
-
|
|
4249
|
+
ti,
|
|
4244
4250
|
{
|
|
4245
4251
|
noValidate: !0,
|
|
4246
4252
|
className: Ce(
|
|
@@ -4251,40 +4257,40 @@ function ln({
|
|
|
4251
4257
|
w === "loading" && /* @__PURE__ */ e(At, {}),
|
|
4252
4258
|
w === "extra_view" && $ && m?.View && /* @__PURE__ */ e(m.View, { path: $ }),
|
|
4253
4259
|
w === "welcome" && /* @__PURE__ */ e(
|
|
4254
|
-
|
|
4260
|
+
rn,
|
|
4255
4261
|
{
|
|
4256
4262
|
path: $,
|
|
4257
|
-
onContinue: (
|
|
4258
|
-
|
|
4263
|
+
onContinue: (oe) => {
|
|
4264
|
+
oe ? (It(oe), A("import_data_mapping")) : A("details");
|
|
4259
4265
|
},
|
|
4260
4266
|
collections: b,
|
|
4261
|
-
parentCollection:
|
|
4267
|
+
parentCollection: v,
|
|
4262
4268
|
pathSuggestions: y
|
|
4263
4269
|
}
|
|
4264
4270
|
),
|
|
4265
|
-
w === "import_data_mapping" &&
|
|
4266
|
-
|
|
4271
|
+
w === "import_data_mapping" && _ && /* @__PURE__ */ e(
|
|
4272
|
+
nn,
|
|
4267
4273
|
{
|
|
4268
|
-
importConfig:
|
|
4274
|
+
importConfig: _,
|
|
4269
4275
|
collectionEditable: Et,
|
|
4270
4276
|
propertyConfigs: x
|
|
4271
4277
|
}
|
|
4272
4278
|
),
|
|
4273
|
-
w === "import_data_preview" &&
|
|
4274
|
-
|
|
4279
|
+
w === "import_data_preview" && _ && /* @__PURE__ */ e(
|
|
4280
|
+
ln,
|
|
4275
4281
|
{
|
|
4276
|
-
importConfig:
|
|
4282
|
+
importConfig: _,
|
|
4277
4283
|
properties: B.properties,
|
|
4278
4284
|
propertiesOrder: B.propertiesOrder
|
|
4279
4285
|
}
|
|
4280
4286
|
),
|
|
4281
|
-
w === "import_data_saving" &&
|
|
4287
|
+
w === "import_data_saving" && _ && /* @__PURE__ */ e(
|
|
4282
4288
|
vi,
|
|
4283
4289
|
{
|
|
4284
|
-
importConfig:
|
|
4290
|
+
importConfig: _,
|
|
4285
4291
|
collection: B,
|
|
4286
|
-
onImportSuccess: (
|
|
4287
|
-
u(
|
|
4292
|
+
onImportSuccess: (oe) => {
|
|
4293
|
+
u(oe), U.open({
|
|
4288
4294
|
type: "info",
|
|
4289
4295
|
message: "Data imported successfully"
|
|
4290
4296
|
});
|
|
@@ -4292,46 +4298,46 @@ function ln({
|
|
|
4292
4298
|
}
|
|
4293
4299
|
),
|
|
4294
4300
|
w === "details" && /* @__PURE__ */ e(
|
|
4295
|
-
|
|
4301
|
+
Ci,
|
|
4296
4302
|
{
|
|
4297
4303
|
existingPaths: I,
|
|
4298
4304
|
existingIds: z,
|
|
4299
4305
|
groups: F,
|
|
4300
4306
|
parentCollectionIds: a,
|
|
4301
|
-
parentCollection:
|
|
4307
|
+
parentCollection: v,
|
|
4302
4308
|
isNewCollection: t
|
|
4303
4309
|
}
|
|
4304
4310
|
),
|
|
4305
4311
|
w === "subcollections" && D && /* @__PURE__ */ e(
|
|
4306
|
-
|
|
4312
|
+
tn,
|
|
4307
4313
|
{
|
|
4308
|
-
parentCollection:
|
|
4314
|
+
parentCollection: v,
|
|
4309
4315
|
configController: i,
|
|
4310
|
-
getUser:
|
|
4316
|
+
getUser: g,
|
|
4311
4317
|
collectionInference: s,
|
|
4312
4318
|
parentCollectionIds: a,
|
|
4313
4319
|
collection: D
|
|
4314
4320
|
}
|
|
4315
4321
|
),
|
|
4316
4322
|
w === "properties" && /* @__PURE__ */ e(
|
|
4317
|
-
|
|
4323
|
+
Wi,
|
|
4318
4324
|
{
|
|
4319
|
-
showErrors:
|
|
4325
|
+
showErrors: L > 0,
|
|
4320
4326
|
isNewCollection: t,
|
|
4321
4327
|
reservedGroups: p,
|
|
4322
|
-
onPropertyError: (
|
|
4323
|
-
O.current =
|
|
4328
|
+
onPropertyError: (oe, _t, Se) => {
|
|
4329
|
+
O.current = Fr({
|
|
4324
4330
|
...O.current,
|
|
4325
|
-
[
|
|
4331
|
+
[oe]: Se
|
|
4326
4332
|
}, !0);
|
|
4327
4333
|
},
|
|
4328
|
-
getUser:
|
|
4334
|
+
getUser: g,
|
|
4329
4335
|
getData: nt,
|
|
4330
4336
|
doCollectionInference: _e,
|
|
4331
4337
|
propertyConfigs: x,
|
|
4332
4338
|
collectionEditable: Et,
|
|
4333
4339
|
extraIcon: m?.icon && /* @__PURE__ */ e(
|
|
4334
|
-
|
|
4340
|
+
se,
|
|
4335
4341
|
{
|
|
4336
4342
|
color: "primary",
|
|
4337
4343
|
onClick: () => A("extra_view"),
|
|
@@ -4345,13 +4351,13 @@ function ln({
|
|
|
4345
4351
|
{
|
|
4346
4352
|
position: "absolute",
|
|
4347
4353
|
children: [
|
|
4348
|
-
fe && /* @__PURE__ */ e(
|
|
4354
|
+
fe && /* @__PURE__ */ e(Qt, { error: fe }),
|
|
4349
4355
|
t && C && w === "import_data_mapping" && /* @__PURE__ */ l(
|
|
4350
4356
|
R,
|
|
4351
4357
|
{
|
|
4352
4358
|
variant: "text",
|
|
4353
4359
|
type: "button",
|
|
4354
|
-
onClick: () => (
|
|
4360
|
+
onClick: () => (_.setInUse(!1), A("welcome")),
|
|
4355
4361
|
children: [
|
|
4356
4362
|
/* @__PURE__ */ e(lt, {}),
|
|
4357
4363
|
"Back"
|
|
@@ -4421,7 +4427,7 @@ function ln({
|
|
|
4421
4427
|
variant: "filled",
|
|
4422
4428
|
color: "primary",
|
|
4423
4429
|
onClick: () => {
|
|
4424
|
-
|
|
4430
|
+
de();
|
|
4425
4431
|
},
|
|
4426
4432
|
children: "Next"
|
|
4427
4433
|
}
|
|
@@ -4434,7 +4440,7 @@ function ln({
|
|
|
4434
4440
|
type: "submit",
|
|
4435
4441
|
loading: He,
|
|
4436
4442
|
disabled: He || w === "details" && !ot,
|
|
4437
|
-
startIcon: w === "properties" ? /* @__PURE__ */ e(
|
|
4443
|
+
startIcon: w === "properties" ? /* @__PURE__ */ e(Zr, {}) : void 0,
|
|
4438
4444
|
children: [
|
|
4439
4445
|
w === "details" && "Next",
|
|
4440
4446
|
w === "properties" && "Create collection"
|
|
@@ -4462,13 +4468,13 @@ function ln({
|
|
|
4462
4468
|
}
|
|
4463
4469
|
) });
|
|
4464
4470
|
}
|
|
4465
|
-
function
|
|
4471
|
+
function sn(t, r) {
|
|
4466
4472
|
const { properties: i, ...n } = t, a = {};
|
|
4467
4473
|
return Object.keys(i).forEach((o) => {
|
|
4468
|
-
a[o] =
|
|
4474
|
+
a[o] = hr(i[o], r);
|
|
4469
4475
|
}), { ...n, properties: a };
|
|
4470
4476
|
}
|
|
4471
|
-
function
|
|
4477
|
+
function hr(t, r) {
|
|
4472
4478
|
let i = t;
|
|
4473
4479
|
if (r && typeof i == "object" && i.propertyConfig) {
|
|
4474
4480
|
const n = r[i.propertyConfig];
|
|
@@ -4477,21 +4483,21 @@ function fr(t, r) {
|
|
|
4477
4483
|
else if (n && (i = J(n.property, i)), !re(i) && i.dataType === "map" && i.properties) {
|
|
4478
4484
|
const a = {};
|
|
4479
4485
|
Object.keys(i.properties).forEach((o) => {
|
|
4480
|
-
a[o] =
|
|
4486
|
+
a[o] = hr(i.properties[o], r);
|
|
4481
4487
|
}), i = { ...i, properties: a };
|
|
4482
4488
|
}
|
|
4483
4489
|
}
|
|
4484
4490
|
return i;
|
|
4485
4491
|
}
|
|
4486
|
-
const
|
|
4492
|
+
const Zt = (t, r, i, n) => {
|
|
4487
4493
|
let a;
|
|
4488
|
-
return t || (a = "You must specify a path in the database for this collection"), r && i?.includes(t.trim().toLowerCase()) && !n && (a = "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"),
|
|
4489
|
-
},
|
|
4494
|
+
return t || (a = "You must specify a path in the database for this collection"), r && i?.includes(t.trim().toLowerCase()) && !n && (a = "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"), Ir(t).split("/").length % 2 === 0 && (a = `Collection paths must have an odd number of segments: ${t}`), a;
|
|
4495
|
+
}, cn = (t, r, i, n) => {
|
|
4490
4496
|
if (!t)
|
|
4491
4497
|
return;
|
|
4492
4498
|
let a;
|
|
4493
4499
|
return r && i?.includes(t.trim().toLowerCase()) && (a = "There is already a collection that uses this value as a path"), r && n?.includes(t.trim().toLowerCase()) && (a = "There is already a collection which uses this id"), a;
|
|
4494
|
-
},
|
|
4500
|
+
}, fr = G.createContext({}), gr = G.createContext({}), dn = G.memo(
|
|
4495
4501
|
function({
|
|
4496
4502
|
children: r,
|
|
4497
4503
|
collectionConfigController: i,
|
|
@@ -4504,7 +4510,7 @@ const Jt = (t, r, i, n) => {
|
|
|
4504
4510
|
getData: m,
|
|
4505
4511
|
onAnalyticsEvent: c
|
|
4506
4512
|
}) {
|
|
4507
|
-
const d = Me(), y =
|
|
4513
|
+
const d = Me(), y = yi(), g = De(), { propertyConfigs: v } = Le(), {
|
|
4508
4514
|
collections: N
|
|
4509
4515
|
} = d, x = N.map((O) => O.path.trim().toLowerCase()), [P, h] = G.useState();
|
|
4510
4516
|
ue(() => {
|
|
@@ -4512,11 +4518,11 @@ const Jt = (t, r, i, n) => {
|
|
|
4512
4518
|
h(O.filter((M) => !x.includes(M.trim().toLowerCase())));
|
|
4513
4519
|
});
|
|
4514
4520
|
}, [u]);
|
|
4515
|
-
const [b, C] = G.useState(), [f, I] = G.useState(), z =
|
|
4521
|
+
const [b, C] = G.useState(), [f, I] = G.useState(), z = Q(() => ({
|
|
4516
4522
|
createCollections: !0,
|
|
4517
4523
|
editCollections: !0,
|
|
4518
4524
|
deleteCollections: !0
|
|
4519
|
-
}), []),
|
|
4525
|
+
}), []), _ = Q(({
|
|
4520
4526
|
path: O,
|
|
4521
4527
|
fullPath: M,
|
|
4522
4528
|
parentCollectionIds: w,
|
|
@@ -4530,7 +4536,7 @@ const Jt = (t, r, i, n) => {
|
|
|
4530
4536
|
parentCollection: A,
|
|
4531
4537
|
redirect: !1
|
|
4532
4538
|
});
|
|
4533
|
-
}, []), F =
|
|
4539
|
+
}, []), F = Q(({
|
|
4534
4540
|
propertyKey: O,
|
|
4535
4541
|
property: M,
|
|
4536
4542
|
editedCollectionPath: w,
|
|
@@ -4563,11 +4569,11 @@ const Jt = (t, r, i, n) => {
|
|
|
4563
4569
|
redirect: A
|
|
4564
4570
|
});
|
|
4565
4571
|
}, []), V = u ? (O) => !O && P ? Promise.resolve(P) : u?.(O) : void 0;
|
|
4566
|
-
return /* @__PURE__ */ e(
|
|
4572
|
+
return /* @__PURE__ */ e(fr.Provider, { value: i, children: /* @__PURE__ */ l(
|
|
4567
4573
|
gr.Provider,
|
|
4568
4574
|
{
|
|
4569
4575
|
value: {
|
|
4570
|
-
editCollection:
|
|
4576
|
+
editCollection: _,
|
|
4571
4577
|
createCollection: U,
|
|
4572
4578
|
editProperty: F,
|
|
4573
4579
|
configPermissions: n ?? z,
|
|
@@ -4576,7 +4582,7 @@ const Jt = (t, r, i, n) => {
|
|
|
4576
4582
|
children: [
|
|
4577
4583
|
r,
|
|
4578
4584
|
/* @__PURE__ */ e(
|
|
4579
|
-
|
|
4585
|
+
mr,
|
|
4580
4586
|
{
|
|
4581
4587
|
open: !!b,
|
|
4582
4588
|
configController: i,
|
|
@@ -4626,7 +4632,7 @@ const Jt = (t, r, i, n) => {
|
|
|
4626
4632
|
newPropertiesOrder: w && f.currentPropertiesOrder ? [...f.currentPropertiesOrder, O] : void 0,
|
|
4627
4633
|
namespace: f.namespace,
|
|
4628
4634
|
parentCollectionIds: f.parentCollectionIds
|
|
4629
|
-
}).catch((A) => (console.error(A),
|
|
4635
|
+
}).catch((A) => (console.error(A), g.open({
|
|
4630
4636
|
type: "error",
|
|
4631
4637
|
message: "Error persisting property: " + (A.message ?? "Details in the console")
|
|
4632
4638
|
}), !1));
|
|
@@ -4644,7 +4650,7 @@ const Jt = (t, r, i, n) => {
|
|
|
4644
4650
|
parentCollectionIds: f?.parentCollectionIds
|
|
4645
4651
|
}).then(() => {
|
|
4646
4652
|
I(void 0);
|
|
4647
|
-
}).catch((M) => (console.error(M),
|
|
4653
|
+
}).catch((M) => (console.error(M), g.open({
|
|
4648
4654
|
type: "error",
|
|
4649
4655
|
message: "Error deleting property: " + (M.message ?? "Details in the console")
|
|
4650
4656
|
}), !1));
|
|
@@ -4661,7 +4667,7 @@ const Jt = (t, r, i, n) => {
|
|
|
4661
4667
|
forceShowErrors: !1,
|
|
4662
4668
|
existingPropertyKeys: [],
|
|
4663
4669
|
allowDataInference: !0,
|
|
4664
|
-
propertyConfigs:
|
|
4670
|
+
propertyConfigs: v,
|
|
4665
4671
|
property: f?.property,
|
|
4666
4672
|
propertyKey: f?.propertyKey
|
|
4667
4673
|
}
|
|
@@ -4671,14 +4677,14 @@ const Jt = (t, r, i, n) => {
|
|
|
4671
4677
|
) });
|
|
4672
4678
|
},
|
|
4673
4679
|
pt
|
|
4674
|
-
), Ie = () =>
|
|
4675
|
-
function
|
|
4680
|
+
), Ie = () => Xt(gr), vr = () => Xt(fr);
|
|
4681
|
+
function un({
|
|
4676
4682
|
path: t,
|
|
4677
4683
|
parentCollectionIds: r,
|
|
4678
4684
|
collection: i,
|
|
4679
4685
|
tableController: n
|
|
4680
4686
|
}) {
|
|
4681
|
-
const a = qe(), o = Me(), s = Ie(), u =
|
|
4687
|
+
const a = qe(), o = Me(), s = Ie(), u = vr(), p = De(), m = o.getCollectionFromIds(r), c = s.configPermissions ? s.configPermissions({
|
|
4682
4688
|
user: a.user,
|
|
4683
4689
|
collection: i
|
|
4684
4690
|
}).editCollections : !0;
|
|
@@ -4697,7 +4703,7 @@ function dn({
|
|
|
4697
4703
|
onClick: () => {
|
|
4698
4704
|
n.clearFilter?.(), i?.initialFilter && n.setFilterValues?.(i?.initialFilter), i?.initialSort && n.setSortBy?.(i?.initialSort);
|
|
4699
4705
|
},
|
|
4700
|
-
children: /* @__PURE__ */ e(
|
|
4706
|
+
children: /* @__PURE__ */ e(Jr, {})
|
|
4701
4707
|
}
|
|
4702
4708
|
)
|
|
4703
4709
|
}
|
|
@@ -4728,7 +4734,7 @@ function dn({
|
|
|
4728
4734
|
message: "Default config saved"
|
|
4729
4735
|
});
|
|
4730
4736
|
}),
|
|
4731
|
-
children: /* @__PURE__ */ e(
|
|
4737
|
+
children: /* @__PURE__ */ e(Kr, {})
|
|
4732
4738
|
}
|
|
4733
4739
|
)
|
|
4734
4740
|
}
|
|
@@ -4740,7 +4746,7 @@ function dn({
|
|
|
4740
4746
|
{
|
|
4741
4747
|
title: c ? "Edit collection" : "You don't have permissions to edit this collection",
|
|
4742
4748
|
children: /* @__PURE__ */ e(
|
|
4743
|
-
|
|
4749
|
+
se,
|
|
4744
4750
|
{
|
|
4745
4751
|
color: "primary",
|
|
4746
4752
|
disabled: !c,
|
|
@@ -4755,16 +4761,16 @@ function dn({
|
|
|
4755
4761
|
function ct(t) {
|
|
4756
4762
|
return t && Object.keys(t).length === 0 ? t : t ?? null;
|
|
4757
4763
|
}
|
|
4758
|
-
function
|
|
4764
|
+
function pn({
|
|
4759
4765
|
path: t,
|
|
4760
4766
|
collection: r
|
|
4761
4767
|
}) {
|
|
4762
|
-
const i = De(), n = qe(), a =
|
|
4768
|
+
const i = De(), n = qe(), a = vr(), o = Ie(), s = o.configPermissions({
|
|
4763
4769
|
user: n.user,
|
|
4764
4770
|
collection: r
|
|
4765
|
-
}), u =
|
|
4771
|
+
}), u = Q(() => {
|
|
4766
4772
|
o?.editCollection({ path: t, parentCollectionIds: [] });
|
|
4767
|
-
}, [o, t]), [p, m] = Y(!1), c =
|
|
4773
|
+
}, [o, t]), [p, m] = Y(!1), c = Q(() => {
|
|
4768
4774
|
a?.deleteCollection({ path: t }).then(() => {
|
|
4769
4775
|
m(!1), i.open({
|
|
4770
4776
|
message: "Collection deleted",
|
|
@@ -4775,10 +4781,10 @@ function un({
|
|
|
4775
4781
|
return /* @__PURE__ */ l(j, { children: [
|
|
4776
4782
|
/* @__PURE__ */ l("div", { children: [
|
|
4777
4783
|
s.deleteCollections && /* @__PURE__ */ e(
|
|
4778
|
-
|
|
4784
|
+
Qr,
|
|
4779
4785
|
{
|
|
4780
|
-
trigger: /* @__PURE__ */ e(
|
|
4781
|
-
children: /* @__PURE__ */ l(
|
|
4786
|
+
trigger: /* @__PURE__ */ e(se, { children: /* @__PURE__ */ e(Wr, { size: "small" }) }),
|
|
4787
|
+
children: /* @__PURE__ */ l(Xr, { onClick: (d) => {
|
|
4782
4788
|
d.preventDefault(), d.stopPropagation(), m(!0);
|
|
4783
4789
|
}, children: [
|
|
4784
4790
|
/* @__PURE__ */ e(ht, {}),
|
|
@@ -4787,7 +4793,7 @@ function un({
|
|
|
4787
4793
|
}
|
|
4788
4794
|
),
|
|
4789
4795
|
s.editCollections && /* @__PURE__ */ e(
|
|
4790
|
-
|
|
4796
|
+
se,
|
|
4791
4797
|
{
|
|
4792
4798
|
onClick: (d) => {
|
|
4793
4799
|
u();
|
|
@@ -4812,7 +4818,7 @@ function un({
|
|
|
4812
4818
|
)
|
|
4813
4819
|
] });
|
|
4814
4820
|
}
|
|
4815
|
-
function
|
|
4821
|
+
function mn({
|
|
4816
4822
|
group: t,
|
|
4817
4823
|
context: r
|
|
4818
4824
|
}) {
|
|
@@ -4822,7 +4828,7 @@ function pn({
|
|
|
4822
4828
|
user: i.user
|
|
4823
4829
|
}).createCollections : !0;
|
|
4824
4830
|
return /* @__PURE__ */ e(
|
|
4825
|
-
|
|
4831
|
+
nr,
|
|
4826
4832
|
{
|
|
4827
4833
|
className: Ce("h-full p-4 min-h-[124px]"),
|
|
4828
4834
|
onClick: n && a ? () => n.createCollection({
|
|
@@ -4852,12 +4858,12 @@ function pn({
|
|
|
4852
4858
|
}
|
|
4853
4859
|
);
|
|
4854
4860
|
}
|
|
4855
|
-
function
|
|
4861
|
+
function hn() {
|
|
4856
4862
|
const t = qe(), r = Me(), i = Ie(), n = i.configPermissions ? i.configPermissions({
|
|
4857
4863
|
user: t.user
|
|
4858
4864
|
}).createCollections : !0, a = i.rootPathSuggestions ?? [], o = a.length > 3 || r.collections.length === 0 && a.length > 0;
|
|
4859
4865
|
return /* @__PURE__ */ e(
|
|
4860
|
-
|
|
4866
|
+
ei,
|
|
4861
4867
|
{
|
|
4862
4868
|
in: o,
|
|
4863
4869
|
children: /* @__PURE__ */ l(
|
|
@@ -4892,7 +4898,7 @@ function mn() {
|
|
|
4892
4898
|
}
|
|
4893
4899
|
);
|
|
4894
4900
|
}
|
|
4895
|
-
function
|
|
4901
|
+
function fn({
|
|
4896
4902
|
propertyKey: t,
|
|
4897
4903
|
onHover: r,
|
|
4898
4904
|
property: i,
|
|
@@ -4902,7 +4908,7 @@ function hn({
|
|
|
4902
4908
|
}) {
|
|
4903
4909
|
const s = Ie();
|
|
4904
4910
|
return /* @__PURE__ */ e(ee, { title: "Edit", children: /* @__PURE__ */ e(
|
|
4905
|
-
|
|
4911
|
+
se,
|
|
4906
4912
|
{
|
|
4907
4913
|
className: r ? "bg-white dark:bg-gray-950" : "hidden",
|
|
4908
4914
|
onClick: () => {
|
|
@@ -4919,7 +4925,7 @@ function hn({
|
|
|
4919
4925
|
}
|
|
4920
4926
|
) });
|
|
4921
4927
|
}
|
|
4922
|
-
function
|
|
4928
|
+
function gn({
|
|
4923
4929
|
fullPath: t,
|
|
4924
4930
|
parentCollectionIds: r,
|
|
4925
4931
|
collection: i
|
|
@@ -4931,12 +4937,12 @@ function fn({
|
|
|
4931
4937
|
return /* @__PURE__ */ e(ee, { title: o ? "Add new property" : "You don't have permission to add new properties", children: /* @__PURE__ */ e(
|
|
4932
4938
|
"div",
|
|
4933
4939
|
{
|
|
4934
|
-
className: "p-0.5 w-20 h-full flex items-center justify-center cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-950",
|
|
4940
|
+
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",
|
|
4935
4941
|
onClick: () => {
|
|
4936
4942
|
a.editProperty({
|
|
4937
4943
|
editedCollectionPath: t,
|
|
4938
4944
|
parentCollectionIds: r,
|
|
4939
|
-
currentPropertiesOrder:
|
|
4945
|
+
currentPropertiesOrder: Er(i),
|
|
4940
4946
|
collection: i
|
|
4941
4947
|
});
|
|
4942
4948
|
},
|
|
@@ -4962,7 +4968,7 @@ function vn() {
|
|
|
4962
4968
|
}
|
|
4963
4969
|
);
|
|
4964
4970
|
}
|
|
4965
|
-
function
|
|
4971
|
+
function _n({
|
|
4966
4972
|
collectionConfigController: t,
|
|
4967
4973
|
modifyCollection: r,
|
|
4968
4974
|
configPermissions: i,
|
|
@@ -4977,20 +4983,20 @@ function En({
|
|
|
4977
4983
|
const c = (d) => {
|
|
4978
4984
|
const y = (N) => {
|
|
4979
4985
|
Xe(N.properties), N.subcollections?.forEach(y);
|
|
4980
|
-
},
|
|
4981
|
-
|
|
4982
|
-
const
|
|
4983
|
-
return console.debug("Collections after joining:",
|
|
4986
|
+
}, g = t.collections ?? [];
|
|
4987
|
+
g.forEach(y), console.debug("Collections specified in code:", d), console.debug("Collections stored in the backend", g);
|
|
4988
|
+
const v = _r(d, g, [], r);
|
|
4989
|
+
return console.debug("Collections after joining:", v), v;
|
|
4984
4990
|
};
|
|
4985
4991
|
return {
|
|
4986
4992
|
name: "Collection Editor",
|
|
4987
4993
|
loading: t.loading,
|
|
4988
4994
|
collections: {
|
|
4989
4995
|
injectCollections: c,
|
|
4990
|
-
CollectionActions:
|
|
4996
|
+
CollectionActions: un
|
|
4991
4997
|
},
|
|
4992
4998
|
provider: {
|
|
4993
|
-
Component:
|
|
4999
|
+
Component: dn,
|
|
4994
5000
|
props: {
|
|
4995
5001
|
collectionConfigController: t,
|
|
4996
5002
|
configPermissions: i,
|
|
@@ -5005,20 +5011,20 @@ function En({
|
|
|
5005
5011
|
},
|
|
5006
5012
|
homePage: {
|
|
5007
5013
|
additionalActions: /* @__PURE__ */ e(vn, {}),
|
|
5008
|
-
additionalChildrenEnd: /* @__PURE__ */ e(
|
|
5009
|
-
CollectionActions:
|
|
5010
|
-
AdditionalCards:
|
|
5014
|
+
additionalChildrenEnd: /* @__PURE__ */ e(hn, {}),
|
|
5015
|
+
CollectionActions: pn,
|
|
5016
|
+
AdditionalCards: mn
|
|
5011
5017
|
},
|
|
5012
5018
|
collectionView: {
|
|
5013
|
-
HeaderAction:
|
|
5014
|
-
AddColumnComponent:
|
|
5019
|
+
HeaderAction: fn,
|
|
5020
|
+
AddColumnComponent: gn
|
|
5015
5021
|
}
|
|
5016
5022
|
};
|
|
5017
5023
|
}
|
|
5018
|
-
function
|
|
5019
|
-
const r = Me(), i =
|
|
5024
|
+
function Sn({ path: t }) {
|
|
5025
|
+
const r = Me(), i = yn(t), n = r.getParentCollectionIds(t), a = Ie();
|
|
5020
5026
|
return /* @__PURE__ */ l("div", { className: "p-1 flex flex-col items-center", children: [
|
|
5021
|
-
/* @__PURE__ */ e(
|
|
5027
|
+
/* @__PURE__ */ e(Qt, { error: "No collection for path: " + i }),
|
|
5022
5028
|
/* @__PURE__ */ e(
|
|
5023
5029
|
R,
|
|
5024
5030
|
{
|
|
@@ -5037,20 +5043,20 @@ function _n({ path: t }) {
|
|
|
5037
5043
|
)
|
|
5038
5044
|
] });
|
|
5039
5045
|
}
|
|
5040
|
-
function
|
|
5046
|
+
function yn(t) {
|
|
5041
5047
|
const r = t.split("/");
|
|
5042
5048
|
return r[r.length - 1];
|
|
5043
5049
|
}
|
|
5044
5050
|
export {
|
|
5045
|
-
|
|
5051
|
+
Sn as MissingReferenceWidget,
|
|
5046
5052
|
Ke as editableProperty,
|
|
5047
|
-
|
|
5053
|
+
le as getFullId,
|
|
5048
5054
|
be as idToPropertiesPath,
|
|
5049
5055
|
Oe as namespaceToPropertiesOrderPath,
|
|
5050
|
-
|
|
5051
|
-
|
|
5056
|
+
xi as namespaceToPropertiesPath,
|
|
5057
|
+
Vi as removeNonEditableProperties,
|
|
5052
5058
|
Ie as useCollectionEditorController,
|
|
5053
|
-
|
|
5054
|
-
|
|
5059
|
+
_n as useCollectionEditorPlugin,
|
|
5060
|
+
vr as useCollectionsConfigController
|
|
5055
5061
|
};
|
|
5056
5062
|
//# sourceMappingURL=index.es.js.map
|