@volverjs/ui-vue 0.0.10-beta.75 → 0.0.10-beta.77
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/README.md +8 -8
- package/bin/icons.cjs +1 -1
- package/bin/icons.js +3 -3
- package/dist/components/VvAccordion/VvAccordion.es.js +9 -9
- package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
- package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +14 -15
- package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
- package/dist/components/VvAction/VvAction.es.js +10 -13
- package/dist/components/VvAction/VvAction.umd.js +1 -1
- package/dist/components/VvAlert/VvAlert.es.js +19 -19
- package/dist/components/VvAlert/VvAlert.umd.js +1 -1
- package/dist/components/VvAlertGroup/VvAlertGroup.es.js +19 -19
- package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.es.js +1 -1
- package/dist/components/VvAvatar/VvAvatar.umd.js +1 -1
- package/dist/components/VvAvatarGroup/VvAvatarGroup.es.js +7 -8
- package/dist/components/VvAvatarGroup/VvAvatarGroup.umd.js +1 -1
- package/dist/components/VvBadge/VvBadge.es.js +1 -1
- package/dist/components/VvBadge/VvBadge.umd.js +1 -1
- package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +12 -18
- package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
- package/dist/components/VvButton/VvButton.es.js +32 -38
- package/dist/components/VvButton/VvButton.umd.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.es.js +1 -1
- package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
- package/dist/components/VvCard/VvCard.es.js +1 -1
- package/dist/components/VvCard/VvCard.umd.js +1 -1
- package/dist/components/VvCheckbox/VvCheckbox.es.js +10 -12
- package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +15 -20
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.es.js +266 -285
- package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
- package/dist/components/VvCombobox/VvCombobox.vue.d.ts +22 -14
- package/dist/components/VvCombobox/index.d.ts +22 -0
- package/dist/components/VvDialog/VvDialog.es.js +5 -7
- package/dist/components/VvDialog/VvDialog.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.es.js +10 -15
- package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
- package/dist/components/VvDropdown/VvDropdown.vue.d.ts +2 -2
- package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +2 -2
- package/dist/components/VvDropdownAction/VvDropdownAction.es.js +11 -14
- package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
- package/dist/components/VvDropdownItem/VvDropdownItem.umd.js +1 -1
- package/dist/components/VvDropdownOptgroup/VvDropdownOptgroup.umd.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.es.js +1 -1
- package/dist/components/VvDropdownOption/VvDropdownOption.umd.js +1 -1
- package/dist/components/VvIcon/VvIcon.es.js +5 -5
- package/dist/components/VvIcon/VvIcon.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.es.js +45 -57
- package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
- package/dist/components/VvInputFile/VvInputFile.vue.d.ts +1 -1
- package/dist/components/VvInputText/VvInputText.es.js +54 -66
- package/dist/components/VvInputText/VvInputText.umd.js +1 -1
- package/dist/components/VvInputText/VvInputText.vue.d.ts +1 -1
- package/dist/components/VvNav/VvNav.es.js +16 -21
- package/dist/components/VvNav/VvNav.umd.js +1 -1
- package/dist/components/VvNavItem/VvNavItem.es.js +10 -13
- package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
- package/dist/components/VvNavSeparator/VvNavSeparator.umd.js +1 -1
- package/dist/components/VvProgress/VvProgress.es.js +1 -1
- package/dist/components/VvProgress/VvProgress.umd.js +1 -1
- package/dist/components/VvRadio/VvRadio.es.js +10 -12
- package/dist/components/VvRadio/VvRadio.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +15 -20
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.es.js +27 -30
- package/dist/components/VvSelect/VvSelect.umd.js +1 -1
- package/dist/components/VvSelect/VvSelect.vue.d.ts +3 -3
- package/dist/components/VvTab/VvTab.es.js +18 -25
- package/dist/components/VvTab/VvTab.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.es.js +47 -57
- package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
- package/dist/components/VvTextarea/VvTextarea.vue.d.ts +1 -1
- package/dist/components/VvTooltip/VvTooltip.es.js +1 -1
- package/dist/components/VvTooltip/VvTooltip.umd.js +1 -1
- package/dist/components/index.es.js +346 -394
- package/dist/components/index.umd.js +1 -1
- package/dist/composables/index.es.js +10 -15
- package/dist/composables/index.umd.js +1 -1
- package/dist/directives/index.es.js +9 -14
- package/dist/directives/index.umd.js +1 -1
- package/dist/directives/v-contextmenu.es.js +8 -13
- package/dist/directives/v-contextmenu.umd.js +1 -1
- package/dist/directives/v-tooltip.es.js +1 -1
- package/dist/directives/v-tooltip.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/dist/index.es.js +9 -12
- package/dist/index.umd.js +1 -1
- package/dist/resolvers/unplugin.es.js +1 -1
- package/dist/resolvers/unplugin.umd.js +1 -1
- package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +2 -2
- package/dist/stories/Combobox/Combobox.stories.d.ts +1 -0
- package/package.json +35 -32
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, isRef, defineComponent, h, inject, toRef, toRefs, useId, unref, useSlots, ref, createElementBlock, openBlock, normalizeClass, withDirectives, renderSlot, createVNode, createElementVNode, vModelRadio, createTextVNode, toDisplayString, createSlots, withCtx, normalizeProps, guardReactiveProps, provide, createCommentVNode, Fragment, renderList, createBlock, mergeProps } from "vue";
|
|
2
2
|
import { useVModel } from "@vueuse/core";
|
|
3
|
-
import {
|
|
3
|
+
import { getProperty } from "dot-prop";
|
|
4
4
|
var StorageType = /* @__PURE__ */ ((StorageType2) => {
|
|
5
5
|
StorageType2["local"] = "local";
|
|
6
6
|
StorageType2["session"] = "session";
|
|
@@ -386,7 +386,6 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
386
386
|
};
|
|
387
387
|
},
|
|
388
388
|
render() {
|
|
389
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
390
389
|
if (this.isVisible) {
|
|
391
390
|
let role;
|
|
392
391
|
if (this.hasInvalidLabelOrSlot) {
|
|
@@ -401,7 +400,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
401
400
|
{
|
|
402
401
|
role
|
|
403
402
|
},
|
|
404
|
-
|
|
403
|
+
this.$slots.loading?.() ?? this.loadingLabel
|
|
405
404
|
);
|
|
406
405
|
}
|
|
407
406
|
if (this.hasInvalidLabelOrSlot) {
|
|
@@ -410,7 +409,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
410
409
|
{
|
|
411
410
|
role
|
|
412
411
|
},
|
|
413
|
-
|
|
412
|
+
this.$slots.invalid?.() ?? this.$slots.invalid ?? this.invalidLabel
|
|
414
413
|
);
|
|
415
414
|
}
|
|
416
415
|
if (this.hasValidLabelOrSlot) {
|
|
@@ -419,7 +418,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
419
418
|
{
|
|
420
419
|
role
|
|
421
420
|
},
|
|
422
|
-
|
|
421
|
+
this.$slots.valid?.() ?? this.validLabel
|
|
423
422
|
);
|
|
424
423
|
}
|
|
425
424
|
return h(
|
|
@@ -427,7 +426,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
427
426
|
{
|
|
428
427
|
role
|
|
429
428
|
},
|
|
430
|
-
|
|
429
|
+
this.$slots.hint?.() ?? this.$slots.hint ?? this.hintLabel
|
|
431
430
|
);
|
|
432
431
|
}
|
|
433
432
|
return null;
|
|
@@ -446,7 +445,7 @@ function useGroupStateInject(groupKey) {
|
|
|
446
445
|
const group = inject(groupKey, void 0);
|
|
447
446
|
const isInGroup = computed(() => group !== void 0);
|
|
448
447
|
function getGroupOrLocalRef(propName, props, emit) {
|
|
449
|
-
const groupPropValue = group
|
|
448
|
+
const groupPropValue = group?.[propName];
|
|
450
449
|
if (groupPropValue) {
|
|
451
450
|
return computed({
|
|
452
451
|
get() {
|
|
@@ -484,10 +483,10 @@ function useGroupProps(props, emit) {
|
|
|
484
483
|
const valid = getGroupOrLocalRef("valid", props);
|
|
485
484
|
const invalid = getGroupOrLocalRef("invalid", props);
|
|
486
485
|
const readonly = computed(
|
|
487
|
-
() => Boolean(props.readonly ||
|
|
486
|
+
() => Boolean(props.readonly || group?.readonly.value)
|
|
488
487
|
);
|
|
489
488
|
const disabled = computed(
|
|
490
|
-
() => Boolean(props.disabled ||
|
|
489
|
+
() => Boolean(props.disabled || group?.disabled.value)
|
|
491
490
|
);
|
|
492
491
|
return {
|
|
493
492
|
// local props
|
|
@@ -508,8 +507,7 @@ function useVolver() {
|
|
|
508
507
|
function useDefaults(componentName, propsDefinition, props) {
|
|
509
508
|
const volver = useVolver();
|
|
510
509
|
const volverComponentDefaults = computed(() => {
|
|
511
|
-
|
|
512
|
-
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
510
|
+
if (!volver || !volver.defaults.value?.[componentName]) {
|
|
513
511
|
return void 0;
|
|
514
512
|
}
|
|
515
513
|
return volver.defaults.value[componentName];
|
|
@@ -559,14 +557,14 @@ function useDefaults(componentName, propsDefinition, props) {
|
|
|
559
557
|
});
|
|
560
558
|
}
|
|
561
559
|
function useUniqueId(id) {
|
|
562
|
-
return computed(() => String(
|
|
560
|
+
return computed(() => String(id?.value || useId()));
|
|
563
561
|
}
|
|
564
562
|
function useModifiers(prefix, modifiers, others) {
|
|
565
563
|
return computed(() => {
|
|
566
564
|
const toReturn = {
|
|
567
565
|
[prefix]: true
|
|
568
566
|
};
|
|
569
|
-
const modifiersArray = typeof
|
|
567
|
+
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
570
568
|
if (modifiersArray) {
|
|
571
569
|
if (Array.isArray(modifiersArray)) {
|
|
572
570
|
modifiersArray.forEach((modifier) => {
|
|
@@ -735,7 +733,7 @@ function useOptions(props) {
|
|
|
735
733
|
return labelKey.value(option);
|
|
736
734
|
}
|
|
737
735
|
return String(
|
|
738
|
-
labelKey.value ?
|
|
736
|
+
labelKey.value ? getProperty(option, labelKey.value) : option
|
|
739
737
|
);
|
|
740
738
|
};
|
|
741
739
|
const getOptionValue = (option) => {
|
|
@@ -745,7 +743,7 @@ function useOptions(props) {
|
|
|
745
743
|
if (typeof valueKey.value === "function") {
|
|
746
744
|
return valueKey.value(option);
|
|
747
745
|
}
|
|
748
|
-
return valueKey.value ?
|
|
746
|
+
return valueKey.value ? getProperty(option, valueKey.value) : option;
|
|
749
747
|
};
|
|
750
748
|
const isOptionDisabled = (option) => {
|
|
751
749
|
if (typeof option === "string") {
|
|
@@ -754,7 +752,7 @@ function useOptions(props) {
|
|
|
754
752
|
if (typeof disabledKey.value === "function") {
|
|
755
753
|
return disabledKey.value(option);
|
|
756
754
|
}
|
|
757
|
-
return disabledKey.value ?
|
|
755
|
+
return disabledKey.value ? Boolean(getProperty(option, disabledKey.value)) : false;
|
|
758
756
|
};
|
|
759
757
|
const getOptionGrouped = (option) => {
|
|
760
758
|
if (typeof option == "string") {
|
|
@@ -842,10 +840,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
842
840
|
renderList(_ctx.options, (option, index) => {
|
|
843
841
|
return openBlock(), createBlock(
|
|
844
842
|
_sfc_main$1,
|
|
845
|
-
mergeProps({
|
|
846
|
-
key: index,
|
|
847
|
-
ref_for: true
|
|
848
|
-
}, getOptionProps(option, index)),
|
|
843
|
+
mergeProps({ key: index }, { ref_for: true }, getOptionProps(option, index)),
|
|
849
844
|
null,
|
|
850
845
|
16
|
|
851
846
|
/* FULL_PROPS */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadioGroup=t(e.vue,e.core,e.tsDotProp)}(this,(function(e,t,l){"use strict";var a=(e=>(e.local="local",e.session="session",e))(a||{}),o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{});const u=Symbol.for("volver"),d=Symbol.for("radioGroup"),s={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},v={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},f={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},p={disabled:{type:Boolean,default:!1}},c={required:{type:Boolean,default:!1}},m={label:{type:[String,Number],default:void 0}},b={readonly:{type:Boolean,default:!1}},y={modifiers:{type:[String,Array],default:void 0}},g={hintLabel:{type:String,default:""}},h={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};i.before;const S={tabindex:{type:[String,Number],default:0}},L={id:[String,Number]};o.bottom;const O={...{...L,name:{type:String,required:!0}},...S,...s,...v,...g,...p,...b,...y,...m,...f,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},k={...s,...v,...h,...g,...p,...b,...y,...m,...f,...c,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};n.button,r.button,a.local;const V=k;function $(e,t,l){return B(e,t)}function B(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,i,n;if(l&&a){if(i=e.length,i!==t.length)return!1;for(o=i;0!==o--;)if(!B(e[o],t[o]))return!1;return!0}if(l!==a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!==u)return!1;if(r&&u)return e.getTime()===t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!==s)return!1;if(d&&s)return e.toString()===t.toString();const v=Object.keys(e);if(i=v.length,i!==Object.keys(t).length)return!1;for(o=i;0!==o--;)if(!Object.prototype.hasOwnProperty.call(t,v[o]))return!1;for(o=i;0!==o--;)if(n=v[o],!B(e[n],t[n]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function R(e){return Array.isArray(e)?e.filter((e=>"string"==typeof e)).join(" "):e}function x(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>R(a.value.invalidLabel))),i=e.computed((()=>R(a.value.validLabel))),n=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||n.value)))),d=e.computed((()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||i.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),f=e.computed((()=>d.value||s.value||u.value||v.value)),p=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),c=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:o,validLabel:i,loadingLabel:n,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,i,n,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(o=(a=this.$slots).invalid)?void 0:o.call(a))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(n=(i=this.$slots).valid)?void 0:n.call(i))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:c}}const N=O;function A(t,l){const{id:a}=e.toRefs(t),{group:o,isInGroup:i,getGroupOrLocalRef:n}=function(t){const l=e.inject(t,void 0),a=e.computed((()=>void 0!==l));return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){const i=null==l?void 0:l[t];if(i)return e.computed({get:()=>i.value,set(e){i.value=e}});const n=e.toRef(a,t);return e.computed({get:()=>n.value,set(e){o&&o(`update:${t}`,e)}})}}}(d),r=n("modelValue",t,l),u=n("valid",t),s=n("invalid",t),v=e.computed((()=>Boolean(t.readonly||(null==o?void 0:o.readonly.value)))),f=e.computed((()=>Boolean(t.disabled||(null==o?void 0:o.disabled.value))));return{id:a,group:o,isInGroup:i,modelValue:r,valid:u,invalid:s,readonly:v,disabled:f}}function P(t,l,a){const o=e.inject(u,void 0),i=e.computed((()=>{var e;if(o&&(null==(e=o.defaults.value)?void 0:e[t]))return o.defaults.value[t]}));return e.computed((()=>{if(void 0===i.value)return a;const e=i.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const i=o[a];if(l[a]=i,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===i&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===i&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(i)&&(l[a]=e[a]):o===i&&(l[a]=e[a])}}return l}),{})}))}function C(t,l,a){return e.computed((()=>{const o={[t]:!0},i="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return i&&Array.isArray(i)&&i.forEach((e=>{e&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const j=["for"],_=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],w=e.defineComponent({name:"VvRadio",props:N,emits:["click","update:modelValue","change","blur"],setup(t,{emit:l}){const a=t,o=l,i=e.useSlots(),n=P("VvRadio",N,a),{id:r,disabled:u,readonly:d,modelValue:s,valid:v,invalid:f}=A(a,o),p=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(r),c=e.computed((()=>`${p.value}-hint`)),m=e.computed((()=>y.value?-1:a.tabindex)),b=e.ref(),y=e.computed((()=>u.value||d.value)),g=e.computed((()=>!0===f.value||!0!==v.value&&void 0)),h=e.computed((()=>Array.isArray(s.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if($(e,l))return!0;return!1}(a.value,s.value):$(a.value,s.value))),S=e.computed((()=>!["string","number","boolean"].includes(typeof a.value)||a.value)),L=e.computed({get:()=>h.value?S.value:null,set(e){Array.isArray(s.value)?s.value=[a.value]:s.value=a.value,o("change",e)}}),{modifiers:O}=e.toRefs(a),k=C("vv-radio",O,e.computed((()=>({valid:v.value,invalid:f.value,disabled:u.value,readonly:d.value})))),{HintSlot:V,hasHintLabelOrSlot:B,hasInvalidLabelOrSlot:R,hintSlotScope:w}=x(n,i);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(k)),for:e.unref(p)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(p),ref_key:"input",ref:b,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(L)?L.value=t:null),type:"radio",class:"vv-radio__input",name:t.name,disabled:e.unref(y),value:e.unref(S),tabindex:e.unref(m),"aria-invalid":e.unref(g),"aria-describedby":e.unref(B)?e.unref(c):void 0,"aria-errormessage":e.unref(R)?e.unref(c):void 0},null,8,_),[[e.vModelRadio,e.unref(L)]]),e.renderSlot(t.$slots,"default",{value:e.unref(s)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(V),{id:e.unref(c),class:"vv-radio__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))])),key:"3"}:void 0]),1032,["id"])],10,j))}});const z=["textContent"],q={class:"vv-radio-group__wrapper"};return e.defineComponent({name:"VvRadioGroup",props:V,emits:["update:modelValue","change"],setup(a,{emit:o}){const i=a,n=o,r=e.useSlots(),u=P("VvRadioGroup",V,i),s=t.useVModel(i,"modelValue",n),{disabled:v,readonly:f,vertical:p,valid:c,invalid:m,modifiers:b}=e.toRefs(i);var y,g;y=d,g={modelValue:s,disabled:v,readonly:f,valid:c,invalid:m},e.provide(y,g);const{getOptionLabel:h,getOptionValue:S,isOptionDisabled:L}=function(t){const{options:a,labelKey:o,valueKey:i,disabledKey:n}=e.toRefs(t);return{options:a,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof o.value?o.value(e):String(o.value?l.get(e,o.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof i.value?i.value(e):i.value?l.get(e,i.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof n.value?n.value(e):!!n.value&&l.get(e,n.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(i),O=C("vv-radio-group",b,e.computed((()=>({disabled:v.value,readonly:f.value,required:i.required,horizontal:!p.value,valid:c.value,invalid:m.value}))));const{HintSlot:k,hintSlotScope:$}=x(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(O))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,z)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",q,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(w,e.mergeProps({key:l,ref_for:!0},function(e,t){return{id:`${i.name}_opt${t}`,name:i.name,label:h(e),value:S(e),required:i.required,disabled:L(e)}}(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(k),{class:"vv-radio-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref($))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref($))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref($))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref($))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@vueuse/core"),require("dot-prop")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvRadioGroup=t(e.vue,e.core,e.dotProp)}(this,function(e,t,l){"use strict";var a=(e=>(e.local="local",e.session="session",e))(a||{}),o=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(o||{}),i=(e=>(e.before="before",e.after="after",e))(i||{}),n=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(n||{}),r=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(r||{});const u=Symbol.for("volver"),d=Symbol.for("radioGroup"),s={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},v={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},f={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},p={disabled:{type:Boolean,default:!1}},c={required:{type:Boolean,default:!1}},m={label:{type:[String,Number],default:void 0}},b={readonly:{type:Boolean,default:!1}},y={modifiers:{type:[String,Array],default:void 0}},g={hintLabel:{type:String,default:""}},h={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};i.before;const S={tabindex:{type:[String,Number],default:0}},L={id:[String,Number]};o.bottom;const O={...{...L,name:{type:String,required:!0}},...S,...s,...v,...g,...p,...b,...y,...m,...f,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},k={...s,...v,...h,...g,...p,...b,...y,...m,...f,...c,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};n.button,r.button,a.local;const V=k;function $(e,t,l){return B(e,t)}function B(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),a=Array.isArray(t);let o,i,n;if(l&&a){if(i=e.length,i!==t.length)return!1;for(o=i;0!==o--;)if(!B(e[o],t[o]))return!1;return!0}if(l!==a)return!1;const r=e instanceof Date,u=t instanceof Date;if(r!==u)return!1;if(r&&u)return e.getTime()===t.getTime();const d=e instanceof RegExp,s=t instanceof RegExp;if(d!==s)return!1;if(d&&s)return e.toString()===t.toString();const v=Object.keys(e);if(i=v.length,i!==Object.keys(t).length)return!1;for(o=i;0!==o--;)if(!Object.prototype.hasOwnProperty.call(t,v[o]))return!1;for(o=i;0!==o--;)if(n=v[o],!B(e[n],t[n]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function R(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).join(" "):e}function P(t,l){const a=e.computed(()=>e.isRef(t)?t.value:t),o=e.computed(()=>R(a.value.invalidLabel)),i=e.computed(()=>R(a.value.validLabel)),n=e.computed(()=>a.value.loadingLabel),r=e.computed(()=>a.value.hintLabel),u=e.computed(()=>Boolean(a.value.loading&&(l.loading||n.value))),d=e.computed(()=>!u.value&&Boolean(a.value.invalid&&(l.invalid||o.value))),s=e.computed(()=>!u.value&&!d.value&&Boolean(a.value.valid&&(l.valid||i.value))),v=e.computed(()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value)),f=e.computed(()=>d.value||s.value||u.value||v.value),p=e.computed(()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading})),c=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:f,invalidLabel:o,validLabel:i,loadingLabel:n,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){if(this.isVisible){let t;return this.hasInvalidLabelOrSlot&&(t="alert"),this.hasValidLabelOrSlot&&(t="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:t},this.$slots.loading?.()??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:t},this.$slots.invalid?.()??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:t},this.$slots.valid?.()??this.validLabel):e.h(this.tag,{role:t},this.$slots.hint?.()??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:c}}const x=O;function N(t,l){const{id:a}=e.toRefs(t),{group:o,isInGroup:i,getGroupOrLocalRef:n}=function(t){const l=e.inject(t,void 0),a=e.computed(()=>void 0!==l);return{group:l,isInGroup:a,getGroupOrLocalRef:function(t,a,o){const i=l?.[t];if(i)return e.computed({get:()=>i.value,set(e){i.value=e}});const n=e.toRef(a,t);return e.computed({get:()=>n.value,set(e){o&&o(`update:${t}`,e)}})}}}(d),r=n("modelValue",t,l),u=n("valid",t),s=n("invalid",t),v=e.computed(()=>Boolean(t.readonly||o?.readonly.value)),f=e.computed(()=>Boolean(t.disabled||o?.disabled.value));return{id:a,group:o,isInGroup:i,modelValue:r,valid:u,invalid:s,readonly:v,disabled:f}}function A(t,l,a){const o=e.inject(u,void 0),i=e.computed(()=>{if(o&&o.defaults.value?.[t])return o.defaults.value[t]});return e.computed(()=>{if(void 0===i.value)return a;const e=i.value,t=l,o=a;return Object.keys(t).reduce((l,a)=>{const i=o[a];if(l[a]=i,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===i&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===i&&(l[a]=e[a])}if("object"==typeof t[a]){let o=t[a].default;"function"==typeof o&&(o=o()),"object"==typeof o?JSON.stringify(o)===JSON.stringify(i)&&(l[a]=e[a]):o===i&&(l[a]=e[a])}}return l},{})})}function C(t,l,a){return e.computed(()=>{const o={[t]:!0},i="string"==typeof l?.value?l.value.split(" "):l?.value;return i&&Array.isArray(i)&&i.forEach(e=>{e&&(o[`${t}--${e}`]=!0)}),a&&Object.keys(a.value).forEach(l=>{o[`${t}--${l}`]=e.unref(a.value[l])}),o})}const j=["for"],_=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],w=e.defineComponent({name:"VvRadio",props:x,emits:["click","update:modelValue","change","blur"],setup(t,{emit:l}){const a=t,o=l,i=e.useSlots(),n=A("VvRadio",x,a),{id:r,disabled:u,readonly:d,modelValue:s,valid:v,invalid:f}=N(a,o),p=function(t){return e.computed(()=>String(t?.value||e.useId()))}(r),c=e.computed(()=>`${p.value}-hint`),m=e.computed(()=>y.value?-1:a.tabindex),b=e.ref(),y=e.computed(()=>u.value||d.value),g=e.computed(()=>!0===f.value||!0!==v.value&&void 0),h=e.computed(()=>Array.isArray(s.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if($(e,l))return!0;return!1}(a.value,s.value):$(a.value,s.value)),S=e.computed(()=>!["string","number","boolean"].includes(typeof a.value)||a.value),L=e.computed({get:()=>h.value?S.value:null,set(e){Array.isArray(s.value)?s.value=[a.value]:s.value=a.value,o("change",e)}}),{modifiers:O}=e.toRefs(a),k=C("vv-radio",O,e.computed(()=>({valid:v.value,invalid:f.value,disabled:u.value,readonly:d.value}))),{HintSlot:V,hasHintLabelOrSlot:B,hasInvalidLabelOrSlot:R,hintSlotScope:w}=P(n,i);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(k)),for:e.unref(p)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(p),ref_key:"input",ref:b,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(L)?L.value=t:null),type:"radio",class:"vv-radio__input",name:t.name,disabled:e.unref(y),value:e.unref(S),tabindex:e.unref(m),"aria-invalid":e.unref(g),"aria-describedby":e.unref(B)?e.unref(c):void 0,"aria-errormessage":e.unref(R)?e.unref(c):void 0},null,8,_),[[e.vModelRadio,e.unref(L)]]),e.renderSlot(t.$slots,"default",{value:e.unref(s)},()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),e.createVNode(e.unref(V),{id:e.unref(c),class:"vv-radio__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(w))))]),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(w))))]),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))]),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(w))))]),key:"3"}:void 0]),1032,["id"])],10,j))}});const z=["textContent"],q={class:"vv-radio-group__wrapper"};return e.defineComponent({name:"VvRadioGroup",props:V,emits:["update:modelValue","change"],setup(a,{emit:o}){const i=a,n=o,r=e.useSlots(),u=A("VvRadioGroup",V,i),s=t.useVModel(i,"modelValue",n),{disabled:v,readonly:f,vertical:p,valid:c,invalid:m,modifiers:b}=e.toRefs(i);var y,g;y=d,g={modelValue:s,disabled:v,readonly:f,valid:c,invalid:m},e.provide(y,g);const{getOptionLabel:h,getOptionValue:S,isOptionDisabled:L}=function(t){const{options:a,labelKey:o,valueKey:i,disabledKey:n}=e.toRefs(t);return{options:a,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof o.value?o.value(e):String(o.value?l.getProperty(e,o.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof i.value?i.value(e):i.value?l.getProperty(e,i.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof n.value?n.value(e):!!n.value&&Boolean(l.getProperty(e,n.value))),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(i),O=C("vv-radio-group",b,e.computed(()=>({disabled:v.value,readonly:f.value,required:i.required,horizontal:!p.value,valid:c.value,invalid:m.value})));const{HintSlot:k,hintSlotScope:$}=P(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(O))},[t.label?(e.openBlock(),e.createElementBlock("legend",{key:0,textContent:e.toDisplayString(t.label)},null,8,z)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",q,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,(t,l)=>(e.openBlock(),e.createBlock(w,e.mergeProps({key:l},{ref_for:!0},function(e,t){return{id:`${i.name}_opt${t}`,name:i.name,label:h(e),value:S(e),required:i.required,disabled:L(e)}}(t,l)),null,16))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(k),{class:"vv-radio-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref($))))]),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref($))))]),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref($))))]),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref($))))]),key:"3"}:void 0]),1024)],2))}})});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, isRef, defineComponent, h, inject, unref, mergeDefaults, ref, toRefs, createBlock, createCommentVNode, openBlock, mergeProps, watch, useId, useSlots, createElementBlock, normalizeClass, createElementVNode, createVNode, toDisplayString, renderSlot, normalizeProps, guardReactiveProps, withDirectives, Fragment, renderList, vModelSelect, createSlots, withCtx } from "vue";
|
|
2
2
|
import { iconLoaded, Icon, addIcon } from "@iconify/vue";
|
|
3
3
|
import { useFocus, useElementVisibility } from "@vueuse/core";
|
|
4
|
-
import {
|
|
4
|
+
import { getProperty } from "dot-prop";
|
|
5
5
|
const ACTION_ICONS = {
|
|
6
6
|
clear: "close"
|
|
7
7
|
};
|
|
@@ -394,7 +394,6 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
394
394
|
};
|
|
395
395
|
},
|
|
396
396
|
render() {
|
|
397
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
398
397
|
if (this.isVisible) {
|
|
399
398
|
let role;
|
|
400
399
|
if (this.hasInvalidLabelOrSlot) {
|
|
@@ -409,7 +408,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
409
408
|
{
|
|
410
409
|
role
|
|
411
410
|
},
|
|
412
|
-
|
|
411
|
+
this.$slots.loading?.() ?? this.loadingLabel
|
|
413
412
|
);
|
|
414
413
|
}
|
|
415
414
|
if (this.hasInvalidLabelOrSlot) {
|
|
@@ -418,7 +417,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
418
417
|
{
|
|
419
418
|
role
|
|
420
419
|
},
|
|
421
|
-
|
|
420
|
+
this.$slots.invalid?.() ?? this.$slots.invalid ?? this.invalidLabel
|
|
422
421
|
);
|
|
423
422
|
}
|
|
424
423
|
if (this.hasValidLabelOrSlot) {
|
|
@@ -427,7 +426,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
427
426
|
{
|
|
428
427
|
role
|
|
429
428
|
},
|
|
430
|
-
|
|
429
|
+
this.$slots.valid?.() ?? this.validLabel
|
|
431
430
|
);
|
|
432
431
|
}
|
|
433
432
|
return h(
|
|
@@ -435,7 +434,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
435
434
|
{
|
|
436
435
|
role
|
|
437
436
|
},
|
|
438
|
-
|
|
437
|
+
this.$slots.hint?.() ?? this.$slots.hint ?? this.hintLabel
|
|
439
438
|
);
|
|
440
439
|
}
|
|
441
440
|
return null;
|
|
@@ -458,7 +457,7 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
458
457
|
const toReturn = {
|
|
459
458
|
[prefix]: true
|
|
460
459
|
};
|
|
461
|
-
const modifiersArray = typeof
|
|
460
|
+
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
462
461
|
if (modifiersArray) {
|
|
463
462
|
if (Array.isArray(modifiersArray)) {
|
|
464
463
|
modifiersArray.forEach((modifier) => {
|
|
@@ -512,7 +511,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
512
511
|
const { modifiers } = toRefs(props);
|
|
513
512
|
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
514
513
|
const provider = computed(() => {
|
|
515
|
-
return props.provider ||
|
|
514
|
+
return props.provider || volver?.iconsProvider;
|
|
516
515
|
});
|
|
517
516
|
const icon = computed(() => {
|
|
518
517
|
const name = props.name ?? "";
|
|
@@ -520,7 +519,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
520
519
|
if (iconLoaded(iconName)) {
|
|
521
520
|
return iconName;
|
|
522
521
|
}
|
|
523
|
-
const iconsCollection = volver
|
|
522
|
+
const iconsCollection = volver?.iconsCollections.find(
|
|
524
523
|
(iconsCollection2) => {
|
|
525
524
|
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
526
525
|
return iconLoaded(icon2);
|
|
@@ -544,7 +543,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
544
543
|
}
|
|
545
544
|
function addIconFromSvg(svg) {
|
|
546
545
|
const svgContentEl = getSvgContent(svg);
|
|
547
|
-
const svgContent =
|
|
546
|
+
const svgContent = svgContentEl?.innerHTML.trim() || "";
|
|
548
547
|
if (svgContentEl && svgContent) {
|
|
549
548
|
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
550
549
|
body: svgContent,
|
|
@@ -563,7 +562,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
563
562
|
show.value = true;
|
|
564
563
|
}
|
|
565
564
|
}).catch((e) => {
|
|
566
|
-
throw new Error(`Error during fetch icon: ${e
|
|
565
|
+
throw new Error(`Error during fetch icon: ${e?.message}`);
|
|
567
566
|
});
|
|
568
567
|
}
|
|
569
568
|
}
|
|
@@ -590,28 +589,28 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
590
589
|
});
|
|
591
590
|
function useComponentIcon(icon, iconPosition) {
|
|
592
591
|
const hasIcon = computed(() => {
|
|
593
|
-
if (typeof
|
|
594
|
-
return { name: icon
|
|
592
|
+
if (typeof icon?.value === "string") {
|
|
593
|
+
return { name: icon?.value };
|
|
595
594
|
}
|
|
596
|
-
return icon
|
|
595
|
+
return icon?.value;
|
|
597
596
|
});
|
|
598
597
|
const hasIconBefore = computed(
|
|
599
|
-
() =>
|
|
598
|
+
() => iconPosition?.value === Position.before ? hasIcon.value : void 0
|
|
600
599
|
);
|
|
601
600
|
const hasIconAfter = computed(
|
|
602
|
-
() =>
|
|
601
|
+
() => iconPosition?.value === Position.after ? hasIcon.value : void 0
|
|
603
602
|
);
|
|
604
603
|
const hasIconLeft = computed(
|
|
605
|
-
() =>
|
|
604
|
+
() => iconPosition?.value === Side.left ? hasIcon.value : void 0
|
|
606
605
|
);
|
|
607
606
|
const hasIconRight = computed(
|
|
608
|
-
() =>
|
|
607
|
+
() => iconPosition?.value === Side.right ? hasIcon.value : void 0
|
|
609
608
|
);
|
|
610
609
|
const hasIconTop = computed(
|
|
611
|
-
() =>
|
|
610
|
+
() => iconPosition?.value === Side.top ? hasIcon.value : void 0
|
|
612
611
|
);
|
|
613
612
|
const hasIconBottom = computed(
|
|
614
|
-
() =>
|
|
613
|
+
() => iconPosition?.value === Side.bottom ? hasIcon.value : void 0
|
|
615
614
|
);
|
|
616
615
|
return {
|
|
617
616
|
hasIcon,
|
|
@@ -649,7 +648,7 @@ const VvInputClearAction = defineComponent({
|
|
|
649
648
|
setup(props, { emit }) {
|
|
650
649
|
const { hasIcon } = useComponentIcon(computed(() => props.icon));
|
|
651
650
|
function onClick(e) {
|
|
652
|
-
e
|
|
651
|
+
e?.stopPropagation();
|
|
653
652
|
if (!props.disabled) {
|
|
654
653
|
emit("clear");
|
|
655
654
|
}
|
|
@@ -680,8 +679,7 @@ const VvInputClearAction = defineComponent({
|
|
|
680
679
|
function useDefaults(componentName, propsDefinition, props) {
|
|
681
680
|
const volver = useVolver();
|
|
682
681
|
const volverComponentDefaults = computed(() => {
|
|
683
|
-
|
|
684
|
-
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
682
|
+
if (!volver || !volver.defaults.value?.[componentName]) {
|
|
685
683
|
return void 0;
|
|
686
684
|
}
|
|
687
685
|
return volver.defaults.value[componentName];
|
|
@@ -740,7 +738,7 @@ function useComponentFocus(inputTemplateRef, emit) {
|
|
|
740
738
|
};
|
|
741
739
|
}
|
|
742
740
|
function useUniqueId(id) {
|
|
743
|
-
return computed(() => String(
|
|
741
|
+
return computed(() => String(id?.value || useId()));
|
|
744
742
|
}
|
|
745
743
|
function useOptions(props) {
|
|
746
744
|
const { options, labelKey, valueKey, disabledKey } = toRefs(props);
|
|
@@ -752,7 +750,7 @@ function useOptions(props) {
|
|
|
752
750
|
return labelKey.value(option);
|
|
753
751
|
}
|
|
754
752
|
return String(
|
|
755
|
-
labelKey.value ?
|
|
753
|
+
labelKey.value ? getProperty(option, labelKey.value) : option
|
|
756
754
|
);
|
|
757
755
|
};
|
|
758
756
|
const getOptionValue = (option) => {
|
|
@@ -762,7 +760,7 @@ function useOptions(props) {
|
|
|
762
760
|
if (typeof valueKey.value === "function") {
|
|
763
761
|
return valueKey.value(option);
|
|
764
762
|
}
|
|
765
|
-
return valueKey.value ?
|
|
763
|
+
return valueKey.value ? getProperty(option, valueKey.value) : option;
|
|
766
764
|
};
|
|
767
765
|
const isOptionDisabled = (option) => {
|
|
768
766
|
if (typeof option === "string") {
|
|
@@ -771,7 +769,7 @@ function useOptions(props) {
|
|
|
771
769
|
if (typeof disabledKey.value === "function") {
|
|
772
770
|
return disabledKey.value(option);
|
|
773
771
|
}
|
|
774
|
-
return disabledKey.value ?
|
|
772
|
+
return disabledKey.value ? Boolean(getProperty(option, disabledKey.value)) : false;
|
|
775
773
|
};
|
|
776
774
|
const getOptionGrouped = (option) => {
|
|
777
775
|
if (typeof option == "string") {
|
|
@@ -832,11 +830,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
832
830
|
} = HintSlotFactory(propsDefaults, slots);
|
|
833
831
|
const { focused } = useComponentFocus(selectEl, emit);
|
|
834
832
|
function isGroup(option) {
|
|
835
|
-
var _a;
|
|
836
833
|
if (typeof option === "string") {
|
|
837
834
|
return false;
|
|
838
835
|
}
|
|
839
|
-
return
|
|
836
|
+
return option.options?.length;
|
|
840
837
|
}
|
|
841
838
|
const {
|
|
842
839
|
id,
|
|
@@ -926,7 +923,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
926
923
|
watch(
|
|
927
924
|
() => props.options,
|
|
928
925
|
(newValue) => {
|
|
929
|
-
if (
|
|
926
|
+
if (newValue?.length && props.autoselectFirst && !isDirty.value) {
|
|
930
927
|
const firstOptionValue = getOptionValue(newValue[0]);
|
|
931
928
|
localModelValue.value = props.multiple ? [firstOptionValue] : firstOptionValue;
|
|
932
929
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("@vueuse/core"),require("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvSelect=t(e.vue,e.vue$1,e.core,e.tsDotProp)}(this,(function(e,t,l,o){"use strict";const a={prefix:"normal"};var n=(e=>(e.local="local",e.session="session",e))(n||{}),i=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(i||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{}),d=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(d||{});const s=Symbol.for("volver"),c={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},v={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},p={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},f={disabled:{type:Boolean,default:!1}},m={showClearAction:{type:Boolean,default:!1},iconClear:{type:[String,Object],default:"close"},labelClear:{type:String,default:"Clear"}},b={label:{type:[String,Number],default:void 0}},h={readonly:{type:Boolean,default:!1}},y={modifiers:{type:[String,Array],default:void 0}},g={hintLabel:{type:String,default:""}},S={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},B={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:r.before,validation:e=>Object.values(r).includes(e)}},k={tabindex:{type:[String,Number],default:0}},L={floating:{type:Boolean,default:!1}},$={unselectable:{type:Boolean,default:!0}},V={id:[String,Number]};i.bottom;const O={...V,name:{type:String,required:!0}},C={autofocus:{type:Boolean,default:!1}},w={autocomplete:{type:String,default:"off"}};u.button,d.button,n.local;const I={...O,...C,...w,...k,...c,...v,...g,...p,...f,...h,...y,...S,...B,...L,...$,...b,...m,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},autoselectFirst:{type:Boolean,default:!1},placeholder:String};function P(){return{...I,options:{...I.options,type:Array,default:()=>[]}}}function x(e){return Array.isArray(e)?e.filter((e=>"string"==typeof e)).join(" "):e}function A(){return e.inject(s,void 0)}function _(t,l,o){return e.computed((()=>{const a={[t]:!0},n="string"==typeof(null==l?void 0:l.value)?l.value.split(" "):null==l?void 0:l.value;return n&&Array.isArray(n)&&n.forEach((e=>{e&&(a[`${t}--${e}`]=!0)})),o&&Object.keys(o.value).forEach((l=>{a[`${t}--${l}`]=e.unref(o.value[l])})),a}))}const E=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},a),setup(l){const o=l,a=e.computed((()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate)),n=e.ref(!0),i=A(),{modifiers:r}=e.toRefs(o),u=_("vv-icon",r),d=e.computed((()=>o.provider||(null==i?void 0:i.iconsProvider))),s=e.computed((()=>{const e=o.name??"",l=`@${d.value}:${o.prefix}:${e}`;if(t.iconLoaded(l))return l;const a=null==i?void 0:i.iconsCollections.find((l=>{const o=`@${d.value}:${l.prefix}:${e}`;return t.iconLoaded(o)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function c(e){const l=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=(null==l?void 0:l.innerHTML.trim())||"";l&&a&&t.addIcon(`@${d.value}:${o.prefix}:${o.name}`,{body:a,height:l.viewBox.baseVal.height,width:l.viewBox.baseVal.width})}return i&&o.src&&!t.iconLoaded(`@${d.value}:${o.prefix}:${o.name}`)&&(n.value=!1,i.fetchIcon(o.src).then((e=>{e&&(c(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),o.svg&&c(o.svg),(l,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:l.inline,width:l.width,height:l.height,horizontalFlip:l.horizontalFlip,verticalFlip:l.verticalFlip,flip:l.flip,rotate:e.unref(a),color:l.color,icon:e.unref(s)},{onLoad:l.onLoad}),null,16,["class","onLoad"])):e.createCommentVNode("v-if",!0)}});function N(t,l){const o=e.computed((()=>"string"==typeof(null==t?void 0:t.value)?{name:null==t?void 0:t.value}:null==t?void 0:t.value)),a=e.computed((()=>(null==l?void 0:l.value)===r.before?o.value:void 0)),n=e.computed((()=>(null==l?void 0:l.value)===r.after?o.value:void 0)),u=e.computed((()=>(null==l?void 0:l.value)===i.left?o.value:void 0)),d=e.computed((()=>(null==l?void 0:l.value)===i.right?o.value:void 0)),s=e.computed((()=>(null==l?void 0:l.value)===i.top?o.value:void 0)),c=e.computed((()=>(null==l?void 0:l.value)===i.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:u,hasIconRight:d,hasIconTop:s,hasIconBottom:c,hasIconBefore:a,hasIconAfter:n}}const F=e.defineComponent({components:{VvIcon:E},props:{inputType:{type:String,default:"input-text"},disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:[String,Object],default:"close"}},emits:["clear"],setup(t,{emit:l}){const{hasIcon:o}=N(e.computed((()=>t.icon)));return{hasIcon:o,onClick:function(e){null==e||e.stopPropagation(),t.disabled||l("clear")}}},render(){const t=this.hasIcon?e.h(E,{...this.hasIcon,class:`vv-${this.inputType}__icon`}):void 0;return e.h("button",{disabled:this.disabled,class:`vv-${this.inputType}__action`,ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});const j=["for"],z={class:"vv-select__wrapper"},D={key:0,class:"vv-select__input-before"},R={class:"vv-select__inner"},q=["id"],H=["disabled","hidden"],T=["disabled","value"],K=["disabled","label"],M=["disabled","value"],J={key:2,class:"vv-select__input-after"};return e.defineComponent({name:"VvSelect",props:P(),emits:["update:modelValue","focus","blur","clear"],setup(t,{emit:a}){const n=t,i=a,r=e.useSlots(),u=function(t,l,o){const a=A(),n=e.computed((()=>{var e;if(a&&(null==(e=a.defaults.value)?void 0:e[t]))return a.defaults.value[t]}));return e.computed((()=>{if(void 0===n.value)return o;const e=n.value,t=l,a=o;return Object.keys(t).reduce(((l,o)=>{const n=a[o];if(l[o]=n,o in e){if(Array.isArray(t[o])){const a=t[o];a.length&&a[0]===n&&(l[o]=e[o])}if("function"==typeof t[o]&&(0,t[o])()===n&&(l[o]=e[o]),"object"==typeof t[o]){let a=t[o].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(l[o]=e[o]):a===n&&(l[o]=e[o])}}return l}),{})}))}("VvSelect",P(),n),d=e.ref(),{HintSlot:s,hasHintLabelOrSlot:c,hasInvalidLabelOrSlot:v,hintSlotScope:p}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>x(o.value.invalidLabel))),n=e.computed((()=>x(o.value.validLabel))),i=e.computed((()=>o.value.loadingLabel)),r=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||i.value)))),d=e.computed((()=>!u.value&&Boolean(o.value.invalid&&(l.invalid||a.value)))),s=e.computed((()=>!u.value&&!d.value&&Boolean(o.value.valid&&(l.valid||n.value)))),c=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),v=e.computed((()=>d.value||s.value||u.value||c.value)),p=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var t,l,o,a,n,i,r,u;if(this.isVisible){let d;return this.hasInvalidLabelOrSlot&&(d="alert"),this.hasValidLabelOrSlot&&(d="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:d},(null==(l=(t=this.$slots).loading)?void 0:l.call(t))??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:d},(null==(a=(o=this.$slots).invalid)?void 0:a.call(o))??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:d},(null==(i=(n=this.$slots).valid)?void 0:i.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(r=this.$slots).hint)?void 0:u.call(r))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:c,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:f}}(u,r),{focused:f}=function(t,o){const{focused:a}=l.useFocus(t);return e.watch(a,(l=>{o(l?"focus":"blur",e.unref(t))})),{focused:a}}(d,i);function m(e){var t;return"string"!=typeof e&&(null==(t=e.options)?void 0:t.length)}const{id:b,modifiers:h,disabled:y,readonly:g,loading:S,icon:B,iconPosition:k,invalid:L,valid:$,floating:V,multiple:O}=e.toRefs(n),C=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(b),w=e.computed((()=>`${C.value}-hint`)),I=e.computed((()=>n.disabled||n.readonly)),G=e.computed((()=>I.value?-1:n.tabindex)),U=e.computed({get:()=>n.modelValue,set:e=>{Array.isArray(e)&&0===(e=e.filter((e=>void 0!==e))).length&&!n.unselectable&&d.value?d.value.value=String(n.modelValue):i("update:modelValue",e)}}),Q=e.computed((()=>Array.isArray(U.value)?U.value.length>0:void 0!==U.value&&null!==U.value)),W=e.computed((()=>!I.value&&n.unselectable)),X=l.useElementVisibility(d);e.watch(X,(e=>{e&&n.autofocus&&(f.value=!0)}));const{hasIconBefore:Y,hasIconAfter:Z}=N(B,k),ee=e.computed((()=>!0===n.invalid||!0!==n.valid&&void 0)),te=_("vv-select",h,e.computed((()=>({valid:$.value,invalid:L.value,loading:S.value,disabled:y.value,readonly:g.value,"icon-before":void 0!==Y.value,"icon-after":void 0!==Z.value,dirty:Q.value,focus:f.value&&!I.value,floating:V.value,multiple:O.value})))),{getOptionLabel:le,getOptionValue:oe,isOptionDisabled:ae,getOptionGrouped:ne}=function(t){const{options:l,labelKey:a,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:l,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof a.value?a.value(e):String(a.value?o.get(e,a.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof n.value?n.value(e):n.value?o.get(e,n.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof i.value?i.value(e):!!i.value&&o.get(e,i.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(n);function ie(){Array.isArray(U.value)?U.value=[]:U.value=void 0,i("clear")}e.watch((()=>n.options),(e=>{if((null==e?void 0:e.length)&&n.autoselectFirst&&!Q.value){const t=oe(e[0]);U.value=n.multiple?[t]:t}}),{immediate:!0});const re=e.computed((()=>({name:n.name,tabindex:G.value,disabled:I.value,required:n.required,size:n.size,autocomplete:n.autocomplete,multiple:n.multiple,"aria-invalid":ee.value,"aria-describedby":c.value?w.value:void 0,"aria-errormessage":v.value?w.value:void 0}))),ue=e.computed((()=>({valid:n.valid,invalid:n.invalid,modelValue:n.modelValue})));return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(te))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(C)},e.toDisplayString(t.label),9,j)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",z,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",D,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(ue))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",R,[e.unref(Y)?(e.openBlock(),e.createBlock(E,e.mergeProps({key:0},e.unref(Y),{class:"vv-select__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(C),ref_key:"selectEl",ref:d},e.unref(re),{"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(U)?U.value=t:null)}),[t.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!e.unref(W),hidden:!e.unref(W)},e.toDisplayString(t.placeholder),9,H)):e.createCommentVNode("v-if",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,((t,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[m(t)?(e.openBlock(),e.createElementBlock("optgroup",{key:`group-${l}`,disabled:e.unref(ae)(t),label:e.unref(le)(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ne)(t),((t,o)=>(e.openBlock(),e.createElementBlock("option",{key:`group-${l}-item-${o}`,disabled:e.unref(ae)(t),value:e.unref(oe)(t)},e.toDisplayString(e.unref(le)(t)),9,M)))),128))],8,K)):(e.openBlock(),e.createElementBlock("option",{key:l,disabled:e.unref(ae)(t),value:e.unref(oe)(t)},e.toDisplayString(e.unref(le)(t)),9,T))],64)))),256))],16,q),[[e.vModelSelect,e.unref(U)]]),e.unref(Z)?(e.openBlock(),e.createBlock(E,e.mergeProps({key:1},e.unref(Z),{class:"vv-select__icon vv-select__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),e.unref(W)&&e.unref(u).showClearAction?(e.openBlock(),e.createBlock(e.unref(F),{key:1,"input-type":"select",label:t.labelClear,icon:t.iconClear,disabled:!e.unref(Q),onClear:ie},null,8,["label","icon","disabled"])):e.createCommentVNode("v-if",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",J,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(ue))))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(s),{id:e.unref(w),class:"vv-select__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(p))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(p))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(p))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(p))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@iconify/vue"),require("@vueuse/core"),require("dot-prop")):"function"==typeof define&&define.amd?define(["vue","@iconify/vue","@vueuse/core","dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvSelect=t(e.vue,e.vue$1,e.core,e.dotProp)}(this,function(e,t,o,l){"use strict";const a={prefix:"normal"};var n=(e=>(e.local="local",e.session="session",e))(n||{}),i=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(i||{}),r=(e=>(e.before="before",e.after="after",e))(r||{}),u=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(u||{}),d=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(d||{});const s=Symbol.for("volver"),c={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},v={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},p={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},f={disabled:{type:Boolean,default:!1}},m={showClearAction:{type:Boolean,default:!1},iconClear:{type:[String,Object],default:"close"},labelClear:{type:String,default:"Clear"}},b={label:{type:[String,Number],default:void 0}},h={readonly:{type:Boolean,default:!1}},y={modifiers:{type:[String,Array],default:void 0}},g={hintLabel:{type:String,default:""}},S={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}},B={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:r.before,validation:e=>Object.values(r).includes(e)}},k={tabindex:{type:[String,Number],default:0}},L={floating:{type:Boolean,default:!1}},$={unselectable:{type:Boolean,default:!0}},V={id:[String,Number]};i.bottom;const O={...V,name:{type:String,required:!0}},C={autofocus:{type:Boolean,default:!1}},w={autocomplete:{type:String,default:"off"}};u.button,d.button,n.local;const P={...O,...C,...w,...k,...c,...v,...g,...p,...f,...h,...y,...S,...B,...L,...$,...b,...m,multiple:Boolean,required:Boolean,size:[String,Number],modelValue:{type:[String,Number,Boolean,Object,Array],default:void 0},autoselectFirst:{type:Boolean,default:!1},placeholder:String};function I(){return{...P,options:{...P.options,type:Array,default:()=>[]}}}function x(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).join(" "):e}function A(){return e.inject(s,void 0)}function _(t,o,l){return e.computed(()=>{const a={[t]:!0},n="string"==typeof o?.value?o.value.split(" "):o?.value;return n&&Array.isArray(n)&&n.forEach(e=>{e&&(a[`${t}--${e}`]=!0)}),l&&Object.keys(l.value).forEach(o=>{a[`${t}--${o}`]=e.unref(l.value[o])}),a})}const E=e.defineComponent({name:"VvIcon",props:e.mergeDefaults({name:{},color:{},width:{},height:{},provider:{},prefix:{},src:{},horizontalFlip:{type:Boolean},verticalFlip:{type:Boolean},flip:{},mode:{},inline:{type:Boolean},rotate:{},onLoad:{type:Function},svg:{},modifiers:{}},a),setup(o){const l=o,a=e.computed(()=>"string"==typeof l.rotate?Number.parseFloat(l.rotate):l.rotate),n=e.ref(!0),i=A(),{modifiers:r}=e.toRefs(l),u=_("vv-icon",r),d=e.computed(()=>l.provider||i?.iconsProvider),s=e.computed(()=>{const e=l.name??"",o=`@${d.value}:${l.prefix}:${e}`;if(t.iconLoaded(o))return o;const a=i?.iconsCollections.find(o=>{const l=`@${d.value}:${o.prefix}:${e}`;return t.iconLoaded(l)});return a?`@${d.value}:${a.prefix}:${e}`:e});function c(e){const o=function(e){let t;if("undefined"==typeof window){const{JSDOM:e}=require("jsdom");t=(new e).window}return(t?new t.DOMParser:new window.DOMParser).parseFromString(e,"text/html").querySelector("svg")}(e),a=o?.innerHTML.trim()||"";o&&a&&t.addIcon(`@${d.value}:${l.prefix}:${l.name}`,{body:a,height:o.viewBox.baseVal.height,width:o.viewBox.baseVal.width})}return i&&l.src&&!t.iconLoaded(`@${d.value}:${l.prefix}:${l.name}`)&&(n.value=!1,i.fetchIcon(l.src).then(e=>{e&&(c(e),n.value=!0)}).catch(e=>{throw new Error(`Error during fetch icon: ${e?.message}`)})),l.svg&&c(l.svg),(o,l)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(t.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:o.inline,width:o.width,height:o.height,horizontalFlip:o.horizontalFlip,verticalFlip:o.verticalFlip,flip:o.flip,rotate:e.unref(a),color:o.color,icon:e.unref(s)},{onLoad:o.onLoad}),null,16,["class","onLoad"])):e.createCommentVNode("v-if",!0)}});function N(t,o){const l=e.computed(()=>"string"==typeof t?.value?{name:t?.value}:t?.value),a=e.computed(()=>o?.value===r.before?l.value:void 0),n=e.computed(()=>o?.value===r.after?l.value:void 0),u=e.computed(()=>o?.value===i.left?l.value:void 0),d=e.computed(()=>o?.value===i.right?l.value:void 0),s=e.computed(()=>o?.value===i.top?l.value:void 0),c=e.computed(()=>o?.value===i.bottom?l.value:void 0);return{hasIcon:l,hasIconLeft:u,hasIconRight:d,hasIconTop:s,hasIconBottom:c,hasIconBefore:a,hasIconAfter:n}}const F=e.defineComponent({components:{VvIcon:E},props:{inputType:{type:String,default:"input-text"},disabled:{type:Boolean,default:!1},label:{type:String,default:"Clear"},icon:{type:[String,Object],default:"close"}},emits:["clear"],setup(t,{emit:o}){const{hasIcon:l}=N(e.computed(()=>t.icon));return{hasIcon:l,onClick:function(e){e?.stopPropagation(),t.disabled||o("clear")}}},render(){const t=this.hasIcon?e.h(E,{...this.hasIcon,class:`vv-${this.inputType}__icon`}):void 0;return e.h("button",{disabled:this.disabled,class:`vv-${this.inputType}__action`,ariaLabel:this.label,type:"button",onClick:this.onClick},t)}});const j=["for"],z={class:"vv-select__wrapper"},R={key:0,class:"vv-select__input-before"},D={class:"vv-select__inner"},q=["id"],H=["disabled","hidden"],T=["disabled","value"],K=["disabled","label"],M=["disabled","value"],J={key:2,class:"vv-select__input-after"};return e.defineComponent({name:"VvSelect",props:I(),emits:["update:modelValue","focus","blur","clear"],setup(t,{emit:a}){const n=t,i=a,r=e.useSlots(),u=function(t,o,l){const a=A(),n=e.computed(()=>{if(a&&a.defaults.value?.[t])return a.defaults.value[t]});return e.computed(()=>{if(void 0===n.value)return l;const e=n.value,t=o,a=l;return Object.keys(t).reduce((o,l)=>{const n=a[l];if(o[l]=n,l in e){if(Array.isArray(t[l])){const a=t[l];a.length&&a[0]===n&&(o[l]=e[l])}if("function"==typeof t[l]&&(0,t[l])()===n&&(o[l]=e[l]),"object"==typeof t[l]){let a=t[l].default;"function"==typeof a&&(a=a()),"object"==typeof a?JSON.stringify(a)===JSON.stringify(n)&&(o[l]=e[l]):a===n&&(o[l]=e[l])}}return o},{})})}("VvSelect",I(),n),d=e.ref(),{HintSlot:s,hasHintLabelOrSlot:c,hasInvalidLabelOrSlot:v,hintSlotScope:p}=function(t,o){const l=e.computed(()=>e.isRef(t)?t.value:t),a=e.computed(()=>x(l.value.invalidLabel)),n=e.computed(()=>x(l.value.validLabel)),i=e.computed(()=>l.value.loadingLabel),r=e.computed(()=>l.value.hintLabel),u=e.computed(()=>Boolean(l.value.loading&&(o.loading||i.value))),d=e.computed(()=>!u.value&&Boolean(l.value.invalid&&(o.invalid||a.value))),s=e.computed(()=>!u.value&&!d.value&&Boolean(l.value.valid&&(o.valid||n.value))),c=e.computed(()=>!u.value&&!d.value&&!s.value&&Boolean(o.hint||r.value)),v=e.computed(()=>d.value||s.value||u.value||c.value),p=e.computed(()=>({modelValue:l.value.modelValue,valid:l.value.valid,invalid:l.value.invalid,loading:l.value.loading})),f=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){if(this.isVisible){let t;return this.hasInvalidLabelOrSlot&&(t="alert"),this.hasValidLabelOrSlot&&(t="status"),this.hasLoadingLabelOrSlot?e.h(this.tag,{role:t},this.$slots.loading?.()??this.loadingLabel):this.hasInvalidLabelOrSlot?e.h(this.tag,{role:t},this.$slots.invalid?.()??this.$slots.invalid??this.invalidLabel):this.hasValidLabelOrSlot?e.h(this.tag,{role:t},this.$slots.valid?.()??this.validLabel):e.h(this.tag,{role:t},this.$slots.hint?.()??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:c,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:p,HintSlot:f}}(u,r),{focused:f}=function(t,l){const{focused:a}=o.useFocus(t);return e.watch(a,o=>{l(o?"focus":"blur",e.unref(t))}),{focused:a}}(d,i);function m(e){return"string"!=typeof e&&e.options?.length}const{id:b,modifiers:h,disabled:y,readonly:g,loading:S,icon:B,iconPosition:k,invalid:L,valid:$,floating:V,multiple:O}=e.toRefs(n),C=function(t){return e.computed(()=>String(t?.value||e.useId()))}(b),w=e.computed(()=>`${C.value}-hint`),P=e.computed(()=>n.disabled||n.readonly),G=e.computed(()=>P.value?-1:n.tabindex),U=e.computed({get:()=>n.modelValue,set:e=>{Array.isArray(e)&&0===(e=e.filter(e=>void 0!==e)).length&&!n.unselectable&&d.value?d.value.value=String(n.modelValue):i("update:modelValue",e)}}),Q=e.computed(()=>Array.isArray(U.value)?U.value.length>0:void 0!==U.value&&null!==U.value),W=e.computed(()=>!P.value&&n.unselectable),X=o.useElementVisibility(d);e.watch(X,e=>{e&&n.autofocus&&(f.value=!0)});const{hasIconBefore:Y,hasIconAfter:Z}=N(B,k),ee=e.computed(()=>!0===n.invalid||!0!==n.valid&&void 0),te=_("vv-select",h,e.computed(()=>({valid:$.value,invalid:L.value,loading:S.value,disabled:y.value,readonly:g.value,"icon-before":void 0!==Y.value,"icon-after":void 0!==Z.value,dirty:Q.value,focus:f.value&&!P.value,floating:V.value,multiple:O.value}))),{getOptionLabel:oe,getOptionValue:le,isOptionDisabled:ae,getOptionGrouped:ne}=function(t){const{options:o,labelKey:a,valueKey:n,disabledKey:i}=e.toRefs(t);return{options:o,getOptionLabel:e=>"string"==typeof e?e:"function"==typeof a.value?a.value(e):String(a.value?l.getProperty(e,a.value):e),getOptionValue:e=>"string"==typeof e?e:"function"==typeof n.value?n.value(e):n.value?l.getProperty(e,n.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof i.value?i.value(e):!!i.value&&Boolean(l.getProperty(e,i.value))),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(n);function ie(){Array.isArray(U.value)?U.value=[]:U.value=void 0,i("clear")}e.watch(()=>n.options,e=>{if(e?.length&&n.autoselectFirst&&!Q.value){const t=le(e[0]);U.value=n.multiple?[t]:t}},{immediate:!0});const re=e.computed(()=>({name:n.name,tabindex:G.value,disabled:P.value,required:n.required,size:n.size,autocomplete:n.autocomplete,multiple:n.multiple,"aria-invalid":ee.value,"aria-describedby":c.value?w.value:void 0,"aria-errormessage":v.value?w.value:void 0})),ue=e.computed(()=>({valid:n.valid,invalid:n.invalid,modelValue:n.modelValue}));return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(te))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(C)},e.toDisplayString(t.label),9,j)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",z,[t.$slots.before?(e.openBlock(),e.createElementBlock("div",R,[e.renderSlot(t.$slots,"before",e.normalizeProps(e.guardReactiveProps(e.unref(ue))))])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",D,[e.unref(Y)?(e.openBlock(),e.createBlock(E,e.mergeProps({key:0},e.unref(Y),{class:"vv-select__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("select",e.mergeProps({id:e.unref(C),ref_key:"selectEl",ref:d},e.unref(re),{"onUpdate:modelValue":o[0]||(o[0]=t=>e.isRef(U)?U.value=t:null)}),[t.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:void 0,disabled:!e.unref(W),hidden:!e.unref(W)},e.toDisplayString(t.placeholder),9,H)):e.createCommentVNode("v-if",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,(t,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[m(t)?(e.openBlock(),e.createElementBlock("optgroup",{key:`group-${o}`,disabled:e.unref(ae)(t),label:e.unref(oe)(t)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ne)(t),(t,l)=>(e.openBlock(),e.createElementBlock("option",{key:`group-${o}-item-${l}`,disabled:e.unref(ae)(t),value:e.unref(le)(t)},e.toDisplayString(e.unref(oe)(t)),9,M))),128))],8,K)):(e.openBlock(),e.createElementBlock("option",{key:o,disabled:e.unref(ae)(t),value:e.unref(le)(t)},e.toDisplayString(e.unref(oe)(t)),9,T))],64))),256))],16,q),[[e.vModelSelect,e.unref(U)]]),e.unref(Z)?(e.openBlock(),e.createBlock(E,e.mergeProps({key:1},e.unref(Z),{class:"vv-select__icon vv-select__icon-after"}),null,16)):e.createCommentVNode("v-if",!0)]),e.unref(W)&&e.unref(u).showClearAction?(e.openBlock(),e.createBlock(e.unref(F),{key:1,"input-type":"select",label:t.labelClear,icon:t.iconClear,disabled:!e.unref(Q),onClear:ie},null,8,["label","icon","disabled"])):e.createCommentVNode("v-if",!0),t.$slots.after?(e.openBlock(),e.createElementBlock("div",J,[e.renderSlot(t.$slots,"after",e.normalizeProps(e.guardReactiveProps(e.unref(ue))))])):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(s),{id:e.unref(w),class:"vv-select__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(p))))]),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(p))))]),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(p))))]),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(p))))]),key:"3"}:void 0]),1032,["id"])],2))}})});
|
|
@@ -60,15 +60,15 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
|
|
|
60
60
|
readonly modelValue?: string | number | boolean | unknown[] | Record<string, any> | undefined;
|
|
61
61
|
readonly modifiers?: string | string[] | undefined;
|
|
62
62
|
readonly id?: string | number | undefined;
|
|
63
|
+
readonly placeholder?: string | undefined;
|
|
63
64
|
readonly icon?: string | import("../VvIcon").VvIconProps | undefined;
|
|
64
65
|
readonly invalidLabel?: string | unknown[] | undefined;
|
|
65
66
|
readonly validLabel?: string | unknown[] | undefined;
|
|
66
|
-
readonly placeholder?: string | undefined;
|
|
67
67
|
readonly onClear?: (() => any) | undefined;
|
|
68
68
|
readonly "onUpdate:modelValue"?: ((args_0: any) => any) | undefined;
|
|
69
69
|
readonly onBlur?: ((args_0: import("@vueuse/core").MaybeElement) => any) | undefined;
|
|
70
70
|
readonly onFocus?: ((args_0: import("@vueuse/core").MaybeElement) => any) | undefined;
|
|
71
|
-
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "floating" | "label" | "disabled" | "modelValue" | "modifiers" | "icon" | "iconPosition" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "autoselectFirst" | "showClearAction" | "iconClear" | "labelClear" | "autocomplete" | "autofocus">, "size" | "name" | "id" | "onFocus" | "onBlur" | "
|
|
71
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "floating" | "label" | "disabled" | "modelValue" | "modifiers" | "icon" | "iconPosition" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "autoselectFirst" | "showClearAction" | "iconClear" | "labelClear" | "autocomplete" | "autofocus">, "size" | "name" | "id" | "onFocus" | "onBlur" | "placeholder" | "onClear" | "onUpdate:modelValue" | ("floating" | "label" | "disabled" | "modelValue" | "modifiers" | "icon" | "iconPosition" | "required" | "loading" | "loadingLabel" | "unselectable" | "multiple" | "readonly" | "hintLabel" | "invalid" | "invalidLabel" | "valid" | "validLabel" | "tabindex" | "options" | "labelKey" | "valueKey" | "disabledKey" | "autoselectFirst" | "showClearAction" | "iconClear" | "labelClear" | "autocomplete" | "autofocus")> & {} & {}> & import("vue").PublicProps;
|
|
72
72
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
73
73
|
attrs: any;
|
|
74
74
|
slots: {
|
|
@@ -118,5 +118,5 @@ declare const _default: <T extends string | Option>(__VLS_props: NonNullable<Awa
|
|
|
118
118
|
};
|
|
119
119
|
export default _default;
|
|
120
120
|
type __VLS_PrettifyLocal<T> = {
|
|
121
|
-
[K in keyof T]: T[K];
|
|
121
|
+
[K in keyof T as K]: T[K];
|
|
122
122
|
} & {};
|
|
@@ -216,7 +216,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
216
216
|
}
|
|
217
217
|
);
|
|
218
218
|
const pressed = computed(() => {
|
|
219
|
-
return props.pressed ||
|
|
219
|
+
return props.pressed || dropdownExpanded?.value;
|
|
220
220
|
});
|
|
221
221
|
const { role } = useInjectedDropdownAction();
|
|
222
222
|
const hasTag = computed(() => {
|
|
@@ -224,7 +224,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
224
224
|
case props.disabled:
|
|
225
225
|
return ActionTag.button;
|
|
226
226
|
case props.to !== void 0:
|
|
227
|
-
return
|
|
227
|
+
return volver?.nuxt ? resolveComponent(ActionTag.nuxtLink) : ActionTag.routerLink;
|
|
228
228
|
case props.href !== void 0:
|
|
229
229
|
return ActionTag.a;
|
|
230
230
|
default:
|
|
@@ -233,10 +233,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
233
233
|
});
|
|
234
234
|
const hasProps = computed(() => {
|
|
235
235
|
const toReturn = {
|
|
236
|
-
...dropdownAria
|
|
236
|
+
...dropdownAria?.value,
|
|
237
237
|
ariaPressed: pressed.value ? true : void 0,
|
|
238
238
|
ariaLabel: props.ariaLabel,
|
|
239
|
-
role: role
|
|
239
|
+
role: role?.value
|
|
240
240
|
};
|
|
241
241
|
switch (hasTag.value) {
|
|
242
242
|
case ActionTag.a:
|
|
@@ -264,32 +264,29 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
264
264
|
}
|
|
265
265
|
});
|
|
266
266
|
function onClick(e) {
|
|
267
|
-
var _a;
|
|
268
267
|
if (props.disabled) {
|
|
269
268
|
e.preventDefault();
|
|
270
269
|
return;
|
|
271
270
|
}
|
|
272
|
-
if (
|
|
271
|
+
if (instance?.vnode.props?.onClick) {
|
|
273
272
|
emit("click", e);
|
|
274
273
|
return;
|
|
275
274
|
}
|
|
276
|
-
dropdownEventBus
|
|
275
|
+
dropdownEventBus?.emit("click", e);
|
|
277
276
|
}
|
|
278
277
|
function onMouseover(e) {
|
|
279
|
-
|
|
280
|
-
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onMouseover) {
|
|
278
|
+
if (instance?.vnode.props?.onMouseover) {
|
|
281
279
|
emit("mouseover", e);
|
|
282
280
|
return;
|
|
283
281
|
}
|
|
284
|
-
dropdownEventBus
|
|
282
|
+
dropdownEventBus?.emit("mouseover", e);
|
|
285
283
|
}
|
|
286
284
|
function onMouseleave(e) {
|
|
287
|
-
|
|
288
|
-
if ((_a = instance == null ? void 0 : instance.vnode.props) == null ? void 0 : _a.onMouseleave) {
|
|
285
|
+
if (instance?.vnode.props?.onMouseleave) {
|
|
289
286
|
emit("mouseleave", e);
|
|
290
287
|
return;
|
|
291
288
|
}
|
|
292
|
-
dropdownEventBus
|
|
289
|
+
dropdownEventBus?.emit("mouseleave", e);
|
|
293
290
|
}
|
|
294
291
|
return (_ctx, _cache) => {
|
|
295
292
|
return openBlock(), createBlock(resolveDynamicComponent(unref(hasTag)), mergeProps(unref(hasProps), {
|
|
@@ -360,7 +357,7 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
360
357
|
const toReturn = {
|
|
361
358
|
[prefix]: true
|
|
362
359
|
};
|
|
363
|
-
const modifiersArray = typeof
|
|
360
|
+
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
364
361
|
if (modifiersArray) {
|
|
365
362
|
if (Array.isArray(modifiersArray)) {
|
|
366
363
|
modifiersArray.forEach((modifier) => {
|
|
@@ -385,12 +382,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
385
382
|
const emit = __emit;
|
|
386
383
|
const { modifiers } = toRefs(props);
|
|
387
384
|
function onClick(event) {
|
|
388
|
-
var _a;
|
|
389
385
|
const target = event.target;
|
|
390
|
-
if (target
|
|
386
|
+
if (target?.dataset.index) {
|
|
391
387
|
const index = Number.parseInt(target.dataset.index);
|
|
392
|
-
const item =
|
|
393
|
-
if (!item ||
|
|
388
|
+
const item = props.items?.[index];
|
|
389
|
+
if (!item || item?.disabled) {
|
|
394
390
|
return;
|
|
395
391
|
}
|
|
396
392
|
emit("click", item);
|
|
@@ -416,9 +412,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
416
412
|
renderList(_ctx.items, ({ on = {}, data, ...item }, index) => {
|
|
417
413
|
return openBlock(), createBlock(_sfc_main$2, mergeProps({
|
|
418
414
|
key: index,
|
|
419
|
-
"data-index": index
|
|
420
|
-
|
|
421
|
-
}, item, toHandlers(on)), {
|
|
415
|
+
"data-index": index
|
|
416
|
+
}, { ref_for: true }, item, toHandlers(on)), {
|
|
422
417
|
default: withCtx(() => [
|
|
423
418
|
renderSlot(_ctx.$slots, "item", mergeProps({ ref_for: true }, { item, data, index }))
|
|
424
419
|
]),
|
|
@@ -475,8 +470,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
475
470
|
const localModelValue = ref();
|
|
476
471
|
const activeTabKey = computed({
|
|
477
472
|
get: () => {
|
|
478
|
-
|
|
479
|
-
return props.modelValue || localModelValue.value || ((_a = tabKeys.value) == null ? void 0 : _a[0]);
|
|
473
|
+
return props.modelValue || localModelValue.value || tabKeys.value?.[0];
|
|
480
474
|
},
|
|
481
475
|
set: (newValue) => {
|
|
482
476
|
localModelValue.value = newValue;
|
|
@@ -484,10 +478,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
484
478
|
}
|
|
485
479
|
});
|
|
486
480
|
const hasNavModifiers = computed(() => {
|
|
487
|
-
var _a;
|
|
488
481
|
return [
|
|
489
482
|
"tabs",
|
|
490
|
-
...Array.isArray(props.navModifiers) ? props.navModifiers :
|
|
483
|
+
...Array.isArray(props.navModifiers) ? props.navModifiers : props.navModifiers?.split(" ") ?? []
|
|
491
484
|
];
|
|
492
485
|
});
|
|
493
486
|
function onNavClick(item) {
|