1 |
- import{t as f,z as h,u as C,av as P,d as p,x as G,Z as b,W as k,b8 as g,c as V,N as S,v as _,C as y,y as E,am as O,E as $,D as B}from"./index.5f7ffb46.js";import{c as N,s as z}from"./Checker.40bdbb46.js";const[x,A]=f("checkbox-group"),D={max:h,shape:C("round"),disabled:Boolean,iconSize:h,direction:String,modelValue:P(),checkedColor:String},v=Symbol(x);var U=p({name:x,props:D,emits:["change","update:modelValue"],setup(a,{emit:c,slots:u}){const{children:l,linkChildren:i}=G(v),o=e=>c("update:modelValue",e),s=(e={})=>{typeof e=="boolean"&&(e={checked:e});const{checked:d,skipDisabled:r}=e,t=l.filter(n=>n.props.bindGroup?n.props.disabled&&r?n.checked.value:d!=null?d:!n.checked.value:!1).map(n=>n.name);o(t)};return b(()=>a.modelValue,e=>c("change",e)),k({toggleAll:s}),g(()=>a.modelValue),i({props:a,updateValue:o}),()=>{var e;return V("div",{class:A([a.direction])},[(e=u.default)==null?void 0:e.call(u)])}}});const[K,F]=f("checkbox"),H=S({},N,{shape:String,bindGroup:_,indeterminate:{type:Boolean,default:null}});var I=p({name:K,props:H,emits:["change","update:modelValue"],setup(a,{emit:c,slots:u}){const{parent:l}=y(v),i=e=>{const{name:d}=a,{max:r,modelValue:m}=l.props,t=m.slice();if(e)!(r&&t.length>=+r)&&!t.includes(d)&&(t.push(d),a.bindGroup&&l.updateValue(t));else{const n=t.indexOf(d);n!==-1&&(t.splice(n,1),a.bindGroup&&l.updateValue(t))}},o=E(()=>l&&a.bindGroup?l.props.modelValue.indexOf(a.name)!==-1:!!a.modelValue),s=(e=!o.value)=>{l&&a.bindGroup?i(e):c("update:modelValue",e),a.indeterminate!==null&&c("change",e)};return b(()=>a.modelValue,e=>{a.indeterminate===null&&c("change",e)}),k({toggle:s,props:a,checked:o}),g(()=>a.modelValue),()=>V(z,$({bem:F,role:"checkbox",parent:l,checked:o.value,onToggle:s},a),O(u,["default","icon"]))}});const W=B(I);export{W as C,U as s};
|