@everymatrix/helper-pagination 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,18 @@ const TRANSLATIONS = {
32
32
  nextPage: 'Urmatoarea',
33
33
  lastPage: 'Ultima'
34
34
  },
35
+ fr: {
36
+ firstPage: 'First',
37
+ previousPage: 'Previous',
38
+ nextPage: 'Next',
39
+ lastPage: 'Last'
40
+ },
41
+ ar: {
42
+ firstPage: 'First',
43
+ previousPage: 'Previous',
44
+ nextPage: 'Next',
45
+ lastPage: 'Last'
46
+ }
35
47
  };
36
48
  const translate = (key, customLang) => {
37
49
  const lang = customLang;
@@ -13,6 +13,18 @@ const TRANSLATIONS = {
13
13
  nextPage: 'Urmatoarea',
14
14
  lastPage: 'Ultima'
15
15
  },
16
+ fr: {
17
+ firstPage: 'First',
18
+ previousPage: 'Previous',
19
+ nextPage: 'Next',
20
+ lastPage: 'Last'
21
+ },
22
+ ar: {
23
+ firstPage: 'First',
24
+ previousPage: 'Previous',
25
+ nextPage: 'Next',
26
+ lastPage: 'Last'
27
+ }
16
28
  };
17
29
  export const translate = (key, customLang) => {
18
30
  const lang = customLang;
@@ -28,6 +28,18 @@ const TRANSLATIONS = {
28
28
  nextPage: 'Urmatoarea',
29
29
  lastPage: 'Ultima'
30
30
  },
31
+ fr: {
32
+ firstPage: 'First',
33
+ previousPage: 'Previous',
34
+ nextPage: 'Next',
35
+ lastPage: 'Last'
36
+ },
37
+ ar: {
38
+ firstPage: 'First',
39
+ previousPage: 'Previous',
40
+ nextPage: 'Next',
41
+ lastPage: 'Last'
42
+ }
31
43
  };
32
44
  const translate = (key, customLang) => {
33
45
  const lang = customLang;
@@ -28,6 +28,18 @@ const TRANSLATIONS = {
28
28
  nextPage: 'Urmatoarea',
29
29
  lastPage: 'Ultima'
30
30
  },
31
+ fr: {
32
+ firstPage: 'First',
33
+ previousPage: 'Previous',
34
+ nextPage: 'Next',
35
+ lastPage: 'Last'
36
+ },
37
+ ar: {
38
+ firstPage: 'First',
39
+ previousPage: 'Previous',
40
+ nextPage: 'Next',
41
+ lastPage: 'Last'
42
+ }
31
43
  };
