Files
flowbite-vue/docs/.vitepress/dist/assets/components_pagination.md.c228117a.lean.js
2024-03-12 05:28:28 +01:00

2 lines
10 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{t as $}from"./chunks/FwbRange.vue_vue_type_style_index_0_scoped_fadec9c5_lang.66ff4c69.js";import{d as f,g,o as r,c,n as C,a as h,k as t,t as b,e as w,r as F,F as x,D as W,h as v,H as p,l as i,w as _,Q as q}from"./chunks/framework.3f630664.js";const O={"aria-label":"Navigation"},Y={class:"font-semibold text-gray-900 dark:text-white"},G={class:"font-semibold text-gray-900 dark:text-white"},H={class:"font-semibold text-gray-900 dark:text-white"},J=["disabled"],Q=["disabled"],K={key:0,stroke:"currentColor",fill:"currentColor","stroke-width":"0",viewBox:"0 0 20 20","aria-hidden":"true",class:"h-5 w-5",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},X=t("path",{"fill-rule":"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z","clip-rule":"evenodd"},null,-1),Z=[X],ss=["disabled","onClick"],as=["disabled"],ns={key:0,stroke:"currentColor",fill:"currentColor","stroke-width":"0",viewBox:"0 0 20 20","aria-hidden":"true",class:"h-5 w-5",height:"1em",width:"1em",xmlns:"http://www.w3.org/2000/svg"},ls=t("path",{"fill-rule":"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z","clip-rule":"evenodd"},null,-1),os=[ls],ts=["disabled"],d=f({__name:"FwbPagination",props:{modelValue:{default:1},totalPages:{default:void 0},perPage:{default:10},totalItems:{default:10},layout:{default:"pagination"},showIcons:{type:Boolean,default:!1},sliceLength:{default:2},previousLabel:{default:"Prev"},nextLabel:{default:"Next"},enableFirstAndLastButtons:{type:Boolean,default:!1},showLabels:{type:Boolean,default:!0},large:{type:Boolean,default:!1}},emits:["update:model-value","page-changed"],setup(u,{emit:n}){const e=n,s=u;function l(a){e("update:model-value",a),e("page-changed",a)}function m(){e("update:model-value",s.modelValue-1),e("page-changed",s.modelValue-1)}function k(){e("update:model-value",s.modelValue+1),e("page-changed",s.modelValue+1)}function S(){e("update:model-value",1),e("page-changed",1)}function I(){const a=y.value;e("update:model-value",a),e("page-changed",a)}const y=g(()=>s.totalPages?s.totalPages:Math.ceil(s.totalItems/s.perPage)),D=g(()=>s.modelValue<=1),V=g(()=>s.modelValue>=y.value),T=a=>a===s.modelValue,L=g(()=>{if(s.layout==="navigation")return[];if(s.layout==="table")return[];if(y.value<=s.sliceLength*2+1){const o=[];for(let E=1;E<=y.value;E++)o.push(E);return o}if(s.modelValue<=s.sliceLength){const o=[],E=Math.abs(s.modelValue-s.sliceLength)+s.modelValue+s.sliceLength+1;for(let B=1;B<=E;B++)o.push(B);return o}if(s.modelValue>=y.value-s.sliceLength){const o=[];for(let E=Math.abs(y.value-s.sliceLength*2);E<=y.value;E++)o.push(E);return o}const a=[],P=s.modelValue-s.sliceLength>0?s.modelValue-s.sliceLength:1;for(let o=P;o<s.modelValue+s.sliceLength+1&&!(o>=y.value);o++)a.push(o);return a}),N=g(()=>s.modelValue*s.perPage-s.perPage+1),j=g(()=>{const a=s.modelValue*s.perPage;return s.totalItems&&a>s.totalItems?s.totalItems:a}),U=g(()=>s.totalItems?s.totalItems:y.value*s.perPage),z=g(()=>s.modelValue===1),M=g(()=>s.modelValue===y.value);function R(a){const P="flex items-center justify-center px-3 h-8 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white",o="text-blue-600 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:bg-gray-700 dark:text-white",E="px-4 h-10";return $(P,a&&o,s.large&&E)}function A(a){const P="flex items-center justify-center first:rounded-l-lg last:rounded-r-lg px-3 h-8 ml-0 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white",o="bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-white cursor-not-allowed",E="px-4 h-10",B="border-none text-white hover:text-white bg-gray-800 rounded-none first:rounded-l last:rounded-r hover:bg-gray-900 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white";return $(P,a===s.modelValue&&o,s.large&&E,(a>y.value||a<1)&&o,s.layout==="navigation"&&"first:mr-3",(s.layout==="navigation"||s.layout==="table")&&"rounded-lg",s.layout==="table"&&B)}return(a,P)=>(r(),c("nav",O,[a.layout==="table"?(r(),c("div",{key:0,class:C(["text-gray-700 dark:text-gray-400 mb-2",a.large?"text-base":"text-sm"])},[h(" Showing "),t("span",Y,b(N.value),1),h(" to "),t("span",G,b(j.value),1),h(" of "),t("span",H,b(U.value),1)],2)):w("",!0),t("div",{class:C(["inline-flex",a.large&&"text-base h-10"])},[F(a.$slots,"start"),a.enableFirstAndLastButtons?F(a.$slots,"first-button",{key:0},()=>[t("button",{disabled:z.value,class:C(A(1)),onClick:S}," First ",10,J)]):w("",!0),F(a.$slots,"prev-button",{disabled:D.value,decreasePage:m},()=>[t("button",{disabled:D.value,class:C(A(a.modelValue-1)),onClick:m},[F(a.$slots,"prev-icon",{},()=>[a.showIcons||a.$slots["prev-icon"]?(r(),c("svg",K,Z)):w("",!0)]),a.showLabels?(r(),c(x,{key:0},[h(b(a.previousLabel),1)],64)):w("",!0)],10,Q)]),(r(!0),c(x,null,W(L.value,o=>F(a.$slots,"page-button",{key:o,page:o,setPage:l,disabled:T(o)},()=>[t("button",{disabled:T(o),class:C(R(o===a.modelValue)),onClick:E=>l(o)},b(o),11,ss)])),128)),F(a.$slots,"next-button",{disabled:V.value,increasePage:k},()=>[t("button",{disabled:V.value,class:C(A(a.modelValue+1)),onClick:k},[a.showLabels?(r(),c(x,{key:0},[h(b(a.nextLabel),1)],64)):w("",!0),F(a.$slots,"next-icon",{},()=>[a.showIcons||a.$slots["next-icon"]?(r(),c("svg",ns,os)):w("",!0)])],10,as)]),a.enableFirstAndLastButtons?F(a.$slots,"last-button",{key:1},()=>[t("button",{disabled:M.value,class:C(A(y.value)),onClick:I}," Last ",10,ts)]):w("",!0),F(a.$slots,"end")],2)]))}}),es={class:"vp-raw flex flex-col items-center"},ps=f({__name:"FwbPaginationExample",setup(u){const n=v(1);return(e,s)=>(r(),c("div",es,[p(i(d),{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=l=>n.value=l),"total-items":100,class:"mb-2"},null,8,["modelValue"]),p(i(d),{modelValue:n.value,"onUpdate:modelValue":s[1]||(s[1]=l=>n.value=l),"total-items":100,large:""},null,8,["modelValue"])]))}}),rs={class:"vp-raw flex justify-center"},cs=f({__name:"FwbPaginationExampleNavigation",setup(u){const n=v(1);return(e,s)=>(r(),c("div",rs,[p(i(d),{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=l=>n.value=l),layout:"navigation","total-pages":100},null,8,["modelValue"])]))}}),Es={class:"vp-raw flex flex-col items-center justify-center text-center"},ys=f({__name:"FwbPaginationExampleTable",setup(u){const n=v(1),e=v(1);return(s,l)=>(r(),c("div",Es,[p(i(d),{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=m=>n.value=m),layout:"table","per-page":20,"total-items":998,class:"mb-2"},null,8,["modelValue"]),p(i(d),{modelValue:e.value,"onUpdate:modelValue":l[1]||(l[1]=m=>e.value=m),layout:"table","per-page":100,"total-items":750,large:""},null,8,["modelValue"])]))}}),is={class:"vp-raw flex flex-col items-center"},ds=t("span",{class:"sr-only"},"Previous",-1),us=t("svg",{class:"w-2.5 h-2.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10"},[t("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 1 1 5l4 4"})],-1),gs=t("span",{class:"sr-only"},"Next",-1),Fs=t("svg",{class:"w-2.5 h-2.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10"},[t("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m1 9 4-4-4-4"})],-1),hs=t("span",{class:"sr-only"},"Previous",-1),ms=t("svg",{class:"w-2.5 h-2.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10"},[t("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 1 1 5l4 4"})],-1),bs=t("span",{class:"sr-only"},"Next",-1),vs=t("svg",{class:"w-2.5 h-2.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 6 10"},[t("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m1 9 4-4-4-4"})],-1),fs=f({__name:"FwbPaginationExampleWithIcons",setup(u){const n=v(1);return(e,s)=>(r(),c("div",is,[p(i(d),{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=l=>n.value=l),"total-pages":100,"show-labels":!1,class:"mb-2"},{"prev-icon":_(()=>[ds,us]),"next-icon":_(()=>[gs,Fs]),_:1},8,["modelValue"]),p(i(d),{modelValue:n.value,"onUpdate:modelValue":s[1]||(s[1]=l=>n.value=l),"total-pages":100,"show-labels":!1,large:""},{"prev-icon":_(()=>[hs,ms]),"next-icon":_(()=>[bs,vs]),_:1},8,["modelValue"])]))}}),Cs={class:"vp-raw flex justify-center"},ws=f({__name:"FwbPaginationExampleWithCustomText",setup(u){const n=v(1);return(e,s)=>(r(),c("div",Cs,[p(i(d),{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=l=>n.value=l),"total-pages":100,"previous-label":"<<<","next-label":">>>"},null,8,["modelValue"])]))}}),_s={class:"vp-raw flex justify-center"},qs=f({__name:"FwbPaginationExampleWithCustomSlice",setup(u){const n=v(1);return(e,s)=>(r(),c("div",_s,[p(i(d),{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=l=>n.value=l),"slice-length":4,"total-pages":100},null,8,["modelValue"])]))}}),Ps={class:"vp-raw flex flex-col items-center"},Bs=["onClick"],As=f({__name:"FwbPaginationExampleSlots",setup(u){const n=v(1);return(e,s)=>(r(),c("div",Ps,[p(i(d),{modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=l=>n.value=l),"total-items":100,"show-labels":!1},{"prev-icon":_(()=>[h(" ⬅️ ")]),"next-icon":_(()=>[h(" ➡️ ")]),"page-button":_(({page:l,setPage:m})=>[t("button",{class:"flex items-center justify-center first:rounded-l-lg last:rounded-r-lg px-3 h-8 ml-0 leading-tight text-gray-500 bg-purple-200 border border-purple-300 hover:bg-purple-300 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white",onClick:k=>m(l)},b(l),9,Bs)]),_:1},8,["modelValue"]),h(" Current page: "+b(n.value),1)]))}}),ks=q("",5),xs=q("",3),Ds=q("",4),Vs=q("",2),Ts=q("",5),$s=q("",2),Ss=t("h2",{id:"slots-example",tabindex:"-1"},[h("Slots example "),t("a",{class:"header-anchor",href:"#slots-example","aria-label":'Permalink to "Slots example"'},"")],-1),Is=q("",8),Us=JSON.parse('{"title":"Vue Pagination - Flowbite","description":"","frontmatter":{},"headers":[],"relativePath":"components/pagination.md","filePath":"components/pagination.md"}'),Ls={name:"components/pagination.md"},zs=Object.assign(Ls,{setup(u){return(n,e)=>(r(),c("div",null,[ks,p(ps),xs,p(fs),Ds,p(qs),Vs,p(cs),Ts,p(ys),$s,p(ws),Ss,p(As),Is]))}});export{Us as __pageData,zs as default};