@uniquedj95/vform 2.0.3 → 3.0.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 +256 -167
- package/dist/components/inputs/BaseInput.vue.d.ts +5 -6
- package/dist/components/inputs/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/CheckboxInput.vue.d.ts +2 -3
- package/dist/components/inputs/CheckboxInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/DateInput.vue.d.ts +2 -3
- package/dist/components/inputs/DateInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/EmailInput.vue.d.ts +6 -4
- package/dist/components/inputs/EmailInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/NumberInput.vue.d.ts +6 -4
- package/dist/components/inputs/NumberInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/PasswordInput.vue.d.ts +6 -4
- package/dist/components/inputs/PasswordInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/RepeatInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/SelectInput.vue.d.ts +2 -1
- package/dist/components/inputs/SelectInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/TextAreaInput.vue.d.ts +3 -5
- package/dist/components/inputs/TextAreaInput.vue.d.ts.map +1 -1
- package/dist/components/inputs/TextInput.vue.d.ts +6 -4
- package/dist/components/inputs/TextInput.vue.d.ts.map +1 -1
- package/dist/components/shared/InputLabel.vue.d.ts +7 -0
- package/dist/components/shared/InputLabel.vue.d.ts.map +1 -0
- package/dist/components/vForm.vue.d.ts +2 -2
- package/dist/components/vForm.vue.d.ts.map +1 -1
- package/dist/composables/useCheckboxLabelText.d.ts +10 -0
- package/dist/composables/useCheckboxLabelText.d.ts.map +1 -0
- package/dist/composables/useDataTransformation.d.ts +11 -0
- package/dist/composables/useDataTransformation.d.ts.map +1 -0
- package/dist/composables/useFormValidation.d.ts +11 -0
- package/dist/composables/useFormValidation.d.ts.map +1 -0
- package/dist/composables/useInputProps.d.ts +25 -0
- package/dist/composables/useInputProps.d.ts.map +1 -0
- package/dist/composables/useInputValidation.d.ts +16 -0
- package/dist/composables/useInputValidation.d.ts.map +1 -0
- package/dist/composables/useLabelTemplate.d.ts +12 -0
- package/dist/composables/useLabelTemplate.d.ts.map +1 -0
- package/dist/composables/useValidationStyles.d.ts +10 -0
- package/dist/composables/useValidationStyles.d.ts.map +1 -0
- package/dist/constants/index.d.ts +41 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +793 -701
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/index.d.ts +10 -10
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/maskito.d.ts +7 -0
- package/dist/utils/maskito.d.ts.map +1 -0
- package/dist/vform.css +1 -1
- package/package.json +49 -3
package/dist/index.es.js
CHANGED
@@ -1,7 +1,67 @@
|
|
1
|
-
import {
|
2
|
-
import { IonGrid as
|
1
|
+
import { ref as x, computed as w, defineComponent as q, watch as H, createBlock as h, openBlock as i, unref as o, withCtx as p, createVNode as R, createCommentVNode as E, createElementBlock as U, Fragment as A, renderList as W, resolveDynamicComponent as me, normalizeStyle as fe, createTextVNode as $, toDisplayString as z, toRef as ke, mergeModels as L, useModel as Y, resolveDirective as _e, withDirectives as xe, onMounted as pe, normalizeClass as Ie, createElementVNode as ve } from "vue";
|
2
|
+
import { IonGrid as Me, IonRow as re, IonCol as se, IonButton as Z, IonLabel as P, IonText as we, IonInput as le, IonInputPasswordToggle as Ce, IonSelect as De, IonSelectOption as Fe, IonIcon as Q, IonChip as Se, IonList as Re, IonItem as Ee, IonCheckbox as he, actionSheetController as Be, alertController as Oe, IonTextarea as Te } from "@ionic/vue";
|
3
3
|
import $e from "@vuepic/vue-datepicker";
|
4
|
-
|
4
|
+
import { calendar as Ue, chevronDown as ze, close as qe, add as Ae, remove as je } from "ionicons/icons";
|
5
|
+
import { maskito as Le } from "@maskito/vue";
|
6
|
+
function Ye(t) {
|
7
|
+
return new Promise((u) => {
|
8
|
+
requestAnimationFrame(async () => {
|
9
|
+
const l = await t.getInputElement();
|
10
|
+
u(l);
|
11
|
+
});
|
12
|
+
});
|
13
|
+
}
|
14
|
+
const Ne = {
|
15
|
+
d: /\d/,
|
16
|
+
a: /[A-Za-z]/,
|
17
|
+
"*": /[A-Za-z0-9]/
|
18
|
+
// Default: alphanum, can customize if needed
|
19
|
+
}, Pe = {
|
20
|
+
d: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
21
|
+
a: ["A", "B", "C", "x", "y", "z", "D", "f"],
|
22
|
+
"*": ["A", "3", "b", "8", "z", "4", "D", "0"]
|
23
|
+
};
|
24
|
+
function He(t, u) {
|
25
|
+
const l = Pe[t];
|
26
|
+
return l[u % l.length];
|
27
|
+
}
|
28
|
+
function Ge(t) {
|
29
|
+
const u = [];
|
30
|
+
let l = "", e = 0, a = 0;
|
31
|
+
for (; e < t.length; ) {
|
32
|
+
const n = t[e];
|
33
|
+
if (["d", "a", "*"].includes(n)) {
|
34
|
+
let s = 1;
|
35
|
+
if (t[e + 1] === "{") {
|
36
|
+
const r = t.indexOf("}", e + 2);
|
37
|
+
if (r !== -1) {
|
38
|
+
const c = t.slice(e + 2, r);
|
39
|
+
if (c.includes(",")) {
|
40
|
+
const [, g] = c.split(",").map((b) => parseInt(b.trim()));
|
41
|
+
s = g || parseInt(c.split(",")[0]);
|
42
|
+
} else
|
43
|
+
s = parseInt(c);
|
44
|
+
e = r;
|
45
|
+
}
|
46
|
+
} else {
|
47
|
+
let r = e + 1;
|
48
|
+
for (; t[r] === n; )
|
49
|
+
s++, r++;
|
50
|
+
e = r - 1;
|
51
|
+
}
|
52
|
+
for (let r = 0; r < s; r++)
|
53
|
+
u.push(Ne[n]), l += He(n, a++);
|
54
|
+
} else
|
55
|
+
u.push(n), l += n;
|
56
|
+
e++;
|
57
|
+
}
|
58
|
+
return {
|
59
|
+
mask: u,
|
60
|
+
placeholder: l,
|
61
|
+
elementPredicate: Ye
|
62
|
+
};
|
63
|
+
}
|
64
|
+
const X = [
|
5
65
|
"January",
|
6
66
|
"February",
|
7
67
|
"March",
|
@@ -15,78 +75,121 @@ const W = [
|
|
15
75
|
"November",
|
16
76
|
"December"
|
17
77
|
];
|
18
|
-
function
|
19
|
-
return
|
78
|
+
function ie(t) {
|
79
|
+
return t == null || Array.isArray(t) && !t.length || typeof t == "object" && !Object.keys(t).length || !t;
|
20
80
|
}
|
21
|
-
function
|
22
|
-
const
|
23
|
-
if (isNaN(
|
81
|
+
function Je(t, u = "DD/MMM/YYYY") {
|
82
|
+
const l = new Date(t);
|
83
|
+
if (isNaN(l.getTime()))
|
24
84
|
throw new Error("Invalid date string");
|
25
|
-
const e =
|
85
|
+
const e = J(l.getDate()), a = l.getMonth() + 1, n = l.getFullYear(), s = J(l.getHours()), r = J(l.getMinutes()), c = J(l.getSeconds()), g = l.getMilliseconds(), b = {
|
26
86
|
DD: e,
|
27
|
-
D:
|
28
|
-
MMM:
|
29
|
-
MMMM:
|
30
|
-
MM:
|
87
|
+
D: l.getDate().toString(),
|
88
|
+
MMM: X[l.getMonth()].slice(0, 3),
|
89
|
+
MMMM: X[l.getMonth()],
|
90
|
+
MM: J(a),
|
31
91
|
M: a.toString(),
|
32
|
-
YYYY:
|
33
|
-
YY:
|
92
|
+
YYYY: n.toString(),
|
93
|
+
YY: n.toString().slice(-2),
|
34
94
|
HH: s,
|
35
|
-
H:
|
36
|
-
mm:
|
37
|
-
m:
|
38
|
-
ss:
|
39
|
-
s:
|
40
|
-
SSS:
|
41
|
-
S:
|
95
|
+
H: l.getHours().toString(),
|
96
|
+
mm: r,
|
97
|
+
m: l.getMinutes().toString(),
|
98
|
+
ss: c,
|
99
|
+
s: l.getSeconds().toString(),
|
100
|
+
SSS: J(g),
|
101
|
+
S: g.toString().slice(0, 1)
|
42
102
|
// Add more replacements as needed
|
43
103
|
};
|
44
|
-
return
|
104
|
+
return u.replace(
|
45
105
|
/DD|D|MMMM|MMM|MM|M|YYYY|YY|HH|H|mm|m|ss|s|SSS|S/g,
|
46
|
-
(
|
106
|
+
(I) => b[I] || I
|
47
107
|
);
|
48
108
|
}
|
49
|
-
function
|
50
|
-
return
|
109
|
+
function J(t) {
|
110
|
+
return t < 10 ? `0${t}` : `${t}`;
|
51
111
|
}
|
52
|
-
function
|
53
|
-
if (Number.isInteger(parseInt(
|
54
|
-
if (
|
55
|
-
if (
|
56
|
-
if (
|
112
|
+
function ue(t, u) {
|
113
|
+
if (Number.isInteger(parseInt(t)) && Number(t) > 0) {
|
114
|
+
if (u === "MMMM") return X[Number(t) - 1];
|
115
|
+
if (u === "MMM") return X[Number(t) - 1].slice(0, 3);
|
116
|
+
if (u === "MM") return J(Number(t));
|
57
117
|
}
|
58
|
-
return
|
118
|
+
return t;
|
59
119
|
}
|
60
|
-
function
|
61
|
-
return typeof
|
120
|
+
function ce(t, u, l) {
|
121
|
+
return typeof t.condition == "function" ? t.condition(u, l) : !0;
|
62
122
|
}
|
63
|
-
function
|
64
|
-
if (typeof
|
65
|
-
return
|
66
|
-
if (Array.isArray(
|
67
|
-
return
|
68
|
-
const
|
69
|
-
return Object.entries(
|
70
|
-
typeof e == "function" ?
|
71
|
-
}),
|
123
|
+
function de(t) {
|
124
|
+
if (typeof t != "object" || t === null)
|
125
|
+
return t;
|
126
|
+
if (Array.isArray(t))
|
127
|
+
return t.map((l) => de(l));
|
128
|
+
const u = {};
|
129
|
+
return Object.entries(t).forEach(([l, e]) => {
|
130
|
+
typeof e == "function" ? u[l] = e.bind(u) : u[l] = de(e);
|
131
|
+
}), u;
|
72
132
|
}
|
73
|
-
function
|
74
|
-
return
|
133
|
+
function ye(t, u) {
|
134
|
+
return u.findIndex((l) => l.value === t.value || l.label === t.label || l.value === t.label || l.label === t.value);
|
75
135
|
}
|
76
|
-
function
|
77
|
-
const
|
78
|
-
|
136
|
+
function G(t, u) {
|
137
|
+
const l = ye(t, u);
|
138
|
+
l >= 0 ? u[l].isChecked = !0 : u.push({ ...t, isChecked: !0 });
|
79
139
|
}
|
80
|
-
function
|
81
|
-
const
|
82
|
-
|
140
|
+
function oe(t, u) {
|
141
|
+
const l = ye(t, u);
|
142
|
+
l >= 0 && (u[l].isChecked = !1);
|
83
143
|
}
|
84
|
-
function
|
85
|
-
return
|
86
|
-
(
|
87
|
-
) :
|
144
|
+
function We(t, u) {
|
145
|
+
return u ? t.filter(
|
146
|
+
(l) => JSON.stringify(l).toLowerCase().includes(u.toLowerCase())
|
147
|
+
) : t;
|
88
148
|
}
|
89
|
-
|
149
|
+
function ge() {
|
150
|
+
const t = x([]);
|
151
|
+
async function u() {
|
152
|
+
const n = [];
|
153
|
+
for (const s of t.value)
|
154
|
+
typeof (s == null ? void 0 : s.onValueUpdate) == "function" && await s.onValueUpdate(), typeof (s == null ? void 0 : s.getErrors) == "function" && n.push(...s.getErrors());
|
155
|
+
return n.every(ie);
|
156
|
+
}
|
157
|
+
function l() {
|
158
|
+
t.value.forEach((n) => {
|
159
|
+
typeof (n == null ? void 0 : n.onReset) == "function" && n.onReset();
|
160
|
+
});
|
161
|
+
}
|
162
|
+
function e() {
|
163
|
+
const n = [];
|
164
|
+
for (const s of t.value)
|
165
|
+
typeof (s == null ? void 0 : s.getErrors) == "function" && n.push(...s.getErrors());
|
166
|
+
return n;
|
167
|
+
}
|
168
|
+
async function a() {
|
169
|
+
for (const n of t.value)
|
170
|
+
typeof (n == null ? void 0 : n.onValueUpdate) == "function" && await n.onValueUpdate();
|
171
|
+
}
|
172
|
+
return {
|
173
|
+
dynamicRefs: t,
|
174
|
+
isFormValid: u,
|
175
|
+
resetForm: l,
|
176
|
+
getFormErrors: e,
|
177
|
+
updateFormValues: a
|
178
|
+
};
|
179
|
+
}
|
180
|
+
function Ke(t) {
|
181
|
+
const u = w(
|
182
|
+
() => Object.entries(t.value).reduce((e, [a, n]) => (n.value !== void 0 && (typeof n.onChange == "function" ? e[a] = n.onChange(n.value) : e[a] = n.value), e), {})
|
183
|
+
), l = w(() => Object.entries(u.value).reduce((e, [a, n]) => (n !== void 0 && (t.value[a].children !== void 0 && (e[a] = n.map(({ other: s }) => Object.entries(s).reduce((r, [c, g]) => (typeof t.value[a].children[c].computedValue == "function" ? r[c] = t.value[a].children[c].computedValue(
|
184
|
+
g,
|
185
|
+
t.value
|
186
|
+
) : r[c] = g, r), {}))), typeof t.value[a].computedValue == "function" && n !== void 0 && (e[a] = t.value[a].computedValue(n, t.value))), e), {}));
|
187
|
+
return {
|
188
|
+
formData: u,
|
189
|
+
computedData: l
|
190
|
+
};
|
191
|
+
}
|
192
|
+
const Ze = /* @__PURE__ */ q({
|
90
193
|
__name: "vForm",
|
91
194
|
props: {
|
92
195
|
schema: {},
|
@@ -101,121 +204,122 @@ const De = /* @__PURE__ */ T({
|
|
101
204
|
customButtons: {}
|
102
205
|
},
|
103
206
|
emits: ["submit", "clear", "cancel"],
|
104
|
-
setup(
|
105
|
-
const e =
|
106
|
-
async function
|
107
|
-
|
108
|
-
for (const f of t.value)
|
109
|
-
typeof (f == null ? void 0 : f.onValueUpdate) == "function" && await f.onValueUpdate(), typeof (f == null ? void 0 : f.getErrors) == "function" && v.push(...f.getErrors());
|
110
|
-
return v.every(oe);
|
207
|
+
setup(t, { expose: u, emit: l }) {
|
208
|
+
const e = t, a = l, n = x(e.schema), { dynamicRefs: s, isFormValid: r, resetForm: c } = ge(), { formData: g, computedData: b } = Ke(n);
|
209
|
+
async function I() {
|
210
|
+
return await r();
|
111
211
|
}
|
112
|
-
async function
|
113
|
-
await
|
212
|
+
async function v() {
|
213
|
+
await I() && a("submit", g.value, b.value);
|
114
214
|
}
|
115
|
-
function
|
116
|
-
|
117
|
-
typeof (v == null ? void 0 : v.onReset) == "function" && v.onReset();
|
118
|
-
});
|
215
|
+
function F() {
|
216
|
+
c();
|
119
217
|
}
|
120
|
-
function
|
121
|
-
|
218
|
+
function k() {
|
219
|
+
F(), a("clear");
|
122
220
|
}
|
123
|
-
function
|
124
|
-
|
221
|
+
function O() {
|
222
|
+
F(), a("cancel");
|
125
223
|
}
|
126
|
-
return
|
127
|
-
|
224
|
+
return H(
|
225
|
+
g,
|
128
226
|
async () => {
|
129
|
-
for (const [
|
130
|
-
|
227
|
+
for (const [m, D] of Object.entries(n.value))
|
228
|
+
ce(D, g.value, b.value) || (D.value = e.schema[m].value);
|
131
229
|
},
|
132
230
|
{
|
133
231
|
deep: !0,
|
134
232
|
immediate: !0
|
135
233
|
}
|
136
|
-
),
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
234
|
+
), H(
|
235
|
+
() => e.schema,
|
236
|
+
(m) => {
|
237
|
+
for (const [D, d] of Object.entries(m))
|
238
|
+
d.value !== void 0 && (n.value[D].value = d.value);
|
239
|
+
},
|
240
|
+
{
|
241
|
+
deep: !0,
|
242
|
+
immediate: !0
|
243
|
+
}
|
244
|
+
), u({
|
245
|
+
resetForm: F,
|
246
|
+
isFormValid: I,
|
145
247
|
resolveData: () => ({
|
146
|
-
formData:
|
147
|
-
computedData:
|
248
|
+
formData: g.value,
|
249
|
+
computedData: b.value
|
148
250
|
})
|
149
|
-
}), (
|
251
|
+
}), (m, D) => (i(), h(o(Me), null, {
|
150
252
|
default: p(() => [
|
151
|
-
R(o(
|
253
|
+
R(o(re), null, {
|
152
254
|
default: p(() => [
|
153
|
-
(
|
154
|
-
var
|
155
|
-
return
|
156
|
-
o(
|
157
|
-
key:
|
158
|
-
size: ((
|
159
|
-
"size-sm": (
|
160
|
-
"size-md": (
|
161
|
-
"size-lg": (
|
162
|
-
"size-xl": (
|
255
|
+
(i(!0), U(A, null, W(Object.keys(n.value), (d) => {
|
256
|
+
var T, j, V, S, y;
|
257
|
+
return i(), U(A, null, [
|
258
|
+
o(ce)(n.value[d], o(g), o(b)) ? (i(), h(o(se), {
|
259
|
+
key: d,
|
260
|
+
size: ((T = n.value[d].grid) == null ? void 0 : T.xs) ?? "12",
|
261
|
+
"size-sm": (j = n.value[d].grid) == null ? void 0 : j.sm,
|
262
|
+
"size-md": (V = n.value[d].grid) == null ? void 0 : V.md,
|
263
|
+
"size-lg": (S = n.value[d].grid) == null ? void 0 : S.lg,
|
264
|
+
"size-xl": (y = n.value[d].grid) == null ? void 0 : y.xl,
|
163
265
|
class: "ion-margin-vertical"
|
164
266
|
}, {
|
165
267
|
default: p(() => [
|
166
|
-
(
|
167
|
-
modelValue:
|
168
|
-
"onUpdate:modelValue": (
|
169
|
-
schema:
|
268
|
+
(i(), h(me(n.value[d].type), {
|
269
|
+
modelValue: n.value[d],
|
270
|
+
"onUpdate:modelValue": (C) => n.value[d] = C,
|
271
|
+
schema: n.value,
|
170
272
|
ref_for: !0,
|
171
273
|
ref_key: "dynamicRefs",
|
172
|
-
ref:
|
173
|
-
"ref-key":
|
274
|
+
ref: s,
|
275
|
+
"ref-key": d
|
174
276
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "schema", "ref-key"]))
|
175
277
|
]),
|
176
278
|
_: 2
|
177
|
-
}, 1032, ["size", "size-sm", "size-md", "size-lg", "size-xl"])) :
|
279
|
+
}, 1032, ["size", "size-sm", "size-md", "size-lg", "size-xl"])) : E("", !0)
|
178
280
|
], 64);
|
179
281
|
}), 256))
|
180
282
|
]),
|
181
283
|
_: 1
|
182
284
|
}),
|
183
|
-
|
285
|
+
m.hideButtons ? E("", !0) : (i(), h(o(re), { key: 0 }, {
|
184
286
|
default: p(() => [
|
185
|
-
R(o(
|
287
|
+
R(o(se), {
|
186
288
|
size: "12",
|
187
|
-
style:
|
289
|
+
style: fe([{ display: "flex" }, { justifyContent: m.buttonPlacement }])
|
188
290
|
}, {
|
189
291
|
default: p(() => [
|
190
|
-
|
292
|
+
m.showCancelButton ? (i(), h(o(Z), {
|
191
293
|
key: 0,
|
192
|
-
onClick:
|
294
|
+
onClick: O
|
193
295
|
}, {
|
194
296
|
default: p(() => [
|
195
|
-
|
297
|
+
$(z(m.cancelButtonText ?? "Cancel"), 1)
|
196
298
|
]),
|
197
299
|
_: 1
|
198
|
-
})) :
|
199
|
-
|
300
|
+
})) : E("", !0),
|
301
|
+
m.showClearButton ? (i(), h(o(Z), {
|
200
302
|
key: 1,
|
201
|
-
onClick:
|
303
|
+
onClick: k
|
202
304
|
}, {
|
203
305
|
default: p(() => [
|
204
|
-
|
306
|
+
$(z(m.clearButtonText ?? "Reset"), 1)
|
205
307
|
]),
|
206
308
|
_: 1
|
207
|
-
})) :
|
208
|
-
(
|
209
|
-
|
309
|
+
})) : E("", !0),
|
310
|
+
(i(!0), U(A, null, W(m.customButtons, (d) => (i(), h(o(Z), {
|
311
|
+
key: d.label,
|
312
|
+
onClick: d.action,
|
313
|
+
color: d.color ?? "primary"
|
210
314
|
}, {
|
211
315
|
default: p(() => [
|
212
|
-
|
316
|
+
$(z(d.label), 1)
|
213
317
|
]),
|
214
318
|
_: 2
|
215
|
-
}, 1032, ["onClick"]))),
|
216
|
-
R(o(
|
319
|
+
}, 1032, ["onClick", "color"]))), 128)),
|
320
|
+
R(o(Z), { onClick: v }, {
|
217
321
|
default: p(() => [
|
218
|
-
|
322
|
+
$(z(m.submitButtonText ?? "Submit"), 1)
|
219
323
|
]),
|
220
324
|
_: 1
|
221
325
|
})
|
@@ -229,213 +333,271 @@ const De = /* @__PURE__ */ T({
|
|
229
333
|
_: 1
|
230
334
|
}));
|
231
335
|
}
|
232
|
-
})
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
setup(l, { expose: d }) {
|
243
|
-
const u = l, e = N(l, "modelValue"), a = M(null), t = M(e.value.value);
|
244
|
-
A(() => e.value.value, (r) => t.value = r);
|
245
|
-
function s() {
|
246
|
-
t.value = "", e.value.error = "", e.value.value = "";
|
247
|
-
}
|
248
|
-
async function i() {
|
249
|
-
if (e.value.required && !t.value)
|
250
|
-
return e.value.error = "This field is required", !1;
|
251
|
-
if (e.value.validation) {
|
252
|
-
const r = await e.value.validation(t.value, u == null ? void 0 : u.schema);
|
253
|
-
if (r && r.length)
|
254
|
-
return e.value.error = r.join(), !1;
|
255
|
-
}
|
256
|
-
return !0;
|
336
|
+
});
|
337
|
+
function Qe(t) {
|
338
|
+
return {
|
339
|
+
applyValidationState: async (e) => {
|
340
|
+
var a, n, s, r, c;
|
341
|
+
(a = t.value) == null || a.$el.classList.remove("ion-invalid"), (n = t.value) == null || n.$el.classList.remove("ion-valid"), e ? (s = t.value) == null || s.$el.classList.add("ion-valid") : (r = t.value) == null || r.$el.classList.add("ion-invalid"), (c = t.value) == null || c.$el.classList.add("ion-touched");
|
342
|
+
},
|
343
|
+
resetValidationState: () => {
|
344
|
+
var e, a;
|
345
|
+
(e = t.value) == null || e.$el.classList.remove("ion-touched"), (a = t.value) == null || a.$el.classList.remove("ion-invalid");
|
257
346
|
}
|
258
|
-
|
259
|
-
|
260
|
-
|
347
|
+
};
|
348
|
+
}
|
349
|
+
function ee(t, u, l, e, a) {
|
350
|
+
const { applyValidationState: n, resetValidationState: s } = Qe(t);
|
351
|
+
async function r() {
|
352
|
+
if (u.value.required && !l.value)
|
353
|
+
return u.value.error = "This field is required", !1;
|
354
|
+
if (a) {
|
355
|
+
const v = await a(l.value);
|
356
|
+
if (typeof v == "string")
|
357
|
+
return u.value.error = v, !1;
|
358
|
+
if (v === !1)
|
359
|
+
return !1;
|
261
360
|
}
|
262
|
-
|
263
|
-
|
264
|
-
|
361
|
+
if (u.value.validation) {
|
362
|
+
const v = await u.value.validation(l.value, e == null ? void 0 : e.value);
|
363
|
+
if (v && v.length)
|
364
|
+
return u.value.error = v.join(), !1;
|
265
365
|
}
|
266
|
-
return
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
366
|
+
return !0;
|
367
|
+
}
|
368
|
+
async function c() {
|
369
|
+
const v = await r();
|
370
|
+
v && (u.value.error = "", u.value.value = l.value), await n(v);
|
371
|
+
}
|
372
|
+
function g() {
|
373
|
+
s(), u.value.error = "";
|
374
|
+
}
|
375
|
+
function b(v = "") {
|
376
|
+
l.value = v, u.value.error = "", u.value.value = v;
|
377
|
+
}
|
378
|
+
const I = w(() => u.value.error);
|
379
|
+
return {
|
380
|
+
isValid: r,
|
381
|
+
onValueUpdate: c,
|
382
|
+
onFocus: g,
|
383
|
+
onReset: b,
|
384
|
+
getErrors: I,
|
385
|
+
applyValidationState: n,
|
386
|
+
resetValidationState: s
|
387
|
+
};
|
388
|
+
}
|
389
|
+
function Xe(t) {
|
390
|
+
const u = w(() => !!t.value.label), l = w(() => !!t.value.required), e = w(() => t.value.label || "");
|
391
|
+
return {
|
392
|
+
showLabel: u,
|
393
|
+
showRequired: l,
|
394
|
+
labelText: e
|
395
|
+
};
|
396
|
+
}
|
397
|
+
const ae = /* @__PURE__ */ q({
|
398
|
+
__name: "InputLabel",
|
399
|
+
props: {
|
400
|
+
model: {}
|
401
|
+
},
|
402
|
+
setup(t) {
|
403
|
+
const u = t, { showLabel: l, showRequired: e, labelText: a } = Xe(ke(u, "model"));
|
404
|
+
return (n, s) => o(l) ? (i(), h(o(P), {
|
405
|
+
key: 0,
|
406
|
+
slot: "label",
|
407
|
+
class: "input-label"
|
293
408
|
}, {
|
294
409
|
default: p(() => [
|
295
|
-
|
410
|
+
$(z(o(a)) + " ", 1),
|
411
|
+
o(e) ? (i(), h(o(we), {
|
296
412
|
key: 0,
|
297
|
-
|
298
|
-
}, {
|
299
|
-
default: p(() => [
|
300
|
-
L(B(e.value.label) + " ", 1),
|
301
|
-
e.value.required ? (c(), h(o(Q), {
|
302
|
-
key: 0,
|
303
|
-
color: "danger"
|
304
|
-
}, {
|
305
|
-
default: p(() => n[1] || (n[1] = [
|
306
|
-
L("*")
|
307
|
-
])),
|
308
|
-
_: 1,
|
309
|
-
__: [1]
|
310
|
-
})) : $("", !0)
|
311
|
-
]),
|
312
|
-
_: 1
|
313
|
-
})) : $("", !0),
|
314
|
-
e.value.prefix ? (c(), h(o(F), {
|
315
|
-
key: 1,
|
316
|
-
slot: "start"
|
317
|
-
}, {
|
318
|
-
default: p(() => [
|
319
|
-
L(B(e.value.prefix), 1)
|
320
|
-
]),
|
321
|
-
_: 1
|
322
|
-
})) : $("", !0),
|
323
|
-
e.value.suffix ? (c(), h(o(F), {
|
324
|
-
key: 2,
|
325
|
-
slot: "end"
|
413
|
+
color: "danger"
|
326
414
|
}, {
|
327
|
-
default: p(() => [
|
328
|
-
|
329
|
-
]),
|
330
|
-
_: 1
|
331
|
-
|
332
|
-
|
333
|
-
key: 3,
|
334
|
-
slot: "end"
|
335
|
-
})) : $("", !0)
|
415
|
+
default: p(() => s[0] || (s[0] = [
|
416
|
+
$("*")
|
417
|
+
])),
|
418
|
+
_: 1,
|
419
|
+
__: [0]
|
420
|
+
})) : E("", !0)
|
336
421
|
]),
|
337
422
|
_: 1
|
338
|
-
}
|
423
|
+
})) : E("", !0);
|
339
424
|
}
|
340
|
-
}),
|
425
|
+
}), ne = /* @__PURE__ */ q({
|
426
|
+
__name: "BaseInput",
|
427
|
+
props: /* @__PURE__ */ L({
|
428
|
+
schema: {},
|
429
|
+
type: {}
|
430
|
+
}, {
|
431
|
+
modelValue: { type: Object, default: {} },
|
432
|
+
modelModifiers: {}
|
433
|
+
}),
|
434
|
+
emits: ["update:modelValue"],
|
435
|
+
setup(t, { expose: u }) {
|
436
|
+
const l = t, e = Y(t, "modelValue"), a = x(null), n = x(e.value.value), s = w(() => l.schema), { isValid: r, onValueUpdate: c, onFocus: g, onReset: b, getErrors: I } = ee(
|
437
|
+
a,
|
438
|
+
e,
|
439
|
+
n,
|
440
|
+
s
|
441
|
+
), v = w(() => {
|
442
|
+
if (e.value.pattern) return Ge(e.value.pattern);
|
443
|
+
});
|
444
|
+
return H(
|
445
|
+
() => e.value.value,
|
446
|
+
(F) => n.value = F
|
447
|
+
), u({
|
448
|
+
onValueUpdate: c,
|
449
|
+
onReset: b,
|
450
|
+
getErrors: I,
|
451
|
+
isValid: r
|
452
|
+
}), (F, k) => {
|
453
|
+
var m;
|
454
|
+
const O = _e("maskito");
|
455
|
+
return xe((i(), h(o(le), {
|
456
|
+
ref_key: "inputRef",
|
457
|
+
ref: a,
|
458
|
+
modelValue: n.value,
|
459
|
+
"onUpdate:modelValue": k[0] || (k[0] = (D) => n.value = D),
|
460
|
+
"clear-input": !0,
|
461
|
+
fill: e.value.fill ?? "outline",
|
462
|
+
"label-placement": e.value.labelPlacement ?? "stacked",
|
463
|
+
type: F.type ?? "text",
|
464
|
+
required: e.value.required,
|
465
|
+
"error-text": e.value.error,
|
466
|
+
autofocus: e.value.autoFocus,
|
467
|
+
placeholder: ((m = v.value) == null ? void 0 : m.placeholder) ?? e.value.placeholder,
|
468
|
+
disabled: e.value.disabled,
|
469
|
+
counter: e.value.counter,
|
470
|
+
min: e.value.min,
|
471
|
+
max: e.value.max,
|
472
|
+
"max-length": e.value.maxLength,
|
473
|
+
"min-length": e.value.minLength,
|
474
|
+
pattern: e.value.pattern,
|
475
|
+
onIonFocus: o(g),
|
476
|
+
onIonChange: o(c),
|
477
|
+
onIonBlur: o(c)
|
478
|
+
}, {
|
479
|
+
default: p(() => [
|
480
|
+
R(ae, { model: e.value }, null, 8, ["model"]),
|
481
|
+
e.value.prefix ? (i(), h(o(P), {
|
482
|
+
key: 0,
|
483
|
+
slot: "start"
|
484
|
+
}, {
|
485
|
+
default: p(() => [
|
486
|
+
$(z(e.value.prefix), 1)
|
487
|
+
]),
|
488
|
+
_: 1
|
489
|
+
})) : E("", !0),
|
490
|
+
e.value.suffix ? (i(), h(o(P), {
|
491
|
+
key: 1,
|
492
|
+
slot: "end"
|
493
|
+
}, {
|
494
|
+
default: p(() => [
|
495
|
+
$(z(e.value.suffix), 1)
|
496
|
+
]),
|
497
|
+
_: 1
|
498
|
+
})) : E("", !0),
|
499
|
+
F.type === "password" ? (i(), h(o(Ce), {
|
500
|
+
key: 2,
|
501
|
+
slot: "end"
|
502
|
+
})) : E("", !0)
|
503
|
+
]),
|
504
|
+
_: 1
|
505
|
+
}, 8, ["modelValue", "fill", "label-placement", "type", "required", "error-text", "autofocus", "placeholder", "disabled", "counter", "min", "max", "max-length", "min-length", "pattern", "onIonFocus", "onIonChange", "onIonBlur"])), [
|
506
|
+
[O, v.value]
|
507
|
+
]);
|
508
|
+
};
|
509
|
+
}
|
510
|
+
}), et = /* @__PURE__ */ q({
|
341
511
|
__name: "TextInput",
|
342
|
-
props: /* @__PURE__ */
|
512
|
+
props: /* @__PURE__ */ L({
|
343
513
|
schema: {}
|
344
514
|
}, {
|
345
515
|
modelValue: { type: Object, default: {} },
|
346
516
|
modelModifiers: {}
|
347
517
|
}),
|
348
518
|
emits: ["update:modelValue"],
|
349
|
-
setup(
|
350
|
-
const
|
351
|
-
return
|
519
|
+
setup(t, { expose: u }) {
|
520
|
+
const l = Y(t, "modelValue"), e = x(null);
|
521
|
+
return u({
|
352
522
|
onReset: () => {
|
353
|
-
var
|
354
|
-
return (
|
523
|
+
var a;
|
524
|
+
return (a = e.value) == null ? void 0 : a.onReset();
|
355
525
|
},
|
356
526
|
onValueUpdate: () => {
|
357
|
-
var
|
358
|
-
return (
|
527
|
+
var a;
|
528
|
+
return (a = e.value) == null ? void 0 : a.onValueUpdate();
|
359
529
|
},
|
360
530
|
getErrors: () => {
|
361
|
-
var
|
362
|
-
return (
|
531
|
+
var a;
|
532
|
+
return (a = e.value) == null ? void 0 : a.getErrors();
|
363
533
|
}
|
364
|
-
}), (
|
365
|
-
modelValue:
|
366
|
-
"onUpdate:modelValue":
|
534
|
+
}), (a, n) => (i(), h(ne, {
|
535
|
+
modelValue: l.value,
|
536
|
+
"onUpdate:modelValue": n[0] || (n[0] = (s) => l.value = s),
|
367
537
|
type: "text",
|
368
|
-
schema:
|
538
|
+
schema: a.schema,
|
369
539
|
ref_key: "inputRef",
|
370
|
-
ref:
|
540
|
+
ref: e
|
371
541
|
}, null, 8, ["modelValue", "schema"]));
|
372
542
|
}
|
373
|
-
}),
|
543
|
+
}), tt = /* @__PURE__ */ q({
|
374
544
|
__name: "DateInput",
|
375
|
-
props: /* @__PURE__ */
|
545
|
+
props: /* @__PURE__ */ L({
|
376
546
|
schema: {}
|
377
547
|
}, {
|
378
548
|
modelValue: { type: Object, default: {} },
|
379
549
|
modelModifiers: {}
|
380
550
|
}),
|
381
551
|
emits: ["update:modelValue"],
|
382
|
-
setup(
|
383
|
-
const
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
i.value = b, O(b);
|
390
|
-
});
|
391
|
-
async function x() {
|
392
|
-
if (i.value === void 0)
|
393
|
-
return e.value.required ? (e.value.error = "This field is required", !1) : !0;
|
394
|
-
const b = new Date(i.value);
|
395
|
-
if (isNaN(b.getTime()))
|
396
|
-
return e.value.error = "Invalid date string", !1;
|
397
|
-
if (s.value && b < new Date(s.value))
|
398
|
-
return e.value.error = `Date must be greater than ${s.value}`, !1;
|
399
|
-
if (t.value && b > new Date(t.value))
|
400
|
-
return e.value.error = `Date must be less than ${t.value}`, !1;
|
401
|
-
if (e.value.validation) {
|
402
|
-
const _ = await e.value.validation(i.value, u == null ? void 0 : u.schema);
|
403
|
-
if (_ && _.length)
|
404
|
-
return e.value.error = _.toString(), !1;
|
405
|
-
}
|
406
|
-
return !0;
|
552
|
+
setup(t, { expose: u }) {
|
553
|
+
const l = t, e = Y(t, "modelValue"), a = x(null), n = x(e.value.max), s = x(e.value.max), r = x(e.value.value), c = w(() => l.schema);
|
554
|
+
async function g(V) {
|
555
|
+
if (V === void 0)
|
556
|
+
return e.value.required ? "This field is required" : !0;
|
557
|
+
const S = new Date(V);
|
558
|
+
return isNaN(S.getTime()) ? "Invalid date string" : s.value && S < new Date(s.value) ? `Date must be greater than ${s.value}` : n.value && S > new Date(n.value) ? `Date must be less than ${n.value}` : !0;
|
407
559
|
}
|
408
|
-
|
409
|
-
|
410
|
-
|
560
|
+
const { onValueUpdate: b, onFocus: I, getErrors: v } = ee(
|
561
|
+
a,
|
562
|
+
e,
|
563
|
+
r,
|
564
|
+
c,
|
565
|
+
g
|
566
|
+
);
|
567
|
+
function F() {
|
568
|
+
r.value = "", e.value.error = "", e.value.value = "";
|
411
569
|
}
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
570
|
+
const k = w(() => {
|
571
|
+
if (e.value.pattern) return e.value.pattern;
|
572
|
+
let V = e.value.pattern ?? "DD/MMM/YYYY";
|
573
|
+
return e.value.enableTime && (V += " HH:mm:ss"), V;
|
574
|
+
}), O = /[-/.,:\s]+/, m = w(() => k.value.split(O)), D = w(() => k.value.match(/[-/.,:\s]+/g) || []), d = x({});
|
575
|
+
H(
|
576
|
+
() => e.value.value,
|
577
|
+
(V) => {
|
578
|
+
r.value = V, j(V);
|
579
|
+
}
|
580
|
+
);
|
581
|
+
async function T(V, S, y) {
|
582
|
+
let C = S ?? (y == null ? void 0 : y.target).value;
|
583
|
+
/MM|MMM|MMMM/.test(V) && (C = ue(C, V)), Number.isInteger(parseInt(C)) && (C = J(parseInt(C))), d.value[V] = C;
|
584
|
+
const B = m.value.reduce((K, f, _) => (K += d.value[f] + (_ < m.value.length - 1 ? D.value[_] : ""), K), "");
|
585
|
+
r.value = B, await b();
|
425
586
|
}
|
426
|
-
function
|
427
|
-
|
587
|
+
async function j(V) {
|
588
|
+
const S = Je(V, k.value).split(O);
|
589
|
+
m.value.forEach((y, C) => T(y, S[C])), await b();
|
428
590
|
}
|
429
|
-
return
|
430
|
-
onValueUpdate:
|
431
|
-
onReset:
|
432
|
-
getErrors:
|
433
|
-
}),
|
434
|
-
|
435
|
-
var
|
436
|
-
|
591
|
+
return u({
|
592
|
+
onValueUpdate: b,
|
593
|
+
onReset: F,
|
594
|
+
getErrors: v
|
595
|
+
}), pe(() => {
|
596
|
+
m.value.forEach((V, S) => {
|
597
|
+
var y;
|
598
|
+
d.value[V] = ((y = r.value) == null ? void 0 : y.split(O)[S]) ?? "";
|
437
599
|
});
|
438
|
-
}), (
|
600
|
+
}), (V, S) => (i(), h(o(le), {
|
439
601
|
type: "text",
|
440
602
|
ref_key: "inputRef",
|
441
603
|
ref: a,
|
@@ -444,97 +606,79 @@ const De = /* @__PURE__ */ T({
|
|
444
606
|
"label-placement": e.value.labelPlacement ?? "stacked",
|
445
607
|
required: e.value.required,
|
446
608
|
"error-text": e.value.error,
|
447
|
-
|
609
|
+
autofocus: e.value.autoFocus,
|
448
610
|
disabled: e.value.disabled,
|
449
|
-
onIonFocus:
|
450
|
-
onIonBlur:
|
611
|
+
onIonFocus: o(I),
|
612
|
+
onIonBlur: o(b)
|
451
613
|
}, {
|
452
614
|
default: p(() => [
|
453
|
-
e.value
|
454
|
-
|
455
|
-
|
456
|
-
}, {
|
457
|
-
default: p(() => [
|
458
|
-
L(B(e.value.label) + " ", 1),
|
459
|
-
e.value.required ? (c(), h(o(Q), {
|
460
|
-
key: 0,
|
461
|
-
color: "danger"
|
462
|
-
}, {
|
463
|
-
default: p(() => _[0] || (_[0] = [
|
464
|
-
L("*")
|
465
|
-
])),
|
466
|
-
_: 1,
|
467
|
-
__: [0]
|
468
|
-
})) : $("", !0)
|
469
|
-
]),
|
470
|
-
_: 1
|
471
|
-
})) : $("", !0),
|
472
|
-
(c(!0), q(j, null, J(r.value, (V, D) => (c(), q(j, null, [
|
473
|
-
/MM|MMM|MMMM/.test(V) ? (c(), h(o(be), {
|
474
|
-
key: 0,
|
615
|
+
R(ae, { model: e.value }, null, 8, ["model"]),
|
616
|
+
(i(!0), U(A, null, W(m.value, (y, C) => (i(), U(A, null, [
|
617
|
+
/MM|MMM|MMMM/.test(y) ? (i(), h(o(De), {
|
475
618
|
slot: "start",
|
619
|
+
key: `select-${y}`,
|
476
620
|
interface: "popover",
|
477
|
-
style:
|
478
|
-
placeholder:
|
479
|
-
value:
|
480
|
-
onIonFocus:
|
481
|
-
onIonInput: (
|
482
|
-
onIonBlur: (
|
621
|
+
style: fe({ minWidth: e.value.enableTime ? "10%" : "30%" }),
|
622
|
+
placeholder: y,
|
623
|
+
value: d.value[y],
|
624
|
+
onIonFocus: o(I),
|
625
|
+
onIonInput: (B) => T(y, void 0, B),
|
626
|
+
onIonBlur: (B) => T(y, void 0, B)
|
483
627
|
}, {
|
484
628
|
default: p(() => [
|
485
|
-
(
|
486
|
-
key:
|
487
|
-
value: o(
|
629
|
+
(i(!0), U(A, null, W(o(X), (B, K) => (i(), h(o(Fe), {
|
630
|
+
key: B,
|
631
|
+
value: o(ue)(K + 1, y)
|
488
632
|
}, {
|
489
633
|
default: p(() => [
|
490
|
-
|
634
|
+
$(z(o(ue)(K + 1, y)), 1)
|
491
635
|
]),
|
492
636
|
_: 2
|
493
637
|
}, 1032, ["value"]))), 128))
|
494
638
|
]),
|
495
639
|
_: 2
|
496
|
-
}, 1032, ["style", "placeholder", "value", "onIonInput", "onIonBlur"])) : (
|
497
|
-
key: 1,
|
640
|
+
}, 1032, ["style", "placeholder", "value", "onIonFocus", "onIonInput", "onIonBlur"])) : (i(), h(o(le), {
|
498
641
|
slot: "start",
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
slot: "start"
|
642
|
+
key: `input-${y}`,
|
643
|
+
placeholder: y,
|
644
|
+
autofocus: e.value.autoFocus,
|
645
|
+
value: d.value[y],
|
646
|
+
onIonFocus: o(I),
|
647
|
+
onIonInput: (B) => T(y, void 0, B),
|
648
|
+
onIonBlur: (B) => T(y, void 0, B)
|
649
|
+
}, null, 8, ["placeholder", "autofocus", "value", "onIonFocus", "onIonInput", "onIonBlur"])),
|
650
|
+
C < m.value.length - 1 ? (i(), h(o(P), {
|
651
|
+
slot: "start",
|
652
|
+
key: `separator-${C}`
|
509
653
|
}, {
|
510
654
|
default: p(() => [
|
511
|
-
|
655
|
+
$(" " + z(D.value[C]) + " ", 1)
|
512
656
|
]),
|
513
657
|
_: 2
|
514
|
-
}, 1024)) :
|
658
|
+
}, 1024)) : E("", !0)
|
515
659
|
], 64))), 256)),
|
516
|
-
R(o(
|
660
|
+
R(o(P), { slot: "end" }, {
|
517
661
|
default: p(() => [
|
518
662
|
R(o($e), {
|
519
663
|
"enable-seconds": "",
|
520
664
|
"time-picker-inline": "",
|
521
665
|
teleport: "",
|
522
|
-
"model-value":
|
666
|
+
"model-value": r.value,
|
523
667
|
"auto-apply": !e.value.enableTime,
|
524
668
|
"enable-time-picker": e.value.enableTime ?? !1,
|
525
|
-
maxDate:
|
669
|
+
maxDate: n.value,
|
526
670
|
minDate: s.value,
|
527
|
-
onDateUpdate:
|
671
|
+
onDateUpdate: j
|
528
672
|
}, {
|
529
673
|
trigger: p(() => [
|
530
|
-
R(o(
|
674
|
+
R(o(Z), { fill: "clear" }, {
|
531
675
|
default: p(() => [
|
532
|
-
R(o(
|
676
|
+
R(o(Q), {
|
533
677
|
slot: "icon-only",
|
534
|
-
icon: o(
|
678
|
+
icon: o(Ue),
|
535
679
|
"aria-hidden": "true",
|
536
|
-
onClick:
|
537
|
-
}, null, 8, ["icon"])
|
680
|
+
onClick: o(I)
|
681
|
+
}, null, 8, ["icon", "onClick"])
|
538
682
|
]),
|
539
683
|
_: 1
|
540
684
|
})
|
@@ -546,110 +690,110 @@ const De = /* @__PURE__ */ T({
|
|
546
690
|
})
|
547
691
|
]),
|
548
692
|
_: 1
|
549
|
-
}, 8, ["fill", "label-placement", "required", "error-text", "
|
693
|
+
}, 8, ["fill", "label-placement", "required", "error-text", "autofocus", "disabled", "onIonFocus", "onIonBlur"]));
|
550
694
|
}
|
551
|
-
}),
|
695
|
+
}), lt = /* @__PURE__ */ q({
|
552
696
|
__name: "NumberInput",
|
553
|
-
props: /* @__PURE__ */
|
697
|
+
props: /* @__PURE__ */ L({
|
554
698
|
schema: {}
|
555
699
|
}, {
|
556
700
|
modelValue: { type: Object, default: {} },
|
557
701
|
modelModifiers: {}
|
558
702
|
}),
|
559
703
|
emits: ["update:modelValue"],
|
560
|
-
setup(
|
561
|
-
const
|
562
|
-
return
|
704
|
+
setup(t, { expose: u }) {
|
705
|
+
const l = Y(t, "modelValue"), e = x(null);
|
706
|
+
return u({
|
563
707
|
onReset: () => {
|
564
|
-
var
|
565
|
-
return (
|
708
|
+
var a;
|
709
|
+
return (a = e.value) == null ? void 0 : a.onReset();
|
566
710
|
},
|
567
711
|
onValueUpdate: () => {
|
568
|
-
var
|
569
|
-
return (
|
712
|
+
var a;
|
713
|
+
return (a = e.value) == null ? void 0 : a.onValueUpdate();
|
570
714
|
},
|
571
715
|
getErrors: () => {
|
572
|
-
var
|
573
|
-
return (
|
716
|
+
var a;
|
717
|
+
return (a = e.value) == null ? void 0 : a.getErrors();
|
574
718
|
}
|
575
|
-
}), (
|
576
|
-
modelValue:
|
577
|
-
"onUpdate:modelValue":
|
719
|
+
}), (a, n) => (i(), h(ne, {
|
720
|
+
modelValue: l.value,
|
721
|
+
"onUpdate:modelValue": n[0] || (n[0] = (s) => l.value = s),
|
578
722
|
type: "number",
|
579
|
-
schema:
|
723
|
+
schema: a.schema,
|
580
724
|
ref_key: "inputRef",
|
581
|
-
ref:
|
725
|
+
ref: e
|
582
726
|
}, null, 8, ["modelValue", "schema"]));
|
583
727
|
}
|
584
|
-
}),
|
728
|
+
}), at = /* @__PURE__ */ q({
|
585
729
|
__name: "EmailInput",
|
586
|
-
props: /* @__PURE__ */
|
730
|
+
props: /* @__PURE__ */ L({
|
587
731
|
schema: {}
|
588
732
|
}, {
|
589
733
|
modelValue: { type: Object, default: {} },
|
590
734
|
modelModifiers: {}
|
591
735
|
}),
|
592
736
|
emits: ["update:modelValue"],
|
593
|
-
setup(
|
594
|
-
const
|
595
|
-
return
|
737
|
+
setup(t, { expose: u }) {
|
738
|
+
const l = Y(t, "modelValue"), e = x(null);
|
739
|
+
return u({
|
596
740
|
onReset: () => {
|
597
|
-
var
|
598
|
-
return (
|
741
|
+
var a;
|
742
|
+
return (a = e.value) == null ? void 0 : a.onReset();
|
599
743
|
},
|
600
744
|
onValueUpdate: () => {
|
601
|
-
var
|
602
|
-
return (
|
745
|
+
var a;
|
746
|
+
return (a = e.value) == null ? void 0 : a.onValueUpdate();
|
603
747
|
},
|
604
748
|
getErrors: () => {
|
605
|
-
var
|
606
|
-
return (
|
749
|
+
var a;
|
750
|
+
return (a = e.value) == null ? void 0 : a.getErrors();
|
607
751
|
}
|
608
|
-
}), (
|
609
|
-
modelValue:
|
610
|
-
"onUpdate:modelValue":
|
752
|
+
}), (a, n) => (i(), h(ne, {
|
753
|
+
modelValue: l.value,
|
754
|
+
"onUpdate:modelValue": n[0] || (n[0] = (s) => l.value = s),
|
611
755
|
type: "email",
|
612
|
-
schema:
|
756
|
+
schema: a.schema,
|
613
757
|
ref_key: "inputRef",
|
614
|
-
ref:
|
758
|
+
ref: e
|
615
759
|
}, null, 8, ["modelValue", "schema"]));
|
616
760
|
}
|
617
|
-
}),
|
761
|
+
}), nt = /* @__PURE__ */ q({
|
618
762
|
__name: "PasswordInput",
|
619
|
-
props: /* @__PURE__ */
|
763
|
+
props: /* @__PURE__ */ L({
|
620
764
|
schema: {}
|
621
765
|
}, {
|
622
766
|
modelValue: { type: Object, default: {} },
|
623
767
|
modelModifiers: {}
|
624
768
|
}),
|
625
769
|
emits: ["update:modelValue"],
|
626
|
-
setup(
|
627
|
-
const
|
628
|
-
return
|
770
|
+
setup(t, { expose: u }) {
|
771
|
+
const l = Y(t, "modelValue"), e = x(null);
|
772
|
+
return u({
|
629
773
|
onReset: () => {
|
630
|
-
var
|
631
|
-
return (
|
774
|
+
var a;
|
775
|
+
return (a = e.value) == null ? void 0 : a.onReset();
|
632
776
|
},
|
633
777
|
onValueUpdate: () => {
|
634
|
-
var
|
635
|
-
return (
|
778
|
+
var a;
|
779
|
+
return (a = e.value) == null ? void 0 : a.onValueUpdate();
|
636
780
|
},
|
637
781
|
getErrors: () => {
|
638
|
-
var
|
639
|
-
return (
|
782
|
+
var a;
|
783
|
+
return (a = e.value) == null ? void 0 : a.getErrors();
|
640
784
|
}
|
641
|
-
}), (
|
642
|
-
modelValue:
|
643
|
-
"onUpdate:modelValue":
|
785
|
+
}), (a, n) => (i(), h(ne, {
|
786
|
+
modelValue: l.value,
|
787
|
+
"onUpdate:modelValue": n[0] || (n[0] = (s) => l.value = s),
|
644
788
|
type: "password",
|
645
|
-
schema:
|
789
|
+
schema: a.schema,
|
646
790
|
ref_key: "inputRef",
|
647
|
-
ref:
|
791
|
+
ref: e
|
648
792
|
}, null, 8, ["modelValue", "schema"]));
|
649
793
|
}
|
650
|
-
}),
|
794
|
+
}), ut = /* @__PURE__ */ q({
|
651
795
|
__name: "SelectInput",
|
652
|
-
props: /* @__PURE__ */
|
796
|
+
props: /* @__PURE__ */ L({
|
653
797
|
schema: {},
|
654
798
|
type: {}
|
655
799
|
}, {
|
@@ -657,28 +801,26 @@ const De = /* @__PURE__ */ T({
|
|
657
801
|
modelModifiers: {}
|
658
802
|
}),
|
659
803
|
emits: ["update:modelValue"],
|
660
|
-
setup(
|
661
|
-
const
|
662
|
-
|
663
|
-
), x = z(() => !k.value && oe(g.value) && !s.value ? e.value.placeholder ?? "Select an option" : "");
|
664
|
-
A([k, () => e.value.options], D, {
|
804
|
+
setup(t, { expose: u }) {
|
805
|
+
const l = t, e = Y(t, "modelValue"), a = x(null), n = x(null), s = x(!1), r = x([]), c = x(""), g = x(1), b = w(() => e.value.interface ?? "popover"), I = w(() => e.value.optionsPlacement === "top" ? "top" : "bottom"), v = w(() => r.value.filter((f) => !!f.isChecked)), F = w(() => !c.value && ie(v.value) && !s.value ? e.value.placeholder ?? "Select an option" : "");
|
806
|
+
H([c, () => e.value.options], B, {
|
665
807
|
immediate: !0,
|
666
808
|
deep: !0
|
667
|
-
}),
|
668
|
-
function
|
669
|
-
|
809
|
+
}), H(() => e.value.value, K, { immediate: !0, deep: !0 });
|
810
|
+
function k() {
|
811
|
+
r.value.forEach((f) => oe(f, r.value)), e.value.error = "", c.value = "", g.value = 1, e.value.value = e.value.multiple ? [] : "";
|
670
812
|
}
|
671
|
-
function f
|
672
|
-
if (
|
673
|
-
e.value.multiple ?
|
813
|
+
function O(f) {
|
814
|
+
if (f.isChecked) return oe(f, r.value);
|
815
|
+
e.value.multiple ? G(f, r.value) : (k(), G(f, r.value), C()), c.value = "";
|
674
816
|
}
|
675
|
-
function
|
676
|
-
switch (
|
817
|
+
function m() {
|
818
|
+
switch (b.value) {
|
677
819
|
case "action-sheet":
|
678
|
-
|
820
|
+
D();
|
679
821
|
break;
|
680
822
|
case "alert":
|
681
|
-
|
823
|
+
d();
|
682
824
|
break;
|
683
825
|
case "popover":
|
684
826
|
default:
|
@@ -686,18 +828,18 @@ const De = /* @__PURE__ */ T({
|
|
686
828
|
break;
|
687
829
|
}
|
688
830
|
}
|
689
|
-
async function
|
690
|
-
if (await
|
831
|
+
async function D() {
|
832
|
+
if (await B(), e.value.multiple) {
|
691
833
|
s.value = !0;
|
692
834
|
return;
|
693
835
|
}
|
694
|
-
await (await
|
836
|
+
await (await Be.create({
|
695
837
|
header: e.value.label || "Select an option",
|
696
838
|
buttons: [
|
697
|
-
...
|
698
|
-
text:
|
699
|
-
cssClass:
|
700
|
-
handler: () => (
|
839
|
+
...r.value.map((_) => ({
|
840
|
+
text: _.label,
|
841
|
+
cssClass: _.isChecked ? "selected-option" : "",
|
842
|
+
handler: () => (O(_), !1)
|
701
843
|
})),
|
702
844
|
{
|
703
845
|
text: "Cancel",
|
@@ -706,17 +848,17 @@ const De = /* @__PURE__ */ T({
|
|
706
848
|
]
|
707
849
|
})).present();
|
708
850
|
}
|
709
|
-
async function
|
710
|
-
await
|
711
|
-
const
|
712
|
-
label:
|
851
|
+
async function d() {
|
852
|
+
await B();
|
853
|
+
const f = r.value.map((M) => ({
|
854
|
+
label: M.label,
|
713
855
|
type: e.value.multiple ? "checkbox" : "radio",
|
714
|
-
value:
|
715
|
-
checked:
|
856
|
+
value: M,
|
857
|
+
checked: M.isChecked
|
716
858
|
}));
|
717
|
-
await (await
|
859
|
+
await (await Oe.create({
|
718
860
|
header: e.value.label || "Select an option",
|
719
|
-
inputs:
|
861
|
+
inputs: f,
|
720
862
|
buttons: [
|
721
863
|
{
|
722
864
|
text: "Cancel",
|
@@ -724,116 +866,111 @@ const De = /* @__PURE__ */ T({
|
|
724
866
|
},
|
725
867
|
{
|
726
868
|
text: "OK",
|
727
|
-
handler: (
|
869
|
+
handler: (M) => {
|
728
870
|
if (e.value.multiple)
|
729
|
-
|
730
|
-
const
|
731
|
-
|
871
|
+
r.value.forEach((N) => oe(N, r.value)), M.forEach((N) => {
|
872
|
+
const te = r.value.find((Ve) => Ve.value === N.value);
|
873
|
+
te && G(te, r.value);
|
732
874
|
});
|
733
875
|
else {
|
734
|
-
|
735
|
-
const
|
736
|
-
|
876
|
+
k();
|
877
|
+
const N = r.value.find((te) => te.value === M.value);
|
878
|
+
N && G(N, r.value);
|
737
879
|
}
|
738
|
-
|
880
|
+
C();
|
739
881
|
}
|
740
882
|
}
|
741
883
|
]
|
742
884
|
})).present();
|
743
885
|
}
|
744
|
-
function
|
745
|
-
|
746
|
-
|
747
|
-
}
|
748
|
-
async function _() {
|
749
|
-
if (e.value.required && oe(g.value))
|
750
|
-
return e.value.error = "This field is required", !1;
|
886
|
+
async function T() {
|
887
|
+
if (e.value.required && ie(v.value))
|
888
|
+
return "This field is required";
|
751
889
|
if (e.value.validation) {
|
752
|
-
const
|
753
|
-
if (
|
754
|
-
return
|
890
|
+
const f = await e.value.validation(v.value, l == null ? void 0 : l.schema);
|
891
|
+
if (f && f.length)
|
892
|
+
return f.join();
|
755
893
|
}
|
756
894
|
return !0;
|
757
895
|
}
|
758
|
-
|
759
|
-
|
760
|
-
|
896
|
+
const { onFocus: j, applyValidationState: V } = ee(
|
897
|
+
a,
|
898
|
+
e,
|
899
|
+
w(() => e.value.multiple ? v.value : v.value[0]),
|
900
|
+
w(() => l == null ? void 0 : l.schema),
|
901
|
+
T
|
902
|
+
);
|
903
|
+
function S() {
|
904
|
+
return e.value.error;
|
761
905
|
}
|
762
|
-
|
763
|
-
|
906
|
+
function y(f) {
|
907
|
+
var _;
|
908
|
+
f.target === ((_ = a.value) == null ? void 0 : _.$el) && (j(), b.value === "popover" && (s.value = !0));
|
909
|
+
}
|
910
|
+
async function C(f) {
|
911
|
+
var M;
|
912
|
+
if ((M = f == null ? void 0 : f.relatedTarget) != null && M.closest(".suggestions-list")) return;
|
913
|
+
s.value = !1;
|
914
|
+
const _ = await T();
|
915
|
+
_ === !0 ? (e.value.error = "", e.value.value = e.value.multiple ? v.value : v.value[0]) : e.value.error = typeof _ == "string" ? _ : "Validation failed", await V(_ === !0);
|
916
|
+
}
|
917
|
+
async function B() {
|
918
|
+
const f = [];
|
764
919
|
if (typeof e.value.options == "function") {
|
765
|
-
const
|
766
|
-
|
920
|
+
const _ = await e.value.options(c.value);
|
921
|
+
f.push(..._.filter((M) => !!M.label));
|
767
922
|
} else
|
768
|
-
|
769
|
-
|
923
|
+
f.push(...We(e.value.options ?? [], c.value));
|
924
|
+
v.value.forEach((_) => G(_, f)), r.value = f;
|
770
925
|
}
|
771
|
-
function
|
772
|
-
const
|
773
|
-
|
774
|
-
value:
|
775
|
-
label:
|
776
|
-
},
|
926
|
+
function K() {
|
927
|
+
const f = e.value.value;
|
928
|
+
f && (Array.isArray(f) ? f.forEach((_) => G(_, r.value)) : G(typeof f == "object" ? f : {
|
929
|
+
value: f,
|
930
|
+
label: f
|
931
|
+
}, r.value));
|
777
932
|
}
|
778
|
-
return
|
779
|
-
onValueUpdate:
|
780
|
-
onReset:
|
781
|
-
getErrors:
|
782
|
-
}), (
|
933
|
+
return u({
|
934
|
+
onValueUpdate: C,
|
935
|
+
onReset: k,
|
936
|
+
getErrors: S
|
937
|
+
}), (f, _) => (i(), U("div", {
|
783
938
|
class: "autocomplete-container",
|
784
|
-
onFocusout:
|
939
|
+
onFocusout: C,
|
785
940
|
ref_key: "containerRef",
|
786
|
-
ref:
|
941
|
+
ref: n
|
787
942
|
}, [
|
788
|
-
R(o(
|
943
|
+
R(o(le), {
|
789
944
|
ref_key: "inputRef",
|
790
945
|
ref: a,
|
791
|
-
modelValue:
|
792
|
-
"onUpdate:modelValue":
|
946
|
+
modelValue: c.value,
|
947
|
+
"onUpdate:modelValue": _[0] || (_[0] = (M) => c.value = M),
|
793
948
|
fill: e.value.fill ?? "outline",
|
794
949
|
"label-placement": e.value.labelPlacement ?? "stacked",
|
795
|
-
type:
|
950
|
+
type: f.type ?? "text",
|
796
951
|
required: e.value.required,
|
797
952
|
"error-text": e.value.error,
|
798
|
-
|
799
|
-
placeholder:
|
953
|
+
autofocus: e.value.autoFocus,
|
954
|
+
placeholder: F.value,
|
800
955
|
disabled: e.value.disabled,
|
801
956
|
counter: e.value.counter,
|
802
|
-
onIonFocus:
|
957
|
+
onIonFocus: y,
|
803
958
|
debounce: 300,
|
804
|
-
onClick:
|
959
|
+
onClick: m
|
805
960
|
}, {
|
806
961
|
default: p(() => [
|
807
|
-
e.value
|
962
|
+
R(ae, { model: e.value }, null, 8, ["model"]),
|
963
|
+
e.value.multiple ? (i(), h(o(P), {
|
808
964
|
key: 0,
|
809
|
-
slot: "label"
|
810
|
-
}, {
|
811
|
-
default: p(() => [
|
812
|
-
L(B(e.value.label) + " ", 1),
|
813
|
-
e.value.required ? (c(), h(o(Q), {
|
814
|
-
key: 0,
|
815
|
-
color: "danger"
|
816
|
-
}, {
|
817
|
-
default: p(() => I[1] || (I[1] = [
|
818
|
-
L("*")
|
819
|
-
])),
|
820
|
-
_: 1,
|
821
|
-
__: [1]
|
822
|
-
})) : $("", !0)
|
823
|
-
]),
|
824
|
-
_: 1
|
825
|
-
})) : $("", !0),
|
826
|
-
e.value.multiple ? (c(), h(o(F), {
|
827
|
-
key: 1,
|
828
965
|
style: { width: "fit-content" },
|
829
966
|
slot: "start"
|
830
967
|
}, {
|
831
968
|
default: p(() => [
|
832
|
-
(
|
969
|
+
(i(!0), U(A, null, W(v.value, (M, N) => (i(), h(o(Se), { key: N }, {
|
833
970
|
default: p(() => [
|
834
|
-
R(o(
|
971
|
+
R(o(P), null, {
|
835
972
|
default: p(() => [
|
836
|
-
|
973
|
+
$(z(M.label), 1)
|
837
974
|
]),
|
838
975
|
_: 2
|
839
976
|
}, 1024)
|
@@ -842,52 +979,52 @@ const De = /* @__PURE__ */ T({
|
|
842
979
|
}, 1024))), 128))
|
843
980
|
]),
|
844
981
|
_: 1
|
845
|
-
})) : (
|
846
|
-
key:
|
982
|
+
})) : (i(), h(o(P), {
|
983
|
+
key: 1,
|
847
984
|
slot: "start",
|
848
985
|
class: "ion-no-wrap"
|
849
986
|
}, {
|
850
987
|
default: p(() => {
|
851
|
-
var
|
988
|
+
var M;
|
852
989
|
return [
|
853
|
-
|
990
|
+
$(z(((M = v.value[0]) == null ? void 0 : M.label) ?? ""), 1)
|
854
991
|
];
|
855
992
|
}),
|
856
993
|
_: 1
|
857
994
|
})),
|
858
|
-
R(o(
|
995
|
+
R(o(Q), {
|
859
996
|
slot: "end",
|
860
|
-
icon: o(
|
997
|
+
icon: o(ze)
|
861
998
|
}, null, 8, ["icon"]),
|
862
|
-
|
863
|
-
key:
|
999
|
+
v.value.length > 0 || c.value ? (i(), h(o(Q), {
|
1000
|
+
key: 2,
|
864
1001
|
slot: "end",
|
865
|
-
icon: o(
|
866
|
-
onClick:
|
1002
|
+
icon: o(qe),
|
1003
|
+
onClick: k,
|
867
1004
|
style: { "z-index": "999999" }
|
868
|
-
}, null, 8, ["icon"])) :
|
1005
|
+
}, null, 8, ["icon"])) : E("", !0)
|
869
1006
|
]),
|
870
1007
|
_: 1
|
871
|
-
}, 8, ["modelValue", "fill", "label-placement", "type", "required", "error-text", "
|
872
|
-
s.value &&
|
1008
|
+
}, 8, ["modelValue", "fill", "label-placement", "type", "required", "error-text", "autofocus", "placeholder", "disabled", "counter"]),
|
1009
|
+
s.value && r.value.length > 0 && b.value === "popover" ? (i(), h(o(Re), {
|
873
1010
|
key: 0,
|
874
|
-
class:
|
1011
|
+
class: Ie(["suggestions-list", I.value])
|
875
1012
|
}, {
|
876
1013
|
default: p(() => [
|
877
|
-
(
|
1014
|
+
(i(!0), U(A, null, W(r.value, (M) => (i(), h(o(Ee), {
|
878
1015
|
button: "",
|
879
|
-
key:
|
880
|
-
onClick: (
|
1016
|
+
key: M.label,
|
1017
|
+
onClick: (N) => O(M)
|
881
1018
|
}, {
|
882
1019
|
default: p(() => [
|
883
|
-
e.value.multiple ? (
|
1020
|
+
e.value.multiple ? (i(), h(o(he), {
|
884
1021
|
key: 0,
|
885
1022
|
slot: "start",
|
886
|
-
checked:
|
887
|
-
}, null, 8, ["checked"])) :
|
888
|
-
R(o(
|
1023
|
+
checked: M.isChecked
|
1024
|
+
}, null, 8, ["checked"])) : E("", !0),
|
1025
|
+
R(o(P), null, {
|
889
1026
|
default: p(() => [
|
890
|
-
|
1027
|
+
$(z(M.label), 1)
|
891
1028
|
]),
|
892
1029
|
_: 2
|
893
1030
|
}, 1024)
|
@@ -896,62 +1033,48 @@ const De = /* @__PURE__ */ T({
|
|
896
1033
|
}, 1032, ["onClick"]))), 128))
|
897
1034
|
]),
|
898
1035
|
_: 1
|
899
|
-
}, 8, ["class"])) :
|
1036
|
+
}, 8, ["class"])) : E("", !0)
|
900
1037
|
], 544));
|
901
1038
|
}
|
902
|
-
}),
|
903
|
-
const
|
904
|
-
for (const [e, a] of
|
905
|
-
|
906
|
-
return
|
907
|
-
},
|
1039
|
+
}), be = (t, u) => {
|
1040
|
+
const l = t.__vccOpts || t;
|
1041
|
+
for (const [e, a] of u)
|
1042
|
+
l[e] = a;
|
1043
|
+
return l;
|
1044
|
+
}, ot = /* @__PURE__ */ be(ut, [["__scopeId", "data-v-0b19f6eb"]]), rt = /* @__PURE__ */ q({
|
908
1045
|
__name: "TextAreaInput",
|
909
|
-
props: /* @__PURE__ */
|
1046
|
+
props: /* @__PURE__ */ L({
|
910
1047
|
schema: {}
|
911
1048
|
}, {
|
912
1049
|
modelValue: { type: Object, default: {} },
|
913
1050
|
modelModifiers: {}
|
914
1051
|
}),
|
915
1052
|
emits: ["update:modelValue"],
|
916
|
-
setup(
|
917
|
-
const
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
if (r && r.length)
|
932
|
-
return e.value.error = r.join(), !1;
|
933
|
-
}
|
934
|
-
return !0;
|
935
|
-
}
|
936
|
-
async function C() {
|
937
|
-
var r, n, g, x, v;
|
938
|
-
(r = a.value) == null || r.$el.classList.remove("ion-invalid"), (n = a.value) == null || n.$el.classList.remove("ion-valid"), await k() ? (e.value.error = "", e.value.value = t.value, (g = a.value) == null || g.$el.classList.add("ion-valid")) : (x = a.value) == null || x.$el.classList.add("ion-invalid"), (v = a.value) == null || v.$el.classList.add("ion-touched");
|
939
|
-
}
|
940
|
-
return d({
|
941
|
-
onReset: i,
|
942
|
-
onValueUpdate: C,
|
943
|
-
getErrors: () => e.value.error
|
944
|
-
}), (r, n) => (c(), h(o(Ie), {
|
1053
|
+
setup(t, { expose: u }) {
|
1054
|
+
const l = t, e = Y(t, "modelValue"), a = x(null), n = x(e.value.value), s = w(() => l.schema), { onValueUpdate: r, onFocus: c, onReset: g, getErrors: b } = ee(
|
1055
|
+
a,
|
1056
|
+
e,
|
1057
|
+
n,
|
1058
|
+
s
|
1059
|
+
);
|
1060
|
+
return H(
|
1061
|
+
() => e.value.value,
|
1062
|
+
(I) => n.value = I
|
1063
|
+
), u({
|
1064
|
+
onReset: g,
|
1065
|
+
onValueUpdate: r,
|
1066
|
+
getErrors: b
|
1067
|
+
}), (I, v) => (i(), h(o(Te), {
|
945
1068
|
ref_key: "inputRef",
|
946
1069
|
ref: a,
|
947
|
-
modelValue:
|
948
|
-
"onUpdate:modelValue":
|
1070
|
+
modelValue: n.value,
|
1071
|
+
"onUpdate:modelValue": v[0] || (v[0] = (F) => n.value = F),
|
949
1072
|
"clear-input": !0,
|
950
1073
|
fill: e.value.fill ?? "outline",
|
951
1074
|
"label-placement": e.value.labelPlacement ?? "stacked",
|
952
1075
|
required: e.value.required,
|
953
1076
|
"error-text": e.value.error,
|
954
|
-
|
1077
|
+
autofocus: e.value.autoFocus,
|
955
1078
|
placeholder: e.value.placeholder,
|
956
1079
|
disabled: e.value.disabled,
|
957
1080
|
counter: e.value.counter,
|
@@ -963,40 +1086,22 @@ const De = /* @__PURE__ */ T({
|
|
963
1086
|
"max-length": e.value.maxLength,
|
964
1087
|
"min-length": e.value.minLength,
|
965
1088
|
pattern: e.value.pattern,
|
966
|
-
onIonFocus:
|
967
|
-
onIonChange:
|
968
|
-
onIonBlur:
|
1089
|
+
onIonFocus: o(c),
|
1090
|
+
onIonChange: o(r),
|
1091
|
+
onIonBlur: o(r)
|
969
1092
|
}, {
|
970
1093
|
default: p(() => [
|
971
|
-
e.value
|
972
|
-
key: 0,
|
973
|
-
slot: "label"
|
974
|
-
}, {
|
975
|
-
default: p(() => [
|
976
|
-
L(B(e.value.label) + " ", 1),
|
977
|
-
e.value.required ? (c(), h(o(Q), {
|
978
|
-
key: 0,
|
979
|
-
color: "danger"
|
980
|
-
}, {
|
981
|
-
default: p(() => n[1] || (n[1] = [
|
982
|
-
L("*")
|
983
|
-
])),
|
984
|
-
_: 1,
|
985
|
-
__: [1]
|
986
|
-
})) : $("", !0)
|
987
|
-
]),
|
988
|
-
_: 1
|
989
|
-
})) : $("", !0)
|
1094
|
+
R(ae, { model: e.value }, null, 8, ["model"])
|
990
1095
|
]),
|
991
1096
|
_: 1
|
992
|
-
}, 8, ["modelValue", "fill", "label-placement", "required", "error-text", "
|
1097
|
+
}, 8, ["modelValue", "fill", "label-placement", "required", "error-text", "autofocus", "placeholder", "disabled", "counter", "min", "max", "rows", "cols", "auto-grow", "max-length", "min-length", "pattern", "onIonFocus", "onIonChange", "onIonBlur"]));
|
993
1098
|
}
|
994
|
-
}),
|
1099
|
+
}), st = {
|
995
1100
|
class: "ion-margin-end",
|
996
1101
|
style: { "flex-grow": "1" }
|
997
|
-
},
|
1102
|
+
}, it = { style: { display: "flex", "justify-content": "flex-end" } }, ct = /* @__PURE__ */ q({
|
998
1103
|
__name: "RepeatInput",
|
999
|
-
props: /* @__PURE__ */
|
1104
|
+
props: /* @__PURE__ */ L({
|
1000
1105
|
schema: {},
|
1001
1106
|
data: {},
|
1002
1107
|
computedData: {}
|
@@ -1005,177 +1110,164 @@ const De = /* @__PURE__ */ T({
|
|
1005
1110
|
modelModifiers: {}
|
1006
1111
|
}),
|
1007
1112
|
emits: ["update:modelValue"],
|
1008
|
-
setup(
|
1009
|
-
const
|
1010
|
-
label: `Set ${
|
1011
|
-
value:
|
1012
|
-
other: Object.entries(
|
1113
|
+
setup(t, { expose: u }) {
|
1114
|
+
const l = Y(t, "modelValue"), e = x([]), { dynamicRefs: a, resetForm: n, getFormErrors: s, updateFormValues: r } = ge(), c = w(() => e.value.map((k, O) => ({
|
1115
|
+
label: `Set ${O + 1}`,
|
1116
|
+
value: O,
|
1117
|
+
other: Object.entries(k).reduce(
|
1118
|
+
(m, [D, d]) => (m[D] = d.value, m),
|
1119
|
+
{}
|
1120
|
+
)
|
1013
1121
|
})));
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1122
|
+
H(
|
1123
|
+
c,
|
1124
|
+
(k) => {
|
1125
|
+
l.value.value = k;
|
1126
|
+
},
|
1127
|
+
{ deep: !0, immediate: !0 }
|
1128
|
+
), pe(g);
|
1129
|
+
function g() {
|
1130
|
+
l.value.children && e.value.push(de(l.value.children));
|
1019
1131
|
}
|
1020
|
-
function
|
1021
|
-
e.value.splice(
|
1132
|
+
function b(k) {
|
1133
|
+
e.value.splice(k, 1);
|
1022
1134
|
}
|
1023
|
-
function
|
1024
|
-
|
1025
|
-
typeof (n == null ? void 0 : n.onReset) == "function" && n.onReset();
|
1026
|
-
});
|
1135
|
+
function I() {
|
1136
|
+
n();
|
1027
1137
|
}
|
1028
|
-
function
|
1029
|
-
|
1030
|
-
for (const g of a.value)
|
1031
|
-
typeof (g == null ? void 0 : g.getErrors) == "function" && n.push(g.getErrors());
|
1032
|
-
return n;
|
1138
|
+
function v() {
|
1139
|
+
return s();
|
1033
1140
|
}
|
1034
|
-
async function
|
1035
|
-
|
1036
|
-
typeof (n == null ? void 0 : n.onValueUpdate) == "function" && await n.onValueUpdate();
|
1141
|
+
async function F() {
|
1142
|
+
await r();
|
1037
1143
|
}
|
1038
|
-
return
|
1039
|
-
onValueUpdate:
|
1040
|
-
onReset:
|
1041
|
-
getErrors:
|
1042
|
-
}), (
|
1043
|
-
|
1044
|
-
|
1144
|
+
return u({
|
1145
|
+
onValueUpdate: F,
|
1146
|
+
onReset: I,
|
1147
|
+
getErrors: v
|
1148
|
+
}), (k, O) => (i(!0), U(A, null, W(e.value, (m, D) => (i(), U("div", {
|
1149
|
+
class: "repeat-input-wrapper",
|
1150
|
+
key: D
|
1151
|
+
}, [
|
1152
|
+
ve("div", st, [
|
1153
|
+
R(o(re), null, {
|
1045
1154
|
default: p(() => [
|
1046
|
-
(
|
1047
|
-
var
|
1048
|
-
return
|
1049
|
-
o(
|
1050
|
-
key: `${
|
1051
|
-
size: ((
|
1052
|
-
"size-sm": (
|
1053
|
-
"size-md": (
|
1054
|
-
"size-lg": (
|
1055
|
-
"size-xl": (
|
1155
|
+
(i(!0), U(A, null, W(Object.keys(m), (d) => {
|
1156
|
+
var T, j, V, S, y;
|
1157
|
+
return i(), U(A, null, [
|
1158
|
+
o(ce)(m[d], k.data, k.computedData) ? (i(), h(o(se), {
|
1159
|
+
key: `${D}-${d}`,
|
1160
|
+
size: ((T = m[d].grid) == null ? void 0 : T.xs) ?? "12",
|
1161
|
+
"size-sm": (j = m[d].grid) == null ? void 0 : j.sm,
|
1162
|
+
"size-md": (V = m[d].grid) == null ? void 0 : V.md,
|
1163
|
+
"size-lg": (S = m[d].grid) == null ? void 0 : S.lg,
|
1164
|
+
"size-xl": (y = m[d].grid) == null ? void 0 : y.xl,
|
1056
1165
|
class: "ion-margin-bottom"
|
1057
1166
|
}, {
|
1058
1167
|
default: p(() => [
|
1059
|
-
(
|
1060
|
-
modelValue:
|
1061
|
-
"onUpdate:modelValue": (
|
1062
|
-
schema:
|
1063
|
-
"ref-key": `${
|
1168
|
+
(i(), h(me(m[d].type), {
|
1169
|
+
modelValue: m[d],
|
1170
|
+
"onUpdate:modelValue": (C) => m[d] = C,
|
1171
|
+
schema: m,
|
1172
|
+
"ref-key": `${D}-${d}`,
|
1064
1173
|
ref_for: !0,
|
1065
1174
|
ref_key: "dynamicRefs",
|
1066
1175
|
ref: a
|
1067
1176
|
}, null, 8, ["modelValue", "onUpdate:modelValue", "schema", "ref-key"]))
|
1068
1177
|
]),
|
1069
1178
|
_: 2
|
1070
|
-
}, 1032, ["size", "size-sm", "size-md", "size-lg", "size-xl"])) :
|
1179
|
+
}, 1032, ["size", "size-sm", "size-md", "size-lg", "size-xl"])) : E("", !0)
|
1071
1180
|
], 64);
|
1072
1181
|
}), 256))
|
1073
1182
|
]),
|
1074
1183
|
_: 2
|
1075
1184
|
}, 1024)
|
1076
1185
|
]),
|
1077
|
-
|
1078
|
-
|
1186
|
+
ve("div", it, [
|
1187
|
+
D === e.value.length - 1 ? (i(), h(o(Z), {
|
1079
1188
|
key: 0,
|
1080
|
-
onClick:
|
1189
|
+
onClick: g,
|
1081
1190
|
color: "primary"
|
1082
1191
|
}, {
|
1083
1192
|
default: p(() => [
|
1084
|
-
R(o(
|
1193
|
+
R(o(Q), {
|
1085
1194
|
slot: "icon-only",
|
1086
|
-
icon: o(
|
1195
|
+
icon: o(Ae)
|
1087
1196
|
}, null, 8, ["icon"])
|
1088
1197
|
]),
|
1089
1198
|
_: 1
|
1090
|
-
})) :
|
1091
|
-
e.value.length > 1 ? (
|
1199
|
+
})) : E("", !0),
|
1200
|
+
e.value.length > 1 ? (i(), h(o(Z), {
|
1092
1201
|
key: 1,
|
1093
|
-
onClick: (
|
1202
|
+
onClick: (d) => b(D),
|
1094
1203
|
color: "warning"
|
1095
1204
|
}, {
|
1096
1205
|
default: p(() => [
|
1097
|
-
R(o(
|
1206
|
+
R(o(Q), {
|
1098
1207
|
slot: "icon-only",
|
1099
|
-
icon: o(
|
1208
|
+
icon: o(je)
|
1100
1209
|
}, null, 8, ["icon"])
|
1101
1210
|
]),
|
1102
1211
|
_: 2
|
1103
|
-
}, 1032, ["onClick"])) :
|
1212
|
+
}, 1032, ["onClick"])) : E("", !0)
|
1104
1213
|
])
|
1105
|
-
]))),
|
1214
|
+
]))), 128));
|
1106
1215
|
}
|
1107
|
-
}),
|
1216
|
+
}), dt = /* @__PURE__ */ be(ct, [["__scopeId", "data-v-402695fe"]]);
|
1217
|
+
function vt(t) {
|
1218
|
+
return {
|
1219
|
+
labelTextWithAsterisk: w(() => {
|
1220
|
+
const l = t.value.label || "", e = t.value.required ? " *" : "";
|
1221
|
+
return l + e;
|
1222
|
+
})
|
1223
|
+
};
|
1224
|
+
}
|
1225
|
+
const mt = /* @__PURE__ */ q({
|
1108
1226
|
__name: "CheckboxInput",
|
1109
|
-
props: /* @__PURE__ */
|
1227
|
+
props: /* @__PURE__ */ L({
|
1110
1228
|
schema: {}
|
1111
1229
|
}, {
|
1112
1230
|
modelValue: { type: Object, default: {} },
|
1113
1231
|
modelModifiers: {}
|
1114
1232
|
}),
|
1115
1233
|
emits: ["update:modelValue"],
|
1116
|
-
setup(
|
1117
|
-
const
|
1118
|
-
|
1119
|
-
|
1120
|
-
t.value = !1, e.value.error = "", e.value.value = !1;
|
1121
|
-
}
|
1122
|
-
async function i() {
|
1123
|
-
if (e.value.required && !t.value)
|
1124
|
-
return e.value.error = "This field is required", !1;
|
1125
|
-
if (e.value.validation) {
|
1126
|
-
const r = await e.value.validation(t.value, u == null ? void 0 : u.schema);
|
1127
|
-
if (r && r.length)
|
1128
|
-
return e.value.error = r.join(), !1;
|
1129
|
-
}
|
1130
|
-
return !0;
|
1131
|
-
}
|
1132
|
-
async function k() {
|
1133
|
-
var r, n, g, x, v;
|
1134
|
-
(r = a.value) == null || r.$el.classList.remove("ion-invalid"), (n = a.value) == null || n.$el.classList.remove("ion-valid"), await i() ? (e.value.error = "", e.value.value = t.value, (g = a.value) == null || g.$el.classList.add("ion-valid")) : (x = a.value) == null || x.$el.classList.add("ion-invalid"), (v = a.value) == null || v.$el.classList.add("ion-touched");
|
1234
|
+
setup(t, { expose: u }) {
|
1235
|
+
const l = t, e = Y(t, "modelValue"), a = x(null), n = x(e.value.value), s = w(() => l.schema), { labelTextWithAsterisk: r } = vt(e), { onValueUpdate: c, onFocus: g, getErrors: b } = ee(a, e, n, s);
|
1236
|
+
function I() {
|
1237
|
+
n.value = !1, e.value.error = "", e.value.value = !1;
|
1135
1238
|
}
|
1136
|
-
|
1137
|
-
|
1138
|
-
(
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
modelValue:
|
1146
|
-
"onUpdate:modelValue": n[0] || (n[0] = (g) => t.value = g),
|
1239
|
+
return H(
|
1240
|
+
() => e.value.value,
|
1241
|
+
(v) => n.value = v
|
1242
|
+
), u({
|
1243
|
+
onValueUpdate: c,
|
1244
|
+
onReset: I,
|
1245
|
+
getErrors: b
|
1246
|
+
}), (v, F) => (i(), h(o(he), {
|
1247
|
+
modelValue: n.value,
|
1248
|
+
"onUpdate:modelValue": F[0] || (F[0] = (k) => n.value = k),
|
1147
1249
|
ref_key: "inputRef",
|
1148
1250
|
ref: a,
|
1149
1251
|
required: e.value.required,
|
1150
1252
|
"error-text": e.value.error,
|
1151
1253
|
disabled: e.value.disabled,
|
1152
|
-
onIonFocus:
|
1153
|
-
onIonChange:
|
1154
|
-
onIonBlur:
|
1254
|
+
onIonFocus: o(g),
|
1255
|
+
onIonChange: o(c),
|
1256
|
+
onIonBlur: o(c)
|
1155
1257
|
}, {
|
1156
1258
|
default: p(() => [
|
1157
|
-
|
1158
|
-
e.value.required ? (c(), h(o(Q), {
|
1159
|
-
key: 0,
|
1160
|
-
color: "danger"
|
1161
|
-
}, {
|
1162
|
-
default: p(() => n[1] || (n[1] = [
|
1163
|
-
L("*")
|
1164
|
-
])),
|
1165
|
-
_: 1,
|
1166
|
-
__: [1]
|
1167
|
-
})) : $("", !0)
|
1259
|
+
$(z(o(r)), 1)
|
1168
1260
|
]),
|
1169
1261
|
_: 1
|
1170
|
-
}, 8, ["modelValue", "required", "error-text", "disabled"]));
|
1262
|
+
}, 8, ["modelValue", "required", "error-text", "disabled", "onIonFocus", "onIonChange", "onIonBlur"]));
|
1171
1263
|
}
|
1172
|
-
}),
|
1173
|
-
install(
|
1174
|
-
|
1264
|
+
}), bt = {
|
1265
|
+
install(t) {
|
1266
|
+
t.component("VForm", Ze), t.component("TextInput", et), t.component("DateInput", tt), t.component("NumberInput", lt), t.component("EmailInput", at), t.component("PasswordInput", nt), t.component("SelectInput", ot), t.component("TextAreaInput", rt), t.component("RepeatInput", dt), t.component("CheckboxInput", mt), t.directive("maskito", Le);
|
1175
1267
|
}
|
1176
1268
|
};
|
1177
1269
|
export {
|
1178
|
-
|
1179
|
-
|
1270
|
+
bt as VForm,
|
1271
|
+
bt as default
|
1180
1272
|
};
|
1181
1273
|
//# sourceMappingURL=index.es.js.map
|