@volverjs/ui-vue 0.0.9-beta.9 → 0.0.9
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 +2 -2
- package/dist/components/VvAccordion/VvAccordion.es.js +8 -7
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +8 -7
- package/dist/components/VvAction/VvAction.es.js +8 -7
- package/dist/components/VvAlert/VvAlert.es.js +8 -7
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +8 -7
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +6 -6
- package/dist/components/VvAlertGroup/index.d.ts +2 -2
- package/dist/components/VvAvatar/VvAvatar.es.js +8 -7
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +8 -7
- package/dist/components/VvBadge/VvBadge.es.js +8 -7
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +8 -7
- package/dist/components/VvButton/VvButton.es.js +8 -7
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +8 -7
- package/dist/components/VvCard/VvCard.es.js +8 -7
- package/dist/components/VvCheckbox/VvCheckbox.es.js +8 -7
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +8 -7
- package/dist/components/VvCombobox/VvCombobox.es.js +145 -116
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +306 -90
- package/dist/components/VvCombobox/index.d.ts +108 -31
- package/dist/components/VvDialog/VvDialog.es.js +16 -11
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +19 -16
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +299 -91
- package/dist/components/VvDropdown/index.d.ts +99 -30
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +8 -7
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.es.js +8 -7
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +8 -7
- package/dist/components/VvInputText/VvInputText.es.js +193 -103
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +19 -37
- package/dist/components/VvInputText/index.d.ts +15 -33
- package/dist/components/VvNav/VvNav.es.js +8 -7
- package/dist/components/VvProgress/VvProgress.es.js +8 -7
- package/dist/components/VvRadio/VvRadio.es.js +8 -7
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +8 -7
- package/dist/components/VvSelect/VvSelect.es.js +8 -7
- package/dist/components/VvSelect/VvSelect.vue.d.ts +1 -1
- package/dist/components/VvTab/VvTab.es.js +8 -7
- package/dist/components/VvTextarea/VvTextarea.es.js +16 -12
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +8 -7
- package/dist/components/index.es.js +346 -221
- package/dist/components/index.umd.js +1 -1
- package/dist/constants.d.ts +4 -0
- package/dist/directives/index.es.js +8 -7
- package/dist/directives/v-tooltip.es.js +8 -7
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +100 -31
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +2 -2
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +18 -18
- package/dist/stories/Combobox/Combobox.settings.d.ts +8 -0
- package/dist/stories/InputText/InputText.settings.d.ts +31 -9
- package/dist/stories/InputText/InputText.stories.d.ts +0 -1
- package/dist/stories/InputText/InputTextMask.stories.d.ts +12 -0
- package/package.json +60 -59
- 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 +40 -19
- package/src/components/VvCombobox/index.ts +13 -0
- package/src/components/VvDialog/VvDialog.vue +6 -2
- package/src/components/VvDropdown/VvDropdown.vue +18 -16
- package/src/components/VvInputText/VvInputText.vue +170 -55
- package/src/components/VvInputText/index.ts +32 -34
- package/src/components/VvTextarea/VvTextarea.vue +8 -5
- package/src/constants.ts +5 -0
- package/src/props/index.ts +7 -11
- package/src/stories/Combobox/Combobox.settings.ts +8 -0
- package/src/stories/Combobox/Combobox.test.ts +1 -1
- package/src/stories/InputText/InputText.settings.ts +36 -15
- package/src/stories/InputText/InputText.stories.ts +4 -12
- package/src/stories/InputText/InputText.test.ts +31 -15
- package/src/stories/InputText/InputTextMask.stories.ts +122 -0
|
@@ -1,11 +1,16 @@
|
|
|
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,
|
|
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, 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";
|
|
7
7
|
import mitt from "mitt";
|
|
8
|
-
import {
|
|
8
|
+
import { useIMask } from "vue-imask";
|
|
9
|
+
var Strategy = /* @__PURE__ */ ((Strategy2) => {
|
|
10
|
+
Strategy2["absolute"] = "absolute";
|
|
11
|
+
Strategy2["fixed"] = "fixed";
|
|
12
|
+
return Strategy2;
|
|
13
|
+
})(Strategy || {});
|
|
9
14
|
var Side = /* @__PURE__ */ ((Side2) => {
|
|
10
15
|
Side2["left"] = "left";
|
|
11
16
|
Side2["right"] = "right";
|
|
@@ -272,19 +277,15 @@ const DropdownProps = {
|
|
|
272
277
|
placement: {
|
|
273
278
|
type: String,
|
|
274
279
|
default: Side.bottom,
|
|
275
|
-
validator: (value) =>
|
|
276
|
-
return Object.values(Side).includes(value) || Object.values(Placement).includes(value);
|
|
277
|
-
}
|
|
280
|
+
validator: (value) => Object.values(Side).includes(value) || Object.values(Placement).includes(value)
|
|
278
281
|
},
|
|
279
282
|
/**
|
|
280
283
|
* Dropdown strategy
|
|
281
284
|
*/
|
|
282
285
|
strategy: {
|
|
283
286
|
type: String,
|
|
284
|
-
default:
|
|
285
|
-
validator: (value) =>
|
|
286
|
-
return ["fixed", "absolute"].includes(value);
|
|
287
|
-
}
|
|
287
|
+
default: void 0,
|
|
288
|
+
validator: (value) => Object.values(Strategy).includes(value)
|
|
288
289
|
},
|
|
289
290
|
/**
|
|
290
291
|
* Dropdown show / hide transition name
|
|
@@ -2572,6 +2573,13 @@ const VvComboboxProps = {
|
|
|
2572
2573
|
* Use input text to search on options
|
|
2573
2574
|
*/
|
|
2574
2575
|
searchable: Boolean,
|
|
2576
|
+
/**
|
|
2577
|
+
* Search function to filter options
|
|
2578
|
+
*/
|
|
2579
|
+
searchFunction: {
|
|
2580
|
+
type: Function,
|
|
2581
|
+
default: void 0
|
|
2582
|
+
},
|
|
2575
2583
|
/**
|
|
2576
2584
|
* On searchable select is the input search placeholder
|
|
2577
2585
|
*/
|
|
@@ -2784,7 +2792,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2784
2792
|
}
|
|
2785
2793
|
} else if (props.flip) {
|
|
2786
2794
|
if (typeof props.flip === "boolean") {
|
|
2787
|
-
toReturn.push(flip());
|
|
2795
|
+
toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
|
|
2788
2796
|
} else {
|
|
2789
2797
|
toReturn.push(flip(props.flip));
|
|
2790
2798
|
}
|
|
@@ -2836,13 +2844,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2836
2844
|
}
|
|
2837
2845
|
return toReturn;
|
|
2838
2846
|
});
|
|
2839
|
-
const { x, y,
|
|
2847
|
+
const { x, y, middlewareData, placement, strategy } = useFloating(
|
|
2840
2848
|
referenceEl,
|
|
2841
2849
|
floatingEl,
|
|
2842
2850
|
{
|
|
2843
2851
|
whileElementsMounted: (...args) => {
|
|
2844
2852
|
return autoUpdate(...args, {
|
|
2845
|
-
animationFrame: props.strategy ===
|
|
2853
|
+
animationFrame: props.strategy === Strategy.fixed
|
|
2846
2854
|
});
|
|
2847
2855
|
},
|
|
2848
2856
|
placement: computed(() => props.placement),
|
|
@@ -2851,16 +2859,18 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2851
2859
|
}
|
|
2852
2860
|
);
|
|
2853
2861
|
const dropdownPlacement = computed(() => {
|
|
2862
|
+
var _a;
|
|
2854
2863
|
if (hasCustomPosition.value) {
|
|
2855
2864
|
return void 0;
|
|
2856
2865
|
}
|
|
2866
|
+
const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
|
|
2857
2867
|
return {
|
|
2858
2868
|
position: strategy.value,
|
|
2859
2869
|
top: `${y.value ?? 0}px`,
|
|
2860
2870
|
left: `${x.value ?? 0}px`,
|
|
2861
|
-
maxWidth: maxWidth.value,
|
|
2871
|
+
maxWidth: width ? void 0 : maxWidth.value,
|
|
2862
2872
|
maxHeight: maxHeight.value,
|
|
2863
|
-
width
|
|
2873
|
+
width
|
|
2864
2874
|
};
|
|
2865
2875
|
});
|
|
2866
2876
|
const side = computed(
|
|
@@ -2872,10 +2882,10 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2872
2882
|
return void 0;
|
|
2873
2883
|
}
|
|
2874
2884
|
const staticSide = {
|
|
2875
|
-
top:
|
|
2876
|
-
right:
|
|
2877
|
-
bottom:
|
|
2878
|
-
left:
|
|
2885
|
+
[Side.top]: Side.bottom,
|
|
2886
|
+
[Side.right]: Side.left,
|
|
2887
|
+
[Side.bottom]: Side.top,
|
|
2888
|
+
[Side.left]: Side.right
|
|
2879
2889
|
}[side.value];
|
|
2880
2890
|
return {
|
|
2881
2891
|
left: ((_a = middlewareData.value.arrow) == null ? void 0 : _a.x) !== void 0 ? `${(_b = middlewareData.value.arrow) == null ? void 0 : _b.x}px` : void 0,
|
|
@@ -3639,7 +3649,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3639
3649
|
const searchText = ref("");
|
|
3640
3650
|
const debouncedSearchText = refDebounced(
|
|
3641
3651
|
searchText,
|
|
3642
|
-
Number(props.debounceSearch)
|
|
3652
|
+
computed(() => Number(props.debounceSearch))
|
|
3643
3653
|
);
|
|
3644
3654
|
watch(
|
|
3645
3655
|
debouncedSearchText,
|
|
@@ -3662,7 +3672,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3662
3672
|
expanded.value = false;
|
|
3663
3673
|
};
|
|
3664
3674
|
const onAfterExpand = () => {
|
|
3665
|
-
if (
|
|
3675
|
+
if (propsDefaults.value.searchable) {
|
|
3666
3676
|
if (inputSearchEl.value) {
|
|
3667
3677
|
inputSearchEl.value.focus({
|
|
3668
3678
|
preventScroll: true
|
|
@@ -3671,7 +3681,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3671
3681
|
}
|
|
3672
3682
|
};
|
|
3673
3683
|
const onAfterCollapse = () => {
|
|
3674
|
-
if (
|
|
3684
|
+
if (propsDefaults.value.searchable) {
|
|
3675
3685
|
searchText.value = "";
|
|
3676
3686
|
}
|
|
3677
3687
|
};
|
|
@@ -3685,14 +3695,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3685
3695
|
loading,
|
|
3686
3696
|
valid,
|
|
3687
3697
|
invalid,
|
|
3688
|
-
floating
|
|
3689
|
-
searchable
|
|
3698
|
+
floating
|
|
3690
3699
|
} = toRefs(props);
|
|
3691
3700
|
const hasId = useUniqueId(id);
|
|
3692
3701
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
3693
3702
|
const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
|
|
3694
3703
|
const hasSearchId = computed(() => `${hasId.value}-search`);
|
|
3695
3704
|
const hasLabelId = computed(() => `${hasId.value}-label`);
|
|
3705
|
+
const localLoading = ref(false);
|
|
3706
|
+
const isLoading = computed(() => localLoading.value || loading.value);
|
|
3696
3707
|
const dropdownEl = ref();
|
|
3697
3708
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
3698
3709
|
icon,
|
|
@@ -3707,7 +3718,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3707
3718
|
modifiers,
|
|
3708
3719
|
computed(() => ({
|
|
3709
3720
|
disabled: disabled.value,
|
|
3710
|
-
loading:
|
|
3721
|
+
loading: isLoading.value,
|
|
3711
3722
|
readonly: readonly.value,
|
|
3712
3723
|
"icon-before": Boolean(hasIconBefore.value),
|
|
3713
3724
|
"icon-after": Boolean(hasIconAfter.value),
|
|
@@ -3725,8 +3736,19 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3725
3736
|
getOptionDisabled,
|
|
3726
3737
|
getOptionGrouped
|
|
3727
3738
|
} = useOptions(props);
|
|
3728
|
-
const filteredOptions =
|
|
3739
|
+
const filteredOptions = computedAsync(async () => {
|
|
3729
3740
|
var _a;
|
|
3741
|
+
if (propsDefaults.value.searchFunction) {
|
|
3742
|
+
localLoading.value = true;
|
|
3743
|
+
const toReturn = await Promise.resolve(
|
|
3744
|
+
propsDefaults.value.searchFunction(
|
|
3745
|
+
debouncedSearchText.value,
|
|
3746
|
+
props.options
|
|
3747
|
+
)
|
|
3748
|
+
);
|
|
3749
|
+
localLoading.value = false;
|
|
3750
|
+
return toReturn;
|
|
3751
|
+
}
|
|
3730
3752
|
return (_a = props.options) == null ? void 0 : _a.filter((option) => {
|
|
3731
3753
|
return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
|
|
3732
3754
|
});
|
|
@@ -3744,12 +3766,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3744
3766
|
} else if (props.modelValue) {
|
|
3745
3767
|
selectedValues = [props.modelValue];
|
|
3746
3768
|
}
|
|
3747
|
-
const options = props.options.reduce(
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3769
|
+
const options = props.options.reduce(
|
|
3770
|
+
(acc, value) => {
|
|
3771
|
+
if (isGroup(value)) {
|
|
3772
|
+
return [...acc, ...getOptionGrouped(value)];
|
|
3773
|
+
}
|
|
3774
|
+
return [...acc, value];
|
|
3775
|
+
},
|
|
3776
|
+
[]
|
|
3777
|
+
);
|
|
3753
3778
|
return options.filter((option) => {
|
|
3754
3779
|
if (isGroup(option)) {
|
|
3755
3780
|
return getOptionGrouped(option).some(
|
|
@@ -3803,7 +3828,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3803
3828
|
invalid: invalid.value,
|
|
3804
3829
|
invalidLabel: propsDefaults.value.invalidLabel,
|
|
3805
3830
|
hintLabel: propsDefaults.value.hintLabel,
|
|
3806
|
-
loading:
|
|
3831
|
+
loading: isLoading.value,
|
|
3807
3832
|
loadingLabel: propsDefaults.value.loadingLabel,
|
|
3808
3833
|
disabled: disabled.value,
|
|
3809
3834
|
readonly: readonly.value,
|
|
@@ -3831,7 +3856,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3831
3856
|
flip: propsDefaults.value.flip,
|
|
3832
3857
|
autoPlacement: propsDefaults.value.autoPlacement,
|
|
3833
3858
|
arrow: propsDefaults.value.arrow,
|
|
3834
|
-
autofocusFirst:
|
|
3859
|
+
autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
|
|
3835
3860
|
triggerWidth: propsDefaults.value.triggerWidth,
|
|
3836
3861
|
modifiers: propsDefaults.value.dropdownModifiers
|
|
3837
3862
|
}));
|
|
@@ -3863,7 +3888,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3863
3888
|
_ctx.label ? (openBlock(), createElementBlock("label", {
|
|
3864
3889
|
key: 0,
|
|
3865
3890
|
id: unref(hasLabelId),
|
|
3866
|
-
for: unref(searchable
|
|
3891
|
+
for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
|
|
3867
3892
|
}, toDisplayString(_ctx.label), 9, _hoisted_2$5)) : createCommentVNode("", true),
|
|
3868
3893
|
createElementVNode("div", {
|
|
3869
3894
|
ref_key: "wrapperEl",
|
|
@@ -3915,6 +3940,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3915
3940
|
_ctx.unselectable && !unref(readonly) && !unref(disabled) ? (openBlock(), createElementBlock("button", {
|
|
3916
3941
|
key: 0,
|
|
3917
3942
|
"aria-label": unref(propsDefaults).deselectActionLabel,
|
|
3943
|
+
type: "button",
|
|
3918
3944
|
onClick: withModifiers(($event) => onInput(option), ["stop"])
|
|
3919
3945
|
}, [
|
|
3920
3946
|
createVNode(_sfc_main$n, { name: "close" })
|
|
@@ -3937,87 +3963,90 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3937
3963
|
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
3938
3964
|
])) : createCommentVNode("", true)
|
|
3939
3965
|
]),
|
|
3940
|
-
items: withCtx(() =>
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
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
|
-
|
|
3966
|
+
items: withCtx(() => {
|
|
3967
|
+
var _a;
|
|
3968
|
+
return [
|
|
3969
|
+
!unref(disabled) && ((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
|
|
3970
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
3971
|
+
isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3972
|
+
createVNode(_sfc_main$b, {
|
|
3973
|
+
label: unref(getOptionLabel)(option)
|
|
3974
|
+
}, null, 8, ["label"]),
|
|
3975
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
|
|
3976
|
+
option
|
|
3977
|
+
), (item, i) => {
|
|
3978
|
+
return openBlock(), createBlock(_sfc_main$c, mergeProps({
|
|
3979
|
+
disabled: unref(getOptionDisabled)(item),
|
|
3980
|
+
selected: getOptionSelected(item),
|
|
3981
|
+
unselectable: _ctx.unselectable,
|
|
3982
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
3983
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
3984
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
3985
|
+
}, {
|
|
3986
|
+
key: i,
|
|
3987
|
+
class: "vv-dropdown-option",
|
|
3988
|
+
onClickPassive: ($event) => onInput(item)
|
|
3989
|
+
}), {
|
|
3990
|
+
default: withCtx(() => [
|
|
3991
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
3992
|
+
option,
|
|
3993
|
+
selectedOptions: unref(selectedOptions),
|
|
3994
|
+
selected: getOptionSelected(item),
|
|
3995
|
+
disabled: unref(getOptionDisabled)(item)
|
|
3996
|
+
})), () => [
|
|
3997
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
|
|
3998
|
+
])
|
|
3999
|
+
]),
|
|
4000
|
+
_: 2
|
|
4001
|
+
}, 1040, ["onClickPassive"]);
|
|
4002
|
+
}), 128))
|
|
4003
|
+
], 64)) : (openBlock(), createBlock(_sfc_main$c, mergeProps({ key: 1 }, {
|
|
4004
|
+
disabled: unref(getOptionDisabled)(option),
|
|
4005
|
+
selected: getOptionSelected(option),
|
|
4006
|
+
unselectable: _ctx.unselectable,
|
|
4007
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
4008
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
4009
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
4010
|
+
}, {
|
|
4011
|
+
class: "vv-dropdown-option",
|
|
4012
|
+
onClickPassive: ($event) => onInput(option)
|
|
4013
|
+
}), {
|
|
4014
|
+
default: withCtx(() => [
|
|
4015
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
4016
|
+
option,
|
|
4017
|
+
selectedOptions: unref(selectedOptions),
|
|
4018
|
+
selected: getOptionSelected(option),
|
|
4019
|
+
disabled: unref(getOptionDisabled)(option)
|
|
4020
|
+
})), () => [
|
|
4021
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
|
|
4022
|
+
])
|
|
4023
|
+
]),
|
|
4024
|
+
_: 2
|
|
4025
|
+
}, 1040, ["onClickPassive"]))
|
|
4026
|
+
], 64);
|
|
4027
|
+
}), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$c, {
|
|
4028
|
+
key: 1,
|
|
4029
|
+
modifiers: "inert"
|
|
4030
|
+
}, {
|
|
4031
|
+
default: withCtx(() => [
|
|
4032
|
+
renderSlot(_ctx.$slots, "no-options", {}, () => [
|
|
4033
|
+
createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
|
|
4034
|
+
])
|
|
4035
|
+
]),
|
|
4036
|
+
_: 3
|
|
4037
|
+
})) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$c, {
|
|
4038
|
+
key: 2,
|
|
4039
|
+
modifiers: "inert"
|
|
4040
|
+
}, {
|
|
4041
|
+
default: withCtx(() => [
|
|
4042
|
+
renderSlot(_ctx.$slots, "no-results", {}, () => [
|
|
4043
|
+
createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
|
|
4044
|
+
])
|
|
4045
|
+
]),
|
|
4046
|
+
_: 3
|
|
4047
|
+
})) : createCommentVNode("", true)
|
|
4048
|
+
];
|
|
4049
|
+
}),
|
|
4021
4050
|
after: withCtx(() => [
|
|
4022
4051
|
renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
|
|
4023
4052
|
var _a;
|
|
@@ -4033,11 +4062,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4033
4062
|
]),
|
|
4034
4063
|
_: 2
|
|
4035
4064
|
}, [
|
|
4036
|
-
unref(searchable
|
|
4065
|
+
unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
|
|
4037
4066
|
name: "before",
|
|
4038
4067
|
fn: withCtx(() => [
|
|
4039
4068
|
renderSlot(_ctx.$slots, "dropdown::before"),
|
|
4040
|
-
unref(searchable) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
4069
|
+
unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
4041
4070
|
key: 0,
|
|
4042
4071
|
id: unref(hasSearchId),
|
|
4043
4072
|
ref_key: "inputSearchEl",
|
|
@@ -4184,14 +4213,18 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
4184
4213
|
const transitioName = computed(() => `vv-dialog--${props.transition}`);
|
|
4185
4214
|
const dialogTransitionHandlers = {
|
|
4186
4215
|
"before-enter": () => {
|
|
4187
|
-
var _a;
|
|
4188
|
-
(_a = dialogEl.value) == null ? void 0 : _a.
|
|
4216
|
+
var _a, _b;
|
|
4217
|
+
if (!((_a = dialogEl.value) == null ? void 0 : _a.open)) {
|
|
4218
|
+
(_b = dialogEl.value) == null ? void 0 : _b.showModal();
|
|
4219
|
+
}
|
|
4189
4220
|
emit("open");
|
|
4190
4221
|
emit("before-enter");
|
|
4191
4222
|
},
|
|
4192
4223
|
"after-leave": () => {
|
|
4193
|
-
var _a;
|
|
4194
|
-
(_a = dialogEl.value) == null ? void 0 : _a.
|
|
4224
|
+
var _a, _b;
|
|
4225
|
+
if ((_a = dialogEl.value) == null ? void 0 : _a.open) {
|
|
4226
|
+
(_b = dialogEl.value) == null ? void 0 : _b.close();
|
|
4227
|
+
}
|
|
4195
4228
|
emit("close");
|
|
4196
4229
|
emit("after-leave");
|
|
4197
4230
|
},
|
|
@@ -4297,7 +4330,23 @@ const TYPES_ICON = {
|
|
|
4297
4330
|
COLOR: "color",
|
|
4298
4331
|
SEARCH: "close"
|
|
4299
4332
|
};
|
|
4300
|
-
const VvInputTextEvents = [
|
|
4333
|
+
const VvInputTextEvents = [
|
|
4334
|
+
"update:modelValue",
|
|
4335
|
+
"update:masked",
|
|
4336
|
+
"accept",
|
|
4337
|
+
"accept:typed",
|
|
4338
|
+
"accept:masked",
|
|
4339
|
+
"accept:unmasked",
|
|
4340
|
+
"complete",
|
|
4341
|
+
"complete:typed",
|
|
4342
|
+
"complete:masked",
|
|
4343
|
+
"complete:unmasked",
|
|
4344
|
+
"focus",
|
|
4345
|
+
"blur",
|
|
4346
|
+
"keyup",
|
|
4347
|
+
"keydown",
|
|
4348
|
+
"keypress"
|
|
4349
|
+
];
|
|
4301
4350
|
const VvInputTextProps = {
|
|
4302
4351
|
...InputTextareaProps,
|
|
4303
4352
|
/**
|
|
@@ -4404,44 +4453,19 @@ const VvInputTextProps = {
|
|
|
4404
4453
|
default: "Clear"
|
|
4405
4454
|
},
|
|
4406
4455
|
/**
|
|
4407
|
-
*
|
|
4408
|
-
* @see https://
|
|
4409
|
-
*/
|
|
4410
|
-
mask: {
|
|
4411
|
-
type: String,
|
|
4412
|
-
default: void 0
|
|
4413
|
-
},
|
|
4414
|
-
/**
|
|
4415
|
-
* Show mask before typing
|
|
4416
|
-
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
4456
|
+
* iMask options
|
|
4457
|
+
* @see https://imask.js.org/guide.html
|
|
4417
4458
|
*/
|
|
4418
|
-
|
|
4419
|
-
type: Boolean,
|
|
4420
|
-
default: false
|
|
4421
|
-
},
|
|
4422
|
-
/**
|
|
4423
|
-
* Write values reverse (ex. for numbers)
|
|
4424
|
-
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
4425
|
-
*/
|
|
4426
|
-
maskReversed: {
|
|
4427
|
-
type: Boolean,
|
|
4428
|
-
default: false
|
|
4429
|
-
},
|
|
4430
|
-
/**
|
|
4431
|
-
* Add mask custom tokens
|
|
4432
|
-
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
4433
|
-
*/
|
|
4434
|
-
maskTokens: {
|
|
4459
|
+
iMask: {
|
|
4435
4460
|
type: Object,
|
|
4436
4461
|
default: void 0
|
|
4437
4462
|
},
|
|
4438
4463
|
/**
|
|
4439
|
-
*
|
|
4440
|
-
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
4464
|
+
* Masked value
|
|
4441
4465
|
*/
|
|
4442
|
-
|
|
4443
|
-
type:
|
|
4444
|
-
default:
|
|
4466
|
+
masked: {
|
|
4467
|
+
type: String,
|
|
4468
|
+
default: void 0
|
|
4445
4469
|
},
|
|
4446
4470
|
/**
|
|
4447
4471
|
* Adjust input width to content
|
|
@@ -4462,6 +4486,13 @@ const VvInputTextProps = {
|
|
|
4462
4486
|
*/
|
|
4463
4487
|
unit: {
|
|
4464
4488
|
type: String
|
|
4489
|
+
},
|
|
4490
|
+
/**
|
|
4491
|
+
* Select input text on focus
|
|
4492
|
+
*/
|
|
4493
|
+
selectOnFocus: {
|
|
4494
|
+
type: Boolean,
|
|
4495
|
+
default: false
|
|
4465
4496
|
}
|
|
4466
4497
|
};
|
|
4467
4498
|
const VvInputPasswordAction = defineComponent({
|
|
@@ -4786,9 +4817,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4786
4817
|
VvInputTextProps,
|
|
4787
4818
|
props
|
|
4788
4819
|
);
|
|
4789
|
-
const inputEl = ref();
|
|
4790
|
-
const innerEl = ref();
|
|
4791
|
-
__expose({ $inner: innerEl });
|
|
4792
4820
|
const {
|
|
4793
4821
|
id,
|
|
4794
4822
|
icon,
|
|
@@ -4798,39 +4826,131 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4798
4826
|
count,
|
|
4799
4827
|
valid,
|
|
4800
4828
|
invalid,
|
|
4801
|
-
loading
|
|
4829
|
+
loading,
|
|
4830
|
+
debounce,
|
|
4831
|
+
maxlength,
|
|
4832
|
+
minlength,
|
|
4833
|
+
type,
|
|
4834
|
+
iMask,
|
|
4835
|
+
step
|
|
4802
4836
|
} = toRefs(props);
|
|
4803
4837
|
const hasId = useUniqueId(id);
|
|
4804
4838
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
4805
4839
|
const inputTextPlaceholder = computed(
|
|
4806
4840
|
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
4807
4841
|
);
|
|
4808
|
-
const
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4842
|
+
const maskReady = ref(false);
|
|
4843
|
+
const { el, mask, typed, masked, unmasked } = useIMask(
|
|
4844
|
+
computed(
|
|
4845
|
+
() => (iMask == null ? void 0 : iMask.value) ?? {
|
|
4846
|
+
mask: /./
|
|
4847
|
+
}
|
|
4848
|
+
),
|
|
4812
4849
|
{
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4850
|
+
emit,
|
|
4851
|
+
onAccept: () => {
|
|
4852
|
+
if (!maskReady.value) {
|
|
4853
|
+
return;
|
|
4816
4854
|
}
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4855
|
+
emit("update:masked", masked.value);
|
|
4856
|
+
if (type.value === INPUT_TYPES.NUMBER) {
|
|
4857
|
+
if (masked.value === "") {
|
|
4858
|
+
if (localModelValue.value === null || localModelValue.value === void 0) {
|
|
4859
|
+
return;
|
|
4860
|
+
}
|
|
4861
|
+
localModelValue.value = void 0;
|
|
4862
|
+
return;
|
|
4863
|
+
}
|
|
4864
|
+
if (typeof typed.value !== "number") {
|
|
4865
|
+
localModelValue.value = Number(typed.value);
|
|
4866
|
+
return;
|
|
4867
|
+
}
|
|
4868
|
+
localModelValue.value = typed.value;
|
|
4869
|
+
return;
|
|
4822
4870
|
}
|
|
4823
|
-
if (
|
|
4824
|
-
|
|
4871
|
+
if (type.value === INPUT_TYPES.DATE) {
|
|
4872
|
+
if (el.value instanceof HTMLInputElement && el.value.type === "date") {
|
|
4873
|
+
localModelValue.value = el.value.value;
|
|
4874
|
+
return;
|
|
4875
|
+
}
|
|
4876
|
+
let date = typed.value;
|
|
4877
|
+
if (date === null || date === "") {
|
|
4878
|
+
if (!localModelValue.value) {
|
|
4879
|
+
return;
|
|
4880
|
+
}
|
|
4881
|
+
localModelValue.value = "";
|
|
4882
|
+
return;
|
|
4883
|
+
}
|
|
4884
|
+
if (!(date instanceof Date)) {
|
|
4885
|
+
date = new Date(date);
|
|
4886
|
+
}
|
|
4887
|
+
localModelValue.value = `${date.getFullYear()}-${("0" + (date.getMonth() + 1)).slice(-2)}-${("0" + date.getDate()).slice(-2)}`;
|
|
4888
|
+
return;
|
|
4825
4889
|
}
|
|
4826
|
-
|
|
4890
|
+
if (type.value === INPUT_TYPES.DATETIME_LOCAL) {
|
|
4891
|
+
if (el.value instanceof HTMLInputElement && el.value.type === "datetime-local") {
|
|
4892
|
+
localModelValue.value = el.value.value;
|
|
4893
|
+
return;
|
|
4894
|
+
}
|
|
4895
|
+
let date = typed.value;
|
|
4896
|
+
if (date === null || date === "") {
|
|
4897
|
+
if (!localModelValue.value) {
|
|
4898
|
+
return;
|
|
4899
|
+
}
|
|
4900
|
+
localModelValue.value = "";
|
|
4901
|
+
return;
|
|
4902
|
+
}
|
|
4903
|
+
if (!(typed.value instanceof Date)) {
|
|
4904
|
+
date = new Date(date);
|
|
4905
|
+
}
|
|
4906
|
+
localModelValue.value = `${date.getFullYear()}-${("0" + (date.getMonth() + 1)).slice(-2)}-${("0" + date.getDate()).slice(-2)}T${("0" + date.getHours()).slice(-2)}:${("0" + date.getMinutes()).slice(-2)}`;
|
|
4907
|
+
return;
|
|
4908
|
+
}
|
|
4909
|
+
if (!localModelValue.value && !unmasked.value) {
|
|
4910
|
+
return;
|
|
4911
|
+
}
|
|
4912
|
+
localModelValue.value = unmasked.value;
|
|
4827
4913
|
}
|
|
4828
4914
|
}
|
|
4829
4915
|
);
|
|
4916
|
+
onMounted(() => {
|
|
4917
|
+
if (mask.value) {
|
|
4918
|
+
maskReady.value = true;
|
|
4919
|
+
typed.value = localModelValue.value ?? "";
|
|
4920
|
+
}
|
|
4921
|
+
});
|
|
4922
|
+
watch(
|
|
4923
|
+
() => props.modelValue,
|
|
4924
|
+
(newValue) => {
|
|
4925
|
+
var _a;
|
|
4926
|
+
if (mask.value) {
|
|
4927
|
+
typed.value = newValue && ((_a = iMask == null ? void 0 : iMask.value) == null ? void 0 : _a.mask) === Date ? new Date(newValue) : newValue ?? "";
|
|
4928
|
+
}
|
|
4929
|
+
}
|
|
4930
|
+
);
|
|
4931
|
+
watch(
|
|
4932
|
+
() => props.masked,
|
|
4933
|
+
(newValue) => {
|
|
4934
|
+
masked.value = newValue ?? "";
|
|
4935
|
+
}
|
|
4936
|
+
);
|
|
4937
|
+
const inputEl = el;
|
|
4938
|
+
const innerEl = ref();
|
|
4939
|
+
__expose({ $inner: innerEl });
|
|
4940
|
+
const localModelValue = useDebouncedInput(
|
|
4941
|
+
modelValue,
|
|
4942
|
+
emit,
|
|
4943
|
+
(debounce == null ? void 0 : debounce.value) ?? 0
|
|
4944
|
+
);
|
|
4830
4945
|
const { focused } = useComponentFocus(inputEl, emit);
|
|
4831
4946
|
const isFocused = computed(
|
|
4832
4947
|
() => focused.value && !props.disabled && !props.readonly
|
|
4833
4948
|
);
|
|
4949
|
+
watch(isFocused, (newValue) => {
|
|
4950
|
+
if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
|
|
4951
|
+
inputEl.value.select();
|
|
4952
|
+
}
|
|
4953
|
+
});
|
|
4834
4954
|
const isVisible = useElementVisibility(inputEl);
|
|
4835
4955
|
watch(isVisible, (newValue) => {
|
|
4836
4956
|
if (newValue && props.autofocus && !props.disabled && !props.readonly) {
|
|
@@ -4848,19 +4968,27 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4848
4968
|
const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER);
|
|
4849
4969
|
const onStepUp = () => {
|
|
4850
4970
|
if (isClickable.value) {
|
|
4971
|
+
if (iMask == null ? void 0 : iMask.value) {
|
|
4972
|
+
typed.value = typed.value + Number((step == null ? void 0 : step.value) ?? 1);
|
|
4973
|
+
return;
|
|
4974
|
+
}
|
|
4851
4975
|
inputEl.value.stepUp();
|
|
4852
4976
|
localModelValue.value = unref(inputEl).value;
|
|
4853
4977
|
}
|
|
4854
4978
|
};
|
|
4855
4979
|
const onStepDown = () => {
|
|
4856
4980
|
if (isClickable.value) {
|
|
4981
|
+
if (iMask == null ? void 0 : iMask.value) {
|
|
4982
|
+
typed.value = typed.value - Number((step == null ? void 0 : step.value) ?? 1);
|
|
4983
|
+
return;
|
|
4984
|
+
}
|
|
4857
4985
|
inputEl.value.stepDown();
|
|
4858
4986
|
localModelValue.value = unref(inputEl).value;
|
|
4859
4987
|
}
|
|
4860
4988
|
};
|
|
4861
4989
|
const isSearch = computed(() => props.type === INPUT_TYPES.SEARCH);
|
|
4862
4990
|
const onClear = () => {
|
|
4863
|
-
localModelValue.value =
|
|
4991
|
+
localModelValue.value = "";
|
|
4864
4992
|
};
|
|
4865
4993
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
4866
4994
|
icon,
|
|
@@ -4882,9 +5010,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4882
5010
|
}
|
|
4883
5011
|
});
|
|
4884
5012
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
4885
|
-
mode:
|
|
4886
|
-
upperLimit: Number(
|
|
4887
|
-
lowerLimit: Number(
|
|
5013
|
+
mode: count.value,
|
|
5014
|
+
upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
|
|
5015
|
+
lowerLimit: Number(minlength == null ? void 0 : minlength.value)
|
|
4888
5016
|
});
|
|
4889
5017
|
const isClickable = computed(() => !props.disabled && !props.readonly);
|
|
4890
5018
|
const hasTabindex = computed(
|
|
@@ -4919,17 +5047,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4919
5047
|
}))
|
|
4920
5048
|
);
|
|
4921
5049
|
const hasAttrs = computed(() => {
|
|
4922
|
-
const
|
|
5050
|
+
const type2 = (() => {
|
|
4923
5051
|
if (isPassword.value && showPassword.value) {
|
|
4924
5052
|
return INPUT_TYPES.TEXT;
|
|
4925
5053
|
}
|
|
4926
5054
|
if (isDateTime.value && !isDirty.value && !focused.value) {
|
|
4927
5055
|
return INPUT_TYPES.TEXT;
|
|
4928
5056
|
}
|
|
5057
|
+
if (iMask == null ? void 0 : iMask.value) {
|
|
5058
|
+
return INPUT_TYPES.TEXT;
|
|
5059
|
+
}
|
|
4929
5060
|
return props.type;
|
|
4930
5061
|
})();
|
|
4931
5062
|
const toReturn = {
|
|
4932
|
-
type,
|
|
5063
|
+
type: type2,
|
|
4933
5064
|
name: props.name,
|
|
4934
5065
|
tabindex: hasTabindex.value,
|
|
4935
5066
|
disabled: props.disabled,
|
|
@@ -4940,20 +5071,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4940
5071
|
"aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
|
|
4941
5072
|
"aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
|
|
4942
5073
|
};
|
|
4943
|
-
if (
|
|
5074
|
+
if (type2 === INPUT_TYPES.DATE || type2 === INPUT_TYPES.MONTH || type2 === INPUT_TYPES.WEEK || type2 === INPUT_TYPES.TIME || type2 === INPUT_TYPES.DATETIME_LOCAL || type2 === INPUT_TYPES.NUMBER) {
|
|
4944
5075
|
toReturn.step = props.step;
|
|
4945
5076
|
toReturn.max = props.max !== void 0 ? String(props.max) : void 0;
|
|
4946
5077
|
toReturn.min = props.min !== void 0 ? String(props.min) : void 0;
|
|
4947
5078
|
}
|
|
4948
|
-
if (
|
|
5079
|
+
if (type2 === INPUT_TYPES.TEXT || type2 === INPUT_TYPES.SEARCH || type2 === INPUT_TYPES.URL || type2 === INPUT_TYPES.TEL || type2 === INPUT_TYPES.EMAIL || type2 === INPUT_TYPES.PASSWORD || type2 === INPUT_TYPES.NUMBER) {
|
|
4949
5080
|
toReturn.placeholder = inputTextPlaceholder.value;
|
|
4950
5081
|
}
|
|
4951
|
-
if (
|
|
5082
|
+
if (type2 === INPUT_TYPES.TEXT || type2 === INPUT_TYPES.SEARCH || type2 === INPUT_TYPES.URL || type2 === INPUT_TYPES.TEL || type2 === INPUT_TYPES.EMAIL || type2 === INPUT_TYPES.PASSWORD) {
|
|
4952
5083
|
toReturn.minlength = props.minlength;
|
|
4953
5084
|
toReturn.maxlength = props.maxlength;
|
|
4954
5085
|
toReturn.pattern = props.pattern;
|
|
4955
5086
|
}
|
|
4956
|
-
if (
|
|
5087
|
+
if (type2 === INPUT_TYPES.EMAIL) {
|
|
4957
5088
|
toReturn.multiple = props.multiple;
|
|
4958
5089
|
}
|
|
4959
5090
|
return toReturn;
|
|
@@ -4985,31 +5116,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4985
5116
|
INPUT_TYPES.SEARCH,
|
|
4986
5117
|
props
|
|
4987
5118
|
);
|
|
4988
|
-
const mask = ref();
|
|
4989
|
-
watch(
|
|
4990
|
-
[
|
|
4991
|
-
() => props.mask,
|
|
4992
|
-
() => props.type,
|
|
4993
|
-
() => props.maskEager,
|
|
4994
|
-
() => props.maskReversed,
|
|
4995
|
-
() => props.maskTokens,
|
|
4996
|
-
() => props.maskTokensReplace
|
|
4997
|
-
],
|
|
4998
|
-
([newMask, newType, eager, reversed, tokens, tokensReplace]) => {
|
|
4999
|
-
if (newMask && newType === INPUT_TYPES.TEXT) {
|
|
5000
|
-
mask.value = new Mask({
|
|
5001
|
-
mask: newMask,
|
|
5002
|
-
eager,
|
|
5003
|
-
reversed,
|
|
5004
|
-
tokens,
|
|
5005
|
-
tokensReplace
|
|
5006
|
-
});
|
|
5007
|
-
return;
|
|
5008
|
-
}
|
|
5009
|
-
mask.value = void 0;
|
|
5010
|
-
},
|
|
5011
|
-
{ immediate: true }
|
|
5012
|
-
);
|
|
5013
5119
|
const onClickInner = () => {
|
|
5014
5120
|
if (isClickable.value) {
|
|
5015
5121
|
focused.value = true;
|
|
@@ -5023,6 +5129,23 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5023
5129
|
width: localModelValue.value !== void 0 ? `${String(localModelValue.value).length + 1}ch` : void 0
|
|
5024
5130
|
};
|
|
5025
5131
|
});
|
|
5132
|
+
const onKeyDown = (event) => {
|
|
5133
|
+
switch (event.code) {
|
|
5134
|
+
case "ArrowUp":
|
|
5135
|
+
if (isNumber.value) {
|
|
5136
|
+
onStepUp();
|
|
5137
|
+
event.preventDefault();
|
|
5138
|
+
}
|
|
5139
|
+
break;
|
|
5140
|
+
case "ArrowDown":
|
|
5141
|
+
if (isNumber.value) {
|
|
5142
|
+
onStepDown();
|
|
5143
|
+
event.preventDefault();
|
|
5144
|
+
}
|
|
5145
|
+
break;
|
|
5146
|
+
}
|
|
5147
|
+
emit("keydown", event);
|
|
5148
|
+
};
|
|
5026
5149
|
return (_ctx, _cache) => {
|
|
5027
5150
|
return openBlock(), createElementBlock("div", {
|
|
5028
5151
|
class: normalizeClass(unref(bemCssClasses))
|
|
@@ -5046,17 +5169,16 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5046
5169
|
key: 0,
|
|
5047
5170
|
class: "vv-input-text__icon"
|
|
5048
5171
|
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
|
|
5049
|
-
|
|
5172
|
+
createElementVNode("input", mergeProps({
|
|
5050
5173
|
id: unref(hasId),
|
|
5051
5174
|
ref_key: "inputEl",
|
|
5052
|
-
ref: inputEl
|
|
5053
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
5175
|
+
ref: inputEl
|
|
5054
5176
|
}, unref(hasAttrs), {
|
|
5055
5177
|
style: unref(hasStyle),
|
|
5056
|
-
onKeyup: _cache[
|
|
5057
|
-
|
|
5058
|
-
[
|
|
5059
|
-
|
|
5178
|
+
onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
|
|
5179
|
+
onKeydown: onKeyDown,
|
|
5180
|
+
onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
|
|
5181
|
+
}), null, 16, _hoisted_5$1),
|
|
5060
5182
|
(_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
|
|
5061
5183
|
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
5062
5184
|
createTextVNode(toDisplayString(_ctx.unit), 1)
|
|
@@ -5651,14 +5773,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5651
5773
|
valid,
|
|
5652
5774
|
invalid,
|
|
5653
5775
|
loading,
|
|
5654
|
-
modifiers
|
|
5776
|
+
modifiers,
|
|
5777
|
+
debounce,
|
|
5778
|
+
minlength,
|
|
5779
|
+
maxlength
|
|
5655
5780
|
} = toRefs(props);
|
|
5656
5781
|
const hasId = useUniqueId(id);
|
|
5657
5782
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
5658
5783
|
const hasPlaceholder = computed(
|
|
5659
5784
|
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
5660
5785
|
);
|
|
5661
|
-
const localModelValue = useDebouncedInput(modelValue, emit,
|
|
5786
|
+
const localModelValue = useDebouncedInput(modelValue, emit, debounce == null ? void 0 : debounce.value);
|
|
5662
5787
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
5663
5788
|
icon,
|
|
5664
5789
|
iconPosition
|
|
@@ -5671,9 +5796,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5671
5796
|
}
|
|
5672
5797
|
});
|
|
5673
5798
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
5674
|
-
mode:
|
|
5675
|
-
upperLimit: Number(
|
|
5676
|
-
lowerLimit: Number(
|
|
5799
|
+
mode: count == null ? void 0 : count.value,
|
|
5800
|
+
upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
|
|
5801
|
+
lowerLimit: Number(minlength == null ? void 0 : minlength.value)
|
|
5677
5802
|
});
|
|
5678
5803
|
const isClickable = computed(() => !props.disabled && !props.readonly);
|
|
5679
5804
|
const hasTabindex = computed(
|