@everymatrix/bonus-pagination-nav 1.86.26 → 1.86.28

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:"|<",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(--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 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}
@@ -154,16 +154,16 @@ const BonusPaginationNav = class {
154
154
  }
155
155
  }
156
156
  else {
157
- if (this.currentPage < (halfOfMaxPageCount - 1)) { // when current page is in first half of nav
157
+ if (this.currentPage <= (maxNavItemsCount - halfOfMaxPageCount)) { // when current page is in first half of nav
158
158
  pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => i + 1);
159
159
  pageArray.push('...');
160
160
  }
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);
161
+ else if (this.currentPage > (lastPageNo - (maxNavItemsCount - halfOfMaxPageCount))) { // when current page is in last half of nav
162
+ pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => lastPageNo - (maxNavItemsCount - 2) + i);
163
163
  pageArray.unshift('...');
164
164
  }
165
165
  else {
166
- pageArray = Array.from({ length: (halfOfMaxPageCount + 1) }, (_, i) => this.currentPage + i - 1);
166
+ pageArray = Array.from({ length: (maxNavItemsCount - 2) }, (_, i) => this.currentPage + i - halfOfMaxPageCount + 1);
167
167
  pageArray.push('...');
168
168
  pageArray.unshift('...');
169
169
  }
@@ -182,23 +182,23 @@ const BonusPaginationNav = class {
182
182
  render() {
183
183
  const startOffset = (this.currentPage - 1) * this.limit + 1;
184
184
  const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
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, {
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, {
186
186
  values: {
187
187
  start: startOffset,
188
188
  end: endOffset,
189
189
  total: this.total
190
190
  }
191
- })), index.h("div", { key: '64fc17d0b992b30a4b8d712e47442ee6a2d44b82', class: 'PageNavigation' }, this.arrowsActive &&
192
- index.h("div", { key: 'f5f3b562fbdfb9e4b39ffd9755e5dba41e6231ba', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
191
+ })), index.h("div", { key: '590af1c2fcb70d782b318c505deb507a8376e13b', class: 'PageNavigation' }, this.arrowsActive &&
192
+ index.h("div", { key: '2d4746e889a43d6199ad7f305676d79bdbaa4f04', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
193
193
  this.goTo(1);
194
194
  } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
195
- index.h("span", { key: '39222e258f6c63502bfd3914c673d804edc96b53', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
195
+ index.h("span", { key: '89b588abdf7b77e3cdc00f44bbad27c432146f97', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
196
196
  this.goTo(this.currentPage - 1);
197
197
  } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
198
- index.h("span", { key: 'd6f9a1394debdae49702713ccc59bea710ccd7ae', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
198
+ index.h("span", { key: '097710df72de15cd1b0c03dfb2ac7870c99e12c0', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
199
199
  this.goTo(this.currentPage + 1);
200
200
  } }, translate('nextPage', this.language)), this.arrowsActive &&
201
- index.h("div", { key: 'd2bb76f9d40fcfc3dbc6bb5fbfe6d237e77f0ee6', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
201
+ index.h("div", { key: 'a61296f3e627bc012545618c0fda239a1356da1f', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
202
202
  this.goTo(this.endPageIndex + 1);
203
203
  } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
204
204
  }
@@ -94,16 +94,16 @@ export class BonusPaginationNav {
94
94
  }
95
95
  }
96
96
  else {
97
- if (this.currentPage < (halfOfMaxPageCount - 1)) { // when current page is in first half of nav
97
+ if (this.currentPage <= (maxNavItemsCount - halfOfMaxPageCount)) { // when current page is in first half of nav
98
98
  pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => i + 1);
99
99
  pageArray.push('...');
100
100
  }
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);
101
+ else if (this.currentPage > (lastPageNo - (maxNavItemsCount - halfOfMaxPageCount))) { // when current page is in last half of nav
102
+ pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => lastPageNo - (maxNavItemsCount - 2) + i);
103
103
  pageArray.unshift('...');
104
104
  }
105
105
  else {
106
- pageArray = Array.from({ length: (halfOfMaxPageCount + 1) }, (_, i) => this.currentPage + i - 1);
106
+ pageArray = Array.from({ length: (maxNavItemsCount - 2) }, (_, i) => this.currentPage + i - halfOfMaxPageCount + 1);
107
107
  pageArray.push('...');
108
108
  pageArray.unshift('...');
109
109
  }
@@ -122,23 +122,23 @@ export class BonusPaginationNav {
122
122
  render() {
123
123
  const startOffset = (this.currentPage - 1) * this.limit + 1;
124
124
  const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
125
- return h("div", { key: 'aa8d14788833b1b0e13ea20943935b03a3b043ac', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: 'a018261b6c598116829d878b8120aee7ae2576c4', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
125
+ return h("div", { key: '77610598f3ce40796b8d486fd27725fc68b61878', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: '879bd2f268a18ea3c9cb2bb706d23c8db0634592', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
126
126
  values: {
127
127
  start: startOffset,
128
128
  end: endOffset,
129
129
  total: this.total
130
130
  }
131
- })), h("div", { key: '64fc17d0b992b30a4b8d712e47442ee6a2d44b82', class: 'PageNavigation' }, this.arrowsActive &&
132
- h("div", { key: 'f5f3b562fbdfb9e4b39ffd9755e5dba41e6231ba', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
131
+ })), h("div", { key: '590af1c2fcb70d782b318c505deb507a8376e13b', class: 'PageNavigation' }, this.arrowsActive &&
132
+ h("div", { key: '2d4746e889a43d6199ad7f305676d79bdbaa4f04', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
133
133
  this.goTo(1);
134
134
  } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
135
- h("span", { key: '39222e258f6c63502bfd3914c673d804edc96b53', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
135
+ h("span", { key: '89b588abdf7b77e3cdc00f44bbad27c432146f97', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
136
136
  this.goTo(this.currentPage - 1);
137
137
  } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
138
- h("span", { key: 'd6f9a1394debdae49702713ccc59bea710ccd7ae', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
138
+ h("span", { key: '097710df72de15cd1b0c03dfb2ac7870c99e12c0', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
139
139
  this.goTo(this.currentPage + 1);
140
140
  } }, translate('nextPage', this.language)), this.arrowsActive &&
141
- h("div", { key: 'd2bb76f9d40fcfc3dbc6bb5fbfe6d237e77f0ee6', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
141
+ h("div", { key: 'a61296f3e627bc012545618c0fda239a1356da1f', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
142
142
  this.goTo(this.endPageIndex + 1);
143
143
  } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
144
144
  }
@@ -150,16 +150,16 @@ const BonusPaginationNav = class {
150
150
  }
151
151
  }
152
152
  else {
153
- if (this.currentPage < (halfOfMaxPageCount - 1)) { // when current page is in first half of nav
153
+ if (this.currentPage <= (maxNavItemsCount - halfOfMaxPageCount)) { // when current page is in first half of nav
154
154
  pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => i + 1);
155
155
  pageArray.push('...');
156
156
  }
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);
157
+ else if (this.currentPage > (lastPageNo - (maxNavItemsCount - halfOfMaxPageCount))) { // when current page is in last half of nav
158
+ pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, i) => lastPageNo - (maxNavItemsCount - 2) + i);
159
159
  pageArray.unshift('...');
160
160
  }
161
161
  else {
162
- pageArray = Array.from({ length: (halfOfMaxPageCount + 1) }, (_, i) => this.currentPage + i - 1);
162
+ pageArray = Array.from({ length: (maxNavItemsCount - 2) }, (_, i) => this.currentPage + i - halfOfMaxPageCount + 1);
163
163
  pageArray.push('...');
164
164
  pageArray.unshift('...');
165
165
  }
@@ -178,23 +178,23 @@ const BonusPaginationNav = class {
178
178
  render() {
179
179
  const startOffset = (this.currentPage - 1) * this.limit + 1;
180
180
  const endOffset = this.currentPage * this.limit > this.total ? this.total : this.currentPage * this.limit;
181
- return h("div", { key: 'aa8d14788833b1b0e13ea20943935b03a3b043ac', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: 'a018261b6c598116829d878b8120aee7ae2576c4', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
181
+ return h("div", { key: '77610598f3ce40796b8d486fd27725fc68b61878', class: 'PageNavigationWrapper' }, this.displayRangeOfTotal && this.total > 0 && h("span", { key: '879bd2f268a18ea3c9cb2bb706d23c8db0634592', class: 'PageOfMessage' }, translate('pageOfTotal', this.language, {
182
182
  values: {
183
183
  start: startOffset,
184
184
  end: endOffset,
185
185
  total: this.total
186
186
  }
187
- })), h("div", { key: '64fc17d0b992b30a4b8d712e47442ee6a2d44b82', class: 'PageNavigation' }, this.arrowsActive &&
188
- h("div", { key: 'f5f3b562fbdfb9e4b39ffd9755e5dba41e6231ba', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
187
+ })), h("div", { key: '590af1c2fcb70d782b318c505deb507a8376e13b', class: 'PageNavigation' }, this.arrowsActive &&
188
+ h("div", { key: '2d4746e889a43d6199ad7f305676d79bdbaa4f04', class: `PageArrow FirstPage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
189
189
  this.goTo(1);
190
190
  } }, translate('firstPage', this.language)), this.secondaryArrowsActive &&
191
- h("span", { key: '39222e258f6c63502bfd3914c673d804edc96b53', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
191
+ h("span", { key: '89b588abdf7b77e3cdc00f44bbad27c432146f97', class: `PageArrow PrePage ${this.currentPage == 1 ? 'Disabled' : ''}`, onClick: () => {
192
192
  this.goTo(this.currentPage - 1);
193
193
  } }, translate('prePage', this.language)), this.displayPageNumbers && this.renderPageList(), this.secondaryArrowsActive &&
194
- h("span", { key: 'd6f9a1394debdae49702713ccc59bea710ccd7ae', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
194
+ h("span", { key: '097710df72de15cd1b0c03dfb2ac7870c99e12c0', class: `PageArrow NextPage ${this.currentPage == (this.endPageIndex + 1) ? 'Disabled' : ''}`, onClick: () => {
195
195
  this.goTo(this.currentPage + 1);
196
196
  } }, translate('nextPage', this.language)), this.arrowsActive &&
197
- h("div", { key: 'd2bb76f9d40fcfc3dbc6bb5fbfe6d237e77f0ee6', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
197
+ h("div", { key: 'a61296f3e627bc012545618c0fda239a1356da1f', class: `PageArrow LastPage ${this.currentPage == this.endPageIndex + 1 ? 'Disabled' : ''}`, onClick: () => {
198
198
  this.goTo(this.endPageIndex + 1);
199
199
  } }, " ", translate('lastPage', this.language), " "), this.renderStylingWrapper()));
200
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/bonus-pagination-nav",
3
- "version": "1.86.26",
3
+ "version": "1.86.28",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",