@stonecrop/aform 0.2.11 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/aform.js DELETED
@@ -1,869 +0,0 @@
1
- import { defineComponent as D, mergeModels as se, useModel as ae, openBlock as f, createElementBlock as h, createElementVNode as i, withDirectives as C, vModelCheckbox as be, toDisplayString as k, vShow as O, resolveComponent as we, createBlock as H, withCtx as Ce, onMounted as re, onBeforeUnmount as ke, ref as y, watch as F, unref as S, getCurrentScope as De, onScopeDispose as Ee, inject as ie, nextTick as Ae, computed as L, Fragment as V, renderList as x, normalizeStyle as Ie, withModifiers as Me, normalizeClass as B, createCommentVNode as ue, withKeys as P, vModelText as R, resolveDynamicComponent as Te, mergeProps as _e, createTextVNode as Se, renderSlot as Oe, createVNode as $e, resolveDirective as Le } from "vue";
2
- const Ve = { id: "checkbox-container" }, xe = ["id", "readonly", "required"], Be = { id: "custom-checkbox" }, Pe = ["for"], qe = ["innerHTML"], He = /* @__PURE__ */ D({
3
- __name: "ACheckbox",
4
- props: /* @__PURE__ */ se({
5
- label: {},
6
- required: { type: Boolean },
7
- readOnly: { type: Boolean },
8
- uuid: {},
9
- validation: { default: () => ({ errorMessage: " " }) }
10
- }, {
11
- modelValue: {},
12
- modelModifiers: {}
13
- }),
14
- emits: ["update:modelValue"],
15
- setup(e) {
16
- const t = ae(e, "modelValue");
17
- return (n, o) => (f(), h("div", null, [
18
- i("label", Ve, [
19
- C(i("input", {
20
- "onUpdate:modelValue": o[0] || (o[0] = (l) => t.value = l),
21
- type: "checkbox",
22
- id: n.uuid,
23
- class: "checkbox",
24
- readonly: n.readOnly,
25
- required: n.required
26
- }, null, 8, xe), [
27
- [be, t.value]
28
- ]),
29
- i("span", Be, k(t.value), 1)
30
- ]),
31
- i("label", {
32
- for: n.uuid,
33
- id: "checkbox-label"
34
- }, k(n.label), 9, Pe),
35
- C(i("p", {
36
- innerHTML: n.validation.errorMessage
37
- }, null, 8, qe), [
38
- [O, n.validation.errorMessage]
39
- ])
40
- ]));
41
- }
42
- }), M = (e, t) => {
43
- const n = e.__vccOpts || e;
44
- for (const [o, l] of t)
45
- n[o] = l;
46
- return n;
47
- }, Fe = /* @__PURE__ */ M(He, [["__scopeId", "data-v-5093f1cb"]]), Re = /* @__PURE__ */ i("div", null, [
48
- /* @__PURE__ */ i("input", { type: "text" }),
49
- /* @__PURE__ */ i("input", { type: "text" }),
50
- /* @__PURE__ */ i("input", { type: "text" })
51
- ], -1), Ue = /* @__PURE__ */ D({
52
- __name: "AComboBox",
53
- props: ["event", "cellData", "tableID"],
54
- setup(e) {
55
- return (t, n) => {
56
- const o = we("ATableModal");
57
- return f(), H(o, {
58
- event: e.event,
59
- cellData: e.cellData,
60
- class: "amodal"
61
- }, {
62
- default: Ce(() => [
63
- Re
64
- ]),
65
- _: 1
66
- }, 8, ["event", "cellData"]);
67
- };
68
- }
69
- });
70
- var W;
71
- const de = typeof window < "u", Qe = (e) => typeof e == "string", Ye = () => {
72
- };
73
- de && (W = window == null ? void 0 : window.navigator) != null && W.userAgent && /iP(ad|hone|od)/.test(window.navigator.userAgent);
74
- function ce(e) {
75
- return typeof e == "function" ? e() : S(e);
76
- }
77
- function je(e) {
78
- return e;
79
- }
80
- function We(e) {
81
- return De() ? (Ee(e), !0) : !1;
82
- }
83
- function q(e) {
84
- var t;
85
- const n = ce(e);
86
- return (t = n == null ? void 0 : n.$el) != null ? t : n;
87
- }
88
- const pe = de ? window : void 0;
89
- function Ne(...e) {
90
- let t, n, o, l;
91
- if (Qe(e[0]) || Array.isArray(e[0]) ? ([n, o, l] = e, t = pe) : [t, n, o, l] = e, !t)
92
- return Ye;
93
- Array.isArray(n) || (n = [n]), Array.isArray(o) || (o = [o]);
94
- const s = [], a = () => {
95
- s.forEach((d) => d()), s.length = 0;
96
- }, r = (d, g, b, m) => (d.addEventListener(g, b, m), () => d.removeEventListener(g, b, m)), p = F(() => [q(t), ce(l)], ([d, g]) => {
97
- a(), d && s.push(...n.flatMap((b) => o.map((m) => r(d, b, m, g))));
98
- }, { immediate: !0, flush: "post" }), u = () => {
99
- p(), a();
100
- };
101
- return We(u), u;
102
- }
103
- const N = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, z = "__vueuse_ssr_handlers__";
104
- N[z] = N[z] || {};
105
- function ze(e, { window: t = pe, scrollTarget: n } = {}) {
106
- const o = y(!1), l = () => {
107
- if (!t)
108
- return;
109
- const s = t.document, a = q(e);
110
- if (!a)
111
- o.value = !1;
112
- else {
113
- const r = a.getBoundingClientRect();
114
- o.value = r.top <= (t.innerHeight || s.documentElement.clientHeight) && r.left <= (t.innerWidth || s.documentElement.clientWidth) && r.bottom >= 0 && r.right >= 0;
115
- }
116
- };
117
- return F(() => q(e), () => l(), { immediate: !0, flush: "post" }), t && Ne(n || t, "scroll", l, {
118
- capture: !1,
119
- passive: !0
120
- }), o;
121
- }
122
- var G;
123
- (function(e) {
124
- e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
125
- })(G || (G = {}));
126
- var Ge = Object.defineProperty, K = Object.getOwnPropertySymbols, Ke = Object.prototype.hasOwnProperty, Je = Object.prototype.propertyIsEnumerable, J = (e, t, n) => t in e ? Ge(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, Xe = (e, t) => {
127
- for (var n in t || (t = {}))
128
- Ke.call(t, n) && J(e, n, t[n]);
129
- if (K)
130
- for (var n of K(t))
131
- Je.call(t, n) && J(e, n, t[n]);
132
- return e;
133
- };
134
- const Ze = {
135
- easeInSine: [0.12, 0, 0.39, 0],
136
- easeOutSine: [0.61, 1, 0.88, 1],
137
- easeInOutSine: [0.37, 0, 0.63, 1],
138
- easeInQuad: [0.11, 0, 0.5, 0],
139
- easeOutQuad: [0.5, 1, 0.89, 1],
140
- easeInOutQuad: [0.45, 0, 0.55, 1],
141
- easeInCubic: [0.32, 0, 0.67, 0],
142
- easeOutCubic: [0.33, 1, 0.68, 1],
143
- easeInOutCubic: [0.65, 0, 0.35, 1],
144
- easeInQuart: [0.5, 0, 0.75, 0],
145
- easeOutQuart: [0.25, 1, 0.5, 1],
146
- easeInOutQuart: [0.76, 0, 0.24, 1],
147
- easeInQuint: [0.64, 0, 0.78, 0],
148
- easeOutQuint: [0.22, 1, 0.36, 1],
149
- easeInOutQuint: [0.83, 0, 0.17, 1],
150
- easeInExpo: [0.7, 0, 0.84, 0],
151
- easeOutExpo: [0.16, 1, 0.3, 1],
152
- easeInOutExpo: [0.87, 0, 0.13, 1],
153
- easeInCirc: [0.55, 0, 1, 0.45],
154
- easeOutCirc: [0, 0.55, 0.45, 1],
155
- easeInOutCirc: [0.85, 0, 0.15, 1],
156
- easeInBack: [0.36, 0, 0.66, -0.56],
157
- easeOutBack: [0.34, 1.56, 0.64, 1],
158
- easeInOutBack: [0.68, -0.6, 0.32, 1.6]
159
- };
160
- Xe({
161
- linear: je
162
- }, Ze);
163
- const E = (e) => {
164
- let t = ze(e).value;
165
- return t = t && e.offsetHeight > 0, t;
166
- }, A = (e) => e.tabIndex >= 0, X = (e) => {
167
- const t = e.target;
168
- return U(t);
169
- }, U = (e) => {
170
- var t;
171
- let n;
172
- if (e instanceof HTMLTableCellElement) {
173
- const o = (t = e.parentElement) == null ? void 0 : t.previousElementSibling;
174
- if (o) {
175
- const l = Array.from(o.children)[e.cellIndex];
176
- l && (n = l);
177
- }
178
- } else if (e instanceof HTMLTableRowElement) {
179
- const o = e.previousElementSibling;
180
- o && (n = o);
181
- }
182
- return n && (!A(n) || !E(n)) ? U(n) : n;
183
- }, et = (e) => {
184
- var t;
185
- const n = e.target;
186
- let o;
187
- if (n instanceof HTMLTableCellElement) {
188
- const l = (t = n.parentElement) == null ? void 0 : t.parentElement;
189
- if (l) {
190
- const s = l.firstElementChild.children[n.cellIndex];
191
- s && (o = s);
192
- }
193
- } else if (n instanceof HTMLTableRowElement) {
194
- const l = n.parentElement;
195
- if (l) {
196
- const s = l.firstElementChild;
197
- s && (o = s);
198
- }
199
- }
200
- return o && (!A(o) || !E(o)) ? Q(o) : o;
201
- }, Z = (e) => {
202
- const t = e.target;
203
- return Q(t);
204
- }, Q = (e) => {
205
- var t;
206
- let n;
207
- if (e instanceof HTMLTableCellElement) {
208
- const o = (t = e.parentElement) == null ? void 0 : t.nextElementSibling;
209
- if (o) {
210
- const l = Array.from(o.children)[e.cellIndex];
211
- l && (n = l);
212
- }
213
- } else if (e instanceof HTMLTableRowElement) {
214
- const o = e.nextElementSibling;
215
- o && (n = o);
216
- }
217
- return n && (!A(n) || !E(n)) ? Q(n) : n;
218
- }, tt = (e) => {
219
- var t;
220
- const n = e.target;
221
- let o;
222
- if (n instanceof HTMLTableCellElement) {
223
- const l = (t = n.parentElement) == null ? void 0 : t.parentElement;
224
- if (l) {
225
- const s = l.lastElementChild.children[n.cellIndex];
226
- s && (o = s);
227
- }
228
- } else if (n instanceof HTMLTableRowElement) {
229
- const l = n.parentElement;
230
- if (l) {
231
- const s = l.lastElementChild;
232
- s && (o = s);
233
- }
234
- }
235
- return o && (!A(o) || !E(o)) ? U(o) : o;
236
- }, ee = (e) => {
237
- const t = e.target;
238
- return Y(t);
239
- }, Y = (e) => {
240
- var t;
241
- let n;
242
- if (e.previousElementSibling)
243
- n = e.previousElementSibling;
244
- else {
245
- const o = (t = e.parentElement) == null ? void 0 : t.previousElementSibling;
246
- n = o == null ? void 0 : o.lastElementChild;
247
- }
248
- return n && (!A(n) || !E(n)) ? Y(n) : n;
249
- }, te = (e) => {
250
- const t = e.target;
251
- return j(t);
252
- }, j = (e) => {
253
- var t;
254
- let n;
255
- if (e.nextElementSibling)
256
- n = e.nextElementSibling;
257
- else {
258
- const o = (t = e.parentElement) == null ? void 0 : t.nextElementSibling;
259
- n = o == null ? void 0 : o.firstElementChild;
260
- }
261
- return n && (!A(n) || !E(n)) ? j(n) : n;
262
- }, ne = (e) => {
263
- const t = e.target.parentElement.firstElementChild;
264
- return t && (!A(t) || !E(t)) ? j(t) : t;
265
- }, oe = (e) => {
266
- const t = e.target.parentElement.lastElementChild;
267
- return t && (!A(t) || !E(t)) ? Y(t) : t;
268
- }, $ = ["alt", "control", "shift", "meta"], nt = {
269
- ArrowUp: "up",
270
- ArrowDown: "down",
271
- ArrowLeft: "left",
272
- ArrowRight: "right"
273
- }, fe = {
274
- "keydown.up": (e) => {
275
- const t = X(e);
276
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
277
- },
278
- "keydown.down": (e) => {
279
- const t = Z(e);
280
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
281
- },
282
- "keydown.left": (e) => {
283
- const t = ee(e);
284
- e.preventDefault(), e.stopPropagation(), t && t.focus();
285
- },
286
- "keydown.right": (e) => {
287
- const t = te(e);
288
- e.preventDefault(), e.stopPropagation(), t && t.focus();
289
- },
290
- "keydown.control.up": (e) => {
291
- const t = et(e);
292
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
293
- },
294
- "keydown.control.down": (e) => {
295
- const t = tt(e);
296
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
297
- },
298
- "keydown.control.left": (e) => {
299
- const t = ne(e);
300
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
301
- },
302
- "keydown.control.right": (e) => {
303
- const t = oe(e);
304
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
305
- },
306
- "keydown.end": (e) => {
307
- const t = oe(e);
308
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
309
- },
310
- "keydown.enter": (e) => {
311
- if (e.target instanceof HTMLTableCellElement) {
312
- e.preventDefault(), e.stopPropagation();
313
- const t = Z(e);
314
- t && t.focus();
315
- }
316
- },
317
- "keydown.shift.enter": (e) => {
318
- if (e.target instanceof HTMLTableCellElement) {
319
- e.preventDefault(), e.stopPropagation();
320
- const t = X(e);
321
- t && t.focus();
322
- }
323
- },
324
- "keydown.home": (e) => {
325
- const t = ne(e);
326
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
327
- },
328
- "keydown.tab": (e) => {
329
- const t = te(e);
330
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
331
- },
332
- "keydown.shift.tab": (e) => {
333
- const t = ee(e);
334
- t && (e.preventDefault(), e.stopPropagation(), t.focus());
335
- }
336
- };
337
- function ot(e) {
338
- const t = (o) => {
339
- let l = null;
340
- o.parent && (typeof o.parent == "string" ? l = document.querySelector(o.parent) : o.parent instanceof Element ? l = o.parent : l = o.parent.value);
341
- let s = [];
342
- if (o.selectors)
343
- if (typeof o.selectors == "string")
344
- s = l ? Array.from(l.querySelectorAll(o.selectors)) : Array.from(document.querySelectorAll(o.selectors));
345
- else if (o.selectors instanceof Element)
346
- s.push(o.selectors);
347
- else if (Array.isArray(o.selectors.value))
348
- for (const a of o.selectors.value)
349
- a instanceof Element ? s.push(a) : s.push(a.$el);
350
- else
351
- s.push(o.selectors.value);
352
- else
353
- s = Array.from(l.children).filter((a) => A(a) && E(a));
354
- return s;
355
- }, n = (o) => (l) => {
356
- const s = nt[l.key] || l.key.toLowerCase();
357
- if ($.includes(s))
358
- return;
359
- const a = o.handlers || fe;
360
- for (const r of Object.keys(a)) {
361
- const [p, ...u] = r.split(".");
362
- if (p === "keydown" && u.includes(s)) {
363
- const d = a[r], g = u.filter((m) => $.includes(m)), b = $.some((m) => {
364
- const _ = m.charAt(0).toUpperCase() + m.slice(1);
365
- return l.getModifierState(_);
366
- });
367
- if (g.length > 0) {
368
- if (b) {
369
- for (const m of $)
370
- if (u.includes(m)) {
371
- const _ = m.charAt(0).toUpperCase() + m.slice(1);
372
- l.getModifierState(_) && d(l);
373
- }
374
- }
375
- } else
376
- b || d(l);
377
- }
378
- }
379
- };
380
- re(() => {
381
- for (const o of e) {
382
- const l = t(o);
383
- for (const s of l)
384
- s.addEventListener("keydown", n(o));
385
- }
386
- }), ke(() => {
387
- for (const o of e) {
388
- const l = t(o);
389
- for (const s of l)
390
- s.removeEventListener("keydown", n(o));
391
- }
392
- });
393
- }
394
- const lt = ["event", "colIndex", "rowIndex", "tableid"], st = { colspan: "5" }, at = ["onClick"], rt = 6, I = 7, it = /* @__PURE__ */ D({
395
- __name: "ADate",
396
- props: {
397
- colIndex: {},
398
- rowIndex: {},
399
- tableid: {},
400
- event: {},
401
- indent: {},
402
- readonly: { type: Boolean }
403
- },
404
- setup(e) {
405
- const t = e, n = ie(t.tableid), o = /* @__PURE__ */ new Date(), l = y(), s = y(), a = y(), r = y([]);
406
- re(async () => {
407
- let c = n.cellData(t.colIndex, t.rowIndex);
408
- c ? (c instanceof Date || (c = new Date(c)), l.value = c, s.value = l.value.getMonth(), a.value = l.value.getFullYear()) : (s.value = o.getMonth(), a.value = o.getFullYear()), p(), await Ae();
409
- const T = document.getElementsByClassName("selecteddate");
410
- if (T.length > 0)
411
- T[0].focus();
412
- else {
413
- const v = document.getElementsByClassName("todaysdate");
414
- v.length > 0 && v[0].focus();
415
- }
416
- }), F([s, a], () => {
417
- p();
418
- });
419
- const p = () => {
420
- r.value = [];
421
- const c = new Date(a.value, s.value, 1), T = c.getDay(), v = c.setDate(c.getDate() - T);
422
- for (let w of Array(43).keys())
423
- r.value.push(v + w * 864e5);
424
- }, u = () => {
425
- a.value -= 1;
426
- }, d = () => {
427
- a.value += 1;
428
- }, g = () => {
429
- s.value == 0 ? (s.value = 11, u()) : s.value -= 1;
430
- }, b = () => {
431
- s.value == 11 ? (s.value = 0, d()) : s.value += 1;
432
- }, m = (c) => {
433
- if (s.value === o.getMonth())
434
- return o.toDateString() === new Date(c).toDateString();
435
- }, _ = (c) => new Date(c).toDateString() === new Date(l.value).toDateString(), he = (c, T) => {
436
- l.value = new Date(r.value[T]), ve();
437
- }, ve = () => {
438
- n.setCellData(t.rowIndex, t.colIndex, l.value.getTime());
439
- }, ge = L(() => new Date(a.value, s.value, 1).toLocaleDateString(void 0, {
440
- year: "numeric",
441
- month: "long"
442
- }));
443
- return ot([
444
- {
445
- parent: "table.adate",
446
- selectors: "td",
447
- handlers: {
448
- ...fe,
449
- "keydown.pageup": g,
450
- "keydown.shift.pageup": u,
451
- "keydown.pagedown": b,
452
- "keydown.shift.pagedown": d
453
- }
454
- }
455
- ]), (c, T) => c.readonly ? ue("", !0) : (f(), h("div", {
456
- key: 0,
457
- event: c.event,
458
- colIndex: c.colIndex,
459
- rowIndex: c.rowIndex,
460
- tableid: c.tableid,
461
- class: "adate",
462
- tabindex: "0",
463
- ref: "adatepicker"
464
- }, [
465
- i("table", null, [
466
- i("tr", null, [
467
- i("td", {
468
- onClick: g,
469
- tabindex: -1
470
- }, "<"),
471
- i("th", st, k(ge.value), 1),
472
- i("td", {
473
- onClick: b,
474
- tabindex: -1
475
- }, ">")
476
- ]),
477
- (f(), h(V, null, x(rt, (v) => i("tr", { key: v }, [
478
- (f(), h(V, null, x(I, (w) => i("td", {
479
- key: (v - 1) * I + w,
480
- contenteditable: !1,
481
- spellcheck: !1,
482
- tabindex: 0,
483
- style: Ie({
484
- border: _(r.value[(v - 1) * I + w]) ? "2px solid var(--focus-cell-outline)" : "none",
485
- borderBottomColor: m(r.value[(v - 1) * I + w]) ? "var(--focus-cell-outline)" : "none"
486
- }),
487
- onClick: Me((ye) => he(ye, (v - 1) * I + w), ["prevent", "stop"]),
488
- class: B({
489
- todaysdate: m(r.value[(v - 1) * I + w]),
490
- selecteddate: _(r.value[(v - 1) * I + w])
491
- })
492
- }, k(new Date(r.value[(v - 1) * I + w]).getDate()), 15, at)), 64))
493
- ])), 64))
494
- ])
495
- ], 8, lt));
496
- }
497
- }), ut = /* @__PURE__ */ M(it, [["__scopeId", "data-v-169f1184"]]), dt = D({
498
- name: "ADropdown",
499
- props: {
500
- modelValue: {
501
- type: String,
502
- required: !1,
503
- default: ""
504
- },
505
- label: {
506
- type: String,
507
- required: !0
508
- },
509
- value: String,
510
- items: {
511
- type: Array,
512
- required: !1,
513
- default: () => []
514
- },
515
- isAsync: {
516
- type: Boolean,
517
- required: !1,
518
- default: !1
519
- }
520
- },
521
- emits: ["update:modelValue", "filterChanged"],
522
- data() {
523
- return {
524
- results: [],
525
- search: this.modelValue,
526
- isLoading: !1,
527
- arrowCounter: 0,
528
- isOpen: !1
529
- };
530
- },
531
- watch: {
532
- items: function(e, t) {
533
- this.isLoading = !1, this.results = e;
534
- }
535
- },
536
- mounted() {
537
- document.addEventListener("click", this.handleClickOutside), this.filterResults();
538
- },
539
- destroyed() {
540
- document.removeEventListener("click", this.handleClickOutside);
541
- },
542
- methods: {
543
- setResult(e) {
544
- this.search = e, this.closeResults();
545
- },
546
- filterResults() {
547
- this.results = this.items.filter((e) => e.toLowerCase().indexOf(this.search.toLowerCase()) > -1);
548
- },
549
- onChange() {
550
- this.isOpen = !0, this.isAsync ? (this.isLoading = !0, this.$emit("filterChanged", this.search)) : this.filterResults();
551
- },
552
- handleClickOutside(e) {
553
- this.$el.contains(e.target) || (this.closeResults(), this.arrowCounter = 0);
554
- },
555
- closeResults() {
556
- this.isOpen = !1, this.items.includes(this.search) || (this.search = ""), this.$emit("update:modelValue", this.search);
557
- },
558
- onArrowDown() {
559
- this.arrowCounter < this.results.length && (this.arrowCounter = this.arrowCounter + 1);
560
- },
561
- onArrowUp() {
562
- this.arrowCounter > 0 && (this.arrowCounter = this.arrowCounter - 1);
563
- },
564
- onEnter() {
565
- this.search = this.results[this.arrowCounter], this.closeResults(), this.arrowCounter = 0;
566
- },
567
- openWithSearch() {
568
- this.search = "", this.onChange(), this.$refs.mopInput.focus();
569
- }
570
- }
571
- }), ct = { class: "input-wrapper" }, pt = {
572
- id: "autocomplete-results",
573
- class: "autocomplete-results"
574
- }, ft = {
575
- key: 0,
576
- class: "loading autocomplete-result"
577
- }, mt = ["onClick"];
578
- function ht(e, t, n, o, l, s) {
579
- return f(), h("div", {
580
- class: B(["autocomplete", { isOpen: e.isOpen }])
581
- }, [
582
- i("div", ct, [
583
- C(i("input", {
584
- ref: "mopInput",
585
- type: "text",
586
- onInput: t[0] || (t[0] = (...a) => e.onChange && e.onChange(...a)),
587
- onFocus: t[1] || (t[1] = (...a) => e.onChange && e.onChange(...a)),
588
- "onUpdate:modelValue": t[2] || (t[2] = (a) => e.search = a),
589
- onKeydown: [
590
- t[3] || (t[3] = P((...a) => e.onArrowDown && e.onArrowDown(...a), ["down"])),
591
- t[4] || (t[4] = P((...a) => e.onArrowUp && e.onArrowUp(...a), ["up"])),
592
- t[5] || (t[5] = P((...a) => e.onEnter && e.onEnter(...a), ["enter"]))
593
- ]
594
- }, null, 544), [
595
- [R, e.search]
596
- ]),
597
- C(i("ul", pt, [
598
- e.isLoading ? (f(), h("li", ft, "Loading results...")) : (f(!0), h(V, { key: 1 }, x(e.results, (a, r) => (f(), h("li", {
599
- key: r,
600
- onClick: (p) => e.setResult(a),
601
- class: B(["autocomplete-result", { "is-active": r === e.arrowCounter }])
602
- }, k(a), 11, mt))), 128))
603
- ], 512), [
604
- [O, e.isOpen]
605
- ]),
606
- i("label", null, k(e.label), 1)
607
- ])
608
- ], 2);
609
- }
610
- const vt = /* @__PURE__ */ M(dt, [["render", ht]]), gt = /* @__PURE__ */ D({
611
- __name: "CollapseButton",
612
- props: {
613
- collapsed: { type: Boolean }
614
- },
615
- setup(e) {
616
- return (t, n) => (f(), h("button", {
617
- class: B(["collapse-button", t.collapsed ? "rotated" : "unrotated"])
618
- }, "×", 2));
619
- }
620
- }), yt = /* @__PURE__ */ M(gt, [["__scopeId", "data-v-6f1c1b45"]]), bt = /* @__PURE__ */ D({
621
- __name: "AForm",
622
- props: {
623
- modelValue: {},
624
- data: {},
625
- readonly: { type: Boolean }
626
- },
627
- emits: ["update:modelValue"],
628
- setup(e, { emit: t }) {
629
- const n = e, o = t, l = y(n.data || {}), s = (r) => {
630
- let p = {};
631
- for (const [u, d] of Object.entries(r))
632
- ["component", "fieldtype"].includes(u) || (p[u] = d), u === "rows" && d && d.length === 0 && (p.rows = l.value[r.fieldname]);
633
- return p;
634
- }, a = L({
635
- get: () => n.modelValue.map((r, p) => L({
636
- get() {
637
- return r.value;
638
- },
639
- set: (u) => {
640
- n.modelValue[p].value = u, o("update:modelValue", n.modelValue);
641
- }
642
- })),
643
- set: () => {
644
- }
645
- });
646
- return (r, p) => (f(), h("form", null, [
647
- (f(!0), h(V, null, x(r.modelValue, (u, d) => (f(), H(Te(u.component), _e({
648
- key: d,
649
- schema: u,
650
- modelValue: a.value[d].value,
651
- "onUpdate:modelValue": (g) => a.value[d].value = g,
652
- data: l.value[u.fieldname],
653
- readonly: r.readonly
654
- }, s(u)), null, 16, ["schema", "modelValue", "onUpdate:modelValue", "data", "readonly"]))), 128))
655
- ]));
656
- }
657
- }), me = /* @__PURE__ */ M(bt, [["__scopeId", "data-v-74d66cf2"]]), wt = /* @__PURE__ */ D({
658
- __name: "AFieldset",
659
- props: {
660
- schema: {},
661
- label: {},
662
- collapsible: { type: Boolean },
663
- data: {}
664
- },
665
- setup(e) {
666
- const t = e, n = y(t.data || []);
667
- let o = y(!1), l = y(t.collapsible);
668
- const s = y(t.schema);
669
- function a(r) {
670
- r.preventDefault(), l.value && (o.value = !o.value);
671
- }
672
- return (r, p) => (f(), h("fieldset", null, [
673
- i("legend", {
674
- onClick: a,
675
- onSubmit: a
676
- }, [
677
- Se(k(r.label) + " ", 1),
678
- S(l) ? (f(), H(yt, {
679
- key: 0,
680
- collapsed: S(o)
681
- }, null, 8, ["collapsed"])) : ue("", !0)
682
- ], 32),
683
- Oe(r.$slots, "default", { collapsed: S(o) }, () => [
684
- C($e(me, {
685
- modelValue: s.value,
686
- "onUpdate:modelValue": p[0] || (p[0] = (u) => s.value = u),
687
- data: n.value
688
- }, null, 8, ["modelValue", "data"]), [
689
- [O, !S(o)]
690
- ])
691
- ], !0)
692
- ]));
693
- }
694
- }), Ct = /* @__PURE__ */ M(wt, [["__scopeId", "data-v-cad9b578"]]), kt = ["id", "disabled", "required"], Dt = ["for"], Et = ["innerHTML"], At = /* @__PURE__ */ D({
695
- __name: "ANumericInput",
696
- props: /* @__PURE__ */ se({
697
- label: {},
698
- required: { type: Boolean },
699
- readonly: { type: Boolean },
700
- uuid: {},
701
- validation: { default: () => ({ errorMessage: "&nbsp;" }) }
702
- }, {
703
- modelValue: {},
704
- modelModifiers: {}
705
- }),
706
- emits: ["update:modelValue"],
707
- setup(e) {
708
- const t = ae(e, "modelValue");
709
- return (n, o) => (f(), h("div", null, [
710
- C(i("input", {
711
- "onUpdate:modelValue": o[0] || (o[0] = (l) => t.value = l),
712
- type: "number",
713
- id: n.uuid,
714
- disabled: n.readonly,
715
- required: n.required
716
- }, null, 8, kt), [
717
- [R, t.value]
718
- ]),
719
- i("label", { for: n.uuid }, k(n.label), 9, Dt),
720
- C(i("p", {
721
- innerHTML: n.validation.errorMessage
722
- }, null, 8, Et), [
723
- [O, n.validation.errorMessage]
724
- ])
725
- ]));
726
- }
727
- }), It = /* @__PURE__ */ M(At, [["__scopeId", "data-v-02907cd6"]]), le = {
728
- date: "##/##/####",
729
- datetime: "####/##/## ##:##",
730
- time: "##:##",
731
- fulltime: "##:##:##",
732
- phone: "(###) ### - ####",
733
- card: "#### #### #### ####"
734
- };
735
- function Mt(e) {
736
- try {
737
- return Function(`"use strict";return (${e})`)();
738
- } catch {
739
- }
740
- }
741
- function Tt(e) {
742
- var n;
743
- let t = e.value;
744
- if (t) {
745
- const o = Mt(t);
746
- if (o) {
747
- const l = e.instance.locale;
748
- t = o(l);
749
- }
750
- } else {
751
- const l = (n = e.instance.schema.fieldtype) == null ? void 0 : n.toLowerCase();
752
- l && le[l] && (t = le[l]);
753
- }
754
- return t;
755
- }
756
- function _t(e, t) {
757
- t || (t = "#");
758
- let n = e;
759
- const o = [t, "/", "-", "(", ")", " "];
760
- for (const l of o)
761
- n = n.replaceAll(l, "");
762
- return n;
763
- }
764
- function St(e, t, n) {
765
- n || (n = "#");
766
- let o = t;
767
- for (const l of e) {
768
- const s = o.indexOf(n);
769
- if (s !== -1) {
770
- const a = o.substring(0, s), r = o.substring(s + 1);
771
- o = a + l + r;
772
- }
773
- }
774
- return o.slice(0, t.length);
775
- }
776
- function Ot(e, t) {
777
- const n = Tt(t);
778
- if (!n)
779
- return;
780
- const o = "#", l = e.value, s = _t(l, o);
781
- if (s) {
782
- const a = St(s, n, o);
783
- t.instance.maskFilled && (t.instance.maskFilled = !a.includes(o)), e.value = a;
784
- } else
785
- e.value = n;
786
- }
787
- const $t = D({
788
- name: "ATextInput",
789
- props: {
790
- schema: {
791
- type: Object,
792
- required: !0
793
- },
794
- label: {
795
- type: String,
796
- required: !0
797
- },
798
- modelValue: {
799
- type: null
800
- },
801
- mask: {
802
- type: String
803
- },
804
- required: {
805
- type: Boolean
806
- },
807
- readonly: {
808
- type: Boolean
809
- },
810
- uuid: {
811
- type: String
812
- },
813
- validation: {
814
- type: Object,
815
- default: () => ({ errorMessage: "&nbsp;" })
816
- }
817
- },
818
- setup(e, t) {
819
- const n = y(!1), o = ie("locale", "");
820
- return { inputText: L({
821
- get() {
822
- return e.modelValue;
823
- },
824
- set(s) {
825
- t.emit("update:modelValue", s);
826
- }
827
- }), locale: o, maskFilled: n };
828
- },
829
- directives: {
830
- mask: Ot
831
- }
832
- }), Lt = ["id", "disabled", "maxlength", "required"], Vt = ["for"], xt = ["innerHTML"];
833
- function Bt(e, t, n, o, l, s) {
834
- const a = Le("mask");
835
- return f(), h("div", null, [
836
- C(i("input", {
837
- "onUpdate:modelValue": t[0] || (t[0] = (r) => e.inputText = r),
838
- id: e.uuid,
839
- disabled: e.readonly,
840
- maxlength: e.mask ? e.maskFilled && e.mask.length : void 0,
841
- required: e.required
842
- }, null, 8, Lt), [
843
- [R, e.inputText],
844
- [a, e.mask]
845
- ]),
846
- i("label", { for: e.uuid }, k(e.label), 9, Vt),
847
- C(i("p", {
848
- innerHTML: e.validation.errorMessage
849
- }, null, 8, xt), [
850
- [O, e.validation.errorMessage]
851
- ])
852
- ]);
853
- }
854
- const Pt = /* @__PURE__ */ M($t, [["render", Bt], ["__scopeId", "data-v-76dba9b8"]]);
855
- function Ht(e) {
856
- e.component("ACheckbox", Fe), e.component("ACombobox", Ue), e.component("ADate", ut), e.component("ADropdown", vt), e.component("AFieldset", Ct), e.component("AForm", me), e.component("ANumericInput", It), e.component("ATextInput", Pt);
857
- }
858
- export {
859
- Fe as ACheckbox,
860
- Ue as AComboBox,
861
- ut as ADate,
862
- vt as ADropdown,
863
- Ct as AFieldset,
864
- me as AForm,
865
- It as ANumericInput,
866
- Pt as ATextInput,
867
- Ht as install
868
- };
869
- //# sourceMappingURL=aform.js.map