@volverjs/ui-vue 0.0.10-beta.74 → 0.0.10-beta.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +3 -2
- package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
- package/dist/components/VvRadioGroup/VvRadioGroup.es.js +3 -2
- package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
- package/dist/components/index.es.js +6 -4
- package/dist/components/index.umd.js +1 -1
- package/dist/icons.es.js +3 -3
- package/dist/icons.umd.js +1 -1
- package/package.json +1 -1
|
@@ -880,7 +880,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
880
880
|
valid,
|
|
881
881
|
invalid
|
|
882
882
|
});
|
|
883
|
-
const { getOptionLabel, getOptionValue } = useOptions(props);
|
|
883
|
+
const { getOptionLabel, getOptionValue, isOptionDisabled } = useOptions(props);
|
|
884
884
|
const bemCssClasses = useModifiers(
|
|
885
885
|
"vv-checkbox-group",
|
|
886
886
|
modifiers,
|
|
@@ -899,7 +899,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
899
899
|
name: props.name,
|
|
900
900
|
label: getOptionLabel(option),
|
|
901
901
|
value: getOptionValue(option),
|
|
902
|
-
required: props.required
|
|
902
|
+
required: props.required,
|
|
903
|
+
disabled: isOptionDisabled(option)
|
|
903
904
|
};
|
|
904
905
|
}
|
|
905
906
|
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
|
|
@@ -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).VvCheckboxGroup=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||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),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("checkGroup"),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}},c={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},f={disabled:{type:Boolean,default:!1}},p={required:{type:Boolean,default:!1}},m={label:{type:[String,Number],default:void 0}},b={readonly:{type:Boolean,default:!1}},h={modifiers:{type:[String,Array],default:void 0}},y={hintLabel:{type:String,default:""}},g={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const S={tabindex:{type:[String,Number],default:0}},k={id:[String,Number]};o.bottom;const L={...{...k,name:{type:String,required:!0}},...S,...s,...v,...y,...f,...b,...h,...m,...c,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},V={...s,...v,...g,...y,...f,...b,...h,...m,...c,...p,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};i.button,r.button,a.local;const x=V;function O(e,t,l){return $(e,t)}function $(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,n,i;if(l&&a){if(n=e.length,n!==t.length)return!1;for(o=n;0!==o--;)if(!$(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(n=v.length,n!==Object.keys(t).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(t,v[o]))return!1;for(o=n;0!==o--;)if(i=v[o],!$(e[i],t[i]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function B(e){return Array.isArray(e)?e.filter((e=>"string"==typeof e)).join(" "):e}function A(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>B(a.value.invalidLabel))),n=e.computed((()=>B(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.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||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),f=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,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==(o=(a=this.$slots).invalid)?void 0:o.call(a))??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:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}const C={...L,...h,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function N(t,l){const{group:a,isInGroup:o,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 n=null==l?void 0:l[t];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const i=e.toRef(a,t);return e.computed({get:()=>i.value,set(e){o&&o(`update:${t}`,e)}})}}}(d),{id:i,switch:r,indeterminate:u}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>Boolean(t.readonly||(null==a?void 0:a.readonly.value)))),p=e.computed((()=>Boolean(t.disabled||(null==a?void 0:a.disabled.value))));return{id:i,propsSwitch:r,indeterminate:u,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}function w(t,l,a){const o=e.inject(u,void 0),n=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===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(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(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function P(t,l,a){return e.computed((()=>{const o={[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&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const R=["for"],j=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],_=e.defineComponent({name:"VvCheckbox",props:C,emits:["click","update:modelValue","change","blur"],setup(t,{emit:l}){const a=t,o=l,n=e.useSlots(),i=w("VvCheckbox",C,a),{id:r,disabled:u,readonly:d,valid:s,invalid:v,propsSwitch:c,modelValue:f,indeterminate:p,isInGroup:m}=N(a,o),b=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(r),h=e.computed((()=>`${b.value}-hint`)),y=e.computed((()=>k.value?-1:a.tabindex)),g=e.ref(),S=e.computed((()=>void 0!==a.uncheckedValue&&!m.value)),k=e.computed((()=>u.value||d.value)),L=e.computed((()=>!0===v.value||!0!==s.value&&void 0)),V=e.computed((()=>S.value?f.value===a.value:Array.isArray(f.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(O(e,l))return!0;return!1}(a.value,f.value):O(a.value,f.value))),x=e.computed((()=>!!p.value||!(V.value||!S.value||a.uncheckedValue===f.value))),$=e.computed((()=>{if(!S.value)return!["string","number","boolean"].includes(typeof a.value)||a.value})),B=e.computed({get:()=>V.value,set(e){if(S.value)f.value=e?a.value:a.uncheckedValue;else if(Array.isArray(f.value)||m.value){const t=f.value??[],l=new Set(Array.isArray(t)?t:[t]);e?l.add(a.value):l.delete(a.value),f.value=[...l]}else f.value=e?a.value:void 0;o("change",e)}}),{modifiers:_}=e.toRefs(a),z=P("vv-checkbox",_,e.computed((()=>({switch:c.value,valid:s.value,invalid:v.value,disabled:u.value,readonly:d.value,indeterminate:p.value}))));e.watchEffect((()=>{S.value&&Array.isArray(f.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>x.value),(e=>{g.value.indeterminate=!!e})),e.onMounted((()=>{x.value&&(g.value.indeterminate=!0)}));const{HintSlot:E,hasHintLabelOrSlot:G,hasInvalidLabelOrSlot:q,hintSlotScope:I}=A(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(b)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(b),ref_key:"input",ref:g,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(B)?B.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(k),value:e.unref($),tabindex:e.unref(y),"aria-invalid":e.unref(L),"aria-describedby":e.unref(G)?e.unref(h):void 0,"aria-errormessage":e.unref(q)?e.unref(h):void 0},null,8,j),[[e.vModelCheckbox,e.unref(B)]]),e.renderSlot(t.$slots,"default",{value:e.unref(f)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(E),{id:e.unref(h),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"3"}:void 0]),1032,["id"])],10,R))}});const z=["textContent"],E={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:x,emits:["update:modelValue","change"],setup(a,{emit:o}){const n=a,i=o,r=e.useSlots(),u=w("VvCheckboxGroup",x,n),s=t.useVModel(n,"modelValue",i),{disabled:v,readonly:c,vertical:f,valid:p,invalid:m,modifiers:b}=e.toRefs(n);var h,y;h=d,y={modelValue:s,disabled:v,readonly:c,valid:p,invalid:m},e.provide(h,y);const{getOptionLabel:g,getOptionValue:S}=function(t){const{options:a,labelKey:o,valueKey:n,disabledKey:i}=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 n.value?n.value(e):n.value?l.get(e,n.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof i.value?i.value(e):!!i.value&&l.get(e,i.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(n),k=P("vv-checkbox-group",b,e.computed((()=>({disabled:v.value,readonly:c.value,required:n.required,horizontal:!f.value,valid:p.value,invalid:m.value}))));const{HintSlot:L,hintSlotScope:V}=A(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(k))},[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",E,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(_,e.mergeProps({key:l,ref_for:!0},function(e,t){return{id:`${n.name}_opt${t}`,name:n.name,label:g(e),value:S(e),required:n.required}}(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(L),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(V))))])),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("ts-dot-prop")):"function"==typeof define&&define.amd?define(["vue","@vueuse/core","ts-dot-prop"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).VvCheckboxGroup=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||{}),n=(e=>(e.before="before",e.after="after",e))(n||{}),i=(e=>(e.button="button",e.submit="submit",e.reset="reset",e))(i||{}),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("checkGroup"),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}},c={loading:{type:Boolean,default:!1},loadingLabel:{type:String,default:"Loading..."}},f={disabled:{type:Boolean,default:!1}},p={required:{type:Boolean,default:!1}},b={label:{type:[String,Number],default:void 0}},m={readonly:{type:Boolean,default:!1}},h={modifiers:{type:[String,Array],default:void 0}},y={hintLabel:{type:String,default:""}},g={options:{type:Array,default:()=>[]},labelKey:{type:[String,Function],default:"label"},valueKey:{type:[String,Function],default:"value"},disabledKey:{type:[String,Function],default:"disabled"}};n.before;const S={tabindex:{type:[String,Number],default:0}},k={id:[String,Number]};o.bottom;const L={...{...k,name:{type:String,required:!0}},...S,...s,...v,...y,...f,...m,...h,...b,...c,value:{type:[String,Number,Boolean],default:void 0},modelValue:{type:[Object,Number,Boolean,String],default:void 0}},V={...s,...v,...g,...y,...f,...m,...h,...b,...c,...p,modelValue:{type:[String,Array,Boolean,Number,Symbol],default:void 0},name:{type:String,required:!0},vertical:{type:Boolean,default:!1}};i.button,r.button,a.local;const x=V;function O(e,t,l){return $(e,t)}function $(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,n,i;if(l&&a){if(n=e.length,n!==t.length)return!1;for(o=n;0!==o--;)if(!$(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(n=v.length,n!==Object.keys(t).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(t,v[o]))return!1;for(o=n;0!==o--;)if(i=v[o],!$(e[i],t[i]))return!1;return!0}return Number.isNaN(e)&&Number.isNaN(t)}function B(e){return Array.isArray(e)?e.filter((e=>"string"==typeof e)).join(" "):e}function A(t,l){const a=e.computed((()=>e.isRef(t)?t.value:t)),o=e.computed((()=>B(a.value.invalidLabel))),n=e.computed((()=>B(a.value.validLabel))),i=e.computed((()=>a.value.loadingLabel)),r=e.computed((()=>a.value.hintLabel)),u=e.computed((()=>Boolean(a.value.loading&&(l.loading||i.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||n.value)))),v=e.computed((()=>!u.value&&!d.value&&!s.value&&Boolean(l.hint||r.value))),c=e.computed((()=>d.value||s.value||u.value||v.value)),f=e.computed((()=>({modelValue:a.value.modelValue,valid:a.value.valid,invalid:a.value.invalid,loading:a.value.loading}))),p=e.defineComponent({name:"HintSlot",props:{tag:{type:String,default:"small"}},setup:()=>({isVisible:c,invalidLabel:o,validLabel:n,loadingLabel:i,hintLabel:r,hasInvalidLabelOrSlot:d,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hasHintLabelOrSlot:v}),render(){var t,l,a,o,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==(o=(a=this.$slots).invalid)?void 0:o.call(a))??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:v,hasValidLabelOrSlot:s,hasLoadingLabelOrSlot:u,hintSlotScope:f,HintSlot:p}}const C={...L,...h,indeterminate:Boolean,uncheckedValue:[String,Number,Boolean],switch:Boolean};function N(t,l){const{group:a,isInGroup:o,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 n=null==l?void 0:l[t];if(n)return e.computed({get:()=>n.value,set(e){n.value=e}});const i=e.toRef(a,t);return e.computed({get:()=>i.value,set(e){o&&o(`update:${t}`,e)}})}}}(d),{id:i,switch:r,indeterminate:u}=e.toRefs(t),s=n("modelValue",t,l),v=n("valid",t),c=n("invalid",t),f=e.computed((()=>Boolean(t.readonly||(null==a?void 0:a.readonly.value)))),p=e.computed((()=>Boolean(t.disabled||(null==a?void 0:a.disabled.value))));return{id:i,propsSwitch:r,indeterminate:u,group:a,isInGroup:o,modelValue:s,valid:v,invalid:c,readonly:f,disabled:p}}function w(t,l,a){const o=e.inject(u,void 0),n=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===n.value)return a;const e=n.value,t=l,o=a;return Object.keys(t).reduce(((l,a)=>{const n=o[a];if(l[a]=n,a in e){if(Array.isArray(t[a])){const o=t[a];if(o.length){o[0]===n&&(l[a]=e[a])}}if("function"==typeof t[a]){(0,t[a])()===n&&(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(n)&&(l[a]=e[a]):o===n&&(l[a]=e[a])}}return l}),{})}))}function P(t,l,a){return e.computed((()=>{const o={[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&&(o[`${t}--${e}`]=!0)})),a&&Object.keys(a.value).forEach((l=>{o[`${t}--${l}`]=e.unref(a.value[l])})),o}))}const R=["for"],j=["id","name","disabled","value","tabindex","aria-invalid","aria-describedby","aria-errormessage"],_=e.defineComponent({name:"VvCheckbox",props:C,emits:["click","update:modelValue","change","blur"],setup(t,{emit:l}){const a=t,o=l,n=e.useSlots(),i=w("VvCheckbox",C,a),{id:r,disabled:u,readonly:d,valid:s,invalid:v,propsSwitch:c,modelValue:f,indeterminate:p,isInGroup:b}=N(a,o),m=function(t){return e.computed((()=>String((null==t?void 0:t.value)||e.useId())))}(r),h=e.computed((()=>`${m.value}-hint`)),y=e.computed((()=>k.value?-1:a.tabindex)),g=e.ref(),S=e.computed((()=>void 0!==a.uncheckedValue&&!b.value)),k=e.computed((()=>u.value||d.value)),L=e.computed((()=>!0===v.value||!0!==s.value&&void 0)),V=e.computed((()=>S.value?f.value===a.value:Array.isArray(f.value)?function(e,t){if(null!=e&&t&&t.length)for(const l of t)if(O(e,l))return!0;return!1}(a.value,f.value):O(a.value,f.value))),x=e.computed((()=>!!p.value||!(V.value||!S.value||a.uncheckedValue===f.value))),$=e.computed((()=>{if(!S.value)return!["string","number","boolean"].includes(typeof a.value)||a.value})),B=e.computed({get:()=>V.value,set(e){if(S.value)f.value=e?a.value:a.uncheckedValue;else if(Array.isArray(f.value)||b.value){const t=f.value??[],l=new Set(Array.isArray(t)?t:[t]);e?l.add(a.value):l.delete(a.value),f.value=[...l]}else f.value=e?a.value:void 0;o("change",e)}}),{modifiers:_}=e.toRefs(a),z=P("vv-checkbox",_,e.computed((()=>({switch:c.value,valid:s.value,invalid:v.value,disabled:u.value,readonly:d.value,indeterminate:p.value}))));e.watchEffect((()=>{S.value&&Array.isArray(f.value)&&console.warn("[VvCheckbox] The model value is an array but the component is in binary mode.")})),e.watch((()=>x.value),(e=>{g.value.indeterminate=!!e})),e.onMounted((()=>{x.value&&(g.value.indeterminate=!0)}));const{HintSlot:E,hasHintLabelOrSlot:G,hasInvalidLabelOrSlot:q,hintSlotScope:I}=A(i,n);return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(e.unref(z)),for:e.unref(m)},[e.withDirectives(e.createElementVNode("input",{id:e.unref(m),ref_key:"input",ref:g,"onUpdate:modelValue":l[0]||(l[0]=t=>e.isRef(B)?B.value=t:null),type:"checkbox",class:"vv-checkbox__input",name:t.name,disabled:e.unref(k),value:e.unref($),tabindex:e.unref(y),"aria-invalid":e.unref(L),"aria-describedby":e.unref(G)?e.unref(h):void 0,"aria-errormessage":e.unref(q)?e.unref(h):void 0},null,8,j),[[e.vModelCheckbox,e.unref(B)]]),e.renderSlot(t.$slots,"default",{value:e.unref(f)},(()=>[e.createTextVNode(e.toDisplayString(t.label),1)])),e.createVNode(e.unref(E),{id:e.unref(h),class:"vv-checkbox__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(I))))])),key:"3"}:void 0]),1032,["id"])],10,R))}});const z=["textContent"],E={class:"vv-checkbox-group__wrapper"};return e.defineComponent({name:"VvCheckboxGroup",props:x,emits:["update:modelValue","change"],setup(a,{emit:o}){const n=a,i=o,r=e.useSlots(),u=w("VvCheckboxGroup",x,n),s=t.useVModel(n,"modelValue",i),{disabled:v,readonly:c,vertical:f,valid:p,invalid:b,modifiers:m}=e.toRefs(n);var h,y;h=d,y={modelValue:s,disabled:v,readonly:c,valid:p,invalid:b},e.provide(h,y);const{getOptionLabel:g,getOptionValue:S,isOptionDisabled:k}=function(t){const{options:a,labelKey:o,valueKey:n,disabledKey:i}=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 n.value?n.value(e):n.value?l.get(e,n.value):e,isOptionDisabled:e=>"string"!=typeof e&&("function"==typeof i.value?i.value(e):!!i.value&&l.get(e,i.value)),getOptionGrouped:e=>"string"==typeof e?[]:"object"==typeof e&&e&&"options"in e?e.options:[]}}(n),L=P("vv-checkbox-group",m,e.computed((()=>({disabled:v.value,readonly:c.value,required:n.required,horizontal:!f.value,valid:p.value,invalid:b.value}))));const{HintSlot:V,hintSlotScope:O}=A(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(L))},[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",E,[t.options.length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.options,((t,l)=>(e.openBlock(),e.createBlock(_,e.mergeProps({key:l,ref_for:!0},function(e,t){return{id:`${n.name}_opt${t}`,name:n.name,label:g(e),value:S(e),required:n.required,disabled:k(e)}}(t,l)),null,16)))),128)):e.renderSlot(t.$slots,"default",{key:1})]),e.createVNode(e.unref(V),{class:"vv-checkbox-group__hint"},e.createSlots({_:2},[t.$slots.hint?{name:"hint",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"hint",e.normalizeProps(e.guardReactiveProps(e.unref(O))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(O))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(O))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(O))))])),key:"3"}:void 0]),1024)],2))}})}));
|
|
@@ -800,7 +800,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
800
800
|
valid,
|
|
801
801
|
invalid
|
|
802
802
|
});
|
|
803
|
-
const { getOptionLabel, getOptionValue } = useOptions(props);
|
|
803
|
+
const { getOptionLabel, getOptionValue, isOptionDisabled } = useOptions(props);
|
|
804
804
|
const bemCssClasses = useModifiers(
|
|
805
805
|
"vv-radio-group",
|
|
806
806
|
modifiers,
|
|
@@ -819,7 +819,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
819
819
|
name: props.name,
|
|
820
820
|
label: getOptionLabel(option),
|
|
821
821
|
value: getOptionValue(option),
|
|
822
|
-
required: props.required
|
|
822
|
+
required: props.required,
|
|
823
|
+
disabled: isOptionDisabled(option)
|
|
823
824
|
};
|
|
824
825
|
}
|
|
825
826
|
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
|
|
@@ -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 k={...{...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}},O={...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=O;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=k;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:k}=e.toRefs(a),O=C("vv-radio",k,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(O)),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}=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),L=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:O}=x(u,r);return(t,l)=>(e.openBlock(),e.createElementBlock("fieldset",{class:e.normalizeClass(e.unref(L))},[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}}(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(O))))])),key:"0"}:void 0,t.$slots.loading?{name:"loading",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"loading",e.normalizeProps(e.guardReactiveProps(e.unref(O))))])),key:"1"}:void 0,t.$slots.valid?{name:"valid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"valid",e.normalizeProps(e.guardReactiveProps(e.unref(O))))])),key:"2"}:void 0,t.$slots.invalid?{name:"invalid",fn:e.withCtx((()=>[e.renderSlot(t.$slots,"invalid",e.normalizeProps(e.guardReactiveProps(e.unref(O))))])),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("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))}})}));
|
|
@@ -3244,7 +3244,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3244
3244
|
valid,
|
|
3245
3245
|
invalid
|
|
3246
3246
|
});
|
|
3247
|
-
const { getOptionLabel, getOptionValue } = useOptions(props);
|
|
3247
|
+
const { getOptionLabel, getOptionValue, isOptionDisabled } = useOptions(props);
|
|
3248
3248
|
const bemCssClasses = useModifiers(
|
|
3249
3249
|
"vv-checkbox-group",
|
|
3250
3250
|
modifiers,
|
|
@@ -3263,7 +3263,8 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
3263
3263
|
name: props.name,
|
|
3264
3264
|
label: getOptionLabel(option),
|
|
3265
3265
|
value: getOptionValue(option),
|
|
3266
|
-
required: props.required
|
|
3266
|
+
required: props.required,
|
|
3267
|
+
disabled: isOptionDisabled(option)
|
|
3267
3268
|
};
|
|
3268
3269
|
}
|
|
3269
3270
|
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
|
|
@@ -7862,7 +7863,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
7862
7863
|
valid,
|
|
7863
7864
|
invalid
|
|
7864
7865
|
});
|
|
7865
|
-
const { getOptionLabel, getOptionValue } = useOptions(props);
|
|
7866
|
+
const { getOptionLabel, getOptionValue, isOptionDisabled } = useOptions(props);
|
|
7866
7867
|
const bemCssClasses = useModifiers(
|
|
7867
7868
|
"vv-radio-group",
|
|
7868
7869
|
modifiers,
|
|
@@ -7881,7 +7882,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
7881
7882
|
name: props.name,
|
|
7882
7883
|
label: getOptionLabel(option),
|
|
7883
7884
|
value: getOptionValue(option),
|
|
7884
|
-
required: props.required
|
|
7885
|
+
required: props.required,
|
|
7886
|
+
disabled: isOptionDisabled(option)
|
|
7885
7887
|
};
|
|
7886
7888
|
}
|
|
7887
7889
|
const { HintSlot, hintSlotScope } = HintSlotFactory(propsDefaults, slots);
|