index.24fb4ee4.js 1.6 KB

1
  1. import{A as f,E as h,aX as C,d as p,ai as P,a2 as b,aj as k,a_ as V,j as g,I as G,G as _,as as A,V as E,aA as O,a7 as S,N as $}from"./index.394decd7.js";import{c as y,s as N}from"./index.b91a923c.js";const[x,j]=f("checkbox-group"),B={max:h,disabled:Boolean,iconSize:h,direction:String,modelValue:C(),checkedColor:String},v=Symbol(x);var F=p({name:x,props:B,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 b(()=>a.modelValue,e=>d("change",e)),k({toggleAll:u}),V(()=>a.modelValue),i({props:a,updateValue:o}),()=>{var e;return g("div",{class:j([a.direction])},[(e=s.default)==null?void 0:e.call(s)])}}});const[I,K]=f("checkbox"),X=G({},y,{bindGroup:_});var w=p({name:I,props:X,emits:["change","update:modelValue"],setup(a,{emit:d,slots:s}){const{parent:l}=A(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=E(()=>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 b(()=>a.modelValue,e=>d("change",e)),k({toggle:u,props:a,checked:o}),V(()=>a.modelValue),()=>g(N,S({bem:K,role:"checkbox",parent:l,checked:o.value,onToggle:u},a),O(s,["default","icon"]))}});const H=$(w);export{H as C,F as s};