@everymatrix/bonus-pagination-nav 1.94.96 → 1.94.98

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 a,h as e}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,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.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 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})}generateNavItemsByType(t,a){if(this.endPageIndex<t)return Array.from({length:this.endPageIndex+1},((t,a)=>a+1));let e=[],i=Math.floor(t/2);const s=this.endPageIndex+1;return a?this.currentPage<i||this.currentPage>s-i+1?(e=Array.from({length:i},((t,a)=>a+1)),e.push("..."),e=e.concat(Array.from({length:i},((t,a)=>this.endPageIndex-1+a)))):this.currentPage==i?(e=Array.from({length:i+1},((t,a)=>a+1)),e.push("..."),e=e.concat(Array.from({length:i-1},((t,a)=>this.endPageIndex+a)))):this.currentPage==s-i+1?(e=Array.from({length:i-1},((t,a)=>a+1)),e.push("..."),e=e.concat(Array.from({length:i+1},((t,a)=>this.endPageIndex-2+a)))):(e=[1,"..."],e=e.concat([this.currentPage-1],[this.currentPage],[this.currentPage+1]),e=e.concat(["...",s])):this.currentPage<=t-i?(e=Array.from({length:t-1},((t,a)=>a+1)),e.push("...")):this.currentPage>s-(t-i)?(e=Array.from({length:t-1},((a,e)=>s-(t-2)+e)),e.unshift("...")):(e=Array.from({length:t-2},((t,a)=>this.currentPage+a-i+1)),e.push("..."),e.unshift("...")),e}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 e("div",{key:"77610598f3ce40796b8d486fd27725fc68b61878",class:"PageNavigationWrapper"},this.displayRangeOfTotal&&this.total>0&&e("span",{key:"879bd2f268a18ea3c9cb2bb706d23c8db0634592",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:"590af1c2fcb70d782b318c505deb507a8376e13b",class:"PageNavigation"},this.arrowsActive&&e("div",{key:"2d4746e889a43d6199ad7f305676d79bdbaa4f04",class:"PageArrow FirstPage "+(1==this.currentPage?"Disabled":""),onClick:()=>{this.goTo(1)}},r("firstPage",this.language)),this.secondaryArrowsActive&&e("span",{key:"89b588abdf7b77e3cdc00f44bbad27c432146f97",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:"097710df72de15cd1b0c03dfb2ac7870c99e12c0",class:"PageArrow NextPage "+(this.currentPage==this.endPageIndex+1?"Disabled":""),onClick:()=>{this.goTo(this.currentPage+1)}},r("nextPage",this.language)),this.arrowsActive&&e("div",{key:"a61296f3e627bc012545618c0fda239a1356da1f",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}
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}
@@ -72,7 +72,7 @@ const BonusPaginationNav = class {
72
72
  this.secondaryArrowsActive = true;
73
73
  this.displayPageNumbers = true;
74
74
  this.displayRangeOfTotal = undefined;
75
- this.navItemAccount = 5;
75
+ this.navItemAccount = 7;
76
76
  this.endPageIndex = 0;
77
77
  this.pagesArray = undefined;
78
78
  this.currentPage = 1;
@@ -131,20 +131,26 @@ const BonusPaginationNav = class {
131
131
  //Nav show as ( 1, 2, 3, ..., 8, 9, 10)
132
132
  pageArray = Array.from({ length: halfOfMaxPageCount }, (_, i) => i + 1);
133
133
  pageArray.push('...');
134
- pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount }, (_, i) => (this.endPageIndex - 1) + i));
134
+ for (let i = (lastPageNo - (maxNavItemsCount - pageArray.length - 1)); i <= lastPageNo; i++) {
135
+ pageArray.push(i);
136
+ }
135
137
  }
136
138
  else if (this.currentPage == halfOfMaxPageCount) {
137
139
  //current page: 3 (=halfOfMaxPageCount)
138
140
  //Nav show as ( 1, 2, 3, 4, ..., 9,10)
139
141
  pageArray = Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => i + 1);
140
142
  pageArray.push('...');
141
- pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => (this.endPageIndex) + i));
143
+ for (let i = (lastPageNo - (maxNavItemsCount - pageArray.length - 1)); i <= lastPageNo; i++) {
144
+ pageArray.push(i);
145
+ }
142
146
  }
143
147
  else if (this.currentPage == (lastPageNo - halfOfMaxPageCount + 1)) {
144
148
  //current page: 8, (the page index after this.total - halfOfMaxPageCount ) Nav show as ( 1, 2, ... ,7, 8,9,10)
145
149
  pageArray = Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => i + 1);
146
150
  pageArray.push('...');
