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.62 kB
JavaScript
import e from"primevue/icons/check";import{ObjectUtils as t}from"primevue/utils";import n from"primevue/basecomponent";import a from"primevue/checkbox/style";import{resolveComponent as l,openBlock as i,createElementBlock as r,mergeProps as o,createElementVNode as u,renderSlot as c,normalizeClass as d,createBlock as s,createCommentVNode as p}from"vue";function h(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function b(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function m(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function f(e){if(Array.isArray(e))return y(e)}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n<t;n++)a[n]=e[n];return a}var g={name:"Checkbox",extends:{name:"BaseCheckbox",extends:n,props:{value:null,modelValue:null,binary:Boolean,name:{type:String,default:null},trueValue:{type:null,default:!0},falseValue:{type:null,default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},required:{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:a,provide:function(){return{$parentInstance:this}}},emits:["update:modelValue","change","focus","blur"],methods:{getPTOptions:function(e){return this.ptm(e,{context:{checked:this.checked,disabled:this.disabled}})},onChange:function(e){var n,a,l=this;this.disabled||this.readonly||(n=this.binary?this.checked?this.falseValue:this.trueValue:this.checked?this.modelValue.filter((function(e){return!t.equals(e,l.value)})):this.modelValue?[].concat(f(a=this.modelValue)||m(a)||b(a)||h(),[this.value]):[this.value],this.$emit("update:modelValue",n),this.$emit("change",e))},onFocus:function(e){this.$emit("focus",e)},onBlur:function(e){this.$emit("blur",e)}},computed:{checked:function(){return this.binary?this.modelValue===this.trueValue:t.contains(this.value,this.modelValue)}},components:{CheckIcon:e}},v=["data-p-highlight","data-p-disabled"],k=["id","value","name","checked","tabindex","disabled","readonly","required","aria-labelledby","aria-label"];g.render=function(e,t,n,a,h,b){var m=l("CheckIcon");return i(),r("div",o({class:e.cx("root")},b.getPTOptions("root"),{"data-pc-name":"checkbox","data-p-highlight":b.checked,"data-p-disabled":e.disabled}),[u("input",o({id:e.inputId,type:"checkbox",class:[e.cx("input"),e.inputClass],style:e.inputStyle,value:e.value,name:e.name,checked:b.checked,tabindex:e.tabindex,disabled:e.disabled,readonly:e.readonly,required:e.required,"aria-labelledby":e.ariaLabelledby,"aria-label":e.ariaLabel,onFocus:t[0]||(t[0]=function(){return b.onFocus&&b.onFocus.apply(b,arguments)}),onBlur:t[1]||(t[1]=function(){return b.onBlur&&b.onBlur.apply(b,arguments)}),onChange:t[2]||(t[2]=function(){return b.onChange&&b.onChange.apply(b,arguments)})},b.getPTOptions("input")),null,16,k),u("div",o({class:e.cx("box")},b.getPTOptions("box")),[c(e.$slots,"icon",{checked:b.checked,class:d(e.cx("icon"))},(function(){return[b.checked?(i(),s(m,o({key:0,class:e.cx("icon")},b.getPTOptions("icon")),null,16,["class"])):p("",!0)]}))],16)],16,v)};export{g as default};