@ucd-lib/theme-elements 2.1.0 → 2.1.2
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.
|
@@ -140,6 +140,11 @@ export default class UcdThemePagination extends LitElement {
|
|
|
140
140
|
* @returns {HTML}
|
|
141
141
|
*/
|
|
142
142
|
_renderLink(page, args={}) {
|
|
143
|
+
if( this.ellipses && typeof page === 'object' ) {
|
|
144
|
+
args.label = args.label || page.label || '';
|
|
145
|
+
page = page.page || 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
143
148
|
if( page < 1 ) page = 1;
|
|
144
149
|
if( page > this.maxPages ) page = this.maxPages;
|
|
145
150
|
|
|
@@ -211,11 +216,11 @@ export default class UcdThemePagination extends LitElement {
|
|
|
211
216
|
if ((this.currentPage <= endIndex - 4) && (this.currentPage >= startIndex + 4)){
|
|
212
217
|
for( let i = startIndex; i < endIndex; i++ ) {
|
|
213
218
|
if(i == 0) pages.push(i+1);
|
|
214
|
-
else if (i == (startIndex + 1)) pages.push(
|
|
219
|
+
else if (i == (startIndex + 1)) pages.push({ page: this.currentPage - 3, label: '...' });
|
|
215
220
|
else if (i > (startIndex + 1) && i < this.currentPage - 3) continue;
|
|
216
221
|
else if (i >= (this.currentPage - 3) && i < (this.currentPage + 2)) pages.push(i+1);
|
|
217
222
|
else if (i < 4 && i < this.currentPage + 2) continue;
|
|
218
|
-
else if (i == (endIndex - 2)) pages.push(
|
|
223
|
+
else if (i == (endIndex - 2)) pages.push({ page: this.currentPage + 3, label: '...' });
|
|
219
224
|
else if (i == endIndex - 1) pages.push(i+1);
|
|
220
225
|
}
|
|
221
226
|
} //Middle ellipses
|
|
@@ -223,14 +228,14 @@ export default class UcdThemePagination extends LitElement {
|
|
|
223
228
|
for( let i = startIndex; i < endIndex; i++ ) {
|
|
224
229
|
if (i == 0) pages.push(i+1);
|
|
225
230
|
else if(i > 0 && i < (endIndex - 6)) continue;
|
|
226
|
-
else if (i == (endIndex - 6)) pages.push(
|
|
231
|
+
else if (i == (endIndex - 6)) pages.push({ page: i+1, label: '...' });
|
|
227
232
|
else pages.push(i+1);
|
|
228
233
|
}
|
|
229
234
|
} //Left ellipses
|
|
230
235
|
else if(this.currentPage <= endIndex - 4){
|
|
231
236
|
for( let i = startIndex; i < endIndex; i++ ) {
|
|
232
237
|
if(i < 6) pages.push(i+1);
|
|
233
|
-
else if (i == 6) pages.push(
|
|
238
|
+
else if (i == 6) pages.push({ page: i+1, label: '...' });
|
|
234
239
|
else if (i > 6 && i < (endIndex - 2)) continue;
|
|
235
240
|
else if (i == endIndex - 1) pages.push(i+1);
|
|
236
241
|
}
|
|
@@ -16,7 +16,11 @@ export function styles() {
|
|
|
16
16
|
}
|
|
17
17
|
.search-form__submit {
|
|
18
18
|
line-height: 1.9;
|
|
19
|
-
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
letter-spacing: normal;
|
|
23
|
+
text-indent: inherit;
|
|
20
24
|
}
|
|
21
25
|
`;
|
|
22
26
|
return [
|
|
@@ -45,8 +49,7 @@ return html`
|
|
|
45
49
|
name=${this.queryParam}
|
|
46
50
|
@input="${this._onInput}"
|
|
47
51
|
value="${this.value}">
|
|
48
|
-
<button type="submit" class="search-form__submit">
|
|
49
|
-
</button>
|
|
52
|
+
<button type="submit" class="search-form__submit"></button>
|
|
50
53
|
|
|
51
54
|
</form>
|
|
52
55
|
`;}
|