@firecms/collection_editor 3.0.0-canary.4 → 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 +792 -760
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/persisted_collection.d.ts +1 -1
- package/dist/ui/EditorCollectionActionStart.d.ts +2 -0
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +2 -2
- 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/ui/collection_editor/utils/supported_fields.d.ts +2 -2
- package/dist/useCollectionEditorPlugin.d.ts +2 -2
- package/dist/utils/collections.d.ts +6 -0
- package/package.json +18 -18
- package/src/ConfigControllerProvider.tsx +2 -2
- package/src/index.ts +1 -0
- package/src/types/persisted_collection.ts +1 -1
- package/src/ui/EditorCollectionAction.tsx +0 -51
- package/src/ui/EditorCollectionActionStart.tsx +87 -0
- package/src/ui/MissingReferenceWidget.tsx +2 -1
- package/src/ui/NewCollectionButton.tsx +12 -10
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +17 -18
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +28 -14
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +1 -1
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +8 -7
- package/src/ui/collection_editor/EnumForm.tsx +3 -4
- package/src/ui/collection_editor/GetCodeDialog.tsx +15 -3
- package/src/ui/collection_editor/PropertyEditView.tsx +4 -4
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +1 -1
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +1 -1
- package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +7 -8
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +7 -8
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +3 -4
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +3 -4
- package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +3 -4
- package/src/ui/collection_editor/utils/supported_fields.tsx +3 -3
- package/src/useCollectionEditorPlugin.tsx +6 -6
- package/src/utils/collections.ts +30 -0
- package/dist/ui/collection_editor/properties/FieldHelperView.d.ts +0 -4
- package/src/ui/collection_editor/properties/FieldHelperView.tsx +0 -13
package/dist/index.es.js
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import { jsx as e, jsxs as a, Fragment as
|
|
2
|
-
import { SearchIconsView as gr, toSnakeCase as Pt, singular as vr, IconForView as
|
|
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 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
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import * 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
|
+
import ye from "react-fast-compare";
|
|
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
|
|
21
|
-
error: t,
|
|
22
|
-
children: r
|
|
23
|
-
}) {
|
|
24
|
-
return r ? /* @__PURE__ */ e(O, { variant: "caption", color: t ? "error" : "secondary", className: "ml-3.5 mt-0.5", children: r }) : null;
|
|
25
|
-
}
|
|
26
|
-
function yi({
|
|
20
|
+
function bi({
|
|
27
21
|
isNewCollection: t,
|
|
28
22
|
reservedGroups: r,
|
|
29
23
|
existingPaths: n,
|
|
@@ -31,12 +25,12 @@ function yi({
|
|
|
31
25
|
groups: l,
|
|
32
26
|
parentCollection: o
|
|
33
27
|
}) {
|
|
34
|
-
const
|
|
28
|
+
const c = Y.useRef(null), {
|
|
35
29
|
values: u,
|
|
36
30
|
setFieldValue: p,
|
|
37
31
|
handleChange: h,
|
|
38
32
|
touched: m,
|
|
39
|
-
errors:
|
|
33
|
+
errors: d,
|
|
40
34
|
setFieldTouched: g,
|
|
41
35
|
isSubmitting: v,
|
|
42
36
|
submitCount: x
|
|
@@ -44,15 +38,15 @@ function yi({
|
|
|
44
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));
|
|
45
39
|
};
|
|
46
40
|
de(() => {
|
|
47
|
-
|
|
48
|
-
}, [
|
|
49
|
-
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)), {
|
|
50
44
|
inputFocused: w,
|
|
51
45
|
autoCompleteOpen: _,
|
|
52
46
|
setAutoCompleteOpen: M
|
|
53
|
-
} =
|
|
54
|
-
ref:
|
|
55
|
-
}),
|
|
47
|
+
} = Sr({
|
|
48
|
+
ref: c
|
|
49
|
+
}), U = !!o;
|
|
56
50
|
let D;
|
|
57
51
|
typeof u.customId == "object" ? D = "code_defined" : u.customId === !0 ? D = "true" : u.customId === !1 ? D = "false" : u.customId === "optional" && (D = "optional");
|
|
58
52
|
const A = x > 0;
|
|
@@ -75,7 +69,7 @@ function yi({
|
|
|
75
69
|
]
|
|
76
70
|
}
|
|
77
71
|
),
|
|
78
|
-
o && /* @__PURE__ */ e(
|
|
72
|
+
o && /* @__PURE__ */ e(ct, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
79
73
|
"This is a subcollection of ",
|
|
80
74
|
/* @__PURE__ */ e("b", { children: o.name })
|
|
81
75
|
] }) })
|
|
@@ -83,18 +77,18 @@ function yi({
|
|
|
83
77
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-4", children: [
|
|
84
78
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
85
79
|
/* @__PURE__ */ e(
|
|
86
|
-
|
|
80
|
+
Ve,
|
|
87
81
|
{
|
|
88
82
|
value: u.name ?? "",
|
|
89
83
|
onChange: (s) => C(s.target.value),
|
|
90
84
|
label: "Name",
|
|
91
85
|
required: !0,
|
|
92
|
-
error: A && !!
|
|
86
|
+
error: A && !!d.name
|
|
93
87
|
}
|
|
94
88
|
),
|
|
95
|
-
/* @__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)" })
|
|
96
90
|
] }),
|
|
97
|
-
/* @__PURE__ */ a("div", { className:
|
|
91
|
+
/* @__PURE__ */ a("div", { className: fe("col-span-12 ", U ? "" : "sm:col-span-8"), children: [
|
|
98
92
|
/* @__PURE__ */ e(
|
|
99
93
|
H,
|
|
100
94
|
{
|
|
@@ -103,22 +97,22 @@ function yi({
|
|
|
103
97
|
label: "Path",
|
|
104
98
|
disabled: !t,
|
|
105
99
|
required: !0,
|
|
106
|
-
error: A && !!
|
|
100
|
+
error: A && !!d.path
|
|
107
101
|
}
|
|
108
102
|
),
|
|
109
|
-
/* @__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" })
|
|
110
104
|
] }),
|
|
111
|
-
!
|
|
105
|
+
!U && /* @__PURE__ */ a("div", { className: "col-span-12 sm:col-span-4 relative", children: [
|
|
112
106
|
/* @__PURE__ */ e(
|
|
113
|
-
|
|
107
|
+
Ve,
|
|
114
108
|
{
|
|
115
|
-
error: A && !!
|
|
109
|
+
error: A && !!d.group,
|
|
116
110
|
disabled: v,
|
|
117
111
|
value: u.group ?? "",
|
|
118
112
|
autoComplete: "off",
|
|
119
113
|
onChange: (s) => p("group", s.target.value),
|
|
120
114
|
name: "group",
|
|
121
|
-
inputRef:
|
|
115
|
+
inputRef: c,
|
|
122
116
|
label: "Group"
|
|
123
117
|
}
|
|
124
118
|
),
|
|
@@ -128,7 +122,7 @@ function yi({
|
|
|
128
122
|
open: _ && (f ?? []).length > 0,
|
|
129
123
|
setOpen: M,
|
|
130
124
|
children: f?.map((s, V) => /* @__PURE__ */ e(
|
|
131
|
-
|
|
125
|
+
Er,
|
|
132
126
|
{
|
|
133
127
|
onClick: () => {
|
|
134
128
|
M(!1), p("group", s ?? null);
|
|
@@ -139,7 +133,7 @@ function yi({
|
|
|
139
133
|
))
|
|
140
134
|
}
|
|
141
135
|
),
|
|
142
|
-
/* @__PURE__ */ e(X, { children: A &&
|
|
136
|
+
/* @__PURE__ */ e(X, { children: A && d.group ? d.group : "Group of the collection" })
|
|
143
137
|
] }),
|
|
144
138
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
145
139
|
xt,
|
|
@@ -147,7 +141,7 @@ function yi({
|
|
|
147
141
|
expanded: k,
|
|
148
142
|
onExpandedChange: b,
|
|
149
143
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
150
|
-
/* @__PURE__ */ e(
|
|
144
|
+
/* @__PURE__ */ e(Ge, {}),
|
|
151
145
|
/* @__PURE__ */ e(
|
|
152
146
|
O,
|
|
153
147
|
{
|
|
@@ -167,16 +161,16 @@ function yi({
|
|
|
167
161
|
as: Z,
|
|
168
162
|
disabled: !t,
|
|
169
163
|
label: "Collection id",
|
|
170
|
-
error: A && !!
|
|
164
|
+
error: A && !!d.id
|
|
171
165
|
}
|
|
172
166
|
),
|
|
173
|
-
/* @__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" })
|
|
174
168
|
] }),
|
|
175
169
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
176
170
|
/* @__PURE__ */ e(
|
|
177
|
-
|
|
171
|
+
Ve,
|
|
178
172
|
{
|
|
179
|
-
error: A && !!
|
|
173
|
+
error: A && !!d.singularName,
|
|
180
174
|
name: "singularName",
|
|
181
175
|
"aria-describedby": "singularName-helper",
|
|
182
176
|
onChange: (s) => (g("singularName", !0), h(s)),
|
|
@@ -184,13 +178,13 @@ function yi({
|
|
|
184
178
|
label: "Singular name"
|
|
185
179
|
}
|
|
186
180
|
),
|
|
187
|
-
/* @__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" })
|
|
188
182
|
] }),
|
|
189
183
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
190
184
|
/* @__PURE__ */ e(
|
|
191
|
-
|
|
185
|
+
Ve,
|
|
192
186
|
{
|
|
193
|
-
error: A && !!
|
|
187
|
+
error: A && !!d.description,
|
|
194
188
|
name: "description",
|
|
195
189
|
value: u.description ?? "",
|
|
196
190
|
onChange: h,
|
|
@@ -200,10 +194,10 @@ function yi({
|
|
|
200
194
|
label: "Description"
|
|
201
195
|
}
|
|
202
196
|
),
|
|
203
|
-
/* @__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" })
|
|
204
198
|
] }),
|
|
205
199
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
206
|
-
|
|
200
|
+
Ce,
|
|
207
201
|
{
|
|
208
202
|
name: "defaultSize",
|
|
209
203
|
label: "Default row size",
|
|
@@ -222,7 +216,7 @@ function yi({
|
|
|
222
216
|
}
|
|
223
217
|
) }),
|
|
224
218
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
225
|
-
|
|
219
|
+
Ce,
|
|
226
220
|
{
|
|
227
221
|
name: "customId",
|
|
228
222
|
label: "Data IDs generation",
|
|
@@ -244,7 +238,7 @@ function yi({
|
|
|
244
238
|
) }),
|
|
245
239
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
246
240
|
/* @__PURE__ */ e(
|
|
247
|
-
|
|
241
|
+
dt,
|
|
248
242
|
{
|
|
249
243
|
position: "start",
|
|
250
244
|
label: "Collection group",
|
|
@@ -256,7 +250,7 @@ function yi({
|
|
|
256
250
|
] }),
|
|
257
251
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
258
252
|
/* @__PURE__ */ e(
|
|
259
|
-
|
|
253
|
+
dt,
|
|
260
254
|
{
|
|
261
255
|
position: "start",
|
|
262
256
|
label: "Enable text search for this collection",
|
|
@@ -272,7 +266,7 @@ function yi({
|
|
|
272
266
|
] }),
|
|
273
267
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
274
268
|
/* @__PURE__ */ e(
|
|
275
|
-
|
|
269
|
+
Se,
|
|
276
270
|
{
|
|
277
271
|
open: y,
|
|
278
272
|
onOpenChange: P,
|
|
@@ -291,13 +285,13 @@ function yi({
|
|
|
291
285
|
)
|
|
292
286
|
] }) });
|
|
293
287
|
}
|
|
294
|
-
function
|
|
288
|
+
function he(t) {
|
|
295
289
|
return "properties." + t.replaceAll(".", ".properties.");
|
|
296
290
|
}
|
|
297
|
-
function
|
|
291
|
+
function Ci(t) {
|
|
298
292
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
|
|
299
293
|
}
|
|
300
|
-
function
|
|
294
|
+
function be(t) {
|
|
301
295
|
return t ? "properties." + t.replaceAll(".", ".properties.") + ".propertiesOrder" : "propertiesOrder";
|
|
302
296
|
}
|
|
303
297
|
function ae(t, r) {
|
|
@@ -305,33 +299,33 @@ function ae(t, r) {
|
|
|
305
299
|
}
|
|
306
300
|
function ir(t, r) {
|
|
307
301
|
const n = r ? `${r}.${t}` : t;
|
|
308
|
-
return
|
|
302
|
+
return he(n);
|
|
309
303
|
}
|
|
310
|
-
function
|
|
304
|
+
function Pi({
|
|
311
305
|
enumValues: t,
|
|
312
306
|
onValuesChanged: r,
|
|
313
307
|
onError: n,
|
|
314
308
|
updateIds: i,
|
|
315
309
|
disabled: l,
|
|
316
310
|
allowDataInference: o,
|
|
317
|
-
getData:
|
|
311
|
+
getData: c
|
|
318
312
|
}) {
|
|
319
313
|
const u = Tt({
|
|
320
314
|
initialValues: { enumValues: t },
|
|
321
315
|
validateOnChange: !0,
|
|
322
316
|
validation: (m) => {
|
|
323
|
-
const
|
|
317
|
+
const d = {};
|
|
324
318
|
m.enumValues && m.enumValues.forEach((v, x) => {
|
|
325
|
-
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");
|
|
326
320
|
});
|
|
327
|
-
const g = !!(
|
|
328
|
-
return n?.(g),
|
|
321
|
+
const g = !!(d?.enumValues && Object.keys(d?.enumValues).length > 0);
|
|
322
|
+
return n?.(g), d;
|
|
329
323
|
}
|
|
330
324
|
}), { values: p, errors: h } = u;
|
|
331
325
|
return de(() => {
|
|
332
326
|
r && r(p.enumValues);
|
|
333
327
|
}, [p.enumValues]), /* @__PURE__ */ e(kt, { value: u, children: /* @__PURE__ */ e(
|
|
334
|
-
|
|
328
|
+
Ni,
|
|
335
329
|
{
|
|
336
330
|
enumValuesPath: "enumValues",
|
|
337
331
|
values: p,
|
|
@@ -339,25 +333,25 @@ function Ci({
|
|
|
339
333
|
shouldUpdateId: i,
|
|
340
334
|
disabled: l,
|
|
341
335
|
allowDataInference: o,
|
|
342
|
-
getData:
|
|
336
|
+
getData: c
|
|
343
337
|
}
|
|
344
338
|
) });
|
|
345
339
|
}
|
|
346
|
-
function
|
|
340
|
+
function Ni({
|
|
347
341
|
values: t,
|
|
348
342
|
errors: r,
|
|
349
343
|
disabled: n,
|
|
350
344
|
enumValuesPath: i,
|
|
351
345
|
shouldUpdateId: l,
|
|
352
346
|
allowDataInference: o,
|
|
353
|
-
getData:
|
|
347
|
+
getData: c
|
|
354
348
|
}) {
|
|
355
349
|
const {
|
|
356
350
|
setFieldValue: u
|
|
357
|
-
} = K(), [p, h] = Y.useState(), [m,
|
|
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) => {
|
|
358
352
|
const N = p === C, f = r?.enumValues && r?.enumValues[b];
|
|
359
353
|
return /* @__PURE__ */ e(
|
|
360
|
-
|
|
354
|
+
xi,
|
|
361
355
|
{
|
|
362
356
|
index: b,
|
|
363
357
|
disabled: n,
|
|
@@ -365,7 +359,7 @@ function Pi({
|
|
|
365
359
|
autoFocus: N,
|
|
366
360
|
entryError: f,
|
|
367
361
|
shouldUpdateId: l || N,
|
|
368
|
-
onDialogOpen: () =>
|
|
362
|
+
onDialogOpen: () => d(b),
|
|
369
363
|
inferredEntry: y.has(t.enumValues[b]?.id)
|
|
370
364
|
},
|
|
371
365
|
`${C}`
|
|
@@ -373,7 +367,7 @@ function Pi({
|
|
|
373
367
|
};
|
|
374
368
|
return /* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
375
369
|
/* @__PURE__ */ a("div", { className: "ml-3.5 flex flex-row items-center", children: [
|
|
376
|
-
/* @__PURE__ */ e(
|
|
370
|
+
/* @__PURE__ */ e(Dr, {}),
|
|
377
371
|
/* @__PURE__ */ e(
|
|
378
372
|
O,
|
|
379
373
|
{
|
|
@@ -390,10 +384,10 @@ function Pi({
|
|
|
390
384
|
variant: "text",
|
|
391
385
|
size: "small",
|
|
392
386
|
onClick: async () => {
|
|
393
|
-
|
|
387
|
+
c && (v(!0), c?.().then((b) => {
|
|
394
388
|
if (!b)
|
|
395
389
|
return;
|
|
396
|
-
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));
|
|
397
391
|
_.forEach((M) => {
|
|
398
392
|
y.add(M.id);
|
|
399
393
|
}), u(i, [..._, ...f], !0);
|
|
@@ -408,7 +402,7 @@ function Pi({
|
|
|
408
402
|
}
|
|
409
403
|
)
|
|
410
404
|
] }),
|
|
411
|
-
/* @__PURE__ */ a(
|
|
405
|
+
/* @__PURE__ */ a(Pe, { className: "p-4 m-1", children: [
|
|
412
406
|
/* @__PURE__ */ e(
|
|
413
407
|
yr,
|
|
414
408
|
{
|
|
@@ -425,38 +419,38 @@ function Pi({
|
|
|
425
419
|
}
|
|
426
420
|
),
|
|
427
421
|
/* @__PURE__ */ e(
|
|
428
|
-
|
|
422
|
+
wi,
|
|
429
423
|
{
|
|
430
424
|
index: m,
|
|
431
425
|
open: m !== void 0,
|
|
432
426
|
enumValuesPath: i,
|
|
433
|
-
onClose: () =>
|
|
427
|
+
onClose: () => d(void 0)
|
|
434
428
|
}
|
|
435
429
|
)
|
|
436
430
|
] })
|
|
437
431
|
] });
|
|
438
432
|
}
|
|
439
|
-
const
|
|
433
|
+
const xi = Y.memo(
|
|
440
434
|
function({
|
|
441
435
|
index: r,
|
|
442
436
|
shouldUpdateId: n,
|
|
443
437
|
enumValuesPath: i,
|
|
444
438
|
autoFocus: l,
|
|
445
439
|
onDialogOpen: o,
|
|
446
|
-
disabled:
|
|
440
|
+
disabled: c,
|
|
447
441
|
inferredEntry: u,
|
|
448
442
|
entryError: p
|
|
449
443
|
}) {
|
|
450
444
|
const {
|
|
451
445
|
values: h,
|
|
452
446
|
handleChange: m,
|
|
453
|
-
errors:
|
|
447
|
+
errors: d,
|
|
454
448
|
setFieldValue: g,
|
|
455
449
|
touched: v
|
|
456
450
|
} = K(), x = Y.useRef(!I(h, `${i}[${r}].id`)), y = n || x.current, P = I(h, `${i}[${r}].id`), k = I(h, `${i}[${r}].label`), b = Y.useRef(k);
|
|
457
451
|
return Y.useEffect(() => {
|
|
458
452
|
(b.current === P || !P) && y && g(`${i}[${r}].id`, k), b.current = k;
|
|
459
|
-
}, [k]), /* @__PURE__ */ a(
|
|
453
|
+
}, [k]), /* @__PURE__ */ a(R, { children: [
|
|
460
454
|
/* @__PURE__ */ a("div", { className: "flex w-full align-center justify-center", children: [
|
|
461
455
|
/* @__PURE__ */ e(
|
|
462
456
|
H,
|
|
@@ -465,7 +459,7 @@ const Ni = Y.memo(
|
|
|
465
459
|
as: Z,
|
|
466
460
|
className: "flex-grow",
|
|
467
461
|
required: !0,
|
|
468
|
-
disabled:
|
|
462
|
+
disabled: c,
|
|
469
463
|
size: "small",
|
|
470
464
|
autoFocus: l,
|
|
471
465
|
autoComplete: "off",
|
|
@@ -473,14 +467,14 @@ const Ni = Y.memo(
|
|
|
473
467
|
error: !!p?.label
|
|
474
468
|
}
|
|
475
469
|
),
|
|
476
|
-
!
|
|
470
|
+
!c && /* @__PURE__ */ e(Ar, { color: "error", invisible: !p?.id, children: /* @__PURE__ */ e(
|
|
477
471
|
oe,
|
|
478
472
|
{
|
|
479
473
|
size: "small",
|
|
480
474
|
"aria-label": "edit",
|
|
481
475
|
className: "m-1",
|
|
482
476
|
onClick: () => o(),
|
|
483
|
-
children: /* @__PURE__ */ e(
|
|
477
|
+
children: /* @__PURE__ */ e(Ge, { size: "small" })
|
|
484
478
|
}
|
|
485
479
|
) })
|
|
486
480
|
] }),
|
|
@@ -503,10 +497,10 @@ const Ni = Y.memo(
|
|
|
503
497
|
] });
|
|
504
498
|
},
|
|
505
499
|
function(r, n) {
|
|
506
|
-
return r.index === n.index && r.enumValuesPath === n.enumValuesPath && r.shouldUpdateId === n.shouldUpdateId && r.inferredEntry === n.inferredEntry &&
|
|
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;
|
|
507
501
|
}
|
|
508
502
|
);
|
|
509
|
-
function
|
|
503
|
+
function wi({
|
|
510
504
|
index: t,
|
|
511
505
|
open: r,
|
|
512
506
|
onClose: n,
|
|
@@ -516,12 +510,12 @@ function xi({
|
|
|
516
510
|
errors: l
|
|
517
511
|
} = K(), o = t !== void 0 ? I(l, `${i}[${t}].id`) : void 0;
|
|
518
512
|
return /* @__PURE__ */ a(
|
|
519
|
-
|
|
513
|
+
Se,
|
|
520
514
|
{
|
|
521
515
|
maxWidth: "md",
|
|
522
516
|
"aria-labelledby": "enum-edit-dialog",
|
|
523
517
|
open: r,
|
|
524
|
-
onOpenChange: (
|
|
518
|
+
onOpenChange: (c) => c ? void 0 : n(),
|
|
525
519
|
children: [
|
|
526
520
|
/* @__PURE__ */ e(Be, { children: t !== void 0 && /* @__PURE__ */ a("div", { children: [
|
|
527
521
|
/* @__PURE__ */ e(
|
|
@@ -559,17 +553,17 @@ function ce({
|
|
|
559
553
|
tooltip: i,
|
|
560
554
|
disabled: l,
|
|
561
555
|
size: o = "small",
|
|
562
|
-
allowIndeterminate:
|
|
556
|
+
allowIndeterminate: c
|
|
563
557
|
}) {
|
|
564
558
|
const u = /* @__PURE__ */ e(
|
|
565
|
-
|
|
559
|
+
dt,
|
|
566
560
|
{
|
|
567
561
|
label: n,
|
|
568
562
|
size: o,
|
|
569
563
|
position: "start",
|
|
570
564
|
value: t.value,
|
|
571
565
|
disabled: l,
|
|
572
|
-
allowIndeterminate:
|
|
566
|
+
allowIndeterminate: c,
|
|
573
567
|
onValueChange: (p) => r.setFieldValue(t.name, p)
|
|
574
568
|
}
|
|
575
569
|
);
|
|
@@ -581,22 +575,22 @@ function ce({
|
|
|
581
575
|
}
|
|
582
576
|
) : u;
|
|
583
577
|
}
|
|
584
|
-
function
|
|
578
|
+
function Fe({ disabled: t }) {
|
|
585
579
|
const { values: r, handleChange: n } = K(), i = "validation.required", l = "validation.requiredMessage";
|
|
586
|
-
return /* @__PURE__ */ a(
|
|
580
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
587
581
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
588
582
|
H,
|
|
589
583
|
{
|
|
590
584
|
name: i,
|
|
591
585
|
type: "checkbox",
|
|
592
|
-
children: ({ field:
|
|
586
|
+
children: ({ field: c, form: u }) => /* @__PURE__ */ e(
|
|
593
587
|
ce,
|
|
594
588
|
{
|
|
595
589
|
disabled: t,
|
|
596
590
|
label: "Required",
|
|
597
591
|
tooltip: "You won't be able to save this entity if this value is not set",
|
|
598
592
|
form: u,
|
|
599
|
-
field:
|
|
593
|
+
field: c
|
|
600
594
|
}
|
|
601
595
|
)
|
|
602
596
|
}
|
|
@@ -606,14 +600,14 @@ function Se({ disabled: t }) {
|
|
|
606
600
|
{
|
|
607
601
|
name: "validation.unique",
|
|
608
602
|
type: "checkbox",
|
|
609
|
-
children: ({ field:
|
|
603
|
+
children: ({ field: c, form: u }) => /* @__PURE__ */ e(
|
|
610
604
|
ce,
|
|
611
605
|
{
|
|
612
606
|
disabled: t,
|
|
613
607
|
label: "Unique",
|
|
614
608
|
tooltip: "There cannot be multiple entities with the same value",
|
|
615
609
|
form: u,
|
|
616
|
-
field:
|
|
610
|
+
field: c
|
|
617
611
|
}
|
|
618
612
|
)
|
|
619
613
|
}
|
|
@@ -638,17 +632,17 @@ function Ee({
|
|
|
638
632
|
max: i,
|
|
639
633
|
min: l,
|
|
640
634
|
trim: o,
|
|
641
|
-
uppercase:
|
|
635
|
+
uppercase: c,
|
|
642
636
|
disabled: u,
|
|
643
637
|
showErrors: p
|
|
644
638
|
}) {
|
|
645
639
|
const {
|
|
646
640
|
values: h,
|
|
647
641
|
handleChange: m,
|
|
648
|
-
errors:
|
|
649
|
-
} = 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);
|
|
650
644
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
651
|
-
/* @__PURE__ */ e(
|
|
645
|
+
/* @__PURE__ */ e(Fe, { disabled: u }),
|
|
652
646
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
|
|
653
647
|
r && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
654
648
|
H,
|
|
@@ -666,7 +660,7 @@ function Ee({
|
|
|
666
660
|
)
|
|
667
661
|
}
|
|
668
662
|
) }),
|
|
669
|
-
|
|
663
|
+
c && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
|
|
670
664
|
H,
|
|
671
665
|
{
|
|
672
666
|
name: b,
|
|
@@ -762,9 +756,9 @@ function Ot({
|
|
|
762
756
|
const {
|
|
763
757
|
values: i,
|
|
764
758
|
handleChange: l
|
|
765
|
-
} = K(), o = "validation.min",
|
|
759
|
+
} = K(), o = "validation.min", c = "validation.max";
|
|
766
760
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
767
|
-
/* @__PURE__ */ e(
|
|
761
|
+
/* @__PURE__ */ e(Fe, { disabled: n }),
|
|
768
762
|
r && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
769
763
|
Z,
|
|
770
764
|
{
|
|
@@ -780,10 +774,10 @@ function Ot({
|
|
|
780
774
|
t && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
781
775
|
Z,
|
|
782
776
|
{
|
|
783
|
-
value: I(i,
|
|
777
|
+
value: I(i, c),
|
|
784
778
|
disabled: n,
|
|
785
779
|
label: "Max length",
|
|
786
|
-
name:
|
|
780
|
+
name: c,
|
|
787
781
|
type: "number",
|
|
788
782
|
size: "small",
|
|
789
783
|
onChange: l
|
|
@@ -791,7 +785,7 @@ function Ot({
|
|
|
791
785
|
) })
|
|
792
786
|
] });
|
|
793
787
|
}
|
|
794
|
-
function
|
|
788
|
+
function xe({
|
|
795
789
|
children: t
|
|
796
790
|
}) {
|
|
797
791
|
return /* @__PURE__ */ e(
|
|
@@ -801,7 +795,7 @@ function Ne({
|
|
|
801
795
|
asField: !0,
|
|
802
796
|
className: "p-4",
|
|
803
797
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
804
|
-
/* @__PURE__ */ e(
|
|
798
|
+
/* @__PURE__ */ e(Br, {}),
|
|
805
799
|
/* @__PURE__ */ e(
|
|
806
800
|
O,
|
|
807
801
|
{
|
|
@@ -824,13 +818,13 @@ function Rt({
|
|
|
824
818
|
getData: o
|
|
825
819
|
}) {
|
|
826
820
|
const {
|
|
827
|
-
values:
|
|
821
|
+
values: c,
|
|
828
822
|
setFieldError: u,
|
|
829
823
|
setFieldValue: p
|
|
830
|
-
} = K(), h =
|
|
831
|
-
return /* @__PURE__ */ a(
|
|
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
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
832
826
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
833
|
-
|
|
827
|
+
Pi,
|
|
834
828
|
{
|
|
835
829
|
enumValues: v,
|
|
836
830
|
updateIds: r,
|
|
@@ -839,11 +833,11 @@ function Rt({
|
|
|
839
833
|
onError: (y) => {
|
|
840
834
|
u(m, y ? "This enum property is missing some values" : void 0);
|
|
841
835
|
},
|
|
842
|
-
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,
|
|
843
837
|
onValuesChanged: (y) => {
|
|
844
|
-
if (
|
|
838
|
+
if (c && (p(m, y), !t)) {
|
|
845
839
|
const P = y.filter((k) => !!k?.id).map((k) => k.id);
|
|
846
|
-
|
|
840
|
+
d && !P.includes(d) && (p("defaultValue", void 0), h.open({
|
|
847
841
|
type: "warning",
|
|
848
842
|
message: "Default value was cleared"
|
|
849
843
|
}));
|
|
@@ -851,7 +845,7 @@ function Rt({
|
|
|
851
845
|
}
|
|
852
846
|
}
|
|
853
847
|
) }),
|
|
854
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
848
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(xe, { children: [
|
|
855
849
|
!t && /* @__PURE__ */ e(
|
|
856
850
|
Ee,
|
|
857
851
|
{
|
|
@@ -862,7 +856,7 @@ function Rt({
|
|
|
862
856
|
t && /* @__PURE__ */ e(Ot, { disabled: n })
|
|
863
857
|
] }) }),
|
|
864
858
|
!t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
865
|
-
|
|
859
|
+
Ce,
|
|
866
860
|
{
|
|
867
861
|
disabled: n,
|
|
868
862
|
position: "item-aligned",
|
|
@@ -870,7 +864,7 @@ function Rt({
|
|
|
870
864
|
p("defaultValue", y);
|
|
871
865
|
},
|
|
872
866
|
label: "Default value",
|
|
873
|
-
value:
|
|
867
|
+
value: d ?? "",
|
|
874
868
|
children: v.filter((y) => !!y?.id).map((y) => /* @__PURE__ */ e(
|
|
875
869
|
ee,
|
|
876
870
|
{
|
|
@@ -883,7 +877,7 @@ function Rt({
|
|
|
883
877
|
) })
|
|
884
878
|
] });
|
|
885
879
|
}
|
|
886
|
-
const
|
|
880
|
+
const nt = {
|
|
887
881
|
"image/*": "Images",
|
|
888
882
|
"video/*": "Videos",
|
|
889
883
|
"audio/*": "Audio files",
|
|
@@ -898,15 +892,15 @@ function Ut({
|
|
|
898
892
|
const {
|
|
899
893
|
values: i,
|
|
900
894
|
setFieldValue: l
|
|
901
|
-
} = K(), o = t ? "of.storage" : "storage",
|
|
902
|
-
b ? b.includes("all") || b.length >= Object.keys(
|
|
903
|
-
}, P = typeof m == "function", k = typeof
|
|
904
|
-
return /* @__PURE__ */ a(
|
|
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
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
905
899
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
906
900
|
xt,
|
|
907
901
|
{
|
|
908
902
|
title: /* @__PURE__ */ a("div", { className: "flex flex-row text-gray-500", children: [
|
|
909
|
-
/* @__PURE__ */ e(
|
|
903
|
+
/* @__PURE__ */ e(zr, {}),
|
|
910
904
|
/* @__PURE__ */ e(
|
|
911
905
|
O,
|
|
912
906
|
{
|
|
@@ -918,16 +912,16 @@ function Ut({
|
|
|
918
912
|
] }),
|
|
919
913
|
children: /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 p-4", children: [
|
|
920
914
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
921
|
-
|
|
915
|
+
Mr,
|
|
922
916
|
{
|
|
923
917
|
disabled: n,
|
|
924
|
-
name:
|
|
918
|
+
name: c,
|
|
925
919
|
value: v ?? [],
|
|
926
920
|
onMultiValueChange: y,
|
|
927
921
|
label: x ? void 0 : "Allowed file types",
|
|
928
|
-
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(", "),
|
|
929
923
|
children: [
|
|
930
|
-
/* @__PURE__ */ a(
|
|
924
|
+
/* @__PURE__ */ a(Ft, { value: "all", className: "flex items-center gap-2", children: [
|
|
931
925
|
/* @__PURE__ */ e(
|
|
932
926
|
Et,
|
|
933
927
|
{
|
|
@@ -936,7 +930,7 @@ function Ut({
|
|
|
936
930
|
),
|
|
937
931
|
"All"
|
|
938
932
|
] }, "all"),
|
|
939
|
-
Object.entries(
|
|
933
|
+
Object.entries(nt).map(([b, C]) => /* @__PURE__ */ a(Ft, { value: b, className: "flex items-center gap-2", children: [
|
|
940
934
|
/* @__PURE__ */ e(
|
|
941
935
|
Et,
|
|
942
936
|
{
|
|
@@ -949,7 +943,7 @@ function Ut({
|
|
|
949
943
|
{
|
|
950
944
|
size: "small",
|
|
951
945
|
variant: "outlined",
|
|
952
|
-
onClick: (N) => (N.preventDefault(), N.stopPropagation(), l(
|
|
946
|
+
onClick: (N) => (N.preventDefault(), N.stopPropagation(), l(c, [b])),
|
|
953
947
|
children: "Only"
|
|
954
948
|
}
|
|
955
949
|
)
|
|
@@ -977,7 +971,7 @@ function Ut({
|
|
|
977
971
|
label: "Storage path",
|
|
978
972
|
disabled: k || n,
|
|
979
973
|
size: "small",
|
|
980
|
-
value: k ? "-" :
|
|
974
|
+
value: k ? "-" : d
|
|
981
975
|
}
|
|
982
976
|
),
|
|
983
977
|
/* @__PURE__ */ a(O, { variant: "caption", className: "ml-3.5 mt-1 mb-2", children: [
|
|
@@ -1013,8 +1007,8 @@ function Ut({
|
|
|
1013
1007
|
] })
|
|
1014
1008
|
}
|
|
1015
1009
|
) }),
|
|
1016
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
1017
|
-
!t && /* @__PURE__ */ e("div", { className: "grid grid-cols-12 gap-2", children: /* @__PURE__ */ e(
|
|
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(Fe, { disabled: n }) }),
|
|
1018
1012
|
t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ot, { disabled: n }) })
|
|
1019
1013
|
] }) })
|
|
1020
1014
|
] });
|
|
@@ -1027,14 +1021,14 @@ function qe(t) {
|
|
|
1027
1021
|
return r.dataType === "array" && typeof r.of == "function" || r.dataType === "array" && Array.isArray(r.of) ? !1 : !!r.editable;
|
|
1028
1022
|
}
|
|
1029
1023
|
}
|
|
1030
|
-
function
|
|
1024
|
+
function Ti(t) {
|
|
1031
1025
|
return Object.entries(t).filter(([r, n]) => qe(n)).map(([r, n]) => {
|
|
1032
1026
|
const i = n;
|
|
1033
1027
|
if (qe(i))
|
|
1034
1028
|
return i.dataType === "map" && i.properties ? {
|
|
1035
1029
|
[r]: {
|
|
1036
1030
|
...i,
|
|
1037
|
-
properties:
|
|
1031
|
+
properties: Ti(i.properties)
|
|
1038
1032
|
}
|
|
1039
1033
|
} : { [r]: i };
|
|
1040
1034
|
}).filter((r) => !!r).reduce((r, n) => ({ ...r, ...n }), {});
|
|
@@ -1047,10 +1041,10 @@ function nr({
|
|
|
1047
1041
|
includeEditButton: l,
|
|
1048
1042
|
selected: o
|
|
1049
1043
|
}) {
|
|
1050
|
-
const { propertyConfigs:
|
|
1044
|
+
const { propertyConfigs: c } = Ae(), u = $e(t, c);
|
|
1051
1045
|
qe(t);
|
|
1052
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";
|
|
1053
|
-
return n && console.log("PropertyFieldPreview", t), /* @__PURE__ */ e(
|
|
1047
|
+
return n && console.log("PropertyFieldPreview", t), /* @__PURE__ */ e(me, { children: /* @__PURE__ */ a(
|
|
1054
1048
|
"div",
|
|
1055
1049
|
{
|
|
1056
1050
|
onClick: r,
|
|
@@ -1058,9 +1052,9 @@ function nr({
|
|
|
1058
1052
|
children: [
|
|
1059
1053
|
/* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(Ye, { propertyConfig: u }) }),
|
|
1060
1054
|
/* @__PURE__ */ a(
|
|
1061
|
-
|
|
1055
|
+
Pe,
|
|
1062
1056
|
{
|
|
1063
|
-
className:
|
|
1057
|
+
className: fe(
|
|
1064
1058
|
"border",
|
|
1065
1059
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1066
1060
|
Qt,
|
|
@@ -1071,7 +1065,7 @@ function nr({
|
|
|
1071
1065
|
),
|
|
1072
1066
|
children: [
|
|
1073
1067
|
/* @__PURE__ */ a("div", { className: "w-full flex flex-col", children: [
|
|
1074
|
-
i && /* @__PURE__ */ e(
|
|
1068
|
+
i && /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
1075
1069
|
O,
|
|
1076
1070
|
{
|
|
1077
1071
|
variant: "body1",
|
|
@@ -1081,7 +1075,7 @@ function nr({
|
|
|
1081
1075
|
}
|
|
1082
1076
|
) }),
|
|
1083
1077
|
/* @__PURE__ */ a("div", { className: "flex flex-row items-center", children: [
|
|
1084
|
-
/* @__PURE__ */ e(
|
|
1078
|
+
/* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
1085
1079
|
O,
|
|
1086
1080
|
{
|
|
1087
1081
|
className: "flex-grow pr-2",
|
|
@@ -1091,7 +1085,7 @@ function nr({
|
|
|
1091
1085
|
children: u?.name
|
|
1092
1086
|
}
|
|
1093
1087
|
) }),
|
|
1094
|
-
/* @__PURE__ */ e(
|
|
1088
|
+
/* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
1095
1089
|
O,
|
|
1096
1090
|
{
|
|
1097
1091
|
variant: "body2",
|
|
@@ -1110,7 +1104,7 @@ function nr({
|
|
|
1110
1104
|
}
|
|
1111
1105
|
) });
|
|
1112
1106
|
}
|
|
1113
|
-
function
|
|
1107
|
+
function ki({
|
|
1114
1108
|
name: t,
|
|
1115
1109
|
selected: r,
|
|
1116
1110
|
onClick: n,
|
|
@@ -1129,15 +1123,15 @@ function Ti({
|
|
|
1129
1123
|
"div",
|
|
1130
1124
|
{
|
|
1131
1125
|
className: "h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500",
|
|
1132
|
-
children: /* @__PURE__ */ e(
|
|
1126
|
+
children: /* @__PURE__ */ e(Rr, { color: "inherit", size: "medium" })
|
|
1133
1127
|
}
|
|
1134
1128
|
),
|
|
1135
|
-
/* @__PURE__ */ e(
|
|
1129
|
+
/* @__PURE__ */ e(Ur, { color: "disabled", size: "small", className: "absolute -right-2 -top-2" })
|
|
1136
1130
|
] }),
|
|
1137
1131
|
/* @__PURE__ */ e(
|
|
1138
|
-
|
|
1132
|
+
Pe,
|
|
1139
1133
|
{
|
|
1140
|
-
className:
|
|
1134
|
+
className: fe(
|
|
1141
1135
|
"pl-2 w-full flex flex-row gap-4 items-center",
|
|
1142
1136
|
Qt,
|
|
1143
1137
|
n ? Xt : "",
|
|
@@ -1166,7 +1160,7 @@ function Ti({
|
|
|
1166
1160
|
children: o?.name
|
|
1167
1161
|
}
|
|
1168
1162
|
),
|
|
1169
|
-
i && !ne(i) && /* @__PURE__ */ e(
|
|
1163
|
+
i && !ne(i) && /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
1170
1164
|
O,
|
|
1171
1165
|
{
|
|
1172
1166
|
variant: "body2",
|
|
@@ -1175,7 +1169,7 @@ function Ti({
|
|
|
1175
1169
|
children: i.dataType
|
|
1176
1170
|
}
|
|
1177
1171
|
) }),
|
|
1178
|
-
i && ne(i) && /* @__PURE__ */ e(
|
|
1172
|
+
i && ne(i) && /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
1179
1173
|
O,
|
|
1180
1174
|
{
|
|
1181
1175
|
variant: "body2",
|
|
@@ -1184,7 +1178,7 @@ function Ti({
|
|
|
1184
1178
|
children: "This property is defined as a property builder in code"
|
|
1185
1179
|
}
|
|
1186
1180
|
) }),
|
|
1187
|
-
!i && /* @__PURE__ */ e(
|
|
1181
|
+
!i && /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
1188
1182
|
O,
|
|
1189
1183
|
{
|
|
1190
1184
|
variant: "body2",
|
|
@@ -1208,12 +1202,12 @@ const ft = Y.memo(
|
|
|
1208
1202
|
onPropertyClick: i,
|
|
1209
1203
|
properties: l,
|
|
1210
1204
|
propertiesOrder: o,
|
|
1211
|
-
additionalFields:
|
|
1205
|
+
additionalFields: c,
|
|
1212
1206
|
errors: u,
|
|
1213
1207
|
onPropertyMove: p,
|
|
1214
1208
|
onPropertyRemove: h,
|
|
1215
1209
|
className: m,
|
|
1216
|
-
inferredPropertyKeys:
|
|
1210
|
+
inferredPropertyKeys: d,
|
|
1217
1211
|
collectionEditable: g
|
|
1218
1212
|
}) {
|
|
1219
1213
|
const v = o ?? Object.keys(l), x = Q((y) => {
|
|
@@ -1222,7 +1216,7 @@ const ft = Y.memo(
|
|
|
1222
1216
|
const P = y.source.index, k = y.destination.index, b = Array.from(v), [C] = b.splice(P, 1);
|
|
1223
1217
|
b.splice(k, 0, C), p && p(b, r);
|
|
1224
1218
|
}, [r, p, v]);
|
|
1225
|
-
return /* @__PURE__ */ e(
|
|
1219
|
+
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(ni, { onDragEnd: x, children: /* @__PURE__ */ e(ai, { droppableId: `droppable_${r}`, children: (y, P) => /* @__PURE__ */ a(
|
|
1226
1220
|
"div",
|
|
1227
1221
|
{
|
|
1228
1222
|
...y.droppableProps,
|
|
@@ -1230,14 +1224,14 @@ const ft = Y.memo(
|
|
|
1230
1224
|
className: m,
|
|
1231
1225
|
children: [
|
|
1232
1226
|
v && v.map((k, b) => {
|
|
1233
|
-
const C = l[k], N =
|
|
1227
|
+
const C = l[k], N = c?.find((f) => f.key === k);
|
|
1234
1228
|
return !C && !N ? (console.warn(`Property ${k} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
|
|
1235
|
-
|
|
1229
|
+
oi,
|
|
1236
1230
|
{
|
|
1237
1231
|
draggableId: `array_field_${r}_${k}}`,
|
|
1238
1232
|
index: b,
|
|
1239
|
-
children: (f, w) => /* @__PURE__ */ e(
|
|
1240
|
-
|
|
1233
|
+
children: (f, w) => /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
1234
|
+
Oi,
|
|
1241
1235
|
{
|
|
1242
1236
|
propertyKey: k,
|
|
1243
1237
|
propertyOrBuilder: C,
|
|
@@ -1245,7 +1239,7 @@ const ft = Y.memo(
|
|
|
1245
1239
|
provided: f,
|
|
1246
1240
|
errors: u,
|
|
1247
1241
|
namespace: r,
|
|
1248
|
-
inferredPropertyKeys:
|
|
1242
|
+
inferredPropertyKeys: d,
|
|
1249
1243
|
onPropertyMove: p,
|
|
1250
1244
|
onPropertyRemove: h,
|
|
1251
1245
|
onPropertyClick: w.isDragging ? void 0 : i,
|
|
@@ -1264,26 +1258,26 @@ const ft = Y.memo(
|
|
|
1264
1258
|
},
|
|
1265
1259
|
(t, r) => {
|
|
1266
1260
|
const n = r.selectedPropertyKey?.startsWith(r.namespace ?? ""), i = t.selectedPropertyKey?.startsWith(t.namespace ?? "");
|
|
1267
|
-
return n || i ? !1 :
|
|
1261
|
+
return n || i ? !1 : ye(t.properties, r.properties) && t.propertiesOrder === r.propertiesOrder && ye(t.additionalFields, r.additionalFields) && ye(t.errors, r.errors) && ye(t.onPropertyClick, r.onPropertyClick) && // equal(prevProps.onPropertyMove, nextProps.onPropertyMove) &&
|
|
1268
1262
|
// equal(prevProps.onPropertyRemove, nextProps.onPropertyRemove) &&
|
|
1269
1263
|
t.namespace === r.namespace && t.collectionEditable === r.collectionEditable;
|
|
1270
1264
|
}
|
|
1271
1265
|
);
|
|
1272
|
-
function
|
|
1266
|
+
function Oi({
|
|
1273
1267
|
propertyKey: t,
|
|
1274
1268
|
namespace: r,
|
|
1275
1269
|
propertyOrBuilder: n,
|
|
1276
1270
|
additionalField: i,
|
|
1277
1271
|
provided: l,
|
|
1278
1272
|
selectedPropertyKey: o,
|
|
1279
|
-
errors:
|
|
1273
|
+
errors: c,
|
|
1280
1274
|
onPropertyClick: u,
|
|
1281
1275
|
onPropertyMove: p,
|
|
1282
1276
|
onPropertyRemove: h,
|
|
1283
1277
|
inferredPropertyKeys: m,
|
|
1284
|
-
collectionEditable:
|
|
1278
|
+
collectionEditable: d
|
|
1285
1279
|
}) {
|
|
1286
|
-
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;
|
|
1287
1281
|
let P;
|
|
1288
1282
|
if (typeof n == "object") {
|
|
1289
1283
|
const C = n;
|
|
@@ -1294,15 +1288,15 @@ function ki({
|
|
|
1294
1288
|
namespace: v,
|
|
1295
1289
|
properties: C.properties,
|
|
1296
1290
|
propertiesOrder: C.propertiesOrder,
|
|
1297
|
-
errors:
|
|
1291
|
+
errors: c,
|
|
1298
1292
|
onPropertyClick: u,
|
|
1299
1293
|
onPropertyMove: p,
|
|
1300
1294
|
onPropertyRemove: h,
|
|
1301
|
-
collectionEditable:
|
|
1295
|
+
collectionEditable: d
|
|
1302
1296
|
}
|
|
1303
1297
|
));
|
|
1304
1298
|
}
|
|
1305
|
-
const k = o === v, b = n && (
|
|
1299
|
+
const k = o === v, b = n && (d && !ne(n) || qe(n));
|
|
1306
1300
|
return /* @__PURE__ */ a(
|
|
1307
1301
|
"div",
|
|
1308
1302
|
{
|
|
@@ -1332,7 +1326,7 @@ function ki({
|
|
|
1332
1326
|
hasError: y
|
|
1333
1327
|
}
|
|
1334
1328
|
) : /* @__PURE__ */ e(
|
|
1335
|
-
|
|
1329
|
+
ki,
|
|
1336
1330
|
{
|
|
1337
1331
|
name: t,
|
|
1338
1332
|
property: n,
|
|
@@ -1348,7 +1342,7 @@ function ki({
|
|
|
1348
1342
|
size: "small",
|
|
1349
1343
|
color: "inherit",
|
|
1350
1344
|
onClick: () => h(t, r),
|
|
1351
|
-
children: /* @__PURE__ */ e(
|
|
1345
|
+
children: /* @__PURE__ */ e(jr, { size: "small" })
|
|
1352
1346
|
}
|
|
1353
1347
|
) }),
|
|
1354
1348
|
p && /* @__PURE__ */ e(te, { title: "Move", children: /* @__PURE__ */ e(
|
|
@@ -1356,7 +1350,7 @@ function ki({
|
|
|
1356
1350
|
{
|
|
1357
1351
|
component: "span",
|
|
1358
1352
|
size: "small",
|
|
1359
|
-
children: /* @__PURE__ */ e(
|
|
1353
|
+
children: /* @__PURE__ */ e(Lr, { size: "small" })
|
|
1360
1354
|
}
|
|
1361
1355
|
) })
|
|
1362
1356
|
] }),
|
|
@@ -1365,32 +1359,32 @@ function ki({
|
|
|
1365
1359
|
}
|
|
1366
1360
|
);
|
|
1367
1361
|
}
|
|
1368
|
-
function
|
|
1362
|
+
function Vi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i, collectionEditable: l }) {
|
|
1369
1363
|
const {
|
|
1370
1364
|
values: o,
|
|
1371
|
-
setFieldValue:
|
|
1372
|
-
} = K(), [u, p] = $(!1), [h, m] = $(), [
|
|
1365
|
+
setFieldValue: c
|
|
1366
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [d, g] = $(), v = o.propertiesOrder ?? Object.keys(o.properties ?? {}), x = ({
|
|
1373
1367
|
id: N,
|
|
1374
1368
|
property: f
|
|
1375
1369
|
}) => {
|
|
1376
1370
|
if (!N)
|
|
1377
1371
|
throw Error();
|
|
1378
|
-
|
|
1372
|
+
c("properties", {
|
|
1379
1373
|
...o.properties ?? {},
|
|
1380
1374
|
[N]: f
|
|
1381
1375
|
}, !1);
|
|
1382
1376
|
const w = o.propertiesOrder ?? Object.keys(o.properties ?? {}), _ = w.includes(N) ? w : [...w, N];
|
|
1383
|
-
|
|
1377
|
+
c("propertiesOrder", _, !1), p(!1);
|
|
1384
1378
|
}, y = Q((N, f) => {
|
|
1385
1379
|
const w = N ? ae(N, f) : void 0;
|
|
1386
1380
|
if (!w)
|
|
1387
1381
|
throw Error("collection editor miss config");
|
|
1388
|
-
const _ =
|
|
1389
|
-
|
|
1390
|
-
}, [
|
|
1391
|
-
|
|
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);
|
|
1392
1386
|
}, []);
|
|
1393
|
-
return /* @__PURE__ */ a(
|
|
1387
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
1394
1388
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1395
1389
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end my-4", children: [
|
|
1396
1390
|
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Properties in this group" }),
|
|
@@ -1408,7 +1402,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1408
1402
|
}
|
|
1409
1403
|
)
|
|
1410
1404
|
] }),
|
|
1411
|
-
/* @__PURE__ */ a(
|
|
1405
|
+
/* @__PURE__ */ a(Pe, { className: "p-2 pl-8", children: [
|
|
1412
1406
|
/* @__PURE__ */ e(
|
|
1413
1407
|
ft,
|
|
1414
1408
|
{
|
|
@@ -1434,19 +1428,19 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1434
1428
|
] }),
|
|
1435
1429
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1436
1430
|
/* @__PURE__ */ e(
|
|
1437
|
-
|
|
1431
|
+
dt,
|
|
1438
1432
|
{
|
|
1439
1433
|
position: "start",
|
|
1440
1434
|
size: "small",
|
|
1441
1435
|
label: "Spread children as columns",
|
|
1442
|
-
onValueChange: (N) =>
|
|
1436
|
+
onValueChange: (N) => c("spreadChildren", N),
|
|
1443
1437
|
value: o.spreadChildren ?? !1
|
|
1444
1438
|
}
|
|
1445
1439
|
),
|
|
1446
1440
|
/* @__PURE__ */ e(X, { children: "Set this flag to true if you want to display the children of this group as individual columns." })
|
|
1447
1441
|
] }),
|
|
1448
1442
|
/* @__PURE__ */ e(
|
|
1449
|
-
|
|
1443
|
+
Ie,
|
|
1450
1444
|
{
|
|
1451
1445
|
inArray: !1,
|
|
1452
1446
|
forceShowErrors: !1,
|
|
@@ -1462,7 +1456,7 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1462
1456
|
getData: r,
|
|
1463
1457
|
onDelete: y,
|
|
1464
1458
|
propertyKey: h,
|
|
1465
|
-
propertyNamespace:
|
|
1459
|
+
propertyNamespace: d,
|
|
1466
1460
|
property: k,
|
|
1467
1461
|
existingProperty: !!h,
|
|
1468
1462
|
autoUpdateId: !h,
|
|
@@ -1474,25 +1468,25 @@ function Oi({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1474
1468
|
)
|
|
1475
1469
|
] });
|
|
1476
1470
|
}
|
|
1477
|
-
function
|
|
1471
|
+
function Ii({
|
|
1478
1472
|
showErrors: t,
|
|
1479
1473
|
existing: r,
|
|
1480
1474
|
disabled: n,
|
|
1481
1475
|
getData: i,
|
|
1482
1476
|
allowDataInference: l,
|
|
1483
1477
|
propertyConfigs: o,
|
|
1484
|
-
collectionEditable:
|
|
1478
|
+
collectionEditable: c
|
|
1485
1479
|
}) {
|
|
1486
1480
|
const {
|
|
1487
1481
|
values: u,
|
|
1488
1482
|
handleChange: p,
|
|
1489
1483
|
errors: h,
|
|
1490
1484
|
setFieldValue: m,
|
|
1491
|
-
touched:
|
|
1492
|
-
} = K(), [g, v] = $(!1), x = I(u, "of"), y = 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 }) => {
|
|
1493
1487
|
console.log("onPropertyChanged", b, C, N), m("of", C);
|
|
1494
1488
|
}, k = x && $e(x, o);
|
|
1495
|
-
return /* @__PURE__ */ a(
|
|
1489
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
1496
1490
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1497
1491
|
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Repeat component" }),
|
|
1498
1492
|
/* @__PURE__ */ e(
|
|
@@ -1500,7 +1494,7 @@ function Vi({
|
|
|
1500
1494
|
{
|
|
1501
1495
|
name: "of",
|
|
1502
1496
|
value: x,
|
|
1503
|
-
children: ({}) => /* @__PURE__ */ a(
|
|
1497
|
+
children: ({}) => /* @__PURE__ */ a(Pe, { className: "p-2 mt-4", children: [
|
|
1504
1498
|
x && /* @__PURE__ */ e(
|
|
1505
1499
|
nr,
|
|
1506
1500
|
{
|
|
@@ -1526,7 +1520,7 @@ function Vi({
|
|
|
1526
1520
|
}
|
|
1527
1521
|
),
|
|
1528
1522
|
/* @__PURE__ */ e(
|
|
1529
|
-
|
|
1523
|
+
Ie,
|
|
1530
1524
|
{
|
|
1531
1525
|
inArray: !0,
|
|
1532
1526
|
open: g,
|
|
@@ -1541,30 +1535,30 @@ function Vi({
|
|
|
1541
1535
|
onPropertyChanged: P,
|
|
1542
1536
|
forceShowErrors: t,
|
|
1543
1537
|
propertyConfigs: o,
|
|
1544
|
-
collectionEditable:
|
|
1538
|
+
collectionEditable: c
|
|
1545
1539
|
}
|
|
1546
1540
|
)
|
|
1547
1541
|
] })
|
|
1548
1542
|
}
|
|
1549
1543
|
)
|
|
1550
1544
|
] }),
|
|
1551
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1545
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Ot, { disabled: n }) }) })
|
|
1552
1546
|
] });
|
|
1553
1547
|
}
|
|
1554
|
-
const
|
|
1548
|
+
const _i = Y.forwardRef(
|
|
1555
1549
|
function({
|
|
1556
1550
|
showErrors: r,
|
|
1557
1551
|
disabledId: n,
|
|
1558
1552
|
disabled: i,
|
|
1559
1553
|
autoUpdateId: l,
|
|
1560
1554
|
isNewProperty: o
|
|
1561
|
-
},
|
|
1555
|
+
}, c) {
|
|
1562
1556
|
const {
|
|
1563
1557
|
errors: u,
|
|
1564
1558
|
values: p,
|
|
1565
1559
|
setFieldValue: h,
|
|
1566
1560
|
setFieldTouched: m,
|
|
1567
|
-
touched:
|
|
1561
|
+
touched: d,
|
|
1568
1562
|
validate: g
|
|
1569
1563
|
} = K(), v = "name", x = r && I(u, v), y = "id", P = r && I(u, y), k = "description", b = r && I(u, k);
|
|
1570
1564
|
return /* @__PURE__ */ a("div", { className: "flex flex-col gap-2 col-span-12", children: [
|
|
@@ -1573,12 +1567,12 @@ const Ii = Y.forwardRef(
|
|
|
1573
1567
|
H,
|
|
1574
1568
|
{
|
|
1575
1569
|
name: v,
|
|
1576
|
-
inputRef:
|
|
1570
|
+
inputRef: c,
|
|
1577
1571
|
as: Z,
|
|
1578
1572
|
value: p[v],
|
|
1579
1573
|
onChange: (C) => {
|
|
1580
1574
|
const N = C.target.value;
|
|
1581
|
-
!I(
|
|
1575
|
+
!I(d, y) && l && h(y, N ? Pt(N) : "", !1), h(v, N, !0), m(v, !0);
|
|
1582
1576
|
},
|
|
1583
1577
|
style: { fontSize: 20 },
|
|
1584
1578
|
placeholder: "Field name",
|
|
@@ -1599,7 +1593,7 @@ const Ii = Y.forwardRef(
|
|
|
1599
1593
|
value: p[y],
|
|
1600
1594
|
onChange: (C) => {
|
|
1601
1595
|
const N = C.target.value;
|
|
1602
|
-
!I(
|
|
1596
|
+
!I(d, v) && l && h(v, N ? pt(N) : ""), h(y, N, !0), m(y, !0);
|
|
1603
1597
|
},
|
|
1604
1598
|
disabled: n || i,
|
|
1605
1599
|
required: !0,
|
|
@@ -1625,14 +1619,14 @@ const Ii = Y.forwardRef(
|
|
|
1625
1619
|
] });
|
|
1626
1620
|
}
|
|
1627
1621
|
);
|
|
1628
|
-
function
|
|
1622
|
+
function Si({
|
|
1629
1623
|
widgetId: t,
|
|
1630
1624
|
disabled: r,
|
|
1631
1625
|
showErrors: n
|
|
1632
1626
|
}) {
|
|
1633
1627
|
const { values: i, setFieldValue: l } = K();
|
|
1634
|
-
return /* @__PURE__ */ a(
|
|
1635
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
1628
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
1629
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(xe, { children: [
|
|
1636
1630
|
t === "text_field" && /* @__PURE__ */ e(
|
|
1637
1631
|
Ee,
|
|
1638
1632
|
{
|
|
@@ -1685,7 +1679,7 @@ function _i({
|
|
|
1685
1679
|
)
|
|
1686
1680
|
] }) }),
|
|
1687
1681
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1688
|
-
|
|
1682
|
+
Ve,
|
|
1689
1683
|
{
|
|
1690
1684
|
name: "defaultValue",
|
|
1691
1685
|
disabled: r,
|
|
@@ -1700,8 +1694,8 @@ function _i({
|
|
|
1700
1694
|
}
|
|
1701
1695
|
function Fi({ disabled: t }) {
|
|
1702
1696
|
const { values: r } = K(), n = I(r, "defaultValue");
|
|
1703
|
-
return /* @__PURE__ */ a(
|
|
1704
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1697
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
1698
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Fe, { disabled: t }) }) }),
|
|
1705
1699
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1706
1700
|
H,
|
|
1707
1701
|
{
|
|
@@ -1720,30 +1714,30 @@ function Fi({ disabled: t }) {
|
|
|
1720
1714
|
) })
|
|
1721
1715
|
] });
|
|
1722
1716
|
}
|
|
1723
|
-
function
|
|
1717
|
+
function Ei({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i, collectionEditable: l }) {
|
|
1724
1718
|
const {
|
|
1725
1719
|
values: o,
|
|
1726
|
-
setFieldValue:
|
|
1727
|
-
} = K(), [u, p] = $(!1), [h, m] = $(), [
|
|
1720
|
+
setFieldValue: c
|
|
1721
|
+
} = K(), [u, p] = $(!1), [h, m] = $(), [d, g] = $(), v = ({
|
|
1728
1722
|
id: C,
|
|
1729
1723
|
property: N
|
|
1730
1724
|
}) => {
|
|
1731
1725
|
if (!C)
|
|
1732
1726
|
throw Error();
|
|
1733
|
-
|
|
1727
|
+
c("oneOf.properties", {
|
|
1734
1728
|
...o.oneOf?.properties ?? {},
|
|
1735
1729
|
[C]: N
|
|
1736
1730
|
}, !1);
|
|
1737
1731
|
const f = o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), w = f.includes(C) ? f : [...f, C];
|
|
1738
|
-
|
|
1739
|
-
}, 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) => {
|
|
1740
1734
|
const f = C ? ae(C, N) : void 0;
|
|
1741
1735
|
if (!f)
|
|
1742
1736
|
throw Error("collection editor miss config");
|
|
1743
|
-
|
|
1744
|
-
const w = `oneOf.${
|
|
1745
|
-
|
|
1746
|
-
}, [
|
|
1737
|
+
c(`oneOf.${he(f)}`, void 0, !1);
|
|
1738
|
+
const w = `oneOf.${be(N)}`, _ = I(o, w);
|
|
1739
|
+
c(w, _.filter((M) => M !== C), !1), p(!1), m(void 0), g(void 0);
|
|
1740
|
+
}, [c, o]), k = /* @__PURE__ */ a(
|
|
1747
1741
|
z,
|
|
1748
1742
|
{
|
|
1749
1743
|
autoFocus: !0,
|
|
@@ -1756,15 +1750,15 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1756
1750
|
]
|
|
1757
1751
|
}
|
|
1758
1752
|
), b = Q((C, N) => {
|
|
1759
|
-
|
|
1753
|
+
c(`oneOf.${be(N)}`, C, !1);
|
|
1760
1754
|
}, []);
|
|
1761
|
-
return /* @__PURE__ */ a(
|
|
1755
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
1762
1756
|
/* @__PURE__ */ a("div", { className: "col-span-12", children: [
|
|
1763
1757
|
/* @__PURE__ */ a("div", { className: "flex justify-between items-end mt-8 mb-4", children: [
|
|
1764
1758
|
/* @__PURE__ */ e(O, { variant: "subtitle2", children: "Properties in this block" }),
|
|
1765
1759
|
k
|
|
1766
1760
|
] }),
|
|
1767
|
-
/* @__PURE__ */ a(
|
|
1761
|
+
/* @__PURE__ */ a(Pe, { className: "p-2 pl-8", children: [
|
|
1768
1762
|
/* @__PURE__ */ e(
|
|
1769
1763
|
ft,
|
|
1770
1764
|
{
|
|
@@ -1782,7 +1776,7 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1782
1776
|
] })
|
|
1783
1777
|
] }),
|
|
1784
1778
|
!t && /* @__PURE__ */ e(
|
|
1785
|
-
|
|
1779
|
+
Ie,
|
|
1786
1780
|
{
|
|
1787
1781
|
inArray: !1,
|
|
1788
1782
|
forceShowErrors: !1,
|
|
@@ -1798,7 +1792,7 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1798
1792
|
collectionEditable: l,
|
|
1799
1793
|
onDelete: P,
|
|
1800
1794
|
propertyKey: h,
|
|
1801
|
-
propertyNamespace:
|
|
1795
|
+
propertyNamespace: d,
|
|
1802
1796
|
property: y,
|
|
1803
1797
|
existingProperty: !!h,
|
|
1804
1798
|
autoUpdateId: !h,
|
|
@@ -1810,13 +1804,13 @@ function Si({ disabled: t, getData: r, allowDataInference: n, propertyConfigs: i
|
|
|
1810
1804
|
)
|
|
1811
1805
|
] });
|
|
1812
1806
|
}
|
|
1813
|
-
function
|
|
1807
|
+
function Ai({ disabled: t }) {
|
|
1814
1808
|
const {
|
|
1815
1809
|
values: r,
|
|
1816
1810
|
handleChange: n
|
|
1817
|
-
} = K(), i = "validation.min", l = "validation.max", o = "validation.lessThan",
|
|
1811
|
+
} = K(), i = "validation.min", l = "validation.max", o = "validation.lessThan", c = "validation.moreThan";
|
|
1818
1812
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
1819
|
-
/* @__PURE__ */ e(
|
|
1813
|
+
/* @__PURE__ */ e(Fe, { disabled: t }),
|
|
1820
1814
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1821
1815
|
Z,
|
|
1822
1816
|
{
|
|
@@ -1856,9 +1850,9 @@ function Ei({ disabled: t }) {
|
|
|
1856
1850
|
/* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
|
|
1857
1851
|
Z,
|
|
1858
1852
|
{
|
|
1859
|
-
value: I(r,
|
|
1853
|
+
value: I(r, c),
|
|
1860
1854
|
label: "More than",
|
|
1861
|
-
name:
|
|
1855
|
+
name: c,
|
|
1862
1856
|
type: "number",
|
|
1863
1857
|
size: "small",
|
|
1864
1858
|
disabled: t,
|
|
@@ -1870,12 +1864,12 @@ function Ei({ disabled: t }) {
|
|
|
1870
1864
|
{
|
|
1871
1865
|
name: "validation.positive",
|
|
1872
1866
|
type: "checkbox",
|
|
1873
|
-
children: ({ field: m, form:
|
|
1867
|
+
children: ({ field: m, form: d }) => /* @__PURE__ */ e(
|
|
1874
1868
|
ce,
|
|
1875
1869
|
{
|
|
1876
1870
|
label: "Positive value",
|
|
1877
1871
|
disabled: t,
|
|
1878
|
-
form:
|
|
1872
|
+
form: d,
|
|
1879
1873
|
field: m
|
|
1880
1874
|
}
|
|
1881
1875
|
)
|
|
@@ -1886,12 +1880,12 @@ function Ei({ disabled: t }) {
|
|
|
1886
1880
|
{
|
|
1887
1881
|
name: "validation.negative",
|
|
1888
1882
|
type: "checkbox",
|
|
1889
|
-
children: ({ field: m, form:
|
|
1883
|
+
children: ({ field: m, form: d }) => /* @__PURE__ */ e(
|
|
1890
1884
|
ce,
|
|
1891
1885
|
{
|
|
1892
1886
|
label: "Negative value",
|
|
1893
1887
|
disabled: t,
|
|
1894
|
-
form:
|
|
1888
|
+
form: d,
|
|
1895
1889
|
field: m
|
|
1896
1890
|
}
|
|
1897
1891
|
)
|
|
@@ -1902,12 +1896,12 @@ function Ei({ disabled: t }) {
|
|
|
1902
1896
|
{
|
|
1903
1897
|
name: "validation.integer",
|
|
1904
1898
|
type: "checkbox",
|
|
1905
|
-
children: ({ field: m, form:
|
|
1899
|
+
children: ({ field: m, form: d }) => /* @__PURE__ */ e(
|
|
1906
1900
|
ce,
|
|
1907
1901
|
{
|
|
1908
1902
|
label: "Integer value",
|
|
1909
1903
|
disabled: t,
|
|
1910
|
-
form:
|
|
1904
|
+
form: d,
|
|
1911
1905
|
field: m
|
|
1912
1906
|
}
|
|
1913
1907
|
)
|
|
@@ -1915,12 +1909,12 @@ function Ei({ disabled: t }) {
|
|
|
1915
1909
|
) })
|
|
1916
1910
|
] });
|
|
1917
1911
|
}
|
|
1918
|
-
function
|
|
1912
|
+
function Di({ disabled: t }) {
|
|
1919
1913
|
const { values: r, setFieldValue: n } = K();
|
|
1920
|
-
return /* @__PURE__ */ a(
|
|
1921
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1914
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
1915
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Ai, { disabled: t }) }) }),
|
|
1922
1916
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1923
|
-
|
|
1917
|
+
Ve,
|
|
1924
1918
|
{
|
|
1925
1919
|
name: "defaultValue",
|
|
1926
1920
|
disabled: t,
|
|
@@ -1943,12 +1937,12 @@ function jt({
|
|
|
1943
1937
|
const {
|
|
1944
1938
|
values: l,
|
|
1945
1939
|
handleChange: o,
|
|
1946
|
-
errors:
|
|
1940
|
+
errors: c
|
|
1947
1941
|
} = K();
|
|
1948
|
-
if (!
|
|
1942
|
+
if (!Ne())
|
|
1949
1943
|
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(De, {}) });
|
|
1950
|
-
const p = r ? "of.path" : "path", h = I(l, p), m = i && I(
|
|
1951
|
-
return /* @__PURE__ */ e(
|
|
1944
|
+
const p = r ? "of.path" : "path", h = I(l, p), m = i && I(c, p);
|
|
1945
|
+
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
1952
1946
|
H,
|
|
1953
1947
|
{
|
|
1954
1948
|
name: p,
|
|
@@ -1958,11 +1952,11 @@ function jt({
|
|
|
1958
1952
|
value: h,
|
|
1959
1953
|
error: m,
|
|
1960
1954
|
handleChange: o,
|
|
1961
|
-
as:
|
|
1955
|
+
as: Bi
|
|
1962
1956
|
}
|
|
1963
1957
|
) }) });
|
|
1964
1958
|
}
|
|
1965
|
-
function
|
|
1959
|
+
function Bi({
|
|
1966
1960
|
disabled: t,
|
|
1967
1961
|
pathPath: r,
|
|
1968
1962
|
value: n,
|
|
@@ -1970,15 +1964,15 @@ function Di({
|
|
|
1970
1964
|
error: l,
|
|
1971
1965
|
...o
|
|
1972
1966
|
}) {
|
|
1973
|
-
const
|
|
1974
|
-
if (!
|
|
1967
|
+
const c = Ne();
|
|
1968
|
+
if (!c)
|
|
1975
1969
|
return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(De, {}) });
|
|
1976
|
-
const u =
|
|
1970
|
+
const u = c?.collections ?? [], p = Array.from(new Set(
|
|
1977
1971
|
Object.values(u).map((m) => m.group).filter(Boolean)
|
|
1978
1972
|
).values()), h = u.filter((m) => !m.group);
|
|
1979
|
-
return /* @__PURE__ */ a(
|
|
1973
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
1980
1974
|
/* @__PURE__ */ a(
|
|
1981
|
-
|
|
1975
|
+
Ce,
|
|
1982
1976
|
{
|
|
1983
1977
|
error: !!l,
|
|
1984
1978
|
disabled: t,
|
|
@@ -1988,15 +1982,15 @@ function Di({
|
|
|
1988
1982
|
onChange: i,
|
|
1989
1983
|
label: "Target collection",
|
|
1990
1984
|
renderValue: (m) => {
|
|
1991
|
-
const
|
|
1992
|
-
return
|
|
1993
|
-
/* @__PURE__ */ e(
|
|
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 }),
|
|
1994
1988
|
/* @__PURE__ */ e(
|
|
1995
1989
|
O,
|
|
1996
1990
|
{
|
|
1997
1991
|
variant: "subtitle2",
|
|
1998
1992
|
className: "font-medium ml-4",
|
|
1999
|
-
children:
|
|
1993
|
+
children: d?.name.toUpperCase()
|
|
2000
1994
|
}
|
|
2001
1995
|
)
|
|
2002
1996
|
] }) : null;
|
|
@@ -2007,23 +2001,23 @@ function Di({
|
|
|
2007
2001
|
At,
|
|
2008
2002
|
{
|
|
2009
2003
|
label: m || "Views",
|
|
2010
|
-
children: u.filter((
|
|
2004
|
+
children: u.filter((d) => d.group === m).map((d) => /* @__PURE__ */ e(
|
|
2011
2005
|
ee,
|
|
2012
2006
|
{
|
|
2013
|
-
value:
|
|
2007
|
+
value: d.id ?? d.path,
|
|
2014
2008
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2015
|
-
/* @__PURE__ */ e(
|
|
2009
|
+
/* @__PURE__ */ e(lt, { collectionOrView: d }),
|
|
2016
2010
|
/* @__PURE__ */ e(
|
|
2017
2011
|
O,
|
|
2018
2012
|
{
|
|
2019
2013
|
variant: "subtitle2",
|
|
2020
2014
|
className: "font-medium ml-4",
|
|
2021
|
-
children:
|
|
2015
|
+
children: d?.name.toUpperCase()
|
|
2022
2016
|
}
|
|
2023
2017
|
)
|
|
2024
2018
|
] })
|
|
2025
2019
|
},
|
|
2026
|
-
`${
|
|
2020
|
+
`${d.id ?? d.path}-${m}`
|
|
2027
2021
|
))
|
|
2028
2022
|
},
|
|
2029
2023
|
`group_${m}`
|
|
@@ -2033,7 +2027,7 @@ function Di({
|
|
|
2033
2027
|
{
|
|
2034
2028
|
value: m.id ?? m.path,
|
|
2035
2029
|
children: /* @__PURE__ */ a("div", { className: "flex flex-row", children: [
|
|
2036
|
-
/* @__PURE__ */ e(
|
|
2030
|
+
/* @__PURE__ */ e(lt, { collectionOrView: m }),
|
|
2037
2031
|
/* @__PURE__ */ e(
|
|
2038
2032
|
O,
|
|
2039
2033
|
{
|
|
@@ -2052,25 +2046,25 @@ function Di({
|
|
|
2052
2046
|
/* @__PURE__ */ e(X, { children: "You can only edit the reference collection upon field creation." })
|
|
2053
2047
|
] });
|
|
2054
2048
|
}
|
|
2055
|
-
function
|
|
2049
|
+
function zi({ disabled: t }) {
|
|
2056
2050
|
const {
|
|
2057
2051
|
values: r,
|
|
2058
2052
|
errors: n,
|
|
2059
2053
|
touched: i,
|
|
2060
2054
|
setFieldValue: l
|
|
2061
|
-
} = K(), o = "mode",
|
|
2062
|
-
return /* @__PURE__ */ a(
|
|
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
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
2063
2057
|
/* @__PURE__ */ a("div", { className: "flex flex-col col-span-12", children: [
|
|
2064
2058
|
/* @__PURE__ */ a(
|
|
2065
|
-
|
|
2059
|
+
Ce,
|
|
2066
2060
|
{
|
|
2067
2061
|
name: o,
|
|
2068
|
-
value:
|
|
2062
|
+
value: c ?? "date",
|
|
2069
2063
|
error: !!u,
|
|
2070
|
-
onValueChange: (
|
|
2064
|
+
onValueChange: (d) => l(o, d),
|
|
2071
2065
|
label: "Mode",
|
|
2072
|
-
renderValue: (
|
|
2073
|
-
switch (
|
|
2066
|
+
renderValue: (d) => {
|
|
2067
|
+
switch (d) {
|
|
2074
2068
|
case "date_time":
|
|
2075
2069
|
return "Date/Time";
|
|
2076
2070
|
case "date":
|
|
@@ -2088,14 +2082,14 @@ function Bi({ disabled: t }) {
|
|
|
2088
2082
|
),
|
|
2089
2083
|
/* @__PURE__ */ e(X, { error: !!u, children: u }),
|
|
2090
2084
|
/* @__PURE__ */ a(
|
|
2091
|
-
|
|
2085
|
+
Ce,
|
|
2092
2086
|
{
|
|
2093
2087
|
name: p,
|
|
2094
2088
|
disabled: t,
|
|
2095
2089
|
value: h ?? "",
|
|
2096
|
-
onValueChange: (
|
|
2097
|
-
renderValue: (
|
|
2098
|
-
switch (
|
|
2090
|
+
onValueChange: (d) => l(p, d === "none" ? null : d),
|
|
2091
|
+
renderValue: (d) => {
|
|
2092
|
+
switch (d) {
|
|
2099
2093
|
case "on_create":
|
|
2100
2094
|
return "On create";
|
|
2101
2095
|
case "on_update":
|
|
@@ -2107,7 +2101,7 @@ function Bi({ disabled: t }) {
|
|
|
2107
2101
|
error: !!m,
|
|
2108
2102
|
label: "Automatic value",
|
|
2109
2103
|
children: [
|
|
2110
|
-
/* @__PURE__ */ e(ee, { value: "", children: " None " }),
|
|
2104
|
+
/* @__PURE__ */ e(ee, { value: "none", children: " None " }),
|
|
2111
2105
|
/* @__PURE__ */ e(ee, { value: "on_create", children: " On create " }),
|
|
2112
2106
|
/* @__PURE__ */ e(ee, { value: "on_update", children: " On any update " })
|
|
2113
2107
|
]
|
|
@@ -2115,10 +2109,10 @@ function Bi({ disabled: t }) {
|
|
|
2115
2109
|
),
|
|
2116
2110
|
/* @__PURE__ */ e(X, { error: !!m, children: m ?? "Update this field automatically when creating or updating the entity" })
|
|
2117
2111
|
] }),
|
|
2118
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2112
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(Fe, { disabled: t }) }) })
|
|
2119
2113
|
] });
|
|
2120
2114
|
}
|
|
2121
|
-
function
|
|
2115
|
+
function Mi({ disabled: t }) {
|
|
2122
2116
|
return /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2", children: [
|
|
2123
2117
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(H, { type: "checkbox", name: "hideFromCollection", children: ({ field: i, form: l }) => /* @__PURE__ */ e(
|
|
2124
2118
|
ce,
|
|
@@ -2149,8 +2143,8 @@ function zi({ disabled: t }) {
|
|
|
2149
2143
|
) })
|
|
2150
2144
|
] });
|
|
2151
2145
|
}
|
|
2152
|
-
function
|
|
2153
|
-
return /* @__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 }) }) }) });
|
|
2154
2148
|
}
|
|
2155
2149
|
function ar(t, r, n) {
|
|
2156
2150
|
let i;
|
|
@@ -2374,7 +2368,7 @@ function or({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
|
2374
2368
|
children: /* @__PURE__ */ a(
|
|
2375
2369
|
"div",
|
|
2376
2370
|
{
|
|
2377
|
-
className:
|
|
2371
|
+
className: fe(
|
|
2378
2372
|
"flex flex-row items-center text-base min-h-[52px]",
|
|
2379
2373
|
r ? "w-full" : ""
|
|
2380
2374
|
),
|
|
@@ -2398,14 +2392,14 @@ function or({ value: t, optionDisabled: r, propertyConfig: n, existing: i }) {
|
|
|
2398
2392
|
}
|
|
2399
2393
|
);
|
|
2400
2394
|
}
|
|
2401
|
-
function
|
|
2395
|
+
function Ui({
|
|
2402
2396
|
disabled: t,
|
|
2403
2397
|
showErrors: r
|
|
2404
2398
|
}) {
|
|
2405
2399
|
const { values: n, setFieldValue: i } = K(), l = I(n, "url");
|
|
2406
|
-
return /* @__PURE__ */ a(
|
|
2400
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
2407
2401
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ a(
|
|
2408
|
-
|
|
2402
|
+
Ce,
|
|
2409
2403
|
{
|
|
2410
2404
|
disabled: t,
|
|
2411
2405
|
position: "item-aligned",
|
|
@@ -2434,7 +2428,7 @@ function Ri({
|
|
|
2434
2428
|
]
|
|
2435
2429
|
}
|
|
2436
2430
|
) }),
|
|
2437
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2431
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(xe, { children: /* @__PURE__ */ e(
|
|
2438
2432
|
Ee,
|
|
2439
2433
|
{
|
|
2440
2434
|
disabled: t,
|
|
@@ -2445,7 +2439,7 @@ function Ri({
|
|
|
2445
2439
|
}
|
|
2446
2440
|
) }) }),
|
|
2447
2441
|
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2448
|
-
|
|
2442
|
+
Ve,
|
|
2449
2443
|
{
|
|
2450
2444
|
name: "defaultValue",
|
|
2451
2445
|
disabled: t,
|
|
@@ -2458,7 +2452,7 @@ function Ri({
|
|
|
2458
2452
|
) })
|
|
2459
2453
|
] });
|
|
2460
2454
|
}
|
|
2461
|
-
const
|
|
2455
|
+
const ji = [
|
|
2462
2456
|
"text_field",
|
|
2463
2457
|
"multiline",
|
|
2464
2458
|
"markdown",
|
|
@@ -2479,19 +2473,19 @@ const Ui = [
|
|
|
2479
2473
|
"key_value",
|
|
2480
2474
|
"repeat",
|
|
2481
2475
|
"block"
|
|
2482
|
-
], 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(
|
|
2483
2477
|
function(r) {
|
|
2484
2478
|
const {
|
|
2485
2479
|
includeIdAndName: n = !0,
|
|
2486
2480
|
autoOpenTypeSelect: i,
|
|
2487
2481
|
existingProperty: l,
|
|
2488
2482
|
autoUpdateId: o,
|
|
2489
|
-
inArray:
|
|
2483
|
+
inArray: c,
|
|
2490
2484
|
propertyKey: u,
|
|
2491
2485
|
existingPropertyKeys: p,
|
|
2492
2486
|
propertyNamespace: h,
|
|
2493
2487
|
property: m,
|
|
2494
|
-
onPropertyChanged:
|
|
2488
|
+
onPropertyChanged: d,
|
|
2495
2489
|
onPropertyChangedImmediate: g = !0,
|
|
2496
2490
|
onDelete: v,
|
|
2497
2491
|
onError: x,
|
|
@@ -2509,7 +2503,7 @@ const Ui = [
|
|
|
2509
2503
|
id: u,
|
|
2510
2504
|
previousId: u,
|
|
2511
2505
|
property: m
|
|
2512
|
-
} : void 0),
|
|
2506
|
+
} : void 0), U = ({
|
|
2513
2507
|
id: A,
|
|
2514
2508
|
property: s
|
|
2515
2509
|
}) => {
|
|
@@ -2519,7 +2513,7 @@ const Ui = [
|
|
|
2519
2513
|
property: s,
|
|
2520
2514
|
namespace: h
|
|
2521
2515
|
};
|
|
2522
|
-
M.current = V,
|
|
2516
|
+
M.current = V, d?.(V);
|
|
2523
2517
|
}, D = Tt({
|
|
2524
2518
|
initialValues: m ? { id: u, ...m } : w,
|
|
2525
2519
|
initialErrors: y,
|
|
@@ -2531,7 +2525,7 @@ const Ui = [
|
|
|
2531
2525
|
id: V,
|
|
2532
2526
|
...G
|
|
2533
2527
|
} = A;
|
|
2534
|
-
|
|
2528
|
+
U({
|
|
2535
2529
|
id: V,
|
|
2536
2530
|
property: { ...G, editable: G.editable ?? !0 }
|
|
2537
2531
|
}), l || s.resetForm({ values: w });
|
|
@@ -2542,13 +2536,13 @@ const Ui = [
|
|
|
2542
2536
|
if (!A.name)
|
|
2543
2537
|
s.name = "Required";
|
|
2544
2538
|
else {
|
|
2545
|
-
const V =
|
|
2539
|
+
const V = Yi(A.name);
|
|
2546
2540
|
V && (s.name = V);
|
|
2547
2541
|
}
|
|
2548
2542
|
if (!A.id)
|
|
2549
2543
|
s.id = "Required";
|
|
2550
2544
|
else {
|
|
2551
|
-
const V =
|
|
2545
|
+
const V = $i(A.id, p);
|
|
2552
2546
|
V && (s.id = V);
|
|
2553
2547
|
}
|
|
2554
2548
|
}
|
|
@@ -2560,9 +2554,9 @@ const Ui = [
|
|
|
2560
2554
|
return de(() => {
|
|
2561
2555
|
b?.(D);
|
|
2562
2556
|
}, [D, b]), /* @__PURE__ */ e(kt, { value: D, children: /* @__PURE__ */ e(
|
|
2563
|
-
|
|
2557
|
+
Li,
|
|
2564
2558
|
{
|
|
2565
|
-
onPropertyChanged: g ?
|
|
2559
|
+
onPropertyChanged: g ? U : void 0,
|
|
2566
2560
|
onDelete: v,
|
|
2567
2561
|
includeIdAndTitle: n,
|
|
2568
2562
|
propertyNamespace: h,
|
|
@@ -2570,7 +2564,7 @@ const Ui = [
|
|
|
2570
2564
|
showErrors: P || D.submitCount > 0,
|
|
2571
2565
|
existing: l,
|
|
2572
2566
|
autoUpdateId: o,
|
|
2573
|
-
inArray:
|
|
2567
|
+
inArray: c,
|
|
2574
2568
|
autoOpenTypeSelect: i,
|
|
2575
2569
|
disabled: _,
|
|
2576
2570
|
getData: C,
|
|
@@ -2583,18 +2577,18 @@ const Ui = [
|
|
|
2583
2577
|
},
|
|
2584
2578
|
(t, r) => t.getData === r.getData && t.propertyKey === r.propertyKey && t.propertyNamespace === r.propertyNamespace && t.includeIdAndName === r.includeIdAndName && t.autoOpenTypeSelect === r.autoOpenTypeSelect && t.autoUpdateId === r.autoUpdateId && t.existingProperty === r.existingProperty
|
|
2585
2579
|
);
|
|
2586
|
-
function
|
|
2580
|
+
function Ie({
|
|
2587
2581
|
open: t,
|
|
2588
2582
|
onCancel: r,
|
|
2589
2583
|
onOkClicked: n,
|
|
2590
2584
|
onPropertyChanged: i,
|
|
2591
2585
|
getData: l,
|
|
2592
2586
|
collectionEditable: o,
|
|
2593
|
-
...
|
|
2587
|
+
...c
|
|
2594
2588
|
}) {
|
|
2595
2589
|
const u = Le();
|
|
2596
2590
|
return /* @__PURE__ */ e(
|
|
2597
|
-
|
|
2591
|
+
Se,
|
|
2598
2592
|
{
|
|
2599
2593
|
open: t ?? !1,
|
|
2600
2594
|
maxWidth: "xl",
|
|
@@ -2611,7 +2605,7 @@ function Ve({
|
|
|
2611
2605
|
/* @__PURE__ */ e(Be, { children: /* @__PURE__ */ e(
|
|
2612
2606
|
sr,
|
|
2613
2607
|
{
|
|
2614
|
-
...
|
|
2608
|
+
...c,
|
|
2615
2609
|
onPropertyChanged: (h) => {
|
|
2616
2610
|
i?.(h), n?.();
|
|
2617
2611
|
},
|
|
@@ -2650,19 +2644,19 @@ function Ve({
|
|
|
2650
2644
|
}
|
|
2651
2645
|
);
|
|
2652
2646
|
}
|
|
2653
|
-
function
|
|
2647
|
+
function Li({
|
|
2654
2648
|
values: t,
|
|
2655
2649
|
errors: r,
|
|
2656
2650
|
setValues: n,
|
|
2657
2651
|
existing: i,
|
|
2658
2652
|
autoUpdateId: l = !1,
|
|
2659
2653
|
autoOpenTypeSelect: o,
|
|
2660
|
-
includeIdAndTitle:
|
|
2654
|
+
includeIdAndTitle: c,
|
|
2661
2655
|
onPropertyChanged: u,
|
|
2662
2656
|
onDelete: p,
|
|
2663
2657
|
propertyNamespace: h,
|
|
2664
2658
|
onError: m,
|
|
2665
|
-
showErrors:
|
|
2659
|
+
showErrors: d,
|
|
2666
2660
|
disabled: g,
|
|
2667
2661
|
inArray: v,
|
|
2668
2662
|
getData: x,
|
|
@@ -2670,20 +2664,20 @@ function ji({
|
|
|
2670
2664
|
propertyConfigs: P,
|
|
2671
2665
|
collectionEditable: k
|
|
2672
2666
|
}) {
|
|
2673
|
-
const [b, C] = $(o), [N, f] = $(!1), [w, _] = $(t?.dataType ? Kt(t) : void 0), M = Object.entries(lr).concat(Object.entries(P)),
|
|
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");
|
|
2674
2668
|
de(() => {
|
|
2675
|
-
if (u && (!
|
|
2669
|
+
if (u && (!c || D.id)) {
|
|
2676
2670
|
const {
|
|
2677
2671
|
id: q,
|
|
2678
2672
|
...L
|
|
2679
2673
|
} = D;
|
|
2680
|
-
|
|
2674
|
+
ye(D, s.current) || (u({
|
|
2681
2675
|
id: q,
|
|
2682
2676
|
property: L,
|
|
2683
2677
|
namespace: h
|
|
2684
2678
|
}), s.current = D);
|
|
2685
2679
|
}
|
|
2686
|
-
}, [D,
|
|
2680
|
+
}, [D, c, u, h]), de(() => {
|
|
2687
2681
|
t?.id && m && m(t?.id, h, r);
|
|
2688
2682
|
}, [r, m, h, t?.id]);
|
|
2689
2683
|
const G = (q) => {
|
|
@@ -2693,17 +2687,17 @@ function ji({
|
|
|
2693
2687
|
};
|
|
2694
2688
|
let B;
|
|
2695
2689
|
return w === "text_field" || w === "multiline" || w === "markdown" || w === "email" ? B = /* @__PURE__ */ e(
|
|
2696
|
-
|
|
2690
|
+
Si,
|
|
2697
2691
|
{
|
|
2698
2692
|
widgetId: w,
|
|
2699
2693
|
disabled: g,
|
|
2700
|
-
showErrors:
|
|
2694
|
+
showErrors: d
|
|
2701
2695
|
}
|
|
2702
2696
|
) : w === "url" ? B = /* @__PURE__ */ e(
|
|
2703
|
-
|
|
2697
|
+
Ui,
|
|
2704
2698
|
{
|
|
2705
2699
|
disabled: g,
|
|
2706
|
-
showErrors:
|
|
2700
|
+
showErrors: d
|
|
2707
2701
|
}
|
|
2708
2702
|
) : w === "select" || w === "number_select" ? B = /* @__PURE__ */ e(
|
|
2709
2703
|
Rt,
|
|
@@ -2713,7 +2707,7 @@ function ji({
|
|
|
2713
2707
|
updateIds: !i,
|
|
2714
2708
|
disabled: g,
|
|
2715
2709
|
getData: x,
|
|
2716
|
-
showErrors:
|
|
2710
|
+
showErrors: d
|
|
2717
2711
|
}
|
|
2718
2712
|
) : w === "multi_select" || w === "multi_number_select" ? B = /* @__PURE__ */ e(
|
|
2719
2713
|
Rt,
|
|
@@ -2723,7 +2717,7 @@ function ji({
|
|
|
2723
2717
|
disabled: g,
|
|
2724
2718
|
allowDataInference: y,
|
|
2725
2719
|
getData: x,
|
|
2726
|
-
showErrors:
|
|
2720
|
+
showErrors: d
|
|
2727
2721
|
}
|
|
2728
2722
|
) : w === "file_upload" ? B = /* @__PURE__ */ e(
|
|
2729
2723
|
Ut,
|
|
@@ -2739,8 +2733,8 @@ function ji({
|
|
|
2739
2733
|
multiple: !0,
|
|
2740
2734
|
disabled: g
|
|
2741
2735
|
}
|
|
2742
|
-
) : w === "switch" ? B = /* @__PURE__ */ e(Fi, { disabled: g }) : w === "number_input" ? B = /* @__PURE__ */ e(
|
|
2743
|
-
|
|
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,
|
|
2744
2738
|
{
|
|
2745
2739
|
disabled: g,
|
|
2746
2740
|
getData: x,
|
|
@@ -2749,7 +2743,7 @@ function ji({
|
|
|
2749
2743
|
propertyConfigs: P
|
|
2750
2744
|
}
|
|
2751
2745
|
) : w === "block" ? B = /* @__PURE__ */ e(
|
|
2752
|
-
|
|
2746
|
+
Ei,
|
|
2753
2747
|
{
|
|
2754
2748
|
disabled: g,
|
|
2755
2749
|
getData: x,
|
|
@@ -2760,23 +2754,23 @@ function ji({
|
|
|
2760
2754
|
) : w === "reference" ? B = /* @__PURE__ */ e(
|
|
2761
2755
|
jt,
|
|
2762
2756
|
{
|
|
2763
|
-
showErrors:
|
|
2757
|
+
showErrors: d,
|
|
2764
2758
|
existing: i,
|
|
2765
2759
|
multiple: !1,
|
|
2766
2760
|
disabled: g
|
|
2767
2761
|
}
|
|
2768
|
-
) : w === "date_time" ? B = /* @__PURE__ */ e(
|
|
2762
|
+
) : w === "date_time" ? B = /* @__PURE__ */ e(zi, { disabled: g }) : w === "multi_references" ? B = /* @__PURE__ */ e(
|
|
2769
2763
|
jt,
|
|
2770
2764
|
{
|
|
2771
|
-
showErrors:
|
|
2765
|
+
showErrors: d,
|
|
2772
2766
|
existing: i,
|
|
2773
2767
|
multiple: !0,
|
|
2774
2768
|
disabled: g
|
|
2775
2769
|
}
|
|
2776
2770
|
) : w === "repeat" ? B = /* @__PURE__ */ e(
|
|
2777
|
-
|
|
2771
|
+
Ii,
|
|
2778
2772
|
{
|
|
2779
|
-
showErrors:
|
|
2773
|
+
showErrors: d,
|
|
2780
2774
|
existing: i,
|
|
2781
2775
|
getData: x,
|
|
2782
2776
|
allowDataInference: y,
|
|
@@ -2784,8 +2778,8 @@ function ji({
|
|
|
2784
2778
|
collectionEditable: k,
|
|
2785
2779
|
propertyConfigs: P
|
|
2786
2780
|
}
|
|
2787
|
-
) : w === "key_value" ? B = /* @__PURE__ */ e(
|
|
2788
|
-
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: [
|
|
2789
2783
|
/* @__PURE__ */ e(O, { children: "This property can't be edited" }),
|
|
2790
2784
|
/* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
2791
2785
|
"You may not have permission to edit it or it is defined in code with no ",
|
|
@@ -2796,7 +2790,7 @@ function ji({
|
|
|
2796
2790
|
/* @__PURE__ */ a("div", { className: "flex mt-2 justify-between", children: [
|
|
2797
2791
|
/* @__PURE__ */ a("div", { className: "w-full flex flex-col gap-2", children: [
|
|
2798
2792
|
/* @__PURE__ */ e(
|
|
2799
|
-
|
|
2793
|
+
Ce,
|
|
2800
2794
|
{
|
|
2801
2795
|
error: !!V,
|
|
2802
2796
|
value: w ?? "",
|
|
@@ -2815,7 +2809,7 @@ function ji({
|
|
|
2815
2809
|
onClick: (re) => {
|
|
2816
2810
|
we && (re.stopPropagation(), re.preventDefault());
|
|
2817
2811
|
},
|
|
2818
|
-
className:
|
|
2812
|
+
className: fe(
|
|
2819
2813
|
"flex items-center",
|
|
2820
2814
|
we ? "w-full pointer-events-none opacity-50" : ""
|
|
2821
2815
|
),
|
|
@@ -2839,7 +2833,7 @@ function ji({
|
|
|
2839
2833
|
onValueChange: (q) => {
|
|
2840
2834
|
G(q);
|
|
2841
2835
|
},
|
|
2842
|
-
children:
|
|
2836
|
+
children: U.map(([q, L]) => {
|
|
2843
2837
|
const J = L.property, le = i && !ne(J) && J.dataType !== t?.dataType;
|
|
2844
2838
|
return /* @__PURE__ */ e(
|
|
2845
2839
|
or,
|
|
@@ -2871,15 +2865,15 @@ function ji({
|
|
|
2871
2865
|
className: "m-4",
|
|
2872
2866
|
disabled: g,
|
|
2873
2867
|
onClick: () => f(!0),
|
|
2874
|
-
children: /* @__PURE__ */ e(
|
|
2868
|
+
children: /* @__PURE__ */ e(ut, {})
|
|
2875
2869
|
}
|
|
2876
2870
|
)
|
|
2877
2871
|
] }),
|
|
2878
2872
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-y-12 mt-8 mb-8", children: [
|
|
2879
|
-
|
|
2880
|
-
|
|
2873
|
+
c && /* @__PURE__ */ e(
|
|
2874
|
+
_i,
|
|
2881
2875
|
{
|
|
2882
|
-
showErrors:
|
|
2876
|
+
showErrors: d,
|
|
2883
2877
|
disabledId: i,
|
|
2884
2878
|
isNewProperty: !i,
|
|
2885
2879
|
disabled: g,
|
|
@@ -2888,10 +2882,10 @@ function ji({
|
|
|
2888
2882
|
}
|
|
2889
2883
|
),
|
|
2890
2884
|
B,
|
|
2891
|
-
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
|
|
2885
|
+
/* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Mi, { disabled: g }) })
|
|
2892
2886
|
] }),
|
|
2893
2887
|
p && /* @__PURE__ */ e(
|
|
2894
|
-
|
|
2888
|
+
st,
|
|
2895
2889
|
{
|
|
2896
2890
|
open: N,
|
|
2897
2891
|
onAccept: () => p(t?.id, h),
|
|
@@ -2906,24 +2900,28 @@ function ji({
|
|
|
2906
2900
|
)
|
|
2907
2901
|
] });
|
|
2908
2902
|
}
|
|
2909
|
-
const
|
|
2910
|
-
function
|
|
2903
|
+
const qi = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
2904
|
+
function $i(t, r) {
|
|
2911
2905
|
let n;
|
|
2912
|
-
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;
|
|
2913
2907
|
}
|
|
2914
|
-
function
|
|
2908
|
+
function Yi(t) {
|
|
2915
2909
|
let r;
|
|
2916
2910
|
return t || (r = "You must specify a title for the field"), r;
|
|
2917
2911
|
}
|
|
2918
|
-
function
|
|
2912
|
+
function Hi(t) {
|
|
2919
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), "") : "";
|
|
2920
2914
|
}
|
|
2921
|
-
function
|
|
2922
|
-
|
|
2915
|
+
function Gi({
|
|
2916
|
+
collection: t,
|
|
2917
|
+
onOpenChange: r,
|
|
2918
|
+
open: n
|
|
2919
|
+
}) {
|
|
2920
|
+
const i = _e(), l = t ? `import { EntityCollection } from "firecms";
|
|
2923
2921
|
|
|
2924
|
-
const ` + (t
|
|
2922
|
+
const ` + (t?.name ? Hi(t.name) : "my") + "Collection:EntityCollection = " + li.stringify(cr(t), null, " ") : "No collection selected";
|
|
2925
2923
|
return /* @__PURE__ */ a(
|
|
2926
|
-
|
|
2924
|
+
Se,
|
|
2927
2925
|
{
|
|
2928
2926
|
open: n,
|
|
2929
2927
|
onOpenChange: r,
|
|
@@ -2947,12 +2945,18 @@ const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.s
|
|
|
2947
2945
|
"."
|
|
2948
2946
|
] }),
|
|
2949
2947
|
/* @__PURE__ */ e(
|
|
2950
|
-
|
|
2948
|
+
si,
|
|
2951
2949
|
{
|
|
2952
|
-
theme:
|
|
2950
|
+
theme: ci.vsDark,
|
|
2953
2951
|
code: l,
|
|
2954
2952
|
language: "typescript",
|
|
2955
|
-
children: ({
|
|
2953
|
+
children: ({
|
|
2954
|
+
className: o,
|
|
2955
|
+
style: c,
|
|
2956
|
+
tokens: u,
|
|
2957
|
+
getLineProps: p,
|
|
2958
|
+
getTokenProps: h
|
|
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)) })
|
|
2956
2960
|
}
|
|
2957
2961
|
)
|
|
2958
2962
|
] }),
|
|
@@ -2967,7 +2971,7 @@ const ` + (t.name ? Yi(t.name) : "my") + "Collection:EntityCollection = " + oi.s
|
|
|
2967
2971
|
message: "Copied"
|
|
2968
2972
|
}), navigator.clipboard.writeText(l)),
|
|
2969
2973
|
children: [
|
|
2970
|
-
/* @__PURE__ */ e(
|
|
2974
|
+
/* @__PURE__ */ e($r, { size: "small" }),
|
|
2971
2975
|
"Copy to clipboard"
|
|
2972
2976
|
]
|
|
2973
2977
|
}
|
|
@@ -3007,19 +3011,19 @@ function cr(t) {
|
|
|
3007
3011
|
subcollections: (t.subcollections ?? []).map(cr)
|
|
3008
3012
|
};
|
|
3009
3013
|
}
|
|
3010
|
-
function
|
|
3014
|
+
function Ki({
|
|
3011
3015
|
showErrors: t,
|
|
3012
3016
|
isNewCollection: r,
|
|
3013
3017
|
propertyErrorsRef: n,
|
|
3014
3018
|
onPropertyError: i,
|
|
3015
3019
|
setDirty: l,
|
|
3016
3020
|
reservedGroups: o,
|
|
3017
|
-
extraIcon:
|
|
3021
|
+
extraIcon: c,
|
|
3018
3022
|
getUser: u,
|
|
3019
3023
|
getData: p,
|
|
3020
3024
|
doCollectionInference: h,
|
|
3021
3025
|
propertyConfigs: m,
|
|
3022
|
-
collectionEditable:
|
|
3026
|
+
collectionEditable: d
|
|
3023
3027
|
}) {
|
|
3024
3028
|
const {
|
|
3025
3029
|
values: g,
|
|
@@ -3028,21 +3032,21 @@ function Gi({
|
|
|
3028
3032
|
setFieldTouched: y,
|
|
3029
3033
|
errors: P,
|
|
3030
3034
|
dirty: k
|
|
3031
|
-
} = K(), b =
|
|
3035
|
+
} = K(), b = _e(), C = Nr(), N = !C, [f, w] = $(), [_, M] = $(), [U, D] = $(), A = _ ? ae(_, U) : void 0, s = A ? I(g.properties, A.replaceAll(".", ".properties.")) : void 0, [V, G] = $(!1), [B, q] = $(!1), [L, J] = $(!1), [le, Me] = $([]), we = Y.useRef(g.propertiesOrder ? { "": g.propertiesOrder } : {});
|
|
3032
3036
|
de(() => {
|
|
3033
3037
|
l && l(k);
|
|
3034
3038
|
}, [k]);
|
|
3035
3039
|
const ue = h ? () => {
|
|
3036
|
-
h && (q(!0), h(g).then((
|
|
3037
|
-
if (
|
|
3040
|
+
h && (q(!0), h(g).then((S) => {
|
|
3041
|
+
if (S && He(S.properties), !S) {
|
|
3038
3042
|
b.open({
|
|
3039
3043
|
type: "error",
|
|
3040
3044
|
message: "Could not infer properties from data"
|
|
3041
3045
|
});
|
|
3042
3046
|
return;
|
|
3043
3047
|
}
|
|
3044
|
-
const
|
|
3045
|
-
if (
|
|
3048
|
+
const j = (S.properties ? Object.keys(S.properties) : []).filter((E) => !g.properties[E]);
|
|
3049
|
+
if (j.length === 0) {
|
|
3046
3050
|
b.open({
|
|
3047
3051
|
type: "info",
|
|
3048
3052
|
message: "No new properties found in existing data"
|
|
@@ -3050,84 +3054,84 @@ function Gi({
|
|
|
3050
3054
|
return;
|
|
3051
3055
|
}
|
|
3052
3056
|
const T = {
|
|
3053
|
-
...
|
|
3057
|
+
...j.reduce((E, ie) => (E[ie] = (S.properties ?? {})[ie], E), {}),
|
|
3054
3058
|
...g.properties
|
|
3055
|
-
},
|
|
3056
|
-
...
|
|
3059
|
+
}, F = [
|
|
3060
|
+
...j,
|
|
3057
3061
|
...g.propertiesOrder ?? []
|
|
3058
3062
|
];
|
|
3059
|
-
v("properties", T, !1),
|
|
3063
|
+
v("properties", T, !1), ve(F), Me(j);
|
|
3060
3064
|
}).finally(() => {
|
|
3061
3065
|
q(!1);
|
|
3062
3066
|
}));
|
|
3063
|
-
} : void 0, re = Q((
|
|
3064
|
-
const T =
|
|
3065
|
-
v(T,
|
|
3066
|
-
}, [v]),
|
|
3067
|
-
const T =
|
|
3067
|
+
} : void 0, re = Q((S) => S ? we.current[S] ?? I(g, be(S)) : we.current[""], [g]), ve = Q((S, j) => {
|
|
3068
|
+
const T = be(j);
|
|
3069
|
+
v(T, S, !1), we.current[j ?? ""] = S;
|
|
3070
|
+
}, [v]), ke = Q((S, j) => {
|
|
3071
|
+
const T = S ? ae(S, j) : void 0;
|
|
3068
3072
|
if (!T)
|
|
3069
3073
|
throw Error("collection editor miss config");
|
|
3070
|
-
v(
|
|
3071
|
-
const E = re(
|
|
3072
|
-
|
|
3073
|
-
}, [re, v,
|
|
3074
|
-
v(
|
|
3074
|
+
v(he(T), void 0, !1);
|
|
3075
|
+
const E = re(j).filter((ie) => ie !== S);
|
|
3076
|
+
ve(E, j), J(!1), w(void 0), M(void 0), D(void 0);
|
|
3077
|
+
}, [re, v, ve]), Ke = (S, j) => {
|
|
3078
|
+
v(be(j), S, !1);
|
|
3075
3079
|
}, gt = ({
|
|
3076
|
-
id:
|
|
3077
|
-
property:
|
|
3080
|
+
id: S,
|
|
3081
|
+
property: j
|
|
3078
3082
|
}) => {
|
|
3079
|
-
if (!
|
|
3083
|
+
if (!S)
|
|
3080
3084
|
throw Error("Need to include an ID when creating a new property");
|
|
3081
3085
|
v("properties", {
|
|
3082
3086
|
...g.properties ?? {},
|
|
3083
|
-
[
|
|
3087
|
+
[S]: j
|
|
3084
3088
|
}, !1);
|
|
3085
|
-
const T = [...g.propertiesOrder ?? Object.keys(g.properties),
|
|
3086
|
-
|
|
3087
|
-
},
|
|
3088
|
-
id:
|
|
3089
|
-
property:
|
|
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
|
+
}, pe = ({
|
|
3092
|
+
id: S,
|
|
3093
|
+
property: j,
|
|
3090
3094
|
previousId: T,
|
|
3091
|
-
namespace:
|
|
3095
|
+
namespace: F
|
|
3092
3096
|
}) => {
|
|
3093
|
-
const E =
|
|
3094
|
-
if (T && T !==
|
|
3097
|
+
const E = S ? ae(S, F) : void 0, ie = E ? he(E) : void 0;
|
|
3098
|
+
if (T && T !== S) {
|
|
3095
3099
|
console.debug("onPropertyChanged, id change", {
|
|
3096
|
-
id:
|
|
3097
|
-
property:
|
|
3100
|
+
id: S,
|
|
3101
|
+
property: j,
|
|
3098
3102
|
previousId: T,
|
|
3099
|
-
namespace:
|
|
3103
|
+
namespace: F
|
|
3100
3104
|
});
|
|
3101
|
-
const
|
|
3102
|
-
|
|
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);
|
|
3103
3107
|
}
|
|
3104
3108
|
console.debug("onPropertyChanged", {
|
|
3105
|
-
id:
|
|
3106
|
-
property:
|
|
3109
|
+
id: S,
|
|
3110
|
+
property: j,
|
|
3107
3111
|
previousId: T,
|
|
3108
|
-
namespace:
|
|
3112
|
+
namespace: F,
|
|
3109
3113
|
propertyPath: ie
|
|
3110
|
-
}), ie && (v(ie,
|
|
3111
|
-
},
|
|
3112
|
-
const
|
|
3114
|
+
}), ie && (v(ie, j, !1), y(ie, !0, !1));
|
|
3115
|
+
}, We = Q((S, j, T) => {
|
|
3116
|
+
const F = S ? ae(S, j) : void 0;
|
|
3113
3117
|
if (console.debug("onPropertyErrorInternal", {
|
|
3114
|
-
id:
|
|
3115
|
-
namespace:
|
|
3118
|
+
id: S,
|
|
3119
|
+
namespace: j,
|
|
3116
3120
|
error: T,
|
|
3117
|
-
propertyPath:
|
|
3118
|
-
}),
|
|
3121
|
+
propertyPath: F
|
|
3122
|
+
}), F) {
|
|
3119
3123
|
const E = T && Object.keys(T).length > 0;
|
|
3120
|
-
i(
|
|
3124
|
+
i(S, j, E ? T : void 0), x(he(F), E ? "Property error" : void 0);
|
|
3121
3125
|
}
|
|
3122
|
-
}, []),
|
|
3126
|
+
}, []), Ze = () => {
|
|
3123
3127
|
w(void 0), M(void 0);
|
|
3124
|
-
},
|
|
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) => {
|
|
3125
3129
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
3126
|
-
propertyKey:
|
|
3127
|
-
namespace:
|
|
3128
|
-
}), w(Re.indexOf(
|
|
3130
|
+
propertyKey: S,
|
|
3131
|
+
namespace: j
|
|
3132
|
+
}), w(Re.indexOf(S)), M(S), D(j);
|
|
3129
3133
|
}, [Re]), yt = /* @__PURE__ */ a("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
|
|
3130
|
-
/* @__PURE__ */ a("div", { className:
|
|
3134
|
+
/* @__PURE__ */ a("div", { className: fe(
|
|
3131
3135
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
3132
3136
|
"col-span-12 lg:col-span-5 h-full overflow-auto",
|
|
3133
3137
|
!N && "border-r " + wt
|
|
@@ -3148,7 +3152,7 @@ function Gi({
|
|
|
3148
3152
|
error: !!P?.name
|
|
3149
3153
|
}
|
|
3150
3154
|
),
|
|
3151
|
-
|
|
3155
|
+
Xe && /* @__PURE__ */ a(
|
|
3152
3156
|
O,
|
|
3153
3157
|
{
|
|
3154
3158
|
variant: "body2",
|
|
@@ -3156,12 +3160,12 @@ function Gi({
|
|
|
3156
3160
|
color: "secondary",
|
|
3157
3161
|
children: [
|
|
3158
3162
|
"Created by ",
|
|
3159
|
-
|
|
3163
|
+
Xe.displayName
|
|
3160
3164
|
]
|
|
3161
3165
|
}
|
|
3162
3166
|
)
|
|
3163
3167
|
] }),
|
|
3164
|
-
|
|
3168
|
+
c && /* @__PURE__ */ e("div", { className: "ml-4", children: c }),
|
|
3165
3169
|
/* @__PURE__ */ a("div", { className: "ml-1 mt-2 flex flex-row gap-2", children: [
|
|
3166
3170
|
/* @__PURE__ */ e(te, { title: "Get the code for this collection", children: /* @__PURE__ */ e(
|
|
3167
3171
|
oe,
|
|
@@ -3169,7 +3173,7 @@ function Gi({
|
|
|
3169
3173
|
variant: "filled",
|
|
3170
3174
|
disabled: B,
|
|
3171
3175
|
onClick: () => G(!0),
|
|
3172
|
-
children: /* @__PURE__ */ e(
|
|
3176
|
+
children: /* @__PURE__ */ e(Yr, {})
|
|
3173
3177
|
}
|
|
3174
3178
|
) }),
|
|
3175
3179
|
ue && /* @__PURE__ */ e(te, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
|
|
@@ -3191,19 +3195,19 @@ function Gi({
|
|
|
3191
3195
|
) })
|
|
3192
3196
|
] })
|
|
3193
3197
|
] }),
|
|
3194
|
-
/* @__PURE__ */ e(
|
|
3198
|
+
/* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
3195
3199
|
ft,
|
|
3196
3200
|
{
|
|
3197
3201
|
className: "pl-8",
|
|
3198
3202
|
inferredPropertyKeys: le,
|
|
3199
|
-
selectedPropertyKey: _ ? ae(_,
|
|
3203
|
+
selectedPropertyKey: _ ? ae(_, U) : void 0,
|
|
3200
3204
|
properties: g.properties,
|
|
3201
3205
|
additionalFields: g.additionalFields,
|
|
3202
3206
|
propertiesOrder: Re,
|
|
3203
3207
|
onPropertyClick: vt,
|
|
3204
|
-
onPropertyMove:
|
|
3205
|
-
onPropertyRemove: r ?
|
|
3206
|
-
collectionEditable:
|
|
3208
|
+
onPropertyMove: Ke,
|
|
3209
|
+
onPropertyRemove: r ? ke : void 0,
|
|
3210
|
+
collectionEditable: d,
|
|
3207
3211
|
errors: P
|
|
3208
3212
|
}
|
|
3209
3213
|
) }),
|
|
@@ -3221,7 +3225,7 @@ function Gi({
|
|
|
3221
3225
|
)
|
|
3222
3226
|
] }),
|
|
3223
3227
|
!N && /* @__PURE__ */ e("div", { className: "col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ a(
|
|
3224
|
-
|
|
3228
|
+
Pe,
|
|
3225
3229
|
{
|
|
3226
3230
|
className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
|
|
3227
3231
|
children: [
|
|
@@ -3234,21 +3238,21 @@ function Gi({
|
|
|
3234
3238
|
allowDataInference: !r,
|
|
3235
3239
|
autoOpenTypeSelect: !1,
|
|
3236
3240
|
propertyKey: _,
|
|
3237
|
-
propertyNamespace:
|
|
3241
|
+
propertyNamespace: U,
|
|
3238
3242
|
property: s,
|
|
3239
|
-
onPropertyChanged:
|
|
3240
|
-
onDelete:
|
|
3241
|
-
onError:
|
|
3243
|
+
onPropertyChanged: pe,
|
|
3244
|
+
onDelete: ke,
|
|
3245
|
+
onError: We,
|
|
3242
3246
|
forceShowErrors: t,
|
|
3243
|
-
initialErrors:
|
|
3247
|
+
initialErrors: Je,
|
|
3244
3248
|
getData: p,
|
|
3245
3249
|
propertyConfigs: m,
|
|
3246
|
-
collectionEditable:
|
|
3250
|
+
collectionEditable: d
|
|
3247
3251
|
},
|
|
3248
3252
|
`edit_view_${f}`
|
|
3249
3253
|
),
|
|
3250
3254
|
!s && /* @__PURE__ */ a("div", { className: "w-full flex flex-col items-center justify-center h-full gap-4", children: [
|
|
3251
|
-
/* @__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" }),
|
|
3252
3256
|
/* @__PURE__ */ a(
|
|
3253
3257
|
z,
|
|
3254
3258
|
{
|
|
@@ -3266,7 +3270,7 @@ function Gi({
|
|
|
3266
3270
|
}
|
|
3267
3271
|
) }),
|
|
3268
3272
|
N && /* @__PURE__ */ e(
|
|
3269
|
-
|
|
3273
|
+
Ie,
|
|
3270
3274
|
{
|
|
3271
3275
|
inArray: !1,
|
|
3272
3276
|
open: f !== void 0,
|
|
@@ -3275,25 +3279,25 @@ function Gi({
|
|
|
3275
3279
|
existingProperty: !0,
|
|
3276
3280
|
autoOpenTypeSelect: !1,
|
|
3277
3281
|
propertyKey: _,
|
|
3278
|
-
propertyNamespace:
|
|
3282
|
+
propertyNamespace: U,
|
|
3279
3283
|
property: s,
|
|
3280
|
-
onPropertyChanged:
|
|
3281
|
-
onDelete:
|
|
3282
|
-
onError:
|
|
3284
|
+
onPropertyChanged: pe,
|
|
3285
|
+
onDelete: ke,
|
|
3286
|
+
onError: We,
|
|
3283
3287
|
forceShowErrors: t,
|
|
3284
|
-
initialErrors:
|
|
3288
|
+
initialErrors: Je,
|
|
3285
3289
|
getData: p,
|
|
3286
3290
|
propertyConfigs: m,
|
|
3287
|
-
collectionEditable:
|
|
3288
|
-
onOkClicked: N ?
|
|
3291
|
+
collectionEditable: d,
|
|
3292
|
+
onOkClicked: N ? Ze : void 0
|
|
3289
3293
|
},
|
|
3290
3294
|
`edit_view_${f}`
|
|
3291
3295
|
)
|
|
3292
3296
|
] });
|
|
3293
|
-
return /* @__PURE__ */ a(
|
|
3297
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
3294
3298
|
yt,
|
|
3295
3299
|
/* @__PURE__ */ e(
|
|
3296
|
-
|
|
3300
|
+
Ie,
|
|
3297
3301
|
{
|
|
3298
3302
|
inArray: !1,
|
|
3299
3303
|
existingProperty: !1,
|
|
@@ -3306,21 +3310,21 @@ function Gi({
|
|
|
3306
3310
|
getData: p,
|
|
3307
3311
|
allowDataInference: !r,
|
|
3308
3312
|
propertyConfigs: m,
|
|
3309
|
-
collectionEditable:
|
|
3313
|
+
collectionEditable: d,
|
|
3310
3314
|
existingPropertyKeys: g.propertiesOrder
|
|
3311
3315
|
}
|
|
3312
3316
|
),
|
|
3313
|
-
/* @__PURE__ */ e(
|
|
3314
|
-
|
|
3317
|
+
/* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(
|
|
3318
|
+
Gi,
|
|
3315
3319
|
{
|
|
3316
3320
|
collection: g,
|
|
3317
3321
|
open: V,
|
|
3318
3322
|
onOpenChange: G
|
|
3319
3323
|
}
|
|
3320
|
-
)
|
|
3324
|
+
) })
|
|
3321
3325
|
] });
|
|
3322
3326
|
}
|
|
3323
|
-
function
|
|
3327
|
+
function Wi({
|
|
3324
3328
|
open: t,
|
|
3325
3329
|
handleOk: r,
|
|
3326
3330
|
handleCancel: n,
|
|
@@ -3328,7 +3332,7 @@ function Ki({
|
|
|
3328
3332
|
title: l
|
|
3329
3333
|
}) {
|
|
3330
3334
|
return /* @__PURE__ */ a(
|
|
3331
|
-
|
|
3335
|
+
Se,
|
|
3332
3336
|
{
|
|
3333
3337
|
open: t,
|
|
3334
3338
|
onOpenChange: (o) => o ? n() : r(),
|
|
@@ -3348,12 +3352,12 @@ function Ki({
|
|
|
3348
3352
|
}
|
|
3349
3353
|
);
|
|
3350
3354
|
}
|
|
3351
|
-
function
|
|
3355
|
+
function Zi({ open: t, onClose: r }) {
|
|
3352
3356
|
const {
|
|
3353
3357
|
entityViews: n
|
|
3354
3358
|
} = Ae();
|
|
3355
3359
|
return /* @__PURE__ */ a(
|
|
3356
|
-
|
|
3360
|
+
Se,
|
|
3357
3361
|
{
|
|
3358
3362
|
maxWidth: "md",
|
|
3359
3363
|
open: t,
|
|
@@ -3382,7 +3386,7 @@ function Wi({ open: t, onClose: r }) {
|
|
|
3382
3386
|
}
|
|
3383
3387
|
);
|
|
3384
3388
|
}
|
|
3385
|
-
function
|
|
3389
|
+
function Ji({
|
|
3386
3390
|
collection: t,
|
|
3387
3391
|
parentCollection: r,
|
|
3388
3392
|
configController: n,
|
|
@@ -3390,10 +3394,10 @@ function Zi({
|
|
|
3390
3394
|
getUser: l,
|
|
3391
3395
|
parentCollectionIds: o
|
|
3392
3396
|
}) {
|
|
3393
|
-
const { entityViews:
|
|
3397
|
+
const { entityViews: c } = Ae(), [u, p] = Y.useState(), [h, m] = Y.useState(!1), [d, g] = Y.useState(), [v, x] = Y.useState(), {
|
|
3394
3398
|
values: y,
|
|
3395
3399
|
setFieldValue: P
|
|
3396
|
-
} = 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;
|
|
3397
3401
|
return /* @__PURE__ */ a("div", { className: "overflow-auto my-auto", children: [
|
|
3398
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: [
|
|
3399
3403
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
@@ -3401,7 +3405,7 @@ function Zi({
|
|
|
3401
3405
|
"Subcollections of ",
|
|
3402
3406
|
y.name
|
|
3403
3407
|
] }),
|
|
3404
|
-
/* @__PURE__ */ a(
|
|
3408
|
+
/* @__PURE__ */ a(Pe, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3405
3409
|
k && k.length > 0 && /* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ e(Bt, { children: k.map((f) => /* @__PURE__ */ a(
|
|
3406
3410
|
bt,
|
|
3407
3411
|
{
|
|
@@ -3429,7 +3433,7 @@ function Zi({
|
|
|
3429
3433
|
w.preventDefault(), w.stopPropagation(), p(f.id);
|
|
3430
3434
|
},
|
|
3431
3435
|
color: "inherit",
|
|
3432
|
-
children: /* @__PURE__ */ e(
|
|
3436
|
+
children: /* @__PURE__ */ e(ut, { size: "small" })
|
|
3433
3437
|
}
|
|
3434
3438
|
) })
|
|
3435
3439
|
}
|
|
@@ -3455,7 +3459,7 @@ function Zi({
|
|
|
3455
3459
|
] }),
|
|
3456
3460
|
/* @__PURE__ */ a("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
|
|
3457
3461
|
/* @__PURE__ */ e(O, { variant: "h5", children: "Custom views" }),
|
|
3458
|
-
N === 0 && /* @__PURE__ */ e(
|
|
3462
|
+
N === 0 && /* @__PURE__ */ e(Hr, { action: /* @__PURE__ */ e(
|
|
3459
3463
|
z,
|
|
3460
3464
|
{
|
|
3461
3465
|
variant: "text",
|
|
@@ -3467,7 +3471,7 @@ function Zi({
|
|
|
3467
3471
|
children: "More info"
|
|
3468
3472
|
}
|
|
3469
3473
|
), children: "Define your own custom views by uploading them with the CLI." }),
|
|
3470
|
-
/* @__PURE__ */ e(
|
|
3474
|
+
/* @__PURE__ */ e(R, { children: /* @__PURE__ */ a(Pe, { className: "flex flex-col gap-4 p-2 w-full", children: [
|
|
3471
3475
|
/* @__PURE__ */ e(Dt, { children: /* @__PURE__ */ a(Bt, { children: [
|
|
3472
3476
|
b.map((f) => /* @__PURE__ */ a(bt, { children: [
|
|
3473
3477
|
/* @__PURE__ */ e(
|
|
@@ -3489,7 +3493,7 @@ function Zi({
|
|
|
3489
3493
|
w.preventDefault(), w.stopPropagation(), g(f.key);
|
|
3490
3494
|
},
|
|
3491
3495
|
color: "inherit",
|
|
3492
|
-
children: /* @__PURE__ */ e(
|
|
3496
|
+
children: /* @__PURE__ */ e(ut, { size: "small" })
|
|
3493
3497
|
}
|
|
3494
3498
|
) })
|
|
3495
3499
|
}
|
|
@@ -3525,7 +3529,7 @@ function Zi({
|
|
|
3525
3529
|
] }) }),
|
|
3526
3530
|
/* @__PURE__ */ e("div", { style: { height: "52px" } }),
|
|
3527
3531
|
u && /* @__PURE__ */ e(
|
|
3528
|
-
|
|
3532
|
+
st,
|
|
3529
3533
|
{
|
|
3530
3534
|
open: !!u,
|
|
3531
3535
|
onAccept: () => {
|
|
@@ -3536,24 +3540,24 @@ function Zi({
|
|
|
3536
3540
|
console.debug("Deleting subcollection", f), n.deleteCollection(f), p(void 0);
|
|
3537
3541
|
},
|
|
3538
3542
|
onCancel: () => p(void 0),
|
|
3539
|
-
title: /* @__PURE__ */ e(
|
|
3540
|
-
body: /* @__PURE__ */ a(
|
|
3543
|
+
title: /* @__PURE__ */ e(R, { children: "Delete this subcollection?" }),
|
|
3544
|
+
body: /* @__PURE__ */ a(R, { children: [
|
|
3541
3545
|
" This will ",
|
|
3542
3546
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
3543
3547
|
", only the collection in the CMS"
|
|
3544
3548
|
] })
|
|
3545
3549
|
}
|
|
3546
3550
|
),
|
|
3547
|
-
|
|
3548
|
-
|
|
3551
|
+
d && /* @__PURE__ */ e(
|
|
3552
|
+
st,
|
|
3549
3553
|
{
|
|
3550
|
-
open: !!
|
|
3554
|
+
open: !!d,
|
|
3551
3555
|
onAccept: () => {
|
|
3552
|
-
P("entityViews", y.entityViews?.filter((f) => f !==
|
|
3556
|
+
P("entityViews", y.entityViews?.filter((f) => f !== d)), g(void 0);
|
|
3553
3557
|
},
|
|
3554
3558
|
onCancel: () => g(void 0),
|
|
3555
|
-
title: /* @__PURE__ */ e(
|
|
3556
|
-
body: /* @__PURE__ */ a(
|
|
3559
|
+
title: /* @__PURE__ */ e(R, { children: "Remove this view?" }),
|
|
3560
|
+
body: /* @__PURE__ */ a(R, { children: [
|
|
3557
3561
|
"This will ",
|
|
3558
3562
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
3559
3563
|
", only the view in the CMS"
|
|
@@ -3577,7 +3581,7 @@ function Zi({
|
|
|
3577
3581
|
}
|
|
3578
3582
|
),
|
|
3579
3583
|
/* @__PURE__ */ e(
|
|
3580
|
-
|
|
3584
|
+
Zi,
|
|
3581
3585
|
{
|
|
3582
3586
|
open: h,
|
|
3583
3587
|
onClose: (f) => {
|
|
@@ -3594,7 +3598,7 @@ const Lt = {
|
|
|
3594
3598
|
singularName: "Product",
|
|
3595
3599
|
icon: "shopping_cart",
|
|
3596
3600
|
description: "List of the products currently sold in your shop",
|
|
3597
|
-
properties:
|
|
3601
|
+
properties: He({
|
|
3598
3602
|
name: {
|
|
3599
3603
|
dataType: "string",
|
|
3600
3604
|
name: "Name",
|
|
@@ -3680,7 +3684,7 @@ const Lt = {
|
|
|
3680
3684
|
icon: "article",
|
|
3681
3685
|
description: "A collection of blog entries",
|
|
3682
3686
|
defaultSize: "l",
|
|
3683
|
-
properties:
|
|
3687
|
+
properties: He({
|
|
3684
3688
|
name: {
|
|
3685
3689
|
name: "Name",
|
|
3686
3690
|
validation: { required: !0 },
|
|
@@ -3791,7 +3795,7 @@ const Lt = {
|
|
|
3791
3795
|
singularName: "User",
|
|
3792
3796
|
description: "Registered users in the app/web",
|
|
3793
3797
|
icon: "person",
|
|
3794
|
-
properties:
|
|
3798
|
+
properties: He({
|
|
3795
3799
|
displayName: {
|
|
3796
3800
|
name: "Display name",
|
|
3797
3801
|
dataType: "string"
|
|
@@ -4009,24 +4013,24 @@ const Lt = {
|
|
|
4009
4013
|
}
|
|
4010
4014
|
}
|
|
4011
4015
|
};
|
|
4012
|
-
function
|
|
4016
|
+
function Qi({
|
|
4013
4017
|
path: t,
|
|
4014
4018
|
pathSuggestions: r,
|
|
4015
4019
|
parentCollection: n,
|
|
4016
4020
|
onContinue: i,
|
|
4017
4021
|
existingCollectionPaths: l
|
|
4018
4022
|
}) {
|
|
4019
|
-
const [o,
|
|
4023
|
+
const [o, c] = $(!1), [u, p] = $();
|
|
4020
4024
|
de(() => {
|
|
4021
|
-
r && l && (
|
|
4025
|
+
r && l && (c(!0), r(t).then((v) => {
|
|
4022
4026
|
const x = v.filter((y) => !(l ?? []).find((P) => P.trim().toLowerCase() === y.trim().toLowerCase()));
|
|
4023
4027
|
p(x);
|
|
4024
|
-
}).finally(() =>
|
|
4028
|
+
}).finally(() => c(!1)));
|
|
4025
4029
|
}, [l, t, r]);
|
|
4026
4030
|
const {
|
|
4027
4031
|
values: h,
|
|
4028
4032
|
setFieldValue: m,
|
|
4029
|
-
setValues:
|
|
4033
|
+
setValues: d,
|
|
4030
4034
|
submitCount: g
|
|
4031
4035
|
} = K();
|
|
4032
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: [
|
|
@@ -4037,7 +4041,7 @@ function Ji({
|
|
|
4037
4041
|
children: /* @__PURE__ */ e(O, { variant: "h4", className: "flex-grow", children: "New collection" })
|
|
4038
4042
|
}
|
|
4039
4043
|
),
|
|
4040
|
-
n && /* @__PURE__ */ e(
|
|
4044
|
+
n && /* @__PURE__ */ e(ct, { colorScheme: "tealDarker", children: /* @__PURE__ */ a(O, { variant: "caption", children: [
|
|
4041
4045
|
"This is a subcollection of ",
|
|
4042
4046
|
/* @__PURE__ */ e("b", { children: n.name })
|
|
4043
4047
|
] }) }),
|
|
@@ -4053,11 +4057,11 @@ function Ji({
|
|
|
4053
4057
|
/* @__PURE__ */ a("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
|
|
4054
4058
|
o && !u && /* @__PURE__ */ e(De, { size: "small" }),
|
|
4055
4059
|
u?.map((v, x) => /* @__PURE__ */ e(
|
|
4056
|
-
|
|
4060
|
+
ct,
|
|
4057
4061
|
{
|
|
4058
4062
|
colorScheme: "cyanLighter",
|
|
4059
4063
|
onClick: () => {
|
|
4060
|
-
m("name",
|
|
4064
|
+
m("name", pt(v)), m("id", v), m("path", v), m("properties", void 0), i();
|
|
4061
4065
|
},
|
|
4062
4066
|
size: "small",
|
|
4063
4067
|
children: v
|
|
@@ -4078,46 +4082,46 @@ function Ji({
|
|
|
4078
4082
|
),
|
|
4079
4083
|
/* @__PURE__ */ a("div", { className: "flex gap-4", children: [
|
|
4080
4084
|
/* @__PURE__ */ e(
|
|
4081
|
-
|
|
4085
|
+
at,
|
|
4082
4086
|
{
|
|
4083
4087
|
title: "Products",
|
|
4084
4088
|
subtitle: "A collection of products with images, prices and stock",
|
|
4085
|
-
icon: /* @__PURE__ */ e(
|
|
4089
|
+
icon: /* @__PURE__ */ e(tt, { size: "small", iconKey: Lt.icon }),
|
|
4086
4090
|
onClick: () => {
|
|
4087
|
-
|
|
4091
|
+
d(Lt), i();
|
|
4088
4092
|
}
|
|
4089
4093
|
}
|
|
4090
4094
|
),
|
|
4091
4095
|
/* @__PURE__ */ e(
|
|
4092
|
-
|
|
4096
|
+
at,
|
|
4093
4097
|
{
|
|
4094
4098
|
title: "Users",
|
|
4095
4099
|
subtitle: "A collection of users with emails, names and roles",
|
|
4096
|
-
icon: /* @__PURE__ */ e(
|
|
4100
|
+
icon: /* @__PURE__ */ e(tt, { size: "small", iconKey: $t.icon }),
|
|
4097
4101
|
onClick: () => {
|
|
4098
|
-
|
|
4102
|
+
d($t), i();
|
|
4099
4103
|
}
|
|
4100
4104
|
}
|
|
4101
4105
|
),
|
|
4102
4106
|
/* @__PURE__ */ e(
|
|
4103
|
-
|
|
4107
|
+
at,
|
|
4104
4108
|
{
|
|
4105
4109
|
title: "Blog posts",
|
|
4106
4110
|
subtitle: "A collection of blog posts with images, authors and complex content",
|
|
4107
|
-
icon: /* @__PURE__ */ e(
|
|
4111
|
+
icon: /* @__PURE__ */ e(tt, { size: "small", iconKey: qt.icon }),
|
|
4108
4112
|
onClick: () => {
|
|
4109
|
-
|
|
4113
|
+
d(qt), i();
|
|
4110
4114
|
}
|
|
4111
4115
|
}
|
|
4112
4116
|
),
|
|
4113
4117
|
/* @__PURE__ */ e(
|
|
4114
|
-
|
|
4118
|
+
at,
|
|
4115
4119
|
{
|
|
4116
4120
|
title: "Pages",
|
|
4117
4121
|
subtitle: "A collection of pages with images, authors and complex content",
|
|
4118
|
-
icon: /* @__PURE__ */ e(
|
|
4122
|
+
icon: /* @__PURE__ */ e(tt, { size: "small", iconKey: Yt.icon }),
|
|
4119
4123
|
onClick: () => {
|
|
4120
|
-
|
|
4124
|
+
d(Yt), i();
|
|
4121
4125
|
}
|
|
4122
4126
|
}
|
|
4123
4127
|
)
|
|
@@ -4133,12 +4137,12 @@ function Ji({
|
|
|
4133
4137
|
children: "● Create a collection from a file (csv, json, xls, xslx...)"
|
|
4134
4138
|
}
|
|
4135
4139
|
),
|
|
4136
|
-
/* @__PURE__ */ e(
|
|
4140
|
+
/* @__PURE__ */ e(di, { onDataAdded: (v) => i(v) })
|
|
4137
4141
|
] }),
|
|
4138
4142
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(z, { variant: "text", onClick: () => i(), className: "my-2", children: "Continue from scratch" }) })
|
|
4139
4143
|
] }) });
|
|
4140
4144
|
}
|
|
4141
|
-
function
|
|
4145
|
+
function at({
|
|
4142
4146
|
title: t,
|
|
4143
4147
|
subtitle: r,
|
|
4144
4148
|
icon: n,
|
|
@@ -4148,9 +4152,9 @@ function nt({
|
|
|
4148
4152
|
tr,
|
|
4149
4153
|
{
|
|
4150
4154
|
onClick: i,
|
|
4151
|
-
className:
|
|
4155
|
+
className: fe(
|
|
4152
4156
|
"my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center",
|
|
4153
|
-
"text-gray-700 dark:text-
|
|
4157
|
+
"text-gray-700 dark:text-slate-300",
|
|
4154
4158
|
"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary",
|
|
4155
4159
|
"border-gray-400 dark:border-gray-600 "
|
|
4156
4160
|
),
|
|
@@ -4161,7 +4165,7 @@ function nt({
|
|
|
4161
4165
|
}
|
|
4162
4166
|
) });
|
|
4163
4167
|
}
|
|
4164
|
-
function
|
|
4168
|
+
function Xi({
|
|
4165
4169
|
importConfig: t,
|
|
4166
4170
|
propertyConfigs: r,
|
|
4167
4171
|
collectionEditable: n
|
|
@@ -4170,23 +4174,23 @@ function Qi({
|
|
|
4170
4174
|
setFieldValue: i,
|
|
4171
4175
|
setFieldTouched: l,
|
|
4172
4176
|
values: o
|
|
4173
|
-
} = 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 = ({
|
|
4174
4178
|
id: v,
|
|
4175
4179
|
property: x,
|
|
4176
4180
|
previousId: y,
|
|
4177
4181
|
namespace: P
|
|
4178
4182
|
}) => {
|
|
4179
|
-
const k = v ? ae(v, P) : void 0, b = k ?
|
|
4180
|
-
const _ =
|
|
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
|
+
const _ = be(w);
|
|
4181
4185
|
i(_, f, !1), p.current[w ?? ""] = f;
|
|
4182
4186
|
};
|
|
4183
4187
|
if (y && y !== v) {
|
|
4184
|
-
const f = ae(y, P), w =
|
|
4188
|
+
const f = ae(y, P), w = he(f), M = C(P).map((D) => D === y ? v : D).filter((D) => D !== void 0);
|
|
4185
4189
|
N(M, P);
|
|
4186
|
-
const
|
|
4187
|
-
Object.keys(
|
|
4188
|
-
|
|
4189
|
-
}), t.setHeadersMapping(
|
|
4190
|
+
const U = { ...t.headersMapping };
|
|
4191
|
+
Object.keys(U).forEach((D) => {
|
|
4192
|
+
U[D] === y && (U[D] = v ?? "");
|
|
4193
|
+
}), t.setHeadersMapping(U), i(w, void 0, !1), l(w, !1, !1);
|
|
4190
4194
|
}
|
|
4191
4195
|
b && (i(b, x, !1), l(b, !0, !1));
|
|
4192
4196
|
}, g = async ({
|
|
@@ -4195,8 +4199,8 @@ function Qi({
|
|
|
4195
4199
|
property: y,
|
|
4196
4200
|
namespace: P
|
|
4197
4201
|
}) => {
|
|
4198
|
-
const k = v ? ae(v, P) : void 0, b = k ?
|
|
4199
|
-
...
|
|
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
|
+
...ri(C, y, rr),
|
|
4200
4204
|
editable: !0
|
|
4201
4205
|
};
|
|
4202
4206
|
b && (N ? i(b, N, !1) : i(b, y, !1), l(b, !0, !1));
|
|
@@ -4205,19 +4209,19 @@ function Qi({
|
|
|
4205
4209
|
/* @__PURE__ */ a(mt, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
|
|
4206
4210
|
/* @__PURE__ */ e(O, { variant: "h6", className: "mt-4", children: "Data property mapping" }),
|
|
4207
4211
|
/* @__PURE__ */ e(
|
|
4208
|
-
|
|
4212
|
+
ui,
|
|
4209
4213
|
{
|
|
4210
4214
|
headersMapping: t.headersMapping,
|
|
4211
4215
|
idColumn: t.idColumn,
|
|
4212
4216
|
originProperties: t.originProperties,
|
|
4213
4217
|
destinationProperties: o.properties,
|
|
4214
|
-
onIdPropertyChanged: (v) => t.setIdColumn(v),
|
|
4218
|
+
onIdPropertyChanged: (v) => t.setIdColumn(v ?? void 0),
|
|
4215
4219
|
buildPropertyView: ({
|
|
4216
4220
|
property: v,
|
|
4217
4221
|
propertyKey: x,
|
|
4218
4222
|
importKey: y
|
|
4219
4223
|
}) => /* @__PURE__ */ e(
|
|
4220
|
-
|
|
4224
|
+
pi,
|
|
4221
4225
|
{
|
|
4222
4226
|
property: v,
|
|
4223
4227
|
propertyKey: x,
|
|
@@ -4230,7 +4234,7 @@ function Qi({
|
|
|
4230
4234
|
});
|
|
4231
4235
|
},
|
|
4232
4236
|
propertyTypeView: /* @__PURE__ */ e(
|
|
4233
|
-
|
|
4237
|
+
en,
|
|
4234
4238
|
{
|
|
4235
4239
|
property: v,
|
|
4236
4240
|
disabled: !1,
|
|
@@ -4248,14 +4252,14 @@ function Qi({
|
|
|
4248
4252
|
)
|
|
4249
4253
|
] }),
|
|
4250
4254
|
/* @__PURE__ */ e(
|
|
4251
|
-
|
|
4255
|
+
Ie,
|
|
4252
4256
|
{
|
|
4253
|
-
open:
|
|
4257
|
+
open: c !== void 0,
|
|
4254
4258
|
propertyKey: h,
|
|
4255
4259
|
property: m,
|
|
4256
4260
|
inArray: !1,
|
|
4257
4261
|
autoUpdateId: !1,
|
|
4258
|
-
onPropertyChanged:
|
|
4262
|
+
onPropertyChanged: d,
|
|
4259
4263
|
allowDataInference: !1,
|
|
4260
4264
|
collectionEditable: n,
|
|
4261
4265
|
onOkClicked: () => {
|
|
@@ -4272,32 +4276,32 @@ function Qi({
|
|
|
4272
4276
|
/* @__PURE__ */ e("div", { style: { height: "52px" } })
|
|
4273
4277
|
] });
|
|
4274
4278
|
}
|
|
4275
|
-
function
|
|
4279
|
+
function en({
|
|
4276
4280
|
property: t,
|
|
4277
4281
|
onPropertyChanged: r,
|
|
4278
4282
|
propertyKey: n,
|
|
4279
4283
|
propertyConfigs: i,
|
|
4280
4284
|
disabled: l
|
|
4281
4285
|
}) {
|
|
4282
|
-
const o = t ? Kt(t) : null,
|
|
4286
|
+
const o = t ? Kt(t) : null, c = t ? $e(t, i) : null, [u, p] = $(!1);
|
|
4283
4287
|
return /* @__PURE__ */ e(
|
|
4284
4288
|
te,
|
|
4285
4289
|
{
|
|
4286
|
-
title: t &&
|
|
4290
|
+
title: t && c ? `${c?.name} - ${t.dataType}` : void 0,
|
|
4287
4291
|
open: u ? !1 : void 0,
|
|
4288
4292
|
children: /* @__PURE__ */ e(
|
|
4289
|
-
|
|
4293
|
+
Ce,
|
|
4290
4294
|
{
|
|
4291
4295
|
open: u,
|
|
4292
4296
|
onOpenChange: p,
|
|
4293
4297
|
invisible: !0,
|
|
4294
4298
|
className: "w-full",
|
|
4295
4299
|
disabled: l,
|
|
4296
|
-
error: !
|
|
4300
|
+
error: !c,
|
|
4297
4301
|
value: o ?? "",
|
|
4298
4302
|
placeholder: "Select a property widget",
|
|
4299
4303
|
position: "item-aligned",
|
|
4300
|
-
renderValue: (h) =>
|
|
4304
|
+
renderValue: (h) => c ? /* @__PURE__ */ e(Ye, { propertyConfig: c }) : null,
|
|
4301
4305
|
onValueChange: (h) => {
|
|
4302
4306
|
const m = ar(t, h, i);
|
|
4303
4307
|
n && r({
|
|
@@ -4322,9 +4326,9 @@ function Xi({
|
|
|
4322
4326
|
}
|
|
4323
4327
|
);
|
|
4324
4328
|
}
|
|
4325
|
-
function
|
|
4329
|
+
function tn({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
4326
4330
|
de(() => {
|
|
4327
|
-
const l =
|
|
4331
|
+
const l = mi(t.originProperties, r), o = t.importData.map((c) => hi(c, t.idColumn, t.headersMapping, r, l, "TEMP_PATH"));
|
|
4328
4332
|
t.setEntities(o);
|
|
4329
4333
|
}, []);
|
|
4330
4334
|
const i = wr();
|
|
@@ -4350,12 +4354,12 @@ function en({ importConfig: t, properties: r, propertiesOrder: n }) {
|
|
|
4350
4354
|
);
|
|
4351
4355
|
}
|
|
4352
4356
|
function dr(t, r = "") {
|
|
4353
|
-
const n = Object.keys(t).reduce((o,
|
|
4354
|
-
const u = t[
|
|
4357
|
+
const n = Object.keys(t).reduce((o, c) => {
|
|
4358
|
+
const u = t[c], p = kr(c), h = r ? `${r}.${p}` : p;
|
|
4355
4359
|
if (u.dataType === "map" && u.properties) {
|
|
4356
4360
|
const g = dr(u.properties, h);
|
|
4357
4361
|
return {
|
|
4358
|
-
headersMapping: { ...o.headersMapping, [
|
|
4362
|
+
headersMapping: { ...o.headersMapping, [c]: h },
|
|
4359
4363
|
properties: {
|
|
4360
4364
|
...o.properties,
|
|
4361
4365
|
[p]: {
|
|
@@ -4371,7 +4375,7 @@ function dr(t, r = "") {
|
|
|
4371
4375
|
[p]: u
|
|
4372
4376
|
};
|
|
4373
4377
|
return {
|
|
4374
|
-
headersMapping: { ...o.headersMapping, [
|
|
4378
|
+
headersMapping: { ...o.headersMapping, [c]: h },
|
|
4375
4379
|
properties: m
|
|
4376
4380
|
};
|
|
4377
4381
|
}, { headersMapping: {}, properties: {} }), i = Object.keys(n.headersMapping)?.[0];
|
|
@@ -4382,31 +4386,31 @@ function dr(t, r = "") {
|
|
|
4382
4386
|
};
|
|
4383
4387
|
}
|
|
4384
4388
|
function ur(t) {
|
|
4385
|
-
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(() => {
|
|
4386
4390
|
n ? o(!0) : t.handleClose(void 0);
|
|
4387
4391
|
}, [n, t.handleClose]);
|
|
4388
4392
|
return de(() => {
|
|
4389
4393
|
r || (i(!1), o(!1));
|
|
4390
4394
|
}, [r]), /* @__PURE__ */ a(
|
|
4391
|
-
|
|
4395
|
+
Se,
|
|
4392
4396
|
{
|
|
4393
4397
|
open: r,
|
|
4394
4398
|
fullWidth: !0,
|
|
4395
4399
|
fullHeight: !0,
|
|
4396
4400
|
scrollable: !1,
|
|
4397
4401
|
maxWidth: "7xl",
|
|
4398
|
-
onOpenChange: (u) => u ? void 0 :
|
|
4402
|
+
onOpenChange: (u) => u ? void 0 : c(),
|
|
4399
4403
|
children: [
|
|
4400
4404
|
r && /* @__PURE__ */ e(
|
|
4401
|
-
|
|
4405
|
+
rn,
|
|
4402
4406
|
{
|
|
4403
4407
|
...t,
|
|
4404
|
-
handleCancel:
|
|
4408
|
+
handleCancel: c,
|
|
4405
4409
|
setFormDirty: i
|
|
4406
4410
|
}
|
|
4407
4411
|
),
|
|
4408
4412
|
/* @__PURE__ */ e(
|
|
4409
|
-
|
|
4413
|
+
Wi,
|
|
4410
4414
|
{
|
|
4411
4415
|
open: l,
|
|
4412
4416
|
handleOk: () => t.handleClose(void 0),
|
|
@@ -4418,62 +4422,62 @@ function ur(t) {
|
|
|
4418
4422
|
}
|
|
4419
4423
|
);
|
|
4420
4424
|
}
|
|
4421
|
-
function
|
|
4422
|
-
const { propertyConfigs: r } = Ae(), n =
|
|
4425
|
+
function rn(t) {
|
|
4426
|
+
const { propertyConfigs: r } = Ae(), n = Ne(), i = Te(), {
|
|
4423
4427
|
topLevelNavigation: l,
|
|
4424
4428
|
collections: o
|
|
4425
|
-
} = 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);
|
|
4426
4430
|
if (de(() => {
|
|
4427
4431
|
try {
|
|
4428
4432
|
n.initialised && (t.editedCollectionId ? g(n.getCollectionFromPaths([...t.parentCollectionIds ?? [], t.editedCollectionId])) : g(void 0), x(!0));
|
|
4429
4433
|
} catch (b) {
|
|
4430
4434
|
console.error(b);
|
|
4431
4435
|
}
|
|
4432
|
-
}, [
|
|
4436
|
+
}, [t.editedCollectionId, t.parentCollectionIds, n]), !l)
|
|
4433
4437
|
throw Error("Internal: Navigation not ready in collection editor");
|
|
4434
4438
|
const {
|
|
4435
4439
|
groups: y
|
|
4436
|
-
} = l, P =
|
|
4437
|
-
...
|
|
4438
|
-
id:
|
|
4439
|
-
} : void 0, k = P ?
|
|
4440
|
-
id:
|
|
4441
|
-
path:
|
|
4442
|
-
name:
|
|
4443
|
-
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 ?? "",
|
|
4444
4448
|
properties: {},
|
|
4445
4449
|
propertiesOrder: [],
|
|
4446
4450
|
icon: zt[Math.floor(Math.random() * zt.length)],
|
|
4447
4451
|
ownerId: i.user?.uid ?? ""
|
|
4448
4452
|
};
|
|
4449
4453
|
return v ? !t.isNewCollection && (!n.initialised || !v) ? /* @__PURE__ */ e(Nt, {}) : /* @__PURE__ */ e(
|
|
4450
|
-
|
|
4454
|
+
nn,
|
|
4451
4455
|
{
|
|
4452
4456
|
...t,
|
|
4453
4457
|
initialValues: k,
|
|
4454
4458
|
existingPaths: h,
|
|
4455
4459
|
existingIds: m,
|
|
4456
4460
|
includeTemplates: u,
|
|
4457
|
-
collection:
|
|
4461
|
+
collection: d,
|
|
4458
4462
|
setCollection: g,
|
|
4459
4463
|
groups: y,
|
|
4460
4464
|
propertyConfigs: r
|
|
4461
4465
|
}
|
|
4462
4466
|
) : /* @__PURE__ */ e(Nt, {});
|
|
4463
4467
|
}
|
|
4464
|
-
function
|
|
4468
|
+
function nn({
|
|
4465
4469
|
isNewCollection: t,
|
|
4466
4470
|
configController: r,
|
|
4467
4471
|
editedCollectionId: n,
|
|
4468
4472
|
parentCollectionIds: i,
|
|
4469
4473
|
fullPath: l,
|
|
4470
4474
|
collectionInference: o,
|
|
4471
|
-
handleClose:
|
|
4475
|
+
handleClose: c,
|
|
4472
4476
|
reservedGroups: u,
|
|
4473
4477
|
extraView: p,
|
|
4474
4478
|
handleCancel: h,
|
|
4475
4479
|
setFormDirty: m,
|
|
4476
|
-
pathSuggestions:
|
|
4480
|
+
pathSuggestions: d,
|
|
4477
4481
|
getUser: g,
|
|
4478
4482
|
parentCollection: v,
|
|
4479
4483
|
getData: x,
|
|
@@ -4486,14 +4490,14 @@ function rn({
|
|
|
4486
4490
|
propertyConfigs: f,
|
|
4487
4491
|
groups: w
|
|
4488
4492
|
}) {
|
|
4489
|
-
const _ =
|
|
4490
|
-
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;
|
|
4491
4495
|
return r.saveCollection({
|
|
4492
|
-
id:
|
|
4496
|
+
id: F,
|
|
4493
4497
|
collectionData: T,
|
|
4494
4498
|
previousId: n,
|
|
4495
4499
|
parentCollectionIds: i
|
|
4496
|
-
}).then(() => (B(void 0), !0)).catch((E) => (B(E), console.error(E),
|
|
4500
|
+
}).then(() => (B(void 0), !0)).catch((E) => (B(E), console.error(E), U.open({
|
|
4497
4501
|
type: "error",
|
|
4498
4502
|
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4499
4503
|
}), !1));
|
|
@@ -4507,35 +4511,35 @@ function rn({
|
|
|
4507
4511
|
if (!J)
|
|
4508
4512
|
return C(T), Promise.resolve(T);
|
|
4509
4513
|
V("loading");
|
|
4510
|
-
const
|
|
4511
|
-
if (!
|
|
4514
|
+
const F = await J?.(T);
|
|
4515
|
+
if (!F)
|
|
4512
4516
|
return C(T), Promise.resolve(T);
|
|
4513
4517
|
const E = {
|
|
4514
4518
|
...T ?? {}
|
|
4515
4519
|
};
|
|
4516
|
-
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", {
|
|
4517
4521
|
newCollection: T ?? {},
|
|
4518
4522
|
values: E
|
|
4519
4523
|
}), E) : (E.propertiesOrder = Object.keys(E.properties), E);
|
|
4520
|
-
} catch (
|
|
4521
|
-
return console.error(
|
|
4524
|
+
} catch (F) {
|
|
4525
|
+
return console.error(F), U.open({
|
|
4522
4526
|
type: "error",
|
|
4523
|
-
message: "Error inferring collection: " + (
|
|
4527
|
+
message: "Error inferring collection: " + (F.message ?? "Details in the console")
|
|
4524
4528
|
}), T;
|
|
4525
4529
|
}
|
|
4526
4530
|
}, [i, J]), ue = Tt({
|
|
4527
4531
|
initialValues: N,
|
|
4528
|
-
onSubmit: (T,
|
|
4532
|
+
onSubmit: (T, F) => {
|
|
4529
4533
|
console.log("Submitting collection", T);
|
|
4530
4534
|
try {
|
|
4531
4535
|
if (!t) {
|
|
4532
4536
|
q(T).then(() => {
|
|
4533
|
-
|
|
4537
|
+
F.resetForm({ values: N }), c(T);
|
|
4534
4538
|
});
|
|
4535
4539
|
return;
|
|
4536
4540
|
}
|
|
4537
|
-
s === "welcome" ? (L(),
|
|
4538
|
-
|
|
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({
|
|
4539
4543
|
values: E ?? T,
|
|
4540
4544
|
touched: {
|
|
4541
4545
|
path: !0,
|
|
@@ -4544,61 +4548,61 @@ function rn({
|
|
|
4544
4548
|
});
|
|
4545
4549
|
}).finally(() => {
|
|
4546
4550
|
L();
|
|
4547
|
-
}) : (
|
|
4548
|
-
|
|
4549
|
-
}) : (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 }));
|
|
4550
4554
|
} catch (E) {
|
|
4551
|
-
|
|
4555
|
+
U.open({
|
|
4552
4556
|
type: "error",
|
|
4553
4557
|
message: "Error persisting collection: " + (E.message ?? "Details in the console")
|
|
4554
|
-
}), console.error(E),
|
|
4558
|
+
}), console.error(E), F.resetForm({ values: T });
|
|
4555
4559
|
}
|
|
4556
4560
|
},
|
|
4557
4561
|
validation: (T) => {
|
|
4558
|
-
let
|
|
4559
|
-
const E = (s === "properties" || s === "subcollections" || s === "details") &&
|
|
4562
|
+
let F = {};
|
|
4563
|
+
const E = (s === "properties" || s === "subcollections" || s === "details") && yi;
|
|
4560
4564
|
if (E)
|
|
4561
4565
|
try {
|
|
4562
4566
|
E.validateSync(T, { abortEarly: !1 });
|
|
4563
4567
|
} catch (ie) {
|
|
4564
|
-
ie.inner.forEach((
|
|
4565
|
-
|
|
4568
|
+
ie.inner.forEach((Oe) => {
|
|
4569
|
+
F[Oe.path] = Oe.message;
|
|
4566
4570
|
});
|
|
4567
4571
|
}
|
|
4568
|
-
if (s === "properties" && (
|
|
4572
|
+
if (s === "properties" && (F = { ...F, ...D.current }), s === "details") {
|
|
4569
4573
|
const ie = Ht(T.path, t, y, T.id);
|
|
4570
|
-
ie && (
|
|
4571
|
-
const
|
|
4572
|
-
|
|
4574
|
+
ie && (F.path = ie);
|
|
4575
|
+
const Oe = on(T.id, t, y, P);
|
|
4576
|
+
Oe && (F.id = Oe);
|
|
4573
4577
|
}
|
|
4574
|
-
return
|
|
4578
|
+
return F;
|
|
4575
4579
|
}
|
|
4576
4580
|
}), {
|
|
4577
4581
|
values: re,
|
|
4578
|
-
setFieldValue:
|
|
4579
|
-
isSubmitting:
|
|
4580
|
-
dirty:
|
|
4582
|
+
setFieldValue: ve,
|
|
4583
|
+
isSubmitting: ke,
|
|
4584
|
+
dirty: Ke,
|
|
4581
4585
|
submitCount: gt
|
|
4582
|
-
} = ue,
|
|
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;
|
|
4583
4587
|
de(() => {
|
|
4584
|
-
m(
|
|
4585
|
-
}, [
|
|
4586
|
-
function
|
|
4587
|
-
_.setInUse(!0),
|
|
4588
|
-
const E = dr(
|
|
4589
|
-
|
|
4588
|
+
m(Ke);
|
|
4589
|
+
}, [Ke]);
|
|
4590
|
+
function Xe(T) {
|
|
4591
|
+
_.setInUse(!0), ii(T, rr).then((F) => {
|
|
4592
|
+
const E = dr(F);
|
|
4593
|
+
ve("properties", E.properties), ve("propertiesOrder", Object.keys(E.properties)), _.setIdColumn(E.idColumn), _.setImportData(T), _.setHeadersMapping(E.headersMapping), _.setOriginProperties(E.properties);
|
|
4590
4594
|
});
|
|
4591
4595
|
}
|
|
4592
4596
|
const vt = !!re.name && !!re.id, yt = () => {
|
|
4593
4597
|
const T = { ...re.properties };
|
|
4594
|
-
_.idColumn && delete T[_.idColumn],
|
|
4595
|
-
},
|
|
4596
|
-
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value: ue, children: /* @__PURE__ */ a(
|
|
4598
|
+
_.idColumn && delete T[_.idColumn], ve("properties", T), L();
|
|
4599
|
+
}, j = b?.editable === void 0 || b?.editable === !0 || t;
|
|
4600
|
+
return /* @__PURE__ */ e(Be, { fullHeight: !0, children: /* @__PURE__ */ e(kt, { value: ue, children: /* @__PURE__ */ a(R, { children: [
|
|
4597
4601
|
!t && /* @__PURE__ */ a(
|
|
4598
|
-
|
|
4602
|
+
Gr,
|
|
4599
4603
|
{
|
|
4600
4604
|
value: s,
|
|
4601
|
-
className:
|
|
4605
|
+
className: fe(wt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
|
|
4602
4606
|
onValueChange: (T) => V(T),
|
|
4603
4607
|
children: [
|
|
4604
4608
|
/* @__PURE__ */ e(Ct, { value: "details", children: "Details" }),
|
|
@@ -4612,35 +4616,35 @@ function rn({
|
|
|
4612
4616
|
{
|
|
4613
4617
|
noValidate: !0,
|
|
4614
4618
|
onSubmit: ue.handleSubmit,
|
|
4615
|
-
className:
|
|
4619
|
+
className: fe(
|
|
4616
4620
|
t ? "h-full" : "h-[calc(100%-48px)]",
|
|
4617
4621
|
"flex-grow flex flex-col relative"
|
|
4618
4622
|
),
|
|
4619
4623
|
children: [
|
|
4620
4624
|
s === "loading" && /* @__PURE__ */ e(Nt, {}),
|
|
4621
|
-
s === "extra_view" &&
|
|
4625
|
+
s === "extra_view" && pe && p?.View && /* @__PURE__ */ e(p.View, { path: pe }),
|
|
4622
4626
|
s === "welcome" && /* @__PURE__ */ e(
|
|
4623
|
-
|
|
4627
|
+
Qi,
|
|
4624
4628
|
{
|
|
4625
|
-
path:
|
|
4629
|
+
path: pe,
|
|
4626
4630
|
onContinue: (T) => {
|
|
4627
|
-
T ? (
|
|
4631
|
+
T ? (Xe(T), V("import_data_mapping")) : V("details");
|
|
4628
4632
|
},
|
|
4629
4633
|
existingCollectionPaths: y,
|
|
4630
4634
|
parentCollection: v,
|
|
4631
|
-
pathSuggestions:
|
|
4635
|
+
pathSuggestions: d
|
|
4632
4636
|
}
|
|
4633
4637
|
),
|
|
4634
4638
|
s === "import_data_mapping" && _ && /* @__PURE__ */ e(
|
|
4635
|
-
|
|
4639
|
+
Xi,
|
|
4636
4640
|
{
|
|
4637
4641
|
importConfig: _,
|
|
4638
|
-
collectionEditable:
|
|
4642
|
+
collectionEditable: j,
|
|
4639
4643
|
propertyConfigs: f
|
|
4640
4644
|
}
|
|
4641
4645
|
),
|
|
4642
4646
|
s === "import_data_preview" && _ && /* @__PURE__ */ e(
|
|
4643
|
-
|
|
4647
|
+
tn,
|
|
4644
4648
|
{
|
|
4645
4649
|
importConfig: _,
|
|
4646
4650
|
properties: re.properties,
|
|
@@ -4648,20 +4652,21 @@ function rn({
|
|
|
4648
4652
|
}
|
|
4649
4653
|
),
|
|
4650
4654
|
s === "import_data_saving" && _ && /* @__PURE__ */ e(
|
|
4651
|
-
|
|
4655
|
+
gi,
|
|
4652
4656
|
{
|
|
4653
4657
|
importConfig: _,
|
|
4654
4658
|
collection: re,
|
|
4659
|
+
path: pe,
|
|
4655
4660
|
onImportSuccess: async (T) => {
|
|
4656
|
-
|
|
4661
|
+
U.open({
|
|
4657
4662
|
type: "info",
|
|
4658
4663
|
message: "Data imported successfully"
|
|
4659
|
-
}), await q(re),
|
|
4664
|
+
}), await q(re), c(T);
|
|
4660
4665
|
}
|
|
4661
4666
|
}
|
|
4662
4667
|
),
|
|
4663
4668
|
s === "details" && /* @__PURE__ */ e(
|
|
4664
|
-
|
|
4669
|
+
bi,
|
|
4665
4670
|
{
|
|
4666
4671
|
existingPaths: y,
|
|
4667
4672
|
existingIds: P,
|
|
@@ -4672,7 +4677,7 @@ function rn({
|
|
|
4672
4677
|
}
|
|
4673
4678
|
),
|
|
4674
4679
|
s === "subcollections" && b && /* @__PURE__ */ e(
|
|
4675
|
-
|
|
4680
|
+
Ji,
|
|
4676
4681
|
{
|
|
4677
4682
|
parentCollection: v,
|
|
4678
4683
|
configController: r,
|
|
@@ -4683,15 +4688,15 @@ function rn({
|
|
|
4683
4688
|
}
|
|
4684
4689
|
),
|
|
4685
4690
|
s === "properties" && /* @__PURE__ */ e(
|
|
4686
|
-
|
|
4691
|
+
Ki,
|
|
4687
4692
|
{
|
|
4688
4693
|
showErrors: gt > 0,
|
|
4689
4694
|
isNewCollection: t,
|
|
4690
4695
|
reservedGroups: u,
|
|
4691
|
-
onPropertyError: (T,
|
|
4692
|
-
const ie =
|
|
4696
|
+
onPropertyError: (T, F, E) => {
|
|
4697
|
+
const ie = St({
|
|
4693
4698
|
...D.current,
|
|
4694
|
-
[ir(T,
|
|
4699
|
+
[ir(T, F)]: St(E, !0)
|
|
4695
4700
|
}, !0);
|
|
4696
4701
|
D.current = ie, ue.validate();
|
|
4697
4702
|
},
|
|
@@ -4699,7 +4704,7 @@ function rn({
|
|
|
4699
4704
|
getData: Re,
|
|
4700
4705
|
doCollectionInference: J,
|
|
4701
4706
|
propertyConfigs: f,
|
|
4702
|
-
collectionEditable:
|
|
4707
|
+
collectionEditable: j,
|
|
4703
4708
|
extraIcon: p?.icon && /* @__PURE__ */ e(
|
|
4704
4709
|
oe,
|
|
4705
4710
|
{
|
|
@@ -4723,7 +4728,7 @@ function rn({
|
|
|
4723
4728
|
type: "button",
|
|
4724
4729
|
onClick: () => (_.setInUse(!1), V("welcome")),
|
|
4725
4730
|
children: [
|
|
4726
|
-
/* @__PURE__ */ e(
|
|
4731
|
+
/* @__PURE__ */ e(rt, {}),
|
|
4727
4732
|
"Back"
|
|
4728
4733
|
]
|
|
4729
4734
|
}
|
|
@@ -4737,7 +4742,7 @@ function rn({
|
|
|
4737
4742
|
V("import_data_mapping");
|
|
4738
4743
|
},
|
|
4739
4744
|
children: [
|
|
4740
|
-
/* @__PURE__ */ e(
|
|
4745
|
+
/* @__PURE__ */ e(rt, {}),
|
|
4741
4746
|
"Back"
|
|
4742
4747
|
]
|
|
4743
4748
|
}
|
|
@@ -4749,7 +4754,7 @@ function rn({
|
|
|
4749
4754
|
type: "button",
|
|
4750
4755
|
onClick: () => V("welcome"),
|
|
4751
4756
|
children: [
|
|
4752
|
-
/* @__PURE__ */ e(
|
|
4757
|
+
/* @__PURE__ */ e(rt, {}),
|
|
4753
4758
|
"Back"
|
|
4754
4759
|
]
|
|
4755
4760
|
}
|
|
@@ -4761,7 +4766,7 @@ function rn({
|
|
|
4761
4766
|
type: "button",
|
|
4762
4767
|
onClick: () => V("details"),
|
|
4763
4768
|
children: [
|
|
4764
|
-
/* @__PURE__ */ e(
|
|
4769
|
+
/* @__PURE__ */ e(rt, {}),
|
|
4765
4770
|
"Back"
|
|
4766
4771
|
]
|
|
4767
4772
|
}
|
|
@@ -4802,9 +4807,9 @@ function rn({
|
|
|
4802
4807
|
variant: "filled",
|
|
4803
4808
|
color: "primary",
|
|
4804
4809
|
type: "submit",
|
|
4805
|
-
loading:
|
|
4806
|
-
disabled:
|
|
4807
|
-
startIcon: s === "properties" ? /* @__PURE__ */ e(
|
|
4810
|
+
loading: ke,
|
|
4811
|
+
disabled: ke || s === "details" && !vt,
|
|
4812
|
+
startIcon: s === "properties" ? /* @__PURE__ */ e(Kr, {}) : void 0,
|
|
4808
4813
|
children: [
|
|
4809
4814
|
s === "details" && "Next",
|
|
4810
4815
|
s === "properties" && "Create collection"
|
|
@@ -4817,7 +4822,7 @@ function rn({
|
|
|
4817
4822
|
variant: "filled",
|
|
4818
4823
|
color: "primary",
|
|
4819
4824
|
type: "submit",
|
|
4820
|
-
loading:
|
|
4825
|
+
loading: ke,
|
|
4821
4826
|
children: "Update collection"
|
|
4822
4827
|
}
|
|
4823
4828
|
)
|
|
@@ -4829,11 +4834,17 @@ function rn({
|
|
|
4829
4834
|
)
|
|
4830
4835
|
] }) }) });
|
|
4831
4836
|
}
|
|
4832
|
-
function
|
|
4833
|
-
const {
|
|
4834
|
-
|
|
4837
|
+
function an(t, r) {
|
|
4838
|
+
const {
|
|
4839
|
+
properties: n,
|
|
4840
|
+
...i
|
|
4841
|
+
} = t, l = {};
|
|
4842
|
+
return n && Object.keys(n).forEach((o) => {
|
|
4835
4843
|
l[o] = pr(n[o], r);
|
|
4836
|
-
}), {
|
|
4844
|
+
}), {
|
|
4845
|
+
...i,
|
|
4846
|
+
properties: l
|
|
4847
|
+
};
|
|
4837
4848
|
}
|
|
4838
4849
|
function pr(t, r) {
|
|
4839
4850
|
let n = t;
|
|
@@ -4845,7 +4856,10 @@ function pr(t, r) {
|
|
|
4845
4856
|
const l = {};
|
|
4846
4857
|
Object.keys(n.properties).forEach((o) => {
|
|
4847
4858
|
l[o] = pr(n.properties[o], r);
|
|
4848
|
-
}), n = {
|
|
4859
|
+
}), n = {
|
|
4860
|
+
...n,
|
|
4861
|
+
properties: l
|
|
4862
|
+
};
|
|
4849
4863
|
}
|
|
4850
4864
|
}
|
|
4851
4865
|
return n;
|
|
@@ -4853,27 +4867,27 @@ function pr(t, r) {
|
|
|
4853
4867
|
const Ht = (t, r, n, i) => {
|
|
4854
4868
|
let l;
|
|
4855
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;
|
|
4856
|
-
},
|
|
4870
|
+
}, on = (t, r, n, i) => {
|
|
4857
4871
|
if (!t)
|
|
4858
4872
|
return;
|
|
4859
4873
|
let l;
|
|
4860
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;
|
|
4861
|
-
}, mr = Y.createContext({}), hr = Y.createContext({}),
|
|
4875
|
+
}, mr = Y.createContext({}), hr = Y.createContext({}), ln = Y.memo(
|
|
4862
4876
|
function({
|
|
4863
4877
|
children: r,
|
|
4864
4878
|
collectionConfigController: n,
|
|
4865
4879
|
configPermissions: i,
|
|
4866
4880
|
reservedGroups: l,
|
|
4867
4881
|
collectionInference: o,
|
|
4868
|
-
extraView:
|
|
4882
|
+
extraView: c,
|
|
4869
4883
|
pathSuggestions: u,
|
|
4870
4884
|
getUser: p,
|
|
4871
4885
|
getData: h,
|
|
4872
4886
|
onAnalyticsEvent: m
|
|
4873
4887
|
}) {
|
|
4874
|
-
const
|
|
4888
|
+
const d = Ne(), g = vi(), v = _e(), { propertyConfigs: x } = Ae(), {
|
|
4875
4889
|
collections: y
|
|
4876
|
-
} =
|
|
4890
|
+
} = d, P = (y ?? []).map((s) => s.path.trim().toLowerCase()), [k, b] = Y.useState();
|
|
4877
4891
|
de(() => {
|
|
4878
4892
|
u && u().then((s) => {
|
|
4879
4893
|
b(s.filter((V) => !P.includes(V.trim().toLowerCase())));
|
|
@@ -4897,7 +4911,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4897
4911
|
parentCollection: B,
|
|
4898
4912
|
redirect: !1
|
|
4899
4913
|
});
|
|
4900
|
-
}, []),
|
|
4914
|
+
}, []), U = Q(({
|
|
4901
4915
|
propertyKey: s,
|
|
4902
4916
|
property: V,
|
|
4903
4917
|
editedCollectionId: G,
|
|
@@ -4905,7 +4919,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4905
4919
|
parentCollectionIds: q,
|
|
4906
4920
|
collection: L
|
|
4907
4921
|
}) => {
|
|
4908
|
-
console.debug("
|
|
4922
|
+
console.debug("Edit property", s, V, G, B, q, L), m?.("edit_property", { propertyKey: s, editedCollectionId: G });
|
|
4909
4923
|
const J = s && s.includes(".") ? s.substring(0, s.lastIndexOf(".")) : void 0, le = s && s.includes(".") ? s.substring(s.lastIndexOf(".") + 1) : s;
|
|
4910
4924
|
w({
|
|
4911
4925
|
propertyKey: le,
|
|
@@ -4937,7 +4951,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4937
4951
|
value: {
|
|
4938
4952
|
editCollection: M,
|
|
4939
4953
|
createCollection: D,
|
|
4940
|
-
editProperty:
|
|
4954
|
+
editProperty: U,
|
|
4941
4955
|
configPermissions: i ?? _,
|
|
4942
4956
|
rootPathSuggestions: k
|
|
4943
4957
|
},
|
|
@@ -4953,12 +4967,12 @@ const Ht = (t, r, n, i) => {
|
|
|
4953
4967
|
...C,
|
|
4954
4968
|
getData: h,
|
|
4955
4969
|
reservedGroups: l,
|
|
4956
|
-
extraView:
|
|
4970
|
+
extraView: c,
|
|
4957
4971
|
pathSuggestions: A,
|
|
4958
4972
|
getUser: p,
|
|
4959
4973
|
handleClose: (s) => {
|
|
4960
4974
|
if (C?.redirect && s && C?.isNewCollection && !C.parentCollectionIds.length) {
|
|
4961
|
-
const V =
|
|
4975
|
+
const V = d.buildUrlCollectionPath(s.id ?? s.path);
|
|
4962
4976
|
g(V);
|
|
4963
4977
|
}
|
|
4964
4978
|
N(void 0);
|
|
@@ -4966,7 +4980,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4966
4980
|
}
|
|
4967
4981
|
),
|
|
4968
4982
|
/* @__PURE__ */ e(
|
|
4969
|
-
|
|
4983
|
+
Ie,
|
|
4970
4984
|
{
|
|
4971
4985
|
open: !!f,
|
|
4972
4986
|
includeIdAndName: !0,
|
|
@@ -4977,7 +4991,7 @@ const Ht = (t, r, n, i) => {
|
|
|
4977
4991
|
collectionEditable: f?.collectionEditable ?? !1,
|
|
4978
4992
|
getData: h && f?.editedCollectionId ? () => {
|
|
4979
4993
|
console.debug("get data for property", f?.editedCollectionId);
|
|
4980
|
-
const s =
|
|
4994
|
+
const s = d.resolveAliasesFrom(f.editedCollectionId);
|
|
4981
4995
|
return h(s, []);
|
|
4982
4996
|
} : void 0,
|
|
4983
4997
|
onPropertyChanged: ({
|
|
@@ -5038,96 +5052,40 @@ const Ht = (t, r, n, i) => {
|
|
|
5038
5052
|
}
|
|
5039
5053
|
) });
|
|
5040
5054
|
},
|
|
5041
|
-
|
|
5042
|
-
),
|
|
5043
|
-
function
|
|
5055
|
+
ye
|
|
5056
|
+
), ge = () => Jt(hr);
|
|
5057
|
+
function sn({
|
|
5044
5058
|
path: t,
|
|
5045
5059
|
parentCollectionIds: r,
|
|
5046
5060
|
collection: n,
|
|
5047
5061
|
tableController: i
|
|
5048
5062
|
}) {
|
|
5049
|
-
const l =
|
|
5063
|
+
const l = Te(), o = Ne(), c = ge(), u = o.getCollectionFromIds(r), p = c.configPermissions ? c.configPermissions({
|
|
5050
5064
|
user: l.user,
|
|
5051
5065
|
collection: n
|
|
5052
5066
|
}).editCollections : !0;
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
children: /* @__PURE__ */ e(Kr, {})
|
|
5069
|
-
}
|
|
5070
|
-
)
|
|
5071
|
-
}
|
|
5072
|
-
),
|
|
5073
|
-
/* @__PURE__ */ e(
|
|
5074
|
-
te,
|
|
5075
|
-
{
|
|
5076
|
-
title: i.sortBy || i.filterValues ? "Save default filter and sort" : "Clear default filter and sort",
|
|
5077
|
-
children: /* @__PURE__ */ e(
|
|
5078
|
-
z,
|
|
5079
|
-
{
|
|
5080
|
-
color: "primary",
|
|
5081
|
-
size: "small",
|
|
5082
|
-
variant: "outlined",
|
|
5083
|
-
onClick: () => u?.saveCollection({
|
|
5084
|
-
id: n.id,
|
|
5085
|
-
parentCollectionIds: r,
|
|
5086
|
-
collectionData: W(
|
|
5087
|
-
n,
|
|
5088
|
-
{
|
|
5089
|
-
initialFilter: i.filterValues ?? null,
|
|
5090
|
-
initialSort: i.sortBy ?? null
|
|
5091
|
-
}
|
|
5092
|
-
)
|
|
5093
|
-
}).then(() => {
|
|
5094
|
-
p.open({
|
|
5095
|
-
type: "success",
|
|
5096
|
-
message: "Default config saved"
|
|
5097
|
-
});
|
|
5098
|
-
}),
|
|
5099
|
-
children: /* @__PURE__ */ e(Wr, {})
|
|
5100
|
-
}
|
|
5101
|
-
)
|
|
5102
|
-
}
|
|
5103
|
-
)
|
|
5104
|
-
] })), /* @__PURE__ */ a(j, { children: [
|
|
5105
|
-
m && c,
|
|
5106
|
-
/* @__PURE__ */ e(
|
|
5107
|
-
te,
|
|
5108
|
-
{
|
|
5109
|
-
title: m ? "Edit collection" : "You don't have permissions to edit this collection",
|
|
5110
|
-
children: /* @__PURE__ */ e(
|
|
5111
|
-
oe,
|
|
5112
|
-
{
|
|
5113
|
-
color: "primary",
|
|
5114
|
-
disabled: !m,
|
|
5115
|
-
onClick: m ? () => d?.editCollection({ id: n.id, fullPath: t, parentCollectionIds: r, parentCollection: h }) : void 0,
|
|
5116
|
-
children: /* @__PURE__ */ e(He, {})
|
|
5117
|
-
}
|
|
5118
|
-
)
|
|
5119
|
-
}
|
|
5120
|
-
)
|
|
5121
|
-
] });
|
|
5122
|
-
}
|
|
5123
|
-
function at(t) {
|
|
5124
|
-
return t && Object.keys(t).length === 0 ? t : t ?? null;
|
|
5067
|
+
return /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
|
|
5068
|
+
te,
|
|
5069
|
+
{
|
|
5070
|
+
title: p ? "Edit collection" : "You don't have permissions to edit this collection",
|
|
5071
|
+
children: /* @__PURE__ */ e(
|
|
5072
|
+
oe,
|
|
5073
|
+
{
|
|
5074
|
+
color: "primary",
|
|
5075
|
+
disabled: !p,
|
|
5076
|
+
onClick: p ? () => c?.editCollection({ id: n.id, fullPath: t, parentCollectionIds: r, parentCollection: u }) : void 0,
|
|
5077
|
+
children: /* @__PURE__ */ e(Ge, {})
|
|
5078
|
+
}
|
|
5079
|
+
)
|
|
5080
|
+
}
|
|
5081
|
+
) });
|
|
5125
5082
|
}
|
|
5126
|
-
|
|
5083
|
+
const fr = () => Jt(mr);
|
|
5084
|
+
function cn({
|
|
5127
5085
|
path: t,
|
|
5128
5086
|
collection: r
|
|
5129
5087
|
}) {
|
|
5130
|
-
const n =
|
|
5088
|
+
const n = _e(), i = Te(), l = fr(), o = ge(), c = o.configPermissions({
|
|
5131
5089
|
user: i.user,
|
|
5132
5090
|
collection: r
|
|
5133
5091
|
}), u = Q(() => {
|
|
@@ -5140,38 +5098,38 @@ function sn({
|
|
|
5140
5098
|
});
|
|
5141
5099
|
});
|
|
5142
5100
|
}, [t, l]);
|
|
5143
|
-
return /* @__PURE__ */ a(
|
|
5101
|
+
return /* @__PURE__ */ a(R, { children: [
|
|
5144
5102
|
/* @__PURE__ */ a("div", { children: [
|
|
5145
|
-
|
|
5146
|
-
|
|
5103
|
+
c.deleteCollections && /* @__PURE__ */ e(
|
|
5104
|
+
Wr,
|
|
5147
5105
|
{
|
|
5148
|
-
trigger: /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(
|
|
5149
|
-
children: /* @__PURE__ */ a(
|
|
5150
|
-
|
|
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);
|
|
5151
5109
|
}, children: [
|
|
5152
|
-
/* @__PURE__ */ e(
|
|
5110
|
+
/* @__PURE__ */ e(ut, {}),
|
|
5153
5111
|
"Delete"
|
|
5154
5112
|
] })
|
|
5155
5113
|
}
|
|
5156
5114
|
),
|
|
5157
|
-
|
|
5115
|
+
c.editCollections && /* @__PURE__ */ e(
|
|
5158
5116
|
oe,
|
|
5159
5117
|
{
|
|
5160
|
-
onClick: (
|
|
5118
|
+
onClick: (d) => {
|
|
5161
5119
|
u();
|
|
5162
5120
|
},
|
|
5163
|
-
children: /* @__PURE__ */ e(
|
|
5121
|
+
children: /* @__PURE__ */ e(Ge, { size: "small" })
|
|
5164
5122
|
}
|
|
5165
5123
|
)
|
|
5166
5124
|
] }),
|
|
5167
5125
|
/* @__PURE__ */ e(
|
|
5168
|
-
|
|
5126
|
+
st,
|
|
5169
5127
|
{
|
|
5170
5128
|
open: p,
|
|
5171
5129
|
onAccept: m,
|
|
5172
5130
|
onCancel: () => h(!1),
|
|
5173
|
-
title: /* @__PURE__ */ e(
|
|
5174
|
-
body: /* @__PURE__ */ a(
|
|
5131
|
+
title: /* @__PURE__ */ e(R, { children: "Delete this collection?" }),
|
|
5132
|
+
body: /* @__PURE__ */ a(R, { children: [
|
|
5175
5133
|
" This will ",
|
|
5176
5134
|
/* @__PURE__ */ e("b", { children: "not delete any data" }),
|
|
5177
5135
|
", only the collection in the CMS"
|
|
@@ -5180,19 +5138,19 @@ function sn({
|
|
|
5180
5138
|
)
|
|
5181
5139
|
] });
|
|
5182
5140
|
}
|
|
5183
|
-
function
|
|
5141
|
+
function dn({
|
|
5184
5142
|
group: t,
|
|
5185
5143
|
context: r
|
|
5186
5144
|
}) {
|
|
5187
5145
|
if (!r.navigation.topLevelNavigation)
|
|
5188
5146
|
throw Error("Navigation not ready in FireCMSHomePage");
|
|
5189
|
-
const n =
|
|
5147
|
+
const n = Te(), i = ge(), l = i.configPermissions ? i.configPermissions({
|
|
5190
5148
|
user: n.user
|
|
5191
5149
|
}).createCollections : !0;
|
|
5192
5150
|
return /* @__PURE__ */ e(
|
|
5193
5151
|
tr,
|
|
5194
5152
|
{
|
|
5195
|
-
className:
|
|
5153
|
+
className: fe("h-full p-4 min-h-[124px]"),
|
|
5196
5154
|
onClick: i && l ? () => i.createCollection({
|
|
5197
5155
|
initialValues: t ? { group: t } : void 0,
|
|
5198
5156
|
parentCollectionIds: [],
|
|
@@ -5221,14 +5179,14 @@ function cn({
|
|
|
5221
5179
|
}
|
|
5222
5180
|
);
|
|
5223
5181
|
}
|
|
5224
|
-
function
|
|
5225
|
-
const r =
|
|
5182
|
+
function un({ introMode: t }) {
|
|
5183
|
+
const r = Te(), n = Ne(), i = ge(), l = i.configPermissions ? i.configPermissions({
|
|
5226
5184
|
user: r.user
|
|
5227
|
-
}).createCollections : !0, o = i.rootPathSuggestions,
|
|
5185
|
+
}).createCollections : !0, o = i.rootPathSuggestions, c = (o ?? []).length > 3 || (n.collections ?? []).length === 0 && (o ?? []).length > 0;
|
|
5228
5186
|
return /* @__PURE__ */ e(
|
|
5229
|
-
|
|
5187
|
+
Qr,
|
|
5230
5188
|
{
|
|
5231
|
-
in: t === "existing_project" ||
|
|
5189
|
+
in: t === "existing_project" || c,
|
|
5232
5190
|
children: /* @__PURE__ */ a(
|
|
5233
5191
|
"div",
|
|
5234
5192
|
{
|
|
@@ -5250,12 +5208,12 @@ function dn({ introMode: t }) {
|
|
|
5250
5208
|
className: "flex flex-row gap-1 overflow-scroll no-scrollbar ",
|
|
5251
5209
|
children: [
|
|
5252
5210
|
(o ?? []).map((p) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
5253
|
-
|
|
5211
|
+
ct,
|
|
5254
5212
|
{
|
|
5255
5213
|
icon: /* @__PURE__ */ e(se, { size: "small" }),
|
|
5256
5214
|
colorScheme: "cyanLighter",
|
|
5257
5215
|
onClick: i && l ? () => i.createCollection({
|
|
5258
|
-
initialValues: { path: p, name:
|
|
5216
|
+
initialValues: { path: p, name: pt(p) },
|
|
5259
5217
|
parentCollectionIds: [],
|
|
5260
5218
|
redirect: !0,
|
|
5261
5219
|
sourceClick: "root_collection_suggestion"
|
|
@@ -5275,7 +5233,7 @@ function dn({ introMode: t }) {
|
|
|
5275
5233
|
}
|
|
5276
5234
|
);
|
|
5277
5235
|
}
|
|
5278
|
-
function
|
|
5236
|
+
function pn({
|
|
5279
5237
|
propertyKey: t,
|
|
5280
5238
|
onHover: r,
|
|
5281
5239
|
property: n,
|
|
@@ -5283,13 +5241,13 @@ function un({
|
|
|
5283
5241
|
parentCollectionIds: l,
|
|
5284
5242
|
collection: o
|
|
5285
5243
|
}) {
|
|
5286
|
-
const
|
|
5244
|
+
const c = ge();
|
|
5287
5245
|
return /* @__PURE__ */ e(te, { title: "Edit", children: /* @__PURE__ */ e(
|
|
5288
5246
|
oe,
|
|
5289
5247
|
{
|
|
5290
5248
|
className: r ? "bg-white dark:bg-gray-950" : "hidden",
|
|
5291
5249
|
onClick: () => {
|
|
5292
|
-
|
|
5250
|
+
c.editProperty({
|
|
5293
5251
|
propertyKey: t,
|
|
5294
5252
|
property: n,
|
|
5295
5253
|
editedCollectionId: o.id,
|
|
@@ -5298,16 +5256,16 @@ function un({
|
|
|
5298
5256
|
});
|
|
5299
5257
|
},
|
|
5300
5258
|
size: "small",
|
|
5301
|
-
children: /* @__PURE__ */ e(
|
|
5259
|
+
children: /* @__PURE__ */ e(Ge, { size: "small" })
|
|
5302
5260
|
}
|
|
5303
5261
|
) });
|
|
5304
5262
|
}
|
|
5305
|
-
function
|
|
5263
|
+
function mn({
|
|
5306
5264
|
fullPath: t,
|
|
5307
5265
|
parentCollectionIds: r,
|
|
5308
5266
|
collection: n
|
|
5309
5267
|
}) {
|
|
5310
|
-
const i =
|
|
5268
|
+
const i = Te(), l = ge(), o = l.configPermissions ? l.configPermissions({
|
|
5311
5269
|
user: i.user,
|
|
5312
5270
|
collection: n
|
|
5313
5271
|
}).editCollections : !0;
|
|
@@ -5327,9 +5285,9 @@ function pn({
|
|
|
5327
5285
|
}
|
|
5328
5286
|
) });
|
|
5329
5287
|
}
|
|
5330
|
-
function
|
|
5331
|
-
const t =
|
|
5332
|
-
return /* @__PURE__ */ a(
|
|
5288
|
+
function hn() {
|
|
5289
|
+
const t = ge();
|
|
5290
|
+
return /* @__PURE__ */ e("div", { className: "bg-gray-50 dark:bg-gray-900 min-w-fit rounded", children: /* @__PURE__ */ a(
|
|
5333
5291
|
z,
|
|
5334
5292
|
{
|
|
5335
5293
|
className: "min-w-fit",
|
|
@@ -5344,28 +5302,91 @@ function mn() {
|
|
|
5344
5302
|
"New collection"
|
|
5345
5303
|
]
|
|
5346
5304
|
}
|
|
5347
|
-
);
|
|
5305
|
+
) });
|
|
5306
|
+
}
|
|
5307
|
+
function fn({
|
|
5308
|
+
path: t,
|
|
5309
|
+
parentCollectionIds: r,
|
|
5310
|
+
collection: n,
|
|
5311
|
+
tableController: i
|
|
5312
|
+
}) {
|
|
5313
|
+
const l = Te(), o = ge(), c = fr(), u = _e(), p = o.configPermissions ? o.configPermissions({
|
|
5314
|
+
user: l.user,
|
|
5315
|
+
collection: n
|
|
5316
|
+
}).editCollections : !0;
|
|
5317
|
+
let h = null;
|
|
5318
|
+
return (!ye(ot(i.filterValues), ot(n.initialFilter)) || !ye(ot(i.sortBy), ot(n.initialSort))) && (h = /* @__PURE__ */ a(R, { children: [
|
|
5319
|
+
/* @__PURE__ */ e(
|
|
5320
|
+
te,
|
|
5321
|
+
{
|
|
5322
|
+
title: i.sortBy || i.filterValues ? "Save default filter and sort" : "Clear default filter and sort",
|
|
5323
|
+
children: /* @__PURE__ */ e(
|
|
5324
|
+
z,
|
|
5325
|
+
{
|
|
5326
|
+
color: "primary",
|
|
5327
|
+
size: "small",
|
|
5328
|
+
variant: "outlined",
|
|
5329
|
+
onClick: () => c?.saveCollection({
|
|
5330
|
+
id: n.id,
|
|
5331
|
+
parentCollectionIds: r,
|
|
5332
|
+
collectionData: W(
|
|
5333
|
+
n,
|
|
5334
|
+
{
|
|
5335
|
+
initialFilter: i.filterValues ?? null,
|
|
5336
|
+
initialSort: i.sortBy ?? null
|
|
5337
|
+
}
|
|
5338
|
+
)
|
|
5339
|
+
}).then(() => {
|
|
5340
|
+
u.open({
|
|
5341
|
+
type: "success",
|
|
5342
|
+
message: "Default config saved"
|
|
5343
|
+
});
|
|
5344
|
+
}),
|
|
5345
|
+
children: /* @__PURE__ */ e(Xr, {})
|
|
5346
|
+
}
|
|
5347
|
+
)
|
|
5348
|
+
}
|
|
5349
|
+
),
|
|
5350
|
+
(n.initialFilter || n.initialSort) && /* @__PURE__ */ e(
|
|
5351
|
+
te,
|
|
5352
|
+
{
|
|
5353
|
+
title: "Reset to default filter and sort",
|
|
5354
|
+
children: /* @__PURE__ */ e(
|
|
5355
|
+
z,
|
|
5356
|
+
{
|
|
5357
|
+
color: "primary",
|
|
5358
|
+
size: "small",
|
|
5359
|
+
variant: "text",
|
|
5360
|
+
onClick: () => {
|
|
5361
|
+
i.clearFilter?.(), n?.initialFilter && i.setFilterValues?.(n?.initialFilter), n?.initialSort && i.setSortBy?.(n?.initialSort);
|
|
5362
|
+
},
|
|
5363
|
+
children: /* @__PURE__ */ e(ei, {})
|
|
5364
|
+
}
|
|
5365
|
+
)
|
|
5366
|
+
}
|
|
5367
|
+
)
|
|
5368
|
+
] })), /* @__PURE__ */ e(R, { children: p && h });
|
|
5348
5369
|
}
|
|
5349
|
-
function
|
|
5370
|
+
function ot(t) {
|
|
5371
|
+
return t && Object.keys(t).length === 0 ? t : t ?? null;
|
|
5372
|
+
}
|
|
5373
|
+
function Sn({
|
|
5350
5374
|
collectionConfigController: t,
|
|
5351
5375
|
introMode: r,
|
|
5352
5376
|
configPermissions: n,
|
|
5353
5377
|
reservedGroups: i,
|
|
5354
5378
|
extraView: l,
|
|
5355
5379
|
pathSuggestions: o,
|
|
5356
|
-
getUser:
|
|
5380
|
+
getUser: c,
|
|
5357
5381
|
collectionInference: u,
|
|
5358
5382
|
getData: p,
|
|
5359
5383
|
onAnalyticsEvent: h
|
|
5360
5384
|
}) {
|
|
5361
5385
|
return {
|
|
5362
|
-
|
|
5386
|
+
key: "collection_editor",
|
|
5363
5387
|
loading: t.loading,
|
|
5364
|
-
collections: {
|
|
5365
|
-
CollectionActions: ln
|
|
5366
|
-
},
|
|
5367
5388
|
provider: {
|
|
5368
|
-
Component:
|
|
5389
|
+
Component: ln,
|
|
5369
5390
|
props: {
|
|
5370
5391
|
collectionConfigController: t,
|
|
5371
5392
|
configPermissions: n,
|
|
@@ -5373,28 +5394,30 @@ function In({
|
|
|
5373
5394
|
reservedGroups: i,
|
|
5374
5395
|
extraView: l,
|
|
5375
5396
|
pathSuggestions: o,
|
|
5376
|
-
getUser:
|
|
5397
|
+
getUser: c,
|
|
5377
5398
|
getData: p,
|
|
5378
5399
|
onAnalyticsEvent: h
|
|
5379
5400
|
}
|
|
5380
5401
|
},
|
|
5381
5402
|
homePage: {
|
|
5382
|
-
additionalActions: /* @__PURE__ */ e(
|
|
5383
|
-
additionalChildrenStart: r ? /* @__PURE__ */ e(
|
|
5384
|
-
additionalChildrenEnd: /* @__PURE__ */ e(
|
|
5385
|
-
CollectionActions:
|
|
5386
|
-
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
|
|
5387
5408
|
},
|
|
5388
5409
|
collectionView: {
|
|
5389
|
-
|
|
5390
|
-
|
|
5410
|
+
CollectionActionsStart: fn,
|
|
5411
|
+
CollectionActions: sn,
|
|
5412
|
+
HeaderAction: pn,
|
|
5413
|
+
AddColumnComponent: mn
|
|
5391
5414
|
}
|
|
5392
5415
|
};
|
|
5393
5416
|
}
|
|
5394
|
-
function
|
|
5395
|
-
if (!
|
|
5417
|
+
function gn({ introMode: t }) {
|
|
5418
|
+
if (!Ne().topLevelNavigation)
|
|
5396
5419
|
throw Error("Navigation not ready in FireCMSHomePage");
|
|
5397
|
-
const n =
|
|
5420
|
+
const n = Te(), i = ge(), l = i.configPermissions ? i.configPermissions({
|
|
5398
5421
|
user: n.user
|
|
5399
5422
|
}).createCollections : !0;
|
|
5400
5423
|
return /* @__PURE__ */ a("div", { className: "mt-8 flex flex-col mt-8 p-2", children: [
|
|
@@ -5418,8 +5441,16 @@ function hn({ introMode: t }) {
|
|
|
5418
5441
|
)
|
|
5419
5442
|
] });
|
|
5420
5443
|
}
|
|
5421
|
-
|
|
5422
|
-
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();
|
|
5423
5454
|
return /* @__PURE__ */ a("div", { className: "p-1 flex flex-col items-center", children: [
|
|
5424
5455
|
/* @__PURE__ */ e(Wt, { error: "No collection for path: " + n }),
|
|
5425
5456
|
/* @__PURE__ */ e(
|
|
@@ -5430,7 +5461,7 @@ function _n({ path: t }) {
|
|
|
5430
5461
|
size: "small",
|
|
5431
5462
|
onClick: () => {
|
|
5432
5463
|
l.createCollection({
|
|
5433
|
-
initialValues: { path: n, name:
|
|
5464
|
+
initialValues: { path: n, name: pt(n) },
|
|
5434
5465
|
parentCollectionIds: i,
|
|
5435
5466
|
redirect: !1,
|
|
5436
5467
|
sourceClick: "missing_reference"
|
|
@@ -5441,21 +5472,22 @@ function _n({ path: t }) {
|
|
|
5441
5472
|
)
|
|
5442
5473
|
] });
|
|
5443
5474
|
}
|
|
5444
|
-
function
|
|
5475
|
+
function vn(t) {
|
|
5445
5476
|
const r = t.split("/");
|
|
5446
5477
|
return r[r.length - 1];
|
|
5447
5478
|
}
|
|
5448
5479
|
export {
|
|
5449
|
-
|
|
5480
|
+
En as MissingReferenceWidget,
|
|
5450
5481
|
qe as editableProperty,
|
|
5451
5482
|
ae as getFullId,
|
|
5452
5483
|
ir as getFullIdPath,
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5484
|
+
he as idToPropertiesPath,
|
|
5485
|
+
Fn as mergeCollections,
|
|
5486
|
+
be as namespaceToPropertiesOrderPath,
|
|
5487
|
+
Ci as namespaceToPropertiesPath,
|
|
5488
|
+
Ti as removeNonEditableProperties,
|
|
5489
|
+
ge as useCollectionEditorController,
|
|
5490
|
+
Sn as useCollectionEditorPlugin,
|
|
5459
5491
|
fr as useCollectionsConfigController
|
|
5460
5492
|
};
|
|
5461
5493
|
//# sourceMappingURL=index.es.js.map
|