File manager - Edit - /home/autoph/public_html/projects/ahg-hr/assets/Pagination.7ae40a9d.js
Back
import{I as f}from"./index.c6b20525.js";import{_ as x,r as y,o as r,b as n,d as l,t as i,j as u,h as d,e as P,F as h,m as v,p as b,v as p}from"./index.15cec131.js";const I={components:{Icon:f},props:{currentPage:{type:Number,required:!0},totalItems:{type:Number,default:0},totalPages:{type:Number,required:!0},itemsPerPage:{type:Number,required:!0},pageOptions:{type:Array},pageNumberClass:{type:String},inactiveClass:{type:String,default:"bg-slate-50 text-slate-700"},activeClass:{type:String,default:"bg-slate-900 text-white"}},data(){return{selectedItemsPerPage:this.itemsPerPage,itemsPerPageOptions:this.pageOptions??[5,10,20,50,100]}},computed:{pages(){let a=[],t=Math.max(1,this.currentPage-2),e=Math.min(this.totalPages,this.currentPage+2);e-t<4&&(t===1?e=Math.min(5,this.totalPages):e===this.totalPages&&(t=Math.max(1,this.totalPages-4)));for(let c=t;c<=e;c++)a.push(c);return a},countStart:function(){return(this.currentPage-1)*this.selectedItemsPerPage+1},countEnd:function(){let a=this.currentPage*this.selectedItemsPerPage;return a>this.totalItems?this.totalItems:a}},methods:{changeItemsPerPage(){this.$emit("changeItemsPerPage",this.selectedItemsPerPage)}}},_={class:"mt-4 grid grid-cols-3 space-x-2 px-6"},C={key:0,class:"self-center text-slate-700"},k={class:"flex-grow flex justify-center items-center space-x-2"},N=["onClick"],S={class:"flex space-x-4 justify-end"},B=["value"],M={class:"text-slate-700 text-sm"};function w(a,t,e,c,g,o){const m=y("Icon");return r(),n("div",_,[l("div",null,[e.totalItems?(r(),n("div",C,i(`${o.countStart}-${o.countEnd}`)+" of "+i(e.totalItems)+" "+i(e.totalItems>1?"records":"record"),1)):u("",!0)]),l("div",k,[e.currentPage!==1?(r(),n("button",{key:0,class:d(["px-2 py-0 text-gray-800 rounded-full text-2xl text-slate-300 hover:text-primary-900 hover:font-semibold",a.prevBtnClass]),onClick:t[0]||(t[0]=s=>a.$emit("changePage",e.currentPage-1))},[P(m,{icon:"carbon:chevron-left"})],2)):u("",!0),e.totalPages>1?(r(!0),n(h,{key:1},v(o.pages,s=>(r(),n("button",{key:s,class:d(["px-2 py-0 rounded-full border border-slate-900",e.pageNumberClass,s===e.currentPage?e.activeClass:e.inactiveClass]),onClick:O=>a.$emit("changePage",s)},i(s),11,N))),128)):u("",!0),e.currentPage!==e.totalPages?(r(),n("button",{key:2,class:d(["px-2 py-0 text-gray-800 rounded-full text-2xl text-slate-300 hover:text-primary-900 hover:font-semibold",a.nextBtnClass]),onClick:t[1]||(t[1]=s=>a.$emit("changePage",e.currentPage+1))},[P(m,{icon:"carbon:chevron-right",class:""})],2)):u("",!0)]),l("div",S,[l("div",null,[t[4]||(t[4]=l("span",null,"per page",-1)),b(l("select",{class:"ml-4 px-2 py-1 bg-white border rounded","onUpdate:modelValue":t[2]||(t[2]=s=>g.selectedItemsPerPage=s),onChange:t[3]||(t[3]=(...s)=>o.changeItemsPerPage&&o.changeItemsPerPage(...s))},[(r(!0),n(h,null,v(g.itemsPerPageOptions,s=>(r(),n("option",{key:s,value:s},i(s),9,B))),128))],544),[[p,g.selectedItemsPerPage]])]),l("div",null,[l("span",M,"Page "+i(e.currentPage)+" of "+i(e.totalPages),1)])])])}const q=x(I,[["render",w],["__scopeId","data-v-2e539a7b"]]);export{q as P};
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.06 |
proxy
|
phpinfo
|
Settings