UNPKG

primevue

Version:

PrimeVue is an open source UI library for Vue featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeBloc

2 lines (1 loc) 3.22 kB
import e from"primevue/icons/check";import t from"primevue/icons/times";import a from"primevue/basecomponent";import l from"primevue/tristatecheckbox/style";import{resolveComponent as n,openBlock as i,createElementBlock as o,mergeProps as c,createElementVNode as u,toDisplayString as s,renderSlot as d,normalizeClass as r,createVNode as p}from"vue";var h={name:"TriStateCheckbox",extends:{name:"BaseTriStateCheckbox",extends:a,props:{modelValue:null,disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},tabindex:{type:Number,default:null},inputId:{type:String,default:null},inputClass:{type:[String,Object],default:null},inputStyle:{type:Object,default:null},ariaLabelledby:{type:String,default:null},ariaLabel:{type:String,default:null}},style:l,provide:function(){return{$parentInstance:this}}},emits:["update:modelValue","change","focus","blur"],methods:{getPTOptions:function(e){return this.ptm(e,{context:{active:this.active,disabled:this.disabled}})},updateModel:function(){var e;switch(this.modelValue){case!0:e=!1;break;case!1:e=null;break;default:e=!0}this.$emit("update:modelValue",e)},onChange:function(e){this.disabled||this.readonly||(this.updateModel(),this.$emit("change",e))},onFocus:function(e){this.$emit("focus",e)},onBlur:function(e){this.$emit("blur",e)}},computed:{active:function(){return null!=this.modelValue},checked:function(){return!0===this.modelValue},ariaValueLabel:function(){return this.modelValue?this.$primevue.config.locale.aria.trueLabel:!1===this.modelValue?this.$primevue.config.locale.aria.falseLabel:this.$primevue.config.locale.aria.nullLabel}},components:{CheckIcon:e,TimesIcon:t}},b=["data-p-highlight","data-p-disabled"],m=["id","value","checked","tabindex","disabled","readonly","aria-labelledby","aria-label"];h.render=function(e,t,a,l,h,f){var y=n("CheckIcon"),k=n("TimesIcon");return i(),o("div",c({class:e.cx("root")},f.getPTOptions("root"),{"data-pc-name":"tristatecheckbox","data-p-highlight":f.active,"data-p-disabled":e.disabled}),[u("input",c({id:e.inputId,type:"checkbox",class:[e.cx("input"),e.inputClass],style:e.inputStyle,value:e.modelValue,checked:f.checked,tabindex:e.tabindex,disabled:e.disabled,readonly:e.readonly,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,onFocus:t[0]||(t[0]=function(){return f.onFocus&&f.onFocus.apply(f,arguments)}),onBlur:t[1]||(t[1]=function(){return f.onBlur&&f.onBlur.apply(f,arguments)}),onChange:t[2]||(t[2]=function(){return f.onChange&&f.onChange.apply(f,arguments)})},f.getPTOptions("input")),null,16,m),u("span",c({role:"status",class:"p-hidden-accessible","aria-live":"polite"},f.getPTOptions("hiddenValueLabel"),{"data-p-hidden-accessible":!0}),s(f.ariaValueLabel),17),u("div",c({class:e.cx("box")},f.getPTOptions("box")),[!0===e.modelValue?d(e.$slots,"checkicon",{key:0,class:r(e.cx("checkIcon"))},(function(){return[p(y,c({class:e.cx("checkIcon")},f.getPTOptions("checkIcon")),null,16,["class"])]})):!1===e.modelValue?d(e.$slots,"uncheckicon",{key:1,class:r(e.cx("uncheckIcon"))},(function(){return[p(k,c({class:e.cx("uncheckIcon")},f.getPTOptions("uncheckIcon")),null,16,["class"])]})):d(e.$slots,"nullableicon",{key:2,class:r(e.cx("nullableIcon"))})],16)],16,b)};export{h as default};