gd-bs 6.8.8 → 6.9.0
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/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/package.json +1 -1
- package/src/components/nav/index.ts +5 -3
- package/src/components/pagination/index.ts +26 -14
- package/src/components/tooltip/index.ts +4 -3
|
@@ -46,10 +46,17 @@ var _Nav = /** @class */ (function (_super) {
|
|
|
46
46
|
this.props.id ? nav.id = this.props.id : null;
|
|
47
47
|
this.props.enableFill ? nav.classList.add("nav-fill") : null;
|
|
48
48
|
this.props.isJustified ? nav.classList.add("nav-justified") : null;
|
|
49
|
-
this.props.isPills ? nav.classList.add("nav-pills") : null;
|
|
50
|
-
this.props.isTabs ? nav.classList.add("nav-tabs") : null;
|
|
51
|
-
this.props.isUnderline ? nav.classList.add("nav-underline") : null;
|
|
52
49
|
this.props.isVertical ? nav.classList.add("flex-column") : null;
|
|
50
|
+
// Set the class name based on the properties
|
|
51
|
+
if (this.props.isTabs) {
|
|
52
|
+
nav.classList.add("nav-tabs");
|
|
53
|
+
}
|
|
54
|
+
else if (this.props.isPills) {
|
|
55
|
+
nav.classList.add("nav-pills");
|
|
56
|
+
}
|
|
57
|
+
else if (this.props.isTabs) {
|
|
58
|
+
nav.classList.add("nav-tabs");
|
|
59
|
+
}
|
|
53
60
|
}
|
|
54
61
|
// Render the nav links
|
|
55
62
|
this.renderItems(itemTemplate);
|
|
@@ -37,6 +37,7 @@ var _Pagination = /** @class */ (function (_super) {
|
|
|
37
37
|
if (template === void 0) { template = templates_1.HTML; }
|
|
38
38
|
if (itemTemplate === void 0) { itemTemplate = templates_1.HTMLItem; }
|
|
39
39
|
var _this = _super.call(this, template, props) || this;
|
|
40
|
+
_this._elList = null;
|
|
40
41
|
_this._items = null;
|
|
41
42
|
// Configure the collapse
|
|
42
43
|
_this.configure(itemTemplate);
|
|
@@ -49,23 +50,23 @@ var _Pagination = /** @class */ (function (_super) {
|
|
|
49
50
|
// Update the nav properties
|
|
50
51
|
this.props.label ? this.el.setAttribute("aria-label", this.props.label) : null;
|
|
51
52
|
// Update the list
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
this.props.isLarge ?
|
|
55
|
-
this.props.isSmall ?
|
|
53
|
+
this._elList = this.el.querySelector("ul");
|
|
54
|
+
if (this._elList) {
|
|
55
|
+
this.props.isLarge ? this._elList.classList.add("pagination-lg") : null;
|
|
56
|
+
this.props.isSmall ? this._elList.classList.add("pagination-sm") : null;
|
|
56
57
|
// Read the alignment
|
|
57
58
|
switch (this.props.alignment) {
|
|
58
59
|
// Danger
|
|
59
60
|
case PaginationAlignment.Center:
|
|
60
|
-
|
|
61
|
+
this._elList.classList.add("justify-content-center");
|
|
61
62
|
break;
|
|
62
63
|
// Dark
|
|
63
64
|
case PaginationAlignment.Right:
|
|
64
|
-
|
|
65
|
+
this._elList.classList.add("justify-content-end");
|
|
65
66
|
break;
|
|
66
67
|
}
|
|
67
68
|
// Render the page numbers
|
|
68
|
-
this.renderPageNumbers(
|
|
69
|
+
this.renderPageNumbers(1, itemTemplate);
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
72
|
// Configures the next/previous buttons, based on the active index
|
|
@@ -175,28 +176,37 @@ var _Pagination = /** @class */ (function (_super) {
|
|
|
175
176
|
return item;
|
|
176
177
|
};
|
|
177
178
|
// Renders the page numbers
|
|
178
|
-
_Pagination.prototype.renderPageNumbers = function (
|
|
179
|
+
_Pagination.prototype.renderPageNumbers = function (activeItem, itemTemplate) {
|
|
179
180
|
// Clear the items
|
|
180
181
|
this._items = [];
|
|
182
|
+
// Determine if there are > 10 pages
|
|
183
|
+
var pages = this.props.numberOfPages || 1;
|
|
184
|
+
var showFirstLast = pages > 10;
|
|
181
185
|
// Create the previous link
|
|
182
186
|
var item = this.createItem("Previous", itemTemplate);
|
|
183
187
|
item.classList.add("disabled");
|
|
184
188
|
item.classList.add("previous");
|
|
185
|
-
|
|
189
|
+
this._elList.appendChild(item);
|
|
190
|
+
// See if we are showing the first/last links
|
|
191
|
+
if (showFirstLast) {
|
|
192
|
+
item = this.createItem("1", itemTemplate);
|
|
193
|
+
activeItem == 1 ? item.classList.add("active") : null;
|
|
194
|
+
item.classList.add("next");
|
|
195
|
+
this._elList.appendChild(item);
|
|
196
|
+
}
|
|
186
197
|
// Loop for the number of pages to create
|
|
187
198
|
// Parse the number of pages
|
|
188
|
-
var
|
|
189
|
-
for (var i = 1; i <= pages; i++) {
|
|
199
|
+
for (var i = 2; i <= pages; i++) {
|
|
190
200
|
// Create a link
|
|
191
201
|
item = this.createItem(i.toString(), itemTemplate);
|
|
192
|
-
i ==
|
|
193
|
-
|
|
202
|
+
i == activeItem ? item.classList.add("active") : null;
|
|
203
|
+
this._elList.appendChild(item);
|
|
194
204
|
}
|
|
195
205
|
// Create the next link
|
|
196
206
|
item = this.createItem("Next", itemTemplate);
|
|
197
207
|
pages > 1 ? null : item.classList.add("disabled");
|
|
198
208
|
item.classList.add("next");
|
|
199
|
-
|
|
209
|
+
this._elList.appendChild(item);
|
|
200
210
|
};
|
|
201
211
|
return _Pagination;
|
|
202
212
|
}(base_1.Base));
|
|
@@ -285,14 +285,17 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
285
285
|
});
|
|
286
286
|
// Sets the tippy content
|
|
287
287
|
_Tooltip.prototype.setContent = function (content) {
|
|
288
|
-
// Set the tippy content
|
|
289
|
-
this._floatingUI.setContent(content);
|
|
290
288
|
// See if the content is a string
|
|
291
289
|
if (typeof (content) === "string") {
|
|
292
290
|
// Update the content
|
|
291
|
+
this._elContent.innerHTML = content;
|
|
293
292
|
this._btn ? this._btn.el.setAttribute("aria-description", content) : null;
|
|
294
293
|
this._ddl ? this._ddl.el.setAttribute("aria-description", content) : null;
|
|
295
294
|
}
|
|
295
|
+
else {
|
|
296
|
+
// Set the tippy content
|
|
297
|
+
this._floatingUI.setContent(content);
|
|
298
|
+
}
|
|
296
299
|
};
|
|
297
300
|
// Shows the tooltip
|
|
298
301
|
_Tooltip.prototype.show = function () {
|