import{e as _,i as C,x as o,c as z,o as S,a as d,b as r,t as l,n as t,w as u,d as c,_ as g,I as N,W as k}from"./BoB2h2qv.js";import{S as w}from"./Dx_CtjHX.js";const I={class:"flex items-center gap-3"},$={class:"text-sm text-muted-foreground"},y={class:"flex items-center gap-2"},D={class:"text-sm text-muted-foreground"},V={class:"flex items-center gap-2"},B=_({__name:"data-table-pagination",props:{table:{},pageSizeOptions:{default:()=>[10,20,50,100]},class:{default:void 0}},setup(m){const{t:s}=C(),e=m,b=o(()=>e.table.getState().pagination),x=o(()=>b.value.pageIndex+1),p=o(()=>e.table.getPageCount()),f=o(()=>e.table.getCanPreviousPage()),v=o(()=>e.table.getCanNextPage()),P=i=>{if(typeof i=="number")e.table.setPageSize(i);else if(typeof i=="string"){const a=Number.parseInt(i,10);Number.isNaN(a)||e.table.setPageSize(a)}};return(i,a)=>(S(),z("div",{class:N(t(k)("flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",e.class))},[d("div",I,[d("span",$,l(t(s)("Rows per page")),1),r(w,{options:m.pageSizeOptions.map(n=>({label:String(n),value:n})),"model-value":b.value.pageSize,class:"w-24","onUpdate:modelValue":P},null,8,["options","model-value"])]),d("div",y,[d("span",D,l(t(s)("Page {current} of {total}",{current:p.value===0?0:x.value,total:p.value})),1),d("div",V,[r(t(g),{variant:"outline",size:"sm",disabled:!f.value,onClick:a[0]||(a[0]=n=>e.table.setPageIndex(0))},{default:u(()=>[c(l(t(s)("First")),1)]),_:1},8,["disabled"]),r(t(g),{variant:"outline",size:"sm",disabled:!f.value,onClick:a[1]||(a[1]=n=>e.table.previousPage())},{default:u(()=>[c(l(t(s)("Prev")),1)]),_:1},8,["disabled"]),r(t(g),{variant:"outline",size:"sm",disabled:!v.value,onClick:a[2]||(a[2]=n=>e.table.nextPage())},{default:u(()=>[c(l(t(s)("Next")),1)]),_:1},8,["disabled"]),r(t(g),{variant:"outline",size:"sm",disabled:!v.value,onClick:a[3]||(a[3]=n=>e.table.setPageIndex(Math.max(p.value-1,0)))},{default:u(()=>[c(l(t(s)("Last")),1)]),_:1},8,["disabled"])])])],2))}}),h=Object.assign(B,{__name:"DataTablePagination"});export{h as D};