32
44
  const translate = (key, customLang) => {
33
45
  const lang = customLang;
@@ -1 +1 @@
1
- import{p as t,b as n}from"./p-68c68be2.js";(()=>{const n=import.meta.url,e={};return""!==n&&(e.resourcesUrl=new URL(".",n).href),t(e)})().then((t=>n([["p-dd1d2413",[[1,"helper-pagination",{firstPage:[1540,"first-page"],previousPage:[1540,"previous-page"],offset:[1538],limit:[1538],total:[1538],language:[1],clientStyling:[1,"client-styling"],clientStylingUrlContent:[1,"client-styling-url-content"],offsetInt:[32],lastPage:[32],limitInt:[32],totalInt:[32],pagesArray:[32],endInt:[32],limitStylingAppends:[32]}]]]],t)));
1
+ import{p as t,b as n}from"./p-68c68be2.js";(()=>{const n=import.meta.url,e={};return""!==n&&(e.resourcesUrl=new URL(".",n).href),t(e)})().then((t=>n([["p-8258fc5c",[[1,"helper-pagination",{firstPage:[1540,"first-page"],previousPage:[1540,"previous-page"],offset:[1538],limit:[1538],total:[1538],language:[1],clientStyling:[1,"client-styling"],clientStylingUrlContent:[1,"client-styling-url-content"],offsetInt:[32],lastPage:[32],limitInt:[32],totalInt:[32],pagesArray:[32],endInt:[32],limitStylingAppends:[32]}]]]],t)));
@@ -0,0 +1 @@
1
+ import{r as t,c as i,h as s}from"./p-68c68be2.js";const e=t=>!!(t.toLowerCase().match(/android/i)||t.toLowerCase().match(/blackberry|bb/i)||t.toLowerCase().match(/iphone|ipad|ipod/i)||t.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),a=["ro","en"],o={en:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ro:{firstPage:"Prima",previousPage:"Anterior",nextPage:"Urmatoarea",lastPage:"Ultima"},fr:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ar:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"}},n=(t,i)=>{const s=i;return o[void 0!==s&&a.includes(s)?s:"en"][t]},h=class{constructor(s){t(this,s),this.hpPageChange=i(this,"hpPageChange",7),this.firstPage=!1,this.previousPage=!1,this.offset=0,this.limit=1,this.total=1,this.language="en",this.clientStyling="",this.clientStylingUrlContent="",this.pagesArray=[],this.endInt=0,this.userAgent=window.navigator.userAgent,this.currentPage=1,this.limitStylingAppends=!1,this.navigateTo=t=>{switch(t){case"firstPage":this.offsetInt=0;break;case"lastPage":this.offsetInt=this.endInt*this.limitInt;break;case"previousPage":this.offsetInt-=10;break;case"nextPage":this.offsetInt+=10;break;case"fivePagesBack":this.offsetInt-=30,this.offsetInt=this.offsetInt<0?0:this.offsetInt;break;case"fivePagesForward":this.offsetInt+=30,this.offsetInt=this.offsetInt/10>=this.endInt?10*this.endInt:this.offsetInt}this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{isNaN(t)?0===i&&this.currentPage<=4?this.navigateTo("firstPage"):0===i&&this.currentPage>4?this.navigateTo("fivePagesBack"):4===i&&this.endInt-this.currentPage>=2&&this.navigateTo("fivePagesForward"):this.offsetInt=1===t?t-1:10*(t-1),this.currentPage=this.offsetInt,this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=document.createElement("style");setTimeout((()=>{t.innerHTML=this.clientStylingUrlContent,this.stylingContainer.prepend(t)}),1)}}componentWillRender(){this.offsetInt=this.offset,this.currentPage=this.offsetInt/this.limitInt+1,this.limitInt=this.limit,this.totalInt=this.total,this.endInt=Math.ceil(this.totalInt/this.limitInt)-1,this.lastPage=!(this.offsetInt>=this.endInt*this.limitInt),1===this.currentPage||2===this.currentPage?(this.pagesArray=Array.from({length:4},((t,i)=>i+1)),this.pagesArray.push("...")):this.currentPage>=3&&this.endInt-this.currentPage>=2?(this.pagesArray=Array.from({length:3},((t,i)=>this.currentPage+i-1)),this.pagesArray.push("..."),this.pagesArray.unshift("...")):this.endInt-this.currentPage<3&&(this.pagesArray=Array.from({length:4},((t,i)=>this.endInt-2+i)),this.pagesArray.unshift("..."))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrlContent&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){let t=s("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>s("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(e(this.userAgent)?"MobileButtons":"")},s("button",{disabled:t===this.currentPage,onClick:this.paginationNavigation.bind(this,t,i)},s("span",null,t)))))),i=s("div",{class:"LeftItems"},s("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"firstPage")},n("firstPage",this.language)),s("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},n("previousPage",this.language)));e(this.userAgent)&&(i=s("div",{class:"LeftItems"},s("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},n("previousPage",this.language))));let a=s("div",{class:"RightItems"},s("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},n("nextPage",this.language)),s("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"lastPage")},n("lastPage",this.language)));return e(this.userAgent)&&(a=s("div",{class:"RightItems"},s("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},n("nextPage",this.language)))),s("div",{id:"PaginationContainer"},i,t,a)}};h.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}#PaginationContainer{width:100%;margin-top:20px;display:inline-flex;justify-content:space-between;align-items:center}.LeftItems button:not(:first-child),.RightItems button:not(:last-child){margin:0 10px}.LeftItems button,.RightItems button{padding:0;background-color:#009993;border-color:#009993}.PaginationArea{display:inline-flex;gap:10px;list-style:none}.PaginationArea li{margin:0;padding:0}.PaginationArea li button{width:24px;height:24px;display:flex;border:0;padding:0;justify-content:center;align-items:center;background-color:transparent;color:#000;cursor:pointer;pointer-events:all}.PaginationItem.ActiveItem button{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem button:disabled{pointer-events:none;cursor:not-allowed}.PaginationItem button:hover,.PaginationItem button:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}button{width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:all 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}button:hover,button:active{background:#004D4A;border-color:#004D4A}button:disabled{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){button{width:90px;font-size:12px}}@media screen and (max-width: 480px){button{width:70px;font-size:10px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:10px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem button:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem button:hover{background:#009993;border-color:#009993;color:#fff}}';export{h as helper_pagination}
@@ -0,0 +1,2 @@
1
+ import { Config } from '../../../../../../../../../../../stencil-public-runtime';
2
+ export declare const config: Config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/helper-pagination",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as t,c as i,h as s}from"./p-68c68be2.js";const e=t=>!!(t.toLowerCase().match(/android/i)||t.toLowerCase().match(/blackberry|bb/i)||t.toLowerCase().match(/iphone|ipad|ipod/i)||t.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),o=["ro","en"],a={en:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ro:{firstPage:"Prima",previousPage:"Anterior",nextPage:"Urmatoarea",lastPage:"Ultima"}},n=(t,i)=>{const s=i;return a[void 0!==s&&o.includes(s)?s:"en"][t]},h=class{constructor(s){t(this,s),this.hpPageChange=i(this,"hpPageChange",7),this.firstPage=!1,this.previousPage=!1,this.offset=0,this.limit=1,this.total=1,this.language="en",this.clientStyling="",this.clientStylingUrlContent="",this.pagesArray=[],this.endInt=0,this.userAgent=window.navigator.userAgent,this.currentPage=1,this.limitStylingAppends=!1,this.navigateTo=t=>{switch(t){case"firstPage":this.offsetInt=0;break;case"lastPage":this.offsetInt=this.endInt*this.limitInt;break;case"previousPage":this.offsetInt-=10;break;case"nextPage":this.offsetInt+=10;break;case"fivePagesBack":this.offsetInt-=30,this.offsetInt=this.offsetInt<0?0:this.offsetInt;break;case"fivePagesForward":this.offsetInt+=30,this.offsetInt=this.offsetInt/10>=this.endInt?10*this.endInt:this.offsetInt}this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{isNaN(t)?0===i&&this.currentPage<=4?this.navigateTo("firstPage"):0===i&&this.currentPage>4?this.navigateTo("fivePagesBack"):4===i&&this.endInt-this.currentPage>=2&&this.navigateTo("fivePagesForward"):this.offsetInt=1===t?t-1:10*(t-1),this.currentPage=this.offsetInt,this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=document.createElement("style");setTimeout((()=>{t.innerHTML=this.clientStylingUrlContent,this.stylingContainer.prepend(t)}),1)}}componentWillRender(){this.offsetInt=this.offset,this.currentPage=this.offsetInt/this.limitInt+1,this.limitInt=this.limit,this.totalInt=this.total,this.endInt=Math.ceil(this.totalInt/this.limitInt)-1,this.lastPage=!(this.offsetInt>=this.endInt*this.limitInt),1===this.currentPage||2===this.currentPage?(this.pagesArray=Array.from({length:4},((t,i)=>i+1)),this.pagesArray.push("...")):this.currentPage>=3&&this.endInt-this.currentPage>=2?(this.pagesArray=Array.from({length:3},((t,i)=>this.currentPage+i-1)),this.pagesArray.push("..."),this.pagesArray.unshift("...")):this.endInt-this.currentPage<3&&(this.pagesArray=Array.from({length:4},((t,i)=>this.endInt-2+i)),this.pagesArray.unshift("..."))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrlContent&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){let t=s("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>s("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(e(this.userAgent)?"MobileButtons":"")},s("button",{disabled:t===this.currentPage,onClick:this.paginationNavigation.bind(this,t,i)},s("span",null,t)))))),i=s("div",{class:"LeftItems"},s("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"firstPage")},n("firstPage",this.language)),s("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},n("previousPage",this.language)));e(this.userAgent)&&(i=s("div",{class:"LeftItems"},s("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},n("previousPage",this.language))));let o=s("div",{class:"RightItems"},s("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},n("nextPage",this.language)),s("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"lastPage")},n("lastPage",this.language)));return e(this.userAgent)&&(o=s("div",{class:"RightItems"},s("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},n("nextPage",this.language)))),s("div",{id:"PaginationContainer"},i,t,o)}};h.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}#PaginationContainer{width:100%;margin-top:20px;display:inline-flex;justify-content:space-between;align-items:center}.LeftItems button:not(:first-child),.RightItems button:not(:last-child){margin:0 10px}.LeftItems button,.RightItems button{padding:0;background-color:#009993;border-color:#009993}.PaginationArea{display:inline-flex;gap:10px;list-style:none}.PaginationArea li{margin:0;padding:0}.PaginationArea li button{width:24px;height:24px;display:flex;border:0;padding:0;justify-content:center;align-items:center;background-color:transparent;color:#000;cursor:pointer;pointer-events:all}.PaginationItem.ActiveItem button{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem button:disabled{pointer-events:none;cursor:not-allowed}.PaginationItem button:hover,.PaginationItem button:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}button{width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:all 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}button:hover,button:active{background:#004D4A;border-color:#004D4A}button:disabled{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){button{width:90px;font-size:12px}}@media screen and (max-width: 480px){button{width:70px;font-size:10px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:10px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem button:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem button:hover{background:#009993;border-color:#009993;color:#fff}}';export{h as helper_pagination}
@@ -1,2 +0,0 @@
1
- import { Config } from '../../../../../../../../../../stencil-public-runtime';
2
- export declare const config: Config;