@volverjs/ui-vue 0.0.9-beta.8 → 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 +7 -7
- 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 +28 -20
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +28 -20
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +165 -129
- 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 +37 -31
- 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 +301 -93
- 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 +212 -115
- 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 +28 -20
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +28 -20
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +28 -20
- 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 +36 -25
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +8 -7
- package/dist/components/index.es.js +390 -257
- 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/resolvers/unplugin.es.js +3 -0
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +1 -1
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +11 -11
- 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 +63 -62
- 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/VvAlertGroup/VvAlertGroup.vue +2 -0
- package/src/components/VvCombobox/VvCombobox.vue +40 -19
- package/src/components/VvCombobox/index.ts +13 -0
- package/src/components/VvDialog/VvDialog.vue +16 -13
- 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/components/common/HintSlot.ts +20 -12
- package/src/constants.ts +5 -0
- package/src/props/index.ts +7 -11
- package/src/resolvers/unplugin.ts +3 -0
- 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
|
|
@@ -1442,9 +1443,9 @@ const _hoisted_1$h = {
|
|
|
1442
1443
|
};
|
|
1443
1444
|
const _hoisted_2$c = ["id"];
|
|
1444
1445
|
const _hoisted_3$6 = ["aria-label"];
|
|
1445
|
-
const _hoisted_4$
|
|
1446
|
+
const _hoisted_4$5 = /* @__PURE__ */ createElementVNode("div", { class: "vv-alert__close-mask" }, null, -1);
|
|
1446
1447
|
const _hoisted_5$4 = [
|
|
1447
|
-
_hoisted_4$
|
|
1448
|
+
_hoisted_4$5
|
|
1448
1449
|
];
|
|
1449
1450
|
const _hoisted_6$4 = {
|
|
1450
1451
|
key: 1,
|
|
@@ -2015,19 +2016,26 @@ function joinLines(items) {
|
|
|
2015
2016
|
return items;
|
|
2016
2017
|
}
|
|
2017
2018
|
function HintSlotFactory(propsOrRef, slots) {
|
|
2018
|
-
const props =
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2019
|
+
const props = computed(() => {
|
|
2020
|
+
if (isRef(propsOrRef)) {
|
|
2021
|
+
return propsOrRef.value;
|
|
2022
|
+
}
|
|
2023
|
+
return propsOrRef;
|
|
2024
|
+
});
|
|
2025
|
+
const invalidLabel = computed(() => joinLines(props.value.invalidLabel));
|
|
2026
|
+
const validLabel = computed(() => joinLines(props.value.validLabel));
|
|
2027
|
+
const loadingLabel = computed(() => props.value.loadingLabel);
|
|
2028
|
+
const hintLabel = computed(() => props.value.hintLabel);
|
|
2023
2029
|
const hasLoadingLabelOrSlot = computed(
|
|
2024
|
-
() => Boolean(props.loading && (slots.loading || loadingLabel.value))
|
|
2030
|
+
() => Boolean(props.value.loading && (slots.loading || loadingLabel.value))
|
|
2025
2031
|
);
|
|
2026
2032
|
const hasInvalidLabelOrSlot = computed(
|
|
2027
|
-
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
2033
|
+
() => !hasLoadingLabelOrSlot.value && Boolean(
|
|
2034
|
+
props.value.invalid && (slots.invalid || invalidLabel.value)
|
|
2035
|
+
)
|
|
2028
2036
|
);
|
|
2029
2037
|
const hasValidLabelOrSlot = computed(
|
|
2030
|
-
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.valid && (slots.valid || validLabel.value))
|
|
2038
|
+
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && Boolean(props.value.valid && (slots.valid || validLabel.value))
|
|
2031
2039
|
);
|
|
2032
2040
|
const hasHintLabelOrSlot = computed(
|
|
2033
2041
|
() => !hasLoadingLabelOrSlot.value && !hasInvalidLabelOrSlot.value && !hasValidLabelOrSlot.value && Boolean(slots.hint || hintLabel.value)
|
|
@@ -2036,10 +2044,10 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
2036
2044
|
() => hasInvalidLabelOrSlot.value || hasValidLabelOrSlot.value || hasLoadingLabelOrSlot.value || hasHintLabelOrSlot.value
|
|
2037
2045
|
);
|
|
2038
2046
|
const hintSlotScope = computed(() => ({
|
|
2039
|
-
modelValue: props.modelValue,
|
|
2040
|
-
valid: props.valid,
|
|
2041
|
-
invalid: props.invalid,
|
|
2042
|
-
loading: props.loading
|
|
2047
|
+
modelValue: props.value.modelValue,
|
|
2048
|
+
valid: props.value.valid,
|
|
2049
|
+
invalid: props.value.invalid,
|
|
2050
|
+
loading: props.value.loading
|
|
2043
2051
|
}));
|
|
2044
2052
|
const HintSlot = defineComponent({
|
|
2045
2053
|
name: "HintSlot",
|
|
@@ -2565,6 +2573,13 @@ const VvComboboxProps = {
|
|
|
2565
2573
|
* Use input text to search on options
|
|
2566
2574
|
*/
|
|
2567
2575
|
searchable: Boolean,
|
|
2576
|
+
/**
|
|
2577
|
+
* Search function to filter options
|
|
2578
|
+
*/
|
|
2579
|
+
searchFunction: {
|
|
2580
|
+
type: Function,
|
|
2581
|
+
default: void 0
|
|
2582
|
+
},
|
|
2568
2583
|
/**
|
|
2569
2584
|
* On searchable select is the input search placeholder
|
|
2570
2585
|
*/
|
|
@@ -2777,7 +2792,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2777
2792
|
}
|
|
2778
2793
|
} else if (props.flip) {
|
|
2779
2794
|
if (typeof props.flip === "boolean") {
|
|
2780
|
-
toReturn.push(flip());
|
|
2795
|
+
toReturn.push(flip({ fallbackStrategy: "initialPlacement" }));
|
|
2781
2796
|
} else {
|
|
2782
2797
|
toReturn.push(flip(props.flip));
|
|
2783
2798
|
}
|
|
@@ -2829,13 +2844,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2829
2844
|
}
|
|
2830
2845
|
return toReturn;
|
|
2831
2846
|
});
|
|
2832
|
-
const { x, y,
|
|
2847
|
+
const { x, y, middlewareData, placement, strategy } = useFloating(
|
|
2833
2848
|
referenceEl,
|
|
2834
2849
|
floatingEl,
|
|
2835
2850
|
{
|
|
2836
2851
|
whileElementsMounted: (...args) => {
|
|
2837
2852
|
return autoUpdate(...args, {
|
|
2838
|
-
animationFrame: props.strategy ===
|
|
2853
|
+
animationFrame: props.strategy === Strategy.fixed
|
|
2839
2854
|
});
|
|
2840
2855
|
},
|
|
2841
2856
|
placement: computed(() => props.placement),
|
|
@@ -2844,16 +2859,18 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2844
2859
|
}
|
|
2845
2860
|
);
|
|
2846
2861
|
const dropdownPlacement = computed(() => {
|
|
2862
|
+
var _a;
|
|
2847
2863
|
if (hasCustomPosition.value) {
|
|
2848
2864
|
return void 0;
|
|
2849
2865
|
}
|
|
2866
|
+
const width = props.triggerWidth && referenceEl.value ? `${(_a = referenceEl.value) == null ? void 0 : _a.offsetWidth}px` : void 0;
|
|
2850
2867
|
return {
|
|
2851
2868
|
position: strategy.value,
|
|
2852
2869
|
top: `${y.value ?? 0}px`,
|
|
2853
2870
|
left: `${x.value ?? 0}px`,
|
|
2854
|
-
maxWidth: maxWidth.value,
|
|
2871
|
+
maxWidth: width ? void 0 : maxWidth.value,
|
|
2855
2872
|
maxHeight: maxHeight.value,
|
|
2856
|
-
width
|
|
2873
|
+
width
|
|
2857
2874
|
};
|
|
2858
2875
|
});
|
|
2859
2876
|
const side = computed(
|
|
@@ -2865,10 +2882,10 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
2865
2882
|
return void 0;
|
|
2866
2883
|
}
|
|
2867
2884
|
const staticSide = {
|
|
2868
|
-
top:
|
|
2869
|
-
right:
|
|
2870
|
-
bottom:
|
|
2871
|
-
left:
|
|
2885
|
+
[Side.top]: Side.bottom,
|
|
2886
|
+
[Side.right]: Side.left,
|
|
2887
|
+
[Side.bottom]: Side.top,
|
|
2888
|
+
[Side.left]: Side.right
|
|
2872
2889
|
}[side.value];
|
|
2873
2890
|
return {
|
|
2874
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,
|
|
@@ -3327,7 +3344,7 @@ const _hoisted_3$4 = {
|
|
|
3327
3344
|
key: 0,
|
|
3328
3345
|
class: "vv-select__input-before"
|
|
3329
3346
|
};
|
|
3330
|
-
const _hoisted_4$
|
|
3347
|
+
const _hoisted_4$4 = { class: "vv-select__inner" };
|
|
3331
3348
|
const _hoisted_5$3 = ["id"];
|
|
3332
3349
|
const _hoisted_6$3 = ["disabled", "hidden"];
|
|
3333
3350
|
const _hoisted_7$3 = ["disabled", "value"];
|
|
@@ -3469,7 +3486,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
3469
3486
|
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_3$4, [
|
|
3470
3487
|
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
3471
3488
|
])) : createCommentVNode("", true),
|
|
3472
|
-
createElementVNode("div", _hoisted_4$
|
|
3489
|
+
createElementVNode("div", _hoisted_4$4, [
|
|
3473
3490
|
unref(hasIconBefore) ? (openBlock(), createBlock(_sfc_main$n, mergeProps({
|
|
3474
3491
|
key: 0,
|
|
3475
3492
|
class: "vv-select__icon"
|
|
@@ -3559,7 +3576,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
3559
3576
|
const _hoisted_1$7 = ["id"];
|
|
3560
3577
|
const _hoisted_2$5 = ["id", "for"];
|
|
3561
3578
|
const _hoisted_3$3 = ["id", "aria-controls", "placeholder"];
|
|
3562
|
-
const _hoisted_4$
|
|
3579
|
+
const _hoisted_4$3 = {
|
|
3563
3580
|
key: 0,
|
|
3564
3581
|
class: "vv-select__input-before"
|
|
3565
3582
|
};
|
|
@@ -3632,7 +3649,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3632
3649
|
const searchText = ref("");
|
|
3633
3650
|
const debouncedSearchText = refDebounced(
|
|
3634
3651
|
searchText,
|
|
3635
|
-
Number(props.debounceSearch)
|
|
3652
|
+
computed(() => Number(props.debounceSearch))
|
|
3636
3653
|
);
|
|
3637
3654
|
watch(
|
|
3638
3655
|
debouncedSearchText,
|
|
@@ -3655,7 +3672,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3655
3672
|
expanded.value = false;
|
|
3656
3673
|
};
|
|
3657
3674
|
const onAfterExpand = () => {
|
|
3658
|
-
if (
|
|
3675
|
+
if (propsDefaults.value.searchable) {
|
|
3659
3676
|
if (inputSearchEl.value) {
|
|
3660
3677
|
inputSearchEl.value.focus({
|
|
3661
3678
|
preventScroll: true
|
|
@@ -3664,7 +3681,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3664
3681
|
}
|
|
3665
3682
|
};
|
|
3666
3683
|
const onAfterCollapse = () => {
|
|
3667
|
-
if (
|
|
3684
|
+
if (propsDefaults.value.searchable) {
|
|
3668
3685
|
searchText.value = "";
|
|
3669
3686
|
}
|
|
3670
3687
|
};
|
|
@@ -3678,14 +3695,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3678
3695
|
loading,
|
|
3679
3696
|
valid,
|
|
3680
3697
|
invalid,
|
|
3681
|
-
floating
|
|
3682
|
-
searchable
|
|
3698
|
+
floating
|
|
3683
3699
|
} = toRefs(props);
|
|
3684
3700
|
const hasId = useUniqueId(id);
|
|
3685
3701
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
3686
3702
|
const hasDropdownId = computed(() => `${hasId.value}-dropdown`);
|
|
3687
3703
|
const hasSearchId = computed(() => `${hasId.value}-search`);
|
|
3688
3704
|
const hasLabelId = computed(() => `${hasId.value}-label`);
|
|
3705
|
+
const localLoading = ref(false);
|
|
3706
|
+
const isLoading = computed(() => localLoading.value || loading.value);
|
|
3689
3707
|
const dropdownEl = ref();
|
|
3690
3708
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
3691
3709
|
icon,
|
|
@@ -3700,7 +3718,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3700
3718
|
modifiers,
|
|
3701
3719
|
computed(() => ({
|
|
3702
3720
|
disabled: disabled.value,
|
|
3703
|
-
loading:
|
|
3721
|
+
loading: isLoading.value,
|
|
3704
3722
|
readonly: readonly.value,
|
|
3705
3723
|
"icon-before": Boolean(hasIconBefore.value),
|
|
3706
3724
|
"icon-after": Boolean(hasIconAfter.value),
|
|
@@ -3718,8 +3736,19 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3718
3736
|
getOptionDisabled,
|
|
3719
3737
|
getOptionGrouped
|
|
3720
3738
|
} = useOptions(props);
|
|
3721
|
-
const filteredOptions =
|
|
3739
|
+
const filteredOptions = computedAsync(async () => {
|
|
3722
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
|
+
}
|
|
3723
3752
|
return (_a = props.options) == null ? void 0 : _a.filter((option) => {
|
|
3724
3753
|
return getOptionLabel(option).toLowerCase().includes(debouncedSearchText.value.toLowerCase().trim());
|
|
3725
3754
|
});
|
|
@@ -3737,12 +3766,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3737
3766
|
} else if (props.modelValue) {
|
|
3738
3767
|
selectedValues = [props.modelValue];
|
|
3739
3768
|
}
|
|
3740
|
-
const options = props.options.reduce(
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
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
|
+
);
|
|
3746
3778
|
return options.filter((option) => {
|
|
3747
3779
|
if (isGroup(option)) {
|
|
3748
3780
|
return getOptionGrouped(option).some(
|
|
@@ -3796,7 +3828,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3796
3828
|
invalid: invalid.value,
|
|
3797
3829
|
invalidLabel: propsDefaults.value.invalidLabel,
|
|
3798
3830
|
hintLabel: propsDefaults.value.hintLabel,
|
|
3799
|
-
loading:
|
|
3831
|
+
loading: isLoading.value,
|
|
3800
3832
|
loadingLabel: propsDefaults.value.loadingLabel,
|
|
3801
3833
|
disabled: disabled.value,
|
|
3802
3834
|
readonly: readonly.value,
|
|
@@ -3824,7 +3856,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3824
3856
|
flip: propsDefaults.value.flip,
|
|
3825
3857
|
autoPlacement: propsDefaults.value.autoPlacement,
|
|
3826
3858
|
arrow: propsDefaults.value.arrow,
|
|
3827
|
-
autofocusFirst:
|
|
3859
|
+
autofocusFirst: propsDefaults.value.searchable ? true : propsDefaults.value.autofocusFirst,
|
|
3828
3860
|
triggerWidth: propsDefaults.value.triggerWidth,
|
|
3829
3861
|
modifiers: propsDefaults.value.dropdownModifiers
|
|
3830
3862
|
}));
|
|
@@ -3856,7 +3888,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3856
3888
|
_ctx.label ? (openBlock(), createElementBlock("label", {
|
|
3857
3889
|
key: 0,
|
|
3858
3890
|
id: unref(hasLabelId),
|
|
3859
|
-
for: unref(searchable
|
|
3891
|
+
for: unref(propsDefaults).searchable ? unref(hasSearchId) : void 0
|
|
3860
3892
|
}, toDisplayString(_ctx.label), 9, _hoisted_2$5)) : createCommentVNode("", true),
|
|
3861
3893
|
createElementVNode("div", {
|
|
3862
3894
|
ref_key: "wrapperEl",
|
|
@@ -3874,7 +3906,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3874
3906
|
onAfterCollapse
|
|
3875
3907
|
}), createSlots({
|
|
3876
3908
|
default: withCtx(({ aria }) => [
|
|
3877
|
-
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4$
|
|
3909
|
+
_ctx.$slots.before ? (openBlock(), createElementBlock("div", _hoisted_4$3, [
|
|
3878
3910
|
renderSlot(_ctx.$slots, "before", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
3879
3911
|
])) : createCommentVNode("", true),
|
|
3880
3912
|
createElementVNode("div", _hoisted_5$2, [
|
|
@@ -3908,6 +3940,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3908
3940
|
_ctx.unselectable && !unref(readonly) && !unref(disabled) ? (openBlock(), createElementBlock("button", {
|
|
3909
3941
|
key: 0,
|
|
3910
3942
|
"aria-label": unref(propsDefaults).deselectActionLabel,
|
|
3943
|
+
type: "button",
|
|
3911
3944
|
onClick: withModifiers(($event) => onInput(option), ["stop"])
|
|
3912
3945
|
}, [
|
|
3913
3946
|
createVNode(_sfc_main$n, { name: "close" })
|
|
@@ -3930,87 +3963,90 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
3930
3963
|
renderSlot(_ctx.$slots, "after", normalizeProps(guardReactiveProps(unref(slotProps))))
|
|
3931
3964
|
])) : createCommentVNode("", true)
|
|
3932
3965
|
]),
|
|
3933
|
-
items: withCtx(() =>
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
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
|
-
|
|
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
|
+
}),
|
|
4014
4050
|
after: withCtx(() => [
|
|
4015
4051
|
renderSlot(_ctx.$slots, "dropdown::after", {}, () => {
|
|
4016
4052
|
var _a;
|
|
@@ -4026,11 +4062,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
4026
4062
|
]),
|
|
4027
4063
|
_: 2
|
|
4028
4064
|
}, [
|
|
4029
|
-
unref(searchable
|
|
4065
|
+
unref(propsDefaults).searchable || _ctx.$slots["dropdown::before"] ? {
|
|
4030
4066
|
name: "before",
|
|
4031
4067
|
fn: withCtx(() => [
|
|
4032
4068
|
renderSlot(_ctx.$slots, "dropdown::before"),
|
|
4033
|
-
unref(searchable) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
4069
|
+
unref(propsDefaults).searchable && !unref(disabled) ? withDirectives((openBlock(), createElementBlock("input", {
|
|
4034
4070
|
key: 0,
|
|
4035
4071
|
id: unref(hasSearchId),
|
|
4036
4072
|
ref_key: "inputSearchEl",
|
|
@@ -4129,12 +4165,13 @@ const VvDialogProps = {
|
|
|
4129
4165
|
*/
|
|
4130
4166
|
keepOpen: { type: Boolean, default: false }
|
|
4131
4167
|
};
|
|
4132
|
-
const _hoisted_1$6 =
|
|
4168
|
+
const _hoisted_1$6 = ["onCancel"];
|
|
4169
|
+
const _hoisted_2$4 = {
|
|
4133
4170
|
key: 0,
|
|
4134
4171
|
class: "vv-dialog__header"
|
|
4135
4172
|
};
|
|
4136
|
-
const
|
|
4137
|
-
const
|
|
4173
|
+
const _hoisted_3$2 = { class: "vv-dialog__content" };
|
|
4174
|
+
const _hoisted_4$2 = {
|
|
4138
4175
|
key: 1,
|
|
4139
4176
|
class: "vv-dialog__footer"
|
|
4140
4177
|
};
|
|
@@ -4150,7 +4187,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
4150
4187
|
const dialogEl = ref();
|
|
4151
4188
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
4152
4189
|
const localModelValue = ref(false);
|
|
4153
|
-
const
|
|
4190
|
+
const isOpened = computed({
|
|
4154
4191
|
get: () => modelValue.value ?? localModelValue.value,
|
|
4155
4192
|
set: (newValue) => {
|
|
4156
4193
|
if (modelValue.value === void 0) {
|
|
@@ -4176,14 +4213,18 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
4176
4213
|
const transitioName = computed(() => `vv-dialog--${props.transition}`);
|
|
4177
4214
|
const dialogTransitionHandlers = {
|
|
4178
4215
|
"before-enter": () => {
|
|
4179
|
-
var _a;
|
|
4180
|
-
(_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
|
+
}
|
|
4181
4220
|
emit("open");
|
|
4182
4221
|
emit("before-enter");
|
|
4183
4222
|
},
|
|
4184
4223
|
"after-leave": () => {
|
|
4185
|
-
var _a;
|
|
4186
|
-
(_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
|
+
}
|
|
4187
4228
|
emit("close");
|
|
4188
4229
|
emit("after-leave");
|
|
4189
4230
|
},
|
|
@@ -4207,37 +4248,37 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
4207
4248
|
}
|
|
4208
4249
|
};
|
|
4209
4250
|
onClickOutside(modalWrapper, () => {
|
|
4210
|
-
if (!props.keepOpen
|
|
4211
|
-
|
|
4251
|
+
if (!props.keepOpen) {
|
|
4252
|
+
close();
|
|
4212
4253
|
}
|
|
4213
4254
|
});
|
|
4214
4255
|
function close() {
|
|
4215
|
-
|
|
4256
|
+
isOpened.value = false;
|
|
4216
4257
|
}
|
|
4217
4258
|
function open() {
|
|
4218
|
-
|
|
4259
|
+
isOpened.value = true;
|
|
4219
4260
|
}
|
|
4220
4261
|
__expose({ close, open });
|
|
4221
|
-
|
|
4222
|
-
if (
|
|
4223
|
-
e.preventDefault();
|
|
4262
|
+
const onCancel = () => {
|
|
4263
|
+
if (!props.keepOpen) {
|
|
4224
4264
|
close();
|
|
4225
4265
|
}
|
|
4226
|
-
}
|
|
4266
|
+
};
|
|
4227
4267
|
return (_ctx, _cache) => {
|
|
4228
4268
|
return openBlock(), createBlock(Transition, mergeProps({ name: unref(transitioName) }, toHandlers(dialogTransitionHandlers)), {
|
|
4229
4269
|
default: withCtx(() => [
|
|
4230
4270
|
withDirectives(createElementVNode("dialog", mergeProps(unref(dialogAttrs), {
|
|
4231
4271
|
ref_key: "dialogEl",
|
|
4232
4272
|
ref: dialogEl,
|
|
4233
|
-
class: unref(dialogClass)
|
|
4273
|
+
class: unref(dialogClass),
|
|
4274
|
+
onCancel: withModifiers(onCancel, ["stop", "prevent"])
|
|
4234
4275
|
}), [
|
|
4235
4276
|
createElementVNode("article", {
|
|
4236
4277
|
ref_key: "modalWrapper",
|
|
4237
4278
|
ref: modalWrapper,
|
|
4238
4279
|
class: "vv-dialog__wrapper"
|
|
4239
4280
|
}, [
|
|
4240
|
-
_ctx.$slots.header || _ctx.title ? (openBlock(), createElementBlock("header",
|
|
4281
|
+
_ctx.$slots.header || _ctx.title ? (openBlock(), createElementBlock("header", _hoisted_2$4, [
|
|
4241
4282
|
renderSlot(_ctx.$slots, "header", {}, () => [
|
|
4242
4283
|
createTextVNode(toDisplayString(_ctx.title) + " ", 1),
|
|
4243
4284
|
createElementVNode("button", {
|
|
@@ -4250,15 +4291,15 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
4250
4291
|
], 32)
|
|
4251
4292
|
])
|
|
4252
4293
|
])) : createCommentVNode("", true),
|
|
4253
|
-
createElementVNode("div",
|
|
4294
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
4254
4295
|
renderSlot(_ctx.$slots, "default")
|
|
4255
4296
|
]),
|
|
4256
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer",
|
|
4297
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_4$2, [
|
|
4257
4298
|
renderSlot(_ctx.$slots, "footer")
|
|
4258
4299
|
])) : createCommentVNode("", true)
|
|
4259
4300
|
], 512)
|
|
4260
|
-
], 16), [
|
|
4261
|
-
[vShow, unref(
|
|
4301
|
+
], 16, _hoisted_1$6), [
|
|
4302
|
+
[vShow, unref(isOpened)]
|
|
4262
4303
|
])
|
|
4263
4304
|
]),
|
|
4264
4305
|
_: 3
|
|
@@ -4289,7 +4330,23 @@ const TYPES_ICON = {
|
|
|
4289
4330
|
COLOR: "color",
|
|
4290
4331
|
SEARCH: "close"
|
|
4291
4332
|
};
|
|
4292
|
-
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
|
+
];
|
|
4293
4350
|
const VvInputTextProps = {
|
|
4294
4351
|
...InputTextareaProps,
|
|
4295
4352
|
/**
|
|
@@ -4396,44 +4453,19 @@ const VvInputTextProps = {
|
|
|
4396
4453
|
default: "Clear"
|
|
4397
4454
|
},
|
|
4398
4455
|
/**
|
|
4399
|
-
*
|
|
4400
|
-
* @see https://
|
|
4456
|
+
* iMask options
|
|
4457
|
+
* @see https://imask.js.org/guide.html
|
|
4401
4458
|
*/
|
|
4402
|
-
|
|
4403
|
-
type: String,
|
|
4404
|
-
default: void 0
|
|
4405
|
-
},
|
|
4406
|
-
/**
|
|
4407
|
-
* Show mask before typing
|
|
4408
|
-
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
4409
|
-
*/
|
|
4410
|
-
maskEager: {
|
|
4411
|
-
type: Boolean,
|
|
4412
|
-
default: false
|
|
4413
|
-
},
|
|
4414
|
-
/**
|
|
4415
|
-
* Write values reverse (ex. for numbers)
|
|
4416
|
-
* @see https://beholdr.github.io/maska/#/?id=maskinput-options
|
|
4417
|
-
*/
|
|
4418
|
-
maskReversed: {
|
|
4419
|
-
type: Boolean,
|
|
4420
|
-
default: false
|
|
4421
|
-
},
|
|
4422
|
-
/**
|
|
4423
|
-
* Add mask custom tokens
|
|
4424
|
-
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
4425
|
-
*/
|
|
4426
|
-
maskTokens: {
|
|
4459
|
+
iMask: {
|
|
4427
4460
|
type: Object,
|
|
4428
4461
|
default: void 0
|
|
4429
4462
|
},
|
|
4430
4463
|
/**
|
|
4431
|
-
*
|
|
4432
|
-
* @see https://beholdr.github.io/maska/#/?id=custom-tokens
|
|
4464
|
+
* Masked value
|
|
4433
4465
|
*/
|
|
4434
|
-
|
|
4435
|
-
type:
|
|
4436
|
-
default:
|
|
4466
|
+
masked: {
|
|
4467
|
+
type: String,
|
|
4468
|
+
default: void 0
|
|
4437
4469
|
},
|
|
4438
4470
|
/**
|
|
4439
4471
|
* Adjust input width to content
|
|
@@ -4454,6 +4486,13 @@ const VvInputTextProps = {
|
|
|
4454
4486
|
*/
|
|
4455
4487
|
unit: {
|
|
4456
4488
|
type: String
|
|
4489
|
+
},
|
|
4490
|
+
/**
|
|
4491
|
+
* Select input text on focus
|
|
4492
|
+
*/
|
|
4493
|
+
selectOnFocus: {
|
|
4494
|
+
type: Boolean,
|
|
4495
|
+
default: false
|
|
4457
4496
|
}
|
|
4458
4497
|
};
|
|
4459
4498
|
const VvInputPasswordAction = defineComponent({
|
|
@@ -4778,9 +4817,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4778
4817
|
VvInputTextProps,
|
|
4779
4818
|
props
|
|
4780
4819
|
);
|
|
4781
|
-
const inputEl = ref();
|
|
4782
|
-
const innerEl = ref();
|
|
4783
|
-
__expose({ $inner: innerEl });
|
|
4784
4820
|
const {
|
|
4785
4821
|
id,
|
|
4786
4822
|
icon,
|
|
@@ -4790,39 +4826,131 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4790
4826
|
count,
|
|
4791
4827
|
valid,
|
|
4792
4828
|
invalid,
|
|
4793
|
-
loading
|
|
4829
|
+
loading,
|
|
4830
|
+
debounce,
|
|
4831
|
+
maxlength,
|
|
4832
|
+
minlength,
|
|
4833
|
+
type,
|
|
4834
|
+
iMask,
|
|
4835
|
+
step
|
|
4794
4836
|
} = toRefs(props);
|
|
4795
4837
|
const hasId = useUniqueId(id);
|
|
4796
4838
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
4797
4839
|
const inputTextPlaceholder = computed(
|
|
4798
4840
|
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
4799
4841
|
);
|
|
4800
|
-
const
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
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
|
+
),
|
|
4804
4849
|
{
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4850
|
+
emit,
|
|
4851
|
+
onAccept: () => {
|
|
4852
|
+
if (!maskReady.value) {
|
|
4853
|
+
return;
|
|
4808
4854
|
}
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
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;
|
|
4870
|
+
}
|
|
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;
|
|
4889
|
+
}
|
|
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;
|
|
4814
4908
|
}
|
|
4815
|
-
if (
|
|
4816
|
-
return
|
|
4909
|
+
if (!localModelValue.value && !unmasked.value) {
|
|
4910
|
+
return;
|
|
4817
4911
|
}
|
|
4818
|
-
|
|
4912
|
+
localModelValue.value = unmasked.value;
|
|
4913
|
+
}
|
|
4914
|
+
}
|
|
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 ?? "";
|
|
4819
4928
|
}
|
|
4820
4929
|
}
|
|
4821
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
|
+
);
|
|
4822
4945
|
const { focused } = useComponentFocus(inputEl, emit);
|
|
4823
4946
|
const isFocused = computed(
|
|
4824
4947
|
() => focused.value && !props.disabled && !props.readonly
|
|
4825
4948
|
);
|
|
4949
|
+
watch(isFocused, (newValue) => {
|
|
4950
|
+
if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
|
|
4951
|
+
inputEl.value.select();
|
|
4952
|
+
}
|
|
4953
|
+
});
|
|
4826
4954
|
const isVisible = useElementVisibility(inputEl);
|
|
4827
4955
|
watch(isVisible, (newValue) => {
|
|
4828
4956
|
if (newValue && props.autofocus && !props.disabled && !props.readonly) {
|
|
@@ -4840,19 +4968,27 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4840
4968
|
const isNumber = computed(() => props.type === INPUT_TYPES.NUMBER);
|
|
4841
4969
|
const onStepUp = () => {
|
|
4842
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
|
+
}
|
|
4843
4975
|
inputEl.value.stepUp();
|
|
4844
4976
|
localModelValue.value = unref(inputEl).value;
|
|
4845
4977
|
}
|
|
4846
4978
|
};
|
|
4847
4979
|
const onStepDown = () => {
|
|
4848
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
|
+
}
|
|
4849
4985
|
inputEl.value.stepDown();
|
|
4850
4986
|
localModelValue.value = unref(inputEl).value;
|
|
4851
4987
|
}
|
|
4852
4988
|
};
|
|
4853
4989
|
const isSearch = computed(() => props.type === INPUT_TYPES.SEARCH);
|
|
4854
4990
|
const onClear = () => {
|
|
4855
|
-
localModelValue.value =
|
|
4991
|
+
localModelValue.value = "";
|
|
4856
4992
|
};
|
|
4857
4993
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
4858
4994
|
icon,
|
|
@@ -4874,9 +5010,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4874
5010
|
}
|
|
4875
5011
|
});
|
|
4876
5012
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
4877
|
-
mode:
|
|
4878
|
-
upperLimit: Number(
|
|
4879
|
-
lowerLimit: Number(
|
|
5013
|
+
mode: count.value,
|
|
5014
|
+
upperLimit: Number(maxlength == null ? void 0 : maxlength.value),
|
|
5015
|
+
lowerLimit: Number(minlength == null ? void 0 : minlength.value)
|
|
4880
5016
|
});
|
|
4881
5017
|
const isClickable = computed(() => !props.disabled && !props.readonly);
|
|
4882
5018
|
const hasTabindex = computed(
|
|
@@ -4911,17 +5047,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4911
5047
|
}))
|
|
4912
5048
|
);
|
|
4913
5049
|
const hasAttrs = computed(() => {
|
|
4914
|
-
const
|
|
5050
|
+
const type2 = (() => {
|
|
4915
5051
|
if (isPassword.value && showPassword.value) {
|
|
4916
5052
|
return INPUT_TYPES.TEXT;
|
|
4917
5053
|
}
|
|
4918
5054
|
if (isDateTime.value && !isDirty.value && !focused.value) {
|
|
4919
5055
|
return INPUT_TYPES.TEXT;
|
|
4920
5056
|
}
|
|
5057
|
+
if (iMask == null ? void 0 : iMask.value) {
|
|
5058
|
+
return INPUT_TYPES.TEXT;
|
|
5059
|
+
}
|
|
4921
5060
|
return props.type;
|
|
4922
5061
|
})();
|
|
4923
5062
|
const toReturn = {
|
|
4924
|
-
type,
|
|
5063
|
+
type: type2,
|
|
4925
5064
|
name: props.name,
|
|
4926
5065
|
tabindex: hasTabindex.value,
|
|
4927
5066
|
disabled: props.disabled,
|
|
@@ -4932,20 +5071,20 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4932
5071
|
"aria-describedby": hasHintLabelOrSlot.value ? hasHintId.value : void 0,
|
|
4933
5072
|
"aria-errormessage": hasInvalidLabelOrSlot.value ? hasHintId.value : void 0
|
|
4934
5073
|
};
|
|
4935
|
-
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) {
|
|
4936
5075
|
toReturn.step = props.step;
|
|
4937
5076
|
toReturn.max = props.max !== void 0 ? String(props.max) : void 0;
|
|
4938
5077
|
toReturn.min = props.min !== void 0 ? String(props.min) : void 0;
|
|
4939
5078
|
}
|
|
4940
|
-
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) {
|
|
4941
5080
|
toReturn.placeholder = inputTextPlaceholder.value;
|
|
4942
5081
|
}
|
|
4943
|
-
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) {
|
|
4944
5083
|
toReturn.minlength = props.minlength;
|
|
4945
5084
|
toReturn.maxlength = props.maxlength;
|
|
4946
5085
|
toReturn.pattern = props.pattern;
|
|
4947
5086
|
}
|
|
4948
|
-
if (
|
|
5087
|
+
if (type2 === INPUT_TYPES.EMAIL) {
|
|
4949
5088
|
toReturn.multiple = props.multiple;
|
|
4950
5089
|
}
|
|
4951
5090
|
return toReturn;
|
|
@@ -4977,31 +5116,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4977
5116
|
INPUT_TYPES.SEARCH,
|
|
4978
5117
|
props
|
|
4979
5118
|
);
|
|
4980
|
-
const mask = ref();
|
|
4981
|
-
watch(
|
|
4982
|
-
[
|
|
4983
|
-
() => props.mask,
|
|
4984
|
-
() => props.type,
|
|
4985
|
-
() => props.maskEager,
|
|
4986
|
-
() => props.maskReversed,
|
|
4987
|
-
() => props.maskTokens,
|
|
4988
|
-
() => props.maskTokensReplace
|
|
4989
|
-
],
|
|
4990
|
-
([newMask, newType, eager, reversed, tokens, tokensReplace]) => {
|
|
4991
|
-
if (newMask && newType === INPUT_TYPES.TEXT) {
|
|
4992
|
-
mask.value = new Mask({
|
|
4993
|
-
mask: newMask,
|
|
4994
|
-
eager,
|
|
4995
|
-
reversed,
|
|
4996
|
-
tokens,
|
|
4997
|
-
tokensReplace
|
|
4998
|
-
});
|
|
4999
|
-
return;
|
|
5000
|
-
}
|
|
5001
|
-
mask.value = void 0;
|
|
5002
|
-
},
|
|
5003
|
-
{ immediate: true }
|
|
5004
|
-
);
|
|
5005
5119
|
const onClickInner = () => {
|
|
5006
5120
|
if (isClickable.value) {
|
|
5007
5121
|
focused.value = true;
|
|
@@ -5015,6 +5129,23 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5015
5129
|
width: localModelValue.value !== void 0 ? `${String(localModelValue.value).length + 1}ch` : void 0
|
|
5016
5130
|
};
|
|
5017
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
|
+
};
|
|
5018
5149
|
return (_ctx, _cache) => {
|
|
5019
5150
|
return openBlock(), createElementBlock("div", {
|
|
5020
5151
|
class: normalizeClass(unref(bemCssClasses))
|
|
@@ -5038,17 +5169,16 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5038
5169
|
key: 0,
|
|
5039
5170
|
class: "vv-input-text__icon"
|
|
5040
5171
|
}, unref(hasIcon)), null, 16)) : createCommentVNode("", true),
|
|
5041
|
-
|
|
5172
|
+
createElementVNode("input", mergeProps({
|
|
5042
5173
|
id: unref(hasId),
|
|
5043
5174
|
ref_key: "inputEl",
|
|
5044
|
-
ref: inputEl
|
|
5045
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(localModelValue) ? localModelValue.value = $event : null)
|
|
5175
|
+
ref: inputEl
|
|
5046
5176
|
}, unref(hasAttrs), {
|
|
5047
5177
|
style: unref(hasStyle),
|
|
5048
|
-
onKeyup: _cache[
|
|
5049
|
-
|
|
5050
|
-
[
|
|
5051
|
-
|
|
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),
|
|
5052
5182
|
(_ctx.unit || _ctx.$slots.unit) && unref(isDirty) ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
|
|
5053
5183
|
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotProps))), () => [
|
|
5054
5184
|
createTextVNode(toDisplayString(_ctx.unit), 1)
|
|
@@ -5643,14 +5773,17 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5643
5773
|
valid,
|
|
5644
5774
|
invalid,
|
|
5645
5775
|
loading,
|
|
5646
|
-
modifiers
|
|
5776
|
+
modifiers,
|
|
5777
|
+
debounce,
|
|
5778
|
+
minlength,
|
|
5779
|
+
maxlength
|
|
5647
5780
|
} = toRefs(props);
|
|
5648
5781
|
const hasId = useUniqueId(id);
|
|
5649
5782
|
const hasHintId = computed(() => `${hasId.value}-hint`);
|
|
5650
5783
|
const hasPlaceholder = computed(
|
|
5651
5784
|
() => props.floating && isEmpty(props.placeholder) ? " " : props.placeholder
|
|
5652
5785
|
);
|
|
5653
|
-
const localModelValue = useDebouncedInput(modelValue, emit,
|
|
5786
|
+
const localModelValue = useDebouncedInput(modelValue, emit, debounce == null ? void 0 : debounce.value);
|
|
5654
5787
|
const { hasIcon, hasIconBefore, hasIconAfter } = useComponentIcon(
|
|
5655
5788
|
icon,
|
|
5656
5789
|
iconPosition
|
|
@@ -5663,9 +5796,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5663
5796
|
}
|
|
5664
5797
|
});
|
|
5665
5798
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
5666
|
-
mode:
|
|
5667
|
-
upperLimit: Number(
|
|
5668
|
-
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)
|
|
5669
5802
|
});
|
|
5670
5803
|
const isClickable = computed(() => !props.disabled && !props.readonly);
|
|
5671
5804
|
const hasTabindex = computed(
|