@volverjs/ui-vue 0.0.10-beta.68 → 0.0.10-beta.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/VvAccordion/VvAccordion.vue.d.ts +5 -4
- package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +4 -2
- package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
- package/dist/components/VvAlert/VvAlert.es.js +6 -7
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.vue.d.ts +14 -8
- package/dist/components/VvAlert/index.d.ts +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +6 -7
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.vue.d.ts +5 -3
- package/dist/components/VvAlertGroup/index.d.ts +1 -1
- package/dist/components/VvAvatar/VvAvatar.vue.d.ts +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.vue.d.ts +1 -1
- package/dist/components/VvBadge/VvBadge.vue.d.ts +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +2 -2
- package/dist/components/VvButton/VvButton.es.js +6 -7
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButton/VvButton.vue.d.ts +9 -5
- package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +3 -2
- package/dist/components/VvCard/VvCard.vue.d.ts +7 -4
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +14 -10
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +13 -9
- package/dist/components/VvCombobox/VvCombobox.es.js +301 -182
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +41 -23
- package/dist/components/VvCombobox/index.d.ts +36 -4
- package/dist/components/VvDialog/VvDialog.vue.d.ts +5 -3
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +11 -8
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -116
- package/dist/components/VvDropdown/VvDropdownItem.vue.d.ts +1 -1
- package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +4 -3
- package/dist/components/VvIcon/VvIcon.es.js +5 -6
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvIcon/index.d.ts +2 -2
- package/dist/components/VvInputFile/VvInputFile.es.js +50 -13
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +13 -9
- package/dist/components/VvInputFile/index.d.ts +4 -4
- package/dist/components/VvInputText/VvInputText.es.js +39 -18
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +37 -20
- package/dist/components/VvInputText/index.d.ts +12 -4
- package/dist/components/VvNav/VvNav.vue.d.ts +4 -3
- package/dist/components/VvNav/VvNavItem.vue.d.ts +1 -1
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.vue.d.ts +14 -10
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +13 -9
- package/dist/components/VvSelect/VvSelect.es.js +143 -51
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +24 -14
- package/dist/components/VvSelect/index.d.ts +34 -2
- package/dist/components/VvTab/VvTab.vue.d.ts +3 -2
- package/dist/components/VvTextarea/VvTextarea.es.js +7 -8
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +23 -16
- package/dist/components/VvTextarea/index.d.ts +1 -1
- package/dist/components/VvTooltip/VvTooltip.vue.d.ts +1 -1
- package/dist/components/{VvInputText → common}/VvInputClearAction.d.ts +10 -0
- package/dist/components/{VvInputText → common}/VvInputPasswordAction.d.ts +9 -0
- package/dist/components/{VvInputText → common}/VvInputStepAction.d.ts +9 -0
- package/dist/components/index.es.js +201 -79
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/alert/useAlert.d.ts +4 -4
- package/dist/composables/dropdown/useDropdownContextmenu.d.ts +1 -1
- package/dist/composables/dropdown/useDropdownVirtualElement.d.ts +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/props/index.d.ts +3 -3
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +44 -22
- package/dist/stories/Alert/Alert.settings.d.ts +1 -1
- package/dist/stories/Button/Button.settings.d.ts +1 -1
- package/dist/stories/Combobox/Combobox.settings.d.ts +1 -1
- package/dist/stories/Nav/Nav.settings.d.ts +1 -1
- package/dist/stories/Tab/Tab.settings.d.ts +1 -1
- package/dist/utils/FileUtilities.d.ts +14 -0
- package/package.json +31 -31
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computed, isRef, defineComponent, h, unref, toRefs,
|
|
2
|
-
import {
|
|
1
|
+
import { computed, isRef, defineComponent, h, inject, unref, mergeDefaults, ref, toRefs, createBlock, createCommentVNode, openBlock, mergeProps, createElementBlock, normalizeClass, renderSlot, createTextVNode, toDisplayString, toRef, getCurrentInstance, watch, resolveComponent, resolveDynamicComponent, withCtx, useId, useAttrs, useSlots, Fragment, provide, onMounted, nextTick, createVNode, normalizeProps, guardReactiveProps, Transition, toHandlers, withDirectives, createElementVNode, normalizeStyle, vShow, renderList, vModelSelect, createSlots, withModifiers, vModelText } from "vue";
|
|
2
|
+
import { iconLoaded, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { autoPlacement, flip, shift, size, offset, arrow, useFloating, autoUpdate } from "@floating-ui/vue";
|
|
4
4
|
import { useMutationObserver, useVModel, onClickOutside, useFocusWithin, useElementHover, onKeyStroke, useFocus, useElementVisibility, refDebounced, computedAsync } from "@vueuse/core";
|
|
5
5
|
import mitt from "mitt";
|
|
@@ -250,7 +250,7 @@ const OptionsProps = {
|
|
|
250
250
|
const IconProps = {
|
|
251
251
|
/**
|
|
252
252
|
* VvIcon name or props
|
|
253
|
-
* @see
|
|
253
|
+
* @see VvIcon
|
|
254
254
|
*/
|
|
255
255
|
icon: {
|
|
256
256
|
type: [String, Object],
|
|
@@ -449,6 +449,13 @@ const ActionProps = {
|
|
|
449
449
|
default: StorageType.local
|
|
450
450
|
}
|
|
451
451
|
});
|
|
452
|
+
const ACTION_ICONS = {
|
|
453
|
+
clear: "close"
|
|
454
|
+
};
|
|
455
|
+
const VvIconPropsDefaults = {
|
|
456
|
+
prefix: "normal"
|
|
457
|
+
/* normal */
|
|
458
|
+
};
|
|
452
459
|
const VvComboboxProps = {
|
|
453
460
|
...IdNameProps,
|
|
454
461
|
...TabindexProps,
|
|
@@ -616,6 +623,21 @@ const VvComboboxProps = {
|
|
|
616
623
|
focusOnHover: {
|
|
617
624
|
type: Boolean,
|
|
618
625
|
default: true
|
|
626
|
+
},
|
|
627
|
+
/**
|
|
628
|
+
* VvIcon name for clear button
|
|
629
|
+
* @see VvIcon
|
|
630
|
+
*/
|
|
631
|
+
iconClear: {
|
|
632
|
+
type: [String, Object],
|
|
633
|
+
default: ACTION_ICONS.clear
|
|
634
|
+
},
|
|
635
|
+
/**
|
|
636
|
+
* Label for clear button
|
|
637
|
+
*/
|
|
638
|
+
labelClear: {
|
|
639
|
+
type: String,
|
|
640
|
+
default: "Clear"
|
|
619
641
|
}
|
|
620
642
|
};
|
|
621
643
|
function useVvComboboxProps() {
|
|
@@ -813,10 +835,9 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
813
835
|
HintSlot
|
|
814
836
|
};
|
|
815
837
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
};
|
|
838
|
+
function useVolver() {
|
|
839
|
+
return inject(INJECTION_KEY_VOLVER, void 0);
|
|
840
|
+
}
|
|
820
841
|
function useModifiers(prefix, modifiers, others) {
|
|
821
842
|
return computed(() => {
|
|
822
843
|
const toReturn = {
|
|
@@ -841,10 +862,215 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
841
862
|
});
|
|
842
863
|
}
|
|
843
864
|
const __default__$9 = {
|
|
844
|
-
name: "
|
|
865
|
+
name: "VvIcon"
|
|
845
866
|
};
|
|
846
867
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
847
868
|
...__default__$9,
|
|
869
|
+
props: /* @__PURE__ */ mergeDefaults({
|
|
870
|
+
name: {},
|
|
871
|
+
color: {},
|
|
872
|
+
width: {},
|
|
873
|
+
height: {},
|
|
874
|
+
provider: {},
|
|
875
|
+
prefix: {},
|
|
876
|
+
src: {},
|
|
877
|
+
horizontalFlip: { type: Boolean },
|
|
878
|
+
verticalFlip: { type: Boolean },
|
|
879
|
+
flip: {},
|
|
880
|
+
mode: {},
|
|
881
|
+
inline: { type: Boolean },
|
|
882
|
+
rotate: {},
|
|
883
|
+
onLoad: { type: Function },
|
|
884
|
+
svg: {},
|
|
885
|
+
modifiers: {}
|
|
886
|
+
}, VvIconPropsDefaults),
|
|
887
|
+
setup(__props) {
|
|
888
|
+
const props = __props;
|
|
889
|
+
const hasRotate = computed(() => {
|
|
890
|
+
if (typeof props.rotate === "string") {
|
|
891
|
+
return Number.parseFloat(props.rotate);
|
|
892
|
+
}
|
|
893
|
+
return props.rotate;
|
|
894
|
+
});
|
|
895
|
+
const show = ref(true);
|
|
896
|
+
const volver = useVolver();
|
|
897
|
+
const { modifiers } = toRefs(props);
|
|
898
|
+
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
899
|
+
const provider = computed(() => {
|
|
900
|
+
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
901
|
+
});
|
|
902
|
+
const icon = computed(() => {
|
|
903
|
+
const name = props.name ?? "";
|
|
904
|
+
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
905
|
+
if (iconLoaded(iconName)) {
|
|
906
|
+
return iconName;
|
|
907
|
+
}
|
|
908
|
+
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
909
|
+
(iconsCollection2) => {
|
|
910
|
+
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
911
|
+
return iconLoaded(icon2);
|
|
912
|
+
}
|
|
913
|
+
);
|
|
914
|
+
if (iconsCollection) {
|
|
915
|
+
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
916
|
+
}
|
|
917
|
+
return name;
|
|
918
|
+
});
|
|
919
|
+
function getSvgContent(svg) {
|
|
920
|
+
let dom;
|
|
921
|
+
if (typeof window === "undefined") {
|
|
922
|
+
const { JSDOM } = require("jsdom");
|
|
923
|
+
dom = new JSDOM().window;
|
|
924
|
+
}
|
|
925
|
+
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
926
|
+
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
927
|
+
const svgEl = svgDomString.querySelector("svg");
|
|
928
|
+
return svgEl;
|
|
929
|
+
}
|
|
930
|
+
function addIconFromSvg(svg) {
|
|
931
|
+
const svgContentEl = getSvgContent(svg);
|
|
932
|
+
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
933
|
+
if (svgContentEl && svgContent) {
|
|
934
|
+
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
935
|
+
body: svgContent,
|
|
936
|
+
// Set height and width from svg content
|
|
937
|
+
height: svgContentEl.viewBox.baseVal.height,
|
|
938
|
+
width: svgContentEl.viewBox.baseVal.width
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
if (volver) {
|
|
943
|
+
if (props.src && !iconLoaded(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
944
|
+
show.value = false;
|
|
945
|
+
volver.fetchIcon(props.src).then((svg) => {
|
|
946
|
+
if (svg) {
|
|
947
|
+
addIconFromSvg(svg);
|
|
948
|
+
show.value = true;
|
|
949
|
+
}
|
|
950
|
+
}).catch((e) => {
|
|
951
|
+
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
if (props.svg) {
|
|
956
|
+
addIconFromSvg(props.svg);
|
|
957
|
+
}
|
|
958
|
+
return (_ctx, _cache) => {
|
|
959
|
+
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
960
|
+
key: 0,
|
|
961
|
+
class: unref(bemCssClasses)
|
|
962
|
+
}, {
|
|
963
|
+
inline: _ctx.inline,
|
|
964
|
+
width: _ctx.width,
|
|
965
|
+
height: _ctx.height,
|
|
966
|
+
horizontalFlip: _ctx.horizontalFlip,
|
|
967
|
+
verticalFlip: _ctx.verticalFlip,
|
|
968
|
+
flip: _ctx.flip,
|
|
969
|
+
rotate: unref(hasRotate),
|
|
970
|
+
color: _ctx.color,
|
|
971
|
+
icon: unref(icon)
|
|
972
|
+
}, { onLoad: _ctx.onLoad }), null, 16, ["class", "onLoad"])) : createCommentVNode("v-if", true);
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
});
|
|
976
|
+
function useComponentIcon(icon, iconPosition) {
|
|
977
|
+
const hasIcon = computed(() => {
|
|
978
|
+
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
979
|
+
return { name: icon == null ? void 0 : icon.value };
|
|
980
|
+
}
|
|
981
|
+
return icon == null ? void 0 : icon.value;
|
|
982
|
+
});
|
|
983
|
+
const hasIconBefore = computed(
|
|
984
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
|
|
985
|
+
);
|
|
986
|
+
const hasIconAfter = computed(
|
|
987
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
|
|
988
|
+
);
|
|
989
|
+
const hasIconLeft = computed(
|
|
990
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
|
|
991
|
+
);
|
|
992
|
+
const hasIconRight = computed(
|
|
993
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
|
|
994
|
+
);
|
|
995
|
+
const hasIconTop = computed(
|
|
996
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
|
|
997
|
+
);
|
|
998
|
+
const hasIconBottom = computed(
|
|
999
|
+
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
|
|
1000
|
+
);
|
|
1001
|
+
return {
|
|
1002
|
+
hasIcon,
|
|
1003
|
+
hasIconLeft,
|
|
1004
|
+
hasIconRight,
|
|
1005
|
+
hasIconTop,
|
|
1006
|
+
hasIconBottom,
|
|
1007
|
+
hasIconBefore,
|
|
1008
|
+
hasIconAfter
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
const VvInputClearAction = defineComponent({
|
|
1012
|
+
components: {
|
|
1013
|
+
VvIcon: _sfc_main$9
|
|
1014
|
+
},
|
|
1015
|
+
props: {
|
|
1016
|
+
inputType: {
|
|
1017
|
+
type: String,
|
|
1018
|
+
default: "input-text"
|
|
1019
|
+
},
|
|
1020
|
+
disabled: {
|
|
1021
|
+
type: Boolean,
|
|
1022
|
+
default: false
|
|
1023
|
+
},
|
|
1024
|
+
label: {
|
|
1025
|
+
type: String,
|
|
1026
|
+
default: "Clear"
|
|
1027
|
+
},
|
|
1028
|
+
icon: {
|
|
1029
|
+
type: [String, Object],
|
|
1030
|
+
default: "close"
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
emits: ["clear"],
|
|
1034
|
+
setup(props, { emit }) {
|
|
1035
|
+
const { hasIcon } = useComponentIcon(computed(() => props.icon));
|
|
1036
|
+
function onClick(e) {
|
|
1037
|
+
e == null ? void 0 : e.stopPropagation();
|
|
1038
|
+
if (!props.disabled) {
|
|
1039
|
+
emit("clear");
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
return {
|
|
1043
|
+
hasIcon,
|
|
1044
|
+
onClick
|
|
1045
|
+
};
|
|
1046
|
+
},
|
|
1047
|
+
render() {
|
|
1048
|
+
const icon = this.hasIcon ? h(_sfc_main$9, {
|
|
1049
|
+
...this.hasIcon,
|
|
1050
|
+
class: `vv-${this.inputType}__icon`
|
|
1051
|
+
}) : void 0;
|
|
1052
|
+
return h(
|
|
1053
|
+
"button",
|
|
1054
|
+
{
|
|
1055
|
+
disabled: this.disabled,
|
|
1056
|
+
class: `vv-${this.inputType}__action`,
|
|
1057
|
+
ariaLabel: this.label,
|
|
1058
|
+
type: "button",
|
|
1059
|
+
onClick: this.onClick
|
|
1060
|
+
},
|
|
1061
|
+
icon
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
const VvBadgeProps = {
|
|
1066
|
+
...ModifiersProps,
|
|
1067
|
+
value: [String, Number]
|
|
1068
|
+
};
|
|
1069
|
+
const __default__$8 = {
|
|
1070
|
+
name: "VvBadge"
|
|
1071
|
+
};
|
|
1072
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
1073
|
+
...__default__$8,
|
|
848
1074
|
props: VvBadgeProps,
|
|
849
1075
|
setup(__props) {
|
|
850
1076
|
const props = __props;
|
|
@@ -1001,9 +1227,6 @@ function useGroupProps(props, emit) {
|
|
|
1001
1227
|
}
|
|
1002
1228
|
const VvActionEvents = ["click", "mouseover", "mouseleave"];
|
|
1003
1229
|
const VvActionProps = ActionProps;
|
|
1004
|
-
function useVolver() {
|
|
1005
|
-
return inject(INJECTION_KEY_VOLVER, void 0);
|
|
1006
|
-
}
|
|
1007
1230
|
function useInjectedDropdownTrigger() {
|
|
1008
1231
|
return inject(INJECTION_KEY_DROPDOWN_TRIGGER, {});
|
|
1009
1232
|
}
|
|
@@ -1013,11 +1236,11 @@ function useInjectedDropdownItem() {
|
|
|
1013
1236
|
function useInjectedDropdownAction() {
|
|
1014
1237
|
return inject(INJECTION_KEY_DROPDOWN_ACTION, {});
|
|
1015
1238
|
}
|
|
1016
|
-
const __default__$
|
|
1239
|
+
const __default__$7 = {
|
|
1017
1240
|
name: "VvAction"
|
|
1018
1241
|
};
|
|
1019
|
-
const _sfc_main$
|
|
1020
|
-
...__default__$
|
|
1242
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1243
|
+
...__default__$7,
|
|
1021
1244
|
props: VvActionProps,
|
|
1022
1245
|
emits: VvActionEvents,
|
|
1023
1246
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -1146,161 +1369,9 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
1146
1369
|
};
|
|
1147
1370
|
}
|
|
1148
1371
|
});
|
|
1149
|
-
const VvIconPropsDefaults = {
|
|
1150
|
-
prefix: "normal"
|
|
1151
|
-
/* normal */
|
|
1152
|
-
};
|
|
1153
|
-
const __default__$7 = {
|
|
1154
|
-
name: "VvIcon"
|
|
1155
|
-
};
|
|
1156
|
-
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1157
|
-
...__default__$7,
|
|
1158
|
-
props: /* @__PURE__ */ mergeDefaults({
|
|
1159
|
-
name: {},
|
|
1160
|
-
color: {},
|
|
1161
|
-
width: {},
|
|
1162
|
-
height: {},
|
|
1163
|
-
provider: {},
|
|
1164
|
-
prefix: {},
|
|
1165
|
-
src: {},
|
|
1166
|
-
horizontalFlip: { type: Boolean },
|
|
1167
|
-
verticalFlip: { type: Boolean },
|
|
1168
|
-
flip: {},
|
|
1169
|
-
mode: {},
|
|
1170
|
-
inline: { type: Boolean },
|
|
1171
|
-
rotate: {},
|
|
1172
|
-
onLoad: { type: Function },
|
|
1173
|
-
svg: {},
|
|
1174
|
-
modifiers: {}
|
|
1175
|
-
}, VvIconPropsDefaults),
|
|
1176
|
-
setup(__props) {
|
|
1177
|
-
const props = __props;
|
|
1178
|
-
const hasRotate = computed(() => {
|
|
1179
|
-
if (typeof props.rotate === "string") {
|
|
1180
|
-
return Number.parseFloat(props.rotate);
|
|
1181
|
-
}
|
|
1182
|
-
return props.rotate;
|
|
1183
|
-
});
|
|
1184
|
-
const show = ref(true);
|
|
1185
|
-
const volver = useVolver();
|
|
1186
|
-
const { modifiers } = toRefs(props);
|
|
1187
|
-
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
1188
|
-
const provider = computed(() => {
|
|
1189
|
-
return props.provider || (volver == null ? void 0 : volver.iconsProvider);
|
|
1190
|
-
});
|
|
1191
|
-
const icon = computed(() => {
|
|
1192
|
-
const name = props.name ?? "";
|
|
1193
|
-
const iconName = `@${provider.value}:${props.prefix}:${name}`;
|
|
1194
|
-
if (iconExists(iconName)) {
|
|
1195
|
-
return iconName;
|
|
1196
|
-
}
|
|
1197
|
-
const iconsCollection = volver == null ? void 0 : volver.iconsCollections.find(
|
|
1198
|
-
(iconsCollection2) => {
|
|
1199
|
-
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
1200
|
-
return iconExists(icon2);
|
|
1201
|
-
}
|
|
1202
|
-
);
|
|
1203
|
-
if (iconsCollection) {
|
|
1204
|
-
return `@${provider.value}:${iconsCollection.prefix}:${name}`;
|
|
1205
|
-
}
|
|
1206
|
-
return name;
|
|
1207
|
-
});
|
|
1208
|
-
function getSvgContent(svg) {
|
|
1209
|
-
let dom;
|
|
1210
|
-
if (typeof window === "undefined") {
|
|
1211
|
-
const { JSDOM } = require("jsdom");
|
|
1212
|
-
dom = new JSDOM().window;
|
|
1213
|
-
}
|
|
1214
|
-
const domParser = dom ? new dom.DOMParser() : new window.DOMParser();
|
|
1215
|
-
const svgDomString = domParser.parseFromString(svg, "text/html");
|
|
1216
|
-
const svgEl = svgDomString.querySelector("svg");
|
|
1217
|
-
return svgEl;
|
|
1218
|
-
}
|
|
1219
|
-
function addIconFromSvg(svg) {
|
|
1220
|
-
const svgContentEl = getSvgContent(svg);
|
|
1221
|
-
const svgContent = (svgContentEl == null ? void 0 : svgContentEl.innerHTML.trim()) || "";
|
|
1222
|
-
if (svgContentEl && svgContent) {
|
|
1223
|
-
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
1224
|
-
body: svgContent,
|
|
1225
|
-
// Set height and width from svg content
|
|
1226
|
-
height: svgContentEl.viewBox.baseVal.height,
|
|
1227
|
-
width: svgContentEl.viewBox.baseVal.width
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
if (volver) {
|
|
1232
|
-
if (props.src && !iconExists(`@${provider.value}:${props.prefix}:${props.name}`)) {
|
|
1233
|
-
show.value = false;
|
|
1234
|
-
volver.fetchIcon(props.src).then((svg) => {
|
|
1235
|
-
if (svg) {
|
|
1236
|
-
addIconFromSvg(svg);
|
|
1237
|
-
show.value = true;
|
|
1238
|
-
}
|
|
1239
|
-
}).catch((e) => {
|
|
1240
|
-
throw new Error(`Error during fetch icon: ${e == null ? void 0 : e.message}`);
|
|
1241
|
-
});
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
if (props.svg) {
|
|
1245
|
-
addIconFromSvg(props.svg);
|
|
1246
|
-
}
|
|
1247
|
-
return (_ctx, _cache) => {
|
|
1248
|
-
return unref(show) ? (openBlock(), createBlock(unref(Icon), mergeProps({
|
|
1249
|
-
key: 0,
|
|
1250
|
-
class: unref(bemCssClasses)
|
|
1251
|
-
}, {
|
|
1252
|
-
inline: _ctx.inline,
|
|
1253
|
-
width: _ctx.width,
|
|
1254
|
-
height: _ctx.height,
|
|
1255
|
-
horizontalFlip: _ctx.horizontalFlip,
|
|
1256
|
-
verticalFlip: _ctx.verticalFlip,
|
|
1257
|
-
flip: _ctx.flip,
|
|
1258
|
-
rotate: unref(hasRotate),
|
|
1259
|
-
color: _ctx.color,
|
|
1260
|
-
onLoad: _ctx.onLoad,
|
|
1261
|
-
icon: unref(icon)
|
|
1262
|
-
}), null, 16, ["class"])) : createCommentVNode("v-if", true);
|
|
1263
|
-
};
|
|
1264
|
-
}
|
|
1265
|
-
});
|
|
1266
1372
|
function useUniqueId(id) {
|
|
1267
1373
|
return computed(() => String((id == null ? void 0 : id.value) || useId()));
|
|
1268
1374
|
}
|
|
1269
|
-
function useComponentIcon(icon, iconPosition) {
|
|
1270
|
-
const hasIcon = computed(() => {
|
|
1271
|
-
if (typeof (icon == null ? void 0 : icon.value) === "string") {
|
|
1272
|
-
return { name: icon == null ? void 0 : icon.value };
|
|
1273
|
-
}
|
|
1274
|
-
return icon == null ? void 0 : icon.value;
|
|
1275
|
-
});
|
|
1276
|
-
const hasIconBefore = computed(
|
|
1277
|
-
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.before ? hasIcon.value : void 0
|
|
1278
|
-
);
|
|
1279
|
-
const hasIconAfter = computed(
|
|
1280
|
-
() => (iconPosition == null ? void 0 : iconPosition.value) === Position.after ? hasIcon.value : void 0
|
|
1281
|
-
);
|
|
1282
|
-
const hasIconLeft = computed(
|
|
1283
|
-
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.left ? hasIcon.value : void 0
|
|
1284
|
-
);
|
|
1285
|
-
const hasIconRight = computed(
|
|
1286
|
-
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.right ? hasIcon.value : void 0
|
|
1287
|
-
);
|
|
1288
|
-
const hasIconTop = computed(
|
|
1289
|
-
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.top ? hasIcon.value : void 0
|
|
1290
|
-
);
|
|
1291
|
-
const hasIconBottom = computed(
|
|
1292
|
-
() => (iconPosition == null ? void 0 : iconPosition.value) === Side.bottom ? hasIcon.value : void 0
|
|
1293
|
-
);
|
|
1294
|
-
return {
|
|
1295
|
-
hasIcon,
|
|
1296
|
-
hasIconLeft,
|
|
1297
|
-
hasIconRight,
|
|
1298
|
-
hasIconTop,
|
|
1299
|
-
hasIconBottom,
|
|
1300
|
-
hasIconBefore,
|
|
1301
|
-
hasIconAfter
|
|
1302
|
-
};
|
|
1303
|
-
}
|
|
1304
1375
|
const _hoisted_1$5 = {
|
|
1305
1376
|
key: 1,
|
|
1306
1377
|
class: "vv-button__label"
|
|
@@ -1399,7 +1470,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1399
1470
|
}
|
|
1400
1471
|
}
|
|
1401
1472
|
return (_ctx, _cache) => {
|
|
1402
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1473
|
+
return openBlock(), createBlock(_sfc_main$7, mergeProps({
|
|
1403
1474
|
...unref(attrs),
|
|
1404
1475
|
...unref(hasListeners),
|
|
1405
1476
|
disabled: unref(disabled),
|
|
@@ -1420,7 +1491,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1420
1491
|
default: withCtx(() => [
|
|
1421
1492
|
renderSlot(_ctx.$slots, "default", {}, () => [
|
|
1422
1493
|
_ctx.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }, () => [
|
|
1423
|
-
_ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$
|
|
1494
|
+
_ctx.loadingIcon ? (openBlock(), createBlock(_sfc_main$9, {
|
|
1424
1495
|
key: 0,
|
|
1425
1496
|
class: "vv-button__loading-icon",
|
|
1426
1497
|
name: _ctx.loadingIcon
|
|
@@ -1438,7 +1509,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
1438
1509
|
[
|
|
1439
1510
|
renderSlot(_ctx.$slots, "before"),
|
|
1440
1511
|
unref(hasIcon) ? (openBlock(), createBlock(
|
|
1441
|
-
_sfc_main$
|
|
1512
|
+
_sfc_main$9,
|
|
1442
1513
|
mergeProps({ key: 0 }, unref(hasIcon), { class: "vv-button__icon" }),
|
|
1443
1514
|
null,
|
|
1444
1515
|
16
|
|
@@ -2175,7 +2246,22 @@ const VvSelectProps = {
|
|
|
2175
2246
|
/**
|
|
2176
2247
|
* Select placeholder
|
|
2177
2248
|
*/
|
|
2178
|
-
placeholder: String
|
|
2249
|
+
placeholder: String,
|
|
2250
|
+
/**
|
|
2251
|
+
* VvIcon name for clear button
|
|
2252
|
+
* @see VvIcon
|
|
2253
|
+
*/
|
|
2254
|
+
iconClear: {
|
|
2255
|
+
type: [String, Object],
|
|
2256
|
+
default: ACTION_ICONS.clear
|
|
2257
|
+
},
|
|
2258
|
+
/**
|
|
2259
|
+
* Label for clear button
|
|
2260
|
+
*/
|
|
2261
|
+
labelClear: {
|
|
2262
|
+
type: String,
|
|
2263
|
+
default: "Clear"
|
|
2264
|
+
}
|
|
2179
2265
|
};
|
|
2180
2266
|
function useVvSelectProps() {
|
|
2181
2267
|
return {
|
|
@@ -2319,7 +2405,7 @@ const __default__$1 = {
|
|
|
2319
2405
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2320
2406
|
...__default__$1,
|
|
2321
2407
|
props: useVvSelectProps(),
|
|
2322
|
-
emits: ["update:modelValue", "focus", "blur"],
|
|
2408
|
+
emits: ["update:modelValue", "focus", "blur", "clear"],
|
|
2323
2409
|
setup(__props, { emit: __emit }) {
|
|
2324
2410
|
const props = __props;
|
|
2325
2411
|
const emit = __emit;
|
|
@@ -2385,6 +2471,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2385
2471
|
}
|
|
2386
2472
|
return localModelValue.value !== void 0 && localModelValue.value !== null;
|
|
2387
2473
|
});
|
|
2474
|
+
const isUnselectable = computed(() => {
|
|
2475
|
+
if (isDisabledOrReadonly.value) {
|
|
2476
|
+
return false;
|
|
2477
|
+
}
|
|
2478
|
+
return props.unselectable;
|
|
2479
|
+
});
|
|
2388
2480
|
const isVisible = useElementVisibility(selectEl);
|
|
2389
2481
|
watch(isVisible, (newValue) => {
|
|
2390
2482
|
if (newValue && props.autofocus) {
|
|
@@ -2434,6 +2526,14 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2434
2526
|
},
|
|
2435
2527
|
{ immediate: true }
|
|
2436
2528
|
);
|
|
2529
|
+
function onClear() {
|
|
2530
|
+
if (Array.isArray(localModelValue.value)) {
|
|
2531
|
+
localModelValue.value = [];
|
|
2532
|
+
} else {
|
|
2533
|
+
localModelValue.value = void 0;
|
|
2534
|
+
}
|
|
2535
|
+
emit("clear");
|
|
2536
|
+
}
|
|
2437
2537
|
const hasAttrs = computed(() => {
|
|
2438
2538
|
return {
|
|
2439
2539
|
"name": props.name,
|
|
@@ -2470,7 +2570,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2470
2570
|
])) : createCommentVNode("v-if", true),
|
|
2471
2571
|
createElementVNode("div", _hoisted_4$1, [
|
|
2472
2572
|
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
2473
|
-
_sfc_main$
|
|
2573
|
+
_sfc_main$9,
|
|
2474
2574
|
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-select__icon" }),
|
|
2475
2575
|
null,
|
|
2476
2576
|
16
|
|
@@ -2486,8 +2586,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2486
2586
|
_ctx.placeholder ? (openBlock(), createElementBlock("option", {
|
|
2487
2587
|
key: 0,
|
|
2488
2588
|
value: void 0,
|
|
2489
|
-
disabled: !
|
|
2490
|
-
hidden: !
|
|
2589
|
+
disabled: !unref(isUnselectable),
|
|
2590
|
+
hidden: !unref(isUnselectable)
|
|
2491
2591
|
}, toDisplayString(_ctx.placeholder), 9, _hoisted_6$1)) : createCommentVNode("v-if", true),
|
|
2492
2592
|
(openBlock(true), createElementBlock(
|
|
2493
2593
|
Fragment,
|
|
@@ -2531,9 +2631,16 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
2531
2631
|
], 16, _hoisted_5$1), [
|
|
2532
2632
|
[vModelSelect, unref(localModelValue)]
|
|
2533
2633
|
]),
|
|
2634
|
+
unref(isUnselectable) ? (openBlock(), createBlock(unref(VvInputClearAction), {
|
|
2635
|
+
key: 1,
|
|
2636
|
+
"input-type": "select",
|
|
2637
|
+
label: _ctx.labelClear,
|
|
2638
|
+
icon: _ctx.iconClear,
|
|
2639
|
+
onClear
|
|
2640
|
+
}, null, 8, ["label", "icon"])) : createCommentVNode("v-if", true),
|
|
2534
2641
|
unref(hasIconAfter) ? (openBlock(), createBlock(
|
|
2535
|
-
_sfc_main$
|
|
2536
|
-
mergeProps({ key:
|
|
2642
|
+
_sfc_main$9,
|
|
2643
|
+
mergeProps({ key: 2 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
|
|
2537
2644
|
null,
|
|
2538
2645
|
16
|
|
2539
2646
|
/* FULL_PROPS */
|
|
@@ -2616,7 +2723,7 @@ const __default__ = {
|
|
|
2616
2723
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2617
2724
|
...__default__,
|
|
2618
2725
|
props: useVvComboboxProps(),
|
|
2619
|
-
emits: ["update:modelValue", "update:search", "
|
|
2726
|
+
emits: ["update:modelValue", "update:search", "focus", "blur", "clear", "change:search"],
|
|
2620
2727
|
setup(__props, { emit: __emit }) {
|
|
2621
2728
|
const props = __props;
|
|
2622
2729
|
const emit = __emit;
|
|
@@ -2864,6 +2971,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2864
2971
|
collapse();
|
|
2865
2972
|
}
|
|
2866
2973
|
}
|
|
2974
|
+
function onClear() {
|
|
2975
|
+
localModelValue.value = [];
|
|
2976
|
+
emit("update:search", "");
|
|
2977
|
+
emit("clear");
|
|
2978
|
+
}
|
|
2867
2979
|
watch(
|
|
2868
2980
|
() => props.options,
|
|
2869
2981
|
(newValue) => {
|
|
@@ -2969,7 +3081,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2969
3081
|
])) : createCommentVNode("v-if", true),
|
|
2970
3082
|
createElementVNode("div", _hoisted_5, [
|
|
2971
3083
|
unref(hasIconBefore) ? (openBlock(), createBlock(
|
|
2972
|
-
_sfc_main$
|
|
3084
|
+
_sfc_main$9,
|
|
2973
3085
|
mergeProps({ key: 0 }, unref(hasIconBefore), { class: "vv-select__icon" }),
|
|
2974
3086
|
null,
|
|
2975
3087
|
16
|
|
@@ -3004,7 +3116,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3004
3116
|
Fragment,
|
|
3005
3117
|
{ key: 1 },
|
|
3006
3118
|
renderList(unref(selectedOptions), (option, index) => {
|
|
3007
|
-
return openBlock(), createBlock(_sfc_main$
|
|
3119
|
+
return openBlock(), createBlock(_sfc_main$8, {
|
|
3008
3120
|
key: index,
|
|
3009
3121
|
modifiers: _ctx.badgeModifiers,
|
|
3010
3122
|
class: "vv-select__badge"
|
|
@@ -3021,7 +3133,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3021
3133
|
type: "button",
|
|
3022
3134
|
onClick: withModifiers(($event) => onInput(option), ["stop"])
|
|
3023
3135
|
}, [
|
|
3024
|
-
createVNode(_sfc_main$
|
|
3136
|
+
createVNode(_sfc_main$9, { name: "close" })
|
|
3025
3137
|
], 8, _hoisted_8)) : createCommentVNode("v-if", true)
|
|
3026
3138
|
]),
|
|
3027
3139
|
_: 2
|
|
@@ -3049,9 +3161,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
3049
3161
|
))
|
|
3050
3162
|
])
|
|
3051
3163
|
], 16, _hoisted_6),
|
|
3164
|
+
unref(isUnselectable) ? (openBlock(), createBlock(unref(VvInputClearAction), {
|
|
3165
|
+
key: 1,
|
|
3166
|
+
"input-type": "select",
|
|
3167
|
+
label: _ctx.labelClear,
|
|
3168
|
+
icon: _ctx.iconClear,
|
|
3169
|
+
onClear
|
|
3170
|
+
}, null, 8, ["label", "icon"])) : createCommentVNode("v-if", true),
|
|
3052
3171
|
unref(hasIconAfter) ? (openBlock(), createBlock(
|
|
3053
|
-
_sfc_main$
|
|
3054
|
-
mergeProps({ key:
|
|
3172
|
+
_sfc_main$9,
|
|
3173
|
+
mergeProps({ key: 2 }, unref(hasIconAfter), { class: "vv-select__icon vv-select__icon-after" }),
|
|
3055
3174
|
null,
|
|
3056
3175
|
16
|
|
3057
3176
|
/* FULL_PROPS */
|