gd-bs 6.9.0 → 6.9.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.
- package/build/bs.js +1 -1
- package/build/components/dropdown/index.js +5 -0
- package/build/components/pagination/index.js +283 -80
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +2 -1
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.js.LICENSE.txt +20 -0
- package/dist/gd-bs.min.js +1 -1
- package/indexv2.html +1 -1
- package/package.json +1 -1
- package/src/components/dropdown/index.ts +6 -0
- package/src/components/pagination/index.ts +300 -84
- package/src/components/pagination/types.d.ts +2 -1
- package/src/styles/_custom.scss +12 -0
package/indexv2.html
CHANGED
package/package.json
CHANGED
|
@@ -82,6 +82,12 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
|
|
|
82
82
|
// Render the items
|
|
83
83
|
this.renderItems();
|
|
84
84
|
|
|
85
|
+
// See if values were defined
|
|
86
|
+
if (this.props.value) {
|
|
87
|
+
// Set the values
|
|
88
|
+
this.setValue(this.props.value);
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
// Set the menu element
|
|
86
92
|
this._elMenu = this.el.querySelector(".dropdown-menu");
|
|
87
93
|
if (this._elMenu) {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { IPagination, IPaginationProps } from "./types";
|
|
2
2
|
import { Base } from "../base";
|
|
3
|
+
import { skipBackward } from "../../icons/svgs/skipBackward";
|
|
4
|
+
import { skipForward } from "../../icons/svgs/skipForward";
|
|
5
|
+
import { skipEnd } from "../../icons/svgs/skipEnd";
|
|
6
|
+
import { skipStart } from "../../icons/svgs/skipStart";
|
|
3
7
|
import { HTML, HTMLItem } from "./templates";
|
|
4
8
|
|
|
5
9
|
/**
|
|
@@ -15,13 +19,24 @@ export enum PaginationAlignment {
|
|
|
15
19
|
* Pagination
|
|
16
20
|
*/
|
|
17
21
|
class _Pagination extends Base<IPaginationProps> implements IPagination {
|
|
22
|
+
private _activePage: number = null;
|
|
18
23
|
private _elList: HTMLUListElement = null;
|
|
19
24
|
private _items: Array<HTMLLIElement> = null;
|
|
25
|
+
private _showDefault: boolean = true;
|
|
26
|
+
|
|
27
|
+
// Buttons
|
|
28
|
+
private _buttons: {
|
|
29
|
+
First: HTMLLIElement, Last: HTMLLIElement, Next: HTMLLIElement, Previous: HTMLLIElement,
|
|
30
|
+
SkipBack10: HTMLLIElement, SkipBack5: HTMLLIElement, SkipForward5: HTMLLIElement, SkipForward10: HTMLLIElement
|
|
31
|
+
} = null;
|
|
20
32
|
|
|
21
33
|
// Constructor
|
|
22
34
|
constructor(props: IPaginationProps, template: string = HTML, itemTemplate: string = HTMLItem) {
|
|
23
35
|
super(template, props);
|
|
24
36
|
|
|
37
|
+
// Create the default buttons
|
|
38
|
+
this.createButtons(itemTemplate);
|
|
39
|
+
|
|
25
40
|
// Configure the collapse
|
|
26
41
|
this.configure(itemTemplate);
|
|
27
42
|
|
|
@@ -53,37 +68,45 @@ class _Pagination extends Base<IPaginationProps> implements IPagination {
|
|
|
53
68
|
}
|
|
54
69
|
|
|
55
70
|
// Render the page numbers
|
|
56
|
-
this.renderPageNumbers(
|
|
71
|
+
this.renderPageNumbers(itemTemplate);
|
|
57
72
|
}
|
|
58
73
|
}
|
|
59
74
|
|
|
60
|
-
// Configures the
|
|
61
|
-
private
|
|
75
|
+
// Configures the default buttons, based on the active index
|
|
76
|
+
private configureDefaultButtons() {
|
|
62
77
|
// Update the previous button
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
78
|
+
if (this._activePage == 1) {
|
|
79
|
+
// Ensure the first/previous item is disabled
|
|
80
|
+
this._buttons.First.classList.add("disabled");
|
|
81
|
+
this._buttons.Previous.classList.add("disabled");
|
|
67
82
|
} else {
|
|
68
|
-
// Ensure the previous item is enabled
|
|
69
|
-
|
|
83
|
+
// Ensure the first/previous item is enabled
|
|
84
|
+
this._buttons.First.classList.remove("disabled");
|
|
85
|
+
this._buttons.Previous.classList.remove("disabled");
|
|
70
86
|
}
|
|
71
87
|
|
|
72
|
-
// Update the next button
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
// Update the next/last button
|
|
89
|
+
if (this._activePage == this._items.length) {
|
|
90
|
+
// Ensure the next/last item is disabled
|
|
91
|
+
this._buttons.Next.classList.add("disabled");
|
|
92
|
+
this._buttons.Last.classList.add("disabled");
|
|
77
93
|
} else {
|
|
78
|
-
// Ensure the
|
|
79
|
-
|
|
94
|
+
// Ensure the next/last item is enabled
|
|
95
|
+
this._buttons.Next.classList.remove("disabled");
|
|
96
|
+
this._buttons.Last.classList.remove("disabled");
|
|
80
97
|
}
|
|
81
98
|
}
|
|
82
99
|
|
|
83
100
|
// Configure the events
|
|
84
|
-
private configureEvents(item: HTMLLIElement) {
|
|
85
|
-
// See if this is
|
|
101
|
+
private configureEvents(item: HTMLLIElement, itemTemplate: string) {
|
|
102
|
+
// See if this is a spacer
|
|
86
103
|
let link = item.querySelector("a").getAttribute("aria-label");
|
|
104
|
+
if (link == "...") {
|
|
105
|
+
// Do nothing
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// See if this is the next or previous item and skip it
|
|
87
110
|
if (link == "Previous" || link == "Next") {
|
|
88
111
|
let isPrevious = link == "Previous";
|
|
89
112
|
|
|
@@ -95,26 +118,88 @@ class _Pagination extends Base<IPaginationProps> implements IPagination {
|
|
|
95
118
|
// Do nothing if it's disabled
|
|
96
119
|
if (item.classList.contains("disabled")) { return; }
|
|
97
120
|
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
121
|
+
// Update the active page
|
|
122
|
+
isPrevious ? this._activePage-- : this._activePage++;
|
|
123
|
+
|
|
124
|
+
// See if we are rendering the default
|
|
125
|
+
if (this._showDefault) {
|
|
126
|
+
// Click the item
|
|
127
|
+
this._items[this._activePage]?.click();
|
|
128
|
+
} else {
|
|
129
|
+
// Render the active buttons
|
|
130
|
+
this.renderActivePageNumbers(itemTemplate);
|
|
131
|
+
|
|
132
|
+
// Call the click event
|
|
133
|
+
this.props.onClick ? this.props.onClick(this._activePage) : null;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
} else if (link == "First" || link == "Last") {
|
|
137
|
+
let isLast = link == "Last";
|
|
138
|
+
|
|
139
|
+
// Add a click event
|
|
140
|
+
item.addEventListener("click", ev => {
|
|
141
|
+
// Prevent the page from moving to the top
|
|
142
|
+
ev.preventDefault();
|
|
143
|
+
|
|
144
|
+
// Do nothing if it's disabled
|
|
145
|
+
if (item.classList.contains("disabled")) { return; }
|
|
146
|
+
|
|
147
|
+
// See if we are rendering the default
|
|
148
|
+
if (this._showDefault) {
|
|
149
|
+
// See if this is the last item
|
|
150
|
+
if (isLast) {
|
|
151
|
+
// Click on the last item
|
|
152
|
+
this._items[this._items.length - 1]?.click();
|
|
153
|
+
} else {
|
|
154
|
+
// Click on the first item
|
|
155
|
+
this._items[0]?.click();
|
|
115
156
|
}
|
|
157
|
+
} else {
|
|
158
|
+
// Update the active page
|
|
159
|
+
this._activePage = isLast ? this.props.numberOfPages : 1;
|
|
160
|
+
|
|
161
|
+
// Render the active buttons
|
|
162
|
+
this.renderActivePageNumbers(itemTemplate);
|
|
163
|
+
|
|
164
|
+
// Call the click event
|
|
165
|
+
this.props.onClick ? this.props.onClick(this._activePage) : null;
|
|
116
166
|
}
|
|
117
167
|
});
|
|
168
|
+
} else if (link == "<<" || link == "<" || link == ">" || link == ">>") {
|
|
169
|
+
// Add a click event
|
|
170
|
+
item.addEventListener("click", ev => {
|
|
171
|
+
// Prevent the page from moving to the top
|
|
172
|
+
ev.preventDefault();
|
|
173
|
+
|
|
174
|
+
// Update the active page
|
|
175
|
+
switch (link) {
|
|
176
|
+
case "<<":
|
|
177
|
+
this._activePage -= 10;
|
|
178
|
+
break;
|
|
179
|
+
case "<":
|
|
180
|
+
this._activePage -= 5;
|
|
181
|
+
break;
|
|
182
|
+
case ">":
|
|
183
|
+
this._activePage += 5;
|
|
184
|
+
break;
|
|
185
|
+
case ">>":
|
|
186
|
+
this._activePage += 10;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Validate the page number
|
|
191
|
+
if (this._activePage <= 0) {
|
|
192
|
+
this._activePage = 1;
|
|
193
|
+
} else if (this._activePage > this.props.numberOfPages) {
|
|
194
|
+
this._activePage = this.props.numberOfPages;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Render the active buttons
|
|
198
|
+
this.renderActivePageNumbers(itemTemplate);
|
|
199
|
+
|
|
200
|
+
// Call the click event
|
|
201
|
+
this.props.onClick ? this.props.onClick(this._activePage) : null;
|
|
202
|
+
});
|
|
118
203
|
} else {
|
|
119
204
|
let pageNumber = parseInt(link);
|
|
120
205
|
|
|
@@ -123,44 +208,81 @@ class _Pagination extends Base<IPaginationProps> implements IPagination {
|
|
|
123
208
|
// Prevent the page from moving to the top
|
|
124
209
|
ev.preventDefault();
|
|
125
210
|
|
|
126
|
-
//
|
|
127
|
-
|
|
128
|
-
for (let i = 0; i < activeItems.length; i++) {
|
|
129
|
-
let item = activeItems[i];
|
|
211
|
+
// Set the active index
|
|
212
|
+
this._activePage = pageNumber;
|
|
130
213
|
|
|
131
|
-
|
|
132
|
-
|
|
214
|
+
// See if we are showing the default
|
|
215
|
+
if (this._showDefault) {
|
|
216
|
+
// Clear the active item
|
|
217
|
+
let activeItem = this._items[this._activePage - 1];
|
|
218
|
+
if (activeItem) {
|
|
219
|
+
// Clear the active class
|
|
220
|
+
activeItem.classList.remove("active");
|
|
133
221
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
222
|
+
// Remove the active span
|
|
223
|
+
let span = activeItem.querySelector("span") as HTMLSpanElement;
|
|
224
|
+
span ? span.parentNode.removeChild(span) : null;
|
|
225
|
+
}
|
|
138
226
|
|
|
139
|
-
|
|
140
|
-
|
|
227
|
+
// Show the active item
|
|
228
|
+
this._items[this._activePage - 1].classList.add("active");
|
|
141
229
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
230
|
+
// Add the span
|
|
231
|
+
let span = document.createElement("span");
|
|
232
|
+
span.classList.add("visually-hidden");
|
|
233
|
+
span.innerHTML = "(current)";
|
|
234
|
+
this._items[this._activePage - 1].appendChild(span);
|
|
147
235
|
|
|
148
|
-
|
|
149
|
-
|
|
236
|
+
// Configure the default buttons
|
|
237
|
+
this.configureDefaultButtons();
|
|
238
|
+
} else {
|
|
239
|
+
// Render the active buttons
|
|
240
|
+
this.renderActivePageNumbers(itemTemplate);
|
|
241
|
+
}
|
|
150
242
|
|
|
151
|
-
//
|
|
152
|
-
this.props.onClick ? this.props.onClick(pageNumber
|
|
243
|
+
// Call the click event
|
|
244
|
+
this.props.onClick ? this.props.onClick(pageNumber) : null;
|
|
153
245
|
});
|
|
154
246
|
}
|
|
155
247
|
}
|
|
156
248
|
|
|
249
|
+
// Creates the default buttons
|
|
250
|
+
private createButtons(itemTemplate: string) {
|
|
251
|
+
this._buttons = {
|
|
252
|
+
First: this.createItem("First", itemTemplate, true),
|
|
253
|
+
Last: this.createItem("Last", itemTemplate, true),
|
|
254
|
+
Next: this.createItem("Next", itemTemplate, true),
|
|
255
|
+
Previous: this.createItem("Previous", itemTemplate, true),
|
|
256
|
+
SkipBack10: this.createItem("<<", itemTemplate, true),
|
|
257
|
+
SkipBack5: this.createItem("<", itemTemplate, true),
|
|
258
|
+
SkipForward5: this.createItem(">", itemTemplate, true),
|
|
259
|
+
SkipForward10: this.createItem(">>", itemTemplate, true)
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// Set the default classes
|
|
263
|
+
this._buttons.First.classList.add("first");
|
|
264
|
+
this._buttons.Last.classList.add("last");
|
|
265
|
+
this._buttons.Next.classList.add("next");
|
|
266
|
+
this._buttons.Previous.classList.add("previous");
|
|
267
|
+
|
|
268
|
+
// Disable the first and previous buttons by default
|
|
269
|
+
this._buttons.First.classList.add("disabled");
|
|
270
|
+
this._buttons.Previous.classList.add("disabled");
|
|
271
|
+
|
|
272
|
+
// Set the icons
|
|
273
|
+
this._buttons.SkipBack10.querySelector("a").innerHTML = skipBackward(15, 15).outerHTML;
|
|
274
|
+
this._buttons.SkipBack5.querySelector("a").innerHTML = skipStart(15, 15).outerHTML;
|
|
275
|
+
this._buttons.SkipForward5.querySelector("a").innerHTML = skipEnd(15, 15).outerHTML;
|
|
276
|
+
this._buttons.SkipForward10.querySelector("a").innerHTML = skipForward(15, 15).outerHTML;
|
|
277
|
+
}
|
|
278
|
+
|
|
157
279
|
// Creates an page number item
|
|
158
|
-
private createItem(text: string, itemTemplate: string): HTMLLIElement {
|
|
280
|
+
private createItem(text: string, itemTemplate: string, isDefault: boolean = false): HTMLLIElement {
|
|
159
281
|
// Create the item
|
|
160
282
|
let el = document.createElement("div");
|
|
161
283
|
el.innerHTML = itemTemplate;
|
|
162
284
|
let item = el.firstChild as HTMLLIElement;
|
|
163
|
-
this._items.push(item);
|
|
285
|
+
isDefault ? null : this._items.push(item);
|
|
164
286
|
|
|
165
287
|
// Update the link
|
|
166
288
|
let link = item.querySelector("a");
|
|
@@ -170,49 +292,143 @@ class _Pagination extends Base<IPaginationProps> implements IPagination {
|
|
|
170
292
|
}
|
|
171
293
|
|
|
172
294
|
// Configure the events
|
|
173
|
-
this.configureEvents(item);
|
|
295
|
+
this.configureEvents(item, itemTemplate);
|
|
174
296
|
|
|
175
297
|
// Return the item
|
|
176
298
|
return item;
|
|
177
299
|
}
|
|
178
300
|
|
|
179
301
|
// Renders the page numbers
|
|
180
|
-
private renderPageNumbers(
|
|
302
|
+
private renderPageNumbers(itemTemplate: string) {
|
|
181
303
|
// Clear the items
|
|
304
|
+
this._activePage = 1;
|
|
182
305
|
this._items = [];
|
|
183
306
|
|
|
184
307
|
// Determine if there are > 10 pages
|
|
185
308
|
let pages = this.props.numberOfPages || 1;
|
|
186
|
-
let
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
309
|
+
let maxPages = typeof (this.props.maxPages) === "number" ? this.props.maxPages : 10;
|
|
310
|
+
this._showDefault = pages < maxPages;
|
|
311
|
+
|
|
312
|
+
// See if we are rendering the default
|
|
313
|
+
if (this._showDefault) {
|
|
314
|
+
// Append the first/previous link
|
|
315
|
+
this._elList.appendChild(this._buttons.First);
|
|
316
|
+
this._elList.appendChild(this._buttons.Previous);
|
|
317
|
+
|
|
318
|
+
// Loop for the number of pages to create
|
|
319
|
+
for (let i = 1; i <= pages; i++) {
|
|
320
|
+
// Create a link
|
|
321
|
+
let item = this.createItem(i.toString(), itemTemplate);
|
|
322
|
+
i == this._activePage ? item.classList.add("active") : null;
|
|
323
|
+
this._elList.appendChild(item);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Append the next/last link
|
|
327
|
+
this._elList.appendChild(this._buttons.Next);
|
|
328
|
+
this._elList.appendChild(this._buttons.Last);
|
|
329
|
+
if (pages == 1) {
|
|
330
|
+
this._buttons.Next.classList.add("disabled");
|
|
331
|
+
this._buttons.Last.classList.add("disabled");
|
|
332
|
+
}
|
|
333
|
+
} else {
|
|
334
|
+
// Render the active page numbers
|
|
335
|
+
this.renderActivePageNumbers(itemTemplate);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Renders the active page numbers
|
|
340
|
+
private renderActivePageNumbers(itemTemplate: string) {
|
|
341
|
+
// Clear the items and list element
|
|
342
|
+
this._items = [];
|
|
343
|
+
while (this._elList.firstChild) { this._elList.removeChild(this._elList.firstChild); }
|
|
344
|
+
|
|
345
|
+
// Append the first/previous link
|
|
346
|
+
this._elList.appendChild(this._buttons.First);
|
|
347
|
+
this._elList.appendChild(this._buttons.Previous);
|
|
348
|
+
if (this._activePage == 1) {
|
|
349
|
+
this._buttons.First.classList.add("disabled");
|
|
350
|
+
this._buttons.Previous.classList.add("disabled");
|
|
351
|
+
} else {
|
|
352
|
+
this._buttons.First.classList.remove("disabled");
|
|
353
|
+
this._buttons.Previous.classList.remove("disabled");
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// See if we are at the beginning
|
|
357
|
+
if (this._activePage < 5) {
|
|
358
|
+
// Render the first five
|
|
359
|
+
for (let i = 1; i <= 5; i++) {
|
|
360
|
+
// Create a link
|
|
361
|
+
let item = this.createItem(i.toString(), itemTemplate);
|
|
362
|
+
i == this._activePage ? item.classList.add("active") : null;
|
|
363
|
+
this._elList.appendChild(item);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// Render a spacer
|
|
367
|
+
let item = this.createItem("...", itemTemplate, true);
|
|
199
368
|
this._elList.appendChild(item);
|
|
369
|
+
|
|
370
|
+
// Render the last 3
|
|
371
|
+
let diff = Math.round((this.props.numberOfPages - 5) / 3);
|
|
372
|
+
for (let i = 2; i >= 0; i--) {
|
|
373
|
+
// Create a link
|
|
374
|
+
let idx = this.props.numberOfPages - i * diff;
|
|
375
|
+
let item = this.createItem((idx).toString(), itemTemplate);
|
|
376
|
+
this._elList.appendChild(item);
|
|
377
|
+
}
|
|
200
378
|
}
|
|
379
|
+
// Else, see if we are at the end
|
|
380
|
+
else if (this._activePage > this.props.numberOfPages - 5) {
|
|
381
|
+
|
|
382
|
+
// Render the first 3
|
|
383
|
+
let diff = Math.round((this.props.numberOfPages - 5) / 3);
|
|
384
|
+
for (let i = 0; i <= 2; i++) {
|
|
385
|
+
// Create a link
|
|
386
|
+
let idx = i == 0 ? 1 : i * diff;
|
|
387
|
+
let item = this.createItem((idx).toString(), itemTemplate);
|
|
388
|
+
this._elList.appendChild(item);
|
|
389
|
+
}
|
|
201
390
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
for (let i = 2; i <= pages; i++) {
|
|
205
|
-
// Create a link
|
|
206
|
-
item = this.createItem(i.toString(), itemTemplate);
|
|
207
|
-
i == activeItem ? item.classList.add("active") : null;
|
|
391
|
+
// Render a spacer
|
|
392
|
+
let item = this.createItem("...", itemTemplate, true);
|
|
208
393
|
this._elList.appendChild(item);
|
|
394
|
+
|
|
395
|
+
// Render the last five
|
|
396
|
+
for (let i = this.props.numberOfPages - 5; i <= this.props.numberOfPages; i++) {
|
|
397
|
+
// Create a link
|
|
398
|
+
let item = this.createItem(i.toString(), itemTemplate);
|
|
399
|
+
i == this._activePage ? item.classList.add("active") : null;
|
|
400
|
+
this._elList.appendChild(item);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// Else, render the skip buttons
|
|
404
|
+
else {
|
|
405
|
+
// Render the skip buttons
|
|
406
|
+
this._elList.appendChild(this._buttons.SkipBack10);
|
|
407
|
+
this._elList.appendChild(this._buttons.SkipBack5);
|
|
408
|
+
|
|
409
|
+
// Render +/- 2 from the active index
|
|
410
|
+
for (let i = this._activePage - 2; i <= this._activePage + 2; i++) {
|
|
411
|
+
// Create a link
|
|
412
|
+
let item = this.createItem(i.toString(), itemTemplate);
|
|
413
|
+
i == this._activePage ? item.classList.add("active") : null;
|
|
414
|
+
this._elList.appendChild(item);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// Render the skip buttons
|
|
418
|
+
this._elList.appendChild(this._buttons.SkipForward5);
|
|
419
|
+
this._elList.appendChild(this._buttons.SkipForward10);
|
|
209
420
|
}
|
|
210
421
|
|
|
211
|
-
//
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
422
|
+
// Append the next/last link
|
|
423
|
+
this._elList.appendChild(this._buttons.Next);
|
|
424
|
+
this._elList.appendChild(this._buttons.Last);
|
|
425
|
+
if (this._activePage == this.props.numberOfPages) {
|
|
426
|
+
this._buttons.Next.classList.add("disabled");
|
|
427
|
+
this._buttons.Last.classList.add("disabled");
|
|
428
|
+
} else {
|
|
429
|
+
this._buttons.Next.classList.remove("disabled");
|
|
430
|
+
this._buttons.Last.classList.remove("disabled");
|
|
431
|
+
}
|
|
216
432
|
}
|
|
217
433
|
}
|
|
218
434
|
export const Pagination = (props: IPaginationProps, template?: string, itemTemplate?: string): IPagination => { return new _Pagination(props, template, itemTemplate); }
|
|
@@ -62,8 +62,9 @@ export interface IPaginationProps extends IBaseProps<IPagination> {
|
|
|
62
62
|
isLarge?: boolean;
|
|
63
63
|
isSmall?: boolean;
|
|
64
64
|
label?: string;
|
|
65
|
+
maxPages?: number;
|
|
65
66
|
numberOfPages?: number;
|
|
66
|
-
onClick?: (pageNumber?: number
|
|
67
|
+
onClick?: (pageNumber?: number) => void;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
/**
|
package/src/styles/_custom.scss
CHANGED
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
-webkit-mask-repeat: no-repeat;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
.badge {
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
.bg-danger {
|
|
47
51
|
background-color: var(--sp-error-icon, #a80000) !important;
|
|
48
52
|
}
|
|
@@ -751,6 +755,14 @@
|
|
|
751
755
|
height: 100vh;
|
|
752
756
|
}
|
|
753
757
|
|
|
758
|
+
.page-item {
|
|
759
|
+
cursor: pointer;
|
|
760
|
+
|
|
761
|
+
.page-link {
|
|
762
|
+
cursor: pointer;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
754
766
|
/* Color match the pagination link color to 'SharePoint Blue' */
|
|
755
767
|
.page-link {
|
|
756
768
|
border-color: var(--sp-info-icon, #605e5c);
|