@volverjs/ui-vue 0.0.5-beta.1 → 0.0.5-beta.3
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/VvAction/VvAction.es.js +10 -0
- package/dist/components/VvBadge/VvBadge.es.js +10 -0
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +10 -0
- package/dist/components/VvButton/VvButton.es.js +10 -0
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +10 -0
- package/dist/components/VvCheckbox/VvCheckbox.es.js +10 -0
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +17 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +174 -64
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +16 -11
- package/dist/components/VvCombobox/index.d.ts +6 -1
- package/dist/components/VvDialog/VvDialog.es.js +10 -0
- package/dist/components/VvDropdown/VvDropdown.es.js +14 -2
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +27 -11
- package/dist/components/VvDropdown/VvDropdownOptgroup.vue.d.ts +6 -0
- package/dist/components/VvDropdown/index.d.ts +6 -1
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +10 -0
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +237 -0
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -0
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +10 -0
- package/dist/components/VvInputText/VvInputText.es.js +14 -4
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +4 -4
- package/dist/components/VvInputText/index.d.ts +2 -2
- package/dist/components/VvProgress/VvProgress.es.js +10 -0
- package/dist/components/VvRadio/VvRadio.es.js +10 -0
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +17 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +52 -10
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +4 -3
- package/dist/components/VvTextarea/VvTextarea.es.js +14 -4
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +10 -10
- package/dist/components/VvTextarea/index.d.ts +2 -2
- package/dist/components/VvTooltip/VvTooltip.es.js +10 -0
- package/dist/components/index.es.js +250 -140
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/useOptions.d.ts +1 -0
- package/dist/directives/index.d.ts +1 -0
- package/dist/directives/index.es.js +51 -2
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.d.ts +3 -0
- package/dist/directives/v-contextmenu.es.js +42 -0
- package/dist/directives/v-contextmenu.umd.js +1 -0
- package/dist/directives/v-tooltip.es.js +10 -0
- package/dist/icons.d.ts +3 -1
- package/dist/icons.es.js +6 -4
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +11 -3
- package/dist/resolvers/unplugin.es.js +2 -1
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +12 -0
- package/dist/stories/Dropdown/Dropdown.settings.d.ts +12 -0
- package/dist/stories/argTypes.d.ts +12 -0
- package/package.json +58 -42
- 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 +85 -28
- package/src/components/VvDropdown/VvDropdown.vue +3 -2
- package/src/components/VvDropdown/VvDropdownOptgroup.vue +18 -0
- package/src/components/VvInputText/VvInputText.vue +2 -2
- package/src/components/VvSelect/VvSelect.vue +38 -10
- package/src/components/VvTextarea/VvTextarea.vue +2 -2
- package/src/composables/useOptions.ts +6 -0
- package/src/directives/index.ts +2 -0
- package/src/directives/v-contextmenu.ts +40 -0
- package/src/icons.ts +1 -1
- package/src/props/index.ts +12 -2
- package/src/resolvers/unplugin.ts +2 -1
- package/src/stories/Dropdown/DropdownContextmenuDirective.stories.mdx +41 -0
- package/src/stories/Tooltip/TooltipDirective.stories.mdx +1 -1
- package/src/stories/argTypes.ts +10 -0
- package/src/types/generic.d.ts +2 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, toDisplayString } from "vue";
|
|
2
|
+
var Side = /* @__PURE__ */ ((Side2) => {
|
|
3
|
+
Side2["left"] = "left";
|
|
4
|
+
Side2["right"] = "right";
|
|
5
|
+
Side2["top"] = "top";
|
|
6
|
+
Side2["bottom"] = "bottom";
|
|
7
|
+
return Side2;
|
|
8
|
+
})(Side || {});
|
|
9
|
+
var Placement = /* @__PURE__ */ ((Placement2) => {
|
|
10
|
+
Placement2["topStart"] = "top-start";
|
|
11
|
+
Placement2["topEnd"] = "top-end";
|
|
12
|
+
Placement2["bottomStart"] = "bottom-start";
|
|
13
|
+
Placement2["bottomEnd"] = "bottom-end";
|
|
14
|
+
Placement2["leftStart"] = "left-start";
|
|
15
|
+
Placement2["leftEnd"] = "left-end";
|
|
16
|
+
Placement2["rightStart"] = "right-start";
|
|
17
|
+
Placement2["rightEnd"] = "right-end";
|
|
18
|
+
return Placement2;
|
|
19
|
+
})(Placement || {});
|
|
20
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
21
|
+
Position2["before"] = "before";
|
|
22
|
+
Position2["after"] = "after";
|
|
23
|
+
return Position2;
|
|
24
|
+
})(Position || {});
|
|
25
|
+
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
26
|
+
ButtonType2["button"] = "button";
|
|
27
|
+
ButtonType2["submit"] = "submit";
|
|
28
|
+
ButtonType2["reset"] = "reset";
|
|
29
|
+
return ButtonType2;
|
|
30
|
+
})(ButtonType || {});
|
|
31
|
+
var AnchorTarget = /* @__PURE__ */ ((AnchorTarget2) => {
|
|
32
|
+
AnchorTarget2["_blank"] = "_blank";
|
|
33
|
+
AnchorTarget2["_self"] = "_self";
|
|
34
|
+
AnchorTarget2["_parent"] = "_parent";
|
|
35
|
+
AnchorTarget2["_top"] = "_top";
|
|
36
|
+
return AnchorTarget2;
|
|
37
|
+
})(AnchorTarget || {});
|
|
38
|
+
const LinkProps = {
|
|
39
|
+
/**
|
|
40
|
+
* The router-link/nuxt-link property, if it is defined the button is rendered as a ruouter-link or nuxt-link.
|
|
41
|
+
* @see Documentation of [router-link](https://router.vuejs.org/api/#router-link) and [nuxt-link](https://nuxtjs.org/api/components-nuxt-link/)
|
|
42
|
+
*/
|
|
43
|
+
to: {
|
|
44
|
+
type: [String, Object]
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Anchor href
|
|
48
|
+
*/
|
|
49
|
+
href: String,
|
|
50
|
+
/**
|
|
51
|
+
* Anchor target
|
|
52
|
+
*/
|
|
53
|
+
target: {
|
|
54
|
+
type: String,
|
|
55
|
+
validator: (value) => Object.values(AnchorTarget).includes(value)
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Anchor rel
|
|
59
|
+
*/
|
|
60
|
+
rel: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "noopener noreferrer"
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const DisabledProps = {
|
|
66
|
+
/**
|
|
67
|
+
* Whether the form control is disabled
|
|
68
|
+
*/
|
|
69
|
+
disabled: Boolean
|
|
70
|
+
};
|
|
71
|
+
const ActiveProps = {
|
|
72
|
+
/**
|
|
73
|
+
* Whether the item is active
|
|
74
|
+
*/
|
|
75
|
+
active: Boolean
|
|
76
|
+
};
|
|
77
|
+
const PressedProps = {
|
|
78
|
+
/**
|
|
79
|
+
* Whether the item is pressed
|
|
80
|
+
*/
|
|
81
|
+
pressed: Boolean
|
|
82
|
+
};
|
|
83
|
+
const LabelProps = {
|
|
84
|
+
/**
|
|
85
|
+
* The item label
|
|
86
|
+
*/
|
|
87
|
+
label: [String, Number]
|
|
88
|
+
};
|
|
89
|
+
({
|
|
90
|
+
/**
|
|
91
|
+
* VvIcon name or props
|
|
92
|
+
* @see VVIcon
|
|
93
|
+
*/
|
|
94
|
+
icon: { type: [String, Object] },
|
|
95
|
+
/**
|
|
96
|
+
* VvIcon position
|
|
97
|
+
*/
|
|
98
|
+
iconPosition: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: Position.before,
|
|
101
|
+
validation: (value) => Object.values(Position).includes(value)
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
({
|
|
105
|
+
/**
|
|
106
|
+
* Dropdown placement
|
|
107
|
+
*/
|
|
108
|
+
placement: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: Side.bottom,
|
|
111
|
+
validator: (value) => {
|
|
112
|
+
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* Dropdown strategy
|
|
117
|
+
*/
|
|
118
|
+
strategy: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: "absolute",
|
|
121
|
+
validator: (value) => {
|
|
122
|
+
return ["fixed", "absolute"].includes(value);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* Dropdown show / hide transition name
|
|
127
|
+
*/
|
|
128
|
+
transitionName: {
|
|
129
|
+
type: String
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* Offset of the dropdown from the trigger
|
|
133
|
+
* @see https://floating-ui.com/docs/offset
|
|
134
|
+
*/
|
|
135
|
+
offset: {
|
|
136
|
+
type: [Number, String, Object],
|
|
137
|
+
default: 0
|
|
138
|
+
},
|
|
139
|
+
/**
|
|
140
|
+
* Move dropdown to the side if there is no space in the default position
|
|
141
|
+
* @see https://floating-ui.com/docs/shift
|
|
142
|
+
*/
|
|
143
|
+
shift: {
|
|
144
|
+
type: [Boolean, Object],
|
|
145
|
+
default: false
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* Flip dropdown position if there is no space in the default position
|
|
149
|
+
* @see https://floating-ui.com/docs/flip
|
|
150
|
+
*/
|
|
151
|
+
flip: {
|
|
152
|
+
type: [Boolean, Object],
|
|
153
|
+
default: true
|
|
154
|
+
},
|
|
155
|
+
/**
|
|
156
|
+
* Size of the dropdown
|
|
157
|
+
* @see https://floating-ui.com/docs/size
|
|
158
|
+
*/
|
|
159
|
+
size: {
|
|
160
|
+
type: [Boolean, Object],
|
|
161
|
+
default: () => ({ padding: 10 })
|
|
162
|
+
},
|
|
163
|
+
/**
|
|
164
|
+
* Automatically change the position of the dropdown
|
|
165
|
+
* @see https://floating-ui.com/docs/autoPlacement
|
|
166
|
+
*/
|
|
167
|
+
autoPlacement: {
|
|
168
|
+
type: [Boolean, Object],
|
|
169
|
+
default: false
|
|
170
|
+
},
|
|
171
|
+
/**
|
|
172
|
+
* Add arrow to the dropdown
|
|
173
|
+
* @see https://floating-ui.com/docs/arrow
|
|
174
|
+
*/
|
|
175
|
+
arrow: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: false
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* Close dropdown on click outside
|
|
181
|
+
*/
|
|
182
|
+
autoClose: {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
default: true
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* Autofocus first item on dropdown open
|
|
188
|
+
*/
|
|
189
|
+
autofocusFirst: {
|
|
190
|
+
type: Boolean,
|
|
191
|
+
default: true
|
|
192
|
+
},
|
|
193
|
+
/**
|
|
194
|
+
* Set dropdown width to the same as the trigger
|
|
195
|
+
*/
|
|
196
|
+
triggerWidth: {
|
|
197
|
+
type: Boolean
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
({
|
|
201
|
+
...DisabledProps,
|
|
202
|
+
...LabelProps,
|
|
203
|
+
...PressedProps,
|
|
204
|
+
...ActiveProps,
|
|
205
|
+
...LinkProps,
|
|
206
|
+
/**
|
|
207
|
+
* Button type
|
|
208
|
+
*/
|
|
209
|
+
type: {
|
|
210
|
+
type: String,
|
|
211
|
+
default: ButtonType.button,
|
|
212
|
+
validator: (value) => Object.values(ButtonType).includes(value)
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
const _hoisted_1 = {
|
|
216
|
+
class: "vv-dropdown-optgroup",
|
|
217
|
+
role: "presentation",
|
|
218
|
+
tabindex: "-1"
|
|
219
|
+
};
|
|
220
|
+
const __default__ = {
|
|
221
|
+
name: "VvDropdownOptgroup"
|
|
222
|
+
};
|
|
223
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
224
|
+
...__default__,
|
|
225
|
+
props: {
|
|
226
|
+
...LabelProps
|
|
227
|
+
},
|
|
228
|
+
setup(__props) {
|
|
229
|
+
const props = __props;
|
|
230
|
+
return (_ctx, _cache) => {
|
|
231
|
+
return openBlock(), createElementBlock("li", _hoisted_1, toDisplayString(props.label), 1);
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
export {
|
|
236
|
+
_sfc_main as default
|
|
237
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(o,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):(o="undefined"!=typeof globalThis?globalThis:o||self).VvDropdownOptgroup=e(o.vue)}(this,(function(o){"use strict";var e=(o=>(o.left="left",o.right="right",o.top="top",o.bottom="bottom",o))(e||{}),t=(o=>(o.before="before",o.after="after",o))(t||{}),n=(o=>(o.button="button",o.submit="submit",o.reset="reset",o))(n||{});Boolean,Boolean,Boolean;const r={label:[String,Number]};t.before,e.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,n.button;const l={class:"vv-dropdown-optgroup",role:"presentation",tabindex:"-1"};return o.defineComponent({name:"VvDropdownOptgroup",props:{...r},setup(e){const t=e;return(e,n)=>(o.openBlock(),o.createElementBlock("li",l,o.toDisplayString(t.label),1))}})}));
|
|
@@ -179,6 +179,16 @@ const UnselectableProps = {
|
|
|
179
179
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
+
/**
|
|
183
|
+
* Dropdown strategy
|
|
184
|
+
*/
|
|
185
|
+
strategy: {
|
|
186
|
+
type: String,
|
|
187
|
+
default: "absolute",
|
|
188
|
+
validator: (value) => {
|
|
189
|
+
return ["fixed", "absolute"].includes(value);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
182
192
|
/**
|
|
183
193
|
* Dropdown show / hide transition name
|
|
184
194
|
*/
|
|
@@ -543,6 +543,16 @@ const IdProps = {
|
|
|
543
543
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
544
544
|
}
|
|
545
545
|
},
|
|
546
|
+
/**
|
|
547
|
+
* Dropdown strategy
|
|
548
|
+
*/
|
|
549
|
+
strategy: {
|
|
550
|
+
type: String,
|
|
551
|
+
default: "absolute",
|
|
552
|
+
validator: (value) => {
|
|
553
|
+
return ["fixed", "absolute"].includes(value);
|
|
554
|
+
}
|
|
555
|
+
},
|
|
546
556
|
/**
|
|
547
557
|
* Dropdown show / hide transition name
|
|
548
558
|
*/
|
|
@@ -664,14 +674,14 @@ const InputTextareaProps = {
|
|
|
664
674
|
* Available for input types: text, search, url, tel, email, password
|
|
665
675
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#minlength
|
|
666
676
|
*/
|
|
667
|
-
minlength: Number,
|
|
677
|
+
minlength: [String, Number],
|
|
668
678
|
/**
|
|
669
679
|
* Input / Textarea maxlength
|
|
670
680
|
* Maximum length (number of characters) of value
|
|
671
681
|
* Available for input types: text, search, url, tel, email, password
|
|
672
682
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#maxlength
|
|
673
683
|
*/
|
|
674
|
-
maxlength: Number,
|
|
684
|
+
maxlength: [String, Number],
|
|
675
685
|
/**
|
|
676
686
|
* Input / Textarea placeholder
|
|
677
687
|
* Text that appears in the form control when it has no value set
|
|
@@ -1351,8 +1361,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1351
1361
|
});
|
|
1352
1362
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
1353
1363
|
mode: props.count,
|
|
1354
|
-
upperLimit: props.maxlength,
|
|
1355
|
-
lowerLimit: props.minlength
|
|
1364
|
+
upperLimit: Number(props.maxlength),
|
|
1365
|
+
lowerLimit: Number(props.minlength)
|
|
1356
1366
|
});
|
|
1357
1367
|
const isClickable = computed(() => !props.disabled && !props.readonly);
|
|
1358
1368
|
const hasTabindex = computed(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("maska"),require("@vueuse/core"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","maska","@vueuse/core","@iconify/vue","nanoid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.maska,e.core,e.vue$1,e.nanoid)}(this,(function(e,t,o,l,n){"use strict";function a(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const o=t.split(".");let l=e;for(let t=0,n=o.length;t<n;++t){if(null==e)return null;l=l[o[t]]}return l}}return null}function i(t){return null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length;var o}function r(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const u={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var d=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(d||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),c=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(c||{});const p=Symbol.for("volver");function v(t,o,l){return e.computed((()=>{const n={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(n[`${t}--${e}`]=!0)})),l&&Object.keys(l.value).forEach((o=>{n[`${t}--${o}`]=e.unref(l.value[o])})),n}))}const m=e.defineComponent({name:"VvIcon",props:u,setup(t){const o=t,n=e.ref(!0),a=e.inject(p),{modifiers:i}=e.toRefs(o),r=v("vv-icon",i),u=e.computed((()=>o.provider||(null==a?void 0:a.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${u.value}:${o.prefix}:${o.name}`;return l.iconExists(e)?e:l.iconExists(t)?t:(null==a?void 0:a.iconsCollections.find((t=>{const o=`@${u.value}:${t.prefix}:${e}`;if(l.iconExists(o))return o})))||e}));function s(e){const t=function(e){let t=null;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),n=(null==t?void 0:t.innerHTML.trim())||"";t&&n&&l.addIcon(`@${u.value}:${o.prefix}:${o.name}`,{body:n,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return a&&(o.src&&!l.iconExists(`@${u.value}:${o.prefix}:${o.name}`)?(n.value=!1,a.fetchIcon(o.src).then((e=>{e&&(s(e),n.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):o.svg&&s(o.svg)),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(r)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:t.rotate,color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),f={valid:Boolean,validLabel:[String,Array]},h={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},y=(Boolean,Boolean,{label:[String,Number]}),S={readonly:Boolean},w={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},B={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},E={debounce:[Number,String]},x={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},T={tabindex:{type:[String,Number],default:0}},L={floating:Boolean},A={id:[String,Number]};d.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const C={...{...A,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...T,...g,...S,...f,...h,...k,...b,...w,...B,...E,...x,...L,...y,minlength:Number,maxlength:Number,placeholder:String,required:Boolean};c.button;const P={TEXT:"text",PASSWORD:"password",NUMBER:"number",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",DATE:"date",TIME:"time",DATETIME_LOCAL:"datetime-local",MONTH:"month",WEEK:"week"},I="eye-on",V="eye-off",_="calendar",D="time",R="color",N="close",$={...C,modelValue:[String,Number],type:{type:String,default:P.TEXT,validator:e=>Object.values(P).includes(e)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:I},iconHidePassword:{type:String,default:V},iconClear:{type:String,default:N},labelStepUp:{type:String,default:"Increase value"},labelStepDown:{type:String,default:"Decrease value"},labelShowPassword:{type:String,default:"Show password"},labelHidePassword:{type:String,default:"Hide password"},labelClear:{type:String,default:"Clear"},mask:{type:String,default:void 0},maskEager:{type:Boolean,default:!1},maskReversed:{type:Boolean,default:!1},maskTokens:{type:Object,default:void 0},maskTokensReplace:{type:Boolean,default:!1},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String}},H=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:I},iconHide:{type:String,default:V}},emits:["toggle-password"],setup(t,{emit:o}){const l=e.ref(!1),n=e.computed((()=>l.value?t.iconHide:t.iconShow));return{active:l,activeIcon:n,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(l.value=!l.value,o("toggle-password",l.value))}}},render(){const t=e.h(m,{name:this.activeIcon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.active?this.labelHide:this.labelShow,type:"button",onClick:this.onClick},t)}}),M=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},label:{type:String},mode:{type:String,validator:e=>["up","down"].includes(e),default:"up"}},emits:["step-up","step-down"],setup(t,{emit:o}){const l=e.computed((()=>"up"===t.mode));return{isUp:l,onClick:e=>{null==e||e.stopPropagation(),t.disabled||o(l.value?"step-up":"step-down")}}},render(){return e.h("button",{class:["vv-input-text__action vv-input-text__action-chevron",this.isUp&&"vv-input-text__action-chevron-up"],disabled:this.disabled,ariaLabel:this.label,type:"button",onClick:this.onClick})}}),O=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(o){null==o||o.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(m,{name:this.icon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});function U(t,o){return{name:"VvInputTextActions",components:{VvIcon:m,VvInputPasswordAction:H,VvInputStepAction:M,VvInputClearAction:O},setup:()=>({isDisabled:e.computed((()=>o.disabled||o.readonly)),labelStepUp:o.labelStepUp,labelStepDown:o.labelStepDown,labelShowPassword:o.labelShowPassword,labelHidePassword:o.labelHidePassword,labelClear:o.labelClear,iconShowPassword:o.iconShowPassword,iconHidePassword:o.iconHidePassword}),render(){let l=null;switch(t){case P.SEARCH:{const{onClear:t}=this.$attrs;l=[e.h(O,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case P.PASSWORD:{const{onTogglePassword:t}=this.$attrs;l=[e.h(H,{disabled:this.isDisabled,onTogglePassword:t,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case P.NUMBER:{const{onStepUp:t,onStepDown:n}=this.$attrs;l=[e.h(M,{mode:"up",disabled:this.isDisabled||void 0!==o.max&&o.modelValue===o.max,label:this.labelStepUp,onStepUp:t,onStepDown:n}),e.h(M,{mode:"down",disabled:this.isDisabled||void 0!==o.min&&o.modelValue===o.min,label:this.labelStepDown,onStepUp:t,onStepDown:n})];break}}return Array.isArray(l)?e.h("div",{class:"vv-input-text__actions-group"},l):l}}}const j=["for"],W={class:"vv-input-text__wrapper"},q={key:0,class:"vv-input-text__input-before"},F=["onClick"],z=["id"],X={key:1,class:"vv-input-text__unit"},K={key:5,class:"vv-input-text__input-after"},J={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:$,emits:["update:modelValue","focus","blur","keyup"],setup(l,{expose:u,emit:c}){const p=l,f=e.useSlots(),h=e.ref(),b=e.ref();u({$inner:b});const{id:g,icon:y,iconPosition:S,label:w,modelValue:k,count:B,valid:E,invalid:x,loading:T}=e.toRefs(p),L=(t=>e.computed((()=>String((null==t?void 0:t.value)||n.nanoid()))))(g),A=e.computed((()=>`${L.value}-hint`)),C=e.computed((()=>p.floating&&i(p.placeholder)?" ":p.placeholder)),I=function(t,o,l=0,{getter:n=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof l&&(l=parseInt(l)),e.computed({get:()=>n(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),l)}})}(k,c,p.debounce,{getter:e=>we.value?we.value.masked(e??""):e,setter:e=>(we.value&&(e=we.value.unmasked(e)),p.type===P.NUMBER?Number(e):e)}),{focused:V}=function(t,l){const{focused:n}=o.useFocus(t);return e.watch(n,(o=>{l(o?"focus":"blur",e.unref(t))})),{focused:n}}(h,c),N=e.computed((()=>V.value&&!p.disabled&&!p.readonly)),$=o.useElementVisibility(h);e.watch($,(e=>{e&&p.autofocus&&!p.disabled&&!p.readonly&&(V.value=!0)}));const H=e.ref(!1),M=e.computed((()=>p.type===P.PASSWORD)),O=()=>{H.value=!H.value},G=e.computed((()=>p.type===P.TIME||p.type===P.DATETIME_LOCAL||p.type===P.DATE||p.type===P.WEEK||p.type===P.MONTH)),Q=e.computed((()=>p.type===P.NUMBER)),Y=()=>{re.value&&(h.value.stepUp(),I.value=e.unref(h).value)},Z=()=>{re.value&&(h.value.stepDown(),I.value=e.unref(h).value)},ee=e.computed((()=>p.type===P.SEARCH)),te=()=>{I.value=void 0},{hasIcon:oe,hasIconBefore:le,hasIconAfter:ne}=function(t,o){const l=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.before))),n=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.after))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.top))),u=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:a,hasIconRight:i,hasIconTop:r,hasIconBottom:u,hasIconBefore:l,hasIconAfter:n}}(y,S),ae=e.computed((()=>{switch(p.type){case P.COLOR:return{name:R};case P.DATE:case P.DATETIME_LOCAL:case P.WEEK:case P.MONTH:return{name:_};case P.TIME:return{name:D};default:return""}})),{formatted:ie}=function(t,o){const l=e.computed((()=>(e.unref(t)??"").length)),n=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&l.value<(null==o?void 0:o.lowerLimit)?l.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&l.value<(null==o?void 0:o.upperLimit)?o.upperLimit-l.value:0)),a=e.computed((()=>{if(!1===(null==o?void 0:o.mode))return"";if("limit"===(null==o?void 0:o.mode)&&(null==o?void 0:o.upperLimit))return`${l.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===n.value)return;return n}return l.value}));return{length:l,gap:n,formatted:a}}(I,{mode:p.count,upperLimit:p.maxlength,lowerLimit:p.minlength}),re=e.computed((()=>!p.disabled&&!p.readonly)),ue=e.computed((()=>re.value?p.tabindex:-1)),de=e.computed((()=>!i(k))),se=e.computed((()=>!0===x.value||!0!==E.value&&void 0)),{modifiers:ce}=e.toRefs(p),pe=v("vv-input-text",ce,e.computed((()=>({valid:E.value,invalid:x.value,loading:T.value,disabled:p.disabled,readonly:p.readonly,"icon-before":le.value,"icon-after":ne.value||!i(ae),floating:p.floating&&!i(p.label),dirty:de.value,focus:N.value,"auto-width":p.autoWidth})))),ve=e.computed((()=>{const e=M.value&&H.value?P.TEXT:!G.value||de.value||V.value?p.type:P.TEXT,t={type:e,name:p.name,tabindex:ue.value,disabled:p.disabled,readonly:p.readonly,required:p.required,autocomplete:p.autocomplete,"aria-invalid":se.value,"aria-describedby":!be.value&&he.value?A.value:void 0,"aria-errormessage":be.value?A.value:void 0};return e!==P.DATE&&e!==P.MONTH&&e!==P.WEEK&&e!==P.TIME&&e!==P.DATETIME_LOCAL&&e!==P.NUMBER||(t.step=p.step,t.max=void 0!==p.max?String(p.max):void 0,t.min=void 0!==p.min?String(p.min):void 0),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD&&e!==P.NUMBER||(t.placeholder=C.value),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD||(t.minlength=p.minlength,t.maxlength=p.maxlength,t.pattern=p.pattern),e===P.EMAIL&&(t.multiple=p.multiple),t})),me=e.computed((()=>({valid:p.valid,invalid:p.invalid,modelValue:p.modelValue,togglePassword:O,stepUp:Y,stepDown:Z,clear:te}))),{HintSlot:fe,hasHint:he,hasInvalid:be}=function(t,l){const{invalid:n,valid:u,hint:d,loading:s}=l,{hintLabel:c,modelValue:p,valid:v,validLabel:m,invalid:f,invalidLabel:h,...b}=e.toRefs(t),g=a(b,"loading"),y=a(b,"loadingLabel"),S=e.computed((()=>!(!f.value||(!f.value||!n)&&!((null==h?void 0:h.value)&&Array.isArray(h.value)&&h.value.length>0)&&(!(null==h?void 0:h.value)||i(h))))),w=e.computed((()=>!!(c&&c.value||d))),k=e.computed((()=>!!(m&&m.value||u))),B=e.computed((()=>!!((null==g?void 0:g.value)&&s||(null==g?void 0:g.value)&&(null==y?void 0:y.value)))),E=e.computed((()=>w.value||k.value||S.value||B.value));return{hasInvalid:S,hasHint:w,hasValid:k,hasLoading:B,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(t){const l=e.computed((()=>{const e=o.toReactive({hintLabel:c,modelValue:p,valid:v,validLabel:m,invalid:f,invalidLabel:h,loading:g,loadingLabel:y,...t.params});return(null==f?void 0:f.value)?(null==n?void 0:n(e))||r(null==h?void 0:h.value)||(null==c?void 0:c.value):(null==v?void 0:v.value)?(null==u?void 0:u(e))||r(null==m?void 0:m.value)||(null==c?void 0:c.value):(null==g?void 0:g.value)?(null==s?void 0:s(e))||r(null==y?void 0:y.value)||(null==c?void 0:c.value):(null==d?void 0:d(e))||r(null==c?void 0:c.value)||(null==c?void 0:c.value)}));return{isVisible:E,hasInvalid:S,hasValid:k,hintContent:l}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}(p,f),ge=U(P.PASSWORD,p),ye=U(P.NUMBER,p),Se=U(P.SEARCH,p),we=e.ref();e.watch([()=>p.mask,()=>p.type,()=>p.maskEager,()=>p.maskReversed,()=>p.maskTokens,()=>p.maskTokensReplace],(([e,o,l,n,a,i])=>{e&&o===P.TEXT?we.value=new t.Mask({mask:e,eager:l,reversed:n,tokens:a,tokensReplace:i}):we.value=void 0}),{immediate:!0});const ke=()=>{re.value&&(V.value=!0)},Be=e.computed((()=>{if(p.autoWidth)return{width:void 0!==I.value?`${String(I.value).length+1}ch`:void 0}}));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(pe))},[e.unref(w)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(L),class:"vv-input-text__label"},e.toDisplayString(e.unref(w)),9,j)):e.createCommentVNode("",!0),e.createElementVNode("div",W,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(me))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:b,class:"vv-input-text__inner",onClick:e.withModifiers(ke,["stop"])},[e.unref(le)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(oe)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(L),ref_key:"inputEl",ref:h,"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef(I)?I.value=t:null)},e.unref(ve),{style:e.unref(Be),onKeyup:o[1]||(o[1]=e=>c("keyup",e))}),null,16,z),[[e.vModelDynamic,e.unref(I)]]),(t.unit||t.$slots.unit)&&e.unref(de)?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(me))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,F),e.unref(ne)||e.unref(ae)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(ne)?e.unref(oe):e.unref(ae)),null,16)):e.unref(M)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(ge),{key:2,onTogglePassword:O})):e.unref(Q)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(ye),{key:3,onStepUp:Y,onStepDown:Z})):e.unref(ee)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(Se),{key:4,onClear:te})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(me))))])):e.createCommentVNode("",!0),e.unref(B)?(e.openBlock(),e.createElementBlock("span",J,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(me))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ie)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(fe),{id:e.unref(A),class:"vv-input-text__hint"},null,8,["id"])],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("maska"),require("@vueuse/core"),require("@iconify/vue"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","maska","@vueuse/core","@iconify/vue","nanoid"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputText=t(e.vue,e.maska,e.core,e.vue$1,e.nanoid)}(this,(function(e,t,o,n,l){"use strict";function a(e,t){if(e&&Object.keys(e).length&&t){if(-1===t.indexOf("."))return e[t];{const o=t.split(".");let n=e;for(let t=0,l=o.length;t<l;++t){if(null==e)return null;n=n[o[t]]}return n}}return null}function i(t){return null==(o=e.unref(t))||""===o||Array.isArray(o)&&0===o.length||!(o instanceof Date)&&"object"==typeof o&&0===Object.keys(o).length;var o}function r(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(t=e)||t instanceof String;var t})).join(" "):e}const u={color:String,width:{type:[String,Number]},height:{type:[String,Number]},name:{type:String,required:!0},provider:{type:String},prefix:{type:String,default:"normal"},src:String,horizontalFlip:Boolean,verticalFlip:Boolean,flip:String,mode:String,inline:Boolean,rotate:[Number,String],onLoad:Function,svg:String,modifiers:{type:[String,Array]}};var d=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(d||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),c=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(c||{});const p=Symbol.for("volver");function v(t,o,n){return e.computed((()=>{const l={[t]:!0},a="string"==typeof(null==o?void 0:o.value)?o.value.split(" "):null==o?void 0:o.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(l[`${t}--${e}`]=!0)})),n&&Object.keys(n.value).forEach((o=>{l[`${t}--${o}`]=e.unref(n.value[o])})),l}))}const m=e.defineComponent({name:"VvIcon",props:u,setup(t){const o=t,l=e.ref(!0),a=e.inject(p),{modifiers:i}=e.toRefs(o),r=v("vv-icon",i),u=e.computed((()=>o.provider||(null==a?void 0:a.iconsProvider))),d=e.computed((()=>{const e=o.name??"",t=`@${u.value}:${o.prefix}:${o.name}`;return n.iconExists(e)?e:n.iconExists(t)?t:(null==a?void 0:a.iconsCollections.find((t=>{const o=`@${u.value}:${t.prefix}:${e}`;if(n.iconExists(o))return o})))||e}));function s(e){const t=function(e){let t=null;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),l=(null==t?void 0:t.innerHTML.trim())||"";t&&l&&n.addIcon(`@${u.value}:${o.prefix}:${o.name}`,{body:l,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return a&&(o.src&&!n.iconExists(`@${u.value}:${o.prefix}:${o.name}`)?(l.value=!1,a.fetchIcon(o.src).then((e=>{e&&(s(e),l.value=!0)})).catch((e=>{throw new Error(`During fetch icon: ${null==e?void 0:e.message}`)}))):o.svg&&s(o.svg)),(t,o)=>e.unref(l)?(e.openBlock(),e.createBlock(e.unref(n.Icon),e.mergeProps({key:0,class:e.unref(r)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:t.rotate,color:t.color,onLoad:t.onLoad,icon:e.unref(d)}),null,16,["class"])):e.createCommentVNode("",!0)}}),f={valid:Boolean,validLabel:[String,Array]},h={invalid:Boolean,invalidLabel:[String,Array]},b={loading:Boolean,loadingLabel:{type:String,default:"Loading..."}},g={disabled:Boolean},y=(Boolean,Boolean,{label:[String,Number]}),S={readonly:Boolean},w={modifiers:[String,Array]},k={hintLabel:{type:String,default:""}},B={count:{type:[Boolean,String],default:!1,validator:e=>[!0,!1,"limit","countdown"].includes(e)}},E={debounce:[Number,String]},x={icon:{type:[String,Object]},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},T={tabindex:{type:[String,Number],default:0}},L={floating:Boolean},A={id:[String,Number]};d.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const C={...{...A,name:{type:String,required:!0}},...{autofocus:Boolean},...{autocomplete:{type:String,default:"off"}},...T,...g,...S,...f,...h,...k,...b,...w,...B,...E,...x,...L,...y,minlength:[String,Number],maxlength:[String,Number],placeholder:String,required:Boolean};c.button;const P={TEXT:"text",PASSWORD:"password",NUMBER:"number",EMAIL:"email",TEL:"tel",URL:"url",COLOR:"color",SEARCH:"search",DATE:"date",TIME:"time",DATETIME_LOCAL:"datetime-local",MONTH:"month",WEEK:"week"},I="eye-on",V="eye-off",_="calendar",D="time",N="color",R="close",$={...C,modelValue:[String,Number],type:{type:String,default:P.TEXT,validator:e=>Object.values(P).includes(e)},min:[Number,Date,String],max:[Number,Date,String],step:{type:[String,Number],default:1},pattern:String,multiple:Boolean,iconShowPassword:{type:String,default:I},iconHidePassword:{type:String,default:V},iconClear:{type:String,default:R},labelStepUp:{type:String,default:"Increase value"},labelStepDown:{type:String,default:"Decrease value"},labelShowPassword:{type:String,default:"Show password"},labelHidePassword:{type:String,default:"Hide password"},labelClear:{type:String,default:"Clear"},mask:{type:String,default:void 0},maskEager:{type:Boolean,default:!1},maskReversed:{type:Boolean,default:!1},maskTokens:{type:Object,default:void 0},maskTokensReplace:{type:Boolean,default:!1},autoWidth:{type:Boolean,default:!1},hideActions:{type:Boolean,default:!1},unit:{type:String}},H=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},labelShow:{type:String,default:"Show password"},labelHide:{type:String,default:"Hide password"},iconShow:{type:String,default:I},iconHide:{type:String,default:V}},emits:["toggle-password"],setup(t,{emit:o}){const n=e.ref(!1),l=e.computed((()=>n.value?t.iconHide:t.iconShow));return{active:n,activeIcon:l,onClick:function(e){null==e||e.stopPropagation(),t.disabled||(n.value=!n.value,o("toggle-password",n.value))}}},render(){const t=e.h(m,{name:this.activeIcon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.active?this.labelHide:this.labelShow,type:"button",onClick:this.onClick},t)}}),M=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},label:{type:String},mode:{type:String,validator:e=>["up","down"].includes(e),default:"up"}},emits:["step-up","step-down"],setup(t,{emit:o}){const n=e.computed((()=>"up"===t.mode));return{isUp:n,onClick:e=>{null==e||e.stopPropagation(),t.disabled||o(n.value?"step-up":"step-down")}}},render(){return e.h("button",{class:["vv-input-text__action vv-input-text__action-chevron",this.isUp&&"vv-input-text__action-chevron-up"],disabled:this.disabled,ariaLabel:this.label,type:"button",onClick:this.onClick})}}),O=e.defineComponent({components:{VvIcon:m},props:{disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:String,default:"close"}},emits:["clear"],setup:(e,{emit:t})=>({onClick:function(o){null==o||o.stopPropagation(),e.disabled||t("clear")}}),render(){const t=e.h(m,{name:this.icon,class:"vv-input-text__icon"});return e.h("button",{disabled:this.disabled,class:"vv-input-text__action",ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});function U(t,o){return{name:"VvInputTextActions",components:{VvIcon:m,VvInputPasswordAction:H,VvInputStepAction:M,VvInputClearAction:O},setup:()=>({isDisabled:e.computed((()=>o.disabled||o.readonly)),labelStepUp:o.labelStepUp,labelStepDown:o.labelStepDown,labelShowPassword:o.labelShowPassword,labelHidePassword:o.labelHidePassword,labelClear:o.labelClear,iconShowPassword:o.iconShowPassword,iconHidePassword:o.iconHidePassword}),render(){let n=null;switch(t){case P.SEARCH:{const{onClear:t}=this.$attrs;n=[e.h(O,{disabled:this.isDisabled,label:this.labelShowPassword,onClear:t})];break}case P.PASSWORD:{const{onTogglePassword:t}=this.$attrs;n=[e.h(H,{disabled:this.isDisabled,onTogglePassword:t,labelShow:this.labelShowPassword,labelHide:this.labelHidePassword,iconShow:this.iconShowPassword,iconHide:this.iconHidePassword})];break}case P.NUMBER:{const{onStepUp:t,onStepDown:l}=this.$attrs;n=[e.h(M,{mode:"up",disabled:this.isDisabled||void 0!==o.max&&o.modelValue===o.max,label:this.labelStepUp,onStepUp:t,onStepDown:l}),e.h(M,{mode:"down",disabled:this.isDisabled||void 0!==o.min&&o.modelValue===o.min,label:this.labelStepDown,onStepUp:t,onStepDown:l})];break}}return Array.isArray(n)?e.h("div",{class:"vv-input-text__actions-group"},n):n}}}const j=["for"],W={class:"vv-input-text__wrapper"},q={key:0,class:"vv-input-text__input-before"},F=["onClick"],z=["id"],X={key:1,class:"vv-input-text__unit"},K={key:5,class:"vv-input-text__input-after"},J={key:6,class:"vv-input-text__limit"};return e.defineComponent({name:"VvInputText",props:$,emits:["update:modelValue","focus","blur","keyup"],setup(n,{expose:u,emit:c}){const p=n,f=e.useSlots(),h=e.ref(),b=e.ref();u({$inner:b});const{id:g,icon:y,iconPosition:S,label:w,modelValue:k,count:B,valid:E,invalid:x,loading:T}=e.toRefs(p),L=(t=>e.computed((()=>String((null==t?void 0:t.value)||l.nanoid()))))(g),A=e.computed((()=>`${L.value}-hint`)),C=e.computed((()=>p.floating&&i(p.placeholder)?" ":p.placeholder)),I=function(t,o,n=0,{getter:l=(e=>e),setter:a=(e=>e)}={}){let i;return"string"==typeof n&&(n=parseInt(n)),e.computed({get:()=>l(null==t?void 0:t.value),set:e=>{i&&clearTimeout(i),i=setTimeout((()=>{o("update:modelValue",a(e))}),n)}})}(k,c,p.debounce,{getter:e=>we.value?we.value.masked(e??""):e,setter:e=>(we.value&&(e=we.value.unmasked(e)),p.type===P.NUMBER?Number(e):e)}),{focused:V}=function(t,n){const{focused:l}=o.useFocus(t);return e.watch(l,(o=>{n(o?"focus":"blur",e.unref(t))})),{focused:l}}(h,c),R=e.computed((()=>V.value&&!p.disabled&&!p.readonly)),$=o.useElementVisibility(h);e.watch($,(e=>{e&&p.autofocus&&!p.disabled&&!p.readonly&&(V.value=!0)}));const H=e.ref(!1),M=e.computed((()=>p.type===P.PASSWORD)),O=()=>{H.value=!H.value},G=e.computed((()=>p.type===P.TIME||p.type===P.DATETIME_LOCAL||p.type===P.DATE||p.type===P.WEEK||p.type===P.MONTH)),Q=e.computed((()=>p.type===P.NUMBER)),Y=()=>{re.value&&(h.value.stepUp(),I.value=e.unref(h).value)},Z=()=>{re.value&&(h.value.stepDown(),I.value=e.unref(h).value)},ee=e.computed((()=>p.type===P.SEARCH)),te=()=>{I.value=void 0},{hasIcon:oe,hasIconBefore:ne,hasIconAfter:le}=function(t,o){const n=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.before))),l=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===s.after))),a=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.left))),i=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.right))),r=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.top))),u=e.computed((()=>Boolean((null==t?void 0:t.value)&&o.value===d.bottom)));return{hasIcon:e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),hasIconLeft:a,hasIconRight:i,hasIconTop:r,hasIconBottom:u,hasIconBefore:n,hasIconAfter:l}}(y,S),ae=e.computed((()=>{switch(p.type){case P.COLOR:return{name:N};case P.DATE:case P.DATETIME_LOCAL:case P.WEEK:case P.MONTH:return{name:_};case P.TIME:return{name:D};default:return""}})),{formatted:ie}=function(t,o){const n=e.computed((()=>(e.unref(t)??"").length)),l=e.computed((()=>void 0!==(null==o?void 0:o.lowerLimit)&&n.value<(null==o?void 0:o.lowerLimit)?n.value-o.lowerLimit:void 0!==(null==o?void 0:o.upperLimit)&&n.value<(null==o?void 0:o.upperLimit)?o.upperLimit-n.value:0)),a=e.computed((()=>{if(!1===(null==o?void 0:o.mode))return"";if("limit"===(null==o?void 0:o.mode)&&(null==o?void 0:o.upperLimit))return`${n.value} / ${o.lowerLimit?`${o.lowerLimit}-`:""}${o.upperLimit}`;if("countdown"===(null==o?void 0:o.mode)){if(0===l.value)return;return l}return n.value}));return{length:n,gap:l,formatted:a}}(I,{mode:p.count,upperLimit:Number(p.maxlength),lowerLimit:Number(p.minlength)}),re=e.computed((()=>!p.disabled&&!p.readonly)),ue=e.computed((()=>re.value?p.tabindex:-1)),de=e.computed((()=>!i(k))),se=e.computed((()=>!0===x.value||!0!==E.value&&void 0)),{modifiers:ce}=e.toRefs(p),pe=v("vv-input-text",ce,e.computed((()=>({valid:E.value,invalid:x.value,loading:T.value,disabled:p.disabled,readonly:p.readonly,"icon-before":ne.value,"icon-after":le.value||!i(ae),floating:p.floating&&!i(p.label),dirty:de.value,focus:R.value,"auto-width":p.autoWidth})))),ve=e.computed((()=>{const e=M.value&&H.value?P.TEXT:!G.value||de.value||V.value?p.type:P.TEXT,t={type:e,name:p.name,tabindex:ue.value,disabled:p.disabled,readonly:p.readonly,required:p.required,autocomplete:p.autocomplete,"aria-invalid":se.value,"aria-describedby":!be.value&&he.value?A.value:void 0,"aria-errormessage":be.value?A.value:void 0};return e!==P.DATE&&e!==P.MONTH&&e!==P.WEEK&&e!==P.TIME&&e!==P.DATETIME_LOCAL&&e!==P.NUMBER||(t.step=p.step,t.max=void 0!==p.max?String(p.max):void 0,t.min=void 0!==p.min?String(p.min):void 0),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD&&e!==P.NUMBER||(t.placeholder=C.value),e!==P.TEXT&&e!==P.SEARCH&&e!==P.URL&&e!==P.TEL&&e!==P.EMAIL&&e!==P.PASSWORD||(t.minlength=p.minlength,t.maxlength=p.maxlength,t.pattern=p.pattern),e===P.EMAIL&&(t.multiple=p.multiple),t})),me=e.computed((()=>({valid:p.valid,invalid:p.invalid,modelValue:p.modelValue,togglePassword:O,stepUp:Y,stepDown:Z,clear:te}))),{HintSlot:fe,hasHint:he,hasInvalid:be}=function(t,n){const{invalid:l,valid:u,hint:d,loading:s}=n,{hintLabel:c,modelValue:p,valid:v,validLabel:m,invalid:f,invalidLabel:h,...b}=e.toRefs(t),g=a(b,"loading"),y=a(b,"loadingLabel"),S=e.computed((()=>!(!f.value||(!f.value||!l)&&!((null==h?void 0:h.value)&&Array.isArray(h.value)&&h.value.length>0)&&(!(null==h?void 0:h.value)||i(h))))),w=e.computed((()=>!!(c&&c.value||d))),k=e.computed((()=>!!(m&&m.value||u))),B=e.computed((()=>!!((null==g?void 0:g.value)&&s||(null==g?void 0:g.value)&&(null==y?void 0:y.value)))),E=e.computed((()=>w.value||k.value||S.value||B.value));return{hasInvalid:S,hasHint:w,hasValid:k,hasLoading:B,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(t){const n=e.computed((()=>{const e=o.toReactive({hintLabel:c,modelValue:p,valid:v,validLabel:m,invalid:f,invalidLabel:h,loading:g,loadingLabel:y,...t.params});return(null==f?void 0:f.value)?(null==l?void 0:l(e))||r(null==h?void 0:h.value)||(null==c?void 0:c.value):(null==v?void 0:v.value)?(null==u?void 0:u(e))||r(null==m?void 0:m.value)||(null==c?void 0:c.value):(null==g?void 0:g.value)?(null==s?void 0:s(e))||r(null==y?void 0:y.value)||(null==c?void 0:c.value):(null==d?void 0:d(e))||r(null==c?void 0:c.value)||(null==c?void 0:c.value)}));return{isVisible:E,hasInvalid:S,hasValid:k,hintContent:n}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}(p,f),ge=U(P.PASSWORD,p),ye=U(P.NUMBER,p),Se=U(P.SEARCH,p),we=e.ref();e.watch([()=>p.mask,()=>p.type,()=>p.maskEager,()=>p.maskReversed,()=>p.maskTokens,()=>p.maskTokensReplace],(([e,o,n,l,a,i])=>{e&&o===P.TEXT?we.value=new t.Mask({mask:e,eager:n,reversed:l,tokens:a,tokensReplace:i}):we.value=void 0}),{immediate:!0});const ke=()=>{re.value&&(V.value=!0)},Be=e.computed((()=>{if(p.autoWidth)return{width:void 0!==I.value?`${String(I.value).length+1}ch`:void 0}}));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(pe))},[e.unref(w)?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(L),class:"vv-input-text__label"},e.toDisplayString(e.unref(w)),9,j)):e.createCommentVNode("",!0),e.createElementVNode("div",W,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",q,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(me))))])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"innerEl",ref:b,class:"vv-input-text__inner",onClick:e.withModifiers(ke,["stop"])},[e.unref(ne)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"vv-input-text__icon"},e.unref(oe)),null,16)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({id:e.unref(L),ref_key:"inputEl",ref:h,"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef(I)?I.value=t:null)},e.unref(ve),{style:e.unref(Be),onKeyup:o[1]||(o[1]=e=>c("keyup",e))}),null,16,z),[[e.vModelDynamic,e.unref(I)]]),(t.unit||t.$slots.unit)&&e.unref(de)?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(me))),(()=>[e.createTextVNode(e.toDisplayString(t.unit),1)]))])):e.createCommentVNode("",!0)],8,F),e.unref(le)||e.unref(ae)?(e.openBlock(),e.createBlock(m,e.mergeProps({key:1,class:"vv-input-text__icon vv-input-text__icon-after"},e.unref(le)?e.unref(oe):e.unref(ae)),null,16)):e.unref(M)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(ge),{key:2,onTogglePassword:O})):e.unref(Q)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(ye),{key:3,onStepUp:Y,onStepDown:Z})):e.unref(ee)&&!t.hideActions&&e.unref(re)?(e.openBlock(),e.createBlock(e.unref(Se),{key:4,onClear:te})):e.createCommentVNode("",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",K,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(me))))])):e.createCommentVNode("",!0),e.unref(B)?(e.openBlock(),e.createElementBlock("span",J,[e.renderSlot(t.$slots,"count",e.normalizeProps(e.guardReactiveProps(e.unref(me))),(()=>[e.createTextVNode(e.toDisplayString(e.unref(ie)),1)]))])):e.createCommentVNode("",!0)]),e.createVNode(e.unref(fe),{id:e.unref(A),class:"vv-input-text__hint"},null,8,["id"])],2))}})}));
|
|
@@ -76,8 +76,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
76
76
|
unit: {
|
|
77
77
|
type: StringConstructor;
|
|
78
78
|
};
|
|
79
|
-
minlength: NumberConstructor;
|
|
80
|
-
maxlength: NumberConstructor;
|
|
79
|
+
minlength: (StringConstructor | NumberConstructor)[];
|
|
80
|
+
maxlength: (StringConstructor | NumberConstructor)[];
|
|
81
81
|
placeholder: StringConstructor;
|
|
82
82
|
required: BooleanConstructor;
|
|
83
83
|
label: (StringConstructor | NumberConstructor)[];
|
|
@@ -206,8 +206,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
206
206
|
unit: {
|
|
207
207
|
type: StringConstructor;
|
|
208
208
|
};
|
|
209
|
-
minlength: NumberConstructor;
|
|
210
|
-
maxlength: NumberConstructor;
|
|
209
|
+
minlength: (StringConstructor | NumberConstructor)[];
|
|
210
|
+
maxlength: (StringConstructor | NumberConstructor)[];
|
|
211
211
|
placeholder: StringConstructor;
|
|
212
212
|
required: BooleanConstructor;
|
|
213
213
|
label: (StringConstructor | NumberConstructor)[];
|
|
@@ -192,8 +192,8 @@ export declare const VvInputTextProps: {
|
|
|
192
192
|
unit: {
|
|
193
193
|
type: StringConstructor;
|
|
194
194
|
};
|
|
195
|
-
minlength: NumberConstructor;
|
|
196
|
-
maxlength: NumberConstructor;
|
|
195
|
+
minlength: (StringConstructor | NumberConstructor)[];
|
|
196
|
+
maxlength: (StringConstructor | NumberConstructor)[];
|
|
197
197
|
placeholder: StringConstructor;
|
|
198
198
|
required: BooleanConstructor;
|
|
199
199
|
label: (StringConstructor | NumberConstructor)[];
|
|
@@ -118,6 +118,16 @@ const ModifiersProps = {
|
|
|
118
118
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
|
+
/**
|
|
122
|
+
* Dropdown strategy
|
|
123
|
+
*/
|
|
124
|
+
strategy: {
|
|
125
|
+
type: String,
|
|
126
|
+
default: "absolute",
|
|
127
|
+
validator: (value) => {
|
|
128
|
+
return ["fixed", "absolute"].includes(value);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
121
131
|
/**
|
|
122
132
|
* Dropdown show / hide transition name
|
|
123
133
|
*/
|
|
@@ -164,6 +164,16 @@ const IdProps = {
|
|
|
164
164
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
|
+
/**
|
|
168
|
+
* Dropdown strategy
|
|
169
|
+
*/
|
|
170
|
+
strategy: {
|
|
171
|
+
type: String,
|
|
172
|
+
default: "absolute",
|
|
173
|
+
validator: (value) => {
|
|
174
|
+
return ["fixed", "absolute"].includes(value);
|
|
175
|
+
}
|
|
176
|
+
},
|
|
167
177
|
/**
|
|
168
178
|
* Dropdown show / hide transition name
|
|
169
179
|
*/
|
|
@@ -377,6 +377,16 @@ const IdProps = {
|
|
|
377
377
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
378
378
|
}
|
|
379
379
|
},
|
|
380
|
+
/**
|
|
381
|
+
* Dropdown strategy
|
|
382
|
+
*/
|
|
383
|
+
strategy: {
|
|
384
|
+
type: String,
|
|
385
|
+
default: "absolute",
|
|
386
|
+
validator: (value) => {
|
|
387
|
+
return ["fixed", "absolute"].includes(value);
|
|
388
|
+
}
|
|
389
|
+
},
|
|
380
390
|
/**
|
|
381
391
|
* Dropdown show / hide transition name
|
|
382
392
|
*/
|
|
@@ -724,11 +734,17 @@ function useOptions(props) {
|
|
|
724
734
|
return false;
|
|
725
735
|
return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
|
|
726
736
|
};
|
|
737
|
+
const getOptionGrouped = (option) => {
|
|
738
|
+
if (typeof option !== "object" && option !== null)
|
|
739
|
+
return [];
|
|
740
|
+
return option.options;
|
|
741
|
+
};
|
|
727
742
|
return {
|
|
728
743
|
options,
|
|
729
744
|
getOptionLabel,
|
|
730
745
|
getOptionValue,
|
|
731
|
-
getOptionDisabled
|
|
746
|
+
getOptionDisabled,
|
|
747
|
+
getOptionGrouped
|
|
732
748
|
};
|
|
733
749
|
}
|
|
734
750
|
const _hoisted_1 = ["textContent"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@vueuse/core"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadioGroup=l(e.vue,e.core,e.nanoid)}(this,(function(e,l,n){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),o=(e=>(e.before="before",e.after="after",e))(o||{}),a=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(a||{});const u=Symbol.for("radioGroup");function i(e,l,n){return n?d(e,n)===d(l,n):r(e,l)}function r(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const n=Array.isArray(e),t=Array.isArray(l);let o,a,u;if(n&&t){if(a=e.length,a!=l.length)return!1;for(o=a;0!=o--;)if(!r(e[o],l[o]))return!1;return!0}if(n!=t)return!1;const i=e instanceof Date,d=l instanceof Date;if(i!=d)return!1;if(i&&d)return e.getTime()==l.getTime();const v=e instanceof RegExp,s=l instanceof RegExp;if(v!=s)return!1;if(v&&s)return e.toString()==l.toString();const c=Object.keys(e);if(a=c.length,a!==Object.keys(l).length)return!1;for(o=a;0!=o--;)if(!Object.prototype.hasOwnProperty.call(l,c[o]))return!1;for(o=a;0!=o--;)if(u=c[o],!r(e[u],l[u]))return!1;return!0}return e!=e&&l!=l}function d(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const n=l.split(".");let t=e;for(let l=0,o=n.length;l<o;++l){if(null==e)return null;t=t[n[l]]}return t}}return null}function v(l){return null==(n=e.unref(l))||""===n||Array.isArray(n)&&0===n.length||!(n instanceof Date)&&"object"==typeof n&&0===Object.keys(n).length;var n}function s(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function c(n,t){const{invalid:o,valid:a,hint:u,loading:i}=t,{hintLabel:r,modelValue:c,valid:f,validLabel:p,invalid:m,invalidLabel:b,...y}=e.toRefs(n),g=d(y,"loading"),h=d(y,"loadingLabel"),S=e.computed((()=>!!m.value&&(!(!m.value||!o)||(!!((null==b?void 0:b.value)&&Array.isArray(b.value)&&b.value.length>0)||!(!(null==b?void 0:b.value)||v(b)))))),B=e.computed((()=>!!(r&&r.value||u))),V=e.computed((()=>!!(p&&p.value||a))),k=e.computed((()=>!!((null==g?void 0:g.value)&&i||(null==g?void 0:g.value)&&(null==h?void 0:h.value)))),A=e.computed((()=>B.value||V.value||S.value||k.value));return{hasInvalid:S,hasHint:B,hasValid:V,hasLoading:k,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(n){const t=e.computed((()=>{const e=l.toReactive({hintLabel:r,modelValue:c,valid:f,validLabel:p,invalid:m,invalidLabel:b,loading:g,loadingLabel:h,...n.params});return(null==m?void 0:m.value)?(null==o?void 0:o(e))||s(null==b?void 0:b.value)||(null==r?void 0:r.value):(null==f?void 0:f.value)?(null==a?void 0:a(e))||s(null==p?void 0:p.value)||(null==r?void 0:r.value):(null==g?void 0:g.value)?(null==i?void 0:i(e))||s(null==h?void 0:h.value)||(null==r?void 0:r.value):(null==u?void 0:u(e))||s(null==r?void 0:r.value)||(null==r?void 0:r.value)}));return{isVisible:A,hasInvalid:S,hasValid:V,hintContent:t}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}const f={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},m={disabled:Boolean},b=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},g={modifiers:[String,Array]},h={hintLabel:{type:String,default:""}},S={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};o.before;const B={tabindex:{type:[String,Number],default:0}},V={id:[String,Number]};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const k={...{...V,name:{type:String,required:!0}},...B,...f,...p,...h,...m,...y,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},A={...f,...p,...S,...h,...m,...y,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};a.button;const O=k;function j(l,n){const{id:t}=e.toRefs(l),{group:o,isInGroup:a,getGroupOrLocalRef:i}=function(l){const n=e.inject(l,void 0),t=e.computed((()=>!v(n)));return{group:n,isInGroup:t,getGroupOrLocalRef:function(l,t,o){if(null==n?void 0:n.value){const t=e.unref(n.value)[l];return e.computed({get:()=>null==t?void 0:t.value,set(e){t.value=e}})}const a=e.toRef(t,l);return e.computed({get:()=>a.value,set(e){o&&o(`update:${l}`,e)}})}}}(u),r=i("modelValue",l,n),d=i("valid",l),s=i("invalid",l),c=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))})),f=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{id:t,group:o,isInGroup:a,modelValue:r,valid:d,invalid:s,readonly:c,disabled:f}}function L(l,n,t){return e.computed((()=>{const o={[l]:!0},a="string"==typeof(null==n?void 0:n.value)?n.value.split(" "):null==n?void 0:n.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(o[`${l}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((n=>{o[`${l}--${n}`]=e.unref(t.value[n])})),o}))}const R=["for"],x=["id","name","disabled","value","tabindex","aria-invalid"],N=e.defineComponent({name:"VvRadio",props:O,emits:["click","update:modelValue","change","blur"],setup(l,{emit:t}){const o=l,a=e.useSlots(),{id:u,disabled:r,readonly:d,modelValue:v,valid:s,invalid:f}=j(o,t),p=(l=>e.computed((()=>String((null==l?void 0:l.value)||n.nanoid()))))(u),m=e.computed((()=>y.value?-1:o.tabindex)),b=e.ref(),y=e.computed((()=>r.value||d.value)),g=e.computed((()=>!0===f.value||!0!==s.value&&void 0)),h=e.computed((()=>Array.isArray(v.value)?function(e,l){if(null!=e&&l&&l.length)for(const n of l)if(i(e,n))return!0;return!1}(o.value,v.value):i(o.value,v.value))),S=e.computed((()=>!["string","number","boolean"].includes(typeof o.value)||o.value)),B=e.computed({get:()=>h.value?S.value:null,set(e){Array.isArray(v.value)?v.value=[o.value]:v.value=o.value,t("change",e)}}),{modifiers:V}=e.toRefs(o),k=L("vv-radio",V,e.computed((()=>({valid:s.value,invalid:f.value,disabled:r.value,readonly:d.value})))),{HintSlot:A}=c(o,a);return(l,n)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(k)),for:e.unref(p)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(p),ref_key:"input",ref:b,"onUpdate:modelValue":n[0]||(n[0]=l=>e.isRef(B)?B.value=l:null),type:"radio",class:"vv-radio__input",name:l.name,disabled:e.unref(y),value:e.unref(S),tabindex:e.unref(m),"aria-invalid":e.unref(g)},null,8,x),[[e.vModelRadio,e.unref(B)]]),e.renderSlot(l.$slots,"default",{value:e.unref(v)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(A),{class:"vv-radio__hint",params:{value:e.unref(v)}},null,8,["params"])],10,R))}}),E=A;const _=["textContent"],C={class:"vv-radio-group__wrapper"};return e.defineComponent({name:"VvRadioGroup",props:E,emits:["update:modelValue","change"],setup(n,{emit:t}){const o=n,a=e.useSlots(),i=l.useVModel(o,"modelValue",t),{disabled:r,readonly:d,vertical:v,valid:s,invalid:f,modifiers:p}=e.toRefs(o);!function(l){if(Object.keys(l).some((n=>"key"!==n&&!e.isRef(l[n]))))throw Error("One or more groupState props aren't ref.");e.provide(l.key,e.computed((()=>l)))}({key:u,modelValue:i,disabled:r,readonly:d,valid:s,invalid:f});const{getOptionLabel:m,getOptionValue:b}=function(l){const{options:n,labelKey:t,valueKey:o,disabledKey:a}=e.toRefs(l);return{options:n,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:"function"==typeof t.value?t.value(e):e[t.value],getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof o.value?o.value(e):e[o.value],getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof a.value?a.value(e):e[a.value])}}(o),y=L("vv-radio-group",p,e.computed((()=>({disabled:r.value,readonly:d.value,horizontal:!v.value,valid:s.value,invalid:f.value})))),{HintSlot:g}=c(o,a);return(l,n)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[l.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(l.label)},null,8,_)):e.createCommentVNode("",!0),e.createElementVNode("div",C,[l.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.options,((l,n)=>(e.openBlock(),e.createBlock(N,e.mergeProps({key:n},((e,l)=>({id:`${o.name}_opt${l}`,name:o.name,label:m(e),value:b(e)}))(l,n)),null,16)))),128)):e.renderSlot(l.$slots,"default",{key:1})]),e.createVNode(e.unref(g),{class:"vv-radio-group__hint"})],2))}})}));
|
|
1
|
+
!function(e,l){"object"==typeof exports&&"undefined"!=typeof module?module.exports=l(require("vue"),require("@vueuse/core"),require("nanoid")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","nanoid"],l):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadioGroup=l(e.vue,e.core,e.nanoid)}(this,(function(e,l,n){"use strict";var t=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(t||{}),o=(e=>(e.before="before",e.after="after",e))(o||{}),a=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(a||{});const u=Symbol.for("radioGroup");function i(e,l,n){return n?d(e,n)===d(l,n):r(e,l)}function r(e,l){if(e===l)return!0;if(e&&l&&"object"==typeof e&&"object"==typeof l){const n=Array.isArray(e),t=Array.isArray(l);let o,a,u;if(n&&t){if(a=e.length,a!=l.length)return!1;for(o=a;0!=o--;)if(!r(e[o],l[o]))return!1;return!0}if(n!=t)return!1;const i=e instanceof Date,d=l instanceof Date;if(i!=d)return!1;if(i&&d)return e.getTime()==l.getTime();const v=e instanceof RegExp,s=l instanceof RegExp;if(v!=s)return!1;if(v&&s)return e.toString()==l.toString();const c=Object.keys(e);if(a=c.length,a!==Object.keys(l).length)return!1;for(o=a;0!=o--;)if(!Object.prototype.hasOwnProperty.call(l,c[o]))return!1;for(o=a;0!=o--;)if(u=c[o],!r(e[u],l[u]))return!1;return!0}return e!=e&&l!=l}function d(e,l){if(e&&Object.keys(e).length&&l){if(-1===l.indexOf("."))return e[l];{const n=l.split(".");let t=e;for(let l=0,o=n.length;l<o;++l){if(null==e)return null;t=t[n[l]]}return t}}return null}function v(l){return null==(n=e.unref(l))||""===n||Array.isArray(n)&&0===n.length||!(n instanceof Date)&&"object"==typeof n&&0===Object.keys(n).length;var n}function s(e){return Array.isArray(e)?e.filter((e=>{return"string"==typeof(l=e)||l instanceof String;var l})).join(" "):e}function c(n,t){const{invalid:o,valid:a,hint:u,loading:i}=t,{hintLabel:r,modelValue:c,valid:f,validLabel:p,invalid:m,invalidLabel:b,...y}=e.toRefs(n),g=d(y,"loading"),h=d(y,"loadingLabel"),S=e.computed((()=>!!m.value&&(!(!m.value||!o)||(!!((null==b?void 0:b.value)&&Array.isArray(b.value)&&b.value.length>0)||!(!(null==b?void 0:b.value)||v(b)))))),B=e.computed((()=>!!(r&&r.value||u))),V=e.computed((()=>!!(p&&p.value||a))),k=e.computed((()=>!!((null==g?void 0:g.value)&&i||(null==g?void 0:g.value)&&(null==h?void 0:h.value)))),A=e.computed((()=>B.value||V.value||S.value||k.value));return{hasInvalid:S,hasHint:B,hasValid:V,hasLoading:k,HintSlot:{name:"HintSlot",props:{params:{type:Object,default:()=>({})}},setup(n){const t=e.computed((()=>{const e=l.toReactive({hintLabel:r,modelValue:c,valid:f,validLabel:p,invalid:m,invalidLabel:b,loading:g,loadingLabel:h,...n.params});return(null==m?void 0:m.value)?(null==o?void 0:o(e))||s(null==b?void 0:b.value)||(null==r?void 0:r.value):(null==f?void 0:f.value)?(null==a?void 0:a(e))||s(null==p?void 0:p.value)||(null==r?void 0:r.value):(null==g?void 0:g.value)?(null==i?void 0:i(e))||s(null==h?void 0:h.value)||(null==r?void 0:r.value):(null==u?void 0:u(e))||s(null==r?void 0:r.value)||(null==r?void 0:r.value)}));return{isVisible:A,hasInvalid:S,hasValid:V,hintContent:t}},render(){if(this.isVisible)return e.h("small",{role:this.hasInvalid?"alert":this.hasValid?"status":void 0},this.hintContent)}}}}const f={valid:Boolean,validLabel:[String,Array]},p={invalid:Boolean,invalidLabel:[String,Array]},m={disabled:Boolean},b=(Boolean,Boolean,{label:[String,Number]}),y={readonly:Boolean},g={modifiers:[String,Array]},h={hintLabel:{type:String,default:""}},S={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};o.before;const B={tabindex:{type:[String,Number],default:0}},V={id:[String,Number]};t.bottom,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean,Boolean;const k={...{...V,name:{type:String,required:!0}},...B,...f,...p,...h,...m,...y,...g,...b,value:[String,Number,Boolean],modelValue:[Object,Number,Boolean,String]},A={...f,...p,...S,...h,...m,...y,...g,...b,modelValue:[String,Array,Boolean,Number,Symbol],name:{type:String,required:!0},vertical:Boolean};a.button;const O=k;function j(l,n){const{id:t}=e.toRefs(l),{group:o,isInGroup:a,getGroupOrLocalRef:i}=function(l){const n=e.inject(l,void 0),t=e.computed((()=>!v(n)));return{group:n,isInGroup:t,getGroupOrLocalRef:function(l,t,o){if(null==n?void 0:n.value){const t=e.unref(n.value)[l];return e.computed({get:()=>null==t?void 0:t.value,set(e){t.value=e}})}const a=e.toRef(t,l);return e.computed({get:()=>a.value,set(e){o&&o(`update:${l}`,e)}})}}}(u),r=i("modelValue",l,n),d=i("valid",l),s=i("invalid",l),c=e.computed((()=>{var e;return Boolean(l.readonly||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))})),f=e.computed((()=>{var e;return Boolean(l.disabled||(null==(e=null==o?void 0:o.value)?void 0:e.disabled.value))}));return{id:t,group:o,isInGroup:a,modelValue:r,valid:d,invalid:s,readonly:c,disabled:f}}function L(l,n,t){return e.computed((()=>{const o={[l]:!0},a="string"==typeof(null==n?void 0:n.value)?n.value.split(" "):null==n?void 0:n.value;return a&&Array.isArray(a)&&a.forEach((e=>{e&&(o[`${l}--${e}`]=!0)})),t&&Object.keys(t.value).forEach((n=>{o[`${l}--${n}`]=e.unref(t.value[n])})),o}))}const R=["for"],x=["id","name","disabled","value","tabindex","aria-invalid"],N=e.defineComponent({name:"VvRadio",props:O,emits:["click","update:modelValue","change","blur"],setup(l,{emit:t}){const o=l,a=e.useSlots(),{id:u,disabled:r,readonly:d,modelValue:v,valid:s,invalid:f}=j(o,t),p=(l=>e.computed((()=>String((null==l?void 0:l.value)||n.nanoid()))))(u),m=e.computed((()=>y.value?-1:o.tabindex)),b=e.ref(),y=e.computed((()=>r.value||d.value)),g=e.computed((()=>!0===f.value||!0!==s.value&&void 0)),h=e.computed((()=>Array.isArray(v.value)?function(e,l){if(null!=e&&l&&l.length)for(const n of l)if(i(e,n))return!0;return!1}(o.value,v.value):i(o.value,v.value))),S=e.computed((()=>!["string","number","boolean"].includes(typeof o.value)||o.value)),B=e.computed({get:()=>h.value?S.value:null,set(e){Array.isArray(v.value)?v.value=[o.value]:v.value=o.value,t("change",e)}}),{modifiers:V}=e.toRefs(o),k=L("vv-radio",V,e.computed((()=>({valid:s.value,invalid:f.value,disabled:r.value,readonly:d.value})))),{HintSlot:A}=c(o,a);return(l,n)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(k)),for:e.unref(p)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(p),ref_key:"input",ref:b,"onUpdate:modelValue":n[0]||(n[0]=l=>e.isRef(B)?B.value=l:null),type:"radio",class:"vv-radio__input",name:l.name,disabled:e.unref(y),value:e.unref(S),tabindex:e.unref(m),"aria-invalid":e.unref(g)},null,8,x),[[e.vModelRadio,e.unref(B)]]),e.renderSlot(l.$slots,"default",{value:e.unref(v)},(()=>[e.createTextVNode(e.toDisplayString(l.label),1)])),e.createVNode(e.unref(A),{class:"vv-radio__hint",params:{value:e.unref(v)}},null,8,["params"])],10,R))}}),E=A;const _=["textContent"],C={class:"vv-radio-group__wrapper"};return e.defineComponent({name:"VvRadioGroup",props:E,emits:["update:modelValue","change"],setup(n,{emit:t}){const o=n,a=e.useSlots(),i=l.useVModel(o,"modelValue",t),{disabled:r,readonly:d,vertical:v,valid:s,invalid:f,modifiers:p}=e.toRefs(o);!function(l){if(Object.keys(l).some((n=>"key"!==n&&!e.isRef(l[n]))))throw Error("One or more groupState props aren't ref.");e.provide(l.key,e.computed((()=>l)))}({key:u,modelValue:i,disabled:r,readonly:d,valid:s,invalid:f});const{getOptionLabel:m,getOptionValue:b}=function(l){const{options:n,labelKey:t,valueKey:o,disabledKey:a}=e.toRefs(l);return{options:n,getOptionLabel:e=>"object"!=typeof e&&null!==e?e:"function"==typeof t.value?t.value(e):e[t.value],getOptionValue:e=>"object"!=typeof e&&null!==e?e:"function"==typeof o.value?o.value(e):e[o.value],getOptionDisabled:e=>("object"==typeof e||null===e)&&("function"==typeof a.value?a.value(e):e[a.value]),getOptionGrouped:e=>"object"!=typeof e&&null!==e?[]:e.options}}(o),y=L("vv-radio-group",p,e.computed((()=>({disabled:r.value,readonly:d.value,horizontal:!v.value,valid:s.value,invalid:f.value})))),{HintSlot:g}=c(o,a);return(l,n)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(y))},[l.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(l.label)},null,8,_)):e.createCommentVNode("",!0),e.createElementVNode("div",C,[l.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.options,((l,n)=>(e.openBlock(),e.createBlock(N,e.mergeProps({key:n},((e,l)=>({id:`${o.name}_opt${l}`,name:o.name,label:m(e),value:b(e)}))(l,n)),null,16)))),128)):e.renderSlot(l.$slots,"default",{key:1})]),e.createVNode(e.unref(g),{class:"vv-radio-group__hint"})],2))}})}));
|
|
@@ -553,6 +553,16 @@ const IdProps = {
|
|
|
553
553
|
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
554
554
|
}
|
|
555
555
|
},
|
|
556
|
+
/**
|
|
557
|
+
* Dropdown strategy
|
|
558
|
+
*/
|
|
559
|
+
strategy: {
|
|
560
|
+
type: String,
|
|
561
|
+
default: "absolute",
|
|
562
|
+
validator: (value) => {
|
|
563
|
+
return ["fixed", "absolute"].includes(value);
|
|
564
|
+
}
|
|
565
|
+
},
|
|
556
566
|
/**
|
|
557
567
|
* Dropdown show / hide transition name
|
|
558
568
|
*/
|
|
@@ -777,11 +787,17 @@ function useOptions(props) {
|
|
|
777
787
|
return false;
|
|
778
788
|
return typeof disabledKey.value === "function" ? disabledKey.value(option) : option[disabledKey.value];
|
|
779
789
|
};
|
|
790
|
+
const getOptionGrouped = (option) => {
|
|
791
|
+
if (typeof option !== "object" && option !== null)
|
|
792
|
+
return [];
|
|
793
|
+
return option.options;
|
|
794
|
+
};
|
|
780
795
|
return {
|
|
781
796
|
options,
|
|
782
797
|
getOptionLabel,
|
|
783
798
|
getOptionValue,
|
|
784
|
-
getOptionDisabled
|
|
799
|
+
getOptionDisabled,
|
|
800
|
+
getOptionGrouped
|
|
785
801
|
};
|
|
786
802
|
}
|
|
787
803
|
const _hoisted_1 = ["for"];
|
|
@@ -794,7 +810,9 @@ const _hoisted_4 = { class: "vv-select__inner" };
|
|
|
794
810
|
const _hoisted_5 = ["id"];
|
|
795
811
|
const _hoisted_6 = ["disabled", "hidden"];
|
|
796
812
|
const _hoisted_7 = ["disabled", "value"];
|
|
797
|
-
const _hoisted_8 =
|
|
813
|
+
const _hoisted_8 = ["disabled", "label"];
|
|
814
|
+
const _hoisted_9 = ["disabled", "value"];
|
|
815
|
+
const _hoisted_10 = {
|
|
798
816
|
key: 1,
|
|
799
817
|
class: "vv-select__input-after"
|
|
800
818
|
};
|
|
@@ -886,7 +904,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
886
904
|
invalid: props.invalid,
|
|
887
905
|
modelValue: props.modelValue
|
|
888
906
|
}));
|
|
889
|
-
const {
|
|
907
|
+
const {
|
|
908
|
+
getOptionLabel,
|
|
909
|
+
getOptionValue,
|
|
910
|
+
getOptionDisabled,
|
|
911
|
+
getOptionGrouped
|
|
912
|
+
} = useOptions(props);
|
|
890
913
|
const localModelValue = computed({
|
|
891
914
|
get: () => {
|
|
892
915
|
return props.modelValue;
|
|
@@ -898,6 +921,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
898
921
|
emit("update:modelValue", newValue);
|
|
899
922
|
}
|
|
900
923
|
});
|
|
924
|
+
const isGroup = (option) => {
|
|
925
|
+
if (typeof option === "string")
|
|
926
|
+
return false;
|
|
927
|
+
return option && option.options && option.options.length > 0;
|
|
928
|
+
};
|
|
901
929
|
return (_ctx, _cache) => {
|
|
902
930
|
return openBlock(), createElementBlock("div", {
|
|
903
931
|
class: normalizeClass(unref(bemCssClasses))
|
|
@@ -928,12 +956,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
928
956
|
hidden: !_ctx.unselectable
|
|
929
957
|
}, toDisplayString(_ctx.placeholder), 9, _hoisted_6)) : createCommentVNode("", true),
|
|
930
958
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
|
|
931
|
-
return openBlock(), createElementBlock(
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
959
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
960
|
+
!isGroup(option) ? (openBlock(), createElementBlock("option", {
|
|
961
|
+
key: index,
|
|
962
|
+
disabled: unref(getOptionDisabled)(option),
|
|
963
|
+
value: unref(getOptionValue)(option)
|
|
964
|
+
}, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7)) : (openBlock(), createElementBlock("optgroup", {
|
|
965
|
+
key: `group-${index}`,
|
|
966
|
+
disabled: unref(getOptionDisabled)(option),
|
|
967
|
+
label: unref(getOptionLabel)(option)
|
|
968
|
+
}, [
|
|
969
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(option), (item, i) => {
|
|
970
|
+
return openBlock(), createElementBlock("option", {
|
|
971
|
+
key: `group-${index}-item-${i}`,
|
|
972
|
+
disabled: unref(getOptionDisabled)(item),
|
|
973
|
+
value: unref(getOptionValue)(item)
|
|
974
|
+
}, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9);
|
|
975
|
+
}), 128))
|
|
976
|
+
], 8, _hoisted_8))
|
|
977
|
+
], 64);
|
|
978
|
+
}), 256))
|
|
937
979
|
], 16, _hoisted_5), [
|
|
938
980
|
[vModelSelect, unref(localModelValue)]
|
|
939
981
|
]),
|
|
@@ -942,7 +984,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
942
984
|
class: "vv-select__icon vv-select__icon-after"
|
|
943
985
|
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true)
|
|
944
986
|
]),
|
|
945
|
-
_ctx.$slots.after ? (openBlock(), createElementBlock("div",
|
|
987
|
+
_ctx.$slots.after ? (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
946
988
|
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
947
989
|
])) : createCommentVNode("", true)
|
|
948
990
|
]),
|