@stonecrop/aform 0.2.5 → 0.2.6

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