@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.
Files changed (55) hide show
  1. package/README.md +256 -167
  2. package/dist/components/inputs/BaseInput.vue.d.ts +5 -6
  3. package/dist/components/inputs/BaseInput.vue.d.ts.map +1 -1
  4. package/dist/components/inputs/CheckboxInput.vue.d.ts +2 -3
  5. package/dist/components/inputs/CheckboxInput.vue.d.ts.map +1 -1
  6. package/dist/components/inputs/DateInput.vue.d.ts +2 -3
  7. package/dist/components/inputs/DateInput.vue.d.ts.map +1 -1
  8. package/dist/components/inputs/EmailInput.vue.d.ts +6 -4
  9. package/dist/components/inputs/EmailInput.vue.d.ts.map +1 -1
  10. package/dist/components/inputs/NumberInput.vue.d.ts +6 -4
  11. package/dist/components/inputs/NumberInput.vue.d.ts.map +1 -1
  12. package/dist/components/inputs/PasswordInput.vue.d.ts +6 -4
  13. package/dist/components/inputs/PasswordInput.vue.d.ts.map +1 -1
  14. package/dist/components/inputs/RepeatInput.vue.d.ts.map +1 -1
  15. package/dist/components/inputs/SelectInput.vue.d.ts +2 -1
  16. package/dist/components/inputs/SelectInput.vue.d.ts.map +1 -1
  17. package/dist/components/inputs/TextAreaInput.vue.d.ts +3 -5
  18. package/dist/components/inputs/TextAreaInput.vue.d.ts.map +1 -1
  19. package/dist/components/inputs/TextInput.vue.d.ts +6 -4
  20. package/dist/components/inputs/TextInput.vue.d.ts.map +1 -1
  21. package/dist/components/shared/InputLabel.vue.d.ts +7 -0
  22. package/dist/components/shared/InputLabel.vue.d.ts.map +1 -0
  23. package/dist/components/vForm.vue.d.ts +2 -2
  24. package/dist/components/vForm.vue.d.ts.map +1 -1
  25. package/dist/composables/useCheckboxLabelText.d.ts +10 -0
  26. package/dist/composables/useCheckboxLabelText.d.ts.map +1 -0
  27. package/dist/composables/useDataTransformation.d.ts +11 -0
  28. package/dist/composables/useDataTransformation.d.ts.map +1 -0
  29. package/dist/composables/useFormValidation.d.ts +11 -0
  30. package/dist/composables/useFormValidation.d.ts.map +1 -0
  31. package/dist/composables/useInputProps.d.ts +25 -0
  32. package/dist/composables/useInputProps.d.ts.map +1 -0
  33. package/dist/composables/useInputValidation.d.ts +16 -0
  34. package/dist/composables/useInputValidation.d.ts.map +1 -0
  35. package/dist/composables/useLabelTemplate.d.ts +12 -0
  36. package/dist/composables/useLabelTemplate.d.ts.map +1 -0
  37. package/dist/composables/useValidationStyles.d.ts +10 -0
  38. package/dist/composables/useValidationStyles.d.ts.map +1 -0
  39. package/dist/constants/index.d.ts +41 -0
  40. package/dist/constants/index.d.ts.map +1 -0
  41. package/dist/index.cjs.js +1 -1
  42. package/dist/index.cjs.js.map +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.es.js +793 -701
  45. package/dist/index.es.js.map +1 -1
  46. package/dist/index.umd.js +1 -1
  47. package/dist/index.umd.js.map +1 -1
  48. package/dist/types/index.d.ts +10 -10
  49. package/dist/types/index.d.ts.map +1 -1
  50. package/dist/utils/index.d.ts +1 -0
  51. package/dist/utils/index.d.ts.map +1 -1
  52. package/dist/utils/maskito.d.ts +7 -0
  53. package/dist/utils/maskito.d.ts.map +1 -0
  54. package/dist/vform.css +1 -1
  55. package/package.json +49 -3
