@ucd-lib/theme-elements 2.1.0 → 2.1.1

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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucd-lib/theme-elements",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Custom elements for the UCD brand theme",
5
5
  "main": "index.js",
6
6
  "scripts": {