@volverjs/ui-vue 0.0.9-beta.10 → 0.0.9-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/VvCombobox/VvCombobox.es.js +105 -96
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +3 -3
- package/dist/components/VvCombobox/index.d.ts +4 -2
- package/dist/components/index.es.js +105 -96
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/package.json +21 -21
- 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 +24 -14
- package/src/components/VvCombobox/index.ts +2 -2
- package/src/stories/Combobox/Combobox.test.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { unref, inject, computed, toRef, toRefs, defineComponent, useAttrs, ref, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString, isRef, provide, watchEffect, watch, Fragment, renderList, createBlock, mergeProps, withCtx, resolveDynamicComponent, createCommentVNode, useSlots, h, onMounted, withDirectives, vModelCheckbox, createVNode, createSlots, nextTick, Transition, toHandlers, normalizeStyle, vShow, vModelSelect, vModelText, vModelDynamic, vModelRadio } from "vue";
|
|
2
2
|
import { nanoid } from "nanoid";
|
|
3
|
-
import { useToggle, useStorage, useVModel, useMutationObserver, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced } from "@vueuse/core";
|
|
3
|
+
import { useToggle, useStorage, useVModel, useMutationObserver, onClickOutside, useFocusWithin, onKeyStroke, useElementHover, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
|
|
4
4
|
import { iconExists, Icon, addIcon } from "@iconify/vue";
|
|
5
5
|
import { get } from "ts-dot-prop";
|
|
6
6
|
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
@@ -3669,7 +3669,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3669
3669
|
expanded.value = false;
|
|
3670
3670
|
};
|
|
3671
3671
|
const onAfterExpand = () => {
|
|
3672
|
-
if (
|
|
3672
|
+
if (propsDefaults.value.searchable) {
|
|
3673
3673
|
if (inputSearchEl.value) {
|
|
3674
3674
|
inputSearchEl.value.focus({
|
|
3675
3675
|
preventScroll: true
|
|
@@ -3678,7 +3678,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3678
3678
|
}
|
|
3679
3679
|
};
|
|
3680
3680
|
const onAfterCollapse = () => {
|
|
3681
|
-
if (
|
|
3681
|
+
if (propsDefaults.value.searchable) {
|
|
3682
3682
|
searchText.value = "";
|
|
3683
3683
|
}
|
|
3684
3684
|
};
|
|
@@ -3692,14 +3692,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3692
3692
|
loading,
|
|
3693
3693
|
valid,
|
|
3694
3694
|
invalid,
|
|
3695
|
-
floating
|
|
3696
|
-
searchable
|
|
3695
|
+
floating
|
|
3697
3696
|
} = toRefs(props);
|
|
3698
3697
|
const hasId = useUniqueId(id);
|
|
3699
3698
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
3700
3699
|
const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
|
|
3701
3700
|
const hasSearchId = computed(() => `${hasId.value}-search`);
|
|
3702
3701
|
const hasLabelId = computed(() => `${hasId.value}-label`);
|
|
3702
|
+
const localLoading = ref(false);
|
|
3703
|
+
const isLoading = computed(() => localLoading.value || loading.value);
|
|
3703
3704
|
const dropdownEl = ref();
|
|
3704
3705
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
3705
3706
|
icon,
|
|
@@ -3714,7 +3715,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3714
3715
|
modifiers,
|
|
3715
3716
|
computed(() => ({
|
|
3716
3717
|
disabled: disabled.value,
|
|
3717
|
-
loading:
|
|
3718
|
+
loading: isLoading.value,
|
|
3718
3719
|
readonly: readonly.value,
|
|
3719
3720
|
"icon-before": Boolean(hasIconBefore.value),
|
|
3720
3721
|
"icon-after": Boolean(hasIconAfter.value),
|
|
@@ -3732,13 +3733,18 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3732
3733
|
getOptionDisabled,
|
|
3733
3734
|
getOptionGrouped
|
|
3734
3735
|
} = useOptions(props);
|
|
3735
|
-
const filteredOptions =
|
|
3736
|
+
const filteredOptions = computedAsync(async () => {
|
|
3736
3737
|
var _a;
|
|
3737
3738
|
if (propsDefaults.value.searchFunction) {
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3739
|
+
localLoading.value = true;
|
|
3740
|
+
const toReturn = await Promise.resolve(
|
|
3741
|
+
propsDefaults.value.searchFunction(
|
|
3742
|
+
debouncedSearchText.value,
|
|
3743
|
+
props.options
|
|
3744
|
+
)
|
|
3741
3745
|
);
|
|
3746
|
+
localLoading.value = false;
|
|
3747
|
+
return toReturn;
|
|
3742
3748
|
}
|
|
3743
3749
|
return (_a = props.options) == null ? void 0 : _a.filter((option) => {
|
|
3744
3750
|
return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
|
|
@@ -3816,7 +3822,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3816
3822
|
invalid: invalid.value,
|
|
3817
3823
|
invalidLabel: propsDefaults.value.invalidLabel,
|
|
3818
3824
|
hintLabel: propsDefaults.value.hintLabel,
|
|
3819
|
-
loading:
|
|
3825
|
+
loading: isLoading.value,
|
|
3820
3826
|
loadingLabel: propsDefaults.value.loadingLabel,
|
|
3821
3827
|
disabled: disabled.value,
|
|
3822
3828
|
readonly: readonly.value,
|
|
@@ -3844,7 +3850,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3844
3850
|
flip: propsDefaults.value.flip,
|
|
3845
3851
|
autoPlacement: propsDefaults.value.autoPlacement,
|
|
3846
3852
|
arrow: propsDefaults.value.arrow,
|
|
3847
|
-
autofocusFirst:
|
|
3853
|
+
autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
|
|
3848
3854
|
triggerWidth: propsDefaults.value.triggerWidth,
|
|
3849
3855
|
modifiers: propsDefaults.value.dropdownModifiers
|
|
3850
3856
|
}));
|
|
@@ -3876,7 +3882,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3876
3882
|
_ctx.label ? (openBlock(), createElementBlock("label", {
|
|
3877
3883
|
key: 0,
|
|
3878
3884
|
id: unref(hasLabelId),
|
|
3879
|
-
for: unref(searchable
|
|
3885
|
+
for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
|
|
3880
3886
|
}, toDisplayString(_ctx.label), 9, _hoisted_2$5)) : createCommentVNode("", true),
|
|
3881
3887
|
createElementVNode("div", {
|
|
3882
3888
|
ref_key: "wrapperEl",
|
|
@@ -3950,87 +3956,90 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3950
3956
|
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
3951
3957
|
])) : createCommentVNode("", true)
|
|
3952
3958
|
]),
|
|
3953
|
-
items: withCtx(() =>
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
3959
|
+
items: withCtx(() => {
|
|
3960
|
+
var _a;
|
|
3961
|
+
return [
|
|
3962
|
+
((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
|
|
3963
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
3964
|
+
isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3965
|
+
createVNode(_sfc_main$b, {
|
|
3966
|
+
label: unref(getOptionLabel)(option)
|
|
3967
|
+
}, null, 8, ["label"]),
|
|
3968
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
|
|
3969
|
+
option
|
|
3970
|
+
), (item, i) => {
|
|
3971
|
+
return openBlock(), createBlock(_sfc_main$c, mergeProps({
|
|
3972
|
+
disabled: unref(getOptionDisabled)(item),
|
|
3973
|
+
selected: getOptionSelected(item),
|
|
3974
|
+
unselectable: _ctx.unselectable,
|
|
3975
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
3976
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
3977
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
3978
|
+
}, {
|
|
3979
|
+
key: i,
|
|
3980
|
+
class: "vv-dropdown-option",
|
|
3981
|
+
onClickPassive: ($event) => onInput(item)
|
|
3982
|
+
}), {
|
|
3983
|
+
default: withCtx(() => [
|
|
3984
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
3985
|
+
option,
|
|
3986
|
+
selectedOptions: unref(selectedOptions),
|
|
3987
|
+
selected: getOptionSelected(item),
|
|
3988
|
+
disabled: unref(getOptionDisabled)(item)
|
|
3989
|
+
})), () => [
|
|
3990
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
|
|
3991
|
+
])
|
|
3992
|
+
]),
|
|
3993
|
+
_: 2
|
|
3994
|
+
}, 1040, ["onClickPassive"]);
|
|
3995
|
+
}), 128))
|
|
3996
|
+
], 64)) : (openBlock(), createBlock(_sfc_main$c, mergeProps({ key: 1 }, {
|
|
3997
|
+
disabled: unref(getOptionDisabled)(option),
|
|
3998
|
+
selected: getOptionSelected(option),
|
|
3999
|
+
unselectable: _ctx.unselectable,
|
|
4000
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
4001
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
4002
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
4003
|
+
}, {
|
|
4004
|
+
class: "vv-dropdown-option",
|
|
4005
|
+
onClickPassive: ($event) => onInput(option)
|
|
4006
|
+
}), {
|
|
4007
|
+
default: withCtx(() => [
|
|
4008
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
4009
|
+
option,
|
|
4010
|
+
selectedOptions: unref(selectedOptions),
|
|
4011
|
+
selected: getOptionSelected(option),
|
|
4012
|
+
disabled: unref(getOptionDisabled)(option)
|
|
4013
|
+
})), () => [
|
|
4014
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
|
|
4015
|
+
])
|
|
4016
|
+
]),
|
|
4017
|
+
_: 2
|
|
4018
|
+
}, 1040, ["onClickPassive"]))
|
|
4019
|
+
], 64);
|
|
4020
|
+
}), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$c, {
|
|
4021
|
+
key: 1,
|
|
4022
|
+
modifiers: "inert"
|
|
4023
|
+
}, {
|
|
4024
|
+
default: withCtx(() => [
|
|
4025
|
+
renderSlot(_ctx.$slots, "no-options", {}, () => [
|
|
4026
|
+
createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
|
|
4027
|
+
])
|
|
4028
|
+
]),
|
|
4029
|
+
_: 3
|
|
4030
|
+
})) : (openBlock(), createBlock(_sfc_main$c, {
|
|
4031
|
+
key: 2,
|
|
4032
|
+
modifiers: "inert"
|
|
4033
|
+
}, {
|
|
4034
|
+
default: withCtx(() => [
|
|
4035
|
+
renderSlot(_ctx.$slots, "no-results", {}, () => [
|
|
4036
|
+
createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
|
|
4037
|
+
])
|
|
4038
|
+
]),
|
|
4039
|
+
_: 3
|
|
4040
|
+
}))
|
|
4041
|
+
];
|
|
4042
|
+
}),
|
|
4034
4043
|
after: withCtx(() => [
|
|
4035
4044
|
renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
|
|
4036
4045
|
var _a;
|
|
@@ -4046,11 +4055,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4046
4055
|
]),
|
|
4047
4056
|
_: 2
|
|
4048
4057
|
}, [
|
|
4049
|
-
unref(searchable
|
|
4058
|
+
unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
|
|
4050
4059
|
name: "before",
|
|
4051
4060
|
fn: withCtx(() => [
|
|
4052
4061
|
renderSlot(_ctx.$slots, "dropdown::before"),
|
|
4053
|
-
unref(searchable
|
|
4062
|
+
unref(propsDefaults).searchable ? withDirectives((openBlock(), createElementBlock("input", {
|
|
4054
4063
|
key: 0,
|
|
4055
4064
|
id: unref(hasSearchId),
|
|
4056
4065
|
ref_key: "inputSearchEl",
|