package/dist/index.es.js CHANGED
@@ -1,7 +1,67 @@
1
- import { defineComponent as T, ref as M, computed as z, watch as A, createBlock as h, openBlock as c, unref as o, withCtx as p, createVNode as R, createCommentVNode as $, createElementBlock as q, Fragment as j, renderList as J, resolveDynamicComponent as ve, normalizeStyle as de, createTextVNode as L, toDisplayString as B, mergeModels as Y, useModel as N, onMounted as fe, normalizeClass as he, createElementVNode as ce } from "vue";
2
- import { IonGrid as ge, IonRow as ue, IonCol as ne, IonButton as G, IonInput as ee, IonLabel as F, IonText as Q, IonInputPasswordToggle as ye, IonSelect as be, IonSelectOption as Ve, IonIcon as K, IonChip as ke, IonList as xe, IonItem as _e, IonCheckbox as me, actionSheetController as we, alertController as Me, IonTextarea as Ie } from "@ionic/vue";
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
- const W = [
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 oe(l) {
19
- return l == null || Array.isArray(l) && !l.length || typeof l == "object" && !Object.keys(l).length || !l;
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 Ce(l, d = "DD/MMM/YYYY") {
22
- const u = new Date(l);
23
- if (isNaN(u.getTime()))
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 = H(u.getDate()), a = u.getMonth() + 1, t = u.getFullYear(), s = H(u.getHours()), i = H(u.getMinutes()), k = H(u.getSeconds()), C = u.getMilliseconds(), r = {
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: u.getDate().toString(),
28
- MMM: W[u.getMonth()].slice(0, 3),
29
- MMMM: W[u.getMonth()],
30
- MM: H(a),
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: t.toString(),
33
- YY: t.toString().slice(-2),
92
+ YYYY: n.toString(),
93
+ YY: n.toString().slice(-2),
34
94
  HH: s,
35
- H: u.getHours().toString(),
36
- mm: i,
37
- m: u.getMinutes().toString(),
38
- ss: k,
39
- s: u.getSeconds().toString(),
40
- SSS: H(C),
41
- S: C.toString().slice(0, 1)
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 d.replace(
104
+ return u.replace(
45
105
  /DD|D|MMMM|MMM|MM|M|YYYY|YY|HH|H|mm|m|ss|s|SSS|S/g,
46
- (n) => r[n] || n
106
+ (I) => b[I] || I
47
107
  );
48
108
  }
49
- function H(l) {
50
- return l < 10 ? `0${l}` : `${l}`;
109
+ function J(t) {
110
+ return t < 10 ? `0${t}` : `${t}`;
51
111
  }
52
- function ae(l, d) {
53
- if (Number.isInteger(parseInt(l)) && Number(l) > 0) {
54
- if (d === "MMMM") return W[Number(l) - 1];
55
- if (d === "MMM") return W[Number(l) - 1].slice(0, 3);
56
- if (d === "MM") return H(Number(l));
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 l;
118
+ return t;
59
119
  }
60
- function re(l, d, u) {
61
- return typeof l.condition == "function" ? l.condition(d, u) : !0;
120
+ function ce(t, u, l) {
121
+ return typeof t.condition == "function" ? t.condition(u, l) : !0;
62
122
  }
63
- function se(l) {
64
- if (typeof l != "object" || l === null)
65
- return l;
66
- if (Array.isArray(l))
67
- return l.map((u) => se(u));
68
- const d = {};
69
- return Object.entries(l).forEach(([u, e]) => {
70
- typeof e == "function" ? d[u] = e.bind(d) : d[u] = se(e);
71
- }), d;
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 pe(l, d) {
74
- return d.findIndex((u) => u.value === l.value || u.label === l.label || u.value === l.label || u.label === l.value);
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 P(l, d) {
77
- const u = pe(l, d);
78
- u >= 0 ? d[u].isChecked = !0 : d.push({ ...l, isChecked: !0 });
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 te(l, d) {
81
- const u = pe(l, d);
82
- u >= 0 && (d[u].isChecked = !1);
140
+ function oe(t, u) {
141
+ const l = ye(t, u);
142
+ l >= 0 && (u[l].isChecked = !1);
83
143
  }
84
- function Le(l, d) {
85
- return d ? l.filter(
86
- (u) => JSON.stringify(u).toLowerCase().includes(d.toLowerCase())
87
- ) : l;
144
+ function We(t, u) {
145
+ return u ? t.filter(
146
+ (l) => JSON.stringify(l).toLowerCase().includes(u.toLowerCase())
147
+ ) : t;
88
148
  }
89
- const De = /* @__PURE__ */ T({
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(l, { expose: d, emit: u }) {
105
- const e = l, a = u, t = M([]), s = M(e.schema), i = z(() => Object.entries(s.value).reduce((v, [f, y]) => (y.value !== void 0 && (typeof y.onChange == "function" ? v[f] = y.onChange(y.value) : v[f] = y.value), v), {})), k = z(() => Object.entries(i.value).reduce((v, [f, y]) => (y !== void 0 && (s.value[f].children !== void 0 && (v[f] = y.map(({ other: O }) => Object.entries(O).reduce((U, [b, _]) => (typeof s.value[f].children[b].computedValue == "function" ? U[b] = s.value[f].children[b].computedValue(_, s.value) : U[b] = _, U), {}))), typeof s.value[f].computedValue == "function" && y !== void 0 && (v[f] = s.value[f].computedValue(y, s.value))), v), {}));
106
- async function C() {
107
- const v = [];
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 r() {
113
- await C() && a("submit", i.value, k.value);
212
+ async function v() {
213
+ await I() && a("submit", g.value, b.value);
114
214
  }
115
- function n() {
116
- t.value.forEach((v) => {
117
- typeof (v == null ? void 0 : v.onReset) == "function" && v.onReset();
118
- });
215
+ function F() {
216
+ c();
119
217
  }
120
- function g() {
121
- n(), a("clear");
218
+ function k() {
219
+ F(), a("clear");
122
220
  }
123
- function x() {
124
- n(), a("cancel");
221
+ function O() {
222
+ F(), a("cancel");
125
223
  }
126
- return A(
127
- i,
224
+ return H(
225
+ g,
128
226
  async () => {
129
- for (const [v, f] of Object.entries(s.value))
130
- re(f, i.value, k.value) || (f.value = e.schema[v].value);
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
- ), A(() => e.schema, (v) => {
137
- for (const [f, y] of Object.entries(v))
138
- y.value !== void 0 && (s.value[f].value = y.value);
139
- }, {
140
- deep: !0,
141
- immediate: !0
142
- }), d({
143
- resetForm: n,
144
- isFormValid: C,
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: i.value,
147
- computedData: k.value
248
+ formData: g.value,
249
+ computedData: b.value
148
250
  })
149
- }), (v, f) => (c(), h(o(ge), null, {
251
+ }), (m, D) => (i(), h(o(Me), null, {
150
252
  default: p(() => [
151
- R(o(ue), null, {
253
+ R(o(re), null, {
152
254
  default: p(() => [
153
- (c(!0), q(j, null, J(Object.keys(s.value), (y) => {
154
- var O, U, b, _, V;
155
- return c(), q(j, null, [
156
- o(re)(s.value[y], i.value, k.value) ? (c(), h(o(ne), {
157
- key: y,
158
- size: ((O = s.value[y].grid) == null ? void 0 : O.xs) ?? "12",
159
- "size-sm": (U = s.value[y].grid) == null ? void 0 : U.sm,
160
- "size-md": (b = s.value[y].grid) == null ? void 0 : b.md,
161
- "size-lg": (_ = s.value[y].grid) == null ? void 0 : _.lg,
162
- "size-xl": (V = s.value[y].grid) == null ? void 0 : V.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
- (c(), h(ve(s.value[y].type), {
167
- modelValue: s.value[y],
168
- "onUpdate:modelValue": (D) => s.value[y] = D,
169
- schema: s.value,
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: t,
173
- "ref-key": y
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"])) : $("", !0)
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
- v.hideButtons ? $("", !0) : (c(), h(o(ue), { key: 0 }, {
285
+ m.hideButtons ? E("", !0) : (i(), h(o(re), { key: 0 }, {
184
286
  default: p(() => [
185
- R(o(ne), {
287
+ R(o(se), {
186
288
  size: "12",
187
- style: de([{ display: "flex" }, { justifyContent: v.buttonPlacement }])
289
+ style: fe([{ display: "flex" }, { justifyContent: m.buttonPlacement }])
188
290
  }, {
189
291
  default: p(() => [
190
- v.showCancelButton ? (c(), h(o(G), {
292
+ m.showCancelButton ? (i(), h(o(Z), {
191
293
  key: 0,
192
- onClick: x
294
+ onClick: O
193
295
  }, {
194
296
  default: p(() => [
195
- L(B(v.cancelButtonText ?? "Cancel"), 1)
297
+ $(z(m.cancelButtonText ?? "Cancel"), 1)
196
298
  ]),
197
299
  _: 1
198
- })) : $("", !0),
199
- v.showClearButton ? (c(), h(o(G), {
300
+ })) : E("", !0),
301
+ m.showClearButton ? (i(), h(o(Z), {
200
302
  key: 1,
201
- onClick: g
303
+ onClick: k
202
304
  }, {
203
305
  default: p(() => [
204
- L(B(v.clearButtonText ?? "Reset"), 1)
306
+ $(z(m.clearButtonText ?? "Reset"), 1)
205
307
  ]),
206
308
  _: 1
207
- })) : $("", !0),
208
- (c(!0), q(j, null, J(v.customButtons, (y) => (c(), h(o(G), {
209
- onClick: y.action
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
- L(B(y.label), 1)
316
+ $(z(d.label), 1)
213
317
  ]),
214
318
  _: 2
215
- }, 1032, ["onClick"]))), 256)),
216
- R(o(G), { onClick: r }, {
319
+ }, 1032, ["onClick", "color"]))), 128)),
320
+ R(o(Z), { onClick: v }, {
217
321
  default: p(() => [
218
- L(B(v.submitButtonText ?? "Submit"), 1)
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
- }), le = /* @__PURE__ */ T({
233
- __name: "BaseInput",
234
- props: /* @__PURE__ */ Y({
235
- schema: {},
236
- type: {}
237
- }, {
238
- modelValue: { type: Object, default: {} },
239
- modelModifiers: {}
240
- }),
241
- emits: ["update:modelValue"],
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
- async function k() {
259
- var r, n, g, x, v;
260
- (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");
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
- function C() {
263
- var r, n;
264
- (r = a.value) == null || r.$el.classList.remove("ion-touched"), (n = a.value) == null || n.$el.classList.remove("ion-invalid"), e.value.error = "";
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 d({
267
- onValueUpdate: k,
268
- onReset: s,
269
- getErrors: () => e.value.error
270
- }), (r, n) => (c(), h(o(ee), {
271
- ref_key: "inputRef",
272
- ref: a,
273
- modelValue: t.value,
274
- "onUpdate:modelValue": n[0] || (n[0] = (g) => t.value = g),
275
- "clear-input": !0,
276
- fill: e.value.fill ?? "outline",
277
- "label-placement": e.value.labelPlacement ?? "stacked",
278
- type: r.type ?? "text",
279
- required: e.value.required,
280
- "error-text": e.value.error,
281
- "auto-focus": e.value.autoFocus,
282
- placeholder: e.value.placeholder,
283
- disabled: e.value.disabled,
284
- counter: e.value.counter,
285
- min: e.value.min,
286
- max: e.value.max,
287
- "max-length": e.value.maxLength,
288
- "min-length": e.value.minLength,
289
- pattern: e.value.pattern,
290
- onIonFocus: C,
291
- onIonChange: k,
292
- onIonBlur: k
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
- e.value.label ? (c(), h(o(F), {
410
+ $(z(o(a)) + " ", 1),
411
+ o(e) ? (i(), h(o(we), {
296
412
  key: 0,
297
- slot: "label"
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
- L(B(e.value.suffix), 1)
329
- ]),
330
- _: 1
331
- })) : $("", !0),
332
- r.type === "password" ? (c(), h(o(ye), {
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
- }, 8, ["modelValue", "fill", "label-placement", "type", "required", "error-text", "auto-focus", "placeholder", "disabled", "counter", "min", "max", "max-length", "min-length", "pattern"]));
423
+ })) : E("", !0);
339
424
  }
340
- }), Se = /* @__PURE__ */ T({
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__ */ Y({
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(l, { expose: d }) {
350
- const u = l, e = N(l, "modelValue"), a = M(null);
351
- return d({
519
+ setup(t, { expose: u }) {
520
+ const l = Y(t, "modelValue"), e = x(null);
521
+ return u({
352
522
  onReset: () => {
353
- var t;
354
- return (t = a.value) == null ? void 0 : t.onReset();
523
+ var a;
524
+ return (a = e.value) == null ? void 0 : a.onReset();
355
525
  },
356
526
  onValueUpdate: () => {
357
- var t;
358
- return (t = a.value) == null ? void 0 : t.onValueUpdate();
527
+ var a;
528
+ return (a = e.value) == null ? void 0 : a.onValueUpdate();
359
529
  },
360
530
  getErrors: () => {
361
- var t;
362
- return (t = a.value) == null ? void 0 : t.getErrors();
531
+ var a;
532
+ return (a = e.value) == null ? void 0 : a.getErrors();
363
533
  }
364
- }), (t, s) => (c(), h(le, {
365
- modelValue: e.value,
366
- "onUpdate:modelValue": s[0] || (s[0] = (i) => e.value = i),
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: u.schema,
538
+ schema: a.schema,
369
539
  ref_key: "inputRef",
370
- ref: a
540
+ ref: e
371
541
  }, null, 8, ["modelValue", "schema"]));
372
542
  }
373
- }), Be = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' class='ionicon'><path d='M256 112v288M400 256H112' stroke-linecap='round' stroke-linejoin='round' class='ionicon-fill-none ionicon-stroke-width'/></svg>", Ee = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' class='ionicon'><path d='M480 128a64 64 0 0 0-64-64h-16V48.45c0-8.61-6.62-16-15.23-16.43A16 16 0 0 0 368 48v16H144V48.45c0-8.61-6.62-16-15.23-16.43A16 16 0 0 0 112 48v16H96a64 64 0 0 0-64 64v12a4 4 0 0 0 4 4h440a4 4 0 0 0 4-4ZM32 416a64 64 0 0 0 64 64h320a64 64 0 0 0 64-64V179a3 3 0 0 0-3-3H35a3 3 0 0 0-3 3Zm344-208a24 24 0 1 1-24 24 24 24 0 0 1 24-24m0 80a24 24 0 1 1-24 24 24 24 0 0 1 24-24m-80-80a24 24 0 1 1-24 24 24 24 0 0 1 24-24m0 80a24 24 0 1 1-24 24 24 24 0 0 1 24-24m0 80a24 24 0 1 1-24 24 24 24 0 0 1 24-24m-80-80a24 24 0 1 1-24 24 24 24 0 0 1 24-24m0 80a24 24 0 1 1-24 24 24 24 0 0 1 24-24m-80-80a24 24 0 1 1-24 24 24 24 0 0 1 24-24m0 80a24 24 0 1 1-24 24 24 24 0 0 1 24-24'/></svg>", Re = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' class='ionicon'><path d='m112 184 144 144 144-144' stroke-linecap='round' stroke-linejoin='round' stroke-width='48px' class='ionicon-fill-none'/></svg>", Ue = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' class='ionicon'><path d='m289.94 256 95-95A24 24 0 0 0 351 127l-95 95-95-95a24 24 0 0 0-34 34l95 95-95 95a24 24 0 1 0 34 34l95-95 95 95a24 24 0 0 0 34-34Z'/></svg>", qe = "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512' class='ionicon'><path d='M400 256H112' stroke-linecap='round' stroke-linejoin='round' class='ionicon-fill-none ionicon-stroke-width'/></svg>", Oe = /* @__PURE__ */ T({
543
+ }), tt = /* @__PURE__ */ q({
374
544
  __name: "DateInput",
375
- props: /* @__PURE__ */ Y({
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(l, { expose: d }) {
383
- const u = l, e = N(l, "modelValue"), a = M(null), t = M(e.value.max), s = M(e.value.max), i = M(e.value.value), k = z(() => {
384
- if (e.value.pattern) return e.value.pattern;
385
- let b = e.value.pattern ?? "DD/MMM/YYYY";
386
- return e.value.enableTime && (b += " HH:mm:ss"), b;
387
- }), C = /[-/.,:\s]+/, r = z(() => k.value.split(C)), n = z(() => k.value.match(/[-/.,:\s]+/g) || []), g = M({});
388
- A(() => e.value.value, (b) => {
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
- async function v() {
409
- var b, _, V, D, S;
410
- (b = a.value) == null || b.$el.classList.remove("ion-invalid"), (_ = a.value) == null || _.$el.classList.remove("ion-valid"), await x() ? (e.value.error = "", e.value.value = i.value, (V = a.value) == null || V.$el.classList.add("ion-valid")) : (D = a.value) == null || D.$el.classList.add("ion-invalid"), (S = a.value) == null || S.$el.classList.add("ion-touched");
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
- function f() {
413
- var b, _;
414
- (b = a.value) == null || b.$el.classList.remove("ion-touched"), (_ = a.value) == null || _.$el.classList.remove("ion-invalid"), e.value.error = "";
415
- }
416
- async function y(b, _, V) {
417
- let D = _ ?? (V == null ? void 0 : V.target).value;
418
- /MM|MMM|MMMM/.test(b) && (D = ae(D, b)), Number.isInteger(parseInt(D)) && (D = H(parseInt(D))), g.value[b] = D;
419
- const S = r.value.reduce((m, I, w) => (m += g.value[I] + (w < r.value.length - 1 ? n.value[w] : ""), m), "");
420
- i.value = S, await v();
421
- }
422
- async function O(b) {
423
- const _ = Ce(b, k.value).split(C);
424
- r.value.forEach((V, D) => y(V, _[D])), await v();
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 U() {
427
- i.value = "", e.value.error = "", e.value.value = "";
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 d({
430
- onValueUpdate: v,
431
- onReset: U,
432
- getErrors: () => e.value.error
433
- }), fe(() => {
434
- r.value.forEach((b, _) => {
435
- var V;
436
- g.value[b] = ((V = i.value) == null ? void 0 : V.split(C)[_]) ?? "";
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
- }), (b, _) => (c(), h(o(ee), {
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
- "auto-focus": e.value.autoFocus,
609
+ autofocus: e.value.autoFocus,
448
610
  disabled: e.value.disabled,
449
- onIonFocus: f,
450
- onIonBlur: v
611
+ onIonFocus: o(I),
612
+ onIonBlur: o(b)
451
613
  }, {
452
614
  default: p(() => [
453
- e.value.label ? (c(), h(o(F), {
454
- key: 0,
455
- slot: "label"
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: de({ minWidth: e.value.enableTime ? "10%" : "30%" }),
478
- placeholder: V,
479
- value: g.value[V],
480
- onIonFocus: f,
481
- onIonInput: (S) => y(V, void 0, S),
482
- onIonBlur: (S) => y(V, void 0, S)
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
- (c(!0), q(j, null, J(o(W), (S, m) => (c(), h(o(Ve), {
486
- key: S,
487
- value: o(ae)(m + 1, V)
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
- L(B(o(ae)(m + 1, V)), 1)
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"])) : (c(), h(o(ee), {
497
- key: 1,
640
+ }, 1032, ["style", "placeholder", "value", "onIonFocus", "onIonInput", "onIonBlur"])) : (i(), h(o(le), {
498
641
  slot: "start",
499
- placeholder: V,
500
- "auto-focus": e.value.autoFocus,
501
- value: g.value[V],
502
- onIonFocus: f,
503
- onIonInput: (S) => y(V, void 0, S),
504
- onIonBlur: (S) => y(V, void 0, S)
505
- }, null, 8, ["placeholder", "auto-focus", "value", "onIonInput", "onIonBlur"])),
506
- D < r.value.length - 1 ? (c(), h(o(F), {
507
- key: 2,
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
- L("  " + B(n.value[D]) + "       ", 1)
655
+ $("  " + z(D.value[C]) + "       ", 1)
512
656
  ]),
513
657
  _: 2
514
- }, 1024)) : $("", !0)
658
+ }, 1024)) : E("", !0)
515
659
  ], 64))), 256)),
516
- R(o(F), { slot: "end" }, {
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": i.value,
666
+ "model-value": r.value,
523
667
  "auto-apply": !e.value.enableTime,
524
668
  "enable-time-picker": e.value.enableTime ?? !1,
525
- maxDate: t.value,
669
+ maxDate: n.value,
526
670
  minDate: s.value,
527
- onDateUpdate: O
671
+ onDateUpdate: j
528
672
  }, {
529
673
  trigger: p(() => [
530
- R(o(G), { fill: "clear" }, {
674
+ R(o(Z), { fill: "clear" }, {
531
675
  default: p(() => [
532
- R(o(K), {
676
+ R(o(Q), {
533
677
  slot: "icon-only",
534
- icon: o(Ee),
678
+ icon: o(Ue),
535
679
  "aria-hidden": "true",
536
- onClick: f
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", "auto-focus", "disabled"]));
693
+ }, 8, ["fill", "label-placement", "required", "error-text", "autofocus", "disabled", "onIonFocus", "onIonBlur"]));
550
694
  }
551
- }), Fe = /* @__PURE__ */ T({
695
+ }), lt = /* @__PURE__ */ q({
552
696
  __name: "NumberInput",
553
- props: /* @__PURE__ */ Y({
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(l, { expose: d }) {
561
- const u = l, e = N(l, "modelValue"), a = M(null);
562
- return d({
704
+ setup(t, { expose: u }) {
705
+ const l = Y(t, "modelValue"), e = x(null);
706
+ return u({
563
707
  onReset: () => {
564
- var t;
565
- return (t = a.value) == null ? void 0 : t.onReset();
708
+ var a;
709
+ return (a = e.value) == null ? void 0 : a.onReset();
566
710
  },
567
711
  onValueUpdate: () => {
568
- var t;
569
- return (t = a.value) == null ? void 0 : t.onValueUpdate();
712
+ var a;
713
+ return (a = e.value) == null ? void 0 : a.onValueUpdate();
570
714
  },
571
715
  getErrors: () => {
572
- var t;
573
- return (t = a.value) == null ? void 0 : t.getErrors();
716
+ var a;
717
+ return (a = e.value) == null ? void 0 : a.getErrors();
574
718
  }
575
- }), (t, s) => (c(), h(le, {
576
- modelValue: e.value,
577
- "onUpdate:modelValue": s[0] || (s[0] = (i) => e.value = i),
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: u.schema,
723
+ schema: a.schema,
580
724
  ref_key: "inputRef",
581
- ref: a
725
+ ref: e
582
726
  }, null, 8, ["modelValue", "schema"]));
583
727
  }
584
- }), je = /* @__PURE__ */ T({
728
+ }), at = /* @__PURE__ */ q({
585
729
  __name: "EmailInput",
586
- props: /* @__PURE__ */ Y({
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(l, { expose: d }) {
594
- const u = l, e = N(l, "modelValue"), a = M(null);
595
- return d({
737
+ setup(t, { expose: u }) {
738
+ const l = Y(t, "modelValue"), e = x(null);
739
+ return u({
596
740
  onReset: () => {
597
- var t;
598
- return (t = a.value) == null ? void 0 : t.onReset();
741
+ var a;
742
+ return (a = e.value) == null ? void 0 : a.onReset();
599
743
  },
600
744
  onValueUpdate: () => {
601
- var t;
602
- return (t = a.value) == null ? void 0 : t.onValueUpdate();
745
+ var a;
746
+ return (a = e.value) == null ? void 0 : a.onValueUpdate();
603
747
  },
604
748
  getErrors: () => {
605
- var t;
606
- return (t = a.value) == null ? void 0 : t.getErrors();
749
+ var a;
750
+ return (a = e.value) == null ? void 0 : a.getErrors();
607
751
  }
608
- }), (t, s) => (c(), h(le, {
609
- modelValue: e.value,
610
- "onUpdate:modelValue": s[0] || (s[0] = (i) => e.value = i),
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: u.schema,
756
+ schema: a.schema,
613
757
  ref_key: "inputRef",
614
- ref: a
758
+ ref: e
615
759
  }, null, 8, ["modelValue", "schema"]));
616
760
  }
617
- }), Te = /* @__PURE__ */ T({
761
+ }), nt = /* @__PURE__ */ q({
618
762
  __name: "PasswordInput",
619
- props: /* @__PURE__ */ Y({
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(l, { expose: d }) {
627
- const u = l, e = N(l, "modelValue"), a = M(null);
628
- return d({
770
+ setup(t, { expose: u }) {
771
+ const l = Y(t, "modelValue"), e = x(null);
772
+ return u({
629
773
  onReset: () => {
630
- var t;
631
- return (t = a.value) == null ? void 0 : t.onReset();
774
+ var a;
775
+ return (a = e.value) == null ? void 0 : a.onReset();
632
776
  },
633
777
  onValueUpdate: () => {
634
- var t;
635
- return (t = a.value) == null ? void 0 : t.onValueUpdate();
778
+ var a;
779
+ return (a = e.value) == null ? void 0 : a.onValueUpdate();
636
780
  },
637
781
  getErrors: () => {
638
- var t;
639
- return (t = a.value) == null ? void 0 : t.getErrors();
782
+ var a;
783
+ return (a = e.value) == null ? void 0 : a.getErrors();
640
784
  }
641
- }), (t, s) => (c(), h(le, {
642
- modelValue: e.value,
643
- "onUpdate:modelValue": s[0] || (s[0] = (i) => e.value = i),
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: u.schema,
789
+ schema: a.schema,
646
790
  ref_key: "inputRef",
647
- ref: a
791
+ ref: e
648
792
  }, null, 8, ["modelValue", "schema"]));
649
793
  }
650
- }), ze = /* @__PURE__ */ T({
794
+ }), ut = /* @__PURE__ */ q({
651
795
  __name: "SelectInput",
652
- props: /* @__PURE__ */ Y({
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(l, { expose: d }) {
661
- const u = l, e = N(l, "modelValue"), a = M(null), t = M(null), s = M(!1), i = M([]), k = M(""), C = M(1), r = z(() => e.value.interface ?? "popover"), n = z(() => e.value.optionsPlacement === "top" ? "top" : "bottom"), g = z(
662
- () => i.value.filter((m) => !!m.isChecked)
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
- }), A(() => e.value.value, S, { immediate: !0, deep: !0 });
668
- function v() {
669
- i.value.forEach((m) => te(m, i.value)), e.value.error = "", k.value = "", C.value = 1, e.value.value = e.value.multiple ? [] : "";
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(m) {
672
- if (m.isChecked) return te(m, i.value);
673
- e.value.multiple ? P(m, i.value) : (v(), P(m, i.value), V()), k.value = "";
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 y() {
676
- switch (r.value) {
817
+ function m() {
818
+ switch (b.value) {
677
819
  case "action-sheet":
678
- O();
820
+ D();
679
821
  break;
680
822
  case "alert":
681
- U();
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 O() {
690
- if (await D(), e.value.multiple) {
831
+ async function D() {
832
+ if (await B(), e.value.multiple) {
691
833
  s.value = !0;
692
834
  return;
693
835
  }
694
- await (await we.create({
836
+ await (await Be.create({
695
837
  header: e.value.label || "Select an option",
696
838
  buttons: [
697
- ...i.value.map((I) => ({
698
- text: I.label,
699
- cssClass: I.isChecked ? "selected-option" : "",
700
- handler: () => (f(I), !1)
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 U() {
710
- await D();
711
- const m = i.value.map((w) => ({
712
- label: w.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: w,
715
- checked: w.isChecked
856
+ value: M,
857
+ checked: M.isChecked
716
858
  }));
717
- await (await Me.create({
859
+ await (await Oe.create({
718
860
  header: e.value.label || "Select an option",
719
- inputs: m,
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: (w) => {
869
+ handler: (M) => {
728
870
  if (e.value.multiple)
729
- i.value.forEach((E) => te(E, i.value)), w.forEach((E) => {
730
- const Z = i.value.find((X) => X.value === E.value);
731
- Z && P(Z, i.value);
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
- v();
735
- const E = i.value.find((Z) => Z.value === w.value);
736
- E && P(E, i.value);
876
+ k();
877
+ const N = r.value.find((te) => te.value === M.value);
878
+ N && G(N, r.value);
737
879
  }
738
- V();
880
+ C();
739
881
  }
740
882
  }
741
883
  ]
742
884
  })).present();
743
885
  }
744
- function b(m) {
745
- var I, w, E;
746
- m.target === ((I = a.value) == null ? void 0 : I.$el) && ((w = a.value) == null || w.$el.classList.remove("ion-touched"), (E = a.value) == null || E.$el.classList.remove("ion-invalid"), e.value.error = "", r.value === "popover" && (s.value = !0));
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 m = await e.value.validation(g.value, u == null ? void 0 : u.schema);
753
- if (m && m.length)
754
- return e.value.error = m.join(), !1;
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
- async function V(m) {
759
- var I, w, E, Z, X, ie;
760
- (I = m == null ? void 0 : m.relatedTarget) != null && I.closest(".suggestions-list") || (s.value = !1, (w = a.value) == null || w.$el.classList.remove("ion-invalid"), (E = a.value) == null || E.$el.classList.remove("ion-valid"), await _() ? (e.value.error = "", e.value.value = e.value.multiple ? g.value : g.value[0], (Z = a.value) == null || Z.$el.classList.add("ion-valid")) : (X = a.value) == null || X.$el.classList.add("ion-invalid"), (ie = a.value) == null || ie.$el.classList.add("ion-touched"));
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
- async function D() {
763
- const m = [];
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 I = await e.value.options(k.value);
766
- m.push(...I.filter((w) => !!w.label));
920
+ const _ = await e.value.options(c.value);
921
+ f.push(..._.filter((M) => !!M.label));
767
922
  } else
768
- m.push(...Le(e.value.options ?? [], k.value));
769
- g.value.forEach((I) => P(I, m)), i.value = m;
923
+ f.push(...We(e.value.options ?? [], c.value));
924
+ v.value.forEach((_) => G(_, f)), r.value = f;
770
925
  }
771
- function S() {
772
- const m = e.value.value;
773
- m && (Array.isArray(m) ? m.forEach((I) => P(I, i.value)) : P(typeof m == "object" ? m : {
774
- value: m,
775
- label: m
776
- }, i.value));
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 d({
779
- onValueUpdate: V,
780
- onReset: v,
781
- getErrors: () => e.value.error
782
- }), (m, I) => (c(), q("div", {
933
+ return u({
934
+ onValueUpdate: C,
935
+ onReset: k,
936
+ getErrors: S
937
+ }), (f, _) => (i(), U("div", {
783
938
  class: "autocomplete-container",
784
- onFocusout: V,
939
+ onFocusout: C,
785
940
  ref_key: "containerRef",
786
- ref: t
941
+ ref: n
787
942
  }, [
788
- R(o(ee), {
943
+ R(o(le), {
789
944
  ref_key: "inputRef",
790
945
  ref: a,
791
- modelValue: k.value,
792
- "onUpdate:modelValue": I[0] || (I[0] = (w) => k.value = w),
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: m.type ?? "text",
950
+ type: f.type ?? "text",
796
951
  required: e.value.required,
797
952
  "error-text": e.value.error,
798
- "auto-focus": e.value.autoFocus,
799
- placeholder: x.value,
953
+ autofocus: e.value.autoFocus,
954
+ placeholder: F.value,
800
955
  disabled: e.value.disabled,
801
956
  counter: e.value.counter,
802
- onIonFocus: b,
957
+ onIonFocus: y,
803
958
  debounce: 300,
804
- onClick: y
959
+ onClick: m
805
960
  }, {
806
961
  default: p(() => [
807
- e.value.label ? (c(), h(o(F), {
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
- (c(!0), q(j, null, J(g.value, (w, E) => (c(), h(o(ke), { key: E }, {
969
+ (i(!0), U(A, null, W(v.value, (M, N) => (i(), h(o(Se), { key: N }, {
833
970
  default: p(() => [
834
- R(o(F), null, {
971
+ R(o(P), null, {
835
972
  default: p(() => [
836
- L(B(w.label), 1)
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
- })) : (c(), h(o(F), {
846
- key: 2,
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 w;
988
+ var M;
852
989
  return [
853
- L(B(((w = g.value[0]) == null ? void 0 : w.label) ?? ""), 1)
990
+ $(z(((M = v.value[0]) == null ? void 0 : M.label) ?? ""), 1)
854
991
  ];
855
992
  }),
856
993
  _: 1
857
994
  })),
858
- R(o(K), {
995
+ R(o(Q), {
859
996
  slot: "end",
860
- icon: o(Re)
997
+ icon: o(ze)
861
998
  }, null, 8, ["icon"]),
862
- g.value.length > 0 || k.value ? (c(), h(o(K), {
863
- key: 3,
999
+ v.value.length > 0 || c.value ? (i(), h(o(Q), {
1000
+ key: 2,
864
1001
  slot: "end",
865
- icon: o(Ue),
866
- onClick: v,
1002
+ icon: o(qe),
1003
+ onClick: k,
867
1004
  style: { "z-index": "999999" }
868
- }, null, 8, ["icon"])) : $("", !0)
1005
+ }, null, 8, ["icon"])) : E("", !0)
869
1006
  ]),
870
1007
  _: 1
871
- }, 8, ["modelValue", "fill", "label-placement", "type", "required", "error-text", "auto-focus", "placeholder", "disabled", "counter"]),
872
- s.value && i.value.length > 0 && r.value === "popover" ? (c(), h(o(xe), {
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: he(["suggestions-list", n.value])
1011
+ class: Ie(["suggestions-list", I.value])
875
1012
  }, {
876
1013
  default: p(() => [
877
- (c(!0), q(j, null, J(i.value, (w) => (c(), h(o(_e), {
1014
+ (i(!0), U(A, null, W(r.value, (M) => (i(), h(o(Ee), {
878
1015
  button: "",
879
- key: w.label,
880
- onClick: (E) => f(w)
1016
+ key: M.label,
1017
+ onClick: (N) => O(M)
881
1018
  }, {
882
1019
  default: p(() => [
883
- e.value.multiple ? (c(), h(o(me), {
1020
+ e.value.multiple ? (i(), h(o(he), {
884
1021
  key: 0,
885
1022
  slot: "start",
886
- checked: w.isChecked
887
- }, null, 8, ["checked"])) : $("", !0),
888
- R(o(F), null, {
1023
+ checked: M.isChecked
1024
+ }, null, 8, ["checked"])) : E("", !0),
1025
+ R(o(P), null, {
889
1026
  default: p(() => [
890
- L(B(w.label), 1)
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"])) : $("", !0)
1036
+ }, 8, ["class"])) : E("", !0)
900
1037
  ], 544));
901
1038
  }
902
- }), Ye = (l, d) => {
903
- const u = l.__vccOpts || l;
904
- for (const [e, a] of d)
905
- u[e] = a;
906
- return u;
907
- }, Ne = /* @__PURE__ */ Ye(ze, [["__scopeId", "data-v-6c4b4a28"]]), Ae = /* @__PURE__ */ T({
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__ */ Y({
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(l, { expose: d }) {
917
- const u = l, e = N(l, "modelValue"), a = M(null), t = M(e.value.value);
918
- A(() => e.value.value, (r) => t.value = r);
919
- function s() {
920
- var r, n;
921
- (r = a.value) == null || r.$el.classList.remove("ion-touched"), (n = a.value) == null || n.$el.classList.remove("ion-invalid"), e.value.error = "";
922
- }
923
- function i() {
924
- t.value = "", e.value.error = "", e.value.value = "";
925
- }
926
- async function k() {
927
- if (e.value.required && !t.value)
928
- return e.value.error = "This field is required", !1;
929
- if (typeof e.value.validation == "function") {
930
- const r = await e.value.validation(t.value, u.schema);
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: t.value,
948
- "onUpdate:modelValue": n[0] || (n[0] = (g) => t.value = g),
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
- "auto-focus": e.value.autoFocus,
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: s,
967
- onIonChange: C,
968
- onIonBlur: C
1089
+ onIonFocus: o(c),
1090
+ onIonChange: o(r),
1091
+ onIonBlur: o(r)
969
1092
  }, {
970
1093
  default: p(() => [
971
- e.value.label ? (c(), h(o(F), {
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", "auto-focus", "placeholder", "disabled", "counter", "min", "max", "rows", "cols", "auto-grow", "max-length", "min-length", "pattern"]));
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
- }), Pe = { style: { display: "flex", "justify-content": "space-between", "align-items": "baseline" } }, He = {
1099
+ }), st = {
995
1100
  class: "ion-margin-end",
996
1101
  style: { "flex-grow": "1" }
997
- }, Je = { style: { display: "flex", "justify-content": "flex-end" } }, Ze = /* @__PURE__ */ T({
1102
+ }, it = { style: { display: "flex", "justify-content": "flex-end" } }, ct = /* @__PURE__ */ q({
998
1103
  __name: "RepeatInput",
999
- props: /* @__PURE__ */ Y({
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(l, { expose: d }) {
1009
- const u = N(l, "modelValue"), e = M([]), a = M([]), t = z(() => e.value.map((n, g) => ({
1010
- label: `Set ${g + 1}`,
1011
- value: g,
1012
- other: Object.entries(n).reduce((x, [v, f]) => (x[v] = f.value, x), {})
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
- A(t, (n) => {
1015
- u.value.value = n;
1016
- }, { deep: !0, immediate: !0 }), fe(s);
1017
- function s() {
1018
- u.value.children && e.value.push(se(u.value.children));
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 i(n) {
1021
- e.value.splice(n, 1);
1132
+ function b(k) {
1133
+ e.value.splice(k, 1);
1022
1134
  }
1023
- function k() {
1024
- a.value.forEach((n) => {
1025
- typeof (n == null ? void 0 : n.onReset) == "function" && n.onReset();
1026
- });
1135
+ function I() {
1136
+ n();
1027
1137
  }
1028
- function C() {
1029
- const n = [];
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 r() {
1035
- for (const n of a.value)
1036
- typeof (n == null ? void 0 : n.onValueUpdate) == "function" && await n.onValueUpdate();
1141
+ async function F() {
1142
+ await r();
1037
1143
  }
1038
- return d({
1039
- onValueUpdate: r,
1040
- onReset: k,
1041
- getErrors: C
1042
- }), (n, g) => (c(!0), q(j, null, J(e.value, (x, v) => (c(), q("div", Pe, [
1043
- ce("div", He, [
1044
- R(o(ue), null, {
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
- (c(!0), q(j, null, J(Object.keys(x), (f) => {
1047
- var y, O, U, b, _;
1048
- return c(), q(j, null, [
1049
- o(re)(x[f], n.data, n.computedData) ? (c(), h(o(ne), {
1050
- key: `${v}-${f}`,
1051
- size: ((y = x[f].grid) == null ? void 0 : y.xs) ?? "12",
1052
- "size-sm": (O = x[f].grid) == null ? void 0 : O.sm,
1053
- "size-md": (U = x[f].grid) == null ? void 0 : U.md,
1054
- "size-lg": (b = x[f].grid) == null ? void 0 : b.lg,
1055
- "size-xl": (_ = x[f].grid) == null ? void 0 : _.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
- (c(), h(ve(x[f].type), {
1060
- modelValue: x[f],
1061
- "onUpdate:modelValue": (V) => x[f] = V,
1062
- schema: x,
1063
- "ref-key": `${v}-${f}`,
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"])) : $("", !0)
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
- ce("div", Je, [
1078
- v === e.value.length - 1 ? (c(), h(o(G), {
1186
+ ve("div", it, [
1187
+ D === e.value.length - 1 ? (i(), h(o(Z), {
1079
1188
  key: 0,
1080
- onClick: s,
1189
+ onClick: g,
1081
1190
  color: "primary"
1082
1191
  }, {
1083
1192
  default: p(() => [
1084
- R(o(K), {
1193
+ R(o(Q), {
1085
1194
  slot: "icon-only",
1086
- icon: o(Be)
1195
+ icon: o(Ae)
1087
1196
  }, null, 8, ["icon"])
1088
1197
  ]),
1089
1198
  _: 1
1090
- })) : $("", !0),
1091
- e.value.length > 1 ? (c(), h(o(G), {
1199
+ })) : E("", !0),
1200
+ e.value.length > 1 ? (i(), h(o(Z), {
1092
1201
  key: 1,
1093
- onClick: (f) => i(v),
1202
+ onClick: (d) => b(D),
1094
1203
  color: "warning"
1095
1204
  }, {
1096
1205
  default: p(() => [
1097
- R(o(K), {
1206
+ R(o(Q), {
1098
1207
  slot: "icon-only",
1099
- icon: o(qe)
1208
+ icon: o(je)
1100
1209
  }, null, 8, ["icon"])
1101
1210
  ]),
1102
1211
  _: 2
1103
- }, 1032, ["onClick"])) : $("", !0)
1212
+ }, 1032, ["onClick"])) : E("", !0)
1104
1213
  ])
1105
- ]))), 256));
1214
+ ]))), 128));
1106
1215
  }
1107
- }), Ge = /* @__PURE__ */ T({
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__ */ Y({
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(l, { expose: d }) {
1117
- const u = l, e = N(l, "modelValue"), a = M(null), t = M(e.value.value);
1118
- A(() => e.value.value, (r) => t.value = r);
1119
- function s() {
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
- function C() {
1137
- var r, n;
1138
- (r = a.value) == null || r.$el.classList.remove("ion-touched"), (n = a.value) == null || n.$el.classList.remove("ion-invalid"), e.value.error = "";
1139
- }
1140
- return d({
1141
- onValueUpdate: k,
1142
- onReset: s,
1143
- getErrors: () => e.value.error
1144
- }), (r, n) => (c(), h(o(me), {
1145
- modelValue: t.value,
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: C,
1153
- onIonChange: k,
1154
- onIonBlur: k
1254
+ onIonFocus: o(g),
1255
+ onIonChange: o(c),
1256
+ onIonBlur: o(c)
1155
1257
  }, {
1156
1258
  default: p(() => [
1157
- L(B(e.value.label) + " ", 1),
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
- }), Xe = {
1173
- install(l) {
1174
- l.component("VForm", De), l.component("TextInput", Se), l.component("DateInput", Oe), l.component("NumberInput", Fe), l.component("EmailInput", je), l.component("PasswordInput", Te), l.component("SelectInput", Ne), l.component("TextAreaInput", Ae), l.component("RepeatInput", Ze), l.component("CheckboxInput", Ge);
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
- Xe as VForm,
1179
- Xe as default
1270
+ bt as VForm,
1271
+ bt as default
1180
1272
  };
1181
1273
  //# sourceMappingURL=index.es.js.map