@vue-interface/select-field 1.0.0-beta.2 → 1.0.0-beta.4

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.
@@ -1,825 +1,125 @@
1
- import { defineComponent as E, inject as nt, openBlock as s, createElementBlock as u, normalizeClass as x, normalizeStyle as rt, createElementVNode as N, createBlock as T, resolveDynamicComponent as st, createCommentVNode as l, toDisplayString as H, resolveComponent as ut, resolveDirective as ot, renderSlot as a, withDirectives as at, mergeProps as lt, createVNode as dt, Transition as ct, withCtx as ht } from "vue";
2
- function c(t, e = "px") {
3
- return t != null && t !== !1 && isFinite(t) ? `${t}${e}` : t;
4
- }
5
- const ft = E({
6
- props: {
7
- absolute: Boolean,
8
- center: Boolean,
9
- label: String,
10
- size: {
11
- type: String,
12
- default: "md"
13
- },
14
- registry: {
15
- type: String,
16
- default: "indicators"
17
- },
18
- type: {
19
- type: String,
20
- required: !0
21
- },
22
- height: [String, Number],
23
- maxHeight: [String, Number],
24
- minHeight: [String, Number],
25
- width: [String, Number],
26
- maxWidth: [String, Number],
27
- minWidth: [String, Number]
28
- },
29
- data: () => ({
30
- is: null
31
- }),
32
- setup(t) {
33
- return {
34
- registryInstance: nt(t.registry || "indicators")
35
- };
36
- },
37
- computed: {
38
- classes() {
39
- return {
40
- "activity-indicator-center": this.center,
41
- "activity-indicator-absolute": this.absolute,
42
- [this.size && `activity-indicator-${this.size}`]: !!this.size
43
- };
44
- },
45
- style() {
46
- return {
47
- width: c(this.width),
48
- maxWidth: c(this.maxWidth),
49
- minWidth: c(this.minWidth),
50
- height: c(this.height),
51
- maxHeight: c(this.maxHeight),
52
- minHeight: c(this.minHeight)
53
- };
54
- }
55
- },
56
- async mounted() {
57
- const t = await this.component();
58
- this.is = () => t;
59
- },
60
- methods: {
61
- async component() {
62
- let t = this.registryInstance.get(this.type);
63
- return t instanceof Promise ? t : (typeof t == "function" && (t = await t()), t.default ? t.default : t);
64
- }
65
- }
66
- }), pt = (t, e) => {
67
- const i = t.__vccOpts || t;
68
- for (const [r, n] of e)
69
- i[r] = n;
70
- return i;
71
- }, vt = { class: "activity-indicator-content" }, gt = {
72
- key: 1,
73
- class: "activity-indicator-label"
74
- };
75
- function yt(t, e, i, r, n, o) {
76
- return s(), u("div", {
77
- class: x(["activity-indicator", t.classes]),
78
- style: rt(t.style)
79
- }, [
80
- N("div", vt, [
81
- t.is ? (s(), T(st(t.is()), {
82
- key: 0,
83
- class: "mx-auto"
84
- })) : l("", !0),
85
- t.label ? (s(), u("div", gt, H(t.label), 1)) : l("", !0)
86
- ])
87
- ], 6);
88
- }
89
- const bt = /* @__PURE__ */ pt(ft, [["render", yt]]);
90
- var mt = Object.defineProperty, Ct = (t, e, i) => e in t ? mt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, Et = (t, e, i) => (Ct(t, typeof e != "symbol" ? e + "" : e, i), i), C = function() {
91
- return C = Object.assign || function(t) {
92
- for (var e, i = 1, r = arguments.length; i < r; i++) {
93
- e = arguments[i];
94
- for (var n in e)
95
- Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
96
- }
97
- return t;
98
- }, C.apply(this, arguments);
99
- };
100
- function $t(t) {
101
- return t.toLowerCase();
102
- }
103
- var St = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], At = /[^A-Z0-9]+/gi;
104
- function Ft(t, e) {
105
- e === void 0 && (e = {});
106
- for (var i = e.splitRegexp, r = i === void 0 ? St : i, n = e.stripRegexp, o = n === void 0 ? At : n, y = e.transform, $ = y === void 0 ? $t : y, d = e.delimiter, it = d === void 0 ? " " : d, b = j(j(t, r, "$1\0$2"), o, "\0"), S = 0, A = b.length; b.charAt(S) === "\0"; )
107
- S++;
108
- for (; b.charAt(A - 1) === "\0"; )
109
- A--;
110
- return b.slice(S, A).split("\0").map($).join(it);
111
- }
112
- function j(t, e, i) {
113
- return e instanceof RegExp ? t.replace(e, i) : e.reduce(function(r, n) {
114
- return r.replace(n, i);
115
- }, t);
116
- }
117
- function xt(t, e) {
118
- return e === void 0 && (e = {}), Ft(t, C({ delimiter: "." }, e));
119
- }
120
- function m(t, e) {
121
- return e === void 0 && (e = {}), xt(t, C({ delimiter: "-" }, e));
122
- }
123
- class jt {
124
- constructor(e = {}) {
125
- Et(this, "components"), this.components = /* @__PURE__ */ new Map(), Object.entries(e).forEach(([i, r]) => {
126
- this.register(i, r);
127
- });
128
- }
129
- get(e) {
130
- const i = this.components.get(
131
- e = m(e)
132
- );
133
- if (i)
134
- return i;
135
- throw new Error(`"${e}" has not been registered yet!`);
136
- }
137
- register(e, i) {
138
- return typeof e == "object" ? (Object.entries(e).forEach(([r, n]) => {
139
- this.register(m(r), n);
140
- }), this) : (this.components.set(m(e), i), this);
141
- }
142
- remove(e) {
143
- return this.components.delete(m(e)), this;
144
- }
145
- reset() {
146
- return this.components = /* @__PURE__ */ new Map(), this;
147
- }
148
- }
149
- function wt(t = {}) {
150
- return new jt(t);
151
- }
152
- wt();
153
- const p = {};
154
- function v(...t) {
155
- if (!t.length)
156
- return p;
157
- const [e, i] = t;
158
- return typeof e == "string" ? typeof p[e] < "u" ? p[e] : i : Array.isArray(e) ? e.reduce((r, n) => Object.assign(r, {
159
- [n]: p[n]
160
- }), {}) : Object.assign(p, ...t);
161
- }
162
- const Dt = E({
163
- props: {
164
- dropShadow: {
165
- type: [Boolean, String],
166
- default: void 0
167
- },
168
- dropShadowableClassPrefix: {
169
- type: String,
170
- default: "drop-shadow"
171
- },
172
- shadow: {
173
- type: [Boolean, String],
174
- default: void 0
175
- },
176
- shadowableClassPrefix: {
177
- type: String,
178
- default: "shadow"
179
- }
180
- },
181
- computed: {
182
- shadowableClass() {
183
- const t = this.dropShadow === !0 ? "" : this.dropShadow && `-${this.dropShadow}`, e = this.shadow === !0 ? "" : this.shadow && `-${this.shadow}`;
184
- return {
185
- [`${this.dropShadowableClassPrefix}${t}`]: !!this.dropShadow,
186
- [`${this.shadowableClassPrefix}${e}`]: !!this.shadow
187
- };
188
- }
189
- }
190
- });
191
- var Ot = typeof global == "object" && global && global.Object === Object && global;
192
- const kt = Ot;
193
- var zt = typeof self == "object" && self && self.Object === Object && self, Bt = kt || zt || Function("return this")();
194
- const It = Bt;
195
- var Lt = It.Symbol;
196
- const f = Lt;
197
- var Z = Object.prototype, Nt = Z.hasOwnProperty, Tt = Z.toString, g = f ? f.toStringTag : void 0;
198
- function Ht(t) {
199
- var e = Nt.call(t, g), i = t[g];
200
- try {
201
- t[g] = void 0;
202
- var r = !0;
203
- } catch {
204
- }
205
- var n = Tt.call(t);
206
- return r && (e ? t[g] = i : delete t[g]), n;
207
- }
208
- var Zt = Object.prototype, Mt = Zt.toString;
209
- function Rt(t) {
210
- return Mt.call(t);
211
- }
212
- var Ut = "[object Null]", Pt = "[object Undefined]", w = f ? f.toStringTag : void 0;
213
- function Vt(t) {
214
- return t == null ? t === void 0 ? Pt : Ut : w && w in Object(t) ? Ht(t) : Rt(t);
215
- }
216
- function Wt(t) {
217
- return t != null && typeof t == "object";
218
- }
219
- var Gt = "[object Symbol]";
220
- function qt(t) {
221
- return typeof t == "symbol" || Wt(t) && Vt(t) == Gt;
222
- }
223
- function Yt(t, e) {
224
- for (var i = -1, r = t == null ? 0 : t.length, n = Array(r); ++i < r; )
225
- n[i] = e(t[i], i, t);
226
- return n;
227
- }
228
- var Jt = Array.isArray;
229
- const Kt = Jt;
230
- var _t = 1 / 0, D = f ? f.prototype : void 0, O = D ? D.toString : void 0;
231
- function M(t) {
232
- if (typeof t == "string")
233
- return t;
234
- if (Kt(t))
235
- return Yt(t, M) + "";
236
- if (qt(t))
237
- return O ? O.call(t) : "";
238
- var e = t + "";
239
- return e == "0" && 1 / t == -_t ? "-0" : e;
240
- }
241
- function R(t) {
242
- return t == null ? "" : M(t);
243
- }
244
- function Qt(t, e, i, r) {
245
- var n = -1, o = t == null ? 0 : t.length;
246
- for (r && o && (i = t[++n]); ++n < o; )
247
- i = e(i, t[n], n, t);
248
- return i;
249
- }
250
- function Xt(t) {
251
- return function(e) {
252
- return t == null ? void 0 : t[e];
253
- };
254
- }
255
- var te = {
256
- \u00C0: "A",
257
- \u00C1: "A",
258
- \u00C2: "A",
259
- \u00C3: "A",
260
- \u00C4: "A",
261
- \u00C5: "A",
262
- \u00E0: "a",
263
- \u00E1: "a",
264
- \u00E2: "a",
265
- \u00E3: "a",
266
- \u00E4: "a",
267
- \u00E5: "a",
268
- \u00C7: "C",
269
- \u00E7: "c",
270
- \u00D0: "D",
271
- \u00F0: "d",
272
- \u00C8: "E",
273
- \u00C9: "E",
274
- \u00CA: "E",
275
- \u00CB: "E",
276
- \u00E8: "e",
277
- \u00E9: "e",
278
- \u00EA: "e",
279
- \u00EB: "e",
280
- \u00CC: "I",
281
- \u00CD: "I",
282
- \u00CE: "I",
283
- \u00CF: "I",
284
- \u00EC: "i",
285
- \u00ED: "i",
286
- \u00EE: "i",
287
- \u00EF: "i",
288
- \u00D1: "N",
289
- \u00F1: "n",
290
- \u00D2: "O",
291
- \u00D3: "O",
292
- \u00D4: "O",
293
- \u00D5: "O",
294
- \u00D6: "O",
295
- \u00D8: "O",
296
- \u00F2: "o",
297
- \u00F3: "o",
298
- \u00F4: "o",
299
- \u00F5: "o",
300
- \u00F6: "o",
301
- \u00F8: "o",
302
- \u00D9: "U",
303
- \u00DA: "U",
304
- \u00DB: "U",
305
- \u00DC: "U",
306
- \u00F9: "u",
307
- \u00FA: "u",
308
- \u00FB: "u",
309
- \u00FC: "u",
310
- \u00DD: "Y",
311
- \u00FD: "y",
312
- \u00FF: "y",
313
- \u00C6: "Ae",
314
- \u00E6: "ae",
315
- \u00DE: "Th",
316
- \u00FE: "th",
317
- \u00DF: "ss",
318
- \u0100: "A",
319
- \u0102: "A",
320
- \u0104: "A",
321
- \u0101: "a",
322
- \u0103: "a",
323
- \u0105: "a",
324
- \u0106: "C",
325
- \u0108: "C",
326
- \u010A: "C",
327
- \u010C: "C",
328
- \u0107: "c",
329
- \u0109: "c",
330
- \u010B: "c",
331
- \u010D: "c",
332
- \u010E: "D",
333
- \u0110: "D",
334
- \u010F: "d",
335
- \u0111: "d",
336
- \u0112: "E",
337
- \u0114: "E",
338
- \u0116: "E",
339
- \u0118: "E",
340
- \u011A: "E",
341
- \u0113: "e",
342
- \u0115: "e",
343
- \u0117: "e",
344
- \u0119: "e",
345
- \u011B: "e",
346
- \u011C: "G",
347
- \u011E: "G",
348
- \u0120: "G",
349
- \u0122: "G",
350
- \u011D: "g",
351
- \u011F: "g",
352
- \u0121: "g",
353
- \u0123: "g",
354
- \u0124: "H",
355
- \u0126: "H",
356
- \u0125: "h",
357
- \u0127: "h",
358
- \u0128: "I",
359
- \u012A: "I",
360
- \u012C: "I",
361
- \u012E: "I",
362
- \u0130: "I",
363
- \u0129: "i",
364
- \u012B: "i",
365
- \u012D: "i",
366
- \u012F: "i",
367
- \u0131: "i",
368
- \u0134: "J",
369
- \u0135: "j",
370
- \u0136: "K",
371
- \u0137: "k",
372
- \u0138: "k",
373
- \u0139: "L",
374
- \u013B: "L",
375
- \u013D: "L",
376
- \u013F: "L",
377
- \u0141: "L",
378
- \u013A: "l",
379
- \u013C: "l",
380
- \u013E: "l",
381
- \u0140: "l",
382
- \u0142: "l",
383
- \u0143: "N",
384
- \u0145: "N",
385
- \u0147: "N",
386
- \u014A: "N",
387
- \u0144: "n",
388
- \u0146: "n",
389
- \u0148: "n",
390
- \u014B: "n",
391
- \u014C: "O",
392
- \u014E: "O",
393
- \u0150: "O",
394
- \u014D: "o",
395
- \u014F: "o",
396
- \u0151: "o",
397
- \u0154: "R",
398
- \u0156: "R",
399
- \u0158: "R",
400
- \u0155: "r",
401
- \u0157: "r",
402
- \u0159: "r",
403
- \u015A: "S",
404
- \u015C: "S",
405
- \u015E: "S",
406
- \u0160: "S",
407
- \u015B: "s",
408
- \u015D: "s",
409
- \u015F: "s",
410
- \u0161: "s",
411
- \u0162: "T",
412
- \u0164: "T",
413
- \u0166: "T",
414
- \u0163: "t",
415
- \u0165: "t",
416
- \u0167: "t",
417
- \u0168: "U",
418
- \u016A: "U",
419
- \u016C: "U",
420
- \u016E: "U",
421
- \u0170: "U",
422
- \u0172: "U",
423
- \u0169: "u",
424
- \u016B: "u",
425
- \u016D: "u",
426
- \u016F: "u",
427
- \u0171: "u",
428
- \u0173: "u",
429
- \u0174: "W",
430
- \u0175: "w",
431
- \u0176: "Y",
432
- \u0177: "y",
433
- \u0178: "Y",
434
- \u0179: "Z",
435
- \u017B: "Z",
436
- \u017D: "Z",
437
- \u017A: "z",
438
- \u017C: "z",
439
- \u017E: "z",
440
- \u0132: "IJ",
441
- \u0133: "ij",
442
- \u0152: "Oe",
443
- \u0153: "oe",
444
- \u0149: "'n",
445
- \u017F: "s"
446
- }, ee = Xt(te);
447
- const ie = ee;
448
- var ne = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, re = "\\u0300-\\u036f", se = "\\ufe20-\\ufe2f", ue = "\\u20d0-\\u20ff", oe = re + se + ue, ae = "[" + oe + "]", le = RegExp(ae, "g");
449
- function de(t) {
450
- return t = R(t), t && t.replace(ne, ie).replace(le, "");
451
- }
452
- var ce = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
453
- function he(t) {
454
- return t.match(ce) || [];
455
- }
456
- var fe = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
457
- function pe(t) {
458
- return fe.test(t);
459
- }
460
- var U = "\\ud800-\\udfff", ve = "\\u0300-\\u036f", ge = "\\ufe20-\\ufe2f", ye = "\\u20d0-\\u20ff", be = ve + ge + ye, P = "\\u2700-\\u27bf", V = "a-z\\xdf-\\xf6\\xf8-\\xff", me = "\\xac\\xb1\\xd7\\xf7", Ce = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", Ee = "\\u2000-\\u206f", $e = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", W = "A-Z\\xc0-\\xd6\\xd8-\\xde", Se = "\\ufe0e\\ufe0f", G = me + Ce + Ee + $e, q = "['\u2019]", k = "[" + G + "]", Ae = "[" + be + "]", Y = "\\d+", Fe = "[" + P + "]", J = "[" + V + "]", K = "[^" + U + G + Y + P + V + W + "]", xe = "\\ud83c[\\udffb-\\udfff]", je = "(?:" + Ae + "|" + xe + ")", we = "[^" + U + "]", _ = "(?:\\ud83c[\\udde6-\\uddff]){2}", Q = "[\\ud800-\\udbff][\\udc00-\\udfff]", h = "[" + W + "]", De = "\\u200d", z = "(?:" + J + "|" + K + ")", Oe = "(?:" + h + "|" + K + ")", B = "(?:" + q + "(?:d|ll|m|re|s|t|ve))?", I = "(?:" + q + "(?:D|LL|M|RE|S|T|VE))?", X = je + "?", tt = "[" + Se + "]?", ke = "(?:" + De + "(?:" + [we, _, Q].join("|") + ")" + tt + X + ")*", ze = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", Be = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", Ie = tt + X + ke, Le = "(?:" + [Fe, _, Q].join("|") + ")" + Ie, Ne = RegExp([
461
- h + "?" + J + "+" + B + "(?=" + [k, h, "$"].join("|") + ")",
462
- Oe + "+" + I + "(?=" + [k, h + z, "$"].join("|") + ")",
463
- h + "?" + z + "+" + B,
464
- h + "+" + I,
465
- Be,
466
- ze,
467
- Y,
468
- Le
469
- ].join("|"), "g");
470
- function Te(t) {
471
- return t.match(Ne) || [];
472
- }
473
- function He(t, e, i) {
474
- return t = R(t), e = i ? void 0 : e, e === void 0 ? pe(t) ? Te(t) : he(t) : t.match(e) || [];
475
- }
476
- var Ze = "['\u2019]", Me = RegExp(Ze, "g");
477
- function Re(t) {
478
- return function(e) {
479
- return Qt(He(de(e).replace(Me, "")), t, "");
480
- };
481
- }
482
- var Ue = Re(function(t, e, i) {
483
- return t + (i ? "-" : "") + e.toLowerCase();
484
- });
485
- const et = Ue;
486
- function F(t, e, i = "-") {
487
- const r = String(e).replace(new RegExp(`^${t}${i}?`), "");
488
- return [
489
- et(r),
490
- t
491
- ].filter((n) => !!n).join(i);
492
- }
493
- function L(t) {
494
- return !Array.isArray(t) && typeof t == "object";
495
- }
496
- function Pe(t) {
497
- return t === void 0;
498
- }
499
- const Ve = E({
500
- directives: {
501
- bindEvents: {
502
- beforeMount(t, e) {
503
- var i, r;
504
- (r = (i = e.instance) == null ? void 0 : i.bindEvents) == null || r.call(i, t);
505
- }
506
- }
507
- },
508
- mixins: [
509
- Dt
510
- ],
511
- inheritAttrs: !1,
512
- props: {
513
- activity: {
514
- type: Boolean,
515
- default: !1
516
- },
517
- animated: {
518
- type: Boolean,
519
- default: () => v("animated", !1)
520
- },
521
- nativeEvents: {
522
- type: Array,
523
- default() {
524
- return ["focus", "blur", "change", "click", "keypress", "keyup", "keydown", "progress", "paste"];
525
- }
526
- },
527
- defaultControlClass: {
528
- type: String,
529
- default: () => v("defaultControlClass", "form-control")
530
- },
531
- error: {
532
- type: [String, Array, Boolean],
533
- default: void 0
534
- },
535
- errors: {
536
- type: [Array, Object, Boolean],
537
- default() {
538
- return {};
539
- }
540
- },
541
- feedback: {
542
- type: [String, Array],
543
- default: void 0
544
- },
545
- group: {
546
- type: Boolean,
547
- default: () => v("group", !0)
548
- },
549
- helpText: {
550
- type: [Number, String],
551
- default: void 0
552
- },
553
- hideLabel: Boolean,
554
- indicator: {
555
- type: [String, Boolean],
556
- default: () => v("indicator", "spinner")
557
- },
558
- indicatorSize: {
559
- type: String,
560
- default: void 0
561
- },
562
- inline: Boolean,
563
- invalid: Boolean,
564
- label: {
565
- type: [Number, String],
566
- default: void 0
567
- },
568
- labelClass: {
569
- type: [Object, String],
570
- default: () => v("labelClass", "form-label")
571
- },
572
- modelValue: {
573
- default: void 0
574
- },
575
- pill: Boolean,
576
- plaintext: Boolean,
577
- size: {
578
- type: String,
579
- default: void 0
580
- },
581
- spacing: {
582
- type: String,
583
- default: void 0
584
- },
585
- valid: Boolean
586
- },
587
- data() {
588
- return {
589
- defaultEmpty: !1,
590
- hasChanged: !1,
591
- hasFocus: !1,
592
- isEmpty: !0
593
- };
594
- },
595
- computed: {
596
- id() {
597
- return this.$attrs.id || this.$attrs.name || (Math.random() + 1).toString(36).substring(7);
598
- },
599
- componentName() {
600
- return this.$options.name;
601
- },
602
- controlAttributes() {
603
- return Object.fromEntries(
604
- Object.entries(this.$attrs).concat([
605
- ["id", this.id],
606
- ["class", this.controlClasses]
607
- ])
608
- );
609
- },
610
- controlClass() {
611
- return this.defaultControlClass;
612
- },
613
- controlSizeClass() {
614
- return F(this.size, this.controlClass);
615
- },
616
- formGroupClasses() {
617
- return Object.assign({
618
- [this.size && F(this.size, this.componentName)]: !!this.size,
619
- animated: this.animated,
620
- "default-empty": this.defaultEmpty,
621
- "form-group": this.group,
622
- [this.size && F(this.size, "form-group")]: !!this.size,
623
- "has-activity": this.activity,
624
- "has-changed": this.hasChanged,
625
- "has-focus": this.hasFocus,
626
- "has-icon": !!this.$slots.icon,
627
- "is-empty": this.isEmpty,
628
- "is-invalid": !!(this.invalid || this.invalidFeedback),
629
- "is-valid": !!(this.valid || this.validFeedback),
630
- [this.$attrs.class]: !!this.$attrs.class,
631
- [this.$attrs.id]: !!this.$attrs.id
632
- }, !!this.componentName && {
633
- [et(this.componentName)]: !0
634
- });
635
- },
636
- controlClasses() {
637
- return Object.assign({
638
- [this.controlClass]: !!this.controlClass,
639
- [this.controlSizeClass]: !!this.controlSizeClass,
640
- "form-control-icon": !!this.$slots.icon,
641
- "is-valid": !!(this.valid || this.validFeedback),
642
- "is-invalid": !!(this.invalid || this.invalidFeedback),
643
- [this.pillClasses]: this.pill,
644
- [this.plaintextClass]: this.plaintext,
645
- [this.spacing]: !!this.spacing
646
- }, this.shadowableClass);
647
- },
648
- hasDefaultSlot() {
649
- return !!this.$slots.default;
650
- },
651
- invalidFeedback() {
652
- if (this.error === "")
653
- return null;
654
- if (this.error)
655
- return this.error;
656
- const t = this.getFieldErrors();
657
- return Array.isArray(t) ? t.filter((e) => e && typeof e == "string").join("<br>") : t;
658
- },
659
- pillClasses() {
660
- return "rounded rounded-pill";
661
- },
662
- plaintextClass() {
663
- return "form-control-plaintext";
664
- },
665
- validFeedback() {
666
- return Array.isArray(this.feedback) ? this.feedback.join("<br>") : this.feedback;
667
- }
668
- },
669
- watch: {
670
- hasFocus() {
671
- this.shouldChangeOnFocus() && (this.hasChanged = !0);
672
- },
673
- defaultEmpty() {
674
- this.hasChanged = !0;
675
- }
676
- },
677
- methods: {
678
- bindEvents(t, e) {
679
- var i;
680
- e || (e = this.onInput);
681
- const r = t instanceof HTMLSelectElement ? (i = t.querySelectorAll("option")) == null ? void 0 : i[t.selectedIndex] : null;
682
- Pe(this.modelValue) ? r && (t.value = r == null ? void 0 : r.value) : t.value = this.modelValue, t.value && e(t.value), this.hasChanged = !!t.value, this.isEmpty = !t.value, t.addEventListener("focus", () => {
683
- this.hasFocus = !0;
684
- }), t.addEventListener("blur", () => {
685
- this.hasFocus = !1;
686
- }), t.addEventListener("input", () => {
687
- this.isEmpty = !1, this.hasChanged = !0;
688
- }), t.addEventListener(
689
- t.tagName === "SELECT" ? "change" : "input",
690
- () => e(t.value)
691
- ), this.nativeEvents.forEach((n) => {
692
- t.addEventListener(n, (o) => {
693
- this.$emit(n, o);
694
- });
695
- });
696
- },
697
- blur() {
698
- this.getInputField() && this.getInputField().blur();
699
- },
700
- focus() {
701
- this.getInputField() && this.getInputField().focus();
702
- },
703
- getInputField() {
704
- return this.$el.querySelector(
705
- ".form-control, input, select, textarea"
706
- );
707
- },
708
- getFieldErrors() {
709
- let t = this.error || this.errors;
710
- return this.errors && L(this.errors) && (t = this.errors[this.$attrs.name || this.$attrs.id]), !t || Array.isArray(t) || L(t) ? t : [t];
711
- },
712
- shouldChangeOnFocus() {
713
- return !this.getInputField().readOnly;
714
- },
715
- onInput(t) {
716
- this.$emit("update:modelValue", t);
717
- }
718
- }
719
- }), We = E({
1
+ import { ActivityIndicator as g } from "@vue-interface/activity-indicator";
2
+ import { FormControl as S } from "@vue-interface/form-control";
3
+ import { defineComponent as z, resolveComponent as m, resolveDirective as E, openBlock as t, createElementBlock as l, normalizeClass as b, renderSlot as o, toDisplayString as i, createCommentVNode as n, createElementVNode as a, normalizeProps as c, guardReactiveProps as f, withDirectives as V, mergeProps as A, vModelSelect as N, createVNode as k, Transition as T, withCtx as p, createBlock as y, createTextVNode as B } from "vue";
4
+ const D = z({
720
5
  name: "SelectField",
721
6
  components: {
722
- ActivityIndicator: bt
7
+ ActivityIndicator: g
723
8
  },
724
- mixins: [
725
- Ve
726
- ],
9
+ extends: S,
727
10
  props: {
728
- defaultControlClass: {
11
+ /**
12
+ * The default class name assigned to the control element
13
+ *
14
+ * @param {String}
15
+ * @default 'form-select'
16
+ */
17
+ formControlClass: {
729
18
  type: String,
730
19
  default: "form-select"
731
20
  }
732
21
  },
733
22
  computed: {
734
23
  controlClass() {
735
- return this.plaintext ? `${this.defaultControlClass}-plaintext` : this.defaultControlClass;
736
- }
737
- },
738
- methods: {
739
- shouldChangeOnFocus() {
740
- return !1;
24
+ return this.plaintext ? `${this.formControlClass}-plaintext` : this.formControlClass;
741
25
  }
742
26
  }
743
27
  });
744
- const Ge = (t, e) => {
745
- const i = t.__vccOpts || t;
746
- for (const [r, n] of e)
747
- i[r] = n;
748
- return i;
749
- }, qe = ["for", "innerHTML"], Ye = { class: "form-group-inner" }, Je = ["innerHTML"], Ke = ["innerHTML"];
750
- function _e(t, e, i, r, n, o) {
751
- const y = ut("activity-indicator"), $ = ot("bind-events");
752
- return s(), u("div", {
753
- class: x(t.formGroupClasses)
28
+ const P = (e, s) => {
29
+ const d = e.__vccOpts || e;
30
+ for (const [u, v] of s)
31
+ d[u] = v;
32
+ return d;
33
+ }, w = ["for"], O = { class: "form-group-inner" }, j = {
34
+ invalid: "",
35
+ class: "invalid-feedback"
36
+ }, G = /* @__PURE__ */ a("br", null, null, -1), I = {
37
+ valid: "",
38
+ class: "valid-feedback"
39
+ };
40
+ function M(e, s, d, u, v, R) {
41
+ const C = m("activity-indicator"), $ = m("FormControlErrors"), h = m("FormControlFeedback"), F = E("bind-events");
42
+ return t(), l("div", {
43
+ class: b(e.formGroupClasses)
754
44
  }, [
755
- a(t.$slots, "label", {}, () => [
756
- t.label ? (s(), u("label", {
45
+ o(e.$slots, "label", {}, () => [
46
+ e.label ? (t(), l("label", {
757
47
  key: 0,
758
48
  ref: "label",
759
- for: t.id,
760
- class: x(t.labelClass),
761
- onClick: e[0] || (e[0] = (...d) => t.focus && t.focus(...d)),
762
- innerHTML: t.label
763
- }, null, 10, qe)) : l("", !0)
49
+ for: e.id,
50
+ class: b(e.labelClass)
51
+ }, i(e.label), 11, w)) : n("", !0)
764
52
  ]),
765
- N("div", Ye, [
766
- a(t.$slots, "control", {
767
- bindEvents: t.bindEvents,
768
- controlAttributes: t.controlAttributes,
769
- focus: t.focus
770
- }, () => [
771
- t.$slots.icon ? (s(), u("div", {
53
+ a("div", O, [
54
+ o(e.$slots, "control", c(f({ bindEvents: e.bindEvents, controlAttributes: e.controlAttributes })), () => [
55
+ e.$slots.icon ? (t(), l("div", {
772
56
  key: 0,
773
57
  class: "form-group-inner-icon",
774
- onClick: e[1] || (e[1] = (...d) => t.focus && t.focus(...d))
58
+ onClick: s[0] || (s[0] = (...r) => e.focus && e.focus(...r))
775
59
  }, [
776
- a(t.$slots, "icon")
777
- ])) : l("", !0),
778
- at((s(), u("select", lt({ ref: "field" }, Object.assign({
779
- disabled: t.$attrs.readonly
780
- }, t.controlAttributes)), [
781
- a(t.$slots, "default")
60
+ o(e.$slots, "icon")
61
+ ])) : n("", !0),
62
+ V((t(), l("select", A({
63
+ ref: "field",
64
+ "onUpdate:modelValue": s[1] || (s[1] = (r) => e.model = r)
65
+ }, Object.assign({
66
+ disabled: e.$attrs.readonly
67
+ }, e.controlAttributes)), [
68
+ o(e.$slots, "default")
782
69
  ], 16)), [
783
- [$]
70
+ [N, e.model],
71
+ [F]
784
72
  ])
785
73
  ]),
786
- a(t.$slots, "activity", {}, () => [
787
- dt(ct, { name: "select-field-fade" }, {
788
- default: ht(() => [
789
- t.activity ? (s(), T(y, {
74
+ o(e.$slots, "activity", {}, () => [
75
+ k(T, { name: "select-field-fade" }, {
76
+ default: p(() => [
77
+ e.activity ? (t(), y(C, {
790
78
  key: "activity",
791
79
  ref: "activity",
792
- type: t.indicator,
793
- size: t.indicatorSize || t.size
794
- }, null, 8, ["type", "size"])) : l("", !0)
80
+ type: e.indicator,
81
+ size: e.indicatorSize || e.size
82
+ }, null, 8, ["type", "size"])) : n("", !0)
795
83
  ]),
796
84
  _: 1
797
85
  })
798
86
  ])
799
87
  ]),
800
- a(t.$slots, "feedback", {}, () => [
801
- t.invalidFeedback ? (s(), u("div", {
88
+ o(e.$slots, "errors", c(f({ error: e.error, errors: e.errors, id: e.$attrs.id, name: e.$attrs.name })), () => [
89
+ e.error || e.errors ? (t(), y($, {
802
90
  key: 0,
803
- class: "invalid-feedback",
804
- invalid: "",
805
- innerHTML: t.invalidFeedback
806
- }, null, 8, Je)) : t.validFeedback ? (s(), u("div", {
807
- key: 1,
808
- class: "valid-feedback",
809
- valid: "",
810
- innerHTML: t.validFeedback
811
- }, null, 8, Ke)) : l("", !0)
91
+ id: e.$attrs.id,
92
+ name: e.$attrs.name,
93
+ error: e.error,
94
+ errors: e.errors
95
+ }, {
96
+ default: p(({ error: r }) => [
97
+ a("div", j, [
98
+ B(i(r), 1),
99
+ G
100
+ ])
101
+ ]),
102
+ _: 1
103
+ }, 8, ["id", "name", "error", "errors"])) : n("", !0)
104
+ ]),
105
+ o(e.$slots, "feedback", c(f({ feedback: e.feedback })), () => [
106
+ k(h, { feedback: e.feedback }, {
107
+ default: p(({ feedback: r }) => [
108
+ a("div", I, i(r), 1)
109
+ ]),
110
+ _: 1
111
+ }, 8, ["feedback"])
812
112
  ]),
813
- a(t.$slots, "help", {}, () => [
814
- t.helpText ? (s(), u("small", {
113
+ o(e.$slots, "help", {}, () => [
114
+ e.helpText ? (t(), l("small", {
815
115
  key: 0,
816
116
  ref: "help"
817
- }, H(t.helpText), 513)) : l("", !0)
117
+ }, i(e.helpText), 513)) : n("", !0)
818
118
  ])
819
119
  ], 2);
820
120
  }
821
- const Xe = /* @__PURE__ */ Ge(We, [["render", _e]]);
121
+ const J = /* @__PURE__ */ P(D, [["render", M]]);
822
122
  export {
823
- Xe as SelectField
123
+ J as SelectField
824
124
  };
825
125
  //# sourceMappingURL=select-field.js.map