@volverjs/ui-vue 0.0.6-beta.6 → 0.0.6-beta.7
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/auto-imports.d.ts +9 -0
- package/dist/components/VvButton/VvButton.es.js +25 -19
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +151 -98
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +36 -0
- package/dist/components/VvCheckbox/index.d.ts +5 -0
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +187 -101
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +36 -0
- package/dist/components/VvCheckboxGroup/index.d.ts +5 -0
- package/dist/components/VvCombobox/VvCombobox.es.js +236 -140
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +25 -1
- package/dist/components/VvDialog/VvDialog.es.js +25 -19
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +19 -4
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +5 -1
- package/dist/components/VvIcon/VvIcon.es.js +25 -19
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.vue.d.ts +2 -2
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputText/VvInputText.es.js +160 -136
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +24 -0
- package/dist/components/VvRadio/VvRadio.es.js +151 -98
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +36 -0
- package/dist/components/VvRadio/index.d.ts +5 -0
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +187 -101
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +36 -0
- package/dist/components/VvRadioGroup/index.d.ts +5 -0
- package/dist/components/VvSelect/VvSelect.es.js +163 -137
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -0
- package/dist/components/VvTextarea/VvTextarea.es.js +160 -136
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +24 -0
- package/dist/components/common/HintSlot.d.ts +38 -12
- package/dist/components/index.es.js +466 -168
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/useOptions.d.ts +2 -2
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +22 -0
- package/package.json +29 -29
- 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/VvCheckbox/VvCheckbox.vue +23 -2
- package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +15 -2
- package/src/components/VvCombobox/VvCombobox.vue +40 -16
- package/src/components/VvDropdown/VvDropdown.vue +20 -2
- package/src/components/VvIcon/VvIcon.vue +37 -34
- package/src/components/VvIcon/index.ts +2 -2
- package/src/components/VvInputText/VvInputText.vue +26 -9
- package/src/components/VvRadio/VvRadio.vue +23 -2
- package/src/components/VvRadioGroup/VvRadioGroup.vue +15 -2
- package/src/components/VvSelect/VvSelect.vue +26 -9
- package/src/components/VvTextarea/VvTextarea.vue +26 -9
- package/src/components/common/HintSlot.ts +129 -170
- package/src/composables/useOptions.ts +9 -7
- package/src/props/index.ts +2 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, h, Fragment, provide, useAttrs, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, useSlots, isRef, renderList, vModelSelect, createSlots, withModifiers, vModelText } from "vue";
|
|
1
|
+
import { inject, computed, unref, defineComponent, ref, toRefs, openBlock, createBlock, mergeProps, createCommentVNode, h, Fragment, provide, useAttrs, watch, nextTick, createElementBlock, createVNode, withCtx, renderSlot, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, normalizeClass, vShow, createTextVNode, toDisplayString, useSlots, isRef, renderList, vModelSelect, createSlots, withModifiers, vModelText } from "vue";
|
|
2
2
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
4
4
|
import { nanoid } from "nanoid";
|
|
5
|
-
import { useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus,
|
|
5
|
+
import { useVModel, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced } from "@vueuse/core";
|
|
6
6
|
import mitt from "mitt";
|
|
7
7
|
var Side = /* @__PURE__ */ ((Side2) => {
|
|
8
8
|
Side2["left"] = "left";
|
|
@@ -613,6 +613,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
613
613
|
props: VvIconProps,
|
|
614
614
|
setup(__props) {
|
|
615
615
|
const props = __props;
|
|
616
|
+
const hasRotate = computed(() => {
|
|
617
|
+
if (typeof props.rotate === "string") {
|
|
618
|
+
return parseFloat(props.rotate);
|
|
619
|
+
}
|
|
620
|
+
return props.rotate;
|
|
621
|
+
});
|
|
616
622
|
const show = ref(true);
|
|
617
623
|
const volver = useVolver();
|
|
618
624
|
const { modifiers } = toRefs(props);
|
|
@@ -621,25 +627,24 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
621
627
|
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
622
628
|
});
|
|
623
629
|
const icon = computed(() => {
|
|
624
|
-
const
|
|
625
|
-
const iconName = `@${provider.value}:${props.prefix}:${
|
|
626
|
-
if (iconExists(
|
|
627
|
-
return _name;
|
|
628
|
-
} else if (iconExists(iconName)) {
|
|
630
|
+
const name = props.name ?? "";
|
|
631
|
+
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
632
|
+
if (iconExists(iconName)) {
|
|
629
633
|
return iconName;
|
|
630
|
-
} else {
|
|
631
|
-
return (volver == null ? void 0 : volver.iconsCollections.find(
|
|
632
|
-
(iconsCollection) => {
|
|
633
|
-
const icon2 = `@${provider.value}:${iconsCollection.prefix}:${_name}`;
|
|
634
|
-
if (iconExists(icon2)) {
|
|
635
|
-
return icon2;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
)) || _name;
|
|
639
634
|
}
|
|
635
|
+
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
636
|
+
(iconsCollection2) => {
|
|
637
|
+
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
638
|
+
return iconExists(icon2);
|
|
639
|
+
}
|
|
640
|
+
);
|
|
641
|
+
if (iconsCollection) {
|
|
642
|
+
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
643
|
+
}
|
|
644
|
+
return name;
|
|
640
645
|
});
|
|
641
646
|
function getSvgContent(svg) {
|
|
642
|
-
let dom
|
|
647
|
+
let dom;
|
|
643
648
|
if (typeof window === "undefined") {
|
|
644
649
|
const { JSDOM } = require("jsdom");
|
|
645
650
|
dom = new JSDOM().window;
|
|
@@ -670,12 +675,13 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
670
675
|
show.value = true;
|
|
671
676
|
}
|
|
672
677
|
}).catch((e) => {
|
|
673
|
-
throw new Error(`
|
|
678
|
+
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
674
679
|
});
|
|
675
|
-
} else if (props.svg) {
|
|
676
|
-
addIconFromSvg(props.svg);
|
|
677
680
|
}
|
|
678
681
|
}
|
|
682
|
+
if (props.svg) {
|
|
683
|
+
addIconFromSvg(props.svg);
|
|
684
|
+
}
|
|
679
685
|
return (_ctx, _cache) => {
|
|
680
686
|
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
681
687
|
key: 0,
|
|
@@ -687,7 +693,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
687
693
|
horizontalFlip: _ctx.horizontalFlip,
|
|
688
694
|
verticalFlip: _ctx.verticalFlip,
|
|
689
695
|
flip: _ctx.flip,
|
|
690
|
-
rotate:
|
|
696
|
+
rotate: unref(hasRotate),
|
|
691
697
|
color: _ctx.color,
|
|
692
698
|
onLoad: _ctx.onLoad,
|
|
693
699
|
icon: unref(icon)
|
|
@@ -785,7 +791,13 @@ const __default__$6 = {
|
|
|
785
791
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
786
792
|
...__default__$6,
|
|
787
793
|
props: VvDropdownProps,
|
|
788
|
-
emits: [
|
|
794
|
+
emits: [
|
|
795
|
+
"update:modelValue",
|
|
796
|
+
"beforeExpand",
|
|
797
|
+
"beforeCollapse",
|
|
798
|
+
"afterExpand",
|
|
799
|
+
"afterCollapse"
|
|
800
|
+
],
|
|
789
801
|
setup(__props, { expose, emit }) {
|
|
790
802
|
const props = __props;
|
|
791
803
|
const { id } = toRefs(props);
|
|
@@ -1056,6 +1068,12 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1056
1068
|
activeElement.click();
|
|
1057
1069
|
}
|
|
1058
1070
|
});
|
|
1071
|
+
const onTransitionBeforeEnter = () => {
|
|
1072
|
+
emit(expanded.value ? "beforeExpand" : "beforeCollapse");
|
|
1073
|
+
};
|
|
1074
|
+
const onTransitionAfterLeave = () => {
|
|
1075
|
+
emit(expanded.value ? "afterExpand" : "afterCollapse");
|
|
1076
|
+
};
|
|
1059
1077
|
return (_ctx, _cache) => {
|
|
1060
1078
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
1061
1079
|
createVNode(unref(VvDropdownTriggerProvider), null, {
|
|
@@ -1064,7 +1082,10 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1064
1082
|
]),
|
|
1065
1083
|
_: 3
|
|
1066
1084
|
}),
|
|
1067
|
-
createVNode(Transition, { name: _ctx.transitionName }, {
|
|
1085
|
+
createVNode(Transition, mergeProps({ name: _ctx.transitionName }, toHandlers({
|
|
1086
|
+
beforeEnter: onTransitionBeforeEnter,
|
|
1087
|
+
onAfterLeave: onTransitionAfterLeave
|
|
1088
|
+
})), {
|
|
1068
1089
|
default: withCtx(() => [
|
|
1069
1090
|
withDirectives(createElementVNode("div", {
|
|
1070
1091
|
ref_key: "floatingEl",
|
|
@@ -1099,7 +1120,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1099
1120
|
])
|
|
1100
1121
|
]),
|
|
1101
1122
|
_: 3
|
|
1102
|
-
},
|
|
1123
|
+
}, 16, ["name"])
|
|
1103
1124
|
], 64);
|
|
1104
1125
|
};
|
|
1105
1126
|
}
|
|
@@ -1324,111 +1345,114 @@ function removeFromList(value, list) {
|
|
|
1324
1345
|
function isString(value) {
|
|
1325
1346
|
return typeof value === "string" || value instanceof String;
|
|
1326
1347
|
}
|
|
1327
|
-
function joinLines(
|
|
1328
|
-
if (Array.isArray(
|
|
1329
|
-
return
|
|
1348
|
+
function joinLines(items) {
|
|
1349
|
+
if (Array.isArray(items)) {
|
|
1350
|
+
return items.filter((item) => isString(item)).join(" ");
|
|
1330
1351
|
}
|
|
1331
|
-
return
|
|
1352
|
+
return items;
|
|
1332
1353
|
}
|
|
1333
|
-
function HintSlotFactory(
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
const {
|
|
1341
|
-
hintLabel,
|
|
1342
|
-
modelValue,
|
|
1343
|
-
valid,
|
|
1344
|
-
validLabel,
|
|
1345
|
-
invalid,
|
|
1346
|
-
invalidLabel,
|
|
1347
|
-
...otherProps
|
|
1348
|
-
} = toRefs(parentProps);
|
|
1349
|
-
const loading = resolveFieldData(otherProps, "loading");
|
|
1350
|
-
const loadingLabel = resolveFieldData(otherProps, "loadingLabel");
|
|
1351
|
-
const hasInvalid = computed(() => {
|
|
1352
|
-
if (!invalid.value) {
|
|
1353
|
-
return false;
|
|
1354
|
-
}
|
|
1355
|
-
if (invalid.value && invalidSlot) {
|
|
1356
|
-
return true;
|
|
1357
|
-
}
|
|
1358
|
-
if ((invalidLabel == null ? void 0 : invalidLabel.value) && Array.isArray(invalidLabel.value) && invalidLabel.value.length > 0) {
|
|
1359
|
-
return true;
|
|
1360
|
-
}
|
|
1361
|
-
if ((invalidLabel == null ? void 0 : invalidLabel.value) && !isEmpty(invalidLabel)) {
|
|
1362
|
-
return true;
|
|
1363
|
-
}
|
|
1364
|
-
return false;
|
|
1365
|
-
});
|
|
1366
|
-
const hasHint = computed(
|
|
1367
|
-
() => !!(hintLabel && hintLabel.value || hintSlot)
|
|
1354
|
+
function HintSlotFactory(props, slots) {
|
|
1355
|
+
const invalidLabel = computed(() => joinLines(props.invalidLabel));
|
|
1356
|
+
const validLabel = computed(() => joinLines(props.validLabel));
|
|
1357
|
+
const loadingLabel = computed(() => props.loadingLabel);
|
|
1358
|
+
const hintLabel = computed(() => props.hintLabel);
|
|
1359
|
+
const hasLoadingLabelOrSlot = computed(
|
|
1360
|
+
() => Boolean(props.loading && (slots.loading || loadingLabel.value))
|
|
1368
1361
|
);
|
|
1369
|
-
const
|
|
1370
|
-
() =>
|
|
1362
|
+
const hasInvalidLabelOrSlot = computed(
|
|
1363
|
+
() => !hasLoadingLabelOrSlot.value && Boolean(props.invalid && (slots.invalid || invalidLabel.value))
|
|
1371
1364
|
);
|
|
1372
|
-
const
|
|
1373
|
-
() =>
|
|
1365
|
+
const hasValidLabelOrSlot = computed(
|
|
1366
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
|
|
1367
|
+
);
|
|
1368
|
+
const hasHintLabelOrSlot = computed(
|
|
1369
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
1374
1370
|
);
|
|
1375
1371
|
const isVisible = computed(
|
|
1376
|
-
() =>
|
|
1372
|
+
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
1377
1373
|
);
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1374
|
+
const hintSlotScope = computed(() => ({
|
|
1375
|
+
modelValue: props.modelValue,
|
|
1376
|
+
valid: props.valid,
|
|
1377
|
+
invalid: props.invalid,
|
|
1378
|
+
loading: props.loading
|
|
1379
|
+
}));
|
|
1380
|
+
const HintSlot = defineComponent({
|
|
1381
|
+
name: "HintSlot",
|
|
1382
|
+
props: {
|
|
1383
|
+
tag: {
|
|
1384
|
+
type: String,
|
|
1385
|
+
default: "small"
|
|
1386
|
+
}
|
|
1387
|
+
},
|
|
1388
|
+
setup() {
|
|
1389
|
+
return {
|
|
1390
|
+
isVisible,
|
|
1391
|
+
invalidLabel,
|
|
1392
|
+
validLabel,
|
|
1393
|
+
loadingLabel,
|
|
1394
|
+
hintLabel,
|
|
1395
|
+
hasInvalidLabelOrSlot,
|
|
1396
|
+
hasValidLabelOrSlot,
|
|
1397
|
+
hasLoadingLabelOrSlot,
|
|
1398
|
+
hasHintLabelOrSlot
|
|
1399
|
+
};
|
|
1400
|
+
},
|
|
1401
|
+
render() {
|
|
1402
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1403
|
+
if (this.isVisible) {
|
|
1404
|
+
let role;
|
|
1405
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
1406
|
+
role = "alert";
|
|
1389
1407
|
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
hintLabel,
|
|
1395
|
-
modelValue,
|
|
1396
|
-
valid,
|
|
1397
|
-
validLabel,
|
|
1398
|
-
invalid,
|
|
1399
|
-
invalidLabel,
|
|
1400
|
-
loading,
|
|
1401
|
-
loadingLabel,
|
|
1402
|
-
...props.params
|
|
1403
|
-
});
|
|
1404
|
-
if (invalid == null ? void 0 : invalid.value) {
|
|
1405
|
-
return (invalidSlot == null ? void 0 : invalidSlot(slotProps)) || joinLines(invalidLabel == null ? void 0 : invalidLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
1406
|
-
}
|
|
1407
|
-
if (valid == null ? void 0 : valid.value)
|
|
1408
|
-
return (validSlot == null ? void 0 : validSlot(slotProps)) || joinLines(validLabel == null ? void 0 : validLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
1409
|
-
if (loading == null ? void 0 : loading.value)
|
|
1410
|
-
return (loadingSlot == null ? void 0 : loadingSlot(slotProps)) || joinLines(loadingLabel == null ? void 0 : loadingLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
1411
|
-
return (hintSlot == null ? void 0 : hintSlot(slotProps)) || joinLines(hintLabel == null ? void 0 : hintLabel.value) || (hintLabel == null ? void 0 : hintLabel.value);
|
|
1412
|
-
});
|
|
1413
|
-
return {
|
|
1414
|
-
isVisible,
|
|
1415
|
-
hasInvalid,
|
|
1416
|
-
hasValid,
|
|
1417
|
-
hintContent
|
|
1418
|
-
};
|
|
1419
|
-
},
|
|
1420
|
-
render() {
|
|
1421
|
-
if (this.isVisible) {
|
|
1408
|
+
if (this.hasValidLabelOrSlot) {
|
|
1409
|
+
role = "status";
|
|
1410
|
+
}
|
|
1411
|
+
if (this.hasLoadingLabelOrSlot) {
|
|
1422
1412
|
return h(
|
|
1423
|
-
|
|
1413
|
+
this.tag,
|
|
1424
1414
|
{
|
|
1425
|
-
role
|
|
1415
|
+
role
|
|
1426
1416
|
},
|
|
1427
|
-
this.
|
|
1417
|
+
((_b = (_a = this.$slots).loading) == null ? void 0 : _b.call(_a)) ?? this.loadingLabel
|
|
1428
1418
|
);
|
|
1429
1419
|
}
|
|
1420
|
+
if (this.hasInvalidLabelOrSlot) {
|
|
1421
|
+
return h(
|
|
1422
|
+
this.tag,
|
|
1423
|
+
{
|
|
1424
|
+
role
|
|
1425
|
+
},
|
|
1426
|
+
((_d = (_c = this.$slots).invalid) == null ? void 0 : _d.call(_c)) ?? this.$slots.invalid ?? this.invalidLabel
|
|
1427
|
+
);
|
|
1428
|
+
}
|
|
1429
|
+
if (this.hasValidLabelOrSlot) {
|
|
1430
|
+
return h(
|
|
1431
|
+
this.tag,
|
|
1432
|
+
{
|
|
1433
|
+
role
|
|
1434
|
+
},
|
|
1435
|
+
((_f = (_e = this.$slots).valid) == null ? void 0 : _f.call(_e)) ?? this.validLabel
|
|
1436
|
+
);
|
|
1437
|
+
}
|
|
1438
|
+
return h(
|
|
1439
|
+
this.tag,
|
|
1440
|
+
{
|
|
1441
|
+
role
|
|
1442
|
+
},
|
|
1443
|
+
((_h = (_g = this.$slots).hint) == null ? void 0 : _h.call(_g)) ?? this.$slots.hint ?? this.hintLabel
|
|
1444
|
+
);
|
|
1430
1445
|
}
|
|
1446
|
+
return null;
|
|
1431
1447
|
}
|
|
1448
|
+
});
|
|
1449
|
+
return {
|
|
1450
|
+
hasInvalidLabelOrSlot,
|
|
1451
|
+
hasHintLabelOrSlot,
|
|
1452
|
+
hasValidLabelOrSlot,
|
|
1453
|
+
hasLoadingLabelOrSlot,
|
|
1454
|
+
hintSlotScope,
|
|
1455
|
+
HintSlot
|
|
1432
1456
|
};
|
|
1433
1457
|
}
|
|
1434
1458
|
const VvSelectProps = {
|
|
@@ -1529,7 +1553,9 @@ function useOptions(props) {
|
|
|
1529
1553
|
const getOptionLabel = (option) => {
|
|
1530
1554
|
if (typeof option !== "object" && option !== null)
|
|
1531
1555
|
return option;
|
|
1532
|
-
return
|
|
1556
|
+
return String(
|
|
1557
|
+
typeof labelKey.value === "function" ? labelKey.value(option) : option[labelKey.value]
|
|
1558
|
+
);
|
|
1533
1559
|
};
|
|
1534
1560
|
const getOptionValue = (option) => {
|
|
1535
1561
|
if (typeof option !== "object" && option !== null)
|
|
@@ -1581,7 +1607,12 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1581
1607
|
const props = __props;
|
|
1582
1608
|
const slots = useSlots();
|
|
1583
1609
|
const select = ref();
|
|
1584
|
-
const {
|
|
1610
|
+
const {
|
|
1611
|
+
HintSlot,
|
|
1612
|
+
hasHintLabelOrSlot,
|
|
1613
|
+
hasInvalidLabelOrSlot,
|
|
1614
|
+
hintSlotScope
|
|
1615
|
+
} = HintSlotFactory(props, slots);
|
|
1585
1616
|
const {
|
|
1586
1617
|
id,
|
|
1587
1618
|
modifiers,
|
|
@@ -1596,7 +1627,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1596
1627
|
multiple
|
|
1597
1628
|
} = toRefs(props);
|
|
1598
1629
|
const hasId = useUniqueId(id);
|
|
1599
|
-
const
|
|
1630
|
+
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
1600
1631
|
const { focused } = useComponentFocus(select, emit);
|
|
1601
1632
|
const isVisible = useElementVisibility(select);
|
|
1602
1633
|
watch(isVisible, (newValue) => {
|
|
@@ -1649,8 +1680,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1649
1680
|
autocomplete: props.autocomplete,
|
|
1650
1681
|
multiple: props.multiple,
|
|
1651
1682
|
"aria-invalid": isInvalid.value,
|
|
1652
|
-
"aria-describedby":
|
|
1653
|
-
"aria-errormessage":
|
|
1683
|
+
"aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
|
|
1684
|
+
"aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
|
|
1654
1685
|
};
|
|
1655
1686
|
});
|
|
1656
1687
|
const slotProps = computed(() => ({
|
|
@@ -1743,9 +1774,38 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
1743
1774
|
])) : createCommentVNode("", true)
|
|
1744
1775
|
]),
|
|
1745
1776
|
createVNode(unref(HintSlot), {
|
|
1746
|
-
id: unref(
|
|
1777
|
+
id: unref(hasHintId),
|
|
1747
1778
|
class: "vv-select__hint"
|
|
1748
|
-
},
|
|
1779
|
+
}, createSlots({ _: 2 }, [
|
|
1780
|
+
_ctx.$slots.hint ? {
|
|
1781
|
+
name: "hint",
|
|
1782
|
+
fn: withCtx(() => [
|
|
1783
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1784
|
+
]),
|
|
1785
|
+
key: "0"
|
|
1786
|
+
} : void 0,
|
|
1787
|
+
_ctx.$slots.loading ? {
|
|
1788
|
+
name: "loading",
|
|
1789
|
+
fn: withCtx(() => [
|
|
1790
|
+
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1791
|
+
]),
|
|
1792
|
+
key: "1"
|
|
1793
|
+
} : void 0,
|
|
1794
|
+
_ctx.$slots.valid ? {
|
|
1795
|
+
name: "valid",
|
|
1796
|
+
fn: withCtx(() => [
|
|
1797
|
+
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1798
|
+
]),
|
|
1799
|
+
key: "2"
|
|
1800
|
+
} : void 0,
|
|
1801
|
+
_ctx.$slots.invalid ? {
|
|
1802
|
+
name: "invalid",
|
|
1803
|
+
fn: withCtx(() => [
|
|
1804
|
+
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
1805
|
+
]),
|
|
1806
|
+
key: "3"
|
|
1807
|
+
} : void 0
|
|
1808
|
+
]), 1032, ["id"])
|
|
1749
1809
|
], 2);
|
|
1750
1810
|
};
|
|
1751
1811
|
}
|
|
@@ -1831,13 +1891,13 @@ function useDefaults(componentName, propsDefinition, props) {
|
|
|
1831
1891
|
}
|
|
1832
1892
|
const _hoisted_1 = ["id"];
|
|
1833
1893
|
const _hoisted_2 = ["id", "for"];
|
|
1834
|
-
const _hoisted_3 = ["id", "aria-controls", "
|
|
1894
|
+
const _hoisted_3 = ["id", "aria-controls", "placeholder"];
|
|
1835
1895
|
const _hoisted_4 = {
|
|
1836
1896
|
key: 0,
|
|
1837
1897
|
class: "vv-select__input-before"
|
|
1838
1898
|
};
|
|
1839
1899
|
const _hoisted_5 = { class: "vv-select__inner" };
|
|
1840
|
-
const _hoisted_6 = ["aria-labelledby", "tabindex"];
|
|
1900
|
+
const _hoisted_6 = ["aria-expanded", "aria-labelledby", "aria-describedby", "aria-errormessage", "tabindex"];
|
|
1841
1901
|
const _hoisted_7 = ["aria-label", "onClick"];
|
|
1842
1902
|
const _hoisted_8 = {
|
|
1843
1903
|
key: 1,
|
|
@@ -1865,7 +1925,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1865
1925
|
}
|
|
1866
1926
|
return option.options && option.options.length > 0;
|
|
1867
1927
|
};
|
|
1868
|
-
const {
|
|
1928
|
+
const {
|
|
1929
|
+
HintSlot,
|
|
1930
|
+
hasHintLabelOrSlot,
|
|
1931
|
+
hasInvalidLabelOrSlot,
|
|
1932
|
+
hintSlotScope
|
|
1933
|
+
} = HintSlotFactory(props, slots);
|
|
1869
1934
|
const inputEl = ref(null);
|
|
1870
1935
|
const inputSearchEl = ref(null);
|
|
1871
1936
|
const wrapperEl = ref(null);
|
|
@@ -1913,19 +1978,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1913
1978
|
return;
|
|
1914
1979
|
expanded.value = false;
|
|
1915
1980
|
};
|
|
1916
|
-
|
|
1981
|
+
const onAfterExpand = () => {
|
|
1917
1982
|
if (searchable.value) {
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
inputSearchEl.value.focus();
|
|
1922
|
-
}
|
|
1923
|
-
return;
|
|
1924
|
-
}
|
|
1925
|
-
searchText.value = "";
|
|
1926
|
-
});
|
|
1983
|
+
if (inputSearchEl.value) {
|
|
1984
|
+
inputSearchEl.value.focus();
|
|
1985
|
+
}
|
|
1927
1986
|
}
|
|
1928
|
-
}
|
|
1987
|
+
};
|
|
1988
|
+
const onAfterCollapse = () => {
|
|
1989
|
+
if (searchable.value) {
|
|
1990
|
+
searchText.value = "";
|
|
1991
|
+
}
|
|
1992
|
+
};
|
|
1929
1993
|
const {
|
|
1930
1994
|
id,
|
|
1931
1995
|
icon,
|
|
@@ -2128,7 +2192,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2128
2192
|
modelValue: unref(expanded),
|
|
2129
2193
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(expanded) ? expanded.value = $event : null)
|
|
2130
2194
|
}, unref(dropdownProps), {
|
|
2131
|
-
role: unref(DropdownRole).listbox
|
|
2195
|
+
role: unref(DropdownRole).listbox,
|
|
2196
|
+
onAfterExpand,
|
|
2197
|
+
onAfterCollapse
|
|
2132
2198
|
}), createSlots({
|
|
2133
2199
|
default: withCtx(({ aria }) => [
|
|
2134
2200
|
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
@@ -2143,9 +2209,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2143
2209
|
ref_key: "inputEl",
|
|
2144
2210
|
ref: inputEl
|
|
2145
2211
|
}, aria, {
|
|
2146
|
-
"aria-labelledby": unref(hasLabelId),
|
|
2147
2212
|
class: "vv-select__input",
|
|
2148
2213
|
role: "combobox",
|
|
2214
|
+
"aria-expanded": unref(expanded),
|
|
2215
|
+
"aria-labelledby": unref(hasLabelId),
|
|
2216
|
+
"aria-describedby": unref(hasHintLabelOrSlot) ? unref(hasHintId) : void 0,
|
|
2217
|
+
"aria-errormessage": unref(hasInvalidLabelOrSlot) ? unref(hasHintId) : void 0,
|
|
2149
2218
|
tabindex: unref(hasTabindex),
|
|
2150
2219
|
onClickPassive: onClickInput
|
|
2151
2220
|
}), [
|
|
@@ -2281,8 +2350,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2281
2350
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchText) ? searchText.value = $event : null),
|
|
2282
2351
|
"aria-autocomplete": "list",
|
|
2283
2352
|
"aria-controls": unref(hasDropdownId),
|
|
2284
|
-
"aria-labelledby": unref(hasLabelId),
|
|
2285
|
-
"aria-describedby": unref(hasHintId),
|
|
2286
2353
|
autocomplete: "off",
|
|
2287
2354
|
spellcheck: "false",
|
|
2288
2355
|
type: "search",
|
|
@@ -2307,7 +2374,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2307
2374
|
createVNode(unref(HintSlot), {
|
|
2308
2375
|
id: unref(hasHintId),
|
|
2309
2376
|
class: "vv-select__hint"
|
|
2310
|
-
},
|
|
2377
|
+
}, createSlots({ _: 2 }, [
|
|
2378
|
+
_ctx.$slots.hint ? {
|
|
2379
|
+
name: "hint",
|
|
2380
|
+
fn: withCtx(() => [
|
|
2381
|
+
renderSlot(_ctx.$slots, "hint", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2382
|
+
]),
|
|
2383
|
+
key: "0"
|
|
2384
|
+
} : void 0,
|
|
2385
|
+
_ctx.$slots.loading ? {
|
|
2386
|
+
name: "loading",
|
|
2387
|
+
fn: withCtx(() => [
|
|
2388
|
+
renderSlot(_ctx.$slots, "loading", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2389
|
+
]),
|
|
2390
|
+
key: "1"
|
|
2391
|
+
} : void 0,
|
|
2392
|
+
_ctx.$slots.valid ? {
|
|
2393
|
+
name: "valid",
|
|
2394
|
+
fn: withCtx(() => [
|
|
2395
|
+
renderSlot(_ctx.$slots, "valid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2396
|
+
]),
|
|
2397
|
+
key: "2"
|
|
2398
|
+
} : void 0,
|
|
2399
|
+
_ctx.$slots.invalid ? {
|
|
2400
|
+
name: "invalid",
|
|
2401
|
+
fn: withCtx(() => [
|
|
2402
|
+
renderSlot(_ctx.$slots, "invalid", normalizeProps(guardReactiveProps(unref(hintSlotScope))))
|
|
2403
|
+
]),
|
|
2404
|
+
key: "3"
|
|
2405
|
+
} : void 0
|
|
2406
|
+
]), 1032, ["id"])
|
|
2311
2407
|
], 10, _hoisted_1)) : (openBlock(), createBlock(_sfc_main$2, mergeProps({ key: 1 }, unref(selectProps), {
|
|
2312
2408
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => emit("update:modelValue", $event))
|
|
2313
2409
|
}), null, 16));
|