147
- pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => (this.endPageIndex - 2) + i));
151
+ for (let i = (lastPageNo - (maxNavItemsCount - pageArray.length - 1)); i <= lastPageNo; i++) {
152
+ pageArray.push(i);
153
+ }
148
154
  }
149
155
  else {
150
156
  //current page: > 3 and < 7, let's say is 5 Nav show as ( 1, ..., 4, 5, 6, ... ,10)
@@ -182,23 +188,23 @@ const BonusPaginationNav = class {
182
188
  render() {
183
189
  const startOffset = (this.currentPage - 1) * this.limit + 1;
184
190
  const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
185
- return index.h("div", { key: '77610598f3ce40796b8d486fd27725fc68b61878', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && index.h("span", { key: '879bd2f268a18ea3c9cb2bb706d23c8db0634592', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
191
+ return index.h("div", { key: 'a6d3cd6cd1e5ff8d927486806d26c6eb61e57833', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && index.h("span", { key: '56f81e329deb0d5160d4d4e020571d1cc402dcc1', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
186
192
  values: {
187
193
  start: startOffset,
188
194
  end: endOffset,
189
195
  total: this.total
190
196
  }
191
- })), index.h("div", { key: '590af1c2fcb70d782b318c505deb507a8376e13b', class: 'PageNavigation' }, this.arrowsActive &&
192
- index.h("div", { key: '2d4746e889a43d6199ad7f305676d79bdbaa4f04', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
197
+ })), index.h("div", { key: 'eaf964e00190b690564d57af6da91aed717e1690', class: 'PageNavigation' }, this.arrowsActive &&
198
+ index.h("div", { key: '2be57e1c4d3d6fb80db83c6b5c60710573da5f5e', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
193
199
  this.goTo(1);
194
200
  } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
195
- index.h("span", { key: '89b588abdf7b77e3cdc00f44bbad27c432146f97', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
201
+ index.h("span", { key: 'd240849c9ba6b9c14d4ebed6c346d7cc629a1a59', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
196
202
  this.goTo(this.currentPage - 1);
197
203
  } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
198
- index.h("span", { key: '097710df72de15cd1b0c03dfb2ac7870c99e12c0', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
204
+ index.h("span", { key: '90cb6da1e51256e86f8678e0520d4b221b99957d', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
199
205
  this.goTo(this.currentPage + 1);
200
206
  } }, translate('nextPage', this.language)), this.arrowsActive &&
201
- index.h("div", { key: 'a61296f3e627bc012545618c0fda239a1356da1f', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
207
+ index.h("div", { key: 'c74711a45bbbf822ca56e6f2fe70ee541ae91cfa', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
202
208
  this.goTo(this.endPageIndex + 1);
203
209
  } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
204
210
  }
@@ -12,7 +12,7 @@ export class BonusPaginationNav {
12
12
  this.secondaryArrowsActive = true;
13
13
  this.displayPageNumbers = true;
14
14
  this.displayRangeOfTotal = undefined;
15
- this.navItemAccount = 5;
15
+ this.navItemAccount = 7;
16
16
  this.endPageIndex = 0;
17
17
  this.pagesArray = undefined;
18
18
  this.currentPage = 1;
@@ -71,20 +71,26 @@ export class BonusPaginationNav {
71
71
  //Nav show as ( 1, 2, 3, ..., 8, 9, 10)
72
72
  pageArray = Array.from({ length: halfOfMaxPageCount }, (_, i) => i + 1);
73
73
  pageArray.push('...');
74
- pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount }, (_, i) => (this.endPageIndex - 1) + i));
74
+ for (let i = (lastPageNo - (maxNavItemsCount - pageArray.length - 1)); i <= lastPageNo; i++) {
75
+ pageArray.push(i);
76
+ }
75
77
  }
76
78
  else if (this.currentPage == halfOfMaxPageCount) {
77
79
  //current page: 3 (=halfOfMaxPageCount)
78
80
  //Nav show as ( 1, 2, 3, 4, ..., 9,10)
79
81
  pageArray = Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => i + 1);
80
82
  pageArray.push('...');
81
- pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => (this.endPageIndex) + i));
83
+ for (let i = (lastPageNo - (maxNavItemsCount - pageArray.length - 1)); i <= lastPageNo; i++) {
84
+ pageArray.push(i);
85
+ }
82
86
  }
83
87
  else if (this.currentPage == (lastPageNo - halfOfMaxPageCount + 1)) {
84
88
  //current page: 8, (the page index after this.total - halfOfMaxPageCount ) Nav show as ( 1, 2, ... ,7, 8,9,10)
85
89
  pageArray = Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => i + 1);
86
90
  pageArray.push('...');
87
- pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => (this.endPageIndex - 2) + i));
91
+ for (let i = (lastPageNo - (maxNavItemsCount - pageArray.length - 1)); i <= lastPageNo; i++) {
92
+ pageArray.push(i);
93
+ }
88
94
  }
89
95
  else {
90
96
  //current page: > 3 and < 7, let's say is 5 Nav show as ( 1, ..., 4, 5, 6, ... ,10)
@@ -122,23 +128,23 @@ export class BonusPaginationNav {
122
128
  render() {
123
129
  const startOffset = (this.currentPage - 1) * this.limit + 1;
124
130
  const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
125
- return h("div", { key: '77610598f3ce40796b8d486fd27725fc68b61878', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: '879bd2f268a18ea3c9cb2bb706d23c8db0634592', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
131
+ return h("div", { key: 'a6d3cd6cd1e5ff8d927486806d26c6eb61e57833', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: '56f81e329deb0d5160d4d4e020571d1cc402dcc1', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
126
132
  values: {
127
133
  start: startOffset,
128
134
  end: endOffset,
129
135
  total: this.total
130
136
  }
131
- })), h("div", { key: '590af1c2fcb70d782b318c505deb507a8376e13b', class: 'PageNavigation' }, this.arrowsActive &&
132
- h("div", { key: '2d4746e889a43d6199ad7f305676d79bdbaa4f04', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
137
+ })), h("div", { key: 'eaf964e00190b690564d57af6da91aed717e1690', class: 'PageNavigation' }, this.arrowsActive &&
138
+ h("div", { key: '2be57e1c4d3d6fb80db83c6b5c60710573da5f5e', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
133
139
  this.goTo(1);
134
140
  } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
135
- h("span", { key: '89b588abdf7b77e3cdc00f44bbad27c432146f97', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
141
+ h("span", { key: 'd240849c9ba6b9c14d4ebed6c346d7cc629a1a59', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
136
142
  this.goTo(this.currentPage - 1);
137
143
  } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
138
- h("span", { key: '097710df72de15cd1b0c03dfb2ac7870c99e12c0', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
144
+ h("span", { key: '90cb6da1e51256e86f8678e0520d4b221b99957d', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
139
145
  this.goTo(this.currentPage + 1);
140
146
  } }, translate('nextPage', this.language)), this.arrowsActive &&
141
- h("div", { key: 'a61296f3e627bc012545618c0fda239a1356da1f', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
147
+ h("div", { key: 'c74711a45bbbf822ca56e6f2fe70ee541ae91cfa', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
142
148
  this.goTo(this.endPageIndex + 1);
143
149
  } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
144
150
  }
@@ -346,11 +352,11 @@ export class BonusPaginationNav {
346
352
  "optional": false,
347
353
  "docs": {
348
354
  "tags": [],
349
- "text": "The Nav Items count for the pagination, default: 5\nthe value should be Odd, 5, 7"
355
+ "text": "The Nav Items count for the pagination, default: 7\nthe value should be Odd, 7, 9"
350
356
  },
351
357
  "attribute": "nav-item-account",
352
358
  "reflect": true,
353
- "defaultValue": "5"
359
+ "defaultValue": "7"
354
360
  }
355
361
  };
356
362
  }
@@ -68,7 +68,7 @@ const BonusPaginationNav = class {
68
68
  this.secondaryArrowsActive = true;
69
69
  this.displayPageNumbers = true;
70
70
  this.displayRangeOfTotal = undefined;
71
- this.navItemAccount = 5;
71
+ this.navItemAccount = 7;
72
72
  this.endPageIndex = 0;
73
73
  this.pagesArray = undefined;
74
74
  this.currentPage = 1;
@@ -127,20 +127,26 @@ const BonusPaginationNav = class {
127
127
  //Nav show as ( 1, 2, 3, ..., 8, 9, 10)
128
128
  pageArray = Array.from({ length: halfOfMaxPageCount }, (_, i) => i + 1);
129
129
  pageArray.push('...');
130
- pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount }, (_, i) => (this.endPageIndex - 1) + i));
130
+ for (let i = (lastPageNo - (maxNavItemsCount - pageArray.length - 1)); i <= lastPageNo; i++) {
131
+ pageArray.push(i);
132
+ }
131
133
  }
132
134
  else if (this.currentPage == halfOfMaxPageCount) {
133
135
  //current page: 3 (=halfOfMaxPageCount)
134
136
  //Nav show as ( 1, 2, 3, 4, ..., 9,10)
135
137
  pageArray = Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => i + 1);
136
138
  pageArray.push('...');
137
- pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => (this.endPageIndex) + i));
139
+ for (let i = (lastPageNo - (maxNavItemsCount - pageArray.length - 1)); i <= lastPageNo; i++) {
140
+ pageArray.push(i);
141
+ }
138
142
  }
139
143
  else if (this.currentPage == (lastPageNo - halfOfMaxPageCount + 1)) {
140
144
  //current page: 8, (the page index after this.total - halfOfMaxPageCount ) Nav show as ( 1, 2, ... ,7, 8,9,10)
141
145
  pageArray = Array.from({ length: halfOfMaxPageCount - 1 }, (_, i) => i + 1);
142
146
  pageArray.push('...');
143
- pageArray = pageArray.concat(Array.from({ length: halfOfMaxPageCount + 1 }, (_, i) => (this.endPageIndex - 2) + i));
147
+ for (let i = (lastPageNo - (maxNavItemsCount - pageArray.length - 1)); i <= lastPageNo; i++) {
148
+ pageArray.push(i);
149
+ }
144
150
  }
145
151
  else {
146
152
  //current page: > 3 and < 7, let's say is 5 Nav show as ( 1, ..., 4, 5, 6, ... ,10)
@@ -178,23 +184,23 @@ const BonusPaginationNav = class {
178
184
  render() {
179
185
  const startOffset = (this.currentPage - 1) * this.limit + 1;
180
186
  const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
181
- return h("div", { key: '77610598f3ce40796b8d486fd27725fc68b61878', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: '879bd2f268a18ea3c9cb2bb706d23c8db0634592', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
187
+ return h("div", { key: 'a6d3cd6cd1e5ff8d927486806d26c6eb61e57833', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: '56f81e329deb0d5160d4d4e020571d1cc402dcc1', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
182
188
  values: {
183
189
  start: startOffset,
184
190
  end: endOffset,
185
191
  total: this.total
186
192
  }
187
- })), h("div", { key: '590af1c2fcb70d782b318c505deb507a8376e13b', class: 'PageNavigation' }, this.arrowsActive &&
188
- h("div", { key: '2d4746e889a43d6199ad7f305676d79bdbaa4f04', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
193
+ })), h("div", { key: 'eaf964e00190b690564d57af6da91aed717e1690', class: 'PageNavigation' }, this.arrowsActive &&
194
+ h("div", { key: '2be57e1c4d3d6fb80db83c6b5c60710573da5f5e', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
189
195
  this.goTo(1);
190
196
  } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
191
- h("span", { key: '89b588abdf7b77e3cdc00f44bbad27c432146f97', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
197
+ h("span", { key: 'd240849c9ba6b9c14d4ebed6c346d7cc629a1a59', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
192
198
  this.goTo(this.currentPage - 1);
193
199
  } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
194
- h("span", { key: '097710df72de15cd1b0c03dfb2ac7870c99e12c0', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
200
+ h("span", { key: '90cb6da1e51256e86f8678e0520d4b221b99957d', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
195
201
  this.goTo(this.currentPage + 1);
196
202
  } }, translate('nextPage', this.language)), this.arrowsActive &&
197
- h("div", { key: 'a61296f3e627bc012545618c0fda239a1356da1f', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
203
+ h("div", { key: 'c74711a45bbbf822ca56e6f2fe70ee541ae91cfa', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
198
204
  this.goTo(this.endPageIndex + 1);
199
205
  } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
200
206
  }
@@ -42,8 +42,8 @@ export declare class BonusPaginationNav {
42
42
  */
43
43
  displayRangeOfTotal: boolean;
44
44
  /**
45
- * The Nav Items count for the pagination, default: 5
46
- * the value should be Odd, 5, 7
45
+ * The Nav Items count for the pagination, default: 7
46
+ * the value should be Odd, 7, 9
47
47
  */
48
48
  navItemAccount: number;
49
49
  endPageIndex: number;
@@ -28,7 +28,7 @@ export namespace Components {
28
28
  */
29
29
  "limit": number;
30
30
  /**
31
- * The Nav Items count for the pagination, default: 5 the value should be Odd, 5, 7
31
+ * The Nav Items count for the pagination, default: 7 the value should be Odd, 7, 9
32
32
  */
33
33
  "navItemAccount": number;
34
34
  /**
@@ -102,7 +102,7 @@ declare namespace LocalJSX {
102
102
  */
103
103
  "limit"?: number;
104
104
  /**
105
- * The Nav Items count for the pagination, default: 5 the value should be Odd, 5, 7
105
+ * The Nav Items count for the pagination, default: 7 the value should be Odd, 7, 9
106
106
  */
107
107
  "navItemAccount"?: number;
108
108
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/bonus-pagination-nav",
3
- "version": "1.94.96",
3
+ "version": "1.94.98",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",