@vue-interface/input-field 1.0.0-beta.11 → 1.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/input-field.js +52 -220
- package/dist/input-field.umd.cjs +1 -1
- package/dist/src/InputField.vue.d.ts +4 -4
- package/package.json +1 -1
package/dist/input-field.js
CHANGED
|
@@ -1,271 +1,103 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FormControl as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
for (var t, r = 1, i = arguments.length; r < i; r++) {
|
|
6
|
-
t = arguments[r];
|
|
7
|
-
for (var o in t)
|
|
8
|
-
Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
|
|
9
|
-
}
|
|
10
|
-
return e;
|
|
11
|
-
}, v.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
function L(e) {
|
|
14
|
-
return e.toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
var U = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], J = /[^A-Z0-9]+/gi;
|
|
17
|
-
function K(e, t) {
|
|
18
|
-
t === void 0 && (t = {});
|
|
19
|
-
for (var r = t.splitRegexp, i = r === void 0 ? U : r, o = t.stripRegexp, y = o === void 0 ? J : o, m = t.transform, b = m === void 0 ? L : m, f = t.delimiter, g = f === void 0 ? " " : f, n = N(N(e, i, "$1\0$2"), y, "\0"), $ = 0, k = n.length; n.charAt($) === "\0"; )
|
|
20
|
-
$++;
|
|
21
|
-
for (; n.charAt(k - 1) === "\0"; )
|
|
22
|
-
k--;
|
|
23
|
-
return n.slice($, k).split("\0").map(b).join(g);
|
|
24
|
-
}
|
|
25
|
-
function N(e, t, r) {
|
|
26
|
-
return t instanceof RegExp ? e.replace(t, r) : t.reduce(function(i, o) {
|
|
27
|
-
return i.replace(o, r);
|
|
28
|
-
}, e);
|
|
29
|
-
}
|
|
30
|
-
function Q(e, t) {
|
|
31
|
-
return t === void 0 && (t = {}), K(e, v({ delimiter: "." }, t));
|
|
32
|
-
}
|
|
33
|
-
function h(e, t) {
|
|
34
|
-
return t === void 0 && (t = {}), Q(e, v({ delimiter: "-" }, t));
|
|
35
|
-
}
|
|
36
|
-
class X {
|
|
37
|
-
constructor(t = {}) {
|
|
38
|
-
q(this, "components"), this.components = /* @__PURE__ */ new Map(), Object.entries(t).forEach(([r, i]) => {
|
|
39
|
-
this.register(r, i);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
get(t) {
|
|
43
|
-
const r = this.components.get(
|
|
44
|
-
t = h(t)
|
|
45
|
-
);
|
|
46
|
-
if (r)
|
|
47
|
-
return r;
|
|
48
|
-
throw new Error(`"${t}" has not been registered yet!`);
|
|
49
|
-
}
|
|
50
|
-
register(t, r) {
|
|
51
|
-
return typeof t == "object" ? (Object.entries(t).forEach(([i, o]) => {
|
|
52
|
-
this.register(h(i), o);
|
|
53
|
-
}), this) : (this.components.set(h(t), r), this);
|
|
54
|
-
}
|
|
55
|
-
remove(t) {
|
|
56
|
-
return this.components.delete(h(t)), this;
|
|
57
|
-
}
|
|
58
|
-
reset() {
|
|
59
|
-
return this.components = /* @__PURE__ */ new Map(), this;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function Y(e = {}) {
|
|
63
|
-
return new X(e);
|
|
64
|
-
}
|
|
65
|
-
const _ = Y();
|
|
66
|
-
function l(e, t = "px") {
|
|
67
|
-
return e != null && e !== !1 && isFinite(e) ? `${e}${t}` : e;
|
|
68
|
-
}
|
|
69
|
-
const x = j({
|
|
70
|
-
props: {
|
|
71
|
-
absolute: Boolean,
|
|
72
|
-
center: Boolean,
|
|
73
|
-
label: {
|
|
74
|
-
type: String,
|
|
75
|
-
default: void 0
|
|
76
|
-
},
|
|
77
|
-
size: {
|
|
78
|
-
type: String,
|
|
79
|
-
default: "md"
|
|
80
|
-
},
|
|
81
|
-
registry: {
|
|
82
|
-
type: String,
|
|
83
|
-
default: "indicators"
|
|
84
|
-
},
|
|
85
|
-
type: {
|
|
86
|
-
type: [Object, String],
|
|
87
|
-
required: !0
|
|
88
|
-
},
|
|
89
|
-
height: {
|
|
90
|
-
type: [String, Number],
|
|
91
|
-
default: void 0
|
|
92
|
-
},
|
|
93
|
-
maxHeight: {
|
|
94
|
-
type: [String, Number],
|
|
95
|
-
default: void 0
|
|
96
|
-
},
|
|
97
|
-
minHeight: {
|
|
98
|
-
type: [String, Number],
|
|
99
|
-
default: void 0
|
|
100
|
-
},
|
|
101
|
-
width: {
|
|
102
|
-
type: [String, Number],
|
|
103
|
-
default: void 0
|
|
104
|
-
},
|
|
105
|
-
maxWidth: {
|
|
106
|
-
type: [String, Number],
|
|
107
|
-
default: void 0
|
|
108
|
-
},
|
|
109
|
-
minWidth: {
|
|
110
|
-
type: [String, Number],
|
|
111
|
-
default: void 0
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
data: () => ({
|
|
115
|
-
is: null
|
|
116
|
-
}),
|
|
117
|
-
computed: {
|
|
118
|
-
classes() {
|
|
119
|
-
return {
|
|
120
|
-
"activity-indicator-center": this.center,
|
|
121
|
-
"activity-indicator-absolute": this.absolute,
|
|
122
|
-
[this.size && `activity-indicator-${this.size}`]: !!this.size
|
|
123
|
-
};
|
|
124
|
-
},
|
|
125
|
-
style() {
|
|
126
|
-
return {
|
|
127
|
-
width: l(this.width),
|
|
128
|
-
maxWidth: l(this.maxWidth),
|
|
129
|
-
minWidth: l(this.minWidth),
|
|
130
|
-
height: l(this.height),
|
|
131
|
-
maxHeight: l(this.maxHeight),
|
|
132
|
-
minHeight: l(this.minHeight)
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
// async mounted() {
|
|
137
|
-
// const component = await this.component();
|
|
138
|
-
// this.is = () => component;
|
|
139
|
-
// },
|
|
140
|
-
methods: {
|
|
141
|
-
componentFromRegistry(e) {
|
|
142
|
-
var t;
|
|
143
|
-
try {
|
|
144
|
-
return (t = O(this.registry || "indicators", _)) == null ? void 0 : t.get(e);
|
|
145
|
-
} catch {
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
component() {
|
|
149
|
-
return typeof this.type == "string" ? this.componentFromRegistry(this.type) : R(this.type);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}), ee = (e, t) => {
|
|
153
|
-
const r = e.__vccOpts || e;
|
|
154
|
-
for (const [i, o] of t)
|
|
155
|
-
r[i] = o;
|
|
156
|
-
return r;
|
|
157
|
-
}, te = { class: "activity-indicator-content" }, re = {
|
|
158
|
-
key: 0,
|
|
159
|
-
class: "activity-indicator-label"
|
|
160
|
-
};
|
|
161
|
-
function oe(e, t, r, i, o, y) {
|
|
162
|
-
return s(), c("div", {
|
|
163
|
-
class: F(["activity-indicator", e.classes]),
|
|
164
|
-
style: H(e.style)
|
|
165
|
-
}, [
|
|
166
|
-
u("div", te, [
|
|
167
|
-
(s(), E(W(e.component()), { class: "mx-auto" })),
|
|
168
|
-
e.label ? (s(), c("div", re, p(e.label), 1)) : d("", !0)
|
|
169
|
-
])
|
|
170
|
-
], 6);
|
|
171
|
-
}
|
|
172
|
-
const ie = /* @__PURE__ */ ee(x, [["render", oe]]), ne = j({
|
|
1
|
+
import { ActivityIndicator as g } from "@vue-interface/activity-indicator";
|
|
2
|
+
import { FormControl as z } from "@vue-interface/form-control";
|
|
3
|
+
import { defineComponent as E, resolveComponent as m, resolveDirective as V, openBlock as n, createElementBlock as l, normalizeClass as b, renderSlot as r, toDisplayString as a, createCommentVNode as s, createElementVNode as i, normalizeProps as p, guardReactiveProps as f, withDirectives as A, mergeProps as D, vModelDynamic as I, createVNode as k, Transition as N, withCtx as u, createBlock as y, createTextVNode as T } from "vue";
|
|
4
|
+
const B = E({
|
|
173
5
|
name: "InputField",
|
|
174
6
|
components: {
|
|
175
|
-
ActivityIndicator:
|
|
7
|
+
ActivityIndicator: g
|
|
176
8
|
},
|
|
177
|
-
extends:
|
|
9
|
+
extends: z
|
|
178
10
|
});
|
|
179
|
-
const
|
|
180
|
-
const
|
|
181
|
-
for (const [
|
|
182
|
-
|
|
183
|
-
return
|
|
184
|
-
},
|
|
11
|
+
const P = (e, t) => {
|
|
12
|
+
const d = e.__vccOpts || e;
|
|
13
|
+
for (const [c, v] of t)
|
|
14
|
+
d[c] = v;
|
|
15
|
+
return d;
|
|
16
|
+
}, S = ["for"], w = { class: "form-group-inner" }, G = {
|
|
185
17
|
invalid: "",
|
|
186
18
|
class: "invalid-feedback"
|
|
187
|
-
},
|
|
19
|
+
}, M = /* @__PURE__ */ i("br", null, null, -1), O = {
|
|
188
20
|
valid: "",
|
|
189
21
|
class: "valid-feedback"
|
|
190
22
|
};
|
|
191
|
-
function
|
|
192
|
-
const
|
|
193
|
-
return
|
|
194
|
-
class:
|
|
23
|
+
function R(e, t, d, c, v, U) {
|
|
24
|
+
const $ = m("activity-indicator"), C = m("FormControlErrors"), F = m("FormControlFeedback"), h = V("bind-events");
|
|
25
|
+
return n(), l("div", {
|
|
26
|
+
class: b(["input-field", e.formGroupClasses])
|
|
195
27
|
}, [
|
|
196
|
-
|
|
197
|
-
e.label ? (
|
|
28
|
+
r(e.$slots, "label", {}, () => [
|
|
29
|
+
e.label ? (n(), l("label", {
|
|
198
30
|
key: 0,
|
|
199
31
|
ref: "label",
|
|
200
|
-
class:
|
|
32
|
+
class: b(e.labelClass),
|
|
201
33
|
for: e.id
|
|
202
|
-
},
|
|
34
|
+
}, a(e.label), 11, S)) : s("", !0)
|
|
203
35
|
]),
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
e.$slots.icon ? (
|
|
36
|
+
i("div", w, [
|
|
37
|
+
r(e.$slots, "control", p(f({ bindEvents: e.bindEvents, controlAttributes: e.controlAttributes })), () => [
|
|
38
|
+
e.$slots.icon ? (n(), l("div", {
|
|
207
39
|
key: 0,
|
|
208
40
|
class: "form-group-inner-icon",
|
|
209
|
-
onClick: t[0] || (t[0] = (...
|
|
41
|
+
onClick: t[0] || (t[0] = (...o) => e.focus && e.focus(...o))
|
|
210
42
|
}, [
|
|
211
|
-
|
|
212
|
-
])) :
|
|
213
|
-
|
|
43
|
+
r(e.$slots, "icon")
|
|
44
|
+
])) : s("", !0),
|
|
45
|
+
A(i("input", D({
|
|
214
46
|
ref: "field",
|
|
215
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
47
|
+
"onUpdate:modelValue": t[1] || (t[1] = (o) => e.model = o)
|
|
216
48
|
}, e.controlAttributes), null, 16), [
|
|
217
|
-
[
|
|
218
|
-
[
|
|
49
|
+
[I, e.model],
|
|
50
|
+
[h]
|
|
219
51
|
])
|
|
220
52
|
]),
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
default:
|
|
224
|
-
e.activity ? (
|
|
53
|
+
r(e.$slots, "activity", {}, () => [
|
|
54
|
+
k(N, { name: "input-field-fade" }, {
|
|
55
|
+
default: u(() => [
|
|
56
|
+
e.activity ? (n(), y($, {
|
|
225
57
|
key: "activity",
|
|
226
58
|
ref: "activity",
|
|
227
59
|
type: e.indicator,
|
|
228
60
|
size: e.indicatorSize || e.size
|
|
229
|
-
}, null, 8, ["type", "size"])) :
|
|
61
|
+
}, null, 8, ["type", "size"])) : s("", !0)
|
|
230
62
|
]),
|
|
231
63
|
_: 1
|
|
232
64
|
})
|
|
233
65
|
])
|
|
234
66
|
]),
|
|
235
|
-
|
|
236
|
-
e.error || e.errors ? (
|
|
67
|
+
r(e.$slots, "errors", p(f({ error: e.error, errors: e.errors, id: e.$attrs.id, name: e.$attrs.name })), () => [
|
|
68
|
+
e.error || e.errors ? (n(), y(C, {
|
|
237
69
|
key: 0,
|
|
238
70
|
id: e.$attrs.id,
|
|
239
71
|
name: e.$attrs.name,
|
|
240
72
|
error: e.error,
|
|
241
73
|
errors: e.errors
|
|
242
74
|
}, {
|
|
243
|
-
default:
|
|
244
|
-
|
|
245
|
-
T(
|
|
246
|
-
|
|
75
|
+
default: u(({ error: o }) => [
|
|
76
|
+
i("div", G, [
|
|
77
|
+
T(a(o), 1),
|
|
78
|
+
M
|
|
247
79
|
])
|
|
248
80
|
]),
|
|
249
81
|
_: 1
|
|
250
|
-
}, 8, ["id", "name", "error", "errors"])) :
|
|
82
|
+
}, 8, ["id", "name", "error", "errors"])) : s("", !0)
|
|
251
83
|
]),
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
default:
|
|
255
|
-
|
|
84
|
+
r(e.$slots, "feedback", p(f({ feedback: e.feedback })), () => [
|
|
85
|
+
k(F, { feedback: e.feedback }, {
|
|
86
|
+
default: u(({ feedback: o }) => [
|
|
87
|
+
i("div", O, a(o), 1)
|
|
256
88
|
]),
|
|
257
89
|
_: 1
|
|
258
90
|
}, 8, ["feedback"])
|
|
259
91
|
]),
|
|
260
|
-
|
|
261
|
-
e.helpText ? (
|
|
92
|
+
r(e.$slots, "help", {}, () => [
|
|
93
|
+
e.helpText ? (n(), l("small", {
|
|
262
94
|
key: 0,
|
|
263
95
|
ref: "help"
|
|
264
|
-
},
|
|
96
|
+
}, a(e.helpText), 513)) : s("", !0)
|
|
265
97
|
])
|
|
266
98
|
], 2);
|
|
267
99
|
}
|
|
268
|
-
const
|
|
100
|
+
const J = /* @__PURE__ */ P(B, [["render", R]]);
|
|
269
101
|
export {
|
|
270
|
-
|
|
102
|
+
J as InputField
|
|
271
103
|
};
|
package/dist/input-field.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(r,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("@vue-interface/activity-indicator"),require("@vue-interface/form-control"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@vue-interface/activity-indicator","@vue-interface/form-control","vue"],i):(r=typeof globalThis<"u"?globalThis:r||self,i(r.InputField={},r.ActivityIndicator,r.FormControl,r.Vue))})(this,function(r,i,d,e){"use strict";const c=e.defineComponent({name:"InputField",components:{ActivityIndicator:i.ActivityIndicator},extends:d.FormControl}),F="",m=(o,n)=>{const l=o.__vccOpts||o;for(const[s,a]of n)l[s]=a;return l},p=["for"],f={class:"form-group-inner"},y={invalid:"",class:"invalid-feedback"},k=e.createElementVNode("br",null,null,-1),b={valid:"",class:"valid-feedback"};function C(o,n,l,s,a,N){const V=e.resolveComponent("activity-indicator"),S=e.resolveComponent("FormControlErrors"),h=e.resolveComponent("FormControlFeedback"),E=e.resolveDirective("bind-events");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-field",o.formGroupClasses])},[e.renderSlot(o.$slots,"label",{},()=>[o.label?(e.openBlock(),e.createElementBlock("label",{key:0,ref:"label",class:e.normalizeClass(o.labelClass),for:o.id},e.toDisplayString(o.label),11,p)):e.createCommentVNode("",!0)]),e.createElementVNode("div",f,[e.renderSlot(o.$slots,"control",e.normalizeProps(e.guardReactiveProps({bindEvents:o.bindEvents,controlAttributes:o.controlAttributes})),()=>[o.$slots.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-group-inner-icon",onClick:n[0]||(n[0]=(...t)=>o.focus&&o.focus(...t))},[e.renderSlot(o.$slots,"icon")])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({ref:"field","onUpdate:modelValue":n[1]||(n[1]=t=>o.model=t)},o.controlAttributes),null,16),[[e.vModelDynamic,o.model],[E]])]),e.renderSlot(o.$slots,"activity",{},()=>[e.createVNode(e.Transition,{name:"input-field-fade"},{default:e.withCtx(()=>[o.activity?(e.openBlock(),e.createBlock(V,{key:"activity",ref:"activity",type:o.indicator,size:o.indicatorSize||o.size},null,8,["type","size"])):e.createCommentVNode("",!0)]),_:1})])]),e.renderSlot(o.$slots,"errors",e.normalizeProps(e.guardReactiveProps({error:o.error,errors:o.errors,id:o.$attrs.id,name:o.$attrs.name})),()=>[o.error||o.errors?(e.openBlock(),e.createBlock(S,{key:0,id:o.$attrs.id,name:o.$attrs.name,error:o.error,errors:o.errors},{default:e.withCtx(({error:t})=>[e.createElementVNode("div",y,[e.createTextVNode(e.toDisplayString(t),1),k])]),_:1},8,["id","name","error","errors"])):e.createCommentVNode("",!0)]),e.renderSlot(o.$slots,"feedback",e.normalizeProps(e.guardReactiveProps({feedback:o.feedback})),()=>[e.createVNode(h,{feedback:o.feedback},{default:e.withCtx(({feedback:t})=>[e.createElementVNode("div",b,e.toDisplayString(t),1)]),_:1},8,["feedback"])]),e.renderSlot(o.$slots,"help",{},()=>[o.helpText?(e.openBlock(),e.createElementBlock("small",{key:0,ref:"help"},e.toDisplayString(o.helpText),513)):e.createCommentVNode("",!0)])],2)}const $=m(c,[["render",C]]);r.InputField=$,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -17,7 +17,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
|
|
|
17
17
|
};
|
|
18
18
|
errors: {
|
|
19
19
|
type: (BooleanConstructor | ObjectConstructor | ArrayConstructor)[];
|
|
20
|
-
default
|
|
20
|
+
default: undefined;
|
|
21
21
|
};
|
|
22
22
|
feedback: {
|
|
23
23
|
type: (StringConstructor | ArrayConstructor)[];
|
|
@@ -54,7 +54,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
|
|
|
54
54
|
};
|
|
55
55
|
modelValue: {
|
|
56
56
|
type: (BooleanConstructor | StringConstructor | ObjectConstructor | NumberConstructor | ArrayConstructor)[];
|
|
57
|
-
default: undefined;
|
|
57
|
+
default: () => undefined;
|
|
58
58
|
};
|
|
59
59
|
plaintext: BooleanConstructor;
|
|
60
60
|
size: {
|
|
@@ -165,7 +165,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
|
|
|
165
165
|
};
|
|
166
166
|
errors: {
|
|
167
167
|
type: (BooleanConstructor | ObjectConstructor | ArrayConstructor)[];
|
|
168
|
-
default
|
|
168
|
+
default: undefined;
|
|
169
169
|
};
|
|
170
170
|
feedback: {
|
|
171
171
|
type: (StringConstructor | ArrayConstructor)[];
|
|
@@ -202,7 +202,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {}, {}, {}, {}, impor
|
|
|
202
202
|
};
|
|
203
203
|
modelValue: {
|
|
204
204
|
type: (BooleanConstructor | StringConstructor | ObjectConstructor | NumberConstructor | ArrayConstructor)[];
|
|
205
|
-
default: undefined;
|
|
205
|
+
default: () => undefined;
|
|
206
206
|
};
|
|
207
207
|
plaintext: BooleanConstructor;
|
|
208
208
|
size: {
|