@vue-interface/select-field 0.13.0 → 1.0.0-beta.0

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,316 +1,93 @@
1
- function _typeof(obj) {
2
- "@babel/helpers - typeof";
3
- return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(obj2) {
4
- return typeof obj2;
5
- } : function(obj2) {
6
- return obj2 && typeof Symbol == "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
7
- }, _typeof(obj);
8
- }
9
- function _classCallCheck(instance, Constructor) {
10
- if (!(instance instanceof Constructor)) {
11
- throw new TypeError("Cannot call a class as a function");
12
- }
13
- }
14
- function _defineProperties(target, props) {
15
- for (var i = 0; i < props.length; i++) {
16
- var descriptor = props[i];
17
- descriptor.enumerable = descriptor.enumerable || false;
18
- descriptor.configurable = true;
19
- if ("value" in descriptor)
20
- descriptor.writable = true;
21
- Object.defineProperty(target, descriptor.key, descriptor);
22
- }
23
- }
24
- function _createClass(Constructor, protoProps, staticProps) {
25
- if (protoProps)
26
- _defineProperties(Constructor.prototype, protoProps);
27
- if (staticProps)
28
- _defineProperties(Constructor, staticProps);
29
- Object.defineProperty(Constructor, "prototype", {
30
- writable: false
31
- });
32
- return Constructor;
33
- }
34
- function _setPrototypeOf(o, p) {
35
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
36
- o2.__proto__ = p2;
37
- return o2;
38
- };
39
- return _setPrototypeOf(o, p);
40
- }
41
- function _isNativeReflectConstruct() {
42
- if (typeof Reflect === "undefined" || !Reflect.construct)
43
- return false;
44
- if (Reflect.construct.sham)
45
- return false;
46
- if (typeof Proxy === "function")
47
- return true;
48
- try {
49
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
50
- }));
51
- return true;
52
- } catch (e) {
53
- return false;
54
- }
55
- }
56
- function _construct(Parent, args, Class) {
57
- if (_isNativeReflectConstruct()) {
58
- _construct = Reflect.construct;
59
- } else {
60
- _construct = function _construct2(Parent2, args2, Class2) {
61
- var a = [null];
62
- a.push.apply(a, args2);
63
- var Constructor = Function.bind.apply(Parent2, a);
64
- var instance = new Constructor();
65
- if (Class2)
66
- _setPrototypeOf(instance, Class2.prototype);
67
- return instance;
68
- };
69
- }
70
- return _construct.apply(null, arguments);
71
- }
72
- function _slicedToArray(arr, i) {
73
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
74
- }
75
- function _arrayWithHoles(arr) {
76
- if (Array.isArray(arr))
77
- return arr;
78
- }
79
- function _iterableToArrayLimit(arr, i) {
80
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
81
- if (_i == null)
82
- return;
83
- var _arr = [];
84
- var _n = true;
85
- var _d = false;
86
- var _s, _e;
87
- try {
88
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
89
- _arr.push(_s.value);
90
- if (i && _arr.length === i)
91
- break;
92
- }
93
- } catch (err) {
94
- _d = true;
95
- _e = err;
96
- } finally {
97
- try {
98
- if (!_n && _i["return"] != null)
99
- _i["return"]();
100
- } finally {
101
- if (_d)
102
- throw _e;
103
- }
104
- }
105
- return _arr;
106
- }
107
- function _unsupportedIterableToArray(o, minLen) {
108
- if (!o)
109
- return;
110
- if (typeof o === "string")
111
- return _arrayLikeToArray(o, minLen);
112
- var n = Object.prototype.toString.call(o).slice(8, -1);
113
- if (n === "Object" && o.constructor)
114
- n = o.constructor.name;
115
- if (n === "Map" || n === "Set")
116
- return Array.from(o);
117
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
118
- return _arrayLikeToArray(o, minLen);
119
- }
120
- function _arrayLikeToArray(arr, len) {
121
- if (len == null || len > arr.length)
122
- len = arr.length;
123
- for (var i = 0, arr2 = new Array(len); i < len; i++)
124
- arr2[i] = arr[i];
125
- return arr2;
126
- }
127
- function _nonIterableRest() {
128
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
129
- }
130
- var _assign = function __assign() {
131
- _assign = Object.assign || function __assign22(t) {
132
- for (var s, i = 1, n = arguments.length; i < n; i++) {
133
- s = arguments[i];
134
- for (var p in s) {
135
- if (Object.prototype.hasOwnProperty.call(s, p))
136
- t[p] = s[p];
137
- }
1
+ import { openBlock as a, createElementBlock as d, normalizeClass as w, normalizeStyle as N, createElementVNode as x, createBlock as O, resolveDynamicComponent as P, createCommentVNode as p, toDisplayString as j, resolveComponent as R, resolveDirective as I, renderSlot as f, withDirectives as H, mergeProps as D, createVNode as M, Transition as Z, withCtx as G } from "vue";
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */
16
+ var b = function() {
17
+ return b = Object.assign || function(t) {
18
+ for (var i, s = 1, r = arguments.length; s < r; s++) {
19
+ i = arguments[s];
20
+ for (var n in i)
21
+ Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);
138
22
  }
139
23
  return t;
140
- };
141
- return _assign.apply(this, arguments);
24
+ }, b.apply(this, arguments);
142
25
  };
143
- function lowerCase$1(str) {
144
- return str.toLowerCase();
26
+ function V(e) {
27
+ return e.toLowerCase();
145
28
  }
146
- var DEFAULT_SPLIT_REGEXP$1 = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
147
- var DEFAULT_STRIP_REGEXP$1 = /[^A-Z0-9]+/gi;
148
- function noCase$1(input, options) {
149
- if (options === void 0) {
150
- options = {};
151
- }
152
- var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP$1 : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP$1 : _b, _c = options.transform, transform = _c === void 0 ? lowerCase$1 : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
153
- var result = replace$1(replace$1(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
154
- var start = 0;
155
- var end = result.length;
156
- while (result.charAt(start) === "\0") {
157
- start++;
158
- }
159
- while (result.charAt(end - 1) === "\0") {
160
- end--;
161
- }
162
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
29
+ var q = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], W = /[^A-Z0-9]+/gi;
30
+ function U(e, t) {
31
+ t === void 0 && (t = {});
32
+ for (var i = t.splitRegexp, s = i === void 0 ? q : i, r = t.stripRegexp, n = r === void 0 ? W : r, u = t.transform, g = u === void 0 ? V : u, o = t.delimiter, S = o === void 0 ? " " : o, l = E(E(e, s, "$1\0$2"), n, "\0"), c = 0, h = l.length; l.charAt(c) === "\0"; )
33
+ c++;
34
+ for (; l.charAt(h - 1) === "\0"; )
35
+ h--;
36
+ return l.slice(c, h).split("\0").map(g).join(S);
163
37
  }
164
- function replace$1(input, re, value) {
165
- if (re instanceof RegExp)
166
- return input.replace(re, value);
167
- return re.reduce(function(input2, re2) {
168
- return input2.replace(re2, value);
169
- }, input);
38
+ function E(e, t, i) {
39
+ return t instanceof RegExp ? e.replace(t, i) : t.reduce(function(s, r) {
40
+ return s.replace(r, i);
41
+ }, e);
170
42
  }
171
- function dotCase$1(input, options) {
172
- if (options === void 0) {
173
- options = {};
174
- }
175
- return noCase$1(input, _assign({
43
+ function X(e, t) {
44
+ return t === void 0 && (t = {}), U(e, b({
176
45
  delimiter: "."
177
- }, options));
46
+ }, t));
178
47
  }
179
- function paramCase$1(input, options) {
180
- if (options === void 0) {
181
- options = {};
182
- }
183
- return dotCase$1(input, _assign({
48
+ function y(e, t) {
49
+ return t === void 0 && (t = {}), X(e, b({
184
50
  delimiter: "-"
185
- }, options));
51
+ }, t));
186
52
  }
187
- var ComponentRegistry = /* @__PURE__ */ function() {
188
- function ComponentRegistry2() {
189
- var _this = this;
190
- var components = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
191
- _classCallCheck(this, ComponentRegistry2);
192
- this.components = {};
193
- Object.entries(components).forEach(function(_ref) {
194
- var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
195
- _this.register(key, value);
53
+ class L {
54
+ constructor(t = {}) {
55
+ this.components = /* @__PURE__ */ new Map(), Object.entries(t).forEach(([i, s]) => {
56
+ this.register(i, s);
196
57
  });
197
58
  }
198
- _createClass(ComponentRegistry2, [{
199
- key: "validate",
200
- value: function validate(value) {
201
- if (_typeof(value) === "object" || typeof value === "function") {
202
- return value;
203
- }
204
- throw new Error("Invalid data type `".concat(_typeof(value), "`. Should be type `object` or `function`."));
205
- }
206
- }, {
207
- key: "get",
208
- value: function get(name) {
209
- var match = this.components[name = paramCase$1(name)];
210
- if (match) {
211
- return match;
212
- }
213
- throw new Error('"'.concat(name, '" has not been registered yet!'));
214
- }
215
- }, {
216
- key: "register",
217
- value: function register(name, value) {
218
- var _this2 = this;
219
- if (_typeof(name) === "object") {
220
- Object.entries(name).forEach(function(_ref3) {
221
- var _ref4 = _slicedToArray(_ref3, 2), name2 = _ref4[0], module = _ref4[1];
222
- _this2.register(paramCase$1(name2), module);
223
- });
224
- return this;
225
- }
226
- this.components[paramCase$1(name)] = this.validate(value);
227
- return this;
228
- }
229
- }, {
230
- key: "remove",
231
- value: function remove(name) {
232
- delete this.components[paramCase$1(name)];
233
- return this;
234
- }
235
- }, {
236
- key: "reset",
237
- value: function reset() {
238
- this.components = {};
239
- return this;
240
- }
241
- }]);
242
- return ComponentRegistry2;
243
- }();
244
- function factory() {
245
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
246
- args[_key] = arguments[_key];
59
+ get(t) {
60
+ const i = this.components.get(t = y(t));
61
+ if (i)
62
+ return i;
63
+ throw new Error(`"${t}" has not been registered yet!`);
247
64
  }
248
- return _construct(ComponentRegistry, args);
249
- }
250
- const registry = factory();
251
- var render$1 = function() {
252
- var _vm = this;
253
- var _h = _vm.$createElement;
254
- var _c = _vm._self._c || _h;
255
- return _c("div", { staticClass: "activity-indicator", class: _vm.classes, style: _vm.style }, [_c("div", { staticClass: "activity-indicator-content" }, [_c(_vm.component, { tag: "component", staticClass: "mx-auto" }), _vm.label ? _c("div", { staticClass: "activity-indicator-label" }, [_vm._v(" " + _vm._s(_vm.label) + " ")]) : _vm._e()], 1)]);
256
- };
257
- var staticRenderFns$1 = [];
258
- var ActivityIndicator_vue_vue_type_style_index_0_lang = "";
259
- function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
260
- var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
261
- if (render2) {
262
- options.render = render2;
263
- options.staticRenderFns = staticRenderFns2;
264
- options._compiled = true;
65
+ register(t, i) {
66
+ return typeof t == "object" ? (Object.entries(t).forEach(([s, r]) => {
67
+ this.register(y(s), r);
68
+ }), this) : (this.components.set(y(t), i), this);
265
69
  }
266
- if (functionalTemplate) {
267
- options.functional = true;
70
+ remove(t) {
71
+ return this.components.delete(y(t)), this;
268
72
  }
269
- if (scopeId) {
270
- options._scopeId = "data-v-" + scopeId;
73
+ reset() {
74
+ return this.components = /* @__PURE__ */ new Map(), this;
271
75
  }
272
- var hook;
273
- if (moduleIdentifier) {
274
- hook = function(context) {
275
- context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
276
- if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
277
- context = __VUE_SSR_CONTEXT__;
278
- }
279
- if (injectStyles) {
280
- injectStyles.call(this, context);
281
- }
282
- if (context && context._registeredComponents) {
283
- context._registeredComponents.add(moduleIdentifier);
284
- }
285
- };
286
- options._ssrRegister = hook;
287
- } else if (injectStyles) {
288
- hook = shadowMode ? function() {
289
- injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
290
- } : injectStyles;
291
- }
292
- if (hook) {
293
- if (options.functional) {
294
- options._injectStyles = hook;
295
- var originalRender = options.render;
296
- options.render = function renderWithStyleInjection(h, context) {
297
- hook.call(context);
298
- return originalRender(h, context);
299
- };
300
- } else {
301
- var existing = options.beforeCreate;
302
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
303
- }
304
- }
305
- return {
306
- exports: scriptExports,
307
- options
308
- };
309
76
  }
310
- function unit(value, uom = "px") {
311
- return value !== null && value !== void 0 && value !== false && isFinite(value) ? `${value}${uom}` : value;
77
+ function J(...e) {
78
+ return new L(...e);
312
79
  }
313
- const __vue2_script$1 = {
80
+ const A = J();
81
+ const T = (e, t) => {
82
+ const i = e.__vccOpts || e;
83
+ for (const [s, r] of t)
84
+ i[s] = r;
85
+ return i;
86
+ };
87
+ function v(e, t = "px") {
88
+ return e != null && e !== !1 && isFinite(e) ? `${e}${t}` : e;
89
+ }
90
+ const K = {
314
91
  name: "ActivityIndicator",
315
92
  props: {
316
93
  absolute: Boolean,
@@ -321,14 +98,14 @@ const __vue2_script$1 = {
321
98
  default: "md"
322
99
  },
323
100
  registry: {
324
- type: ComponentRegistry,
101
+ type: L,
325
102
  default() {
326
- return registry;
103
+ return A;
327
104
  }
328
105
  },
329
106
  type: {
330
107
  type: String,
331
- required: true
108
+ required: !0
332
109
  },
333
110
  height: [String, Number],
334
111
  maxHeight: [String, Number],
@@ -337,6 +114,9 @@ const __vue2_script$1 = {
337
114
  maxWidth: [String, Number],
338
115
  minWidth: [String, Number]
339
116
  },
117
+ data: () => ({
118
+ is: null
119
+ }),
340
120
  computed: {
341
121
  classes() {
342
122
  return {
@@ -347,53 +127,54 @@ const __vue2_script$1 = {
347
127
  },
348
128
  style() {
349
129
  return {
350
- width: unit(this.width),
351
- maxWidth: unit(this.maxWidth),
352
- minWidth: unit(this.minWidth),
353
- height: unit(this.height),
354
- maxHeight: unit(this.maxHeight),
355
- minHeight: unit(this.minHeight)
356
- };
357
- },
358
- component() {
359
- return () => {
360
- const component = registry.get(this.type);
361
- if (component instanceof Promise) {
362
- return component;
363
- }
364
- if (typeof component === "function") {
365
- return component();
366
- }
367
- return Promise.resolve(component);
130
+ width: v(this.width),
131
+ maxWidth: v(this.maxWidth),
132
+ minWidth: v(this.minWidth),
133
+ height: v(this.height),
134
+ maxHeight: v(this.maxHeight),
135
+ minHeight: v(this.minHeight)
368
136
  };
369
137
  }
138
+ },
139
+ async mounted() {
140
+ const e = await this.component();
141
+ this.is = () => e;
142
+ },
143
+ methods: {
144
+ async component() {
145
+ let e = A.get(this.type);
146
+ return e instanceof Promise ? e : (typeof e == "function" && (e = await e()), e.default ? e.default : e);
147
+ }
370
148
  }
149
+ }, Q = { class: "activity-indicator-content" }, Y = {
150
+ key: 1,
151
+ class: "activity-indicator-label"
371
152
  };
372
- const __cssModules$1 = {};
373
- var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, null, null, null);
374
- function __vue2_injectStyles$1(context) {
375
- for (let o in __cssModules$1) {
376
- this[o] = __cssModules$1[o];
377
- }
153
+ function ee(e, t, i, s, r, n) {
154
+ return a(), d("div", {
155
+ class: w(["activity-indicator", n.classes]),
156
+ style: N(n.style)
157
+ }, [
158
+ x("div", Q, [
159
+ e.is ? (a(), O(P(e.is()), {
160
+ key: 0,
161
+ class: "mx-auto"
162
+ })) : p("", !0),
163
+ i.label ? (a(), d("div", Y, j(i.label), 1)) : p("", !0)
164
+ ])
165
+ ], 6);
378
166
  }
379
- var ActivityIndicator = /* @__PURE__ */ function() {
380
- return __component__$1.exports;
381
- }();
382
- var Chase_vue_vue_type_style_index_0_lang = "";
383
- var CircleFade_vue_vue_type_style_index_0_lang = "";
384
- var CircleOrbit_vue_vue_type_style_index_0_lang = "";
385
- var CircleTrail_vue_vue_type_style_index_0_lang = "";
386
- var Dots_vue_vue_type_style_index_0_lang = "";
387
- var DoublePulse_vue_vue_type_style_index_0_lang = "";
388
- var Facebook_vue_vue_type_style_index_0_lang = "";
389
- var Grid_vue_vue_type_style_index_0_lang = "";
390
- var Pulse_vue_vue_type_style_index_0_lang = "";
391
- var Spinner_vue_vue_type_style_index_0_lang = "";
392
- var Spotify_vue_vue_type_style_index_0_lang = "";
393
- var Square_vue_vue_type_style_index_0_lang = "";
394
- var SquareFold_vue_vue_type_style_index_0_lang = "";
395
- var SquareOrbit_vue_vue_type_style_index_0_lang = "";
396
- var Shadowable = {
167
+ const te = /* @__PURE__ */ T(K, [["render", ee]]);
168
+ const m = {};
169
+ function _(...e) {
170
+ if (!e.length)
171
+ return m;
172
+ const [t, i] = e;
173
+ return typeof t == "string" ? typeof m[t] < "u" ? m[t] : i : Array.isArray(t) ? t.reduce((s, r) => Object.assign(s, {
174
+ [r]: m[r]
175
+ }), {}) : Object.assign(m, ...e);
176
+ }
177
+ var ie = {
397
178
  props: {
398
179
  dropShadow: [Boolean, String],
399
180
  dropShadowableClassPrefix: {
@@ -408,166 +189,88 @@ var Shadowable = {
408
189
  },
409
190
  computed: {
410
191
  shadowableClass() {
411
- const dropShadowClassName = this.dropShadow === true ? "" : this.dropShadow && `-${this.dropShadow}`;
412
- const shadowClassName = this.shadow === true ? "" : this.shadow && `-${this.shadow}`;
192
+ const e = this.dropShadow === !0 ? "" : this.dropShadow && `-${this.dropShadow}`, t = this.shadow === !0 ? "" : this.shadow && `-${this.shadow}`;
413
193
  return {
414
- [`${this.dropShadowableClassPrefix}${dropShadowClassName}`]: !!this.dropShadow,
415
- [`${this.shadowableClassPrefix}${shadowClassName}`]: !!this.shadow
194
+ [`${this.dropShadowableClassPrefix}${e}`]: !!this.dropShadow,
195
+ [`${this.shadowableClassPrefix}${t}`]: !!this.shadow
416
196
  };
417
197
  }
418
198
  }
419
- };
420
- /*! *****************************************************************************
421
- Copyright (c) Microsoft Corporation.
422
-
423
- Permission to use, copy, modify, and/or distribute this software for any
424
- purpose with or without fee is hereby granted.
425
-
426
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
427
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
428
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
429
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
430
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
431
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
432
- PERFORMANCE OF THIS SOFTWARE.
433
- ***************************************************************************** */
434
- var __assign2 = function() {
435
- __assign2 = Object.assign || function __assign3(t) {
436
- for (var s, i = 1, n = arguments.length; i < n; i++) {
437
- s = arguments[i];
438
- for (var p in s)
439
- if (Object.prototype.hasOwnProperty.call(s, p))
440
- t[p] = s[p];
199
+ }, C = function() {
200
+ return C = Object.assign || function(t) {
201
+ for (var i, s = 1, r = arguments.length; s < r; s++) {
202
+ i = arguments[s];
203
+ for (var n in i)
204
+ Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);
441
205
  }
442
206
  return t;
443
- };
444
- return __assign2.apply(this, arguments);
207
+ }, C.apply(this, arguments);
445
208
  };
446
- function lowerCase(str) {
447
- return str.toLowerCase();
209
+ function se(e) {
210
+ return e.toLowerCase();
448
211
  }
449
- var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
450
- var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
451
- function noCase(input, options) {
452
- if (options === void 0) {
453
- options = {};
454
- }
455
- var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
456
- var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
457
- var start = 0;
458
- var end = result.length;
459
- while (result.charAt(start) === "\0")
460
- start++;
461
- while (result.charAt(end - 1) === "\0")
462
- end--;
463
- return result.slice(start, end).split("\0").map(transform).join(delimiter);
212
+ var re = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], ne = /[^A-Z0-9]+/gi;
213
+ function ae(e, t) {
214
+ t === void 0 && (t = {});
215
+ for (var i = t.splitRegexp, s = i === void 0 ? re : i, r = t.stripRegexp, n = r === void 0 ? ne : r, u = t.transform, g = u === void 0 ? se : u, o = t.delimiter, S = o === void 0 ? " " : o, l = F(F(e, s, "$1\0$2"), n, "\0"), c = 0, h = l.length; l.charAt(c) === "\0"; )
216
+ c++;
217
+ for (; l.charAt(h - 1) === "\0"; )
218
+ h--;
219
+ return l.slice(c, h).split("\0").map(g).join(S);
464
220
  }
465
- function replace(input, re, value) {
466
- if (re instanceof RegExp)
467
- return input.replace(re, value);
468
- return re.reduce(function(input2, re2) {
469
- return input2.replace(re2, value);
470
- }, input);
221
+ function F(e, t, i) {
222
+ return t instanceof RegExp ? e.replace(t, i) : t.reduce(function(s, r) {
223
+ return s.replace(r, i);
224
+ }, e);
471
225
  }
472
- function dotCase(input, options) {
473
- if (options === void 0) {
474
- options = {};
475
- }
476
- return noCase(input, __assign2({
226
+ function oe(e, t) {
227
+ return t === void 0 && (t = {}), ae(e, C({
477
228
  delimiter: "."
478
- }, options));
229
+ }, t));
479
230
  }
480
- function paramCase(input, options) {
481
- if (options === void 0) {
482
- options = {};
483
- }
484
- return dotCase(input, __assign2({
231
+ function B(e, t) {
232
+ return t === void 0 && (t = {}), oe(e, C({
485
233
  delimiter: "-"
486
- }, options));
234
+ }, t));
487
235
  }
488
- const global = {};
489
- function config(...args) {
490
- if (!args.length) {
491
- return global;
492
- }
493
- const [key, value] = args;
494
- if (typeof key === "string") {
495
- return typeof global[key] !== "undefined" ? global[key] : value;
496
- }
497
- if (Array.isArray(key)) {
498
- return key.reduce((carry, key2) => {
499
- return Object.assign(carry, {
500
- [key2]: global[key2]
501
- });
502
- }, {});
503
- }
504
- return Object.assign(global, ...args);
236
+ function $(e, t, i = "-") {
237
+ const s = t.toString().replace(new RegExp(`^${e}${i}?`), "");
238
+ return [B(s), e].filter((r) => !!r).join(i);
505
239
  }
506
- function prefix(key, value, delimeter = "-") {
507
- const string = value.toString().replace(new RegExp(`^${key}${delimeter}?`), "");
508
- return [paramCase(string), key].filter((value2) => !!value2).join(delimeter);
240
+ function k(e) {
241
+ return !Array.isArray(e) && typeof e == "object";
509
242
  }
510
- function isObject(subject) {
511
- return !Array.isArray(subject) && typeof subject === "object";
243
+ function z(e) {
244
+ return e === void 0;
512
245
  }
513
- var FormControl = {
246
+ const le = {
514
247
  directives: {
515
248
  bindEvents: {
516
- bind(el, binding, vnode) {
517
- el.addEventListener("focus", () => {
518
- vnode.context.hasFocus = true;
519
- });
520
- el.addEventListener("blur", () => {
521
- vnode.context.hasFocus = false;
522
- });
523
- el.addEventListener(el.tagName === "SELECT" ? "change" : "input", (e) => {
524
- vnode.context.isEmpty = !el.value;
525
- vnode.context.currentValue = el.value;
526
- });
527
- vnode.context.hasChanged = !!el.value;
528
- vnode.context.bindEvents.forEach((name) => {
529
- el.addEventListener(name, (event) => {
530
- vnode.context.$emit(name, event);
531
- });
532
- });
533
- if (el.tagName === "SELECT") {
534
- const opt = el.querySelector('[value=""]');
535
- if (opt && opt.value === el.value) {
536
- vnode.context.defaultEmpty = true;
537
- }
538
- }
249
+ beforeMount(e, t, i) {
250
+ t.instance.bindEvents(e);
539
251
  }
540
252
  }
541
253
  },
542
- mixins: [Shadowable],
543
- inheritAttrs: false,
254
+ mixins: [ie],
255
+ inheritAttrs: !1,
544
256
  props: {
545
257
  activity: {
546
258
  type: Boolean,
547
- default: false
259
+ default: !1
548
260
  },
549
261
  animated: {
550
262
  type: Boolean,
551
- default: () => config("animated", false)
263
+ default: () => _("animated", !1)
552
264
  },
553
- bindEvents: {
265
+ nativeEvents: {
554
266
  type: Array,
555
267
  default() {
556
268
  return ["focus", "blur", "change", "click", "keypress", "keyup", "keydown", "progress", "paste"];
557
269
  }
558
270
  },
559
- componentName: {
560
- type: String,
561
- default() {
562
- return this.$options.name;
563
- }
564
- },
565
271
  defaultControlClass: {
566
272
  type: String,
567
- default: () => config("defaultControlClass", "form-control")
568
- },
569
- defaultValue: {
570
- default: () => config("defaultValue", null)
273
+ default: () => _("defaultControlClass", "form-control")
571
274
  },
572
275
  error: [String, Array, Boolean],
573
276
  errors: {
@@ -579,13 +282,13 @@ var FormControl = {
579
282
  feedback: [String, Array],
580
283
  group: {
581
284
  type: Boolean,
582
- default: () => config("group", true)
285
+ default: () => _("group", !0)
583
286
  },
584
287
  helpText: [Number, String],
585
288
  hideLabel: Boolean,
586
289
  indicator: {
587
290
  type: String,
588
- default: () => config("indicator", "spinner")
291
+ default: () => _("indicator", "spinner")
589
292
  },
590
293
  indicatorSize: String,
591
294
  inline: Boolean,
@@ -593,61 +296,58 @@ var FormControl = {
593
296
  label: [Number, String],
594
297
  labelClass: {
595
298
  type: [Object, String],
596
- default: () => config("labelClass", "form-label")
299
+ default: () => _("labelClass", "form-label")
300
+ },
301
+ modelValue: {
302
+ default: void 0
597
303
  },
598
304
  pill: Boolean,
599
305
  plaintext: Boolean,
600
306
  size: String,
601
307
  spacing: String,
602
- valid: Boolean,
603
- value: {
604
- default: null
605
- }
308
+ valid: Boolean
606
309
  },
607
310
  data() {
608
311
  return {
609
- currentValue: this.value || this.defaultValue,
610
- defaultEmpty: false,
611
- hasChanged: false,
612
- hasFocus: false,
613
- isEmpty: !(this.value || this.defaultValue)
312
+ defaultEmpty: !1,
313
+ hasChanged: !1,
314
+ hasFocus: !1,
315
+ isEmpty: !0
614
316
  };
615
317
  },
616
318
  computed: {
617
319
  id() {
618
- return this.$attrs.id || this.$attrs.name;
320
+ return this.$attrs.id || this.$attrs.name || (Math.random() + 1).toString(36).substring(7);
321
+ },
322
+ componentName() {
323
+ return this.$options.name;
619
324
  },
620
325
  controlAttributes() {
621
- return Object.keys(this.$attrs).concat([["id", this.id], ["class", this.controlClasses]]).reduce((carry, key) => {
622
- if (Array.isArray(key)) {
623
- carry[key[0]] = key[1];
624
- } else {
625
- carry[key] = this[key] || this.$attrs[key];
626
- }
627
- return carry;
628
- }, {});
326
+ return Object.fromEntries(Object.entries(this.$attrs).concat([["id", this.id], ["class", this.controlClasses]]));
629
327
  },
630
328
  controlClass() {
631
329
  return this.defaultControlClass;
632
330
  },
633
331
  controlSizeClass() {
634
- return prefix(this.size, this.controlClass);
332
+ return $(this.size, this.controlClass);
635
333
  },
636
334
  formGroupClasses() {
637
335
  return {
638
- [paramCase(this.componentName)]: !!this.componentName,
639
- [this.size && prefix(this.size, this.componentName)]: !!this.size,
640
- "animated": this.animated,
336
+ [B(this.componentName)]: !!this.componentName,
337
+ [this.size && $(this.size, this.componentName)]: !!this.size,
338
+ animated: this.animated,
641
339
  "default-empty": this.defaultEmpty,
642
340
  "form-group": this.group,
643
- [this.size && prefix(this.size, "form-group")]: !!this.size,
341
+ [this.size && $(this.size, "form-group")]: !!this.size,
644
342
  "has-activity": this.activity,
645
343
  "has-changed": this.hasChanged,
646
344
  "has-focus": this.hasFocus,
647
345
  "has-icon": !!this.$slots.icon,
648
346
  "is-empty": this.isEmpty,
649
347
  "is-invalid": !!(this.invalid || this.invalidFeedback),
650
- "is-valid": !!(this.valid || this.validFeedback)
348
+ "is-valid": !!(this.valid || this.validFeedback),
349
+ [this.$attrs.class]: !!this.$attrs.class,
350
+ [this.$attrs.id]: !!this.$attrs.id
651
351
  };
652
352
  },
653
353
  controlClasses() {
@@ -666,16 +366,12 @@ var FormControl = {
666
366
  return !!this.$slots.default;
667
367
  },
668
368
  invalidFeedback() {
669
- if (this.error === "") {
369
+ if (this.error === "")
670
370
  return null;
671
- }
672
- if (this.error) {
371
+ if (this.error)
673
372
  return this.error;
674
- }
675
- const errors = this.getFieldErrors();
676
- return Array.isArray(errors) ? errors.filter((error) => {
677
- return error && typeof error === "string";
678
- }).join("<br>") : errors;
373
+ const e = this.getFieldErrors();
374
+ return Array.isArray(e) ? e.filter((t) => t && typeof t == "string").join("<br>") : e;
679
375
  },
680
376
  pillClasses() {
681
377
  return "rounded rounded-pill";
@@ -689,81 +385,56 @@ var FormControl = {
689
385
  },
690
386
  watch: {
691
387
  hasFocus() {
692
- if (this.shouldChangeOnFocus()) {
693
- this.hasChanged = true;
694
- }
695
- },
696
- value(value) {
697
- this.currentValue = value;
698
- },
699
- currentValue() {
700
- this.hasChanged = true;
388
+ this.shouldChangeOnFocus() && (this.hasChanged = !0);
701
389
  },
702
390
  defaultEmpty() {
703
- this.hasChanged = true;
704
- }
705
- },
706
- mounted() {
707
- if (this.value === null && this.defaultValue !== null) {
708
- this.$emit("input", this.defaultValue);
391
+ this.hasChanged = !0;
709
392
  }
710
393
  },
711
394
  methods: {
395
+ bindEvents(e, t) {
396
+ t || (t = this.onInput);
397
+ const i = e.querySelectorAll("option")[e.selectedIndex];
398
+ z(this.modelValue) ? z(i) || (e.value = i.value) : e.value = this.modelValue, e.value && t(e.value), this.hasChanged = !!e.value, this.isEmpty = !e.value, e.addEventListener("focus", () => {
399
+ this.hasFocus = !0;
400
+ }), e.addEventListener("blur", () => {
401
+ this.hasFocus = !1;
402
+ }), e.addEventListener("input", (s) => {
403
+ this.isEmpty = !1, this.hasChanged = !0;
404
+ }), e.addEventListener(e.tagName === "SELECT" ? "change" : "input", () => t(e.value)), this.nativeEvents.forEach((s) => {
405
+ e.addEventListener(s, (r) => {
406
+ this.$emit(s, r);
407
+ });
408
+ });
409
+ },
712
410
  blur() {
713
- if (this.getInputField()) {
714
- this.getInputField().blur();
715
- }
411
+ this.getInputField() && this.getInputField().blur();
716
412
  },
717
413
  focus() {
718
- if (this.getInputField()) {
719
- this.getInputField().focus();
720
- }
414
+ this.getInputField() && this.getInputField().focus();
721
415
  },
722
416
  getInputField() {
723
417
  return this.$el.querySelector(".form-control, input, select, textarea");
724
418
  },
725
419
  getFieldErrors() {
726
- let errors = this.error || this.errors;
727
- if (this.errors && isObject(this.errors)) {
728
- errors = this.errors[this.$attrs.name || this.$attrs.id];
729
- }
730
- return !errors || Array.isArray(errors) || isObject(errors) ? errors : [errors];
420
+ let e = this.error || this.errors;
421
+ return this.errors && k(this.errors) && (e = this.errors[this.$attrs.name || this.$attrs.id]), !e || Array.isArray(e) || k(e) ? e : [e];
731
422
  },
732
423
  shouldChangeOnFocus() {
733
424
  return !this.getInputField().readOnly;
734
425
  },
735
426
  onInput(e) {
736
- this.$emit("input", e.target.value);
737
- this.$emit("update:value", e.target.value);
427
+ this.$emit("update:modelValue", e);
738
428
  }
739
429
  }
740
430
  };
741
- var render = function() {
742
- var _vm = this;
743
- var _h = _vm.$createElement;
744
- var _c = _vm._self._c || _h;
745
- return _c("div", { class: _vm.formGroupClasses }, [_vm._t("label", function() {
746
- return [_vm.label ? _c("label", { ref: "label", class: _vm.labelClass, attrs: { "for": _vm.id }, domProps: { "innerHTML": _vm._s(_vm.label) }, on: { "click": _vm.focus } }) : _vm._e()];
747
- }), _c("div", { staticClass: "form-group-inner" }, [_vm._t("control", function() {
748
- var _obj;
749
- return [_vm.$slots.icon ? _c("div", { staticClass: "form-group-inner-icon", on: { "click": _vm.focus } }, [_vm._t("icon")], 2) : _vm._e(), _c("select", _vm._b({ directives: [{ name: "bind-events", rawName: "v-bind-events" }], ref: "field", domProps: { "value": _vm.currentValue }, on: { "input": _vm.onInput } }, "select", Object.assign((_obj = {}, _obj["disabled"] = _vm.$attrs.readonly, _obj), _vm.controlAttributes), false), [_vm._t("default")], 2)];
750
- }), _vm._t("activity", function() {
751
- return [_c("transition", { attrs: { "name": "select-field-fade" } }, [_vm.activity ? _c("activity-indicator", { key: "activity", ref: "activity", attrs: { "type": _vm.indicator, "size": _vm.indicatorSize || _vm.size } }) : _vm._e()], 1)];
752
- })], 2), _vm._t("feedback", function() {
753
- return [_vm.invalidFeedback ? _c("div", { staticClass: "invalid-feedback", attrs: { "invalid": "" }, domProps: { "innerHTML": _vm._s(_vm.invalidFeedback) } }) : _vm.validFeedback ? _c("div", { staticClass: "valid-feedback", attrs: { "valid": "" }, domProps: { "innerHTML": _vm._s(_vm.validFeedback) } }) : _vm._e()];
754
- }), _vm._t("help", function() {
755
- return [_vm.helpText ? _c("small", { ref: "help" }, [_vm._v(" " + _vm._s(_vm.helpText) + " ")]) : _vm._e()];
756
- })], 2);
757
- };
758
- var staticRenderFns = [];
759
- var SelectField_vue_vue_type_style_index_0_lang = "";
760
- const __vue2_script = {
431
+ const de = {
761
432
  name: "SelectField",
762
433
  components: {
763
- ActivityIndicator
434
+ ActivityIndicator: te
764
435
  },
765
436
  mixins: [
766
- FormControl
437
+ le
767
438
  ],
768
439
  props: {
769
440
  defaultControlClass: {
@@ -777,27 +448,85 @@ const __vue2_script = {
777
448
  }
778
449
  },
779
450
  mounted() {
780
- const selected = this.$el.querySelector("[selected]");
781
- if (selected) {
782
- this.currentValue = selected.value;
783
- this.$emit("input", this.currentValue);
784
- this.$emit("update:value", this.currentValue);
785
- }
786
451
  },
787
452
  methods: {
788
453
  shouldChangeOnFocus() {
789
- return false;
454
+ return !1;
790
455
  }
791
456
  }
792
- };
793
- const __cssModules = {};
794
- var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
795
- function __vue2_injectStyles(context) {
796
- for (let o in __cssModules) {
797
- this[o] = __cssModules[o];
798
- }
457
+ }, ue = ["for", "innerHTML"], ce = { class: "form-group-inner" }, he = ["innerHTML"], fe = ["innerHTML"];
458
+ function pe(e, t, i, s, r, n) {
459
+ const u = R("activity-indicator"), g = I("bind-events");
460
+ return a(), d("div", {
461
+ class: w(e.formGroupClasses)
462
+ }, [
463
+ f(e.$slots, "label", {}, () => [
464
+ e.label ? (a(), d("label", {
465
+ key: 0,
466
+ ref: "label",
467
+ for: e.id,
468
+ class: w(e.labelClass),
469
+ onClick: t[0] || (t[0] = (...o) => e.focus && e.focus(...o)),
470
+ innerHTML: e.label
471
+ }, null, 10, ue)) : p("", !0)
472
+ ]),
473
+ x("div", ce, [
474
+ f(e.$slots, "control", {
475
+ bindEvents: e.bindEvents,
476
+ controlAttributes: e.controlAttributes,
477
+ focus: e.focus
478
+ }, () => [
479
+ e.$slots.icon ? (a(), d("div", {
480
+ key: 0,
481
+ class: "form-group-inner-icon",
482
+ onClick: t[1] || (t[1] = (...o) => e.focus && e.focus(...o))
483
+ }, [
484
+ f(e.$slots, "icon")
485
+ ])) : p("", !0),
486
+ H((a(), d("select", D({ ref: "field" }, Object.assign({
487
+ disabled: e.$attrs.readonly
488
+ }, e.controlAttributes)), [
489
+ f(e.$slots, "default")
490
+ ], 16)), [
491
+ [g]
492
+ ])
493
+ ]),
494
+ f(e.$slots, "activity", {}, () => [
495
+ M(Z, { name: "select-field-fade" }, {
496
+ default: G(() => [
497
+ e.activity ? (a(), O(u, {
498
+ key: "activity",
499
+ ref: "activity",
500
+ type: e.indicator,
501
+ size: e.indicatorSize || e.size
502
+ }, null, 8, ["type", "size"])) : p("", !0)
503
+ ]),
504
+ _: 1
505
+ })
506
+ ])
507
+ ]),
508
+ f(e.$slots, "feedback", {}, () => [
509
+ e.invalidFeedback ? (a(), d("div", {
510
+ key: 0,
511
+ class: "invalid-feedback",
512
+ invalid: "",
513
+ innerHTML: e.invalidFeedback
514
+ }, null, 8, he)) : e.validFeedback ? (a(), d("div", {
515
+ key: 1,
516
+ class: "valid-feedback",
517
+ valid: "",
518
+ innerHTML: e.validFeedback
519
+ }, null, 8, fe)) : p("", !0)
520
+ ]),
521
+ f(e.$slots, "help", {}, () => [
522
+ e.helpText ? (a(), d("small", {
523
+ key: 0,
524
+ ref: "help"
525
+ }, j(e.helpText), 513)) : p("", !0)
526
+ ])
527
+ ], 2);
799
528
  }
800
- var SelectField = /* @__PURE__ */ function() {
801
- return __component__.exports;
802
- }();
803
- export { SelectField };
529
+ const ge = /* @__PURE__ */ T(de, [["render", pe]]);
530
+ export {
531
+ ge as SelectField
532
+ };