import{k as F,an as M,c as o,r as j,$ as m,a8 as w,a9 as f,_ as d,a0 as k,S as n,X as B,Z as z,H as E,j as U,aa as v,F as W,ak as C,l as H,v as L,ao as O}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{ao as P,bd as x}from"./index-BTglIPU2.js?v=1773287522785";import{k as T,al as X,a6 as Z,f as q,B as A}from"./naive-ui--dJnpVcV.js?v=1773287522785";const G={class:"flex justify-center w-42px"},I={class:"ml-8px"},ee=F({__name:"index",props:O({data:{default:()=>[]},rowKey:{default:"id"},options:{default:()=>[]},selectWidth:{default:140}},{checkedRowKeys:{default:()=>[]},checkedRowKeysModifiers:{}}),emits:["update:checkedRowKeys"],setup(_){const s=_,l=M(_,"checkedRowKeys"),{rowKey:r}=s,b=P(r)?e=>e[r]:r,p=o({get(){return l.value.length>0&&l.value.length===s.data.length},set(e){e?l.value=s.data.map(t=>b(t)):l.value=[]}}),K=o(()=>s.data.length===0),D=o(()=>l.value.length>0&&l.value.length<s.data.length),c=j(null),S=o(()=>s.options.map(e=>({label:e.label,value:e.key}))),i=o(()=>l.value.length===0),y=o(()=>i.value||c.value===null),u=o(()=>s.data.filter(e=>l.value.includes(b(e)))),R=()=>{var t;const{options:e}=s;for(let a of e)a.key===c.value&&(a.type==="confirm"?x({...a.confirm,data:u.value}):(t=a.onBatch)==null||t.call(a,u.value))},N=()=>{var a;const{options:e}=s,t=e[0];t.type==="confirm"?x({...t.confirm,data:u.value}):(a=t.onBatch)==null||a.call(t,u.value)};return(e,t)=>{const a=X,V=Z,g=A,$=T;return m(),w($,{class:"bt-table-batch items-center",size:0},{default:f(()=>[d("div",G,[k(a,{checked:n(p),"onUpdate:checked":t[0]||(t[0]=h=>B(p)?p.value=h:null),disabled:n(K),indeterminate:n(D)},null,8,["checked","disabled","indeterminate"])]),e.options.length>1?(m(),z(W,{key:0},[d("div",{class:"min-w-140px",style:E({width:n(q)(e.selectWidth)})},[k(V,{value:n(c),"onUpdate:value":t[1]||(t[1]=h=>B(c)?c.value=h:null),options:n(S),disabled:n(i),placeholder:e.$t("Component.Batch.index_1")},null,8,["value","options","disabled","placeholder"])],4),d("div",I,[k(g,{type:n(y)?"default":"primary",disabled:n(y),onClick:R},{default:f(()=>[U(v(e.$t("Public.Btn.Execute")),1)]),_:1},8,["type","disabled"])])],64)):C("",!0),e.options.length===1?(m(),w(g,{key:1,disabled:n(i),type:n(i)?"default":"primary",onClick:N},{default:f(()=>[d("span",null,v(e.options[0].label),1),H(d("span",null,v(e.$t("Component.Batch.index_2",[l.value.length])),513),[[L,l.value.length>0]])]),_:1},8,["disabled","type"])):C("",!0)]),_:1})}}});export{ee as _};
