@volverjs/ui-vue 0.0.9-beta.9 → 0.0.10-beta.1
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 +11 -10
- 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 +11 -10
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +13 -12
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +158 -140
- 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 +11 -10
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +13 -12
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +14 -13
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- 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 +359 -245
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/useOptions.d.ts +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/Combobox/ComboboxOptions.stories.d.ts +1 -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 +61 -60
- 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 +51 -42
- 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/VvSelect/VvSelect.vue +4 -4
- package/src/components/VvTextarea/VvTextarea.vue +8 -5
- package/src/composables/useOptions.ts +2 -2
- 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/Combobox/ComboboxOptions.stories.ts +18 -0
- 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
- package/src/utils/ObjectUtilities.ts +3 -2
|
@@ -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
|
|
@@ -497,10 +498,10 @@ const ActionProps = {
|
|
|
497
498
|
}
|
|
498
499
|
};
|
|
499
500
|
function equals(obj1, obj2, field) {
|
|
500
|
-
if (field)
|
|
501
|
+
if (field) {
|
|
501
502
|
return resolveFieldData(obj1, field) === resolveFieldData(obj2, field);
|
|
502
|
-
|
|
503
|
-
|
|
503
|
+
}
|
|
504
|
+
return deepEquals(obj1, obj2);
|
|
504
505
|
}
|
|
505
506
|
function deepEquals(a, b) {
|
|
506
507
|
if (a === b)
|
|
@@ -2387,7 +2388,7 @@ function useOptions(props) {
|
|
|
2387
2388
|
return option;
|
|
2388
2389
|
return typeof valueKey.value === "function" ? valueKey.value(option) : get(option, valueKey.value);
|
|
2389
2390
|
};
|
|
2390
|
-
const
|
|
2391
|
+
const isOptionDisabled = (option) => {
|
|
2391
2392
|
if (typeof option !== "object" && option !== null)
|
|
2392
2393
|
return false;
|
|
2393
2394
|
return typeof disabledKey.value === "function" ? disabledKey.value(option) : get(option, disabledKey.value);
|
|
@@ -2401,7 +2402,7 @@ function useOptions(props) {
|
|
|
2401
2402
|
options,
|
|
2402
2403
|
getOptionLabel,
|
|
2403
2404
|
getOptionValue,
|
|
2404
|
-
|
|
2405
|
+
isOptionDisabled,
|
|
2405
2406
|
getOptionGrouped
|
|
2406
2407
|
};
|
|
2407
2408
|
}
|
|
@@ -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,
|
|
@@ -3445,7 +3455,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
3445
3455
|
const {
|
|
3446
3456
|
getOptionLabel,
|
|
3447
3457
|
getOptionValue,
|
|
3448
|
-
|
|
3458
|
+
isOptionDisabled,
|
|
3449
3459
|
getOptionGrouped
|
|
3450
3460
|
} = useOptions(props);
|
|
3451
3461
|
const localModelValue = computed({
|
|
@@ -3497,17 +3507,17 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
3497
3507
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
3498
3508
|
!isGroup(option) ? (openBlock(), createElementBlock("option", {
|
|
3499
3509
|
key: index,
|
|
3500
|
-
disabled: unref(
|
|
3510
|
+
disabled: unref(isOptionDisabled)(option),
|
|
3501
3511
|
value: unref(getOptionValue)(option)
|
|
3502
3512
|
}, toDisplayString(unref(getOptionLabel)(option)), 9, _hoisted_7$3)) : (openBlock(), createElementBlock("optgroup", {
|
|
3503
3513
|
key: `group-${index}`,
|
|
3504
|
-
disabled: unref(
|
|
3514
|
+
disabled: unref(isOptionDisabled)(option),
|
|
3505
3515
|
label: unref(getOptionLabel)(option)
|
|
3506
3516
|
}, [
|
|
3507
3517
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(option), (item, i) => {
|
|
3508
3518
|
return openBlock(), createElementBlock("option", {
|
|
3509
3519
|
key: `group-${index}-item-${i}`,
|
|
3510
|
-
disabled: unref(
|
|
3520
|
+
disabled: unref(isOptionDisabled)(item),
|
|
3511
3521
|
value: unref(getOptionValue)(item)
|
|
3512
3522
|
}, toDisplayString(unref(getOptionLabel)(item)), 9, _hoisted_9$1);
|
|
3513
3523
|
}), 128))
|
|
@@ -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),
|
|
@@ -3722,41 +3733,44 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3722
3733
|
const {
|
|
3723
3734
|
getOptionLabel,
|
|
3724
3735
|
getOptionValue,
|
|
3725
|
-
|
|
3726
|
-
|
|
3736
|
+
getOptionGrouped,
|
|
3737
|
+
isOptionDisabled
|
|
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
|
});
|
|
3733
3755
|
});
|
|
3734
|
-
function
|
|
3756
|
+
function isOptionSelected(option) {
|
|
3735
3757
|
if (Array.isArray(props.modelValue)) {
|
|
3736
3758
|
return contains(option, props.modelValue) || contains(getOptionValue(option), props.modelValue);
|
|
3737
3759
|
}
|
|
3738
3760
|
return equals(option, props.modelValue) || equals(getOptionValue(option), props.modelValue);
|
|
3739
3761
|
}
|
|
3740
3762
|
const selectedOptions = computed(() => {
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
}
|
|
3751
|
-
return [...acc, value];
|
|
3752
|
-
}, []);
|
|
3763
|
+
const options = props.options.reduce(
|
|
3764
|
+
(acc, value) => {
|
|
3765
|
+
if (isGroup(value)) {
|
|
3766
|
+
return [...acc, ...getOptionGrouped(value)];
|
|
3767
|
+
}
|
|
3768
|
+
return [...acc, value];
|
|
3769
|
+
},
|
|
3770
|
+
[]
|
|
3771
|
+
);
|
|
3753
3772
|
return options.filter((option) => {
|
|
3754
|
-
|
|
3755
|
-
return getOptionGrouped(option).some(
|
|
3756
|
-
(item) => selectedValues.includes(getOptionValue(item))
|
|
3757
|
-
);
|
|
3758
|
-
}
|
|
3759
|
-
return selectedValues.includes(getOptionValue(option));
|
|
3773
|
+
return isOptionSelected(option);
|
|
3760
3774
|
});
|
|
3761
3775
|
});
|
|
3762
3776
|
const hasValue = computed(() => {
|
|
@@ -3803,7 +3817,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3803
3817
|
invalid: invalid.value,
|
|
3804
3818
|
invalidLabel: propsDefaults.value.invalidLabel,
|
|
3805
3819
|
hintLabel: propsDefaults.value.hintLabel,
|
|
3806
|
-
loading:
|
|
3820
|
+
loading: isLoading.value,
|
|
3807
3821
|
loadingLabel: propsDefaults.value.loadingLabel,
|
|
3808
3822
|
disabled: disabled.value,
|
|
3809
3823
|
readonly: readonly.value,
|
|
@@ -3831,7 +3845,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3831
3845
|
flip: propsDefaults.value.flip,
|
|
3832
3846
|
autoPlacement: propsDefaults.value.autoPlacement,
|
|
3833
3847
|
arrow: propsDefaults.value.arrow,
|
|
3834
|
-
autofocusFirst:
|
|
3848
|
+
autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
|
|
3835
3849
|
triggerWidth: propsDefaults.value.triggerWidth,
|
|
3836
3850
|
modifiers: propsDefaults.value.dropdownModifiers
|
|
3837
3851
|
}));
|
|
@@ -3863,7 +3877,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3863
3877
|
_ctx.label ? (openBlock(), createElementBlock("label", {
|
|
3864
3878
|
key: 0,
|
|
3865
3879
|
id: unref(hasLabelId),
|
|
3866
|
-
for: unref(searchable
|
|
3880
|
+
for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
|
|
3867
3881
|
}, toDisplayString(_ctx.label), 9, _hoisted_2$5)) : createCommentVNode("", true),
|
|
3868
3882
|
createElementVNode("div", {
|
|
3869
3883
|
ref_key: "wrapperEl",
|
|
@@ -3915,6 +3929,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3915
3929
|
_ctx.unselectable && !unref(readonly) && !unref(disabled) ? (openBlock(), createElementBlock("button", {
|
|
3916
3930
|
key: 0,
|
|
3917
3931
|
"aria-label": unref(propsDefaults).deselectActionLabel,
|
|
3932
|
+
type: "button",
|
|
3918
3933
|
onClick: withModifiers(($event) => onInput(option), ["stop"])
|
|
3919
3934
|
}, [
|
|
3920
3935
|
createVNode(_sfc_main$n, { name: "close" })
|
|
@@ -3937,87 +3952,90 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3937
3952
|
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
3938
3953
|
])) : createCommentVNode("", true)
|
|
3939
3954
|
]),
|
|
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
|
-
|
|
3955
|
+
items: withCtx(() => {
|
|
3956
|
+
var _a;
|
|
3957
|
+
return [
|
|
3958
|
+
!unref(disabled) && ((_a = unref(filteredOptions)) == null ? void 0 : _a.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filteredOptions), (option, index) => {
|
|
3959
|
+
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
3960
|
+
isGroup(option) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3961
|
+
createVNode(_sfc_main$b, {
|
|
3962
|
+
label: unref(getOptionLabel)(option)
|
|
3963
|
+
}, null, 8, ["label"]),
|
|
3964
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(getOptionGrouped)(
|
|
3965
|
+
option
|
|
3966
|
+
), (item, i) => {
|
|
3967
|
+
return openBlock(), createBlock(_sfc_main$c, mergeProps({
|
|
3968
|
+
selected: isOptionSelected(item),
|
|
3969
|
+
disabled: unref(isOptionDisabled)(item),
|
|
3970
|
+
unselectable: _ctx.unselectable,
|
|
3971
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
3972
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
3973
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
3974
|
+
}, {
|
|
3975
|
+
key: i,
|
|
3976
|
+
class: "vv-dropdown-option",
|
|
3977
|
+
onClickPassive: ($event) => onInput(item)
|
|
3978
|
+
}), {
|
|
3979
|
+
default: withCtx(() => [
|
|
3980
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
3981
|
+
option,
|
|
3982
|
+
selectedOptions: unref(selectedOptions),
|
|
3983
|
+
selected: isOptionSelected(item),
|
|
3984
|
+
disabled: unref(isOptionDisabled)(item)
|
|
3985
|
+
})), () => [
|
|
3986
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(item)), 1)
|
|
3987
|
+
])
|
|
3988
|
+
]),
|
|
3989
|
+
_: 2
|
|
3990
|
+
}, 1040, ["onClickPassive"]);
|
|
3991
|
+
}), 128))
|
|
3992
|
+
], 64)) : (openBlock(), createBlock(_sfc_main$c, mergeProps({ key: 1 }, {
|
|
3993
|
+
selected: isOptionSelected(option),
|
|
3994
|
+
disabled: unref(isOptionDisabled)(option),
|
|
3995
|
+
unselectable: _ctx.unselectable,
|
|
3996
|
+
deselectHintLabel: unref(propsDefaults).deselectHintLabel,
|
|
3997
|
+
selectHintLabel: unref(propsDefaults).selectHintLabel,
|
|
3998
|
+
selectedHintLabel: unref(propsDefaults).selectedHintLabel
|
|
3999
|
+
}, {
|
|
4000
|
+
class: "vv-dropdown-option",
|
|
4001
|
+
onClickPassive: ($event) => onInput(option)
|
|
4002
|
+
}), {
|
|
4003
|
+
default: withCtx(() => [
|
|
4004
|
+
renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps({
|
|
4005
|
+
option,
|
|
4006
|
+
selectedOptions: unref(selectedOptions),
|
|
4007
|
+
selected: isOptionSelected(option),
|
|
4008
|
+
disabled: unref(isOptionDisabled)(option)
|
|
4009
|
+
})), () => [
|
|
4010
|
+
createTextVNode(toDisplayString(unref(getOptionLabel)(option)), 1)
|
|
4011
|
+
])
|
|
4012
|
+
]),
|
|
4013
|
+
_: 2
|
|
4014
|
+
}, 1040, ["onClickPassive"]))
|
|
4015
|
+
], 64);
|
|
4016
|
+
}), 128)) : !_ctx.options.length ? (openBlock(), createBlock(_sfc_main$c, {
|
|
4017
|
+
key: 1,
|
|
4018
|
+
modifiers: "inert"
|
|
4019
|
+
}, {
|
|
4020
|
+
default: withCtx(() => [
|
|
4021
|
+
renderSlot(_ctx.$slots, "no-options", {}, () => [
|
|
4022
|
+
createTextVNode(toDisplayString(unref(propsDefaults).noOptionsLabel), 1)
|
|
4023
|
+
])
|
|
4024
|
+
]),
|
|
4025
|
+
_: 3
|
|
4026
|
+
})) : !unref(disabled) ? (openBlock(), createBlock(_sfc_main$c, {
|
|
4027
|
+
key: 2,
|
|
4028
|
+
modifiers: "inert"
|
|
4029
|
+
}, {
|
|
4030
|
+
default: withCtx(() => [
|
|
4031
|
+
renderSlot(_ctx.$slots, "no-results", {}, () => [
|
|
4032
|
+
createTextVNode(toDisplayString(unref(propsDefaults).noResultsLabel), 1)
|
|
4033
|
+
])
|
|
4034
|
+
]),
|
|
4035
|
+
_: 3
|
|
4036
|
+
})) : createCommentVNode("", true)
|
|
4037
|
+
];
|
|
4038
|
+
}),
|
|
4021
4039
|
after: withCtx(() => [
|
|
4022
4040
|
renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
|
|
4023
4041
|
var _a;
|
|
@@ -4033,11 +4051,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4033
4051
|
]),
|
|
4034
4052
|
_: 2
|
|
4035
4053
|
}, [
|
|
4036
|
-
unref(searchable
|
|
4054
|
+
unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
|
|
4037
4055
|
name: "before",
|
|
4038
4056
|
fn: withCtx(() => [
|
|
4039
4057
|
renderSlot(_ctx.$slots, "dropdown::before"),
|
|
4040
|
-
unref(searchable) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
4058
|
+
unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
4041
4059
|
key: 0,
|
|
4042
4060
|
id: unref(hasSearchId),
|
|
4043
4061
|
ref_key: "inputSearchEl",
|
|
@@ -4184,14 +4202,18 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
4184
4202
|
const transitioName = computed(() => `vv-dialog--${props.transition}`);
|
|
4185
4203
|
const dialogTransitionHandlers = {
|
|
4186
4204
|
"before-enter": () => {
|
|
4187
|
-
var _a;
|
|
4188
|
-
(_a = dialogEl.value) == null ? void 0 : _a.
|
|
4205
|
+
var _a, _b;
|
|
4206
|
+
if (!((_a = dialogEl.value) == null ? void 0 : _a.open)) {
|
|
4207
|
+
(_b = dialogEl.value) == null ? void 0 : _b.showModal();
|
|
4208
|
+
}
|
|
4189
4209
|
emit("open");
|
|
4190
4210
|
emit("before-enter");
|
|
4191
4211
|
},
|
|
4192
4212
|
"after-leave": () => {
|
|
4193
|
-
var _a;
|
|
4194
|
-
(_a = dialogEl.value) == null ? void 0 : _a.
|
|
4213
|
+
var _a, _b;
|
|
4214
|
+
if ((_a = dialogEl.value) == null ? void 0 : _a.open) {
|
|
4215
|
+
(_b = dialogEl.value) == null ? void 0 : _b.close();
|
|
4216
|
+
}
|
|
4195
4217
|
emit("close");
|
|
4196
4218
|
emit("after-leave");
|
|
4197
4219
|
},
|
|
@@ -4297,7 +4319,23 @@ const TYPES_ICON = {
|
|
|
4297
4319
|
COLOR: "color",
|
|
4298
4320
|
SEARCH: "close"
|
|
4299
4321
|
};
|
|
4300
|
-
const VvInputTextEvents = [
|
|
4322
|
+
const VvInputTextEvents = [
|
|
4323
|
+
"update:modelValue",
|
|
4324
|
+
"update:masked",
|
|
4325
|
+
"accept",
|
|
4326
|
+
"accept:typed",
|
|
4327
|
+
"accept:masked",
|
|
4328
|
+
"accept:unmasked",
|
|
4329
|
+
"complete",
|
|
4330
|
+
"complete:typed",
|
|
4331
|
+
"complete:masked",
|
|
4332
|
+
"complete:unmasked",
|
|
4333
|
+
"focus",
|
|
4334
|
+
"blur",
|
|
4335
|
+
"keyup",
|
|
4336
|
+
"keydown",
|
|
4337
|
+
"keypress"
|
|
4338
|
+
];
|
|
4301
4339
|
const VvInputTextProps = {
|
|
4302
4340
|
...InputTextareaProps,
|
|
4303
4341
|
/**
|
|
@@ -4404,44 +4442,19 @@ const VvInputTextProps = {
|
|
|
4404
4442
|
default: "Clear"
|
|
4405
4443
|
},
|
|
4406
4444
|
/**
|
|
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
|
|
4417
|
-
*/
|
|
4418
|
-
maskEager: {
|
|
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
|
|
4445
|
+
* iMask options
|
|
4446
|
+
* @see https://imask.js.org/guide.html
|
|
4425
4447
|
*/
|
|
4426
|
-
|
|
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: {
|
|
4448
|
+
iMask: {
|
|
4435
4449
|
type: Object,
|
|
4436
4450
|
default: void 0
|
|
4437
4451
|
},
|
|
4438
4452
|
/**
|
|
4439
|
-
*
|
|
4440
|
-
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
4453
|
+
* Masked value
|
|
4441
4454
|
*/
|
|
4442
|
-
|
|
4443
|
-
type:
|
|
4444
|
-
default:
|
|
4455
|
+
masked: {
|
|
4456
|
+
type: String,
|
|
4457
|
+
default: void 0
|
|
4445
4458
|
},
|
|
4446
4459
|
/**
|
|
4447
4460
|
* Adjust input width to content
|
|
@@ -4462,6 +4475,13 @@ const VvInputTextProps = {
|
|
|
4462
4475
|
*/
|
|
4463
4476
|
unit: {
|
|
4464
4477
|
type: String
|
|
4478
|
+
},
|
|
4479
|
+
/**
|
|
4480
|
+
* Select input text on focus
|
|
4481
|
+
*/
|
|
4482
|
+
selectOnFocus: {
|
|
4483
|
+
type: Boolean,
|
|
4484
|
+
default: false
|
|
4465
4485
|
}
|
|
4466
4486
|
};
|
|
4467
4487
|
const VvInputPasswordAction = defineComponent({
|
|
@@ -4786,9 +4806,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4786
4806
|
VvInputTextProps,
|
|
4787
4807
|
props
|
|
4788
4808
|
);
|
|
4789
|
-
const inputEl = ref();
|
|
4790
|
-
const innerEl = ref();
|
|
4791
|
-
__expose({ $inner: innerEl });
|
|
4792
4809
|
const {
|
|
4793
4810
|
id,
|
|
4794
4811
|
icon,
|
|
@@ -4798,39 +4815,131 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4798
4815
|
count,
|
|
4799
4816
|
valid,
|
|
4800
4817
|
invalid,
|
|
4801
|
-
loading
|
|
4818
|
+
loading,
|
|
4819
|
+
debounce,
|
|
4820
|
+
maxlength,
|
|
4821
|
+
minlength,
|
|
4822
|
+
type,
|
|
4823
|
+
iMask,
|
|
4824
|
+
step
|
|
4802
4825
|
} = toRefs(props);
|
|
4803
4826
|
const hasId = useUniqueId(id);
|
|
4804
4827
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
4805
4828
|
const inputTextPlaceholder = computed(
|
|
4806
4829
|
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
4807
4830
|
);
|
|
4808
|
-
const
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4831
|
+
const maskReady = ref(false);
|
|
4832
|
+
const { el, mask, typed, masked, unmasked } = useIMask(
|
|
4833
|
+
computed(
|
|
4834
|
+
() => (iMask == null ? void 0 : iMask.value) ?? {
|
|
4835
|
+
mask: /./
|
|
4836
|
+
}
|
|
4837
|
+
),
|
|
4812
4838
|
{
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4839
|
+
emit,
|
|
4840
|
+
onAccept: () => {
|
|
4841
|
+
if (!maskReady.value) {
|
|
4842
|
+
return;
|
|
4816
4843
|
}
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4844
|
+
emit("update:masked", masked.value);
|
|
4845
|
+
if (type.value === INPUT_TYPES.NUMBER) {
|
|
4846
|
+
if (masked.value === "") {
|
|
4847
|
+
if (localModelValue.value === null || localModelValue.value === void 0) {
|
|
4848
|
+
return;
|
|
4849
|
+
}
|
|
4850
|
+
localModelValue.value = void 0;
|
|
4851
|
+
return;
|
|
4852
|
+
}
|
|
4853
|
+
if (typeof typed.value !== "number") {
|
|
4854
|
+
localModelValue.value = Number(typed.value);
|
|
4855
|
+
return;
|
|
4856
|
+
}
|
|
4857
|
+
localModelValue.value = typed.value;
|
|
4858
|
+
return;
|
|
4859
|
+
}
|
|
4860
|
+
if (type.value === INPUT_TYPES.DATE) {
|
|
4861
|
+
if (el.value instanceof HTMLInputElement && el.value.type === "date") {
|
|
4862
|
+
localModelValue.value = el.value.value;
|
|
4863
|
+
return;
|
|
4864
|
+
}
|
|
4865
|
+
let date = typed.value;
|
|
4866
|
+
if (date === null || date === "") {
|
|
4867
|
+
if (!localModelValue.value) {
|
|
4868
|
+
return;
|
|
4869
|
+
}
|
|
4870
|
+
localModelValue.value = "";
|
|
4871
|
+
return;
|
|
4872
|
+
}
|
|
4873
|
+
if (!(date instanceof Date)) {
|
|
4874
|
+
date = new Date(date);
|
|
4875
|
+
}
|
|
4876
|
+
localModelValue.value = `${date.getFullYear()}-${("0" + (date.getMonth() + 1)).slice(-2)}-${("0" + date.getDate()).slice(-2)}`;
|
|
4877
|
+
return;
|
|
4822
4878
|
}
|
|
4823
|
-
if (
|
|
4824
|
-
|
|
4879
|
+
if (type.value === INPUT_TYPES.DATETIME_LOCAL) {
|
|
4880
|
+
if (el.value instanceof HTMLInputElement && el.value.type === "datetime-local") {
|
|
4881
|
+
localModelValue.value = el.value.value;
|
|
4882
|
+
return;
|
|
4883
|
+
}
|
|
4884
|
+
let date = typed.value;
|
|
4885
|
+
if (date === null || date === "") {
|
|
4886
|
+
if (!localModelValue.value) {
|
|
4887
|
+
return;
|
|
4888
|
+
}
|
|
4889
|
+
localModelValue.value = "";
|
|
4890
|
+
return;
|
|
4891
|
+
}
|
|
4892
|
+
if (!(typed.value instanceof Date)) {
|
|
4893
|
+
date = new Date(date);
|
|
4894
|
+
}
|
|
4895
|
+
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)}`;
|
|
4896
|
+
return;
|
|
4897
|
+
}
|
|
4898
|
+
if (!localModelValue.value && !unmasked.value) {
|
|
4899
|
+
return;
|
|
4825
4900
|
}
|
|
4826
|
-
|
|
4901
|
+
localModelValue.value = unmasked.value;
|
|
4902
|
+
}
|
|
4903
|
+
}
|
|
4904
|
+
);
|
|
4905
|
+
onMounted(() => {
|
|
4906
|
+
if (mask.value) {
|
|
4907
|
+
maskReady.value = true;
|
|
4908
|
+
typed.value = localModelValue.value ?? "";
|
|
4909
|
+
}
|
|
4910
|
+
});
|
|
4911
|
+
watch(
|
|
4912
|
+
() => props.modelValue,
|
|
4913
|
+
(newValue) => {
|
|
4914
|
+
var _a;
|
|
4915
|
+
if (mask.value) {
|
|
4916
|
+
typed.value = newValue && ((_a = iMask == null ? void 0 : iMask.value) == null ? void 0 : _a.mask) === Date ? new Date(newValue) : newValue ?? "";
|
|
4827
4917
|
}
|
|
4828
4918
|
}
|
|
4829
4919
|
);
|
|
4920
|
+
watch(
|
|
4921
|
+
() => props.masked,
|
|
4922
|
+
(newValue) => {
|
|
4923
|
+
masked.value = newValue ?? "";
|
|
4924
|
+
}
|
|
4925
|
+
);
|
|
4926
|
+
const inputEl = el;
|
|
4927
|
+
const innerEl = ref();
|
|
4928
|
+
__expose({ $inner: innerEl });
|
|
4929
|
+
const localModelValue = useDebouncedInput(
|
|
4930
|
+
modelValue,
|
|
4931
|
+
emit,
|
|
4932
|
+
(debounce == null ? void 0 : debounce.value) ?? 0
|
|
4933
|
+
);
|
|
4830
4934
|
const { focused } = useComponentFocus(inputEl, emit);
|
|
4831
4935
|
const isFocused = computed(
|
|
4832
4936
|
() => focused.value && !props.disabled && !props.readonly
|
|
4833
4937
|
);
|
|
4938
|
+
watch(isFocused, (newValue) => {
|
|
4939
|
+
if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
|
|
4940
|
+
inputEl.value.select();
|
|
4941
|
+
}
|
|
4942
|
+
});
|
|
4834
4943
|
const isVisible = useElementVisibility(inputEl);
|
|
4835
4944
|
watch(isVisible, (newValue) => {
|
|
4836
4945
|
if (newValue && props.autofocus && !props.disabled && !props.readonly) {
|
|
@@ -4848,19 +4957,27 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4848
4957
|
const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER);
|
|
4849
4958
|
const onStepUp = () => {
|
|
4850
4959
|
if (isClickable.value) {
|
|
4960
|
+
if (iMask == null ? void 0 : iMask.value) {
|
|
4961
|
+
typed.value = typed.value + Number((step == null ? void 0 : step.value) ?? 1);
|
|
4962
|
+
return;
|
|
4963
|
+
}
|
|
4851
4964
|
inputEl.value.stepUp();
|
|
4852
4965
|
localModelValue.value = unref(inputEl).value;
|
|
4853
4966
|
}
|
|
4854
4967
|
};
|
|
4855
4968
|
const onStepDown = () => {
|
|
4856
4969
|
if (isClickable.value) {
|
|
4970
|
+
if (iMask == null ? void 0 : iMask.value) {
|
|
4971
|
+
typed.value = typed.value - Number((step == null ? void 0 : step.value) ?? 1);
|
|
4972
|
+
return;
|
|
4973
|
+
}
|
|
4857
4974
|
inputEl.value.stepDown();
|
|
4858
4975
|
localModelValue.value = unref(inputEl).value;
|
|
4859
4976
|
}
|
|
4860
4977
|
};
|
|
4861
4978
|
const isSearch = computed(() => props.type === INPUT_TYPES.SEARCH);
|
|
4862
4979
|
const onClear = () => {
|
|
4863
|
-
localModelValue.value =
|
|
4980
|
+
localModelValue.value = "";
|
|
4864
4981
|
};
|
|
4865
4982
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
4866
4983
|
icon,
|
|
@@ -4882,9 +4999,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4882
4999
|
}
|
|
4883
5000
|
});
|
|
4884
5001
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
4885
|
-
mode:
|
|
4886
|
-
upperLimit: Number(
|
|
4887
|
-
lowerLimit: Number(
|
|
5002
|
+
mode: count.value,
|
|
5003
|
+
upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
|
|
5004
|
+
lowerLimit: Number(minlength == null ? void 0 : minlength.value)
|
|
4888
5005
|
});
|
|
4889
5006
|
const isClickable = computed(() => !props.disabled && !props.readonly);
|
|
4890
5007
|
const hasTabindex = computed(
|
|
@@ -4919,17 +5036,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4919
5036
|
}))
|
|
4920
5037
|
);
|
|
4921
5038
|
const hasAttrs = computed(() => {
|
|
4922
|
-
const
|
|
5039
|
+
const type2 = (() => {
|
|
4923
5040
|
if (isPassword.value && showPassword.value) {
|
|
4924
5041
|
return INPUT_TYPES.TEXT;
|
|
4925
5042
|
}
|
|
4926
5043
|
if (isDateTime.value && !isDirty.value && !focused.value) {
|
|
4927
5044
|
return INPUT_TYPES.TEXT;
|
|
4928
5045
|
}
|
|
5046
|
+
if (iMask == null ? void 0 : iMask.value) {
|
|
5047
|
+
return INPUT_TYPES.TEXT;
|
|
5048
|
+
}
|
|
4929
5049
|
return props.type;
|
|
4930
5050
|
})();
|
|
4931
5051
|
const toReturn = {
|
|
4932
|
-
type,
|
|
5052
|
+
type: type2,
|
|
4933
5053
|
name: props.name,
|
|
4934
5054
|
tabindex: hasTabindex.value,
|
|
4935
5055
|
disabled: props.disabled,
|
|
@@ -4940,20 +5060,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4940
5060
|
"aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
|
|
4941
5061
|
"aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
|
|
4942
5062
|
};
|
|
4943
|
-
if (
|
|
5063
|
+
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
5064
|
toReturn.step = props.step;
|
|
4945
5065
|
toReturn.max = props.max !== void 0 ? String(props.max) : void 0;
|
|
4946
5066
|
toReturn.min = props.min !== void 0 ? String(props.min) : void 0;
|
|
4947
5067
|
}
|
|
4948
|
-
if (
|
|
5068
|
+
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
5069
|
toReturn.placeholder = inputTextPlaceholder.value;
|
|
4950
5070
|
}
|
|
4951
|
-
if (
|
|
5071
|
+
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
5072
|
toReturn.minlength = props.minlength;
|
|
4953
5073
|
toReturn.maxlength = props.maxlength;
|
|
4954
5074
|
toReturn.pattern = props.pattern;
|
|
4955
5075
|
}
|
|
4956
|
-
if (
|
|
5076
|
+
if (type2 === INPUT_TYPES.EMAIL) {
|
|
4957
5077
|
toReturn.multiple = props.multiple;
|
|
4958
5078
|
}
|
|
4959
5079
|
return toReturn;
|
|
@@ -4985,31 +5105,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4985
5105
|
INPUT_TYPES.SEARCH,
|
|
4986
5106
|
props
|
|
4987
5107
|
);
|
|
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
5108
|
const onClickInner = () => {
|
|
5014
5109
|
if (isClickable.value) {
|
|
5015
5110
|
focused.value = true;
|
|
@@ -5023,6 +5118,23 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5023
5118
|
width: localModelValue.value !== void 0 ? `${String(localModelValue.value).length + 1}ch` : void 0
|
|
5024
5119
|
};
|
|
5025
5120
|
});
|
|
5121
|
+
const onKeyDown = (event) => {
|
|
5122
|
+
switch (event.code) {
|
|
5123
|
+
case "ArrowUp":
|
|
5124
|
+
if (isNumber.value) {
|
|
5125
|
+
onStepUp();
|
|
5126
|
+
event.preventDefault();
|
|
5127
|
+
}
|
|
5128
|
+
break;
|
|
5129
|
+
case "ArrowDown":
|
|
5130
|
+
if (isNumber.value) {
|
|
5131
|
+
onStepDown();
|
|
5132
|
+
event.preventDefault();
|
|
5133
|
+
}
|
|
5134
|
+
break;
|
|
5135
|
+
}
|
|
5136
|
+
emit("keydown", event);
|
|
5137
|
+
};
|
|
5026
5138
|
return (_ctx, _cache) => {
|
|
5027
5139
|
return openBlock(), createElementBlock("div", {
|
|
5028
5140
|
class: normalizeClass(unref(bemCssClasses))
|
|
@@ -5046,17 +5158,16 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5046
5158
|
key: 0,
|
|
5047
5159
|
class: "vv-input-text__icon"
|
|
5048
5160
|
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
|
|
5049
|
-
|
|
5161
|
+
createElementVNode("input", mergeProps({
|
|
5050
5162
|
id: unref(hasId),
|
|
5051
5163
|
ref_key: "inputEl",
|
|
5052
|
-
ref: inputEl
|
|
5053
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
5164
|
+
ref: inputEl
|
|
5054
5165
|
}, unref(hasAttrs), {
|
|
5055
5166
|
style: unref(hasStyle),
|
|
5056
|
-
onKeyup: _cache[
|
|
5057
|
-
|
|
5058
|
-
[
|
|
5059
|
-
|
|
5167
|
+
onKeyup: _cache[0] || (_cache[0] = ($event) => emit("keyup", $event)),
|
|
5168
|
+
onKeydown: onKeyDown,
|
|
5169
|
+
onKeypress: _cache[1] || (_cache[1] = ($event) => emit("keypress", $event))
|
|
5170
|
+
}), null, 16, _hoisted_5$1),
|
|
5060
5171
|
(_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
|
|
5061
5172
|
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
5062
5173
|
createTextVNode(toDisplayString(_ctx.unit), 1)
|
|
@@ -5651,14 +5762,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5651
5762
|
valid,
|
|
5652
5763
|
invalid,
|
|
5653
5764
|
loading,
|
|
5654
|
-
modifiers
|
|
5765
|
+
modifiers,
|
|
5766
|
+
debounce,
|
|
5767
|
+
minlength,
|
|
5768
|
+
maxlength
|
|
5655
5769
|
} = toRefs(props);
|
|
5656
5770
|
const hasId = useUniqueId(id);
|
|
5657
5771
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
5658
5772
|
const hasPlaceholder = computed(
|
|
5659
5773
|
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
5660
5774
|
);
|
|
5661
|
-
const localModelValue = useDebouncedInput(modelValue, emit,
|
|
5775
|
+
const localModelValue = useDebouncedInput(modelValue, emit, debounce == null ? void 0 : debounce.value);
|
|
5662
5776
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
5663
5777
|
icon,
|
|
5664
5778
|
iconPosition
|
|
@@ -5671,9 +5785,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5671
5785
|
}
|
|
5672
5786
|
});
|
|
5673
5787
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
5674
|
-
mode:
|
|
5675
|
-
upperLimit: Number(
|
|
5676
|
-
lowerLimit: Number(
|
|
5788
|
+
mode: count == null ? void 0 : count.value,
|
|
5789
|
+
upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
|
|
5790
|
+
lowerLimit: Number(minlength == null ? void 0 : minlength.value)
|
|
5677
5791
|
});
|
|
5678
5792
|
const isClickable = computed(() => !props.disabled && !props.readonly);
|
|
5679
5793
|
const hasTabindex = computed(
|