1 |
- System.register(["./index-legacy.eb062188.js"],(function(e){"use strict";var l,o,n,a,i,t,r,c,d,s,u;return{setters:[function(e){l=e.O,o=e.z,n=e.d,a=e.N,i=e.aB,t=e.v,r=e.R,c=e.y,d=e.c,s=e.a5,u=e.U}],execute:function(){const b=e("c",{name:l,disabled:Boolean,iconSize:o,modelValue:l,checkedColor:String,labelPosition:String,labelDisabled:Boolean});e("s",n({props:a({},b,{bem:i(Function),role:String,shape:String,parent:Object,checked:Boolean,bindGroup:t,indeterminate:{type:Boolean,default:null}}),emits:["click","toggle"],setup(e,{emit:l,slots:o}){const n=r(),a=l=>{if(e.parent&&e.bindGroup)return e.parent.props[l]},i=c((()=>{if(e.parent&&e.bindGroup){const l=a("disabled")||e.disabled;if("checkbox"===e.role){const o=a("modelValue").length,n=a("max"),i=n&&o>=+n;return l||i&&!e.checked}return l}return e.disabled})),t=c((()=>a("direction"))),b=c((()=>{const l=e.checkedColor||a("checkedColor");if(l&&e.checked&&!i.value)return{borderColor:l,backgroundColor:l}})),v=c((()=>e.shape||a("shape")||"round")),h=o=>{const{target:a}=o,t=n.value,r=t===a||(null==t?void 0:t.contains(a));i.value||!r&&e.labelDisabled||l("toggle"),l("click",o)},k=()=>{var l,t;const{bem:r,checked:c,indeterminate:h}=e,k=e.iconSize||a("iconSize");return d("div",{ref:n,class:r("icon",[v.value,{disabled:i.value,checked:c,indeterminate:h}]),style:"dot"!==v.value?{fontSize:u(k)}:{width:u(k),height:u(k),borderColor:null==(l=b.value)?void 0:l.borderColor}},[o.icon?o.icon({checked:c,disabled:i.value}):"dot"!==v.value?d(s,{name:h?"minus":"success",style:b.value},null):d("div",{class:r("icon--dot__icon"),style:{backgroundColor:null==(t=b.value)?void 0:t.backgroundColor}},null)])},p=()=>{if(o.default)return d("span",{class:e.bem("label",[e.labelPosition,{disabled:i.value}])},[o.default()])};return()=>{const l="left"===e.labelPosition?[p(),k()]:[k(),p()];return d("div",{role:e.role,class:e.bem([{disabled:i.value,"label-disabled":e.labelDisabled},t.value]),tabindex:i.value?void 0:0,"aria-checked":e.checked,onClick:h},[l])}}}))}}}));
|