@everymatrix/bonus-pagination-nav 1.99.75 → 1.99.77
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,h as a}from"./index-9c2a4b03.js";const i=["pt-br","en","es-mx","hu","hr"],s={en:{firstPage:"
|
|
1
|
+
import{r as t,c as e,h as a}from"./index-9c2a4b03.js";const i=["pt-br","en","es-mx","hu","hr"],s={en:{firstPage:"<<",lastPage:">>",prePage:"<",nextPage:">",pageOfTotal:"{start}-{end} of {total}"},hu:{firstPage:"First",lastPage:"Last",prePage:"<",nextPage:">",pageOfTotal:"{start}-{end} of {total}"},hr:{firstPage:"First",lastPage:"Last",prePage:"<",nextPage:">",pageOfTotal:"{start}-{end} of {total}"},"pt-br":{firstPage:"First",lastPage:"Last",prePage:"<",nextPage:">",pageOfTotal:"{start}-{end} of {total}"},"es-mx":{firstPage:"First",lastPage:"Last",prePage:"<",nextPage:">",pageOfTotal:"{start}-{end} of {total}"}},r=(t,e,a)=>{const r=e;let h=s[void 0!==r&&i.includes(r)?r:"en"][t];if(void 0!==a)for(const[t,e]of Object.entries(a.values)){const a=new RegExp(`{${t}}`,"g");h=h.replace(a,e)}return h},h=class{constructor(a){t(this,a),this.reloadPageEmitter=e(this,"reloadPageByType",7),this.total=1,this.limit=10,this.offset=0,this.tableId="default",this.language="en",this.translationUrl="",this.arrowsActive=!0,this.secondaryArrowsActive=!0,this.displayPageNumbers=!0,this.displayRangeOfTotal=void 0,this.navItemAccount=7,this.endPageIndex=0,this.pagesArray=void 0,this.currentPage=1,this.showAsEllipsisMid=!this.arrowsActive}pageLimitChangedHandler(t){this.limit=t.detail.limit?t.detail.limit:this.limit,this.currentPage=1,this.offset=0,this.updatePageStatus(),"pageLimitChanged"==t.type&&this.reloadPageEmitter.emit({offset:0,limit:this.limit,tableId:this.tableId})}goTo(t){"..."==t||0==t||parseInt(t.toString(),10)>this.endPageIndex+1||(this.currentPage=t,this.reloadPageEmitter.emit({offset:(this.currentPage-1)*this.limit,limit:this.limit,tableId:this.tableId}))}renderPageList(){return a("ul",{class:"PaginationArea"},this.pagesArray.map((t=>a("li",{class:"PageItem "+(this.currentPage==t?"Active":""),onClick:()=>{this.goTo(t)}},t))))}renderStylingWrapper(){return a("general-styling-wrapper",{targetTranslations:s,translationUrl:this.translationUrl})}generateNavItemsByType(t,e){if(this.endPageIndex<t)return Array.from({length:this.endPageIndex+1},((t,e)=>e+1));let a=[],i=Math.floor(t/2);const s=this.endPageIndex+1;if(e)if(this.currentPage<i||this.currentPage>s-i+1){a=Array.from({length:i},((t,e)=>e+1)),a.push("...");for(let e=s-(t-a.length-1);e<=s;e++)a.push(e)}else if(this.currentPage==i){a=Array.from({length:i+1},((t,e)=>e+1)),a.push("...");for(let e=s-(t-a.length-1);e<=s;e++)a.push(e)}else if(this.currentPage==s-i+1){a=Array.from({length:i-1},((t,e)=>e+1)),a.push("...");for(let e=s-(t-a.length-1);e<=s;e++)a.push(e)}else a=[1,"..."],a=a.concat([this.currentPage-1],[this.currentPage],[this.currentPage+1]),a=a.concat(["...",s]);else this.currentPage<=t-i?(a=Array.from({length:t-1},((t,e)=>e+1)),a.push("...")):this.currentPage>s-(t-i)?(a=Array.from({length:t-1},((e,a)=>s-(t-2)+a)),a.unshift("...")):(a=Array.from({length:t-2},((t,e)=>this.currentPage+e-i+1)),a.push("..."),a.unshift("..."));return a}updatePageStatus(){this.endPageIndex=Math.ceil(this.total/this.limit)-1,this.endPageIndex=this.endPageIndex<0?this.endPageIndex=0:this.endPageIndex,this.pagesArray=this.generateNavItemsByType(this.navItemAccount,this.showAsEllipsisMid)}componentWillRender(){this.currentPage=Math.floor(this.offset/this.limit)+1,this.updatePageStatus()}render(){return a("div",{key:"a6d3cd6cd1e5ff8d927486806d26c6eb61e57833",class:"PageNavigationWrapper"},this.displayRangeOfTotal&&this.total>0&&a("span",{key:"56f81e329deb0d5160d4d4e020571d1cc402dcc1",class:"PageOfMessage"},r("pageOfTotal",this.language,{values:{start:(this.currentPage-1)*this.limit+1,end:this.currentPage*this.limit>this.total?this.total:this.currentPage*this.limit,total:this.total}})),a("div",{key:"eaf964e00190b690564d57af6da91aed717e1690",class:"PageNavigation"},this.arrowsActive&&a("div",{key:"2be57e1c4d3d6fb80db83c6b5c60710573da5f5e",class:"PageArrow FirstPage "+(1==this.currentPage?"Disabled":""),onClick:()=>{this.goTo(1)}},r("firstPage",this.language)),this.secondaryArrowsActive&&a("span",{key:"d240849c9ba6b9c14d4ebed6c346d7cc629a1a59",class:"PageArrow PrePage "+(1==this.currentPage?"Disabled":""),onClick:()=>{this.goTo(this.currentPage-1)}},r("prePage",this.language)),this.displayPageNumbers&&this.renderPageList(),this.secondaryArrowsActive&&a("span",{key:"90cb6da1e51256e86f8678e0520d4b221b99957d",class:"PageArrow NextPage "+(this.currentPage==this.endPageIndex+1?"Disabled":""),onClick:()=>{this.goTo(this.currentPage+1)}},r("nextPage",this.language)),this.arrowsActive&&a("div",{key:"c74711a45bbbf822ca56e6f2fe70ee541ae91cfa",class:"PageArrow LastPage "+(this.currentPage==this.endPageIndex+1?"Disabled":""),onClick:()=>{this.goTo(this.endPageIndex+1)}}," ",r("lastPage",this.language)," "),this.renderStylingWrapper()))}};h.style=":host{display:block}.PageNavigationWrapper{display:flex;flex-direction:row;height:100%;align-content:center}.PageNavigationWrapper .PageOfMessage{margin:5px;padding:5px 6px;margin:2px}.PageNavigation{display:flex;flex-direction:row;align-items:center}.PageNavigation .PageArrow{color:var(--emw--color-primary, #777676);padding:6px 5px;cursor:pointer;font-weight:bold;width:1.2rem;text-align:center}.PageNavigation .PageArrow.Disabled{color:var(--emw--color-gray-100, #e0e0e0)}ul.PaginationArea{list-style:none;padding:0px;margin:0px;display:flex}ul.PaginationArea li.PageItem{cursor:pointer;padding:5px 6px;margin:2px;width:0.9rem;text-align:center}ul.PaginationArea li.PageItem.Active,ul.PaginationArea li.PageItem:hover{font-weight:bold;color:var(--emw--color-primary, #f5f1f1);background-color:var(--emw--color-secondary, #8c8989);border-radius:0.3rem}";export{h as bonus_pagination_nav}
|
|
@@ -8,8 +8,8 @@ const DEFAULT_LANGUAGE = 'en';
|
|
|
8
8
|
const SUPPORTED_LANGUAGES = ['pt-br', 'en', 'es-mx', 'hu', 'hr'];
|
|
9
9
|
const TRANSLATIONS = {
|
|
10
10
|
"en": {
|
|
11
|
-
"firstPage": '
|
|
12
|
-
"lastPage": '
|
|
11
|
+
"firstPage": '<<',
|
|
12
|
+
"lastPage": '>>',
|
|
13
13
|
"prePage": '<',
|
|
14
14
|
"nextPage": '>',
|
|
15
15
|
"pageOfTotal": '{start}-{end} of {total}',
|
|
@@ -2,8 +2,8 @@ const DEFAULT_LANGUAGE = 'en';
|
|
|
2
2
|
const SUPPORTED_LANGUAGES = ['pt-br', 'en', 'es-mx', 'hu', 'hr'];
|
|
3
3
|
export const TRANSLATIONS = {
|
|
4
4
|
"en": {
|
|
5
|
-
"firstPage": '
|
|
6
|
-
"lastPage": '
|
|
5
|
+
"firstPage": '<<',
|
|
6
|
+
"lastPage": '>>',
|
|
7
7
|
"prePage": '<',
|
|
8
8
|
"nextPage": '>',
|
|
9
9
|
"pageOfTotal": '{start}-{end} of {total}',
|
|
@@ -4,8 +4,8 @@ const DEFAULT_LANGUAGE = 'en';
|
|
|
4
4
|
const SUPPORTED_LANGUAGES = ['pt-br', 'en', 'es-mx', 'hu', 'hr'];
|
|
5
5
|
const TRANSLATIONS = {
|
|
6
6
|
"en": {
|
|
7
|
-
"firstPage": '
|
|
8
|
-
"lastPage": '
|
|
7
|
+
"firstPage": '<<',
|
|
8
|
+
"lastPage": '>>',
|
|
9
9
|
"prePage": '<',
|
|
10
10
|
"nextPage": '>',
|
|
11
11
|
"pageOfTotal": '{start}-{end} of {total}',
|