gd-bs 5.0.4 → 5.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "5.0.4",
3
+ "version": "5.0.8",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
File without changes
@@ -81,6 +81,22 @@ class _ListBox extends Base<IListBoxProps> implements IListBox {
81
81
 
82
82
  // Configures the events
83
83
  private configureEvents() {
84
+ // Execute the load event
85
+ let returnVal: any = this.props.onLoadData ? this.props.onLoadData() : null;
86
+ if (returnVal) {
87
+ // See if a promise was returned
88
+ if (typeof (returnVal.then) === "function") {
89
+ // Wait for the promise to complete
90
+ returnVal.then(items => {
91
+ // Set the options
92
+ this.setOptions(items);
93
+ });
94
+ } else {
95
+ // Set the options
96
+ this.setOptions(returnVal);
97
+ }
98
+ }
99
+
84
100
  // Set the change event on the search box
85
101
  this._elSearchBox.addEventListener("input", ev => {
86
102
  let value = this._elSearchBox.value;
@@ -30,6 +30,7 @@ export interface IListBoxProps {
30
30
  items: Array<IDropdownItem>;
31
31
  multi?: boolean;
32
32
  placeholder?: string;
33
+ onLoadData?: () => Array<IDropdownItem> | PromiseLike<Array<IDropdownItem>>;
33
34
  onChange?: (items: IDropdownItem | Array<IDropdownItem>, ev?: Event) => void;
34
35
  value?: string | Array<string>;
35
36
  }
@@ -91,24 +91,24 @@ class _Nav extends Base<INavProps> implements INav {
91
91
  this.configureEvents(link);
92
92
 
93
93
  // Add the tab content
94
- tabs.appendChild(link.elTab);
94
+ tabs.appendChild(link.elTabContent);
95
95
 
96
96
  // See if the fade option is enabled
97
97
  if (this.props.fadeTabs) {
98
98
  // Set the class name
99
- link.elTab.classList.add("fade");
99
+ link.elTabContent.classList.add("fade");
100
100
 
101
101
  // See if the tab is active
102
102
  if (link.props.isActive) {
103
103
  // Set the class name
104
- link.elTab.classList.add("show");
104
+ link.elTabContent.classList.add("show");
105
105
  }
106
106
  }
107
107
  }
108
108
 
109
109
  // Call the render events
110
- this.props.onLinkRendered ? this.props.onLinkRendered(link.el, links[i]) : null;
111
- this.props.onTabRendered ? this.props.onTabRendered(link.elTab, links[i]) : null;
110
+ this.props.onLinkRendered ? this.props.onLinkRendered(link.elTab, links[i]) : null;
111
+ this.props.onTabRendered ? this.props.onTabRendered(link.elTabContent, links[i]) : null;
112
112
  }
113
113
  }
114
114
  }
@@ -143,7 +143,7 @@ class _Nav extends Base<INavProps> implements INav {
143
143
  let link = this._links[i];
144
144
 
145
145
  // See if this is the target tab
146
- if (tabId === i + 1 || link.elTab.getAttribute("data-title") == tabId) {
146
+ if (tabId === i + 1 || link.elTabContent.getAttribute("data-title") == tabId) {
147
147
  // Toggle it if it's not active
148
148
  link.isActive ? null : link.toggle(this.props.fadeTabs);
149
149
  }
@@ -94,11 +94,18 @@ export class NavLink extends Base<INavLinkProps> implements INavLink {
94
94
  */
95
95
 
96
96
  // The HTML tab element
97
- get elTab(): HTMLDivElement { return this._elTab; }
97
+ get elTab(): HTMLAnchorElement { return this._elLink; }
98
+
99
+ // The HTML tab content element
100
+ get elTabContent(): HTMLDivElement { return this._elTab; }
98
101
 
99
102
  // Returns true if the link is active
100
103
  get isActive(): boolean { return this._elLink.classList.contains("active"); }
101
104
 
105
+ // Gets the tab name
106
+ get tabName(): string { return this._elLink.innerHTML.trim(); }
107
+ set tabName(value: string) { this._elLink.innerHTML = (value || "").trim(); }
108
+
102
109
  // Toggles a link
103
110
  toggle(fadeTabs?: boolean) {
104
111
  // See if this item is currently active
@@ -96,8 +96,10 @@ export interface INavProps<T = Element> extends IBaseProps<INav> {
96
96
  * Navigation Link
97
97
  */
98
98
  export interface INavLink {
99
- elTab: HTMLDivElement;
99
+ elTab: HTMLAnchorElement;
100
+ elTabContent: HTMLDivElement;
100
101
  isActive: boolean;
102
+ tabName: string;
101
103
  toggle: (fadeTabs?: boolean) => void;
102
104
  }
103
105
 
@@ -1,4 +1,4 @@
1
- import * as Components from "./components";
1
+ import * as Components from "./components/components";
2
2
  import { Icons, IconTypes } from "./icons";
3
3
  declare var tippy: Function;
4
4
 
package/src/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as Components from "./components";
1
+ import * as Components from "./components/components";
2
2
  declare var tippy: Function;
3
3
 
4
4
  export {