gd-bs 6.8.8 → 6.9.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.
- package/build/components/dropdown/index.js +5 -0
- package/build/components/nav/index.js +10 -3
- package/build/components/pagination/index.js +24 -14
- package/build/components/tooltip/index.js +5 -2
- package/dist/gd-bs-icons.js +1 -1
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.js +1 -1
- package/dist/gd-bs.min.js +1 -1
- package/index.html +2 -1
- package/indexv2.html +1 -1
- package/package.json +1 -1
- package/src/components/dropdown/index.ts +6 -0
- package/src/components/nav/index.ts +5 -3
- package/src/components/pagination/index.ts +26 -14
- package/src/components/tooltip/index.ts +4 -3
package/index.html
CHANGED
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) {
|
|
@@ -32,10 +32,12 @@ class _Nav extends Base<INavProps> implements INav {
|
|
|
32
32
|
this.props.id ? nav.id = this.props.id : null;
|
|
33
33
|
this.props.enableFill ? nav.classList.add("nav-fill") : null;
|
|
34
34
|
this.props.isJustified ? nav.classList.add("nav-justified") : null;
|
|
35
|
-
this.props.isPills ? nav.classList.add("nav-pills") : null;
|
|
36
|
-
this.props.isTabs ? nav.classList.add("nav-tabs") : null;
|
|
37
|
-
this.props.isUnderline ? nav.classList.add("nav-underline") : null;
|
|
38
35
|
this.props.isVertical ? nav.classList.add("flex-column") : null;
|
|
36
|
+
|
|
37
|
+
// Set the class name based on the properties
|
|
38
|
+
if (this.props.isTabs) { nav.classList.add("nav-tabs"); }
|
|
39
|
+
else if (this.props.isPills) { nav.classList.add("nav-pills"); }
|
|
40
|
+
else if (this.props.isTabs) { nav.classList.add("nav-tabs"); }
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
// Render the nav links
|
|
@@ -15,6 +15,7 @@ export enum PaginationAlignment {
|
|
|
15
15
|
* Pagination
|
|
16
16
|
*/
|
|
17
17
|
class _Pagination extends Base<IPaginationProps> implements IPagination {
|
|
18
|
+
private _elList: HTMLUListElement = null;
|
|
18
19
|
private _items: Array<HTMLLIElement> = null;
|
|
19
20
|
|
|
20
21
|
// Constructor
|
|
@@ -34,25 +35,25 @@ class _Pagination extends Base<IPaginationProps> implements IPagination {
|
|
|
34
35
|
this.props.label ? this.el.setAttribute("aria-label", this.props.label) : null;
|
|
35
36
|
|
|
36
37
|
// Update the list
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
this.props.isLarge ?
|
|
40
|
-
this.props.isSmall ?
|
|
38
|
+
this._elList = this.el.querySelector("ul");
|
|
39
|
+
if (this._elList) {
|
|
40
|
+
this.props.isLarge ? this._elList.classList.add("pagination-lg") : null;
|
|
41
|
+
this.props.isSmall ? this._elList.classList.add("pagination-sm") : null;
|
|
41
42
|
|
|
42
43
|
// Read the alignment
|
|
43
44
|
switch (this.props.alignment) {
|
|
44
45
|
// Danger
|
|
45
46
|
case PaginationAlignment.Center:
|
|
46
|
-
|
|
47
|
+
this._elList.classList.add("justify-content-center");
|
|
47
48
|
break;
|
|
48
49
|
// Dark
|
|
49
50
|
case PaginationAlignment.Right:
|
|
50
|
-
|
|
51
|
+
this._elList.classList.add("justify-content-end");
|
|
51
52
|
break;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
// Render the page numbers
|
|
55
|
-
this.renderPageNumbers(
|
|
56
|
+
this.renderPageNumbers(1, itemTemplate);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -176,31 +177,42 @@ class _Pagination extends Base<IPaginationProps> implements IPagination {
|
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
// Renders the page numbers
|
|
179
|
-
private renderPageNumbers(
|
|
180
|
+
private renderPageNumbers(activeItem: number, itemTemplate: string) {
|
|
180
181
|
// Clear the items
|
|
181
182
|
this._items = [];
|
|
182
183
|
|
|
184
|
+
// Determine if there are > 10 pages
|
|
185
|
+
let pages = this.props.numberOfPages || 1;
|
|
186
|
+
let showFirstLast = pages > 10;
|
|
187
|
+
|
|
183
188
|
// Create the previous link
|
|
184
189
|
let item = this.createItem("Previous", itemTemplate);
|
|
185
190
|
item.classList.add("disabled");
|
|
186
191
|
item.classList.add("previous");
|
|
187
|
-
|
|
192
|
+
this._elList.appendChild(item);
|
|
193
|
+
|
|
194
|
+
// See if we are showing the first/last links
|
|
195
|
+
if (showFirstLast) {
|
|
196
|
+
item = this.createItem("1", itemTemplate);
|
|
197
|
+
activeItem == 1 ? item.classList.add("active") : null;
|
|
198
|
+
item.classList.add("next");
|
|
199
|
+
this._elList.appendChild(item);
|
|
200
|
+
}
|
|
188
201
|
|
|
189
202
|
// Loop for the number of pages to create
|
|
190
203
|
// Parse the number of pages
|
|
191
|
-
let
|
|
192
|
-
for (let i = 1; i <= pages; i++) {
|
|
204
|
+
for (let i = 2; i <= pages; i++) {
|
|
193
205
|
// Create a link
|
|
194
206
|
item = this.createItem(i.toString(), itemTemplate);
|
|
195
|
-
i ==
|
|
196
|
-
|
|
207
|
+
i == activeItem ? item.classList.add("active") : null;
|
|
208
|
+
this._elList.appendChild(item);
|
|
197
209
|
}
|
|
198
210
|
|
|
199
211
|
// Create the next link
|
|
200
212
|
item = this.createItem("Next", itemTemplate);
|
|
201
213
|
pages > 1 ? null : item.classList.add("disabled");
|
|
202
214
|
item.classList.add("next");
|
|
203
|
-
|
|
215
|
+
this._elList.appendChild(item);
|
|
204
216
|
}
|
|
205
217
|
}
|
|
206
218
|
export const Pagination = (props: IPaginationProps, template?: string, itemTemplate?: string): IPagination => { return new _Pagination(props, template, itemTemplate); }
|
|
@@ -269,14 +269,15 @@ class _Tooltip extends Base<ITooltipProps> {
|
|
|
269
269
|
|
|
270
270
|
// Sets the tippy content
|
|
271
271
|
setContent(content: string | Element) {
|
|
272
|
-
// Set the tippy content
|
|
273
|
-
this._floatingUI.setContent(content);
|
|
274
|
-
|
|
275
272
|
// See if the content is a string
|
|
276
273
|
if (typeof (content) === "string") {
|
|
277
274
|
// Update the content
|
|
275
|
+
this._elContent.innerHTML = content;
|
|
278
276
|
this._btn ? this._btn.el.setAttribute("aria-description", content) : null;
|
|
279
277
|
this._ddl ? this._ddl.el.setAttribute("aria-description", content) : null;
|
|
278
|
+
} else {
|
|
279
|
+
// Set the tippy content
|
|
280
|
+
this._floatingUI.setContent(content);
|
|
280
281
|
}
|
|
281
282
|
}
|
|
282
283
|
|