@vue-interface/select-field 0.11.1 → 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);
79
+ }
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;
312
89
  }
313
- const __vue2_script$1 = {
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);
166
+ }
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);
378
176
  }
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 = {
177
+ var ie = {
397
178
  props: {
398
179
  dropShadow: [Boolean, String],
399
180
  dropShadowableClassPrefix: {
@@ -408,144 +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
- function prefix(key, value, delimeter = "-") {
489
- const string = value.toString().replace(new RegExp(`^${key}${delimeter}?`), "");
490
- return [paramCase(string), key].filter((value2) => !!value2).join(delimeter);
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);
491
239
  }
492
- function isObject(subject) {
493
- return !Array.isArray(subject) && typeof subject === "object";
240
+ function k(e) {
241
+ return !Array.isArray(e) && typeof e == "object";
494
242
  }
495
- var FormControl = {
243
+ function z(e) {
244
+ return e === void 0;
245
+ }
246
+ const le = {
496
247
  directives: {
497
248
  bindEvents: {
498
- bind(el, binding, vnode) {
499
- el.addEventListener("focus", () => {
500
- vnode.context.hasFocus = true;
501
- });
502
- el.addEventListener("blur", () => {
503
- vnode.context.hasFocus = false;
504
- });
505
- el.addEventListener(el.tagName === "SELECT" ? "change" : "input", (e) => {
506
- vnode.context.isEmpty = !el.value;
507
- vnode.context.currentValue = el.value;
508
- });
509
- vnode.context.hasChanged = !!el.value;
510
- vnode.context.bindEvents.forEach((name) => {
511
- el.addEventListener(name, (event) => {
512
- vnode.context.$emit(name, event);
513
- });
514
- });
515
- if (el.tagName === "SELECT") {
516
- const opt = el.querySelector('[value=""]');
517
- if (opt && opt.value === el.value) {
518
- vnode.context.defaultEmpty = true;
519
- }
520
- }
249
+ beforeMount(e, t, i) {
250
+ t.instance.bindEvents(e);
521
251
  }
522
252
  }
523
253
  },
524
- mixins: [Shadowable],
525
- inheritAttrs: false,
254
+ mixins: [ie],
255
+ inheritAttrs: !1,
526
256
  props: {
527
257
  activity: {
528
258
  type: Boolean,
529
- default: false
259
+ default: !1
530
260
  },
531
- bindEvents: {
261
+ animated: {
262
+ type: Boolean,
263
+ default: () => _("animated", !1)
264
+ },
265
+ nativeEvents: {
532
266
  type: Array,
533
267
  default() {
534
268
  return ["focus", "blur", "change", "click", "keypress", "keyup", "keydown", "progress", "paste"];
535
269
  }
536
270
  },
537
- componentName: {
538
- type: String,
539
- default() {
540
- return this.$options.name;
541
- }
542
- },
543
271
  defaultControlClass: {
544
272
  type: String,
545
- default: "form-control"
546
- },
547
- defaultValue: {
548
- default: null
273
+ default: () => _("defaultControlClass", "form-control")
549
274
  },
550
275
  error: [String, Array, Boolean],
551
276
  errors: {
@@ -557,13 +282,13 @@ var FormControl = {
557
282
  feedback: [String, Array],
558
283
  group: {
559
284
  type: Boolean,
560
- default: true
285
+ default: () => _("group", !0)
561
286
  },
562
287
  helpText: [Number, String],
563
288
  hideLabel: Boolean,
564
289
  indicator: {
565
290
  type: String,
566
- default: "spinner"
291
+ default: () => _("indicator", "spinner")
567
292
  },
568
293
  indicatorSize: String,
569
294
  inline: Boolean,
@@ -571,60 +296,58 @@ var FormControl = {
571
296
  label: [Number, String],
572
297
  labelClass: {
573
298
  type: [Object, String],
574
- default: "form-label"
299
+ default: () => _("labelClass", "form-label")
300
+ },
301
+ modelValue: {
302
+ default: void 0
575
303
  },
576
304
  pill: Boolean,
577
305
  plaintext: Boolean,
578
306
  size: String,
579
307
  spacing: String,
580
- valid: Boolean,
581
- value: {
582
- default: null
583
- }
308
+ valid: Boolean
584
309
  },
585
310
  data() {
586
311
  return {
587
- currentValue: this.value || this.defaultValue,
588
- defaultEmpty: false,
589
- hasChanged: false,
590
- hasFocus: false,
591
- isEmpty: !(this.value || this.defaultValue)
312
+ defaultEmpty: !1,
313
+ hasChanged: !1,
314
+ hasFocus: !1,
315
+ isEmpty: !0
592
316
  };
593
317
  },
594
318
  computed: {
595
319
  id() {
596
- 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;
597
324
  },
598
325
  controlAttributes() {
599
- return Object.keys(this.$attrs).concat([["id", this.id], ["class", this.controlClasses]]).reduce((carry, key) => {
600
- if (Array.isArray(key)) {
601
- carry[key[0]] = key[1];
602
- } else {
603
- carry[key] = this[key] || this.$attrs[key];
604
- }
605
- return carry;
606
- }, {});
326
+ return Object.fromEntries(Object.entries(this.$attrs).concat([["id", this.id], ["class", this.controlClasses]]));
607
327
  },
608
328
  controlClass() {
609
329
  return this.defaultControlClass;
610
330
  },
611
331
  controlSizeClass() {
612
- return prefix(this.size, this.controlClass);
332
+ return $(this.size, this.controlClass);
613
333
  },
614
334
  formGroupClasses() {
615
335
  return {
616
- [paramCase(this.componentName)]: !!this.componentName,
617
- [this.size && prefix(this.size, this.componentName)]: !!this.size,
336
+ [B(this.componentName)]: !!this.componentName,
337
+ [this.size && $(this.size, this.componentName)]: !!this.size,
338
+ animated: this.animated,
618
339
  "default-empty": this.defaultEmpty,
619
340
  "form-group": this.group,
620
- [this.size && prefix(this.size, "form-group")]: !!this.size,
341
+ [this.size && $(this.size, "form-group")]: !!this.size,
621
342
  "has-activity": this.activity,
622
343
  "has-changed": this.hasChanged,
623
344
  "has-focus": this.hasFocus,
624
345
  "has-icon": !!this.$slots.icon,
625
346
  "is-empty": this.isEmpty,
626
347
  "is-invalid": !!(this.invalid || this.invalidFeedback),
627
- "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
628
351
  };
629
352
  },
630
353
  controlClasses() {
@@ -643,16 +366,12 @@ var FormControl = {
643
366
  return !!this.$slots.default;
644
367
  },
645
368
  invalidFeedback() {
646
- if (this.error === "") {
369
+ if (this.error === "")
647
370
  return null;
648
- }
649
- if (this.error) {
371
+ if (this.error)
650
372
  return this.error;
651
- }
652
- const errors = this.getFieldErrors();
653
- return Array.isArray(errors) ? errors.filter((error) => {
654
- return error && typeof error === "string";
655
- }).join("<br>") : errors;
373
+ const e = this.getFieldErrors();
374
+ return Array.isArray(e) ? e.filter((t) => t && typeof t == "string").join("<br>") : e;
656
375
  },
657
376
  pillClasses() {
658
377
  return "rounded rounded-pill";
@@ -666,81 +385,56 @@ var FormControl = {
666
385
  },
667
386
  watch: {
668
387
  hasFocus() {
669
- if (this.shouldChangeOnFocus()) {
670
- this.hasChanged = true;
671
- }
672
- },
673
- value(value) {
674
- this.currentValue = value;
675
- },
676
- currentValue() {
677
- this.hasChanged = true;
388
+ this.shouldChangeOnFocus() && (this.hasChanged = !0);
678
389
  },
679
390
  defaultEmpty() {
680
- this.hasChanged = true;
681
- }
682
- },
683
- mounted() {
684
- if (this.value === null && this.defaultValue !== null) {
685
- this.$emit("input", this.defaultValue);
391
+ this.hasChanged = !0;
686
392
  }
687
393
  },
688
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
+ },
689
410
  blur() {
690
- if (this.getInputField()) {
691
- this.getInputField().blur();
692
- }
411
+ this.getInputField() && this.getInputField().blur();
693
412
  },
694
413
  focus() {
695
- if (this.getInputField()) {
696
- this.getInputField().focus();
697
- }
414
+ this.getInputField() && this.getInputField().focus();
698
415
  },
699
416
  getInputField() {
700
417
  return this.$el.querySelector(".form-control, input, select, textarea");
701
418
  },
702
419
  getFieldErrors() {
703
- let errors = this.error || this.errors;
704
- if (isObject(this.errors)) {
705
- errors = this.errors[this.$attrs.name || this.$attrs.id];
706
- }
707
- 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];
708
422
  },
709
423
  shouldChangeOnFocus() {
710
424
  return !this.getInputField().readOnly;
711
425
  },
712
426
  onInput(e) {
713
- this.$emit("input", e.target.value);
714
- this.$emit("update:value", e.target.value);
427
+ this.$emit("update:modelValue", e);
715
428
  }
716
429
  }
717
430
  };
718
- var render = function() {
719
- var _vm = this;
720
- var _h = _vm.$createElement;
721
- var _c = _vm._self._c || _h;
722
- return _c("div", { class: _vm.formGroupClasses }, [_vm._t("label", function() {
723
- 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()];
724
- }), _c("div", { staticClass: "form-group-inner" }, [_vm._t("control", function() {
725
- var _obj;
726
- 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)];
727
- }), _vm._t("activity", function() {
728
- 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)];
729
- })], 2), _vm._t("feedback", function() {
730
- 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()];
731
- }), _vm._t("help", function() {
732
- return [_vm.helpText ? _c("small", { ref: "help" }, [_vm._v(" " + _vm._s(_vm.helpText) + " ")]) : _vm._e()];
733
- })], 2);
734
- };
735
- var staticRenderFns = [];
736
- var SelectField_vue_vue_type_style_index_0_lang = "";
737
- const __vue2_script = {
431
+ const de = {
738
432
  name: "SelectField",
739
433
  components: {
740
- ActivityIndicator
434
+ ActivityIndicator: te
741
435
  },
742
436
  mixins: [
743
- FormControl
437
+ le
744
438
  ],
745
439
  props: {
746
440
  defaultControlClass: {
@@ -754,27 +448,85 @@ const __vue2_script = {
754
448
  }
755
449
  },
756
450
  mounted() {
757
- const selected = this.$el.querySelector("[selected]");
758
- if (selected) {
759
- this.currentValue = selected.value;
760
- this.$emit("input", this.currentValue);
761
- this.$emit("update:value", this.currentValue);
762
- }
763
451
  },
764
452
  methods: {
765
453
  shouldChangeOnFocus() {
766
- return false;
454
+ return !1;
767
455
  }
768
456
  }
769
- };
770
- const __cssModules = {};
771
- var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
772
- function __vue2_injectStyles(context) {
773
- for (let o in __cssModules) {
774
- this[o] = __cssModules[o];
775
- }
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);
776
528
  }
777
- var SelectField = /* @__PURE__ */ function() {
778
- return __component__.exports;
779
- }();
780
- export { SelectField };
529
+ const ge = /* @__PURE__ */ T(de, [["render", pe]]);
530
+ export {
531
+ ge as SelectField
532
+ };