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