@volverjs/ui-vue 0.0.10-beta.50 → 0.0.10-beta.51
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/components/VvCombobox/VvCombobox.es.js +450 -438
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +3 -1
- package/dist/components/VvCombobox/index.d.ts +8 -0
- package/dist/components/VvInputText/VvInputText.es.js +11 -4
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +8 -8
- package/dist/components/VvInputText/index.d.ts +4 -4
- package/dist/components/VvTextarea/VvTextarea.es.js +544 -530
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +8 -8
- package/dist/components/VvTextarea/index.d.ts +4 -4
- package/dist/components/index.es.js +217 -199
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +17 -11
- package/package.json +1 -1
- package/src/assets/icons/detailed.json +1 -1
- package/src/assets/icons/normal.json +1 -1
- package/src/assets/icons/simple.json +1 -1
- package/src/components/VvCombobox/VvCombobox.vue +4 -2
- package/src/components/VvCombobox/index.ts +2 -0
- package/src/components/VvInputText/VvInputText.vue +1 -0
- package/src/components/VvTextarea/VvTextarea.vue +2 -2
- package/src/props/index.ts +12 -5
|
@@ -1,6 +1,134 @@
|
|
|
1
|
-
import { unref, computed, isRef, defineComponent, h, inject, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, useId, watch, useSlots, createElementBlock, normalizeClass, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withDirectives, vModelText,
|
|
1
|
+
import { unref, computed, isRef, defineComponent, h, inject, mergeDefaults, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, useId, watch, useSlots, createElementBlock, normalizeClass, createTextVNode, toDisplayString, createElementVNode, renderSlot, normalizeProps, guardReactiveProps, withDirectives, vModelText, createVNode, createSlots, withCtx } from "vue";
|
|
2
2
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { useFocus, useElementVisibility } from "@vueuse/core";
|
|
4
|
+
function isEmpty(value) {
|
|
5
|
+
return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
|
|
6
|
+
}
|
|
7
|
+
function isString(value) {
|
|
8
|
+
return typeof value === "string" || value instanceof String;
|
|
9
|
+
}
|
|
10
|
+
function joinLines(items) {
|
|
11
|
+
if (Array.isArray(items)) {
|
|
12
|
+
return items.filter((item) => isString(item)).join(" ");
|
|
13
|
+
}
|
|
14
|
+
return items;
|
|
15
|
+
}
|
|
16
|
+
function HintSlotFactory(propsOrRef, slots) {
|
|
17
|
+
const props = computed(() => {
|
|
18
|
+
if (isRef(propsOrRef)) {
|
|
19
|
+
return propsOrRef.value;
|
|
20
|
+
}
|
|
21
|
+
return propsOrRef;
|
|
22
|
+
});
|
|
23
|
+
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
24
|
+
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
25
|
+
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
26
|
+
const hintLabel = computed(() => props.value.hintLabel);
|
|
27
|
+
const hasLoadingLabelOrSlot = computed(
|
|
28
|
+
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
29
|
+
);
|
|
30
|
+
const hasInvalidLabelOrSlot = computed(
|
|
31
|
+
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
32
|
+
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
const hasValidLabelOrSlot = computed(
|
|
36
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
37
|
+
);
|
|
38
|
+
const hasHintLabelOrSlot = computed(
|
|
39
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
40
|
+
);
|
|
41
|
+
const isVisible = computed(
|
|
42
|
+
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
43
|
+
);
|
|
44
|
+
const hintSlotScope = computed(() => ({
|
|
45
|
+
modelValue: props.value.modelValue,
|
|
46
|
+
valid: props.value.valid,
|
|
47
|
+
invalid: props.value.invalid,
|
|
48
|
+
loading: props.value.loading
|
|
49
|
+
}));
|
|
50
|
+
const HintSlot = defineComponent({
|
|
51
|
+
name: "HintSlot",
|
|
52
|
+
props: {
|
|
53
|
+
tag: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "small"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
setup() {
|
|
59
|
+
return {
|
|
60
|
+
isVisible,
|
|
61
|
+
invalidLabel,
|
|
62
|
+
validLabel,
|
|
63
|
+
loadingLabel,
|
|
64
|
+
hintLabel,
|
|
65
|
+
hasInvalidLabelOrSlot,
|
|
66
|
+
hasValidLabelOrSlot,
|
|
67
|
+
hasLoadingLabelOrSlot,
|
|
68
|
+
hasHintLabelOrSlot
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
render() {
|
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
73
|
+
if (this.isVisible) {
|
|
74
|
+
let role;
|
|
75
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
76
|
+
role = "alert";
|
|
77
|
+
}
|
|
78
|
+
if (this.hasValidLabelOrSlot) {
|
|
79
|
+
role = "status";
|
|
80
|
+
}
|
|
81
|
+
if (this.hasLoadingLabelOrSlot) {
|
|
82
|
+
return h(
|
|
83
|
+
this.tag,
|
|
84
|
+
{
|
|
85
|
+
role
|
|
86
|
+
},
|
|
87
|
+
((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
91
|
+
return h(
|
|
92
|
+
this.tag,
|
|
93
|
+
{
|
|
94
|
+
role
|
|
95
|
+
},
|
|
96
|
+
((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
if (this.hasValidLabelOrSlot) {
|
|
100
|
+
return h(
|
|
101
|
+
this.tag,
|
|
102
|
+
{
|
|
103
|
+
role
|
|
104
|
+
},
|
|
105
|
+
((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
return h(
|
|
109
|
+
this.tag,
|
|
110
|
+
{
|
|
111
|
+
role
|
|
112
|
+
},
|
|
113
|
+
((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
hasInvalidLabelOrSlot,
|
|
121
|
+
hasHintLabelOrSlot,
|
|
122
|
+
hasValidLabelOrSlot,
|
|
123
|
+
hasLoadingLabelOrSlot,
|
|
124
|
+
hintSlotScope,
|
|
125
|
+
HintSlot
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const VvIconPropsDefaults = {
|
|
129
|
+
prefix: "normal"
|
|
130
|
+
/* normal */
|
|
131
|
+
};
|
|
4
132
|
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
5
133
|
StorageType2["local"] = "local";
|
|
6
134
|
StorageType2["session"] = "session";
|
|
@@ -48,107 +176,255 @@ var ActionTag = /* @__PURE__ */ ((ActionTag2) => {
|
|
|
48
176
|
return ActionTag2;
|
|
49
177
|
})(ActionTag || {});
|
|
50
178
|
const INJECTION_KEY_VOLVER = Symbol.for("volver");
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
valid: { type: Boolean, default: false },
|
|
80
|
-
/**
|
|
81
|
-
* Valid label
|
|
82
|
-
*/
|
|
83
|
-
validLabel: { type: [String, Array], default: void 0 }
|
|
84
|
-
};
|
|
85
|
-
const InvalidProps = {
|
|
86
|
-
/**
|
|
87
|
-
* Invalid status
|
|
88
|
-
*/
|
|
89
|
-
invalid: {
|
|
90
|
-
type: Boolean,
|
|
91
|
-
default: false
|
|
92
|
-
},
|
|
93
|
-
/**
|
|
94
|
-
* Invalid label
|
|
95
|
-
*/
|
|
96
|
-
invalidLabel: { type: [String, Array], default: void 0 }
|
|
97
|
-
};
|
|
98
|
-
const LoadingProps = {
|
|
99
|
-
/**
|
|
100
|
-
* Loading status
|
|
101
|
-
*/
|
|
102
|
-
loading: {
|
|
103
|
-
type: Boolean,
|
|
104
|
-
default: false
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* Loading label
|
|
108
|
-
*/
|
|
109
|
-
loadingLabel: {
|
|
110
|
-
type: String,
|
|
111
|
-
default: "Loading..."
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
const DisabledProps = {
|
|
115
|
-
/**
|
|
116
|
-
* Whether the form control is disabled
|
|
117
|
-
*/
|
|
118
|
-
disabled: {
|
|
119
|
-
type: Boolean,
|
|
120
|
-
default: false
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
const ActiveProps = {
|
|
124
|
-
/**
|
|
125
|
-
* Whether the item is active
|
|
126
|
-
*/
|
|
127
|
-
active: {
|
|
128
|
-
type: Boolean,
|
|
129
|
-
default: false
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
const CurrentProps = {
|
|
133
|
-
/**
|
|
134
|
-
* Whether the item is current
|
|
135
|
-
*/
|
|
136
|
-
current: {
|
|
137
|
-
type: Boolean,
|
|
138
|
-
default: false
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
const PressedProps = {
|
|
142
|
-
/**
|
|
143
|
-
* Whether the item is pressed
|
|
144
|
-
*/
|
|
145
|
-
pressed: {
|
|
146
|
-
type: Boolean,
|
|
147
|
-
default: false
|
|
148
|
-
}
|
|
179
|
+
function useVolver() {
|
|
180
|
+
return inject(INJECTION_KEY_VOLVER);
|
|
181
|
+
}
|
|
182
|
+
function useModifiers(prefix, modifiers, others) {
|
|
183
|
+
return computed(() => {
|
|
184
|
+
const toReturn = {
|
|
185
|
+
[prefix]: true
|
|
186
|
+
};
|
|
187
|
+
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
188
|
+
if (modifiersArray) {
|
|
189
|
+
if (Array.isArray(modifiersArray)) {
|
|
190
|
+
modifiersArray.forEach((modifier) => {
|
|
191
|
+
if (modifier) {
|
|
192
|
+
toReturn[`${prefix}--${modifier}`] = true;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (others) {
|
|
198
|
+
Object.keys(others.value).forEach((key) => {
|
|
199
|
+
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return toReturn;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
const __default__$1 = {
|
|
206
|
+
name: "VvIcon"
|
|
149
207
|
};
|
|
150
|
-
const
|
|
151
|
-
|
|
208
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
209
|
+
...__default__$1,
|
|
210
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
211
|
+
name: {},
|
|
212
|
+
color: {},
|
|
213
|
+
width: {},
|
|
214
|
+
height: {},
|
|
215
|
+
provider: {},
|
|
216
|
+
prefix: {},
|
|
217
|
+
src: {},
|
|
218
|
+
horizontalFlip: { type: Boolean },
|
|
219
|
+
verticalFlip: { type: Boolean },
|
|
220
|
+
flip: {},
|
|
221
|
+
mode: {},
|
|
222
|
+
inline: { type: Boolean },
|
|
223
|
+
rotate: {},
|
|
224
|
+
onLoad: { type: Function },
|
|
225
|
+
svg: {},
|
|
226
|
+
modifiers: {}
|
|
227
|
+
}, VvIconPropsDefaults),
|
|
228
|
+
setup(__props) {
|
|
229
|
+
const props = __props;
|
|
230
|
+
const hasRotate = computed(() => {
|
|
231
|
+
if (typeof props.rotate === "string") {
|
|
232
|
+
return Number.parseFloat(props.rotate);
|
|
233
|
+
}
|
|
234
|
+
return props.rotate;
|
|
235
|
+
});
|
|
236
|
+
const show = ref(true);
|
|
237
|
+
const volver = useVolver();
|
|
238
|
+
const { modifiers } = toRefs(props);
|
|
239
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
240
|
+
const provider = computed(() => {
|
|
241
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
242
|
+
});
|
|
243
|
+
const icon = computed(() => {
|
|
244
|
+
const name = props.name ?? "";
|
|
245
|
+
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
246
|
+
if (iconExists(iconName)) {
|
|
247
|
+
return iconName;
|
|
248
|
+
}
|
|
249
|
+
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
250
|
+
(iconsCollection2) => {
|
|
251
|
+
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
252
|
+
return iconExists(icon2);
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
if (iconsCollection) {
|
|
256
|
+
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
257
|
+
}
|
|
258
|
+
return name;
|
|
259
|
+
});
|
|
260
|
+
function getSvgContent(svg) {
|
|
261
|
+
let dom;
|
|
262
|
+
if (typeof window === "undefined") {
|
|
263
|
+
const { JSDOM } = require("jsdom");
|
|
264
|
+
dom = new JSDOM().window;
|
|
265
|
+
}
|
|
266
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
267
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
268
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
269
|
+
return svgEl;
|
|
270
|
+
}
|
|
271
|
+
function addIconFromSvg(svg) {
|
|
272
|
+
const svgContentEl = getSvgContent(svg);
|
|
273
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
274
|
+
if (svgContentEl && svgContent) {
|
|
275
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
276
|
+
body: svgContent,
|
|
277
|
+
// Set height and width from svg content
|
|
278
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
279
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (volver) {
|
|
284
|
+
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
285
|
+
show.value = false;
|
|
286
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
287
|
+
if (svg) {
|
|
288
|
+
addIconFromSvg(svg);
|
|
289
|
+
show.value = true;
|
|
290
|
+
}
|
|
291
|
+
}).catch((e) => {
|
|
292
|
+
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (props.svg) {
|
|
297
|
+
addIconFromSvg(props.svg);
|
|
298
|
+
}
|
|
299
|
+
return (_ctx, _cache) => {
|
|
300
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
301
|
+
key: 0,
|
|
302
|
+
class: unref(bemCssClasses)
|
|
303
|
+
}, {
|
|
304
|
+
inline: _ctx.inline,
|
|
305
|
+
width: _ctx.width,
|
|
306
|
+
height: _ctx.height,
|
|
307
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
308
|
+
verticalFlip: _ctx.verticalFlip,
|
|
309
|
+
flip: _ctx.flip,
|
|
310
|
+
rotate: unref(hasRotate),
|
|
311
|
+
color: _ctx.color,
|
|
312
|
+
onLoad: _ctx.onLoad,
|
|
313
|
+
icon: unref(icon)
|
|
314
|
+
}), null, 16, ["class"])) : createCommentVNode("v-if", true);
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
const LinkProps = {
|
|
319
|
+
/**
|
|
320
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
321
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
322
|
+
*/
|
|
323
|
+
to: {
|
|
324
|
+
type: [String, Object]
|
|
325
|
+
},
|
|
326
|
+
/**
|
|
327
|
+
* Anchor href
|
|
328
|
+
*/
|
|
329
|
+
href: String,
|
|
330
|
+
/**
|
|
331
|
+
* Anchor target
|
|
332
|
+
*/
|
|
333
|
+
target: String,
|
|
334
|
+
/**
|
|
335
|
+
* Anchor rel
|
|
336
|
+
*/
|
|
337
|
+
rel: {
|
|
338
|
+
type: String,
|
|
339
|
+
default: "noopener noreferrer"
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
const ValidProps = {
|
|
343
|
+
/**
|
|
344
|
+
* Valid status
|
|
345
|
+
*/
|
|
346
|
+
valid: { type: Boolean, default: false },
|
|
347
|
+
/**
|
|
348
|
+
* Valid label
|
|
349
|
+
*/
|
|
350
|
+
validLabel: { type: [String, Array], default: void 0 }
|
|
351
|
+
};
|
|
352
|
+
const InvalidProps = {
|
|
353
|
+
/**
|
|
354
|
+
* Invalid status
|
|
355
|
+
*/
|
|
356
|
+
invalid: {
|
|
357
|
+
type: Boolean,
|
|
358
|
+
default: false
|
|
359
|
+
},
|
|
360
|
+
/**
|
|
361
|
+
* Invalid label
|
|
362
|
+
*/
|
|
363
|
+
invalidLabel: { type: [String, Array], default: void 0 }
|
|
364
|
+
};
|
|
365
|
+
const LoadingProps = {
|
|
366
|
+
/**
|
|
367
|
+
* Loading status
|
|
368
|
+
*/
|
|
369
|
+
loading: {
|
|
370
|
+
type: Boolean,
|
|
371
|
+
default: false
|
|
372
|
+
},
|
|
373
|
+
/**
|
|
374
|
+
* Loading label
|
|
375
|
+
*/
|
|
376
|
+
loadingLabel: {
|
|
377
|
+
type: String,
|
|
378
|
+
default: "Loading..."
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
const DisabledProps = {
|
|
382
|
+
/**
|
|
383
|
+
* Whether the form control is disabled
|
|
384
|
+
*/
|
|
385
|
+
disabled: {
|
|
386
|
+
type: Boolean,
|
|
387
|
+
default: false
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
const RequiredProps = {
|
|
391
|
+
/**
|
|
392
|
+
* Whether the form control is required
|
|
393
|
+
*/
|
|
394
|
+
required: {
|
|
395
|
+
type: Boolean,
|
|
396
|
+
default: false
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
const ActiveProps = {
|
|
400
|
+
/**
|
|
401
|
+
* Whether the item is active
|
|
402
|
+
*/
|
|
403
|
+
active: {
|
|
404
|
+
type: Boolean,
|
|
405
|
+
default: false
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
const CurrentProps = {
|
|
409
|
+
/**
|
|
410
|
+
* Whether the item is current
|
|
411
|
+
*/
|
|
412
|
+
current: {
|
|
413
|
+
type: Boolean,
|
|
414
|
+
default: false
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
const PressedProps = {
|
|
418
|
+
/**
|
|
419
|
+
* Whether the item is pressed
|
|
420
|
+
*/
|
|
421
|
+
pressed: {
|
|
422
|
+
type: Boolean,
|
|
423
|
+
default: false
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
const LabelProps = {
|
|
427
|
+
/**
|
|
152
428
|
* The item label
|
|
153
429
|
*/
|
|
154
430
|
label: {
|
|
@@ -337,425 +613,155 @@ const IdNameProps = {
|
|
|
337
613
|
* Input / Textarea name
|
|
338
614
|
* Name of the form control. Submitted with the form as part of a name/value pair
|
|
339
615
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
|
|
340
|
-
*/
|
|
341
|
-
name: { type: String, required: true }
|
|
342
|
-
};
|
|
343
|
-
const AutofocusProps = {
|
|
344
|
-
/**
|
|
345
|
-
* Global attribute autofocus
|
|
346
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
347
|
-
*/
|
|
348
|
-
autofocus: {
|
|
349
|
-
type: Boolean,
|
|
350
|
-
default: false
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
const AutocompleteProps = {
|
|
354
|
-
/**
|
|
355
|
-
* Global attribute autocomplete
|
|
356
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
|
|
357
|
-
*/
|
|
358
|
-
autocomplete: { type: String, default: "off" }
|
|
359
|
-
};
|
|
360
|
-
const InputTextareaProps = {
|
|
361
|
-
...IdNameProps,
|
|
362
|
-
...AutofocusProps,
|
|
363
|
-
...AutocompleteProps,
|
|
364
|
-
...TabindexProps,
|
|
365
|
-
...DisabledProps,
|
|
366
|
-
...ReadonlyProps,
|
|
367
|
-
...ValidProps,
|
|
368
|
-
...InvalidProps,
|
|
369
|
-
...HintProps,
|
|
370
|
-
...LoadingProps,
|
|
371
|
-
...ModifiersProps,
|
|
372
|
-
...CountProps,
|
|
373
|
-
...DebounceProps,
|
|
374
|
-
...IconProps,
|
|
375
|
-
...FloatingLabelProps,
|
|
376
|
-
...LabelProps,
|
|
377
|
-
/**
|
|
378
|
-
* Input / Textarea minlength
|
|
379
|
-
* Minimum length (number of characters) of value
|
|
380
|
-
* Available for input types: text, search, url, tel, email, password
|
|
381
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
|
|
382
|
-
*/
|
|
383
|
-
minlength: { type: [String, Number], default: void 0 },
|
|
384
|
-
/**
|
|
385
|
-
* Input / Textarea maxlength
|
|
386
|
-
* Maximum length (number of characters) of value
|
|
387
|
-
* Available for input types: text, search, url, tel, email, password
|
|
388
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
|
|
389
|
-
*/
|
|
390
|
-
maxlength: { type: [String, Number], default: void 0 },
|
|
391
|
-
/**
|
|
392
|
-
* Input / Textarea placeholder
|
|
393
|
-
* Text that appears in the form control when it has no value set
|
|
394
|
-
* Available for input types: text, search, url, tel, email, password, number
|
|
395
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
|
|
396
|
-
*/
|
|
397
|
-
placeholder: {
|
|
398
|
-
type: String,
|
|
399
|
-
default: void 0
|
|
400
|
-
},
|
|
401
|
-
/**
|
|
402
|
-
* Input / Textarea required
|
|
403
|
-
* A value is required or must be check for the form to be submittable
|
|
404
|
-
* Available for all input types except color
|
|
405
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
|
|
406
|
-
*/
|
|
407
|
-
required: {
|
|
408
|
-
type: Boolean,
|
|
409
|
-
default: false
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
({
|
|
413
|
-
...DisabledProps,
|
|
414
|
-
...LabelProps,
|
|
415
|
-
...PressedProps,
|
|
416
|
-
...ActiveProps,
|
|
417
|
-
...CurrentProps,
|
|
418
|
-
...LinkProps,
|
|
419
|
-
/**
|
|
420
|
-
* Button type
|
|
421
|
-
*/
|
|
422
|
-
type: {
|
|
423
|
-
type: String,
|
|
424
|
-
default: ButtonType.button,
|
|
425
|
-
validator: (value) => Object.values(ButtonType).includes(value)
|
|
426
|
-
},
|
|
427
|
-
/**
|
|
428
|
-
* Button aria-label
|
|
429
|
-
*/
|
|
430
|
-
ariaLabel: {
|
|
431
|
-
type: String,
|
|
432
|
-
default: void 0
|
|
433
|
-
},
|
|
434
|
-
/**
|
|
435
|
-
* Default tag for the action
|
|
436
|
-
*/
|
|
437
|
-
defaultTag: {
|
|
438
|
-
type: String,
|
|
439
|
-
default: ActionTag.button
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
({
|
|
443
|
-
storageType: {
|
|
444
|
-
type: String,
|
|
445
|
-
default: StorageType.local,
|
|
446
|
-
validator: (value) => Object.values(StorageType).includes(value)
|
|
447
|
-
},
|
|
448
|
-
storageKey: String
|
|
449
|
-
});
|
|
450
|
-
const WRAP = {
|
|
451
|
-
hard: "hard",
|
|
452
|
-
soft: "soft"
|
|
453
|
-
};
|
|
454
|
-
const SPELLCHECK = {
|
|
455
|
-
true: true,
|
|
456
|
-
false: false,
|
|
457
|
-
default: "default"
|
|
458
|
-
};
|
|
459
|
-
const VvTextareaEvents = ["update:modelValue", "focus", "blur", "keyup"];
|
|
460
|
-
const VvTextareaProps = {
|
|
461
|
-
...InputTextareaProps,
|
|
462
|
-
/**
|
|
463
|
-
* Textarea value
|
|
464
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#value
|
|
465
|
-
*/
|
|
466
|
-
modelValue: String,
|
|
467
|
-
/**
|
|
468
|
-
* The visible width of the text control, in average character widths. If it is specified, it must be a positive integer. If it is not specified, the default value is 20.
|
|
469
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#cols
|
|
470
|
-
*/
|
|
471
|
-
cols: { type: [String, Number], default: 20 },
|
|
472
|
-
/**
|
|
473
|
-
* The number of visible text lines for the control. If it is specified, it must be a positive integer. If it is not specified, the default value is 2.
|
|
474
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#rows
|
|
475
|
-
*/
|
|
476
|
-
rows: { type: [String, Number], default: 2 },
|
|
477
|
-
/**
|
|
478
|
-
* Indicates how the control should wrap the value for form submission.
|
|
479
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap
|
|
480
|
-
*/
|
|
481
|
-
wrap: { type: String, default: WRAP.soft },
|
|
482
|
-
/**
|
|
483
|
-
* Specifies whether the <textarea> is subject to spell checking by the underlying browser/OS.
|
|
484
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap
|
|
485
|
-
*/
|
|
486
|
-
spellcheck: { type: [Boolean, String], default: SPELLCHECK.default },
|
|
487
|
-
/**
|
|
488
|
-
* If true, the textarea will be resizable
|
|
489
|
-
*/
|
|
490
|
-
resizable: Boolean
|
|
491
|
-
};
|
|
492
|
-
function isEmpty(value) {
|
|
493
|
-
return ((value2) => value2 === null || value2 === void 0 || value2 === "" || Array.isArray(value2) && value2.length === 0 || !(value2 instanceof Date) && typeof value2 === "object" && Object.keys(value2).length === 0)(unref(value));
|
|
494
|
-
}
|
|
495
|
-
function isString(value) {
|
|
496
|
-
return typeof value === "string" || value instanceof String;
|
|
497
|
-
}
|
|
498
|
-
function joinLines(items) {
|
|
499
|
-
if (Array.isArray(items)) {
|
|
500
|
-
return items.filter((item) => isString(item)).join(" ");
|
|
501
|
-
}
|
|
502
|
-
return items;
|
|
503
|
-
}
|
|
504
|
-
function HintSlotFactory(propsOrRef, slots) {
|
|
505
|
-
const props = computed(() => {
|
|
506
|
-
if (isRef(propsOrRef)) {
|
|
507
|
-
return propsOrRef.value;
|
|
508
|
-
}
|
|
509
|
-
return propsOrRef;
|
|
510
|
-
});
|
|
511
|
-
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
512
|
-
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
513
|
-
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
514
|
-
const hintLabel = computed(() => props.value.hintLabel);
|
|
515
|
-
const hasLoadingLabelOrSlot = computed(
|
|
516
|
-
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
517
|
-
);
|
|
518
|
-
const hasInvalidLabelOrSlot = computed(
|
|
519
|
-
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
520
|
-
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
521
|
-
)
|
|
522
|
-
);
|
|
523
|
-
const hasValidLabelOrSlot = computed(
|
|
524
|
-
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
525
|
-
);
|
|
526
|
-
const hasHintLabelOrSlot = computed(
|
|
527
|
-
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
528
|
-
);
|
|
529
|
-
const isVisible = computed(
|
|
530
|
-
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
531
|
-
);
|
|
532
|
-
const hintSlotScope = computed(() => ({
|
|
533
|
-
modelValue: props.value.modelValue,
|
|
534
|
-
valid: props.value.valid,
|
|
535
|
-
invalid: props.value.invalid,
|
|
536
|
-
loading: props.value.loading
|
|
537
|
-
}));
|
|
538
|
-
const HintSlot = defineComponent({
|
|
539
|
-
name: "HintSlot",
|
|
540
|
-
props: {
|
|
541
|
-
tag: {
|
|
542
|
-
type: String,
|
|
543
|
-
default: "small"
|
|
544
|
-
}
|
|
545
|
-
},
|
|
546
|
-
setup() {
|
|
547
|
-
return {
|
|
548
|
-
isVisible,
|
|
549
|
-
invalidLabel,
|
|
550
|
-
validLabel,
|
|
551
|
-
loadingLabel,
|
|
552
|
-
hintLabel,
|
|
553
|
-
hasInvalidLabelOrSlot,
|
|
554
|
-
hasValidLabelOrSlot,
|
|
555
|
-
hasLoadingLabelOrSlot,
|
|
556
|
-
hasHintLabelOrSlot
|
|
557
|
-
};
|
|
558
|
-
},
|
|
559
|
-
render() {
|
|
560
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
561
|
-
if (this.isVisible) {
|
|
562
|
-
let role;
|
|
563
|
-
if (this.hasInvalidLabelOrSlot) {
|
|
564
|
-
role = "alert";
|
|
565
|
-
}
|
|
566
|
-
if (this.hasValidLabelOrSlot) {
|
|
567
|
-
role = "status";
|
|
568
|
-
}
|
|
569
|
-
if (this.hasLoadingLabelOrSlot) {
|
|
570
|
-
return h(
|
|
571
|
-
this.tag,
|
|
572
|
-
{
|
|
573
|
-
role
|
|
574
|
-
},
|
|
575
|
-
((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
|
|
576
|
-
);
|
|
577
|
-
}
|
|
578
|
-
if (this.hasInvalidLabelOrSlot) {
|
|
579
|
-
return h(
|
|
580
|
-
this.tag,
|
|
581
|
-
{
|
|
582
|
-
role
|
|
583
|
-
},
|
|
584
|
-
((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
|
|
585
|
-
);
|
|
586
|
-
}
|
|
587
|
-
if (this.hasValidLabelOrSlot) {
|
|
588
|
-
return h(
|
|
589
|
-
this.tag,
|
|
590
|
-
{
|
|
591
|
-
role
|
|
592
|
-
},
|
|
593
|
-
((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
|
|
594
|
-
);
|
|
595
|
-
}
|
|
596
|
-
return h(
|
|
597
|
-
this.tag,
|
|
598
|
-
{
|
|
599
|
-
role
|
|
600
|
-
},
|
|
601
|
-
((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
|
|
602
|
-
);
|
|
603
|
-
}
|
|
604
|
-
return null;
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
return {
|
|
608
|
-
hasInvalidLabelOrSlot,
|
|
609
|
-
hasHintLabelOrSlot,
|
|
610
|
-
hasValidLabelOrSlot,
|
|
611
|
-
hasLoadingLabelOrSlot,
|
|
612
|
-
hintSlotScope,
|
|
613
|
-
HintSlot
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
const VvIconPropsDefaults = {
|
|
617
|
-
prefix: "normal"
|
|
618
|
-
/* normal */
|
|
619
|
-
};
|
|
620
|
-
function useVolver() {
|
|
621
|
-
return inject(INJECTION_KEY_VOLVER);
|
|
622
|
-
}
|
|
623
|
-
function useModifiers(prefix, modifiers, others) {
|
|
624
|
-
return computed(() => {
|
|
625
|
-
const toReturn = {
|
|
626
|
-
[prefix]: true
|
|
627
|
-
};
|
|
628
|
-
const modifiersArray = typeof (modifiers == null ? void 0 : modifiers.value) === "string" ? modifiers.value.split(" ") : modifiers == null ? void 0 : modifiers.value;
|
|
629
|
-
if (modifiersArray) {
|
|
630
|
-
if (Array.isArray(modifiersArray)) {
|
|
631
|
-
modifiersArray.forEach((modifier) => {
|
|
632
|
-
if (modifier) {
|
|
633
|
-
toReturn[`${prefix}--${modifier}`] = true;
|
|
634
|
-
}
|
|
635
|
-
});
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
if (others) {
|
|
639
|
-
Object.keys(others.value).forEach((key) => {
|
|
640
|
-
toReturn[`${prefix}--${key}`] = unref(others.value[key]);
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
return toReturn;
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
const __default__$1 = {
|
|
647
|
-
name: "VvIcon"
|
|
616
|
+
*/
|
|
617
|
+
name: { type: String, required: true }
|
|
648
618
|
};
|
|
649
|
-
const
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
class: unref(bemCssClasses)
|
|
744
|
-
}, {
|
|
745
|
-
inline: _ctx.inline,
|
|
746
|
-
width: _ctx.width,
|
|
747
|
-
height: _ctx.height,
|
|
748
|
-
horizontalFlip: _ctx.horizontalFlip,
|
|
749
|
-
verticalFlip: _ctx.verticalFlip,
|
|
750
|
-
flip: _ctx.flip,
|
|
751
|
-
rotate: unref(hasRotate),
|
|
752
|
-
color: _ctx.color,
|
|
753
|
-
onLoad: _ctx.onLoad,
|
|
754
|
-
icon: unref(icon)
|
|
755
|
-
}), null, 16, ["class"])) : createCommentVNode("v-if", true);
|
|
756
|
-
};
|
|
619
|
+
const AutofocusProps = {
|
|
620
|
+
/**
|
|
621
|
+
* Global attribute autofocus
|
|
622
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autofocus
|
|
623
|
+
*/
|
|
624
|
+
autofocus: {
|
|
625
|
+
type: Boolean,
|
|
626
|
+
default: false
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
const AutocompleteProps = {
|
|
630
|
+
/**
|
|
631
|
+
* Global attribute autocomplete
|
|
632
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete
|
|
633
|
+
*/
|
|
634
|
+
autocomplete: { type: String, default: "off" }
|
|
635
|
+
};
|
|
636
|
+
const InputTextareaProps = {
|
|
637
|
+
...IdNameProps,
|
|
638
|
+
...AutofocusProps,
|
|
639
|
+
...AutocompleteProps,
|
|
640
|
+
...TabindexProps,
|
|
641
|
+
...DisabledProps,
|
|
642
|
+
...ReadonlyProps,
|
|
643
|
+
...ValidProps,
|
|
644
|
+
...InvalidProps,
|
|
645
|
+
...HintProps,
|
|
646
|
+
...LoadingProps,
|
|
647
|
+
...ModifiersProps,
|
|
648
|
+
...CountProps,
|
|
649
|
+
...DebounceProps,
|
|
650
|
+
...IconProps,
|
|
651
|
+
...FloatingLabelProps,
|
|
652
|
+
...LabelProps,
|
|
653
|
+
/**
|
|
654
|
+
* Input / Textarea minlength
|
|
655
|
+
* Minimum length (number of characters) of value
|
|
656
|
+
* Available for input types: text, search, url, tel, email, password
|
|
657
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
|
|
658
|
+
*/
|
|
659
|
+
minlength: { type: [String, Number], default: void 0 },
|
|
660
|
+
/**
|
|
661
|
+
* Input / Textarea maxlength
|
|
662
|
+
* Maximum length (number of characters) of value
|
|
663
|
+
* Available for input types: text, search, url, tel, email, password
|
|
664
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
|
|
665
|
+
*/
|
|
666
|
+
maxlength: { type: [String, Number], default: void 0 },
|
|
667
|
+
/**
|
|
668
|
+
* Input / Textarea placeholder
|
|
669
|
+
* Text that appears in the form control when it has no value set
|
|
670
|
+
* Available for input types: text, search, url, tel, email, password, number
|
|
671
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#placeholder
|
|
672
|
+
*/
|
|
673
|
+
placeholder: {
|
|
674
|
+
type: String,
|
|
675
|
+
default: void 0
|
|
676
|
+
},
|
|
677
|
+
/**
|
|
678
|
+
* Input / Textarea required
|
|
679
|
+
* A value is required or must be check for the form to be submittable
|
|
680
|
+
* Available for all input types except color
|
|
681
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#required
|
|
682
|
+
*/
|
|
683
|
+
...RequiredProps
|
|
684
|
+
};
|
|
685
|
+
({
|
|
686
|
+
...DisabledProps,
|
|
687
|
+
...LabelProps,
|
|
688
|
+
...PressedProps,
|
|
689
|
+
...ActiveProps,
|
|
690
|
+
...CurrentProps,
|
|
691
|
+
...LinkProps,
|
|
692
|
+
/**
|
|
693
|
+
* Button type
|
|
694
|
+
*/
|
|
695
|
+
type: {
|
|
696
|
+
type: String,
|
|
697
|
+
default: ButtonType.button,
|
|
698
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
699
|
+
},
|
|
700
|
+
/**
|
|
701
|
+
* Button aria-label
|
|
702
|
+
*/
|
|
703
|
+
ariaLabel: {
|
|
704
|
+
type: String,
|
|
705
|
+
default: void 0
|
|
706
|
+
},
|
|
707
|
+
/**
|
|
708
|
+
* Default tag for the action
|
|
709
|
+
*/
|
|
710
|
+
defaultTag: {
|
|
711
|
+
type: String,
|
|
712
|
+
default: ActionTag.button
|
|
757
713
|
}
|
|
758
714
|
});
|
|
715
|
+
({
|
|
716
|
+
storageType: {
|
|
717
|
+
type: String,
|
|
718
|
+
default: StorageType.local,
|
|
719
|
+
validator: (value) => Object.values(StorageType).includes(value)
|
|
720
|
+
},
|
|
721
|
+
storageKey: String
|
|
722
|
+
});
|
|
723
|
+
const WRAP = {
|
|
724
|
+
hard: "hard",
|
|
725
|
+
soft: "soft"
|
|
726
|
+
};
|
|
727
|
+
const SPELLCHECK = {
|
|
728
|
+
true: true,
|
|
729
|
+
false: false,
|
|
730
|
+
default: "default"
|
|
731
|
+
};
|
|
732
|
+
const VvTextareaEvents = ["update:modelValue", "focus", "blur", "keyup"];
|
|
733
|
+
const VvTextareaProps = {
|
|
734
|
+
...InputTextareaProps,
|
|
735
|
+
/**
|
|
736
|
+
* Textarea value
|
|
737
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#value
|
|
738
|
+
*/
|
|
739
|
+
modelValue: String,
|
|
740
|
+
/**
|
|
741
|
+
* The visible width of the text control, in average character widths. If it is specified, it must be a positive integer. If it is not specified, the default value is 20.
|
|
742
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#cols
|
|
743
|
+
*/
|
|
744
|
+
cols: { type: [String, Number], default: 20 },
|
|
745
|
+
/**
|
|
746
|
+
* The number of visible text lines for the control. If it is specified, it must be a positive integer. If it is not specified, the default value is 2.
|
|
747
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#rows
|
|
748
|
+
*/
|
|
749
|
+
rows: { type: [String, Number], default: 2 },
|
|
750
|
+
/**
|
|
751
|
+
* Indicates how the control should wrap the value for form submission.
|
|
752
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap
|
|
753
|
+
*/
|
|
754
|
+
wrap: { type: String, default: WRAP.soft },
|
|
755
|
+
/**
|
|
756
|
+
* Specifies whether the <textarea> is subject to spell checking by the underlying browser/OS.
|
|
757
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#wrap
|
|
758
|
+
*/
|
|
759
|
+
spellcheck: { type: [Boolean, String], default: SPELLCHECK.default },
|
|
760
|
+
/**
|
|
761
|
+
* If true, the textarea will be resizable
|
|
762
|
+
*/
|
|
763
|
+
resizable: Boolean
|
|
764
|
+
};
|
|
759
765
|
function useDefaults(componentName, propsDefinition, props) {
|
|
760
766
|
const volver = useVolver();
|
|
761
767
|
const volverComponentDefaults = computed(() => {
|
|
@@ -911,18 +917,19 @@ function useTextCount(text, options) {
|
|
|
911
917
|
};
|
|
912
918
|
}
|
|
913
919
|
const _hoisted_1 = ["for"];
|
|
914
|
-
const _hoisted_2 = {
|
|
915
|
-
const _hoisted_3 = {
|
|
920
|
+
const _hoisted_2 = { key: 0 };
|
|
921
|
+
const _hoisted_3 = { class: "vv-textarea__wrapper" };
|
|
922
|
+
const _hoisted_4 = {
|
|
916
923
|
key: 0,
|
|
917
924
|
class: "vv-textarea__input-before"
|
|
918
925
|
};
|
|
919
|
-
const
|
|
920
|
-
const
|
|
921
|
-
const
|
|
926
|
+
const _hoisted_5 = { class: "vv-textarea__inner" };
|
|
927
|
+
const _hoisted_6 = ["id"];
|
|
928
|
+
const _hoisted_7 = {
|
|
922
929
|
key: 1,
|
|
923
930
|
class: "vv-textarea__input-after"
|
|
924
931
|
};
|
|
925
|
-
const
|
|
932
|
+
const _hoisted_8 = {
|
|
926
933
|
key: 2,
|
|
927
934
|
class: "vv-textarea__limit"
|
|
928
935
|
};
|
|
@@ -1057,12 +1064,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1057
1064
|
key: 0,
|
|
1058
1065
|
for: unref(hasId),
|
|
1059
1066
|
class: "vv-textarea__label"
|
|
1060
|
-
},
|
|
1061
|
-
|
|
1062
|
-
|
|
1067
|
+
}, [
|
|
1068
|
+
createTextVNode(
|
|
1069
|
+
toDisplayString(unref(label)) + " ",
|
|
1070
|
+
1
|
|
1071
|
+
/* TEXT */
|
|
1072
|
+
),
|
|
1073
|
+
_ctx.required ? (openBlock(), createElementBlock("span", _hoisted_2, "*")) : createCommentVNode("v-if", true)
|
|
1074
|
+
], 8, _hoisted_1)) : createCommentVNode("v-if", true),
|
|
1075
|
+
createElementVNode("div", _hoisted_3, [
|
|
1076
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
1063
1077
|
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1064
1078
|
])) : createCommentVNode("v-if", true),
|
|
1065
|
-
createElementVNode("div",
|
|
1079
|
+
createElementVNode("div", _hoisted_5, [
|
|
1066
1080
|
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
1067
1081
|
_sfc_main$1,
|
|
1068
1082
|
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-textarea__icon" }),
|
|
@@ -1077,7 +1091,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1077
1091
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
1078
1092
|
}, unref(hasAttrs), {
|
|
1079
1093
|
onKeyup: _cache[1] || (_cache[1] = ($event) => emit("keyup", $event))
|
|
1080
|
-
}), null, 16,
|
|
1094
|
+
}), null, 16, _hoisted_6), [
|
|
1081
1095
|
[vModelText, unref(localModelValue)]
|
|
1082
1096
|
]),
|
|
1083
1097
|
unref(hasIconAfter) ? (openBlock(), createBlock(
|
|
@@ -1088,10 +1102,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1088
1102
|
/* FULL_PROPS */
|
|
1089
1103
|
)) : createCommentVNode("v-if", true)
|
|
1090
1104
|
]),
|
|
1091
|
-
_ctx.$slots.after ? (openBlock(), createElementBlock("div",
|
|
1105
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
1092
1106
|
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
1093
1107
|
])) : createCommentVNode("v-if", true),
|
|
1094
|
-
unref(count) ? (openBlock(), createElementBlock("span",
|
|
1108
|
+
unref(count) ? (openBlock(), createElementBlock("span", _hoisted_8, [
|
|
1095
1109
|
renderSlot(_ctx.$slots, "count", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
1096
1110
|
createTextVNode(
|
|
1097
1111
|
toDisplayString(unref(countFormatted)),
|