@levo-so/studio 0.1.109 → 0.1.111
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/{BillingStep-DZeqbtfs.js → BillingStep-CY2MHQ-L.js} +1 -1
- package/{Button-BMUB23Y7.js → Button-DjphTnCg.js} +160 -148
- package/CollectionField-DrJuHNsg.js +318 -0
- package/{DateTimeWidget-DWbn_kXp.js → DateTimeWidget-BVHZh4EV.js} +13 -14
- package/{EntryCard-BNZ-0_Kv.js → EntryCard-BYONyIm5.js} +3 -3
- package/{LoginCard-B1XlZfEU.js → LoginCard-CrtSHdaR.js} +3 -3
- package/{LoginForm-NmDPe72V.js → LoginForm-DeYsk4kd.js} +2 -2
- package/{LoginModal-CVd08mNx.js → LoginModal-BbDfB4S9.js} +3 -3
- package/{MessageCard-C2fU_Bo_.js → MessageCard-x6jPClGi.js} +2 -2
- package/{MessageFooter-4qIEK91O.js → MessageFooter-CHuPnL_D.js} +1 -1
- package/{ModalManager-Dqq7D60M.js → ModalManager-DQVNPEuG.js} +1 -1
- package/{PendingApprovalCard-CXOEpAbg.js → PendingApprovalCard-CsnyrSsa.js} +3 -3
- package/{PhoneWidget-CtNIit2w.js → PhoneWidget-BaDSMSW5.js} +5 -6
- package/{PopupRenderer-SSn97BLs-DQfvcymq.js → PopupRenderer-Dd9zoNIY-Cx663DmW.js} +258 -223
- package/{ProfileCard-CzL5uB2z.js → ProfileCard-Dg5TY1Mw.js} +3 -3
- package/{RichTextWidget-DkRrKQqN.js → RichTextWidget-yaDCZwIo.js} +10 -11
- package/{RteThemeProvider-Cfepkyer.js → RteThemeProvider-LFGzAYi1.js} +2 -2
- package/{Toolbar-C3WDkSnO.js → Toolbar-D3PnF7Ud.js} +3 -3
- package/{VerifyButton-TNkt-SDu.js → VerifyButton-6BIXAEGp.js} +1 -1
- package/{bookingCard-61Yx6JO-.js → bookingCard-D40dbgvH.js} +3 -3
- package/collection.js +6 -8
- package/dist-bHoi1bCB.js +3795 -0
- package/index.d.ts +77 -2
- package/index.js +2391 -2197
- package/{inlineCollectionTheme-WpCvMKrW.js → inlineCollectionTheme-D2w17LHX.js} +1 -1
- package/{inlineRteTheme-Ajq9PNpQ.js → inlineRteTheme-abXxag3B.js} +1 -1
- package/package.json +5 -5
- package/studio.css +1 -1
- package/{utils-BJLmuC5w.js → utils-C_tr8kXV.js} +1 -1
- package/CollectionField-xa-jed3_.js +0 -232
- package/dist-Cfv-YjpI.js +0 -3469
- package/getFieldValidations-CSkSV2hW.js +0 -90
- package/widgets-K6ECnoJJ.js +0 -335
- /package/{Beams-WJN38XSv.js → Beams-DboMUgCv.js} +0 -0
- /package/{CollectionInput-CpNGIXJx.js → CollectionInput-CG-Pu_51.js} +0 -0
- /package/{Dots-DggLz5I7.js → Dots-a8xSboDv.js} +0 -0
- /package/{Gradient-BSWJAu0a.js → Gradient-NacpoDCM.js} +0 -0
- /package/{Grid-BFKl0MUt.js → Grid-BJQvxnks.js} +0 -0
- /package/{Popover-O1poOHk2.js → Popover-DnZY1k6o.js} +0 -0
- /package/{StripePaymentModal-Do1xHctU.js → StripePaymentModal-BsYNQ4MB.js} +0 -0
- /package/{Tooltip-NEMQqPyr.js → Tooltip-DreKXbTO.js} +0 -0
- /package/{Waves-BPEgTYoO.js → Waves-DUuT_IFr.js} +0 -0
- /package/{authentication-hnV1BI8s.js → authentication-TdyaDNTn.js} +0 -0
- /package/{card-5ooLmYSr.js → card-D5fPArfa.js} +0 -0
- /package/{dialog-DoxC50i0.js → dialog-LRLdr3kq.js} +0 -0
- /package/{theme.cssm-BXDp-ojp.js → theme.cssm-2YTdd8Yh.js} +0 -0
- /package/{useLogin-D4A5iRey.js → useLogin-B2HHZxTi.js} +0 -0
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { FieldInterfaces as e } from "@levo-so/core";
|
|
2
|
-
import { isValidPhoneNumber as t } from "react-phone-number-input";
|
|
3
|
-
import * as n from "yup";
|
|
4
|
-
//#region ../../libraries/react-collection/dist/utils/getFieldValidations.js
|
|
5
|
-
var r = (r, i) => {
|
|
6
|
-
let a = (r?.label || r?.key || "")?.replace(/_/g, " ");
|
|
7
|
-
if (a?.endsWith("Id") && (a = a?.replace("Id", "")), a.includes(".")) {
|
|
8
|
-
let [e] = a.split(".");
|
|
9
|
-
e && (a = e);
|
|
10
|
-
}
|
|
11
|
-
let o = (e) => {
|
|
12
|
-
let t = e;
|
|
13
|
-
return r.max !== void 0 && r.max !== null && r.max !== "" && (t = t.max(Number(r.max), `The ${a} value is too large (max ${r.max})`)), r.min !== void 0 && r.min !== null && r.min !== "" && (t = t.min(Number(r.min), `The ${a} value is too small (min ${r.min})`)), t;
|
|
14
|
-
}, s;
|
|
15
|
-
switch (r.field_interface) {
|
|
16
|
-
case e.NumberWidget:
|
|
17
|
-
s = o(n.number());
|
|
18
|
-
break;
|
|
19
|
-
case e.ArrayWidget:
|
|
20
|
-
s = o(n.array().typeError("The field must be an array"));
|
|
21
|
-
break;
|
|
22
|
-
case e.RecordWidget:
|
|
23
|
-
s = n.object();
|
|
24
|
-
break;
|
|
25
|
-
case e.EmailWidget:
|
|
26
|
-
s = o(n.string().email("The email address is not valid"));
|
|
27
|
-
break;
|
|
28
|
-
case e.PhoneWidget:
|
|
29
|
-
s = o(n.string().test("phone", "The phone number has incorrect format", (e) => {
|
|
30
|
-
if (e) try {
|
|
31
|
-
return t(e);
|
|
32
|
-
} catch {
|
|
33
|
-
return !1;
|
|
34
|
-
}
|
|
35
|
-
return !0;
|
|
36
|
-
}));
|
|
37
|
-
break;
|
|
38
|
-
case e.URLWidget:
|
|
39
|
-
s = o(n.string().matches(/^(?:https?:\/\/)?(?:[a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+(?:\.[a-zA-Z]{2,})+(?:\/[^\s?#]*)?(?:\?[^\s]*)?$/, "The URL is not valid"));
|
|
40
|
-
break;
|
|
41
|
-
case e.ImageUploadWidget:
|
|
42
|
-
case e.FileUploadWidget:
|
|
43
|
-
case e.GeocoderWidget:
|
|
44
|
-
s = n.object();
|
|
45
|
-
break;
|
|
46
|
-
case e.MultiImageUploadWidget:
|
|
47
|
-
case e.MultiFileUploadWidget:
|
|
48
|
-
case e.MultiGeocoderWidget:
|
|
49
|
-
s = n.array().of(n.object());
|
|
50
|
-
break;
|
|
51
|
-
case e.JSONWidget:
|
|
52
|
-
case e.DropdownWidget:
|
|
53
|
-
s = n.string();
|
|
54
|
-
break;
|
|
55
|
-
case e.MultiTextWidget:
|
|
56
|
-
case e.MultiDropdownWidget:
|
|
57
|
-
case e.CheckboxWidget:
|
|
58
|
-
s = n.array().of(n.string());
|
|
59
|
-
break;
|
|
60
|
-
case e.ToggleCheckboxWidget:
|
|
61
|
-
s = n.boolean();
|
|
62
|
-
break;
|
|
63
|
-
case e.CollectionWidget:
|
|
64
|
-
s = r.options.current_have_many_connected ? n.array() : n.object();
|
|
65
|
-
break;
|
|
66
|
-
default:
|
|
67
|
-
s = o(n.string());
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
if (r.options?.validationsPresets && Array.isArray(r.options.validationsPresets)) {
|
|
71
|
-
let t = r.options.validationsPresets;
|
|
72
|
-
(r.field_interface === e.TextWidget || r.field_interface === e.TextareaWidget) && (t.includes("exclude_special_chars") && (s = s.matches(/^[a-zA-Z0-9\s]*$/, "Special characters are not allowed")), t.includes("exclude_numbers") && (s = s.matches(/^[^0-9]*$/, "Numbers are not allowed")));
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
required: {
|
|
76
|
-
value: !!r?.required,
|
|
77
|
-
message: `The ${a} field is required`
|
|
78
|
-
},
|
|
79
|
-
validate: (e) => {
|
|
80
|
-
if (r?.options?.disableValidation || e === "" || e == null) return !0;
|
|
81
|
-
try {
|
|
82
|
-
return s.validateSync(e), i ? i(e) : !0;
|
|
83
|
-
} catch (e) {
|
|
84
|
-
return e instanceof n.ValidationError ? e.message : !0;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
//#endregion
|
|
90
|
-
export { r as t };
|
package/widgets-K6ECnoJJ.js
DELETED
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import { FieldInterfaces as t, FieldInterfacesList as n, defaultByKinds as r, formatsByInterface as i, interfaceKinds as a, operatorsByKind as o } from "@levo-so/core";
|
|
3
|
-
import s from "dayjs";
|
|
4
|
-
import { Snowflake as c } from "@theinternetfolks/snowflake";
|
|
5
|
-
import { isPossiblePhoneNumber as l } from "react-phone-number-input";
|
|
6
|
-
import * as u from "yup";
|
|
7
|
-
//#region ../../libraries/react-collection/dist/constants/fileUploadPresets.js
|
|
8
|
-
var d = [
|
|
9
|
-
"pdf",
|
|
10
|
-
"xls",
|
|
11
|
-
"xlsx",
|
|
12
|
-
"doc",
|
|
13
|
-
"docx",
|
|
14
|
-
"csv"
|
|
15
|
-
], f = [
|
|
16
|
-
"svg",
|
|
17
|
-
"png",
|
|
18
|
-
"jpg",
|
|
19
|
-
"jpeg",
|
|
20
|
-
"webp",
|
|
21
|
-
"gif",
|
|
22
|
-
"avif"
|
|
23
|
-
], p = ["mpeg", "mp4"], m = [
|
|
24
|
-
"mp3",
|
|
25
|
-
"ogg",
|
|
26
|
-
"oga"
|
|
27
|
-
], h = {
|
|
28
|
-
audio: {
|
|
29
|
-
"audio/mpeg": [".mp3"],
|
|
30
|
-
"audio/ogg": [".oga"]
|
|
31
|
-
},
|
|
32
|
-
document: {
|
|
33
|
-
"application/pdf": [".pdf"],
|
|
34
|
-
"application/msword": [".doc"],
|
|
35
|
-
"application/vnd.ms-excel": [".xls"],
|
|
36
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
|
|
37
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
|
|
38
|
-
"text/csv": [".csv"]
|
|
39
|
-
},
|
|
40
|
-
image: {
|
|
41
|
-
"image/jpeg": [".jpeg", ".jpg"],
|
|
42
|
-
"image/png": [".png"],
|
|
43
|
-
"image/gif": [".gif"],
|
|
44
|
-
"image/svg+xml": [".svg"],
|
|
45
|
-
"image/webp": [".webp"],
|
|
46
|
-
"image/avif": [".avif"]
|
|
47
|
-
},
|
|
48
|
-
video: {
|
|
49
|
-
"video/mp4": [".mp4"],
|
|
50
|
-
"video/mpeg": [".mpeg"]
|
|
51
|
-
}
|
|
52
|
-
}, g = {
|
|
53
|
-
audio: m,
|
|
54
|
-
document: d,
|
|
55
|
-
image: f,
|
|
56
|
-
video: p
|
|
57
|
-
};
|
|
58
|
-
[
|
|
59
|
-
...g.audio,
|
|
60
|
-
...g.document,
|
|
61
|
-
...g.image,
|
|
62
|
-
...g.video
|
|
63
|
-
], {
|
|
64
|
-
...h.audio,
|
|
65
|
-
...h.document,
|
|
66
|
-
...h.image,
|
|
67
|
-
...h.video
|
|
68
|
-
};
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region ../../libraries/react-collection/dist/utils/logic.js
|
|
71
|
-
var _ = (e) => e.combinator !== void 0, v = (e) => e == null ? !0 : typeof e == "string" ? e === "" : Array.isArray(e) ? e.length === 0 : !1, y = (e, t) => {
|
|
72
|
-
if (t == null) return t;
|
|
73
|
-
if (e === "date") {
|
|
74
|
-
if (t instanceof Date || typeof t == "string" || typeof t == "number") {
|
|
75
|
-
let e = s(t);
|
|
76
|
-
if (e.isValid()) return e.valueOf();
|
|
77
|
-
}
|
|
78
|
-
return NaN;
|
|
79
|
-
}
|
|
80
|
-
if (e === "number") {
|
|
81
|
-
if (typeof t == "number") return t;
|
|
82
|
-
if (typeof t == "string" && t !== "") {
|
|
83
|
-
let e = Number(t);
|
|
84
|
-
if (!Number.isNaN(e)) return e;
|
|
85
|
-
}
|
|
86
|
-
return NaN;
|
|
87
|
-
}
|
|
88
|
-
return t;
|
|
89
|
-
}, b = (e, t) => e === "collection" && t && typeof t == "object" && !Array.isArray(t) && "_id" in t ? t._id : t, x = (e, t, n) => y(e, b(e, t)) === y(e, b(e, n)), S = (e, t) => e ? o[e]?.includes(t) ?? !1 : !1, C = (e, t) => {
|
|
90
|
-
if (_(e)) {
|
|
91
|
-
e.conditions.forEach((e) => {
|
|
92
|
-
C(e, t);
|
|
93
|
-
});
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
t.add(e.source);
|
|
97
|
-
}, w = (e, t) => {
|
|
98
|
-
if (!t?.length) return {};
|
|
99
|
-
let n = /* @__PURE__ */ new Set();
|
|
100
|
-
for (let e of t) C(e.when, n);
|
|
101
|
-
let r = {};
|
|
102
|
-
for (let t of e.sections) for (let e of t.fields) n.has(e.key) && (r[e.key] = e.kind);
|
|
103
|
-
return r;
|
|
104
|
-
}, T = (e, t) => _(e) ? e.conditions.some((e) => T(e, t)) : t[e.source] === void 0, E = (e, t) => {
|
|
105
|
-
if (_(e)) {
|
|
106
|
-
for (let n of e.conditions) {
|
|
107
|
-
let e = E(n, t);
|
|
108
|
-
if (e) return e;
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
return S(t[e.source], e.operator) ? null : e;
|
|
113
|
-
}, D = (e, t, n) => {
|
|
114
|
-
let r = n[e.source], i = t[e.source];
|
|
115
|
-
switch (e.operator) {
|
|
116
|
-
case "is_empty": return v(i);
|
|
117
|
-
case "is_not_empty": return !v(i);
|
|
118
|
-
case "equals": return x(r, i, e.value);
|
|
119
|
-
case "not": return !x(r, i, e.value);
|
|
120
|
-
case "gt":
|
|
121
|
-
case "gte":
|
|
122
|
-
case "lt":
|
|
123
|
-
case "lte": {
|
|
124
|
-
let t = y(r, i), n = y(r, e.value);
|
|
125
|
-
if (typeof t != "number" || typeof n != "number" || Number.isNaN(t) || Number.isNaN(n)) return !1;
|
|
126
|
-
switch (e.operator) {
|
|
127
|
-
case "gt": return t > n;
|
|
128
|
-
case "gte": return t >= n;
|
|
129
|
-
case "lt": return t < n;
|
|
130
|
-
case "lte": return t <= n;
|
|
131
|
-
default: return !1;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
case "contains":
|
|
135
|
-
case "not_contains":
|
|
136
|
-
if (r === "array-string" || r === "array-number" || r === "collection") {
|
|
137
|
-
if (!Array.isArray(i)) return e.operator === "not_contains";
|
|
138
|
-
let t = i.some((t) => x(r, t, e.value));
|
|
139
|
-
return e.operator === "contains" ? t : !t;
|
|
140
|
-
}
|
|
141
|
-
if (typeof i == "string" && typeof e.value == "string") {
|
|
142
|
-
let t = i.includes(e.value);
|
|
143
|
-
return e.operator === "contains" ? t : !t;
|
|
144
|
-
}
|
|
145
|
-
return e.operator === "not_contains";
|
|
146
|
-
case "starts_with":
|
|
147
|
-
case "not_starts_with":
|
|
148
|
-
case "ends_with":
|
|
149
|
-
case "not_ends_with":
|
|
150
|
-
if (typeof i != "string" || typeof e.value != "string") return !1;
|
|
151
|
-
switch (e.operator) {
|
|
152
|
-
case "starts_with": return i.startsWith(e.value);
|
|
153
|
-
case "not_starts_with": return !i.startsWith(e.value);
|
|
154
|
-
case "ends_with": return i.endsWith(e.value);
|
|
155
|
-
case "not_ends_with": return !i.endsWith(e.value);
|
|
156
|
-
default: return !1;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}, O = (e, t, n) => _(e) ? e.conditions.length === 0 ? !1 : e.combinator === "AND" ? e.conditions.every((e) => O(e, t, n)) : e.conditions.some((e) => O(e, t, n)) : D(e, t, n), k = ({ logic: e, formValues: t, sourceKinds: n }) => {
|
|
160
|
-
if (!e?.length) return { visible: !0 };
|
|
161
|
-
let r = !e.some((e) => e.action === "show");
|
|
162
|
-
for (let { action: r, when: i } of e) if (r && !T(i, n) && !E(i, n) && O(i, t, n)) return { visible: r === "show" };
|
|
163
|
-
return { visible: r };
|
|
164
|
-
}, A = (e, t, n) => {
|
|
165
|
-
if (t.hidden) return !0;
|
|
166
|
-
if (!t.logic?.length || !e) return !1;
|
|
167
|
-
let r = w(e, t.logic);
|
|
168
|
-
return !k({
|
|
169
|
-
logic: t.logic,
|
|
170
|
-
formValues: n,
|
|
171
|
-
sourceKinds: r
|
|
172
|
-
}).visible;
|
|
173
|
-
}, j = (e, t) => e?.sections?.[0]?.id === t.id, M = (e, t, n) => {
|
|
174
|
-
if (j(e, t) || !t.logic?.length || !e) return !0;
|
|
175
|
-
let r = w(e, t.logic);
|
|
176
|
-
return k({
|
|
177
|
-
logic: t.logic,
|
|
178
|
-
formValues: n,
|
|
179
|
-
sourceKinds: r
|
|
180
|
-
}).visible;
|
|
181
|
-
}, N = (e) => {
|
|
182
|
-
let t = [];
|
|
183
|
-
for (let n of Object.keys(e)) for (let r of e?.[n] || []) t.push({
|
|
184
|
-
message: r,
|
|
185
|
-
name: n
|
|
186
|
-
});
|
|
187
|
-
return t;
|
|
188
|
-
}, P = (e) => e ? l(e) : !1, F = (e, t) => {
|
|
189
|
-
let n = [];
|
|
190
|
-
for (let [r, i] of Object.entries(t)) {
|
|
191
|
-
let t = e?.[r], a = u.string();
|
|
192
|
-
for (let e of i) if (typeof e == "string") switch (e) {
|
|
193
|
-
case "required":
|
|
194
|
-
a = a.required(`The ${r} field is required`);
|
|
195
|
-
break;
|
|
196
|
-
case "email":
|
|
197
|
-
a = a.email("The email address is not valid");
|
|
198
|
-
break;
|
|
199
|
-
case "phone_number":
|
|
200
|
-
a = a.test("phone", "The phone number has incorrect format", (e) => e ? P(e) : !0);
|
|
201
|
-
break;
|
|
202
|
-
case "url":
|
|
203
|
-
a = a.url("The URL is not valid");
|
|
204
|
-
break;
|
|
205
|
-
case "data_uri":
|
|
206
|
-
a = a.test("data_uri", "The field does not have a valid file", (e) => typeof e == "string" ? e.startsWith("data:") && e.includes(",") : !1);
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
else if (typeof e == "object" && e) {
|
|
210
|
-
let t = e;
|
|
211
|
-
"max" in e && t.max?.[0] && (a = a.max(Number(t.max[0]))), "min" in e && t.min?.[0] && (a = a.min(Number(t.min[0])));
|
|
212
|
-
}
|
|
213
|
-
try {
|
|
214
|
-
a.validateSync(t);
|
|
215
|
-
} catch (e) {
|
|
216
|
-
e instanceof u.ValidationError && n.push({
|
|
217
|
-
message: e.message,
|
|
218
|
-
name: r
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return n.length > 0 ? {
|
|
223
|
-
status: !1,
|
|
224
|
-
errors: n
|
|
225
|
-
} : { status: !0 };
|
|
226
|
-
}, I = (e, n) => {
|
|
227
|
-
let r = {};
|
|
228
|
-
for (let n of e.sections) for (let e of n.fields) {
|
|
229
|
-
let n = [];
|
|
230
|
-
switch (e.required && n.push("required"), e.max !== void 0 && e.max !== null && n.push({ max: [e.max] }), e.min !== void 0 && e.min !== null && n.push({ min: [e.min] }), e.field_interface) {
|
|
231
|
-
case t.EmailWidget:
|
|
232
|
-
n.push("email");
|
|
233
|
-
break;
|
|
234
|
-
case t.PhoneWidget:
|
|
235
|
-
n.push("phone_number");
|
|
236
|
-
break;
|
|
237
|
-
case t.URLWidget:
|
|
238
|
-
n.push("url");
|
|
239
|
-
break;
|
|
240
|
-
default: break;
|
|
241
|
-
}
|
|
242
|
-
r[e.key] = n;
|
|
243
|
-
}
|
|
244
|
-
let { errors: i } = F(n, r), a = {};
|
|
245
|
-
return i && i.map((e) => {
|
|
246
|
-
a[e.name] = e.message;
|
|
247
|
-
}), a;
|
|
248
|
-
}, L = (e) => {
|
|
249
|
-
let n = {};
|
|
250
|
-
for (let i of e) {
|
|
251
|
-
if (i.kind === "collection") {
|
|
252
|
-
let e = i.options?.current_have_many_connected, t = i.options?.connected_have_many_current;
|
|
253
|
-
e && t ? n[i.key] = r.collection.m2m : n[i.key] = r.collection.m2o;
|
|
254
|
-
} else n[i.key] = r?.[i?.kind];
|
|
255
|
-
i?.field_interface === t.RecordWidget && i?.fields?.length && (n[i.key] = L(i.fields));
|
|
256
|
-
}
|
|
257
|
-
return n;
|
|
258
|
-
}, R = (e) => {
|
|
259
|
-
if (!e?.sections) return {};
|
|
260
|
-
let t = {};
|
|
261
|
-
for (let n of e.sections) n?.fields && n?.fields?.length > 0 && (t = {
|
|
262
|
-
...t,
|
|
263
|
-
...L(n.fields)
|
|
264
|
-
});
|
|
265
|
-
return t;
|
|
266
|
-
}, z = (e) => e === void 0 ? null : e, B = (e, t) => {
|
|
267
|
-
if (!e?.sections) return {};
|
|
268
|
-
let n = {};
|
|
269
|
-
for (let r of e.sections) {
|
|
270
|
-
let e = L(r.fields ?? []);
|
|
271
|
-
for (let i of r.fields) {
|
|
272
|
-
let r = z(t?.[i?.key]);
|
|
273
|
-
Array.isArray(r) && r?.length > 0 && Array.isArray(i?.values) && i?.values?.length > 0 && !i?.options?.custom_input && (r = r?.filter((e) => i?.values?.includes(e))), n[i.key] = r ?? z(i?.default_value) ?? e[i.key];
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
return n;
|
|
277
|
-
}, V = (e, o) => {
|
|
278
|
-
let s = { ...e }, l = null;
|
|
279
|
-
if ((s.field_interface === t.ArrayWidget && o !== t.ArrayWidget || s.field_interface === t.RecordWidget && o !== t.RecordWidget) && (s.fields = []), (o !== t.MultiDropdownWidget || o !== t.DropdownWidget || o !== t.RadioWidget || o !== t.CheckboxWidget) && s.field_interface !== t.MultiDropdownWidget && s.field_interface !== t.DropdownWidget && s.field_interface !== t.RadioWidget && s.field_interface !== t.CheckboxWidget && s.values?.length !== 0 && (s.values = []), (o === t.MultiDropdownWidget && s.field_interface !== t.MultiDropdownWidget || o === t.DropdownWidget && s.field_interface !== t.DropdownWidget || o === t.RadioWidget && s.field_interface !== t.RadioWidget || o === t.CheckboxWidget && s.field_interface !== t.CheckboxWidget) && (s.values = [""], l = `${s.id}-option-0`), [t.RecordWidget, t.ArrayWidget].includes(o) && (l = `field-${c.generate()}`, s.kind = o === t.RecordWidget ? "record" : "group", s.fields = [...s?.fields || [], {
|
|
280
|
-
id: l,
|
|
281
|
-
key: "title",
|
|
282
|
-
label: "Title",
|
|
283
|
-
helper_text: "",
|
|
284
|
-
kind: "string",
|
|
285
|
-
field_interface: t.TextWidget,
|
|
286
|
-
default_value: "",
|
|
287
|
-
options: {},
|
|
288
|
-
fields: [],
|
|
289
|
-
hidden: !1,
|
|
290
|
-
readonly: !1,
|
|
291
|
-
required: !1,
|
|
292
|
-
unique: !1,
|
|
293
|
-
min: null,
|
|
294
|
-
max: null,
|
|
295
|
-
formats: i[o] || [],
|
|
296
|
-
values: [],
|
|
297
|
-
editable: !0
|
|
298
|
-
}]), s.kind = a[o] || "string", !s.default_value) if (s.kind === "collection") {
|
|
299
|
-
let e = s.options?.current_have_many_connected, t = s.options?.connected_have_many_current;
|
|
300
|
-
e && t ? s.default_value = r.collection.m2m : s.default_value = r.collection.m2o;
|
|
301
|
-
} else s.default_value = r[s.kind] || null;
|
|
302
|
-
return o !== t.CollectionWidget && n.includes(o) && (s.field_interface = o), {
|
|
303
|
-
field: s,
|
|
304
|
-
fieldFocused: l
|
|
305
|
-
};
|
|
306
|
-
}, H = (e, t, n) => {
|
|
307
|
-
let r = {}, i = n !== void 0;
|
|
308
|
-
if (t) for (let a of t?.sections ?? []) {
|
|
309
|
-
let o = i ? !M(t, a, e) : !1;
|
|
310
|
-
for (let s of a?.fields) {
|
|
311
|
-
if (i && (o || A(t, s, e))) {
|
|
312
|
-
r[s?.key] = n[s?.key];
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
if (s.field_interface === "CollectionWidget") {
|
|
316
|
-
let t = e?.[s?.key];
|
|
317
|
-
t && typeof t == "object" && (Array.isArray(t) ? r[s?.key] = t?.filter((e) => e) : r[s?.key] = t._id);
|
|
318
|
-
} else r[s?.key] = e?.[s?.key];
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
return r;
|
|
322
|
-
}, U = (e) => e.every((e) => {
|
|
323
|
-
let { field_interface: t = "", key: n = "", hidden: r } = e;
|
|
324
|
-
return !t || !n || r;
|
|
325
|
-
}), W = (e, t) => {
|
|
326
|
-
if (Array.isArray(e) && e.length > 0) {
|
|
327
|
-
let n = 0;
|
|
328
|
-
for (let r of e) n += 1, r?.param && t && t(r?.param, {
|
|
329
|
-
type: "server_error",
|
|
330
|
-
message: r?.message
|
|
331
|
-
}, { shouldFocus: n === 0 });
|
|
332
|
-
}
|
|
333
|
-
}, G = (t) => e.memo(t);
|
|
334
|
-
//#endregion
|
|
335
|
-
export { g as _, P as a, L as c, V as d, H as f, k as g, w as h, U as i, I as l, A as m, W as n, z as o, M as p, B as r, R as s, G as t, N as u, h as v };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|