@quandis/qbo4.ui 4.0.1-CI-20250106-195358 → 4.0.1-CI-20250106-222914
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.
- package/package.json +1 -1
- package/src/qbo/qbo-paginate.d.ts +1 -0
- package/src/qbo/qbo-paginate.js +9 -2
- package/src/qbo/qbo-paginate.ts +7 -2
- package/wwwroot/js/esm/qbo4.ui.js +10 -3
- package/wwwroot/js/esm/qbo4.ui.min.js +4 -4
- package/wwwroot/js/esm/qbo4.ui.min.js.map +1 -1
- package/wwwroot/js/qbo4.ui.js +10 -3
- package/wwwroot/js/qbo4.ui.min.js +4 -4
- package/wwwroot/js/qbo4.ui.min.js.map +1 -1
package/package.json
CHANGED
package/src/qbo/qbo-paginate.js
CHANGED
|
@@ -20,6 +20,7 @@ let QboPaginate = class QboPaginate extends LitElement {
|
|
|
20
20
|
this.currentPage = 1;
|
|
21
21
|
this.rollingView = true;
|
|
22
22
|
this.editSize = true;
|
|
23
|
+
this.displayCountText = 'Results per page:';
|
|
23
24
|
}
|
|
24
25
|
get maxPage() {
|
|
25
26
|
return Math.floor(this.count / this.display) + (this.count % this.display === 0 ? 0 : 1);
|
|
@@ -30,7 +31,7 @@ let QboPaginate = class QboPaginate extends LitElement {
|
|
|
30
31
|
]; }
|
|
31
32
|
// Go to a specific page
|
|
32
33
|
goToPage(page) {
|
|
33
|
-
if (page != this.currentPage && page
|
|
34
|
+
if (page != this.currentPage && page > 0 && page <= this.maxPage) {
|
|
34
35
|
this.currentPage = page;
|
|
35
36
|
this.dispatchEvent(new CustomEvent('change', {
|
|
36
37
|
detail: { start: (page - 1) * this.display, display: this.display, page: page },
|
|
@@ -54,6 +55,8 @@ let QboPaginate = class QboPaginate extends LitElement {
|
|
|
54
55
|
: 1;
|
|
55
56
|
if (first < 1)
|
|
56
57
|
first = 1;
|
|
58
|
+
if (first + this.pageLimit > this.maxPage)
|
|
59
|
+
first = this.maxPage - this.pageLimit + 1;
|
|
57
60
|
let last = (this.maxPage > this.pageLimit)
|
|
58
61
|
? first + this.pageLimit - 1
|
|
59
62
|
: this.maxPage;
|
|
@@ -83,7 +86,7 @@ let QboPaginate = class QboPaginate extends LitElement {
|
|
|
83
86
|
}
|
|
84
87
|
renderPageSize() {
|
|
85
88
|
return html `<li class="pageSize">
|
|
86
|
-
<span
|
|
89
|
+
<span>${this.displayCountText}</span>
|
|
87
90
|
<input type="number" min="5" value="${this.display}" title="Display Size" @change=${(e) => this.setDisplaySize(e)}>
|
|
88
91
|
</li>`;
|
|
89
92
|
}
|
|
@@ -135,6 +138,10 @@ __decorate([
|
|
|
135
138
|
property({ type: Boolean }),
|
|
136
139
|
__metadata("design:type", Object)
|
|
137
140
|
], QboPaginate.prototype, "editSize", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
property({ type: String }),
|
|
143
|
+
__metadata("design:type", Object)
|
|
144
|
+
], QboPaginate.prototype, "displayCountText", void 0);
|
|
138
145
|
QboPaginate = __decorate([
|
|
139
146
|
customElement('qbo-paginate')
|
|
140
147
|
], QboPaginate);
|
package/src/qbo/qbo-paginate.ts
CHANGED
|
@@ -25,6 +25,9 @@ export class QboPaginate extends LitElement {
|
|
|
25
25
|
@property({ type: Boolean })
|
|
26
26
|
editSize = true;
|
|
27
27
|
|
|
28
|
+
@property({ type: String })
|
|
29
|
+
displayCountText = 'Results per page:';
|
|
30
|
+
|
|
28
31
|
private get maxPage(): number {
|
|
29
32
|
return Math.floor(this.count / this.display) + (this.count % this.display === 0 ? 0 : 1);
|
|
30
33
|
}
|
|
@@ -36,7 +39,7 @@ export class QboPaginate extends LitElement {
|
|
|
36
39
|
|
|
37
40
|
// Go to a specific page
|
|
38
41
|
goToPage(page) {
|
|
39
|
-
if (page != this.currentPage && page
|
|
42
|
+
if (page != this.currentPage && page > 0 && page <= this.maxPage) {
|
|
40
43
|
this.currentPage = page;
|
|
41
44
|
|
|
42
45
|
this.dispatchEvent(
|
|
@@ -66,6 +69,8 @@ export class QboPaginate extends LitElement {
|
|
|
66
69
|
? this.currentPage - Math.floor(this.pageLimit / 2)
|
|
67
70
|
: 1;
|
|
68
71
|
if (first < 1) first = 1;
|
|
72
|
+
if (first + this.pageLimit > this.maxPage)
|
|
73
|
+
first = this.maxPage - this.pageLimit + 1;
|
|
69
74
|
let last = (this.maxPage > this.pageLimit)
|
|
70
75
|
? first + this.pageLimit - 1
|
|
71
76
|
: this.maxPage;
|
|
@@ -97,7 +102,7 @@ export class QboPaginate extends LitElement {
|
|
|
97
102
|
|
|
98
103
|
renderPageSize() {
|
|
99
104
|
return html`<li class="pageSize">
|
|
100
|
-
<span
|
|
105
|
+
<span>${this.displayCountText}</span>
|
|
101
106
|
<input type="number" min="5" value="${this.display}" title="Display Size" @change=${(e) => this.setDisplaySize(e)}>
|
|
102
107
|
</li>`
|
|
103
108
|
}
|