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