@aquera/nile-elements 0.1.50-beta-1.2 → 0.1.50-beta-1.3
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/README.md +5 -0
- package/dist/index.js +380 -186
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js.map +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.esm.js +2 -2
- package/dist/nile-pagination/nile-pagination.cjs.js +1 -1
- package/dist/nile-pagination/nile-pagination.cjs.js.map +1 -1
- package/dist/nile-pagination/nile-pagination.css.cjs.js +1 -1
- package/dist/nile-pagination/nile-pagination.css.cjs.js.map +1 -1
- package/dist/nile-pagination/nile-pagination.css.esm.js +170 -63
- package/dist/nile-pagination/nile-pagination.esm.js +120 -33
- package/dist/nile-tab/nile-tab.css.cjs.js +1 -1
- package/dist/nile-tab/nile-tab.css.cjs.js.map +1 -1
- package/dist/nile-tab/nile-tab.css.esm.js +3 -3
- package/dist/src/nile-content-editor/nile-content-editor.css.js +2 -2
- package/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/dist/src/nile-pagination/nile-pagination.css.js +168 -61
- package/dist/src/nile-pagination/nile-pagination.css.js.map +1 -1
- package/dist/src/nile-pagination/nile-pagination.d.ts +3 -0
- package/dist/src/nile-pagination/nile-pagination.js +169 -44
- package/dist/src/nile-pagination/nile-pagination.js.map +1 -1
- package/dist/src/nile-tab/nile-tab.css.js +1 -1
- package/dist/src/nile-tab/nile-tab.css.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-content-editor/nile-content-editor.css.ts +2 -2
- package/src/nile-pagination/nile-pagination.css.ts +168 -61
- package/src/nile-pagination/nile-pagination.ts +190 -50
- package/src/nile-tab/nile-tab.css.ts +1 -1
- package/vscode-html-custom-data.json +1 -1
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"description": "Webcomponent nile-elements following open-wc recommendations",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "nile-elements",
|
6
|
-
"version": "0.1.50-beta-1.
|
6
|
+
"version": "0.1.50-beta-1.3",
|
7
7
|
"main": "dist/src/index.js",
|
8
8
|
"type": "module",
|
9
9
|
"module": "dist/src/index.js",
|
@@ -33,7 +33,7 @@ export const styles = css`
|
|
33
33
|
.content-editable-input {
|
34
34
|
box-sizing: border-box;
|
35
35
|
width: 100%;
|
36
|
-
padding: var(--nile-spacing-
|
36
|
+
padding: var(--nile-spacing-9px);
|
37
37
|
border: 1px solid var(--nile-colors-neutral-500);
|
38
38
|
border-radius: var(--nile-radius-radius-xs);
|
39
39
|
overflow: auto;
|
@@ -68,7 +68,7 @@ export const styles = css`
|
|
68
68
|
padding: var(--nile-spacing-sm);
|
69
69
|
height: 24px;
|
70
70
|
line-height: 10px;
|
71
|
-
margin-left: var(--nile-
|
71
|
+
margin-left: var(--nile-height-26px);
|
72
72
|
letter-spacing: 0.2px;
|
73
73
|
}
|
74
74
|
|
@@ -18,38 +18,101 @@ export const styles = css`
|
|
18
18
|
display: flex;
|
19
19
|
align-items: center;
|
20
20
|
justify-content: space-between;
|
21
|
-
padding: var(--nile-spacing-spacing-md
|
22
|
-
}
|
23
|
-
|
24
|
-
.pagination-wrapper.v2 {
|
25
|
-
justify-content: flex-start;
|
26
|
-
gap: var(--nile-spacing-spacing-lg, var(--ng-spacing-lg));
|
21
|
+
padding: var(--nile-spacing-spacing-md) var(--nile-spacing-spacing-lg) ;
|
27
22
|
}
|
28
23
|
|
24
|
+
|
29
25
|
.pagination-wrapper.v2 .pager-container {
|
30
26
|
flex-direction: row;
|
31
27
|
align-items: center;
|
32
|
-
gap: var(--nile-spacing-spacing-md
|
33
|
-
margin-right: var(--nile-spacing-spacing-xl
|
28
|
+
gap: var(--nile-spacing-spacing-md);
|
29
|
+
margin-right: var(--nile-spacing-spacing-xl);
|
34
30
|
}
|
35
31
|
|
36
32
|
.pagination-wrapper.v2 .range-text {
|
37
|
-
margin-right: var(--nile-spacing-spacing-md
|
38
|
-
font-size: var(--nile-font-size-small
|
39
|
-
color: var(--nile-colors-dark-900
|
33
|
+
margin-right: var(--nile-spacing-spacing-md);
|
34
|
+
font-size: var(--nile-font-size-small);
|
35
|
+
color: var(--nile-colors-dark-900);
|
40
36
|
font-feature-settings: 'liga' off, 'clig' off;
|
41
|
-
font-weight: var(--nile-font-weight-regular
|
37
|
+
font-weight: var(--nile-font-weight-regular);
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
.pagination-wrapper.compact {
|
42
|
+
min-width: 324px;
|
43
|
+
justify-content: space-between;
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
.pagination-wrapper.compact .range-text {
|
49
|
+
margin-right: var(--nile-spacing-spacing-md);
|
50
|
+
white-space: nowrap;
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
.pagination-wrapper.compact .pager-container {
|
55
|
+
gap: var(--nile-spacing-spacing-md);
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
.pagination-wrapper.compact .pager-container {
|
60
|
+
display: flex;
|
61
|
+
align-items: center;
|
62
|
+
gap: var(--nile-spacing-spacing-md);
|
42
63
|
}
|
43
64
|
|
65
|
+
.pagination-wrapper.compact .page-size-dropdown ::part(base) {
|
66
|
+
min-width: 32px;
|
67
|
+
height: 32px;
|
68
|
+
padding: 0 6px;
|
69
|
+
}
|
70
|
+
|
71
|
+
.pagination-wrapper.compact .page-size-dropdown .chevron {
|
72
|
+
transition: transform 0.2s;
|
73
|
+
}
|
74
|
+
.pagination-wrapper.compact .page-size-dropdown .open .chevron {
|
75
|
+
transform: rotate(180deg);
|
76
|
+
}
|
77
|
+
|
78
|
+
.pagination-wrapper.compact ul.pagination:not(.compact-pagination) {
|
79
|
+
display: none;
|
80
|
+
}
|
81
|
+
|
82
|
+
.compact-pagination {
|
83
|
+
display: flex;
|
84
|
+
align-items: center;
|
85
|
+
gap: var(--nile-spacing-spacing-xs);
|
86
|
+
list-style: none;
|
87
|
+
margin: 0;
|
88
|
+
padding: 0;
|
89
|
+
}
|
90
|
+
.page-dropdown .current-page-btn {
|
91
|
+
padding: 2px;
|
92
|
+
font-size: var(--nile-font-size-small);
|
93
|
+
}
|
94
|
+
|
95
|
+
nile-button.current-page-btn::part(base){
|
96
|
+
min-width: 51px;
|
97
|
+
}
|
98
|
+
|
99
|
+
nile-button.current-page-btn::part(base):active {
|
100
|
+
min-width: 51px;
|
101
|
+
}
|
102
|
+
|
44
103
|
.pager-container {
|
45
104
|
display: flex;
|
46
105
|
align-items: center;
|
47
|
-
gap: var(--nile-spacing-spacing-3xl
|
106
|
+
gap: var(--nile-spacing-spacing-3xl);
|
48
107
|
}
|
49
108
|
|
109
|
+
.pagination-wrapper.compact .pager-container {
|
110
|
+
gap: var(--nile-spacing-xxs) !important;
|
111
|
+
}
|
112
|
+
|
50
113
|
.range-text {
|
51
|
-
font-size: var(--nile-font-size-small
|
52
|
-
color: var(--nile-colors-dark-900
|
114
|
+
font-size: var(--nile-font-size-small);
|
115
|
+
color: var(--nile-colors-dark-900);
|
53
116
|
white-space: nowrap;
|
54
117
|
}
|
55
118
|
|
@@ -61,13 +124,13 @@ export const styles = css`
|
|
61
124
|
ul.pagination {
|
62
125
|
display: flex;
|
63
126
|
list-style: none;
|
64
|
-
padding: var(--nile-spacing-spacing-none
|
65
|
-
margin: var(--nile-spacing-spacing-none
|
66
|
-
gap: var(--nile-radius-radius-xxs
|
127
|
+
padding: var(--nile-spacing-spacing-none);
|
128
|
+
margin: var(--nile-spacing-spacing-none);
|
129
|
+
gap: var(--nile-radius-radius-xxs);
|
67
130
|
}
|
68
131
|
|
69
132
|
ul.pagination li {
|
70
|
-
margin: var(--nile-spacing-spacing-none
|
133
|
+
margin: var(--nile-spacing-spacing-none);
|
71
134
|
}
|
72
135
|
|
73
136
|
.ellipsis-scroll-wrapper {
|
@@ -75,69 +138,113 @@ export const styles = css`
|
|
75
138
|
overflow-y: auto;
|
76
139
|
width: 66px;
|
77
140
|
}
|
141
|
+
.down-scroll-wrapper {
|
142
|
+
max-height: 150px;
|
143
|
+
overflow-y: auto;
|
144
|
+
width: 60px;
|
145
|
+
}
|
78
146
|
|
79
|
-
|
147
|
+
|
148
|
+
.compact-scroll-wrapper {
|
149
|
+
max-height: 160px;
|
80
150
|
overflow-y: auto;
|
81
|
-
|
151
|
+
width: 60px;
|
152
|
+
}
|
153
|
+
.compact-dropdown nile-menu {
|
154
|
+
overflow-y: auto;
|
155
|
+
padding: var(--nile-spacing-spacing-lg) var(--nile-spacing-spacing-none);
|
156
|
+
box-shadow: 0px 4px 8px 0px rgba(119, 125, 130, 0.15);
|
157
|
+
}
|
158
|
+
|
159
|
+
.page-size-dropdown nile-menu {
|
160
|
+
overflow-y: auto;
|
161
|
+
padding: var(--nile-spacing-spacing-lg) var(--nile-spacing-spacing-none);
|
82
162
|
box-shadow: 0px 4px 8px 0px rgba(119, 125, 130, 0.15);
|
83
163
|
}
|
84
164
|
|
85
|
-
|
165
|
+
.compact-scroll-wrapper1 {
|
166
|
+
max-height: 164px;
|
167
|
+
overflow-y: auto;
|
168
|
+
width: 60px;
|
169
|
+
}
|
86
170
|
|
87
|
-
.
|
88
|
-
max-height: 144px;
|
171
|
+
.compact-dropdown1 nile-menu {
|
89
172
|
overflow-y: auto;
|
173
|
+
padding: var(--nile-spacing-spacing-lg) var(--nile-spacing-spacing-none);
|
174
|
+
box-shadow: 0px 4px 8px 0px rgba(119, 125, 130, 0.15);
|
90
175
|
}
|
176
|
+
|
177
|
+
.compact-dropdown1 nile-menu {
|
178
|
+
overflow-y: auto;
|
179
|
+
padding: var(--nile-spacing-spacing-lg) var(--nile-spacing-spacing-none);
|
180
|
+
box-shadow: 0px 4px 8px 0px rgba(119, 125, 130, 0.15);
|
181
|
+
}
|
182
|
+
|
91
183
|
|
92
|
-
|
93
|
-
|
184
|
+
.ellipsis-dropdown nile-menu {
|
185
|
+
overflow-y: auto;
|
186
|
+
padding: var(--nile-spacing-spacing-lg) var(--nile-spacing-spacing-none);
|
187
|
+
box-shadow: 0px 4px 8px 0px rgba(119, 125, 130, 0.15);
|
94
188
|
}
|
95
|
-
|
96
|
-
|
189
|
+
|
190
|
+
.page-size-menu {
|
191
|
+
max-height: 144px;
|
192
|
+
overflow-y: auto;
|
97
193
|
}
|
98
194
|
|
195
|
+
.pagination-wrapper.fluid ul.pagination li:first-child {
|
196
|
+
margin-right: var(--nile-spacing-spacing-xs);
|
197
|
+
}
|
198
|
+
.pagination-wrapper.fluid ul.pagination li:last-child {
|
199
|
+
margin-left: var(--nile-spacing-spacing-md);
|
200
|
+
}
|
201
|
+
|
202
|
+
|
99
203
|
.page-size-label {
|
100
|
-
font-size: var(--nile-type-scale-3
|
101
|
-
color: var(--nile-colors-dark-500
|
102
|
-
margin-left: var(--nile-spacing-spacing-md
|
204
|
+
font-size: var(--nile-type-scale-3);
|
205
|
+
color: var(--nile-colors-dark-500);
|
206
|
+
margin-left: var(--nile-spacing-spacing-md);
|
103
207
|
font-feature-settings: 'liga' off, 'clig' off;
|
104
|
-
font-weight: var(--nile-font-weight-regular
|
208
|
+
font-weight: var(--nile-font-weight-regular);
|
105
209
|
}
|
106
210
|
|
107
211
|
nile-button::part(base) {
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
}
|
212
|
+
min-width: 32px;
|
213
|
+
height: 32px;
|
214
|
+
padding: 0px 6px;
|
215
|
+
box-shadow: none;
|
216
|
+
}
|
114
217
|
|
115
218
|
nile-button::part(base):active {
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
}
|
122
|
-
|
123
|
-
nile-button.down::part(base){
|
124
|
-
min-width: 62px;
|
125
|
-
border: 1px solid var(--nile-colors-neutral-500, var(--ng-colors-border-primary));
|
126
|
-
}
|
127
|
-
|
128
|
-
nile-button.arrow::part(base){
|
129
|
-
border: 1px solid var(--nile-colors-neutral-500, var(--ng-colors-border-primary));
|
130
|
-
}
|
131
|
-
|
132
|
-
.page-size-dropdown .chevron {
|
133
|
-
transition: transform 0.2s;
|
134
|
-
}
|
135
|
-
.page-size-dropdown .open .chevron {
|
136
|
-
transform: rotate(180deg);
|
137
|
-
}
|
138
|
-
|
219
|
+
min-width: 32px;
|
220
|
+
height: 32px;
|
221
|
+
padding: 0px 6px;
|
222
|
+
box-shadow: none;
|
223
|
+
border: none;
|
224
|
+
}
|
139
225
|
|
226
|
+
nile-button.down::part(base) {
|
227
|
+
min-width: 62px;
|
228
|
+
}
|
140
229
|
|
230
|
+
nile-button.compactbtn:part(base){
|
231
|
+
background-color: red;
|
232
|
+
}
|
233
|
+
.page-size-dropdown .chevron {
|
234
|
+
transition: transform 0.2s;
|
235
|
+
}
|
236
|
+
.page-size-dropdown .open .chevron {
|
237
|
+
transform: rotate(180deg);
|
238
|
+
}
|
239
|
+
|
240
|
+
.pagination-wrapper.compact .compact-dropdown .chevron,
|
241
|
+
.pagination-wrapper.compact .compact-dropdown1 .chevron {
|
242
|
+
transition: transform 0.2s;
|
243
|
+
}
|
244
|
+
.pagination-wrapper.compact .compact-dropdown .down.open .chevron,
|
245
|
+
.pagination-wrapper.compact .compact-dropdown1 .current-page-btn.open .chevron {
|
246
|
+
transform: rotate(180deg);
|
247
|
+
}
|
141
248
|
|
142
249
|
|
143
250
|
`;
|
@@ -4,6 +4,7 @@
|
|
4
4
|
* This source code is licensed under the BSD-3-Clause license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
|
+
|
7
8
|
import { LitElement, html, CSSResultArray, TemplateResult } from 'lit';
|
8
9
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
9
10
|
import { styles } from './nile-pagination.css';
|
@@ -21,33 +22,51 @@ export class NilePagination extends NileElement {
|
|
21
22
|
return [styles];
|
22
23
|
}
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
@property({attribute: 'totalitems',reflect: true,converter: {
|
26
|
+
fromAttribute: (v: string) => {
|
27
|
+
const n = Number(v);
|
28
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : 0;
|
29
|
+
},
|
30
|
+
},
|
31
|
+
})totalItems: number = 0;
|
31
32
|
|
32
|
-
@property({attribute: '
|
33
|
+
@property({attribute: 'currentpage', reflect: true, converter: {
|
34
|
+
fromAttribute: (v: string) => {
|
33
35
|
const n = Number(v);
|
34
|
-
return Number.isFinite(n) && n >= 1 ? Math.floor(n) :
|
36
|
+
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 1;
|
37
|
+
},
|
38
|
+
},
|
39
|
+
})currentPage: number = 1;
|
35
40
|
|
41
|
+
@property({attribute: 'pagesize',reflect: true,converter: {
|
42
|
+
fromAttribute: (v: string) => {
|
43
|
+
const n = Number(v);
|
44
|
+
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : 50;
|
45
|
+
},
|
46
|
+
},
|
47
|
+
})pageSize: number = 50;
|
36
48
|
|
37
|
-
@property({ attribute: 'pagesizeoptions', reflect: false,converter: { fromAttribute: (v: string) => {
|
49
|
+
@property({ attribute: 'pagesizeoptions', reflect: false, converter: { fromAttribute: (v: string) => {
|
50
|
+
try {
|
51
|
+
const arr = JSON.parse(v);
|
38
52
|
if (Array.isArray(arr) && arr.every(x => typeof x === 'number')) {
|
39
53
|
return arr as number[];
|
40
54
|
}
|
41
|
-
} catch {}
|
55
|
+
} catch {}
|
56
|
+
return [10, 25, 50, 100];
|
57
|
+
}}})
|
58
|
+
pageSizeOptions: number[] = [10, 25, 50, 100];
|
42
59
|
|
43
|
-
@property({ type: String })
|
60
|
+
@property({ type: String })variant: 'fluid' | 'compact' = 'fluid';
|
44
61
|
@property({ type: Boolean }) disabled = false;
|
45
62
|
@property({ type: Boolean }) showTitle = true;
|
46
63
|
|
47
64
|
@state() private _pageSizeOpen = false;
|
65
|
+
@state() private _pageOpen = false;
|
48
66
|
@query('.page-size-dropdown') private _pageSizeDropdown!: HTMLElement;
|
49
67
|
|
50
68
|
firstUpdated() {
|
69
|
+
if (this._pageSizeDropdown) {
|
51
70
|
this._pageSizeDropdown.addEventListener('nile-show', () => {
|
52
71
|
this._pageSizeOpen = true;
|
53
72
|
});
|
@@ -55,31 +74,49 @@ export class NilePagination extends NileElement {
|
|
55
74
|
this._pageSizeOpen = false;
|
56
75
|
});
|
57
76
|
}
|
58
|
-
|
77
|
+
}
|
78
|
+
|
59
79
|
private get totalPages(): number {
|
60
80
|
return Math.max(1, calculateTotalPages(this.totalItems, this.pageSize));
|
61
81
|
}
|
62
82
|
|
63
|
-
private goToPage(
|
83
|
+
private goToPage(newPage: number) {
|
84
|
+
|
64
85
|
if (this.disabled) return;
|
65
|
-
this.currentPage
|
66
|
-
this.
|
86
|
+
const previousPage = this.currentPage;
|
87
|
+
this.currentPage = newPage;
|
88
|
+
this.emit('nile-change', { page: newPage, previousPage, pageSize: this.pageSize });
|
67
89
|
}
|
68
90
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
91
|
+
private onPageSizeSelect(newSize: number) {
|
92
|
+
if (this.disabled || this.pageSize === newSize) return;
|
93
|
+
|
94
|
+
const previousPage = this.currentPage;
|
95
|
+
this.pageSize = newSize;
|
96
|
+
this.currentPage = 1;
|
97
|
+
this.emit('nile-change', {
|
98
|
+
page: 1,
|
99
|
+
previousPage,
|
100
|
+
pageSize: newSize
|
101
|
+
});
|
102
|
+
}
|
103
|
+
|
104
|
+
private renderCompactRangeText(): TemplateResult {
|
105
|
+
const full = getRangeText(this.totalItems, this.pageSize, this.currentPage);
|
106
|
+
const trimmed = full.replace(/^Showing\s*/, '');
|
107
|
+
return html`<div class="range-text">${trimmed}</div>`;
|
108
|
+
}
|
109
|
+
|
75
110
|
|
76
111
|
private renderRangeText(): TemplateResult {
|
77
112
|
if (this.totalItems === 0) {
|
78
113
|
return html`<div class="range-text">Showing 0 of 0</div>`;
|
79
114
|
}
|
80
|
-
return html
|
81
|
-
|
82
|
-
|
115
|
+
return html`
|
116
|
+
<div part="range-text" class="range-text">
|
117
|
+
${getRangeText(this.totalItems, this.pageSize, this.currentPage)}
|
118
|
+
</div>
|
119
|
+
`;
|
83
120
|
}
|
84
121
|
|
85
122
|
private renderPageSizeSelect(): TemplateResult | null {
|
@@ -87,13 +124,65 @@ export class NilePagination extends NileElement {
|
|
87
124
|
return html`
|
88
125
|
<div class="page-size-select">
|
89
126
|
<nile-dropdown class="page-size-dropdown" ?disabled=${this.disabled}>
|
90
|
-
<nile-button
|
127
|
+
<nile-button
|
128
|
+
slot="trigger"
|
129
|
+
variant="tertiary"
|
130
|
+
class="down ${this._pageSizeOpen ? 'open' : ''}"
|
91
131
|
?disabled=${this.disabled}
|
92
132
|
>
|
93
133
|
${this.pageSize}
|
94
|
-
<nile-icon
|
134
|
+
<nile-icon
|
135
|
+
name="chevrondown"
|
136
|
+
size="14"
|
137
|
+
color="var(--nile-colors-dark-500)"
|
138
|
+
class="chevron"
|
139
|
+
></nile-icon>
|
95
140
|
</nile-button>
|
96
|
-
<nile-menu
|
141
|
+
<nile-menu>
|
142
|
+
<div class="down-scroll-wrapper">
|
143
|
+
${this.pageSizeOptions.map(
|
144
|
+
size => html`
|
145
|
+
<nile-menu-item
|
146
|
+
?disabled=${this.disabled}
|
147
|
+
@click=${() => this.onPageSizeSelect(size)}
|
148
|
+
>
|
149
|
+
${size}
|
150
|
+
</nile-menu-item>
|
151
|
+
`
|
152
|
+
)}
|
153
|
+
</div>
|
154
|
+
</nile-menu>
|
155
|
+
</nile-dropdown>
|
156
|
+
<span part="pagesize-label" class="page-size-label">Items per page</span>
|
157
|
+
</div>
|
158
|
+
`;
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
private renderCompactPageSize(): TemplateResult {
|
163
|
+
return html`
|
164
|
+
<nile-dropdown
|
165
|
+
class="compact-dropdown"
|
166
|
+
?disabled=${this.disabled}
|
167
|
+
@nile-show=${() => (this._pageSizeOpen = true)}
|
168
|
+
@nile-after-hide=${() => (this._pageSizeOpen = false)}
|
169
|
+
>
|
170
|
+
<nile-button
|
171
|
+
slot="trigger"
|
172
|
+
variant="tertiary"
|
173
|
+
class="down ${this._pageSizeOpen ? 'open' : ''}"
|
174
|
+
?disabled=${this.disabled}
|
175
|
+
>
|
176
|
+
${this.pageSize}
|
177
|
+
<nile-icon
|
178
|
+
name="chevrondown"
|
179
|
+
size="14"
|
180
|
+
color="var(--nile-colors-dark-500)"
|
181
|
+
class="chevron"
|
182
|
+
></nile-icon>
|
183
|
+
</nile-button>
|
184
|
+
<nile-menu>
|
185
|
+
<div class="compact-scroll-wrapper">
|
97
186
|
${this.pageSizeOptions.map(
|
98
187
|
size => html`
|
99
188
|
<nile-menu-item
|
@@ -101,25 +190,25 @@ export class NilePagination extends NileElement {
|
|
101
190
|
@click=${() => this.onPageSizeSelect(size)}
|
102
191
|
>
|
103
192
|
${size}
|
104
|
-
</nile-menu-item
|
193
|
+
</nile-menu-item>
|
194
|
+
`
|
105
195
|
)}
|
106
|
-
</
|
107
|
-
</nile-
|
108
|
-
|
109
|
-
</div>
|
196
|
+
</div>
|
197
|
+
</nile-menu>
|
198
|
+
</nile-dropdown>
|
110
199
|
`;
|
111
200
|
}
|
201
|
+
|
112
202
|
|
113
203
|
private renderPrevButton(): TemplateResult {
|
114
204
|
return html`
|
115
205
|
<li>
|
116
206
|
<nile-button
|
117
|
-
class="arrow"
|
118
207
|
variant="tertiary"
|
119
208
|
?disabled=${this.currentPage === 1 || this.disabled}
|
120
209
|
@click=${() => this.goToPage(this.currentPage - 1)}
|
121
210
|
>
|
122
|
-
<nile-icon name="arrowleft"
|
211
|
+
<nile-icon name="arrowleft" size="14"></nile-icon>
|
123
212
|
</nile-button>
|
124
213
|
</li>
|
125
214
|
`;
|
@@ -130,11 +219,10 @@ export class NilePagination extends NileElement {
|
|
130
219
|
<li>
|
131
220
|
<nile-button
|
132
221
|
variant="tertiary"
|
133
|
-
class="arrow"
|
134
222
|
?disabled=${this.currentPage === this.totalPages || this.disabled}
|
135
223
|
@click=${() => this.goToPage(this.currentPage + 1)}
|
136
224
|
>
|
137
|
-
<nile-icon name="arrowright"
|
225
|
+
<nile-icon name="arrowright" size="14"></nile-icon>
|
138
226
|
</nile-button>
|
139
227
|
</li>
|
140
228
|
`;
|
@@ -166,7 +254,8 @@ export class NilePagination extends NileElement {
|
|
166
254
|
@click=${() => this.goToPage(page)}
|
167
255
|
>
|
168
256
|
${page}
|
169
|
-
</nile-menu-item
|
257
|
+
</nile-menu-item>
|
258
|
+
`
|
170
259
|
)}
|
171
260
|
</div>
|
172
261
|
</nile-menu>
|
@@ -174,7 +263,6 @@ export class NilePagination extends NileElement {
|
|
174
263
|
</li>
|
175
264
|
`;
|
176
265
|
}
|
177
|
-
|
178
266
|
return html`
|
179
267
|
<li>
|
180
268
|
<nile-button
|
@@ -189,10 +277,56 @@ export class NilePagination extends NileElement {
|
|
189
277
|
}
|
190
278
|
|
191
279
|
private renderPageList(): TemplateResult {
|
280
|
+
if (this.variant === 'compact') {
|
281
|
+
return html`
|
282
|
+
<nav aria-label="Pagination">
|
283
|
+
<ul class="pagination compact-pagination">
|
284
|
+
${this.renderPrevButton()}
|
285
|
+
<li>
|
286
|
+
<nile-dropdown
|
287
|
+
class="compact-dropdown1"
|
288
|
+
?disabled=${this.disabled}
|
289
|
+
@nile-show=${() => (this._pageOpen = true)}
|
290
|
+
@nile-after-hide=${() => (this._pageOpen = false)}
|
291
|
+
>
|
292
|
+
<nile-button
|
293
|
+
slot="trigger"
|
294
|
+
variant="tertiary"
|
295
|
+
class="current-page-btn ${this._pageOpen ? 'open' : ''}"
|
296
|
+
?disabled=${this.disabled}
|
297
|
+
>
|
298
|
+
${this.currentPage}
|
299
|
+
<nile-icon
|
300
|
+
name="chevrondown"
|
301
|
+
size="14"
|
302
|
+
class="chevron"
|
303
|
+
></nile-icon>
|
304
|
+
</nile-button>
|
305
|
+
<nile-menu>
|
306
|
+
<div class="compact-scroll-wrapper1">
|
307
|
+
${Array.from({ length: this.totalPages }, (_, i) => i + 1).map(
|
308
|
+
p => html`
|
309
|
+
<nile-menu-item
|
310
|
+
?disabled=${this.disabled}
|
311
|
+
@click=${() => this.goToPage(p)}
|
312
|
+
>
|
313
|
+
${p}
|
314
|
+
</nile-menu-item>
|
315
|
+
`
|
316
|
+
)}
|
317
|
+
</div>
|
318
|
+
</nile-menu>
|
319
|
+
</nile-dropdown>
|
320
|
+
</li>
|
321
|
+
${this.renderNextButton()}
|
322
|
+
</ul>
|
323
|
+
</nav>
|
324
|
+
`;
|
325
|
+
}
|
192
326
|
const items = getPaginationItems(this.totalPages, this.currentPage);
|
193
327
|
return html`
|
194
328
|
<nav aria-label="Pagination">
|
195
|
-
<ul class="pagination">
|
329
|
+
<ul part="page-list" class="pagination">
|
196
330
|
${this.renderPrevButton()}
|
197
331
|
${items.map((item, idx) => this.renderPageItem(item, idx, items))}
|
198
332
|
${this.renderNextButton()}
|
@@ -201,17 +335,23 @@ export class NilePagination extends NileElement {
|
|
201
335
|
`;
|
202
336
|
}
|
203
337
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
338
|
+
public render(): TemplateResult {
|
339
|
+
return html`
|
340
|
+
<div part="wrapper" class="pagination-wrapper ${this.variant}">
|
341
|
+
<div part="pager-container" class="pager-container">
|
342
|
+
${this.variant === 'fluid' && this.showTitle
|
343
|
+
? this.renderRangeText()
|
344
|
+
: this.variant === 'compact'
|
345
|
+
? this.renderCompactRangeText()
|
346
|
+
: null}
|
347
|
+
${this.variant === 'fluid'
|
348
|
+
? this.renderPageSizeSelect()
|
349
|
+
: this.renderCompactPageSize()}
|
212
350
|
</div>
|
213
|
-
|
214
|
-
|
351
|
+
${this.renderPageList()}
|
352
|
+
</div>
|
353
|
+
`;
|
354
|
+
}
|
215
355
|
}
|
216
356
|
|
217
357
|
declare global {
|
@@ -36,7 +36,7 @@ export const styles = css`
|
|
36
36
|
width: 100%;
|
37
37
|
align-items: center;
|
38
38
|
border-radius: var(--tab-border-radius);
|
39
|
-
color: var(--nile-colors-
|
39
|
+
color: var(--nile-colors-gray-light-mode-500, var(--ng-colors-text-quaternary-500));
|
40
40
|
padding: var(--tab-padding);
|
41
41
|
white-space: nowrap;
|
42
42
|
user-select: none;
|