2 lines
2.1 KiB
JavaScript
2 lines
2.1 KiB
JavaScript
import{u as f,j as e,e as u}from"./vendor-BKmmeuxg.js";import{B as s}from"./button-BpNwv2aE.js";import{D as y,a as _,b as k,c as P}from"./dropdown-menu-DO-po5c1.js";import{S as w}from"./scroll-area-C8HGru-R.js";import{g as x}from"./route-B4ZMN77y.js";import"./index-WW_1X1qx.js";import"./utils-DxSsnXxD.js";const F=t=>{const{paginationInfo:p,paginationKey:c="page"}=t,{current_page:o,last_page:n,first_page_url:g,last_page_url:b,next_page_url:l,prev_page_url:i}=p,h=f(),m=x(h.url),d=[];if(n>0)for(let r=1;r<=n;r++)d.push({key:`${r}`,value:r});else d.push({key:"1",value:1});const j=r=>{u.get(route(t.routeName,{...t.routeParams||{},...m,[c]:r}),{},{preserveState:!0})},a=r=>{const N=x(r);u.get(route(t.routeName,{...t.routeParams||{},...m,[c]:N.page}),{},{preserveState:!0})},v=r=>`text-center py-1 ${o===r&&"bg-primary-50"}`;return e.jsxs("div",{className:`space-y-4 ${t.className}`,children:[e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx("span",{className:"mr-1",children:e.jsxs("strong",{children:[o," of ",n]})}),e.jsx("span",{className:"mr-3",children:"| Go to page:"}),e.jsxs(y,{children:[e.jsx(_,{children:e.jsx(s,{type:"button",variant:"outline",className:"h-8 w-[60px] rounded-md border",children:o})}),e.jsx(k,{align:"end",className:"min-w-[60px]",children:e.jsx(w,{className:"",children:d.map(r=>e.jsx(P,{onClick:()=>j(r.value),className:v(r.value),children:r.value},r.key))})})]})]}),e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(s,{type:"button",variant:"ghost",disabled:!i,onClick:()=>a(g),className:"bg-muted border-border h-8 border px-2 text-xs sm:px-3",children:"<<First"}),e.jsx(s,{type:"button",variant:"ghost",disabled:!i,onClick:()=>a(i),className:"bg-muted border-border mx-3 h-8 border px-2 text-xs sm:px-3",children:"Prev"}),e.jsx(s,{type:"button",variant:"ghost",disabled:!l,onClick:()=>a(l),className:"bg-muted border-border mx-3 h-8 border px-2 text-xs sm:px-3",children:"Next"}),e.jsx(s,{type:"button",variant:"ghost",disabled:!l,onClick:()=>a(b),className:"bg-muted border-border h-8 border px-2 text-xs sm:px-3",children:"Last>>"})]})]})};export{F as default};
|