import{k as e,ad as a,ae as l,c as t,r as s,a2 as n,V as d,a3 as o,S as i,R as u,an as c,W as p,U as r,ak as h,I as v,j as f,a4 as m,F as y,l as b,v as k}from"./vue.js?v=1764233927359";import{h as g}from"./page_layout.js?v=1764233927359";import{A as _}from"./public.js?v=1764233927359";import{da as w,_ as x,dV as j,d3 as K,aC as B}from"./naive.js?v=1764233927359";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:W}=a,$=g(W)?e=>e[W]:W,V=t({get:()=>U.value.length>0&&U.value.length===a.data.length,set(e){U.value=e?a.data.map(e=>$(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($(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)},q=()=>{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=B,g=w;return d(),n(g,{class:"bt-table-batch items-center",size:0},{default:o(()=>[i("div",C,[p(l,{checked:r(V),"onUpdate:checked":a[0]||(a[0]=e=>h(V)?V.value=e:null),disabled:r(z),indeterminate:r(A)},null,8,["checked","disabled","indeterminate"])]),e.options.length>1?(d(),u(y,{key:0},[i("div",{class:"min-w-140px",style:v({width:r(K)(e.selectWidth)})},[p(t,{value:r(E),"onUpdate:value":a[1]||(a[1]=e=>h(E)?E.value=e:null),options:r(F),disabled:r(I),placeholder:e.$t("Component.Batch.index_1")},null,8,["value","options","disabled","placeholder"])],4),i("div",R,[p(s,{type:r(M)?"default":"primary",disabled:r(M),onClick:S},{default:o(()=>[f(m(e.$t("Public.Btn.Execute")),1)]),_:1},8,["type","disabled"])])],64)):c("",!0),1===e.options.length?(d(),n(s,{key:1,disabled:r(I),type:r(I)?"default":"primary",onClick:q},{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),[[k,U.value.length>0]])]),_:1},8,["disabled","type"])):c("",!0)]),_:1})}}});export{U as _};
