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/index.html CHANGED
@@ -1384,7 +1384,8 @@
1384
1384
  });
1385
1385
  GD.Components.Pagination({
1386
1386
  el: document.querySelector("#paging"),
1387
- numberOfPages: 5,
1387
+ numberOfPages: 200,
1388
+ isCompact: true,
1388
1389
  onClick: function (pageNumber) {
1389
1390
  alert(pageNumber + " was clicked.");
1390
1391
  }
package/indexv2.html CHANGED
@@ -380,7 +380,7 @@
380
380
 
381
381
  <h5>Paging</h5>
382
382
 
383
- <bs-paging number-of-pages="5" on-click="MyLib.pagingOnClick"></bs-paging>
383
+ <bs-paging number-of-pages="20" on-click="MyLib.pagingOnClick"></bs-paging>
384
384
 
385
385
  <h5>Popover</h5>
386
386
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "6.8.8",
3
+ "version": "6.9.1",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -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
- let list = this.el.querySelector("ul");
38
- if (list) {
39
- this.props.isLarge ? list.classList.add("pagination-lg") : null;
40
- this.props.isSmall ? list.classList.add("pagination-sm") : null;
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
- list.classList.add("justify-content-center");
47
+ this._elList.classList.add("justify-content-center");
47
48
  break;
48
49
  // Dark
49
50
  case PaginationAlignment.Right:
50
- list.classList.add("justify-content-end");
51
+ this._elList.classList.add("justify-content-end");
51
52
  break;
52
53
  }
53
54
 
54
55
  // Render the page numbers
55
- this.renderPageNumbers(list, itemTemplate);
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(list: HTMLUListElement, itemTemplate: string) {
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
- list.appendChild(item);
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 pages = this.props.numberOfPages || 1;
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 == 1 ? item.classList.add("active") : null;
196
- list.appendChild(item);
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
- list.appendChild(item);
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