@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 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@vueuse/core"),require("vuedraggable"),require("@iconify/vue")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","vuedraggable","@iconify/vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputFile=t(e.vue,e.core,e.Sortable,e.vue$1)}(this,(function(e,t,l,o){"use strict";const a="add",n="edit",r="download",i={prefix:"normal"};var u=(e=>(e.local="local",e.session="session",e))(u||{}),d=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(d||{}),s=(e=>(e.before="before",e.after="after",e))(s||{}),c=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(c||{}),v=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(v||{});const f=Symbol.for("volver"),p=Symbol.for("buttonGroup"),m=Symbol.for("dropdownTrigger"),g=Symbol.for("dropdownAction"),b={to:{type:[String,Object]},href:String,target:String,rel:{type:String,default:"noopener noreferrer"}},y={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},h={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},k={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},S={disabled:{type:Boolean,default:!1}},B={required:{type:Boolean,default:!1}},L={active:{type:Boolean,default:!1}},w={current:{type:Boolean,default:!1}},V={pressed:{type:Boolean,default:!1}},A={label:{type:[String,Number],default:void 0}},C={readonly:{type:Boolean,default:!1}},$={modifiers:{type:[String,Array],default:void 0}},N={hintLabel:{type:String,default:""}},O={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:s.before,validation:e=>Object.values(s).includes(e)}},x={unselectable:{type:Boolean,default:!0}},_={id:[String,Number]};d.bottom;const I={..._,name:{type:String,required:!0}},P={...S,...A,...V,...L,...w,...b,type:{type:String,default:c.button,validator:e=>Object.values(c).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:v.button}};u.local;const R={...I,...$,...y,...h,...N,...A,...k,...C,...S,...B,...O,modelValue:{type:Object},progress:{type:[Number,String],default:void 0},placeholder:{type:String,default:void 0},accept:{type:String,default:"*"},multiple:{type:Boolean,default:!1},capture:{type:String,default:void 0,validation:e=>void 0===e||["user","environment"].includes(e)},max:{type:[Number,String],default:void 0},dropArea:{type:Boolean,default:!1},sortable:{type:Boolean,default:!1},labelAdd:{type:String,default:"Add file"},iconAdd:{type:[String,Object],default:a},labelReplace:{type:String,default:"Replace file"},iconReplace:{type:[String,Object],default:n},labelDownload:{type:String,default:"Downlaod file"},iconDownload:{type:[String,Object],default:r},labelRemove:{type:String,default:"Remove file"}};function j(e,t,l){return E(e,t)}function E(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const l=Array.isArray(e),o=Array.isArray(t);let a,n,r;if(l&&o){if(n=e.length,n!==t.length)return!1;for(a=n;0!==a--;)if(!E(e[a],t[a]))return!1;return!0}if(l!==o)return!1;const i=e instanceof Date,u=t instanceof Date;if(i!==u)return!1;if(i&&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 c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(a=n;0!==a--;)if(!Object.prototype.hasOwnProperty.call(t,c[a]))return!1;for(a=n;0!==a--;)if(r=c[a],!E(e[r],t[r]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function D(e,t){if(null!=e&&t&&t.length)for(const l of t)if(j(e,l))return!0;return!1}function M(e){return Array.isArray(e)?e.filter((e=>"string"==typeof e)).join(" "):e}const F={...P,..._,...$,...x,...k,...O,iconPosition:{type:String,default:d.left,validator:e=>Object.values(d).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};function T(t,l){const{group:o,isInGroup:a,getGroupOrLocalRef:n}=function(t){const l=e.inject(t,void 0),o=e.computed((()=>void 0!==l));return{group:l,isInGroup:o,getGroupOrLocalRef:function(t,o,a){const n=null==l?void 0:l[t];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const r=e.toRef(o,t);return e.computed({get:()=>r.value,set(e){a&&a(`update:${t}`,e)}})}}}(p),{id:r,iconPosition:i,icon:u,label:d,pressed:s}=e.toRefs(t),c=n("modelValue",t,l),v=n("toggle",t),f=n("unselectable",t),m=e.computed((()=>(null==o?void 0:o.multiple.value)??!1)),g=e.computed((()=>{let e=t.modifiers,l=null==o?void 0:o.modifiers.value;const a=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach((e=>a.add(e)))),l&&(Array.isArray(l)||(l=l.split(" ")),l.forEach((e=>a.add(e)))),Array.from(a)})),b=e.computed((()=>Boolean(t.disabled||(null==o?void 0:o.disabled.value))));return{group:o,isInGroup:a,modelValue:c,toggle:v,unselectable:f,multiple:m,modifiers:g,disabled:b,id:r,pressed:s,iconPosition:i,icon:u,label:d}}const z=P;function U(){return e.inject(f,void 0)}const q=e.defineComponent({name:"VvAction",props:z,emits:["click","mouseover","mouseleave"],setup(t,{expose:l,emit:o}){const a=t,n=o,r=e.getCurrentInstance(),i=U(),u=e.ref(null);l({$el:u});const{reference:d,bus:s,aria:c,expanded:f}=e.inject(m,{});e.watch((()=>u.value),(e=>{d&&(d.value=e)}));const p=e.computed((()=>a.pressed||(null==f?void 0:f.value))),{role:b}=e.inject(g,{}),y=e.computed((()=>{switch(!0){case a.disabled:return v.button;case void 0!==a.to:return(null==i?void 0:i.nuxt)?e.resolveComponent(v.nuxtLink):v.routerLink;case void 0!==a.href:return v.a;default:return a.defaultTag}})),h=e.computed((()=>{const e={...null==c?void 0:c.value,ariaPressed:!!p.value||void 0,ariaLabel:a.ariaLabel,role:null==b?void 0:b.value};switch(y.value){case v.a:return{...e,href:a.href,target:a.target,rel:a.rel};case v.routerLink:case v.nuxtLink:return{...e,to:a.to,target:a.target};case v.button:return{...e,type:a.type,disabled:a.disabled};default:return e}}));function k(e){var t;a.disabled?e.preventDefault():(null==(t=null==r?void 0:r.vnode.props)?void 0:t.onClick)?n("click",e):null==s||s.emit("click",e)}function S(e){var t;(null==(t=null==r?void 0:r.vnode.props)?void 0:t.onMouseover)?n("mouseover",e):null==s||s.emit("mouseover",e)}function B(e){var t;(null==(t=null==r?void 0:r.vnode.props)?void 0:t.onMouseleave)?n("mouseleave",e):null==s||s.emit("mouseleave",e)}return(t,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps(e.unref(h),{ref_key:"element",ref:u,class:{active:t.active,pressed:e.unref(p),disabled:t.disabled,current:t.current},onClickPassive:k,onMouseoverPassive:S,onMouseleavePassive:B}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]))])),_:3},16,["class"]))}});function G(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 H=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:{}},i),setup(t){const l=t,a=e.computed((()=>"string"==typeof l.rotate?Number.parseFloat(l.rotate):l.rotate)),n=e.ref(!0),r=U(),{modifiers:i}=e.toRefs(l),u=G("vv-icon",i),d=e.computed((()=>l.provider||(null==r?void 0:r.iconsProvider))),s=e.computed((()=>{const e=l.name??"",t=`@${d.value}:${l.prefix}:${e}`;if(o.iconLoaded(t))return t;const a=null==r?void 0:r.iconsCollections.find((t=>{const l=`@${d.value}:${t.prefix}:${e}`;return o.iconLoaded(l)}));return a?`@${d.value}:${a.prefix}:${e}`:e}));function c(e){const t=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==t?void 0:t.innerHTML.trim())||"";t&&a&&o.addIcon(`@${d.value}:${l.prefix}:${l.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return r&&l.src&&!o.iconLoaded(`@${d.value}:${l.prefix}:${l.name}`)&&(n.value=!1,r.fetchIcon(l.src).then((e=>{e&&(c(e),n.value=!0)})).catch((e=>{throw new Error(`Error during fetch icon: ${null==e?void 0:e.message}`)}))),l.svg&&c(l.svg),(t,l)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(o.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,icon:e.unref(s)},{onLoad:t.onLoad}),null,16,["class","onLoad"])):e.createCommentVNode("v-if",!0)}});function J(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}function W(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)===s.before?o.value:void 0)),n=e.computed((()=>(null==l?void 0:l.value)===s.after?o.value:void 0)),r=e.computed((()=>(null==l?void 0:l.value)===d.left?o.value:void 0)),i=e.computed((()=>(null==l?void 0:l.value)===d.right?o.value:void 0)),u=e.computed((()=>(null==l?void 0:l.value)===d.top?o.value:void 0)),c=e.computed((()=>(null==l?void 0:l.value)===d.bottom?o.value:void 0));return{hasIcon:o,hasIconLeft:r,hasIconRight:i,hasIconTop:u,hasIconBottom:c,hasIconBefore:a,hasIconAfter:n}}const K={key:1,class:"vv-button__label"},Y={key:1,class:"vv-button__label"},Z=e.defineComponent({name:"VvButton",inheritAttrs:!1,props:F,emits:["update:modelValue"],setup(t,{expose:l,emit:o}){const a=t,n=o,r=e.useAttrs(),i=e.useSlots(),{id:u,modifiers:s,iconPosition:c,icon:v,label:f,modelValue:p,disabled:m,toggle:g,unselectable:b}=T(a,n),y=J(u),h=e.computed((()=>(null==r?void 0:r.name)||y.value)),k=e.ref(null);l({$el:e.computed((()=>{var e;return null==(e=k.value)?void 0:e.$el}))});const S=e.computed((()=>g.value?Array.isArray(p.value)?D(h.value,p.value):j(h.value,p.value):a.pressed)),B=G("vv-button",s,e.computed((()=>({reverse:[d.right,d.bottom].includes(c.value),column:[d.top,d.bottom].includes(c.value),"icon-only":Boolean((null==v?void 0:v.value)&&!(null==f?void 0:f.value)&&!i.default)})))),{hasIcon:L}=W(v),w=e.computed((()=>void 0!==a.value?a.value:h.value)),V=e.computed((()=>{if(g.value)return{onClick:A}}));function A(){if(g.value){if(Array.isArray(p.value))return D(w.value,p.value)?void(b.value&&(p.value=p.value.filter((e=>e!==w.value)))):void p.value.push(w.value);if(w.value===p.value&&b.value)return void(p.value=a.uncheckedValue);p.value=w.value}}return(t,l)=>(e.openBlock(),e.createBlock(q,e.mergeProps({...e.unref(r),...e.unref(V),disabled:e.unref(m),pressed:e.unref(S),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(y),ref_key:"element",ref:k,class:e.unref(B)}),{default:e.withCtx((()=>[e.renderSlot(t.$slots,"default",{},(()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},(()=>[t.loadingIcon?(e.openBlock(),e.createBlock(H,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",K,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(L)?(e.openBlock(),e.createBlock(H,e.mergeProps({key:0},e.unref(L),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(f)?(e.openBlock(),e.createElementBlock("span",Y,[e.renderSlot(t.$slots,"label",{},(()=>[e.createTextVNode(e.toDisplayString(e.unref(f)),1)]))])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"after")],64))]))])),_:3},16,["id","class"]))}});const Q=["for"],X={class:"vv-input-file__preview"},ee=["src","alt"],te={class:"vv-input-file__wrapper"},le=["id","readonly","disabled","required","placeholder","aria-describedby","aria-invalid","aria-errormessage","multiple","accept","capture","name"],oe=["value"],ae=["onClick"],ne=["title","onClick"],re={class:"vv-input-file__item-name"},ie={class:"vv-input-file__item-info"},ue=["title","disabled","onClick"];return e.defineComponent({name:"VvInputFile",props:R,emits:["remove","download","update:modelValue"],setup(o,{emit:a}){const n=o,r=a,i=e.useSlots(),u=function(t,l,o){const a=U(),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}),{})}))}("VvInputFile",R,n),{modifiers:d,id:s,readonly:c,disabled:v,icon:f,iconPosition:p,iconDownload:m}=e.toRefs(n),g=J(s),b=e.computed((()=>`${g.value}-hint`)),y=e.computed((()=>{if(!n.progress)return!1;const e="string"==typeof n.progress?Number.parseInt(n.progress):n.progress;return e>0&&e<100})),{hasIconBefore:h,hasIconAfter:k}=W(f,p),{hasIcon:S}=W(m),B=G("vv-input-file",d,e.computed((()=>({valid:!0===n.valid,invalid:!0===n.invalid,loading:n.loading&&!y.value,disabled:n.disabled,required:n.required,readonly:n.readonly,dragging:I.value,"icon-before":!!h.value,"icon-after":!!k.value,"drop-area":x.value})))),{HintSlot:L,hasHintLabelOrSlot:w,hasInvalidLabelOrSlot:V,hintSlotScope:A}=function(t,l){const o=e.computed((()=>e.isRef(t)?t.value:t)),a=e.computed((()=>M(o.value.invalidLabel))),n=e.computed((()=>M(o.value.validLabel))),r=e.computed((()=>o.value.loadingLabel)),i=e.computed((()=>o.value.hintLabel)),u=e.computed((()=>Boolean(o.value.loading&&(l.loading||r.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||i.value))),v=e.computed((()=>d.value||s.value||u.value||c.value)),f=e.computed((()=>({modelValue:o.value.modelValue,valid:o.value.valid,invalid:o.value.invalid,loading:o.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:i,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:c}),render(){var t,l,o,a,n,r,i,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==(r=(n=this.$slots).valid)?void 0:r.call(n))??this.validLabel):e.h(this.tag,{role:d},(null==(u=(i=this.$slots).hint)?void 0:u.call(i))??this.$slots.hint??this.hintLabel)}return null}});return{hasInvalidLabelOrSlot:d,hasHintLabelOrSlot:c,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}(u,i),C=t.useVModel(n,"modelValue",r),$=e.computed({get:()=>{var e;return C.value&&(Array.isArray(C.value)||(null==(e=C.value)?void 0:e.name))?Array.isArray(C.value)?C.value:[C.value]:[]},set:e=>{_.value?C.value=e:C.value=null==e?void 0:e[0]}}),N=e.computed((()=>n.disabled||n.readonly)),O=e.computed((()=>"string"==typeof n.max?Number.parseInt(n.max):n.max)),x=e.computed((()=>n.dropArea&&!N.value)),_=e.computed((()=>!!n.multiple&&(!O.value||O.value-$.value.length>1))),I=e.ref(!1),P=e.ref();function j(){I.value=!0}function E(){I.value=!1}function D(e){var t,l;(null==(t=e.dataTransfer)?void 0:t.files)&&(I.value=!1,T(null==(l=e.dataTransfer)?void 0:l.files))}function F(){var e;(null==(e=P.value)?void 0:e.files)&&(T(P.value.files),P.value.value="")}function T(e){const t=function(e,t){if(!t||""===t.trim()||"*"===t)return Array.from(e);const{mimeTypes:l,extensions:o,wildcards:a}=function(e){const t=[],l=[],o=[],a=null==e?void 0:e.split(",").map((e=>e.trim().toLowerCase()));return(null==a?void 0:a.length)&&a.forEach((e=>{e.startsWith(".")?l.push(e):e.includes("/*")?o.push(e.replace("/*","")):t.push(e)})),{mimeTypes:t,extensions:l,wildcards:o}}(t);return Array.from(e).filter((e=>{var t;const n=e.type.toLowerCase(),r=`.${null==(t=e.name.split(".").pop())?void 0:t.toLowerCase()}`,i=l.includes(n),u=a.some((e=>n.startsWith(`${e}/`))),d=o.some((e=>r===e.toLowerCase()));return i||u||d}))}(e,n.accept);if(!n.multiple)return Array.isArray(C.value)?void(C.value=t):void(C.value=t[0]);let l=[];l=!Array.isArray(C.value)&&C.value?[C.value]:C.value&&Array.isArray(C.value)?[...C.value]:l;for(const o of t){if(O.value&&l.length>=O.value)break;l.push(o)}C.value=l,q.value=l.length-1}function z(){P.value&&(N.value||P.value.click())}const q=e.ref(0),K=["image/jpeg","image/png"],Y=e.computed((()=>{if(0===$.value.length)return;if(!$.value[q.value])return;if($.value[q.value]instanceof File){const e=$.value[q.value];if(!K.includes(e.type))return;return URL.createObjectURL(e)}const e=$.value[q.value];return e.thumbnailUrl?e.thumbnailUrl:K.includes(e.type)?e.url:void 0}));function de(e,t){if(!e)return;if(0===e)return"0 Bytes";const l=Math.floor(Math.log(e)/Math.log(1024));return`${Number.parseFloat((e/1024**l).toFixed(2))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][l]}`}e.watch(Y,((e,t)=>{t&&URL.revokeObjectURL(t)})),e.onBeforeUnmount((()=>{Y.value&&URL.revokeObjectURL(Y.value)}));const se=e.computed((()=>0===$.value.length||_.value?n.labelAdd:n.labelReplace)),ce=e.computed((()=>0===$.value.length||_.value?n.iconAdd:n.iconReplace));function ve({newIndex:e}){null!==e&&(q.value=e)}return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(B))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(g)},e.toDisplayString(t.label),9,Q)):e.createCommentVNode("v-if",!0),x.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vv-input-file__drop-area",onDragenter:e.withModifiers(j,["prevent","stop"]),onDragleave:e.withModifiers(E,["prevent","stop"]),onDrop:e.withModifiers(D,["prevent","stop"]),onDragover:o[0]||(o[0]=e.withModifiers((()=>{}),["prevent","stop"])),onClick:e.withModifiers(z,["stop"])},[e.renderSlot(t.$slots,"drop-area",{},(()=>[e.createElementVNode("picture",X,[Y.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:Y.value,alt:$.value[q.value].name},null,8,ee)):e.createCommentVNode("v-if",!0)]),e.unref(c)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(Z,{key:0,modifiers:"action",label:Y.value?void 0:se.value,title:Y.value?se.value:void 0,disabled:e.unref(v),class:e.normalizeClass({"vv-input-file__drop-area-action":Y.value}),icon:ce.value,onClick:e.withModifiers(z,["stop"])},null,8,["label","title","disabled","class","icon"]))]))],32)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",te,[e.unref(h)?(e.openBlock(),e.createBlock(H,e.normalizeProps(e.mergeProps({key:0},e.unref(h))),null,16)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{id:e.unref(g),ref_key:"inputEl",ref:P,type:"file",readonly:e.unref(c),disabled:e.unref(v),required:t.required,placeholder:t.placeholder,"aria-describedby":e.unref(w)?b.value:void 0,"aria-invalid":t.invalid,"aria-errormessage":e.unref(V)?b.value:void 0,multiple:_.value,accept:t.accept,capture:t.capture,name:t.name,onChange:F},null,40,le),y.value?(e.openBlock(),e.createElementBlock("progress",{key:1,class:"vv-input-file__progress",value:t.progress,max:"100"},e.toDisplayString(t.progress)+"% ",9,oe)):e.createCommentVNode("v-if",!0),e.unref(k)?(e.openBlock(),e.createBlock(H,e.normalizeProps(e.mergeProps({key:2},e.unref(k))),null,16)):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(l),{modelValue:$.value,"onUpdate:modelValue":o[1]||(o[1]=e=>$.value=e),tag:"ul",class:"vv-input-file__list","item-key":"name",move:()=>t.sortable,onEnd:ve},{item:e.withCtx((({element:l,index:o})=>[e.createElementVNode("li",{class:e.normalizeClass(["vv-input-file__item",{active:o===q.value&&x.value&&$.value.length>1,"cursor-move":t.sortable}]),onClick:e.withModifiers((e=>function(e){q.value=e}(o)),["stop"])},[e.unref(S)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"vv-input-file__item-action",title:t.labelDownload,onClick:e.withModifiers((e=>function(e){r("download",e);const t=e instanceof File?URL.createObjectURL(e):e.url;if(!t)return;const l=document.createElement("a");l.href=t,l.setAttribute("download",e.name),document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(l.href)}(l)),["stop"])},[e.createVNode(H,e.normalizeProps(e.guardReactiveProps(e.unref(S))),null,16)],8,ne)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",re,e.toDisplayString(l.name),1),e.createElementVNode("small",ie,e.toDisplayString(de(l.size)),1),e.unref(c)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"vv-input-file__item-remove",title:t.labelRemove,disabled:e.unref(v),onClick:e.withModifiers((e=>function(e){const t=Array.isArray(C.value)?C.value[e]:C.value;if(!t)return;if(r("remove",t),!Array.isArray(C.value))return void(C.value=void 0);q.value===e&&(q.value=0);const l=[...C.value];l.splice(e,1),C.value=l}(o)),["stop"])},null,8,ue))],10,ae)])),_:1},8,["modelValue","move"]),e.createVNode(e.unref(L),{id:b.value,class:"vv-input-file__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(A))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(A))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(A))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(A))))])),key:"3"}:void 0]),1032,["id"])],2))}})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue"),require("@vueuse/core"),require("vuedraggable"),require("@iconify/vue")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","vuedraggable","@iconify/vue"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvInputFile=t(e.vue,e.core,e.Sortable,e.vue$1)}(this,function(e,t,o,l){"use strict";const a="add",n="edit",r="download",i={prefix:"normal"};var u=(e=>(e.local="local",e.session="session",e))(u||{}),s=(e=>(e.left="left",e.right="right",e.top="top",e.bottom="bottom",e))(s||{}),d=(e=>(e.before="before",e.after="after",e))(d||{}),c=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(c||{}),v=(e=>(e.nuxtLink="nuxt-link",e.routerLink="router-link",e.a="a",e.button="button",e))(v||{});const f=Symbol.for("volver"),p=Symbol.for("buttonGroup"),m=Symbol.for("dropdownTrigger"),g=Symbol.for("dropdownAction"),b={to:{type:[String,Object]},href:String,target:String,rel:{type:String,default:"noopener noreferrer"}},y={valid:{type:Boolean,default:!1},validLabel:{type:[String,Array],default:void 0}},h={invalid:{type:Boolean,default:!1},invalidLabel:{type:[String,Array],default:void 0}},k={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},S={disabled:{type:Boolean,default:!1}},B={required:{type:Boolean,default:!1}},L={active:{type:Boolean,default:!1}},w={current:{type:Boolean,default:!1}},V={pressed:{type:Boolean,default:!1}},A={label:{type:[String,Number],default:void 0}},C={readonly:{type:Boolean,default:!1}},$={modifiers:{type:[String,Array],default:void 0}},N={hintLabel:{type:String,default:""}},O={icon:{type:[String,Object],default:void 0},iconPosition:{type:String,default:d.before,validation:e=>Object.values(d).includes(e)}},x={unselectable:{type:Boolean,default:!0}},_={id:[String,Number]};s.bottom;const I={..._,name:{type:String,required:!0}},P={...S,...A,...V,...L,...w,...b,type:{type:String,default:c.button,validator:e=>Object.values(c).includes(e)},ariaLabel:{type:String,default:void 0},defaultTag:{type:String,default:v.button}};u.local;const R={...I,...$,...y,...h,...N,...A,...k,...C,...S,...B,...O,modelValue:{type:Object},progress:{type:[Number,String],default:void 0},placeholder:{type:String,default:void 0},accept:{type:String,default:"*"},multiple:{type:Boolean,default:!1},capture:{type:String,default:void 0,validation:e=>void 0===e||["user","environment"].includes(e)},max:{type:[Number,String],default:void 0},dropArea:{type:Boolean,default:!1},sortable:{type:Boolean,default:!1},labelAdd:{type:String,default:"Add file"},iconAdd:{type:[String,Object],default:a},labelReplace:{type:String,default:"Replace file"},iconReplace:{type:[String,Object],default:n},labelDownload:{type:String,default:"Downlaod file"},iconDownload:{type:[String,Object],default:r},labelRemove:{type:String,default:"Remove file"}};function j(e,t,o){return E(e,t)}function E(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){const o=Array.isArray(e),l=Array.isArray(t);let a,n,r;if(o&&l){if(n=e.length,n!==t.length)return!1;for(a=n;0!==a--;)if(!E(e[a],t[a]))return!1;return!0}if(o!==l)return!1;const i=e instanceof Date,u=t instanceof Date;if(i!==u)return!1;if(i&&u)return e.getTime()===t.getTime();const s=e instanceof RegExp,d=t instanceof RegExp;if(s!==d)return!1;if(s&&d)return e.toString()===t.toString();const c=Object.keys(e);if(n=c.length,n!==Object.keys(t).length)return!1;for(a=n;0!==a--;)if(!Object.prototype.hasOwnProperty.call(t,c[a]))return!1;for(a=n;0!==a--;)if(r=c[a],!E(e[r],t[r]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function D(e,t){if(null!=e&&t&&t.length)for(const o of t)if(j(e,o))return!0;return!1}function M(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).join(" "):e}const F={...P,..._,...$,...x,...k,...O,iconPosition:{type:String,default:s.left,validator:e=>Object.values(s).includes(e)},loadingIcon:{type:String,default:"eos-icons:bubble-loading"},toggle:{type:Boolean,default:!1},value:{type:[String,Number,Boolean],default:void 0},uncheckedValue:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[String,Number,Boolean],default:void 0}};function T(t,o){const{group:l,isInGroup:a,getGroupOrLocalRef:n}=function(t){const o=e.inject(t,void 0),l=e.computed(()=>void 0!==o);return{group:o,isInGroup:l,getGroupOrLocalRef:function(t,l,a){const n=o?.[t];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const r=e.toRef(l,t);return e.computed({get:()=>r.value,set(e){a&&a(`update:${t}`,e)}})}}}(p),{id:r,iconPosition:i,icon:u,label:s,pressed:d}=e.toRefs(t),c=n("modelValue",t,o),v=n("toggle",t),f=n("unselectable",t),m=e.computed(()=>l?.multiple.value??!1),g=e.computed(()=>{let e=t.modifiers,o=l?.modifiers.value;const a=new Set;return e&&(Array.isArray(e)||(e=e.split(" ")),e.forEach(e=>a.add(e))),o&&(Array.isArray(o)||(o=o.split(" ")),o.forEach(e=>a.add(e))),Array.from(a)}),b=e.computed(()=>Boolean(t.disabled||l?.disabled.value));return{group:l,isInGroup:a,modelValue:c,toggle:v,unselectable:f,multiple:m,modifiers:g,disabled:b,id:r,pressed:d,iconPosition:i,icon:u,label:s}}const z=P;function U(){return e.inject(f,void 0)}const q=e.defineComponent({name:"VvAction",props:z,emits:["click","mouseover","mouseleave"],setup(t,{expose:o,emit:l}){const a=t,n=l,r=e.getCurrentInstance(),i=U(),u=e.ref(null);o({$el:u});const{reference:s,bus:d,aria:c,expanded:f}=e.inject(m,{});e.watch(()=>u.value,e=>{s&&(s.value=e)});const p=e.computed(()=>a.pressed||f?.value),{role:b}=e.inject(g,{}),y=e.computed(()=>{switch(!0){case a.disabled:return v.button;case void 0!==a.to:return i?.nuxt?e.resolveComponent(v.nuxtLink):v.routerLink;case void 0!==a.href:return v.a;default:return a.defaultTag}}),h=e.computed(()=>{const e={...c?.value,ariaPressed:!!p.value||void 0,ariaLabel:a.ariaLabel,role:b?.value};switch(y.value){case v.a:return{...e,href:a.href,target:a.target,rel:a.rel};case v.routerLink:case v.nuxtLink:return{...e,to:a.to,target:a.target};case v.button:return{...e,type:a.type,disabled:a.disabled};default:return e}});function k(e){a.disabled?e.preventDefault():r?.vnode.props?.onClick?n("click",e):d?.emit("click",e)}function S(e){r?.vnode.props?.onMouseover?n("mouseover",e):d?.emit("mouseover",e)}function B(e){r?.vnode.props?.onMouseleave?n("mouseleave",e):d?.emit("mouseleave",e)}return(t,o)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.mergeProps(e.unref(h),{ref_key:"element",ref:u,class:{active:t.active,pressed:e.unref(p),disabled:t.disabled,current:t.current},onClickPassive:k,onMouseoverPassive:S,onMouseleavePassive:B}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)])]),_:3},16,["class"]))}});function G(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 H=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:{}},i),setup(t){const o=t,a=e.computed(()=>"string"==typeof o.rotate?Number.parseFloat(o.rotate):o.rotate),n=e.ref(!0),r=U(),{modifiers:i}=e.toRefs(o),u=G("vv-icon",i),s=e.computed(()=>o.provider||r?.iconsProvider),d=e.computed(()=>{const e=o.name??"",t=`@${s.value}:${o.prefix}:${e}`;if(l.iconLoaded(t))return t;const a=r?.iconsCollections.find(t=>{const o=`@${s.value}:${t.prefix}:${e}`;return l.iconLoaded(o)});return a?`@${s.value}:${a.prefix}:${e}`:e});function c(e){const t=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=t?.innerHTML.trim()||"";t&&a&&l.addIcon(`@${s.value}:${o.prefix}:${o.name}`,{body:a,height:t.viewBox.baseVal.height,width:t.viewBox.baseVal.width})}return r&&o.src&&!l.iconLoaded(`@${s.value}:${o.prefix}:${o.name}`)&&(n.value=!1,r.fetchIcon(o.src).then(e=>{e&&(c(e),n.value=!0)}).catch(e=>{throw new Error(`Error during fetch icon: ${e?.message}`)})),o.svg&&c(o.svg),(t,o)=>e.unref(n)?(e.openBlock(),e.createBlock(e.unref(l.Icon),e.mergeProps({key:0,class:e.unref(u)},{inline:t.inline,width:t.width,height:t.height,horizontalFlip:t.horizontalFlip,verticalFlip:t.verticalFlip,flip:t.flip,rotate:e.unref(a),color:t.color,icon:e.unref(d)},{onLoad:t.onLoad}),null,16,["class","onLoad"])):e.createCommentVNode("v-if",!0)}});function J(t){return e.computed(()=>String(t?.value||e.useId()))}function W(t,o){const l=e.computed(()=>"string"==typeof t?.value?{name:t?.value}:t?.value),a=e.computed(()=>o?.value===d.before?l.value:void 0),n=e.computed(()=>o?.value===d.after?l.value:void 0),r=e.computed(()=>o?.value===s.left?l.value:void 0),i=e.computed(()=>o?.value===s.right?l.value:void 0),u=e.computed(()=>o?.value===s.top?l.value:void 0),c=e.computed(()=>o?.value===s.bottom?l.value:void 0);return{hasIcon:l,hasIconLeft:r,hasIconRight:i,hasIconTop:u,hasIconBottom:c,hasIconBefore:a,hasIconAfter:n}}const K={key:1,class:"vv-button__label"},Y={key:1,class:"vv-button__label"},Z=e.defineComponent({name:"VvButton",inheritAttrs:!1,props:F,emits:["update:modelValue"],setup(t,{expose:o,emit:l}){const a=t,n=l,r=e.useAttrs(),i=e.useSlots(),{id:u,modifiers:d,iconPosition:c,icon:v,label:f,modelValue:p,disabled:m,toggle:g,unselectable:b}=T(a,n),y=J(u),h=e.computed(()=>r?.name||y.value),k=e.ref(null);o({$el:e.computed(()=>k.value?.$el)});const S=e.computed(()=>g.value?Array.isArray(p.value)?D(h.value,p.value):j(h.value,p.value):a.pressed),B=G("vv-button",d,e.computed(()=>({reverse:[s.right,s.bottom].includes(c.value),column:[s.top,s.bottom].includes(c.value),"icon-only":Boolean(v?.value&&!f?.value&&!i.default)}))),{hasIcon:L}=W(v),w=e.computed(()=>void 0!==a.value?a.value:h.value),V=e.computed(()=>{if(g.value)return{onClick:A}});function A(){if(g.value){if(Array.isArray(p.value))return D(w.value,p.value)?void(b.value&&(p.value=p.value.filter(e=>e!==w.value))):void p.value.push(w.value);if(w.value===p.value&&b.value)return void(p.value=a.uncheckedValue);p.value=w.value}}return(t,o)=>(e.openBlock(),e.createBlock(q,e.mergeProps({...e.unref(r),...e.unref(V),disabled:e.unref(m),pressed:e.unref(S),active:t.active,type:t.type,to:t.to,href:t.href,target:t.target,rel:t.rel,ariaLabel:t.ariaLabel},{id:e.unref(y),ref_key:"element",ref:k,class:e.unref(B)}),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default",{},()=>[t.loading?e.renderSlot(t.$slots,"loading",{key:0},()=>[t.loadingIcon?(e.openBlock(),e.createBlock(H,{key:0,class:"vv-button__loading-icon",name:t.loadingIcon},null,8,["name"])):e.createCommentVNode("v-if",!0),t.loadingLabel?(e.openBlock(),e.createElementBlock("span",K,e.toDisplayString(t.loadingLabel),1)):e.createCommentVNode("v-if",!0)]):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.renderSlot(t.$slots,"before"),e.unref(L)?(e.openBlock(),e.createBlock(H,e.mergeProps({key:0},e.unref(L),{class:"vv-button__icon"}),null,16)):e.createCommentVNode("v-if",!0),e.unref(f)?(e.openBlock(),e.createElementBlock("span",Y,[e.renderSlot(t.$slots,"label",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(f)),1)])])):e.createCommentVNode("v-if",!0),e.renderSlot(t.$slots,"after")],64))])]),_:3},16,["id","class"]))}});const Q=["for"],X={class:"vv-input-file__preview"},ee=["src","alt"],te={class:"vv-input-file__wrapper"},oe=["id","readonly","disabled","required","placeholder","aria-describedby","aria-invalid","aria-errormessage","multiple","accept","capture","name"],le=["value"],ae=["onClick"],ne=["title","onClick"],re={class:"vv-input-file__item-name"},ie={class:"vv-input-file__item-info"},ue=["title","disabled","onClick"];return e.defineComponent({name:"VvInputFile",props:R,emits:["remove","download","update:modelValue"],setup(l,{emit:a}){const n=l,r=a,i=e.useSlots(),u=function(t,o,l){const a=U(),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},{})})}("VvInputFile",R,n),{modifiers:s,id:d,readonly:c,disabled:v,icon:f,iconPosition:p,iconDownload:m}=e.toRefs(n),g=J(d),b=e.computed(()=>`${g.value}-hint`),y=e.computed(()=>{if(!n.progress)return!1;const e="string"==typeof n.progress?Number.parseInt(n.progress):n.progress;return e>0&&e<100}),{hasIconBefore:h,hasIconAfter:k}=W(f,p),{hasIcon:S}=W(m),B=G("vv-input-file",s,e.computed(()=>({valid:!0===n.valid,invalid:!0===n.invalid,loading:n.loading&&!y.value,disabled:n.disabled,required:n.required,readonly:n.readonly,dragging:I.value,"icon-before":!!h.value,"icon-after":!!k.value,"drop-area":x.value}))),{HintSlot:L,hasHintLabelOrSlot:w,hasInvalidLabelOrSlot:V,hintSlotScope:A}=function(t,o){const l=e.computed(()=>e.isRef(t)?t.value:t),a=e.computed(()=>M(l.value.invalidLabel)),n=e.computed(()=>M(l.value.validLabel)),r=e.computed(()=>l.value.loadingLabel),i=e.computed(()=>l.value.hintLabel),u=e.computed(()=>Boolean(l.value.loading&&(o.loading||r.value))),s=e.computed(()=>!u.value&&Boolean(l.value.invalid&&(o.invalid||a.value))),d=e.computed(()=>!u.value&&!s.value&&Boolean(l.value.valid&&(o.valid||n.value))),c=e.computed(()=>!u.value&&!s.value&&!d.value&&Boolean(o.hint||i.value)),v=e.computed(()=>s.value||d.value||u.value||c.value),f=e.computed(()=>({modelValue:l.value.modelValue,valid:l.value.valid,invalid:l.value.invalid,loading:l.value.loading})),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:v,invalidLabel:a,validLabel:n,loadingLabel:r,hintLabel:i,hasInvalidLabelOrSlot:s,hasValidLabelOrSlot:d,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:s,hasHintLabelOrSlot:c,hasValidLabelOrSlot:d,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}(u,i),C=t.useVModel(n,"modelValue",r),$=e.computed({get:()=>C.value&&(Array.isArray(C.value)||C.value?.name)?Array.isArray(C.value)?C.value:[C.value]:[],set:e=>{_.value?C.value=e:C.value=e?.[0]}}),N=e.computed(()=>n.disabled||n.readonly),O=e.computed(()=>"string"==typeof n.max?Number.parseInt(n.max):n.max),x=e.computed(()=>n.dropArea&&!N.value),_=e.computed(()=>!!n.multiple&&(!O.value||O.value-$.value.length>1)),I=e.ref(!1),P=e.ref();function j(){I.value=!0}function E(){I.value=!1}function D(e){e.dataTransfer?.files&&(I.value=!1,T(e.dataTransfer?.files))}function F(){P.value?.files&&(T(P.value.files),P.value.value="")}function T(e){const t=function(e,t){if(!t||""===t.trim()||"*"===t)return Array.from(e);const{mimeTypes:o,extensions:l,wildcards:a}=function(e){const t=[],o=[],l=[],a=e?.split(",").map(e=>e.trim().toLowerCase());return a?.length&&a.forEach(e=>{e.startsWith(".")?o.push(e):e.includes("/*")?l.push(e.replace("/*","")):t.push(e)}),{mimeTypes:t,extensions:o,wildcards:l}}(t);return Array.from(e).filter(e=>{const t=e.type.toLowerCase(),n=`.${e.name.split(".").pop()?.toLowerCase()}`,r=o.includes(t),i=a.some(e=>t.startsWith(`${e}/`)),u=l.some(e=>n===e.toLowerCase());return r||i||u})}(e,n.accept);if(!n.multiple)return Array.isArray(C.value)?void(C.value=t):void(C.value=t[0]);let o=[];o=!Array.isArray(C.value)&&C.value?[C.value]:C.value&&Array.isArray(C.value)?[...C.value]:o;for(const l of t){if(O.value&&o.length>=O.value)break;o.push(l)}C.value=o,q.value=o.length-1}function z(){P.value&&(N.value||P.value.click())}const q=e.ref(0),K=["image/jpeg","image/png"],Y=e.computed(()=>{if(0===$.value.length)return;if(!$.value[q.value])return;if($.value[q.value]instanceof File){const e=$.value[q.value];if(!K.includes(e.type))return;return URL.createObjectURL(e)}const e=$.value[q.value];return e.thumbnailUrl?e.thumbnailUrl:K.includes(e.type)?e.url:void 0});function se(e,t){if(!e)return;if(0===e)return"0 Bytes";const o=Math.floor(Math.log(e)/Math.log(1024));return`${Number.parseFloat((e/1024**o).toFixed(2))} ${["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][o]}`}e.watch(Y,(e,t)=>{t&&URL.revokeObjectURL(t)}),e.onBeforeUnmount(()=>{Y.value&&URL.revokeObjectURL(Y.value)});const de=e.computed(()=>0===$.value.length||_.value?n.labelAdd:n.labelReplace),ce=e.computed(()=>0===$.value.length||_.value?n.iconAdd:n.iconReplace);function ve({newIndex:e}){null!==e&&(q.value=e)}return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(e.unref(B))},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:e.unref(g)},e.toDisplayString(t.label),9,Q)):e.createCommentVNode("v-if",!0),x.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"vv-input-file__drop-area",onDragenter:e.withModifiers(j,["prevent","stop"]),onDragleave:e.withModifiers(E,["prevent","stop"]),onDrop:e.withModifiers(D,["prevent","stop"]),onDragover:l[0]||(l[0]=e.withModifiers(()=>{},["prevent","stop"])),onClick:e.withModifiers(z,["stop"])},[e.renderSlot(t.$slots,"drop-area",{},()=>[e.createElementVNode("picture",X,[Y.value?(e.openBlock(),e.createElementBlock("img",{key:0,src:Y.value,alt:$.value[q.value].name},null,8,ee)):e.createCommentVNode("v-if",!0)]),e.unref(c)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createBlock(Z,{key:0,modifiers:"action",label:Y.value?void 0:de.value,title:Y.value?de.value:void 0,disabled:e.unref(v),class:e.normalizeClass({"vv-input-file__drop-area-action":Y.value}),icon:ce.value,onClick:e.withModifiers(z,["stop"])},null,8,["label","title","disabled","class","icon"]))])],32)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",te,[e.unref(h)?(e.openBlock(),e.createBlock(H,e.normalizeProps(e.mergeProps({key:0},e.unref(h))),null,16)):e.createCommentVNode("v-if",!0),e.createElementVNode("input",{id:e.unref(g),ref_key:"inputEl",ref:P,type:"file",readonly:e.unref(c),disabled:e.unref(v),required:t.required,placeholder:t.placeholder,"aria-describedby":e.unref(w)?b.value:void 0,"aria-invalid":t.invalid,"aria-errormessage":e.unref(V)?b.value:void 0,multiple:_.value,accept:t.accept,capture:t.capture,name:t.name,onChange:F},null,40,oe),y.value?(e.openBlock(),e.createElementBlock("progress",{key:1,class:"vv-input-file__progress",value:t.progress,max:"100"},e.toDisplayString(t.progress)+"% ",9,le)):e.createCommentVNode("v-if",!0),e.unref(k)?(e.openBlock(),e.createBlock(H,e.normalizeProps(e.mergeProps({key:2},e.unref(k))),null,16)):e.createCommentVNode("v-if",!0)]),e.createVNode(e.unref(o),{modelValue:$.value,"onUpdate:modelValue":l[1]||(l[1]=e=>$.value=e),tag:"ul",class:"vv-input-file__list","item-key":"name",move:()=>t.sortable,onEnd:ve},{item:e.withCtx(({element:o,index:l})=>[e.createElementVNode("li",{class:e.normalizeClass(["vv-input-file__item",{active:l===q.value&&x.value&&$.value.length>1,"cursor-move":t.sortable}]),onClick:e.withModifiers(e=>function(e){q.value=e}(l),["stop"])},[e.unref(S)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"vv-input-file__item-action",title:t.labelDownload,onClick:e.withModifiers(e=>function(e){r("download",e);const t=e instanceof File?URL.createObjectURL(e):e.url;if(!t)return;const o=document.createElement("a");o.href=t,o.setAttribute("download",e.name),document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(o.href)}(o),["stop"])},[e.createVNode(H,e.normalizeProps(e.guardReactiveProps(e.unref(S))),null,16)],8,ne)):e.createCommentVNode("v-if",!0),e.createElementVNode("div",re,e.toDisplayString(o.name),1),e.createElementVNode("small",ie,e.toDisplayString(se(o.size)),1),e.unref(c)?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"vv-input-file__item-remove",title:t.labelRemove,disabled:e.unref(v),onClick:e.withModifiers(e=>function(e){const t=Array.isArray(C.value)?C.value[e]:C.value;if(!t)return;if(r("remove",t),!Array.isArray(C.value))return void(C.value=void 0);q.value===e&&(q.value=0);const o=[...C.value];o.splice(e,1),C.value=o}(l),["stop"])},null,8,ue))],10,ae)]),_:1},8,["modelValue","move"]),e.createVNode(e.unref(L),{id:b.value,class:"vv-input-file__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(A))))]),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(A))))]),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(A))))]),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(A))))]),key:"3"}:void 0]),1032,["id"])],2))}})});
|
|
@@ -266,6 +266,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<globalThis
|
|
|
266
266
|
disabled: boolean;
|
|
267
267
|
modifiers: string | string[];
|
|
268
268
|
progress: string | number;
|
|
269
|
+
placeholder: string;
|
|
269
270
|
icon: string | import("../VvIcon").VvIconProps;
|
|
270
271
|
iconPosition: "before" | "after";
|
|
271
272
|
required: boolean;
|
|
@@ -278,7 +279,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<globalThis
|
|
|
278
279
|
invalidLabel: string | unknown[];
|
|
279
280
|
valid: boolean;
|
|
280
281
|
validLabel: string | unknown[];
|
|
281
|
-
placeholder: string;
|
|
282
282
|
accept: string;
|
|
283
283
|
capture: "user" | "environment";
|
|
284
284
|
max: string | number;
|
|
@@ -40,7 +40,7 @@ function getInputValueFromDate(date, typeOfInput = "date", withSeconds) {
|
|
|
40
40
|
return `${toReturn}T${time}`;
|
|
41
41
|
}
|
|
42
42
|
function getDateFromInputValue(value, typeOfInput = "date") {
|
|
43
|
-
if (!
|
|
43
|
+
if (!value?.trim()) {
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -144,7 +144,6 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
144
144
|
};
|
|
145
145
|
},
|
|
146
146
|
render() {
|
|
147
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
148
147
|
if (this.isVisible) {
|
|
149
148
|
let role;
|
|
150
149
|
if (this.hasInvalidLabelOrSlot) {
|
|
@@ -159,7 +158,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
159
158
|
{
|
|
160
159
|
role
|
|
161
160
|
},
|
|
162
|
-
|
|
161
|
+
this.$slots.loading?.() ?? this.loadingLabel
|
|
163
162
|
);
|
|
164
163
|
}
|
|
165
164
|
if (this.hasInvalidLabelOrSlot) {
|
|
@@ -168,7 +167,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
168
167
|
{
|
|
169
168
|
role
|
|
170
169
|
},
|
|
171
|
-
|
|
170
|
+
this.$slots.invalid?.() ?? this.$slots.invalid ?? this.invalidLabel
|
|
172
171
|
);
|
|
173
172
|
}
|
|
174
173
|
if (this.hasValidLabelOrSlot) {
|
|
@@ -177,7 +176,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
177
176
|
{
|
|
178
177
|
role
|
|
179
178
|
},
|
|
180
|
-
|
|
179
|
+
this.$slots.valid?.() ?? this.validLabel
|
|
181
180
|
);
|
|
182
181
|
}
|
|
183
182
|
return h(
|
|
@@ -185,7 +184,7 @@ function HintSlotFactory(propsOrRef, slots) {
|
|
|
185
184
|
{
|
|
186
185
|
role
|
|
187
186
|
},
|
|
188
|
-
|
|
187
|
+
this.$slots.hint?.() ?? this.$slots.hint ?? this.hintLabel
|
|
189
188
|
);
|
|
190
189
|
}
|
|
191
190
|
return null;
|
|
@@ -691,7 +690,7 @@ const VvDropdownOptionProps = {
|
|
|
691
690
|
}
|
|
692
691
|
};
|
|
693
692
|
function useUniqueId(id) {
|
|
694
|
-
return computed(() => String(
|
|
693
|
+
return computed(() => String(id?.value || useId()));
|
|
695
694
|
}
|
|
696
695
|
function useDropdownProvideTrigger({
|
|
697
696
|
reference,
|
|
@@ -712,8 +711,7 @@ function useDropdownProvideTrigger({
|
|
|
712
711
|
});
|
|
713
712
|
},
|
|
714
713
|
render() {
|
|
715
|
-
|
|
716
|
-
return h(Fragment, {}, (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a));
|
|
714
|
+
return h(Fragment, {}, this.$slots.default?.());
|
|
717
715
|
}
|
|
718
716
|
});
|
|
719
717
|
return {
|
|
@@ -747,7 +745,7 @@ function useModifiers(prefix, modifiers, others) {
|
|
|
747
745
|
const toReturn = {
|
|
748
746
|
[prefix]: true
|
|
749
747
|
};
|
|
750
|
-
const modifiersArray = typeof
|
|
748
|
+
const modifiersArray = typeof modifiers?.value === "string" ? modifiers.value.split(" ") : modifiers?.value;
|
|
751
749
|
if (modifiersArray) {
|
|
752
750
|
if (Array.isArray(modifiersArray)) {
|
|
753
751
|
modifiersArray.forEach((modifier) => {
|
|
@@ -813,8 +811,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
813
811
|
useMutationObserver(
|
|
814
812
|
floatingEl.value,
|
|
815
813
|
() => {
|
|
816
|
-
|
|
817
|
-
hasCustomPosition.value = ((_a = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")) == null ? void 0 : _a.trim()) === "true";
|
|
814
|
+
hasCustomPosition.value = window.getComputedStyle(floatingEl.value).getPropertyValue("--dropdown-custom-position")?.trim() === "true";
|
|
818
815
|
},
|
|
819
816
|
{
|
|
820
817
|
attributeFilter: ["style"],
|
|
@@ -901,11 +898,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
901
898
|
}
|
|
902
899
|
);
|
|
903
900
|
const dropdownPlacement = computed(() => {
|
|
904
|
-
var _a;
|
|
905
901
|
if (hasCustomPosition.value) {
|
|
906
902
|
return void 0;
|
|
907
903
|
}
|
|
908
|
-
const width = props.triggerWidth && referenceEl.value ? `${
|
|
904
|
+
const width = props.triggerWidth && referenceEl.value ? `${referenceEl.value?.offsetWidth}px` : void 0;
|
|
909
905
|
return {
|
|
910
906
|
position: strategy.value,
|
|
911
907
|
top: `${y.value ?? 0}px`,
|
|
@@ -919,7 +915,6 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
919
915
|
() => placement.value.split("-")[0]
|
|
920
916
|
);
|
|
921
917
|
const arrowPlacement = computed(() => {
|
|
922
|
-
var _a, _b, _c, _d, _e;
|
|
923
918
|
if (hasCustomPosition.value) {
|
|
924
919
|
return void 0;
|
|
925
920
|
}
|
|
@@ -930,9 +925,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
930
925
|
[Side.left]: Side.right
|
|
931
926
|
}[side.value];
|
|
932
927
|
return {
|
|
933
|
-
left:
|
|
934
|
-
top:
|
|
935
|
-
[staticSide]: `${-(
|
|
928
|
+
left: middlewareData.value.arrow?.x !== void 0 ? `${middlewareData.value.arrow?.x}px` : void 0,
|
|
929
|
+
top: middlewareData.value.arrow?.y !== void 0 ? `${middlewareData.value.arrow?.y}px` : void 0,
|
|
930
|
+
[staticSide]: `${-(arrowEl.value?.offsetWidth ?? 0) / 2}px`
|
|
936
931
|
};
|
|
937
932
|
});
|
|
938
933
|
const modelValue = useVModel(props, "modelValue", emit);
|
|
@@ -969,8 +964,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
969
964
|
{ ignore: [referenceEl] }
|
|
970
965
|
);
|
|
971
966
|
const hasAriaLabelledby = computed(() => {
|
|
972
|
-
|
|
973
|
-
return ((_b = (_a = referenceEl.value) == null ? void 0 : _a.getAttribute) == null ? void 0 : _b.call(_a, "id")) ?? void 0;
|
|
967
|
+
return referenceEl.value?.getAttribute?.("id") ?? void 0;
|
|
974
968
|
});
|
|
975
969
|
const referenceAria = computed(() => ({
|
|
976
970
|
"aria-controls": hasId.value,
|
|
@@ -1121,7 +1115,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
1121
1115
|
onKeyStroke([" ", "Enter"], (e) => {
|
|
1122
1116
|
const htmlEl = e.target;
|
|
1123
1117
|
if (expanded.value && focused.value && htmlEl) {
|
|
1124
|
-
htmlEl
|
|
1118
|
+
htmlEl?.click();
|
|
1125
1119
|
}
|
|
1126
1120
|
});
|
|
1127
1121
|
const dropdownTransitionHandlers = {
|
|
@@ -1355,7 +1349,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1355
1349
|
const { modifiers } = toRefs(props);
|
|
1356
1350
|
const bemCssClasses = useModifiers("vv-icon", modifiers);
|
|
1357
1351
|
const provider = computed(() => {
|
|
1358
|
-
return props.provider ||
|
|
1352
|
+
return props.provider || volver?.iconsProvider;
|
|
1359
1353
|
});
|
|
1360
1354
|
const icon = computed(() => {
|
|
1361
1355
|
const name = props.name ?? "";
|
|
@@ -1363,7 +1357,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1363
1357
|
if (iconLoaded(iconName)) {
|
|
1364
1358
|
return iconName;
|
|
1365
1359
|
}
|
|
1366
|
-
const iconsCollection = volver
|
|
1360
|
+
const iconsCollection = volver?.iconsCollections.find(
|
|
1367
1361
|
(iconsCollection2) => {
|
|
1368
1362
|
const icon2 = `@${provider.value}:${iconsCollection2.prefix}:${name}`;
|
|
1369
1363
|
return iconLoaded(icon2);
|
|
@@ -1387,7 +1381,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1387
1381
|
}
|
|
1388
1382
|
function addIconFromSvg(svg) {
|
|
1389
1383
|
const svgContentEl = getSvgContent(svg);
|
|
1390
|
-
const svgContent =
|
|
1384
|
+
const svgContent = svgContentEl?.innerHTML.trim() || "";
|
|
1391
1385
|
if (svgContentEl && svgContent) {
|
|
1392
1386
|
addIcon(`@${provider.value}:${props.prefix}:${props.name}`, {
|
|
1393
1387
|
body: svgContent,
|
|
@@ -1406,7 +1400,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
1406
1400
|
show.value = true;
|
|
1407
1401
|
}
|
|
1408
1402
|
}).catch((e) => {
|
|
1409
|
-
throw new Error(`Error during fetch icon: ${e
|
|
1403
|
+
throw new Error(`Error during fetch icon: ${e?.message}`);
|
|
1410
1404
|
});
|
|
1411
1405
|
}
|
|
1412
1406
|
}
|
|
@@ -1647,28 +1641,28 @@ const VvInputTextProps = {
|
|
|
1647
1641
|
};
|
|
1648
1642
|
function useComponentIcon(icon, iconPosition) {
|
|
1649
1643
|
const hasIcon = computed(() => {
|
|
1650
|
-
if (typeof
|
|
1651
|
-
return { name: icon
|
|
1644
|
+
if (typeof icon?.value === "string") {
|
|
1645
|
+
return { name: icon?.value };
|
|
1652
1646
|
}
|
|
1653
|
-
return icon
|
|
1647
|
+
return icon?.value;
|
|
1654
1648
|
});
|
|
1655
1649
|
const hasIconBefore = computed(
|
|
1656
|
-
() =>
|
|
1650
|
+
() => iconPosition?.value === Position.before ? hasIcon.value : void 0
|
|
1657
1651
|
);
|
|
1658
1652
|
const hasIconAfter = computed(
|
|
1659
|
-
() =>
|
|
1653
|
+
() => iconPosition?.value === Position.after ? hasIcon.value : void 0
|
|
1660
1654
|
);
|
|
1661
1655
|
const hasIconLeft = computed(
|
|
1662
|
-
() =>
|
|
1656
|
+
() => iconPosition?.value === Side.left ? hasIcon.value : void 0
|
|
1663
1657
|
);
|
|
1664
1658
|
const hasIconRight = computed(
|
|
1665
|
-
() =>
|
|
1659
|
+
() => iconPosition?.value === Side.right ? hasIcon.value : void 0
|
|
1666
1660
|
);
|
|
1667
1661
|
const hasIconTop = computed(
|
|
1668
|
-
() =>
|
|
1662
|
+
() => iconPosition?.value === Side.top ? hasIcon.value : void 0
|
|
1669
1663
|
);
|
|
1670
1664
|
const hasIconBottom = computed(
|
|
1671
|
-
() =>
|
|
1665
|
+
() => iconPosition?.value === Side.bottom ? hasIcon.value : void 0
|
|
1672
1666
|
);
|
|
1673
1667
|
return {
|
|
1674
1668
|
hasIcon,
|
|
@@ -1706,7 +1700,7 @@ const VvInputClearAction = defineComponent({
|
|
|
1706
1700
|
setup(props, { emit }) {
|
|
1707
1701
|
const { hasIcon } = useComponentIcon(computed(() => props.icon));
|
|
1708
1702
|
function onClick(e) {
|
|
1709
|
-
e
|
|
1703
|
+
e?.stopPropagation();
|
|
1710
1704
|
if (!props.disabled) {
|
|
1711
1705
|
emit("clear");
|
|
1712
1706
|
}
|
|
@@ -1772,7 +1766,7 @@ const VvInputPasswordAction = defineComponent({
|
|
|
1772
1766
|
);
|
|
1773
1767
|
const { hasIcon } = useComponentIcon(activeIcon);
|
|
1774
1768
|
function onClick(e) {
|
|
1775
|
-
e
|
|
1769
|
+
e?.stopPropagation();
|
|
1776
1770
|
if (!props.disabled) {
|
|
1777
1771
|
active.value = !active.value;
|
|
1778
1772
|
emit("toggle-password", active.value);
|
|
@@ -1829,7 +1823,7 @@ const VvInputStepAction = defineComponent({
|
|
|
1829
1823
|
setup(props, { emit }) {
|
|
1830
1824
|
const isUp = computed(() => props.mode === "up");
|
|
1831
1825
|
const onClick = (e) => {
|
|
1832
|
-
e
|
|
1826
|
+
e?.stopPropagation();
|
|
1833
1827
|
if (!props.disabled) {
|
|
1834
1828
|
emit(isUp.value ? "step-up" : "step-down");
|
|
1835
1829
|
}
|
|
@@ -1934,8 +1928,7 @@ function VvInputTextActionsFactory(type, parentProps, isDirty) {
|
|
|
1934
1928
|
function useDefaults(componentName, propsDefinition, props) {
|
|
1935
1929
|
const volver = useVolver();
|
|
1936
1930
|
const volverComponentDefaults = computed(() => {
|
|
1937
|
-
|
|
1938
|
-
if (!volver || !((_a = volver.defaults.value) == null ? void 0 : _a[componentName])) {
|
|
1931
|
+
if (!volver || !volver.defaults.value?.[componentName]) {
|
|
1939
1932
|
return void 0;
|
|
1940
1933
|
}
|
|
1941
1934
|
return volver.defaults.value[componentName];
|
|
@@ -1993,7 +1986,7 @@ function useDebouncedInput(modelValue, emit, ms = 0, {
|
|
|
1993
1986
|
ms = Number.parseInt(ms);
|
|
1994
1987
|
}
|
|
1995
1988
|
return computed({
|
|
1996
|
-
get: () => getter(modelValue
|
|
1989
|
+
get: () => getter(modelValue?.value),
|
|
1997
1990
|
set: (value) => {
|
|
1998
1991
|
if (timeout) {
|
|
1999
1992
|
clearTimeout(timeout);
|
|
@@ -2018,22 +2011,22 @@ function useTextCount(text, options) {
|
|
|
2018
2011
|
return (unref(text) ?? "").length;
|
|
2019
2012
|
});
|
|
2020
2013
|
const gap = computed(() => {
|
|
2021
|
-
if (
|
|
2014
|
+
if (options?.lowerLimit !== void 0 && length.value < options?.lowerLimit) {
|
|
2022
2015
|
return length.value - options.lowerLimit;
|
|
2023
2016
|
}
|
|
2024
|
-
if (
|
|
2017
|
+
if (options?.upperLimit !== void 0 && length.value < options?.upperLimit) {
|
|
2025
2018
|
return options.upperLimit - length.value;
|
|
2026
2019
|
}
|
|
2027
2020
|
return 0;
|
|
2028
2021
|
});
|
|
2029
2022
|
const formatted = computed(() => {
|
|
2030
|
-
if (
|
|
2023
|
+
if (options?.mode === false) {
|
|
2031
2024
|
return "";
|
|
2032
2025
|
}
|
|
2033
|
-
if (
|
|
2026
|
+
if (options?.mode === "limit" && options?.upperLimit) {
|
|
2034
2027
|
return `${length.value} / ${options.lowerLimit ? `${options.lowerLimit}-` : ""}${options.upperLimit}`;
|
|
2035
2028
|
}
|
|
2036
|
-
if (
|
|
2029
|
+
if (options?.mode === "countdown") {
|
|
2037
2030
|
if (gap.value === 0) {
|
|
2038
2031
|
return void 0;
|
|
2039
2032
|
}
|
|
@@ -2065,7 +2058,7 @@ function usePersistence(storageKey, storageType = StorageType.local, defaultValu
|
|
|
2065
2058
|
if (newKey) {
|
|
2066
2059
|
storageValue = useStorage(
|
|
2067
2060
|
newKey,
|
|
2068
|
-
|
|
2061
|
+
storageValue?.value ?? localValue.value,
|
|
2069
2062
|
storage
|
|
2070
2063
|
);
|
|
2071
2064
|
if (storageValue.value) {
|
|
@@ -2082,12 +2075,12 @@ function usePersistence(storageKey, storageType = StorageType.local, defaultValu
|
|
|
2082
2075
|
}
|
|
2083
2076
|
if (isRef(storageType)) {
|
|
2084
2077
|
watch(storageType, (newType, oldType) => {
|
|
2085
|
-
if (storageKey
|
|
2078
|
+
if (storageKey?.value) {
|
|
2086
2079
|
if (newType) {
|
|
2087
2080
|
const storage = newType === StorageType.session ? sessionStorage : localStorage;
|
|
2088
2081
|
storageValue = useStorage(
|
|
2089
2082
|
storageKey.value,
|
|
2090
|
-
|
|
2083
|
+
storageValue?.value ?? localValue.value,
|
|
2091
2084
|
storage
|
|
2092
2085
|
);
|
|
2093
2086
|
}
|
|
@@ -2172,7 +2165,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2172
2165
|
const localModelValue = useDebouncedInput(
|
|
2173
2166
|
modelValue,
|
|
2174
2167
|
emit,
|
|
2175
|
-
|
|
2168
|
+
debounce?.value ?? 0
|
|
2176
2169
|
);
|
|
2177
2170
|
const hasSeconds = computed(() => {
|
|
2178
2171
|
const stepValue = typeof step.value === "number" ? step.value : Number.parseInt(step.value);
|
|
@@ -2209,7 +2202,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2209
2202
|
{
|
|
2210
2203
|
emit,
|
|
2211
2204
|
onAccept: () => {
|
|
2212
|
-
var _a;
|
|
2213
2205
|
if (!maskReady.value) {
|
|
2214
2206
|
return;
|
|
2215
2207
|
}
|
|
@@ -2268,7 +2260,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2268
2260
|
toReturn.setSeconds(date.getSeconds());
|
|
2269
2261
|
}
|
|
2270
2262
|
if (modelValueDate.value instanceof Date) {
|
|
2271
|
-
if (
|
|
2263
|
+
if (localModelValue.value?.getTime() === toReturn.getTime()) {
|
|
2272
2264
|
return;
|
|
2273
2265
|
}
|
|
2274
2266
|
localModelValue.value = toReturn;
|
|
@@ -2288,13 +2280,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2288
2280
|
}
|
|
2289
2281
|
);
|
|
2290
2282
|
function updateMaskValue(newValue) {
|
|
2291
|
-
var _a;
|
|
2292
2283
|
if (newValue === void 0 || newValue === null) {
|
|
2293
2284
|
typed.value = "";
|
|
2294
2285
|
unmasked.value = "";
|
|
2295
2286
|
return;
|
|
2296
2287
|
}
|
|
2297
|
-
if (
|
|
2288
|
+
if (props.iMask?.mask === Date) {
|
|
2298
2289
|
typed.value = newValue instanceof Date ? newValue : new Date(newValue);
|
|
2299
2290
|
return;
|
|
2300
2291
|
}
|
|
@@ -2351,12 +2342,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2351
2342
|
() => focused.value && !props.disabled && !props.readonly
|
|
2352
2343
|
);
|
|
2353
2344
|
watch(isFocused, (newValue) => {
|
|
2354
|
-
var _a, _b;
|
|
2355
2345
|
if (newValue && propsDefaults.value.selectOnFocus && inputEl.value) {
|
|
2356
2346
|
inputEl.value.select();
|
|
2357
2347
|
}
|
|
2358
|
-
if (newValue &&
|
|
2359
|
-
|
|
2348
|
+
if (newValue && suggestions.value?.size) {
|
|
2349
|
+
suggestionsDropdownEl.value?.show();
|
|
2360
2350
|
return;
|
|
2361
2351
|
}
|
|
2362
2352
|
if (isDirty.value && suggestions.value) {
|
|
@@ -2389,7 +2379,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2389
2379
|
function onStepUp() {
|
|
2390
2380
|
if (!isDisabledOrReadonly.value) {
|
|
2391
2381
|
if (props.iMask) {
|
|
2392
|
-
typed.value = Number(typed.value) + Number(
|
|
2382
|
+
typed.value = Number(typed.value) + Number(step?.value ?? 1);
|
|
2393
2383
|
return;
|
|
2394
2384
|
}
|
|
2395
2385
|
inputEl.value.stepUp();
|
|
@@ -2399,7 +2389,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2399
2389
|
function onStepDown() {
|
|
2400
2390
|
if (!isDisabledOrReadonly.value) {
|
|
2401
2391
|
if (props.iMask) {
|
|
2402
|
-
typed.value = Number(typed.value) - Number(
|
|
2392
|
+
typed.value = Number(typed.value) - Number(step?.value ?? 1);
|
|
2403
2393
|
return;
|
|
2404
2394
|
}
|
|
2405
2395
|
inputEl.value.stepDown();
|
|
@@ -2432,8 +2422,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2432
2422
|
const { hasIcon: hasIconRemoveSuggestion } = useComponentIcon(iconRemoveSuggestion);
|
|
2433
2423
|
const { formatted: countFormatted } = useTextCount(localModelValue, {
|
|
2434
2424
|
mode: count.value,
|
|
2435
|
-
upperLimit: Number(maxlength
|
|
2436
|
-
lowerLimit: Number(minlength
|
|
2425
|
+
upperLimit: Number(maxlength?.value),
|
|
2426
|
+
lowerLimit: Number(minlength?.value)
|
|
2437
2427
|
});
|
|
2438
2428
|
const isDisabledOrReadonly = computed(() => props.disabled || props.readonly);
|
|
2439
2429
|
const hasTabindex = computed(() => {
|
|
@@ -2449,7 +2439,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2449
2439
|
}
|
|
2450
2440
|
return void 0;
|
|
2451
2441
|
});
|
|
2452
|
-
const storageKey = computed(() => props.storageKey ?? (
|
|
2442
|
+
const storageKey = computed(() => props.storageKey ?? (volver?.experimentalFeatures.forceInputSuggestions ? props.name : void 0));
|
|
2453
2443
|
const suggestions = usePersistence(
|
|
2454
2444
|
storageKey,
|
|
2455
2445
|
storageType,
|
|
@@ -2464,17 +2454,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
2464
2454
|
).reverse();
|
|
2465
2455
|
});
|
|
2466
2456
|
const hasSuggestions = computed(
|
|
2467
|
-
() =>
|
|
2457
|
+
() => storageKey?.value && suggestions.value && suggestions.value.size > 0
|
|
2468
2458
|
);
|
|
2469
2459
|
function onSuggestionSelect(suggestion) {
|
|
2470
|
-
var _a;
|
|
2471
2460
|
localModelValue.value = suggestion;
|
|
2472
|
-
|
|
2461
|
+
suggestionsDropdownEl.value?.hide();
|
|
2473
2462
|
emit("suggestion:selected", suggestion);
|
|
2474
2463
|
}
|
|
2475
2464
|
function onSuggestionRemove(suggestion) {
|
|
2476
|
-
|
|
2477
|
-
(_a = suggestions.value) == null ? void 0 : _a.delete(suggestion);
|
|
2465
|
+
suggestions.value?.delete(suggestion);
|
|
2478
2466
|
emit("suggestion:removed", suggestion);
|
|
2479
2467
|
}
|
|
2480
2468
|
const { modifiers } = toRefs(props);
|