gd-bs 6.8.7 → 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 +70 -84
- 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 +86 -79
- 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 +74 -90
|
@@ -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));
|
|
@@ -64,14 +64,18 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
64
64
|
_this._floatingUI = null;
|
|
65
65
|
// Configure the collapse
|
|
66
66
|
_this.configure();
|
|
67
|
-
// Configure the parent
|
|
68
|
-
_this.configureParent();
|
|
69
67
|
return _this;
|
|
70
68
|
}
|
|
71
69
|
// Configure the tooltip
|
|
72
70
|
_Tooltip.prototype.configure = function () {
|
|
73
|
-
// See if the target element was
|
|
74
|
-
if (this.props.target
|
|
71
|
+
// See if the target element was defined
|
|
72
|
+
if (this.props.target) {
|
|
73
|
+
// Update the element
|
|
74
|
+
this.el = this.props.target;
|
|
75
|
+
// Configure the options
|
|
76
|
+
this.configureOptions();
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
75
79
|
// See if the dropdown property exists
|
|
76
80
|
if (this.props.ddlProps) {
|
|
77
81
|
// Set the default properties
|
|
@@ -96,9 +100,11 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
96
100
|
// Update the element
|
|
97
101
|
this.el = this._btn.el;
|
|
98
102
|
}
|
|
103
|
+
// Configure the options
|
|
104
|
+
this.configureOptions();
|
|
105
|
+
// Configure the parent
|
|
106
|
+
this.configureParent();
|
|
99
107
|
}
|
|
100
|
-
// Configure the options
|
|
101
|
-
this.configureOptions();
|
|
102
108
|
};
|
|
103
109
|
// Configure the options
|
|
104
110
|
_Tooltip.prototype.configureOptions = function () {
|
|
@@ -152,61 +158,61 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
152
158
|
default:
|
|
153
159
|
// Set the default theme
|
|
154
160
|
theme = "secondary";
|
|
155
|
-
// See if a button/dropdown exists
|
|
156
|
-
var objType = this.props.btnProps && this.props.btnProps.type > 0 ? this.props.btnProps.type : null;
|
|
157
|
-
objType = this.props.ddlProps && this.props.ddlProps.type > 0 ? this.props.ddlProps.type : objType;
|
|
158
|
-
if (objType > 0) {
|
|
159
|
-
// Match the theme to the button/dropdown type
|
|
160
|
-
switch (objType) {
|
|
161
|
-
// Danger
|
|
162
|
-
case button_1.ButtonTypes.Danger:
|
|
163
|
-
case button_1.ButtonTypes.OutlineDanger:
|
|
164
|
-
theme = "danger";
|
|
165
|
-
break;
|
|
166
|
-
// Dark
|
|
167
|
-
case button_1.ButtonTypes.Dark:
|
|
168
|
-
case button_1.ButtonTypes.OutlineDark:
|
|
169
|
-
theme = "dark";
|
|
170
|
-
break;
|
|
171
|
-
// Info
|
|
172
|
-
case button_1.ButtonTypes.Info:
|
|
173
|
-
case button_1.ButtonTypes.OutlineInfo:
|
|
174
|
-
theme = "info";
|
|
175
|
-
break;
|
|
176
|
-
// Light
|
|
177
|
-
case button_1.ButtonTypes.Light:
|
|
178
|
-
case button_1.ButtonTypes.OutlineLight:
|
|
179
|
-
theme = "light";
|
|
180
|
-
break;
|
|
181
|
-
// Link
|
|
182
|
-
case button_1.ButtonTypes.Link:
|
|
183
|
-
case button_1.ButtonTypes.OutlineLink:
|
|
184
|
-
theme = "light-border";
|
|
185
|
-
break;
|
|
186
|
-
// Primary
|
|
187
|
-
case button_1.ButtonTypes.Primary:
|
|
188
|
-
case button_1.ButtonTypes.OutlinePrimary:
|
|
189
|
-
theme = "primary";
|
|
190
|
-
break;
|
|
191
|
-
// Secondary
|
|
192
|
-
case button_1.ButtonTypes.Secondary:
|
|
193
|
-
case button_1.ButtonTypes.OutlineSecondary:
|
|
194
|
-
theme = "secondary";
|
|
195
|
-
break;
|
|
196
|
-
// Success
|
|
197
|
-
case button_1.ButtonTypes.Success:
|
|
198
|
-
case button_1.ButtonTypes.OutlineSuccess:
|
|
199
|
-
theme = "success";
|
|
200
|
-
break;
|
|
201
|
-
// Warning
|
|
202
|
-
case button_1.ButtonTypes.Warning:
|
|
203
|
-
case button_1.ButtonTypes.OutlineWarning:
|
|
204
|
-
theme = "warning";
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
161
|
break;
|
|
209
162
|
}
|
|
163
|
+
// See if a button/dropdown exists
|
|
164
|
+
var objType = this.props.btnProps && this.props.btnProps.type > 0 ? this.props.btnProps.type : null;
|
|
165
|
+
objType = this.props.ddlProps && this.props.ddlProps.type > 0 ? this.props.ddlProps.type : objType;
|
|
166
|
+
if (objType > 0) {
|
|
167
|
+
// Match the theme to the button/dropdown type
|
|
168
|
+
switch (objType) {
|
|
169
|
+
// Danger
|
|
170
|
+
case button_1.ButtonTypes.Danger:
|
|
171
|
+
case button_1.ButtonTypes.OutlineDanger:
|
|
172
|
+
theme = "danger";
|
|
173
|
+
break;
|
|
174
|
+
// Dark
|
|
175
|
+
case button_1.ButtonTypes.Dark:
|
|
176
|
+
case button_1.ButtonTypes.OutlineDark:
|
|
177
|
+
theme = "dark";
|
|
178
|
+
break;
|
|
179
|
+
// Info
|
|
180
|
+
case button_1.ButtonTypes.Info:
|
|
181
|
+
case button_1.ButtonTypes.OutlineInfo:
|
|
182
|
+
theme = "info";
|
|
183
|
+
break;
|
|
184
|
+
// Light
|
|
185
|
+
case button_1.ButtonTypes.Light:
|
|
186
|
+
case button_1.ButtonTypes.OutlineLight:
|
|
187
|
+
theme = "light";
|
|
188
|
+
break;
|
|
189
|
+
// Link
|
|
190
|
+
case button_1.ButtonTypes.Link:
|
|
191
|
+
case button_1.ButtonTypes.OutlineLink:
|
|
192
|
+
theme = "light-border";
|
|
193
|
+
break;
|
|
194
|
+
// Primary
|
|
195
|
+
case button_1.ButtonTypes.Primary:
|
|
196
|
+
case button_1.ButtonTypes.OutlinePrimary:
|
|
197
|
+
theme = "primary";
|
|
198
|
+
break;
|
|
199
|
+
// Secondary
|
|
200
|
+
case button_1.ButtonTypes.Secondary:
|
|
201
|
+
case button_1.ButtonTypes.OutlineSecondary:
|
|
202
|
+
theme = "secondary";
|
|
203
|
+
break;
|
|
204
|
+
// Success
|
|
205
|
+
case button_1.ButtonTypes.Success:
|
|
206
|
+
case button_1.ButtonTypes.OutlineSuccess:
|
|
207
|
+
theme = "success";
|
|
208
|
+
break;
|
|
209
|
+
// Warning
|
|
210
|
+
case button_1.ButtonTypes.Warning:
|
|
211
|
+
case button_1.ButtonTypes.OutlineWarning:
|
|
212
|
+
theme = "warning";
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
210
216
|
// Set the tooltip content element
|
|
211
217
|
if (typeof (this.props.content) === "string") {
|
|
212
218
|
this._elContent = document.createElement("div");
|
|
@@ -220,29 +226,6 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
220
226
|
}
|
|
221
227
|
// Set the padding
|
|
222
228
|
this._elContent.classList.add("p-2");
|
|
223
|
-
// Set the on create event
|
|
224
|
-
/*
|
|
225
|
-
options["onCreate"] = (tippyObj) => {
|
|
226
|
-
// Get the content element
|
|
227
|
-
let elContent = tippyObj.popper.querySelector(".tippy-content") as HTMLElement;
|
|
228
|
-
if (elContent) {
|
|
229
|
-
// Set the class
|
|
230
|
-
elContent.classList.add("bs");
|
|
231
|
-
|
|
232
|
-
// Get the custom class name(s)
|
|
233
|
-
let custom = (this.props.className || "").trim().split(" ");
|
|
234
|
-
for (let i = 0; i < custom.length; i++) {
|
|
235
|
-
let className = custom[i];
|
|
236
|
-
|
|
237
|
-
// Add the custom class name
|
|
238
|
-
className ? elContent.classList.add(custom[i]) : null;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// Call the custom event if it's defined
|
|
243
|
-
this.props.options && this.props.options.onCreate ? this.props.options.onCreate(tippyObj) : null;
|
|
244
|
-
}
|
|
245
|
-
*/
|
|
246
229
|
// Create the floating ui
|
|
247
230
|
this._floatingUI = (0, floating_ui_1.FloatingUI)({
|
|
248
231
|
className: "floating-tooltip",
|
|
@@ -302,14 +285,17 @@ var _Tooltip = /** @class */ (function (_super) {
|
|
|
302
285
|
});
|
|
303
286
|
// Sets the tippy content
|
|
304
287
|
_Tooltip.prototype.setContent = function (content) {
|
|
305
|
-
// Set the tippy content
|
|
306
|
-
this._floatingUI.setContent(content);
|
|
307
288
|
// See if the content is a string
|
|
308
289
|
if (typeof (content) === "string") {
|
|
309
290
|
// Update the content
|
|
291
|
+
this._elContent.innerHTML = content;
|
|
310
292
|
this._btn ? this._btn.el.setAttribute("aria-description", content) : null;
|
|
311
293
|
this._ddl ? this._ddl.el.setAttribute("aria-description", content) : null;
|
|
312
294
|
}
|
|
295
|
+
else {
|
|
296
|
+
// Set the tippy content
|
|
297
|
+
this._floatingUI.setContent(content);
|
|
298
|
+
}
|
|
313
299
|
};
|
|
314
300
|
// Shows the tooltip
|
|
315
301
|
_Tooltip.prototype.show = function () {
|