vlite3 1.0.10 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/components/AttachmentsList/AttachmentsList.vue.d.ts +1 -16
- package/components/AttachmentsList/AttachmentsList.vue.js +191 -167
- package/components/AvatarGroup/AvatarGroup.vue.d.ts +24 -0
- package/components/AvatarGroup/AvatarGroup.vue.js +91 -0
- package/components/AvatarGroup/AvatarGroup.vue2.js +4 -0
- package/components/AvatarGroup/index.d.ts +2 -0
- package/components/AvatarUploader/AvatarUploader.vue.d.ts +1 -1
- package/components/Barcode/Barcode.vue.js +6 -5
- package/components/Button.vue.d.ts +1 -1
- package/components/Calendar/Calendar.vue.d.ts +229 -0
- package/components/Calendar/Calendar.vue.js +7 -0
- package/components/Calendar/Calendar.vue2.js +186 -0
- package/components/Calendar/CalendarEventItem.vue.d.ts +17 -0
- package/components/Calendar/CalendarEventItem.vue.js +111 -0
- package/components/Calendar/CalendarEventItem.vue2.js +4 -0
- package/components/Calendar/index.d.ts +2 -0
- package/components/Carousel/Carousel.vue.d.ts +2 -2
- package/components/CategoryManager/CategoryManager.vue.d.ts +2 -1
- package/components/CategoryManager/CategoryManager.vue.js +322 -0
- package/components/CategoryManager/CategoryManager.vue2.js +4 -0
- package/components/CategoryManager/CategoryNode.vue.js +224 -0
- package/components/CategoryManager/CategoryNode.vue2.js +4 -0
- package/components/CategoryManager/types.d.ts +14 -0
- package/components/Chip/Chip.vue.d.ts +2 -2
- package/components/ColorPicker/ColorIro.vue3.js +2 -2
- package/components/ColorPicker/ColorPicker.vue.js +2 -2
- package/components/CommandPalette/CommandPaletteContent.vue.js +1 -1
- package/components/CommandPalette/CommandPaletteContent.vue2.js +7 -7
- package/components/CommandPalette/{CommandPaletteItem.vue2.js → CommandPaletteItem.vue.js} +1 -1
- package/components/ConfirmationModal.vue.d.ts +2 -2
- package/components/CustomFieldsDisplay/CustomFieldsDisplay.vue.d.ts +48 -0
- package/components/CustomFieldsDisplay/CustomFieldsDisplay.vue.js +97 -0
- package/components/CustomFieldsDisplay/CustomFieldsDisplay.vue2.js +4 -0
- package/components/CustomFieldsDisplay/index.d.ts +2 -0
- package/components/CustomFieldsDisplay/types.d.ts +18 -0
- package/components/DataTable/DataTable.vue.d.ts +3 -3
- package/components/DateTime/DateTime.vue.d.ts +2 -0
- package/components/DateTime/DateTime.vue.js +9 -23
- package/components/Dropdown/Dropdown.vue.d.ts +3 -3
- package/components/Dropdown/DropdownGroupedLayout.vue.d.ts +1 -1
- package/components/Dropdown/DropdownMenu.vue.d.ts +2 -2
- package/components/Dropdown/DropdownTrigger.vue.d.ts +1 -1
- package/components/FilePicker/FilePicker.vue.d.ts +1 -1
- package/components/Form/CustomFields.vue.d.ts +1 -1
- package/components/Form/Form.vue.js +2 -2
- package/components/Form/Form.vue2.js +230 -241
- package/components/Form/FormField.vue.d.ts +1 -1
- package/components/Form/composables/useForm.d.ts +2 -0
- package/components/Form/composables/useForm.js +76 -69
- package/components/Form/utils/form.utils.js +66 -66
- package/components/ImportData/ImportData.vue.js +48 -48
- package/components/ImportData/ImportStep2.vue.js +116 -5
- package/components/ImportData/ImportStep2.vue2.js +2 -105
- package/components/Input.vue.d.ts +3 -3
- package/components/Invoice/Invoice.vue.d.ts +3 -0
- package/components/Invoice/Invoice.vue.js +38 -0
- package/components/Invoice/Invoice.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant1.vue.d.ts +13 -0
- package/components/Invoice/InvoiceVariant1.vue.js +360 -0
- package/components/Invoice/InvoiceVariant1.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant2.vue.d.ts +13 -0
- package/components/Invoice/InvoiceVariant2.vue.js +226 -0
- package/components/Invoice/InvoiceVariant2.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant3.vue.d.ts +13 -0
- package/components/Invoice/InvoiceVariant3.vue.js +292 -0
- package/components/Invoice/InvoiceVariant3.vue2.js +4 -0
- package/components/Invoice/InvoiceVariant4.vue.d.ts +13 -0
- package/components/Invoice/InvoiceVariant4.vue.js +343 -0
- package/components/Invoice/InvoiceVariant4.vue2.js +4 -0
- package/components/Invoice/index.d.ts +2 -0
- package/components/Invoice/types.d.ts +97 -0
- package/components/List/List.vue.d.ts +1 -9
- package/components/List/List.vue.js +166 -165
- package/components/List/ListFieldRow.vue.d.ts +10 -2
- package/components/List/ListFieldRow.vue.js +80 -78
- package/components/List/utils.d.ts +2 -1
- package/components/List/utils.js +8 -39
- package/components/MultiSelect/MultiSelect.vue.d.ts +1 -1
- package/components/Navbar/NavbarItem.vue.d.ts +1 -1
- package/components/Navbar/NavbarTabs.vue.js +2 -2
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/NumberInput.vue.d.ts +2 -2
- package/components/NumberInput.vue.js +2 -2
- package/components/NumberInput.vue2.js +38 -38
- package/components/OTPInput/OTPInput.vue.d.ts +1 -1
- package/components/PricingPlan/PricingPlan.vue.d.ts +1 -1
- package/components/Screen/ScreenFilter.vue.js +22 -21
- package/components/Screen/components/ScreenQuickFilters.vue.js +6 -5
- package/components/SidebarMenu/SidebarMenu.vue.d.ts +1 -1
- package/components/Stats/Stats.vue.d.ts +1 -1
- package/components/StatusChip/status-map.js +27 -7
- package/components/Tabes/Tabes.vue.d.ts +1 -0
- package/components/Tabes/Tabes.vue.js +2 -2
- package/components/Tabes/Tabes.vue2.js +33 -32
- package/components/ThumbnailSelector/ThumbnailSelector.vue.d.ts +2 -2
- package/components/ThumbnailSelector/ThumbnailSelector.vue.js +2 -2
- package/components/ThumbnailSelector/ThumbnailSelector.vue2.js +141 -115
- package/components/Workbook/Workbook.vue.d.ts +3 -3
- package/core/config.d.ts +76 -0
- package/core/index.js +17 -5
- package/index.d.ts +6 -1
- package/index.js +271 -256
- package/package.json +2 -1
- package/style.css +5 -3
- package/types/config.type.d.ts +6 -0
- package/types/list.type.d.ts +6 -0
- package/utils/configUtils.d.ts +9 -0
- package/utils/configUtils.js +7 -0
- package/utils/index.d.ts +1 -0
- package/utils/status.d.ts +5 -0
- package/utils/status.js +33 -0
- /package/components/ColorPicker/{ColorIro.vue.js → ColorIro.vue2.js} +0 -0
|
@@ -30,10 +30,10 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
30
30
|
variant: InputVariant;
|
|
31
31
|
size: InputSize;
|
|
32
32
|
rounded: InputRounded;
|
|
33
|
+
loading: boolean;
|
|
33
34
|
readonly: boolean;
|
|
34
35
|
error: string;
|
|
35
36
|
disabled: boolean;
|
|
36
|
-
loading: boolean;
|
|
37
37
|
isUpdate: boolean;
|
|
38
38
|
floatingActive: boolean;
|
|
39
39
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -45,6 +45,8 @@ export interface UseFormReturn {
|
|
|
45
45
|
handleSubmit: () => Promise<void>;
|
|
46
46
|
/** Flattened schema for iteration */
|
|
47
47
|
flatSchema: ComputedRef<IForm[]>;
|
|
48
|
+
/** Re-initialize form with new schema/values (useful for async data loading) */
|
|
49
|
+
reinitialize: (newSchema?: IForm[] | IForm[][], newValues?: Record<string, any>) => Promise<void>;
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
50
52
|
* Main form composable for managing form state, validation, and submission
|
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { deepClone as
|
|
3
|
-
import { useFileUpload as
|
|
4
|
-
import { $t as
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ref as z, shallowRef as H, computed as ee, watch as ae } from "vue";
|
|
2
|
+
import { deepClone as V, initializeFormValues as le, cleanSubmitValues as te, getNestedValue as J, evaluateConditional as S, setNestedValue as j, collectFileFields as se, filterNullCustomFields as ie } from "../utils/form.utils.js";
|
|
3
|
+
import { useFileUpload as oe } from "./useFileUpload.js";
|
|
4
|
+
import { $t as re } from "../../../utils/i18n.js";
|
|
5
|
+
function Fe(q) {
|
|
6
|
+
let { schema: K, values: b, isUpdate: F = !1, folderId: U, onSubmit: L } = q;
|
|
7
|
+
const { handleUploadFile: E } = oe(), n = z(b ? V(b) : {}), y = z({}), I = z(!1), g = z(!1), m = z({}), A = H(K), C = H(
|
|
8
|
+
b ? V(b) : {}
|
|
9
|
+
), $ = ee(() => {
|
|
10
|
+
const e = A.value;
|
|
11
|
+
return e ? Array.isArray(e[0]) ? e.flat() : e : [];
|
|
12
|
+
}), D = async (e) => {
|
|
9
13
|
try {
|
|
10
|
-
const a = await
|
|
11
|
-
n.value = a, C.value =
|
|
14
|
+
const a = await le(A.value, e, n.value, F);
|
|
15
|
+
n.value = a, C.value = V(a), g.value = !1;
|
|
12
16
|
} catch (a) {
|
|
13
17
|
console.error("[useForm] Initialization error:", a);
|
|
14
18
|
}
|
|
15
19
|
};
|
|
16
|
-
|
|
17
|
-
() =>
|
|
20
|
+
D(b), ae(
|
|
21
|
+
() => b,
|
|
18
22
|
(e) => {
|
|
19
|
-
e &&
|
|
23
|
+
e && D(e);
|
|
20
24
|
},
|
|
21
25
|
{ deep: !0 }
|
|
22
26
|
);
|
|
23
|
-
const
|
|
27
|
+
const N = () => ({
|
|
24
28
|
values: n.value,
|
|
25
29
|
globalValues: n.value,
|
|
26
|
-
isUpdate:
|
|
27
|
-
}), M = (e) =>
|
|
30
|
+
isUpdate: F
|
|
31
|
+
}), M = (e) => J(n.value, e), Q = (e) => y.value[e] || "", R = (e, a) => {
|
|
28
32
|
a ? y.value[e] = a : delete y.value[e];
|
|
29
|
-
},
|
|
33
|
+
}, O = () => {
|
|
30
34
|
y.value = {};
|
|
31
|
-
},
|
|
35
|
+
}, x = (e) => e.when ? S(e.when, N()) : !0, P = (e) => S(e.disabled, N()), W = (e) => S(e.readonly, N()), T = async (e, a = "") => {
|
|
32
36
|
const o = a ? `${a}.${e.name}` : e.name, t = M(o);
|
|
33
37
|
let s = "";
|
|
34
|
-
const i = e.labelI18n ?
|
|
38
|
+
const i = e.labelI18n ? re(e.labelI18n) : typeof e.label == "string" ? e.label : e.name;
|
|
35
39
|
if (e.required && (t == null || t === "" || Array.isArray(t) && t.length === 0) && (s = `${i} is required`), !s && e.maxFileSize) {
|
|
36
40
|
const r = e.maxFileSize * 1024 * 1024;
|
|
37
41
|
if (t != null && t !== "") {
|
|
@@ -56,7 +60,7 @@ function me(B) {
|
|
|
56
60
|
value: t,
|
|
57
61
|
values: n.value,
|
|
58
62
|
globalValues: n.value,
|
|
59
|
-
isUpdate:
|
|
63
|
+
isUpdate: F
|
|
60
64
|
});
|
|
61
65
|
} catch (r) {
|
|
62
66
|
console.error(`[useForm] Validation error in field ${o}:`, r), s = "Validation failed";
|
|
@@ -68,30 +72,30 @@ function me(B) {
|
|
|
68
72
|
const r = e.props.schema, l = Array.isArray(t) ? t : [];
|
|
69
73
|
let f = !1;
|
|
70
74
|
for (let v = 0; v < l.length; v++) {
|
|
71
|
-
const d = { values: l[v] || {}, globalValues: n.value, isUpdate:
|
|
75
|
+
const d = { values: l[v] || {}, globalValues: n.value, isUpdate: F };
|
|
72
76
|
for (const u of r) {
|
|
73
|
-
const c = !u.when ||
|
|
74
|
-
c && !
|
|
77
|
+
const c = !u.when || S(u.when, d), w = S(u.disabled, d);
|
|
78
|
+
c && !w ? await T(u, `${o}.${v}`) && (f = !0) : delete y.value[`${o}.${v}.${u.name}`];
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
81
|
f && !s && (s = "Please fix errors in the list.", y.value[o] = s);
|
|
78
82
|
}
|
|
79
83
|
return s;
|
|
80
84
|
}, G = async () => {
|
|
81
|
-
|
|
85
|
+
O();
|
|
82
86
|
let e = !0;
|
|
83
|
-
for (const a of
|
|
84
|
-
if (!
|
|
85
|
-
await
|
|
87
|
+
for (const a of $.value) {
|
|
88
|
+
if (!x(a) || P(a)) continue;
|
|
89
|
+
await T(a) && (e = !1);
|
|
86
90
|
}
|
|
87
91
|
return e;
|
|
88
|
-
},
|
|
89
|
-
const t =
|
|
90
|
-
if (t && (!
|
|
92
|
+
}, X = async (e, a, o) => {
|
|
93
|
+
const t = $.value.find((s) => s.name === e);
|
|
94
|
+
if (t && (!x(t) || P(t) || W(t))) {
|
|
91
95
|
console.warn(`[vlite3/useForm] Blocked attempted update to disabled/readonly/hidden field: ${e}`);
|
|
92
96
|
return;
|
|
93
97
|
}
|
|
94
|
-
if (n.value = j(n.value, e, a),
|
|
98
|
+
if (n.value = j(n.value, e, a), g.value = !0, delete y.value[e], t?.updateValues) {
|
|
95
99
|
m.value[e] = !0;
|
|
96
100
|
try {
|
|
97
101
|
const s = await t.updateValues({
|
|
@@ -100,7 +104,7 @@ function me(B) {
|
|
|
100
104
|
values: n.value,
|
|
101
105
|
globalValues: n.value,
|
|
102
106
|
data: o,
|
|
103
|
-
isUpdate:
|
|
107
|
+
isUpdate: F,
|
|
104
108
|
updateError: R
|
|
105
109
|
});
|
|
106
110
|
s && typeof s == "object" && (n.value = { ...n.value, ...s });
|
|
@@ -110,8 +114,8 @@ function me(B) {
|
|
|
110
114
|
m.value[e] = !1;
|
|
111
115
|
}
|
|
112
116
|
}
|
|
113
|
-
},
|
|
114
|
-
const e =
|
|
117
|
+
}, Y = async () => {
|
|
118
|
+
const e = V(n.value), a = se(A.value, e, n.value, F), o = (i, r) => {
|
|
115
119
|
let l = null;
|
|
116
120
|
i instanceof File ? l = i : i && typeof i == "object" && i.file instanceof File && (l = i.file);
|
|
117
121
|
const f = {
|
|
@@ -128,29 +132,29 @@ function me(B) {
|
|
|
128
132
|
const d = l, u = Array.isArray(d.images) ? d.images : [], c = d.thumbnail;
|
|
129
133
|
m.value[r] = !0;
|
|
130
134
|
try {
|
|
131
|
-
const
|
|
132
|
-
u.map(async (
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
return await E(
|
|
135
|
+
const w = await Promise.all(
|
|
136
|
+
u.map(async (h) => {
|
|
137
|
+
if (h.startsWith("data:image/")) {
|
|
138
|
+
const B = await (await fetch(h)).blob(), _ = new File([B], `thumbnail-${Date.now()}.${B.type.split("/")[1] || "jpg"}`, { type: B.type });
|
|
139
|
+
return await E(_, U) || h;
|
|
136
140
|
}
|
|
137
|
-
return
|
|
141
|
+
return h;
|
|
138
142
|
})
|
|
139
143
|
);
|
|
140
144
|
let p = c;
|
|
141
145
|
if (c && c.startsWith("data:image/")) {
|
|
142
|
-
const
|
|
143
|
-
|
|
146
|
+
const h = u.indexOf(c);
|
|
147
|
+
h !== -1 && w[h] && (p = w[h]);
|
|
144
148
|
}
|
|
145
|
-
return { name: r, value: { images:
|
|
149
|
+
return { name: r, value: { images: w, thumbnail: p } };
|
|
146
150
|
} finally {
|
|
147
151
|
m.value[r] = !1;
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
|
-
const v = f.returnFileObject === !0,
|
|
154
|
+
const v = f.returnFileObject === !0, k = Array.isArray(l) ? l.some(
|
|
151
155
|
(d) => d instanceof File || d && typeof d == "object" && d.file instanceof File
|
|
152
156
|
) : l instanceof File || l && typeof l == "object" && l.file instanceof File;
|
|
153
|
-
|
|
157
|
+
k && (m.value[r] = !0);
|
|
154
158
|
try {
|
|
155
159
|
if (Array.isArray(l)) {
|
|
156
160
|
const d = l.map(async (c) => {
|
|
@@ -177,19 +181,19 @@ function me(B) {
|
|
|
177
181
|
return null;
|
|
178
182
|
}
|
|
179
183
|
} finally {
|
|
180
|
-
|
|
184
|
+
k && (m.value[r] = !1);
|
|
181
185
|
}
|
|
182
186
|
});
|
|
183
187
|
return (await Promise.all(t)).forEach((i) => {
|
|
184
188
|
i && (Object.assign(e, j(e, i.name, i.value)), n.value = j(n.value, i.name, i.value));
|
|
185
189
|
}), e;
|
|
186
|
-
},
|
|
190
|
+
}, Z = (e) => {
|
|
187
191
|
const a = { ...e };
|
|
188
|
-
for (const o of
|
|
189
|
-
if (
|
|
190
|
-
const t =
|
|
192
|
+
for (const o of $.value)
|
|
193
|
+
if (x(o) && o.type === "customFields" && o.props?.schema) {
|
|
194
|
+
const t = J(a, o.name);
|
|
191
195
|
if (Array.isArray(t)) {
|
|
192
|
-
const s =
|
|
196
|
+
const s = ie(t, o.props.schema);
|
|
193
197
|
Object.assign(a, j(a, o.name, s));
|
|
194
198
|
}
|
|
195
199
|
}
|
|
@@ -199,37 +203,37 @@ function me(B) {
|
|
|
199
203
|
formValues: n,
|
|
200
204
|
errors: y,
|
|
201
205
|
isSubmitting: I,
|
|
202
|
-
isDirty:
|
|
206
|
+
isDirty: g,
|
|
203
207
|
fieldLoading: m,
|
|
204
|
-
handleFieldChange:
|
|
205
|
-
validateField:
|
|
208
|
+
handleFieldChange: X,
|
|
209
|
+
validateField: T,
|
|
206
210
|
validateAll: G,
|
|
207
|
-
isFieldVisible:
|
|
208
|
-
isFieldDisabled:
|
|
211
|
+
isFieldVisible: x,
|
|
212
|
+
isFieldDisabled: P,
|
|
209
213
|
isFieldReadonly: W,
|
|
210
214
|
getFieldValue: M,
|
|
211
|
-
getFieldError:
|
|
215
|
+
getFieldError: Q,
|
|
212
216
|
setFieldError: R,
|
|
213
|
-
clearErrors:
|
|
217
|
+
clearErrors: O,
|
|
214
218
|
resetForm: () => {
|
|
215
|
-
n.value =
|
|
219
|
+
n.value = V(C.value), O(), g.value = !1;
|
|
216
220
|
},
|
|
217
221
|
handleSubmit: async () => {
|
|
218
222
|
if (await G()) {
|
|
219
223
|
I.value = !0;
|
|
220
224
|
try {
|
|
221
|
-
let a = await
|
|
222
|
-
a =
|
|
225
|
+
let a = await Y();
|
|
226
|
+
a = Z(a), a = await te(
|
|
223
227
|
a,
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
A.value,
|
|
229
|
+
q.emitFields,
|
|
226
230
|
void 0,
|
|
227
231
|
n.value,
|
|
228
|
-
|
|
229
|
-
),
|
|
232
|
+
F
|
|
233
|
+
), L && await L({
|
|
230
234
|
values: a,
|
|
231
|
-
isUpdate:
|
|
232
|
-
}),
|
|
235
|
+
isUpdate: F
|
|
236
|
+
}), g.value = !1, C.value = V(a);
|
|
233
237
|
} catch (a) {
|
|
234
238
|
throw console.error("[useForm] Submit error:", a), a;
|
|
235
239
|
} finally {
|
|
@@ -237,9 +241,12 @@ function me(B) {
|
|
|
237
241
|
}
|
|
238
242
|
}
|
|
239
243
|
},
|
|
240
|
-
flatSchema:
|
|
244
|
+
flatSchema: $,
|
|
245
|
+
reinitialize: async (e, a) => {
|
|
246
|
+
e !== void 0 && (A.value = e), a !== void 0 && (b = a), await D(a !== void 0 ? a : b);
|
|
247
|
+
}
|
|
241
248
|
};
|
|
242
249
|
}
|
|
243
250
|
export {
|
|
244
|
-
|
|
251
|
+
Fe as useForm
|
|
245
252
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function
|
|
1
|
+
function x(e) {
|
|
2
2
|
return !!e && typeof e == "object";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function U(e) {
|
|
5
5
|
return e ? typeof e == "object" && (typeof e.render == "function" || typeof e.setup == "function" || e.__name !== void 0 || e.name !== void 0) : !1;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
if (typeof e.type == "function" && !
|
|
7
|
+
function b(e, n) {
|
|
8
|
+
if (typeof e.type == "function" && !U(e.type))
|
|
9
9
|
try {
|
|
10
10
|
return e.type(n);
|
|
11
11
|
} catch (i) {
|
|
@@ -23,7 +23,7 @@ function p(e, n) {
|
|
|
23
23
|
}
|
|
24
24
|
return f;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function A(e, n, i) {
|
|
27
27
|
if (!n) return e;
|
|
28
28
|
const f = n.split("."), o = { ...e };
|
|
29
29
|
let a = o;
|
|
@@ -34,50 +34,50 @@ function g(e, n, i) {
|
|
|
34
34
|
return a[f[f.length - 1]] = i, o;
|
|
35
35
|
}
|
|
36
36
|
function k(e, n) {
|
|
37
|
-
return !
|
|
37
|
+
return !x(n) || !n.name ? e : p(e, n.name) === void 0 && n.value !== void 0 ? A(e, n.name, n.value) : e;
|
|
38
38
|
}
|
|
39
|
-
async function
|
|
39
|
+
async function T(e, n, i, f) {
|
|
40
40
|
let o = n ? S(n) : {};
|
|
41
41
|
const a = i || o, c = Array.isArray(e[0]) ? e.flat() : e;
|
|
42
42
|
for (const t of c) {
|
|
43
43
|
if (!t.name) continue;
|
|
44
|
-
const
|
|
45
|
-
if (t.when && !
|
|
44
|
+
const h = { values: o, globalValues: a, isUpdate: f };
|
|
45
|
+
if (t.when && !v(t.when, h))
|
|
46
46
|
continue;
|
|
47
47
|
const m = t.mapFrom || t.name;
|
|
48
48
|
let s = n ? p(n, m) : void 0;
|
|
49
49
|
if (s != null) {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
(r) => r && typeof r == "object" ? p(r,
|
|
53
|
-
) : typeof s == "object" && (s = p(s,
|
|
50
|
+
const u = t.valueKey || t.key;
|
|
51
|
+
u && (Array.isArray(s) ? s = s.map(
|
|
52
|
+
(r) => r && typeof r == "object" ? p(r, u) : r
|
|
53
|
+
) : typeof s == "object" && (s = p(s, u))), t.format && (s = await t.format(s, n || {}));
|
|
54
54
|
}
|
|
55
55
|
if (s === void 0) {
|
|
56
56
|
if (t.mapFrom && n) {
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const u = p(n, t.name);
|
|
58
|
+
u !== void 0 && (s = u);
|
|
59
59
|
}
|
|
60
60
|
if (s === void 0) {
|
|
61
|
-
const
|
|
62
|
-
|
|
61
|
+
const u = typeof t.value == "function" ? t.value() : t.value;
|
|
62
|
+
u !== void 0 && Object.assign(o, A(o, t.name, u));
|
|
63
63
|
} else
|
|
64
|
-
Object.assign(o,
|
|
64
|
+
Object.assign(o, A(o, t.name, s));
|
|
65
65
|
} else
|
|
66
|
-
Object.assign(o,
|
|
67
|
-
if (o = k(o, t.addonLeft), o = k(o, t.addonRight),
|
|
68
|
-
const
|
|
66
|
+
Object.assign(o, A(o, t.name, s));
|
|
67
|
+
if (o = k(o, t.addonLeft), o = k(o, t.addonRight), b(t, h) === "customFields" && t.props?.schema) {
|
|
68
|
+
const u = t.props.schema;
|
|
69
69
|
let r = p(o, t.name);
|
|
70
70
|
if (Array.isArray(r) && r.length > 0) {
|
|
71
71
|
const y = await Promise.all(
|
|
72
|
-
r.map((
|
|
72
|
+
r.map((l) => T(u, l, a, f))
|
|
73
73
|
);
|
|
74
|
-
Object.assign(o,
|
|
74
|
+
Object.assign(o, A(o, t.name, y));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
return o;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function v(e, n) {
|
|
81
81
|
return e === void 0 ? !1 : typeof e == "boolean" ? e : typeof e == "function" ? e(n) : !1;
|
|
82
82
|
}
|
|
83
83
|
function $(e, n) {
|
|
@@ -93,10 +93,10 @@ function B(e, n, i, f) {
|
|
|
93
93
|
const o = [], a = i || n, c = Array.isArray(e[0]) ? e.flat() : e;
|
|
94
94
|
for (const t of c) {
|
|
95
95
|
if (!t.name) continue;
|
|
96
|
-
const
|
|
97
|
-
if (t.when && !
|
|
96
|
+
const h = { values: n, globalValues: a, isUpdate: f };
|
|
97
|
+
if (t.when && !v(t.when, h))
|
|
98
98
|
continue;
|
|
99
|
-
const m =
|
|
99
|
+
const m = b(t, h);
|
|
100
100
|
if (m === "file" || m === "avatarUpload" || m === "fileUploader") {
|
|
101
101
|
const s = p(n, t.name);
|
|
102
102
|
s && o.push({
|
|
@@ -118,20 +118,20 @@ function B(e, n, i, f) {
|
|
|
118
118
|
if (m === "customFields" && t.props?.schema) {
|
|
119
119
|
const s = p(n, t.name);
|
|
120
120
|
if (Array.isArray(s)) {
|
|
121
|
-
const r = t.props.schema.filter((y) => !
|
|
122
|
-
r.length > 0 && s.forEach((y,
|
|
123
|
-
r.forEach((
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
121
|
+
const r = t.props.schema.filter((y) => !U(y.type));
|
|
122
|
+
r.length > 0 && s.forEach((y, l) => {
|
|
123
|
+
r.forEach((g) => {
|
|
124
|
+
const F = { values: y || {}, globalValues: a, isUpdate: f };
|
|
125
|
+
if (g.when && !v(g.when, F))
|
|
126
126
|
return;
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
const w = y?.[
|
|
127
|
+
const d = b(g, F);
|
|
128
|
+
if (d === "file" || d === "avatarUpload" || d === "fileUploader") {
|
|
129
|
+
const w = y?.[g.name];
|
|
130
130
|
w && o.push({
|
|
131
|
-
name: `${t.name}.${
|
|
131
|
+
name: `${t.name}.${l}.${g.name}`,
|
|
132
132
|
value: w,
|
|
133
|
-
type:
|
|
134
|
-
field:
|
|
133
|
+
type: d,
|
|
134
|
+
field: g
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
});
|
|
@@ -152,67 +152,67 @@ function S(e) {
|
|
|
152
152
|
return n;
|
|
153
153
|
}
|
|
154
154
|
function I(e, n) {
|
|
155
|
-
const i =
|
|
156
|
-
return i === "multiSelect" ? [] : i === "thumbnailSelector" ? { images: [], thumbnail: null } : i === "switch" || i === "check" ? !1 : null;
|
|
155
|
+
const i = b(e, n);
|
|
156
|
+
return i === "multiSelect" ? [] : i === "thumbnailSelector" ? { images: [], thumbnail: null } : i === "switch" || i === "check" ? !1 : (i === "fileUploader" || i === "file" || i === "avatarUpload") && e.props?.multiple ? [] : null;
|
|
157
157
|
}
|
|
158
158
|
function K(e) {
|
|
159
159
|
return !!(e == null || e === "" || Array.isArray(e) && e.length === 0);
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function O(e, n) {
|
|
162
162
|
if (!(!e || typeof e != "object"))
|
|
163
163
|
if (Array.isArray(e))
|
|
164
|
-
e.forEach((i) =>
|
|
164
|
+
e.forEach((i) => O(i, n));
|
|
165
165
|
else {
|
|
166
166
|
for (const i of n)
|
|
167
167
|
delete e[i];
|
|
168
168
|
for (const i in e)
|
|
169
|
-
|
|
169
|
+
O(e[i], n);
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
async function P(e, n, i, f, o, a) {
|
|
173
|
-
const c = S(e), t = o || e,
|
|
174
|
-
for (const r of
|
|
173
|
+
const c = S(e), t = o || e, h = Array.isArray(n[0]) ? n.flat() : n, m = /* @__PURE__ */ new Set();
|
|
174
|
+
for (const r of h) {
|
|
175
175
|
if (!r.name) continue;
|
|
176
176
|
const y = { values: e, globalValues: t, isUpdate: a };
|
|
177
|
-
(!r.when ||
|
|
177
|
+
(!r.when || v(r.when, y)) && m.add(r.name);
|
|
178
178
|
}
|
|
179
|
-
const s = i || [],
|
|
180
|
-
for (const r of
|
|
179
|
+
const s = i || [], u = [];
|
|
180
|
+
for (const r of h) {
|
|
181
181
|
if (!r.name) continue;
|
|
182
182
|
const y = { values: e, globalValues: t, isUpdate: a };
|
|
183
|
-
if (r.when && !
|
|
183
|
+
if (r.when && !v(r.when, y)) {
|
|
184
184
|
m.has(r.name) || delete c[r.name];
|
|
185
185
|
continue;
|
|
186
186
|
}
|
|
187
|
-
let
|
|
188
|
-
const
|
|
189
|
-
if (K(
|
|
190
|
-
if (!
|
|
187
|
+
let l = p(e, r.name);
|
|
188
|
+
const g = r.name.split(".")[0], F = Object.prototype.hasOwnProperty.call(e, g), d = b(r, y);
|
|
189
|
+
if (Array.isArray(l) && (d === "fileUploader" || d === "file" || d === "avatarUpload") && (l = l.filter((V) => V != null && V !== "")), K(l)) {
|
|
190
|
+
if (!F) {
|
|
191
191
|
m.has(r.name) || delete c[r.name];
|
|
192
192
|
continue;
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
l = I(r, y);
|
|
195
195
|
}
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
|
|
196
|
+
if (l = S(l), d === "customFields" && r.props?.schema && Array.isArray(l)) {
|
|
197
|
+
const V = r.props.schema;
|
|
198
|
+
l = await Promise.all(l.map((E) => P(E, V, i, f, t, a)));
|
|
199
199
|
}
|
|
200
|
-
r.transform && (
|
|
200
|
+
r.transform && (l = await r.transform(l, e));
|
|
201
201
|
const w = r.mapTo || r.name;
|
|
202
|
-
w !== r.name ? (delete c[r.name], Object.assign(c,
|
|
202
|
+
w !== r.name ? (delete c[r.name], Object.assign(c, A(c, w, l))) : Object.assign(c, A(c, r.name, l));
|
|
203
203
|
}
|
|
204
|
-
return s.length > 0 &&
|
|
204
|
+
return s.length > 0 && O(c, s), u.length > 0 && O(c, u), c;
|
|
205
205
|
}
|
|
206
206
|
export {
|
|
207
207
|
P as cleanSubmitValues,
|
|
208
208
|
B as collectFileFields,
|
|
209
209
|
S as deepClone,
|
|
210
|
-
|
|
210
|
+
v as evaluateConditional,
|
|
211
211
|
$ as filterNullCustomFields,
|
|
212
212
|
p as getNestedValue,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
213
|
+
T as initializeFormValues,
|
|
214
|
+
x as isAddonObject,
|
|
215
|
+
U as isComponent,
|
|
216
|
+
b as resolveFieldType,
|
|
217
|
+
A as setNestedValue
|
|
218
218
|
};
|