import{k as e,ad as a,ae as l,c as t,r as s,R as n,a2 as d,a3 as o,U as i,X as u,V as c,aj as p,S as r,F as h,I as v,j as f,a4 as m,an as y,l as b,v as g}from"./vue.js?v=1763625242172";import{h as k}from"./page_layout.js?v=1763625242172";import{A as _}from"./public.js?v=1763625242172";import{d3 as w,_ as x,dV as j,aC as K,d9 as B}from"./naive.js?v=1763625242172";const C={class:"flex justify-center w-42px"},R={class:"ml-8px"},U=e({__name:"index",props:a({data:{default:()=>[]},rowKey:{default:"id"},options:{default:()=>[]},selectWidth:{default:140}},{checkedRowKeys:{default:()=>[]},checkedRowKeysModifiers:{}}),emits:["update:checkedRowKeys"],setup(e){const a=e,U=l(e,"checkedRowKeys"),{rowKey:$}=a,V=k($)?e=>e[$]:$,W=t({get:()=>U.value.length>0&&U.value.length===a.data.length,set(e){U.value=e?a.data.map((e=>V(e))):[]}}),z=t((()=>0===a.data.length)),A=t((()=>U.value.length>0&&U.value.length<a.data.length)),E=s(null),F=t((()=>a.options.map((e=>({label:e.label,value:e.key}))))),I=t((()=>0===U.value.length)),M=t((()=>I.value||null===E.value)),P=t((()=>a.data.filter((e=>U.value.includes(V(e)))))),S=()=>{var e;const{options:l}=a;for(let a of l)if(a.key===E.value)if("confirm"===a.type)_({...a.confirm,data:P.value});else null==(e=a.onBatch)||e.call(a,P.value)},X=()=>{var e;const{options:l}=a,t=l[0];if("confirm"===t.type)_({...t.confirm,data:P.value});else null==(e=t.onBatch)||e.call(t,P.value)};return(e,a)=>{const l=x,t=j,s=K,k=B;return n(),d(k,{class:"bt-table-batch items-center",size:0},{default:o((()=>[i("div",C,[u(l,{checked:c(W),"onUpdate:checked":a[0]||(a[0]=e=>p(W)?W.value=e:null),disabled:c(z),indeterminate:c(A)},null,8,["checked","disabled","indeterminate"])]),e.options.length>1?(n(),r(h,{key:0},[i("div",{class:"min-w-140px",style:v({width:c(w)(e.selectWidth)})},[u(t,{value:c(E),"onUpdate:value":a[1]||(a[1]=e=>p(E)?E.value=e:null),options:c(F),disabled:c(I),placeholder:e.$t("Component.Batch.index_1")},null,8,["value","options","disabled","placeholder"])],4),i("div",R,[u(s,{type:c(M)?"default":"primary",disabled:c(M),onClick:S},{default:o((()=>[f(m(e.$t("Public.Btn.Execute")),1)])),_:1},8,["type","disabled"])])],64)):y("",!0),1===e.options.length?(n(),d(s,{key:1,disabled:c(I),type:c(I)?"default":"primary",onClick:X},{default:o((()=>[i("span",null,m(e.options[0].label),1),b(i("span",null,m(e.$t("Component.Batch.index_2",[U.value.length])),513),[[g,U.value.length>0]])])),_:1},8,["disabled","type"])):y("",!0)])),_:1})}}});export{U as _};
