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