@everymatrix/bonus-pagination-nav 1.47.3 → 1.48.0

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{p as a,b as e}from"./p-57809f35.js";export{s as setNonce}from"./p-57809f35.js";import{g as t}from"./p-e1255160.js";(()=>{const e=import.meta.url,t={};return""!==e&&(t.resourcesUrl=new URL(".",e).href),a(t)})().then((async a=>(await t(),e([["p-f71ef42b",[[0,"bonus-pagination-nav",{total:[1538],limit:[1538],offset:[1538],tableId:[1537,"table-id"],language:[1537],translationUrl:[513,"translation-url"],arrowsActive:[1540,"arrows-active"],secondaryArrowsActive:[1540,"secondary-arrows-active"],displayPageNumbers:[1540,"display-page-numbers"],displayRangeOfTotal:[1540,"display-range-of-total"],endPageIndex:[32],pagesArray:[32],currentPage:[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]],a))));
1
+ import{p as a,b as e}from"./p-57809f35.js";export{s as setNonce}from"./p-57809f35.js";import{g as t}from"./p-e1255160.js";(()=>{const e=import.meta.url,t={};return""!==e&&(t.resourcesUrl=new URL(".",e).href),a(t)})().then((async a=>(await t(),e([["p-d98a7643",[[0,"bonus-pagination-nav",{total:[1538],limit:[1538],offset:[1538],tableId:[1537,"table-id"],language:[1537],translationUrl:[513,"translation-url"],arrowsActive:[1540,"arrows-active"],secondaryArrowsActive:[1540,"secondary-arrows-active"],displayPageNumbers:[1540,"display-page-numbers"],displayRangeOfTotal:[1540,"display-range-of-total"],navItemAccount:[1538,"nav-item-account"],endPageIndex:[32],pagesArray:[32],currentPage:[32],showAsEllipsisMid:[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]],a))));
@@ -0,0 +1 @@
1
+ import{r as t,c as e,h as a}from"./p-57809f35.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=5,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;return e?this.currentPage<i||this.currentPage>s-i+1?(a=Array.from({length:i},((t,e)=>e+1)),a.push("..."),a=a.concat(Array.from({length:i},((t,e)=>this.endPageIndex-1+e)))):this.currentPage==i?(a=Array.from({length:i+1},((t,e)=>e+1)),a.push("..."),a=a.concat(Array.from({length:i-1},((t,e)=>this.endPageIndex+e)))):this.currentPage==s-i+1?(a=Array.from({length:i-1},((t,e)=>e+1)),a.push("..."),a=a.concat(Array.from({length:i+1},((t,e)=>this.endPageIndex-2+e)))):(a=[1,"..."],a=a.concat([this.currentPage-1],[this.currentPage],[this.currentPage+1]),a=a.concat(["...",s])):this.currentPage<i-1?(a=Array.from({length:t-1},((t,e)=>e+1)),a.push("...")):this.endPageIndex-this.currentPage<i+1?(a=Array.from({length:t-1},((t,e)=>this.endPageIndex-i+e)),a.unshift("...")):(a=Array.from({length:i+1},((t,e)=>this.currentPage+e-1)),a.push("..."),a.unshift("...")),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:"aa8d14788833b1b0e13ea20943935b03a3b043ac",class:"PageNavigationWrapper"},this.displayRangeOfTotal&&this.total>0&&a("span",{key:"a018261b6c598116829d878b8120aee7ae2576c4",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:"64fc17d0b992b30a4b8d712e47442ee6a2d44b82",class:"PageNavigation"},this.arrowsActive&&a("div",{key:"f5f3b562fbdfb9e4b39ffd9755e5dba41e6231ba",class:"PageArrow FirstPage "+(1==this.currentPage?"Disabled":""),onClick:()=>{this.goTo(1)}},r("firstPage",this.language)),this.secondaryArrowsActive&&a("span",{key:"39222e258f6c63502bfd3914c673d804edc96b53",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:"d6f9a1394debdae49702713ccc59bea710ccd7ae",class:"PageArrow NextPage "+(this.currentPage==this.endPageIndex+1?"Disabled":""),onClick:()=>{this.goTo(this.currentPage+1)}},r("nextPage",this.language)),this.arrowsActive&&a("div",{key:"d2bb76f9d40fcfc3dbc6bb5fbfe6d237e77f0ee6",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(--emfe-w-color-primary, #777676);padding:6px 5px;cursor:pointer;font-weight:bold;width:1.2rem;text-align:center}.PageNavigation .PageArrow.Disabled{color:var(--emfe-w-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(--emfe-w-color-primary, #f5f1f1);background-color:var(--emfe-w-color-secondary, #8c8989);border-radius:0.3rem}";export{h as bonus_pagination_nav}
@@ -55,7 +55,7 @@ const translate = (key, customLang, values) => {
55
55
  return translation;
56
56
  };
57
57
 
58
- const bonusPaginationNavCss = ":host{display:block}.PageNavigationWrapper{display:flex;flex-direction:row}.PageNavigationWrapper .PageOfMessage{margin:5px;padding:5px 6px;margin:2px}.PageNavigation{display:flex;flex-direction:row;align-items:center}.PageNavigation .PageArrow{color:var(--emfe-w-color-primary, #777676);padding:6px 5px;cursor:pointer;font-weight:bold;width:1.2rem;text-align:center}.PageNavigation .PageArrow.Disabled{color:var(--emfe-w-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(--emfe-w-color-primary, #f5f1f1);background-color:var(--emfe-w-color-secondary, #8c8989);border-radius:0.3rem}";
58
+ const bonusPaginationNavCss = ":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(--emfe-w-color-primary, #777676);padding:6px 5px;cursor:pointer;font-weight:bold;width:1.2rem;text-align:center}.PageNavigation .PageArrow.Disabled{color:var(--emfe-w-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(--emfe-w-color-primary, #f5f1f1);background-color:var(--emfe-w-color-secondary, #8c8989);border-radius:0.3rem}";
59
59
  const BonusPaginationNavStyle0 = bonusPaginationNavCss;
60
60
 
61
61
  const BonusPaginationNav = class {
@@ -72,9 +72,11 @@ const BonusPaginationNav = class {
72
72
  this.secondaryArrowsActive = true;
73
73
  this.displayPageNumbers = true;
74
74
  this.displayRangeOfTotal = undefined;
75
+ this.navItemAccount = 5;
75
76
  this.endPageIndex = 0;
76
77
  this.pagesArray = undefined;
77
78
  this.currentPage = 1;
79
+ this.showAsEllipsisMid = !this.arrowsActive;
78
80
  }
79
81
  pageLimitChangedHandler(event) {
80
82
  this.limit = event.detail.limit ? event.detail.limit : this.limit;
@@ -104,31 +106,74 @@ const BonusPaginationNav = class {
104
106
  renderStylingWrapper() {
105
107
  return index.h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl });
106
108
  }
107
- updatePageStatus() {
108
- this.endPageIndex = (Math.ceil(this.total / this.limit) - 1);
109
- this.endPageIndex = this.endPageIndex < 0 ? this.endPageIndex = 0 : this.endPageIndex;
110
- this.pagesArray = [];
111
- if (this.endPageIndex < 5) {
112
- this.pagesArray = Array.from({ length: this.endPageIndex + 1 }, (_, i) => i + 1);
109
+ /**
110
+ *
111
+ * @param maxNavItemsCount
112
+ * @param ellipsisMid
113
+ * @private
114
+ */
115
+ generateNavItemsByType(maxNavItemsCount, ellipsisMid) {
116
+ if (this.endPageIndex < maxNavItemsCount) {
117
+ return Array.from({ length: this.endPageIndex + 1 }, (_, i) => i + 1);
118
+ }
119
+ let pageArray = [];
120
+ /**
121
+ * Construct numbered navigation area based on current page position
122
+ * if ellipsisMid => 1, 2, 3 ... 8,9,10 / 1 ... 5,6,7,...10
123
+ * else => 1, 2, ... / ... 2, 3,4... / ... 9, 10
124
+ */
125
+ let halfOfMaxPageCount = Math.floor(maxNavItemsCount / 2);
126
+ const firstPageNo = 1, lastPageNo = this.endPageIndex + 1;
127
+ if (ellipsisMid) {
128
+ //Assume navItemAccount = 7, and totalPage = 10, in this case, we got halfOfMaxPageCount = 3,
129
+ if (this.currentPage < halfOfMaxPageCount || this.currentPage > (lastPageNo - halfOfMaxPageCount + 1)) {
130
+ //current page: (1, 2, 9, 10)
131
+ //Nav show as ( 1, 2, 3, ..., 8, 9, 10)
132
+ pageArray = Array.from({ length: halfOfMaxPageCount }, (_, i) => i + 1);
133
+ pageArray.push('...');
134
+ pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount }, (_, i) => (this.endPageIndex - 1) + i));
135
+ }
136
+ else if (this.currentPage == halfOfMaxPageCount) {
137
+ //current page: 3 (=halfOfMaxPageCount)
138
+ //Nav show as ( 1, 2, 3, 4, ..., 9,10)
139
+ pageArray = Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => i + 1);
140
+ pageArray.push('...');
141
+ pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => (this.endPageIndex) + i));
142
+ }
143
+ else if (this.currentPage == (lastPageNo - halfOfMaxPageCount + 1)) {
144
+ //current page: 8, (the page index after this.total - halfOfMaxPageCount ) Nav show as ( 1, 2, ... ,7, 8,9,10)
145
+ pageArray = Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => i + 1);
146
+ pageArray.push('...');
147
+ pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => (this.endPageIndex - 2) + i));
148
+ }
149
+ else {
150
+ //current page: > 3 and < 7, let's say is 5 Nav show as ( 1, ..., 4, 5, 6, ... ,10)
151
+ pageArray = [firstPageNo, '...'];
152
+ pageArray = pageArray.concat([this.currentPage - 1], [this.currentPage], [this.currentPage + 1]);
153
+ pageArray = pageArray.concat(['...', lastPageNo]);
154
+ }
113
155
  }
114
156
  else {
115
- /**
116
- * Construct numbered navigation area based on current page position
117
- */
118
- if (this.currentPage == 1 || this.currentPage == 2) {
119
- this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
120
- this.pagesArray.push('...');
157
+ if (this.currentPage < (halfOfMaxPageCount - 1)) { // when current page is in first half of nav
158
+ pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => i + 1);
159
+ pageArray.push('...');
121
160
  }
122
- else if (this.currentPage >= 3 && ((this.endPageIndex - this.currentPage) >= 2)) {
123
- this.pagesArray = Array.from({ length: 3 }, (_, i) => this.currentPage + i - 1);
124
- this.pagesArray.push('...');
125
- this.pagesArray.unshift('...');
161
+ else if ((this.endPageIndex - this.currentPage) < (halfOfMaxPageCount + 1)) { // when current page is in last half of nav
162
+ pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => this.endPageIndex - halfOfMaxPageCount + i);
163
+ pageArray.unshift('...');
126
164
  }
127
- else if ((this.endPageIndex - this.currentPage) < 3) {
128
- this.pagesArray = Array.from({ length: 4 }, (_, i) => this.endPageIndex - 2 + i);
129
- this.pagesArray.unshift('...');
165
+ else {
166
+ pageArray = Array.from({ length: (halfOfMaxPageCount + 1) }, (_, i) => this.currentPage + i - 1);
167
+ pageArray.push('...');
168
+ pageArray.unshift('...');
130
169
  }
131
170
  }
171
+ return pageArray;
172
+ }
173
+ updatePageStatus() {
174
+ this.endPageIndex = (Math.ceil(this.total / this.limit) - 1);
175
+ this.endPageIndex = this.endPageIndex < 0 ? this.endPageIndex = 0 : this.endPageIndex;
176
+ this.pagesArray = this.generateNavItemsByType(this.navItemAccount, this.showAsEllipsisMid);
132
177
  }
133
178
  componentWillRender() {
134
179
  this.currentPage = Math.floor(this.offset / this.limit) + 1;
@@ -137,23 +182,23 @@ const BonusPaginationNav = class {
137
182
  render() {
138
183
  const startOffset = (this.currentPage - 1) * this.limit + 1;
139
184
  const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
140
- return index.h("div", { key: 'a6817c12f1e1e9960f8e91cfd5c5e2fa1ea72f7f', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && index.h("span", { key: '8f7a16c5835147e2a83808f882a66a2463e3998e', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
185
+ return index.h("div", { key: 'aa8d14788833b1b0e13ea20943935b03a3b043ac', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && index.h("span", { key: 'a018261b6c598116829d878b8120aee7ae2576c4', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
141
186
  values: {
142
187
  start: startOffset,
143
188
  end: endOffset,
144
189
  total: this.total
145
190
  }
146
- })), index.h("div", { key: 'ddc20a86777c2fde667ad8b75ab86f3bc72ccfdb', class: 'PageNavigation' }, this.arrowsActive &&
147
- index.h("div", { key: 'ce2a45b8c0d6e32cfa3f1c5cc8b3c9ac58acc409', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
191
+ })), index.h("div", { key: '64fc17d0b992b30a4b8d712e47442ee6a2d44b82', class: 'PageNavigation' }, this.arrowsActive &&
192
+ index.h("div", { key: 'f5f3b562fbdfb9e4b39ffd9755e5dba41e6231ba', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
148
193
  this.goTo(1);
149
194
  } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
150
- index.h("span", { key: '82dce028e4283dcac511b3b62823e87f2085f4b5', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
195
+ index.h("span", { key: '39222e258f6c63502bfd3914c673d804edc96b53', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
151
196
  this.goTo(this.currentPage - 1);
152
197
  } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
153
- index.h("span", { key: 'a6ed748ce3e2555ac3d9d4bae174ad5bad0fabec', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
198
+ index.h("span", { key: 'd6f9a1394debdae49702713ccc59bea710ccd7ae', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
154
199
  this.goTo(this.currentPage + 1);
155
200
  } }, translate('nextPage', this.language)), this.arrowsActive &&
156
- index.h("div", { key: '60a81a86f11e2bb07ee93b61d6f367a11b0e2b6c', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
201
+ index.h("div", { key: 'd2bb76f9d40fcfc3dbc6bb5fbfe6d237e77f0ee6', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
157
202
  this.goTo(this.endPageIndex + 1);
158
203
  } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
159
204
  }
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["bonus-pagination-nav.cjs",[[0,"bonus-pagination-nav",{"total":[1538],"limit":[1538],"offset":[1538],"tableId":[1537,"table-id"],"language":[1537],"translationUrl":[513,"translation-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"displayPageNumbers":[1540,"display-page-numbers"],"displayRangeOfTotal":[1540,"display-range-of-total"],"endPageIndex":[32],"pagesArray":[32],"currentPage":[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]], options);
22
+ return index.bootstrapLazy([["bonus-pagination-nav.cjs",[[0,"bonus-pagination-nav",{"total":[1538],"limit":[1538],"offset":[1538],"tableId":[1537,"table-id"],"language":[1537],"translationUrl":[513,"translation-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"displayPageNumbers":[1540,"display-page-numbers"],"displayRangeOfTotal":[1540,"display-range-of-total"],"navItemAccount":[1538,"nav-item-account"],"endPageIndex":[32],"pagesArray":[32],"currentPage":[32],"showAsEllipsisMid":[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["bonus-pagination-nav.cjs",[[0,"bonus-pagination-nav",{"total":[1538],"limit":[1538],"offset":[1538],"tableId":[1537,"table-id"],"language":[1537],"translationUrl":[513,"translation-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"displayPageNumbers":[1540,"display-page-numbers"],"displayRangeOfTotal":[1540,"display-range-of-total"],"endPageIndex":[32],"pagesArray":[32],"currentPage":[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]], options);
11
+ return index.bootstrapLazy([["bonus-pagination-nav.cjs",[[0,"bonus-pagination-nav",{"total":[1538],"limit":[1538],"offset":[1538],"tableId":[1537,"table-id"],"language":[1537],"translationUrl":[513,"translation-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"displayPageNumbers":[1540,"display-page-numbers"],"displayRangeOfTotal":[1540,"display-range-of-total"],"navItemAccount":[1538,"nav-item-account"],"endPageIndex":[32],"pagesArray":[32],"currentPage":[32],"showAsEllipsisMid":[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -5,6 +5,8 @@
5
5
  .PageNavigationWrapper {
6
6
  display: flex;
7
7
  flex-direction: row;
8
+ height: 100%;
9
+ align-content: center;
8
10
  }
9
11
  .PageNavigationWrapper .PageOfMessage {
10
12
  margin: 5px;
@@ -12,9 +12,11 @@ export class BonusPaginationNav {
12
12
  this.secondaryArrowsActive = true;
13
13
  this.displayPageNumbers = true;
14
14
  this.displayRangeOfTotal = undefined;
15
+ this.navItemAccount = 5;
15
16
  this.endPageIndex = 0;
16
17
  this.pagesArray = undefined;
17
18
  this.currentPage = 1;
19
+ this.showAsEllipsisMid = !this.arrowsActive;
18
20
  }
19
21
  pageLimitChangedHandler(event) {
20
22
  this.limit = event.detail.limit ? event.detail.limit : this.limit;
@@ -44,31 +46,74 @@ export class BonusPaginationNav {
44
46
  renderStylingWrapper() {
45
47
  return h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl });
46
48
  }
47
- updatePageStatus() {
48
- this.endPageIndex = (Math.ceil(this.total / this.limit) - 1);
49
- this.endPageIndex = this.endPageIndex < 0 ? this.endPageIndex = 0 : this.endPageIndex;
50
- this.pagesArray = [];
51
- if (this.endPageIndex < 5) {
52
- this.pagesArray = Array.from({ length: this.endPageIndex + 1 }, (_, i) => i + 1);
49
+ /**
50
+ *
51
+ * @param maxNavItemsCount
52
+ * @param ellipsisMid
53
+ * @private
54
+ */
55
+ generateNavItemsByType(maxNavItemsCount, ellipsisMid) {
56
+ if (this.endPageIndex < maxNavItemsCount) {
57
+ return Array.from({ length: this.endPageIndex + 1 }, (_, i) => i + 1);
58
+ }
59
+ let pageArray = [];
60
+ /**
61
+ * Construct numbered navigation area based on current page position
62
+ * if ellipsisMid => 1, 2, 3 ... 8,9,10 / 1 ... 5,6,7,...10
63
+ * else => 1, 2, ... / ... 2, 3,4... / ... 9, 10
64
+ */
65
+ let halfOfMaxPageCount = Math.floor(maxNavItemsCount / 2);
66
+ const firstPageNo = 1, lastPageNo = this.endPageIndex + 1;
67
+ if (ellipsisMid) {
68
+ //Assume navItemAccount = 7, and totalPage = 10, in this case, we got halfOfMaxPageCount = 3,
69
+ if (this.currentPage < halfOfMaxPageCount || this.currentPage > (lastPageNo - halfOfMaxPageCount + 1)) {
70
+ //current page: (1, 2, 9, 10)
71
+ //Nav show as ( 1, 2, 3, ..., 8, 9, 10)
72
+ pageArray = Array.from({ length: halfOfMaxPageCount }, (_, i) => i + 1);
73
+ pageArray.push('...');
74
+ pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount }, (_, i) => (this.endPageIndex - 1) + i));
75
+ }
76
+ else if (this.currentPage == halfOfMaxPageCount) {
77
+ //current page: 3 (=halfOfMaxPageCount)
78
+ //Nav show as ( 1, 2, 3, 4, ..., 9,10)
79
+ pageArray = Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => i + 1);
80
+ pageArray.push('...');
81
+ pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => (this.endPageIndex) + i));
82
+ }
83
+ else if (this.currentPage == (lastPageNo - halfOfMaxPageCount + 1)) {
84
+ //current page: 8, (the page index after this.total - halfOfMaxPageCount ) Nav show as ( 1, 2, ... ,7, 8,9,10)
85
+ pageArray = Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => i + 1);
86
+ pageArray.push('...');
87
+ pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => (this.endPageIndex - 2) + i));
88
+ }
89
+ else {
90
+ //current page: > 3 and < 7, let's say is 5 Nav show as ( 1, ..., 4, 5, 6, ... ,10)
91
+ pageArray = [firstPageNo, '...'];
92
+ pageArray = pageArray.concat([this.currentPage - 1], [this.currentPage], [this.currentPage + 1]);
93
+ pageArray = pageArray.concat(['...', lastPageNo]);
94
+ }
53
95
  }
54
96
  else {
55
- /**
56
- * Construct numbered navigation area based on current page position
57
- */
58
- if (this.currentPage == 1 || this.currentPage == 2) {
59
- this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
60
- this.pagesArray.push('...');
97
+ if (this.currentPage < (halfOfMaxPageCount - 1)) { // when current page is in first half of nav
98
+ pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => i + 1);
99
+ pageArray.push('...');
61
100
  }
62
- else if (this.currentPage >= 3 && ((this.endPageIndex - this.currentPage) >= 2)) {
63
- this.pagesArray = Array.from({ length: 3 }, (_, i) => this.currentPage + i - 1);
64
- this.pagesArray.push('...');
65
- this.pagesArray.unshift('...');
101
+ else if ((this.endPageIndex - this.currentPage) < (halfOfMaxPageCount + 1)) { // when current page is in last half of nav
102
+ pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => this.endPageIndex - halfOfMaxPageCount + i);
103
+ pageArray.unshift('...');
66
104
  }
67
- else if ((this.endPageIndex - this.currentPage) < 3) {
68
- this.pagesArray = Array.from({ length: 4 }, (_, i) => this.endPageIndex - 2 + i);
69
- this.pagesArray.unshift('...');
105
+ else {
106
+ pageArray = Array.from({ length: (halfOfMaxPageCount + 1) }, (_, i) => this.currentPage + i - 1);
107
+ pageArray.push('...');
108
+ pageArray.unshift('...');
70
109
  }
71
110
  }
111
+ return pageArray;
112
+ }
113
+ updatePageStatus() {
114
+ this.endPageIndex = (Math.ceil(this.total / this.limit) - 1);
115
+ this.endPageIndex = this.endPageIndex < 0 ? this.endPageIndex = 0 : this.endPageIndex;
116
+ this.pagesArray = this.generateNavItemsByType(this.navItemAccount, this.showAsEllipsisMid);
72
117
  }
73
118
  componentWillRender() {
74
119
  this.currentPage = Math.floor(this.offset / this.limit) + 1;
@@ -77,23 +122,23 @@ export class BonusPaginationNav {
77
122
  render() {
78
123
  const startOffset = (this.currentPage - 1) * this.limit + 1;
79
124
  const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
80
- return h("div", { key: 'a6817c12f1e1e9960f8e91cfd5c5e2fa1ea72f7f', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: '8f7a16c5835147e2a83808f882a66a2463e3998e', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
125
+ return h("div", { key: 'aa8d14788833b1b0e13ea20943935b03a3b043ac', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: 'a018261b6c598116829d878b8120aee7ae2576c4', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
81
126
  values: {
82
127
  start: startOffset,
83
128
  end: endOffset,
84
129
  total: this.total
85
130
  }
86
- })), h("div", { key: 'ddc20a86777c2fde667ad8b75ab86f3bc72ccfdb', class: 'PageNavigation' }, this.arrowsActive &&
87
- h("div", { key: 'ce2a45b8c0d6e32cfa3f1c5cc8b3c9ac58acc409', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
131
+ })), h("div", { key: '64fc17d0b992b30a4b8d712e47442ee6a2d44b82', class: 'PageNavigation' }, this.arrowsActive &&
132
+ h("div", { key: 'f5f3b562fbdfb9e4b39ffd9755e5dba41e6231ba', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
88
133
  this.goTo(1);
89
134
  } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
90
- h("span", { key: '82dce028e4283dcac511b3b62823e87f2085f4b5', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
135
+ h("span", { key: '39222e258f6c63502bfd3914c673d804edc96b53', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
91
136
  this.goTo(this.currentPage - 1);
92
137
  } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
93
- h("span", { key: 'a6ed748ce3e2555ac3d9d4bae174ad5bad0fabec', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
138
+ h("span", { key: 'd6f9a1394debdae49702713ccc59bea710ccd7ae', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
94
139
  this.goTo(this.currentPage + 1);
95
140
  } }, translate('nextPage', this.language)), this.arrowsActive &&
96
- h("div", { key: '60a81a86f11e2bb07ee93b61d6f367a11b0e2b6c', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
141
+ h("div", { key: 'd2bb76f9d40fcfc3dbc6bb5fbfe6d237e77f0ee6', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
97
142
  this.goTo(this.endPageIndex + 1);
98
143
  } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
99
144
  }
@@ -288,6 +333,24 @@ export class BonusPaginationNav {
288
333
  },
289
334
  "attribute": "display-range-of-total",
290
335
  "reflect": true
336
+ },
337
+ "navItemAccount": {
338
+ "type": "number",
339
+ "mutable": true,
340
+ "complexType": {
341
+ "original": "number",
342
+ "resolved": "number",
343
+ "references": {}
344
+ },
345
+ "required": false,
346
+ "optional": false,
347
+ "docs": {
348
+ "tags": [],
349
+ "text": "The Nav Items count for the pagination, default: 5\nthe value should be Odd, 5, 7"
350
+ },
351
+ "attribute": "nav-item-account",
352
+ "reflect": true,
353
+ "defaultValue": "5"
291
354
  }
292
355
  };
293
356
  }
@@ -295,7 +358,8 @@ export class BonusPaginationNav {
295
358
  return {
296
359
  "endPageIndex": {},
297
360
  "pagesArray": {},
298
- "currentPage": {}
361
+ "currentPage": {},
362
+ "showAsEllipsisMid": {}
299
363
  };
300
364
  }
301
365
  static get events() {
@@ -51,7 +51,7 @@ const translate = (key, customLang, values) => {
51
51
  return translation;
52
52
  };
53
53
 
54
- const bonusPaginationNavCss = ":host{display:block}.PageNavigationWrapper{display:flex;flex-direction:row}.PageNavigationWrapper .PageOfMessage{margin:5px;padding:5px 6px;margin:2px}.PageNavigation{display:flex;flex-direction:row;align-items:center}.PageNavigation .PageArrow{color:var(--emfe-w-color-primary, #777676);padding:6px 5px;cursor:pointer;font-weight:bold;width:1.2rem;text-align:center}.PageNavigation .PageArrow.Disabled{color:var(--emfe-w-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(--emfe-w-color-primary, #f5f1f1);background-color:var(--emfe-w-color-secondary, #8c8989);border-radius:0.3rem}";
54
+ const bonusPaginationNavCss = ":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(--emfe-w-color-primary, #777676);padding:6px 5px;cursor:pointer;font-weight:bold;width:1.2rem;text-align:center}.PageNavigation .PageArrow.Disabled{color:var(--emfe-w-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(--emfe-w-color-primary, #f5f1f1);background-color:var(--emfe-w-color-secondary, #8c8989);border-radius:0.3rem}";
55
55
  const BonusPaginationNavStyle0 = bonusPaginationNavCss;
56
56
 
57
57
  const BonusPaginationNav = class {
@@ -68,9 +68,11 @@ const BonusPaginationNav = class {
68
68
  this.secondaryArrowsActive = true;
69
69
  this.displayPageNumbers = true;
70
70
  this.displayRangeOfTotal = undefined;
71
+ this.navItemAccount = 5;
71
72
  this.endPageIndex = 0;
72
73
  this.pagesArray = undefined;
73
74
  this.currentPage = 1;
75
+ this.showAsEllipsisMid = !this.arrowsActive;
74
76
  }
75
77
  pageLimitChangedHandler(event) {
76
78
  this.limit = event.detail.limit ? event.detail.limit : this.limit;
@@ -100,31 +102,74 @@ const BonusPaginationNav = class {
100
102
  renderStylingWrapper() {
101
103
  return h("general-styling-wrapper", { targetTranslations: TRANSLATIONS, translationUrl: this.translationUrl });
102
104
  }
103
- updatePageStatus() {
104
- this.endPageIndex = (Math.ceil(this.total / this.limit) - 1);
105
- this.endPageIndex = this.endPageIndex < 0 ? this.endPageIndex = 0 : this.endPageIndex;
106
- this.pagesArray = [];
107
- if (this.endPageIndex < 5) {
108
- this.pagesArray = Array.from({ length: this.endPageIndex + 1 }, (_, i) => i + 1);
105
+ /**
106
+ *
107
+ * @param maxNavItemsCount
108
+ * @param ellipsisMid
109
+ * @private
110
+ */
111
+ generateNavItemsByType(maxNavItemsCount, ellipsisMid) {
112
+ if (this.endPageIndex < maxNavItemsCount) {
113
+ return Array.from({ length: this.endPageIndex + 1 }, (_, i) => i + 1);
114
+ }
115
+ let pageArray = [];
116
+ /**
117
+ * Construct numbered navigation area based on current page position
118
+ * if ellipsisMid => 1, 2, 3 ... 8,9,10 / 1 ... 5,6,7,...10
119
+ * else => 1, 2, ... / ... 2, 3,4... / ... 9, 10
120
+ */
121
+ let halfOfMaxPageCount = Math.floor(maxNavItemsCount / 2);
122
+ const firstPageNo = 1, lastPageNo = this.endPageIndex + 1;
123
+ if (ellipsisMid) {
124
+ //Assume navItemAccount = 7, and totalPage = 10, in this case, we got halfOfMaxPageCount = 3,
125
+ if (this.currentPage < halfOfMaxPageCount || this.currentPage > (lastPageNo - halfOfMaxPageCount + 1)) {
126
+ //current page: (1, 2, 9, 10)
127
+ //Nav show as ( 1, 2, 3, ..., 8, 9, 10)
128
+ pageArray = Array.from({ length: halfOfMaxPageCount }, (_, i) => i + 1);
129
+ pageArray.push('...');
130
+ pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount }, (_, i) => (this.endPageIndex - 1) + i));
131
+ }
132
+ else if (this.currentPage == halfOfMaxPageCount) {
133
+ //current page: 3 (=halfOfMaxPageCount)
134
+ //Nav show as ( 1, 2, 3, 4, ..., 9,10)
135
+ pageArray = Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => i + 1);
136
+ pageArray.push('...');
137
+ pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => (this.endPageIndex) + i));
138
+ }
139
+ else if (this.currentPage == (lastPageNo - halfOfMaxPageCount + 1)) {
140
+ //current page: 8, (the page index after this.total - halfOfMaxPageCount ) Nav show as ( 1, 2, ... ,7, 8,9,10)
141
+ pageArray = Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => i + 1);
142
+ pageArray.push('...');
143
+ pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => (this.endPageIndex - 2) + i));
144
+ }
145
+ else {
146
+ //current page: > 3 and < 7, let's say is 5 Nav show as ( 1, ..., 4, 5, 6, ... ,10)
147
+ pageArray = [firstPageNo, '...'];
148
+ pageArray = pageArray.concat([this.currentPage - 1], [this.currentPage], [this.currentPage + 1]);
149
+ pageArray = pageArray.concat(['...', lastPageNo]);
150
+ }
109
151
  }
110
152
  else {
111
- /**
112
- * Construct numbered navigation area based on current page position
113
- */
114
- if (this.currentPage == 1 || this.currentPage == 2) {
115
- this.pagesArray = Array.from({ length: 4 }, (_, i) => i + 1);
116
- this.pagesArray.push('...');
153
+ if (this.currentPage < (halfOfMaxPageCount - 1)) { // when current page is in first half of nav
154
+ pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => i + 1);
155
+ pageArray.push('...');
117
156
  }
118
- else if (this.currentPage >= 3 && ((this.endPageIndex - this.currentPage) >= 2)) {
119
- this.pagesArray = Array.from({ length: 3 }, (_, i) => this.currentPage + i - 1);
120
- this.pagesArray.push('...');
121
- this.pagesArray.unshift('...');
157
+ else if ((this.endPageIndex - this.currentPage) < (halfOfMaxPageCount + 1)) { // when current page is in last half of nav
158
+ pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => this.endPageIndex - halfOfMaxPageCount + i);
159
+ pageArray.unshift('...');
122
160
  }
123
- else if ((this.endPageIndex - this.currentPage) < 3) {
124
- this.pagesArray = Array.from({ length: 4 }, (_, i) => this.endPageIndex - 2 + i);
125
- this.pagesArray.unshift('...');
161
+ else {
162
+ pageArray = Array.from({ length: (halfOfMaxPageCount + 1) }, (_, i) => this.currentPage + i - 1);
163
+ pageArray.push('...');
164
+ pageArray.unshift('...');
126
165
  }
127
166
  }
167
+ return pageArray;
168
+ }
169
+ updatePageStatus() {
170
+ this.endPageIndex = (Math.ceil(this.total / this.limit) - 1);
171
+ this.endPageIndex = this.endPageIndex < 0 ? this.endPageIndex = 0 : this.endPageIndex;
172
+ this.pagesArray = this.generateNavItemsByType(this.navItemAccount, this.showAsEllipsisMid);
128
173
  }
129
174
  componentWillRender() {
130
175
  this.currentPage = Math.floor(this.offset / this.limit) + 1;
@@ -133,23 +178,23 @@ const BonusPaginationNav = class {
133
178
  render() {
134
179
  const startOffset = (this.currentPage - 1) * this.limit + 1;
135
180
  const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
136
- return h("div", { key: 'a6817c12f1e1e9960f8e91cfd5c5e2fa1ea72f7f', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: '8f7a16c5835147e2a83808f882a66a2463e3998e', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
181
+ return h("div", { key: 'aa8d14788833b1b0e13ea20943935b03a3b043ac', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: 'a018261b6c598116829d878b8120aee7ae2576c4', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
137
182
  values: {
138
183
  start: startOffset,
139
184
  end: endOffset,
140
185
  total: this.total
141
186
  }
142
- })), h("div", { key: 'ddc20a86777c2fde667ad8b75ab86f3bc72ccfdb', class: 'PageNavigation' }, this.arrowsActive &&
143
- h("div", { key: 'ce2a45b8c0d6e32cfa3f1c5cc8b3c9ac58acc409', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
187
+ })), h("div", { key: '64fc17d0b992b30a4b8d712e47442ee6a2d44b82', class: 'PageNavigation' }, this.arrowsActive &&
188
+ h("div", { key: 'f5f3b562fbdfb9e4b39ffd9755e5dba41e6231ba', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
144
189
  this.goTo(1);
145
190
  } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
146
- h("span", { key: '82dce028e4283dcac511b3b62823e87f2085f4b5', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
191
+ h("span", { key: '39222e258f6c63502bfd3914c673d804edc96b53', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
147
192
  this.goTo(this.currentPage - 1);
148
193
  } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
149
- h("span", { key: 'a6ed748ce3e2555ac3d9d4bae174ad5bad0fabec', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
194
+ h("span", { key: 'd6f9a1394debdae49702713ccc59bea710ccd7ae', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
150
195
  this.goTo(this.currentPage + 1);
151
196
  } }, translate('nextPage', this.language)), this.arrowsActive &&
152
- h("div", { key: '60a81a86f11e2bb07ee93b61d6f367a11b0e2b6c', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
197
+ h("div", { key: 'd2bb76f9d40fcfc3dbc6bb5fbfe6d237e77f0ee6', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
153
198
  this.goTo(this.endPageIndex + 1);
154
199
  } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
155
200
  }
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["bonus-pagination-nav",[[0,"bonus-pagination-nav",{"total":[1538],"limit":[1538],"offset":[1538],"tableId":[1537,"table-id"],"language":[1537],"translationUrl":[513,"translation-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"displayPageNumbers":[1540,"display-page-numbers"],"displayRangeOfTotal":[1540,"display-range-of-total"],"endPageIndex":[32],"pagesArray":[32],"currentPage":[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]], options);
19
+ return bootstrapLazy([["bonus-pagination-nav",[[0,"bonus-pagination-nav",{"total":[1538],"limit":[1538],"offset":[1538],"tableId":[1537,"table-id"],"language":[1537],"translationUrl":[513,"translation-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"displayPageNumbers":[1540,"display-page-numbers"],"displayRangeOfTotal":[1540,"display-range-of-total"],"navItemAccount":[1538,"nav-item-account"],"endPageIndex":[32],"pagesArray":[32],"currentPage":[32],"showAsEllipsisMid":[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]], options);
20
20
  });
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["bonus-pagination-nav",[[0,"bonus-pagination-nav",{"total":[1538],"limit":[1538],"offset":[1538],"tableId":[1537,"table-id"],"language":[1537],"translationUrl":[513,"translation-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"displayPageNumbers":[1540,"display-page-numbers"],"displayRangeOfTotal":[1540,"display-range-of-total"],"endPageIndex":[32],"pagesArray":[32],"currentPage":[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]], options);
8
+ return bootstrapLazy([["bonus-pagination-nav",[[0,"bonus-pagination-nav",{"total":[1538],"limit":[1538],"offset":[1538],"tableId":[1537,"table-id"],"language":[1537],"translationUrl":[513,"translation-url"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"displayPageNumbers":[1540,"display-page-numbers"],"displayRangeOfTotal":[1540,"display-range-of-total"],"navItemAccount":[1538,"nav-item-account"],"endPageIndex":[32],"pagesArray":[32],"currentPage":[32],"showAsEllipsisMid":[32]},[[8,"paginationReset","pageLimitChangedHandler"],[8,"pageLimitChanged","pageLimitChangedHandler"]]]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -41,14 +41,27 @@ export declare class BonusPaginationNav {
41
41
  * If show the page of message, eg: `1-20 of 100`
42
42
  */
43
43
  displayRangeOfTotal: boolean;
44
+ /**
45
+ * The Nav Items count for the pagination, default: 5
46
+ * the value should be Odd, 5, 7
47
+ */
48
+ navItemAccount: number;
44
49
  endPageIndex: number;
45
50
  pagesArray: Array<string | number>;
46
51
  reloadPageEmitter: EventEmitter;
47
52
  currentPage: number;
53
+ showAsEllipsisMid: boolean;
48
54
  pageLimitChangedHandler(event: CustomEvent): void;
49
55
  goTo(step: number | string): void;
50
56
  renderPageList(): any;
51
57
  renderStylingWrapper(): any;
58
+ /**
59
+ *
60
+ * @param maxNavItemsCount
61
+ * @param ellipsisMid
62
+ * @private
63
+ */
64
+ private generateNavItemsByType;
52
65
  private updatePageStatus;
53
66
  componentWillRender(): void;
54
67
  render(): any;
@@ -27,6 +27,10 @@ export namespace Components {
27
27
  * The received limit for the number of pages
28
28
  */
29
29
  "limit": number;
30
+ /**
31
+ * The Nav Items count for the pagination, default: 5 the value should be Odd, 5, 7
32
+ */
33
+ "navItemAccount": number;
30
34
  /**
31
35
  * The offset of dataset
32
36
  */
@@ -97,6 +101,10 @@ declare namespace LocalJSX {
97
101
  * The received limit for the number of pages
98
102
  */
99
103
  "limit"?: number;
104
+ /**
105
+ * The Nav Items count for the pagination, default: 5 the value should be Odd, 5, 7
106
+ */
107
+ "navItemAccount"?: number;
100
108
  /**
101
109
  * The offset of dataset
102
110
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/bonus-pagination-nav",
3
- "version": "1.47.3",
3
+ "version": "1.48.0",
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 a,h as e}from"./p-57809f35.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,a,e)=>{const r=a;let h=s[void 0!==r&&i.includes(r)?r:"en"][t];if(void 0!==e)for(const[t,a]of Object.entries(e.values)){const e=new RegExp(`{${t}}`,"g");h=h.replace(e,a)}return h},h=class{constructor(e){t(this,e),this.reloadPageEmitter=a(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.endPageIndex=0,this.pagesArray=void 0,this.currentPage=1}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 e("ul",{class:"PaginationArea"},this.pagesArray.map((t=>e("li",{class:"PageItem "+(this.currentPage==t?"Active":""),onClick:()=>{this.goTo(t)}},t))))}renderStylingWrapper(){return e("general-styling-wrapper",{targetTranslations:s,translationUrl:this.translationUrl})}updatePageStatus(){this.endPageIndex=Math.ceil(this.total/this.limit)-1,this.endPageIndex=this.endPageIndex<0?this.endPageIndex=0:this.endPageIndex,this.pagesArray=[],this.endPageIndex<5?this.pagesArray=Array.from({length:this.endPageIndex+1},((t,a)=>a+1)):1==this.currentPage||2==this.currentPage?(this.pagesArray=Array.from({length:4},((t,a)=>a+1)),this.pagesArray.push("...")):this.currentPage>=3&&this.endPageIndex-this.currentPage>=2?(this.pagesArray=Array.from({length:3},((t,a)=>this.currentPage+a-1)),this.pagesArray.push("..."),this.pagesArray.unshift("...")):this.endPageIndex-this.currentPage<3&&(this.pagesArray=Array.from({length:4},((t,a)=>this.endPageIndex-2+a)),this.pagesArray.unshift("..."))}componentWillRender(){this.currentPage=Math.floor(this.offset/this.limit)+1,this.updatePageStatus()}render(){return e("div",{key:"a6817c12f1e1e9960f8e91cfd5c5e2fa1ea72f7f",class:"PageNavigationWrapper"},this.displayRangeOfTotal&&this.total>0&&e("span",{key:"8f7a16c5835147e2a83808f882a66a2463e3998e",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}})),e("div",{key:"ddc20a86777c2fde667ad8b75ab86f3bc72ccfdb",class:"PageNavigation"},this.arrowsActive&&e("div",{key:"ce2a45b8c0d6e32cfa3f1c5cc8b3c9ac58acc409",class:"PageArrow FirstPage "+(1==this.currentPage?"Disabled":""),onClick:()=>{this.goTo(1)}},r("firstPage",this.language)),this.secondaryArrowsActive&&e("span",{key:"82dce028e4283dcac511b3b62823e87f2085f4b5",class:"PageArrow PrePage "+(1==this.currentPage?"Disabled":""),onClick:()=>{this.goTo(this.currentPage-1)}},r("prePage",this.language)),this.displayPageNumbers&&this.renderPageList(),this.secondaryArrowsActive&&e("span",{key:"a6ed748ce3e2555ac3d9d4bae174ad5bad0fabec",class:"PageArrow NextPage "+(this.currentPage==this.endPageIndex+1?"Disabled":""),onClick:()=>{this.goTo(this.currentPage+1)}},r("nextPage",this.language)),this.arrowsActive&&e("div",{key:"60a81a86f11e2bb07ee93b61d6f367a11b0e2b6c",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}.PageNavigationWrapper .PageOfMessage{margin:5px;padding:5px 6px;margin:2px}.PageNavigation{display:flex;flex-direction:row;align-items:center}.PageNavigation .PageArrow{color:var(--emfe-w-color-primary, #777676);padding:6px 5px;cursor:pointer;font-weight:bold;width:1.2rem;text-align:center}.PageNavigation .PageArrow.Disabled{color:var(--emfe-w-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(--emfe-w-color-primary, #f5f1f1);background-color:var(--emfe-w-color-secondary, #8c8989);border-radius:0.3rem}";export{h as bonus_pagination_nav}