@everymatrix/bonus-pagination-nav 1.86.27 → 1.86.29
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
|
|
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
|
|
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 (
|
|
162
|
-
pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, 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: (
|
|
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: '
|
|
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: '
|
|
192
|
-
index.h("div", { key: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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
|
|
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 (
|
|
102
|
-
pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, 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: (
|
|
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: '
|
|
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: '
|
|
132
|
-
h("div", { key: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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
|
|
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 (
|
|
158
|
-
pageArray = Array.from({ length: (maxNavItemsCount - 1) }, (_, 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: (
|
|
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: '
|
|
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: '
|
|
188
|
-
h("div", { key: '
|
|
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: '
|
|
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: '
|
|
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: '
|
|
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
|
}
|