@firecms/collection_editor 3.0.0-canary.40 → 3.0.0-canary.41
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/ConfigControllerProvider.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +715 -697
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +1 -1
- package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -1
- package/dist/ui/collection_editor/PropertyTree.d.ts +9 -9
- package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +1 -1
- package/dist/useCollectionEditorPlugin.d.ts +2 -2
- package/dist/utils/collections.d.ts +6 -0
- package/package.json +6 -6
- package/src/ConfigControllerProvider.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +15 -5
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +2 -2
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +2 -2
- package/src/utils/collections.ts +30 -0
package/dist/index.es.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as R } from "react/jsx-runtime";
|
|
2
|
-
import { FieldCaption as X, SearchIconsView as gr, toSnakeCase as Pt, singular as vr, IconForView as
|
|
2
|
+
import { FieldCaption as X, SearchIconsView as gr, toSnakeCase as Pt, singular as vr, IconForView as lt, ArrayContainer as yr, serializeRegExp as br, useSnackbarController as _e, resolveEnumValues as Cr, isPropertyBuilder as ne, useCustomizationController as Ae, getFieldConfig as $e, ErrorBoundary as me, PropertyConfigBadge as Ye, unslugify as pt, useNavigationController as Ne, mergeDeep as W, DEFAULT_FIELD_CONFIGS as Gt, isValidRegExp as Pr, getFieldId as Kt, DeleteConfirmationDialog as st, useLargeLayout as Nr, makePropertiesEditable as He, resolveEntityView as xr, useSelectionController as wr, EntityCollectionTable as Tr, slugify as kr, useAuthController as Te, randomString as _t, CircularProgressCenter as Nt, removeUndefined as St, ErrorView as Wt, removeInitialAndTrailingSlashes as Or, getDefaultPropertiesOrder as Vr, joinCollectionLists as Ir } from "@firecms/core";
|
|
3
3
|
import * as je from "react";
|
|
4
|
-
import Y, { useState as $, useEffect as de, useMemo as Zt, useCallback as Q, useRef as Le, useDeferredValue as
|
|
4
|
+
import Y, { useState as $, useEffect as de, useMemo as Zt, useCallback as Q, useRef as Le, useDeferredValue as _r, useContext as Jt } from "react";
|
|
5
5
|
import ye from "react-fast-compare";
|
|
6
|
-
import { useAutoComplete as
|
|
7
|
-
import * as
|
|
6
|
+
import { useAutoComplete as Sr, Container as mt, Typography as O, Tooltip as te, IconButton as oe, Chip as ct, TextField as Ve, cn as fe, DebouncedTextField as Z, Autocomplete as Fr, AutocompleteItem as Er, ExpandablePanel as xt, SettingsIcon as Ge, Select as Ce, SelectItem as ee, BooleanSwitchWithLabel as dt, Dialog as Se, AutoAwesomeIcon as ht, Badge as Ar, ListIcon as Dr, Button as z, CircularProgress as De, Paper as Pe, DialogContent as Be, DialogActions as ze, RuleIcon as Br, FileUploadIcon as zr, MultiSelect as Mr, MultiSelectItem as Ft, Checkbox as Et, cardMixin as Qt, cardClickableMixin as Xt, cardSelectedMixin as er, FunctionsIcon as Rr, RemoveCircleIcon as Ur, defaultBorderMixin as wt, RemoveIcon as jr, DragHandleIcon as Lr, AddIcon as se, SelectGroup as At, InfoLabel as qr, DeleteIcon as ut, ContentCopyIcon as $r, CodeIcon as Yr, Table as Dt, TableBody as Bt, TableRow as bt, TableCell as Ue, Alert as Hr, Icon as tt, Card as tr, coolIconKeys as zt, Tabs as Gr, Tab as Ct, ArrowBackIcon as rt, LoadingButton as Mt, DoneIcon as Kr, Menu as Wr, MoreVertIcon as Zr, MenuItem as Jr, Collapse as Qr, SaveIcon as Xr, UndoIcon as ei } from "@firecms/ui";
|
|
7
|
+
import * as it from "yup";
|
|
8
8
|
import { useFormex as K, Field as H, getIn as I, useCreateFormex as Tt, Formex as kt } from "@firecms/formex";
|
|
9
|
-
import { extractEnumFromValues as
|
|
10
|
-
import { DragDropContext as
|
|
11
|
-
import
|
|
12
|
-
import { Highlight as
|
|
13
|
-
import { ImportFileUpload as
|
|
14
|
-
import { useNavigate as
|
|
15
|
-
const
|
|
16
|
-
id:
|
|
17
|
-
name:
|
|
18
|
-
path:
|
|
9
|
+
import { extractEnumFromValues as ti, buildPropertyFromData as ri, buildEntityPropertiesFromData as ii } from "@firecms/schema_inference";
|
|
10
|
+
import { DragDropContext as ni, Droppable as ai, Draggable as oi } from "@hello-pangea/dnd";
|
|
11
|
+
import li from "json5";
|
|
12
|
+
import { Highlight as si, themes as ci } from "prism-react-renderer";
|
|
13
|
+
import { ImportFileUpload as di, DataNewPropertiesMapping as ui, ImportNewPropertyFieldPreview as pi, getInferenceType as rr, getPropertiesMapping as mi, convertDataToEntity as hi, useImportConfig as fi, ImportSaveInProgress as gi } from "@firecms/data_import_export";
|
|
14
|
+
import { useNavigate as vi } from "react-router";
|
|
15
|
+
const yi = it.object().shape({
|
|
16
|
+
id: it.string().required("Required"),
|
|
17
|
+
name: it.string().required("Required"),
|
|
18
|
+
path: it.string().required("Required")
|
|
19
19
|
});
|
|
20
|
-
function
|
|
20
|
+
function bi({
|
|
21
21
|
isNewCollection: t,
|
|
22
22
|
reservedGroups: r,
|
|
23
23
|
existingPaths: n,
|
|
@@ -25,30 +25,30 @@ function yi({
|
|
|
25
25
|
groups: l,
|
|
26
26
|
parentCollection: o
|
|
27
27
|
}) {
|
|
28
|
-
const
|
|
29
|
-
values:
|
|
30
|
-
setFieldValue:
|
|
28
|
+
const c = Y.useRef(null), {
|
|
29
|
+
values: u,
|
|
30
|
+
setFieldValue: p,
|
|
31
31
|
handleChange: h,
|
|
32
32
|
touched: m,
|
|
33
|
-
errors:
|
|
33
|
+
errors: d,
|
|
34
34
|
setFieldTouched: g,
|
|
35
35
|
isSubmitting: v,
|
|
36
36
|
submitCount: x
|
|
37
37
|
} = K(), [y, P] = $(!1), [k, b] = $(!1), C = (s) => {
|
|
38
|
-
|
|
38
|
+
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));
|
|
39
39
|
};
|
|
40
40
|
de(() => {
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
const N = /* @__PURE__ */ e(
|
|
41
|
+
d.id && b(!0);
|
|
42
|
+
}, [d.id]);
|
|
43
|
+
const N = /* @__PURE__ */ e(lt, { collectionOrView: u }), f = l?.filter((s) => !r?.includes(s)), {
|
|
44
44
|
inputFocused: w,
|
|
45
45
|
autoCompleteOpen: _,
|
|
46
46
|
setAutoCompleteOpen: M
|
|
47
|
-
} =
|
|
48
|
-
ref:
|
|
47
|
+
} = Sr({
|
|
48
|
+
ref: c
|
|
49
49
|
}), U = !!o;
|
|
50
50
|
let D;
|
|
51
|
-
typeof
|
|
51
|
+
typeof u.customId == "object" ? D = "code_defined" : u.customId === !0 ? D = "true" : u.customId === !1 ? D = "false" : u.customId === "optional" && (D = "optional");
|
|
52
52
|
const A = x > 0;
|
|
53
53
|
return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ a(mt, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
54
54
|
/* @__PURE__ */ a("div", { children: [
|
|
@@ -57,7 +57,7 @@ function yi({
|
|
|
57
57
|
{
|
|
58
58
|
className: "flex flex-row py-2 pt-3 items-center",
|
|
59
59
|
children: [
|
|
60
|
-
/* @__PURE__ */ e(O, { variant: t ? "h4" : "h5", className: "flex-grow", children: t ? "New collection" : `${
|
|
60
|
+
/* @__PURE__ */ e(O, { variant: t ? "h4" : "h5", className: "flex-grow", children: t ? "New collection" : `${u?.name} collection` }),
|
|
61
61
|
/* @__PURE__ */ e(te, { title: "Change icon", children: /* @__PURE__ */ e(
|
|
62
62
|
oe,
|
|
63
63
|
{
|
|
@@ -69,7 +69,7 @@ function yi({
|
|
|
69
69
|
]
|
|
70
70
|
}
|
|
71
71
|
),
|
|
72
|
-
o && /* @__PURE__ */ e(
|
|
72
|
+
o && /* @__PURE__ */ e(ct, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
73
73
|
"This is a subcollection of ",
|
|
74
74
|
/* @__PURE__ */ e("b", { children: o.name })
|
|
75
75
|
] }) })
|
|
@@ -79,14 +79,14 @@ function yi({
|
|
|
79
79
|
/* @__PURE__ */ e(
|
|
80
80
|
Ve,
|
|
81
81
|
{
|
|
82
|
-
value:
|
|
82
|
+
value: u.name ?? "",
|
|
83
83
|
onChange: (s) => C(s.target.value),
|
|
84
84
|
label: "Name",
|
|
85
85
|
required: !0,
|
|
86
|
-
error: A && !!
|
|
86
|
+
error: A && !!d.name
|
|
87
87
|
}
|
|
88
88
|
),
|
|
89
|
-
/* @__PURE__ */ e(X, { error: m.name && !!
|
|
89
|
+
/* @__PURE__ */ e(X, { error: m.name && !!d.name, children: m.name && d.name ? d.name : "Name of in this collection, usually a plural name (e.g. Products)" })
|
|
90
90
|
] }),
|
|
91
91
|
/* @__PURE__ */ a("div", { className: fe("col-span-12 ", U ? "" : "sm:col-span-8"), children: [
|
|
92
92
|
/* @__PURE__ */ e(
|
|
@@ -97,22 +97,22 @@ function yi({
|
|
|
97
97
|
label: "Path",
|
|
98
98
|
disabled: !t,
|
|
99
99
|
required: !0,
|
|
100
|
-
error: A && !!
|
|
100
|
+
error: A && !!d.path
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
|
-
/* @__PURE__ */ e(X, { error: m.path && !!
|
|
103
|
+
/* @__PURE__ */ e(X, { error: m.path && !!d.path, children: m.path && d.path ? d.path : U ? "Relative path to the parent (no need to include the parent path)" : "Path that this collection is stored in, in the database" })
|
|
104
104
|
] }),
|
|
105
105
|
!U && /* @__PURE__ */ a("div", { className: "col-span-12 sm:col-span-4 relative", children: [
|
|
106
106
|
/* @__PURE__ */ e(
|
|
107
107
|
Ve,
|
|
108
108
|
{
|
|
109
|
-
error: A && !!
|
|
109
|
+
error: A && !!d.group,
|
|
110
110
|
disabled: v,
|
|
111
|
-
value:
|
|
111
|
+
value: u.group ?? "",
|
|
112
112
|
autoComplete: "off",
|
|
113
|
-
onChange: (s) =>
|
|
113
|
+
onChange: (s) => p("group", s.target.value),
|
|
114
114
|
name: "group",
|
|
115
|
-
inputRef:
|
|
115
|
+
inputRef: c,
|
|
116
116
|
label: "Group"
|
|
117
117
|
}
|
|
118
118
|
),
|
|
@@ -122,10 +122,10 @@ function yi({
|
|
|
122
122
|
open: _ && (f ?? []).length > 0,
|
|
123
123
|
setOpen: M,
|
|
124
124
|
children: f?.map((s, V) => /* @__PURE__ */ e(
|
|
125
|
-
|
|
125
|
+
Er,
|
|
126
126
|
{
|
|
127
127
|
onClick: () => {
|
|
128
|
-
M(!1),
|
|
128
|
+
M(!1), p("group", s ?? null);
|
|
129
129
|
},
|
|
130
130
|
children: /* @__PURE__ */ e("div", { className: "flex-grow", children: s })
|
|
131
131
|
},
|
|
@@ -133,7 +133,7 @@ function yi({
|
|
|
133
133
|
))
|
|
134
134
|
}
|
|
135
135
|
),
|
|
136
|
-
/* @__PURE__ */ e(X, { children: A &&
|
|
136
|
+
/* @__PURE__ */ e(X, { children: A && d.group ? d.group : "Group of the collection" })
|
|
137
137
|
] }),
|
|
138
138
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
139
139
|
xt,
|
|
@@ -141,7 +141,7 @@ function yi({
|
|
|
141
141
|
expanded: k,
|
|
142
142
|
onExpandedChange: b,
|
|
143
143
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
144
|
-
/* @__PURE__ */ e(
|
|
144
|
+
/* @__PURE__ */ e(Ge, {}),
|
|
145
145
|
/* @__PURE__ */ e(
|
|
146
146
|
O,
|
|
147
147
|
{
|
|
@@ -161,32 +161,32 @@ function yi({
|
|
|
161
161
|
as: Z,
|
|
162
162
|
disabled: !t,
|
|
163
163
|
label: "Collection id",
|
|
164
|
-
error: A && !!
|
|
164
|
+
error: A && !!d.id
|
|
165
165
|
}
|
|
166
166
|
),
|
|
167
|
-
/* @__PURE__ */ e(X, { error: m.id && !!
|
|
167
|
+
/* @__PURE__ */ e(X, { error: m.id && !!d.id, children: m.id && d.id ? d.id : "This id identifies this collection" })
|
|
168
168
|
] }),
|
|
169
169
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
170
170
|
/* @__PURE__ */ e(
|
|
171
171
|
Ve,
|
|
172
172
|
{
|
|
173
|
-
error: A && !!
|
|
173
|
+
error: A && !!d.singularName,
|
|
174
174
|
name: "singularName",
|
|
175
175
|
"aria-describedby": "singularName-helper",
|
|
176
176
|
onChange: (s) => (g("singularName", !0), h(s)),
|
|
177
|
-
value:
|
|
177
|
+
value: u.singularName ?? "",
|
|
178
178
|
label: "Singular name"
|
|
179
179
|
}
|
|
180
180
|
),
|
|
181
|
-
/* @__PURE__ */ e(X, { error: A && !!
|
|
181
|
+
/* @__PURE__ */ e(X, { error: A && !!d.singularName, children: A && d.singularName ? d.singularName : "Optionally define a singular name for your entities" })
|
|
182
182
|
] }),
|
|
183
183
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
184
184
|
/* @__PURE__ */ e(
|
|
185
185
|
Ve,
|
|
186
186
|
{
|
|
187
|
-
error: A && !!
|
|
187
|
+
error: A && !!d.description,
|
|
188
188
|
name: "description",
|
|
189
|
-
value:
|
|
189
|
+
value: u.description ?? "",
|
|
190
190
|
onChange: h,
|
|
191
191
|
multiline: !0,
|
|
192
192
|
rows: 2,
|
|
@@ -194,7 +194,7 @@ function yi({
|
|
|
194
194
|
label: "Description"
|
|
195
195
|
}
|
|
196
196
|
),
|
|
197
|
-
/* @__PURE__ */ e(X, { error: A && !!
|
|
197
|
+
/* @__PURE__ */ e(X, { error: A && !!d.description, children: A && d.description ? d.description : "Description of the collection, you can use markdown" })
|
|
198
198
|
] }),
|
|
199
199
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
200
200
|
Ce,
|
|
@@ -203,7 +203,7 @@ function yi({
|
|
|
203
203
|
label: "Default row size",
|
|
204
204
|
position: "item-aligned",
|
|
205
205
|
onChange: h,
|
|
206
|
-
value:
|
|
206
|
+
value: u.defaultSize ?? "",
|
|
207
207
|
renderValue: (s) => s.toUpperCase(),
|
|
208
208
|
children: ["xs", "s", "m", "l", "xl"].map((s) => /* @__PURE__ */ e(
|
|
209
209
|
ee,
|
|
@@ -225,7 +225,7 @@ function yi({
|
|
|
225
225
|
onValueChange: (s) => {
|
|
226
226
|
if (s === "code_defined")
|
|
227
227
|
throw new Error("This should not happen");
|
|
228
|
-
s === "true" ?
|
|
228
|
+
s === "true" ? p("customId", !0) : s === "false" ? p("customId", !1) : s === "optional" && p("customId", "optional");
|
|
229
229
|
},
|
|
230
230
|
value: D ?? "",
|
|
231
231
|
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",
|
|
@@ -238,24 +238,24 @@ function yi({
|
|
|
238
238
|
) }),
|
|
239
239
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
240
240
|
/* @__PURE__ */ e(
|
|
241
|
-
|
|
241
|
+
dt,
|
|
242
242
|
{
|
|
243
243
|
position: "start",
|
|
244
244
|
label: "Collection group",
|
|
245
|
-
onValueChange: (s) =>
|
|
246
|
-
value:
|
|
245
|
+
onValueChange: (s) => p("collectionGroup", s),
|
|
246
|
+
value: u.collectionGroup ?? !1
|
|
247
247
|
}
|
|
248
248
|
),
|
|
249
249
|
/* @__PURE__ */ e(X, { children: "A collection group consists of all collections with the same path. This allows you to query over multiple collections at once." })
|
|
250
250
|
] }),
|
|
251
251
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
252
252
|
/* @__PURE__ */ e(
|
|
253
|
-
|
|
253
|
+
dt,
|
|
254
254
|
{
|
|
255
255
|
position: "start",
|
|
256
256
|
label: "Enable text search for this collection",
|
|
257
|
-
onValueChange: (s) =>
|
|
258
|
-
value:
|
|
257
|
+
onValueChange: (s) => p("textSearchEnabled", s),
|
|
258
|
+
value: u.textSearchEnabled ?? !1
|
|
259
259
|
}
|
|
260
260
|
),
|
|
261
261
|
/* @__PURE__ */ e(X, { children: "Allow text search for this collection. If you have not specified a text search delegate, this will use the built-in local text search. This is not recommended for large collections, as it may incur in performance and cost issues." })
|
|
@@ -266,7 +266,7 @@ function yi({
|
|
|
266
266
|
] }),
|
|
267
267
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
268
268
|
/* @__PURE__ */ e(
|
|
269
|
-
|
|
269
|
+
Se,
|
|
270
270
|
{
|
|
271
271
|
open: y,
|
|
272
272
|
onOpenChange: P,
|
|
@@ -275,9 +275,9 @@ function yi({
|
|
|
275
275
|
children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
|
|
276
276
|
gr,
|
|
277
277
|
{
|
|
278
|
-
selectedIcon:
|
|
278
|
+
selectedIcon: u.icon,
|
|
279
279
|
onIconSelected: (s) => {
|
|
280
|
-
P(!1),
|
|
280
|
+
P(!1), p("icon", s);
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
) })
|
|
@@ -288,7 +288,7 @@ function yi({
|
|
|
288
288
|
function he(t) {
|
|
289
289
|
return "properties." + t.replaceAll(".", ".properties.");
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function Ci(t) {
|
|
292
292
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
|
|
293
293
|
}
|
|
294
294
|
function be(t) {
|
|
@@ -301,57 +301,57 @@ function ir(t, r) {
|
|
|
301
301
|
const n = r ? `${r}.${t}` : t;
|
|
302
302
|
return he(n);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function Pi({
|
|
305
305
|
enumValues: t,
|
|
306
306
|
onValuesChanged: r,
|
|
307
307
|
onError: n,
|
|
308
308
|
updateIds: i,
|
|
309
309
|
disabled: l,
|
|
310
310
|
allowDataInference: o,
|
|
311
|
-
getData:
|
|
311
|
+
getData: c
|
|
312
312
|
}) {
|
|
313
|
-
const
|
|
313
|
+
const u = Tt({
|
|
314
314
|
initialValues: { enumValues: t },
|
|
315
315
|
validateOnChange: !0,
|
|
316
316
|
validation: (m) => {
|
|
317
|
-
const
|
|
317
|
+
const d = {};
|
|
318
318
|
m.enumValues && m.enumValues.forEach((v, x) => {
|
|
319
|
-
v?.label || (
|
|
319
|
+
v?.label || (d.enumValues = d.enumValues ?? [], d.enumValues[x] = d.enumValues[x] ?? {}, d.enumValues[x].label = "You must specify a label for this enum value entry"), v?.id || (d.enumValues = d.enumValues ?? [], d.enumValues[x] = d.enumValues[x] ?? {}, d.enumValues[x].id = "You must specify an ID for this enum value entry");
|
|
320
320
|
});
|
|
321
|
-
const g = !!(
|
|
322
|
-
return n?.(g),
|
|
321
|
+
const g = !!(d?.enumValues && Object.keys(d?.enumValues).length > 0);
|
|
322
|
+
return n?.(g), d;
|
|
323
323
|
}
|
|
324
|
-
}), { values:
|
|
324
|
+
}), { values: p, errors: h } = u;
|
|
325
325
|
return de(() => {
|
|
326
|
-
r && r(
|
|
327
|
-
}, [
|
|
328
|
-
|
|
326
|
+
r && r(p.enumValues);
|
|
327
|
+
}, [p.enumValues]), /* @__PURE__ */ e(kt, { value: u, children: /* @__PURE__ */ e(
|
|
328
|
+
Ni,
|
|
329
329
|
{
|
|
330
330
|
enumValuesPath: "enumValues",
|
|
331
|
-
values:
|
|
331
|
+
values: p,
|
|
332
332
|
errors: h,
|
|
333
333
|
shouldUpdateId: i,
|
|
334
334
|
disabled: l,
|
|
335
335
|
allowDataInference: o,
|
|
336
|
-
getData:
|
|
336
|
+
getData: c
|
|
337
337
|
}
|
|
338
338
|
) });
|
|
339
339
|
}
|
|
340
|
-
function
|
|
340
|
+
function Ni({
|
|
341
341
|
values: t,
|
|
342
342
|
errors: r,
|
|
343
343
|
disabled: n,
|
|
344
344
|
enumValuesPath: i,
|
|
345
345
|
shouldUpdateId: l,
|
|
346
346
|
allowDataInference: o,
|
|
347
|
-
getData:
|
|
347
|
+
getData: c
|
|
348
348
|
}) {
|
|
349
349
|
const {
|
|
350
|
-
setFieldValue:
|
|
351
|
-
} = K(), [
|
|
352
|
-
const N =
|
|
350
|
+
setFieldValue: u
|
|
351
|
+
} = K(), [p, h] = Y.useState(), [m, d] = Y.useState(), [g, v] = Y.useState(!1), y = Y.useRef(/* @__PURE__ */ new Set()).current, P = (b, C) => {
|
|
352
|
+
const N = p === C, f = r?.enumValues && r?.enumValues[b];
|
|
353
353
|
return /* @__PURE__ */ e(
|
|
354
|
-
|
|
354
|
+
xi,
|
|
355
355
|
{
|
|
356
356
|
index: b,
|
|
357
357
|
disabled: n,
|
|
@@ -359,7 +359,7 @@ function Pi({
|
|
|
359
359
|
autoFocus: N,
|
|
360
360
|
entryError: f,
|
|
361
361
|
shouldUpdateId: l || N,
|
|
362
|
-
onDialogOpen: () =>
|
|
362
|
+
onDialogOpen: () => d(b),
|
|
363
363
|
inferredEntry: y.has(t.enumValues[b]?.id)
|
|
364
364
|
},
|
|
365
365
|
`${C}`
|
|
@@ -367,7 +367,7 @@ function Pi({
|
|
|
367
367
|
};
|
|
368
368
|
return /* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
369
369
|
/* @__PURE__ */ a("div", { className: "ml-3.5 flex flex-row items-center", children: [
|
|
370
|
-
/* @__PURE__ */ e(
|
|
370
|
+
/* @__PURE__ */ e(Dr, {}),
|
|
371
371
|
/* @__PURE__ */ e(
|
|
372
372
|
O,
|
|
373
373
|
{
|
|
@@ -384,13 +384,13 @@ function Pi({
|
|
|
384
384
|
variant: "text",
|
|
385
385
|
size: "small",
|
|
386
386
|
onClick: async () => {
|
|
387
|
-
|
|
387
|
+
c && (v(!0), c?.().then((b) => {
|
|
388
388
|
if (!b)
|
|
389
389
|
return;
|
|
390
|
-
const C = b.flat(), N = Array.from(new Set(C)), f = t.enumValues, _ =
|
|
390
|
+
const C = b.flat(), N = Array.from(new Set(C)), f = t.enumValues, _ = ti(N).filter((M) => !f?.some((U) => U.id === M.id));
|
|
391
391
|
_.forEach((M) => {
|
|
392
392
|
y.add(M.id);
|
|
393
|
-
}),
|
|
393
|
+
}), u(i, [..._, ...f], !0);
|
|
394
394
|
}).catch((b) => {
|
|
395
395
|
console.error(b);
|
|
396
396
|
}).finally(() => v(!1)));
|
|
@@ -414,37 +414,37 @@ function Pi({
|
|
|
414
414
|
buildEntry: P,
|
|
415
415
|
onInternalIdAdded: h,
|
|
416
416
|
includeAddButton: !0,
|
|
417
|
-
onValueChange: (b) =>
|
|
417
|
+
onValueChange: (b) => u(i, b),
|
|
418
418
|
newDefaultEntry: { id: "", label: "" }
|
|
419
419
|
}
|
|
420
420
|
),
|
|
421
421
|
/* @__PURE__ */ e(
|
|
422
|
-
|
|
422
|
+
wi,
|
|
423
423
|
{
|
|
424
424
|
index: m,
|
|
425
425
|
open: m !== void 0,
|
|
426
426
|
enumValuesPath: i,
|
|
427
|
-
onClose: () =>
|
|
427
|
+
onClose: () => d(void 0)
|
|
428
428
|
}
|
|
429
429
|
)
|
|
430
430
|
] })
|
|
431
431
|
] });
|
|
432
432
|
}
|
|
433
|
-
const
|
|
433
|
+
const xi = Y.memo(
|
|
434
434
|
function({
|
|
435
435
|
index: r,
|
|
436
436
|
shouldUpdateId: n,
|
|
437
437
|
enumValuesPath: i,
|
|
438
438
|
autoFocus: l,
|
|
439
439
|
onDialogOpen: o,
|
|
440
|
-
disabled:
|
|
441
|
-
inferredEntry:
|
|
442
|
-
entryError:
|
|
440
|
+
disabled: c,
|
|
441
|
+
inferredEntry: u,
|
|
442
|
+
entryError: p
|
|
443
443
|
}) {
|
|
444
444
|
const {
|
|
445
445
|
values: h,
|
|
446
446
|
handleChange: m,
|
|
447
|
-
errors:
|
|
447
|
+
errors: d,
|
|
448
448
|
setFieldValue: g,
|
|
449
449
|
touched: v
|
|
450
450
|
} = K(), x = Y.useRef(!I(h, `${i}[${r}].id`)), y = n || x.current, P = I(h, `${i}[${r}].id`), k = I(h, `${i}[${r}].label`), b = Y.useRef(k);
|
|
@@ -459,39 +459,39 @@ const Ni = Y.memo(
|
|
|
459
459
|
as: Z,
|
|
460
460
|
className: "flex-grow",
|
|
461
461
|
required: !0,
|
|
462
|
-
disabled:
|
|
462
|
+
disabled: c,
|
|
463
463
|
size: "small",
|
|
464
464
|
autoFocus: l,
|
|
465
465
|
autoComplete: "off",
|
|
466
|
-
endAdornment:
|
|
467
|
-
error: !!
|
|
466
|
+
endAdornment: u && /* @__PURE__ */ e(ht, { size: "small" }),
|
|
467
|
+
error: !!p?.label
|
|
468
468
|
}
|
|
469
469
|
),
|
|
470
|
-
!
|
|
470
|
+
!c && /* @__PURE__ */ e(Ar, { color: "error", invisible: !p?.id, children: /* @__PURE__ */ e(
|
|
471
471
|
oe,
|
|
472
472
|
{
|
|
473
473
|
size: "small",
|
|
474
474
|
"aria-label": "edit",
|
|
475
475
|
className: "m-1",
|
|
476
476
|
onClick: () => o(),
|
|
477
|
-
children: /* @__PURE__ */ e(
|
|
477
|
+
children: /* @__PURE__ */ e(Ge, { size: "small" })
|
|
478
478
|
}
|
|
479
479
|
) })
|
|
480
480
|
] }),
|
|
481
|
-
|
|
481
|
+
p?.label && /* @__PURE__ */ e(
|
|
482
482
|
O,
|
|
483
483
|
{
|
|
484
484
|
variant: "caption",
|
|
485
485
|
className: "ml-3.5 text-red-500 dark:text-red-500",
|
|
486
|
-
children:
|
|
486
|
+
children: p?.label
|
|
487
487
|
}
|
|
488
488
|
),
|
|
489
|
-
|
|
489
|
+
p?.id && /* @__PURE__ */ e(
|
|
490
490
|
O,
|
|
491
491
|
{
|
|
492
492
|
variant: "caption",
|
|
493
493
|
className: "ml-3.5 text-red-500 dark:text-red-500",
|
|
494
|
-
children:
|
|
494
|
+
children: p?.id
|
|
495
495
|
}
|
|
496
496
|
)
|
|
497
497
|
] });
|
|
@@ -500,7 +500,7 @@ const Ni = Y.memo(
|
|
|
500
500
|
return r.index === n.index && r.enumValuesPath === n.enumValuesPath && r.shouldUpdateId === n.shouldUpdateId && r.inferredEntry === n.inferredEntry && ye(r.entryError, n.entryError) && r.autoFocus === n.autoFocus;
|
|
501
501
|
}
|
|
502
502
|
);
|
|
503
|
-
function
|
|
503
|
+
function wi({
|
|
504
504
|
index: t,
|
|
505
505
|
open: r,
|
|
506
506
|
onClose: n,
|
|
@@ -510,12 +510,12 @@ function xi({
|
|
|
510
510
|
errors: l
|
|
511
511
|
} = K(), o = t !== void 0 ? I(l, `${i}[${t}].id`) : void 0;
|
|
512
512
|
return /* @__PURE__ */ a(
|
|
513
|
-
|
|
513
|
+
Se,
|
|
514
514
|
{
|
|
515
515
|
maxWidth: "md",
|
|
516
516
|
"aria-labelledby": "enum-edit-dialog",
|
|
517
517
|
open: r,
|
|
518
|
-
onOpenChange: (
|
|
518
|
+
onOpenChange: (c) => c ? void 0 : n(),
|
|
519
519
|
children: [
|
|
520
520
|
/* @__PURE__ */ e(Be, { children: t !== void 0 && /* @__PURE__ */ a("div", { children: [
|
|
521
521
|
/* @__PURE__ */ e(
|
|
@@ -553,29 +553,29 @@ function ce({
|
|
|
553
553
|
tooltip: i,
|
|
554
554
|
disabled: l,
|
|
555
555
|
size: o = "small",
|
|
556
|
-
allowIndeterminate:
|
|
556
|
+
allowIndeterminate: c
|
|
557
557
|
}) {
|
|
558
|
-
const
|
|
559
|
-
|
|
558
|
+
const u = /* @__PURE__ */ e(
|
|
559
|
+
dt,
|
|
560
560
|
{
|
|
561
561
|
label: n,
|
|
562
562
|
size: o,
|
|
563
563
|
position: "start",
|
|
564
564
|
value: t.value,
|
|
565
565
|
disabled: l,
|
|
566
|
-
allowIndeterminate:
|
|
567
|
-
onValueChange: (
|
|
566
|
+
allowIndeterminate: c,
|
|
567
|
+
onValueChange: (p) => r.setFieldValue(t.name, p)
|
|
568
568
|
}
|
|
569
569
|
);
|
|
570
570
|
return i ? /* @__PURE__ */ e(
|
|
571
571
|
te,
|
|
572
572
|
{
|
|
573
573
|
title: i,
|
|
574
|
-
children:
|
|
574
|
+
children: u
|
|
575
575
|
}
|
|
576
|
-
) :
|
|
576
|
+
) : u;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function Fe({ disabled: t }) {
|
|
579
579
|
const { values: r, handleChange: n } = K(), i = "validation.required", l = "validation.requiredMessage";
|
|
580
580
|
return /* @__PURE__ */ a(R, { children: [
|
|
581
581
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
@@ -583,14 +583,14 @@ function Se({ disabled: t }) {
|
|
|
583
583
|
{
|
|
584
584
|
name: i,
|
|
585
585
|
type: "checkbox",
|
|
586
|
-
children: ({ field:
|
|
586
|
+
children: ({ field: c, form: u }) => /* @__PURE__ */ e(
|
|
587
587
|
ce,
|
|
588
588
|
{
|
|
589
589
|
disabled: t,
|
|
590
590
|
label: "Required",
|
|
591
591
|
tooltip: "You won't be able to save this entity if this value is not set",
|
|
592
|
-
form:
|
|
593
|
-
field:
|
|
592
|
+
form: u,
|
|
593
|
+
field: c
|
|
594
594
|
}
|
|
595
595
|
)
|
|
596
596
|
}
|
|
@@ -600,14 +600,14 @@ function Se({ disabled: t }) {
|
|
|
600
600
|
{
|
|
601
601
|
name: "validation.unique",
|
|
602
602
|
type: "checkbox",
|
|
603
|
-
children: ({ field:
|
|
603
|
+
children: ({ field: c, form: u }) => /* @__PURE__ */ e(
|
|
604
604
|
ce,
|
|
605
605
|
{
|
|
606
606
|
disabled: t,
|
|
607
607
|
label: "Unique",
|
|
608
608
|
tooltip: "There cannot be multiple entities with the same value",
|
|
609
|
-
form:
|
|
610
|
-
field:
|
|
609
|
+
form: u,
|
|
610
|
+
field: c
|
|
611
611
|
}
|
|
612
612
|
)
|
|
613
613
|
}
|
|
@@ -632,17 +632,17 @@ function Ee({
|
|
|
632
632
|
max: i,
|
|
633
633
|
min: l,
|
|
634
634
|
trim: o,
|
|
635
|
-
uppercase:
|
|
636
|
-
disabled:
|
|
637
|
-
showErrors:
|
|
635
|
+
uppercase: c,
|
|
636
|
+
disabled: u,
|
|
637
|
+
showErrors: p
|
|
638
638
|
}) {
|
|
639
639
|
const {
|
|
640
640
|
values: h,
|
|
641
641
|
handleChange: m,
|
|
642
|
-
errors:
|
|
643
|
-
} = K(), g = "validation.length", v = "validation.min", x = "validation.max", y = "validation.trim", P = "validation.matches", k = "validation.lowercase", b = "validation.uppercase", C = I(
|
|
642
|
+
errors: d
|
|
643
|
+
} = K(), g = "validation.length", v = "validation.min", x = "validation.max", y = "validation.trim", P = "validation.matches", k = "validation.lowercase", b = "validation.uppercase", C = I(d, P), N = I(h, P), f = typeof N == "string" ? N : br(N);
|
|
644
644
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
645
|
-
/* @__PURE__ */ e(
|
|
645
|
+
/* @__PURE__ */ e(Fe, { disabled: u }),
|
|
646
646
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
647
647
|
r && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
648
648
|
H,
|
|
@@ -653,14 +653,14 @@ function Ee({
|
|
|
653
653
|
ce,
|
|
654
654
|
{
|
|
655
655
|
label: "Lowercase",
|
|
656
|
-
disabled:
|
|
656
|
+
disabled: u,
|
|
657
657
|
form: _,
|
|
658
658
|
field: w
|
|
659
659
|
}
|
|
660
660
|
)
|
|
661
661
|
}
|
|
662
662
|
) }),
|
|
663
|
-
|
|
663
|
+
c && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
664
664
|
H,
|
|
665
665
|
{
|
|
666
666
|
name: b,
|
|
@@ -669,7 +669,7 @@ function Ee({
|
|
|
669
669
|
ce,
|
|
670
670
|
{
|
|
671
671
|
label: "Uppercase",
|
|
672
|
-
disabled:
|
|
672
|
+
disabled: u,
|
|
673
673
|
form: _,
|
|
674
674
|
field: w
|
|
675
675
|
}
|
|
@@ -685,7 +685,7 @@ function Ee({
|
|
|
685
685
|
ce,
|
|
686
686
|
{
|
|
687
687
|
label: "Trim",
|
|
688
|
-
disabled:
|
|
688
|
+
disabled: u,
|
|
689
689
|
form: _,
|
|
690
690
|
field: w
|
|
691
691
|
}
|
|
@@ -702,7 +702,7 @@ function Ee({
|
|
|
702
702
|
name: g,
|
|
703
703
|
type: "number",
|
|
704
704
|
size: "small",
|
|
705
|
-
disabled:
|
|
705
|
+
disabled: u,
|
|
706
706
|
onChange: m
|
|
707
707
|
}
|
|
708
708
|
) }),
|
|
@@ -714,7 +714,7 @@ function Ee({
|
|
|
714
714
|
name: v,
|
|
715
715
|
type: "number",
|
|
716
716
|
size: "small",
|
|
717
|
-
disabled:
|
|
717
|
+
disabled: u,
|
|
718
718
|
onChange: m
|
|
719
719
|
}
|
|
720
720
|
) }),
|
|
@@ -726,7 +726,7 @@ function Ee({
|
|
|
726
726
|
name: x,
|
|
727
727
|
type: "number",
|
|
728
728
|
size: "small",
|
|
729
|
-
disabled:
|
|
729
|
+
disabled: u,
|
|
730
730
|
onChange: m
|
|
731
731
|
}
|
|
732
732
|
) })
|
|
@@ -739,7 +739,7 @@ function Ee({
|
|
|
739
739
|
as: Z,
|
|
740
740
|
label: "Matches regex",
|
|
741
741
|
size: "small",
|
|
742
|
-
disabled:
|
|
742
|
+
disabled: u,
|
|
743
743
|
value: f,
|
|
744
744
|
error: !!C
|
|
745
745
|
}
|
|
@@ -756,9 +756,9 @@ function Ot({
|
|
|
756
756
|
const {
|
|
757
757
|
values: i,
|
|
758
758
|
handleChange: l
|
|
759
|
-
} = K(), o = "validation.min",
|
|
759
|
+
} = K(), o = "validation.min", c = "validation.max";
|
|
760
760
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
761
|
-
/* @__PURE__ */ e(
|
|
761
|
+
/* @__PURE__ */ e(Fe, { disabled: n }),
|
|
762
762
|
r && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
763
763
|
Z,
|
|
764
764
|
{
|
|
@@ -774,10 +774,10 @@ function Ot({
|
|
|
774
774
|
t && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
775
775
|
Z,
|
|
776
776
|
{
|
|
777
|
-
value: I(i,
|
|
777
|
+
value: I(i, c),
|
|
778
778
|
disabled: n,
|
|
779
779
|
label: "Max length",
|
|
780
|
-
name:
|
|
780
|
+
name: c,
|
|
781
781
|
type: "number",
|
|
782
782
|
size: "small",
|
|
783
783
|
onChange: l
|
|
@@ -795,7 +795,7 @@ function xe({
|
|
|
795
795
|
asField: !0,
|
|
796
796
|
className: "p-4",
|
|
797
797
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
798
|
-
/* @__PURE__ */ e(
|
|
798
|
+
/* @__PURE__ */ e(Br, {}),
|
|
799
799
|
/* @__PURE__ */ e(
|
|
800
800
|
O,
|
|
801
801
|
{
|
|
@@ -818,26 +818,26 @@ function Rt({
|
|
|
818
818
|
getData: o
|
|
819
819
|
}) {
|
|
820
820
|
const {
|
|
821
|
-
values:
|
|
822
|
-
setFieldError:
|
|
823
|
-
setFieldValue:
|
|
824
|
-
} = K(), h = _e(), m = t ? "of.enumValues" : "enumValues",
|
|
821
|
+
values: c,
|
|
822
|
+
setFieldError: u,
|
|
823
|
+
setFieldValue: p
|
|
824
|
+
} = K(), h = _e(), m = t ? "of.enumValues" : "enumValues", d = I(c, "defaultValue"), g = I(c, m), v = Zt(() => !g || typeof g == "boolean" ? [] : Cr(g) ?? [], [g]);
|
|
825
825
|
return /* @__PURE__ */ a(R, { children: [
|
|
826
826
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
827
|
-
|
|
827
|
+
Pi,
|
|
828
828
|
{
|
|
829
829
|
enumValues: v,
|
|
830
830
|
updateIds: r,
|
|
831
831
|
disabled: n,
|
|
832
832
|
allowDataInference: l,
|
|
833
833
|
onError: (y) => {
|
|
834
|
-
|
|
834
|
+
u(m, y ? "This enum property is missing some values" : void 0);
|
|
835
835
|
},
|
|
836
|
-
getData: o ? () => o().then((y) => y.map((P) =>
|
|
836
|
+
getData: o ? () => o().then((y) => y.map((P) => c.id && I(P, c.id)).filter(Boolean)) : void 0,
|
|
837
837
|
onValuesChanged: (y) => {
|
|
838
|
-
if (
|
|
838
|
+
if (c && (p(m, y), !t)) {
|
|
839
839
|
const P = y.filter((k) => !!k?.id).map((k) => k.id);
|
|
840
|
-
|
|
840
|
+
d && !P.includes(d) && (p("defaultValue", void 0), h.open({
|
|
841
841
|
type: "warning",
|
|
842
842
|
message: "Default value was cleared"
|
|
843
843
|
}));
|
|
@@ -861,10 +861,10 @@ function Rt({
|
|
|
861
861
|
disabled: n,
|
|
862
862
|
position: "item-aligned",
|
|
863
863
|
onValueChange: (y) => {
|
|
864
|
-
|
|
864
|
+
p("defaultValue", y);
|
|
865
865
|
},
|
|
866
866
|
label: "Default value",
|
|
867
|
-
value:
|
|
867
|
+
value: d ?? "",
|
|
868
868
|
children: v.filter((y) => !!y?.id).map((y) => /* @__PURE__ */ e(
|
|
869
869
|
ee,
|
|
870
870
|
{
|
|
@@ -877,7 +877,7 @@ function Rt({
|
|
|
877
877
|
) })
|
|
878
878
|
] });
|
|
879
879
|
}
|
|
880
|
-
const
|
|
880
|
+
const nt = {
|
|
881
881
|
"image/*": "Images",
|
|
882
882
|
"video/*": "Videos",
|
|
883
883
|
"audio/*": "Audio files",
|
|
@@ -892,15 +892,15 @@ function Ut({
|
|
|
892
892
|
const {
|
|
893
893
|
values: i,
|
|
894
894
|
setFieldValue: l
|
|
895
|
-
} = K(), o = t ? "of.storage" : "storage",
|
|
896
|
-
b ? b.includes("all") || b.length >= Object.keys(
|
|
897
|
-
}, P = typeof m == "function", k = typeof
|
|
895
|
+
} = K(), o = t ? "of.storage" : "storage", c = `${o}.acceptedFiles`, u = `${o}.fileName`, p = `${o}.storagePath`, h = `${o}.storeUrl`, m = I(i, u) ?? "{rand}_{file}", d = I(i, p) ?? "/", g = I(i, c), v = Array.isArray(g) ? g : void 0, x = !v || v.length === 0, y = (b) => {
|
|
896
|
+
b ? b.includes("all") || b.length >= Object.keys(nt).length ? l(c, void 0) : x ? l(c, Object.keys(nt).filter((C) => !b.includes(C))) : l(c, b) : l(c, void 0);
|
|
897
|
+
}, P = typeof m == "function", k = typeof d == "function";
|
|
898
898
|
return /* @__PURE__ */ a(R, { children: [
|
|
899
899
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
900
900
|
xt,
|
|
901
901
|
{
|
|
902
902
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
903
|
-
/* @__PURE__ */ e(
|
|
903
|
+
/* @__PURE__ */ e(zr, {}),
|
|
904
904
|
/* @__PURE__ */ e(
|
|
905
905
|
O,
|
|
906
906
|
{
|
|
@@ -912,16 +912,16 @@ function Ut({
|
|
|
912
912
|
] }),
|
|
913
913
|
children: /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 p-4", children: [
|
|
914
914
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
915
|
-
|
|
915
|
+
Mr,
|
|
916
916
|
{
|
|
917
917
|
disabled: n,
|
|
918
|
-
name:
|
|
918
|
+
name: c,
|
|
919
919
|
value: v ?? [],
|
|
920
920
|
onMultiValueChange: y,
|
|
921
921
|
label: x ? void 0 : "Allowed file types",
|
|
922
|
-
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((C) =>
|
|
922
|
+
renderValues: (b) => !b || b.length === 0 ? "All file types allowed" : b.map((C) => nt[C]).filter((C) => !!C).join(", "),
|
|
923
923
|
children: [
|
|
924
|
-
/* @__PURE__ */ a(
|
|
924
|
+
/* @__PURE__ */ a(Ft, { value: "all", className: "flex items-center gap-2", children: [
|
|
925
925
|
/* @__PURE__ */ e(
|
|
926
926
|
Et,
|
|
927
927
|
{
|
|
@@ -930,7 +930,7 @@ function Ut({
|
|
|
930
930
|
),
|
|
931
931
|
"All"
|
|
932
932
|
] }, "all"),
|
|
933
|
-
Object.entries(
|
|
933
|
+
Object.entries(nt).map(([b, C]) => /* @__PURE__ */ a(Ft, { value: b, className: "flex items-center gap-2", children: [
|
|
934
934
|
/* @__PURE__ */ e(
|
|
935
935
|
Et,
|
|
936
936
|
{
|
|
@@ -943,7 +943,7 @@ function Ut({
|
|
|
943
943
|
{
|
|
944
944
|
size: "small",
|
|
945
945
|
variant: "outlined",
|
|
946
|
-
onClick: (N) => (N.preventDefault(), N.stopPropagation(), l(
|
|
946
|
+
onClick: (N) => (N.preventDefault(), N.stopPropagation(), l(c, [b])),
|
|
947
947
|
children: "Only"
|
|
948
948
|
}
|
|
949
949
|
)
|
|
@@ -954,7 +954,7 @@ function Ut({
|
|
|
954
954
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
955
955
|
H,
|
|
956
956
|
{
|
|
957
|
-
name:
|
|
957
|
+
name: u,
|
|
958
958
|
as: Z,
|
|
959
959
|
label: "File name",
|
|
960
960
|
size: "small",
|
|
@@ -966,12 +966,12 @@ function Ut({
|
|
|
966
966
|
/* @__PURE__ */ e(
|
|
967
967
|
H,
|
|
968
968
|
{
|
|
969
|
-
name:
|
|
969
|
+
name: p,
|
|
970
970
|
as: Z,
|
|
971
971
|
label: "Storage path",
|
|
972
972
|
disabled: k || n,
|
|
973
973
|
size: "small",
|
|
974
|
-
value: k ? "-" :
|
|
974
|
+
value: k ? "-" : d
|
|
975
975
|
}
|
|
976
976
|
),
|
|
977
977
|
/* @__PURE__ */ a(O, { variant: "caption", className: "ml-3.5 mt-1 mb-2", children: [
|
|
@@ -1008,7 +1008,7 @@ function Ut({
|
|
|
1008
1008
|
}
|
|
1009
1009
|
) }),
|
|
1010
1010
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(xe, { children: [
|
|
1011
|
-
!t && /* @__PURE__ */ e("div", { className: "grid grid-cols-12 gap-2", children: /* @__PURE__ */ e(
|
|
1011
|
+
!t && /* @__PURE__ */ e("div", { className: "grid grid-cols-12 gap-2", children: /* @__PURE__ */ e(Fe, { disabled: n }) }),
|
|
1012
1012
|
t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ot, { disabled: n }) })
|
|
1013
1013
|
] }) })
|
|
1014
1014
|
] });
|
|
@@ -1021,14 +1021,14 @@ function qe(t) {
|
|
|
1021
1021
|
return r.dataType === "array" && typeof r.of == "function" || r.dataType === "array" && Array.isArray(r.of) ? !1 : !!r.editable;
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function Ti(t) {
|
|
1025
1025
|
return Object.entries(t).filter(([r, n]) => qe(n)).map(([r, n]) => {
|
|
1026
1026
|
const i = n;
|
|
1027
1027
|
if (qe(i))
|
|
1028
1028
|
return i.dataType === "map" && i.properties ? {
|
|
1029
1029
|
[r]: {
|
|
1030
1030
|
...i,
|
|
1031
|
-
properties:
|
|
1031
|
+
properties: Ti(i.properties)
|
|
1032
1032
|
}
|
|
1033
1033
|
} : { [r]: i };
|
|
1034
1034
|
}).filter((r) => !!r).reduce((r, n) => ({ ...r, ...n }), {});
|
|
@@ -1041,16 +1041,16 @@ function nr({
|
|
|
1041
1041
|
includeEditButton: l,
|
|
1042
1042
|
selected: o
|
|
1043
1043
|
}) {
|
|
1044
|
-
const { propertyConfigs:
|
|
1044
|
+
const { propertyConfigs: c } = Ae(), u = $e(t, c);
|
|
1045
1045
|
qe(t);
|
|
1046
|
-
const
|
|
1046
|
+
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";
|
|
1047
1047
|
return n && console.log("PropertyFieldPreview", t), /* @__PURE__ */ e(me, { children: /* @__PURE__ */ a(
|
|
1048
1048
|
"div",
|
|
1049
1049
|
{
|
|
1050
1050
|
onClick: r,
|
|
1051
1051
|
className: "flex flex-row w-full cursor-pointer",
|
|
1052
1052
|
children: [
|
|
1053
|
-
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(Ye, { propertyConfig:
|
|
1053
|
+
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(Ye, { propertyConfig: u }) }),
|
|
1054
1054
|
/* @__PURE__ */ a(
|
|
1055
1055
|
Pe,
|
|
1056
1056
|
{
|
|
@@ -1061,7 +1061,7 @@ function nr({
|
|
|
1061
1061
|
r ? Xt : "",
|
|
1062
1062
|
o ? er : "",
|
|
1063
1063
|
"flex-grow p-4 border transition-colors duration-200",
|
|
1064
|
-
|
|
1064
|
+
p
|
|
1065
1065
|
),
|
|
1066
1066
|
children: [
|
|
1067
1067
|
/* @__PURE__ */ a("div", { className: "w-full flex flex-col", children: [
|
|
@@ -1082,7 +1082,7 @@ function nr({
|
|
|
1082
1082
|
variant: i ? "body2" : "subtitle1",
|
|
1083
1083
|
component: "span",
|
|
1084
1084
|
color: "secondary",
|
|
1085
|
-
children:
|
|
1085
|
+
children: u?.name
|
|
1086
1086
|
}
|
|
1087
1087
|
) }),
|
|
1088
1088
|
/* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
@@ -1104,7 +1104,7 @@ function nr({
|
|
|
1104
1104
|
}
|
|
1105
1105
|
) });
|
|
1106
1106
|
}
|
|
1107
|
-
function
|
|
1107
|
+
function ki({
|
|
1108
1108
|
name: t,
|
|
1109
1109
|
selected: r,
|
|
1110
1110
|
onClick: n,
|
|
@@ -1123,10 +1123,10 @@ function Ti({
|
|
|
1123
1123
|
"div",
|
|
1124
1124
|
{
|
|
1125
1125
|
className: "h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500",
|
|
1126
|
-
children: /* @__PURE__ */ e(
|
|
1126
|
+
children: /* @__PURE__ */ e(Rr, { color: "inherit", size: "medium" })
|
|
1127
1127
|
}
|
|
1128
1128
|
),
|
|
1129
|
-
/* @__PURE__ */ e(
|
|
1129
|
+
/* @__PURE__ */ e(Ur, { color: "disabled", size: "small", className: "absolute -right-2 -top-2" })
|
|
1130
1130
|
] }),
|
|
1131
1131
|
/* @__PURE__ */ e(
|
|
1132
1132
|
Pe,
|
|
@@ -1202,21 +1202,21 @@ const ft = Y.memo(
|
|
|
1202
1202
|
onPropertyClick: i,
|
|
1203
1203
|
properties: l,
|
|
1204
1204
|
propertiesOrder: o,
|
|
1205
|
-
additionalFields:
|
|
1206
|
-
errors:
|
|
1207
|
-
onPropertyMove:
|
|
1205
|
+
additionalFields: c,
|
|
1206
|
+
errors: u,
|
|
1207
|
+
onPropertyMove: p,
|
|
1208
1208
|
onPropertyRemove: h,
|
|
1209
1209
|
className: m,
|
|
1210
|
-
inferredPropertyKeys:
|
|
1210
|
+
inferredPropertyKeys: d,
|
|
1211
1211
|
collectionEditable: g
|
|
1212
1212
|
}) {
|
|
1213
1213
|
const v = o ?? Object.keys(l), x = Q((y) => {
|
|
1214
1214
|
if (!y.destination)
|
|
1215
1215
|
return;
|
|
1216
1216
|
const P = y.source.index, k = y.destination.index, b = Array.from(v), [C] = b.splice(P, 1);
|
|
1217
|
-
b.splice(k, 0, C),
|
|
1218
|
-
}, [r,
|
|
1219
|
-
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
|
|
1217
|
+
b.splice(k, 0, C), p && p(b, r);
|
|
1218
|
+
}, [r, p, v]);
|
|
1219
|
+
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(ni, { onDragEnd: x, children: /* @__PURE__ */ e(ai, { droppableId: `droppable_${r}`, children: (y, P) => /* @__PURE__ */ a(
|
|
1220
1220
|
"div",
|
|
1221
1221
|
{
|
|
1222
1222
|
...y.droppableProps,
|
|
@@ -1224,23 +1224,23 @@ const ft = Y.memo(
|
|
|
1224
1224
|
className: m,
|
|
1225
1225
|
children: [
|
|
1226
1226
|
v && v.map((k, b) => {
|
|
1227
|
-
const C = l[k], N =
|
|
1227
|
+
const C = l[k], N = c?.find((f) => f.key === k);
|
|
1228
1228
|
return !C && !N ? (console.warn(`Property ${k} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
1229
|
-
|
|
1229
|
+
oi,
|
|
1230
1230
|
{
|
|
1231
1231
|
draggableId: `array_field_${r}_${k}}`,
|
|
1232
1232
|
index: b,
|
|
1233
1233
|
children: (f, w) => /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
1234
|
-
|
|
1234
|
+
Oi,
|
|
1235
1235
|
{
|
|
1236
1236
|
propertyKey: k,
|
|
1237
1237
|
propertyOrBuilder: C,
|
|
1238
1238
|
additionalField: N,
|
|
1239
1239
|
provided: f,
|
|
1240
|
-
errors:
|
|
1240
|
+
errors: u,
|
|
1241
1241
|
namespace: r,
|
|
1242
|
-
inferredPropertyKeys:
|
|
1243
|
-
onPropertyMove:
|
|
1242
|
+
inferredPropertyKeys: d,
|
|
1243
|
+
onPropertyMove: p,
|
|
1244
1244
|
onPropertyRemove: h,
|
|
1245
1245
|
onPropertyClick: w.isDragging ? void 0 : i,
|
|
1246
1246
|
selectedPropertyKey: n,
|
|
@@ -1263,21 +1263,21 @@ const ft = Y.memo(
|
|
|
1263
1263
|
t.namespace === r.namespace && t.collectionEditable === r.collectionEditable;
|
|
1264
1264
|
}
|
|
1265
1265
|
);
|
|
1266
|
-
function
|
|
1266
|
+
function Oi({
|
|
1267
1267
|
propertyKey: t,
|
|
1268
1268
|
namespace: r,
|
|
1269
1269
|
propertyOrBuilder: n,
|
|
1270
1270
|
additionalField: i,
|
|
1271
1271
|
provided: l,
|
|
1272
1272
|
selectedPropertyKey: o,
|
|
1273
|
-
errors:
|
|
1274
|
-
onPropertyClick:
|
|
1275
|
-
onPropertyMove:
|
|
1273
|
+
errors: c,
|
|
1274
|
+
onPropertyClick: u,
|
|
1275
|
+
onPropertyMove: p,
|
|
1276
1276
|
onPropertyRemove: h,
|
|
1277
1277
|
inferredPropertyKeys: m,
|
|
1278
|
-
collectionEditable:
|
|
1278
|
+
collectionEditable: d
|
|
1279
1279
|
}) {
|
|
1280
|
-
const g = m?.includes(r ? `${r}.${t}` : t), v = ae(t, r), y = ir(t, r) in
|
|
1280
|
+
const g = m?.includes(r ? `${r}.${t}` : t), v = ae(t, r), y = ir(t, r) in c;
|
|
1281
1281
|
let P;
|
|
1282
1282
|
if (typeof n == "object") {
|
|
1283
1283
|
const C = n;
|
|
@@ -1288,15 +1288,15 @@ function ki({
|
|
|
1288
1288
|
namespace: v,
|
|
1289
1289
|
properties: C.properties,
|
|
1290
1290
|
propertiesOrder: C.propertiesOrder,
|
|
1291
|
-
errors:
|
|
1292
|
-
onPropertyClick:
|
|
1293
|
-
onPropertyMove:
|
|
1291
|
+
errors: c,
|
|
1292
|
+
onPropertyClick: u,
|
|
1293
|
+
onPropertyMove: p,
|
|
1294
1294
|
onPropertyRemove: h,
|
|
1295
|
-
collectionEditable:
|
|
1295
|
+
collectionEditable: d
|
|
1296
1296
|
}
|
|
1297
1297
|
));
|
|
1298
1298
|
}
|
|
1299
|
-
const k = o === v, b = n && (
|
|
1299
|
+
const k = o === v, b = n && (d && !ne(n) || qe(n));
|
|
1300
1300
|
return /* @__PURE__ */ a(
|
|
1301
1301
|
"div",
|
|
1302
1302
|
{
|
|
@@ -1320,17 +1320,17 @@ function ki({
|
|
|
1320
1320
|
nr,
|
|
1321
1321
|
{
|
|
1322
1322
|
property: n,
|
|
1323
|
-
onClick:
|
|
1323
|
+
onClick: u ? () => u(t, r) : void 0,
|
|
1324
1324
|
includeName: !0,
|
|
1325
1325
|
selected: k,
|
|
1326
1326
|
hasError: y
|
|
1327
1327
|
}
|
|
1328
1328
|
) : /* @__PURE__ */ e(
|
|
1329
|
-
|
|
1329
|
+
ki,
|
|
1330
1330
|
{
|
|
1331
1331
|
name: t,
|
|
1332
1332
|
property: n,
|
|
1333
|
-
onClick:
|
|
1333
|
+
onClick: u ? () => u(t, r) : void 0,
|
|
1334
1334
|
selected: k
|
|
1335
1335
|
}
|
|
1336
1336
|
),
|
|
@@ -1342,15 +1342,15 @@ function ki({
|
|
|
1342
1342
|
size: "small",
|
|
1343
1343
|
color: "inherit",
|
|
1344
1344
|
onClick: () => h(t, r),
|
|
1345
|
-
children: /* @__PURE__ */ e(
|
|
1345
|
+
children: /* @__PURE__ */ e(jr, { size: "small" })
|
|
1346
1346
|
}
|
|
1347
1347
|
) }),
|
|
1348
|
-
|
|
1348
|
+
p && /* @__PURE__ */ e(te, { title: "Move", children: /* @__PURE__ */ e(
|
|
1349
1349
|
oe,
|
|
1350
1350
|
{
|
|
1351
1351
|
component: "span",
|
|
1352
1352
|
size: "small",
|
|
1353
|
-
children: /* @__PURE__ */ e(
|
|
1353
|
+
children: /* @__PURE__ */ e(Lr, { size: "small" })
|
|
1354
1354
|
}
|
|
1355
1355
|
) })
|
|
1356
1356
|
] }),
|
|
@@ -1359,30 +1359,30 @@ function ki({
|
|
|
1359
1359
|
}
|
|
1360
1360
|
);
|
|
1361
1361
|
}
|
|
1362
|
-
function
|
|
1362
|
+
function Vi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i, collectionEditable: l }) {
|
|
1363
1363
|
const {
|
|
1364
1364
|
values: o,
|
|
1365
|
-
setFieldValue:
|
|
1366
|
-
} = K(), [
|
|
1365
|
+
setFieldValue: c
|
|
1366
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [d, g] = $(), v = o.propertiesOrder ?? Object.keys(o.properties ?? {}), x = ({
|
|
1367
1367
|
id: N,
|
|
1368
1368
|
property: f
|
|
1369
1369
|
}) => {
|
|
1370
1370
|
if (!N)
|
|
1371
1371
|
throw Error();
|
|
1372
|
-
|
|
1372
|
+
c("properties", {
|
|
1373
1373
|
...o.properties ?? {},
|
|
1374
1374
|
[N]: f
|
|
1375
1375
|
}, !1);
|
|
1376
1376
|
const w = o.propertiesOrder ?? Object.keys(o.properties ?? {}), _ = w.includes(N) ? w : [...w, N];
|
|
1377
|
-
|
|
1377
|
+
c("propertiesOrder", _, !1), p(!1);
|
|
1378
1378
|
}, y = Q((N, f) => {
|
|
1379
1379
|
const w = N ? ae(N, f) : void 0;
|
|
1380
1380
|
if (!w)
|
|
1381
1381
|
throw Error("collection editor miss config");
|
|
1382
|
-
const _ = he(w), M = be(f), U = I(o, M) ?? Object.keys(I(o,
|
|
1383
|
-
|
|
1384
|
-
}, [
|
|
1385
|
-
|
|
1382
|
+
const _ = he(w), M = be(f), U = I(o, M) ?? Object.keys(I(o, Ci(f)));
|
|
1383
|
+
c(_, void 0, !1), c(M, U.filter((D) => D !== N), !1), p(!1), m(void 0), g(void 0);
|
|
1384
|
+
}, [c, o]), P = h ? ae(h, d) : void 0, k = P ? I(o.properties, P.replaceAll(".", ".properties.")) : void 0, b = !v || v.length < 1, C = Q((N, f) => {
|
|
1385
|
+
c(be(f), N, !1);
|
|
1386
1386
|
}, []);
|
|
1387
1387
|
return /* @__PURE__ */ a(R, { children: [
|
|
1388
1388
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -1393,7 +1393,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1393
1393
|
{
|
|
1394
1394
|
color: "primary",
|
|
1395
1395
|
variant: "outlined",
|
|
1396
|
-
onClick: () =>
|
|
1396
|
+
onClick: () => p(!0),
|
|
1397
1397
|
startIcon: /* @__PURE__ */ e(se, {}),
|
|
1398
1398
|
children: [
|
|
1399
1399
|
"Add property to ",
|
|
@@ -1411,7 +1411,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1411
1411
|
errors: {},
|
|
1412
1412
|
collectionEditable: l,
|
|
1413
1413
|
onPropertyClick: (N, f) => {
|
|
1414
|
-
m(N), g(f),
|
|
1414
|
+
m(N), g(f), p(!0);
|
|
1415
1415
|
},
|
|
1416
1416
|
onPropertyMove: C
|
|
1417
1417
|
}
|
|
@@ -1428,12 +1428,12 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1428
1428
|
] }),
|
|
1429
1429
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1430
1430
|
/* @__PURE__ */ e(
|
|
1431
|
-
|
|
1431
|
+
dt,
|
|
1432
1432
|
{
|
|
1433
1433
|
position: "start",
|
|
1434
1434
|
size: "small",
|
|
1435
1435
|
label: "Spread children as columns",
|
|
1436
|
-
onValueChange: (N) =>
|
|
1436
|
+
onValueChange: (N) => c("spreadChildren", N),
|
|
1437
1437
|
value: o.spreadChildren ?? !1
|
|
1438
1438
|
}
|
|
1439
1439
|
),
|
|
@@ -1444,19 +1444,19 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1444
1444
|
{
|
|
1445
1445
|
inArray: !1,
|
|
1446
1446
|
forceShowErrors: !1,
|
|
1447
|
-
open:
|
|
1447
|
+
open: u,
|
|
1448
1448
|
allowDataInference: n,
|
|
1449
1449
|
collectionEditable: l,
|
|
1450
1450
|
onCancel: () => {
|
|
1451
|
-
|
|
1451
|
+
p(!1), m(void 0), g(void 0);
|
|
1452
1452
|
},
|
|
1453
1453
|
onOkClicked: () => {
|
|
1454
|
-
|
|
1454
|
+
p(!1), m(void 0), g(void 0);
|
|
1455
1455
|
},
|
|
1456
1456
|
getData: r,
|
|
1457
1457
|
onDelete: y,
|
|
1458
1458
|
propertyKey: h,
|
|
1459
|
-
propertyNamespace:
|
|
1459
|
+
propertyNamespace: d,
|
|
1460
1460
|
property: k,
|
|
1461
1461
|
existingProperty: !!h,
|
|
1462
1462
|
autoUpdateId: !h,
|
|
@@ -1468,22 +1468,22 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1468
1468
|
)
|
|
1469
1469
|
] });
|
|
1470
1470
|
}
|
|
1471
|
-
function
|
|
1471
|
+
function Ii({
|
|
1472
1472
|
showErrors: t,
|
|
1473
1473
|
existing: r,
|
|
1474
1474
|
disabled: n,
|
|
1475
1475
|
getData: i,
|
|
1476
1476
|
allowDataInference: l,
|
|
1477
1477
|
propertyConfigs: o,
|
|
1478
|
-
collectionEditable:
|
|
1478
|
+
collectionEditable: c
|
|
1479
1479
|
}) {
|
|
1480
1480
|
const {
|
|
1481
|
-
values:
|
|
1482
|
-
handleChange:
|
|
1481
|
+
values: u,
|
|
1482
|
+
handleChange: p,
|
|
1483
1483
|
errors: h,
|
|
1484
1484
|
setFieldValue: m,
|
|
1485
|
-
touched:
|
|
1486
|
-
} = K(), [g, v] = $(!1), x = I(
|
|
1485
|
+
touched: d
|
|
1486
|
+
} = K(), [g, v] = $(!1), x = I(u, "of"), y = I(d, "of") && I(h, "of"), P = ({ id: b, property: C, namespace: N }) => {
|
|
1487
1487
|
console.log("onPropertyChanged", b, C, N), m("of", C);
|
|
1488
1488
|
}, k = x && $e(x, o);
|
|
1489
1489
|
return /* @__PURE__ */ a(R, { children: [
|
|
@@ -1535,7 +1535,7 @@ function Vi({
|
|
|
1535
1535
|
onPropertyChanged: P,
|
|
1536
1536
|
forceShowErrors: t,
|
|
1537
1537
|
propertyConfigs: o,
|
|
1538
|
-
collectionEditable:
|
|
1538
|
+
collectionEditable: c
|
|
1539
1539
|
}
|
|
1540
1540
|
)
|
|
1541
1541
|
] })
|
|
@@ -1545,34 +1545,34 @@ function Vi({
|
|
|
1545
1545
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Ot, { disabled: n }) }) })
|
|
1546
1546
|
] });
|
|
1547
1547
|
}
|
|
1548
|
-
const
|
|
1548
|
+
const _i = Y.forwardRef(
|
|
1549
1549
|
function({
|
|
1550
1550
|
showErrors: r,
|
|
1551
1551
|
disabledId: n,
|
|
1552
1552
|
disabled: i,
|
|
1553
1553
|
autoUpdateId: l,
|
|
1554
1554
|
isNewProperty: o
|
|
1555
|
-
},
|
|
1555
|
+
}, c) {
|
|
1556
1556
|
const {
|
|
1557
|
-
errors:
|
|
1558
|
-
values:
|
|
1557
|
+
errors: u,
|
|
1558
|
+
values: p,
|
|
1559
1559
|
setFieldValue: h,
|
|
1560
1560
|
setFieldTouched: m,
|
|
1561
|
-
touched:
|
|
1561
|
+
touched: d,
|
|
1562
1562
|
validate: g
|
|
1563
|
-
} = K(), v = "name", x = r && I(
|
|
1563
|
+
} = K(), v = "name", x = r && I(u, v), y = "id", P = r && I(u, y), k = "description", b = r && I(u, k);
|
|
1564
1564
|
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
1565
1565
|
/* @__PURE__ */ a("div", { children: [
|
|
1566
1566
|
/* @__PURE__ */ e(
|
|
1567
1567
|
H,
|
|
1568
1568
|
{
|
|
1569
1569
|
name: v,
|
|
1570
|
-
inputRef:
|
|
1570
|
+
inputRef: c,
|
|
1571
1571
|
as: Z,
|
|
1572
|
-
value:
|
|
1572
|
+
value: p[v],
|
|
1573
1573
|
onChange: (C) => {
|
|
1574
1574
|
const N = C.target.value;
|
|
1575
|
-
!I(
|
|
1575
|
+
!I(d, y) && l && h(y, N ? Pt(N) : "", !1), h(v, N, !0), m(v, !0);
|
|
1576
1576
|
},
|
|
1577
1577
|
style: { fontSize: 20 },
|
|
1578
1578
|
placeholder: "Field name",
|
|
@@ -1590,10 +1590,10 @@ const Ii = Y.forwardRef(
|
|
|
1590
1590
|
name: y,
|
|
1591
1591
|
as: Z,
|
|
1592
1592
|
label: "ID",
|
|
1593
|
-
value:
|
|
1593
|
+
value: p[y],
|
|
1594
1594
|
onChange: (C) => {
|
|
1595
1595
|
const N = C.target.value;
|
|
1596
|
-
!I(
|
|
1596
|
+
!I(d, v) && l && h(v, N ? pt(N) : ""), h(y, N, !0), m(y, !0);
|
|
1597
1597
|
},
|
|
1598
1598
|
disabled: n || i,
|
|
1599
1599
|
required: !0,
|
|
@@ -1619,7 +1619,7 @@ const Ii = Y.forwardRef(
|
|
|
1619
1619
|
] });
|
|
1620
1620
|
}
|
|
1621
1621
|
);
|
|
1622
|
-
function
|
|
1622
|
+
function Si({
|
|
1623
1623
|
widgetId: t,
|
|
1624
1624
|
disabled: r,
|
|
1625
1625
|
showErrors: n
|
|
@@ -1695,7 +1695,7 @@ function _i({
|
|
|
1695
1695
|
function Fi({ disabled: t }) {
|
|
1696
1696
|
const { values: r } = K(), n = I(r, "defaultValue");
|
|
1697
1697
|
return /* @__PURE__ */ a(R, { children: [
|
|
1698
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(
|
|
1698
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Fe, { disabled: t }) }) }),
|
|
1699
1699
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1700
1700
|
H,
|
|
1701
1701
|
{
|
|
@@ -1714,35 +1714,35 @@ function Fi({ disabled: t }) {
|
|
|
1714
1714
|
) })
|
|
1715
1715
|
] });
|
|
1716
1716
|
}
|
|
1717
|
-
function
|
|
1717
|
+
function Ei({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i, collectionEditable: l }) {
|
|
1718
1718
|
const {
|
|
1719
1719
|
values: o,
|
|
1720
|
-
setFieldValue:
|
|
1721
|
-
} = K(), [
|
|
1720
|
+
setFieldValue: c
|
|
1721
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [d, g] = $(), v = ({
|
|
1722
1722
|
id: C,
|
|
1723
1723
|
property: N
|
|
1724
1724
|
}) => {
|
|
1725
1725
|
if (!C)
|
|
1726
1726
|
throw Error();
|
|
1727
|
-
|
|
1727
|
+
c("oneOf.properties", {
|
|
1728
1728
|
...o.oneOf?.properties ?? {},
|
|
1729
1729
|
[C]: N
|
|
1730
1730
|
}, !1);
|
|
1731
1731
|
const f = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), w = f.includes(C) ? f : [...f, C];
|
|
1732
|
-
|
|
1733
|
-
}, x = h ? ae(h,
|
|
1732
|
+
c("oneOf.propertiesOrder", w, !1), p(!1);
|
|
1733
|
+
}, x = h ? ae(h, d) : void 0, y = x ? I(o.oneOf?.properties, x.replaceAll(".", ".properties.")) : void 0, P = Q((C, N) => {
|
|
1734
1734
|
const f = C ? ae(C, N) : void 0;
|
|
1735
1735
|
if (!f)
|
|
1736
1736
|
throw Error("collection editor miss config");
|
|
1737
|
-
|
|
1737
|
+
c(`oneOf.${he(f)}`, void 0, !1);
|
|
1738
1738
|
const w = `oneOf.${be(N)}`, _ = I(o, w);
|
|
1739
|
-
|
|
1740
|
-
}, [
|
|
1739
|
+
c(w, _.filter((M) => M !== C), !1), p(!1), m(void 0), g(void 0);
|
|
1740
|
+
}, [c, o]), k = /* @__PURE__ */ a(
|
|
1741
1741
|
z,
|
|
1742
1742
|
{
|
|
1743
1743
|
autoFocus: !0,
|
|
1744
1744
|
color: "primary",
|
|
1745
|
-
onClick: () =>
|
|
1745
|
+
onClick: () => p(!0),
|
|
1746
1746
|
startIcon: /* @__PURE__ */ e(se, {}),
|
|
1747
1747
|
children: [
|
|
1748
1748
|
"Add property to ",
|
|
@@ -1750,7 +1750,7 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1750
1750
|
]
|
|
1751
1751
|
}
|
|
1752
1752
|
), b = Q((C, N) => {
|
|
1753
|
-
|
|
1753
|
+
c(`oneOf.${be(N)}`, C, !1);
|
|
1754
1754
|
}, []);
|
|
1755
1755
|
return /* @__PURE__ */ a(R, { children: [
|
|
1756
1756
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
@@ -1767,7 +1767,7 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1767
1767
|
errors: {},
|
|
1768
1768
|
collectionEditable: l,
|
|
1769
1769
|
onPropertyClick: t ? void 0 : (C, N) => {
|
|
1770
|
-
m(C), g(N),
|
|
1770
|
+
m(C), g(N), p(!0);
|
|
1771
1771
|
},
|
|
1772
1772
|
onPropertyMove: t ? void 0 : b
|
|
1773
1773
|
}
|
|
@@ -1780,19 +1780,19 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1780
1780
|
{
|
|
1781
1781
|
inArray: !1,
|
|
1782
1782
|
forceShowErrors: !1,
|
|
1783
|
-
open:
|
|
1783
|
+
open: u,
|
|
1784
1784
|
getData: r,
|
|
1785
1785
|
allowDataInference: n,
|
|
1786
1786
|
onCancel: () => {
|
|
1787
|
-
|
|
1787
|
+
p(!1), m(void 0), g(void 0);
|
|
1788
1788
|
},
|
|
1789
1789
|
onOkClicked: () => {
|
|
1790
|
-
|
|
1790
|
+
p(!1), m(void 0), g(void 0);
|
|
1791
1791
|
},
|
|
1792
1792
|
collectionEditable: l,
|
|
1793
1793
|
onDelete: P,
|
|
1794
1794
|
propertyKey: h,
|
|
1795
|
-
propertyNamespace:
|
|
1795
|
+
propertyNamespace: d,
|
|
1796
1796
|
property: y,
|
|
1797
1797
|
existingProperty: !!h,
|
|
1798
1798
|
autoUpdateId: !h,
|
|
@@ -1804,13 +1804,13 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1804
1804
|
)
|
|
1805
1805
|
] });
|
|
1806
1806
|
}
|
|
1807
|
-
function
|
|
1807
|
+
function Ai({ disabled: t }) {
|
|
1808
1808
|
const {
|
|
1809
1809
|
values: r,
|
|
1810
1810
|
handleChange: n
|
|
1811
|
-
} = K(), i = "validation.min", l = "validation.max", o = "validation.lessThan",
|
|
1811
|
+
} = K(), i = "validation.min", l = "validation.max", o = "validation.lessThan", c = "validation.moreThan";
|
|
1812
1812
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
1813
|
-
/* @__PURE__ */ e(
|
|
1813
|
+
/* @__PURE__ */ e(Fe, { disabled: t }),
|
|
1814
1814
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1815
1815
|
Z,
|
|
1816
1816
|
{
|
|
@@ -1850,9 +1850,9 @@ function Ei({ disabled: t }) {
|
|
|
1850
1850
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1851
1851
|
Z,
|
|
1852
1852
|
{
|
|
1853
|
-
value: I(r,
|
|
1853
|
+
value: I(r, c),
|
|
1854
1854
|
label: "More than",
|
|
1855
|
-
name:
|
|
1855
|
+
name: c,
|
|
1856
1856
|
type: "number",
|
|
1857
1857
|
size: "small",
|
|
1858
1858
|
disabled: t,
|
|
@@ -1864,12 +1864,12 @@ function Ei({ disabled: t }) {
|
|
|
1864
1864
|
{
|
|
1865
1865
|
name: "validation.positive",
|
|
1866
1866
|
type: "checkbox",
|
|
1867
|
-
children: ({ field: m, form:
|
|
1867
|
+
children: ({ field: m, form: d }) => /* @__PURE__ */ e(
|
|
1868
1868
|
ce,
|
|
1869
1869
|
{
|
|
1870
1870
|
label: "Positive value",
|
|
1871
1871
|
disabled: t,
|
|
1872
|
-
form:
|
|
1872
|
+
form: d,
|
|
1873
1873
|
field: m
|
|
1874
1874
|
}
|
|
1875
1875
|
)
|
|
@@ -1880,12 +1880,12 @@ function Ei({ disabled: t }) {
|
|
|
1880
1880
|
{
|
|
1881
1881
|
name: "validation.negative",
|
|
1882
1882
|
type: "checkbox",
|
|
1883
|
-
children: ({ field: m, form:
|
|
1883
|
+
children: ({ field: m, form: d }) => /* @__PURE__ */ e(
|
|
1884
1884
|
ce,
|
|
1885
1885
|
{
|
|
1886
1886
|
label: "Negative value",
|
|
1887
1887
|
disabled: t,
|
|
1888
|
-
form:
|
|
1888
|
+
form: d,
|
|
1889
1889
|
field: m
|
|
1890
1890
|
}
|
|
1891
1891
|
)
|
|
@@ -1896,12 +1896,12 @@ function Ei({ disabled: t }) {
|
|
|
1896
1896
|
{
|
|
1897
1897
|
name: "validation.integer",
|
|
1898
1898
|
type: "checkbox",
|
|
1899
|
-
children: ({ field: m, form:
|
|
1899
|
+
children: ({ field: m, form: d }) => /* @__PURE__ */ e(
|
|
1900
1900
|
ce,
|
|
1901
1901
|
{
|
|
1902
1902
|
label: "Integer value",
|
|
1903
1903
|
disabled: t,
|
|
1904
|
-
form:
|
|
1904
|
+
form: d,
|
|
1905
1905
|
field: m
|
|
1906
1906
|
}
|
|
1907
1907
|
)
|
|
@@ -1909,10 +1909,10 @@ function Ei({ disabled: t }) {
|
|
|
1909
1909
|
) })
|
|
1910
1910
|
] });
|
|
1911
1911
|
}
|
|
1912
|
-
function
|
|
1912
|
+
function Di({ disabled: t }) {
|
|
1913
1913
|
const { values: r, setFieldValue: n } = K();
|
|
1914
1914
|
return /* @__PURE__ */ a(R, { children: [
|
|
1915
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(
|
|
1915
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Ai, { disabled: t }) }) }),
|
|
1916
1916
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1917
1917
|
Ve,
|
|
1918
1918
|
{
|
|
@@ -1937,26 +1937,26 @@ function jt({
|
|
|
1937
1937
|
const {
|
|
1938
1938
|
values: l,
|
|
1939
1939
|
handleChange: o,
|
|
1940
|
-
errors:
|
|
1940
|
+
errors: c
|
|
1941
1941
|
} = K();
|
|
1942
1942
|
if (!Ne())
|
|
1943
1943
|
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(De, {}) });
|
|
1944
|
-
const
|
|
1944
|
+
const p = r ? "of.path" : "path", h = I(l, p), m = i && I(c, p);
|
|
1945
1945
|
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1946
1946
|
H,
|
|
1947
1947
|
{
|
|
1948
|
-
name:
|
|
1949
|
-
pathPath:
|
|
1948
|
+
name: p,
|
|
1949
|
+
pathPath: p,
|
|
1950
1950
|
type: "select",
|
|
1951
1951
|
disabled: t && !!h || n,
|
|
1952
1952
|
value: h,
|
|
1953
1953
|
error: m,
|
|
1954
1954
|
handleChange: o,
|
|
1955
|
-
as:
|
|
1955
|
+
as: Bi
|
|
1956
1956
|
}
|
|
1957
1957
|
) }) });
|
|
1958
1958
|
}
|
|
1959
|
-
function
|
|
1959
|
+
function Bi({
|
|
1960
1960
|
disabled: t,
|
|
1961
1961
|
pathPath: r,
|
|
1962
1962
|
value: n,
|
|
@@ -1964,12 +1964,12 @@ function Di({
|
|
|
1964
1964
|
error: l,
|
|
1965
1965
|
...o
|
|
1966
1966
|
}) {
|
|
1967
|
-
const
|
|
1968
|
-
if (!
|
|
1967
|
+
const c = Ne();
|
|
1968
|
+
if (!c)
|
|
1969
1969
|
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(De, {}) });
|
|
1970
|
-
const
|
|
1971
|
-
Object.values(
|
|
1972
|
-
).values()), h =
|
|
1970
|
+
const u = c?.collections ?? [], p = Array.from(new Set(
|
|
1971
|
+
Object.values(u).map((m) => m.group).filter(Boolean)
|
|
1972
|
+
).values()), h = u.filter((m) => !m.group);
|
|
1973
1973
|
return /* @__PURE__ */ a(R, { children: [
|
|
1974
1974
|
/* @__PURE__ */ a(
|
|
1975
1975
|
Ce,
|
|
@@ -1982,42 +1982,42 @@ function Di({
|
|
|
1982
1982
|
onChange: i,
|
|
1983
1983
|
label: "Target collection",
|
|
1984
1984
|
renderValue: (m) => {
|
|
1985
|
-
const
|
|
1986
|
-
return
|
|
1987
|
-
/* @__PURE__ */ e(
|
|
1985
|
+
const d = u.find((g) => g.id === m || g.path === m);
|
|
1986
|
+
return d ? /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
1987
|
+
/* @__PURE__ */ e(lt, { collectionOrView: d }),
|
|
1988
1988
|
/* @__PURE__ */ e(
|
|
1989
1989
|
O,
|
|
1990
1990
|
{
|
|
1991
1991
|
variant: "subtitle2",
|
|
1992
1992
|
className: "font-medium ml-4",
|
|
1993
|
-
children:
|
|
1993
|
+
children: d?.name.toUpperCase()
|
|
1994
1994
|
}
|
|
1995
1995
|
)
|
|
1996
1996
|
] }) : null;
|
|
1997
1997
|
},
|
|
1998
1998
|
...o,
|
|
1999
1999
|
children: [
|
|
2000
|
-
|
|
2000
|
+
p.flatMap((m) => /* @__PURE__ */ e(
|
|
2001
2001
|
At,
|
|
2002
2002
|
{
|
|
2003
2003
|
label: m || "Views",
|
|
2004
|
-
children:
|
|
2004
|
+
children: u.filter((d) => d.group === m).map((d) => /* @__PURE__ */ e(
|
|
2005
2005
|
ee,
|
|
2006
2006
|
{
|
|
2007
|
-
value:
|
|
2007
|
+
value: d.id ?? d.path,
|
|
2008
2008
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2009
|
-
/* @__PURE__ */ e(
|
|
2009
|
+
/* @__PURE__ */ e(lt, { collectionOrView: d }),
|
|
2010
2010
|
/* @__PURE__ */ e(
|
|
2011
2011
|
O,
|
|
2012
2012
|
{
|
|
2013
2013
|
variant: "subtitle2",
|
|
2014
2014
|
className: "font-medium ml-4",
|
|
2015
|
-
children:
|
|
2015
|
+
children: d?.name.toUpperCase()
|
|
2016
2016
|
}
|
|
2017
2017
|
)
|
|
2018
2018
|
] })
|
|
2019
2019
|
},
|
|
2020
|
-
`${
|
|
2020
|
+
`${d.id ?? d.path}-${m}`
|
|
2021
2021
|
))
|
|
2022
2022
|
},
|
|
2023
2023
|
`group_${m}`
|
|
@@ -2027,7 +2027,7 @@ function Di({
|
|
|
2027
2027
|
{
|
|
2028
2028
|
value: m.id ?? m.path,
|
|
2029
2029
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2030
|
-
/* @__PURE__ */ e(
|
|
2030
|
+
/* @__PURE__ */ e(lt, { collectionOrView: m }),
|
|
2031
2031
|
/* @__PURE__ */ e(
|
|
2032
2032
|
O,
|
|
2033
2033
|
{
|
|
@@ -2046,25 +2046,25 @@ function Di({
|
|
|
2046
2046
|
/* @__PURE__ */ e(X, { children: "You can only edit the reference collection upon field creation." })
|
|
2047
2047
|
] });
|
|
2048
2048
|
}
|
|
2049
|
-
function
|
|
2049
|
+
function zi({ disabled: t }) {
|
|
2050
2050
|
const {
|
|
2051
2051
|
values: r,
|
|
2052
2052
|
errors: n,
|
|
2053
2053
|
touched: i,
|
|
2054
2054
|
setFieldValue: l
|
|
2055
|
-
} = K(), o = "mode",
|
|
2055
|
+
} = K(), o = "mode", c = I(r, o), u = I(i, o) && I(n, o), p = "autoValue", h = I(r, p), m = I(i, p) && I(n, p);
|
|
2056
2056
|
return /* @__PURE__ */ a(R, { children: [
|
|
2057
2057
|
/* @__PURE__ */ a("div", { className: "flex flex-col col-span-12", children: [
|
|
2058
2058
|
/* @__PURE__ */ a(
|
|
2059
2059
|
Ce,
|
|
2060
2060
|
{
|
|
2061
2061
|
name: o,
|
|
2062
|
-
value:
|
|
2063
|
-
error: !!
|
|
2064
|
-
onValueChange: (
|
|
2062
|
+
value: c ?? "date",
|
|
2063
|
+
error: !!u,
|
|
2064
|
+
onValueChange: (d) => l(o, d),
|
|
2065
2065
|
label: "Mode",
|
|
2066
|
-
renderValue: (
|
|
2067
|
-
switch (
|
|
2066
|
+
renderValue: (d) => {
|
|
2067
|
+
switch (d) {
|
|
2068
2068
|
case "date_time":
|
|
2069
2069
|
return "Date/Time";
|
|
2070
2070
|
case "date":
|
|
@@ -2080,16 +2080,16 @@ function Bi({ disabled: t }) {
|
|
|
2080
2080
|
]
|
|
2081
2081
|
}
|
|
2082
2082
|
),
|
|
2083
|
-
/* @__PURE__ */ e(X, { error: !!
|
|
2083
|
+
/* @__PURE__ */ e(X, { error: !!u, children: u }),
|
|
2084
2084
|
/* @__PURE__ */ a(
|
|
2085
2085
|
Ce,
|
|
2086
2086
|
{
|
|
2087
|
-
name:
|
|
2087
|
+
name: p,
|
|
2088
2088
|
disabled: t,
|
|
2089
2089
|
value: h ?? "",
|
|
2090
|
-
onValueChange: (
|
|
2091
|
-
renderValue: (
|
|
2092
|
-
switch (
|
|
2090
|
+
onValueChange: (d) => l(p, d === "none" ? null : d),
|
|
2091
|
+
renderValue: (d) => {
|
|
2092
|
+
switch (d) {
|
|
2093
2093
|
case "on_create":
|
|
2094
2094
|
return "On create";
|
|
2095
2095
|
case "on_update":
|
|
@@ -2109,10 +2109,10 @@ function Bi({ disabled: t }) {
|
|
|
2109
2109
|
),
|
|
2110
2110
|
/* @__PURE__ */ e(X, { error: !!m, children: m ?? "Update this field automatically when creating or updating the entity" })
|
|
2111
2111
|
] }),
|
|
2112
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(
|
|
2112
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Fe, { disabled: t }) }) })
|
|
2113
2113
|
] });
|
|
2114
2114
|
}
|
|
2115
|
-
function
|
|
2115
|
+
function Mi({ disabled: t }) {
|
|
2116
2116
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
2117
2117
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(H, { type: "checkbox", name: "hideFromCollection", children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
2118
2118
|
ce,
|
|
@@ -2143,8 +2143,8 @@ function zi({ disabled: t }) {
|
|
|
2143
2143
|
) })
|
|
2144
2144
|
] });
|
|
2145
2145
|
}
|
|
2146
|
-
function
|
|
2147
|
-
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(
|
|
2146
|
+
function Ri({ disabled: t }) {
|
|
2147
|
+
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Fe, { disabled: t }) }) }) });
|
|
2148
2148
|
}
|
|
2149
2149
|
function ar(t, r, n) {
|
|
2150
2150
|
let i;
|
|
@@ -2392,7 +2392,7 @@ function or({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
|
2392
2392
|
}
|
|
2393
2393
|
);
|
|
2394
2394
|
}
|
|
2395
|
-
function
|
|
2395
|
+
function Ui({
|
|
2396
2396
|
disabled: t,
|
|
2397
2397
|
showErrors: r
|
|
2398
2398
|
}) {
|
|
@@ -2452,7 +2452,7 @@ function Ri({
|
|
|
2452
2452
|
) })
|
|
2453
2453
|
] });
|
|
2454
2454
|
}
|
|
2455
|
-
const
|
|
2455
|
+
const ji = [
|
|
2456
2456
|
"text_field",
|
|
2457
2457
|
"multiline",
|
|
2458
2458
|
"markdown",
|
|
@@ -2473,19 +2473,19 @@ const Ui = [
|
|
|
2473
2473
|
"key_value",
|
|
2474
2474
|
"repeat",
|
|
2475
2475
|
"block"
|
|
2476
|
-
], lr = Object.entries(Gt).filter(([t]) =>
|
|
2476
|
+
], lr = Object.entries(Gt).filter(([t]) => ji.includes(t)).map(([t, r]) => ({ [t]: r })).reduce((t, r) => ({ ...t, ...r }), {}), sr = Y.memo(
|
|
2477
2477
|
function(r) {
|
|
2478
2478
|
const {
|
|
2479
2479
|
includeIdAndName: n = !0,
|
|
2480
2480
|
autoOpenTypeSelect: i,
|
|
2481
2481
|
existingProperty: l,
|
|
2482
2482
|
autoUpdateId: o,
|
|
2483
|
-
inArray:
|
|
2484
|
-
propertyKey:
|
|
2485
|
-
existingPropertyKeys:
|
|
2483
|
+
inArray: c,
|
|
2484
|
+
propertyKey: u,
|
|
2485
|
+
existingPropertyKeys: p,
|
|
2486
2486
|
propertyNamespace: h,
|
|
2487
2487
|
property: m,
|
|
2488
|
-
onPropertyChanged:
|
|
2488
|
+
onPropertyChanged: d,
|
|
2489
2489
|
onPropertyChangedImmediate: g = !0,
|
|
2490
2490
|
onDelete: v,
|
|
2491
2491
|
onError: x,
|
|
@@ -2500,8 +2500,8 @@ const Ui = [
|
|
|
2500
2500
|
id: "",
|
|
2501
2501
|
name: ""
|
|
2502
2502
|
}, _ = !!(m && !qe(m)) && !f, M = Le(m ? {
|
|
2503
|
-
id:
|
|
2504
|
-
previousId:
|
|
2503
|
+
id: u,
|
|
2504
|
+
previousId: u,
|
|
2505
2505
|
property: m
|
|
2506
2506
|
} : void 0), U = ({
|
|
2507
2507
|
id: A,
|
|
@@ -2513,9 +2513,9 @@ const Ui = [
|
|
|
2513
2513
|
property: s,
|
|
2514
2514
|
namespace: h
|
|
2515
2515
|
};
|
|
2516
|
-
M.current = V,
|
|
2516
|
+
M.current = V, d?.(V);
|
|
2517
2517
|
}, D = Tt({
|
|
2518
|
-
initialValues: m ? { id:
|
|
2518
|
+
initialValues: m ? { id: u, ...m } : w,
|
|
2519
2519
|
initialErrors: y,
|
|
2520
2520
|
validateOnChange: !0,
|
|
2521
2521
|
validateOnInitialRender: !0,
|
|
@@ -2536,13 +2536,13 @@ const Ui = [
|
|
|
2536
2536
|
if (!A.name)
|
|
2537
2537
|
s.name = "Required";
|
|
2538
2538
|
else {
|
|
2539
|
-
const V =
|
|
2539
|
+
const V = Yi(A.name);
|
|
2540
2540
|
V && (s.name = V);
|
|
2541
2541
|
}
|
|
2542
2542
|
if (!A.id)
|
|
2543
2543
|
s.id = "Required";
|
|
2544
2544
|
else {
|
|
2545
|
-
const V =
|
|
2545
|
+
const V = $i(A.id, p);
|
|
2546
2546
|
V && (s.id = V);
|
|
2547
2547
|
}
|
|
2548
2548
|
}
|
|
@@ -2554,7 +2554,7 @@ const Ui = [
|
|
|
2554
2554
|
return de(() => {
|
|
2555
2555
|
b?.(D);
|
|
2556
2556
|
}, [D, b]), /* @__PURE__ */ e(kt, { value: D, children: /* @__PURE__ */ e(
|
|
2557
|
-
|
|
2557
|
+
Li,
|
|
2558
2558
|
{
|
|
2559
2559
|
onPropertyChanged: g ? U : void 0,
|
|
2560
2560
|
onDelete: v,
|
|
@@ -2564,7 +2564,7 @@ const Ui = [
|
|
|
2564
2564
|
showErrors: P || D.submitCount > 0,
|
|
2565
2565
|
existing: l,
|
|
2566
2566
|
autoUpdateId: o,
|
|
2567
|
-
inArray:
|
|
2567
|
+
inArray: c,
|
|
2568
2568
|
autoOpenTypeSelect: i,
|
|
2569
2569
|
disabled: _,
|
|
2570
2570
|
getData: C,
|
|
@@ -2584,11 +2584,11 @@ function Ie({
|
|
|
2584
2584
|
onPropertyChanged: i,
|
|
2585
2585
|
getData: l,
|
|
2586
2586
|
collectionEditable: o,
|
|
2587
|
-
...
|
|
2587
|
+
...c
|
|
2588
2588
|
}) {
|
|
2589
|
-
const
|
|
2589
|
+
const u = Le();
|
|
2590
2590
|
return /* @__PURE__ */ e(
|
|
2591
|
-
|
|
2591
|
+
Se,
|
|
2592
2592
|
{
|
|
2593
2593
|
open: t ?? !1,
|
|
2594
2594
|
maxWidth: "xl",
|
|
@@ -2599,20 +2599,20 @@ function Ie({
|
|
|
2599
2599
|
noValidate: !0,
|
|
2600
2600
|
autoComplete: "off",
|
|
2601
2601
|
onSubmit: (h) => {
|
|
2602
|
-
h.preventDefault(), h.stopPropagation(),
|
|
2602
|
+
h.preventDefault(), h.stopPropagation(), u.current?.handleSubmit(h);
|
|
2603
2603
|
},
|
|
2604
2604
|
children: [
|
|
2605
2605
|
/* @__PURE__ */ e(Be, { children: /* @__PURE__ */ e(
|
|
2606
2606
|
sr,
|
|
2607
2607
|
{
|
|
2608
|
-
...
|
|
2608
|
+
...c,
|
|
2609
2609
|
onPropertyChanged: (h) => {
|
|
2610
2610
|
i?.(h), n?.();
|
|
2611
2611
|
},
|
|
2612
2612
|
collectionEditable: o,
|
|
2613
2613
|
onPropertyChangedImmediate: !1,
|
|
2614
2614
|
getController: (h) => {
|
|
2615
|
-
|
|
2615
|
+
u.current = h;
|
|
2616
2616
|
},
|
|
2617
2617
|
getData: l
|
|
2618
2618
|
}
|
|
@@ -2623,7 +2623,7 @@ function Ie({
|
|
|
2623
2623
|
{
|
|
2624
2624
|
variant: "text",
|
|
2625
2625
|
onClick: () => {
|
|
2626
|
-
r(),
|
|
2626
|
+
r(), u.current?.resetForm();
|
|
2627
2627
|
},
|
|
2628
2628
|
children: "Cancel"
|
|
2629
2629
|
}
|
|
@@ -2644,19 +2644,19 @@ function Ie({
|
|
|
2644
2644
|
}
|
|
2645
2645
|
);
|
|
2646
2646
|
}
|
|
2647
|
-
function
|
|
2647
|
+
function Li({
|
|
2648
2648
|
values: t,
|
|
2649
2649
|
errors: r,
|
|
2650
2650
|
setValues: n,
|
|
2651
2651
|
existing: i,
|
|
2652
2652
|
autoUpdateId: l = !1,
|
|
2653
2653
|
autoOpenTypeSelect: o,
|
|
2654
|
-
includeIdAndTitle:
|
|
2655
|
-
onPropertyChanged:
|
|
2656
|
-
onDelete:
|
|
2654
|
+
includeIdAndTitle: c,
|
|
2655
|
+
onPropertyChanged: u,
|
|
2656
|
+
onDelete: p,
|
|
2657
2657
|
propertyNamespace: h,
|
|
2658
2658
|
onError: m,
|
|
2659
|
-
showErrors:
|
|
2659
|
+
showErrors: d,
|
|
2660
2660
|
disabled: g,
|
|
2661
2661
|
inArray: v,
|
|
2662
2662
|
getData: x,
|
|
@@ -2664,20 +2664,20 @@ function ji({
|
|
|
2664
2664
|
propertyConfigs: P,
|
|
2665
2665
|
collectionEditable: k
|
|
2666
2666
|
}) {
|
|
2667
|
-
const [b, C] = $(o), [N, f] = $(!1), [w, _] = $(t?.dataType ? Kt(t) : void 0), M = Object.entries(lr).concat(Object.entries(P)), U = v ? M.filter(([q, L]) => !ne(L.property) && L.property?.dataType !== "array") : M, D =
|
|
2667
|
+
const [b, C] = $(o), [N, f] = $(!1), [w, _] = $(t?.dataType ? Kt(t) : void 0), M = Object.entries(lr).concat(Object.entries(P)), U = v ? M.filter(([q, L]) => !ne(L.property) && L.property?.dataType !== "array") : M, D = _r(t), A = Le(null), s = Le(t), V = d && I(r, "selectedWidget");
|
|
2668
2668
|
de(() => {
|
|
2669
|
-
if (
|
|
2669
|
+
if (u && (!c || D.id)) {
|
|
2670
2670
|
const {
|
|
2671
2671
|
id: q,
|
|
2672
2672
|
...L
|
|
2673
2673
|
} = D;
|
|
2674
|
-
ye(D, s.current) || (
|
|
2674
|
+
ye(D, s.current) || (u({
|
|
2675
2675
|
id: q,
|
|
2676
2676
|
property: L,
|
|
2677
2677
|
namespace: h
|
|
2678
2678
|
}), s.current = D);
|
|
2679
2679
|
}
|
|
2680
|
-
}, [D,
|
|
2680
|
+
}, [D, c, u, h]), de(() => {
|
|
2681
2681
|
t?.id && m && m(t?.id, h, r);
|
|
2682
2682
|
}, [r, m, h, t?.id]);
|
|
2683
2683
|
const G = (q) => {
|
|
@@ -2687,17 +2687,17 @@ function ji({
|
|
|
2687
2687
|
};
|
|
2688
2688
|
let B;
|
|
2689
2689
|
return w === "text_field" || w === "multiline" || w === "markdown" || w === "email" ? B = /* @__PURE__ */ e(
|
|
2690
|
-
|
|
2690
|
+
Si,
|
|
2691
2691
|
{
|
|
2692
2692
|
widgetId: w,
|
|
2693
2693
|
disabled: g,
|
|
2694
|
-
showErrors:
|
|
2694
|
+
showErrors: d
|
|
2695
2695
|
}
|
|
2696
2696
|
) : w === "url" ? B = /* @__PURE__ */ e(
|
|
2697
|
-
|
|
2697
|
+
Ui,
|
|
2698
2698
|
{
|
|
2699
2699
|
disabled: g,
|
|
2700
|
-
showErrors:
|
|
2700
|
+
showErrors: d
|
|
2701
2701
|
}
|
|
2702
2702
|
) : w === "select" || w === "number_select" ? B = /* @__PURE__ */ e(
|
|
2703
2703
|
Rt,
|
|
@@ -2707,7 +2707,7 @@ function ji({
|
|
|
2707
2707
|
updateIds: !i,
|
|
2708
2708
|
disabled: g,
|
|
2709
2709
|
getData: x,
|
|
2710
|
-
showErrors:
|
|
2710
|
+
showErrors: d
|
|
2711
2711
|
}
|
|
2712
2712
|
) : w === "multi_select" || w === "multi_number_select" ? B = /* @__PURE__ */ e(
|
|
2713
2713
|
Rt,
|
|
@@ -2717,7 +2717,7 @@ function ji({
|
|
|
2717
2717
|
disabled: g,
|
|
2718
2718
|
allowDataInference: y,
|
|
2719
2719
|
getData: x,
|
|
2720
|
-
showErrors:
|
|
2720
|
+
showErrors: d
|
|
2721
2721
|
}
|
|
2722
2722
|
) : w === "file_upload" ? B = /* @__PURE__ */ e(
|
|
2723
2723
|
Ut,
|
|
@@ -2733,8 +2733,8 @@ function ji({
|
|
|
2733
2733
|
multiple: !0,
|
|
2734
2734
|
disabled: g
|
|
2735
2735
|
}
|
|
2736
|
-
) : w === "switch" ? B = /* @__PURE__ */ e(Fi, { disabled: g }) : w === "number_input" ? B = /* @__PURE__ */ e(
|
|
2737
|
-
|
|
2736
|
+
) : w === "switch" ? B = /* @__PURE__ */ e(Fi, { disabled: g }) : w === "number_input" ? B = /* @__PURE__ */ e(Di, { disabled: g }) : w === "group" ? B = /* @__PURE__ */ e(
|
|
2737
|
+
Vi,
|
|
2738
2738
|
{
|
|
2739
2739
|
disabled: g,
|
|
2740
2740
|
getData: x,
|
|
@@ -2743,7 +2743,7 @@ function ji({
|
|
|
2743
2743
|
propertyConfigs: P
|
|
2744
2744
|
}
|
|
2745
2745
|
) : w === "block" ? B = /* @__PURE__ */ e(
|
|
2746
|
-
|
|
2746
|
+
Ei,
|
|
2747
2747
|
{
|
|
2748
2748
|
disabled: g,
|
|
2749
2749
|
getData: x,
|
|
@@ -2754,23 +2754,23 @@ function ji({
|
|
|
2754
2754
|
) : w === "reference" ? B = /* @__PURE__ */ e(
|
|
2755
2755
|
jt,
|
|
2756
2756
|
{
|
|
2757
|
-
showErrors:
|
|
2757
|
+
showErrors: d,
|
|
2758
2758
|
existing: i,
|
|
2759
2759
|
multiple: !1,
|
|
2760
2760
|
disabled: g
|
|
2761
2761
|
}
|
|
2762
|
-
) : w === "date_time" ? B = /* @__PURE__ */ e(
|
|
2762
|
+
) : w === "date_time" ? B = /* @__PURE__ */ e(zi, { disabled: g }) : w === "multi_references" ? B = /* @__PURE__ */ e(
|
|
2763
2763
|
jt,
|
|
2764
2764
|
{
|
|
2765
|
-
showErrors:
|
|
2765
|
+
showErrors: d,
|
|
2766
2766
|
existing: i,
|
|
2767
2767
|
multiple: !0,
|
|
2768
2768
|
disabled: g
|
|
2769
2769
|
}
|
|
2770
2770
|
) : w === "repeat" ? B = /* @__PURE__ */ e(
|
|
2771
|
-
|
|
2771
|
+
Ii,
|
|
2772
2772
|
{
|
|
2773
|
-
showErrors:
|
|
2773
|
+
showErrors: d,
|
|
2774
2774
|
existing: i,
|
|
2775
2775
|
getData: x,
|
|
2776
2776
|
allowDataInference: y,
|
|
@@ -2778,8 +2778,8 @@ function ji({
|
|
|
2778
2778
|
collectionEditable: k,
|
|
2779
2779
|
propertyConfigs: P
|
|
2780
2780
|
}
|
|
2781
|
-
) : w === "key_value" ? B = /* @__PURE__ */ e(
|
|
2782
|
-
g && /* @__PURE__ */ a(
|
|
2781
|
+
) : w === "key_value" ? B = /* @__PURE__ */ e(Ri, { disabled: g }) : B = null, /* @__PURE__ */ a(R, { children: [
|
|
2782
|
+
g && /* @__PURE__ */ a(qr, { mode: "warn", children: [
|
|
2783
2783
|
/* @__PURE__ */ e(O, { children: "This property can't be edited" }),
|
|
2784
2784
|
/* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
2785
2785
|
"You may not have permission to edit it or it is defined in code with no ",
|
|
@@ -2858,22 +2858,22 @@ function ji({
|
|
|
2858
2858
|
}
|
|
2859
2859
|
)
|
|
2860
2860
|
] }),
|
|
2861
|
-
|
|
2861
|
+
p && t?.id && /* @__PURE__ */ e(
|
|
2862
2862
|
oe,
|
|
2863
2863
|
{
|
|
2864
2864
|
variant: "ghost",
|
|
2865
2865
|
className: "m-4",
|
|
2866
2866
|
disabled: g,
|
|
2867
2867
|
onClick: () => f(!0),
|
|
2868
|
-
children: /* @__PURE__ */ e(
|
|
2868
|
+
children: /* @__PURE__ */ e(ut, {})
|
|
2869
2869
|
}
|
|
2870
2870
|
)
|
|
2871
2871
|
] }),
|
|
2872
2872
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-y-12 mt-8 mb-8", children: [
|
|
2873
|
-
|
|
2874
|
-
|
|
2873
|
+
c && /* @__PURE__ */ e(
|
|
2874
|
+
_i,
|
|
2875
2875
|
{
|
|
2876
|
-
showErrors:
|
|
2876
|
+
showErrors: d,
|
|
2877
2877
|
disabledId: i,
|
|
2878
2878
|
isNewProperty: !i,
|
|
2879
2879
|
disabled: g,
|
|
@@ -2882,13 +2882,13 @@ function ji({
|
|
|
2882
2882
|
}
|
|
2883
2883
|
),
|
|
2884
2884
|
B,
|
|
2885
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2885
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Mi, { disabled: g }) })
|
|
2886
2886
|
] }),
|
|
2887
|
-
|
|
2888
|
-
|
|
2887
|
+
p && /* @__PURE__ */ e(
|
|
2888
|
+
st,
|
|
2889
2889
|
{
|
|
2890
2890
|
open: N,
|
|
2891
|
-
onAccept: () =>
|
|
2891
|
+
onAccept: () => p(t?.id, h),
|
|
2892
2892
|
onCancel: () => f(!1),
|
|
2893
2893
|
title: /* @__PURE__ */ e("div", { children: "Delete this property?" }),
|
|
2894
2894
|
body: /* @__PURE__ */ a("div", { children: [
|
|
@@ -2900,28 +2900,28 @@ function ji({
|
|
|
2900
2900
|
)
|
|
2901
2901
|
] });
|
|
2902
2902
|
}
|
|
2903
|
-
const
|
|
2904
|
-
function
|
|
2903
|
+
const qi = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
2904
|
+
function $i(t, r) {
|
|
2905
2905
|
let n;
|
|
2906
|
-
return t || (n = "You must specify an id for the field"), t && !t.match(
|
|
2906
|
+
return t || (n = "You must specify an id for the field"), t && !t.match(qi) && (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
2907
|
}
|
|
2908
|
-
function
|
|
2908
|
+
function Yi(t) {
|
|
2909
2909
|
let r;
|
|
2910
2910
|
return t || (r = "You must specify a title for the field"), r;
|
|
2911
2911
|
}
|
|
2912
|
-
function
|
|
2912
|
+
function Hi(t) {
|
|
2913
2913
|
return t ? (t.slice(0, 1).toLowerCase() + t.slice(1)).replace(/([-_ ]){1,}/g, " ").split(/[-_ ]/).reduce((r, n) => r + n[0].toUpperCase() + n.substring(1), "") : "";
|
|
2914
2914
|
}
|
|
2915
|
-
function
|
|
2915
|
+
function Gi({
|
|
2916
2916
|
collection: t,
|
|
2917
2917
|
onOpenChange: r,
|
|
2918
2918
|
open: n
|
|
2919
2919
|
}) {
|
|
2920
2920
|
const i = _e(), l = t ? `import { EntityCollection } from "firecms";
|
|
2921
2921
|
|
|
2922
|
-
const ` + (t?.name ?
|
|
2922
|
+
const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + li.stringify(cr(t), null, " ") : "No collection selected";
|
|
2923
2923
|
return /* @__PURE__ */ a(
|
|
2924
|
-
|
|
2924
|
+
Se,
|
|
2925
2925
|
{
|
|
2926
2926
|
open: n,
|
|
2927
2927
|
onOpenChange: r,
|
|
@@ -2945,18 +2945,18 @@ const ` + (t?.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.
|
|
|
2945
2945
|
"."
|
|
2946
2946
|
] }),
|
|
2947
2947
|
/* @__PURE__ */ e(
|
|
2948
|
-
|
|
2948
|
+
si,
|
|
2949
2949
|
{
|
|
2950
|
-
theme:
|
|
2950
|
+
theme: ci.vsDark,
|
|
2951
2951
|
code: l,
|
|
2952
2952
|
language: "typescript",
|
|
2953
2953
|
children: ({
|
|
2954
2954
|
className: o,
|
|
2955
|
-
style:
|
|
2956
|
-
tokens:
|
|
2957
|
-
getLineProps:
|
|
2955
|
+
style: c,
|
|
2956
|
+
tokens: u,
|
|
2957
|
+
getLineProps: p,
|
|
2958
2958
|
getTokenProps: h
|
|
2959
|
-
}) => /* @__PURE__ */ e("pre", { style:
|
|
2959
|
+
}) => /* @__PURE__ */ e("pre", { style: c, className: "p-4 rounded text-sm", children: u.map((m, d) => /* @__PURE__ */ e("div", { ...p({ line: m }), children: m.map((g, v) => /* @__PURE__ */ e("span", { ...h({ token: g }) }, v)) }, d)) })
|
|
2960
2960
|
}
|
|
2961
2961
|
)
|
|
2962
2962
|
] }),
|
|
@@ -2971,7 +2971,7 @@ const ` + (t?.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.
|
|
|
2971
2971
|
message: "Copied"
|
|
2972
2972
|
}), navigator.clipboard.writeText(l)),
|
|
2973
2973
|
children: [
|
|
2974
|
-
/* @__PURE__ */ e(
|
|
2974
|
+
/* @__PURE__ */ e($r, { size: "small" }),
|
|
2975
2975
|
"Copy to clipboard"
|
|
2976
2976
|
]
|
|
2977
2977
|
}
|
|
@@ -3011,19 +3011,19 @@ function cr(t) {
|
|
|
3011
3011
|
subcollections: (t.subcollections ?? []).map(cr)
|
|
3012
3012
|
};
|
|
3013
3013
|
}
|
|
3014
|
-
function
|
|
3014
|
+
function Ki({
|
|
3015
3015
|
showErrors: t,
|
|
3016
3016
|
isNewCollection: r,
|
|
3017
3017
|
propertyErrorsRef: n,
|
|
3018
3018
|
onPropertyError: i,
|
|
3019
3019
|
setDirty: l,
|
|
3020
3020
|
reservedGroups: o,
|
|
3021
|
-
extraIcon:
|
|
3022
|
-
getUser:
|
|
3023
|
-
getData:
|
|
3021
|
+
extraIcon: c,
|
|
3022
|
+
getUser: u,
|
|
3023
|
+
getData: p,
|
|
3024
3024
|
doCollectionInference: h,
|
|
3025
3025
|
propertyConfigs: m,
|
|
3026
|
-
collectionEditable:
|
|
3026
|
+
collectionEditable: d
|
|
3027
3027
|
}) {
|
|
3028
3028
|
const {
|
|
3029
3029
|
values: g,
|
|
@@ -3037,15 +3037,15 @@ function Gi({
|
|
|
3037
3037
|
l && l(k);
|
|
3038
3038
|
}, [k]);
|
|
3039
3039
|
const ue = h ? () => {
|
|
3040
|
-
h && (q(!0), h(g).then((
|
|
3041
|
-
if (
|
|
3040
|
+
h && (q(!0), h(g).then((S) => {
|
|
3041
|
+
if (S && He(S.properties), !S) {
|
|
3042
3042
|
b.open({
|
|
3043
3043
|
type: "error",
|
|
3044
3044
|
message: "Could not infer properties from data"
|
|
3045
3045
|
});
|
|
3046
3046
|
return;
|
|
3047
3047
|
}
|
|
3048
|
-
const j = (
|
|
3048
|
+
const j = (S.properties ? Object.keys(S.properties) : []).filter((E) => !g.properties[E]);
|
|
3049
3049
|
if (j.length === 0) {
|
|
3050
3050
|
b.open({
|
|
3051
3051
|
type: "info",
|
|
@@ -3054,82 +3054,82 @@ function Gi({
|
|
|
3054
3054
|
return;
|
|
3055
3055
|
}
|
|
3056
3056
|
const T = {
|
|
3057
|
-
...j.reduce((E, ie) => (E[ie] = (
|
|
3057
|
+
...j.reduce((E, ie) => (E[ie] = (S.properties ?? {})[ie], E), {}),
|
|
3058
3058
|
...g.properties
|
|
3059
|
-
},
|
|
3059
|
+
}, F = [
|
|
3060
3060
|
...j,
|
|
3061
3061
|
...g.propertiesOrder ?? []
|
|
3062
3062
|
];
|
|
3063
|
-
v("properties", T, !1), ve(
|
|
3063
|
+
v("properties", T, !1), ve(F), Me(j);
|
|
3064
3064
|
}).finally(() => {
|
|
3065
3065
|
q(!1);
|
|
3066
3066
|
}));
|
|
3067
|
-
} : void 0, re = Q((
|
|
3067
|
+
} : void 0, re = Q((S) => S ? we.current[S] ?? I(g, be(S)) : we.current[""], [g]), ve = Q((S, j) => {
|
|
3068
3068
|
const T = be(j);
|
|
3069
|
-
v(T,
|
|
3070
|
-
}, [v]), ke = Q((
|
|
3071
|
-
const T =
|
|
3069
|
+
v(T, S, !1), we.current[j ?? ""] = S;
|
|
3070
|
+
}, [v]), ke = Q((S, j) => {
|
|
3071
|
+
const T = S ? ae(S, j) : void 0;
|
|
3072
3072
|
if (!T)
|
|
3073
3073
|
throw Error("collection editor miss config");
|
|
3074
3074
|
v(he(T), void 0, !1);
|
|
3075
|
-
const E = re(j).filter((ie) => ie !==
|
|
3075
|
+
const E = re(j).filter((ie) => ie !== S);
|
|
3076
3076
|
ve(E, j), J(!1), w(void 0), M(void 0), D(void 0);
|
|
3077
|
-
}, [re, v, ve]),
|
|
3078
|
-
v(be(j),
|
|
3077
|
+
}, [re, v, ve]), Ke = (S, j) => {
|
|
3078
|
+
v(be(j), S, !1);
|
|
3079
3079
|
}, gt = ({
|
|
3080
|
-
id:
|
|
3080
|
+
id: S,
|
|
3081
3081
|
property: j
|
|
3082
3082
|
}) => {
|
|
3083
|
-
if (!
|
|
3083
|
+
if (!S)
|
|
3084
3084
|
throw Error("Need to include an ID when creating a new property");
|
|
3085
3085
|
v("properties", {
|
|
3086
3086
|
...g.properties ?? {},
|
|
3087
|
-
[
|
|
3087
|
+
[S]: j
|
|
3088
3088
|
}, !1);
|
|
3089
|
-
const T = [...g.propertiesOrder ?? Object.keys(g.properties),
|
|
3090
|
-
ve(T), J(!1), C && (w(T.indexOf(
|
|
3089
|
+
const T = [...g.propertiesOrder ?? Object.keys(g.properties), S];
|
|
3090
|
+
ve(T), J(!1), C && (w(T.indexOf(S)), M(S)), D(void 0);
|
|
3091
3091
|
}, pe = ({
|
|
3092
|
-
id:
|
|
3092
|
+
id: S,
|
|
3093
3093
|
property: j,
|
|
3094
3094
|
previousId: T,
|
|
3095
|
-
namespace:
|
|
3095
|
+
namespace: F
|
|
3096
3096
|
}) => {
|
|
3097
|
-
const E =
|
|
3098
|
-
if (T && T !==
|
|
3097
|
+
const E = S ? ae(S, F) : void 0, ie = E ? he(E) : void 0;
|
|
3098
|
+
if (T && T !== S) {
|
|
3099
3099
|
console.debug("onPropertyChanged, id change", {
|
|
3100
|
-
id:
|
|
3100
|
+
id: S,
|
|
3101
3101
|
property: j,
|
|
3102
3102
|
previousId: T,
|
|
3103
|
-
namespace:
|
|
3103
|
+
namespace: F
|
|
3104
3104
|
});
|
|
3105
|
-
const Oe = ae(T,
|
|
3106
|
-
ve(It,
|
|
3105
|
+
const Oe = ae(T, F), Vt = he(Oe), It = re(F).map((et) => et === T ? S : et).filter((et) => et !== void 0);
|
|
3106
|
+
ve(It, F), S && (w(It.indexOf(S)), M(S)), v(Vt, void 0, !1), y(Vt, !1, !1);
|
|
3107
3107
|
}
|
|
3108
3108
|
console.debug("onPropertyChanged", {
|
|
3109
|
-
id:
|
|
3109
|
+
id: S,
|
|
3110
3110
|
property: j,
|
|
3111
3111
|
previousId: T,
|
|
3112
|
-
namespace:
|
|
3112
|
+
namespace: F,
|
|
3113
3113
|
propertyPath: ie
|
|
3114
3114
|
}), ie && (v(ie, j, !1), y(ie, !0, !1));
|
|
3115
|
-
},
|
|
3116
|
-
const
|
|
3115
|
+
}, We = Q((S, j, T) => {
|
|
3116
|
+
const F = S ? ae(S, j) : void 0;
|
|
3117
3117
|
if (console.debug("onPropertyErrorInternal", {
|
|
3118
|
-
id:
|
|
3118
|
+
id: S,
|
|
3119
3119
|
namespace: j,
|
|
3120
3120
|
error: T,
|
|
3121
|
-
propertyPath:
|
|
3122
|
-
}),
|
|
3121
|
+
propertyPath: F
|
|
3122
|
+
}), F) {
|
|
3123
3123
|
const E = T && Object.keys(T).length > 0;
|
|
3124
|
-
i(
|
|
3124
|
+
i(S, j, E ? T : void 0), x(he(F), E ? "Property error" : void 0);
|
|
3125
3125
|
}
|
|
3126
|
-
}, []),
|
|
3126
|
+
}, []), Ze = () => {
|
|
3127
3127
|
w(void 0), M(void 0);
|
|
3128
|
-
},
|
|
3128
|
+
}, Je = _ && n?.current?.properties ? n.current.properties[_] : void 0, Qe = g?.propertiesOrder === void 0 || g.propertiesOrder.length === 0, Re = g.propertiesOrder ? g.propertiesOrder : Object.keys(g.properties), Xe = Zt(() => g.ownerId && u ? u(g.ownerId) : null, [u, g.ownerId]), vt = Q((S, j) => {
|
|
3129
3129
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
3130
|
-
propertyKey:
|
|
3130
|
+
propertyKey: S,
|
|
3131
3131
|
namespace: j
|
|
3132
|
-
}), w(Re.indexOf(
|
|
3132
|
+
}), w(Re.indexOf(S)), M(S), D(j);
|
|
3133
3133
|
}, [Re]), yt = /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3134
3134
|
/* @__PURE__ */ a("div", { className: fe(
|
|
3135
3135
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
@@ -3152,7 +3152,7 @@ function Gi({
|
|
|
3152
3152
|
error: !!P?.name
|
|
3153
3153
|
}
|
|
3154
3154
|
),
|
|
3155
|
-
|
|
3155
|
+
Xe && /* @__PURE__ */ a(
|
|
3156
3156
|
O,
|
|
3157
3157
|
{
|
|
3158
3158
|
variant: "body2",
|
|
@@ -3160,12 +3160,12 @@ function Gi({
|
|
|
3160
3160
|
color: "secondary",
|
|
3161
3161
|
children: [
|
|
3162
3162
|
"Created by ",
|
|
3163
|
-
|
|
3163
|
+
Xe.displayName
|
|
3164
3164
|
]
|
|
3165
3165
|
}
|
|
3166
3166
|
)
|
|
3167
3167
|
] }),
|
|
3168
|
-
|
|
3168
|
+
c && /* @__PURE__ */ e("div", { className: "ml-4", children: c }),
|
|
3169
3169
|
/* @__PURE__ */ a("div", { className: "ml-1 mt-2 flex flex-row gap-2", children: [
|
|
3170
3170
|
/* @__PURE__ */ e(te, { title: "Get the code for this collection", children: /* @__PURE__ */ e(
|
|
3171
3171
|
oe,
|
|
@@ -3173,7 +3173,7 @@ function Gi({
|
|
|
3173
3173
|
variant: "filled",
|
|
3174
3174
|
disabled: B,
|
|
3175
3175
|
onClick: () => G(!0),
|
|
3176
|
-
children: /* @__PURE__ */ e(
|
|
3176
|
+
children: /* @__PURE__ */ e(Yr, {})
|
|
3177
3177
|
}
|
|
3178
3178
|
) }),
|
|
3179
3179
|
ue && /* @__PURE__ */ e(te, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
|
|
@@ -3205,9 +3205,9 @@ function Gi({
|
|
|
3205
3205
|
additionalFields: g.additionalFields,
|
|
3206
3206
|
propertiesOrder: Re,
|
|
3207
3207
|
onPropertyClick: vt,
|
|
3208
|
-
onPropertyMove:
|
|
3208
|
+
onPropertyMove: Ke,
|
|
3209
3209
|
onPropertyRemove: r ? ke : void 0,
|
|
3210
|
-
collectionEditable:
|
|
3210
|
+
collectionEditable: d,
|
|
3211
3211
|
errors: P
|
|
3212
3212
|
}
|
|
3213
3213
|
) }),
|
|
@@ -3242,17 +3242,17 @@ function Gi({
|
|
|
3242
3242
|
property: s,
|
|
3243
3243
|
onPropertyChanged: pe,
|
|
3244
3244
|
onDelete: ke,
|
|
3245
|
-
onError:
|
|
3245
|
+
onError: We,
|
|
3246
3246
|
forceShowErrors: t,
|
|
3247
|
-
initialErrors:
|
|
3248
|
-
getData:
|
|
3247
|
+
initialErrors: Je,
|
|
3248
|
+
getData: p,
|
|
3249
3249
|
propertyConfigs: m,
|
|
3250
|
-
collectionEditable:
|
|
3250
|
+
collectionEditable: d
|
|
3251
3251
|
},
|
|
3252
3252
|
`edit_view_${f}`
|
|
3253
3253
|
),
|
|
3254
3254
|
!s && /* @__PURE__ */ a("div", { className: "w-full flex flex-col items-center justify-center h-full gap-4", children: [
|
|
3255
|
-
/* @__PURE__ */ e(O, { variant: "label", className: "", children:
|
|
3255
|
+
/* @__PURE__ */ e(O, { variant: "label", className: "", children: Qe ? "Now you can add your first property" : "Select a property to edit it" }),
|
|
3256
3256
|
/* @__PURE__ */ a(
|
|
3257
3257
|
z,
|
|
3258
3258
|
{
|
|
@@ -3283,13 +3283,13 @@ function Gi({
|
|
|
3283
3283
|
property: s,
|
|
3284
3284
|
onPropertyChanged: pe,
|
|
3285
3285
|
onDelete: ke,
|
|
3286
|
-
onError:
|
|
3286
|
+
onError: We,
|
|
3287
3287
|
forceShowErrors: t,
|
|
3288
|
-
initialErrors:
|
|
3289
|
-
getData:
|
|
3288
|
+
initialErrors: Je,
|
|
3289
|
+
getData: p,
|
|
3290
3290
|
propertyConfigs: m,
|
|
3291
|
-
collectionEditable:
|
|
3292
|
-
onOkClicked: N ?
|
|
3291
|
+
collectionEditable: d,
|
|
3292
|
+
onOkClicked: N ? Ze : void 0
|
|
3293
3293
|
},
|
|
3294
3294
|
`edit_view_${f}`
|
|
3295
3295
|
)
|
|
@@ -3307,15 +3307,15 @@ function Gi({
|
|
|
3307
3307
|
open: L,
|
|
3308
3308
|
onCancel: () => J(!1),
|
|
3309
3309
|
onPropertyChanged: gt,
|
|
3310
|
-
getData:
|
|
3310
|
+
getData: p,
|
|
3311
3311
|
allowDataInference: !r,
|
|
3312
3312
|
propertyConfigs: m,
|
|
3313
|
-
collectionEditable:
|
|
3313
|
+
collectionEditable: d,
|
|
3314
3314
|
existingPropertyKeys: g.propertiesOrder
|
|
3315
3315
|
}
|
|
3316
3316
|
),
|
|
3317
3317
|
/* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
3318
|
-
|
|
3318
|
+
Gi,
|
|
3319
3319
|
{
|
|
3320
3320
|
collection: g,
|
|
3321
3321
|
open: V,
|
|
@@ -3324,7 +3324,7 @@ function Gi({
|
|
|
3324
3324
|
) })
|
|
3325
3325
|
] });
|
|
3326
3326
|
}
|
|
3327
|
-
function
|
|
3327
|
+
function Wi({
|
|
3328
3328
|
open: t,
|
|
3329
3329
|
handleOk: r,
|
|
3330
3330
|
handleCancel: n,
|
|
@@ -3332,7 +3332,7 @@ function Ki({
|
|
|
3332
3332
|
title: l
|
|
3333
3333
|
}) {
|
|
3334
3334
|
return /* @__PURE__ */ a(
|
|
3335
|
-
|
|
3335
|
+
Se,
|
|
3336
3336
|
{
|
|
3337
3337
|
open: t,
|
|
3338
3338
|
onOpenChange: (o) => o ? n() : r(),
|
|
@@ -3352,12 +3352,12 @@ function Ki({
|
|
|
3352
3352
|
}
|
|
3353
3353
|
);
|
|
3354
3354
|
}
|
|
3355
|
-
function
|
|
3355
|
+
function Zi({ open: t, onClose: r }) {
|
|
3356
3356
|
const {
|
|
3357
3357
|
entityViews: n
|
|
3358
3358
|
} = Ae();
|
|
3359
3359
|
return /* @__PURE__ */ a(
|
|
3360
|
-
|
|
3360
|
+
Se,
|
|
3361
3361
|
{
|
|
3362
3362
|
maxWidth: "md",
|
|
3363
3363
|
open: t,
|
|
@@ -3386,7 +3386,7 @@ function Wi({ open: t, onClose: r }) {
|
|
|
3386
3386
|
}
|
|
3387
3387
|
);
|
|
3388
3388
|
}
|
|
3389
|
-
function
|
|
3389
|
+
function Ji({
|
|
3390
3390
|
collection: t,
|
|
3391
3391
|
parentCollection: r,
|
|
3392
3392
|
configController: n,
|
|
@@ -3394,10 +3394,10 @@ function Zi({
|
|
|
3394
3394
|
getUser: l,
|
|
3395
3395
|
parentCollectionIds: o
|
|
3396
3396
|
}) {
|
|
3397
|
-
const { entityViews:
|
|
3397
|
+
const { entityViews: c } = Ae(), [u, p] = Y.useState(), [h, m] = Y.useState(!1), [d, g] = Y.useState(), [v, x] = Y.useState(), {
|
|
3398
3398
|
values: y,
|
|
3399
3399
|
setFieldValue: P
|
|
3400
|
-
} = K(), k = t.subcollections ?? [], b = y.entityViews?.filter((f) => typeof f == "string").map((f) => xr(f,
|
|
3400
|
+
} = K(), k = t.subcollections ?? [], b = y.entityViews?.filter((f) => typeof f == "string").map((f) => xr(f, c)).filter(Boolean) ?? [], C = t.entityViews?.filter((f) => typeof f != "string") ?? [], N = b.length + C.length;
|
|
3401
3401
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3402
3402
|
/* @__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: [
|
|
3403
3403
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
@@ -3430,10 +3430,10 @@ function Zi({
|
|
|
3430
3430
|
{
|
|
3431
3431
|
size: "small",
|
|
3432
3432
|
onClick: (w) => {
|
|
3433
|
-
w.preventDefault(), w.stopPropagation(),
|
|
3433
|
+
w.preventDefault(), w.stopPropagation(), p(f.id);
|
|
3434
3434
|
},
|
|
3435
3435
|
color: "inherit",
|
|
3436
|
-
children: /* @__PURE__ */ e(
|
|
3436
|
+
children: /* @__PURE__ */ e(ut, { size: "small" })
|
|
3437
3437
|
}
|
|
3438
3438
|
) })
|
|
3439
3439
|
}
|
|
@@ -3459,7 +3459,7 @@ function Zi({
|
|
|
3459
3459
|
] }),
|
|
3460
3460
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3461
3461
|
/* @__PURE__ */ e(O, { variant: "h5", children: "Custom views" }),
|
|
3462
|
-
N === 0 && /* @__PURE__ */ e(
|
|
3462
|
+
N === 0 && /* @__PURE__ */ e(Hr, { action: /* @__PURE__ */ e(
|
|
3463
3463
|
z,
|
|
3464
3464
|
{
|
|
3465
3465
|
variant: "text",
|
|
@@ -3493,7 +3493,7 @@ function Zi({
|
|
|
3493
3493
|
w.preventDefault(), w.stopPropagation(), g(f.key);
|
|
3494
3494
|
},
|
|
3495
3495
|
color: "inherit",
|
|
3496
|
-
children: /* @__PURE__ */ e(
|
|
3496
|
+
children: /* @__PURE__ */ e(ut, { size: "small" })
|
|
3497
3497
|
}
|
|
3498
3498
|
) })
|
|
3499
3499
|
}
|
|
@@ -3528,18 +3528,18 @@ function Zi({
|
|
|
3528
3528
|
] })
|
|
3529
3529
|
] }) }),
|
|
3530
3530
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
3531
|
-
|
|
3532
|
-
|
|
3531
|
+
u && /* @__PURE__ */ e(
|
|
3532
|
+
st,
|
|
3533
3533
|
{
|
|
3534
|
-
open: !!
|
|
3534
|
+
open: !!u,
|
|
3535
3535
|
onAccept: () => {
|
|
3536
3536
|
const f = {
|
|
3537
|
-
id:
|
|
3537
|
+
id: u,
|
|
3538
3538
|
parentCollectionIds: [...o ?? [], t.id]
|
|
3539
3539
|
};
|
|
3540
|
-
console.debug("Deleting subcollection", f), n.deleteCollection(f),
|
|
3540
|
+
console.debug("Deleting subcollection", f), n.deleteCollection(f), p(void 0);
|
|
3541
3541
|
},
|
|
3542
|
-
onCancel: () =>
|
|
3542
|
+
onCancel: () => p(void 0),
|
|
3543
3543
|
title: /* @__PURE__ */ e(R, { children: "Delete this subcollection?" }),
|
|
3544
3544
|
body: /* @__PURE__ */ a(R, { children: [
|
|
3545
3545
|
" This will ",
|
|
@@ -3548,12 +3548,12 @@ function Zi({
|
|
|
3548
3548
|
] })
|
|
3549
3549
|
}
|
|
3550
3550
|
),
|
|
3551
|
-
|
|
3552
|
-
|
|
3551
|
+
d && /* @__PURE__ */ e(
|
|
3552
|
+
st,
|
|
3553
3553
|
{
|
|
3554
|
-
open: !!
|
|
3554
|
+
open: !!d,
|
|
3555
3555
|
onAccept: () => {
|
|
3556
|
-
P("entityViews", y.entityViews?.filter((f) => f !==
|
|
3556
|
+
P("entityViews", y.entityViews?.filter((f) => f !== d)), g(void 0);
|
|
3557
3557
|
},
|
|
3558
3558
|
onCancel: () => g(void 0),
|
|
3559
3559
|
title: /* @__PURE__ */ e(R, { children: "Remove this view?" }),
|
|
@@ -3581,7 +3581,7 @@ function Zi({
|
|
|
3581
3581
|
}
|
|
3582
3582
|
),
|
|
3583
3583
|
/* @__PURE__ */ e(
|
|
3584
|
-
|
|
3584
|
+
Zi,
|
|
3585
3585
|
{
|
|
3586
3586
|
open: h,
|
|
3587
3587
|
onClose: (f) => {
|
|
@@ -3598,7 +3598,7 @@ const Lt = {
|
|
|
3598
3598
|
singularName: "Product",
|
|
3599
3599
|
icon: "shopping_cart",
|
|
3600
3600
|
description: "List of the products currently sold in your shop",
|
|
3601
|
-
properties:
|
|
3601
|
+
properties: He({
|
|
3602
3602
|
name: {
|
|
3603
3603
|
dataType: "string",
|
|
3604
3604
|
name: "Name",
|
|
@@ -3684,7 +3684,7 @@ const Lt = {
|
|
|
3684
3684
|
icon: "article",
|
|
3685
3685
|
description: "A collection of blog entries",
|
|
3686
3686
|
defaultSize: "l",
|
|
3687
|
-
properties:
|
|
3687
|
+
properties: He({
|
|
3688
3688
|
name: {
|
|
3689
3689
|
name: "Name",
|
|
3690
3690
|
validation: { required: !0 },
|
|
@@ -3795,7 +3795,7 @@ const Lt = {
|
|
|
3795
3795
|
singularName: "User",
|
|
3796
3796
|
description: "Registered users in the app/web",
|
|
3797
3797
|
icon: "person",
|
|
3798
|
-
properties:
|
|
3798
|
+
properties: He({
|
|
3799
3799
|
displayName: {
|
|
3800
3800
|
name: "Display name",
|
|
3801
3801
|
dataType: "string"
|
|
@@ -4013,24 +4013,24 @@ const Lt = {
|
|
|
4013
4013
|
}
|
|
4014
4014
|
}
|
|
4015
4015
|
};
|
|
4016
|
-
function
|
|
4016
|
+
function Qi({
|
|
4017
4017
|
path: t,
|
|
4018
4018
|
pathSuggestions: r,
|
|
4019
4019
|
parentCollection: n,
|
|
4020
4020
|
onContinue: i,
|
|
4021
4021
|
existingCollectionPaths: l
|
|
4022
4022
|
}) {
|
|
4023
|
-
const [o,
|
|
4023
|
+
const [o, c] = $(!1), [u, p] = $();
|
|
4024
4024
|
de(() => {
|
|
4025
|
-
r && l && (
|
|
4025
|
+
r && l && (c(!0), r(t).then((v) => {
|
|
4026
4026
|
const x = v.filter((y) => !(l ?? []).find((P) => P.trim().toLowerCase() === y.trim().toLowerCase()));
|
|
4027
|
-
|
|
4028
|
-
}).finally(() =>
|
|
4027
|
+
p(x);
|
|
4028
|
+
}).finally(() => c(!1)));
|
|
4029
4029
|
}, [l, t, r]);
|
|
4030
4030
|
const {
|
|
4031
4031
|
values: h,
|
|
4032
4032
|
setFieldValue: m,
|
|
4033
|
-
setValues:
|
|
4033
|
+
setValues: d,
|
|
4034
4034
|
submitCount: g
|
|
4035
4035
|
} = K();
|
|
4036
4036
|
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: [
|
|
@@ -4041,7 +4041,7 @@ function Ji({
|
|
|
4041
4041
|
children: /* @__PURE__ */ e(O, { variant: "h4", className: "flex-grow", children: "New collection" })
|
|
4042
4042
|
}
|
|
4043
4043
|
),
|
|
4044
|
-
n && /* @__PURE__ */ e(
|
|
4044
|
+
n && /* @__PURE__ */ e(ct, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
4045
4045
|
"This is a subcollection of ",
|
|
4046
4046
|
/* @__PURE__ */ e("b", { children: n.name })
|
|
4047
4047
|
] }) }),
|
|
@@ -4055,20 +4055,20 @@ function Ji({
|
|
|
4055
4055
|
}
|
|
4056
4056
|
),
|
|
4057
4057
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
|
|
4058
|
-
o && !
|
|
4059
|
-
|
|
4060
|
-
|
|
4058
|
+
o && !u && /* @__PURE__ */ e(De, { size: "small" }),
|
|
4059
|
+
u?.map((v, x) => /* @__PURE__ */ e(
|
|
4060
|
+
ct,
|
|
4061
4061
|
{
|
|
4062
4062
|
colorScheme: "cyanLighter",
|
|
4063
4063
|
onClick: () => {
|
|
4064
|
-
m("name",
|
|
4064
|
+
m("name", pt(v)), m("id", v), m("path", v), m("properties", void 0), i();
|
|
4065
4065
|
},
|
|
4066
4066
|
size: "small",
|
|
4067
4067
|
children: v
|
|
4068
4068
|
},
|
|
4069
4069
|
v
|
|
4070
4070
|
)),
|
|
4071
|
-
!o && (
|
|
4071
|
+
!o && (u ?? [])?.length === 0 && /* @__PURE__ */ e(O, { variant: "caption", children: "No suggestions" })
|
|
4072
4072
|
] })
|
|
4073
4073
|
] }),
|
|
4074
4074
|
/* @__PURE__ */ a("div", { className: "my-2", children: [
|
|
@@ -4082,46 +4082,46 @@ function Ji({
|
|
|
4082
4082
|
),
|
|
4083
4083
|
/* @__PURE__ */ a("div", { className: "flex gap-4", children: [
|
|
4084
4084
|
/* @__PURE__ */ e(
|
|
4085
|
-
|
|
4085
|
+
at,
|
|
4086
4086
|
{
|
|
4087
4087
|
title: "Products",
|
|
4088
4088
|
subtitle: "A collection of products with images, prices and stock",
|
|
4089
|
-
icon: /* @__PURE__ */ e(
|
|
4089
|
+
icon: /* @__PURE__ */ e(tt, { size: "small", iconKey: Lt.icon }),
|
|
4090
4090
|
onClick: () => {
|
|
4091
|
-
|
|
4091
|
+
d(Lt), i();
|
|
4092
4092
|
}
|
|
4093
4093
|
}
|
|
4094
4094
|
),
|
|
4095
4095
|
/* @__PURE__ */ e(
|
|
4096
|
-
|
|
4096
|
+
at,
|
|
4097
4097
|
{
|
|
4098
4098
|
title: "Users",
|
|
4099
4099
|
subtitle: "A collection of users with emails, names and roles",
|
|
4100
|
-
icon: /* @__PURE__ */ e(
|
|
4100
|
+
icon: /* @__PURE__ */ e(tt, { size: "small", iconKey: $t.icon }),
|
|
4101
4101
|
onClick: () => {
|
|
4102
|
-
|
|
4102
|
+
d($t), i();
|
|
4103
4103
|
}
|
|
4104
4104
|
}
|
|
4105
4105
|
),
|
|
4106
4106
|
/* @__PURE__ */ e(
|
|
4107
|
-
|
|
4107
|
+
at,
|
|
4108
4108
|
{
|
|
4109
4109
|
title: "Blog posts",
|
|
4110
4110
|
subtitle: "A collection of blog posts with images, authors and complex content",
|
|
4111
|
-
icon: /* @__PURE__ */ e(
|
|
4111
|
+
icon: /* @__PURE__ */ e(tt, { size: "small", iconKey: qt.icon }),
|
|
4112
4112
|
onClick: () => {
|
|
4113
|
-
|
|
4113
|
+
d(qt), i();
|
|
4114
4114
|
}
|
|
4115
4115
|
}
|
|
4116
4116
|
),
|
|
4117
4117
|
/* @__PURE__ */ e(
|
|
4118
|
-
|
|
4118
|
+
at,
|
|
4119
4119
|
{
|
|
4120
4120
|
title: "Pages",
|
|
4121
4121
|
subtitle: "A collection of pages with images, authors and complex content",
|
|
4122
|
-
icon: /* @__PURE__ */ e(
|
|
4122
|
+
icon: /* @__PURE__ */ e(tt, { size: "small", iconKey: Yt.icon }),
|
|
4123
4123
|
onClick: () => {
|
|
4124
|
-
|
|
4124
|
+
d(Yt), i();
|
|
4125
4125
|
}
|
|
4126
4126
|
}
|
|
4127
4127
|
)
|
|
@@ -4137,12 +4137,12 @@ function Ji({
|
|
|
4137
4137
|
children: "● Create a collection from a file (csv, json, xls, xslx...)"
|
|
4138
4138
|
}
|
|
4139
4139
|
),
|
|
4140
|
-
/* @__PURE__ */ e(
|
|
4140
|
+
/* @__PURE__ */ e(di, { onDataAdded: (v) => i(v) })
|
|
4141
4141
|
] }),
|
|
4142
4142
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(z, { variant: "text", onClick: () => i(), className: "my-2", children: "Continue from scratch" }) })
|
|
4143
4143
|
] }) });
|
|
4144
4144
|
}
|
|
4145
|
-
function
|
|
4145
|
+
function at({
|
|
4146
4146
|
title: t,
|
|
4147
4147
|
subtitle: r,
|
|
4148
4148
|
icon: n,
|
|
@@ -4165,7 +4165,7 @@ function nt({
|
|
|
4165
4165
|
}
|
|
4166
4166
|
) });
|
|
4167
4167
|
}
|
|
4168
|
-
function
|
|
4168
|
+
function Xi({
|
|
4169
4169
|
importConfig: t,
|
|
4170
4170
|
propertyConfigs: r,
|
|
4171
4171
|
collectionEditable: n
|
|
@@ -4174,15 +4174,15 @@ function Qi({
|
|
|
4174
4174
|
setFieldValue: i,
|
|
4175
4175
|
setFieldTouched: l,
|
|
4176
4176
|
values: o
|
|
4177
|
-
} = K(), [
|
|
4177
|
+
} = K(), [c, u] = $(void 0), p = Y.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), h = c ? c.id : void 0, m = c || void 0, d = ({
|
|
4178
4178
|
id: v,
|
|
4179
4179
|
property: x,
|
|
4180
4180
|
previousId: y,
|
|
4181
4181
|
namespace: P
|
|
4182
4182
|
}) => {
|
|
4183
|
-
const k = v ? ae(v, P) : void 0, b = k ? he(k) : void 0, C = (f) => f ?
|
|
4183
|
+
const k = v ? ae(v, P) : void 0, b = k ? he(k) : void 0, C = (f) => f ? p.current[f] ?? I(o, be(f)) : p.current[""], N = (f, w) => {
|
|
4184
4184
|
const _ = be(w);
|
|
4185
|
-
i(_, f, !1),
|
|
4185
|
+
i(_, f, !1), p.current[w ?? ""] = f;
|
|
4186
4186
|
};
|
|
4187
4187
|
if (y && y !== v) {
|
|
4188
4188
|
const f = ae(y, P), w = he(f), M = C(P).map((D) => D === y ? v : D).filter((D) => D !== void 0);
|
|
@@ -4200,7 +4200,7 @@ function Qi({
|
|
|
4200
4200
|
namespace: P
|
|
4201
4201
|
}) => {
|
|
4202
4202
|
const k = v ? ae(v, P) : void 0, b = k ? he(k) : void 0, C = t.importData.map((f) => I(f, x)), N = {
|
|
4203
|
-
...
|
|
4203
|
+
...ri(C, y, rr),
|
|
4204
4204
|
editable: !0
|
|
4205
4205
|
};
|
|
4206
4206
|
b && (N ? i(b, N, !1) : i(b, y, !1), l(b, !0, !1));
|
|
@@ -4209,7 +4209,7 @@ function Qi({
|
|
|
4209
4209
|
/* @__PURE__ */ a(mt, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
4210
4210
|
/* @__PURE__ */ e(O, { variant: "h6", className: "mt-4", children: "Data property mapping" }),
|
|
4211
4211
|
/* @__PURE__ */ e(
|
|
4212
|
-
|
|
4212
|
+
ui,
|
|
4213
4213
|
{
|
|
4214
4214
|
headersMapping: t.headersMapping,
|
|
4215
4215
|
idColumn: t.idColumn,
|
|
@@ -4221,20 +4221,20 @@ function Qi({
|
|
|
4221
4221
|
propertyKey: x,
|
|
4222
4222
|
importKey: y
|
|
4223
4223
|
}) => /* @__PURE__ */ e(
|
|
4224
|
-
|
|
4224
|
+
pi,
|
|
4225
4225
|
{
|
|
4226
4226
|
property: v,
|
|
4227
4227
|
propertyKey: x,
|
|
4228
4228
|
onPropertyNameChanged: (P, k) => i(`properties.${P}.name`, k, !1),
|
|
4229
4229
|
onEditClick: () => {
|
|
4230
|
-
!x || !v ||
|
|
4230
|
+
!x || !v || u({
|
|
4231
4231
|
...v,
|
|
4232
4232
|
id: x,
|
|
4233
4233
|
editable: !0
|
|
4234
4234
|
});
|
|
4235
4235
|
},
|
|
4236
4236
|
propertyTypeView: /* @__PURE__ */ e(
|
|
4237
|
-
|
|
4237
|
+
en,
|
|
4238
4238
|
{
|
|
4239
4239
|
property: v,
|
|
4240
4240
|
disabled: !1,
|
|
@@ -4254,19 +4254,19 @@ function Qi({
|
|
|
4254
4254
|
/* @__PURE__ */ e(
|
|
4255
4255
|
Ie,
|
|
4256
4256
|
{
|
|
4257
|
-
open:
|
|
4257
|
+
open: c !== void 0,
|
|
4258
4258
|
propertyKey: h,
|
|
4259
4259
|
property: m,
|
|
4260
4260
|
inArray: !1,
|
|
4261
4261
|
autoUpdateId: !1,
|
|
4262
|
-
onPropertyChanged:
|
|
4262
|
+
onPropertyChanged: d,
|
|
4263
4263
|
allowDataInference: !1,
|
|
4264
4264
|
collectionEditable: n,
|
|
4265
4265
|
onOkClicked: () => {
|
|
4266
|
-
|
|
4266
|
+
u(void 0);
|
|
4267
4267
|
},
|
|
4268
4268
|
onCancel: () => {
|
|
4269
|
-
|
|
4269
|
+
u(void 0);
|
|
4270
4270
|
},
|
|
4271
4271
|
autoOpenTypeSelect: !1,
|
|
4272
4272
|
existingProperty: !1,
|
|
@@ -4276,32 +4276,32 @@ function Qi({
|
|
|
4276
4276
|
/* @__PURE__ */ e("div", { style: { height: "52px" } })
|
|
4277
4277
|
] });
|
|
4278
4278
|
}
|
|
4279
|
-
function
|
|
4279
|
+
function en({
|
|
4280
4280
|
property: t,
|
|
4281
4281
|
onPropertyChanged: r,
|
|
4282
4282
|
propertyKey: n,
|
|
4283
4283
|
propertyConfigs: i,
|
|
4284
4284
|
disabled: l
|
|
4285
4285
|
}) {
|
|
4286
|
-
const o = t ? Kt(t) : null,
|
|
4286
|
+
const o = t ? Kt(t) : null, c = t ? $e(t, i) : null, [u, p] = $(!1);
|
|
4287
4287
|
return /* @__PURE__ */ e(
|
|
4288
4288
|
te,
|
|
4289
4289
|
{
|
|
4290
|
-
title: t &&
|
|
4291
|
-
open:
|
|
4290
|
+
title: t && c ? `${c?.name} - ${t.dataType}` : void 0,
|
|
4291
|
+
open: u ? !1 : void 0,
|
|
4292
4292
|
children: /* @__PURE__ */ e(
|
|
4293
4293
|
Ce,
|
|
4294
4294
|
{
|
|
4295
|
-
open:
|
|
4296
|
-
onOpenChange:
|
|
4295
|
+
open: u,
|
|
4296
|
+
onOpenChange: p,
|
|
4297
4297
|
invisible: !0,
|
|
4298
4298
|
className: "w-full",
|
|
4299
4299
|
disabled: l,
|
|
4300
|
-
error: !
|
|
4300
|
+
error: !c,
|
|
4301
4301
|
value: o ?? "",
|
|
4302
4302
|
placeholder: "Select a property widget",
|
|
4303
4303
|
position: "item-aligned",
|
|
4304
|
-
renderValue: (h) =>
|
|
4304
|
+
renderValue: (h) => c ? /* @__PURE__ */ e(Ye, { propertyConfig: c }) : null,
|
|
4305
4305
|
onValueChange: (h) => {
|
|
4306
4306
|
const m = ar(t, h, i);
|
|
4307
4307
|
n && r({
|
|
@@ -4326,9 +4326,9 @@ function Xi({
|
|
|
4326
4326
|
}
|
|
4327
4327
|
);
|
|
4328
4328
|
}
|
|
4329
|
-
function
|
|
4329
|
+
function tn({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
4330
4330
|
de(() => {
|
|
4331
|
-
const l =
|
|
4331
|
+
const l = mi(t.originProperties, r), o = t.importData.map((c) => hi(c, t.idColumn, t.headersMapping, r, l, "TEMP_PATH"));
|
|
4332
4332
|
t.setEntities(o);
|
|
4333
4333
|
}, []);
|
|
4334
4334
|
const i = wr();
|
|
@@ -4354,16 +4354,16 @@ function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
|
4354
4354
|
);
|
|
4355
4355
|
}
|
|
4356
4356
|
function dr(t, r = "") {
|
|
4357
|
-
const n = Object.keys(t).reduce((o,
|
|
4358
|
-
const
|
|
4359
|
-
if (
|
|
4360
|
-
const g = dr(
|
|
4357
|
+
const n = Object.keys(t).reduce((o, c) => {
|
|
4358
|
+
const u = t[c], p = kr(c), h = r ? `${r}.${p}` : p;
|
|
4359
|
+
if (u.dataType === "map" && u.properties) {
|
|
4360
|
+
const g = dr(u.properties, h);
|
|
4361
4361
|
return {
|
|
4362
|
-
headersMapping: { ...o.headersMapping, [
|
|
4362
|
+
headersMapping: { ...o.headersMapping, [c]: h },
|
|
4363
4363
|
properties: {
|
|
4364
4364
|
...o.properties,
|
|
4365
|
-
[
|
|
4366
|
-
...
|
|
4365
|
+
[p]: {
|
|
4366
|
+
...u,
|
|
4367
4367
|
properties: g.properties,
|
|
4368
4368
|
propertiesOrder: Object.keys(g.properties)
|
|
4369
4369
|
}
|
|
@@ -4372,10 +4372,10 @@ function dr(t, r = "") {
|
|
|
4372
4372
|
}
|
|
4373
4373
|
const m = {
|
|
4374
4374
|
...o.properties,
|
|
4375
|
-
[
|
|
4375
|
+
[p]: u
|
|
4376
4376
|
};
|
|
4377
4377
|
return {
|
|
4378
|
-
headersMapping: { ...o.headersMapping, [
|
|
4378
|
+
headersMapping: { ...o.headersMapping, [c]: h },
|
|
4379
4379
|
properties: m
|
|
4380
4380
|
};
|
|
4381
4381
|
}, { headersMapping: {}, properties: {} }), i = Object.keys(n.headersMapping)?.[0];
|
|
@@ -4386,31 +4386,31 @@ function dr(t, r = "") {
|
|
|
4386
4386
|
};
|
|
4387
4387
|
}
|
|
4388
4388
|
function ur(t) {
|
|
4389
|
-
const r = t.open, [n, i] = je.useState(!1), [l, o] = je.useState(!1),
|
|
4389
|
+
const r = t.open, [n, i] = je.useState(!1), [l, o] = je.useState(!1), c = Q(() => {
|
|
4390
4390
|
n ? o(!0) : t.handleClose(void 0);
|
|
4391
4391
|
}, [n, t.handleClose]);
|
|
4392
4392
|
return de(() => {
|
|
4393
4393
|
r || (i(!1), o(!1));
|
|
4394
4394
|
}, [r]), /* @__PURE__ */ a(
|
|
4395
|
-
|
|
4395
|
+
Se,
|
|
4396
4396
|
{
|
|
4397
4397
|
open: r,
|
|
4398
4398
|
fullWidth: !0,
|
|
4399
4399
|
fullHeight: !0,
|
|
4400
4400
|
scrollable: !1,
|
|
4401
4401
|
maxWidth: "7xl",
|
|
4402
|
-
onOpenChange: (
|
|
4402
|
+
onOpenChange: (u) => u ? void 0 : c(),
|
|
4403
4403
|
children: [
|
|
4404
4404
|
r && /* @__PURE__ */ e(
|
|
4405
|
-
|
|
4405
|
+
rn,
|
|
4406
4406
|
{
|
|
4407
4407
|
...t,
|
|
4408
|
-
handleCancel:
|
|
4408
|
+
handleCancel: c,
|
|
4409
4409
|
setFormDirty: i
|
|
4410
4410
|
}
|
|
4411
4411
|
),
|
|
4412
4412
|
/* @__PURE__ */ e(
|
|
4413
|
-
|
|
4413
|
+
Wi,
|
|
4414
4414
|
{
|
|
4415
4415
|
open: l,
|
|
4416
4416
|
handleOk: () => t.handleClose(void 0),
|
|
@@ -4422,62 +4422,62 @@ function ur(t) {
|
|
|
4422
4422
|
}
|
|
4423
4423
|
);
|
|
4424
4424
|
}
|
|
4425
|
-
function
|
|
4425
|
+
function rn(t) {
|
|
4426
4426
|
const { propertyConfigs: r } = Ae(), n = Ne(), i = Te(), {
|
|
4427
4427
|
topLevelNavigation: l,
|
|
4428
4428
|
collections: o
|
|
4429
|
-
} = n,
|
|
4429
|
+
} = n, c = t.initialValues, u = !c?.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), [d, g] = je.useState(), [v, x] = je.useState(!1);
|
|
4430
4430
|
if (de(() => {
|
|
4431
4431
|
try {
|
|
4432
4432
|
n.initialised && (t.editedCollectionId ? g(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : g(void 0), x(!0));
|
|
4433
4433
|
} catch (b) {
|
|
4434
4434
|
console.error(b);
|
|
4435
4435
|
}
|
|
4436
|
-
}, [
|
|
4436
|
+
}, [t.editedCollectionId, t.parentCollectionIds, n]), !l)
|
|
4437
4437
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
4438
4438
|
const {
|
|
4439
4439
|
groups: y
|
|
4440
|
-
} = l, P =
|
|
4441
|
-
...
|
|
4442
|
-
id:
|
|
4443
|
-
} : void 0, k = P ?
|
|
4444
|
-
id:
|
|
4445
|
-
path:
|
|
4446
|
-
name:
|
|
4447
|
-
group:
|
|
4440
|
+
} = l, P = d ? {
|
|
4441
|
+
...d,
|
|
4442
|
+
id: d.id ?? d.path ?? _t(16)
|
|
4443
|
+
} : void 0, k = P ? an(P, r) : {
|
|
4444
|
+
id: c?.path ?? _t(16),
|
|
4445
|
+
path: c?.path ?? "",
|
|
4446
|
+
name: c?.name ?? "",
|
|
4447
|
+
group: c?.group ?? "",
|
|
4448
4448
|
properties: {},
|
|
4449
4449
|
propertiesOrder: [],
|
|
4450
4450
|
icon: zt[Math.floor(Math.random() * zt.length)],
|
|
4451
4451
|
ownerId: i.user?.uid ?? ""
|
|
4452
4452
|
};
|
|
4453
4453
|
return v ? !t.isNewCollection && (!n.initialised || !v) ? /* @__PURE__ */ e(Nt, {}) : /* @__PURE__ */ e(
|
|
4454
|
-
|
|
4454
|
+
nn,
|
|
4455
4455
|
{
|
|
4456
4456
|
...t,
|
|
4457
4457
|
initialValues: k,
|
|
4458
4458
|
existingPaths: h,
|
|
4459
4459
|
existingIds: m,
|
|
4460
|
-
includeTemplates:
|
|
4461
|
-
collection:
|
|
4460
|
+
includeTemplates: u,
|
|
4461
|
+
collection: d,
|
|
4462
4462
|
setCollection: g,
|
|
4463
4463
|
groups: y,
|
|
4464
4464
|
propertyConfigs: r
|
|
4465
4465
|
}
|
|
4466
4466
|
) : /* @__PURE__ */ e(Nt, {});
|
|
4467
4467
|
}
|
|
4468
|
-
function
|
|
4468
|
+
function nn({
|
|
4469
4469
|
isNewCollection: t,
|
|
4470
4470
|
configController: r,
|
|
4471
4471
|
editedCollectionId: n,
|
|
4472
4472
|
parentCollectionIds: i,
|
|
4473
4473
|
fullPath: l,
|
|
4474
4474
|
collectionInference: o,
|
|
4475
|
-
handleClose:
|
|
4476
|
-
reservedGroups:
|
|
4477
|
-
extraView:
|
|
4475
|
+
handleClose: c,
|
|
4476
|
+
reservedGroups: u,
|
|
4477
|
+
extraView: p,
|
|
4478
4478
|
handleCancel: h,
|
|
4479
4479
|
setFormDirty: m,
|
|
4480
|
-
pathSuggestions:
|
|
4480
|
+
pathSuggestions: d,
|
|
4481
4481
|
getUser: g,
|
|
4482
4482
|
parentCollection: v,
|
|
4483
4483
|
getData: x,
|
|
@@ -4490,10 +4490,10 @@ function rn({
|
|
|
4490
4490
|
propertyConfigs: f,
|
|
4491
4491
|
groups: w
|
|
4492
4492
|
}) {
|
|
4493
|
-
const _ =
|
|
4494
|
-
const
|
|
4493
|
+
const _ = fi(), M = Ne(), U = _e(), D = Le({}), A = t ? k ? "welcome" : "details" : "properties", [s, V] = $(A), [G, B] = je.useState(), q = (T) => {
|
|
4494
|
+
const F = T.id || T.path;
|
|
4495
4495
|
return r.saveCollection({
|
|
4496
|
-
id:
|
|
4496
|
+
id: F,
|
|
4497
4497
|
collectionData: T,
|
|
4498
4498
|
previousId: n,
|
|
4499
4499
|
parentCollectionIds: i
|
|
@@ -4502,8 +4502,8 @@ function rn({
|
|
|
4502
4502
|
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4503
4503
|
}), !1));
|
|
4504
4504
|
}, L = Q(() => {
|
|
4505
|
-
s === "details" ? _.inUse ? V("import_data_saving") : V(
|
|
4506
|
-
}, [s, _.inUse,
|
|
4505
|
+
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");
|
|
4506
|
+
}, [s, _.inUse, p]), J = Q((T) => {
|
|
4507
4507
|
if (o)
|
|
4508
4508
|
return o?.(T.path, T.collectionGroup ?? !1, i ?? []);
|
|
4509
4509
|
}, [o, i]), le = Q(async (T) => {
|
|
@@ -4511,35 +4511,35 @@ function rn({
|
|
|
4511
4511
|
if (!J)
|
|
4512
4512
|
return C(T), Promise.resolve(T);
|
|
4513
4513
|
V("loading");
|
|
4514
|
-
const
|
|
4515
|
-
if (!
|
|
4514
|
+
const F = await J?.(T);
|
|
4515
|
+
if (!F)
|
|
4516
4516
|
return C(T), Promise.resolve(T);
|
|
4517
4517
|
const E = {
|
|
4518
4518
|
...T ?? {}
|
|
4519
4519
|
};
|
|
4520
|
-
return Object.keys(
|
|
4520
|
+
return Object.keys(F.properties ?? {}).length > 0 && (E.properties = F.properties, E.propertiesOrder = F.propertiesOrder), E.propertiesOrder ? (C(E), console.debug("Inferred collection", {
|
|
4521
4521
|
newCollection: T ?? {},
|
|
4522
4522
|
values: E
|
|
4523
4523
|
}), E) : (E.propertiesOrder = Object.keys(E.properties), E);
|
|
4524
|
-
} catch (
|
|
4525
|
-
return console.error(
|
|
4524
|
+
} catch (F) {
|
|
4525
|
+
return console.error(F), U.open({
|
|
4526
4526
|
type: "error",
|
|
4527
|
-
message: "Error inferring collection: " + (
|
|
4527
|
+
message: "Error inferring collection: " + (F.message ?? "Details in the console")
|
|
4528
4528
|
}), T;
|
|
4529
4529
|
}
|
|
4530
4530
|
}, [i, J]), ue = Tt({
|
|
4531
4531
|
initialValues: N,
|
|
4532
|
-
onSubmit: (T,
|
|
4532
|
+
onSubmit: (T, F) => {
|
|
4533
4533
|
console.log("Submitting collection", T);
|
|
4534
4534
|
try {
|
|
4535
4535
|
if (!t) {
|
|
4536
4536
|
q(T).then(() => {
|
|
4537
|
-
|
|
4537
|
+
F.resetForm({ values: N }), c(T);
|
|
4538
4538
|
});
|
|
4539
4539
|
return;
|
|
4540
4540
|
}
|
|
4541
|
-
s === "welcome" ? (L(),
|
|
4542
|
-
|
|
4541
|
+
s === "welcome" ? (L(), F.resetForm({ values: T })) : s === "details" ? p || _.inUse ? (F.resetForm({ values: T }), L()) : t ? le(T).then((E) => {
|
|
4542
|
+
F.resetForm({
|
|
4543
4543
|
values: E ?? T,
|
|
4544
4544
|
touched: {
|
|
4545
4545
|
path: !0,
|
|
@@ -4548,48 +4548,48 @@ function rn({
|
|
|
4548
4548
|
});
|
|
4549
4549
|
}).finally(() => {
|
|
4550
4550
|
L();
|
|
4551
|
-
}) : (
|
|
4552
|
-
|
|
4553
|
-
}) : (L(),
|
|
4551
|
+
}) : (F.resetForm({ values: T }), L()) : s === "extra_view" ? (L(), F.resetForm({ values: T })) : s === "import_data_mapping" || s === "import_data_preview" ? L() : s === "properties" ? q(T).then(() => {
|
|
4552
|
+
F.resetForm({ values: N }), L(), c(T);
|
|
4553
|
+
}) : (L(), F.resetForm({ values: T }));
|
|
4554
4554
|
} catch (E) {
|
|
4555
4555
|
U.open({
|
|
4556
4556
|
type: "error",
|
|
4557
4557
|
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4558
|
-
}), console.error(E),
|
|
4558
|
+
}), console.error(E), F.resetForm({ values: T });
|
|
4559
4559
|
}
|
|
4560
4560
|
},
|
|
4561
4561
|
validation: (T) => {
|
|
4562
|
-
let
|
|
4563
|
-
const E = (s === "properties" || s === "subcollections" || s === "details") &&
|
|
4562
|
+
let F = {};
|
|
4563
|
+
const E = (s === "properties" || s === "subcollections" || s === "details") && yi;
|
|
4564
4564
|
if (E)
|
|
4565
4565
|
try {
|
|
4566
4566
|
E.validateSync(T, { abortEarly: !1 });
|
|
4567
4567
|
} catch (ie) {
|
|
4568
4568
|
ie.inner.forEach((Oe) => {
|
|
4569
|
-
|
|
4569
|
+
F[Oe.path] = Oe.message;
|
|
4570
4570
|
});
|
|
4571
4571
|
}
|
|
4572
|
-
if (s === "properties" && (
|
|
4572
|
+
if (s === "properties" && (F = { ...F, ...D.current }), s === "details") {
|
|
4573
4573
|
const ie = Ht(T.path, t, y, T.id);
|
|
4574
|
-
ie && (
|
|
4575
|
-
const Oe =
|
|
4576
|
-
Oe && (
|
|
4574
|
+
ie && (F.path = ie);
|
|
4575
|
+
const Oe = on(T.id, t, y, P);
|
|
4576
|
+
Oe && (F.id = Oe);
|
|
4577
4577
|
}
|
|
4578
|
-
return
|
|
4578
|
+
return F;
|
|
4579
4579
|
}
|
|
4580
4580
|
}), {
|
|
4581
4581
|
values: re,
|
|
4582
4582
|
setFieldValue: ve,
|
|
4583
4583
|
isSubmitting: ke,
|
|
4584
|
-
dirty:
|
|
4584
|
+
dirty: Ke,
|
|
4585
4585
|
submitCount: gt
|
|
4586
|
-
} = ue, pe = re.path,
|
|
4586
|
+
} = ue, pe = re.path, We = l?.includes("/") ? l?.split("/").slice(0, -1).join("/") + "/" + pe : pe, Ze = Ht(pe, t, y, re.id), Je = !Ze && i ? M.convertIdsToPaths(i) : void 0, Qe = Ze ? void 0 : M.resolveAliasesFrom(We), Re = Qe && x ? () => x(Qe, Je ?? []) : void 0;
|
|
4587
4587
|
de(() => {
|
|
4588
|
-
m(
|
|
4589
|
-
}, [
|
|
4590
|
-
function
|
|
4591
|
-
_.setInUse(!0),
|
|
4592
|
-
const E = dr(
|
|
4588
|
+
m(Ke);
|
|
4589
|
+
}, [Ke]);
|
|
4590
|
+
function Xe(T) {
|
|
4591
|
+
_.setInUse(!0), ii(T, rr).then((F) => {
|
|
4592
|
+
const E = dr(F);
|
|
4593
4593
|
ve("properties", E.properties), ve("propertiesOrder", Object.keys(E.properties)), _.setIdColumn(E.idColumn), _.setImportData(T), _.setHeadersMapping(E.headersMapping), _.setOriginProperties(E.properties);
|
|
4594
4594
|
});
|
|
4595
4595
|
}
|
|
@@ -4599,7 +4599,7 @@ function rn({
|
|
|
4599
4599
|
}, j = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4600
4600
|
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value: ue, children: /* @__PURE__ */ a(R, { children: [
|
|
4601
4601
|
!t && /* @__PURE__ */ a(
|
|
4602
|
-
|
|
4602
|
+
Gr,
|
|
4603
4603
|
{
|
|
4604
4604
|
value: s,
|
|
4605
4605
|
className: fe(wt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
@@ -4622,21 +4622,21 @@ function rn({
|
|
|
4622
4622
|
),
|
|
4623
4623
|
children: [
|
|
4624
4624
|
s === "loading" && /* @__PURE__ */ e(Nt, {}),
|
|
4625
|
-
s === "extra_view" && pe &&
|
|
4625
|
+
s === "extra_view" && pe && p?.View && /* @__PURE__ */ e(p.View, { path: pe }),
|
|
4626
4626
|
s === "welcome" && /* @__PURE__ */ e(
|
|
4627
|
-
|
|
4627
|
+
Qi,
|
|
4628
4628
|
{
|
|
4629
4629
|
path: pe,
|
|
4630
4630
|
onContinue: (T) => {
|
|
4631
|
-
T ? (
|
|
4631
|
+
T ? (Xe(T), V("import_data_mapping")) : V("details");
|
|
4632
4632
|
},
|
|
4633
4633
|
existingCollectionPaths: y,
|
|
4634
4634
|
parentCollection: v,
|
|
4635
|
-
pathSuggestions:
|
|
4635
|
+
pathSuggestions: d
|
|
4636
4636
|
}
|
|
4637
4637
|
),
|
|
4638
4638
|
s === "import_data_mapping" && _ && /* @__PURE__ */ e(
|
|
4639
|
-
|
|
4639
|
+
Xi,
|
|
4640
4640
|
{
|
|
4641
4641
|
importConfig: _,
|
|
4642
4642
|
collectionEditable: j,
|
|
@@ -4644,7 +4644,7 @@ function rn({
|
|
|
4644
4644
|
}
|
|
4645
4645
|
),
|
|
4646
4646
|
s === "import_data_preview" && _ && /* @__PURE__ */ e(
|
|
4647
|
-
|
|
4647
|
+
tn,
|
|
4648
4648
|
{
|
|
4649
4649
|
importConfig: _,
|
|
4650
4650
|
properties: re.properties,
|
|
@@ -4652,7 +4652,7 @@ function rn({
|
|
|
4652
4652
|
}
|
|
4653
4653
|
),
|
|
4654
4654
|
s === "import_data_saving" && _ && /* @__PURE__ */ e(
|
|
4655
|
-
|
|
4655
|
+
gi,
|
|
4656
4656
|
{
|
|
4657
4657
|
importConfig: _,
|
|
4658
4658
|
collection: re,
|
|
@@ -4661,12 +4661,12 @@ function rn({
|
|
|
4661
4661
|
U.open({
|
|
4662
4662
|
type: "info",
|
|
4663
4663
|
message: "Data imported successfully"
|
|
4664
|
-
}), await q(re),
|
|
4664
|
+
}), await q(re), c(T);
|
|
4665
4665
|
}
|
|
4666
4666
|
}
|
|
4667
4667
|
),
|
|
4668
4668
|
s === "details" && /* @__PURE__ */ e(
|
|
4669
|
-
|
|
4669
|
+
bi,
|
|
4670
4670
|
{
|
|
4671
4671
|
existingPaths: y,
|
|
4672
4672
|
existingIds: P,
|
|
@@ -4677,7 +4677,7 @@ function rn({
|
|
|
4677
4677
|
}
|
|
4678
4678
|
),
|
|
4679
4679
|
s === "subcollections" && b && /* @__PURE__ */ e(
|
|
4680
|
-
|
|
4680
|
+
Ji,
|
|
4681
4681
|
{
|
|
4682
4682
|
parentCollection: v,
|
|
4683
4683
|
configController: r,
|
|
@@ -4688,15 +4688,15 @@ function rn({
|
|
|
4688
4688
|
}
|
|
4689
4689
|
),
|
|
4690
4690
|
s === "properties" && /* @__PURE__ */ e(
|
|
4691
|
-
|
|
4691
|
+
Ki,
|
|
4692
4692
|
{
|
|
4693
4693
|
showErrors: gt > 0,
|
|
4694
4694
|
isNewCollection: t,
|
|
4695
|
-
reservedGroups:
|
|
4696
|
-
onPropertyError: (T,
|
|
4697
|
-
const ie =
|
|
4695
|
+
reservedGroups: u,
|
|
4696
|
+
onPropertyError: (T, F, E) => {
|
|
4697
|
+
const ie = St({
|
|
4698
4698
|
...D.current,
|
|
4699
|
-
[ir(T,
|
|
4699
|
+
[ir(T, F)]: St(E, !0)
|
|
4700
4700
|
}, !0);
|
|
4701
4701
|
D.current = ie, ue.validate();
|
|
4702
4702
|
},
|
|
@@ -4705,12 +4705,12 @@ function rn({
|
|
|
4705
4705
|
doCollectionInference: J,
|
|
4706
4706
|
propertyConfigs: f,
|
|
4707
4707
|
collectionEditable: j,
|
|
4708
|
-
extraIcon:
|
|
4708
|
+
extraIcon: p?.icon && /* @__PURE__ */ e(
|
|
4709
4709
|
oe,
|
|
4710
4710
|
{
|
|
4711
4711
|
color: "primary",
|
|
4712
4712
|
onClick: () => V("extra_view"),
|
|
4713
|
-
children:
|
|
4713
|
+
children: p.icon
|
|
4714
4714
|
}
|
|
4715
4715
|
)
|
|
4716
4716
|
}
|
|
@@ -4728,7 +4728,7 @@ function rn({
|
|
|
4728
4728
|
type: "button",
|
|
4729
4729
|
onClick: () => (_.setInUse(!1), V("welcome")),
|
|
4730
4730
|
children: [
|
|
4731
|
-
/* @__PURE__ */ e(
|
|
4731
|
+
/* @__PURE__ */ e(rt, {}),
|
|
4732
4732
|
"Back"
|
|
4733
4733
|
]
|
|
4734
4734
|
}
|
|
@@ -4742,7 +4742,7 @@ function rn({
|
|
|
4742
4742
|
V("import_data_mapping");
|
|
4743
4743
|
},
|
|
4744
4744
|
children: [
|
|
4745
|
-
/* @__PURE__ */ e(
|
|
4745
|
+
/* @__PURE__ */ e(rt, {}),
|
|
4746
4746
|
"Back"
|
|
4747
4747
|
]
|
|
4748
4748
|
}
|
|
@@ -4754,7 +4754,7 @@ function rn({
|
|
|
4754
4754
|
type: "button",
|
|
4755
4755
|
onClick: () => V("welcome"),
|
|
4756
4756
|
children: [
|
|
4757
|
-
/* @__PURE__ */ e(
|
|
4757
|
+
/* @__PURE__ */ e(rt, {}),
|
|
4758
4758
|
"Back"
|
|
4759
4759
|
]
|
|
4760
4760
|
}
|
|
@@ -4766,7 +4766,7 @@ function rn({
|
|
|
4766
4766
|
type: "button",
|
|
4767
4767
|
onClick: () => V("details"),
|
|
4768
4768
|
children: [
|
|
4769
|
-
/* @__PURE__ */ e(
|
|
4769
|
+
/* @__PURE__ */ e(rt, {}),
|
|
4770
4770
|
"Back"
|
|
4771
4771
|
]
|
|
4772
4772
|
}
|
|
@@ -4809,7 +4809,7 @@ function rn({
|
|
|
4809
4809
|
type: "submit",
|
|
4810
4810
|
loading: ke,
|
|
4811
4811
|
disabled: ke || s === "details" && !vt,
|
|
4812
|
-
startIcon: s === "properties" ? /* @__PURE__ */ e(
|
|
4812
|
+
startIcon: s === "properties" ? /* @__PURE__ */ e(Kr, {}) : void 0,
|
|
4813
4813
|
children: [
|
|
4814
4814
|
s === "details" && "Next",
|
|
4815
4815
|
s === "properties" && "Create collection"
|
|
@@ -4834,11 +4834,17 @@ function rn({
|
|
|
4834
4834
|
)
|
|
4835
4835
|
] }) }) });
|
|
4836
4836
|
}
|
|
4837
|
-
function
|
|
4838
|
-
const {
|
|
4837
|
+
function an(t, r) {
|
|
4838
|
+
const {
|
|
4839
|
+
properties: n,
|
|
4840
|
+
...i
|
|
4841
|
+
} = t, l = {};
|
|
4839
4842
|
return n && Object.keys(n).forEach((o) => {
|
|
4840
4843
|
l[o] = pr(n[o], r);
|
|
4841
|
-
}), {
|
|
4844
|
+
}), {
|
|
4845
|
+
...i,
|
|
4846
|
+
properties: l
|
|
4847
|
+
};
|
|
4842
4848
|
}
|
|
4843
4849
|
function pr(t, r) {
|
|
4844
4850
|
let n = t;
|
|
@@ -4850,7 +4856,10 @@ function pr(t, r) {
|
|
|
4850
4856
|
const l = {};
|
|
4851
4857
|
Object.keys(n.properties).forEach((o) => {
|
|
4852
4858
|
l[o] = pr(n.properties[o], r);
|
|
4853
|
-
}), n = {
|
|
4859
|
+
}), n = {
|
|
4860
|
+
...n,
|
|
4861
|
+
properties: l
|
|
4862
|
+
};
|
|
4854
4863
|
}
|
|
4855
4864
|
}
|
|
4856
4865
|
return n;
|
|
@@ -4858,32 +4867,32 @@ function pr(t, r) {
|
|
|
4858
4867
|
const Ht = (t, r, n, i) => {
|
|
4859
4868
|
let l;
|
|
4860
4869
|
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;
|
|
4861
|
-
},
|
|
4870
|
+
}, on = (t, r, n, i) => {
|
|
4862
4871
|
if (!t)
|
|
4863
4872
|
return;
|
|
4864
4873
|
let l;
|
|
4865
4874
|
return r && n?.includes(t.trim().toLowerCase()) && (l = "There is already a collection that uses this value as a path"), r && i?.includes(t.trim().toLowerCase()) && (l = "There is already a collection which uses this id"), l;
|
|
4866
|
-
}, mr = Y.createContext({}), hr = Y.createContext({}),
|
|
4875
|
+
}, mr = Y.createContext({}), hr = Y.createContext({}), ln = Y.memo(
|
|
4867
4876
|
function({
|
|
4868
4877
|
children: r,
|
|
4869
4878
|
collectionConfigController: n,
|
|
4870
4879
|
configPermissions: i,
|
|
4871
4880
|
reservedGroups: l,
|
|
4872
4881
|
collectionInference: o,
|
|
4873
|
-
extraView:
|
|
4874
|
-
pathSuggestions:
|
|
4875
|
-
getUser:
|
|
4882
|
+
extraView: c,
|
|
4883
|
+
pathSuggestions: u,
|
|
4884
|
+
getUser: p,
|
|
4876
4885
|
getData: h,
|
|
4877
4886
|
onAnalyticsEvent: m
|
|
4878
4887
|
}) {
|
|
4879
|
-
const
|
|
4888
|
+
const d = Ne(), g = vi(), v = _e(), { propertyConfigs: x } = Ae(), {
|
|
4880
4889
|
collections: y
|
|
4881
|
-
} =
|
|
4890
|
+
} = d, P = (y ?? []).map((s) => s.path.trim().toLowerCase()), [k, b] = Y.useState();
|
|
4882
4891
|
de(() => {
|
|
4883
|
-
|
|
4892
|
+
u && u().then((s) => {
|
|
4884
4893
|
b(s.filter((V) => !P.includes(V.trim().toLowerCase())));
|
|
4885
4894
|
});
|
|
4886
|
-
}, [
|
|
4895
|
+
}, [u]);
|
|
4887
4896
|
const [C, N] = Y.useState(), [f, w] = Y.useState(), _ = Q(() => ({
|
|
4888
4897
|
createCollections: !0,
|
|
4889
4898
|
editCollections: !0,
|
|
@@ -4935,7 +4944,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4935
4944
|
initialValues: G,
|
|
4936
4945
|
redirect: B
|
|
4937
4946
|
});
|
|
4938
|
-
}, []), A =
|
|
4947
|
+
}, []), A = u ? (s) => !s && k ? Promise.resolve(k) : u?.(s) : void 0;
|
|
4939
4948
|
return /* @__PURE__ */ e(mr.Provider, { value: n, children: /* @__PURE__ */ a(
|
|
4940
4949
|
hr.Provider,
|
|
4941
4950
|
{
|
|
@@ -4958,12 +4967,12 @@ const Ht = (t, r, n, i) => {
|
|
|
4958
4967
|
...C,
|
|
4959
4968
|
getData: h,
|
|
4960
4969
|
reservedGroups: l,
|
|
4961
|
-
extraView:
|
|
4970
|
+
extraView: c,
|
|
4962
4971
|
pathSuggestions: A,
|
|
4963
|
-
getUser:
|
|
4972
|
+
getUser: p,
|
|
4964
4973
|
handleClose: (s) => {
|
|
4965
4974
|
if (C?.redirect && s && C?.isNewCollection && !C.parentCollectionIds.length) {
|
|
4966
|
-
const V =
|
|
4975
|
+
const V = d.buildUrlCollectionPath(s.id ?? s.path);
|
|
4967
4976
|
g(V);
|
|
4968
4977
|
}
|
|
4969
4978
|
N(void 0);
|
|
@@ -4982,7 +4991,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4982
4991
|
collectionEditable: f?.collectionEditable ?? !1,
|
|
4983
4992
|
getData: h && f?.editedCollectionId ? () => {
|
|
4984
4993
|
console.debug("get data for property", f?.editedCollectionId);
|
|
4985
|
-
const s =
|
|
4994
|
+
const s = d.resolveAliasesFrom(f.editedCollectionId);
|
|
4986
4995
|
return h(s, []);
|
|
4987
4996
|
} : void 0,
|
|
4988
4997
|
onPropertyChanged: ({
|
|
@@ -5045,43 +5054,43 @@ const Ht = (t, r, n, i) => {
|
|
|
5045
5054
|
},
|
|
5046
5055
|
ye
|
|
5047
5056
|
), ge = () => Jt(hr);
|
|
5048
|
-
function
|
|
5057
|
+
function sn({
|
|
5049
5058
|
path: t,
|
|
5050
5059
|
parentCollectionIds: r,
|
|
5051
5060
|
collection: n,
|
|
5052
5061
|
tableController: i
|
|
5053
5062
|
}) {
|
|
5054
|
-
const l = Te(), o = Ne(),
|
|
5063
|
+
const l = Te(), o = Ne(), c = ge(), u = o.getCollectionFromIds(r), p = c.configPermissions ? c.configPermissions({
|
|
5055
5064
|
user: l.user,
|
|
5056
5065
|
collection: n
|
|
5057
5066
|
}).editCollections : !0;
|
|
5058
5067
|
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
|
|
5059
5068
|
te,
|
|
5060
5069
|
{
|
|
5061
|
-
title:
|
|
5070
|
+
title: p ? "Edit collection" : "You don't have permissions to edit this collection",
|
|
5062
5071
|
children: /* @__PURE__ */ e(
|
|
5063
5072
|
oe,
|
|
5064
5073
|
{
|
|
5065
5074
|
color: "primary",
|
|
5066
|
-
disabled: !
|
|
5067
|
-
onClick:
|
|
5068
|
-
children: /* @__PURE__ */ e(
|
|
5075
|
+
disabled: !p,
|
|
5076
|
+
onClick: p ? () => c?.editCollection({ id: n.id, fullPath: t, parentCollectionIds: r, parentCollection: u }) : void 0,
|
|
5077
|
+
children: /* @__PURE__ */ e(Ge, {})
|
|
5069
5078
|
}
|
|
5070
5079
|
)
|
|
5071
5080
|
}
|
|
5072
5081
|
) });
|
|
5073
5082
|
}
|
|
5074
5083
|
const fr = () => Jt(mr);
|
|
5075
|
-
function
|
|
5084
|
+
function cn({
|
|
5076
5085
|
path: t,
|
|
5077
5086
|
collection: r
|
|
5078
5087
|
}) {
|
|
5079
|
-
const n = _e(), i = Te(), l = fr(), o = ge(),
|
|
5088
|
+
const n = _e(), i = Te(), l = fr(), o = ge(), c = o.configPermissions({
|
|
5080
5089
|
user: i.user,
|
|
5081
5090
|
collection: r
|
|
5082
|
-
}),
|
|
5091
|
+
}), u = Q(() => {
|
|
5083
5092
|
o?.editCollection({ id: r.id, parentCollectionIds: [] });
|
|
5084
|
-
}, [o, t]), [
|
|
5093
|
+
}, [o, t]), [p, h] = $(!1), m = Q(() => {
|
|
5085
5094
|
l?.deleteCollection({ id: r.id }).then(() => {
|
|
5086
5095
|
h(!1), n.open({
|
|
5087
5096
|
message: "Collection deleted",
|
|
@@ -5091,32 +5100,32 @@ function sn({
|
|
|
5091
5100
|
}, [t, l]);
|
|
5092
5101
|
return /* @__PURE__ */ a(R, { children: [
|
|
5093
5102
|
/* @__PURE__ */ a("div", { children: [
|
|
5094
|
-
|
|
5095
|
-
|
|
5103
|
+
c.deleteCollections && /* @__PURE__ */ e(
|
|
5104
|
+
Wr,
|
|
5096
5105
|
{
|
|
5097
|
-
trigger: /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(
|
|
5098
|
-
children: /* @__PURE__ */ a(
|
|
5099
|
-
|
|
5106
|
+
trigger: /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(Zr, { size: "small" }) }),
|
|
5107
|
+
children: /* @__PURE__ */ a(Jr, { onClick: (d) => {
|
|
5108
|
+
d.preventDefault(), d.stopPropagation(), h(!0);
|
|
5100
5109
|
}, children: [
|
|
5101
|
-
/* @__PURE__ */ e(
|
|
5110
|
+
/* @__PURE__ */ e(ut, {}),
|
|
5102
5111
|
"Delete"
|
|
5103
5112
|
] })
|
|
5104
5113
|
}
|
|
5105
5114
|
),
|
|
5106
|
-
|
|
5115
|
+
c.editCollections && /* @__PURE__ */ e(
|
|
5107
5116
|
oe,
|
|
5108
5117
|
{
|
|
5109
|
-
onClick: (
|
|
5110
|
-
|
|
5118
|
+
onClick: (d) => {
|
|
5119
|
+
u();
|
|
5111
5120
|
},
|
|
5112
|
-
children: /* @__PURE__ */ e(
|
|
5121
|
+
children: /* @__PURE__ */ e(Ge, { size: "small" })
|
|
5113
5122
|
}
|
|
5114
5123
|
)
|
|
5115
5124
|
] }),
|
|
5116
5125
|
/* @__PURE__ */ e(
|
|
5117
|
-
|
|
5126
|
+
st,
|
|
5118
5127
|
{
|
|
5119
|
-
open:
|
|
5128
|
+
open: p,
|
|
5120
5129
|
onAccept: m,
|
|
5121
5130
|
onCancel: () => h(!1),
|
|
5122
5131
|
title: /* @__PURE__ */ e(R, { children: "Delete this collection?" }),
|
|
@@ -5129,7 +5138,7 @@ function sn({
|
|
|
5129
5138
|
)
|
|
5130
5139
|
] });
|
|
5131
5140
|
}
|
|
5132
|
-
function
|
|
5141
|
+
function dn({
|
|
5133
5142
|
group: t,
|
|
5134
5143
|
context: r
|
|
5135
5144
|
}) {
|
|
@@ -5170,14 +5179,14 @@ function cn({
|
|
|
5170
5179
|
}
|
|
5171
5180
|
);
|
|
5172
5181
|
}
|
|
5173
|
-
function
|
|
5182
|
+
function un({ introMode: t }) {
|
|
5174
5183
|
const r = Te(), n = Ne(), i = ge(), l = i.configPermissions ? i.configPermissions({
|
|
5175
5184
|
user: r.user
|
|
5176
|
-
}).createCollections : !0, o = i.rootPathSuggestions,
|
|
5185
|
+
}).createCollections : !0, o = i.rootPathSuggestions, c = (o ?? []).length > 3 || (n.collections ?? []).length === 0 && (o ?? []).length > 0;
|
|
5177
5186
|
return /* @__PURE__ */ e(
|
|
5178
|
-
|
|
5187
|
+
Qr,
|
|
5179
5188
|
{
|
|
5180
|
-
in: t === "existing_project" ||
|
|
5189
|
+
in: t === "existing_project" || c,
|
|
5181
5190
|
children: /* @__PURE__ */ a(
|
|
5182
5191
|
"div",
|
|
5183
5192
|
{
|
|
@@ -5198,21 +5207,21 @@ function dn({ introMode: t }) {
|
|
|
5198
5207
|
{
|
|
5199
5208
|
className: "flex flex-row gap-1 overflow-scroll no-scrollbar ",
|
|
5200
5209
|
children: [
|
|
5201
|
-
(o ?? []).map((
|
|
5202
|
-
|
|
5210
|
+
(o ?? []).map((p) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
5211
|
+
ct,
|
|
5203
5212
|
{
|
|
5204
5213
|
icon: /* @__PURE__ */ e(se, { size: "small" }),
|
|
5205
5214
|
colorScheme: "cyanLighter",
|
|
5206
5215
|
onClick: i && l ? () => i.createCollection({
|
|
5207
|
-
initialValues: { path:
|
|
5216
|
+
initialValues: { path: p, name: pt(p) },
|
|
5208
5217
|
parentCollectionIds: [],
|
|
5209
5218
|
redirect: !0,
|
|
5210
5219
|
sourceClick: "root_collection_suggestion"
|
|
5211
5220
|
}) : void 0,
|
|
5212
5221
|
size: "small",
|
|
5213
|
-
children:
|
|
5222
|
+
children: p
|
|
5214
5223
|
}
|
|
5215
|
-
) },
|
|
5224
|
+
) }, p)),
|
|
5216
5225
|
o === void 0 && /* @__PURE__ */ e(De, { size: "small" }),
|
|
5217
5226
|
o?.length === 0 && /* @__PURE__ */ e(O, { variant: "caption", children: "No suggestions" })
|
|
5218
5227
|
]
|
|
@@ -5224,7 +5233,7 @@ function dn({ introMode: t }) {
|
|
|
5224
5233
|
}
|
|
5225
5234
|
);
|
|
5226
5235
|
}
|
|
5227
|
-
function
|
|
5236
|
+
function pn({
|
|
5228
5237
|
propertyKey: t,
|
|
5229
5238
|
onHover: r,
|
|
5230
5239
|
property: n,
|
|
@@ -5232,13 +5241,13 @@ function un({
|
|
|
5232
5241
|
parentCollectionIds: l,
|
|
5233
5242
|
collection: o
|
|
5234
5243
|
}) {
|
|
5235
|
-
const
|
|
5244
|
+
const c = ge();
|
|
5236
5245
|
return /* @__PURE__ */ e(te, { title: "Edit", children: /* @__PURE__ */ e(
|
|
5237
5246
|
oe,
|
|
5238
5247
|
{
|
|
5239
5248
|
className: r ? "bg-white dark:bg-gray-950" : "hidden",
|
|
5240
5249
|
onClick: () => {
|
|
5241
|
-
|
|
5250
|
+
c.editProperty({
|
|
5242
5251
|
propertyKey: t,
|
|
5243
5252
|
property: n,
|
|
5244
5253
|
editedCollectionId: o.id,
|
|
@@ -5247,11 +5256,11 @@ function un({
|
|
|
5247
5256
|
});
|
|
5248
5257
|
},
|
|
5249
5258
|
size: "small",
|
|
5250
|
-
children: /* @__PURE__ */ e(
|
|
5259
|
+
children: /* @__PURE__ */ e(Ge, { size: "small" })
|
|
5251
5260
|
}
|
|
5252
5261
|
) });
|
|
5253
5262
|
}
|
|
5254
|
-
function
|
|
5263
|
+
function mn({
|
|
5255
5264
|
fullPath: t,
|
|
5256
5265
|
parentCollectionIds: r,
|
|
5257
5266
|
collection: n
|
|
@@ -5276,7 +5285,7 @@ function pn({
|
|
|
5276
5285
|
}
|
|
5277
5286
|
) });
|
|
5278
5287
|
}
|
|
5279
|
-
function
|
|
5288
|
+
function hn() {
|
|
5280
5289
|
const t = ge();
|
|
5281
5290
|
return /* @__PURE__ */ e("div", { className: "bg-gray-50 dark:bg-gray-900 min-w-fit rounded", children: /* @__PURE__ */ a(
|
|
5282
5291
|
z,
|
|
@@ -5295,18 +5304,18 @@ function mn() {
|
|
|
5295
5304
|
}
|
|
5296
5305
|
) });
|
|
5297
5306
|
}
|
|
5298
|
-
function
|
|
5307
|
+
function fn({
|
|
5299
5308
|
path: t,
|
|
5300
5309
|
parentCollectionIds: r,
|
|
5301
5310
|
collection: n,
|
|
5302
5311
|
tableController: i
|
|
5303
5312
|
}) {
|
|
5304
|
-
const l = Te(), o = ge(),
|
|
5313
|
+
const l = Te(), o = ge(), c = fr(), u = _e(), p = o.configPermissions ? o.configPermissions({
|
|
5305
5314
|
user: l.user,
|
|
5306
5315
|
collection: n
|
|
5307
5316
|
}).editCollections : !0;
|
|
5308
5317
|
let h = null;
|
|
5309
|
-
return (!ye(
|
|
5318
|
+
return (!ye(ot(i.filterValues), ot(n.initialFilter)) || !ye(ot(i.sortBy), ot(n.initialSort))) && (h = /* @__PURE__ */ a(R, { children: [
|
|
5310
5319
|
/* @__PURE__ */ e(
|
|
5311
5320
|
te,
|
|
5312
5321
|
{
|
|
@@ -5317,7 +5326,7 @@ function hn({
|
|
|
5317
5326
|
color: "primary",
|
|
5318
5327
|
size: "small",
|
|
5319
5328
|
variant: "outlined",
|
|
5320
|
-
onClick: () =>
|
|
5329
|
+
onClick: () => c?.saveCollection({
|
|
5321
5330
|
id: n.id,
|
|
5322
5331
|
parentCollectionIds: r,
|
|
5323
5332
|
collectionData: W(
|
|
@@ -5328,12 +5337,12 @@ function hn({
|
|
|
5328
5337
|
}
|
|
5329
5338
|
)
|
|
5330
5339
|
}).then(() => {
|
|
5331
|
-
|
|
5340
|
+
u.open({
|
|
5332
5341
|
type: "success",
|
|
5333
5342
|
message: "Default config saved"
|
|
5334
5343
|
});
|
|
5335
5344
|
}),
|
|
5336
|
-
children: /* @__PURE__ */ e(
|
|
5345
|
+
children: /* @__PURE__ */ e(Xr, {})
|
|
5337
5346
|
}
|
|
5338
5347
|
)
|
|
5339
5348
|
}
|
|
@@ -5351,61 +5360,61 @@ function hn({
|
|
|
5351
5360
|
onClick: () => {
|
|
5352
5361
|
i.clearFilter?.(), n?.initialFilter && i.setFilterValues?.(n?.initialFilter), n?.initialSort && i.setSortBy?.(n?.initialSort);
|
|
5353
5362
|
},
|
|
5354
|
-
children: /* @__PURE__ */ e(
|
|
5363
|
+
children: /* @__PURE__ */ e(ei, {})
|
|
5355
5364
|
}
|
|
5356
5365
|
)
|
|
5357
5366
|
}
|
|
5358
5367
|
)
|
|
5359
|
-
] })), /* @__PURE__ */ e(R, { children:
|
|
5368
|
+
] })), /* @__PURE__ */ e(R, { children: p && h });
|
|
5360
5369
|
}
|
|
5361
|
-
function
|
|
5370
|
+
function ot(t) {
|
|
5362
5371
|
return t && Object.keys(t).length === 0 ? t : t ?? null;
|
|
5363
5372
|
}
|
|
5364
|
-
function
|
|
5373
|
+
function Sn({
|
|
5365
5374
|
collectionConfigController: t,
|
|
5366
5375
|
introMode: r,
|
|
5367
5376
|
configPermissions: n,
|
|
5368
5377
|
reservedGroups: i,
|
|
5369
5378
|
extraView: l,
|
|
5370
5379
|
pathSuggestions: o,
|
|
5371
|
-
getUser:
|
|
5372
|
-
collectionInference:
|
|
5373
|
-
getData:
|
|
5380
|
+
getUser: c,
|
|
5381
|
+
collectionInference: u,
|
|
5382
|
+
getData: p,
|
|
5374
5383
|
onAnalyticsEvent: h
|
|
5375
5384
|
}) {
|
|
5376
5385
|
return {
|
|
5377
5386
|
key: "collection_editor",
|
|
5378
5387
|
loading: t.loading,
|
|
5379
5388
|
provider: {
|
|
5380
|
-
Component:
|
|
5389
|
+
Component: ln,
|
|
5381
5390
|
props: {
|
|
5382
5391
|
collectionConfigController: t,
|
|
5383
5392
|
configPermissions: n,
|
|
5384
|
-
collectionInference:
|
|
5393
|
+
collectionInference: u,
|
|
5385
5394
|
reservedGroups: i,
|
|
5386
5395
|
extraView: l,
|
|
5387
5396
|
pathSuggestions: o,
|
|
5388
|
-
getUser:
|
|
5389
|
-
getData:
|
|
5397
|
+
getUser: c,
|
|
5398
|
+
getData: p,
|
|
5390
5399
|
onAnalyticsEvent: h
|
|
5391
5400
|
}
|
|
5392
5401
|
},
|
|
5393
5402
|
homePage: {
|
|
5394
|
-
additionalActions: /* @__PURE__ */ e(
|
|
5395
|
-
additionalChildrenStart: r ? /* @__PURE__ */ e(
|
|
5396
|
-
additionalChildrenEnd: /* @__PURE__ */ e(
|
|
5397
|
-
CollectionActions:
|
|
5398
|
-
AdditionalCards: r ? void 0 :
|
|
5403
|
+
additionalActions: /* @__PURE__ */ e(hn, {}),
|
|
5404
|
+
additionalChildrenStart: r ? /* @__PURE__ */ e(gn, { introMode: r }) : void 0,
|
|
5405
|
+
additionalChildrenEnd: /* @__PURE__ */ e(un, { introMode: r }),
|
|
5406
|
+
CollectionActions: cn,
|
|
5407
|
+
AdditionalCards: r ? void 0 : dn
|
|
5399
5408
|
},
|
|
5400
5409
|
collectionView: {
|
|
5401
|
-
CollectionActionsStart:
|
|
5402
|
-
CollectionActions:
|
|
5403
|
-
HeaderAction:
|
|
5404
|
-
AddColumnComponent:
|
|
5410
|
+
CollectionActionsStart: fn,
|
|
5411
|
+
CollectionActions: sn,
|
|
5412
|
+
HeaderAction: pn,
|
|
5413
|
+
AddColumnComponent: mn
|
|
5405
5414
|
}
|
|
5406
5415
|
};
|
|
5407
5416
|
}
|
|
5408
|
-
function
|
|
5417
|
+
function gn({ introMode: t }) {
|
|
5409
5418
|
if (!Ne().topLevelNavigation)
|
|
5410
5419
|
throw Error("Navigation not ready in FireCMSHomePage");
|
|
5411
5420
|
const n = Te(), i = ge(), l = i.configPermissions ? i.configPermissions({
|
|
@@ -5432,8 +5441,16 @@ function fn({ introMode: t }) {
|
|
|
5432
5441
|
)
|
|
5433
5442
|
] });
|
|
5434
5443
|
}
|
|
5435
|
-
|
|
5436
|
-
const
|
|
5444
|
+
const Fn = (t, r, n) => {
|
|
5445
|
+
const i = (c) => {
|
|
5446
|
+
He(c.properties), c.subcollections?.forEach(i);
|
|
5447
|
+
}, l = r ?? [];
|
|
5448
|
+
l.forEach(i), console.debug("Collections specified in code:", t), console.debug("Collections stored in the backend", l);
|
|
5449
|
+
const o = Ir(t, l, [], n);
|
|
5450
|
+
return console.debug("Collections after joining:", o), o;
|
|
5451
|
+
};
|
|
5452
|
+
function En({ path: t }) {
|
|
5453
|
+
const r = Ne(), n = vn(t), i = r.getParentCollectionIds(t), l = ge();
|
|
5437
5454
|
return /* @__PURE__ */ a("div", { className: "p-1 flex flex-col items-center", children: [
|
|
5438
5455
|
/* @__PURE__ */ e(Wt, { error: "No collection for path: " + n }),
|
|
5439
5456
|
/* @__PURE__ */ e(
|
|
@@ -5444,7 +5461,7 @@ function Fn({ path: t }) {
|
|
|
5444
5461
|
size: "small",
|
|
5445
5462
|
onClick: () => {
|
|
5446
5463
|
l.createCollection({
|
|
5447
|
-
initialValues: { path: n, name:
|
|
5464
|
+
initialValues: { path: n, name: pt(n) },
|
|
5448
5465
|
parentCollectionIds: i,
|
|
5449
5466
|
redirect: !1,
|
|
5450
5467
|
sourceClick: "missing_reference"
|
|
@@ -5455,21 +5472,22 @@ function Fn({ path: t }) {
|
|
|
5455
5472
|
)
|
|
5456
5473
|
] });
|
|
5457
5474
|
}
|
|
5458
|
-
function
|
|
5475
|
+
function vn(t) {
|
|
5459
5476
|
const r = t.split("/");
|
|
5460
5477
|
return r[r.length - 1];
|
|
5461
5478
|
}
|
|
5462
5479
|
export {
|
|
5463
|
-
|
|
5480
|
+
En as MissingReferenceWidget,
|
|
5464
5481
|
qe as editableProperty,
|
|
5465
5482
|
ae as getFullId,
|
|
5466
5483
|
ir as getFullIdPath,
|
|
5467
5484
|
he as idToPropertiesPath,
|
|
5485
|
+
Fn as mergeCollections,
|
|
5468
5486
|
be as namespaceToPropertiesOrderPath,
|
|
5469
|
-
|
|
5470
|
-
|
|
5487
|
+
Ci as namespaceToPropertiesPath,
|
|
5488
|
+
Ti as removeNonEditableProperties,
|
|
5471
5489
|
ge as useCollectionEditorController,
|
|
5472
|
-
|
|
5490
|
+
Sn as useCollectionEditorPlugin,
|
|
5473
5491
|
fr as useCollectionsConfigController
|
|
5474
5492
|
};
|
|
5475
5493
|
//# sourceMappingURL=index.es.js.map
|