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