Checker-legacy-f2b46109.js 1.6 KB

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