@firecms/collection_editor 3.0.0-beta.2-pre.4 → 3.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1273 -1222
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/ui/RootCollectionSuggestions.d.ts +3 -1
- package/dist/useCollectionEditorPlugin.d.ts +6 -3
- package/package.json +7 -7
- package/src/ui/RootCollectionSuggestions.tsx +16 -9
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +25 -25
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +6 -9
- package/src/ui/collection_editor/GetCodeDialog.tsx +1 -1
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +69 -66
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +1 -1
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +10 -7
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +18 -16
- package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +50 -16
package/dist/index.es.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as U } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Typography as
|
|
2
|
+
import { SearchIconsView as gr, toSnakeCase as Pt, singular as vr, IconForView as ot, ArrayContainer as yr, serializeRegExp as br, useSnackbarController as Ie, resolveEnumValues as Cr, isPropertyBuilder as ne, useCustomizationController as Ae, getFieldConfig as $e, ErrorBoundary as ge, PropertyConfigBadge as Ye, unslugify as ut, useNavigationController as Pe, mergeDeep as W, DEFAULT_FIELD_CONFIGS as Gt, isValidRegExp as Pr, getFieldId as Kt, DeleteConfirmationDialog as lt, useLargeLayout as Nr, makePropertiesEditable as pt, resolveEntityView as xr, useSelectionController as wr, EntityCollectionTable as Tr, slugify as kr, useAuthController as _e, randomString as _t, CircularProgressCenter as Nt, removeUndefined as Ft, ErrorView as Wt, removeInitialAndTrailingSlashes as Or, getDefaultPropertiesOrder as Vr } from "@firecms/core";
|
|
3
|
+
import * as je from "react";
|
|
4
|
+
import Y, { useState as $, useEffect as ce, useMemo as Zt, useCallback as Q, useRef as Le, useDeferredValue as Ir, useContext as Jt } from "react";
|
|
5
|
+
import ve from "react-fast-compare";
|
|
6
|
+
import { Typography as O, useAutoComplete as _r, Container as mt, Tooltip as te, IconButton as oe, Chip as st, TextField as Oe, cn as me, DebouncedTextField as Z, Autocomplete as Fr, AutocompleteItem as Sr, ExpandablePanel as xt, SettingsIcon as He, Select as be, SelectItem as ee, BooleanSwitchWithLabel as ct, Dialog as Fe, AutoAwesomeIcon as ht, Badge as Er, ListIcon as Ar, Button as z, CircularProgress as De, Paper as Ce, DialogContent as Be, DialogActions as ze, RuleIcon as Dr, FileUploadIcon as Br, MultiSelect as zr, MultiSelectItem as St, Checkbox as Et, cardMixin as Qt, cardClickableMixin as Xt, cardSelectedMixin as er, FunctionsIcon as Mr, RemoveCircleIcon as Rr, defaultBorderMixin as wt, RemoveIcon as Ur, DragHandleIcon as jr, AddIcon as ue, SelectGroup as At, InfoLabel as Lr, DeleteIcon as dt, ContentCopyIcon as qr, CodeIcon as $r, Table as Dt, TableBody as Bt, TableRow as bt, TableCell as Ue, Alert as Yr, Icon as et, Card as tr, coolIconKeys as zt, Tabs as Hr, Tab as Ct, ArrowBackIcon as tt, LoadingButton as Mt, DoneIcon as Gr, UndoIcon as Kr, SaveIcon as Wr, Menu as Zr, MoreVertIcon as Jr, MenuItem as Qr, Collapse as Xr } from "@firecms/ui";
|
|
7
7
|
import * as rt from "yup";
|
|
8
8
|
import { useFormex as K, Field as H, getIn as I, useCreateFormex as Tt, Formex as kt } from "@firecms/formex";
|
|
9
9
|
import { extractEnumFromValues as ei, buildPropertyFromData as ti, buildEntityPropertiesFromData as ri } from "@firecms/schema_inference";
|
|
10
10
|
import { DragDropContext as ii, Droppable as ni, Draggable as ai } from "@hello-pangea/dnd";
|
|
11
11
|
import oi from "json5";
|
|
12
12
|
import { Highlight as li, themes as si } from "prism-react-renderer";
|
|
13
|
-
import { ImportFileUpload as
|
|
13
|
+
import { ImportFileUpload as ci, DataNewPropertiesMapping as di, ImportNewPropertyFieldPreview as ui, getInferenceType as rr, getPropertiesMapping as pi, convertDataToEntity as mi, useImportConfig as hi, ImportSaveInProgress as fi } from "@firecms/data_import_export";
|
|
14
14
|
import { useNavigate as gi } from "react-router";
|
|
15
15
|
const vi = rt.object().shape({
|
|
16
16
|
id: rt.string().required("Required"),
|
|
@@ -21,7 +21,7 @@ function X({
|
|
|
21
21
|
error: t,
|
|
22
22
|
children: r
|
|
23
23
|
}) {
|
|
24
|
-
return r ? /* @__PURE__ */ e(
|
|
24
|
+
return r ? /* @__PURE__ */ e(O, { variant: "caption", color: t ? "error" : "secondary", className: "ml-3.5 mt-0.5", children: r }) : null;
|
|
25
25
|
}
|
|
26
26
|
function yi({
|
|
27
27
|
isNewCollection: t,
|
|
@@ -34,26 +34,28 @@ function yi({
|
|
|
34
34
|
const d = Y.useRef(null), {
|
|
35
35
|
values: u,
|
|
36
36
|
setFieldValue: p,
|
|
37
|
-
handleChange:
|
|
38
|
-
touched:
|
|
39
|
-
errors:
|
|
40
|
-
setFieldTouched:
|
|
37
|
+
handleChange: h,
|
|
38
|
+
touched: m,
|
|
39
|
+
errors: c,
|
|
40
|
+
setFieldTouched: g,
|
|
41
41
|
isSubmitting: v,
|
|
42
|
-
submitCount:
|
|
43
|
-
} = K(), [y,
|
|
44
|
-
p("name",
|
|
42
|
+
submitCount: x
|
|
43
|
+
} = K(), [y, P] = $(!1), [T, b] = $(!1), C = (s) => {
|
|
44
|
+
p("name", s), !I(m, "path") && t && s && p("path", Pt(s)), !I(m, "id") && t && s && p("id", Pt(s)), !I(m, "singularName") && t && s && p("singularName", vr(s));
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
const
|
|
50
|
-
inputFocused:
|
|
51
|
-
autoCompleteOpen:
|
|
52
|
-
setAutoCompleteOpen:
|
|
46
|
+
ce(() => {
|
|
47
|
+
c.id && b(!0);
|
|
48
|
+
}, [c.id]);
|
|
49
|
+
const N = /* @__PURE__ */ e(ot, { collectionOrView: u }), f = l?.filter((s) => !r?.includes(s)), {
|
|
50
|
+
inputFocused: w,
|
|
51
|
+
autoCompleteOpen: _,
|
|
52
|
+
setAutoCompleteOpen: M
|
|
53
53
|
} = _r({
|
|
54
54
|
ref: d
|
|
55
|
-
}),
|
|
56
|
-
let
|
|
55
|
+
}), R = !!o;
|
|
56
|
+
let D;
|
|
57
|
+
typeof u.customId == "object" ? D = "code_defined" : u.customId === !0 ? D = "true" : u.customId === !1 ? D = "false" : u.customId === "optional" && (D = "optional");
|
|
58
|
+
const A = x > 0;
|
|
57
59
|
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ a(mt, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
58
60
|
/* @__PURE__ */ a("div", { children: [
|
|
59
61
|
/* @__PURE__ */ a(
|
|
@@ -61,19 +63,19 @@ function yi({
|
|
|
61
63
|
{
|
|
62
64
|
className: "flex flex-row py-2 pt-3 items-center",
|
|
63
65
|
children: [
|
|
64
|
-
/* @__PURE__ */ e(
|
|
66
|
+
/* @__PURE__ */ e(O, { variant: t ? "h4" : "h5", className: "flex-grow", children: t ? "New collection" : `${u?.name} collection` }),
|
|
65
67
|
/* @__PURE__ */ e(te, { title: "Change icon", children: /* @__PURE__ */ e(
|
|
66
68
|
oe,
|
|
67
69
|
{
|
|
68
70
|
shape: "square",
|
|
69
|
-
onClick: () =>
|
|
70
|
-
children:
|
|
71
|
+
onClick: () => P(!0),
|
|
72
|
+
children: N
|
|
71
73
|
}
|
|
72
74
|
) })
|
|
73
75
|
]
|
|
74
76
|
}
|
|
75
77
|
),
|
|
76
|
-
o && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(
|
|
78
|
+
o && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
77
79
|
"This is a subcollection of ",
|
|
78
80
|
/* @__PURE__ */ e("b", { children: o.name })
|
|
79
81
|
] }) })
|
|
@@ -84,37 +86,37 @@ function yi({
|
|
|
84
86
|
Oe,
|
|
85
87
|
{
|
|
86
88
|
value: u.name ?? "",
|
|
87
|
-
onChange: (
|
|
89
|
+
onChange: (s) => C(s.target.value),
|
|
88
90
|
label: "Name",
|
|
89
91
|
required: !0,
|
|
90
|
-
error:
|
|
92
|
+
error: A && !!c.name
|
|
91
93
|
}
|
|
92
94
|
),
|
|
93
|
-
/* @__PURE__ */ e(X, { error:
|
|
95
|
+
/* @__PURE__ */ e(X, { error: m.name && !!c.name, children: m.name && c.name ? c.name : "Name of in this collection, usually a plural name (e.g. Products)" })
|
|
94
96
|
] }),
|
|
95
|
-
/* @__PURE__ */ a("div", { className:
|
|
97
|
+
/* @__PURE__ */ a("div", { className: me("col-span-12 ", R ? "" : "sm:col-span-8"), children: [
|
|
96
98
|
/* @__PURE__ */ e(
|
|
97
99
|
H,
|
|
98
100
|
{
|
|
99
101
|
name: "path",
|
|
100
|
-
as:
|
|
102
|
+
as: Z,
|
|
101
103
|
label: "Path",
|
|
102
104
|
disabled: !t,
|
|
103
105
|
required: !0,
|
|
104
|
-
error:
|
|
106
|
+
error: A && !!c.path
|
|
105
107
|
}
|
|
106
108
|
),
|
|
107
|
-
/* @__PURE__ */ e(X, { error:
|
|
109
|
+
/* @__PURE__ */ e(X, { error: m.path && !!c.path, children: m.path && c.path ? c.path : R ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database" })
|
|
108
110
|
] }),
|
|
109
|
-
!
|
|
111
|
+
!R && /* @__PURE__ */ a("div", { className: "col-span-12 sm:col-span-4 relative", children: [
|
|
110
112
|
/* @__PURE__ */ e(
|
|
111
113
|
Oe,
|
|
112
114
|
{
|
|
113
|
-
error:
|
|
115
|
+
error: A && !!c.group,
|
|
114
116
|
disabled: v,
|
|
115
117
|
value: u.group ?? "",
|
|
116
118
|
autoComplete: "off",
|
|
117
|
-
onChange: (
|
|
119
|
+
onChange: (s) => p("group", s.target.value),
|
|
118
120
|
name: "group",
|
|
119
121
|
inputRef: d,
|
|
120
122
|
label: "Group"
|
|
@@ -123,21 +125,21 @@ function yi({
|
|
|
123
125
|
/* @__PURE__ */ e(
|
|
124
126
|
Fr,
|
|
125
127
|
{
|
|
126
|
-
open:
|
|
127
|
-
setOpen:
|
|
128
|
-
children:
|
|
128
|
+
open: _ && (f ?? []).length > 0,
|
|
129
|
+
setOpen: M,
|
|
130
|
+
children: f?.map((s, V) => /* @__PURE__ */ e(
|
|
129
131
|
Sr,
|
|
130
132
|
{
|
|
131
133
|
onClick: () => {
|
|
132
|
-
|
|
134
|
+
M(!1), p("group", s ?? null);
|
|
133
135
|
},
|
|
134
|
-
children: /* @__PURE__ */ e("div", { className: "flex-grow", children:
|
|
136
|
+
children: /* @__PURE__ */ e("div", { className: "flex-grow", children: s })
|
|
135
137
|
},
|
|
136
|
-
|
|
138
|
+
V + "_" + s
|
|
137
139
|
))
|
|
138
140
|
}
|
|
139
141
|
),
|
|
140
|
-
/* @__PURE__ */ e(X, { children:
|
|
142
|
+
/* @__PURE__ */ e(X, { children: A && c.group ? c.group : "Group of the collection" })
|
|
141
143
|
] }),
|
|
142
144
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
143
145
|
xt,
|
|
@@ -145,9 +147,9 @@ function yi({
|
|
|
145
147
|
expanded: T,
|
|
146
148
|
onExpandedChange: b,
|
|
147
149
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
148
|
-
/* @__PURE__ */ e(
|
|
150
|
+
/* @__PURE__ */ e(He, {}),
|
|
149
151
|
/* @__PURE__ */ e(
|
|
150
|
-
|
|
152
|
+
O,
|
|
151
153
|
{
|
|
152
154
|
variant: "subtitle2",
|
|
153
155
|
className: "ml-2",
|
|
@@ -162,43 +164,43 @@ function yi({
|
|
|
162
164
|
H,
|
|
163
165
|
{
|
|
164
166
|
name: "id",
|
|
165
|
-
as:
|
|
167
|
+
as: Z,
|
|
166
168
|
disabled: !t,
|
|
167
169
|
label: "Collection id",
|
|
168
|
-
error:
|
|
170
|
+
error: A && !!c.id
|
|
169
171
|
}
|
|
170
172
|
),
|
|
171
|
-
/* @__PURE__ */ e(X, { error:
|
|
173
|
+
/* @__PURE__ */ e(X, { error: m.id && !!c.id, children: m.id && c.id ? c.id : "This id identifies this collection" })
|
|
172
174
|
] }),
|
|
173
175
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
174
176
|
/* @__PURE__ */ e(
|
|
175
177
|
Oe,
|
|
176
178
|
{
|
|
177
|
-
error:
|
|
178
|
-
|
|
179
|
+
error: A && !!c.singularName,
|
|
180
|
+
name: "singularName",
|
|
179
181
|
"aria-describedby": "singularName-helper",
|
|
180
|
-
onChange: (
|
|
182
|
+
onChange: (s) => (g("singularName", !0), h(s)),
|
|
181
183
|
value: u.singularName ?? "",
|
|
182
184
|
label: "Singular name"
|
|
183
185
|
}
|
|
184
186
|
),
|
|
185
|
-
/* @__PURE__ */ e(X, { error:
|
|
187
|
+
/* @__PURE__ */ e(X, { error: A && !!c.singularName, children: A && c.singularName ? c.singularName : "Optionally define a singular name for your entities" })
|
|
186
188
|
] }),
|
|
187
189
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
188
190
|
/* @__PURE__ */ e(
|
|
189
191
|
Oe,
|
|
190
192
|
{
|
|
191
|
-
error:
|
|
192
|
-
|
|
193
|
+
error: A && !!c.description,
|
|
194
|
+
name: "description",
|
|
193
195
|
value: u.description ?? "",
|
|
194
|
-
onChange:
|
|
196
|
+
onChange: h,
|
|
195
197
|
multiline: !0,
|
|
196
198
|
rows: 2,
|
|
197
199
|
"aria-describedby": "description-helper-text",
|
|
198
200
|
label: "Description"
|
|
199
201
|
}
|
|
200
202
|
),
|
|
201
|
-
/* @__PURE__ */ e(X, { error:
|
|
203
|
+
/* @__PURE__ */ e(X, { error: A && !!c.description, children: A && c.description ? c.description : "Description of the collection, you can use markdown" })
|
|
202
204
|
] }),
|
|
203
205
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
204
206
|
be,
|
|
@@ -206,16 +208,16 @@ function yi({
|
|
|
206
208
|
name: "defaultSize",
|
|
207
209
|
label: "Default row size",
|
|
208
210
|
position: "item-aligned",
|
|
209
|
-
onChange:
|
|
211
|
+
onChange: h,
|
|
210
212
|
value: u.defaultSize ?? "",
|
|
211
|
-
renderValue: (
|
|
212
|
-
children: ["xs", "s", "m", "l", "xl"].map((
|
|
213
|
+
renderValue: (s) => s.toUpperCase(),
|
|
214
|
+
children: ["xs", "s", "m", "l", "xl"].map((s) => /* @__PURE__ */ e(
|
|
213
215
|
ee,
|
|
214
216
|
{
|
|
215
|
-
value:
|
|
216
|
-
children:
|
|
217
|
+
value: s,
|
|
218
|
+
children: s.toUpperCase()
|
|
217
219
|
},
|
|
218
|
-
`size-select-${
|
|
220
|
+
`size-select-${s}`
|
|
219
221
|
))
|
|
220
222
|
}
|
|
221
223
|
) }),
|
|
@@ -225,14 +227,14 @@ function yi({
|
|
|
225
227
|
name: "customId",
|
|
226
228
|
label: "Data IDs generation",
|
|
227
229
|
position: "item-aligned",
|
|
228
|
-
disabled:
|
|
229
|
-
onValueChange: (
|
|
230
|
-
if (
|
|
230
|
+
disabled: D === "code_defined",
|
|
231
|
+
onValueChange: (s) => {
|
|
232
|
+
if (s === "code_defined")
|
|
231
233
|
throw new Error("This should not happen");
|
|
232
|
-
|
|
234
|
+
s === "true" ? p("customId", !0) : s === "false" ? p("customId", !1) : s === "optional" && p("customId", "optional");
|
|
233
235
|
},
|
|
234
|
-
value: "",
|
|
235
|
-
renderValue: (
|
|
236
|
+
value: D ?? "",
|
|
237
|
+
renderValue: (s) => s === "code_defined" ? "Code defined" : s === "true" ? "Users must define an ID" : s === "optional" ? "Users can define an ID, but it is not required" : "Document ID is generated automatically",
|
|
236
238
|
children: [
|
|
237
239
|
/* @__PURE__ */ e(ee, { value: "false", children: "Document ID is generated automatically" }),
|
|
238
240
|
/* @__PURE__ */ e(ee, { value: "true", children: "Users must define an ID" }),
|
|
@@ -242,11 +244,11 @@ function yi({
|
|
|
242
244
|
) }),
|
|
243
245
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
244
246
|
/* @__PURE__ */ e(
|
|
245
|
-
|
|
247
|
+
ct,
|
|
246
248
|
{
|
|
247
249
|
position: "start",
|
|
248
250
|
label: "Collection group",
|
|
249
|
-
onValueChange: (
|
|
251
|
+
onValueChange: (s) => p("collectionGroup", s),
|
|
250
252
|
value: u.collectionGroup ?? !1
|
|
251
253
|
}
|
|
252
254
|
),
|
|
@@ -254,11 +256,11 @@ function yi({
|
|
|
254
256
|
] }),
|
|
255
257
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
256
258
|
/* @__PURE__ */ e(
|
|
257
|
-
|
|
259
|
+
ct,
|
|
258
260
|
{
|
|
259
261
|
position: "start",
|
|
260
262
|
label: "Enable text search for this collection",
|
|
261
|
-
onValueChange: (
|
|
263
|
+
onValueChange: (s) => p("textSearchEnabled", s),
|
|
262
264
|
value: u.textSearchEnabled ?? !1
|
|
263
265
|
}
|
|
264
266
|
),
|
|
@@ -270,18 +272,18 @@ function yi({
|
|
|
270
272
|
] }),
|
|
271
273
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
272
274
|
/* @__PURE__ */ e(
|
|
273
|
-
|
|
275
|
+
Fe,
|
|
274
276
|
{
|
|
275
277
|
open: y,
|
|
276
|
-
onOpenChange:
|
|
278
|
+
onOpenChange: P,
|
|
277
279
|
maxWidth: "xl",
|
|
278
280
|
fullWidth: !0,
|
|
279
281
|
children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
|
|
280
|
-
|
|
282
|
+
gr,
|
|
281
283
|
{
|
|
282
284
|
selectedIcon: u.icon,
|
|
283
|
-
onIconSelected: (
|
|
284
|
-
|
|
285
|
+
onIconSelected: (s) => {
|
|
286
|
+
P(!1), p("icon", s);
|
|
285
287
|
}
|
|
286
288
|
}
|
|
287
289
|
) })
|
|
@@ -289,7 +291,7 @@ function yi({
|
|
|
289
291
|
)
|
|
290
292
|
] }) });
|
|
291
293
|
}
|
|
292
|
-
function
|
|
294
|
+
function pe(t) {
|
|
293
295
|
return "properties." + t.replaceAll(".", ".properties.");
|
|
294
296
|
}
|
|
295
297
|
function bi(t) {
|
|
@@ -303,7 +305,7 @@ function ae(t, r) {
|
|
|
303
305
|
}
|
|
304
306
|
function ir(t, r) {
|
|
305
307
|
const n = r ? `${r}.${t}` : t;
|
|
306
|
-
return
|
|
308
|
+
return pe(n);
|
|
307
309
|
}
|
|
308
310
|
function Ci({
|
|
309
311
|
enumValues: t,
|
|
@@ -317,23 +319,23 @@ function Ci({
|
|
|
317
319
|
const u = Tt({
|
|
318
320
|
initialValues: { enumValues: t },
|
|
319
321
|
validateOnChange: !0,
|
|
320
|
-
validation: (
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
v?.label || (
|
|
322
|
+
validation: (m) => {
|
|
323
|
+
const c = {};
|
|
324
|
+
m.enumValues && m.enumValues.forEach((v, x) => {
|
|
325
|
+
v?.label || (c.enumValues = c.enumValues ?? [], c.enumValues[x] = c.enumValues[x] ?? {}, c.enumValues[x].label = "You must specify a label for this enum value entry"), v?.id || (c.enumValues = c.enumValues ?? [], c.enumValues[x] = c.enumValues[x] ?? {}, c.enumValues[x].id = "You must specify an ID for this enum value entry");
|
|
324
326
|
});
|
|
325
|
-
const
|
|
326
|
-
return n?.(
|
|
327
|
+
const g = !!(c?.enumValues && Object.keys(c?.enumValues).length > 0);
|
|
328
|
+
return n?.(g), c;
|
|
327
329
|
}
|
|
328
|
-
}), { values: p, errors:
|
|
329
|
-
return
|
|
330
|
+
}), { values: p, errors: h } = u;
|
|
331
|
+
return ce(() => {
|
|
330
332
|
r && r(p.enumValues);
|
|
331
333
|
}, [p.enumValues]), /* @__PURE__ */ e(kt, { value: u, children: /* @__PURE__ */ e(
|
|
332
334
|
Pi,
|
|
333
335
|
{
|
|
334
336
|
enumValuesPath: "enumValues",
|
|
335
337
|
values: p,
|
|
336
|
-
errors:
|
|
338
|
+
errors: h,
|
|
337
339
|
shouldUpdateId: i,
|
|
338
340
|
disabled: l,
|
|
339
341
|
allowDataInference: o,
|
|
@@ -352,28 +354,28 @@ function Pi({
|
|
|
352
354
|
}) {
|
|
353
355
|
const {
|
|
354
356
|
setFieldValue: u
|
|
355
|
-
} = K(), [p,
|
|
356
|
-
const
|
|
357
|
+
} = K(), [p, h] = Y.useState(), [m, c] = Y.useState(), [g, v] = Y.useState(!1), y = Y.useRef(/* @__PURE__ */ new Set()).current, P = (b, C) => {
|
|
358
|
+
const N = p === C, f = r?.enumValues && r?.enumValues[b];
|
|
357
359
|
return /* @__PURE__ */ e(
|
|
358
360
|
Ni,
|
|
359
361
|
{
|
|
360
362
|
index: b,
|
|
361
363
|
disabled: n,
|
|
362
364
|
enumValuesPath: i,
|
|
363
|
-
autoFocus:
|
|
364
|
-
entryError:
|
|
365
|
-
shouldUpdateId: l ||
|
|
366
|
-
onDialogOpen: () =>
|
|
365
|
+
autoFocus: N,
|
|
366
|
+
entryError: f,
|
|
367
|
+
shouldUpdateId: l || N,
|
|
368
|
+
onDialogOpen: () => c(b),
|
|
367
369
|
inferredEntry: y.has(t.enumValues[b]?.id)
|
|
368
370
|
},
|
|
369
|
-
`${
|
|
371
|
+
`${C}`
|
|
370
372
|
);
|
|
371
373
|
};
|
|
372
374
|
return /* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
373
375
|
/* @__PURE__ */ a("div", { className: "ml-3.5 flex flex-row items-center", children: [
|
|
374
376
|
/* @__PURE__ */ e(Ar, {}),
|
|
375
377
|
/* @__PURE__ */ e(
|
|
376
|
-
|
|
378
|
+
O,
|
|
377
379
|
{
|
|
378
380
|
variant: "subtitle2",
|
|
379
381
|
className: "ml-2 grow",
|
|
@@ -383,24 +385,24 @@ function Pi({
|
|
|
383
385
|
o && /* @__PURE__ */ a(
|
|
384
386
|
z,
|
|
385
387
|
{
|
|
386
|
-
loading:
|
|
387
|
-
disabled: n ||
|
|
388
|
+
loading: g,
|
|
389
|
+
disabled: n || g,
|
|
388
390
|
variant: "text",
|
|
389
391
|
size: "small",
|
|
390
392
|
onClick: async () => {
|
|
391
393
|
d && (v(!0), d?.().then((b) => {
|
|
392
394
|
if (!b)
|
|
393
395
|
return;
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
y.add(
|
|
397
|
-
}), u(i, [...
|
|
396
|
+
const C = b.flat(), N = Array.from(new Set(C)), f = t.enumValues, _ = ei(N).filter((M) => !f?.some((R) => R.id === M.id));
|
|
397
|
+
_.forEach((M) => {
|
|
398
|
+
y.add(M.id);
|
|
399
|
+
}), u(i, [..._, ...f], !0);
|
|
398
400
|
}).catch((b) => {
|
|
399
401
|
console.error(b);
|
|
400
402
|
}).finally(() => v(!1)));
|
|
401
403
|
},
|
|
402
404
|
children: [
|
|
403
|
-
|
|
405
|
+
g ? /* @__PURE__ */ e(De, { size: "small" }) : /* @__PURE__ */ e(ht, {}),
|
|
404
406
|
"Infer values from data"
|
|
405
407
|
]
|
|
406
408
|
}
|
|
@@ -408,15 +410,15 @@ function Pi({
|
|
|
408
410
|
] }),
|
|
409
411
|
/* @__PURE__ */ a(Ce, { className: "p-4 m-1", children: [
|
|
410
412
|
/* @__PURE__ */ e(
|
|
411
|
-
|
|
413
|
+
yr,
|
|
412
414
|
{
|
|
413
415
|
droppableId: i,
|
|
414
416
|
addLabel: "Add enum value",
|
|
415
417
|
value: t.enumValues,
|
|
416
418
|
disabled: n,
|
|
417
419
|
size: "small",
|
|
418
|
-
buildEntry:
|
|
419
|
-
onInternalIdAdded:
|
|
420
|
+
buildEntry: P,
|
|
421
|
+
onInternalIdAdded: h,
|
|
420
422
|
includeAddButton: !0,
|
|
421
423
|
onValueChange: (b) => u(i, b),
|
|
422
424
|
newDefaultEntry: { id: "", label: "" }
|
|
@@ -425,10 +427,10 @@ function Pi({
|
|
|
425
427
|
/* @__PURE__ */ e(
|
|
426
428
|
xi,
|
|
427
429
|
{
|
|
428
|
-
index:
|
|
429
|
-
open:
|
|
430
|
+
index: m,
|
|
431
|
+
open: m !== void 0,
|
|
430
432
|
enumValuesPath: i,
|
|
431
|
-
onClose: () =>
|
|
433
|
+
onClose: () => c(void 0)
|
|
432
434
|
}
|
|
433
435
|
)
|
|
434
436
|
] })
|
|
@@ -446,21 +448,21 @@ const Ni = Y.memo(
|
|
|
446
448
|
entryError: p
|
|
447
449
|
}) {
|
|
448
450
|
const {
|
|
449
|
-
values:
|
|
450
|
-
handleChange:
|
|
451
|
-
errors:
|
|
452
|
-
setFieldValue:
|
|
451
|
+
values: h,
|
|
452
|
+
handleChange: m,
|
|
453
|
+
errors: c,
|
|
454
|
+
setFieldValue: g,
|
|
453
455
|
touched: v
|
|
454
|
-
} = K(),
|
|
456
|
+
} = K(), x = Y.useRef(!I(h, `${i}[${r}].id`)), y = n || x.current, P = I(h, `${i}[${r}].id`), T = I(h, `${i}[${r}].label`), b = Y.useRef(T);
|
|
455
457
|
return Y.useEffect(() => {
|
|
456
|
-
(b.current ===
|
|
458
|
+
(b.current === P || !P) && y && g(`${i}[${r}].id`, T), b.current = T;
|
|
457
459
|
}, [T]), /* @__PURE__ */ a(U, { children: [
|
|
458
460
|
/* @__PURE__ */ a("div", { className: "flex w-full align-center justify-center", children: [
|
|
459
461
|
/* @__PURE__ */ e(
|
|
460
462
|
H,
|
|
461
463
|
{
|
|
462
464
|
name: `${i}[${r}].label`,
|
|
463
|
-
as:
|
|
465
|
+
as: Z,
|
|
464
466
|
className: "flex-grow",
|
|
465
467
|
required: !0,
|
|
466
468
|
disabled: d,
|
|
@@ -478,12 +480,12 @@ const Ni = Y.memo(
|
|
|
478
480
|
"aria-label": "edit",
|
|
479
481
|
className: "m-1",
|
|
480
482
|
onClick: () => o(),
|
|
481
|
-
children: /* @__PURE__ */ e(
|
|
483
|
+
children: /* @__PURE__ */ e(He, { size: "small" })
|
|
482
484
|
}
|
|
483
485
|
) })
|
|
484
486
|
] }),
|
|
485
487
|
p?.label && /* @__PURE__ */ e(
|
|
486
|
-
|
|
488
|
+
O,
|
|
487
489
|
{
|
|
488
490
|
variant: "caption",
|
|
489
491
|
className: "ml-3.5 text-red-500 dark:text-red-500",
|
|
@@ -491,7 +493,7 @@ const Ni = Y.memo(
|
|
|
491
493
|
}
|
|
492
494
|
),
|
|
493
495
|
p?.id && /* @__PURE__ */ e(
|
|
494
|
-
|
|
496
|
+
O,
|
|
495
497
|
{
|
|
496
498
|
variant: "caption",
|
|
497
499
|
className: "ml-3.5 text-red-500 dark:text-red-500",
|
|
@@ -501,7 +503,7 @@ const Ni = Y.memo(
|
|
|
501
503
|
] });
|
|
502
504
|
},
|
|
503
505
|
function(r, n) {
|
|
504
|
-
return r.index === n.index && r.enumValuesPath === n.enumValuesPath && r.shouldUpdateId === n.shouldUpdateId && r.inferredEntry === n.inferredEntry &&
|
|
506
|
+
return r.index === n.index && r.enumValuesPath === n.enumValuesPath && r.shouldUpdateId === n.shouldUpdateId && r.inferredEntry === n.inferredEntry && ve(r.entryError, n.entryError) && r.autoFocus === n.autoFocus;
|
|
505
507
|
}
|
|
506
508
|
);
|
|
507
509
|
function xi({
|
|
@@ -514,19 +516,19 @@ function xi({
|
|
|
514
516
|
errors: l
|
|
515
517
|
} = K(), o = t !== void 0 ? I(l, `${i}[${t}].id`) : void 0;
|
|
516
518
|
return /* @__PURE__ */ a(
|
|
517
|
-
|
|
519
|
+
Fe,
|
|
518
520
|
{
|
|
519
521
|
maxWidth: "md",
|
|
520
522
|
"aria-labelledby": "enum-edit-dialog",
|
|
521
523
|
open: r,
|
|
522
524
|
onOpenChange: (d) => d ? void 0 : n(),
|
|
523
525
|
children: [
|
|
524
|
-
/* @__PURE__ */ e(
|
|
526
|
+
/* @__PURE__ */ e(Be, { children: t !== void 0 && /* @__PURE__ */ a("div", { children: [
|
|
525
527
|
/* @__PURE__ */ e(
|
|
526
528
|
H,
|
|
527
529
|
{
|
|
528
530
|
name: `${i}[${t}].id`,
|
|
529
|
-
as:
|
|
531
|
+
as: Z,
|
|
530
532
|
required: !0,
|
|
531
533
|
label: "ID",
|
|
532
534
|
size: "small",
|
|
@@ -536,7 +538,7 @@ function xi({
|
|
|
536
538
|
),
|
|
537
539
|
/* @__PURE__ */ e(X, { error: !!o, children: o ?? "Value saved in the data source" })
|
|
538
540
|
] }) }),
|
|
539
|
-
/* @__PURE__ */ e(
|
|
541
|
+
/* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(
|
|
540
542
|
z,
|
|
541
543
|
{
|
|
542
544
|
autoFocus: !0,
|
|
@@ -560,7 +562,7 @@ function se({
|
|
|
560
562
|
allowIndeterminate: d
|
|
561
563
|
}) {
|
|
562
564
|
const u = /* @__PURE__ */ e(
|
|
563
|
-
|
|
565
|
+
ct,
|
|
564
566
|
{
|
|
565
567
|
label: n,
|
|
566
568
|
size: o,
|
|
@@ -579,7 +581,7 @@ function se({
|
|
|
579
581
|
}
|
|
580
582
|
) : u;
|
|
581
583
|
}
|
|
582
|
-
function
|
|
584
|
+
function Se({ disabled: t }) {
|
|
583
585
|
const { values: r, handleChange: n } = K(), i = "validation.required", l = "validation.requiredMessage";
|
|
584
586
|
return /* @__PURE__ */ a(U, { children: [
|
|
585
587
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
@@ -617,7 +619,7 @@ function Fe({ disabled: t }) {
|
|
|
617
619
|
}
|
|
618
620
|
) }),
|
|
619
621
|
I(r, i) && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
620
|
-
|
|
622
|
+
Z,
|
|
621
623
|
{
|
|
622
624
|
disabled: t,
|
|
623
625
|
value: I(r, l),
|
|
@@ -629,7 +631,7 @@ function Fe({ disabled: t }) {
|
|
|
629
631
|
) })
|
|
630
632
|
] });
|
|
631
633
|
}
|
|
632
|
-
function
|
|
634
|
+
function Ee({
|
|
633
635
|
length: t,
|
|
634
636
|
lowercase: r,
|
|
635
637
|
matches: n,
|
|
@@ -641,25 +643,25 @@ function Se({
|
|
|
641
643
|
showErrors: p
|
|
642
644
|
}) {
|
|
643
645
|
const {
|
|
644
|
-
values:
|
|
645
|
-
handleChange:
|
|
646
|
-
errors:
|
|
647
|
-
} = K(),
|
|
646
|
+
values: h,
|
|
647
|
+
handleChange: m,
|
|
648
|
+
errors: c
|
|
649
|
+
} = K(), g = "validation.length", v = "validation.min", x = "validation.max", y = "validation.trim", P = "validation.matches", T = "validation.lowercase", b = "validation.uppercase", C = I(c, P), N = I(h, P), f = typeof N == "string" ? N : br(N);
|
|
648
650
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
649
|
-
/* @__PURE__ */ e(
|
|
651
|
+
/* @__PURE__ */ e(Se, { disabled: u }),
|
|
650
652
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
651
653
|
r && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
652
654
|
H,
|
|
653
655
|
{
|
|
654
656
|
name: T,
|
|
655
657
|
type: "checkbox",
|
|
656
|
-
children: ({ field:
|
|
658
|
+
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
657
659
|
se,
|
|
658
660
|
{
|
|
659
661
|
label: "Lowercase",
|
|
660
662
|
disabled: u,
|
|
661
|
-
form:
|
|
662
|
-
field:
|
|
663
|
+
form: _,
|
|
664
|
+
field: w
|
|
663
665
|
}
|
|
664
666
|
)
|
|
665
667
|
}
|
|
@@ -669,13 +671,13 @@ function Se({
|
|
|
669
671
|
{
|
|
670
672
|
name: b,
|
|
671
673
|
type: "checkbox",
|
|
672
|
-
children: ({ field:
|
|
674
|
+
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
673
675
|
se,
|
|
674
676
|
{
|
|
675
677
|
label: "Uppercase",
|
|
676
678
|
disabled: u,
|
|
677
|
-
form:
|
|
678
|
-
field:
|
|
679
|
+
form: _,
|
|
680
|
+
field: w
|
|
679
681
|
}
|
|
680
682
|
)
|
|
681
683
|
}
|
|
@@ -685,13 +687,13 @@ function Se({
|
|
|
685
687
|
{
|
|
686
688
|
name: y,
|
|
687
689
|
type: "checkbox",
|
|
688
|
-
children: ({ field:
|
|
690
|
+
children: ({ field: w, form: _ }) => /* @__PURE__ */ e(
|
|
689
691
|
se,
|
|
690
692
|
{
|
|
691
693
|
label: "Trim",
|
|
692
694
|
disabled: u,
|
|
693
|
-
form:
|
|
694
|
-
field:
|
|
695
|
+
form: _,
|
|
696
|
+
field: w
|
|
695
697
|
}
|
|
696
698
|
)
|
|
697
699
|
}
|
|
@@ -699,39 +701,39 @@ function Se({
|
|
|
699
701
|
] }),
|
|
700
702
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
701
703
|
t && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
702
|
-
|
|
704
|
+
Z,
|
|
703
705
|
{
|
|
704
|
-
value: I(
|
|
706
|
+
value: I(h, g),
|
|
705
707
|
label: "Exact length",
|
|
706
|
-
name:
|
|
708
|
+
name: g,
|
|
707
709
|
type: "number",
|
|
708
710
|
size: "small",
|
|
709
711
|
disabled: u,
|
|
710
|
-
onChange:
|
|
712
|
+
onChange: m
|
|
711
713
|
}
|
|
712
714
|
) }),
|
|
713
715
|
l && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
714
|
-
|
|
716
|
+
Z,
|
|
715
717
|
{
|
|
716
|
-
value: I(
|
|
718
|
+
value: I(h, v),
|
|
717
719
|
label: "Min length",
|
|
718
720
|
name: v,
|
|
719
721
|
type: "number",
|
|
720
722
|
size: "small",
|
|
721
723
|
disabled: u,
|
|
722
|
-
onChange:
|
|
724
|
+
onChange: m
|
|
723
725
|
}
|
|
724
726
|
) }),
|
|
725
727
|
i && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
726
|
-
|
|
728
|
+
Z,
|
|
727
729
|
{
|
|
728
|
-
value: I(
|
|
730
|
+
value: I(h, x),
|
|
729
731
|
label: "Max length",
|
|
730
|
-
name:
|
|
732
|
+
name: x,
|
|
731
733
|
type: "number",
|
|
732
734
|
size: "small",
|
|
733
735
|
disabled: u,
|
|
734
|
-
onChange:
|
|
736
|
+
onChange: m
|
|
735
737
|
}
|
|
736
738
|
) })
|
|
737
739
|
] }),
|
|
@@ -739,16 +741,16 @@ function Se({
|
|
|
739
741
|
/* @__PURE__ */ e(
|
|
740
742
|
H,
|
|
741
743
|
{
|
|
742
|
-
name:
|
|
743
|
-
as:
|
|
744
|
+
name: P,
|
|
745
|
+
as: Z,
|
|
744
746
|
label: "Matches regex",
|
|
745
747
|
size: "small",
|
|
746
748
|
disabled: u,
|
|
747
|
-
value:
|
|
748
|
-
error: !!
|
|
749
|
+
value: f,
|
|
750
|
+
error: !!C
|
|
749
751
|
}
|
|
750
752
|
),
|
|
751
|
-
/* @__PURE__ */ e(X, { error: !!
|
|
753
|
+
/* @__PURE__ */ e(X, { error: !!C, children: C ? "Not a valid regexp" : "e.g. /^\\d+$/ for digits only" })
|
|
752
754
|
] })
|
|
753
755
|
] });
|
|
754
756
|
}
|
|
@@ -762,9 +764,9 @@ function Ot({
|
|
|
762
764
|
handleChange: l
|
|
763
765
|
} = K(), o = "validation.min", d = "validation.max";
|
|
764
766
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
765
|
-
/* @__PURE__ */ e(
|
|
767
|
+
/* @__PURE__ */ e(Se, { disabled: n }),
|
|
766
768
|
r && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
767
|
-
|
|
769
|
+
Z,
|
|
768
770
|
{
|
|
769
771
|
value: I(i, o),
|
|
770
772
|
disabled: n,
|
|
@@ -776,7 +778,7 @@ function Ot({
|
|
|
776
778
|
}
|
|
777
779
|
) }),
|
|
778
780
|
t && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
779
|
-
|
|
781
|
+
Z,
|
|
780
782
|
{
|
|
781
783
|
value: I(i, d),
|
|
782
784
|
disabled: n,
|
|
@@ -789,7 +791,7 @@ function Ot({
|
|
|
789
791
|
) })
|
|
790
792
|
] });
|
|
791
793
|
}
|
|
792
|
-
function
|
|
794
|
+
function Ne({
|
|
793
795
|
children: t
|
|
794
796
|
}) {
|
|
795
797
|
return /* @__PURE__ */ e(
|
|
@@ -801,7 +803,7 @@ function Pe({
|
|
|
801
803
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
802
804
|
/* @__PURE__ */ e(Dr, {}),
|
|
803
805
|
/* @__PURE__ */ e(
|
|
804
|
-
|
|
806
|
+
O,
|
|
805
807
|
{
|
|
806
808
|
variant: "subtitle2",
|
|
807
809
|
className: "ml-2",
|
|
@@ -825,7 +827,7 @@ function Rt({
|
|
|
825
827
|
values: d,
|
|
826
828
|
setFieldError: u,
|
|
827
829
|
setFieldValue: p
|
|
828
|
-
} = K(),
|
|
830
|
+
} = K(), h = Ie(), m = t ? "of.enumValues" : "enumValues", c = I(d, "defaultValue"), g = I(d, m), v = Zt(() => !g || typeof g == "boolean" ? [] : Cr(g) ?? [], [g]);
|
|
829
831
|
return /* @__PURE__ */ a(U, { children: [
|
|
830
832
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
831
833
|
Ci,
|
|
@@ -835,13 +837,13 @@ function Rt({
|
|
|
835
837
|
disabled: n,
|
|
836
838
|
allowDataInference: l,
|
|
837
839
|
onError: (y) => {
|
|
838
|
-
u(
|
|
840
|
+
u(m, y ? "This enum property is missing some values" : void 0);
|
|
839
841
|
},
|
|
840
|
-
getData: o ? () => o().then((y) => y.map((
|
|
842
|
+
getData: o ? () => o().then((y) => y.map((P) => d.id && I(P, d.id)).filter(Boolean)) : void 0,
|
|
841
843
|
onValuesChanged: (y) => {
|
|
842
|
-
if (d && (p(
|
|
843
|
-
const
|
|
844
|
-
|
|
844
|
+
if (d && (p(m, y), !t)) {
|
|
845
|
+
const P = y.filter((T) => !!T?.id).map((T) => T.id);
|
|
846
|
+
c && !P.includes(c) && (p("defaultValue", void 0), h.open({
|
|
845
847
|
type: "warning",
|
|
846
848
|
message: "Default value was cleared"
|
|
847
849
|
}));
|
|
@@ -849,9 +851,9 @@ function Rt({
|
|
|
849
851
|
}
|
|
850
852
|
}
|
|
851
853
|
) }),
|
|
852
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
854
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Ne, { children: [
|
|
853
855
|
!t && /* @__PURE__ */ e(
|
|
854
|
-
|
|
856
|
+
Ee,
|
|
855
857
|
{
|
|
856
858
|
disabled: n,
|
|
857
859
|
showErrors: i
|
|
@@ -868,7 +870,7 @@ function Rt({
|
|
|
868
870
|
p("defaultValue", y);
|
|
869
871
|
},
|
|
870
872
|
label: "Default value",
|
|
871
|
-
value:
|
|
873
|
+
value: c ?? "",
|
|
872
874
|
children: v.filter((y) => !!y?.id).map((y) => /* @__PURE__ */ e(
|
|
873
875
|
ee,
|
|
874
876
|
{
|
|
@@ -896,9 +898,9 @@ function Ut({
|
|
|
896
898
|
const {
|
|
897
899
|
values: i,
|
|
898
900
|
setFieldValue: l
|
|
899
|
-
} = K(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`, u = `${o}.fileName`, p = `${o}.storagePath`,
|
|
900
|
-
b ? b.includes("all") || b.length >= Object.keys(it).length ? l(d, void 0) :
|
|
901
|
-
},
|
|
901
|
+
} = K(), o = t ? "of.storage" : "storage", d = `${o}.acceptedFiles`, u = `${o}.fileName`, p = `${o}.storagePath`, h = `${o}.storeUrl`, m = I(i, u) ?? "{rand}_{file}", c = I(i, p) ?? "/", g = I(i, d), v = Array.isArray(g) ? g : void 0, x = !v || v.length === 0, y = (b) => {
|
|
902
|
+
b ? b.includes("all") || b.length >= Object.keys(it).length ? l(d, void 0) : x ? l(d, Object.keys(it).filter((C) => !b.includes(C))) : l(d, b) : l(d, void 0);
|
|
903
|
+
}, P = typeof m == "function", T = typeof c == "function";
|
|
902
904
|
return /* @__PURE__ */ a(U, { children: [
|
|
903
905
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
904
906
|
xt,
|
|
@@ -906,7 +908,7 @@ function Ut({
|
|
|
906
908
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
907
909
|
/* @__PURE__ */ e(Br, {}),
|
|
908
910
|
/* @__PURE__ */ e(
|
|
909
|
-
|
|
911
|
+
O,
|
|
910
912
|
{
|
|
911
913
|
variant: "subtitle2",
|
|
912
914
|
className: "ml-2",
|
|
@@ -922,8 +924,8 @@ function Ut({
|
|
|
922
924
|
name: d,
|
|
923
925
|
value: v ?? [],
|
|
924
926
|
onMultiValueChange: y,
|
|
925
|
-
label:
|
|
926
|
-
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((
|
|
927
|
+
label: x ? void 0 : "Allowed file types",
|
|
928
|
+
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((C) => it[C]).filter((C) => !!C).join(", "),
|
|
927
929
|
children: [
|
|
928
930
|
/* @__PURE__ */ a(St, { value: "all", className: "flex items-center gap-2", children: [
|
|
929
931
|
/* @__PURE__ */ e(
|
|
@@ -934,20 +936,20 @@ function Ut({
|
|
|
934
936
|
),
|
|
935
937
|
"All"
|
|
936
938
|
] }, "all"),
|
|
937
|
-
Object.entries(it).map(([b,
|
|
939
|
+
Object.entries(it).map(([b, C]) => /* @__PURE__ */ a(St, { value: b, className: "flex items-center gap-2", children: [
|
|
938
940
|
/* @__PURE__ */ e(
|
|
939
941
|
Et,
|
|
940
942
|
{
|
|
941
|
-
checked:
|
|
943
|
+
checked: x || v.indexOf(b) > -1
|
|
942
944
|
}
|
|
943
945
|
),
|
|
944
|
-
/* @__PURE__ */ e("div", { className: "flex-grow", children:
|
|
946
|
+
/* @__PURE__ */ e("div", { className: "flex-grow", children: C }),
|
|
945
947
|
/* @__PURE__ */ e(
|
|
946
948
|
z,
|
|
947
949
|
{
|
|
948
950
|
size: "small",
|
|
949
951
|
variant: "outlined",
|
|
950
|
-
onClick: (
|
|
952
|
+
onClick: (N) => (N.preventDefault(), N.stopPropagation(), l(d, [b])),
|
|
951
953
|
children: "Only"
|
|
952
954
|
}
|
|
953
955
|
)
|
|
@@ -959,11 +961,11 @@ function Ut({
|
|
|
959
961
|
H,
|
|
960
962
|
{
|
|
961
963
|
name: u,
|
|
962
|
-
as:
|
|
964
|
+
as: Z,
|
|
963
965
|
label: "File name",
|
|
964
966
|
size: "small",
|
|
965
|
-
disabled:
|
|
966
|
-
value:
|
|
967
|
+
disabled: P || n,
|
|
968
|
+
value: P ? "-" : m
|
|
967
969
|
}
|
|
968
970
|
) }),
|
|
969
971
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -971,14 +973,14 @@ function Ut({
|
|
|
971
973
|
H,
|
|
972
974
|
{
|
|
973
975
|
name: p,
|
|
974
|
-
as:
|
|
976
|
+
as: Z,
|
|
975
977
|
label: "Storage path",
|
|
976
978
|
disabled: T || n,
|
|
977
979
|
size: "small",
|
|
978
|
-
value: T ? "-" :
|
|
980
|
+
value: T ? "-" : c
|
|
979
981
|
}
|
|
980
982
|
),
|
|
981
|
-
/* @__PURE__ */ a(
|
|
983
|
+
/* @__PURE__ */ a(O, { variant: "caption", className: "ml-3.5 mt-1 mb-2", children: [
|
|
982
984
|
/* @__PURE__ */ e("p", { children: "You can use the following placeholders in the file name and storage path values:" }),
|
|
983
985
|
/* @__PURE__ */ a("ul", { children: [
|
|
984
986
|
/* @__PURE__ */ e("li", { children: "{file} - Full name of the uploaded file" }),
|
|
@@ -993,31 +995,31 @@ function Ut({
|
|
|
993
995
|
/* @__PURE__ */ e(
|
|
994
996
|
H,
|
|
995
997
|
{
|
|
996
|
-
name:
|
|
998
|
+
name: h,
|
|
997
999
|
type: "checkbox",
|
|
998
|
-
children: ({ field: b, form:
|
|
1000
|
+
children: ({ field: b, form: C }) => /* @__PURE__ */ e(
|
|
999
1001
|
se,
|
|
1000
1002
|
{
|
|
1001
1003
|
label: "Save URL instead of storage path",
|
|
1002
1004
|
disabled: r || n,
|
|
1003
|
-
form:
|
|
1005
|
+
form: C,
|
|
1004
1006
|
field: b
|
|
1005
1007
|
}
|
|
1006
1008
|
)
|
|
1007
1009
|
}
|
|
1008
1010
|
),
|
|
1009
|
-
/* @__PURE__ */ e(
|
|
1011
|
+
/* @__PURE__ */ e(O, { variant: "caption", className: "ml-3.5 mt-1 mb-2", children: "Turn this setting on, if you prefer to save the download URL of the uploaded file instead of the storage path. You can only change this prop upon creation." })
|
|
1010
1012
|
] })
|
|
1011
1013
|
] })
|
|
1012
1014
|
}
|
|
1013
1015
|
) }),
|
|
1014
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
1015
|
-
!t && /* @__PURE__ */ e("div", { className: "grid grid-cols-12 gap-2", children: /* @__PURE__ */ e(
|
|
1016
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Ne, { children: [
|
|
1017
|
+
!t && /* @__PURE__ */ e("div", { className: "grid grid-cols-12 gap-2", children: /* @__PURE__ */ e(Se, { disabled: n }) }),
|
|
1016
1018
|
t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ot, { disabled: n }) })
|
|
1017
1019
|
] }) })
|
|
1018
1020
|
] });
|
|
1019
1021
|
}
|
|
1020
|
-
function
|
|
1022
|
+
function qe(t) {
|
|
1021
1023
|
if (ne(t) || ne(t))
|
|
1022
1024
|
return !1;
|
|
1023
1025
|
{
|
|
@@ -1026,9 +1028,9 @@ function Le(t) {
|
|
|
1026
1028
|
}
|
|
1027
1029
|
}
|
|
1028
1030
|
function wi(t) {
|
|
1029
|
-
return Object.entries(t).filter(([r, n]) =>
|
|
1031
|
+
return Object.entries(t).filter(([r, n]) => qe(n)).map(([r, n]) => {
|
|
1030
1032
|
const i = n;
|
|
1031
|
-
if (
|
|
1033
|
+
if (qe(i))
|
|
1032
1034
|
return i.dataType === "map" && i.properties ? {
|
|
1033
1035
|
[r]: {
|
|
1034
1036
|
...i,
|
|
@@ -1045,20 +1047,20 @@ function nr({
|
|
|
1045
1047
|
includeEditButton: l,
|
|
1046
1048
|
selected: o
|
|
1047
1049
|
}) {
|
|
1048
|
-
const { propertyConfigs: d } =
|
|
1049
|
-
|
|
1050
|
+
const { propertyConfigs: d } = Ae(), u = $e(t, d);
|
|
1051
|
+
qe(t);
|
|
1050
1052
|
const p = n ? "border-red-500 dark:border-red-500 border-opacity-100 dark:border-opacity-100 ring-0 dark:ring-0" : o ? "border-primary" : "border-transparent";
|
|
1051
|
-
return n && console.log("PropertyFieldPreview", t), /* @__PURE__ */ e(
|
|
1053
|
+
return n && console.log("PropertyFieldPreview", t), /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ a(
|
|
1052
1054
|
"div",
|
|
1053
1055
|
{
|
|
1054
1056
|
onClick: r,
|
|
1055
1057
|
className: "flex flex-row w-full cursor-pointer",
|
|
1056
1058
|
children: [
|
|
1057
|
-
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(
|
|
1059
|
+
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(Ye, { propertyConfig: u }) }),
|
|
1058
1060
|
/* @__PURE__ */ a(
|
|
1059
1061
|
Ce,
|
|
1060
1062
|
{
|
|
1061
|
-
className:
|
|
1063
|
+
className: me(
|
|
1062
1064
|
"border",
|
|
1063
1065
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1064
1066
|
Qt,
|
|
@@ -1069,8 +1071,8 @@ function nr({
|
|
|
1069
1071
|
),
|
|
1070
1072
|
children: [
|
|
1071
1073
|
/* @__PURE__ */ a("div", { className: "w-full flex flex-col", children: [
|
|
1072
|
-
i && /* @__PURE__ */ e(
|
|
1073
|
-
|
|
1074
|
+
i && /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1075
|
+
O,
|
|
1074
1076
|
{
|
|
1075
1077
|
variant: "body1",
|
|
1076
1078
|
component: "span",
|
|
@@ -1079,8 +1081,8 @@ function nr({
|
|
|
1079
1081
|
}
|
|
1080
1082
|
) }),
|
|
1081
1083
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center", children: [
|
|
1082
|
-
/* @__PURE__ */ e(
|
|
1083
|
-
|
|
1084
|
+
/* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1085
|
+
O,
|
|
1084
1086
|
{
|
|
1085
1087
|
className: "flex-grow pr-2",
|
|
1086
1088
|
variant: i ? "body2" : "subtitle1",
|
|
@@ -1089,8 +1091,8 @@ function nr({
|
|
|
1089
1091
|
children: u?.name
|
|
1090
1092
|
}
|
|
1091
1093
|
) }),
|
|
1092
|
-
/* @__PURE__ */ e(
|
|
1093
|
-
|
|
1094
|
+
/* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1095
|
+
O,
|
|
1094
1096
|
{
|
|
1095
1097
|
variant: "body2",
|
|
1096
1098
|
component: "span",
|
|
@@ -1100,7 +1102,7 @@ function nr({
|
|
|
1100
1102
|
) })
|
|
1101
1103
|
] })
|
|
1102
1104
|
] }),
|
|
1103
|
-
l && /* @__PURE__ */ e(
|
|
1105
|
+
l && /* @__PURE__ */ e(O, { variant: "button", children: "EDIT" })
|
|
1104
1106
|
]
|
|
1105
1107
|
}
|
|
1106
1108
|
)
|
|
@@ -1114,7 +1116,7 @@ function Ti({
|
|
|
1114
1116
|
onClick: n,
|
|
1115
1117
|
property: i
|
|
1116
1118
|
}) {
|
|
1117
|
-
const { propertyConfigs: l } =
|
|
1119
|
+
const { propertyConfigs: l } = Ae(), o = !ne(i) && i ? $e(i, l) : void 0;
|
|
1118
1120
|
return /* @__PURE__ */ a(
|
|
1119
1121
|
"div",
|
|
1120
1122
|
{
|
|
@@ -1122,7 +1124,7 @@ function Ti({
|
|
|
1122
1124
|
className: "flex flex-row w-full cursor-pointer",
|
|
1123
1125
|
children: [
|
|
1124
1126
|
/* @__PURE__ */ a("div", { className: "relative m-4", children: [
|
|
1125
|
-
o && /* @__PURE__ */ e(
|
|
1127
|
+
o && /* @__PURE__ */ e(Ye, { propertyConfig: o }),
|
|
1126
1128
|
!o && /* @__PURE__ */ e(
|
|
1127
1129
|
"div",
|
|
1128
1130
|
{
|
|
@@ -1135,7 +1137,7 @@ function Ti({
|
|
|
1135
1137
|
/* @__PURE__ */ e(
|
|
1136
1138
|
Ce,
|
|
1137
1139
|
{
|
|
1138
|
-
className:
|
|
1140
|
+
className: me(
|
|
1139
1141
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1140
1142
|
Qt,
|
|
1141
1143
|
n ? Xt : "",
|
|
@@ -1145,7 +1147,7 @@ function Ti({
|
|
|
1145
1147
|
),
|
|
1146
1148
|
children: /* @__PURE__ */ a("div", { className: "w-full flex flex-col", children: [
|
|
1147
1149
|
/* @__PURE__ */ e(
|
|
1148
|
-
|
|
1150
|
+
O,
|
|
1149
1151
|
{
|
|
1150
1152
|
variant: "body1",
|
|
1151
1153
|
component: "span",
|
|
@@ -1155,7 +1157,7 @@ function Ti({
|
|
|
1155
1157
|
),
|
|
1156
1158
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center", children: [
|
|
1157
1159
|
o && /* @__PURE__ */ e(
|
|
1158
|
-
|
|
1160
|
+
O,
|
|
1159
1161
|
{
|
|
1160
1162
|
className: "flex-grow pr-2",
|
|
1161
1163
|
variant: "body2",
|
|
@@ -1164,8 +1166,8 @@ function Ti({
|
|
|
1164
1166
|
children: o?.name
|
|
1165
1167
|
}
|
|
1166
1168
|
),
|
|
1167
|
-
i && !ne(i) && /* @__PURE__ */ e(
|
|
1168
|
-
|
|
1169
|
+
i && !ne(i) && /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1170
|
+
O,
|
|
1169
1171
|
{
|
|
1170
1172
|
variant: "body2",
|
|
1171
1173
|
component: "span",
|
|
@@ -1173,8 +1175,8 @@ function Ti({
|
|
|
1173
1175
|
children: i.dataType
|
|
1174
1176
|
}
|
|
1175
1177
|
) }),
|
|
1176
|
-
i && ne(i) && /* @__PURE__ */ e(
|
|
1177
|
-
|
|
1178
|
+
i && ne(i) && /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1179
|
+
O,
|
|
1178
1180
|
{
|
|
1179
1181
|
variant: "body2",
|
|
1180
1182
|
component: "span",
|
|
@@ -1182,8 +1184,8 @@ function Ti({
|
|
|
1182
1184
|
children: "This property is defined as a property builder in code"
|
|
1183
1185
|
}
|
|
1184
1186
|
) }),
|
|
1185
|
-
!i && /* @__PURE__ */ e(
|
|
1186
|
-
|
|
1187
|
+
!i && /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1188
|
+
O,
|
|
1187
1189
|
{
|
|
1188
1190
|
variant: "body2",
|
|
1189
1191
|
component: "span",
|
|
@@ -1209,46 +1211,46 @@ const ft = Y.memo(
|
|
|
1209
1211
|
additionalFields: d,
|
|
1210
1212
|
errors: u,
|
|
1211
1213
|
onPropertyMove: p,
|
|
1212
|
-
onPropertyRemove:
|
|
1213
|
-
className:
|
|
1214
|
-
inferredPropertyKeys:
|
|
1215
|
-
collectionEditable:
|
|
1214
|
+
onPropertyRemove: h,
|
|
1215
|
+
className: m,
|
|
1216
|
+
inferredPropertyKeys: c,
|
|
1217
|
+
collectionEditable: g
|
|
1216
1218
|
}) {
|
|
1217
|
-
const v = o ?? Object.keys(l),
|
|
1219
|
+
const v = o ?? Object.keys(l), x = Q((y) => {
|
|
1218
1220
|
if (!y.destination)
|
|
1219
1221
|
return;
|
|
1220
|
-
const
|
|
1221
|
-
b.splice(T, 0,
|
|
1222
|
+
const P = y.source.index, T = y.destination.index, b = Array.from(v), [C] = b.splice(P, 1);
|
|
1223
|
+
b.splice(T, 0, C), p && p(b, r);
|
|
1222
1224
|
}, [r, p, v]);
|
|
1223
|
-
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(ii, { onDragEnd:
|
|
1225
|
+
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(ii, { onDragEnd: x, children: /* @__PURE__ */ e(ni, { droppableId: `droppable_${r}`, children: (y, P) => /* @__PURE__ */ a(
|
|
1224
1226
|
"div",
|
|
1225
1227
|
{
|
|
1226
1228
|
...y.droppableProps,
|
|
1227
1229
|
ref: y.innerRef,
|
|
1228
|
-
className:
|
|
1230
|
+
className: m,
|
|
1229
1231
|
children: [
|
|
1230
1232
|
v && v.map((T, b) => {
|
|
1231
|
-
const
|
|
1232
|
-
return !
|
|
1233
|
+
const C = l[T], N = d?.find((f) => f.key === T);
|
|
1234
|
+
return !C && !N ? (console.warn(`Property ${T} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
1233
1235
|
ai,
|
|
1234
1236
|
{
|
|
1235
1237
|
draggableId: `array_field_${r}_${T}}`,
|
|
1236
1238
|
index: b,
|
|
1237
|
-
children: (
|
|
1239
|
+
children: (f, w) => /* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
1238
1240
|
ki,
|
|
1239
1241
|
{
|
|
1240
1242
|
propertyKey: T,
|
|
1241
|
-
propertyOrBuilder:
|
|
1242
|
-
additionalField:
|
|
1243
|
-
provided:
|
|
1243
|
+
propertyOrBuilder: C,
|
|
1244
|
+
additionalField: N,
|
|
1245
|
+
provided: f,
|
|
1244
1246
|
errors: u,
|
|
1245
1247
|
namespace: r,
|
|
1246
|
-
inferredPropertyKeys:
|
|
1248
|
+
inferredPropertyKeys: c,
|
|
1247
1249
|
onPropertyMove: p,
|
|
1248
|
-
onPropertyRemove:
|
|
1249
|
-
onPropertyClick:
|
|
1250
|
+
onPropertyRemove: h,
|
|
1251
|
+
onPropertyClick: w.isDragging ? void 0 : i,
|
|
1250
1252
|
selectedPropertyKey: n,
|
|
1251
|
-
collectionEditable:
|
|
1253
|
+
collectionEditable: g
|
|
1252
1254
|
}
|
|
1253
1255
|
) })
|
|
1254
1256
|
},
|
|
@@ -1262,7 +1264,7 @@ const ft = Y.memo(
|
|
|
1262
1264
|
},
|
|
1263
1265
|
(t, r) => {
|
|
1264
1266
|
const n = r.selectedPropertyKey?.startsWith(r.namespace ?? ""), i = t.selectedPropertyKey?.startsWith(t.namespace ?? "");
|
|
1265
|
-
return n || i ? !1 :
|
|
1267
|
+
return n || i ? !1 : ve(t.properties, r.properties) && t.propertiesOrder === r.propertiesOrder && ve(t.additionalFields, r.additionalFields) && ve(t.errors, r.errors) && ve(t.onPropertyClick, r.onPropertyClick) && // equal(prevProps.onPropertyMove, nextProps.onPropertyMove) &&
|
|
1266
1268
|
// equal(prevProps.onPropertyRemove, nextProps.onPropertyRemove) &&
|
|
1267
1269
|
t.namespace === r.namespace && t.collectionEditable === r.collectionEditable;
|
|
1268
1270
|
}
|
|
@@ -1277,30 +1279,30 @@ function ki({
|
|
|
1277
1279
|
errors: d,
|
|
1278
1280
|
onPropertyClick: u,
|
|
1279
1281
|
onPropertyMove: p,
|
|
1280
|
-
onPropertyRemove:
|
|
1281
|
-
inferredPropertyKeys:
|
|
1282
|
-
collectionEditable:
|
|
1282
|
+
onPropertyRemove: h,
|
|
1283
|
+
inferredPropertyKeys: m,
|
|
1284
|
+
collectionEditable: c
|
|
1283
1285
|
}) {
|
|
1284
|
-
const
|
|
1285
|
-
let
|
|
1286
|
+
const g = m?.includes(r ? `${r}.${t}` : t), v = ae(t, r), y = ir(t, r) in d;
|
|
1287
|
+
let P;
|
|
1286
1288
|
if (typeof n == "object") {
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1289
|
+
const C = n;
|
|
1290
|
+
C.dataType === "map" && C.properties && (P = /* @__PURE__ */ e(
|
|
1289
1291
|
ft,
|
|
1290
1292
|
{
|
|
1291
1293
|
selectedPropertyKey: o,
|
|
1292
1294
|
namespace: v,
|
|
1293
|
-
properties:
|
|
1294
|
-
propertiesOrder:
|
|
1295
|
+
properties: C.properties,
|
|
1296
|
+
propertiesOrder: C.propertiesOrder,
|
|
1295
1297
|
errors: d,
|
|
1296
1298
|
onPropertyClick: u,
|
|
1297
1299
|
onPropertyMove: p,
|
|
1298
|
-
onPropertyRemove:
|
|
1299
|
-
collectionEditable:
|
|
1300
|
+
onPropertyRemove: h,
|
|
1301
|
+
collectionEditable: c
|
|
1300
1302
|
}
|
|
1301
1303
|
));
|
|
1302
1304
|
}
|
|
1303
|
-
const T = o === v, b = n && (
|
|
1305
|
+
const T = o === v, b = n && (c && !ne(n) || qe(n));
|
|
1304
1306
|
return /* @__PURE__ */ a(
|
|
1305
1307
|
"div",
|
|
1306
1308
|
{
|
|
@@ -1309,7 +1311,7 @@ function ki({
|
|
|
1309
1311
|
...l.dragHandleProps,
|
|
1310
1312
|
className: "relative -ml-8",
|
|
1311
1313
|
children: [
|
|
1312
|
-
|
|
1314
|
+
P && /* @__PURE__ */ e(
|
|
1313
1315
|
"div",
|
|
1314
1316
|
{
|
|
1315
1317
|
className: "absolute border-l " + wt,
|
|
@@ -1339,13 +1341,13 @@ function ki({
|
|
|
1339
1341
|
}
|
|
1340
1342
|
),
|
|
1341
1343
|
/* @__PURE__ */ a("div", { className: "absolute top-2 right-2 flex flex-row ", children: [
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
+
g && /* @__PURE__ */ e(te, { title: "Inferred property", children: /* @__PURE__ */ e(ht, { size: "small", className: "p-2" }) }),
|
|
1345
|
+
h && /* @__PURE__ */ e(te, { title: "Remove", children: /* @__PURE__ */ e(
|
|
1344
1346
|
oe,
|
|
1345
1347
|
{
|
|
1346
1348
|
size: "small",
|
|
1347
1349
|
color: "inherit",
|
|
1348
|
-
onClick: () =>
|
|
1350
|
+
onClick: () => h(t, r),
|
|
1349
1351
|
children: /* @__PURE__ */ e(Ur, { size: "small" })
|
|
1350
1352
|
}
|
|
1351
1353
|
) }),
|
|
@@ -1354,11 +1356,11 @@ function ki({
|
|
|
1354
1356
|
{
|
|
1355
1357
|
component: "span",
|
|
1356
1358
|
size: "small",
|
|
1357
|
-
children: /* @__PURE__ */ e(
|
|
1359
|
+
children: /* @__PURE__ */ e(jr, { size: "small" })
|
|
1358
1360
|
}
|
|
1359
1361
|
) })
|
|
1360
1362
|
] }),
|
|
1361
|
-
|
|
1363
|
+
P && /* @__PURE__ */ e("div", { className: "ml-16", children: P })
|
|
1362
1364
|
]
|
|
1363
1365
|
}
|
|
1364
1366
|
);
|
|
@@ -1367,42 +1369,44 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1367
1369
|
const {
|
|
1368
1370
|
values: o,
|
|
1369
1371
|
setFieldValue: d
|
|
1370
|
-
} = K(), [u, p] =
|
|
1371
|
-
id:
|
|
1372
|
-
property:
|
|
1372
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [c, g] = $(), v = o.propertiesOrder ?? Object.keys(o.properties ?? {}), x = ({
|
|
1373
|
+
id: N,
|
|
1374
|
+
property: f
|
|
1373
1375
|
}) => {
|
|
1374
|
-
if (!
|
|
1376
|
+
if (!N)
|
|
1375
1377
|
throw Error();
|
|
1376
1378
|
d("properties", {
|
|
1377
1379
|
...o.properties ?? {},
|
|
1378
|
-
[
|
|
1379
|
-
}, !1)
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1380
|
+
[N]: f
|
|
1381
|
+
}, !1);
|
|
1382
|
+
const w = o.propertiesOrder ?? Object.keys(o.properties ?? {}), _ = w.includes(N) ? w : [...w, N];
|
|
1383
|
+
d("propertiesOrder", _, !1), p(!1);
|
|
1384
|
+
}, y = Q((N, f) => {
|
|
1385
|
+
const w = N ? ae(N, f) : void 0;
|
|
1386
|
+
if (!w)
|
|
1383
1387
|
throw Error("collection editor miss config");
|
|
1384
|
-
const
|
|
1385
|
-
d(
|
|
1386
|
-
}, [d, o]),
|
|
1387
|
-
|
|
1388
|
-
{
|
|
1389
|
-
color: "primary",
|
|
1390
|
-
variant: "outlined",
|
|
1391
|
-
onClick: () => p(!0),
|
|
1392
|
-
startIcon: /* @__PURE__ */ e(me, {}),
|
|
1393
|
-
children: [
|
|
1394
|
-
"Add property to ",
|
|
1395
|
-
o.name ?? "this group"
|
|
1396
|
-
]
|
|
1397
|
-
}
|
|
1398
|
-
), P = !v || v.length < 1, O = Z((h, N) => {
|
|
1399
|
-
d(ye(N), h, !1);
|
|
1388
|
+
const _ = pe(w), M = ye(f), R = I(o, M) ?? Object.keys(I(o, bi(f)));
|
|
1389
|
+
d(_, void 0, !1), d(M, R.filter((D) => D !== N), !1), p(!1), m(void 0), g(void 0);
|
|
1390
|
+
}, [d, o]), P = h ? ae(h, c) : void 0, T = P ? I(o.properties, P.replaceAll(".", ".properties.")) : void 0, b = !v || v.length < 1, C = Q((N, f) => {
|
|
1391
|
+
d(ye(f), N, !1);
|
|
1400
1392
|
}, []);
|
|
1401
1393
|
return /* @__PURE__ */ a(U, { children: [
|
|
1402
1394
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1403
1395
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end my-4", children: [
|
|
1404
|
-
/* @__PURE__ */ e(
|
|
1405
|
-
|
|
1396
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Properties in this group" }),
|
|
1397
|
+
/* @__PURE__ */ a(
|
|
1398
|
+
z,
|
|
1399
|
+
{
|
|
1400
|
+
color: "primary",
|
|
1401
|
+
variant: "outlined",
|
|
1402
|
+
onClick: () => p(!0),
|
|
1403
|
+
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
1404
|
+
children: [
|
|
1405
|
+
"Add property to ",
|
|
1406
|
+
o.name ?? "this group"
|
|
1407
|
+
]
|
|
1408
|
+
}
|
|
1409
|
+
)
|
|
1406
1410
|
] }),
|
|
1407
1411
|
/* @__PURE__ */ a(Ce, { className: "p-2 pl-8", children: [
|
|
1408
1412
|
/* @__PURE__ */ e(
|
|
@@ -1412,14 +1416,14 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1412
1416
|
propertiesOrder: v,
|
|
1413
1417
|
errors: {},
|
|
1414
1418
|
collectionEditable: l,
|
|
1415
|
-
onPropertyClick: (
|
|
1416
|
-
|
|
1419
|
+
onPropertyClick: (N, f) => {
|
|
1420
|
+
m(N), g(f), p(!0);
|
|
1417
1421
|
},
|
|
1418
|
-
onPropertyMove:
|
|
1422
|
+
onPropertyMove: C
|
|
1419
1423
|
}
|
|
1420
1424
|
),
|
|
1421
|
-
|
|
1422
|
-
|
|
1425
|
+
b && /* @__PURE__ */ e(
|
|
1426
|
+
O,
|
|
1423
1427
|
{
|
|
1424
1428
|
variant: "label",
|
|
1425
1429
|
className: "h-full flex items-center justify-center p-4",
|
|
@@ -1430,12 +1434,12 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1430
1434
|
] }),
|
|
1431
1435
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1432
1436
|
/* @__PURE__ */ e(
|
|
1433
|
-
|
|
1437
|
+
ct,
|
|
1434
1438
|
{
|
|
1435
1439
|
position: "start",
|
|
1436
1440
|
size: "small",
|
|
1437
1441
|
label: "Spread children as columns",
|
|
1438
|
-
onValueChange: (
|
|
1442
|
+
onValueChange: (N) => d("spreadChildren", N),
|
|
1439
1443
|
value: o.spreadChildren ?? !1
|
|
1440
1444
|
}
|
|
1441
1445
|
),
|
|
@@ -1450,21 +1454,21 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1450
1454
|
allowDataInference: n,
|
|
1451
1455
|
collectionEditable: l,
|
|
1452
1456
|
onCancel: () => {
|
|
1453
|
-
p(!1),
|
|
1457
|
+
p(!1), m(void 0), g(void 0);
|
|
1454
1458
|
},
|
|
1455
1459
|
onOkClicked: () => {
|
|
1456
|
-
p(!1),
|
|
1460
|
+
p(!1), m(void 0), g(void 0);
|
|
1457
1461
|
},
|
|
1458
1462
|
getData: r,
|
|
1459
1463
|
onDelete: y,
|
|
1460
|
-
propertyKey:
|
|
1461
|
-
propertyNamespace:
|
|
1464
|
+
propertyKey: h,
|
|
1465
|
+
propertyNamespace: c,
|
|
1462
1466
|
property: T,
|
|
1463
|
-
existingProperty: !!
|
|
1464
|
-
autoUpdateId: !
|
|
1465
|
-
autoOpenTypeSelect: !
|
|
1466
|
-
onPropertyChanged:
|
|
1467
|
-
existingPropertyKeys:
|
|
1467
|
+
existingProperty: !!h,
|
|
1468
|
+
autoUpdateId: !h,
|
|
1469
|
+
autoOpenTypeSelect: !h,
|
|
1470
|
+
onPropertyChanged: x,
|
|
1471
|
+
existingPropertyKeys: h ? void 0 : v,
|
|
1468
1472
|
propertyConfigs: i
|
|
1469
1473
|
}
|
|
1470
1474
|
)
|
|
@@ -1482,25 +1486,25 @@ function Vi({
|
|
|
1482
1486
|
const {
|
|
1483
1487
|
values: u,
|
|
1484
1488
|
handleChange: p,
|
|
1485
|
-
errors:
|
|
1486
|
-
setFieldValue:
|
|
1487
|
-
touched:
|
|
1488
|
-
} = K(), [
|
|
1489
|
-
console.log("onPropertyChanged", b,
|
|
1490
|
-
}, T =
|
|
1489
|
+
errors: h,
|
|
1490
|
+
setFieldValue: m,
|
|
1491
|
+
touched: c
|
|
1492
|
+
} = K(), [g, v] = $(!1), x = I(u, "of"), y = I(c, "of") && I(h, "of"), P = ({ id: b, property: C, namespace: N }) => {
|
|
1493
|
+
console.log("onPropertyChanged", b, C, N), m("of", C);
|
|
1494
|
+
}, T = x && $e(x, o);
|
|
1491
1495
|
return /* @__PURE__ */ a(U, { children: [
|
|
1492
1496
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1493
|
-
/* @__PURE__ */ e(
|
|
1497
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Repeat component" }),
|
|
1494
1498
|
/* @__PURE__ */ e(
|
|
1495
1499
|
H,
|
|
1496
1500
|
{
|
|
1497
1501
|
name: "of",
|
|
1498
|
-
value:
|
|
1502
|
+
value: x,
|
|
1499
1503
|
children: ({}) => /* @__PURE__ */ a(Ce, { className: "p-2 mt-4", children: [
|
|
1500
|
-
|
|
1504
|
+
x && /* @__PURE__ */ e(
|
|
1501
1505
|
nr,
|
|
1502
1506
|
{
|
|
1503
|
-
property:
|
|
1507
|
+
property: x,
|
|
1504
1508
|
onClick: n ? void 0 : () => v(!0),
|
|
1505
1509
|
includeName: !1,
|
|
1506
1510
|
includeEditButton: !0,
|
|
@@ -1508,7 +1512,7 @@ function Vi({
|
|
|
1508
1512
|
hasError: !1
|
|
1509
1513
|
}
|
|
1510
1514
|
),
|
|
1511
|
-
!n && !
|
|
1515
|
+
!n && !x && /* @__PURE__ */ a(
|
|
1512
1516
|
z,
|
|
1513
1517
|
{
|
|
1514
1518
|
variant: "text",
|
|
@@ -1525,16 +1529,16 @@ function Vi({
|
|
|
1525
1529
|
Ve,
|
|
1526
1530
|
{
|
|
1527
1531
|
inArray: !0,
|
|
1528
|
-
open:
|
|
1532
|
+
open: g,
|
|
1529
1533
|
existingProperty: r,
|
|
1530
1534
|
getData: i,
|
|
1531
1535
|
autoUpdateId: !r,
|
|
1532
1536
|
autoOpenTypeSelect: !r,
|
|
1533
1537
|
onOkClicked: () => v(!1),
|
|
1534
1538
|
allowDataInference: l,
|
|
1535
|
-
property:
|
|
1539
|
+
property: x,
|
|
1536
1540
|
includeIdAndName: !1,
|
|
1537
|
-
onPropertyChanged:
|
|
1541
|
+
onPropertyChanged: P,
|
|
1538
1542
|
forceShowErrors: t,
|
|
1539
1543
|
propertyConfigs: o,
|
|
1540
1544
|
collectionEditable: d
|
|
@@ -1544,7 +1548,7 @@ function Vi({
|
|
|
1544
1548
|
}
|
|
1545
1549
|
)
|
|
1546
1550
|
] }),
|
|
1547
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1551
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Ot, { disabled: n }) }) })
|
|
1548
1552
|
] });
|
|
1549
1553
|
}
|
|
1550
1554
|
const Ii = Y.forwardRef(
|
|
@@ -1558,11 +1562,11 @@ const Ii = Y.forwardRef(
|
|
|
1558
1562
|
const {
|
|
1559
1563
|
errors: u,
|
|
1560
1564
|
values: p,
|
|
1561
|
-
setFieldValue:
|
|
1562
|
-
setFieldTouched:
|
|
1563
|
-
touched:
|
|
1564
|
-
validate:
|
|
1565
|
-
} = K(), v = "name",
|
|
1565
|
+
setFieldValue: h,
|
|
1566
|
+
setFieldTouched: m,
|
|
1567
|
+
touched: c,
|
|
1568
|
+
validate: g
|
|
1569
|
+
} = K(), v = "name", x = r && I(u, v), y = "id", P = r && I(u, y), T = "description", b = r && I(u, T);
|
|
1566
1570
|
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
1567
1571
|
/* @__PURE__ */ a("div", { children: [
|
|
1568
1572
|
/* @__PURE__ */ e(
|
|
@@ -1570,47 +1574,47 @@ const Ii = Y.forwardRef(
|
|
|
1570
1574
|
{
|
|
1571
1575
|
name: v,
|
|
1572
1576
|
inputRef: d,
|
|
1573
|
-
as:
|
|
1577
|
+
as: Z,
|
|
1574
1578
|
value: p[v],
|
|
1575
|
-
onChange: (
|
|
1576
|
-
const
|
|
1577
|
-
!I(
|
|
1579
|
+
onChange: (C) => {
|
|
1580
|
+
const N = C.target.value;
|
|
1581
|
+
!I(c, y) && l && h(y, N ? Pt(N) : "", !1), h(v, N, !0), m(v, !0);
|
|
1578
1582
|
},
|
|
1579
1583
|
style: { fontSize: 20 },
|
|
1580
1584
|
placeholder: "Field name",
|
|
1581
1585
|
required: !0,
|
|
1582
1586
|
disabled: i,
|
|
1583
|
-
error: !!
|
|
1587
|
+
error: !!x
|
|
1584
1588
|
}
|
|
1585
1589
|
),
|
|
1586
|
-
/* @__PURE__ */ e(X, { error: !!
|
|
1590
|
+
/* @__PURE__ */ e(X, { error: !!x, children: x })
|
|
1587
1591
|
] }),
|
|
1588
1592
|
/* @__PURE__ */ a("div", { children: [
|
|
1589
1593
|
/* @__PURE__ */ e(
|
|
1590
1594
|
H,
|
|
1591
1595
|
{
|
|
1592
1596
|
name: y,
|
|
1593
|
-
as:
|
|
1597
|
+
as: Z,
|
|
1594
1598
|
label: "ID",
|
|
1595
1599
|
value: p[y],
|
|
1596
|
-
onChange: (
|
|
1597
|
-
const
|
|
1598
|
-
!I(
|
|
1600
|
+
onChange: (C) => {
|
|
1601
|
+
const N = C.target.value;
|
|
1602
|
+
!I(c, v) && l && h(v, N ? ut(N) : ""), h(y, N, !0), m(y, !0);
|
|
1599
1603
|
},
|
|
1600
1604
|
disabled: n || i,
|
|
1601
1605
|
required: !0,
|
|
1602
1606
|
size: "small",
|
|
1603
|
-
error: !!
|
|
1607
|
+
error: !!P
|
|
1604
1608
|
}
|
|
1605
1609
|
),
|
|
1606
|
-
/* @__PURE__ */ e(X, { error: !!
|
|
1610
|
+
/* @__PURE__ */ e(X, { error: !!P, children: P })
|
|
1607
1611
|
] }),
|
|
1608
1612
|
/* @__PURE__ */ a("div", { children: [
|
|
1609
1613
|
/* @__PURE__ */ e(
|
|
1610
1614
|
H,
|
|
1611
1615
|
{
|
|
1612
1616
|
name: T,
|
|
1613
|
-
as:
|
|
1617
|
+
as: Z,
|
|
1614
1618
|
label: "Description",
|
|
1615
1619
|
disabled: i,
|
|
1616
1620
|
error: !!b
|
|
@@ -1628,9 +1632,9 @@ function _i({
|
|
|
1628
1632
|
}) {
|
|
1629
1633
|
const { values: i, setFieldValue: l } = K();
|
|
1630
1634
|
return /* @__PURE__ */ a(U, { children: [
|
|
1631
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
1635
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(Ne, { children: [
|
|
1632
1636
|
t === "text_field" && /* @__PURE__ */ e(
|
|
1633
|
-
|
|
1637
|
+
Ee,
|
|
1634
1638
|
{
|
|
1635
1639
|
disabled: r,
|
|
1636
1640
|
length: !0,
|
|
@@ -1644,7 +1648,7 @@ function _i({
|
|
|
1644
1648
|
}
|
|
1645
1649
|
),
|
|
1646
1650
|
t === "multiline" && /* @__PURE__ */ e(
|
|
1647
|
-
|
|
1651
|
+
Ee,
|
|
1648
1652
|
{
|
|
1649
1653
|
disabled: r,
|
|
1650
1654
|
length: !0,
|
|
@@ -1657,7 +1661,7 @@ function _i({
|
|
|
1657
1661
|
}
|
|
1658
1662
|
),
|
|
1659
1663
|
t === "markdown" && /* @__PURE__ */ e(
|
|
1660
|
-
|
|
1664
|
+
Ee,
|
|
1661
1665
|
{
|
|
1662
1666
|
disabled: r,
|
|
1663
1667
|
length: !0,
|
|
@@ -1670,7 +1674,7 @@ function _i({
|
|
|
1670
1674
|
}
|
|
1671
1675
|
),
|
|
1672
1676
|
t === "email" && /* @__PURE__ */ e(
|
|
1673
|
-
|
|
1677
|
+
Ee,
|
|
1674
1678
|
{
|
|
1675
1679
|
disabled: r,
|
|
1676
1680
|
max: !0,
|
|
@@ -1697,7 +1701,7 @@ function _i({
|
|
|
1697
1701
|
function Fi({ disabled: t }) {
|
|
1698
1702
|
const { values: r } = K(), n = I(r, "defaultValue");
|
|
1699
1703
|
return /* @__PURE__ */ a(U, { children: [
|
|
1700
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1704
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Se, { disabled: t }) }) }),
|
|
1701
1705
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1702
1706
|
H,
|
|
1703
1707
|
{
|
|
@@ -1720,42 +1724,44 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1720
1724
|
const {
|
|
1721
1725
|
values: o,
|
|
1722
1726
|
setFieldValue: d
|
|
1723
|
-
} = K(), [u, p] =
|
|
1724
|
-
id:
|
|
1725
|
-
property:
|
|
1727
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [c, g] = $(), v = ({
|
|
1728
|
+
id: C,
|
|
1729
|
+
property: N
|
|
1726
1730
|
}) => {
|
|
1727
|
-
if (!
|
|
1731
|
+
if (!C)
|
|
1728
1732
|
throw Error();
|
|
1729
1733
|
d("oneOf.properties", {
|
|
1730
1734
|
...o.oneOf?.properties ?? {},
|
|
1731
|
-
[
|
|
1732
|
-
}, !1)
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1735
|
+
[C]: N
|
|
1736
|
+
}, !1);
|
|
1737
|
+
const f = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), w = f.includes(C) ? f : [...f, C];
|
|
1738
|
+
d("oneOf.propertiesOrder", w, !1), p(!1);
|
|
1739
|
+
}, x = h ? ae(h, c) : void 0, y = x ? I(o.oneOf?.properties, x.replaceAll(".", ".properties.")) : void 0, P = Q((C, N) => {
|
|
1740
|
+
const f = C ? ae(C, N) : void 0;
|
|
1741
|
+
if (!f)
|
|
1736
1742
|
throw Error("collection editor miss config");
|
|
1737
|
-
d(`oneOf.${
|
|
1738
|
-
const
|
|
1739
|
-
d(
|
|
1743
|
+
d(`oneOf.${pe(f)}`, void 0, !1);
|
|
1744
|
+
const w = `oneOf.${ye(N)}`, _ = I(o, w);
|
|
1745
|
+
d(w, _.filter((M) => M !== C), !1), p(!1), m(void 0), g(void 0);
|
|
1740
1746
|
}, [d, o]), T = /* @__PURE__ */ a(
|
|
1741
1747
|
z,
|
|
1742
1748
|
{
|
|
1743
1749
|
autoFocus: !0,
|
|
1744
1750
|
color: "primary",
|
|
1745
1751
|
onClick: () => p(!0),
|
|
1746
|
-
startIcon: /* @__PURE__ */ e(
|
|
1752
|
+
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
1747
1753
|
children: [
|
|
1748
1754
|
"Add property to ",
|
|
1749
1755
|
o.name ?? "this block"
|
|
1750
1756
|
]
|
|
1751
1757
|
}
|
|
1752
|
-
), b =
|
|
1753
|
-
d(`oneOf.${ye(
|
|
1758
|
+
), b = Q((C, N) => {
|
|
1759
|
+
d(`oneOf.${ye(N)}`, C, !1);
|
|
1754
1760
|
}, []);
|
|
1755
1761
|
return /* @__PURE__ */ a(U, { children: [
|
|
1756
1762
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1757
1763
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end mt-8 mb-4", children: [
|
|
1758
|
-
/* @__PURE__ */ e(
|
|
1764
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Properties in this block" }),
|
|
1759
1765
|
T
|
|
1760
1766
|
] }),
|
|
1761
1767
|
/* @__PURE__ */ a(Ce, { className: "p-2 pl-8", children: [
|
|
@@ -1766,8 +1772,8 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1766
1772
|
propertiesOrder: o.oneOf?.propertiesOrder,
|
|
1767
1773
|
errors: {},
|
|
1768
1774
|
collectionEditable: l,
|
|
1769
|
-
onPropertyClick: t ? void 0 : (
|
|
1770
|
-
|
|
1775
|
+
onPropertyClick: t ? void 0 : (C, N) => {
|
|
1776
|
+
m(C), g(N), p(!0);
|
|
1771
1777
|
},
|
|
1772
1778
|
onPropertyMove: t ? void 0 : b
|
|
1773
1779
|
}
|
|
@@ -1784,21 +1790,21 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1784
1790
|
getData: r,
|
|
1785
1791
|
allowDataInference: n,
|
|
1786
1792
|
onCancel: () => {
|
|
1787
|
-
p(!1),
|
|
1793
|
+
p(!1), m(void 0), g(void 0);
|
|
1788
1794
|
},
|
|
1789
1795
|
onOkClicked: () => {
|
|
1790
|
-
p(!1),
|
|
1796
|
+
p(!1), m(void 0), g(void 0);
|
|
1791
1797
|
},
|
|
1792
1798
|
collectionEditable: l,
|
|
1793
|
-
onDelete:
|
|
1794
|
-
propertyKey:
|
|
1795
|
-
propertyNamespace:
|
|
1799
|
+
onDelete: P,
|
|
1800
|
+
propertyKey: h,
|
|
1801
|
+
propertyNamespace: c,
|
|
1796
1802
|
property: y,
|
|
1797
|
-
existingProperty: !!
|
|
1798
|
-
autoUpdateId: !
|
|
1799
|
-
autoOpenTypeSelect: !
|
|
1803
|
+
existingProperty: !!h,
|
|
1804
|
+
autoUpdateId: !h,
|
|
1805
|
+
autoOpenTypeSelect: !h,
|
|
1800
1806
|
onPropertyChanged: v,
|
|
1801
|
-
existingPropertyKeys:
|
|
1807
|
+
existingPropertyKeys: h ? void 0 : o.oneOf?.propertiesOrder,
|
|
1802
1808
|
propertyConfigs: i
|
|
1803
1809
|
}
|
|
1804
1810
|
)
|
|
@@ -1808,11 +1814,11 @@ function Ei({ disabled: t }) {
|
|
|
1808
1814
|
const {
|
|
1809
1815
|
values: r,
|
|
1810
1816
|
handleChange: n
|
|
1811
|
-
} = K(), i = "validation.min", l = "validation.max", o = "validation.lessThan", d = "validation.moreThan"
|
|
1817
|
+
} = K(), i = "validation.min", l = "validation.max", o = "validation.lessThan", d = "validation.moreThan";
|
|
1812
1818
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
1813
|
-
/* @__PURE__ */ e(
|
|
1819
|
+
/* @__PURE__ */ e(Se, { disabled: t }),
|
|
1814
1820
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1815
|
-
|
|
1821
|
+
Z,
|
|
1816
1822
|
{
|
|
1817
1823
|
value: I(r, i),
|
|
1818
1824
|
label: "Min value",
|
|
@@ -1824,7 +1830,7 @@ function Ei({ disabled: t }) {
|
|
|
1824
1830
|
}
|
|
1825
1831
|
) }),
|
|
1826
1832
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1827
|
-
|
|
1833
|
+
Z,
|
|
1828
1834
|
{
|
|
1829
1835
|
value: I(r, l),
|
|
1830
1836
|
label: "Max value",
|
|
@@ -1836,7 +1842,7 @@ function Ei({ disabled: t }) {
|
|
|
1836
1842
|
}
|
|
1837
1843
|
) }),
|
|
1838
1844
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1839
|
-
|
|
1845
|
+
Z,
|
|
1840
1846
|
{
|
|
1841
1847
|
value: I(r, o),
|
|
1842
1848
|
label: "Less than",
|
|
@@ -1848,7 +1854,7 @@ function Ei({ disabled: t }) {
|
|
|
1848
1854
|
}
|
|
1849
1855
|
) }),
|
|
1850
1856
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1851
|
-
|
|
1857
|
+
Z,
|
|
1852
1858
|
{
|
|
1853
1859
|
value: I(r, d),
|
|
1854
1860
|
label: "More than",
|
|
@@ -1862,15 +1868,15 @@ function Ei({ disabled: t }) {
|
|
|
1862
1868
|
/* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
1863
1869
|
H,
|
|
1864
1870
|
{
|
|
1865
|
-
name:
|
|
1871
|
+
name: "validation.positive",
|
|
1866
1872
|
type: "checkbox",
|
|
1867
|
-
children: ({ field:
|
|
1873
|
+
children: ({ field: m, form: c }) => /* @__PURE__ */ e(
|
|
1868
1874
|
se,
|
|
1869
1875
|
{
|
|
1870
1876
|
label: "Positive value",
|
|
1871
1877
|
disabled: t,
|
|
1872
|
-
form:
|
|
1873
|
-
field:
|
|
1878
|
+
form: c,
|
|
1879
|
+
field: m
|
|
1874
1880
|
}
|
|
1875
1881
|
)
|
|
1876
1882
|
}
|
|
@@ -1878,15 +1884,15 @@ function Ei({ disabled: t }) {
|
|
|
1878
1884
|
/* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
1879
1885
|
H,
|
|
1880
1886
|
{
|
|
1881
|
-
name:
|
|
1887
|
+
name: "validation.negative",
|
|
1882
1888
|
type: "checkbox",
|
|
1883
|
-
children: ({ field:
|
|
1889
|
+
children: ({ field: m, form: c }) => /* @__PURE__ */ e(
|
|
1884
1890
|
se,
|
|
1885
1891
|
{
|
|
1886
1892
|
label: "Negative value",
|
|
1887
1893
|
disabled: t,
|
|
1888
|
-
form:
|
|
1889
|
-
field:
|
|
1894
|
+
form: c,
|
|
1895
|
+
field: m
|
|
1890
1896
|
}
|
|
1891
1897
|
)
|
|
1892
1898
|
}
|
|
@@ -1894,15 +1900,15 @@ function Ei({ disabled: t }) {
|
|
|
1894
1900
|
/* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
1895
1901
|
H,
|
|
1896
1902
|
{
|
|
1897
|
-
name:
|
|
1903
|
+
name: "validation.integer",
|
|
1898
1904
|
type: "checkbox",
|
|
1899
|
-
children: ({ field:
|
|
1905
|
+
children: ({ field: m, form: c }) => /* @__PURE__ */ e(
|
|
1900
1906
|
se,
|
|
1901
1907
|
{
|
|
1902
1908
|
label: "Integer value",
|
|
1903
1909
|
disabled: t,
|
|
1904
|
-
form:
|
|
1905
|
-
field:
|
|
1910
|
+
form: c,
|
|
1911
|
+
field: m
|
|
1906
1912
|
}
|
|
1907
1913
|
)
|
|
1908
1914
|
}
|
|
@@ -1912,7 +1918,7 @@ function Ei({ disabled: t }) {
|
|
|
1912
1918
|
function Ai({ disabled: t }) {
|
|
1913
1919
|
const { values: r, setFieldValue: n } = K();
|
|
1914
1920
|
return /* @__PURE__ */ a(U, { children: [
|
|
1915
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1921
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Ei, { disabled: t }) }) }),
|
|
1916
1922
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1917
1923
|
Oe,
|
|
1918
1924
|
{
|
|
@@ -1928,7 +1934,7 @@ function Ai({ disabled: t }) {
|
|
|
1928
1934
|
) })
|
|
1929
1935
|
] });
|
|
1930
1936
|
}
|
|
1931
|
-
function
|
|
1937
|
+
function jt({
|
|
1932
1938
|
existing: t,
|
|
1933
1939
|
multiple: r,
|
|
1934
1940
|
disabled: n,
|
|
@@ -1939,9 +1945,9 @@ function qt({
|
|
|
1939
1945
|
handleChange: o,
|
|
1940
1946
|
errors: d
|
|
1941
1947
|
} = K();
|
|
1942
|
-
if (!
|
|
1943
|
-
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1944
|
-
const p = r ? "of.path" : "path",
|
|
1948
|
+
if (!Pe())
|
|
1949
|
+
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(De, {}) });
|
|
1950
|
+
const p = r ? "of.path" : "path", h = I(l, p), m = i && I(d, p);
|
|
1945
1951
|
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1946
1952
|
H,
|
|
1947
1953
|
{
|
|
@@ -1949,8 +1955,8 @@ function qt({
|
|
|
1949
1955
|
pathPath: p,
|
|
1950
1956
|
type: "select",
|
|
1951
1957
|
disabled: t || n,
|
|
1952
|
-
value:
|
|
1953
|
-
error:
|
|
1958
|
+
value: h,
|
|
1959
|
+
error: m,
|
|
1954
1960
|
handleChange: o,
|
|
1955
1961
|
as: Di
|
|
1956
1962
|
}
|
|
@@ -1964,12 +1970,12 @@ function Di({
|
|
|
1964
1970
|
error: l,
|
|
1965
1971
|
...o
|
|
1966
1972
|
}) {
|
|
1967
|
-
const d =
|
|
1973
|
+
const d = Pe();
|
|
1968
1974
|
if (!d)
|
|
1969
|
-
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1975
|
+
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(De, {}) });
|
|
1970
1976
|
const u = d?.collections ?? [], p = Array.from(new Set(
|
|
1971
|
-
Object.values(u).map((
|
|
1972
|
-
).values()),
|
|
1977
|
+
Object.values(u).map((m) => m.group).filter(Boolean)
|
|
1978
|
+
).values()), h = u.filter((m) => !m.group);
|
|
1973
1979
|
return /* @__PURE__ */ a(U, { children: [
|
|
1974
1980
|
/* @__PURE__ */ a(
|
|
1975
1981
|
be,
|
|
@@ -1981,64 +1987,64 @@ function Di({
|
|
|
1981
1987
|
name: r,
|
|
1982
1988
|
onChange: i,
|
|
1983
1989
|
label: "Target collection",
|
|
1984
|
-
renderValue: (
|
|
1985
|
-
const
|
|
1986
|
-
return
|
|
1987
|
-
/* @__PURE__ */ e(ot, { collectionOrView:
|
|
1990
|
+
renderValue: (m) => {
|
|
1991
|
+
const c = u.find((g) => g.id === m || g.path === m);
|
|
1992
|
+
return c ? /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
1993
|
+
/* @__PURE__ */ e(ot, { collectionOrView: c }),
|
|
1988
1994
|
/* @__PURE__ */ e(
|
|
1989
|
-
|
|
1995
|
+
O,
|
|
1990
1996
|
{
|
|
1991
1997
|
variant: "subtitle2",
|
|
1992
1998
|
className: "font-medium ml-4",
|
|
1993
|
-
children:
|
|
1999
|
+
children: c?.name.toUpperCase()
|
|
1994
2000
|
}
|
|
1995
2001
|
)
|
|
1996
2002
|
] }) : null;
|
|
1997
2003
|
},
|
|
1998
2004
|
...o,
|
|
1999
2005
|
children: [
|
|
2000
|
-
p.flatMap((
|
|
2006
|
+
p.flatMap((m) => /* @__PURE__ */ e(
|
|
2001
2007
|
At,
|
|
2002
2008
|
{
|
|
2003
|
-
label:
|
|
2004
|
-
children: u.filter((
|
|
2009
|
+
label: m || "Views",
|
|
2010
|
+
children: u.filter((c) => c.group === m).map((c) => /* @__PURE__ */ e(
|
|
2005
2011
|
ee,
|
|
2006
2012
|
{
|
|
2007
|
-
value:
|
|
2013
|
+
value: c.id ?? c.path,
|
|
2008
2014
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2009
|
-
/* @__PURE__ */ e(ot, { collectionOrView:
|
|
2015
|
+
/* @__PURE__ */ e(ot, { collectionOrView: c }),
|
|
2010
2016
|
/* @__PURE__ */ e(
|
|
2011
|
-
|
|
2017
|
+
O,
|
|
2012
2018
|
{
|
|
2013
2019
|
variant: "subtitle2",
|
|
2014
2020
|
className: "font-medium ml-4",
|
|
2015
|
-
children:
|
|
2021
|
+
children: c?.name.toUpperCase()
|
|
2016
2022
|
}
|
|
2017
2023
|
)
|
|
2018
2024
|
] })
|
|
2019
2025
|
},
|
|
2020
|
-
`${
|
|
2026
|
+
`${c.id ?? c.path}-${m}`
|
|
2021
2027
|
))
|
|
2022
2028
|
},
|
|
2023
|
-
`group_${
|
|
2029
|
+
`group_${m}`
|
|
2024
2030
|
)),
|
|
2025
|
-
|
|
2031
|
+
h && /* @__PURE__ */ e(At, { label: "Views", children: h.map((m) => /* @__PURE__ */ e(
|
|
2026
2032
|
ee,
|
|
2027
2033
|
{
|
|
2028
|
-
value:
|
|
2034
|
+
value: m.id ?? m.path,
|
|
2029
2035
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2030
|
-
/* @__PURE__ */ e(ot, { collectionOrView:
|
|
2036
|
+
/* @__PURE__ */ e(ot, { collectionOrView: m }),
|
|
2031
2037
|
/* @__PURE__ */ e(
|
|
2032
|
-
|
|
2038
|
+
O,
|
|
2033
2039
|
{
|
|
2034
2040
|
variant: "subtitle2",
|
|
2035
2041
|
className: "font-medium ml-4",
|
|
2036
|
-
children:
|
|
2042
|
+
children: m?.name.toUpperCase()
|
|
2037
2043
|
}
|
|
2038
2044
|
)
|
|
2039
2045
|
] })
|
|
2040
2046
|
},
|
|
2041
|
-
|
|
2047
|
+
m.id ?? m.path
|
|
2042
2048
|
)) })
|
|
2043
2049
|
]
|
|
2044
2050
|
}
|
|
@@ -2052,7 +2058,7 @@ function Bi({ disabled: t }) {
|
|
|
2052
2058
|
errors: n,
|
|
2053
2059
|
touched: i,
|
|
2054
2060
|
setFieldValue: l
|
|
2055
|
-
} = K(), o = "mode", d = I(r, o), u = I(i, o) && I(n, o), p = "autoValue",
|
|
2061
|
+
} = K(), o = "mode", d = I(r, o), u = I(i, o) && I(n, o), p = "autoValue", h = I(r, p), m = I(i, p) && I(n, p);
|
|
2056
2062
|
return /* @__PURE__ */ a(U, { children: [
|
|
2057
2063
|
/* @__PURE__ */ a("div", { className: "flex flex-col col-span-12", children: [
|
|
2058
2064
|
/* @__PURE__ */ a(
|
|
@@ -2061,10 +2067,10 @@ function Bi({ disabled: t }) {
|
|
|
2061
2067
|
name: o,
|
|
2062
2068
|
value: d ?? "date",
|
|
2063
2069
|
error: !!u,
|
|
2064
|
-
onValueChange: (
|
|
2070
|
+
onValueChange: (c) => l(o, c),
|
|
2065
2071
|
label: "Mode",
|
|
2066
|
-
renderValue: (
|
|
2067
|
-
switch (
|
|
2072
|
+
renderValue: (c) => {
|
|
2073
|
+
switch (c) {
|
|
2068
2074
|
case "date_time":
|
|
2069
2075
|
return "Date/Time";
|
|
2070
2076
|
case "date":
|
|
@@ -2086,10 +2092,10 @@ function Bi({ disabled: t }) {
|
|
|
2086
2092
|
{
|
|
2087
2093
|
name: p,
|
|
2088
2094
|
disabled: t,
|
|
2089
|
-
value:
|
|
2090
|
-
onValueChange: (
|
|
2091
|
-
renderValue: (
|
|
2092
|
-
switch (
|
|
2095
|
+
value: h ?? "",
|
|
2096
|
+
onValueChange: (c) => l(p, c),
|
|
2097
|
+
renderValue: (c) => {
|
|
2098
|
+
switch (c) {
|
|
2093
2099
|
case "on_create":
|
|
2094
2100
|
return "On create";
|
|
2095
2101
|
case "on_update":
|
|
@@ -2098,7 +2104,7 @@ function Bi({ disabled: t }) {
|
|
|
2098
2104
|
return "None";
|
|
2099
2105
|
}
|
|
2100
2106
|
},
|
|
2101
|
-
error: !!
|
|
2107
|
+
error: !!m,
|
|
2102
2108
|
label: "Automatic value",
|
|
2103
2109
|
children: [
|
|
2104
2110
|
/* @__PURE__ */ e(ee, { value: "", children: " None " }),
|
|
@@ -2107,9 +2113,9 @@ function Bi({ disabled: t }) {
|
|
|
2107
2113
|
]
|
|
2108
2114
|
}
|
|
2109
2115
|
),
|
|
2110
|
-
/* @__PURE__ */ e(X, { error: !!
|
|
2116
|
+
/* @__PURE__ */ e(X, { error: !!m, children: m ?? "Update this field automatically when creating or updating the entity" })
|
|
2111
2117
|
] }),
|
|
2112
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2118
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Se, { disabled: t }) }) })
|
|
2113
2119
|
] });
|
|
2114
2120
|
}
|
|
2115
2121
|
function zi({ disabled: t }) {
|
|
@@ -2144,7 +2150,7 @@ function zi({ disabled: t }) {
|
|
|
2144
2150
|
] });
|
|
2145
2151
|
}
|
|
2146
2152
|
function Mi({ disabled: t }) {
|
|
2147
|
-
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2153
|
+
return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Se, { disabled: t }) }) }) });
|
|
2148
2154
|
}
|
|
2149
2155
|
function ar(t, r, n) {
|
|
2150
2156
|
let i;
|
|
@@ -2368,16 +2374,16 @@ function or({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
|
2368
2374
|
children: /* @__PURE__ */ a(
|
|
2369
2375
|
"div",
|
|
2370
2376
|
{
|
|
2371
|
-
className:
|
|
2377
|
+
className: me(
|
|
2372
2378
|
"flex flex-row items-center text-base min-h-[52px]",
|
|
2373
2379
|
r ? "w-full" : ""
|
|
2374
2380
|
),
|
|
2375
2381
|
children: [
|
|
2376
|
-
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(
|
|
2382
|
+
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(Ye, { propertyConfig: n }) }),
|
|
2377
2383
|
/* @__PURE__ */ a("div", { children: [
|
|
2378
2384
|
/* @__PURE__ */ e("div", { children: n.name }),
|
|
2379
2385
|
/* @__PURE__ */ e(
|
|
2380
|
-
|
|
2386
|
+
O,
|
|
2381
2387
|
{
|
|
2382
2388
|
variant: "caption",
|
|
2383
2389
|
color: "disabled",
|
|
@@ -2428,8 +2434,8 @@ function Ri({
|
|
|
2428
2434
|
]
|
|
2429
2435
|
}
|
|
2430
2436
|
) }),
|
|
2431
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2432
|
-
|
|
2437
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
|
|
2438
|
+
Ee,
|
|
2433
2439
|
{
|
|
2434
2440
|
disabled: t,
|
|
2435
2441
|
max: !0,
|
|
@@ -2473,7 +2479,7 @@ const Ui = [
|
|
|
2473
2479
|
"key_value",
|
|
2474
2480
|
"repeat",
|
|
2475
2481
|
"block"
|
|
2476
|
-
], lr = Object.entries(
|
|
2482
|
+
], lr = Object.entries(Gt).filter(([t]) => Ui.includes(t)).map(([t, r]) => ({ [t]: r })).reduce((t, r) => ({ ...t, ...r }), {}), sr = Y.memo(
|
|
2477
2483
|
function(r) {
|
|
2478
2484
|
const {
|
|
2479
2485
|
includeIdAndName: n = !0,
|
|
@@ -2483,95 +2489,95 @@ const Ui = [
|
|
|
2483
2489
|
inArray: d,
|
|
2484
2490
|
propertyKey: u,
|
|
2485
2491
|
existingPropertyKeys: p,
|
|
2486
|
-
propertyNamespace:
|
|
2487
|
-
property:
|
|
2488
|
-
onPropertyChanged:
|
|
2489
|
-
onPropertyChangedImmediate:
|
|
2492
|
+
propertyNamespace: h,
|
|
2493
|
+
property: m,
|
|
2494
|
+
onPropertyChanged: c,
|
|
2495
|
+
onPropertyChangedImmediate: g = !0,
|
|
2490
2496
|
onDelete: v,
|
|
2491
|
-
onError:
|
|
2497
|
+
onError: x,
|
|
2492
2498
|
initialErrors: y,
|
|
2493
|
-
forceShowErrors:
|
|
2499
|
+
forceShowErrors: P,
|
|
2494
2500
|
allowDataInference: T,
|
|
2495
2501
|
getController: b,
|
|
2496
|
-
getData:
|
|
2497
|
-
propertyConfigs:
|
|
2498
|
-
collectionEditable:
|
|
2499
|
-
} = r,
|
|
2502
|
+
getData: C,
|
|
2503
|
+
propertyConfigs: N,
|
|
2504
|
+
collectionEditable: f
|
|
2505
|
+
} = r, w = {
|
|
2500
2506
|
id: "",
|
|
2501
2507
|
name: ""
|
|
2502
|
-
},
|
|
2508
|
+
}, _ = !!(m && !qe(m)) && !f, M = Le(m ? {
|
|
2503
2509
|
id: u,
|
|
2504
2510
|
previousId: u,
|
|
2505
|
-
property:
|
|
2506
|
-
} : void 0),
|
|
2507
|
-
id:
|
|
2508
|
-
property:
|
|
2511
|
+
property: m
|
|
2512
|
+
} : void 0), R = ({
|
|
2513
|
+
id: A,
|
|
2514
|
+
property: s
|
|
2509
2515
|
}) => {
|
|
2510
|
-
const
|
|
2511
|
-
id:
|
|
2512
|
-
previousId:
|
|
2513
|
-
property:
|
|
2514
|
-
namespace:
|
|
2516
|
+
const V = {
|
|
2517
|
+
id: A,
|
|
2518
|
+
previousId: M.current?.id,
|
|
2519
|
+
property: s,
|
|
2520
|
+
namespace: h
|
|
2515
2521
|
};
|
|
2516
|
-
|
|
2517
|
-
},
|
|
2518
|
-
initialValues:
|
|
2522
|
+
M.current = V, c?.(V);
|
|
2523
|
+
}, D = Tt({
|
|
2524
|
+
initialValues: m ? { id: u, ...m } : w,
|
|
2519
2525
|
initialErrors: y,
|
|
2520
2526
|
validateOnChange: !0,
|
|
2521
2527
|
validateOnInitialRender: !0,
|
|
2522
|
-
onSubmit: (
|
|
2523
|
-
console.debug("onSubmit",
|
|
2528
|
+
onSubmit: (A, s) => {
|
|
2529
|
+
console.debug("onSubmit", A);
|
|
2524
2530
|
const {
|
|
2525
|
-
id:
|
|
2531
|
+
id: V,
|
|
2526
2532
|
...G
|
|
2527
|
-
} =
|
|
2528
|
-
|
|
2529
|
-
id:
|
|
2533
|
+
} = A;
|
|
2534
|
+
R({
|
|
2535
|
+
id: V,
|
|
2530
2536
|
property: { ...G, editable: G.editable ?? !0 }
|
|
2531
|
-
}), l ||
|
|
2537
|
+
}), l || s.resetForm({ values: w });
|
|
2532
2538
|
},
|
|
2533
|
-
validation: (
|
|
2534
|
-
const
|
|
2539
|
+
validation: (A) => {
|
|
2540
|
+
const s = {};
|
|
2535
2541
|
if (n) {
|
|
2536
|
-
if (!
|
|
2537
|
-
|
|
2542
|
+
if (!A.name)
|
|
2543
|
+
s.name = "Required";
|
|
2538
2544
|
else {
|
|
2539
|
-
const
|
|
2540
|
-
|
|
2545
|
+
const V = $i(A.name);
|
|
2546
|
+
V && (s.name = V);
|
|
2541
2547
|
}
|
|
2542
|
-
if (!
|
|
2543
|
-
|
|
2548
|
+
if (!A.id)
|
|
2549
|
+
s.id = "Required";
|
|
2544
2550
|
else {
|
|
2545
|
-
const
|
|
2546
|
-
|
|
2551
|
+
const V = qi(A.id, p);
|
|
2552
|
+
V && (s.id = V);
|
|
2547
2553
|
}
|
|
2548
2554
|
}
|
|
2549
|
-
return
|
|
2555
|
+
return A.dataType === "string" && A.validation?.matches && !Pr(A.validation?.matches.toString()) && (s.validation = {
|
|
2550
2556
|
matches: "Invalid regular expression"
|
|
2551
|
-
}),
|
|
2557
|
+
}), A.dataType === "reference" && !A.path && (s.path = "You must specify a target collection for the field"), A.propertyConfig === "repeat" && (A.of || (s.of = "You need to specify a repeat field")), A.propertyConfig === "block" && (A.oneOf || (s.oneOf = "You need to specify the properties of this block")), s;
|
|
2552
2558
|
}
|
|
2553
2559
|
});
|
|
2554
|
-
return
|
|
2555
|
-
b?.(
|
|
2556
|
-
}, [
|
|
2557
|
-
|
|
2560
|
+
return ce(() => {
|
|
2561
|
+
b?.(D);
|
|
2562
|
+
}, [D, b]), /* @__PURE__ */ e(kt, { value: D, children: /* @__PURE__ */ e(
|
|
2563
|
+
ji,
|
|
2558
2564
|
{
|
|
2559
|
-
onPropertyChanged:
|
|
2565
|
+
onPropertyChanged: g ? R : void 0,
|
|
2560
2566
|
onDelete: v,
|
|
2561
2567
|
includeIdAndTitle: n,
|
|
2562
|
-
propertyNamespace:
|
|
2563
|
-
onError:
|
|
2564
|
-
showErrors:
|
|
2568
|
+
propertyNamespace: h,
|
|
2569
|
+
onError: x,
|
|
2570
|
+
showErrors: P || D.submitCount > 0,
|
|
2565
2571
|
existing: l,
|
|
2566
2572
|
autoUpdateId: o,
|
|
2567
2573
|
inArray: d,
|
|
2568
2574
|
autoOpenTypeSelect: i,
|
|
2569
|
-
disabled:
|
|
2570
|
-
getData:
|
|
2575
|
+
disabled: _,
|
|
2576
|
+
getData: C,
|
|
2571
2577
|
allowDataInference: T,
|
|
2572
|
-
propertyConfigs:
|
|
2573
|
-
collectionEditable:
|
|
2574
|
-
...
|
|
2578
|
+
propertyConfigs: N,
|
|
2579
|
+
collectionEditable: f,
|
|
2580
|
+
...D
|
|
2575
2581
|
}
|
|
2576
2582
|
) });
|
|
2577
2583
|
},
|
|
@@ -2586,9 +2592,9 @@ function Ve({
|
|
|
2586
2592
|
collectionEditable: o,
|
|
2587
2593
|
...d
|
|
2588
2594
|
}) {
|
|
2589
|
-
const u =
|
|
2595
|
+
const u = Le();
|
|
2590
2596
|
return /* @__PURE__ */ e(
|
|
2591
|
-
|
|
2597
|
+
Fe,
|
|
2592
2598
|
{
|
|
2593
2599
|
open: t ?? !1,
|
|
2594
2600
|
maxWidth: "xl",
|
|
@@ -2598,26 +2604,26 @@ function Ve({
|
|
|
2598
2604
|
{
|
|
2599
2605
|
noValidate: !0,
|
|
2600
2606
|
autoComplete: "off",
|
|
2601
|
-
onSubmit: (
|
|
2602
|
-
|
|
2607
|
+
onSubmit: (h) => {
|
|
2608
|
+
h.preventDefault(), h.stopPropagation(), u.current?.handleSubmit(h);
|
|
2603
2609
|
},
|
|
2604
2610
|
children: [
|
|
2605
|
-
/* @__PURE__ */ e(
|
|
2611
|
+
/* @__PURE__ */ e(Be, { children: /* @__PURE__ */ e(
|
|
2606
2612
|
sr,
|
|
2607
2613
|
{
|
|
2608
2614
|
...d,
|
|
2609
|
-
onPropertyChanged: (
|
|
2610
|
-
i?.(
|
|
2615
|
+
onPropertyChanged: (h) => {
|
|
2616
|
+
i?.(h), n?.();
|
|
2611
2617
|
},
|
|
2612
2618
|
collectionEditable: o,
|
|
2613
2619
|
onPropertyChangedImmediate: !1,
|
|
2614
|
-
getController: (
|
|
2615
|
-
u.current =
|
|
2620
|
+
getController: (h) => {
|
|
2621
|
+
u.current = h;
|
|
2616
2622
|
},
|
|
2617
2623
|
getData: l
|
|
2618
2624
|
}
|
|
2619
2625
|
) }),
|
|
2620
|
-
/* @__PURE__ */ a(
|
|
2626
|
+
/* @__PURE__ */ a(ze, { children: [
|
|
2621
2627
|
r && /* @__PURE__ */ e(
|
|
2622
2628
|
z,
|
|
2623
2629
|
{
|
|
@@ -2644,7 +2650,7 @@ function Ve({
|
|
|
2644
2650
|
}
|
|
2645
2651
|
);
|
|
2646
2652
|
}
|
|
2647
|
-
function
|
|
2653
|
+
function ji({
|
|
2648
2654
|
values: t,
|
|
2649
2655
|
errors: r,
|
|
2650
2656
|
setValues: n,
|
|
@@ -2654,134 +2660,134 @@ function qi({
|
|
|
2654
2660
|
includeIdAndTitle: d,
|
|
2655
2661
|
onPropertyChanged: u,
|
|
2656
2662
|
onDelete: p,
|
|
2657
|
-
propertyNamespace:
|
|
2658
|
-
onError:
|
|
2659
|
-
showErrors:
|
|
2660
|
-
disabled:
|
|
2663
|
+
propertyNamespace: h,
|
|
2664
|
+
onError: m,
|
|
2665
|
+
showErrors: c,
|
|
2666
|
+
disabled: g,
|
|
2661
2667
|
inArray: v,
|
|
2662
|
-
getData:
|
|
2668
|
+
getData: x,
|
|
2663
2669
|
allowDataInference: y,
|
|
2664
|
-
propertyConfigs:
|
|
2670
|
+
propertyConfigs: P,
|
|
2665
2671
|
collectionEditable: T
|
|
2666
2672
|
}) {
|
|
2667
|
-
const [b,
|
|
2668
|
-
|
|
2669
|
-
if (u && (!d ||
|
|
2673
|
+
const [b, C] = $(o), [N, f] = $(!1), [w, _] = $(t?.dataType ? Kt(t) : void 0), M = Object.entries(lr).concat(Object.entries(P)), R = v ? M.filter(([q, L]) => !ne(L.property) && L.property?.dataType !== "array") : M, D = Ir(t), A = Le(null), s = Le(t), V = c && I(r, "selectedWidget");
|
|
2674
|
+
ce(() => {
|
|
2675
|
+
if (u && (!d || D.id)) {
|
|
2670
2676
|
const {
|
|
2671
|
-
id:
|
|
2677
|
+
id: q,
|
|
2672
2678
|
...L
|
|
2673
|
-
} =
|
|
2674
|
-
|
|
2675
|
-
id:
|
|
2679
|
+
} = D;
|
|
2680
|
+
ve(D, s.current) || (u({
|
|
2681
|
+
id: q,
|
|
2676
2682
|
property: L,
|
|
2677
|
-
namespace:
|
|
2678
|
-
}),
|
|
2683
|
+
namespace: h
|
|
2684
|
+
}), s.current = D);
|
|
2679
2685
|
}
|
|
2680
|
-
}, [
|
|
2681
|
-
t?.id &&
|
|
2682
|
-
}, [r,
|
|
2683
|
-
const G = (
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
+
}, [D, d, u, h]), ce(() => {
|
|
2687
|
+
t?.id && m && m(t?.id, h, r);
|
|
2688
|
+
}, [r, m, h, t?.id]);
|
|
2689
|
+
const G = (q) => {
|
|
2690
|
+
_(q), n(ar(t, q, P)), setTimeout(() => {
|
|
2691
|
+
A.current?.focus();
|
|
2686
2692
|
}, 0);
|
|
2687
2693
|
};
|
|
2688
|
-
let
|
|
2689
|
-
return
|
|
2694
|
+
let B;
|
|
2695
|
+
return w === "text_field" || w === "multiline" || w === "markdown" || w === "email" ? B = /* @__PURE__ */ e(
|
|
2690
2696
|
_i,
|
|
2691
2697
|
{
|
|
2692
|
-
widgetId:
|
|
2693
|
-
disabled:
|
|
2694
|
-
showErrors:
|
|
2698
|
+
widgetId: w,
|
|
2699
|
+
disabled: g,
|
|
2700
|
+
showErrors: c
|
|
2695
2701
|
}
|
|
2696
|
-
) :
|
|
2702
|
+
) : w === "url" ? B = /* @__PURE__ */ e(
|
|
2697
2703
|
Ri,
|
|
2698
2704
|
{
|
|
2699
|
-
disabled:
|
|
2700
|
-
showErrors:
|
|
2705
|
+
disabled: g,
|
|
2706
|
+
showErrors: c
|
|
2701
2707
|
}
|
|
2702
|
-
) :
|
|
2708
|
+
) : w === "select" || w === "number_select" ? B = /* @__PURE__ */ e(
|
|
2703
2709
|
Rt,
|
|
2704
2710
|
{
|
|
2705
2711
|
multiselect: !1,
|
|
2706
2712
|
allowDataInference: y,
|
|
2707
2713
|
updateIds: !i,
|
|
2708
|
-
disabled:
|
|
2709
|
-
getData:
|
|
2710
|
-
showErrors:
|
|
2714
|
+
disabled: g,
|
|
2715
|
+
getData: x,
|
|
2716
|
+
showErrors: c
|
|
2711
2717
|
}
|
|
2712
|
-
) :
|
|
2718
|
+
) : w === "multi_select" || w === "multi_number_select" ? B = /* @__PURE__ */ e(
|
|
2713
2719
|
Rt,
|
|
2714
2720
|
{
|
|
2715
2721
|
multiselect: !0,
|
|
2716
2722
|
updateIds: !i,
|
|
2717
|
-
disabled:
|
|
2723
|
+
disabled: g,
|
|
2718
2724
|
allowDataInference: y,
|
|
2719
|
-
getData:
|
|
2720
|
-
showErrors:
|
|
2725
|
+
getData: x,
|
|
2726
|
+
showErrors: c
|
|
2721
2727
|
}
|
|
2722
|
-
) :
|
|
2728
|
+
) : w === "file_upload" ? B = /* @__PURE__ */ e(
|
|
2723
2729
|
Ut,
|
|
2724
2730
|
{
|
|
2725
2731
|
existing: i,
|
|
2726
2732
|
multiple: !1,
|
|
2727
|
-
disabled:
|
|
2733
|
+
disabled: g
|
|
2728
2734
|
}
|
|
2729
|
-
) :
|
|
2735
|
+
) : w === "multi_file_upload" ? B = /* @__PURE__ */ e(
|
|
2730
2736
|
Ut,
|
|
2731
2737
|
{
|
|
2732
2738
|
existing: i,
|
|
2733
2739
|
multiple: !0,
|
|
2734
|
-
disabled:
|
|
2740
|
+
disabled: g
|
|
2735
2741
|
}
|
|
2736
|
-
) :
|
|
2742
|
+
) : w === "switch" ? B = /* @__PURE__ */ e(Fi, { disabled: g }) : w === "number_input" ? B = /* @__PURE__ */ e(Ai, { disabled: g }) : w === "group" ? B = /* @__PURE__ */ e(
|
|
2737
2743
|
Oi,
|
|
2738
2744
|
{
|
|
2739
|
-
disabled:
|
|
2740
|
-
getData:
|
|
2745
|
+
disabled: g,
|
|
2746
|
+
getData: x,
|
|
2741
2747
|
allowDataInference: y,
|
|
2742
2748
|
collectionEditable: T,
|
|
2743
|
-
propertyConfigs:
|
|
2749
|
+
propertyConfigs: P
|
|
2744
2750
|
}
|
|
2745
|
-
) :
|
|
2751
|
+
) : w === "block" ? B = /* @__PURE__ */ e(
|
|
2746
2752
|
Si,
|
|
2747
2753
|
{
|
|
2748
|
-
disabled:
|
|
2749
|
-
getData:
|
|
2754
|
+
disabled: g,
|
|
2755
|
+
getData: x,
|
|
2750
2756
|
allowDataInference: y,
|
|
2751
2757
|
collectionEditable: T,
|
|
2752
|
-
propertyConfigs:
|
|
2758
|
+
propertyConfigs: P
|
|
2753
2759
|
}
|
|
2754
|
-
) :
|
|
2755
|
-
|
|
2760
|
+
) : w === "reference" ? B = /* @__PURE__ */ e(
|
|
2761
|
+
jt,
|
|
2756
2762
|
{
|
|
2757
|
-
showErrors:
|
|
2763
|
+
showErrors: c,
|
|
2758
2764
|
existing: i,
|
|
2759
2765
|
multiple: !1,
|
|
2760
|
-
disabled:
|
|
2766
|
+
disabled: g
|
|
2761
2767
|
}
|
|
2762
|
-
) :
|
|
2763
|
-
|
|
2768
|
+
) : w === "date_time" ? B = /* @__PURE__ */ e(Bi, { disabled: g }) : w === "multi_references" ? B = /* @__PURE__ */ e(
|
|
2769
|
+
jt,
|
|
2764
2770
|
{
|
|
2765
|
-
showErrors:
|
|
2771
|
+
showErrors: c,
|
|
2766
2772
|
existing: i,
|
|
2767
2773
|
multiple: !0,
|
|
2768
|
-
disabled:
|
|
2774
|
+
disabled: g
|
|
2769
2775
|
}
|
|
2770
|
-
) :
|
|
2776
|
+
) : w === "repeat" ? B = /* @__PURE__ */ e(
|
|
2771
2777
|
Vi,
|
|
2772
2778
|
{
|
|
2773
|
-
showErrors:
|
|
2779
|
+
showErrors: c,
|
|
2774
2780
|
existing: i,
|
|
2775
|
-
getData:
|
|
2781
|
+
getData: x,
|
|
2776
2782
|
allowDataInference: y,
|
|
2777
|
-
disabled:
|
|
2783
|
+
disabled: g,
|
|
2778
2784
|
collectionEditable: T,
|
|
2779
|
-
propertyConfigs:
|
|
2785
|
+
propertyConfigs: P
|
|
2780
2786
|
}
|
|
2781
|
-
) :
|
|
2782
|
-
|
|
2783
|
-
/* @__PURE__ */ e(
|
|
2784
|
-
/* @__PURE__ */ a(
|
|
2787
|
+
) : w === "key_value" ? B = /* @__PURE__ */ e(Mi, { disabled: g }) : B = null, /* @__PURE__ */ a(U, { children: [
|
|
2788
|
+
g && /* @__PURE__ */ a(Lr, { mode: "warn", children: [
|
|
2789
|
+
/* @__PURE__ */ e(O, { children: "This property can't be edited" }),
|
|
2790
|
+
/* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
2785
2791
|
"You may not have permission to edit it or it is defined in code with no ",
|
|
2786
2792
|
/* @__PURE__ */ e("code", { children: "editable" }),
|
|
2787
2793
|
" flag"
|
|
@@ -2792,37 +2798,37 @@ function qi({
|
|
|
2792
2798
|
/* @__PURE__ */ e(
|
|
2793
2799
|
be,
|
|
2794
2800
|
{
|
|
2795
|
-
error: !!
|
|
2796
|
-
value:
|
|
2801
|
+
error: !!V,
|
|
2802
|
+
value: w ?? "",
|
|
2797
2803
|
placeholder: "Select a property widget",
|
|
2798
2804
|
open: b,
|
|
2799
|
-
onOpenChange:
|
|
2805
|
+
onOpenChange: C,
|
|
2800
2806
|
position: "item-aligned",
|
|
2801
|
-
disabled:
|
|
2802
|
-
renderValue: (
|
|
2803
|
-
if (
|
|
2807
|
+
disabled: g,
|
|
2808
|
+
renderValue: (q) => {
|
|
2809
|
+
if (!q)
|
|
2804
2810
|
return /* @__PURE__ */ e("em", { children: "Select a property widget" });
|
|
2805
|
-
const L =
|
|
2811
|
+
const L = q, J = Gt[L] ?? P[L], le = J.property, Me = le && !ne(le) ? $e(le, P) : void 0, we = ne(le) || i && le.dataType !== t?.dataType, de = Me ? W(Me, J) : J;
|
|
2806
2812
|
return /* @__PURE__ */ a(
|
|
2807
2813
|
"div",
|
|
2808
2814
|
{
|
|
2809
2815
|
onClick: (re) => {
|
|
2810
|
-
|
|
2816
|
+
we && (re.stopPropagation(), re.preventDefault());
|
|
2811
2817
|
},
|
|
2812
|
-
className:
|
|
2818
|
+
className: me(
|
|
2813
2819
|
"flex items-center",
|
|
2814
|
-
|
|
2820
|
+
we ? "w-full pointer-events-none opacity-50" : ""
|
|
2815
2821
|
),
|
|
2816
2822
|
children: [
|
|
2817
|
-
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(
|
|
2823
|
+
/* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(Ye, { propertyConfig: de }) }),
|
|
2818
2824
|
/* @__PURE__ */ a("div", { className: "flex flex-col items-start text-base text-left", children: [
|
|
2819
|
-
/* @__PURE__ */ e("div", { children:
|
|
2825
|
+
/* @__PURE__ */ e("div", { children: de.name }),
|
|
2820
2826
|
/* @__PURE__ */ e(
|
|
2821
|
-
|
|
2827
|
+
O,
|
|
2822
2828
|
{
|
|
2823
2829
|
variant: "caption",
|
|
2824
2830
|
color: "disabled",
|
|
2825
|
-
children:
|
|
2831
|
+
children: we ? "You can only switch to widgets that use the same data type" : de.description
|
|
2826
2832
|
}
|
|
2827
2833
|
)
|
|
2828
2834
|
] })
|
|
@@ -2830,26 +2836,26 @@ function qi({
|
|
|
2830
2836
|
}
|
|
2831
2837
|
);
|
|
2832
2838
|
},
|
|
2833
|
-
onValueChange: (
|
|
2834
|
-
G(
|
|
2839
|
+
onValueChange: (q) => {
|
|
2840
|
+
G(q);
|
|
2835
2841
|
},
|
|
2836
|
-
children:
|
|
2837
|
-
const
|
|
2842
|
+
children: R.map(([q, L]) => {
|
|
2843
|
+
const J = L.property, le = i && !ne(J) && J.dataType !== t?.dataType;
|
|
2838
2844
|
return /* @__PURE__ */ e(
|
|
2839
2845
|
or,
|
|
2840
2846
|
{
|
|
2841
|
-
value:
|
|
2847
|
+
value: q,
|
|
2842
2848
|
optionDisabled: le,
|
|
2843
2849
|
propertyConfig: L,
|
|
2844
2850
|
existing: i
|
|
2845
2851
|
},
|
|
2846
|
-
|
|
2852
|
+
q
|
|
2847
2853
|
);
|
|
2848
2854
|
})
|
|
2849
2855
|
}
|
|
2850
2856
|
),
|
|
2851
|
-
|
|
2852
|
-
|
|
2857
|
+
V && /* @__PURE__ */ e(
|
|
2858
|
+
O,
|
|
2853
2859
|
{
|
|
2854
2860
|
variant: "caption",
|
|
2855
2861
|
className: "ml-3.5",
|
|
@@ -2863,9 +2869,9 @@ function qi({
|
|
|
2863
2869
|
{
|
|
2864
2870
|
variant: "ghost",
|
|
2865
2871
|
className: "m-4",
|
|
2866
|
-
disabled:
|
|
2867
|
-
onClick: () =>
|
|
2868
|
-
children: /* @__PURE__ */ e(
|
|
2872
|
+
disabled: g,
|
|
2873
|
+
onClick: () => f(!0),
|
|
2874
|
+
children: /* @__PURE__ */ e(dt, {})
|
|
2869
2875
|
}
|
|
2870
2876
|
)
|
|
2871
2877
|
] }),
|
|
@@ -2873,23 +2879,23 @@ function qi({
|
|
|
2873
2879
|
d && /* @__PURE__ */ e(
|
|
2874
2880
|
Ii,
|
|
2875
2881
|
{
|
|
2876
|
-
showErrors:
|
|
2882
|
+
showErrors: c,
|
|
2877
2883
|
disabledId: i,
|
|
2878
2884
|
isNewProperty: !i,
|
|
2879
|
-
disabled:
|
|
2885
|
+
disabled: g,
|
|
2880
2886
|
autoUpdateId: l,
|
|
2881
|
-
ref:
|
|
2887
|
+
ref: A
|
|
2882
2888
|
}
|
|
2883
2889
|
),
|
|
2884
|
-
|
|
2885
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(zi, { disabled:
|
|
2890
|
+
B,
|
|
2891
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(zi, { disabled: g }) })
|
|
2886
2892
|
] }),
|
|
2887
2893
|
p && /* @__PURE__ */ e(
|
|
2888
2894
|
lt,
|
|
2889
2895
|
{
|
|
2890
|
-
open:
|
|
2891
|
-
onAccept: () => p(t?.id,
|
|
2892
|
-
onCancel: () =>
|
|
2896
|
+
open: N,
|
|
2897
|
+
onAccept: () => p(t?.id, h),
|
|
2898
|
+
onCancel: () => f(!1),
|
|
2893
2899
|
title: /* @__PURE__ */ e("div", { children: "Delete this property?" }),
|
|
2894
2900
|
body: /* @__PURE__ */ a("div", { children: [
|
|
2895
2901
|
" This will ",
|
|
@@ -2901,11 +2907,11 @@ function qi({
|
|
|
2901
2907
|
] });
|
|
2902
2908
|
}
|
|
2903
2909
|
const Li = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
2904
|
-
function
|
|
2910
|
+
function qi(t, r) {
|
|
2905
2911
|
let n;
|
|
2906
2912
|
return t || (n = "You must specify an id for the field"), t && !t.match(Li) && (n = "The id can only contain letters, numbers and underscores (_), and not start with a number"), t && r && r.includes(t) && (n = "There is another field with this ID already"), n;
|
|
2907
2913
|
}
|
|
2908
|
-
function
|
|
2914
|
+
function $i(t) {
|
|
2909
2915
|
let r;
|
|
2910
2916
|
return t || (r = "You must specify a title for the field"), r;
|
|
2911
2917
|
}
|
|
@@ -2915,20 +2921,20 @@ function Yi(t) {
|
|
|
2915
2921
|
function Hi({ collection: t, onOpenChange: r, open: n }) {
|
|
2916
2922
|
const i = Ie(), l = `import { EntityCollection } from "firecms";
|
|
2917
2923
|
|
|
2918
|
-
const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.stringify(
|
|
2924
|
+
const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.stringify(cr(t), null, " ");
|
|
2919
2925
|
return /* @__PURE__ */ a(
|
|
2920
|
-
|
|
2926
|
+
Fe,
|
|
2921
2927
|
{
|
|
2922
2928
|
open: n,
|
|
2923
2929
|
onOpenChange: r,
|
|
2924
2930
|
maxWidth: "4xl",
|
|
2925
2931
|
children: [
|
|
2926
|
-
/* @__PURE__ */ a(
|
|
2927
|
-
/* @__PURE__ */ a(
|
|
2932
|
+
/* @__PURE__ */ a(Be, { children: [
|
|
2933
|
+
/* @__PURE__ */ a(O, { variant: "h6", className: "my-4", children: [
|
|
2928
2934
|
"Code for ",
|
|
2929
2935
|
t.name
|
|
2930
2936
|
] }),
|
|
2931
|
-
/* @__PURE__ */ a(
|
|
2937
|
+
/* @__PURE__ */ a(O, { variant: "body2", className: "my-4 mb-8", children: [
|
|
2932
2938
|
"If you want to customise the collection in code, you can add this collection code to your CMS app configuration. More info in the ",
|
|
2933
2939
|
/* @__PURE__ */ e(
|
|
2934
2940
|
"a",
|
|
@@ -2946,11 +2952,11 @@ const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.s
|
|
|
2946
2952
|
theme: si.vsDark,
|
|
2947
2953
|
code: l,
|
|
2948
2954
|
language: "typescript",
|
|
2949
|
-
children: ({ className: o, style: d, tokens: u, getLineProps: p, getTokenProps:
|
|
2955
|
+
children: ({ className: o, style: d, tokens: u, getLineProps: p, getTokenProps: h }) => /* @__PURE__ */ e("pre", { style: d, className: "p-4 rounded text-sm", children: u.map((m, c) => /* @__PURE__ */ e("div", { ...p({ line: m }), children: m.map((g, v) => /* @__PURE__ */ e("span", { ...h({ token: g }) }, v)) }, c)) })
|
|
2950
2956
|
}
|
|
2951
2957
|
)
|
|
2952
2958
|
] }),
|
|
2953
|
-
/* @__PURE__ */ a(
|
|
2959
|
+
/* @__PURE__ */ a(ze, { children: [
|
|
2954
2960
|
/* @__PURE__ */ a(
|
|
2955
2961
|
z,
|
|
2956
2962
|
{
|
|
@@ -2961,7 +2967,7 @@ const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.s
|
|
|
2961
2967
|
message: "Copied"
|
|
2962
2968
|
}), navigator.clipboard.writeText(l)),
|
|
2963
2969
|
children: [
|
|
2964
|
-
/* @__PURE__ */ e(
|
|
2970
|
+
/* @__PURE__ */ e(qr, { size: "small" }),
|
|
2965
2971
|
"Copy to clipboard"
|
|
2966
2972
|
]
|
|
2967
2973
|
}
|
|
@@ -2972,7 +2978,7 @@ const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.s
|
|
|
2972
2978
|
}
|
|
2973
2979
|
);
|
|
2974
2980
|
}
|
|
2975
|
-
function
|
|
2981
|
+
function cr(t) {
|
|
2976
2982
|
const r = (n) => {
|
|
2977
2983
|
const i = {
|
|
2978
2984
|
...n
|
|
@@ -2995,10 +3001,10 @@ function dr(t) {
|
|
|
2995
3001
|
customId: t.customId,
|
|
2996
3002
|
initialFilter: t.initialFilter,
|
|
2997
3003
|
initialSort: t.initialSort,
|
|
2998
|
-
properties: Object.entries(t.properties).map(([n, i]) => ({
|
|
3004
|
+
properties: Object.entries(t.properties ?? {}).map(([n, i]) => ({
|
|
2999
3005
|
[n]: r(i)
|
|
3000
3006
|
})).reduce((n, i) => ({ ...n, ...i }), {}),
|
|
3001
|
-
subcollections: (t.subcollections ?? []).map(
|
|
3007
|
+
subcollections: (t.subcollections ?? []).map(cr)
|
|
3002
3008
|
};
|
|
3003
3009
|
}
|
|
3004
3010
|
function Gi({
|
|
@@ -3011,32 +3017,32 @@ function Gi({
|
|
|
3011
3017
|
extraIcon: d,
|
|
3012
3018
|
getUser: u,
|
|
3013
3019
|
getData: p,
|
|
3014
|
-
doCollectionInference:
|
|
3015
|
-
propertyConfigs:
|
|
3016
|
-
collectionEditable:
|
|
3020
|
+
doCollectionInference: h,
|
|
3021
|
+
propertyConfigs: m,
|
|
3022
|
+
collectionEditable: c
|
|
3017
3023
|
}) {
|
|
3018
3024
|
const {
|
|
3019
|
-
values:
|
|
3025
|
+
values: g,
|
|
3020
3026
|
setFieldValue: v,
|
|
3021
|
-
setFieldError:
|
|
3027
|
+
setFieldError: x,
|
|
3022
3028
|
setFieldTouched: y,
|
|
3023
|
-
errors:
|
|
3029
|
+
errors: P,
|
|
3024
3030
|
dirty: T
|
|
3025
|
-
} = K(), b = Ie(),
|
|
3026
|
-
|
|
3031
|
+
} = K(), b = Ie(), C = Nr(), N = !C, [f, w] = $(), [_, M] = $(), [R, D] = $(), A = _ ? ae(_, R) : void 0, s = A ? I(g.properties, A.replaceAll(".", ".properties.")) : void 0, [V, G] = $(!1), [B, q] = $(!1), [L, J] = $(!1), [le, Me] = $([]), we = Y.useRef(g.propertiesOrder ? { "": g.propertiesOrder } : {});
|
|
3032
|
+
ce(() => {
|
|
3027
3033
|
l && l(T);
|
|
3028
3034
|
}, [T]);
|
|
3029
|
-
const
|
|
3030
|
-
|
|
3031
|
-
if (
|
|
3035
|
+
const de = h ? () => {
|
|
3036
|
+
h && (q(!0), h(g).then((F) => {
|
|
3037
|
+
if (F && pt(F.properties), !F) {
|
|
3032
3038
|
b.open({
|
|
3033
3039
|
type: "error",
|
|
3034
3040
|
message: "Could not infer properties from data"
|
|
3035
3041
|
});
|
|
3036
3042
|
return;
|
|
3037
3043
|
}
|
|
3038
|
-
const
|
|
3039
|
-
if (
|
|
3044
|
+
const j = (F.properties ? Object.keys(F.properties) : []).filter((E) => !g.properties[E]);
|
|
3045
|
+
if (j.length === 0) {
|
|
3040
3046
|
b.open({
|
|
3041
3047
|
type: "info",
|
|
3042
3048
|
message: "No new properties found in existing data"
|
|
@@ -3044,81 +3050,81 @@ function Gi({
|
|
|
3044
3050
|
return;
|
|
3045
3051
|
}
|
|
3046
3052
|
const k = {
|
|
3047
|
-
...
|
|
3048
|
-
...
|
|
3049
|
-
},
|
|
3050
|
-
...
|
|
3051
|
-
...
|
|
3053
|
+
...j.reduce((E, ie) => (E[ie] = (F.properties ?? {})[ie], E), {}),
|
|
3054
|
+
...g.properties
|
|
3055
|
+
}, S = [
|
|
3056
|
+
...j,
|
|
3057
|
+
...g.propertiesOrder ?? []
|
|
3052
3058
|
];
|
|
3053
|
-
v("properties", k, !1), he(
|
|
3059
|
+
v("properties", k, !1), he(S), Me(j);
|
|
3054
3060
|
}).finally(() => {
|
|
3055
|
-
|
|
3061
|
+
q(!1);
|
|
3056
3062
|
}));
|
|
3057
|
-
} : void 0, re =
|
|
3058
|
-
const k = ye(
|
|
3059
|
-
v(k,
|
|
3060
|
-
}, [v]), Te =
|
|
3061
|
-
const k =
|
|
3063
|
+
} : void 0, re = Q((F) => F ? we.current[F] ?? I(g, ye(F)) : we.current[""], [g]), he = Q((F, j) => {
|
|
3064
|
+
const k = ye(j);
|
|
3065
|
+
v(k, F, !1), we.current[j ?? ""] = F;
|
|
3066
|
+
}, [v]), Te = Q((F, j) => {
|
|
3067
|
+
const k = F ? ae(F, j) : void 0;
|
|
3062
3068
|
if (!k)
|
|
3063
3069
|
throw Error("collection editor miss config");
|
|
3064
|
-
v(
|
|
3065
|
-
const
|
|
3066
|
-
he(
|
|
3067
|
-
}, [re, v, he]), Ge = (
|
|
3068
|
-
v(ye(
|
|
3070
|
+
v(pe(k), void 0, !1);
|
|
3071
|
+
const E = re(j).filter((ie) => ie !== F);
|
|
3072
|
+
he(E, j), J(!1), w(void 0), M(void 0), D(void 0);
|
|
3073
|
+
}, [re, v, he]), Ge = (F, j) => {
|
|
3074
|
+
v(ye(j), F, !1);
|
|
3069
3075
|
}, gt = ({
|
|
3070
|
-
id:
|
|
3071
|
-
property:
|
|
3076
|
+
id: F,
|
|
3077
|
+
property: j
|
|
3072
3078
|
}) => {
|
|
3073
|
-
if (!
|
|
3079
|
+
if (!F)
|
|
3074
3080
|
throw Error("Need to include an ID when creating a new property");
|
|
3075
3081
|
v("properties", {
|
|
3076
|
-
...
|
|
3077
|
-
[
|
|
3082
|
+
...g.properties ?? {},
|
|
3083
|
+
[F]: j
|
|
3078
3084
|
}, !1);
|
|
3079
|
-
const k = [...
|
|
3080
|
-
he(k),
|
|
3085
|
+
const k = [...g.propertiesOrder ?? Object.keys(g.properties), F];
|
|
3086
|
+
he(k), J(!1), C && (w(k.indexOf(F)), M(F)), D(void 0);
|
|
3081
3087
|
}, fe = ({
|
|
3082
|
-
id:
|
|
3083
|
-
property:
|
|
3088
|
+
id: F,
|
|
3089
|
+
property: j,
|
|
3084
3090
|
previousId: k,
|
|
3085
|
-
namespace:
|
|
3091
|
+
namespace: S
|
|
3086
3092
|
}) => {
|
|
3087
|
-
const
|
|
3088
|
-
if (k && k !==
|
|
3089
|
-
const ke = ae(k,
|
|
3090
|
-
he(It,
|
|
3093
|
+
const E = F ? ae(F, S) : void 0, ie = E ? pe(E) : void 0;
|
|
3094
|
+
if (k && k !== F) {
|
|
3095
|
+
const ke = ae(k, S), Vt = pe(ke), It = re(S).map((Xe) => Xe === k ? F : Xe).filter((Xe) => Xe !== void 0);
|
|
3096
|
+
he(It, S), F && (w(It.indexOf(F)), M(F)), v(Vt, void 0, !1), y(Vt, !1, !1);
|
|
3091
3097
|
}
|
|
3092
3098
|
console.debug("onPropertyChanged", {
|
|
3093
|
-
id:
|
|
3094
|
-
property:
|
|
3099
|
+
id: F,
|
|
3100
|
+
property: j,
|
|
3095
3101
|
previousId: k,
|
|
3096
|
-
namespace:
|
|
3102
|
+
namespace: S,
|
|
3097
3103
|
propertyPath: ie
|
|
3098
|
-
}), ie && (v(ie,
|
|
3099
|
-
}, Ke =
|
|
3100
|
-
const
|
|
3104
|
+
}), ie && (v(ie, j, !1), y(ie, !0, !1));
|
|
3105
|
+
}, Ke = Q((F, j, k) => {
|
|
3106
|
+
const S = F ? ae(F, j) : void 0;
|
|
3101
3107
|
if (console.debug("onPropertyErrorInternal", {
|
|
3102
|
-
id:
|
|
3103
|
-
namespace:
|
|
3108
|
+
id: F,
|
|
3109
|
+
namespace: j,
|
|
3104
3110
|
error: k,
|
|
3105
|
-
propertyPath:
|
|
3106
|
-
}),
|
|
3107
|
-
const
|
|
3108
|
-
i(
|
|
3111
|
+
propertyPath: S
|
|
3112
|
+
}), S) {
|
|
3113
|
+
const E = k && Object.keys(k).length > 0;
|
|
3114
|
+
i(F, j, E ? k : void 0), x(pe(S), E ? "Property error" : void 0);
|
|
3109
3115
|
}
|
|
3110
3116
|
}, []), We = () => {
|
|
3111
|
-
|
|
3112
|
-
}, Ze =
|
|
3117
|
+
w(void 0), M(void 0);
|
|
3118
|
+
}, Ze = _ && n?.current?.properties ? n.current.properties[_] : void 0, Je = g?.propertiesOrder === void 0 || g.propertiesOrder.length === 0, Re = g.propertiesOrder ? g.propertiesOrder : Object.keys(g.properties), Qe = Zt(() => u(g.ownerId), [u, g.ownerId]), vt = Q((F, j) => {
|
|
3113
3119
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
3114
|
-
propertyKey:
|
|
3115
|
-
namespace:
|
|
3116
|
-
}),
|
|
3117
|
-
}, [
|
|
3118
|
-
/* @__PURE__ */ a("div", { className:
|
|
3120
|
+
propertyKey: F,
|
|
3121
|
+
namespace: j
|
|
3122
|
+
}), w(Re.indexOf(F)), M(F), D(j);
|
|
3123
|
+
}, [Re]), yt = /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3124
|
+
/* @__PURE__ */ a("div", { className: me(
|
|
3119
3125
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
3120
3126
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
3121
|
-
!
|
|
3127
|
+
!N && "border-r " + wt
|
|
3122
3128
|
), children: [
|
|
3123
3129
|
/* @__PURE__ */ a("div", { className: "flex my-2", children: [
|
|
3124
3130
|
/* @__PURE__ */ a("div", { className: "flex-grow mb-4", children: [
|
|
@@ -3126,18 +3132,18 @@ function Gi({
|
|
|
3126
3132
|
H,
|
|
3127
3133
|
{
|
|
3128
3134
|
name: "name",
|
|
3129
|
-
as:
|
|
3135
|
+
as: Z,
|
|
3130
3136
|
invisible: !0,
|
|
3131
3137
|
className: "-ml-1",
|
|
3132
3138
|
inputClassName: "text-2xl font-headers",
|
|
3133
3139
|
placeholder: "Collection name",
|
|
3134
3140
|
size: "small",
|
|
3135
3141
|
required: !0,
|
|
3136
|
-
error: !!
|
|
3142
|
+
error: !!P?.name
|
|
3137
3143
|
}
|
|
3138
3144
|
),
|
|
3139
3145
|
Qe && /* @__PURE__ */ a(
|
|
3140
|
-
|
|
3146
|
+
O,
|
|
3141
3147
|
{
|
|
3142
3148
|
variant: "body2",
|
|
3143
3149
|
className: "ml-2",
|
|
@@ -3155,44 +3161,44 @@ function Gi({
|
|
|
3155
3161
|
oe,
|
|
3156
3162
|
{
|
|
3157
3163
|
variant: "filled",
|
|
3158
|
-
disabled:
|
|
3164
|
+
disabled: B,
|
|
3159
3165
|
onClick: () => G(!0),
|
|
3160
|
-
children: /* @__PURE__ */ e(
|
|
3166
|
+
children: /* @__PURE__ */ e($r, {})
|
|
3161
3167
|
}
|
|
3162
3168
|
) }),
|
|
3163
|
-
|
|
3169
|
+
de && /* @__PURE__ */ e(te, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
|
|
3164
3170
|
oe,
|
|
3165
3171
|
{
|
|
3166
3172
|
variant: "filled",
|
|
3167
|
-
disabled:
|
|
3168
|
-
onClick:
|
|
3169
|
-
children:
|
|
3173
|
+
disabled: B,
|
|
3174
|
+
onClick: de,
|
|
3175
|
+
children: B ? /* @__PURE__ */ e(De, { size: "small" }) : /* @__PURE__ */ e(ht, {})
|
|
3170
3176
|
}
|
|
3171
3177
|
) }),
|
|
3172
3178
|
/* @__PURE__ */ e(te, { title: "Add new property", children: /* @__PURE__ */ e(
|
|
3173
3179
|
z,
|
|
3174
3180
|
{
|
|
3175
3181
|
variant: "outlined",
|
|
3176
|
-
onClick: () =>
|
|
3177
|
-
children: /* @__PURE__ */ e(
|
|
3182
|
+
onClick: () => J(!0),
|
|
3183
|
+
children: /* @__PURE__ */ e(ue, {})
|
|
3178
3184
|
}
|
|
3179
3185
|
) })
|
|
3180
3186
|
] })
|
|
3181
3187
|
] }),
|
|
3182
|
-
/* @__PURE__ */ e(
|
|
3188
|
+
/* @__PURE__ */ e(ge, { children: /* @__PURE__ */ e(
|
|
3183
3189
|
ft,
|
|
3184
3190
|
{
|
|
3185
3191
|
className: "pl-8",
|
|
3186
3192
|
inferredPropertyKeys: le,
|
|
3187
|
-
selectedPropertyKey:
|
|
3188
|
-
properties:
|
|
3189
|
-
additionalFields:
|
|
3190
|
-
propertiesOrder:
|
|
3193
|
+
selectedPropertyKey: _ ? ae(_, R) : void 0,
|
|
3194
|
+
properties: g.properties,
|
|
3195
|
+
additionalFields: g.additionalFields,
|
|
3196
|
+
propertiesOrder: Re,
|
|
3191
3197
|
onPropertyClick: vt,
|
|
3192
3198
|
onPropertyMove: Ge,
|
|
3193
3199
|
onPropertyRemove: r ? Te : void 0,
|
|
3194
|
-
collectionEditable:
|
|
3195
|
-
errors:
|
|
3200
|
+
collectionEditable: c,
|
|
3201
|
+
errors: P
|
|
3196
3202
|
}
|
|
3197
3203
|
) }),
|
|
3198
3204
|
/* @__PURE__ */ e(
|
|
@@ -3202,18 +3208,18 @@ function Gi({
|
|
|
3202
3208
|
color: "primary",
|
|
3203
3209
|
variant: "outlined",
|
|
3204
3210
|
size: "large",
|
|
3205
|
-
onClick: () =>
|
|
3206
|
-
startIcon: /* @__PURE__ */ e(
|
|
3211
|
+
onClick: () => J(!0),
|
|
3212
|
+
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
3207
3213
|
children: "Add new property"
|
|
3208
3214
|
}
|
|
3209
3215
|
)
|
|
3210
3216
|
] }),
|
|
3211
|
-
!
|
|
3217
|
+
!N && /* @__PURE__ */ e("div", { className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ a(
|
|
3212
3218
|
Ce,
|
|
3213
3219
|
{
|
|
3214
3220
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
3215
3221
|
children: [
|
|
3216
|
-
|
|
3222
|
+
A && s && !ne(s) && /* @__PURE__ */ e(
|
|
3217
3223
|
sr,
|
|
3218
3224
|
{
|
|
3219
3225
|
inArray: !1,
|
|
@@ -3221,48 +3227,48 @@ function Gi({
|
|
|
3221
3227
|
autoUpdateId: !1,
|
|
3222
3228
|
allowDataInference: !r,
|
|
3223
3229
|
autoOpenTypeSelect: !1,
|
|
3224
|
-
propertyKey:
|
|
3225
|
-
propertyNamespace:
|
|
3226
|
-
property:
|
|
3230
|
+
propertyKey: _,
|
|
3231
|
+
propertyNamespace: R,
|
|
3232
|
+
property: s,
|
|
3227
3233
|
onPropertyChanged: fe,
|
|
3228
3234
|
onDelete: Te,
|
|
3229
3235
|
onError: Ke,
|
|
3230
3236
|
forceShowErrors: t,
|
|
3231
3237
|
initialErrors: Ze,
|
|
3232
3238
|
getData: p,
|
|
3233
|
-
propertyConfigs:
|
|
3234
|
-
collectionEditable:
|
|
3239
|
+
propertyConfigs: m,
|
|
3240
|
+
collectionEditable: c
|
|
3235
3241
|
},
|
|
3236
|
-
`edit_view_${
|
|
3242
|
+
`edit_view_${f}`
|
|
3237
3243
|
),
|
|
3238
|
-
!
|
|
3239
|
-
|
|
3244
|
+
!s && /* @__PURE__ */ e(O, { variant: "label", className: "flex items-center justify-center h-full", children: Je ? "Now you can add your first property" : "Select a property to edit it" }),
|
|
3245
|
+
s && ne(s) && /* @__PURE__ */ e(O, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
|
|
3240
3246
|
]
|
|
3241
3247
|
}
|
|
3242
3248
|
) }),
|
|
3243
|
-
|
|
3249
|
+
N && /* @__PURE__ */ e(
|
|
3244
3250
|
Ve,
|
|
3245
3251
|
{
|
|
3246
3252
|
inArray: !1,
|
|
3247
|
-
open:
|
|
3248
|
-
autoUpdateId: !
|
|
3253
|
+
open: f !== void 0,
|
|
3254
|
+
autoUpdateId: !s,
|
|
3249
3255
|
allowDataInference: !r,
|
|
3250
3256
|
existingProperty: !0,
|
|
3251
3257
|
autoOpenTypeSelect: !1,
|
|
3252
|
-
propertyKey:
|
|
3253
|
-
propertyNamespace:
|
|
3254
|
-
property:
|
|
3258
|
+
propertyKey: _,
|
|
3259
|
+
propertyNamespace: R,
|
|
3260
|
+
property: s,
|
|
3255
3261
|
onPropertyChanged: fe,
|
|
3256
3262
|
onDelete: Te,
|
|
3257
3263
|
onError: Ke,
|
|
3258
3264
|
forceShowErrors: t,
|
|
3259
3265
|
initialErrors: Ze,
|
|
3260
3266
|
getData: p,
|
|
3261
|
-
propertyConfigs:
|
|
3262
|
-
collectionEditable:
|
|
3263
|
-
onOkClicked:
|
|
3267
|
+
propertyConfigs: m,
|
|
3268
|
+
collectionEditable: c,
|
|
3269
|
+
onOkClicked: N ? We : void 0
|
|
3264
3270
|
},
|
|
3265
|
-
`edit_view_${
|
|
3271
|
+
`edit_view_${f}`
|
|
3266
3272
|
)
|
|
3267
3273
|
] });
|
|
3268
3274
|
return /* @__PURE__ */ a(U, { children: [
|
|
@@ -3276,20 +3282,20 @@ function Gi({
|
|
|
3276
3282
|
autoUpdateId: !0,
|
|
3277
3283
|
forceShowErrors: t,
|
|
3278
3284
|
open: L,
|
|
3279
|
-
onCancel: () =>
|
|
3285
|
+
onCancel: () => J(!1),
|
|
3280
3286
|
onPropertyChanged: gt,
|
|
3281
3287
|
getData: p,
|
|
3282
3288
|
allowDataInference: !r,
|
|
3283
|
-
propertyConfigs:
|
|
3284
|
-
collectionEditable:
|
|
3285
|
-
existingPropertyKeys:
|
|
3289
|
+
propertyConfigs: m,
|
|
3290
|
+
collectionEditable: c,
|
|
3291
|
+
existingPropertyKeys: g.propertiesOrder
|
|
3286
3292
|
}
|
|
3287
3293
|
),
|
|
3288
3294
|
/* @__PURE__ */ e(
|
|
3289
3295
|
Hi,
|
|
3290
3296
|
{
|
|
3291
|
-
collection:
|
|
3292
|
-
open:
|
|
3297
|
+
collection: g,
|
|
3298
|
+
open: V,
|
|
3293
3299
|
onOpenChange: G
|
|
3294
3300
|
}
|
|
3295
3301
|
)
|
|
@@ -3303,19 +3309,19 @@ function Ki({
|
|
|
3303
3309
|
title: l
|
|
3304
3310
|
}) {
|
|
3305
3311
|
return /* @__PURE__ */ a(
|
|
3306
|
-
|
|
3312
|
+
Fe,
|
|
3307
3313
|
{
|
|
3308
3314
|
open: t,
|
|
3309
3315
|
onOpenChange: (o) => o ? n() : r(),
|
|
3310
3316
|
"aria-labelledby": "alert-dialog-title",
|
|
3311
3317
|
"aria-describedby": "alert-dialog-description",
|
|
3312
3318
|
children: [
|
|
3313
|
-
/* @__PURE__ */ a(De, { children: [
|
|
3314
|
-
/* @__PURE__ */ e(V, { variant: "h6", children: l ?? "Unsaved changes" }),
|
|
3315
|
-
i && /* @__PURE__ */ e(V, { children: i }),
|
|
3316
|
-
/* @__PURE__ */ e(V, { children: "Are you sure?" })
|
|
3317
|
-
] }),
|
|
3318
3319
|
/* @__PURE__ */ a(Be, { children: [
|
|
3320
|
+
/* @__PURE__ */ e(O, { variant: "h6", children: l ?? "Unsaved changes" }),
|
|
3321
|
+
i && /* @__PURE__ */ e(O, { children: i }),
|
|
3322
|
+
/* @__PURE__ */ e(O, { children: "Are you sure?" })
|
|
3323
|
+
] }),
|
|
3324
|
+
/* @__PURE__ */ a(ze, { children: [
|
|
3319
3325
|
/* @__PURE__ */ e(z, { variant: "text", onClick: n, autoFocus: !0, children: " Cancel " }),
|
|
3320
3326
|
/* @__PURE__ */ e(z, { onClick: r, children: " Ok " })
|
|
3321
3327
|
] })
|
|
@@ -3326,15 +3332,15 @@ function Ki({
|
|
|
3326
3332
|
function Wi({ open: t, onClose: r }) {
|
|
3327
3333
|
const {
|
|
3328
3334
|
entityViews: n
|
|
3329
|
-
} =
|
|
3335
|
+
} = Ae();
|
|
3330
3336
|
return /* @__PURE__ */ a(
|
|
3331
|
-
|
|
3337
|
+
Fe,
|
|
3332
3338
|
{
|
|
3333
3339
|
maxWidth: "md",
|
|
3334
3340
|
open: t,
|
|
3335
3341
|
children: [
|
|
3336
|
-
/* @__PURE__ */ a(
|
|
3337
|
-
/* @__PURE__ */ e(
|
|
3342
|
+
/* @__PURE__ */ a(Be, { className: "flex flex-col gap-4", children: [
|
|
3343
|
+
/* @__PURE__ */ e(O, { variant: "h6", children: "Select view" }),
|
|
3338
3344
|
n?.map((i) => /* @__PURE__ */ a(
|
|
3339
3345
|
z,
|
|
3340
3346
|
{
|
|
@@ -3350,9 +3356,9 @@ function Wi({ open: t, onClose: r }) {
|
|
|
3350
3356
|
},
|
|
3351
3357
|
i.key
|
|
3352
3358
|
)),
|
|
3353
|
-
(n ?? []).length === 0 && /* @__PURE__ */ e(
|
|
3359
|
+
(n ?? []).length === 0 && /* @__PURE__ */ e(O, { variant: "body2", children: "No custom views defined" })
|
|
3354
3360
|
] }),
|
|
3355
|
-
/* @__PURE__ */ e(
|
|
3361
|
+
/* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(z, { variant: "outlined", onClick: () => r(), children: "Cancel" }) })
|
|
3356
3362
|
]
|
|
3357
3363
|
}
|
|
3358
3364
|
);
|
|
@@ -3365,133 +3371,137 @@ function Zi({
|
|
|
3365
3371
|
getUser: l,
|
|
3366
3372
|
parentCollectionIds: o
|
|
3367
3373
|
}) {
|
|
3368
|
-
const { entityViews: d } =
|
|
3374
|
+
const { entityViews: d } = Ae(), [u, p] = Y.useState(), [h, m] = Y.useState(!1), [c, g] = Y.useState(), [v, x] = Y.useState(), {
|
|
3369
3375
|
values: y,
|
|
3370
|
-
setFieldValue:
|
|
3371
|
-
} = K(), T = t.subcollections ?? [], b = y.entityViews?.filter((
|
|
3376
|
+
setFieldValue: P
|
|
3377
|
+
} = K(), T = t.subcollections ?? [], b = y.entityViews?.filter((f) => typeof f == "string").map((f) => xr(f, d)).filter(Boolean) ?? [], C = t.entityViews?.filter((f) => typeof f != "string") ?? [], N = b.length + C.length;
|
|
3372
3378
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3373
3379
|
/* @__PURE__ */ e(mt, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ a("div", { className: "flex flex-col gap-16", children: [
|
|
3374
3380
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3375
|
-
/* @__PURE__ */ a(
|
|
3381
|
+
/* @__PURE__ */ a(O, { variant: "h5", children: [
|
|
3376
3382
|
"Subcollections of ",
|
|
3377
3383
|
y.name
|
|
3378
3384
|
] }),
|
|
3379
|
-
|
|
3380
|
-
|
|
3385
|
+
/* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3386
|
+
T && T.length > 0 && /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(Bt, { children: T.map((f) => /* @__PURE__ */ a(
|
|
3387
|
+
bt,
|
|
3388
|
+
{
|
|
3389
|
+
onClick: () => x({
|
|
3390
|
+
isNewCollection: !1,
|
|
3391
|
+
editedCollectionId: f.id
|
|
3392
|
+
}),
|
|
3393
|
+
children: [
|
|
3394
|
+
/* @__PURE__ */ e(
|
|
3395
|
+
Ue,
|
|
3396
|
+
{
|
|
3397
|
+
align: "left",
|
|
3398
|
+
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: f.name })
|
|
3399
|
+
}
|
|
3400
|
+
),
|
|
3401
|
+
/* @__PURE__ */ e(
|
|
3402
|
+
Ue,
|
|
3403
|
+
{
|
|
3404
|
+
align: "right",
|
|
3405
|
+
children: /* @__PURE__ */ e(te, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3406
|
+
oe,
|
|
3407
|
+
{
|
|
3408
|
+
size: "small",
|
|
3409
|
+
onClick: (w) => {
|
|
3410
|
+
w.preventDefault(), w.stopPropagation(), p(f.id);
|
|
3411
|
+
},
|
|
3412
|
+
color: "inherit",
|
|
3413
|
+
children: /* @__PURE__ */ e(dt, { size: "small" })
|
|
3414
|
+
}
|
|
3415
|
+
) })
|
|
3416
|
+
}
|
|
3417
|
+
)
|
|
3418
|
+
]
|
|
3419
|
+
},
|
|
3420
|
+
f.path
|
|
3421
|
+
)) }) }),
|
|
3422
|
+
/* @__PURE__ */ e(
|
|
3423
|
+
z,
|
|
3424
|
+
{
|
|
3425
|
+
onClick: () => {
|
|
3426
|
+
x({
|
|
3427
|
+
isNewCollection: !0
|
|
3428
|
+
});
|
|
3429
|
+
},
|
|
3430
|
+
variant: "text",
|
|
3431
|
+
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
3432
|
+
children: "Add subcollection"
|
|
3433
|
+
}
|
|
3434
|
+
)
|
|
3435
|
+
] })
|
|
3436
|
+
] }),
|
|
3437
|
+
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3438
|
+
/* @__PURE__ */ e(O, { variant: "h5", children: "Custom views" }),
|
|
3439
|
+
N === 0 && /* @__PURE__ */ e(Yr, { action: /* @__PURE__ */ e(
|
|
3440
|
+
z,
|
|
3381
3441
|
{
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3442
|
+
variant: "text",
|
|
3443
|
+
size: "small",
|
|
3444
|
+
href: "https://firecms.co/docs/customization_quickstart",
|
|
3445
|
+
component: "a",
|
|
3446
|
+
rel: "noopener noreferrer",
|
|
3447
|
+
target: "_blank",
|
|
3448
|
+
children: "More info"
|
|
3449
|
+
}
|
|
3450
|
+
), children: "Define your own custom views by uploading it with the CLI." }),
|
|
3451
|
+
/* @__PURE__ */ e(U, { children: /* @__PURE__ */ a(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3452
|
+
/* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3453
|
+
b.map((f) => /* @__PURE__ */ a(bt, { children: [
|
|
3387
3454
|
/* @__PURE__ */ e(
|
|
3388
|
-
|
|
3455
|
+
Ue,
|
|
3389
3456
|
{
|
|
3390
3457
|
align: "left",
|
|
3391
|
-
children: /* @__PURE__ */ e(
|
|
3458
|
+
children: /* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: f.name })
|
|
3392
3459
|
}
|
|
3393
3460
|
),
|
|
3394
3461
|
/* @__PURE__ */ e(
|
|
3395
|
-
|
|
3462
|
+
Ue,
|
|
3396
3463
|
{
|
|
3397
3464
|
align: "right",
|
|
3398
3465
|
children: /* @__PURE__ */ e(te, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3399
3466
|
oe,
|
|
3400
3467
|
{
|
|
3401
3468
|
size: "small",
|
|
3402
|
-
onClick: (
|
|
3403
|
-
|
|
3469
|
+
onClick: (w) => {
|
|
3470
|
+
w.preventDefault(), w.stopPropagation(), g(f.key);
|
|
3404
3471
|
},
|
|
3405
3472
|
color: "inherit",
|
|
3406
|
-
children: /* @__PURE__ */ e(
|
|
3473
|
+
children: /* @__PURE__ */ e(dt, { size: "small" })
|
|
3407
3474
|
}
|
|
3408
3475
|
) })
|
|
3409
3476
|
}
|
|
3410
3477
|
)
|
|
3411
|
-
]
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
)) }) }) }),
|
|
3415
|
-
/* @__PURE__ */ e(
|
|
3416
|
-
z,
|
|
3417
|
-
{
|
|
3418
|
-
onClick: () => {
|
|
3419
|
-
w({
|
|
3420
|
-
isNewCollection: !0
|
|
3421
|
-
});
|
|
3422
|
-
},
|
|
3423
|
-
variant: "outlined",
|
|
3424
|
-
startIcon: /* @__PURE__ */ e(me, {}),
|
|
3425
|
-
children: "Add subcollection"
|
|
3426
|
-
}
|
|
3427
|
-
)
|
|
3428
|
-
] }),
|
|
3429
|
-
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3430
|
-
/* @__PURE__ */ e(V, { variant: "h5", children: "Custom views" }),
|
|
3431
|
-
O > 0 && /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(Ce, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3432
|
-
b.map((h) => /* @__PURE__ */ a(bt, { children: [
|
|
3433
|
-
/* @__PURE__ */ e(
|
|
3434
|
-
Re,
|
|
3478
|
+
] }, f.key)),
|
|
3479
|
+
C.map((f) => /* @__PURE__ */ e(bt, { children: /* @__PURE__ */ a(
|
|
3480
|
+
Ue,
|
|
3435
3481
|
{
|
|
3436
3482
|
align: "left",
|
|
3437
|
-
children:
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
children: /* @__PURE__ */ e(te, { title: "Remove", children: /* @__PURE__ */ e(
|
|
3445
|
-
oe,
|
|
3446
|
-
{
|
|
3447
|
-
size: "small",
|
|
3448
|
-
onClick: (N) => {
|
|
3449
|
-
N.preventDefault(), N.stopPropagation(), f(h.key);
|
|
3450
|
-
},
|
|
3451
|
-
color: "inherit",
|
|
3452
|
-
children: /* @__PURE__ */ e(ct, { size: "small" })
|
|
3453
|
-
}
|
|
3454
|
-
) })
|
|
3483
|
+
children: [
|
|
3484
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", className: "flex-grow", children: f.name }),
|
|
3485
|
+
/* @__PURE__ */ a(O, { variant: "caption", className: "flex-grow", children: [
|
|
3486
|
+
"This view is defined in code with key ",
|
|
3487
|
+
/* @__PURE__ */ e("code", { children: f.key })
|
|
3488
|
+
] })
|
|
3489
|
+
]
|
|
3455
3490
|
}
|
|
3456
|
-
)
|
|
3457
|
-
] }
|
|
3458
|
-
|
|
3459
|
-
|
|
3491
|
+
) }, f.key))
|
|
3492
|
+
] }) }),
|
|
3493
|
+
/* @__PURE__ */ e(
|
|
3494
|
+
z,
|
|
3460
3495
|
{
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
] })
|
|
3468
|
-
]
|
|
3496
|
+
onClick: () => {
|
|
3497
|
+
m(!0);
|
|
3498
|
+
},
|
|
3499
|
+
variant: "text",
|
|
3500
|
+
startIcon: /* @__PURE__ */ e(ue, {}),
|
|
3501
|
+
children: "Add custom entity view"
|
|
3469
3502
|
}
|
|
3470
|
-
)
|
|
3471
|
-
] }) })
|
|
3472
|
-
O === 0 && /* @__PURE__ */ e(Yr, { action: /* @__PURE__ */ e(
|
|
3473
|
-
z,
|
|
3474
|
-
{
|
|
3475
|
-
variant: "text",
|
|
3476
|
-
size: "small",
|
|
3477
|
-
href: "https://firecms.co/docs/customization_quickstart",
|
|
3478
|
-
component: "a",
|
|
3479
|
-
rel: "noopener noreferrer",
|
|
3480
|
-
target: "_blank",
|
|
3481
|
-
children: "More info"
|
|
3482
|
-
}
|
|
3483
|
-
), children: "Define your own custom views by uploading it with the CLI." }),
|
|
3484
|
-
/* @__PURE__ */ e(
|
|
3485
|
-
z,
|
|
3486
|
-
{
|
|
3487
|
-
onClick: () => {
|
|
3488
|
-
c(!0);
|
|
3489
|
-
},
|
|
3490
|
-
variant: "outlined",
|
|
3491
|
-
startIcon: /* @__PURE__ */ e(me, {}),
|
|
3492
|
-
children: "Add custom entity view"
|
|
3493
|
-
}
|
|
3494
|
-
)
|
|
3503
|
+
)
|
|
3504
|
+
] }) })
|
|
3495
3505
|
] })
|
|
3496
3506
|
] }) }),
|
|
3497
3507
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
@@ -3500,11 +3510,11 @@ function Zi({
|
|
|
3500
3510
|
{
|
|
3501
3511
|
open: !!u,
|
|
3502
3512
|
onAccept: () => {
|
|
3503
|
-
const
|
|
3513
|
+
const f = {
|
|
3504
3514
|
id: u,
|
|
3505
3515
|
parentCollectionIds: [...o ?? [], t.id]
|
|
3506
3516
|
};
|
|
3507
|
-
console.debug("Deleting subcollection",
|
|
3517
|
+
console.debug("Deleting subcollection", f), n.deleteCollection(f), p(void 0);
|
|
3508
3518
|
},
|
|
3509
3519
|
onCancel: () => p(void 0),
|
|
3510
3520
|
title: /* @__PURE__ */ e(U, { children: "Delete this subcollection?" }),
|
|
@@ -3515,14 +3525,14 @@ function Zi({
|
|
|
3515
3525
|
] })
|
|
3516
3526
|
}
|
|
3517
3527
|
),
|
|
3518
|
-
|
|
3528
|
+
c && /* @__PURE__ */ e(
|
|
3519
3529
|
lt,
|
|
3520
3530
|
{
|
|
3521
|
-
open: !!
|
|
3531
|
+
open: !!c,
|
|
3522
3532
|
onAccept: () => {
|
|
3523
|
-
|
|
3533
|
+
P("entityViews", y.entityViews?.filter((f) => f !== c)), g(void 0);
|
|
3524
3534
|
},
|
|
3525
|
-
onCancel: () =>
|
|
3535
|
+
onCancel: () => g(void 0),
|
|
3526
3536
|
title: /* @__PURE__ */ e(U, { children: "Remove this view?" }),
|
|
3527
3537
|
body: /* @__PURE__ */ a(U, { children: [
|
|
3528
3538
|
"This will ",
|
|
@@ -3543,16 +3553,16 @@ function Zi({
|
|
|
3543
3553
|
...v,
|
|
3544
3554
|
getUser: l,
|
|
3545
3555
|
handleClose: () => {
|
|
3546
|
-
|
|
3556
|
+
x(void 0);
|
|
3547
3557
|
}
|
|
3548
3558
|
}
|
|
3549
3559
|
),
|
|
3550
3560
|
/* @__PURE__ */ e(
|
|
3551
3561
|
Wi,
|
|
3552
3562
|
{
|
|
3553
|
-
open:
|
|
3554
|
-
onClose: (
|
|
3555
|
-
|
|
3563
|
+
open: h,
|
|
3564
|
+
onClose: (f) => {
|
|
3565
|
+
f && P("entityViews", [...y.entityViews ?? [], f]), m(!1);
|
|
3556
3566
|
}
|
|
3557
3567
|
}
|
|
3558
3568
|
)
|
|
@@ -3643,7 +3653,7 @@ const Lt = {
|
|
|
3643
3653
|
autoValue: "on_create"
|
|
3644
3654
|
}
|
|
3645
3655
|
})
|
|
3646
|
-
},
|
|
3656
|
+
}, qt = {
|
|
3647
3657
|
id: "blog",
|
|
3648
3658
|
path: "blog",
|
|
3649
3659
|
name: "Blog",
|
|
@@ -3755,7 +3765,7 @@ const Lt = {
|
|
|
3755
3765
|
initialFilter: {
|
|
3756
3766
|
status: ["==", "published"]
|
|
3757
3767
|
}
|
|
3758
|
-
},
|
|
3768
|
+
}, $t = {
|
|
3759
3769
|
id: "users",
|
|
3760
3770
|
path: "users",
|
|
3761
3771
|
name: "Users",
|
|
@@ -3987,34 +3997,34 @@ function Ji({
|
|
|
3987
3997
|
onContinue: i,
|
|
3988
3998
|
existingCollectionPaths: l
|
|
3989
3999
|
}) {
|
|
3990
|
-
const [o, d] =
|
|
3991
|
-
|
|
4000
|
+
const [o, d] = $(!1), [u, p] = $();
|
|
4001
|
+
ce(() => {
|
|
3992
4002
|
r && l && (d(!0), r(t).then((v) => {
|
|
3993
|
-
const
|
|
3994
|
-
p(
|
|
4003
|
+
const x = v.filter((y) => !(l ?? []).find((P) => P.trim().toLowerCase() === y.trim().toLowerCase()));
|
|
4004
|
+
p(x);
|
|
3995
4005
|
}).finally(() => d(!1)));
|
|
3996
4006
|
}, [l, t, r]);
|
|
3997
4007
|
const {
|
|
3998
|
-
values:
|
|
3999
|
-
setFieldValue:
|
|
4000
|
-
setValues:
|
|
4001
|
-
submitCount:
|
|
4008
|
+
values: h,
|
|
4009
|
+
setFieldValue: m,
|
|
4010
|
+
setValues: c,
|
|
4011
|
+
submitCount: g
|
|
4002
4012
|
} = K();
|
|
4003
4013
|
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: [
|
|
4004
4014
|
/* @__PURE__ */ e(
|
|
4005
4015
|
"div",
|
|
4006
4016
|
{
|
|
4007
4017
|
className: "flex flex-row py-2 pt-3 items-center",
|
|
4008
|
-
children: /* @__PURE__ */ e(
|
|
4018
|
+
children: /* @__PURE__ */ e(O, { variant: "h4", className: "flex-grow", children: "New collection" })
|
|
4009
4019
|
}
|
|
4010
4020
|
),
|
|
4011
|
-
n && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(
|
|
4021
|
+
n && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
4012
4022
|
"This is a subcollection of ",
|
|
4013
4023
|
/* @__PURE__ */ e("b", { children: n.name })
|
|
4014
4024
|
] }) }),
|
|
4015
4025
|
/* @__PURE__ */ a("div", { className: "my-2", children: [
|
|
4016
4026
|
/* @__PURE__ */ e(
|
|
4017
|
-
|
|
4027
|
+
O,
|
|
4018
4028
|
{
|
|
4019
4029
|
variant: "caption",
|
|
4020
4030
|
color: "secondary",
|
|
@@ -4022,25 +4032,25 @@ function Ji({
|
|
|
4022
4032
|
}
|
|
4023
4033
|
),
|
|
4024
4034
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
|
|
4025
|
-
o && !u && /* @__PURE__ */ e(
|
|
4026
|
-
u?.map((v,
|
|
4035
|
+
o && !u && /* @__PURE__ */ e(De, { size: "small" }),
|
|
4036
|
+
u?.map((v, x) => /* @__PURE__ */ e(
|
|
4027
4037
|
st,
|
|
4028
4038
|
{
|
|
4029
4039
|
colorScheme: "cyanLighter",
|
|
4030
4040
|
onClick: () => {
|
|
4031
|
-
|
|
4041
|
+
m("name", ut(v)), m("id", v), m("path", v), m("properties", void 0), i();
|
|
4032
4042
|
},
|
|
4033
4043
|
size: "small",
|
|
4034
4044
|
children: v
|
|
4035
4045
|
},
|
|
4036
4046
|
v
|
|
4037
4047
|
)),
|
|
4038
|
-
!o && (u ?? [])?.length === 0 && /* @__PURE__ */ e(
|
|
4048
|
+
!o && (u ?? [])?.length === 0 && /* @__PURE__ */ e(O, { variant: "caption", children: "No suggestions" })
|
|
4039
4049
|
] })
|
|
4040
4050
|
] }),
|
|
4041
4051
|
/* @__PURE__ */ a("div", { className: "my-2", children: [
|
|
4042
4052
|
/* @__PURE__ */ e(
|
|
4043
|
-
|
|
4053
|
+
O,
|
|
4044
4054
|
{
|
|
4045
4055
|
variant: "caption",
|
|
4046
4056
|
color: "secondary",
|
|
@@ -4055,7 +4065,7 @@ function Ji({
|
|
|
4055
4065
|
subtitle: "A collection of products with images, prices and stock",
|
|
4056
4066
|
icon: /* @__PURE__ */ e(et, { size: "small", iconKey: Lt.icon }),
|
|
4057
4067
|
onClick: () => {
|
|
4058
|
-
|
|
4068
|
+
c(Lt), i();
|
|
4059
4069
|
}
|
|
4060
4070
|
}
|
|
4061
4071
|
),
|
|
@@ -4064,9 +4074,9 @@ function Ji({
|
|
|
4064
4074
|
{
|
|
4065
4075
|
title: "Users",
|
|
4066
4076
|
subtitle: "A collection of users with emails, names and roles",
|
|
4067
|
-
icon: /* @__PURE__ */ e(et, { size: "small", iconKey:
|
|
4077
|
+
icon: /* @__PURE__ */ e(et, { size: "small", iconKey: $t.icon }),
|
|
4068
4078
|
onClick: () => {
|
|
4069
|
-
|
|
4079
|
+
c($t), i();
|
|
4070
4080
|
}
|
|
4071
4081
|
}
|
|
4072
4082
|
),
|
|
@@ -4075,9 +4085,9 @@ function Ji({
|
|
|
4075
4085
|
{
|
|
4076
4086
|
title: "Blog posts",
|
|
4077
4087
|
subtitle: "A collection of blog posts with images, authors and complex content",
|
|
4078
|
-
icon: /* @__PURE__ */ e(et, { size: "small", iconKey:
|
|
4088
|
+
icon: /* @__PURE__ */ e(et, { size: "small", iconKey: qt.icon }),
|
|
4079
4089
|
onClick: () => {
|
|
4080
|
-
|
|
4090
|
+
c(qt), i();
|
|
4081
4091
|
}
|
|
4082
4092
|
}
|
|
4083
4093
|
),
|
|
@@ -4088,7 +4098,7 @@ function Ji({
|
|
|
4088
4098
|
subtitle: "A collection of pages with images, authors and complex content",
|
|
4089
4099
|
icon: /* @__PURE__ */ e(et, { size: "small", iconKey: Yt.icon }),
|
|
4090
4100
|
onClick: () => {
|
|
4091
|
-
|
|
4101
|
+
c(Yt), i();
|
|
4092
4102
|
}
|
|
4093
4103
|
}
|
|
4094
4104
|
)
|
|
@@ -4096,7 +4106,7 @@ function Ji({
|
|
|
4096
4106
|
] }),
|
|
4097
4107
|
!n && /* @__PURE__ */ a("div", { children: [
|
|
4098
4108
|
/* @__PURE__ */ e(
|
|
4099
|
-
|
|
4109
|
+
O,
|
|
4100
4110
|
{
|
|
4101
4111
|
variant: "caption",
|
|
4102
4112
|
color: "secondary",
|
|
@@ -4104,7 +4114,7 @@ function Ji({
|
|
|
4104
4114
|
children: "● Create a collection from a file (csv, json, xls, xslx...)"
|
|
4105
4115
|
}
|
|
4106
4116
|
),
|
|
4107
|
-
/* @__PURE__ */ e(
|
|
4117
|
+
/* @__PURE__ */ e(ci, { onDataAdded: (v) => i(v) })
|
|
4108
4118
|
] }),
|
|
4109
4119
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(z, { variant: "text", onClick: () => i(), className: "my-2", children: "Continue from scratch" }) })
|
|
4110
4120
|
] }) });
|
|
@@ -4119,7 +4129,7 @@ function nt({
|
|
|
4119
4129
|
tr,
|
|
4120
4130
|
{
|
|
4121
4131
|
onClick: i,
|
|
4122
|
-
className:
|
|
4132
|
+
className: me(
|
|
4123
4133
|
"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",
|
|
4124
4134
|
"text-gray-700 dark:text-gray-300",
|
|
4125
4135
|
"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary",
|
|
@@ -4127,7 +4137,7 @@ function nt({
|
|
|
4127
4137
|
),
|
|
4128
4138
|
children: [
|
|
4129
4139
|
n,
|
|
4130
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ e(
|
|
4140
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-start", children: /* @__PURE__ */ e(O, { variant: "subtitle1", children: t }) })
|
|
4131
4141
|
]
|
|
4132
4142
|
}
|
|
4133
4143
|
) });
|
|
@@ -4141,42 +4151,42 @@ function Qi({
|
|
|
4141
4151
|
setFieldValue: i,
|
|
4142
4152
|
setFieldTouched: l,
|
|
4143
4153
|
values: o
|
|
4144
|
-
} = K(), [d, u] =
|
|
4154
|
+
} = K(), [d, u] = $(void 0), p = Y.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), h = d ? d.id : void 0, m = d || void 0, c = ({
|
|
4145
4155
|
id: v,
|
|
4146
|
-
property:
|
|
4156
|
+
property: x,
|
|
4147
4157
|
previousId: y,
|
|
4148
|
-
namespace:
|
|
4158
|
+
namespace: P
|
|
4149
4159
|
}) => {
|
|
4150
|
-
const T = v ? ae(v,
|
|
4151
|
-
const
|
|
4152
|
-
i(
|
|
4160
|
+
const T = v ? ae(v, P) : void 0, b = T ? pe(T) : void 0, C = (f) => f ? p.current[f] ?? I(o, ye(f)) : p.current[""], N = (f, w) => {
|
|
4161
|
+
const _ = ye(w);
|
|
4162
|
+
i(_, f, !1), p.current[w ?? ""] = f;
|
|
4153
4163
|
};
|
|
4154
4164
|
if (y && y !== v) {
|
|
4155
|
-
const
|
|
4156
|
-
|
|
4157
|
-
const
|
|
4158
|
-
Object.keys(
|
|
4159
|
-
|
|
4160
|
-
}), t.setHeadersMapping(
|
|
4165
|
+
const f = ae(y, P), w = pe(f), M = C(P).map((D) => D === y ? v : D).filter((D) => D !== void 0);
|
|
4166
|
+
N(M, P);
|
|
4167
|
+
const R = { ...t.headersMapping };
|
|
4168
|
+
Object.keys(R).forEach((D) => {
|
|
4169
|
+
R[D] === y && (R[D] = v ?? "");
|
|
4170
|
+
}), t.setHeadersMapping(R), i(w, void 0, !1), l(w, !1, !1);
|
|
4161
4171
|
}
|
|
4162
|
-
b && (i(b,
|
|
4163
|
-
},
|
|
4172
|
+
b && (i(b, x, !1), l(b, !0, !1));
|
|
4173
|
+
}, g = async ({
|
|
4164
4174
|
id: v,
|
|
4165
|
-
importKey:
|
|
4175
|
+
importKey: x,
|
|
4166
4176
|
property: y,
|
|
4167
|
-
namespace:
|
|
4177
|
+
namespace: P
|
|
4168
4178
|
}) => {
|
|
4169
|
-
const T = v ? ae(v,
|
|
4170
|
-
...ti(
|
|
4179
|
+
const T = v ? ae(v, P) : void 0, b = T ? pe(T) : void 0, C = t.importData.map((f) => I(f, x)), N = {
|
|
4180
|
+
...ti(C, y, rr),
|
|
4171
4181
|
editable: !0
|
|
4172
4182
|
};
|
|
4173
|
-
b && (
|
|
4183
|
+
b && (N ? i(b, N, !1) : i(b, y, !1), l(b, !0, !1));
|
|
4174
4184
|
};
|
|
4175
|
-
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto
|
|
4185
|
+
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
4176
4186
|
/* @__PURE__ */ a(mt, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
4177
|
-
/* @__PURE__ */ e(
|
|
4187
|
+
/* @__PURE__ */ e(O, { variant: "h6", className: "mt-4", children: "Data property mapping" }),
|
|
4178
4188
|
/* @__PURE__ */ e(
|
|
4179
|
-
|
|
4189
|
+
di,
|
|
4180
4190
|
{
|
|
4181
4191
|
headersMapping: t.headersMapping,
|
|
4182
4192
|
idColumn: t.idColumn,
|
|
@@ -4185,18 +4195,18 @@ function Qi({
|
|
|
4185
4195
|
onIdPropertyChanged: (v) => t.setIdColumn(v),
|
|
4186
4196
|
buildPropertyView: ({
|
|
4187
4197
|
property: v,
|
|
4188
|
-
propertyKey:
|
|
4198
|
+
propertyKey: x,
|
|
4189
4199
|
importKey: y
|
|
4190
4200
|
}) => /* @__PURE__ */ e(
|
|
4191
4201
|
ui,
|
|
4192
4202
|
{
|
|
4193
4203
|
property: v,
|
|
4194
|
-
propertyKey:
|
|
4195
|
-
onPropertyNameChanged: (
|
|
4204
|
+
propertyKey: x,
|
|
4205
|
+
onPropertyNameChanged: (P, T) => i(`properties.${P}.name`, T, !1),
|
|
4196
4206
|
onEditClick: () => {
|
|
4197
|
-
!
|
|
4207
|
+
!x || !v || u({
|
|
4198
4208
|
...v,
|
|
4199
|
-
id:
|
|
4209
|
+
id: x,
|
|
4200
4210
|
editable: !0
|
|
4201
4211
|
});
|
|
4202
4212
|
},
|
|
@@ -4205,11 +4215,11 @@ function Qi({
|
|
|
4205
4215
|
{
|
|
4206
4216
|
property: v,
|
|
4207
4217
|
disabled: !1,
|
|
4208
|
-
onPropertyChanged: (
|
|
4209
|
-
...
|
|
4218
|
+
onPropertyChanged: (P) => g({
|
|
4219
|
+
...P,
|
|
4210
4220
|
importKey: y
|
|
4211
4221
|
}),
|
|
4212
|
-
propertyKey:
|
|
4222
|
+
propertyKey: x,
|
|
4213
4223
|
propertyConfigs: r
|
|
4214
4224
|
}
|
|
4215
4225
|
)
|
|
@@ -4222,11 +4232,11 @@ function Qi({
|
|
|
4222
4232
|
Ve,
|
|
4223
4233
|
{
|
|
4224
4234
|
open: d !== void 0,
|
|
4225
|
-
propertyKey:
|
|
4226
|
-
property:
|
|
4235
|
+
propertyKey: h,
|
|
4236
|
+
property: m,
|
|
4227
4237
|
inArray: !1,
|
|
4228
4238
|
autoUpdateId: !1,
|
|
4229
|
-
onPropertyChanged:
|
|
4239
|
+
onPropertyChanged: c,
|
|
4230
4240
|
allowDataInference: !1,
|
|
4231
4241
|
collectionEditable: n,
|
|
4232
4242
|
onOkClicked: () => {
|
|
@@ -4250,7 +4260,7 @@ function Xi({
|
|
|
4250
4260
|
propertyConfigs: i,
|
|
4251
4261
|
disabled: l
|
|
4252
4262
|
}) {
|
|
4253
|
-
const o = t ?
|
|
4263
|
+
const o = t ? Kt(t) : null, d = t ? $e(t, i) : null, [u, p] = $(!1);
|
|
4254
4264
|
return /* @__PURE__ */ e(
|
|
4255
4265
|
te,
|
|
4256
4266
|
{
|
|
@@ -4268,25 +4278,25 @@ function Xi({
|
|
|
4268
4278
|
value: o ?? "",
|
|
4269
4279
|
placeholder: "Select a property widget",
|
|
4270
4280
|
position: "item-aligned",
|
|
4271
|
-
renderValue: (
|
|
4272
|
-
onValueChange: (
|
|
4273
|
-
const
|
|
4281
|
+
renderValue: (h) => d ? /* @__PURE__ */ e(Ye, { propertyConfig: d }) : null,
|
|
4282
|
+
onValueChange: (h) => {
|
|
4283
|
+
const m = ar(t, h, i);
|
|
4274
4284
|
n && r({
|
|
4275
4285
|
id: n,
|
|
4276
|
-
property:
|
|
4286
|
+
property: m,
|
|
4277
4287
|
previousId: n,
|
|
4278
4288
|
namespace: void 0
|
|
4279
4289
|
});
|
|
4280
4290
|
},
|
|
4281
|
-
children: Object.entries(lr).map(([
|
|
4291
|
+
children: Object.entries(lr).map(([h, m]) => /* @__PURE__ */ e(
|
|
4282
4292
|
or,
|
|
4283
4293
|
{
|
|
4284
|
-
value:
|
|
4294
|
+
value: h,
|
|
4285
4295
|
optionDisabled: !1,
|
|
4286
|
-
propertyConfig:
|
|
4296
|
+
propertyConfig: m,
|
|
4287
4297
|
existing: !1
|
|
4288
4298
|
},
|
|
4289
|
-
|
|
4299
|
+
h
|
|
4290
4300
|
))
|
|
4291
4301
|
}
|
|
4292
4302
|
)
|
|
@@ -4294,17 +4304,17 @@ function Xi({
|
|
|
4294
4304
|
);
|
|
4295
4305
|
}
|
|
4296
4306
|
function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
4297
|
-
|
|
4307
|
+
ce(() => {
|
|
4298
4308
|
const l = pi(t.originProperties, r), o = t.importData.map((d) => mi(d, t.idColumn, t.headersMapping, r, l, "TEMP_PATH"));
|
|
4299
4309
|
t.setEntities(o);
|
|
4300
4310
|
}, []);
|
|
4301
|
-
const i =
|
|
4311
|
+
const i = wr();
|
|
4302
4312
|
return /* @__PURE__ */ e(
|
|
4303
|
-
|
|
4313
|
+
Tr,
|
|
4304
4314
|
{
|
|
4305
4315
|
title: /* @__PURE__ */ a("div", { children: [
|
|
4306
|
-
/* @__PURE__ */ e(
|
|
4307
|
-
/* @__PURE__ */ e(
|
|
4316
|
+
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Imported data preview" }),
|
|
4317
|
+
/* @__PURE__ */ e(O, { variant: "caption", children: "Entities with the same id will be overwritten" })
|
|
4308
4318
|
] }),
|
|
4309
4319
|
tableController: {
|
|
4310
4320
|
data: t.entities,
|
|
@@ -4320,30 +4330,30 @@ function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
|
4320
4330
|
}
|
|
4321
4331
|
);
|
|
4322
4332
|
}
|
|
4323
|
-
function
|
|
4333
|
+
function dr(t, r = "") {
|
|
4324
4334
|
const n = Object.keys(t).reduce((o, d) => {
|
|
4325
|
-
const u = t[d], p =
|
|
4335
|
+
const u = t[d], p = kr(d), h = r ? `${r}.${p}` : p;
|
|
4326
4336
|
if (u.dataType === "map" && u.properties) {
|
|
4327
|
-
const
|
|
4337
|
+
const g = dr(u.properties, h);
|
|
4328
4338
|
return {
|
|
4329
|
-
headersMapping: { ...o.headersMapping, [d]:
|
|
4339
|
+
headersMapping: { ...o.headersMapping, [d]: h },
|
|
4330
4340
|
properties: {
|
|
4331
4341
|
...o.properties,
|
|
4332
4342
|
[p]: {
|
|
4333
4343
|
...u,
|
|
4334
|
-
properties:
|
|
4335
|
-
propertiesOrder: Object.keys(
|
|
4344
|
+
properties: g.properties,
|
|
4345
|
+
propertiesOrder: Object.keys(g.properties)
|
|
4336
4346
|
}
|
|
4337
4347
|
}
|
|
4338
4348
|
};
|
|
4339
4349
|
}
|
|
4340
|
-
const
|
|
4350
|
+
const m = {
|
|
4341
4351
|
...o.properties,
|
|
4342
4352
|
[p]: u
|
|
4343
4353
|
};
|
|
4344
4354
|
return {
|
|
4345
|
-
headersMapping: { ...o.headersMapping, [d]:
|
|
4346
|
-
properties:
|
|
4355
|
+
headersMapping: { ...o.headersMapping, [d]: h },
|
|
4356
|
+
properties: m
|
|
4347
4357
|
};
|
|
4348
4358
|
}, { headersMapping: {}, properties: {} }), i = Object.keys(n.headersMapping)?.[0];
|
|
4349
4359
|
let l;
|
|
@@ -4353,13 +4363,13 @@ function cr(t, r = "") {
|
|
|
4353
4363
|
};
|
|
4354
4364
|
}
|
|
4355
4365
|
function ur(t) {
|
|
4356
|
-
const r = t.open, [n, i] =
|
|
4366
|
+
const r = t.open, [n, i] = je.useState(!1), [l, o] = je.useState(!1), d = Q(() => {
|
|
4357
4367
|
n ? o(!0) : t.handleClose(void 0);
|
|
4358
4368
|
}, [n, t.handleClose]);
|
|
4359
|
-
return
|
|
4369
|
+
return ce(() => {
|
|
4360
4370
|
r || (i(!1), o(!1));
|
|
4361
4371
|
}, [r]), /* @__PURE__ */ a(
|
|
4362
|
-
|
|
4372
|
+
Fe,
|
|
4363
4373
|
{
|
|
4364
4374
|
open: r,
|
|
4365
4375
|
fullWidth: !0,
|
|
@@ -4390,13 +4400,13 @@ function ur(t) {
|
|
|
4390
4400
|
);
|
|
4391
4401
|
}
|
|
4392
4402
|
function tn(t) {
|
|
4393
|
-
const { propertyConfigs: r } =
|
|
4403
|
+
const { propertyConfigs: r } = Ae(), n = Pe(), i = _e(), {
|
|
4394
4404
|
topLevelNavigation: l,
|
|
4395
4405
|
collections: o
|
|
4396
|
-
} = n, d = t.initialValues, u = !d?.path && (t.parentCollectionIds ?? []).length === 0, p = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [],
|
|
4397
|
-
if (
|
|
4406
|
+
} = n, d = t.initialValues, u = !d?.path && (t.parentCollectionIds ?? []).length === 0, p = (t.parentCollection ? t.parentCollection.subcollections : o) ?? [], h = p.map((b) => b.path.trim().toLowerCase()), m = p.map((b) => b.id?.trim().toLowerCase()).filter(Boolean), [c, g] = je.useState(), [v, x] = je.useState(!1);
|
|
4407
|
+
if (ce(() => {
|
|
4398
4408
|
try {
|
|
4399
|
-
n.initialised && (t.editedCollectionId ?
|
|
4409
|
+
n.initialised && (t.editedCollectionId ? g(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : g(void 0), x(!0));
|
|
4400
4410
|
} catch (b) {
|
|
4401
4411
|
console.error(b);
|
|
4402
4412
|
}
|
|
@@ -4404,10 +4414,10 @@ function tn(t) {
|
|
|
4404
4414
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
4405
4415
|
const {
|
|
4406
4416
|
groups: y
|
|
4407
|
-
} = l,
|
|
4408
|
-
...
|
|
4409
|
-
id:
|
|
4410
|
-
} : void 0, T =
|
|
4417
|
+
} = l, P = c ? {
|
|
4418
|
+
...c,
|
|
4419
|
+
id: c.id ?? c.path ?? _t(16)
|
|
4420
|
+
} : void 0, T = P ? nn(P, r) : {
|
|
4411
4421
|
id: d?.path ?? _t(16),
|
|
4412
4422
|
path: d?.path ?? "",
|
|
4413
4423
|
name: d?.name ?? "",
|
|
@@ -4422,11 +4432,11 @@ function tn(t) {
|
|
|
4422
4432
|
{
|
|
4423
4433
|
...t,
|
|
4424
4434
|
initialValues: T,
|
|
4425
|
-
existingPaths:
|
|
4426
|
-
existingIds:
|
|
4435
|
+
existingPaths: h,
|
|
4436
|
+
existingIds: m,
|
|
4427
4437
|
includeTemplates: u,
|
|
4428
|
-
collection:
|
|
4429
|
-
setCollection:
|
|
4438
|
+
collection: c,
|
|
4439
|
+
setCollection: g,
|
|
4430
4440
|
groups: y,
|
|
4431
4441
|
propertyConfigs: r
|
|
4432
4442
|
}
|
|
@@ -4442,72 +4452,72 @@ function rn({
|
|
|
4442
4452
|
handleClose: d,
|
|
4443
4453
|
reservedGroups: u,
|
|
4444
4454
|
extraView: p,
|
|
4445
|
-
handleCancel:
|
|
4446
|
-
setFormDirty:
|
|
4447
|
-
pathSuggestions:
|
|
4448
|
-
getUser:
|
|
4455
|
+
handleCancel: h,
|
|
4456
|
+
setFormDirty: m,
|
|
4457
|
+
pathSuggestions: c,
|
|
4458
|
+
getUser: g,
|
|
4449
4459
|
parentCollection: v,
|
|
4450
|
-
getData:
|
|
4460
|
+
getData: x,
|
|
4451
4461
|
existingPaths: y,
|
|
4452
|
-
existingIds:
|
|
4462
|
+
existingIds: P,
|
|
4453
4463
|
includeTemplates: T,
|
|
4454
4464
|
collection: b,
|
|
4455
|
-
setCollection:
|
|
4456
|
-
initialValues:
|
|
4457
|
-
propertyConfigs:
|
|
4458
|
-
groups:
|
|
4465
|
+
setCollection: C,
|
|
4466
|
+
initialValues: N,
|
|
4467
|
+
propertyConfigs: f,
|
|
4468
|
+
groups: w
|
|
4459
4469
|
}) {
|
|
4460
|
-
const
|
|
4461
|
-
const
|
|
4470
|
+
const _ = hi(), M = Pe(), R = Ie(), D = Le({}), A = t ? T ? "welcome" : "details" : "properties", [s, V] = $(A), [G, B] = je.useState(), q = (k) => {
|
|
4471
|
+
const S = k.id || k.path;
|
|
4462
4472
|
return r.saveCollection({
|
|
4463
|
-
id:
|
|
4473
|
+
id: S,
|
|
4464
4474
|
collectionData: k,
|
|
4465
4475
|
previousId: n,
|
|
4466
4476
|
parentCollectionIds: i
|
|
4467
|
-
}).then(() => (
|
|
4477
|
+
}).then(() => (B(void 0), !0)).catch((E) => (B(E), console.error(E), R.open({
|
|
4468
4478
|
type: "error",
|
|
4469
|
-
message: "Error persisting collection: " + (
|
|
4479
|
+
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4470
4480
|
}), !1));
|
|
4471
|
-
}, L =
|
|
4472
|
-
|
|
4473
|
-
}, [
|
|
4481
|
+
}, L = Q(() => {
|
|
4482
|
+
s === "details" ? _.inUse ? V("import_data_saving") : V(p ? "extra_view" : "properties") : V(s === "welcome" ? "details" : s === "import_data_mapping" ? "import_data_preview" : s === "import_data_preview" ? "details" : s === "extra_view" ? "properties" : "details");
|
|
4483
|
+
}, [s, _.inUse, p]), J = Q((k) => {
|
|
4474
4484
|
if (o)
|
|
4475
4485
|
return o?.(k.path, k.collectionGroup ?? !1, i ?? []);
|
|
4476
|
-
}, [o, i]), le =
|
|
4486
|
+
}, [o, i]), le = Q(async (k) => {
|
|
4477
4487
|
try {
|
|
4478
|
-
if (!
|
|
4479
|
-
return
|
|
4480
|
-
|
|
4481
|
-
const
|
|
4482
|
-
if (!
|
|
4483
|
-
return
|
|
4484
|
-
const
|
|
4488
|
+
if (!J)
|
|
4489
|
+
return C(k), Promise.resolve(k);
|
|
4490
|
+
V("loading");
|
|
4491
|
+
const S = await J?.(k);
|
|
4492
|
+
if (!S)
|
|
4493
|
+
return C(k), Promise.resolve(k);
|
|
4494
|
+
const E = {
|
|
4485
4495
|
...k ?? {}
|
|
4486
4496
|
};
|
|
4487
|
-
return Object.keys(
|
|
4497
|
+
return Object.keys(S.properties ?? {}).length > 0 && (E.properties = S.properties, E.propertiesOrder = S.propertiesOrder), E.propertiesOrder ? (C(E), console.debug("Inferred collection", {
|
|
4488
4498
|
newCollection: k ?? {},
|
|
4489
|
-
values:
|
|
4490
|
-
}),
|
|
4491
|
-
} catch (
|
|
4492
|
-
return console.error(
|
|
4499
|
+
values: E
|
|
4500
|
+
}), E) : (E.propertiesOrder = Object.keys(E.properties), E);
|
|
4501
|
+
} catch (S) {
|
|
4502
|
+
return console.error(S), R.open({
|
|
4493
4503
|
type: "error",
|
|
4494
|
-
message: "Error inferring collection: " + (
|
|
4504
|
+
message: "Error inferring collection: " + (S.message ?? "Details in the console")
|
|
4495
4505
|
}), k;
|
|
4496
4506
|
}
|
|
4497
|
-
}, [i,
|
|
4498
|
-
initialValues:
|
|
4499
|
-
onSubmit: (k,
|
|
4507
|
+
}, [i, J]), de = Tt({
|
|
4508
|
+
initialValues: N,
|
|
4509
|
+
onSubmit: (k, S) => {
|
|
4500
4510
|
console.log("Submitting collection", k);
|
|
4501
4511
|
try {
|
|
4502
4512
|
if (!t) {
|
|
4503
|
-
|
|
4504
|
-
|
|
4513
|
+
q(k).then(() => {
|
|
4514
|
+
S.resetForm({ values: N }), d(k);
|
|
4505
4515
|
});
|
|
4506
4516
|
return;
|
|
4507
4517
|
}
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
values:
|
|
4518
|
+
s === "welcome" ? (L(), S.resetForm({ values: k })) : s === "details" ? p || _.inUse ? (S.resetForm({ values: k }), L()) : t ? le(k).then((E) => {
|
|
4519
|
+
S.resetForm({
|
|
4520
|
+
values: E ?? k,
|
|
4511
4521
|
touched: {
|
|
4512
4522
|
path: !0,
|
|
4513
4523
|
name: !0
|
|
@@ -4515,34 +4525,34 @@ function rn({
|
|
|
4515
4525
|
});
|
|
4516
4526
|
}).finally(() => {
|
|
4517
4527
|
L();
|
|
4518
|
-
}) : (
|
|
4519
|
-
|
|
4520
|
-
}) : (L(),
|
|
4521
|
-
} catch (
|
|
4522
|
-
|
|
4528
|
+
}) : (S.resetForm({ values: k }), L()) : s === "extra_view" ? (L(), S.resetForm({ values: k })) : s === "import_data_mapping" || s === "import_data_preview" ? L() : s === "properties" ? q(k).then(() => {
|
|
4529
|
+
S.resetForm({ values: N }), L(), d(k);
|
|
4530
|
+
}) : (L(), S.resetForm({ values: k }));
|
|
4531
|
+
} catch (E) {
|
|
4532
|
+
R.open({
|
|
4523
4533
|
type: "error",
|
|
4524
|
-
message: "Error persisting collection: " + (
|
|
4525
|
-
}), console.error(
|
|
4534
|
+
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4535
|
+
}), console.error(E), S.resetForm({ values: k });
|
|
4526
4536
|
}
|
|
4527
4537
|
},
|
|
4528
4538
|
validation: (k) => {
|
|
4529
|
-
let
|
|
4530
|
-
const
|
|
4531
|
-
if (
|
|
4539
|
+
let S = {};
|
|
4540
|
+
const E = (s === "properties" || s === "subcollections" || s === "details") && vi;
|
|
4541
|
+
if (E)
|
|
4532
4542
|
try {
|
|
4533
|
-
|
|
4543
|
+
E.validateSync(k, { abortEarly: !1 });
|
|
4534
4544
|
} catch (ie) {
|
|
4535
4545
|
ie.inner.forEach((ke) => {
|
|
4536
|
-
|
|
4546
|
+
S[ke.path] = ke.message;
|
|
4537
4547
|
});
|
|
4538
4548
|
}
|
|
4539
|
-
if (
|
|
4549
|
+
if (s === "properties" && (S = { ...S, ...D.current }), s === "details") {
|
|
4540
4550
|
const ie = Ht(k.path, t, y, k.id);
|
|
4541
|
-
ie && (
|
|
4542
|
-
const ke = an(k.id, t, y,
|
|
4543
|
-
ke && (
|
|
4551
|
+
ie && (S.path = ie);
|
|
4552
|
+
const ke = an(k.id, t, y, P);
|
|
4553
|
+
ke && (S.id = ke);
|
|
4544
4554
|
}
|
|
4545
|
-
return
|
|
4555
|
+
return S;
|
|
4546
4556
|
}
|
|
4547
4557
|
}), {
|
|
4548
4558
|
values: re,
|
|
@@ -4550,27 +4560,27 @@ function rn({
|
|
|
4550
4560
|
isSubmitting: Te,
|
|
4551
4561
|
dirty: Ge,
|
|
4552
4562
|
submitCount: gt
|
|
4553
|
-
} =
|
|
4554
|
-
|
|
4555
|
-
|
|
4563
|
+
} = de, fe = re.path ?? n, Ke = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + fe : fe, We = Ht(fe, t, y, re.id), Ze = !We && i ? M.convertIdsToPaths(i) : void 0, Je = We ? void 0 : M.resolveAliasesFrom(Ke), Re = Je && x ? () => x(Je, Ze ?? []) : void 0;
|
|
4564
|
+
ce(() => {
|
|
4565
|
+
m(Ge);
|
|
4556
4566
|
}, [Ge]);
|
|
4557
4567
|
function Qe(k) {
|
|
4558
|
-
|
|
4559
|
-
const
|
|
4560
|
-
he("properties",
|
|
4568
|
+
_.setInUse(!0), ri(k, rr).then((S) => {
|
|
4569
|
+
const E = dr(S);
|
|
4570
|
+
he("properties", E.properties), he("propertiesOrder", Object.keys(E.properties)), _.setIdColumn(E.idColumn), _.setImportData(k), _.setHeadersMapping(E.headersMapping), _.setOriginProperties(E.properties);
|
|
4561
4571
|
});
|
|
4562
4572
|
}
|
|
4563
4573
|
const vt = !!re.name && !!re.id, yt = () => {
|
|
4564
4574
|
const k = { ...re.properties };
|
|
4565
|
-
|
|
4566
|
-
},
|
|
4567
|
-
return /* @__PURE__ */ e(
|
|
4575
|
+
_.idColumn && delete k[_.idColumn], he("properties", k), L();
|
|
4576
|
+
}, j = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4577
|
+
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value: de, children: /* @__PURE__ */ a(U, { children: [
|
|
4568
4578
|
!t && /* @__PURE__ */ a(
|
|
4569
4579
|
Hr,
|
|
4570
4580
|
{
|
|
4571
|
-
value:
|
|
4572
|
-
className:
|
|
4573
|
-
onValueChange: (k) =>
|
|
4581
|
+
value: s,
|
|
4582
|
+
className: me(wt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
4583
|
+
onValueChange: (k) => V(k),
|
|
4574
4584
|
children: [
|
|
4575
4585
|
/* @__PURE__ */ e(Ct, { value: "details", children: "Details" }),
|
|
4576
4586
|
/* @__PURE__ */ e(Ct, { value: "properties", children: "Properties" }),
|
|
@@ -4582,130 +4592,130 @@ function rn({
|
|
|
4582
4592
|
"form",
|
|
4583
4593
|
{
|
|
4584
4594
|
noValidate: !0,
|
|
4585
|
-
onSubmit:
|
|
4586
|
-
className:
|
|
4595
|
+
onSubmit: de.handleSubmit,
|
|
4596
|
+
className: me(
|
|
4587
4597
|
t ? "h-full" : "h-[calc(100%-48px)]",
|
|
4588
4598
|
"flex-grow flex flex-col relative"
|
|
4589
4599
|
),
|
|
4590
4600
|
children: [
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4601
|
+
s === "loading" && /* @__PURE__ */ e(Nt, {}),
|
|
4602
|
+
s === "extra_view" && fe && p?.View && /* @__PURE__ */ e(p.View, { path: fe }),
|
|
4603
|
+
s === "welcome" && /* @__PURE__ */ e(
|
|
4594
4604
|
Ji,
|
|
4595
4605
|
{
|
|
4596
4606
|
path: fe,
|
|
4597
4607
|
onContinue: (k) => {
|
|
4598
|
-
k ? (Qe(k),
|
|
4608
|
+
k ? (Qe(k), V("import_data_mapping")) : V("details");
|
|
4599
4609
|
},
|
|
4600
4610
|
existingCollectionPaths: y,
|
|
4601
4611
|
parentCollection: v,
|
|
4602
|
-
pathSuggestions:
|
|
4612
|
+
pathSuggestions: c
|
|
4603
4613
|
}
|
|
4604
4614
|
),
|
|
4605
|
-
|
|
4615
|
+
s === "import_data_mapping" && _ && /* @__PURE__ */ e(
|
|
4606
4616
|
Qi,
|
|
4607
4617
|
{
|
|
4608
|
-
importConfig:
|
|
4609
|
-
collectionEditable:
|
|
4610
|
-
propertyConfigs:
|
|
4618
|
+
importConfig: _,
|
|
4619
|
+
collectionEditable: j,
|
|
4620
|
+
propertyConfigs: f
|
|
4611
4621
|
}
|
|
4612
4622
|
),
|
|
4613
|
-
|
|
4623
|
+
s === "import_data_preview" && _ && /* @__PURE__ */ e(
|
|
4614
4624
|
en,
|
|
4615
4625
|
{
|
|
4616
|
-
importConfig:
|
|
4626
|
+
importConfig: _,
|
|
4617
4627
|
properties: re.properties,
|
|
4618
4628
|
propertiesOrder: re.propertiesOrder
|
|
4619
4629
|
}
|
|
4620
4630
|
),
|
|
4621
|
-
|
|
4631
|
+
s === "import_data_saving" && _ && /* @__PURE__ */ e(
|
|
4622
4632
|
fi,
|
|
4623
4633
|
{
|
|
4624
|
-
importConfig:
|
|
4634
|
+
importConfig: _,
|
|
4625
4635
|
collection: re,
|
|
4626
|
-
onImportSuccess: (k) => {
|
|
4627
|
-
|
|
4636
|
+
onImportSuccess: async (k) => {
|
|
4637
|
+
R.open({
|
|
4628
4638
|
type: "info",
|
|
4629
4639
|
message: "Data imported successfully"
|
|
4630
|
-
});
|
|
4640
|
+
}), await q(re), d(k);
|
|
4631
4641
|
}
|
|
4632
4642
|
}
|
|
4633
4643
|
),
|
|
4634
|
-
|
|
4644
|
+
s === "details" && /* @__PURE__ */ e(
|
|
4635
4645
|
yi,
|
|
4636
4646
|
{
|
|
4637
4647
|
existingPaths: y,
|
|
4638
|
-
existingIds:
|
|
4639
|
-
groups:
|
|
4648
|
+
existingIds: P,
|
|
4649
|
+
groups: w,
|
|
4640
4650
|
parentCollectionIds: i,
|
|
4641
4651
|
parentCollection: v,
|
|
4642
4652
|
isNewCollection: t
|
|
4643
4653
|
}
|
|
4644
4654
|
),
|
|
4645
|
-
|
|
4655
|
+
s === "subcollections" && b && /* @__PURE__ */ e(
|
|
4646
4656
|
Zi,
|
|
4647
4657
|
{
|
|
4648
4658
|
parentCollection: v,
|
|
4649
4659
|
configController: r,
|
|
4650
|
-
getUser:
|
|
4660
|
+
getUser: g,
|
|
4651
4661
|
collectionInference: o,
|
|
4652
4662
|
parentCollectionIds: i,
|
|
4653
4663
|
collection: b
|
|
4654
4664
|
}
|
|
4655
4665
|
),
|
|
4656
|
-
|
|
4666
|
+
s === "properties" && /* @__PURE__ */ e(
|
|
4657
4667
|
Gi,
|
|
4658
4668
|
{
|
|
4659
4669
|
showErrors: gt > 0,
|
|
4660
4670
|
isNewCollection: t,
|
|
4661
4671
|
reservedGroups: u,
|
|
4662
|
-
onPropertyError: (k,
|
|
4672
|
+
onPropertyError: (k, S, E) => {
|
|
4663
4673
|
const ie = Ft({
|
|
4664
|
-
...
|
|
4665
|
-
[ir(k,
|
|
4674
|
+
...D.current,
|
|
4675
|
+
[ir(k, S)]: Ft(E, !0)
|
|
4666
4676
|
}, !0);
|
|
4667
|
-
|
|
4677
|
+
D.current = ie, de.validate();
|
|
4668
4678
|
},
|
|
4669
|
-
getUser:
|
|
4670
|
-
getData:
|
|
4671
|
-
doCollectionInference:
|
|
4672
|
-
propertyConfigs:
|
|
4673
|
-
collectionEditable:
|
|
4679
|
+
getUser: g,
|
|
4680
|
+
getData: Re,
|
|
4681
|
+
doCollectionInference: J,
|
|
4682
|
+
propertyConfigs: f,
|
|
4683
|
+
collectionEditable: j,
|
|
4674
4684
|
extraIcon: p?.icon && /* @__PURE__ */ e(
|
|
4675
4685
|
oe,
|
|
4676
4686
|
{
|
|
4677
4687
|
color: "primary",
|
|
4678
|
-
onClick: () =>
|
|
4688
|
+
onClick: () => V("extra_view"),
|
|
4679
4689
|
children: p.icon
|
|
4680
4690
|
}
|
|
4681
4691
|
)
|
|
4682
4692
|
}
|
|
4683
4693
|
),
|
|
4684
|
-
|
|
4685
|
-
|
|
4694
|
+
s !== "welcome" && /* @__PURE__ */ a(
|
|
4695
|
+
ze,
|
|
4686
4696
|
{
|
|
4687
4697
|
position: "absolute",
|
|
4688
4698
|
children: [
|
|
4689
|
-
G && /* @__PURE__ */ e(
|
|
4690
|
-
t && T &&
|
|
4699
|
+
G && /* @__PURE__ */ e(Wt, { error: G }),
|
|
4700
|
+
t && T && s === "import_data_mapping" && /* @__PURE__ */ a(
|
|
4691
4701
|
z,
|
|
4692
4702
|
{
|
|
4693
4703
|
variant: "text",
|
|
4694
4704
|
type: "button",
|
|
4695
|
-
onClick: () => (
|
|
4705
|
+
onClick: () => (_.setInUse(!1), V("welcome")),
|
|
4696
4706
|
children: [
|
|
4697
4707
|
/* @__PURE__ */ e(tt, {}),
|
|
4698
4708
|
"Back"
|
|
4699
4709
|
]
|
|
4700
4710
|
}
|
|
4701
4711
|
),
|
|
4702
|
-
t && T &&
|
|
4712
|
+
t && T && s === "import_data_preview" && /* @__PURE__ */ a(
|
|
4703
4713
|
z,
|
|
4704
4714
|
{
|
|
4705
4715
|
variant: "text",
|
|
4706
4716
|
type: "button",
|
|
4707
4717
|
onClick: () => {
|
|
4708
|
-
|
|
4718
|
+
V("import_data_mapping");
|
|
4709
4719
|
},
|
|
4710
4720
|
children: [
|
|
4711
4721
|
/* @__PURE__ */ e(tt, {}),
|
|
@@ -4713,24 +4723,24 @@ function rn({
|
|
|
4713
4723
|
]
|
|
4714
4724
|
}
|
|
4715
4725
|
),
|
|
4716
|
-
t && T &&
|
|
4726
|
+
t && T && s === "details" && /* @__PURE__ */ a(
|
|
4717
4727
|
z,
|
|
4718
4728
|
{
|
|
4719
4729
|
variant: "text",
|
|
4720
4730
|
type: "button",
|
|
4721
|
-
onClick: () =>
|
|
4731
|
+
onClick: () => V("welcome"),
|
|
4722
4732
|
children: [
|
|
4723
4733
|
/* @__PURE__ */ e(tt, {}),
|
|
4724
4734
|
"Back"
|
|
4725
4735
|
]
|
|
4726
4736
|
}
|
|
4727
4737
|
),
|
|
4728
|
-
t &&
|
|
4738
|
+
t && s === "properties" && /* @__PURE__ */ a(
|
|
4729
4739
|
z,
|
|
4730
4740
|
{
|
|
4731
4741
|
variant: "text",
|
|
4732
4742
|
type: "button",
|
|
4733
|
-
onClick: () =>
|
|
4743
|
+
onClick: () => V("details"),
|
|
4734
4744
|
children: [
|
|
4735
4745
|
/* @__PURE__ */ e(tt, {}),
|
|
4736
4746
|
"Back"
|
|
@@ -4742,12 +4752,12 @@ function rn({
|
|
|
4742
4752
|
{
|
|
4743
4753
|
variant: "text",
|
|
4744
4754
|
onClick: () => {
|
|
4745
|
-
|
|
4755
|
+
h();
|
|
4746
4756
|
},
|
|
4747
4757
|
children: "Cancel"
|
|
4748
4758
|
}
|
|
4749
4759
|
),
|
|
4750
|
-
t &&
|
|
4760
|
+
t && s === "import_data_mapping" && /* @__PURE__ */ e(
|
|
4751
4761
|
z,
|
|
4752
4762
|
{
|
|
4753
4763
|
variant: "filled",
|
|
@@ -4756,7 +4766,7 @@ function rn({
|
|
|
4756
4766
|
children: "Next"
|
|
4757
4767
|
}
|
|
4758
4768
|
),
|
|
4759
|
-
t &&
|
|
4769
|
+
t && s === "import_data_preview" && /* @__PURE__ */ e(
|
|
4760
4770
|
z,
|
|
4761
4771
|
{
|
|
4762
4772
|
variant: "filled",
|
|
@@ -4767,18 +4777,18 @@ function rn({
|
|
|
4767
4777
|
children: "Next"
|
|
4768
4778
|
}
|
|
4769
4779
|
),
|
|
4770
|
-
t && (
|
|
4780
|
+
t && (s === "details" || s === "properties") && /* @__PURE__ */ a(
|
|
4771
4781
|
Mt,
|
|
4772
4782
|
{
|
|
4773
4783
|
variant: "filled",
|
|
4774
4784
|
color: "primary",
|
|
4775
4785
|
type: "submit",
|
|
4776
4786
|
loading: Te,
|
|
4777
|
-
disabled: Te ||
|
|
4778
|
-
startIcon:
|
|
4787
|
+
disabled: Te || s === "details" && !vt,
|
|
4788
|
+
startIcon: s === "properties" ? /* @__PURE__ */ e(Gr, {}) : void 0,
|
|
4779
4789
|
children: [
|
|
4780
|
-
|
|
4781
|
-
|
|
4790
|
+
s === "details" && "Next",
|
|
4791
|
+
s === "properties" && "Create collection"
|
|
4782
4792
|
]
|
|
4783
4793
|
}
|
|
4784
4794
|
),
|
|
@@ -4823,7 +4833,7 @@ function pr(t, r) {
|
|
|
4823
4833
|
}
|
|
4824
4834
|
const Ht = (t, r, n, i) => {
|
|
4825
4835
|
let l;
|
|
4826
|
-
return t || (l = "You must specify a path in the database for this collection"), r && n?.includes(t.trim().toLowerCase()) && !i && (l = "There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids"),
|
|
4836
|
+
return t || (l = "You must specify a path in the database for this collection"), r && n?.includes(t.trim().toLowerCase()) && !i && (l = "There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids"), Or(t).split("/").length % 2 === 0 && (l = `Collection paths must have an odd number of segments: ${t}`), l;
|
|
4827
4837
|
}, an = (t, r, n, i) => {
|
|
4828
4838
|
if (!t)
|
|
4829
4839
|
return;
|
|
@@ -4839,77 +4849,77 @@ const Ht = (t, r, n, i) => {
|
|
|
4839
4849
|
extraView: d,
|
|
4840
4850
|
pathSuggestions: u,
|
|
4841
4851
|
getUser: p,
|
|
4842
|
-
getData:
|
|
4843
|
-
onAnalyticsEvent:
|
|
4852
|
+
getData: h,
|
|
4853
|
+
onAnalyticsEvent: m
|
|
4844
4854
|
}) {
|
|
4845
|
-
const
|
|
4855
|
+
const c = Pe(), g = gi(), v = Ie(), { propertyConfigs: x } = Ae(), {
|
|
4846
4856
|
collections: y
|
|
4847
|
-
} =
|
|
4848
|
-
|
|
4849
|
-
u && u().then((
|
|
4850
|
-
b(
|
|
4857
|
+
} = c, P = (y ?? []).map((s) => s.path.trim().toLowerCase()), [T, b] = Y.useState();
|
|
4858
|
+
ce(() => {
|
|
4859
|
+
u && u().then((s) => {
|
|
4860
|
+
b(s.filter((V) => !P.includes(V.trim().toLowerCase())));
|
|
4851
4861
|
});
|
|
4852
4862
|
}, [u]);
|
|
4853
|
-
const [
|
|
4863
|
+
const [C, N] = Y.useState(), [f, w] = Y.useState(), _ = Q(() => ({
|
|
4854
4864
|
createCollections: !0,
|
|
4855
4865
|
editCollections: !0,
|
|
4856
4866
|
deleteCollections: !0
|
|
4857
|
-
}), []),
|
|
4858
|
-
id:
|
|
4859
|
-
fullPath:
|
|
4867
|
+
}), []), M = Q(({
|
|
4868
|
+
id: s,
|
|
4869
|
+
fullPath: V,
|
|
4860
4870
|
parentCollectionIds: G,
|
|
4861
|
-
parentCollection:
|
|
4871
|
+
parentCollection: B
|
|
4862
4872
|
}) => {
|
|
4863
|
-
console.debug("Edit collection",
|
|
4864
|
-
editedCollectionId:
|
|
4865
|
-
fullPath:
|
|
4873
|
+
console.debug("Edit collection", s, V, G, B), m?.("edit_collection", { id: s, fullPath: V }), N({
|
|
4874
|
+
editedCollectionId: s,
|
|
4875
|
+
fullPath: V,
|
|
4866
4876
|
parentCollectionIds: G,
|
|
4867
4877
|
isNewCollection: !1,
|
|
4868
|
-
parentCollection:
|
|
4878
|
+
parentCollection: B,
|
|
4869
4879
|
redirect: !1
|
|
4870
4880
|
});
|
|
4871
|
-
}, []),
|
|
4872
|
-
propertyKey:
|
|
4873
|
-
property:
|
|
4881
|
+
}, []), R = Q(({
|
|
4882
|
+
propertyKey: s,
|
|
4883
|
+
property: V,
|
|
4874
4884
|
editedCollectionId: G,
|
|
4875
|
-
currentPropertiesOrder:
|
|
4876
|
-
parentCollectionIds:
|
|
4885
|
+
currentPropertiesOrder: B,
|
|
4886
|
+
parentCollectionIds: q,
|
|
4877
4887
|
collection: L
|
|
4878
4888
|
}) => {
|
|
4879
|
-
console.debug("edit property",
|
|
4880
|
-
const
|
|
4881
|
-
|
|
4889
|
+
console.debug("edit property", s, V, G, B, q, L), m?.("edit_property", { propertyKey: s, editedCollectionId: G });
|
|
4890
|
+
const J = s && s.includes(".") ? s.substring(0, s.lastIndexOf(".")) : void 0, le = s && s.includes(".") ? s.substring(s.lastIndexOf(".") + 1) : s;
|
|
4891
|
+
w({
|
|
4882
4892
|
propertyKey: le,
|
|
4883
|
-
property:
|
|
4884
|
-
namespace:
|
|
4885
|
-
currentPropertiesOrder:
|
|
4893
|
+
property: V,
|
|
4894
|
+
namespace: J,
|
|
4895
|
+
currentPropertiesOrder: B,
|
|
4886
4896
|
editedCollectionId: G,
|
|
4887
|
-
parentCollectionIds:
|
|
4897
|
+
parentCollectionIds: q,
|
|
4888
4898
|
collectionEditable: L?.editable ?? !1
|
|
4889
4899
|
});
|
|
4890
|
-
}, []),
|
|
4891
|
-
parentCollectionIds:
|
|
4892
|
-
parentCollection:
|
|
4900
|
+
}, []), D = Y.useCallback(({
|
|
4901
|
+
parentCollectionIds: s,
|
|
4902
|
+
parentCollection: V,
|
|
4893
4903
|
initialValues: G,
|
|
4894
|
-
redirect:
|
|
4895
|
-
sourceClick:
|
|
4904
|
+
redirect: B,
|
|
4905
|
+
sourceClick: q
|
|
4896
4906
|
}) => {
|
|
4897
|
-
console.debug("Create collection", { parentCollectionIds:
|
|
4907
|
+
console.debug("Create collection", { parentCollectionIds: s, parentCollection: V, initialValues: G, redirect: B, sourceClick: q }), m?.("create_collection", { parentCollectionIds: s, parentCollection: V, initialValues: G, redirect: B, sourceClick: q }), N({
|
|
4898
4908
|
isNewCollection: !0,
|
|
4899
|
-
parentCollectionIds:
|
|
4900
|
-
parentCollection:
|
|
4909
|
+
parentCollectionIds: s,
|
|
4910
|
+
parentCollection: V,
|
|
4901
4911
|
initialValues: G,
|
|
4902
|
-
redirect:
|
|
4912
|
+
redirect: B
|
|
4903
4913
|
});
|
|
4904
|
-
}, []),
|
|
4914
|
+
}, []), A = u ? (s) => !s && T ? Promise.resolve(T) : u?.(s) : void 0;
|
|
4905
4915
|
return /* @__PURE__ */ e(mr.Provider, { value: n, children: /* @__PURE__ */ a(
|
|
4906
4916
|
hr.Provider,
|
|
4907
4917
|
{
|
|
4908
4918
|
value: {
|
|
4909
|
-
editCollection:
|
|
4910
|
-
createCollection:
|
|
4911
|
-
editProperty:
|
|
4912
|
-
configPermissions: i ??
|
|
4919
|
+
editCollection: M,
|
|
4920
|
+
createCollection: D,
|
|
4921
|
+
editProperty: R,
|
|
4922
|
+
configPermissions: i ?? _,
|
|
4913
4923
|
rootPathSuggestions: T
|
|
4914
4924
|
},
|
|
4915
4925
|
children: [
|
|
@@ -4917,112 +4927,112 @@ const Ht = (t, r, n, i) => {
|
|
|
4917
4927
|
/* @__PURE__ */ e(
|
|
4918
4928
|
ur,
|
|
4919
4929
|
{
|
|
4920
|
-
open: !!
|
|
4930
|
+
open: !!C,
|
|
4921
4931
|
configController: n,
|
|
4922
4932
|
isNewCollection: !1,
|
|
4923
4933
|
collectionInference: o,
|
|
4924
|
-
...
|
|
4925
|
-
getData:
|
|
4934
|
+
...C,
|
|
4935
|
+
getData: h,
|
|
4926
4936
|
reservedGroups: l,
|
|
4927
4937
|
extraView: d,
|
|
4928
|
-
pathSuggestions:
|
|
4938
|
+
pathSuggestions: A,
|
|
4929
4939
|
getUser: p,
|
|
4930
|
-
handleClose: (
|
|
4931
|
-
if (
|
|
4932
|
-
const
|
|
4933
|
-
|
|
4940
|
+
handleClose: (s) => {
|
|
4941
|
+
if (C?.redirect && s && C?.isNewCollection && !C.parentCollectionIds.length) {
|
|
4942
|
+
const V = c.buildUrlCollectionPath(s.id ?? s.path);
|
|
4943
|
+
g(V);
|
|
4934
4944
|
}
|
|
4935
|
-
|
|
4945
|
+
N(void 0);
|
|
4936
4946
|
}
|
|
4937
4947
|
}
|
|
4938
4948
|
),
|
|
4939
4949
|
/* @__PURE__ */ e(
|
|
4940
4950
|
Ve,
|
|
4941
4951
|
{
|
|
4942
|
-
open: !!
|
|
4952
|
+
open: !!f,
|
|
4943
4953
|
includeIdAndName: !0,
|
|
4944
|
-
existingProperty: !!
|
|
4945
|
-
autoUpdateId:
|
|
4946
|
-
autoOpenTypeSelect:
|
|
4954
|
+
existingProperty: !!f?.propertyKey,
|
|
4955
|
+
autoUpdateId: f ? !f?.propertyKey : !1,
|
|
4956
|
+
autoOpenTypeSelect: f ? !f?.propertyKey : !1,
|
|
4947
4957
|
inArray: !1,
|
|
4948
|
-
collectionEditable:
|
|
4949
|
-
getData:
|
|
4950
|
-
console.debug("get data for property",
|
|
4951
|
-
const
|
|
4952
|
-
return
|
|
4958
|
+
collectionEditable: f?.collectionEditable ?? !1,
|
|
4959
|
+
getData: h && f?.editedCollectionId ? () => {
|
|
4960
|
+
console.debug("get data for property", f?.editedCollectionId);
|
|
4961
|
+
const s = c.resolveAliasesFrom(f.editedCollectionId);
|
|
4962
|
+
return h(s, []);
|
|
4953
4963
|
} : void 0,
|
|
4954
4964
|
onPropertyChanged: ({
|
|
4955
|
-
id:
|
|
4956
|
-
property:
|
|
4965
|
+
id: s,
|
|
4966
|
+
property: V
|
|
4957
4967
|
}) => {
|
|
4958
|
-
if (!
|
|
4968
|
+
if (!f || !s)
|
|
4959
4969
|
return;
|
|
4960
|
-
const G = !
|
|
4970
|
+
const G = !f.propertyKey;
|
|
4961
4971
|
return n.saveProperty({
|
|
4962
|
-
path:
|
|
4963
|
-
property:
|
|
4964
|
-
propertyKey:
|
|
4965
|
-
newPropertiesOrder: G &&
|
|
4966
|
-
namespace:
|
|
4967
|
-
parentCollectionIds:
|
|
4968
|
-
}).catch((
|
|
4972
|
+
path: f?.editedCollectionId,
|
|
4973
|
+
property: V,
|
|
4974
|
+
propertyKey: s,
|
|
4975
|
+
newPropertiesOrder: G && f.currentPropertiesOrder ? [...f.currentPropertiesOrder, s] : void 0,
|
|
4976
|
+
namespace: f.namespace,
|
|
4977
|
+
parentCollectionIds: f.parentCollectionIds
|
|
4978
|
+
}).catch((B) => (console.error(B), v.open({
|
|
4969
4979
|
type: "error",
|
|
4970
|
-
message: "Error persisting property: " + (
|
|
4980
|
+
message: "Error persisting property: " + (B.message ?? "Details in the console")
|
|
4971
4981
|
}), !1));
|
|
4972
4982
|
},
|
|
4973
4983
|
onPropertyChangedImmediate: !1,
|
|
4974
4984
|
onDelete: () => {
|
|
4975
|
-
if (!
|
|
4985
|
+
if (!f?.propertyKey)
|
|
4976
4986
|
return;
|
|
4977
|
-
const
|
|
4987
|
+
const s = f?.currentPropertiesOrder?.filter((V) => V !== f?.propertyKey);
|
|
4978
4988
|
return n.deleteProperty({
|
|
4979
|
-
path:
|
|
4980
|
-
propertyKey:
|
|
4981
|
-
namespace:
|
|
4982
|
-
newPropertiesOrder:
|
|
4983
|
-
parentCollectionIds:
|
|
4989
|
+
path: f?.editedCollectionId,
|
|
4990
|
+
propertyKey: f?.propertyKey,
|
|
4991
|
+
namespace: f?.namespace,
|
|
4992
|
+
newPropertiesOrder: s,
|
|
4993
|
+
parentCollectionIds: f?.parentCollectionIds
|
|
4984
4994
|
}).then(() => {
|
|
4985
|
-
|
|
4986
|
-
}).catch((
|
|
4995
|
+
w(void 0);
|
|
4996
|
+
}).catch((V) => (console.error(V), v.open({
|
|
4987
4997
|
type: "error",
|
|
4988
|
-
message: "Error deleting property: " + (
|
|
4998
|
+
message: "Error deleting property: " + (V.message ?? "Details in the console")
|
|
4989
4999
|
}), !1));
|
|
4990
5000
|
},
|
|
4991
5001
|
onError: () => {
|
|
4992
5002
|
},
|
|
4993
5003
|
onOkClicked: () => {
|
|
4994
|
-
|
|
5004
|
+
w(void 0);
|
|
4995
5005
|
},
|
|
4996
5006
|
onCancel: () => {
|
|
4997
|
-
|
|
5007
|
+
w(void 0);
|
|
4998
5008
|
},
|
|
4999
5009
|
initialErrors: {},
|
|
5000
5010
|
forceShowErrors: !1,
|
|
5001
5011
|
existingPropertyKeys: [],
|
|
5002
5012
|
allowDataInference: !0,
|
|
5003
|
-
propertyConfigs:
|
|
5004
|
-
property:
|
|
5005
|
-
propertyKey:
|
|
5013
|
+
propertyConfigs: x,
|
|
5014
|
+
property: f?.property,
|
|
5015
|
+
propertyKey: f?.propertyKey
|
|
5006
5016
|
}
|
|
5007
5017
|
)
|
|
5008
5018
|
]
|
|
5009
5019
|
}
|
|
5010
5020
|
) });
|
|
5011
5021
|
},
|
|
5012
|
-
|
|
5013
|
-
),
|
|
5022
|
+
ve
|
|
5023
|
+
), xe = () => Jt(hr), fr = () => Jt(mr);
|
|
5014
5024
|
function ln({
|
|
5015
5025
|
path: t,
|
|
5016
5026
|
parentCollectionIds: r,
|
|
5017
5027
|
collection: n,
|
|
5018
5028
|
tableController: i
|
|
5019
5029
|
}) {
|
|
5020
|
-
const l =
|
|
5030
|
+
const l = _e(), o = Pe(), d = xe(), u = fr(), p = Ie(), h = o.getCollectionFromIds(r), m = d.configPermissions ? d.configPermissions({
|
|
5021
5031
|
user: l.user,
|
|
5022
5032
|
collection: n
|
|
5023
5033
|
}).editCollections : !0;
|
|
5024
|
-
let
|
|
5025
|
-
return (!
|
|
5034
|
+
let c = null;
|
|
5035
|
+
return (!ve(at(i.filterValues), at(n.initialFilter)) || !ve(at(i.sortBy), at(n.initialSort))) && (c = /* @__PURE__ */ a(U, { children: [
|
|
5026
5036
|
(n.initialFilter || n.initialSort) && /* @__PURE__ */ e(
|
|
5027
5037
|
te,
|
|
5028
5038
|
{
|
|
@@ -5073,18 +5083,18 @@ function ln({
|
|
|
5073
5083
|
}
|
|
5074
5084
|
)
|
|
5075
5085
|
] })), /* @__PURE__ */ a(U, { children: [
|
|
5076
|
-
|
|
5086
|
+
m && c,
|
|
5077
5087
|
/* @__PURE__ */ e(
|
|
5078
5088
|
te,
|
|
5079
5089
|
{
|
|
5080
|
-
title:
|
|
5090
|
+
title: m ? "Edit collection" : "You don't have permissions to edit this collection",
|
|
5081
5091
|
children: /* @__PURE__ */ e(
|
|
5082
5092
|
oe,
|
|
5083
5093
|
{
|
|
5084
5094
|
color: "primary",
|
|
5085
|
-
disabled: !
|
|
5086
|
-
onClick:
|
|
5087
|
-
children: /* @__PURE__ */ e(
|
|
5095
|
+
disabled: !m,
|
|
5096
|
+
onClick: m ? () => d?.editCollection({ id: n.id, fullPath: t, parentCollectionIds: r, parentCollection: h }) : void 0,
|
|
5097
|
+
children: /* @__PURE__ */ e(He, {})
|
|
5088
5098
|
}
|
|
5089
5099
|
)
|
|
5090
5100
|
}
|
|
@@ -5098,14 +5108,14 @@ function sn({
|
|
|
5098
5108
|
path: t,
|
|
5099
5109
|
collection: r
|
|
5100
5110
|
}) {
|
|
5101
|
-
const n = Ie(), i =
|
|
5111
|
+
const n = Ie(), i = _e(), l = fr(), o = xe(), d = o.configPermissions({
|
|
5102
5112
|
user: i.user,
|
|
5103
5113
|
collection: r
|
|
5104
|
-
}), u =
|
|
5114
|
+
}), u = Q(() => {
|
|
5105
5115
|
o?.editCollection({ id: r.id, parentCollectionIds: [] });
|
|
5106
|
-
}, [o, t]), [p,
|
|
5116
|
+
}, [o, t]), [p, h] = $(!1), m = Q(() => {
|
|
5107
5117
|
l?.deleteCollection({ id: r.id }).then(() => {
|
|
5108
|
-
|
|
5118
|
+
h(!1), n.open({
|
|
5109
5119
|
message: "Collection deleted",
|
|
5110
5120
|
type: "success"
|
|
5111
5121
|
});
|
|
@@ -5117,10 +5127,10 @@ function sn({
|
|
|
5117
5127
|
Zr,
|
|
5118
5128
|
{
|
|
5119
5129
|
trigger: /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(Jr, { size: "small" }) }),
|
|
5120
|
-
children: /* @__PURE__ */ a(Qr, { onClick: (
|
|
5121
|
-
|
|
5130
|
+
children: /* @__PURE__ */ a(Qr, { onClick: (c) => {
|
|
5131
|
+
c.preventDefault(), c.stopPropagation(), h(!0);
|
|
5122
5132
|
}, children: [
|
|
5123
|
-
/* @__PURE__ */ e(
|
|
5133
|
+
/* @__PURE__ */ e(dt, {}),
|
|
5124
5134
|
"Delete"
|
|
5125
5135
|
] })
|
|
5126
5136
|
}
|
|
@@ -5128,10 +5138,10 @@ function sn({
|
|
|
5128
5138
|
d.editCollections && /* @__PURE__ */ e(
|
|
5129
5139
|
oe,
|
|
5130
5140
|
{
|
|
5131
|
-
onClick: (
|
|
5141
|
+
onClick: (c) => {
|
|
5132
5142
|
u();
|
|
5133
5143
|
},
|
|
5134
|
-
children: /* @__PURE__ */ e(
|
|
5144
|
+
children: /* @__PURE__ */ e(He, { size: "small" })
|
|
5135
5145
|
}
|
|
5136
5146
|
)
|
|
5137
5147
|
] }),
|
|
@@ -5139,8 +5149,8 @@ function sn({
|
|
|
5139
5149
|
lt,
|
|
5140
5150
|
{
|
|
5141
5151
|
open: p,
|
|
5142
|
-
onAccept:
|
|
5143
|
-
onCancel: () =>
|
|
5152
|
+
onAccept: m,
|
|
5153
|
+
onCancel: () => h(!1),
|
|
5144
5154
|
title: /* @__PURE__ */ e(U, { children: "Delete this collection?" }),
|
|
5145
5155
|
body: /* @__PURE__ */ a(U, { children: [
|
|
5146
5156
|
" This will ",
|
|
@@ -5151,19 +5161,19 @@ function sn({
|
|
|
5151
5161
|
)
|
|
5152
5162
|
] });
|
|
5153
5163
|
}
|
|
5154
|
-
function
|
|
5164
|
+
function cn({
|
|
5155
5165
|
group: t,
|
|
5156
5166
|
context: r
|
|
5157
5167
|
}) {
|
|
5158
5168
|
if (!r.navigation.topLevelNavigation)
|
|
5159
5169
|
throw Error("Navigation not ready in FireCMSHomePage");
|
|
5160
|
-
const n =
|
|
5170
|
+
const n = _e(), i = xe(), l = i.configPermissions ? i.configPermissions({
|
|
5161
5171
|
user: n.user
|
|
5162
5172
|
}).createCollections : !0;
|
|
5163
5173
|
return /* @__PURE__ */ e(
|
|
5164
5174
|
tr,
|
|
5165
5175
|
{
|
|
5166
|
-
className:
|
|
5176
|
+
className: me("h-full p-4 min-h-[124px]"),
|
|
5167
5177
|
onClick: i && l ? () => i.createCollection({
|
|
5168
5178
|
initialValues: t ? { group: t } : void 0,
|
|
5169
5179
|
parentCollectionIds: [],
|
|
@@ -5175,9 +5185,9 @@ function dn({
|
|
|
5175
5185
|
{
|
|
5176
5186
|
className: "flex flex-col items-start h-full w-full items-center justify-center h-full w-full flex-grow flex-col",
|
|
5177
5187
|
children: [
|
|
5178
|
-
/* @__PURE__ */ e(
|
|
5188
|
+
/* @__PURE__ */ e(ue, { color: "primary", size: "large" }),
|
|
5179
5189
|
/* @__PURE__ */ e(
|
|
5180
|
-
|
|
5190
|
+
O,
|
|
5181
5191
|
{
|
|
5182
5192
|
color: "primary",
|
|
5183
5193
|
variant: "caption",
|
|
@@ -5185,46 +5195,59 @@ function dn({
|
|
|
5185
5195
|
children: "Add new collection".toUpperCase()
|
|
5186
5196
|
}
|
|
5187
5197
|
),
|
|
5188
|
-
!l && /* @__PURE__ */ e(
|
|
5198
|
+
!l && /* @__PURE__ */ e(O, { variant: "caption", children: "You don't have permissions to create collections" })
|
|
5189
5199
|
]
|
|
5190
5200
|
}
|
|
5191
5201
|
)
|
|
5192
5202
|
}
|
|
5193
5203
|
);
|
|
5194
5204
|
}
|
|
5195
|
-
function
|
|
5196
|
-
const
|
|
5197
|
-
user:
|
|
5198
|
-
}).createCollections : !0,
|
|
5205
|
+
function dn({ introMode: t }) {
|
|
5206
|
+
const r = _e(), n = Pe(), i = xe(), l = i.configPermissions ? i.configPermissions({
|
|
5207
|
+
user: r.user
|
|
5208
|
+
}).createCollections : !0, o = i.rootPathSuggestions, d = (o ?? []).length > 3 || (n.collections ?? []).length === 0 && (o ?? []).length > 0;
|
|
5199
5209
|
return /* @__PURE__ */ e(
|
|
5200
5210
|
Xr,
|
|
5201
5211
|
{
|
|
5202
|
-
in:
|
|
5212
|
+
in: t === "existing_project" || d,
|
|
5203
5213
|
children: /* @__PURE__ */ a(
|
|
5204
5214
|
"div",
|
|
5205
5215
|
{
|
|
5206
5216
|
className: "flex flex-col gap-1 p-2 my-4",
|
|
5207
5217
|
children: [
|
|
5208
|
-
/* @__PURE__ */
|
|
5209
|
-
|
|
5218
|
+
!t && /* @__PURE__ */ a(O, { variant: "body2", color: "secondary", children: [
|
|
5219
|
+
"Create a collection ",
|
|
5220
|
+
/* @__PURE__ */ e("b", { children: "automatically" }),
|
|
5221
|
+
" from your data:"
|
|
5222
|
+
] }),
|
|
5223
|
+
t === "existing_project" && /* @__PURE__ */ a(O, { children: [
|
|
5224
|
+
"You will see your ",
|
|
5225
|
+
/* @__PURE__ */ e("b", { children: "database collections" }),
|
|
5226
|
+
" here, a few seconds after project creation"
|
|
5227
|
+
] }),
|
|
5228
|
+
/* @__PURE__ */ a(
|
|
5210
5229
|
"div",
|
|
5211
5230
|
{
|
|
5212
5231
|
className: "flex flex-row gap-1 overflow-scroll no-scrollbar ",
|
|
5213
|
-
children:
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5232
|
+
children: [
|
|
5233
|
+
(o ?? []).map((p) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
5234
|
+
st,
|
|
5235
|
+
{
|
|
5236
|
+
icon: /* @__PURE__ */ e(ue, { size: "small" }),
|
|
5237
|
+
colorScheme: "cyanLighter",
|
|
5238
|
+
onClick: i && l ? () => i.createCollection({
|
|
5239
|
+
initialValues: { path: p, name: ut(p) },
|
|
5240
|
+
parentCollectionIds: [],
|
|
5241
|
+
redirect: !0,
|
|
5242
|
+
sourceClick: "root_collection_suggestion"
|
|
5243
|
+
}) : void 0,
|
|
5244
|
+
size: "small",
|
|
5245
|
+
children: p
|
|
5246
|
+
}
|
|
5247
|
+
) }, p)),
|
|
5248
|
+
o === void 0 && /* @__PURE__ */ e(De, { size: "small" }),
|
|
5249
|
+
o?.length === 0 && /* @__PURE__ */ e(O, { variant: "caption", children: "No suggestions" })
|
|
5250
|
+
]
|
|
5228
5251
|
}
|
|
5229
5252
|
)
|
|
5230
5253
|
]
|
|
@@ -5241,7 +5264,7 @@ function un({
|
|
|
5241
5264
|
parentCollectionIds: l,
|
|
5242
5265
|
collection: o
|
|
5243
5266
|
}) {
|
|
5244
|
-
const d =
|
|
5267
|
+
const d = xe();
|
|
5245
5268
|
return /* @__PURE__ */ e(te, { title: "Edit", children: /* @__PURE__ */ e(
|
|
5246
5269
|
oe,
|
|
5247
5270
|
{
|
|
@@ -5256,7 +5279,7 @@ function un({
|
|
|
5256
5279
|
});
|
|
5257
5280
|
},
|
|
5258
5281
|
size: "small",
|
|
5259
|
-
children: /* @__PURE__ */ e(
|
|
5282
|
+
children: /* @__PURE__ */ e(He, { size: "small" })
|
|
5260
5283
|
}
|
|
5261
5284
|
) });
|
|
5262
5285
|
}
|
|
@@ -5265,7 +5288,7 @@ function pn({
|
|
|
5265
5288
|
parentCollectionIds: r,
|
|
5266
5289
|
collection: n
|
|
5267
5290
|
}) {
|
|
5268
|
-
const i =
|
|
5291
|
+
const i = _e(), l = xe(), o = l.configPermissions ? l.configPermissions({
|
|
5269
5292
|
user: i.user,
|
|
5270
5293
|
collection: n
|
|
5271
5294
|
}).editCollections : !0;
|
|
@@ -5277,16 +5300,16 @@ function pn({
|
|
|
5277
5300
|
l.editProperty({
|
|
5278
5301
|
editedCollectionId: n.id,
|
|
5279
5302
|
parentCollectionIds: r,
|
|
5280
|
-
currentPropertiesOrder:
|
|
5303
|
+
currentPropertiesOrder: Vr(n),
|
|
5281
5304
|
collection: n
|
|
5282
5305
|
});
|
|
5283
5306
|
},
|
|
5284
|
-
children: /* @__PURE__ */ e(
|
|
5307
|
+
children: /* @__PURE__ */ e(ue, { color: "inherit" })
|
|
5285
5308
|
}
|
|
5286
5309
|
) });
|
|
5287
5310
|
}
|
|
5288
5311
|
function mn() {
|
|
5289
|
-
const t =
|
|
5312
|
+
const t = xe();
|
|
5290
5313
|
return /* @__PURE__ */ a(
|
|
5291
5314
|
z,
|
|
5292
5315
|
{
|
|
@@ -5298,15 +5321,15 @@ function mn() {
|
|
|
5298
5321
|
sourceClick: "new_collection_button"
|
|
5299
5322
|
}),
|
|
5300
5323
|
children: [
|
|
5301
|
-
/* @__PURE__ */ e(
|
|
5324
|
+
/* @__PURE__ */ e(ue, {}),
|
|
5302
5325
|
"New collection"
|
|
5303
5326
|
]
|
|
5304
5327
|
}
|
|
5305
5328
|
);
|
|
5306
5329
|
}
|
|
5307
|
-
function
|
|
5330
|
+
function In({
|
|
5308
5331
|
collectionConfigController: t,
|
|
5309
|
-
|
|
5332
|
+
introMode: r,
|
|
5310
5333
|
configPermissions: n,
|
|
5311
5334
|
reservedGroups: i,
|
|
5312
5335
|
extraView: l,
|
|
@@ -5314,7 +5337,7 @@ function Vn({
|
|
|
5314
5337
|
getUser: d,
|
|
5315
5338
|
collectionInference: u,
|
|
5316
5339
|
getData: p,
|
|
5317
|
-
onAnalyticsEvent:
|
|
5340
|
+
onAnalyticsEvent: h
|
|
5318
5341
|
}) {
|
|
5319
5342
|
return {
|
|
5320
5343
|
name: "Collection Editor",
|
|
@@ -5333,14 +5356,15 @@ function Vn({
|
|
|
5333
5356
|
pathSuggestions: o,
|
|
5334
5357
|
getUser: d,
|
|
5335
5358
|
getData: p,
|
|
5336
|
-
onAnalyticsEvent:
|
|
5359
|
+
onAnalyticsEvent: h
|
|
5337
5360
|
}
|
|
5338
5361
|
},
|
|
5339
5362
|
homePage: {
|
|
5340
5363
|
additionalActions: /* @__PURE__ */ e(mn, {}),
|
|
5341
|
-
|
|
5364
|
+
additionalChildrenStart: r ? /* @__PURE__ */ e(hn, { introMode: r }) : void 0,
|
|
5365
|
+
additionalChildrenEnd: /* @__PURE__ */ e(dn, { introMode: r }),
|
|
5342
5366
|
CollectionActions: sn,
|
|
5343
|
-
AdditionalCards:
|
|
5367
|
+
AdditionalCards: r ? void 0 : cn
|
|
5344
5368
|
},
|
|
5345
5369
|
collectionView: {
|
|
5346
5370
|
HeaderAction: un,
|
|
@@ -5348,10 +5372,37 @@ function Vn({
|
|
|
5348
5372
|
}
|
|
5349
5373
|
};
|
|
5350
5374
|
}
|
|
5351
|
-
function
|
|
5352
|
-
|
|
5375
|
+
function hn({ introMode: t }) {
|
|
5376
|
+
if (!Pe().topLevelNavigation)
|
|
5377
|
+
throw Error("Navigation not ready in FireCMSHomePage");
|
|
5378
|
+
const n = _e(), i = xe(), l = i.configPermissions ? i.configPermissions({
|
|
5379
|
+
user: n.user
|
|
5380
|
+
}).createCollections : !0;
|
|
5381
|
+
return /* @__PURE__ */ a("div", { className: "mt-8 flex flex-col mt-8 p-2", children: [
|
|
5382
|
+
/* @__PURE__ */ e(O, { variant: "h4", className: "mb-4", children: "Welcome" }),
|
|
5383
|
+
/* @__PURE__ */ e(O, { paragraph: !0, children: "Your admin panel is ready ✌️" }),
|
|
5384
|
+
/* @__PURE__ */ e(O, { paragraph: !0, children: "Start building collections in FireCMS easily. Map them to your existing database data, import from files, or use our templates. Simplify your data management process now." }),
|
|
5385
|
+
l && /* @__PURE__ */ a(
|
|
5386
|
+
z,
|
|
5387
|
+
{
|
|
5388
|
+
className: "mt-4",
|
|
5389
|
+
onClick: i && l ? () => i.createCollection({
|
|
5390
|
+
parentCollectionIds: [],
|
|
5391
|
+
redirect: !0,
|
|
5392
|
+
sourceClick: "new_collection_card"
|
|
5393
|
+
}) : void 0,
|
|
5394
|
+
children: [
|
|
5395
|
+
/* @__PURE__ */ e(ue, {}),
|
|
5396
|
+
"Create your first collection"
|
|
5397
|
+
]
|
|
5398
|
+
}
|
|
5399
|
+
)
|
|
5400
|
+
] });
|
|
5401
|
+
}
|
|
5402
|
+
function _n({ path: t }) {
|
|
5403
|
+
const r = Pe(), n = fn(t), i = r.getParentCollectionIds(t), l = xe();
|
|
5353
5404
|
return /* @__PURE__ */ a("div", { className: "p-1 flex flex-col items-center", children: [
|
|
5354
|
-
/* @__PURE__ */ e(
|
|
5405
|
+
/* @__PURE__ */ e(Wt, { error: "No collection for path: " + n }),
|
|
5355
5406
|
/* @__PURE__ */ e(
|
|
5356
5407
|
z,
|
|
5357
5408
|
{
|
|
@@ -5371,21 +5422,21 @@ function In({ path: t }) {
|
|
|
5371
5422
|
)
|
|
5372
5423
|
] });
|
|
5373
5424
|
}
|
|
5374
|
-
function
|
|
5425
|
+
function fn(t) {
|
|
5375
5426
|
const r = t.split("/");
|
|
5376
5427
|
return r[r.length - 1];
|
|
5377
5428
|
}
|
|
5378
5429
|
export {
|
|
5379
|
-
|
|
5380
|
-
|
|
5430
|
+
_n as MissingReferenceWidget,
|
|
5431
|
+
qe as editableProperty,
|
|
5381
5432
|
ae as getFullId,
|
|
5382
5433
|
ir as getFullIdPath,
|
|
5383
|
-
|
|
5434
|
+
pe as idToPropertiesPath,
|
|
5384
5435
|
ye as namespaceToPropertiesOrderPath,
|
|
5385
5436
|
bi as namespaceToPropertiesPath,
|
|
5386
5437
|
wi as removeNonEditableProperties,
|
|
5387
|
-
|
|
5388
|
-
|
|
5438
|
+
xe as useCollectionEditorController,
|
|
5439
|
+
In as useCollectionEditorPlugin,
|
|
5389
5440
|
fr as useCollectionsConfigController
|
|
5390
5441
|
};
|
|
5391
5442
|
//# sourceMappingURL=index.es.js.map
|