index-f6f96797.js 1.6 KB

1
  1. import{c as f,d as p,aa as P,w as b,Z as k,a4 as V,a as g,n as h,ab as G,ac as _,t as O,ad as S,e as $,ae as y,h as E,k as x}from"./index-521a9826.js";import{c as w,s as A}from"./Checker-1ada2d85.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};