index.29eb1675.js 1.6 KB

1
  1. import{E as f,G as h,aW as C,d as p,aj as P,a3 as k,ak as b,a$ as V,i as g,J as G,H as _,at as O,W as $,aB as E,a8 as S,O as y}from"./index.7994470a.js";import{c as B,s as A}from"./index.c9af17c2.js";const[x,H]=f("checkbox-group"),K={max:h,disabled:Boolean,iconSize:h,direction:String,modelValue:C(),checkedColor:String},v=Symbol(x);var F=p({name:x,props:K,emits:["change","update:modelValue"],setup(a,{emit:d,slots:s}){const{children:l,linkChildren:i}=P(v),o=e=>d("update:modelValue",e),u=(e={})=>{typeof e=="boolean"&&(e={checked:e});const{checked:t,skipDisabled:r}=e,c=l.filter(n=>n.props.bindGroup?n.props.disabled&&r?n.checked.value:t!=null?t:!n.checked.value:!1).map(n=>n.name);o(c)};return k(()=>a.modelValue,e=>d("change",e)),b({toggleAll:u}),V(()=>a.modelValue),i({props:a,updateValue:o}),()=>{var e;return g("div",{class:H([a.direction])},[(e=s.default)==null?void 0:e.call(s)])}}});const[N,W]=f("checkbox"),j=G({},B,{bindGroup:_});var w=p({name:N,props:j,emits:["change","update:modelValue"],setup(a,{emit:d,slots:s}){const{parent:l}=O(v),i=e=>{const{name:t}=a,{max:r,modelValue:m}=l.props,c=m.slice();if(e)!(r&&c.length>=r)&&!c.includes(t)&&(c.push(t),a.bindGroup&&l.updateValue(c));else{const n=c.indexOf(t);n!==-1&&(c.splice(n,1),a.bindGroup&&l.updateValue(c))}},o=$(()=>l&&a.bindGroup?l.props.modelValue.indexOf(a.name)!==-1:!!a.modelValue),u=(e=!o.value)=>{l&&a.bindGroup?i(e):d("update:modelValue",e)};return k(()=>a.modelValue,e=>d("change",e)),b({toggle:u,props:a,checked:o}),V(()=>a.modelValue),()=>g(A,S({bem:W,role:"checkbox",parent:l,checked:o.value,onToggle:u},a),E(s,["default","icon"]))}});const I=y(w);export{I as C,F as s};