@firecms/collection_editor 3.0.0-canary.3 → 3.0.0-canary.30
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 +390 -397
- 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/types/persisted_collection.d.ts +1 -1
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +1 -1
- package/dist/ui/collection_editor/utils/supported_fields.d.ts +2 -2
- package/package.json +18 -18
- package/src/ConfigControllerProvider.tsx +1 -1
- package/src/types/persisted_collection.ts +1 -1
- package/src/ui/MissingReferenceWidget.tsx +2 -1
- package/src/ui/NewCollectionButton.tsx +12 -10
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +17 -18
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +13 -9
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +1 -1
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +1 -1
- package/src/ui/collection_editor/EnumForm.tsx +3 -4
- package/src/ui/collection_editor/PropertyEditView.tsx +4 -4
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +1 -1
- package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +7 -8
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +7 -8
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +3 -4
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +3 -4
- package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +3 -4
- package/src/ui/collection_editor/utils/supported_fields.tsx +3 -3
- package/src/useCollectionEditorPlugin.tsx +2 -4
- package/dist/ui/collection_editor/properties/FieldHelperView.d.ts +0 -4
- package/src/ui/collection_editor/properties/FieldHelperView.tsx +0 -13
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as j } from "react/jsx-runtime";
|
|
2
|
-
import { SearchIconsView as gr, toSnakeCase as Pt, singular as vr, IconForView as ot, ArrayContainer as yr, serializeRegExp as br, useSnackbarController as Ie, resolveEnumValues as Cr, isPropertyBuilder as ne, useCustomizationController as Ae, getFieldConfig as $e, ErrorBoundary as ge, PropertyConfigBadge as Ye, unslugify as ut, useNavigationController as Pe, mergeDeep as W, DEFAULT_FIELD_CONFIGS as Gt, isValidRegExp as Pr, getFieldId as Kt, DeleteConfirmationDialog as lt, useLargeLayout as Nr, makePropertiesEditable as pt, resolveEntityView as xr, useSelectionController as wr, EntityCollectionTable as Tr, slugify as kr, useAuthController as _e, randomString as _t, CircularProgressCenter as Nt, removeUndefined as Ft, ErrorView as Wt, removeInitialAndTrailingSlashes as Or, getDefaultPropertiesOrder as Vr } from "@firecms/core";
|
|
2
|
+
import { FieldCaption as X, SearchIconsView as gr, toSnakeCase as Pt, singular as vr, IconForView as ot, ArrayContainer as yr, serializeRegExp as br, useSnackbarController as Ie, resolveEnumValues as Cr, isPropertyBuilder as ne, useCustomizationController as Ae, getFieldConfig as $e, ErrorBoundary as ge, PropertyConfigBadge as Ye, unslugify as ut, useNavigationController as Pe, mergeDeep as W, DEFAULT_FIELD_CONFIGS as Gt, isValidRegExp as Pr, getFieldId as Kt, DeleteConfirmationDialog as lt, useLargeLayout as Nr, makePropertiesEditable as pt, resolveEntityView as xr, useSelectionController as wr, EntityCollectionTable as Tr, slugify as kr, useAuthController as _e, randomString as _t, CircularProgressCenter as Nt, removeUndefined as Ft, ErrorView as Wt, removeInitialAndTrailingSlashes as Or, getDefaultPropertiesOrder as Vr } from "@firecms/core";
|
|
3
3
|
import * as je from "react";
|
|
4
4
|
import Y, { useState as $, useEffect as de, useMemo as Zt, useCallback as Q, useRef as Le, useDeferredValue as Ir, useContext as Jt } from "react";
|
|
5
5
|
import ve from "react-fast-compare";
|
|
6
|
-
import {
|
|
6
|
+
import { useAutoComplete as _r, Container as mt, Typography as O, Tooltip as te, IconButton as oe, Chip as st, TextField as Oe, cn as he, DebouncedTextField as Z, Autocomplete as Fr, AutocompleteItem as Sr, ExpandablePanel as xt, SettingsIcon as He, Select as be, SelectItem as ee, BooleanSwitchWithLabel as ct, Dialog as Fe, AutoAwesomeIcon as ht, Badge as Er, ListIcon as Ar, Button as z, CircularProgress as De, Paper as Ce, DialogContent as Be, DialogActions as ze, RuleIcon as Dr, FileUploadIcon as Br, MultiSelect as zr, MultiSelectItem as St, Checkbox as Et, cardMixin as Qt, cardClickableMixin as Xt, cardSelectedMixin as er, FunctionsIcon as Mr, RemoveCircleIcon as Rr, defaultBorderMixin as wt, RemoveIcon as Ur, DragHandleIcon as jr, AddIcon as se, SelectGroup as At, InfoLabel as Lr, DeleteIcon as dt, ContentCopyIcon as qr, CodeIcon as $r, Table as Dt, TableBody as Bt, TableRow as bt, TableCell as Ue, Alert as Yr, Icon as et, Card as tr, coolIconKeys as zt, Tabs as Hr, Tab as Ct, ArrowBackIcon as tt, LoadingButton as Mt, DoneIcon as Gr, UndoIcon as Kr, SaveIcon as Wr, Menu as Zr, MoreVertIcon as Jr, MenuItem as Qr, Collapse as Xr } from "@firecms/ui";
|
|
7
7
|
import * as rt from "yup";
|
|
8
8
|
import { useFormex as K, Field as H, getIn as I, useCreateFormex as Tt, Formex as kt } from "@firecms/formex";
|
|
9
9
|
import { extractEnumFromValues as ei, buildPropertyFromData as ti, buildEntityPropertiesFromData as ri } from "@firecms/schema_inference";
|
|
@@ -17,12 +17,6 @@ const vi = rt.object().shape({
|
|
|
17
17
|
name: rt.string().required("Required"),
|
|
18
18
|
path: rt.string().required("Required")
|
|
19
19
|
});
|
|
20
|
-
function X({
|
|
21
|
-
error: t,
|
|
22
|
-
children: r
|
|
23
|
-
}) {
|
|
24
|
-
return r ? /* @__PURE__ */ e(O, { variant: "caption", color: t ? "error" : "secondary", className: "ml-3.5 mt-0.5", children: r }) : null;
|
|
25
|
-
}
|
|
26
20
|
function yi({
|
|
27
21
|
isNewCollection: t,
|
|
28
22
|
reservedGroups: r,
|
|
@@ -36,17 +30,17 @@ function yi({
|
|
|
36
30
|
setFieldValue: p,
|
|
37
31
|
handleChange: h,
|
|
38
32
|
touched: m,
|
|
39
|
-
errors:
|
|
40
|
-
setFieldTouched:
|
|
33
|
+
errors: s,
|
|
34
|
+
setFieldTouched: f,
|
|
41
35
|
isSubmitting: v,
|
|
42
36
|
submitCount: x
|
|
43
|
-
} = K(), [y, P] = $(!1), [k, b] = $(!1), C = (
|
|
44
|
-
p("name",
|
|
37
|
+
} = K(), [y, P] = $(!1), [k, b] = $(!1), C = (c) => {
|
|
38
|
+
p("name", c), !I(m, "path") && t && c && p("path", Pt(c)), !I(m, "id") && t && c && p("id", Pt(c)), !I(m, "singularName") && t && c && p("singularName", vr(c));
|
|
45
39
|
};
|
|
46
40
|
de(() => {
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
const N = /* @__PURE__ */ e(ot, { collectionOrView: u }),
|
|
41
|
+
s.id && b(!0);
|
|
42
|
+
}, [s.id]);
|
|
43
|
+
const N = /* @__PURE__ */ e(ot, { collectionOrView: u }), g = l?.filter((c) => !r?.includes(c)), {
|
|
50
44
|
inputFocused: w,
|
|
51
45
|
autoCompleteOpen: _,
|
|
52
46
|
setAutoCompleteOpen: M
|
|
@@ -86,15 +80,15 @@ function yi({
|
|
|
86
80
|
Oe,
|
|
87
81
|
{
|
|
88
82
|
value: u.name ?? "",
|
|
89
|
-
onChange: (
|
|
83
|
+
onChange: (c) => C(c.target.value),
|
|
90
84
|
label: "Name",
|
|
91
85
|
required: !0,
|
|
92
|
-
error: A && !!
|
|
86
|
+
error: A && !!s.name
|
|
93
87
|
}
|
|
94
88
|
),
|
|
95
|
-
/* @__PURE__ */ e(X, { error: m.name && !!
|
|
89
|
+
/* @__PURE__ */ e(X, { error: m.name && !!s.name, children: m.name && s.name ? s.name : "Name of in this collection, usually a plural name (e.g. Products)" })
|
|
96
90
|
] }),
|
|
97
|
-
/* @__PURE__ */ a("div", { className:
|
|
91
|
+
/* @__PURE__ */ a("div", { className: he("col-span-12 ", R ? "" : "sm:col-span-8"), children: [
|
|
98
92
|
/* @__PURE__ */ e(
|
|
99
93
|
H,
|
|
100
94
|
{
|
|
@@ -103,20 +97,20 @@ function yi({
|
|
|
103
97
|
label: "Path",
|
|
104
98
|
disabled: !t,
|
|
105
99
|
required: !0,
|
|
106
|
-
error: A && !!
|
|
100
|
+
error: A && !!s.path
|
|
107
101
|
}
|
|
108
102
|
),
|
|
109
|
-
/* @__PURE__ */ e(X, { error: m.path && !!
|
|
103
|
+
/* @__PURE__ */ e(X, { error: m.path && !!s.path, children: m.path && s.path ? s.path : R ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database" })
|
|
110
104
|
] }),
|
|
111
105
|
!R && /* @__PURE__ */ a("div", { className: "col-span-12 sm:col-span-4 relative", children: [
|
|
112
106
|
/* @__PURE__ */ e(
|
|
113
107
|
Oe,
|
|
114
108
|
{
|
|
115
|
-
error: A && !!
|
|
109
|
+
error: A && !!s.group,
|
|
116
110
|
disabled: v,
|
|
117
111
|
value: u.group ?? "",
|
|
118
112
|
autoComplete: "off",
|
|
119
|
-
onChange: (
|
|
113
|
+
onChange: (c) => p("group", c.target.value),
|
|
120
114
|
name: "group",
|
|
121
115
|
inputRef: d,
|
|
122
116
|
label: "Group"
|
|
@@ -125,21 +119,21 @@ function yi({
|
|
|
125
119
|
/* @__PURE__ */ e(
|
|
126
120
|
Fr,
|
|
127
121
|
{
|
|
128
|
-
open: _ && (
|
|
122
|
+
open: _ && (g ?? []).length > 0,
|
|
129
123
|
setOpen: M,
|
|
130
|
-
children:
|
|
124
|
+
children: g?.map((c, V) => /* @__PURE__ */ e(
|
|
131
125
|
Sr,
|
|
132
126
|
{
|
|
133
127
|
onClick: () => {
|
|
134
|
-
M(!1), p("group",
|
|
128
|
+
M(!1), p("group", c ?? null);
|
|
135
129
|
},
|
|
136
|
-
children: /* @__PURE__ */ e("div", { className: "flex-grow", children:
|
|
130
|
+
children: /* @__PURE__ */ e("div", { className: "flex-grow", children: c })
|
|
137
131
|
},
|
|
138
|
-
V + "_" +
|
|
132
|
+
V + "_" + c
|
|
139
133
|
))
|
|
140
134
|
}
|
|
141
135
|
),
|
|
142
|
-
/* @__PURE__ */ e(X, { children: A &&
|
|
136
|
+
/* @__PURE__ */ e(X, { children: A && s.group ? s.group : "Group of the collection" })
|
|
143
137
|
] }),
|
|
144
138
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
145
139
|
xt,
|
|
@@ -167,30 +161,30 @@ function yi({
|
|
|
167
161
|
as: Z,
|
|
168
162
|
disabled: !t,
|
|
169
163
|
label: "Collection id",
|
|
170
|
-
error: A && !!
|
|
164
|
+
error: A && !!s.id
|
|
171
165
|
}
|
|
172
166
|
),
|
|
173
|
-
/* @__PURE__ */ e(X, { error: m.id && !!
|
|
167
|
+
/* @__PURE__ */ e(X, { error: m.id && !!s.id, children: m.id && s.id ? s.id : "This id identifies this collection" })
|
|
174
168
|
] }),
|
|
175
169
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
176
170
|
/* @__PURE__ */ e(
|
|
177
171
|
Oe,
|
|
178
172
|
{
|
|
179
|
-
error: A && !!
|
|
173
|
+
error: A && !!s.singularName,
|
|
180
174
|
name: "singularName",
|
|
181
175
|
"aria-describedby": "singularName-helper",
|
|
182
|
-
onChange: (
|
|
176
|
+
onChange: (c) => (f("singularName", !0), h(c)),
|
|
183
177
|
value: u.singularName ?? "",
|
|
184
178
|
label: "Singular name"
|
|
185
179
|
}
|
|
186
180
|
),
|
|
187
|
-
/* @__PURE__ */ e(X, { error: A && !!
|
|
181
|
+
/* @__PURE__ */ e(X, { error: A && !!s.singularName, children: A && s.singularName ? s.singularName : "Optionally define a singular name for your entities" })
|
|
188
182
|
] }),
|
|
189
183
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
190
184
|
/* @__PURE__ */ e(
|
|
191
185
|
Oe,
|
|
192
186
|
{
|
|
193
|
-
error: A && !!
|
|
187
|
+
error: A && !!s.description,
|
|
194
188
|
name: "description",
|
|
195
189
|
value: u.description ?? "",
|
|
196
190
|
onChange: h,
|
|
@@ -200,7 +194,7 @@ function yi({
|
|
|
200
194
|
label: "Description"
|
|
201
195
|
}
|
|
202
196
|
),
|
|
203
|
-
/* @__PURE__ */ e(X, { error: A && !!
|
|
197
|
+
/* @__PURE__ */ e(X, { error: A && !!s.description, children: A && s.description ? s.description : "Description of the collection, you can use markdown" })
|
|
204
198
|
] }),
|
|
205
199
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
206
200
|
be,
|
|
@@ -210,14 +204,14 @@ function yi({
|
|
|
210
204
|
position: "item-aligned",
|
|
211
205
|
onChange: h,
|
|
212
206
|
value: u.defaultSize ?? "",
|
|
213
|
-
renderValue: (
|
|
214
|
-
children: ["xs", "s", "m", "l", "xl"].map((
|
|
207
|
+
renderValue: (c) => c.toUpperCase(),
|
|
208
|
+
children: ["xs", "s", "m", "l", "xl"].map((c) => /* @__PURE__ */ e(
|
|
215
209
|
ee,
|
|
216
210
|
{
|
|
217
|
-
value:
|
|
218
|
-
children:
|
|
211
|
+
value: c,
|
|
212
|
+
children: c.toUpperCase()
|
|
219
213
|
},
|
|
220
|
-
`size-select-${
|
|
214
|
+
`size-select-${c}`
|
|
221
215
|
))
|
|
222
216
|
}
|
|
223
217
|
) }),
|
|
@@ -228,13 +222,13 @@ function yi({
|
|
|
228
222
|
label: "Data IDs generation",
|
|
229
223
|
position: "item-aligned",
|
|
230
224
|
disabled: D === "code_defined",
|
|
231
|
-
onValueChange: (
|
|
232
|
-
if (
|
|
225
|
+
onValueChange: (c) => {
|
|
226
|
+
if (c === "code_defined")
|
|
233
227
|
throw new Error("This should not happen");
|
|
234
|
-
|
|
228
|
+
c === "true" ? p("customId", !0) : c === "false" ? p("customId", !1) : c === "optional" && p("customId", "optional");
|
|
235
229
|
},
|
|
236
230
|
value: D ?? "",
|
|
237
|
-
renderValue: (
|
|
231
|
+
renderValue: (c) => c === "code_defined" ? "Code defined" : c === "true" ? "Users must define an ID" : c === "optional" ? "Users can define an ID, but it is not required" : "Document ID is generated automatically",
|
|
238
232
|
children: [
|
|
239
233
|
/* @__PURE__ */ e(ee, { value: "false", children: "Document ID is generated automatically" }),
|
|
240
234
|
/* @__PURE__ */ e(ee, { value: "true", children: "Users must define an ID" }),
|
|
@@ -248,7 +242,7 @@ function yi({
|
|
|
248
242
|
{
|
|
249
243
|
position: "start",
|
|
250
244
|
label: "Collection group",
|
|
251
|
-
onValueChange: (
|
|
245
|
+
onValueChange: (c) => p("collectionGroup", c),
|
|
252
246
|
value: u.collectionGroup ?? !1
|
|
253
247
|
}
|
|
254
248
|
),
|
|
@@ -260,7 +254,7 @@ function yi({
|
|
|
260
254
|
{
|
|
261
255
|
position: "start",
|
|
262
256
|
label: "Enable text search for this collection",
|
|
263
|
-
onValueChange: (
|
|
257
|
+
onValueChange: (c) => p("textSearchEnabled", c),
|
|
264
258
|
value: u.textSearchEnabled ?? !1
|
|
265
259
|
}
|
|
266
260
|
),
|
|
@@ -282,8 +276,8 @@ function yi({
|
|
|
282
276
|
gr,
|
|
283
277
|
{
|
|
284
278
|
selectedIcon: u.icon,
|
|
285
|
-
onIconSelected: (
|
|
286
|
-
P(!1), p("icon",
|
|
279
|
+
onIconSelected: (c) => {
|
|
280
|
+
P(!1), p("icon", c);
|
|
287
281
|
}
|
|
288
282
|
}
|
|
289
283
|
) })
|
|
@@ -291,7 +285,7 @@ function yi({
|
|
|
291
285
|
)
|
|
292
286
|
] }) });
|
|
293
287
|
}
|
|
294
|
-
function
|
|
288
|
+
function me(t) {
|
|
295
289
|
return "properties." + t.replaceAll(".", ".properties.");
|
|
296
290
|
}
|
|
297
291
|
function bi(t) {
|
|
@@ -305,7 +299,7 @@ function ae(t, r) {
|
|
|
305
299
|
}
|
|
306
300
|
function ir(t, r) {
|
|
307
301
|
const n = r ? `${r}.${t}` : t;
|
|
308
|
-
return
|
|
302
|
+
return me(n);
|
|
309
303
|
}
|
|
310
304
|
function Ci({
|
|
311
305
|
enumValues: t,
|
|
@@ -320,12 +314,12 @@ function Ci({
|
|
|
320
314
|
initialValues: { enumValues: t },
|
|
321
315
|
validateOnChange: !0,
|
|
322
316
|
validation: (m) => {
|
|
323
|
-
const
|
|
317
|
+
const s = {};
|
|
324
318
|
m.enumValues && m.enumValues.forEach((v, x) => {
|
|
325
|
-
v?.label || (
|
|
319
|
+
v?.label || (s.enumValues = s.enumValues ?? [], s.enumValues[x] = s.enumValues[x] ?? {}, s.enumValues[x].label = "You must specify a label for this enum value entry"), v?.id || (s.enumValues = s.enumValues ?? [], s.enumValues[x] = s.enumValues[x] ?? {}, s.enumValues[x].id = "You must specify an ID for this enum value entry");
|
|
326
320
|
});
|
|
327
|
-
const
|
|
328
|
-
return n?.(
|
|
321
|
+
const f = !!(s?.enumValues && Object.keys(s?.enumValues).length > 0);
|
|
322
|
+
return n?.(f), s;
|
|
329
323
|
}
|
|
330
324
|
}), { values: p, errors: h } = u;
|
|
331
325
|
return de(() => {
|
|
@@ -354,8 +348,8 @@ function Pi({
|
|
|
354
348
|
}) {
|
|
355
349
|
const {
|
|
356
350
|
setFieldValue: u
|
|
357
|
-
} = K(), [p, h] = Y.useState(), [m,
|
|
358
|
-
const N = p === C,
|
|
351
|
+
} = K(), [p, h] = Y.useState(), [m, s] = Y.useState(), [f, v] = Y.useState(!1), y = Y.useRef(/* @__PURE__ */ new Set()).current, P = (b, C) => {
|
|
352
|
+
const N = p === C, g = r?.enumValues && r?.enumValues[b];
|
|
359
353
|
return /* @__PURE__ */ e(
|
|
360
354
|
Ni,
|
|
361
355
|
{
|
|
@@ -363,9 +357,9 @@ function Pi({
|
|
|
363
357
|
disabled: n,
|
|
364
358
|
enumValuesPath: i,
|
|
365
359
|
autoFocus: N,
|
|
366
|
-
entryError:
|
|
360
|
+
entryError: g,
|
|
367
361
|
shouldUpdateId: l || N,
|
|
368
|
-
onDialogOpen: () =>
|
|
362
|
+
onDialogOpen: () => s(b),
|
|
369
363
|
inferredEntry: y.has(t.enumValues[b]?.id)
|
|
370
364
|
},
|
|
371
365
|
`${C}`
|
|
@@ -385,24 +379,24 @@ function Pi({
|
|
|
385
379
|
o && /* @__PURE__ */ a(
|
|
386
380
|
z,
|
|
387
381
|
{
|
|
388
|
-
loading:
|
|
389
|
-
disabled: n ||
|
|
382
|
+
loading: f,
|
|
383
|
+
disabled: n || f,
|
|
390
384
|
variant: "text",
|
|
391
385
|
size: "small",
|
|
392
386
|
onClick: async () => {
|
|
393
387
|
d && (v(!0), d?.().then((b) => {
|
|
394
388
|
if (!b)
|
|
395
389
|
return;
|
|
396
|
-
const C = b.flat(), N = Array.from(new Set(C)),
|
|
390
|
+
const C = b.flat(), N = Array.from(new Set(C)), g = t.enumValues, _ = ei(N).filter((M) => !g?.some((R) => R.id === M.id));
|
|
397
391
|
_.forEach((M) => {
|
|
398
392
|
y.add(M.id);
|
|
399
|
-
}), u(i, [..._, ...
|
|
393
|
+
}), u(i, [..._, ...g], !0);
|
|
400
394
|
}).catch((b) => {
|
|
401
395
|
console.error(b);
|
|
402
396
|
}).finally(() => v(!1)));
|
|
403
397
|
},
|
|
404
398
|
children: [
|
|
405
|
-
|
|
399
|
+
f ? /* @__PURE__ */ e(De, { size: "small" }) : /* @__PURE__ */ e(ht, {}),
|
|
406
400
|
"Infer values from data"
|
|
407
401
|
]
|
|
408
402
|
}
|
|
@@ -430,7 +424,7 @@ function Pi({
|
|
|
430
424
|
index: m,
|
|
431
425
|
open: m !== void 0,
|
|
432
426
|
enumValuesPath: i,
|
|
433
|
-
onClose: () =>
|
|
427
|
+
onClose: () => s(void 0)
|
|
434
428
|
}
|
|
435
429
|
)
|
|
436
430
|
] })
|
|
@@ -450,12 +444,12 @@ const Ni = Y.memo(
|
|
|
450
444
|
const {
|
|
451
445
|
values: h,
|
|
452
446
|
handleChange: m,
|
|
453
|
-
errors:
|
|
454
|
-
setFieldValue:
|
|
447
|
+
errors: s,
|
|
448
|
+
setFieldValue: f,
|
|
455
449
|
touched: v
|
|
456
450
|
} = K(), x = Y.useRef(!I(h, `${i}[${r}].id`)), y = n || x.current, P = I(h, `${i}[${r}].id`), k = I(h, `${i}[${r}].label`), b = Y.useRef(k);
|
|
457
451
|
return Y.useEffect(() => {
|
|
458
|
-
(b.current === P || !P) && y &&
|
|
452
|
+
(b.current === P || !P) && y && f(`${i}[${r}].id`, k), b.current = k;
|
|
459
453
|
}, [k]), /* @__PURE__ */ a(j, { children: [
|
|
460
454
|
/* @__PURE__ */ a("div", { className: "flex w-full align-center justify-center", children: [
|
|
461
455
|
/* @__PURE__ */ e(
|
|
@@ -645,8 +639,8 @@ function Ee({
|
|
|
645
639
|
const {
|
|
646
640
|
values: h,
|
|
647
641
|
handleChange: m,
|
|
648
|
-
errors:
|
|
649
|
-
} = K(),
|
|
642
|
+
errors: s
|
|
643
|
+
} = K(), f = "validation.length", v = "validation.min", x = "validation.max", y = "validation.trim", P = "validation.matches", k = "validation.lowercase", b = "validation.uppercase", C = I(s, P), N = I(h, P), g = typeof N == "string" ? N : br(N);
|
|
650
644
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
651
645
|
/* @__PURE__ */ e(Se, { disabled: u }),
|
|
652
646
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
@@ -703,9 +697,9 @@ function Ee({
|
|
|
703
697
|
t && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
704
698
|
Z,
|
|
705
699
|
{
|
|
706
|
-
value: I(h,
|
|
700
|
+
value: I(h, f),
|
|
707
701
|
label: "Exact length",
|
|
708
|
-
name:
|
|
702
|
+
name: f,
|
|
709
703
|
type: "number",
|
|
710
704
|
size: "small",
|
|
711
705
|
disabled: u,
|
|
@@ -746,7 +740,7 @@ function Ee({
|
|
|
746
740
|
label: "Matches regex",
|
|
747
741
|
size: "small",
|
|
748
742
|
disabled: u,
|
|
749
|
-
value:
|
|
743
|
+
value: g,
|
|
750
744
|
error: !!C
|
|
751
745
|
}
|
|
752
746
|
),
|
|
@@ -827,7 +821,7 @@ function Rt({
|
|
|
827
821
|
values: d,
|
|
828
822
|
setFieldError: u,
|
|
829
823
|
setFieldValue: p
|
|
830
|
-
} = K(), h = Ie(), m = t ? "of.enumValues" : "enumValues",
|
|
824
|
+
} = K(), h = Ie(), m = t ? "of.enumValues" : "enumValues", s = I(d, "defaultValue"), f = I(d, m), v = Zt(() => !f || typeof f == "boolean" ? [] : Cr(f) ?? [], [f]);
|
|
831
825
|
return /* @__PURE__ */ a(j, { children: [
|
|
832
826
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
833
827
|
Ci,
|
|
@@ -843,7 +837,7 @@ function Rt({
|
|
|
843
837
|
onValuesChanged: (y) => {
|
|
844
838
|
if (d && (p(m, y), !t)) {
|
|
845
839
|
const P = y.filter((k) => !!k?.id).map((k) => k.id);
|
|
846
|
-
|
|
840
|
+
s && !P.includes(s) && (p("defaultValue", void 0), h.open({
|
|
847
841
|
type: "warning",
|
|
848
842
|
message: "Default value was cleared"
|
|
849
843
|
}));
|
|
@@ -870,7 +864,7 @@ function Rt({
|
|
|
870
864
|
p("defaultValue", y);
|
|
871
865
|
},
|
|
872
866
|
label: "Default value",
|
|
873
|
-
value:
|
|
867
|
+
value: s ?? "",
|
|
874
868
|
children: v.filter((y) => !!y?.id).map((y) => /* @__PURE__ */ e(
|
|
875
869
|
ee,
|
|
876
870
|
{
|
|
@@ -898,9 +892,9 @@ function Ut({
|
|
|
898
892
|
const {
|
|
899
893
|
values: i,
|
|
900
894
|
setFieldValue: l
|
|
901
|
-
} = K(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`, u = `${o}.fileName`, p = `${o}.storagePath`, h = `${o}.storeUrl`, m = I(i, u) ?? "{rand}_{file}",
|
|
895
|
+
} = K(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`, u = `${o}.fileName`, p = `${o}.storagePath`, h = `${o}.storeUrl`, m = I(i, u) ?? "{rand}_{file}", s = I(i, p) ?? "/", f = I(i, d), v = Array.isArray(f) ? f : void 0, x = !v || v.length === 0, y = (b) => {
|
|
902
896
|
b ? b.includes("all") || b.length >= Object.keys(it).length ? l(d, void 0) : x ? l(d, Object.keys(it).filter((C) => !b.includes(C))) : l(d, b) : l(d, void 0);
|
|
903
|
-
}, P = typeof m == "function", k = typeof
|
|
897
|
+
}, P = typeof m == "function", k = typeof s == "function";
|
|
904
898
|
return /* @__PURE__ */ a(j, { children: [
|
|
905
899
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
906
900
|
xt,
|
|
@@ -977,7 +971,7 @@ function Ut({
|
|
|
977
971
|
label: "Storage path",
|
|
978
972
|
disabled: k || n,
|
|
979
973
|
size: "small",
|
|
980
|
-
value: k ? "-" :
|
|
974
|
+
value: k ? "-" : s
|
|
981
975
|
}
|
|
982
976
|
),
|
|
983
977
|
/* @__PURE__ */ a(O, { variant: "caption", className: "ml-3.5 mt-1 mb-2", children: [
|
|
@@ -1060,7 +1054,7 @@ function nr({
|
|
|
1060
1054
|
/* @__PURE__ */ a(
|
|
1061
1055
|
Ce,
|
|
1062
1056
|
{
|
|
1063
|
-
className:
|
|
1057
|
+
className: he(
|
|
1064
1058
|
"border",
|
|
1065
1059
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1066
1060
|
Qt,
|
|
@@ -1137,7 +1131,7 @@ function Ti({
|
|
|
1137
1131
|
/* @__PURE__ */ e(
|
|
1138
1132
|
Ce,
|
|
1139
1133
|
{
|
|
1140
|
-
className:
|
|
1134
|
+
className: he(
|
|
1141
1135
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1142
1136
|
Qt,
|
|
1143
1137
|
n ? Xt : "",
|
|
@@ -1213,8 +1207,8 @@ const ft = Y.memo(
|
|
|
1213
1207
|
onPropertyMove: p,
|
|
1214
1208
|
onPropertyRemove: h,
|
|
1215
1209
|
className: m,
|
|
1216
|
-
inferredPropertyKeys:
|
|
1217
|
-
collectionEditable:
|
|
1210
|
+
inferredPropertyKeys: s,
|
|
1211
|
+
collectionEditable: f
|
|
1218
1212
|
}) {
|
|
1219
1213
|
const v = o ?? Object.keys(l), x = Q((y) => {
|
|
1220
1214
|
if (!y.destination)
|
|
@@ -1230,27 +1224,27 @@ const ft = Y.memo(
|
|
|
1230
1224
|
className: m,
|
|
1231
1225
|
children: [
|
|
1232
1226
|
v && v.map((k, b) => {
|
|
1233
|
-
const C = l[k], N = d?.find((
|
|
1227
|
+
const C = l[k], N = d?.find((g) => g.key === k);
|
|
1234
1228
|
return !C && !N ? (console.warn(`Property ${k} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
1235
1229
|
ai,
|
|
1236
1230
|
{
|
|
1237
1231
|
draggableId: `array_field_${r}_${k}}`,
|
|
1238
1232
|
index: b,
|
|
1239
|
-
children: (
|
|
1233
|
+
children: (g, w) => /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1240
1234
|
ki,
|
|
1241
1235
|
{
|
|
1242
1236
|
propertyKey: k,
|
|
1243
1237
|
propertyOrBuilder: C,
|
|
1244
1238
|
additionalField: N,
|
|
1245
|
-
provided:
|
|
1239
|
+
provided: g,
|
|
1246
1240
|
errors: u,
|
|
1247
1241
|
namespace: r,
|
|
1248
|
-
inferredPropertyKeys:
|
|
1242
|
+
inferredPropertyKeys: s,
|
|
1249
1243
|
onPropertyMove: p,
|
|
1250
1244
|
onPropertyRemove: h,
|
|
1251
1245
|
onPropertyClick: w.isDragging ? void 0 : i,
|
|
1252
1246
|
selectedPropertyKey: n,
|
|
1253
|
-
collectionEditable:
|
|
1247
|
+
collectionEditable: f
|
|
1254
1248
|
}
|
|
1255
1249
|
) })
|
|
1256
1250
|
},
|
|
@@ -1281,9 +1275,9 @@ function ki({
|
|
|
1281
1275
|
onPropertyMove: p,
|
|
1282
1276
|
onPropertyRemove: h,
|
|
1283
1277
|
inferredPropertyKeys: m,
|
|
1284
|
-
collectionEditable:
|
|
1278
|
+
collectionEditable: s
|
|
1285
1279
|
}) {
|
|
1286
|
-
const
|
|
1280
|
+
const f = m?.includes(r ? `${r}.${t}` : t), v = ae(t, r), y = ir(t, r) in d;
|
|
1287
1281
|
let P;
|
|
1288
1282
|
if (typeof n == "object") {
|
|
1289
1283
|
const C = n;
|
|
@@ -1298,11 +1292,11 @@ function ki({
|
|
|
1298
1292
|
onPropertyClick: u,
|
|
1299
1293
|
onPropertyMove: p,
|
|
1300
1294
|
onPropertyRemove: h,
|
|
1301
|
-
collectionEditable:
|
|
1295
|
+
collectionEditable: s
|
|
1302
1296
|
}
|
|
1303
1297
|
));
|
|
1304
1298
|
}
|
|
1305
|
-
const k = o === v, b = n && (
|
|
1299
|
+
const k = o === v, b = n && (s && !ne(n) || qe(n));
|
|
1306
1300
|
return /* @__PURE__ */ a(
|
|
1307
1301
|
"div",
|
|
1308
1302
|
{
|
|
@@ -1341,7 +1335,7 @@ function ki({
|
|
|
1341
1335
|
}
|
|
1342
1336
|
),
|
|
1343
1337
|
/* @__PURE__ */ a("div", { className: "absolute top-2 right-2 flex flex-row ", children: [
|
|
1344
|
-
|
|
1338
|
+
f && /* @__PURE__ */ e(te, { title: "Inferred property", children: /* @__PURE__ */ e(ht, { size: "small", className: "p-2" }) }),
|
|
1345
1339
|
h && /* @__PURE__ */ e(te, { title: "Remove", children: /* @__PURE__ */ e(
|
|
1346
1340
|
oe,
|
|
1347
1341
|
{
|
|
@@ -1369,26 +1363,26 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1369
1363
|
const {
|
|
1370
1364
|
values: o,
|
|
1371
1365
|
setFieldValue: d
|
|
1372
|
-
} = K(), [u, p] = $(!1), [h, m] = $(), [
|
|
1366
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [s, f] = $(), v = o.propertiesOrder ?? Object.keys(o.properties ?? {}), x = ({
|
|
1373
1367
|
id: N,
|
|
1374
|
-
property:
|
|
1368
|
+
property: g
|
|
1375
1369
|
}) => {
|
|
1376
1370
|
if (!N)
|
|
1377
1371
|
throw Error();
|
|
1378
1372
|
d("properties", {
|
|
1379
1373
|
...o.properties ?? {},
|
|
1380
|
-
[N]:
|
|
1374
|
+
[N]: g
|
|
1381
1375
|
}, !1);
|
|
1382
1376
|
const w = o.propertiesOrder ?? Object.keys(o.properties ?? {}), _ = w.includes(N) ? w : [...w, N];
|
|
1383
1377
|
d("propertiesOrder", _, !1), p(!1);
|
|
1384
|
-
}, y = Q((N,
|
|
1385
|
-
const w = N ? ae(N,
|
|
1378
|
+
}, y = Q((N, g) => {
|
|
1379
|
+
const w = N ? ae(N, g) : void 0;
|
|
1386
1380
|
if (!w)
|
|
1387
1381
|
throw Error("collection editor miss config");
|
|
1388
|
-
const _ =
|
|
1389
|
-
d(_, void 0, !1), d(M, R.filter((D) => D !== N), !1), p(!1), m(void 0),
|
|
1390
|
-
}, [d, o]), P = h ? ae(h,
|
|
1391
|
-
d(ye(
|
|
1382
|
+
const _ = me(w), M = ye(g), R = I(o, M) ?? Object.keys(I(o, bi(g)));
|
|
1383
|
+
d(_, void 0, !1), d(M, R.filter((D) => D !== N), !1), p(!1), m(void 0), f(void 0);
|
|
1384
|
+
}, [d, o]), P = h ? ae(h, s) : void 0, k = P ? I(o.properties, P.replaceAll(".", ".properties.")) : void 0, b = !v || v.length < 1, C = Q((N, g) => {
|
|
1385
|
+
d(ye(g), N, !1);
|
|
1392
1386
|
}, []);
|
|
1393
1387
|
return /* @__PURE__ */ a(j, { children: [
|
|
1394
1388
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -1416,8 +1410,8 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1416
1410
|
propertiesOrder: v,
|
|
1417
1411
|
errors: {},
|
|
1418
1412
|
collectionEditable: l,
|
|
1419
|
-
onPropertyClick: (N,
|
|
1420
|
-
m(N), g
|
|
1413
|
+
onPropertyClick: (N, g) => {
|
|
1414
|
+
m(N), f(g), p(!0);
|
|
1421
1415
|
},
|
|
1422
1416
|
onPropertyMove: C
|
|
1423
1417
|
}
|
|
@@ -1454,15 +1448,15 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1454
1448
|
allowDataInference: n,
|
|
1455
1449
|
collectionEditable: l,
|
|
1456
1450
|
onCancel: () => {
|
|
1457
|
-
p(!1), m(void 0),
|
|
1451
|
+
p(!1), m(void 0), f(void 0);
|
|
1458
1452
|
},
|
|
1459
1453
|
onOkClicked: () => {
|
|
1460
|
-
p(!1), m(void 0),
|
|
1454
|
+
p(!1), m(void 0), f(void 0);
|
|
1461
1455
|
},
|
|
1462
1456
|
getData: r,
|
|
1463
1457
|
onDelete: y,
|
|
1464
1458
|
propertyKey: h,
|
|
1465
|
-
propertyNamespace:
|
|
1459
|
+
propertyNamespace: s,
|
|
1466
1460
|
property: k,
|
|
1467
1461
|
existingProperty: !!h,
|
|
1468
1462
|
autoUpdateId: !h,
|
|
@@ -1488,8 +1482,8 @@ function Vi({
|
|
|
1488
1482
|
handleChange: p,
|
|
1489
1483
|
errors: h,
|
|
1490
1484
|
setFieldValue: m,
|
|
1491
|
-
touched:
|
|
1492
|
-
} = K(), [
|
|
1485
|
+
touched: s
|
|
1486
|
+
} = K(), [f, v] = $(!1), x = I(u, "of"), y = I(s, "of") && I(h, "of"), P = ({ id: b, property: C, namespace: N }) => {
|
|
1493
1487
|
console.log("onPropertyChanged", b, C, N), m("of", C);
|
|
1494
1488
|
}, k = x && $e(x, o);
|
|
1495
1489
|
return /* @__PURE__ */ a(j, { children: [
|
|
@@ -1529,7 +1523,7 @@ function Vi({
|
|
|
1529
1523
|
Ve,
|
|
1530
1524
|
{
|
|
1531
1525
|
inArray: !0,
|
|
1532
|
-
open:
|
|
1526
|
+
open: f,
|
|
1533
1527
|
existingProperty: r,
|
|
1534
1528
|
getData: i,
|
|
1535
1529
|
autoUpdateId: !r,
|
|
@@ -1564,8 +1558,8 @@ const Ii = Y.forwardRef(
|
|
|
1564
1558
|
values: p,
|
|
1565
1559
|
setFieldValue: h,
|
|
1566
1560
|
setFieldTouched: m,
|
|
1567
|
-
touched:
|
|
1568
|
-
validate:
|
|
1561
|
+
touched: s,
|
|
1562
|
+
validate: f
|
|
1569
1563
|
} = K(), v = "name", x = r && I(u, v), y = "id", P = r && I(u, y), k = "description", b = r && I(u, k);
|
|
1570
1564
|
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
1571
1565
|
/* @__PURE__ */ a("div", { children: [
|
|
@@ -1578,7 +1572,7 @@ const Ii = Y.forwardRef(
|
|
|
1578
1572
|
value: p[v],
|
|
1579
1573
|
onChange: (C) => {
|
|
1580
1574
|
const N = C.target.value;
|
|
1581
|
-
!I(
|
|
1575
|
+
!I(s, y) && l && h(y, N ? Pt(N) : "", !1), h(v, N, !0), m(v, !0);
|
|
1582
1576
|
},
|
|
1583
1577
|
style: { fontSize: 20 },
|
|
1584
1578
|
placeholder: "Field name",
|
|
@@ -1599,7 +1593,7 @@ const Ii = Y.forwardRef(
|
|
|
1599
1593
|
value: p[y],
|
|
1600
1594
|
onChange: (C) => {
|
|
1601
1595
|
const N = C.target.value;
|
|
1602
|
-
!I(
|
|
1596
|
+
!I(s, v) && l && h(v, N ? ut(N) : ""), h(y, N, !0), m(y, !0);
|
|
1603
1597
|
},
|
|
1604
1598
|
disabled: n || i,
|
|
1605
1599
|
required: !0,
|
|
@@ -1724,7 +1718,7 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1724
1718
|
const {
|
|
1725
1719
|
values: o,
|
|
1726
1720
|
setFieldValue: d
|
|
1727
|
-
} = K(), [u, p] = $(!1), [h, m] = $(), [
|
|
1721
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [s, f] = $(), v = ({
|
|
1728
1722
|
id: C,
|
|
1729
1723
|
property: N
|
|
1730
1724
|
}) => {
|
|
@@ -1734,15 +1728,15 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1734
1728
|
...o.oneOf?.properties ?? {},
|
|
1735
1729
|
[C]: N
|
|
1736
1730
|
}, !1);
|
|
1737
|
-
const
|
|
1731
|
+
const g = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), w = g.includes(C) ? g : [...g, C];
|
|
1738
1732
|
d("oneOf.propertiesOrder", w, !1), p(!1);
|
|
1739
|
-
}, x = h ? ae(h,
|
|
1740
|
-
const
|
|
1741
|
-
if (!
|
|
1733
|
+
}, x = h ? ae(h, s) : void 0, y = x ? I(o.oneOf?.properties, x.replaceAll(".", ".properties.")) : void 0, P = Q((C, N) => {
|
|
1734
|
+
const g = C ? ae(C, N) : void 0;
|
|
1735
|
+
if (!g)
|
|
1742
1736
|
throw Error("collection editor miss config");
|
|
1743
|
-
d(`oneOf.${
|
|
1737
|
+
d(`oneOf.${me(g)}`, void 0, !1);
|
|
1744
1738
|
const w = `oneOf.${ye(N)}`, _ = I(o, w);
|
|
1745
|
-
d(w, _.filter((M) => M !== C), !1), p(!1), m(void 0),
|
|
1739
|
+
d(w, _.filter((M) => M !== C), !1), p(!1), m(void 0), f(void 0);
|
|
1746
1740
|
}, [d, o]), k = /* @__PURE__ */ a(
|
|
1747
1741
|
z,
|
|
1748
1742
|
{
|
|
@@ -1773,7 +1767,7 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1773
1767
|
errors: {},
|
|
1774
1768
|
collectionEditable: l,
|
|
1775
1769
|
onPropertyClick: t ? void 0 : (C, N) => {
|
|
1776
|
-
m(C),
|
|
1770
|
+
m(C), f(N), p(!0);
|
|
1777
1771
|
},
|
|
1778
1772
|
onPropertyMove: t ? void 0 : b
|
|
1779
1773
|
}
|
|
@@ -1790,15 +1784,15 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1790
1784
|
getData: r,
|
|
1791
1785
|
allowDataInference: n,
|
|
1792
1786
|
onCancel: () => {
|
|
1793
|
-
p(!1), m(void 0),
|
|
1787
|
+
p(!1), m(void 0), f(void 0);
|
|
1794
1788
|
},
|
|
1795
1789
|
onOkClicked: () => {
|
|
1796
|
-
p(!1), m(void 0),
|
|
1790
|
+
p(!1), m(void 0), f(void 0);
|
|
1797
1791
|
},
|
|
1798
1792
|
collectionEditable: l,
|
|
1799
1793
|
onDelete: P,
|
|
1800
1794
|
propertyKey: h,
|
|
1801
|
-
propertyNamespace:
|
|
1795
|
+
propertyNamespace: s,
|
|
1802
1796
|
property: y,
|
|
1803
1797
|
existingProperty: !!h,
|
|
1804
1798
|
autoUpdateId: !h,
|
|
@@ -1870,12 +1864,12 @@ function Ei({ disabled: t }) {
|
|
|
1870
1864
|
{
|
|
1871
1865
|
name: "validation.positive",
|
|
1872
1866
|
type: "checkbox",
|
|
1873
|
-
children: ({ field: m, form:
|
|
1867
|
+
children: ({ field: m, form: s }) => /* @__PURE__ */ e(
|
|
1874
1868
|
ce,
|
|
1875
1869
|
{
|
|
1876
1870
|
label: "Positive value",
|
|
1877
1871
|
disabled: t,
|
|
1878
|
-
form:
|
|
1872
|
+
form: s,
|
|
1879
1873
|
field: m
|
|
1880
1874
|
}
|
|
1881
1875
|
)
|
|
@@ -1886,12 +1880,12 @@ function Ei({ disabled: t }) {
|
|
|
1886
1880
|
{
|
|
1887
1881
|
name: "validation.negative",
|
|
1888
1882
|
type: "checkbox",
|
|
1889
|
-
children: ({ field: m, form:
|
|
1883
|
+
children: ({ field: m, form: s }) => /* @__PURE__ */ e(
|
|
1890
1884
|
ce,
|
|
1891
1885
|
{
|
|
1892
1886
|
label: "Negative value",
|
|
1893
1887
|
disabled: t,
|
|
1894
|
-
form:
|
|
1888
|
+
form: s,
|
|
1895
1889
|
field: m
|
|
1896
1890
|
}
|
|
1897
1891
|
)
|
|
@@ -1902,12 +1896,12 @@ function Ei({ disabled: t }) {
|
|
|
1902
1896
|
{
|
|
1903
1897
|
name: "validation.integer",
|
|
1904
1898
|
type: "checkbox",
|
|
1905
|
-
children: ({ field: m, form:
|
|
1899
|
+
children: ({ field: m, form: s }) => /* @__PURE__ */ e(
|
|
1906
1900
|
ce,
|
|
1907
1901
|
{
|
|
1908
1902
|
label: "Integer value",
|
|
1909
1903
|
disabled: t,
|
|
1910
|
-
form:
|
|
1904
|
+
form: s,
|
|
1911
1905
|
field: m
|
|
1912
1906
|
}
|
|
1913
1907
|
)
|
|
@@ -1988,15 +1982,15 @@ function Di({
|
|
|
1988
1982
|
onChange: i,
|
|
1989
1983
|
label: "Target collection",
|
|
1990
1984
|
renderValue: (m) => {
|
|
1991
|
-
const
|
|
1992
|
-
return
|
|
1993
|
-
/* @__PURE__ */ e(ot, { collectionOrView:
|
|
1985
|
+
const s = u.find((f) => f.id === m || f.path === m);
|
|
1986
|
+
return s ? /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
1987
|
+
/* @__PURE__ */ e(ot, { collectionOrView: s }),
|
|
1994
1988
|
/* @__PURE__ */ e(
|
|
1995
1989
|
O,
|
|
1996
1990
|
{
|
|
1997
1991
|
variant: "subtitle2",
|
|
1998
1992
|
className: "font-medium ml-4",
|
|
1999
|
-
children:
|
|
1993
|
+
children: s?.name.toUpperCase()
|
|
2000
1994
|
}
|
|
2001
1995
|
)
|
|
2002
1996
|
] }) : null;
|
|
@@ -2007,23 +2001,23 @@ function Di({
|
|
|
2007
2001
|
At,
|
|
2008
2002
|
{
|
|
2009
2003
|
label: m || "Views",
|
|
2010
|
-
children: u.filter((
|
|
2004
|
+
children: u.filter((s) => s.group === m).map((s) => /* @__PURE__ */ e(
|
|
2011
2005
|
ee,
|
|
2012
2006
|
{
|
|
2013
|
-
value:
|
|
2007
|
+
value: s.id ?? s.path,
|
|
2014
2008
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2015
|
-
/* @__PURE__ */ e(ot, { collectionOrView:
|
|
2009
|
+
/* @__PURE__ */ e(ot, { collectionOrView: s }),
|
|
2016
2010
|
/* @__PURE__ */ e(
|
|
2017
2011
|
O,
|
|
2018
2012
|
{
|
|
2019
2013
|
variant: "subtitle2",
|
|
2020
2014
|
className: "font-medium ml-4",
|
|
2021
|
-
children:
|
|
2015
|
+
children: s?.name.toUpperCase()
|
|
2022
2016
|
}
|
|
2023
2017
|
)
|
|
2024
2018
|
] })
|
|
2025
2019
|
},
|
|
2026
|
-
`${
|
|
2020
|
+
`${s.id ?? s.path}-${m}`
|
|
2027
2021
|
))
|
|
2028
2022
|
},
|
|
2029
2023
|
`group_${m}`
|
|
@@ -2067,10 +2061,10 @@ function Bi({ disabled: t }) {
|
|
|
2067
2061
|
name: o,
|
|
2068
2062
|
value: d ?? "date",
|
|
2069
2063
|
error: !!u,
|
|
2070
|
-
onValueChange: (
|
|
2064
|
+
onValueChange: (s) => l(o, s),
|
|
2071
2065
|
label: "Mode",
|
|
2072
|
-
renderValue: (
|
|
2073
|
-
switch (
|
|
2066
|
+
renderValue: (s) => {
|
|
2067
|
+
switch (s) {
|
|
2074
2068
|
case "date_time":
|
|
2075
2069
|
return "Date/Time";
|
|
2076
2070
|
case "date":
|
|
@@ -2093,9 +2087,9 @@ function Bi({ disabled: t }) {
|
|
|
2093
2087
|
name: p,
|
|
2094
2088
|
disabled: t,
|
|
2095
2089
|
value: h ?? "",
|
|
2096
|
-
onValueChange: (
|
|
2097
|
-
renderValue: (
|
|
2098
|
-
switch (
|
|
2090
|
+
onValueChange: (s) => l(p, s === "none" ? null : s),
|
|
2091
|
+
renderValue: (s) => {
|
|
2092
|
+
switch (s) {
|
|
2099
2093
|
case "on_create":
|
|
2100
2094
|
return "On create";
|
|
2101
2095
|
case "on_update":
|
|
@@ -2107,7 +2101,7 @@ function Bi({ disabled: t }) {
|
|
|
2107
2101
|
error: !!m,
|
|
2108
2102
|
label: "Automatic value",
|
|
2109
2103
|
children: [
|
|
2110
|
-
/* @__PURE__ */ e(ee, { value: "", children: " None " }),
|
|
2104
|
+
/* @__PURE__ */ e(ee, { value: "none", children: " None " }),
|
|
2111
2105
|
/* @__PURE__ */ e(ee, { value: "on_create", children: " On create " }),
|
|
2112
2106
|
/* @__PURE__ */ e(ee, { value: "on_update", children: " On any update " })
|
|
2113
2107
|
]
|
|
@@ -2374,7 +2368,7 @@ function or({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
|
2374
2368
|
children: /* @__PURE__ */ a(
|
|
2375
2369
|
"div",
|
|
2376
2370
|
{
|
|
2377
|
-
className:
|
|
2371
|
+
className: he(
|
|
2378
2372
|
"flex flex-row items-center text-base min-h-[52px]",
|
|
2379
2373
|
r ? "w-full" : ""
|
|
2380
2374
|
),
|
|
@@ -2491,8 +2485,8 @@ const Ui = [
|
|
|
2491
2485
|
existingPropertyKeys: p,
|
|
2492
2486
|
propertyNamespace: h,
|
|
2493
2487
|
property: m,
|
|
2494
|
-
onPropertyChanged:
|
|
2495
|
-
onPropertyChangedImmediate:
|
|
2488
|
+
onPropertyChanged: s,
|
|
2489
|
+
onPropertyChangedImmediate: f = !0,
|
|
2496
2490
|
onDelete: v,
|
|
2497
2491
|
onError: x,
|
|
2498
2492
|
initialErrors: y,
|
|
@@ -2501,31 +2495,31 @@ const Ui = [
|
|
|
2501
2495
|
getController: b,
|
|
2502
2496
|
getData: C,
|
|
2503
2497
|
propertyConfigs: N,
|
|
2504
|
-
collectionEditable:
|
|
2498
|
+
collectionEditable: g
|
|
2505
2499
|
} = r, w = {
|
|
2506
2500
|
id: "",
|
|
2507
2501
|
name: ""
|
|
2508
|
-
}, _ = !!(m && !qe(m)) && !
|
|
2502
|
+
}, _ = !!(m && !qe(m)) && !g, M = Le(m ? {
|
|
2509
2503
|
id: u,
|
|
2510
2504
|
previousId: u,
|
|
2511
2505
|
property: m
|
|
2512
2506
|
} : void 0), R = ({
|
|
2513
2507
|
id: A,
|
|
2514
|
-
property:
|
|
2508
|
+
property: c
|
|
2515
2509
|
}) => {
|
|
2516
2510
|
const V = {
|
|
2517
2511
|
id: A,
|
|
2518
2512
|
previousId: M.current?.id,
|
|
2519
|
-
property:
|
|
2513
|
+
property: c,
|
|
2520
2514
|
namespace: h
|
|
2521
2515
|
};
|
|
2522
|
-
M.current = V,
|
|
2516
|
+
M.current = V, s?.(V);
|
|
2523
2517
|
}, D = Tt({
|
|
2524
2518
|
initialValues: m ? { id: u, ...m } : w,
|
|
2525
2519
|
initialErrors: y,
|
|
2526
2520
|
validateOnChange: !0,
|
|
2527
2521
|
validateOnInitialRender: !0,
|
|
2528
|
-
onSubmit: (A,
|
|
2522
|
+
onSubmit: (A, c) => {
|
|
2529
2523
|
console.debug("onSubmit", A);
|
|
2530
2524
|
const {
|
|
2531
2525
|
id: V,
|
|
@@ -2534,27 +2528,27 @@ const Ui = [
|
|
|
2534
2528
|
R({
|
|
2535
2529
|
id: V,
|
|
2536
2530
|
property: { ...G, editable: G.editable ?? !0 }
|
|
2537
|
-
}), l ||
|
|
2531
|
+
}), l || c.resetForm({ values: w });
|
|
2538
2532
|
},
|
|
2539
2533
|
validation: (A) => {
|
|
2540
|
-
const
|
|
2534
|
+
const c = {};
|
|
2541
2535
|
if (n) {
|
|
2542
2536
|
if (!A.name)
|
|
2543
|
-
|
|
2537
|
+
c.name = "Required";
|
|
2544
2538
|
else {
|
|
2545
2539
|
const V = $i(A.name);
|
|
2546
|
-
V && (
|
|
2540
|
+
V && (c.name = V);
|
|
2547
2541
|
}
|
|
2548
2542
|
if (!A.id)
|
|
2549
|
-
|
|
2543
|
+
c.id = "Required";
|
|
2550
2544
|
else {
|
|
2551
2545
|
const V = qi(A.id, p);
|
|
2552
|
-
V && (
|
|
2546
|
+
V && (c.id = V);
|
|
2553
2547
|
}
|
|
2554
2548
|
}
|
|
2555
|
-
return A.dataType === "string" && A.validation?.matches && !Pr(A.validation?.matches.toString()) && (
|
|
2549
|
+
return A.dataType === "string" && A.validation?.matches && !Pr(A.validation?.matches.toString()) && (c.validation = {
|
|
2556
2550
|
matches: "Invalid regular expression"
|
|
2557
|
-
}), A.dataType === "reference" && !A.path && (
|
|
2551
|
+
}), A.dataType === "reference" && !A.path && (c.path = "You must specify a target collection for the field"), A.propertyConfig === "repeat" && (A.of || (c.of = "You need to specify a repeat field")), A.propertyConfig === "block" && (A.oneOf || (c.oneOf = "You need to specify the properties of this block")), c;
|
|
2558
2552
|
}
|
|
2559
2553
|
});
|
|
2560
2554
|
return de(() => {
|
|
@@ -2562,7 +2556,7 @@ const Ui = [
|
|
|
2562
2556
|
}, [D, b]), /* @__PURE__ */ e(kt, { value: D, children: /* @__PURE__ */ e(
|
|
2563
2557
|
ji,
|
|
2564
2558
|
{
|
|
2565
|
-
onPropertyChanged:
|
|
2559
|
+
onPropertyChanged: f ? R : void 0,
|
|
2566
2560
|
onDelete: v,
|
|
2567
2561
|
includeIdAndTitle: n,
|
|
2568
2562
|
propertyNamespace: h,
|
|
@@ -2576,7 +2570,7 @@ const Ui = [
|
|
|
2576
2570
|
getData: C,
|
|
2577
2571
|
allowDataInference: k,
|
|
2578
2572
|
propertyConfigs: N,
|
|
2579
|
-
collectionEditable:
|
|
2573
|
+
collectionEditable: g,
|
|
2580
2574
|
...D
|
|
2581
2575
|
}
|
|
2582
2576
|
) });
|
|
@@ -2662,26 +2656,26 @@ function ji({
|
|
|
2662
2656
|
onDelete: p,
|
|
2663
2657
|
propertyNamespace: h,
|
|
2664
2658
|
onError: m,
|
|
2665
|
-
showErrors:
|
|
2666
|
-
disabled:
|
|
2659
|
+
showErrors: s,
|
|
2660
|
+
disabled: f,
|
|
2667
2661
|
inArray: v,
|
|
2668
2662
|
getData: x,
|
|
2669
2663
|
allowDataInference: y,
|
|
2670
2664
|
propertyConfigs: P,
|
|
2671
2665
|
collectionEditable: k
|
|
2672
2666
|
}) {
|
|
2673
|
-
const [b, C] = $(o), [N,
|
|
2667
|
+
const [b, C] = $(o), [N, g] = $(!1), [w, _] = $(t?.dataType ? Kt(t) : void 0), M = Object.entries(lr).concat(Object.entries(P)), R = v ? M.filter(([q, L]) => !ne(L.property) && L.property?.dataType !== "array") : M, D = Ir(t), A = Le(null), c = Le(t), V = s && I(r, "selectedWidget");
|
|
2674
2668
|
de(() => {
|
|
2675
2669
|
if (u && (!d || D.id)) {
|
|
2676
2670
|
const {
|
|
2677
2671
|
id: q,
|
|
2678
2672
|
...L
|
|
2679
2673
|
} = D;
|
|
2680
|
-
ve(D,
|
|
2674
|
+
ve(D, c.current) || (u({
|
|
2681
2675
|
id: q,
|
|
2682
2676
|
property: L,
|
|
2683
2677
|
namespace: h
|
|
2684
|
-
}),
|
|
2678
|
+
}), c.current = D);
|
|
2685
2679
|
}
|
|
2686
2680
|
}, [D, d, u, h]), de(() => {
|
|
2687
2681
|
t?.id && m && m(t?.id, h, r);
|
|
@@ -2696,14 +2690,14 @@ function ji({
|
|
|
2696
2690
|
_i,
|
|
2697
2691
|
{
|
|
2698
2692
|
widgetId: w,
|
|
2699
|
-
disabled:
|
|
2700
|
-
showErrors:
|
|
2693
|
+
disabled: f,
|
|
2694
|
+
showErrors: s
|
|
2701
2695
|
}
|
|
2702
2696
|
) : w === "url" ? B = /* @__PURE__ */ e(
|
|
2703
2697
|
Ri,
|
|
2704
2698
|
{
|
|
2705
|
-
disabled:
|
|
2706
|
-
showErrors:
|
|
2699
|
+
disabled: f,
|
|
2700
|
+
showErrors: s
|
|
2707
2701
|
}
|
|
2708
2702
|
) : w === "select" || w === "number_select" ? B = /* @__PURE__ */ e(
|
|
2709
2703
|
Rt,
|
|
@@ -2711,38 +2705,38 @@ function ji({
|
|
|
2711
2705
|
multiselect: !1,
|
|
2712
2706
|
allowDataInference: y,
|
|
2713
2707
|
updateIds: !i,
|
|
2714
|
-
disabled:
|
|
2708
|
+
disabled: f,
|
|
2715
2709
|
getData: x,
|
|
2716
|
-
showErrors:
|
|
2710
|
+
showErrors: s
|
|
2717
2711
|
}
|
|
2718
2712
|
) : w === "multi_select" || w === "multi_number_select" ? B = /* @__PURE__ */ e(
|
|
2719
2713
|
Rt,
|
|
2720
2714
|
{
|
|
2721
2715
|
multiselect: !0,
|
|
2722
2716
|
updateIds: !i,
|
|
2723
|
-
disabled:
|
|
2717
|
+
disabled: f,
|
|
2724
2718
|
allowDataInference: y,
|
|
2725
2719
|
getData: x,
|
|
2726
|
-
showErrors:
|
|
2720
|
+
showErrors: s
|
|
2727
2721
|
}
|
|
2728
2722
|
) : w === "file_upload" ? B = /* @__PURE__ */ e(
|
|
2729
2723
|
Ut,
|
|
2730
2724
|
{
|
|
2731
2725
|
existing: i,
|
|
2732
2726
|
multiple: !1,
|
|
2733
|
-
disabled:
|
|
2727
|
+
disabled: f
|
|
2734
2728
|
}
|
|
2735
2729
|
) : w === "multi_file_upload" ? B = /* @__PURE__ */ e(
|
|
2736
2730
|
Ut,
|
|
2737
2731
|
{
|
|
2738
2732
|
existing: i,
|
|
2739
2733
|
multiple: !0,
|
|
2740
|
-
disabled:
|
|
2734
|
+
disabled: f
|
|
2741
2735
|
}
|
|
2742
|
-
) : w === "switch" ? B = /* @__PURE__ */ e(Fi, { disabled:
|
|
2736
|
+
) : w === "switch" ? B = /* @__PURE__ */ e(Fi, { disabled: f }) : w === "number_input" ? B = /* @__PURE__ */ e(Ai, { disabled: f }) : w === "group" ? B = /* @__PURE__ */ e(
|
|
2743
2737
|
Oi,
|
|
2744
2738
|
{
|
|
2745
|
-
disabled:
|
|
2739
|
+
disabled: f,
|
|
2746
2740
|
getData: x,
|
|
2747
2741
|
allowDataInference: y,
|
|
2748
2742
|
collectionEditable: k,
|
|
@@ -2751,7 +2745,7 @@ function ji({
|
|
|
2751
2745
|
) : w === "block" ? B = /* @__PURE__ */ e(
|
|
2752
2746
|
Si,
|
|
2753
2747
|
{
|
|
2754
|
-
disabled:
|
|
2748
|
+
disabled: f,
|
|
2755
2749
|
getData: x,
|
|
2756
2750
|
allowDataInference: y,
|
|
2757
2751
|
collectionEditable: k,
|
|
@@ -2760,32 +2754,32 @@ function ji({
|
|
|
2760
2754
|
) : w === "reference" ? B = /* @__PURE__ */ e(
|
|
2761
2755
|
jt,
|
|
2762
2756
|
{
|
|
2763
|
-
showErrors:
|
|
2757
|
+
showErrors: s,
|
|
2764
2758
|
existing: i,
|
|
2765
2759
|
multiple: !1,
|
|
2766
|
-
disabled:
|
|
2760
|
+
disabled: f
|
|
2767
2761
|
}
|
|
2768
|
-
) : w === "date_time" ? B = /* @__PURE__ */ e(Bi, { disabled:
|
|
2762
|
+
) : w === "date_time" ? B = /* @__PURE__ */ e(Bi, { disabled: f }) : w === "multi_references" ? B = /* @__PURE__ */ e(
|
|
2769
2763
|
jt,
|
|
2770
2764
|
{
|
|
2771
|
-
showErrors:
|
|
2765
|
+
showErrors: s,
|
|
2772
2766
|
existing: i,
|
|
2773
2767
|
multiple: !0,
|
|
2774
|
-
disabled:
|
|
2768
|
+
disabled: f
|
|
2775
2769
|
}
|
|
2776
2770
|
) : w === "repeat" ? B = /* @__PURE__ */ e(
|
|
2777
2771
|
Vi,
|
|
2778
2772
|
{
|
|
2779
|
-
showErrors:
|
|
2773
|
+
showErrors: s,
|
|
2780
2774
|
existing: i,
|
|
2781
2775
|
getData: x,
|
|
2782
2776
|
allowDataInference: y,
|
|
2783
|
-
disabled:
|
|
2777
|
+
disabled: f,
|
|
2784
2778
|
collectionEditable: k,
|
|
2785
2779
|
propertyConfigs: P
|
|
2786
2780
|
}
|
|
2787
|
-
) : w === "key_value" ? B = /* @__PURE__ */ e(Mi, { disabled:
|
|
2788
|
-
|
|
2781
|
+
) : w === "key_value" ? B = /* @__PURE__ */ e(Mi, { disabled: f }) : B = null, /* @__PURE__ */ a(j, { children: [
|
|
2782
|
+
f && /* @__PURE__ */ a(Lr, { mode: "warn", children: [
|
|
2789
2783
|
/* @__PURE__ */ e(O, { children: "This property can't be edited" }),
|
|
2790
2784
|
/* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
2791
2785
|
"You may not have permission to edit it or it is defined in code with no ",
|
|
@@ -2804,7 +2798,7 @@ function ji({
|
|
|
2804
2798
|
open: b,
|
|
2805
2799
|
onOpenChange: C,
|
|
2806
2800
|
position: "item-aligned",
|
|
2807
|
-
disabled:
|
|
2801
|
+
disabled: f,
|
|
2808
2802
|
renderValue: (q) => {
|
|
2809
2803
|
if (!q)
|
|
2810
2804
|
return /* @__PURE__ */ e("em", { children: "Select a property widget" });
|
|
@@ -2815,7 +2809,7 @@ function ji({
|
|
|
2815
2809
|
onClick: (re) => {
|
|
2816
2810
|
we && (re.stopPropagation(), re.preventDefault());
|
|
2817
2811
|
},
|
|
2818
|
-
className:
|
|
2812
|
+
className: he(
|
|
2819
2813
|
"flex items-center",
|
|
2820
2814
|
we ? "w-full pointer-events-none opacity-50" : ""
|
|
2821
2815
|
),
|
|
@@ -2869,8 +2863,8 @@ function ji({
|
|
|
2869
2863
|
{
|
|
2870
2864
|
variant: "ghost",
|
|
2871
2865
|
className: "m-4",
|
|
2872
|
-
disabled:
|
|
2873
|
-
onClick: () =>
|
|
2866
|
+
disabled: f,
|
|
2867
|
+
onClick: () => g(!0),
|
|
2874
2868
|
children: /* @__PURE__ */ e(dt, {})
|
|
2875
2869
|
}
|
|
2876
2870
|
)
|
|
@@ -2879,23 +2873,23 @@ function ji({
|
|
|
2879
2873
|
d && /* @__PURE__ */ e(
|
|
2880
2874
|
Ii,
|
|
2881
2875
|
{
|
|
2882
|
-
showErrors:
|
|
2876
|
+
showErrors: s,
|
|
2883
2877
|
disabledId: i,
|
|
2884
2878
|
isNewProperty: !i,
|
|
2885
|
-
disabled:
|
|
2879
|
+
disabled: f,
|
|
2886
2880
|
autoUpdateId: l,
|
|
2887
2881
|
ref: A
|
|
2888
2882
|
}
|
|
2889
2883
|
),
|
|
2890
2884
|
B,
|
|
2891
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(zi, { disabled:
|
|
2885
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(zi, { disabled: f }) })
|
|
2892
2886
|
] }),
|
|
2893
2887
|
p && /* @__PURE__ */ e(
|
|
2894
2888
|
lt,
|
|
2895
2889
|
{
|
|
2896
2890
|
open: N,
|
|
2897
2891
|
onAccept: () => p(t?.id, h),
|
|
2898
|
-
onCancel: () =>
|
|
2892
|
+
onCancel: () => g(!1),
|
|
2899
2893
|
title: /* @__PURE__ */ e("div", { children: "Delete this property?" }),
|
|
2900
2894
|
body: /* @__PURE__ */ a("div", { children: [
|
|
2901
2895
|
" This will ",
|
|
@@ -2952,7 +2946,7 @@ const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.s
|
|
|
2952
2946
|
theme: si.vsDark,
|
|
2953
2947
|
code: l,
|
|
2954
2948
|
language: "typescript",
|
|
2955
|
-
children: ({ className: o, style: d, tokens: u, getLineProps: p, getTokenProps: h }) => /* @__PURE__ */ e("pre", { style: d, className: "p-4 rounded text-sm", children: u.map((m,
|
|
2949
|
+
children: ({ className: o, style: d, tokens: u, getLineProps: p, getTokenProps: h }) => /* @__PURE__ */ e("pre", { style: d, className: "p-4 rounded text-sm", children: u.map((m, s) => /* @__PURE__ */ e("div", { ...p({ line: m }), children: m.map((f, v) => /* @__PURE__ */ e("span", { ...h({ token: f }) }, v)) }, s)) })
|
|
2956
2950
|
}
|
|
2957
2951
|
)
|
|
2958
2952
|
] }),
|
|
@@ -3019,21 +3013,21 @@ function Gi({
|
|
|
3019
3013
|
getData: p,
|
|
3020
3014
|
doCollectionInference: h,
|
|
3021
3015
|
propertyConfigs: m,
|
|
3022
|
-
collectionEditable:
|
|
3016
|
+
collectionEditable: s
|
|
3023
3017
|
}) {
|
|
3024
3018
|
const {
|
|
3025
|
-
values:
|
|
3019
|
+
values: f,
|
|
3026
3020
|
setFieldValue: v,
|
|
3027
3021
|
setFieldError: x,
|
|
3028
3022
|
setFieldTouched: y,
|
|
3029
3023
|
errors: P,
|
|
3030
3024
|
dirty: k
|
|
3031
|
-
} = K(), b = Ie(), C = Nr(), N = !C, [
|
|
3025
|
+
} = K(), b = Ie(), C = Nr(), N = !C, [g, w] = $(), [_, M] = $(), [R, D] = $(), A = _ ? ae(_, R) : void 0, c = A ? I(f.properties, A.replaceAll(".", ".properties.")) : void 0, [V, G] = $(!1), [B, q] = $(!1), [L, J] = $(!1), [le, Me] = $([]), we = Y.useRef(f.propertiesOrder ? { "": f.propertiesOrder } : {});
|
|
3032
3026
|
de(() => {
|
|
3033
3027
|
l && l(k);
|
|
3034
3028
|
}, [k]);
|
|
3035
3029
|
const ue = h ? () => {
|
|
3036
|
-
h && (q(!0), h(
|
|
3030
|
+
h && (q(!0), h(f).then((F) => {
|
|
3037
3031
|
if (F && pt(F.properties), !F) {
|
|
3038
3032
|
b.open({
|
|
3039
3033
|
type: "error",
|
|
@@ -3041,7 +3035,7 @@ function Gi({
|
|
|
3041
3035
|
});
|
|
3042
3036
|
return;
|
|
3043
3037
|
}
|
|
3044
|
-
const U = (F.properties ? Object.keys(F.properties) : []).filter((E) => !
|
|
3038
|
+
const U = (F.properties ? Object.keys(F.properties) : []).filter((E) => !f.properties[E]);
|
|
3045
3039
|
if (U.length === 0) {
|
|
3046
3040
|
b.open({
|
|
3047
3041
|
type: "info",
|
|
@@ -3051,26 +3045,26 @@ function Gi({
|
|
|
3051
3045
|
}
|
|
3052
3046
|
const T = {
|
|
3053
3047
|
...U.reduce((E, ie) => (E[ie] = (F.properties ?? {})[ie], E), {}),
|
|
3054
|
-
...
|
|
3048
|
+
...f.properties
|
|
3055
3049
|
}, S = [
|
|
3056
3050
|
...U,
|
|
3057
|
-
...
|
|
3051
|
+
...f.propertiesOrder ?? []
|
|
3058
3052
|
];
|
|
3059
|
-
v("properties", T, !1),
|
|
3053
|
+
v("properties", T, !1), fe(S), Me(U);
|
|
3060
3054
|
}).finally(() => {
|
|
3061
3055
|
q(!1);
|
|
3062
3056
|
}));
|
|
3063
|
-
} : void 0, re = Q((F) => F ? we.current[F] ?? I(
|
|
3057
|
+
} : void 0, re = Q((F) => F ? we.current[F] ?? I(f, ye(F)) : we.current[""], [f]), fe = Q((F, U) => {
|
|
3064
3058
|
const T = ye(U);
|
|
3065
3059
|
v(T, F, !1), we.current[U ?? ""] = F;
|
|
3066
3060
|
}, [v]), Te = Q((F, U) => {
|
|
3067
3061
|
const T = F ? ae(F, U) : void 0;
|
|
3068
3062
|
if (!T)
|
|
3069
3063
|
throw Error("collection editor miss config");
|
|
3070
|
-
v(
|
|
3064
|
+
v(me(T), void 0, !1);
|
|
3071
3065
|
const E = re(U).filter((ie) => ie !== F);
|
|
3072
|
-
|
|
3073
|
-
}, [re, v,
|
|
3066
|
+
fe(E, U), J(!1), w(void 0), M(void 0), D(void 0);
|
|
3067
|
+
}, [re, v, fe]), Ge = (F, U) => {
|
|
3074
3068
|
v(ye(U), F, !1);
|
|
3075
3069
|
}, gt = ({
|
|
3076
3070
|
id: F,
|
|
@@ -3079,18 +3073,18 @@ function Gi({
|
|
|
3079
3073
|
if (!F)
|
|
3080
3074
|
throw Error("Need to include an ID when creating a new property");
|
|
3081
3075
|
v("properties", {
|
|
3082
|
-
...
|
|
3076
|
+
...f.properties ?? {},
|
|
3083
3077
|
[F]: U
|
|
3084
3078
|
}, !1);
|
|
3085
|
-
const T = [...
|
|
3086
|
-
|
|
3087
|
-
},
|
|
3079
|
+
const T = [...f.propertiesOrder ?? Object.keys(f.properties), F];
|
|
3080
|
+
fe(T), J(!1), C && (w(T.indexOf(F)), M(F)), D(void 0);
|
|
3081
|
+
}, pe = ({
|
|
3088
3082
|
id: F,
|
|
3089
3083
|
property: U,
|
|
3090
3084
|
previousId: T,
|
|
3091
3085
|
namespace: S
|
|
3092
3086
|
}) => {
|
|
3093
|
-
const E = F ? ae(F, S) : void 0, ie = E ?
|
|
3087
|
+
const E = F ? ae(F, S) : void 0, ie = E ? me(E) : void 0;
|
|
3094
3088
|
if (T && T !== F) {
|
|
3095
3089
|
console.debug("onPropertyChanged, id change", {
|
|
3096
3090
|
id: F,
|
|
@@ -3098,8 +3092,8 @@ function Gi({
|
|
|
3098
3092
|
previousId: T,
|
|
3099
3093
|
namespace: S
|
|
3100
3094
|
});
|
|
3101
|
-
const ke = ae(T, S), Vt =
|
|
3102
|
-
|
|
3095
|
+
const ke = ae(T, S), Vt = me(ke), It = re(S).map((Xe) => Xe === T ? F : Xe).filter((Xe) => Xe !== void 0);
|
|
3096
|
+
fe(It, S), F && (w(It.indexOf(F)), M(F)), v(Vt, void 0, !1), y(Vt, !1, !1);
|
|
3103
3097
|
}
|
|
3104
3098
|
console.debug("onPropertyChanged", {
|
|
3105
3099
|
id: F,
|
|
@@ -3117,17 +3111,17 @@ function Gi({
|
|
|
3117
3111
|
propertyPath: S
|
|
3118
3112
|
}), S) {
|
|
3119
3113
|
const E = T && Object.keys(T).length > 0;
|
|
3120
|
-
i(F, U, E ? T : void 0), x(
|
|
3114
|
+
i(F, U, E ? T : void 0), x(me(S), E ? "Property error" : void 0);
|
|
3121
3115
|
}
|
|
3122
3116
|
}, []), We = () => {
|
|
3123
3117
|
w(void 0), M(void 0);
|
|
3124
|
-
}, Ze = _ && n?.current?.properties ? n.current.properties[_] : void 0, Je =
|
|
3118
|
+
}, Ze = _ && n?.current?.properties ? n.current.properties[_] : void 0, Je = f?.propertiesOrder === void 0 || f.propertiesOrder.length === 0, Re = f.propertiesOrder ? f.propertiesOrder : Object.keys(f.properties), Qe = Zt(() => f.ownerId ? u(f.ownerId) : null, [u, f.ownerId]), vt = Q((F, U) => {
|
|
3125
3119
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
3126
3120
|
propertyKey: F,
|
|
3127
3121
|
namespace: U
|
|
3128
3122
|
}), w(Re.indexOf(F)), M(F), D(U);
|
|
3129
3123
|
}, [Re]), yt = /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3130
|
-
/* @__PURE__ */ a("div", { className:
|
|
3124
|
+
/* @__PURE__ */ a("div", { className: he(
|
|
3131
3125
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
3132
3126
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
3133
3127
|
!N && "border-r " + wt
|
|
@@ -3197,13 +3191,13 @@ function Gi({
|
|
|
3197
3191
|
className: "pl-8",
|
|
3198
3192
|
inferredPropertyKeys: le,
|
|
3199
3193
|
selectedPropertyKey: _ ? ae(_, R) : void 0,
|
|
3200
|
-
properties:
|
|
3201
|
-
additionalFields:
|
|
3194
|
+
properties: f.properties,
|
|
3195
|
+
additionalFields: f.additionalFields,
|
|
3202
3196
|
propertiesOrder: Re,
|
|
3203
3197
|
onPropertyClick: vt,
|
|
3204
3198
|
onPropertyMove: Ge,
|
|
3205
3199
|
onPropertyRemove: r ? Te : void 0,
|
|
3206
|
-
collectionEditable:
|
|
3200
|
+
collectionEditable: s,
|
|
3207
3201
|
errors: P
|
|
3208
3202
|
}
|
|
3209
3203
|
) }),
|
|
@@ -3225,7 +3219,7 @@ function Gi({
|
|
|
3225
3219
|
{
|
|
3226
3220
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
3227
3221
|
children: [
|
|
3228
|
-
A &&
|
|
3222
|
+
A && c && !ne(c) && /* @__PURE__ */ e(
|
|
3229
3223
|
sr,
|
|
3230
3224
|
{
|
|
3231
3225
|
inArray: !1,
|
|
@@ -3235,19 +3229,19 @@ function Gi({
|
|
|
3235
3229
|
autoOpenTypeSelect: !1,
|
|
3236
3230
|
propertyKey: _,
|
|
3237
3231
|
propertyNamespace: R,
|
|
3238
|
-
property:
|
|
3239
|
-
onPropertyChanged:
|
|
3232
|
+
property: c,
|
|
3233
|
+
onPropertyChanged: pe,
|
|
3240
3234
|
onDelete: Te,
|
|
3241
3235
|
onError: Ke,
|
|
3242
3236
|
forceShowErrors: t,
|
|
3243
3237
|
initialErrors: Ze,
|
|
3244
3238
|
getData: p,
|
|
3245
3239
|
propertyConfigs: m,
|
|
3246
|
-
collectionEditable:
|
|
3240
|
+
collectionEditable: s
|
|
3247
3241
|
},
|
|
3248
|
-
`edit_view_${
|
|
3242
|
+
`edit_view_${g}`
|
|
3249
3243
|
),
|
|
3250
|
-
!
|
|
3244
|
+
!c && /* @__PURE__ */ a("div", { className: "w-full flex flex-col items-center justify-center h-full gap-4", children: [
|
|
3251
3245
|
/* @__PURE__ */ e(O, { variant: "label", className: "", children: Je ? "Now you can add your first property" : "Select a property to edit it" }),
|
|
3252
3246
|
/* @__PURE__ */ a(
|
|
3253
3247
|
z,
|
|
@@ -3261,7 +3255,7 @@ function Gi({
|
|
|
3261
3255
|
}
|
|
3262
3256
|
)
|
|
3263
3257
|
] }),
|
|
3264
|
-
|
|
3258
|
+
c && ne(c) && /* @__PURE__ */ e(O, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
|
|
3265
3259
|
]
|
|
3266
3260
|
}
|
|
3267
3261
|
) }),
|
|
@@ -3269,25 +3263,25 @@ function Gi({
|
|
|
3269
3263
|
Ve,
|
|
3270
3264
|
{
|
|
3271
3265
|
inArray: !1,
|
|
3272
|
-
open:
|
|
3273
|
-
autoUpdateId: !
|
|
3266
|
+
open: g !== void 0,
|
|
3267
|
+
autoUpdateId: !c,
|
|
3274
3268
|
allowDataInference: !r,
|
|
3275
3269
|
existingProperty: !0,
|
|
3276
3270
|
autoOpenTypeSelect: !1,
|
|
3277
3271
|
propertyKey: _,
|
|
3278
3272
|
propertyNamespace: R,
|
|
3279
|
-
property:
|
|
3280
|
-
onPropertyChanged:
|
|
3273
|
+
property: c,
|
|
3274
|
+
onPropertyChanged: pe,
|
|
3281
3275
|
onDelete: Te,
|
|
3282
3276
|
onError: Ke,
|
|
3283
3277
|
forceShowErrors: t,
|
|
3284
3278
|
initialErrors: Ze,
|
|
3285
3279
|
getData: p,
|
|
3286
3280
|
propertyConfigs: m,
|
|
3287
|
-
collectionEditable:
|
|
3281
|
+
collectionEditable: s,
|
|
3288
3282
|
onOkClicked: N ? We : void 0
|
|
3289
3283
|
},
|
|
3290
|
-
`edit_view_${
|
|
3284
|
+
`edit_view_${g}`
|
|
3291
3285
|
)
|
|
3292
3286
|
] });
|
|
3293
3287
|
return /* @__PURE__ */ a(j, { children: [
|
|
@@ -3306,14 +3300,14 @@ function Gi({
|
|
|
3306
3300
|
getData: p,
|
|
3307
3301
|
allowDataInference: !r,
|
|
3308
3302
|
propertyConfigs: m,
|
|
3309
|
-
collectionEditable:
|
|
3310
|
-
existingPropertyKeys:
|
|
3303
|
+
collectionEditable: s,
|
|
3304
|
+
existingPropertyKeys: f.propertiesOrder
|
|
3311
3305
|
}
|
|
3312
3306
|
),
|
|
3313
3307
|
/* @__PURE__ */ e(
|
|
3314
3308
|
Hi,
|
|
3315
3309
|
{
|
|
3316
|
-
collection:
|
|
3310
|
+
collection: f,
|
|
3317
3311
|
open: V,
|
|
3318
3312
|
onOpenChange: G
|
|
3319
3313
|
}
|
|
@@ -3390,10 +3384,10 @@ function Zi({
|
|
|
3390
3384
|
getUser: l,
|
|
3391
3385
|
parentCollectionIds: o
|
|
3392
3386
|
}) {
|
|
3393
|
-
const { entityViews: d } = Ae(), [u, p] = Y.useState(), [h, m] = Y.useState(!1), [
|
|
3387
|
+
const { entityViews: d } = Ae(), [u, p] = Y.useState(), [h, m] = Y.useState(!1), [s, f] = Y.useState(), [v, x] = Y.useState(), {
|
|
3394
3388
|
values: y,
|
|
3395
3389
|
setFieldValue: P
|
|
3396
|
-
} = K(), k = t.subcollections ?? [], b = y.entityViews?.filter((
|
|
3390
|
+
} = K(), k = t.subcollections ?? [], b = y.entityViews?.filter((g) => typeof g == "string").map((g) => xr(g, d)).filter(Boolean) ?? [], C = t.entityViews?.filter((g) => typeof g != "string") ?? [], N = b.length + C.length;
|
|
3397
3391
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3398
3392
|
/* @__PURE__ */ e(mt, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-16", children: [
|
|
3399
3393
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
@@ -3402,19 +3396,19 @@ function Zi({
|
|
|
3402
3396
|
y.name
|
|
3403
3397
|
] }),
|
|
3404
3398
|
/* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3405
|
-
k && k.length > 0 && /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(Bt, { children: k.map((
|
|
3399
|
+
k && k.length > 0 && /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(Bt, { children: k.map((g) => /* @__PURE__ */ a(
|
|
3406
3400
|
bt,
|
|
3407
3401
|
{
|
|
3408
3402
|
onClick: () => x({
|
|
3409
3403
|
isNewCollection: !1,
|
|
3410
|
-
editedCollectionId:
|
|
3404
|
+
editedCollectionId: g.id
|
|
3411
3405
|
}),
|
|
3412
3406
|
children: [
|
|
3413
3407
|
/* @__PURE__ */ e(
|
|
3414
3408
|
Ue,
|
|
3415
3409
|
{
|
|
3416
3410
|
align: "left",
|
|
3417
|
-
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children:
|
|
3411
|
+
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: g.name })
|
|
3418
3412
|
}
|
|
3419
3413
|
),
|
|
3420
3414
|
/* @__PURE__ */ e(
|
|
@@ -3426,7 +3420,7 @@ function Zi({
|
|
|
3426
3420
|
{
|
|
3427
3421
|
size: "small",
|
|
3428
3422
|
onClick: (w) => {
|
|
3429
|
-
w.preventDefault(), w.stopPropagation(), p(
|
|
3423
|
+
w.preventDefault(), w.stopPropagation(), p(g.id);
|
|
3430
3424
|
},
|
|
3431
3425
|
color: "inherit",
|
|
3432
3426
|
children: /* @__PURE__ */ e(dt, { size: "small" })
|
|
@@ -3436,7 +3430,7 @@ function Zi({
|
|
|
3436
3430
|
)
|
|
3437
3431
|
]
|
|
3438
3432
|
},
|
|
3439
|
-
|
|
3433
|
+
g.path
|
|
3440
3434
|
)) }) }),
|
|
3441
3435
|
/* @__PURE__ */ e(
|
|
3442
3436
|
z,
|
|
@@ -3469,12 +3463,12 @@ function Zi({
|
|
|
3469
3463
|
), children: "Define your own custom views by uploading them with the CLI." }),
|
|
3470
3464
|
/* @__PURE__ */ e(j, { children: /* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3471
3465
|
/* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3472
|
-
b.map((
|
|
3466
|
+
b.map((g) => /* @__PURE__ */ a(bt, { children: [
|
|
3473
3467
|
/* @__PURE__ */ e(
|
|
3474
3468
|
Ue,
|
|
3475
3469
|
{
|
|
3476
3470
|
align: "left",
|
|
3477
|
-
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children:
|
|
3471
|
+
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: g.name })
|
|
3478
3472
|
}
|
|
3479
3473
|
),
|
|
3480
3474
|
/* @__PURE__ */ e(
|
|
@@ -3486,7 +3480,7 @@ function Zi({
|
|
|
3486
3480
|
{
|
|
3487
3481
|
size: "small",
|
|
3488
3482
|
onClick: (w) => {
|
|
3489
|
-
w.preventDefault(), w.stopPropagation(), g
|
|
3483
|
+
w.preventDefault(), w.stopPropagation(), f(g.key);
|
|
3490
3484
|
},
|
|
3491
3485
|
color: "inherit",
|
|
3492
3486
|
children: /* @__PURE__ */ e(dt, { size: "small" })
|
|
@@ -3494,20 +3488,20 @@ function Zi({
|
|
|
3494
3488
|
) })
|
|
3495
3489
|
}
|
|
3496
3490
|
)
|
|
3497
|
-
] },
|
|
3498
|
-
C.map((
|
|
3491
|
+
] }, g.key)),
|
|
3492
|
+
C.map((g) => /* @__PURE__ */ e(bt, { children: /* @__PURE__ */ a(
|
|
3499
3493
|
Ue,
|
|
3500
3494
|
{
|
|
3501
3495
|
align: "left",
|
|
3502
3496
|
children: [
|
|
3503
|
-
/* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children:
|
|
3497
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: g.name }),
|
|
3504
3498
|
/* @__PURE__ */ a(O, { variant: "caption", className: "flex-grow", children: [
|
|
3505
3499
|
"This view is defined in code with key ",
|
|
3506
|
-
/* @__PURE__ */ e("code", { children:
|
|
3500
|
+
/* @__PURE__ */ e("code", { children: g.key })
|
|
3507
3501
|
] })
|
|
3508
3502
|
]
|
|
3509
3503
|
}
|
|
3510
|
-
) },
|
|
3504
|
+
) }, g.key))
|
|
3511
3505
|
] }) }),
|
|
3512
3506
|
/* @__PURE__ */ e(
|
|
3513
3507
|
z,
|
|
@@ -3529,11 +3523,11 @@ function Zi({
|
|
|
3529
3523
|
{
|
|
3530
3524
|
open: !!u,
|
|
3531
3525
|
onAccept: () => {
|
|
3532
|
-
const
|
|
3526
|
+
const g = {
|
|
3533
3527
|
id: u,
|
|
3534
3528
|
parentCollectionIds: [...o ?? [], t.id]
|
|
3535
3529
|
};
|
|
3536
|
-
console.debug("Deleting subcollection",
|
|
3530
|
+
console.debug("Deleting subcollection", g), n.deleteCollection(g), p(void 0);
|
|
3537
3531
|
},
|
|
3538
3532
|
onCancel: () => p(void 0),
|
|
3539
3533
|
title: /* @__PURE__ */ e(j, { children: "Delete this subcollection?" }),
|
|
@@ -3544,14 +3538,14 @@ function Zi({
|
|
|
3544
3538
|
] })
|
|
3545
3539
|
}
|
|
3546
3540
|
),
|
|
3547
|
-
|
|
3541
|
+
s && /* @__PURE__ */ e(
|
|
3548
3542
|
lt,
|
|
3549
3543
|
{
|
|
3550
|
-
open: !!
|
|
3544
|
+
open: !!s,
|
|
3551
3545
|
onAccept: () => {
|
|
3552
|
-
P("entityViews", y.entityViews?.filter((
|
|
3546
|
+
P("entityViews", y.entityViews?.filter((g) => g !== s)), f(void 0);
|
|
3553
3547
|
},
|
|
3554
|
-
onCancel: () =>
|
|
3548
|
+
onCancel: () => f(void 0),
|
|
3555
3549
|
title: /* @__PURE__ */ e(j, { children: "Remove this view?" }),
|
|
3556
3550
|
body: /* @__PURE__ */ a(j, { children: [
|
|
3557
3551
|
"This will ",
|
|
@@ -3580,8 +3574,8 @@ function Zi({
|
|
|
3580
3574
|
Wi,
|
|
3581
3575
|
{
|
|
3582
3576
|
open: h,
|
|
3583
|
-
onClose: (
|
|
3584
|
-
|
|
3577
|
+
onClose: (g) => {
|
|
3578
|
+
g && P("entityViews", [...y.entityViews ?? [], g]), m(!1);
|
|
3585
3579
|
}
|
|
3586
3580
|
}
|
|
3587
3581
|
)
|
|
@@ -4026,8 +4020,8 @@ function Ji({
|
|
|
4026
4020
|
const {
|
|
4027
4021
|
values: h,
|
|
4028
4022
|
setFieldValue: m,
|
|
4029
|
-
setValues:
|
|
4030
|
-
submitCount:
|
|
4023
|
+
setValues: s,
|
|
4024
|
+
submitCount: f
|
|
4031
4025
|
} = K();
|
|
4032
4026
|
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ a(mt, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
4033
4027
|
/* @__PURE__ */ e(
|
|
@@ -4084,7 +4078,7 @@ function Ji({
|
|
|
4084
4078
|
subtitle: "A collection of products with images, prices and stock",
|
|
4085
4079
|
icon: /* @__PURE__ */ e(et, { size: "small", iconKey: Lt.icon }),
|
|
4086
4080
|
onClick: () => {
|
|
4087
|
-
|
|
4081
|
+
s(Lt), i();
|
|
4088
4082
|
}
|
|
4089
4083
|
}
|
|
4090
4084
|
),
|
|
@@ -4095,7 +4089,7 @@ function Ji({
|
|
|
4095
4089
|
subtitle: "A collection of users with emails, names and roles",
|
|
4096
4090
|
icon: /* @__PURE__ */ e(et, { size: "small", iconKey: $t.icon }),
|
|
4097
4091
|
onClick: () => {
|
|
4098
|
-
|
|
4092
|
+
s($t), i();
|
|
4099
4093
|
}
|
|
4100
4094
|
}
|
|
4101
4095
|
),
|
|
@@ -4106,7 +4100,7 @@ function Ji({
|
|
|
4106
4100
|
subtitle: "A collection of blog posts with images, authors and complex content",
|
|
4107
4101
|
icon: /* @__PURE__ */ e(et, { size: "small", iconKey: qt.icon }),
|
|
4108
4102
|
onClick: () => {
|
|
4109
|
-
|
|
4103
|
+
s(qt), i();
|
|
4110
4104
|
}
|
|
4111
4105
|
}
|
|
4112
4106
|
),
|
|
@@ -4117,7 +4111,7 @@ function Ji({
|
|
|
4117
4111
|
subtitle: "A collection of pages with images, authors and complex content",
|
|
4118
4112
|
icon: /* @__PURE__ */ e(et, { size: "small", iconKey: Yt.icon }),
|
|
4119
4113
|
onClick: () => {
|
|
4120
|
-
|
|
4114
|
+
s(Yt), i();
|
|
4121
4115
|
}
|
|
4122
4116
|
}
|
|
4123
4117
|
)
|
|
@@ -4148,9 +4142,9 @@ function nt({
|
|
|
4148
4142
|
tr,
|
|
4149
4143
|
{
|
|
4150
4144
|
onClick: i,
|
|
4151
|
-
className:
|
|
4145
|
+
className: he(
|
|
4152
4146
|
"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center",
|
|
4153
|
-
"text-gray-700 dark:text-
|
|
4147
|
+
"text-gray-700 dark:text-slate-300",
|
|
4154
4148
|
"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary",
|
|
4155
4149
|
"border-gray-400 dark:border-gray-600 "
|
|
4156
4150
|
),
|
|
@@ -4170,18 +4164,18 @@ function Qi({
|
|
|
4170
4164
|
setFieldValue: i,
|
|
4171
4165
|
setFieldTouched: l,
|
|
4172
4166
|
values: o
|
|
4173
|
-
} = K(), [d, u] = $(void 0), p = Y.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), h = d ? d.id : void 0, m = d || void 0,
|
|
4167
|
+
} = K(), [d, u] = $(void 0), p = Y.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), h = d ? d.id : void 0, m = d || void 0, s = ({
|
|
4174
4168
|
id: v,
|
|
4175
4169
|
property: x,
|
|
4176
4170
|
previousId: y,
|
|
4177
4171
|
namespace: P
|
|
4178
4172
|
}) => {
|
|
4179
|
-
const k = v ? ae(v, P) : void 0, b = k ?
|
|
4173
|
+
const k = v ? ae(v, P) : void 0, b = k ? me(k) : void 0, C = (g) => g ? p.current[g] ?? I(o, ye(g)) : p.current[""], N = (g, w) => {
|
|
4180
4174
|
const _ = ye(w);
|
|
4181
|
-
i(_,
|
|
4175
|
+
i(_, g, !1), p.current[w ?? ""] = g;
|
|
4182
4176
|
};
|
|
4183
4177
|
if (y && y !== v) {
|
|
4184
|
-
const
|
|
4178
|
+
const g = ae(y, P), w = me(g), M = C(P).map((D) => D === y ? v : D).filter((D) => D !== void 0);
|
|
4185
4179
|
N(M, P);
|
|
4186
4180
|
const R = { ...t.headersMapping };
|
|
4187
4181
|
Object.keys(R).forEach((D) => {
|
|
@@ -4189,13 +4183,13 @@ function Qi({
|
|
|
4189
4183
|
}), t.setHeadersMapping(R), i(w, void 0, !1), l(w, !1, !1);
|
|
4190
4184
|
}
|
|
4191
4185
|
b && (i(b, x, !1), l(b, !0, !1));
|
|
4192
|
-
},
|
|
4186
|
+
}, f = async ({
|
|
4193
4187
|
id: v,
|
|
4194
4188
|
importKey: x,
|
|
4195
4189
|
property: y,
|
|
4196
4190
|
namespace: P
|
|
4197
4191
|
}) => {
|
|
4198
|
-
const k = v ? ae(v, P) : void 0, b = k ?
|
|
4192
|
+
const k = v ? ae(v, P) : void 0, b = k ? me(k) : void 0, C = t.importData.map((g) => I(g, x)), N = {
|
|
4199
4193
|
...ti(C, y, rr),
|
|
4200
4194
|
editable: !0
|
|
4201
4195
|
};
|
|
@@ -4211,7 +4205,7 @@ function Qi({
|
|
|
4211
4205
|
idColumn: t.idColumn,
|
|
4212
4206
|
originProperties: t.originProperties,
|
|
4213
4207
|
destinationProperties: o.properties,
|
|
4214
|
-
onIdPropertyChanged: (v) => t.setIdColumn(v),
|
|
4208
|
+
onIdPropertyChanged: (v) => t.setIdColumn(v ?? void 0),
|
|
4215
4209
|
buildPropertyView: ({
|
|
4216
4210
|
property: v,
|
|
4217
4211
|
propertyKey: x,
|
|
@@ -4234,7 +4228,7 @@ function Qi({
|
|
|
4234
4228
|
{
|
|
4235
4229
|
property: v,
|
|
4236
4230
|
disabled: !1,
|
|
4237
|
-
onPropertyChanged: (P) =>
|
|
4231
|
+
onPropertyChanged: (P) => f({
|
|
4238
4232
|
...P,
|
|
4239
4233
|
importKey: y
|
|
4240
4234
|
}),
|
|
@@ -4255,7 +4249,7 @@ function Qi({
|
|
|
4255
4249
|
property: m,
|
|
4256
4250
|
inArray: !1,
|
|
4257
4251
|
autoUpdateId: !1,
|
|
4258
|
-
onPropertyChanged:
|
|
4252
|
+
onPropertyChanged: s,
|
|
4259
4253
|
allowDataInference: !1,
|
|
4260
4254
|
collectionEditable: n,
|
|
4261
4255
|
onOkClicked: () => {
|
|
@@ -4353,15 +4347,15 @@ function dr(t, r = "") {
|
|
|
4353
4347
|
const n = Object.keys(t).reduce((o, d) => {
|
|
4354
4348
|
const u = t[d], p = kr(d), h = r ? `${r}.${p}` : p;
|
|
4355
4349
|
if (u.dataType === "map" && u.properties) {
|
|
4356
|
-
const
|
|
4350
|
+
const f = dr(u.properties, h);
|
|
4357
4351
|
return {
|
|
4358
4352
|
headersMapping: { ...o.headersMapping, [d]: h },
|
|
4359
4353
|
properties: {
|
|
4360
4354
|
...o.properties,
|
|
4361
4355
|
[p]: {
|
|
4362
4356
|
...u,
|
|
4363
|
-
properties:
|
|
4364
|
-
propertiesOrder: Object.keys(
|
|
4357
|
+
properties: f.properties,
|
|
4358
|
+
propertiesOrder: Object.keys(f.properties)
|
|
4365
4359
|
}
|
|
4366
4360
|
}
|
|
4367
4361
|
};
|
|
@@ -4422,10 +4416,10 @@ function tn(t) {
|
|
|
4422
4416
|
const { propertyConfigs: r } = Ae(), n = Pe(), i = _e(), {
|
|
4423
4417
|
topLevelNavigation: l,
|
|
4424
4418
|
collections: o
|
|
4425
|
-
} = n, d = t.initialValues, u = !d?.path && (t.parentCollectionIds ?? []).length === 0, p = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], h = p.map((b) => b.path.trim().toLowerCase()), m = p.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [
|
|
4419
|
+
} = n, d = t.initialValues, u = !d?.path && (t.parentCollectionIds ?? []).length === 0, p = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], h = p.map((b) => b.path.trim().toLowerCase()), m = p.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [s, f] = je.useState(), [v, x] = je.useState(!1);
|
|
4426
4420
|
if (de(() => {
|
|
4427
4421
|
try {
|
|
4428
|
-
n.initialised && (t.editedCollectionId ?
|
|
4422
|
+
n.initialised && (t.editedCollectionId ? f(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : f(void 0), x(!0));
|
|
4429
4423
|
} catch (b) {
|
|
4430
4424
|
console.error(b);
|
|
4431
4425
|
}
|
|
@@ -4433,9 +4427,9 @@ function tn(t) {
|
|
|
4433
4427
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
4434
4428
|
const {
|
|
4435
4429
|
groups: y
|
|
4436
|
-
} = l, P =
|
|
4437
|
-
...
|
|
4438
|
-
id:
|
|
4430
|
+
} = l, P = s ? {
|
|
4431
|
+
...s,
|
|
4432
|
+
id: s.id ?? s.path ?? _t(16)
|
|
4439
4433
|
} : void 0, k = P ? nn(P, r) : {
|
|
4440
4434
|
id: d?.path ?? _t(16),
|
|
4441
4435
|
path: d?.path ?? "",
|
|
@@ -4454,8 +4448,8 @@ function tn(t) {
|
|
|
4454
4448
|
existingPaths: h,
|
|
4455
4449
|
existingIds: m,
|
|
4456
4450
|
includeTemplates: u,
|
|
4457
|
-
collection:
|
|
4458
|
-
setCollection:
|
|
4451
|
+
collection: s,
|
|
4452
|
+
setCollection: f,
|
|
4459
4453
|
groups: y,
|
|
4460
4454
|
propertyConfigs: r
|
|
4461
4455
|
}
|
|
@@ -4473,8 +4467,8 @@ function rn({
|
|
|
4473
4467
|
extraView: p,
|
|
4474
4468
|
handleCancel: h,
|
|
4475
4469
|
setFormDirty: m,
|
|
4476
|
-
pathSuggestions:
|
|
4477
|
-
getUser:
|
|
4470
|
+
pathSuggestions: s,
|
|
4471
|
+
getUser: f,
|
|
4478
4472
|
parentCollection: v,
|
|
4479
4473
|
getData: x,
|
|
4480
4474
|
existingPaths: y,
|
|
@@ -4483,10 +4477,10 @@ function rn({
|
|
|
4483
4477
|
collection: b,
|
|
4484
4478
|
setCollection: C,
|
|
4485
4479
|
initialValues: N,
|
|
4486
|
-
propertyConfigs:
|
|
4480
|
+
propertyConfigs: g,
|
|
4487
4481
|
groups: w
|
|
4488
4482
|
}) {
|
|
4489
|
-
const _ = hi(), M = Pe(), R = Ie(), D = Le({}), A = t ? k ? "welcome" : "details" : "properties", [
|
|
4483
|
+
const _ = hi(), M = Pe(), R = Ie(), D = Le({}), A = t ? k ? "welcome" : "details" : "properties", [c, V] = $(A), [G, B] = je.useState(), q = (T) => {
|
|
4490
4484
|
const S = T.id || T.path;
|
|
4491
4485
|
return r.saveCollection({
|
|
4492
4486
|
id: S,
|
|
@@ -4498,8 +4492,8 @@ function rn({
|
|
|
4498
4492
|
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4499
4493
|
}), !1));
|
|
4500
4494
|
}, L = Q(() => {
|
|
4501
|
-
|
|
4502
|
-
}, [
|
|
4495
|
+
c === "details" ? _.inUse ? V("import_data_saving") : V(p ? "extra_view" : "properties") : V(c === "welcome" ? "details" : c === "import_data_mapping" ? "import_data_preview" : c === "import_data_preview" ? "details" : c === "extra_view" ? "properties" : "details");
|
|
4496
|
+
}, [c, _.inUse, p]), J = Q((T) => {
|
|
4503
4497
|
if (o)
|
|
4504
4498
|
return o?.(T.path, T.collectionGroup ?? !1, i ?? []);
|
|
4505
4499
|
}, [o, i]), le = Q(async (T) => {
|
|
@@ -4534,7 +4528,7 @@ function rn({
|
|
|
4534
4528
|
});
|
|
4535
4529
|
return;
|
|
4536
4530
|
}
|
|
4537
|
-
|
|
4531
|
+
c === "welcome" ? (L(), S.resetForm({ values: T })) : c === "details" ? p || _.inUse ? (S.resetForm({ values: T }), L()) : t ? le(T).then((E) => {
|
|
4538
4532
|
S.resetForm({
|
|
4539
4533
|
values: E ?? T,
|
|
4540
4534
|
touched: {
|
|
@@ -4544,7 +4538,7 @@ function rn({
|
|
|
4544
4538
|
});
|
|
4545
4539
|
}).finally(() => {
|
|
4546
4540
|
L();
|
|
4547
|
-
}) : (S.resetForm({ values: T }), L()) :
|
|
4541
|
+
}) : (S.resetForm({ values: T }), L()) : c === "extra_view" ? (L(), S.resetForm({ values: T })) : c === "import_data_mapping" || c === "import_data_preview" ? L() : c === "properties" ? q(T).then(() => {
|
|
4548
4542
|
S.resetForm({ values: N }), L(), d(T);
|
|
4549
4543
|
}) : (L(), S.resetForm({ values: T }));
|
|
4550
4544
|
} catch (E) {
|
|
@@ -4556,7 +4550,7 @@ function rn({
|
|
|
4556
4550
|
},
|
|
4557
4551
|
validation: (T) => {
|
|
4558
4552
|
let S = {};
|
|
4559
|
-
const E = (
|
|
4553
|
+
const E = (c === "properties" || c === "subcollections" || c === "details") && vi;
|
|
4560
4554
|
if (E)
|
|
4561
4555
|
try {
|
|
4562
4556
|
E.validateSync(T, { abortEarly: !1 });
|
|
@@ -4565,7 +4559,7 @@ function rn({
|
|
|
4565
4559
|
S[ke.path] = ke.message;
|
|
4566
4560
|
});
|
|
4567
4561
|
}
|
|
4568
|
-
if (
|
|
4562
|
+
if (c === "properties" && (S = { ...S, ...D.current }), c === "details") {
|
|
4569
4563
|
const ie = Ht(T.path, t, y, T.id);
|
|
4570
4564
|
ie && (S.path = ie);
|
|
4571
4565
|
const ke = an(T.id, t, y, P);
|
|
@@ -4575,30 +4569,30 @@ function rn({
|
|
|
4575
4569
|
}
|
|
4576
4570
|
}), {
|
|
4577
4571
|
values: re,
|
|
4578
|
-
setFieldValue:
|
|
4572
|
+
setFieldValue: fe,
|
|
4579
4573
|
isSubmitting: Te,
|
|
4580
4574
|
dirty: Ge,
|
|
4581
4575
|
submitCount: gt
|
|
4582
|
-
} = ue,
|
|
4576
|
+
} = ue, pe = re.path, Ke = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + pe : pe, We = Ht(pe, t, y, re.id), Ze = !We && i ? M.convertIdsToPaths(i) : void 0, Je = We ? void 0 : M.resolveAliasesFrom(Ke), Re = Je && x ? () => x(Je, Ze ?? []) : void 0;
|
|
4583
4577
|
de(() => {
|
|
4584
4578
|
m(Ge);
|
|
4585
4579
|
}, [Ge]);
|
|
4586
4580
|
function Qe(T) {
|
|
4587
4581
|
_.setInUse(!0), ri(T, rr).then((S) => {
|
|
4588
4582
|
const E = dr(S);
|
|
4589
|
-
|
|
4583
|
+
fe("properties", E.properties), fe("propertiesOrder", Object.keys(E.properties)), _.setIdColumn(E.idColumn), _.setImportData(T), _.setHeadersMapping(E.headersMapping), _.setOriginProperties(E.properties);
|
|
4590
4584
|
});
|
|
4591
4585
|
}
|
|
4592
4586
|
const vt = !!re.name && !!re.id, yt = () => {
|
|
4593
4587
|
const T = { ...re.properties };
|
|
4594
|
-
_.idColumn && delete T[_.idColumn],
|
|
4588
|
+
_.idColumn && delete T[_.idColumn], fe("properties", T), L();
|
|
4595
4589
|
}, U = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4596
4590
|
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value: ue, children: /* @__PURE__ */ a(j, { children: [
|
|
4597
4591
|
!t && /* @__PURE__ */ a(
|
|
4598
4592
|
Hr,
|
|
4599
4593
|
{
|
|
4600
|
-
value:
|
|
4601
|
-
className:
|
|
4594
|
+
value: c,
|
|
4595
|
+
className: he(wt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
4602
4596
|
onValueChange: (T) => V(T),
|
|
4603
4597
|
children: [
|
|
4604
4598
|
/* @__PURE__ */ e(Ct, { value: "details", children: "Details" }),
|
|
@@ -4612,34 +4606,34 @@ function rn({
|
|
|
4612
4606
|
{
|
|
4613
4607
|
noValidate: !0,
|
|
4614
4608
|
onSubmit: ue.handleSubmit,
|
|
4615
|
-
className:
|
|
4609
|
+
className: he(
|
|
4616
4610
|
t ? "h-full" : "h-[calc(100%-48px)]",
|
|
4617
4611
|
"flex-grow flex flex-col relative"
|
|
4618
4612
|
),
|
|
4619
4613
|
children: [
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4614
|
+
c === "loading" && /* @__PURE__ */ e(Nt, {}),
|
|
4615
|
+
c === "extra_view" && pe && p?.View && /* @__PURE__ */ e(p.View, { path: pe }),
|
|
4616
|
+
c === "welcome" && /* @__PURE__ */ e(
|
|
4623
4617
|
Ji,
|
|
4624
4618
|
{
|
|
4625
|
-
path:
|
|
4619
|
+
path: pe,
|
|
4626
4620
|
onContinue: (T) => {
|
|
4627
4621
|
T ? (Qe(T), V("import_data_mapping")) : V("details");
|
|
4628
4622
|
},
|
|
4629
4623
|
existingCollectionPaths: y,
|
|
4630
4624
|
parentCollection: v,
|
|
4631
|
-
pathSuggestions:
|
|
4625
|
+
pathSuggestions: s
|
|
4632
4626
|
}
|
|
4633
4627
|
),
|
|
4634
|
-
|
|
4628
|
+
c === "import_data_mapping" && _ && /* @__PURE__ */ e(
|
|
4635
4629
|
Qi,
|
|
4636
4630
|
{
|
|
4637
4631
|
importConfig: _,
|
|
4638
4632
|
collectionEditable: U,
|
|
4639
|
-
propertyConfigs:
|
|
4633
|
+
propertyConfigs: g
|
|
4640
4634
|
}
|
|
4641
4635
|
),
|
|
4642
|
-
|
|
4636
|
+
c === "import_data_preview" && _ && /* @__PURE__ */ e(
|
|
4643
4637
|
en,
|
|
4644
4638
|
{
|
|
4645
4639
|
importConfig: _,
|
|
@@ -4647,11 +4641,12 @@ function rn({
|
|
|
4647
4641
|
propertiesOrder: re.propertiesOrder
|
|
4648
4642
|
}
|
|
4649
4643
|
),
|
|
4650
|
-
|
|
4644
|
+
c === "import_data_saving" && _ && /* @__PURE__ */ e(
|
|
4651
4645
|
fi,
|
|
4652
4646
|
{
|
|
4653
4647
|
importConfig: _,
|
|
4654
4648
|
collection: re,
|
|
4649
|
+
path: pe,
|
|
4655
4650
|
onImportSuccess: async (T) => {
|
|
4656
4651
|
R.open({
|
|
4657
4652
|
type: "info",
|
|
@@ -4660,7 +4655,7 @@ function rn({
|
|
|
4660
4655
|
}
|
|
4661
4656
|
}
|
|
4662
4657
|
),
|
|
4663
|
-
|
|
4658
|
+
c === "details" && /* @__PURE__ */ e(
|
|
4664
4659
|
yi,
|
|
4665
4660
|
{
|
|
4666
4661
|
existingPaths: y,
|
|
@@ -4671,18 +4666,18 @@ function rn({
|
|
|
4671
4666
|
isNewCollection: t
|
|
4672
4667
|
}
|
|
4673
4668
|
),
|
|
4674
|
-
|
|
4669
|
+
c === "subcollections" && b && /* @__PURE__ */ e(
|
|
4675
4670
|
Zi,
|
|
4676
4671
|
{
|
|
4677
4672
|
parentCollection: v,
|
|
4678
4673
|
configController: r,
|
|
4679
|
-
getUser:
|
|
4674
|
+
getUser: f,
|
|
4680
4675
|
collectionInference: o,
|
|
4681
4676
|
parentCollectionIds: i,
|
|
4682
4677
|
collection: b
|
|
4683
4678
|
}
|
|
4684
4679
|
),
|
|
4685
|
-
|
|
4680
|
+
c === "properties" && /* @__PURE__ */ e(
|
|
4686
4681
|
Gi,
|
|
4687
4682
|
{
|
|
4688
4683
|
showErrors: gt > 0,
|
|
@@ -4695,10 +4690,10 @@ function rn({
|
|
|
4695
4690
|
}, !0);
|
|
4696
4691
|
D.current = ie, ue.validate();
|
|
4697
4692
|
},
|
|
4698
|
-
getUser:
|
|
4693
|
+
getUser: f,
|
|
4699
4694
|
getData: Re,
|
|
4700
4695
|
doCollectionInference: J,
|
|
4701
|
-
propertyConfigs:
|
|
4696
|
+
propertyConfigs: g,
|
|
4702
4697
|
collectionEditable: U,
|
|
4703
4698
|
extraIcon: p?.icon && /* @__PURE__ */ e(
|
|
4704
4699
|
oe,
|
|
@@ -4710,13 +4705,13 @@ function rn({
|
|
|
4710
4705
|
)
|
|
4711
4706
|
}
|
|
4712
4707
|
),
|
|
4713
|
-
|
|
4708
|
+
c !== "welcome" && /* @__PURE__ */ a(
|
|
4714
4709
|
ze,
|
|
4715
4710
|
{
|
|
4716
4711
|
position: "absolute",
|
|
4717
4712
|
children: [
|
|
4718
4713
|
G && /* @__PURE__ */ e(Wt, { error: G }),
|
|
4719
|
-
t && k &&
|
|
4714
|
+
t && k && c === "import_data_mapping" && /* @__PURE__ */ a(
|
|
4720
4715
|
z,
|
|
4721
4716
|
{
|
|
4722
4717
|
variant: "text",
|
|
@@ -4728,7 +4723,7 @@ function rn({
|
|
|
4728
4723
|
]
|
|
4729
4724
|
}
|
|
4730
4725
|
),
|
|
4731
|
-
t && k &&
|
|
4726
|
+
t && k && c === "import_data_preview" && /* @__PURE__ */ a(
|
|
4732
4727
|
z,
|
|
4733
4728
|
{
|
|
4734
4729
|
variant: "text",
|
|
@@ -4742,7 +4737,7 @@ function rn({
|
|
|
4742
4737
|
]
|
|
4743
4738
|
}
|
|
4744
4739
|
),
|
|
4745
|
-
t && k &&
|
|
4740
|
+
t && k && c === "details" && /* @__PURE__ */ a(
|
|
4746
4741
|
z,
|
|
4747
4742
|
{
|
|
4748
4743
|
variant: "text",
|
|
@@ -4754,7 +4749,7 @@ function rn({
|
|
|
4754
4749
|
]
|
|
4755
4750
|
}
|
|
4756
4751
|
),
|
|
4757
|
-
t &&
|
|
4752
|
+
t && c === "properties" && /* @__PURE__ */ a(
|
|
4758
4753
|
z,
|
|
4759
4754
|
{
|
|
4760
4755
|
variant: "text",
|
|
@@ -4776,7 +4771,7 @@ function rn({
|
|
|
4776
4771
|
children: "Cancel"
|
|
4777
4772
|
}
|
|
4778
4773
|
),
|
|
4779
|
-
t &&
|
|
4774
|
+
t && c === "import_data_mapping" && /* @__PURE__ */ e(
|
|
4780
4775
|
z,
|
|
4781
4776
|
{
|
|
4782
4777
|
variant: "filled",
|
|
@@ -4785,7 +4780,7 @@ function rn({
|
|
|
4785
4780
|
children: "Next"
|
|
4786
4781
|
}
|
|
4787
4782
|
),
|
|
4788
|
-
t &&
|
|
4783
|
+
t && c === "import_data_preview" && /* @__PURE__ */ e(
|
|
4789
4784
|
z,
|
|
4790
4785
|
{
|
|
4791
4786
|
variant: "filled",
|
|
@@ -4796,18 +4791,18 @@ function rn({
|
|
|
4796
4791
|
children: "Next"
|
|
4797
4792
|
}
|
|
4798
4793
|
),
|
|
4799
|
-
t && (
|
|
4794
|
+
t && (c === "details" || c === "properties") && /* @__PURE__ */ a(
|
|
4800
4795
|
Mt,
|
|
4801
4796
|
{
|
|
4802
4797
|
variant: "filled",
|
|
4803
4798
|
color: "primary",
|
|
4804
4799
|
type: "submit",
|
|
4805
4800
|
loading: Te,
|
|
4806
|
-
disabled: Te ||
|
|
4807
|
-
startIcon:
|
|
4801
|
+
disabled: Te || c === "details" && !vt,
|
|
4802
|
+
startIcon: c === "properties" ? /* @__PURE__ */ e(Gr, {}) : void 0,
|
|
4808
4803
|
children: [
|
|
4809
|
-
|
|
4810
|
-
|
|
4804
|
+
c === "details" && "Next",
|
|
4805
|
+
c === "properties" && "Create collection"
|
|
4811
4806
|
]
|
|
4812
4807
|
}
|
|
4813
4808
|
),
|
|
@@ -4831,7 +4826,7 @@ function rn({
|
|
|
4831
4826
|
}
|
|
4832
4827
|
function nn(t, r) {
|
|
4833
4828
|
const { properties: n, ...i } = t, l = {};
|
|
4834
|
-
return Object.keys(n).forEach((o) => {
|
|
4829
|
+
return n && Object.keys(n).forEach((o) => {
|
|
4835
4830
|
l[o] = pr(n[o], r);
|
|
4836
4831
|
}), { ...i, properties: l };
|
|
4837
4832
|
}
|
|
@@ -4871,26 +4866,26 @@ const Ht = (t, r, n, i) => {
|
|
|
4871
4866
|
getData: h,
|
|
4872
4867
|
onAnalyticsEvent: m
|
|
4873
4868
|
}) {
|
|
4874
|
-
const
|
|
4869
|
+
const s = Pe(), f = gi(), v = Ie(), { propertyConfigs: x } = Ae(), {
|
|
4875
4870
|
collections: y
|
|
4876
|
-
} =
|
|
4871
|
+
} = s, P = (y ?? []).map((c) => c.path.trim().toLowerCase()), [k, b] = Y.useState();
|
|
4877
4872
|
de(() => {
|
|
4878
|
-
u && u().then((
|
|
4879
|
-
b(
|
|
4873
|
+
u && u().then((c) => {
|
|
4874
|
+
b(c.filter((V) => !P.includes(V.trim().toLowerCase())));
|
|
4880
4875
|
});
|
|
4881
4876
|
}, [u]);
|
|
4882
|
-
const [C, N] = Y.useState(), [
|
|
4877
|
+
const [C, N] = Y.useState(), [g, w] = Y.useState(), _ = Q(() => ({
|
|
4883
4878
|
createCollections: !0,
|
|
4884
4879
|
editCollections: !0,
|
|
4885
4880
|
deleteCollections: !0
|
|
4886
4881
|
}), []), M = Q(({
|
|
4887
|
-
id:
|
|
4882
|
+
id: c,
|
|
4888
4883
|
fullPath: V,
|
|
4889
4884
|
parentCollectionIds: G,
|
|
4890
4885
|
parentCollection: B
|
|
4891
4886
|
}) => {
|
|
4892
|
-
console.debug("Edit collection",
|
|
4893
|
-
editedCollectionId:
|
|
4887
|
+
console.debug("Edit collection", c, V, G, B), m?.("edit_collection", { id: c, fullPath: V }), N({
|
|
4888
|
+
editedCollectionId: c,
|
|
4894
4889
|
fullPath: V,
|
|
4895
4890
|
parentCollectionIds: G,
|
|
4896
4891
|
isNewCollection: !1,
|
|
@@ -4898,15 +4893,15 @@ const Ht = (t, r, n, i) => {
|
|
|
4898
4893
|
redirect: !1
|
|
4899
4894
|
});
|
|
4900
4895
|
}, []), R = Q(({
|
|
4901
|
-
propertyKey:
|
|
4896
|
+
propertyKey: c,
|
|
4902
4897
|
property: V,
|
|
4903
4898
|
editedCollectionId: G,
|
|
4904
4899
|
currentPropertiesOrder: B,
|
|
4905
4900
|
parentCollectionIds: q,
|
|
4906
4901
|
collection: L
|
|
4907
4902
|
}) => {
|
|
4908
|
-
console.debug("
|
|
4909
|
-
const J =
|
|
4903
|
+
console.debug("Edit property", c, V, G, B, q, L), m?.("edit_property", { propertyKey: c, editedCollectionId: G });
|
|
4904
|
+
const J = c && c.includes(".") ? c.substring(0, c.lastIndexOf(".")) : void 0, le = c && c.includes(".") ? c.substring(c.lastIndexOf(".") + 1) : c;
|
|
4910
4905
|
w({
|
|
4911
4906
|
propertyKey: le,
|
|
4912
4907
|
property: V,
|
|
@@ -4917,20 +4912,20 @@ const Ht = (t, r, n, i) => {
|
|
|
4917
4912
|
collectionEditable: L?.editable ?? !1
|
|
4918
4913
|
});
|
|
4919
4914
|
}, []), D = Y.useCallback(({
|
|
4920
|
-
parentCollectionIds:
|
|
4915
|
+
parentCollectionIds: c,
|
|
4921
4916
|
parentCollection: V,
|
|
4922
4917
|
initialValues: G,
|
|
4923
4918
|
redirect: B,
|
|
4924
4919
|
sourceClick: q
|
|
4925
4920
|
}) => {
|
|
4926
|
-
console.debug("Create collection", { parentCollectionIds:
|
|
4921
|
+
console.debug("Create collection", { parentCollectionIds: c, parentCollection: V, initialValues: G, redirect: B, sourceClick: q }), m?.("create_collection", { parentCollectionIds: c, parentCollection: V, initialValues: G, redirect: B, sourceClick: q }), N({
|
|
4927
4922
|
isNewCollection: !0,
|
|
4928
|
-
parentCollectionIds:
|
|
4923
|
+
parentCollectionIds: c,
|
|
4929
4924
|
parentCollection: V,
|
|
4930
4925
|
initialValues: G,
|
|
4931
4926
|
redirect: B
|
|
4932
4927
|
});
|
|
4933
|
-
}, []), A = u ? (
|
|
4928
|
+
}, []), A = u ? (c) => !c && k ? Promise.resolve(k) : u?.(c) : void 0;
|
|
4934
4929
|
return /* @__PURE__ */ e(mr.Provider, { value: n, children: /* @__PURE__ */ a(
|
|
4935
4930
|
hr.Provider,
|
|
4936
4931
|
{
|
|
@@ -4956,10 +4951,10 @@ const Ht = (t, r, n, i) => {
|
|
|
4956
4951
|
extraView: d,
|
|
4957
4952
|
pathSuggestions: A,
|
|
4958
4953
|
getUser: p,
|
|
4959
|
-
handleClose: (
|
|
4960
|
-
if (C?.redirect &&
|
|
4961
|
-
const V =
|
|
4962
|
-
|
|
4954
|
+
handleClose: (c) => {
|
|
4955
|
+
if (C?.redirect && c && C?.isNewCollection && !C.parentCollectionIds.length) {
|
|
4956
|
+
const V = s.buildUrlCollectionPath(c.id ?? c.path);
|
|
4957
|
+
f(V);
|
|
4963
4958
|
}
|
|
4964
4959
|
N(void 0);
|
|
4965
4960
|
}
|
|
@@ -4968,32 +4963,32 @@ const Ht = (t, r, n, i) => {
|
|
|
4968
4963
|
/* @__PURE__ */ e(
|
|
4969
4964
|
Ve,
|
|
4970
4965
|
{
|
|
4971
|
-
open: !!
|
|
4966
|
+
open: !!g,
|
|
4972
4967
|
includeIdAndName: !0,
|
|
4973
|
-
existingProperty: !!
|
|
4974
|
-
autoUpdateId:
|
|
4975
|
-
autoOpenTypeSelect:
|
|
4968
|
+
existingProperty: !!g?.propertyKey,
|
|
4969
|
+
autoUpdateId: g ? !g?.propertyKey : !1,
|
|
4970
|
+
autoOpenTypeSelect: g ? !g?.propertyKey : !1,
|
|
4976
4971
|
inArray: !1,
|
|
4977
|
-
collectionEditable:
|
|
4978
|
-
getData: h &&
|
|
4979
|
-
console.debug("get data for property",
|
|
4980
|
-
const
|
|
4981
|
-
return h(
|
|
4972
|
+
collectionEditable: g?.collectionEditable ?? !1,
|
|
4973
|
+
getData: h && g?.editedCollectionId ? () => {
|
|
4974
|
+
console.debug("get data for property", g?.editedCollectionId);
|
|
4975
|
+
const c = s.resolveAliasesFrom(g.editedCollectionId);
|
|
4976
|
+
return h(c, []);
|
|
4982
4977
|
} : void 0,
|
|
4983
4978
|
onPropertyChanged: ({
|
|
4984
|
-
id:
|
|
4979
|
+
id: c,
|
|
4985
4980
|
property: V
|
|
4986
4981
|
}) => {
|
|
4987
|
-
if (!
|
|
4982
|
+
if (!g || !c)
|
|
4988
4983
|
return;
|
|
4989
|
-
const G = !
|
|
4984
|
+
const G = !g.propertyKey;
|
|
4990
4985
|
return n.saveProperty({
|
|
4991
|
-
path:
|
|
4986
|
+
path: g?.editedCollectionId,
|
|
4992
4987
|
property: V,
|
|
4993
|
-
propertyKey:
|
|
4994
|
-
newPropertiesOrder: G &&
|
|
4995
|
-
namespace:
|
|
4996
|
-
parentCollectionIds:
|
|
4988
|
+
propertyKey: c,
|
|
4989
|
+
newPropertiesOrder: G && g.currentPropertiesOrder ? [...g.currentPropertiesOrder, c] : void 0,
|
|
4990
|
+
namespace: g.namespace,
|
|
4991
|
+
parentCollectionIds: g.parentCollectionIds
|
|
4997
4992
|
}).catch((B) => (console.error(B), v.open({
|
|
4998
4993
|
type: "error",
|
|
4999
4994
|
message: "Error persisting property: " + (B.message ?? "Details in the console")
|
|
@@ -5001,15 +4996,15 @@ const Ht = (t, r, n, i) => {
|
|
|
5001
4996
|
},
|
|
5002
4997
|
onPropertyChangedImmediate: !1,
|
|
5003
4998
|
onDelete: () => {
|
|
5004
|
-
if (!
|
|
4999
|
+
if (!g?.propertyKey)
|
|
5005
5000
|
return;
|
|
5006
|
-
const
|
|
5001
|
+
const c = g?.currentPropertiesOrder?.filter((V) => V !== g?.propertyKey);
|
|
5007
5002
|
return n.deleteProperty({
|
|
5008
|
-
path:
|
|
5009
|
-
propertyKey:
|
|
5010
|
-
namespace:
|
|
5011
|
-
newPropertiesOrder:
|
|
5012
|
-
parentCollectionIds:
|
|
5003
|
+
path: g?.editedCollectionId,
|
|
5004
|
+
propertyKey: g?.propertyKey,
|
|
5005
|
+
namespace: g?.namespace,
|
|
5006
|
+
newPropertiesOrder: c,
|
|
5007
|
+
parentCollectionIds: g?.parentCollectionIds
|
|
5013
5008
|
}).then(() => {
|
|
5014
5009
|
w(void 0);
|
|
5015
5010
|
}).catch((V) => (console.error(V), v.open({
|
|
@@ -5030,8 +5025,8 @@ const Ht = (t, r, n, i) => {
|
|
|
5030
5025
|
existingPropertyKeys: [],
|
|
5031
5026
|
allowDataInference: !0,
|
|
5032
5027
|
propertyConfigs: x,
|
|
5033
|
-
property:
|
|
5034
|
-
propertyKey:
|
|
5028
|
+
property: g?.property,
|
|
5029
|
+
propertyKey: g?.propertyKey
|
|
5035
5030
|
}
|
|
5036
5031
|
)
|
|
5037
5032
|
]
|
|
@@ -5050,8 +5045,8 @@ function ln({
|
|
|
5050
5045
|
user: l.user,
|
|
5051
5046
|
collection: n
|
|
5052
5047
|
}).editCollections : !0;
|
|
5053
|
-
let
|
|
5054
|
-
return (!ve(at(i.filterValues), at(n.initialFilter)) || !ve(at(i.sortBy), at(n.initialSort))) && (
|
|
5048
|
+
let s = null;
|
|
5049
|
+
return (!ve(at(i.filterValues), at(n.initialFilter)) || !ve(at(i.sortBy), at(n.initialSort))) && (s = /* @__PURE__ */ a(j, { children: [
|
|
5055
5050
|
(n.initialFilter || n.initialSort) && /* @__PURE__ */ e(
|
|
5056
5051
|
te,
|
|
5057
5052
|
{
|
|
@@ -5102,7 +5097,7 @@ function ln({
|
|
|
5102
5097
|
}
|
|
5103
5098
|
)
|
|
5104
5099
|
] })), /* @__PURE__ */ a(j, { children: [
|
|
5105
|
-
m &&
|
|
5100
|
+
m && s,
|
|
5106
5101
|
/* @__PURE__ */ e(
|
|
5107
5102
|
te,
|
|
5108
5103
|
{
|
|
@@ -5146,8 +5141,8 @@ function sn({
|
|
|
5146
5141
|
Zr,
|
|
5147
5142
|
{
|
|
5148
5143
|
trigger: /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(Jr, { size: "small" }) }),
|
|
5149
|
-
children: /* @__PURE__ */ a(Qr, { onClick: (
|
|
5150
|
-
|
|
5144
|
+
children: /* @__PURE__ */ a(Qr, { onClick: (s) => {
|
|
5145
|
+
s.preventDefault(), s.stopPropagation(), h(!0);
|
|
5151
5146
|
}, children: [
|
|
5152
5147
|
/* @__PURE__ */ e(dt, {}),
|
|
5153
5148
|
"Delete"
|
|
@@ -5157,7 +5152,7 @@ function sn({
|
|
|
5157
5152
|
d.editCollections && /* @__PURE__ */ e(
|
|
5158
5153
|
oe,
|
|
5159
5154
|
{
|
|
5160
|
-
onClick: (
|
|
5155
|
+
onClick: (s) => {
|
|
5161
5156
|
u();
|
|
5162
5157
|
},
|
|
5163
5158
|
children: /* @__PURE__ */ e(He, { size: "small" })
|
|
@@ -5192,7 +5187,7 @@ function cn({
|
|
|
5192
5187
|
return /* @__PURE__ */ e(
|
|
5193
5188
|
tr,
|
|
5194
5189
|
{
|
|
5195
|
-
className:
|
|
5190
|
+
className: he("h-full p-4 min-h-[124px]"),
|
|
5196
5191
|
onClick: i && l ? () => i.createCollection({
|
|
5197
5192
|
initialValues: t ? { group: t } : void 0,
|
|
5198
5193
|
parentCollectionIds: [],
|
|
@@ -5329,7 +5324,7 @@ function pn({
|
|
|
5329
5324
|
}
|
|
5330
5325
|
function mn() {
|
|
5331
5326
|
const t = xe();
|
|
5332
|
-
return /* @__PURE__ */ a(
|
|
5327
|
+
return /* @__PURE__ */ e("div", { className: "bg-gray-50 dark:bg-gray-900 min-w-fit rounded", children: /* @__PURE__ */ a(
|
|
5333
5328
|
z,
|
|
5334
5329
|
{
|
|
5335
5330
|
className: "min-w-fit",
|
|
@@ -5344,7 +5339,7 @@ function mn() {
|
|
|
5344
5339
|
"New collection"
|
|
5345
5340
|
]
|
|
5346
5341
|
}
|
|
5347
|
-
);
|
|
5342
|
+
) });
|
|
5348
5343
|
}
|
|
5349
5344
|
function In({
|
|
5350
5345
|
collectionConfigController: t,
|
|
@@ -5359,11 +5354,8 @@ function In({
|
|
|
5359
5354
|
onAnalyticsEvent: h
|
|
5360
5355
|
}) {
|
|
5361
5356
|
return {
|
|
5362
|
-
|
|
5357
|
+
key: "collection_editor",
|
|
5363
5358
|
loading: t.loading,
|
|
5364
|
-
collections: {
|
|
5365
|
-
CollectionActions: ln
|
|
5366
|
-
},
|
|
5367
5359
|
provider: {
|
|
5368
5360
|
Component: on,
|
|
5369
5361
|
props: {
|
|
@@ -5386,6 +5378,7 @@ function In({
|
|
|
5386
5378
|
AdditionalCards: r ? void 0 : cn
|
|
5387
5379
|
},
|
|
5388
5380
|
collectionView: {
|
|
5381
|
+
CollectionActions: ln,
|
|
5389
5382
|
HeaderAction: un,
|
|
5390
5383
|
AddColumnComponent: pn
|
|
5391
5384
|
}
|
|
@@ -5450,7 +5443,7 @@ export {
|
|
|
5450
5443
|
qe as editableProperty,
|
|
5451
5444
|
ae as getFullId,
|
|
5452
5445
|
ir as getFullIdPath,
|
|
5453
|
-
|
|
5446
|
+
me as idToPropertiesPath,
|
|
5454
5447
|
ye as namespaceToPropertiesOrderPath,
|
|
5455
5448
|
bi as namespaceToPropertiesPath,
|
|
5456
5449
|
wi as removeNonEditableProperties,
|