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/build/components/listBox/index.js +16 -0
- package/build/components/nav/index.js +6 -6
- package/build/components/nav/link.js +13 -0
- package/dist/gd-bs-icons.js +3 -3
- package/dist/gd-bs-icons.min.js +1 -1
- package/dist/gd-bs.d.ts +6 -3
- package/dist/gd-bs.js +3 -3
- package/dist/gd-bs.min.js +1 -1
- package/package.json +1 -1
- package/src/components/{index.d.ts → components.d.ts} +0 -0
- package/src/components/listBox/index.ts +16 -0
- package/src/components/listBox/types.d.ts +1 -0
- package/src/components/nav/index.ts +6 -6
- package/src/components/nav/link.ts +8 -1
- package/src/components/nav/types.d.ts +3 -1
- package/src/index-icons.d.ts +1 -1
- package/src/index.d.ts +1 -1
package/package.json
CHANGED
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
111
|
-
this.props.onTabRendered ? this.props.onTabRendered(link.
|
|
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.
|
|
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():
|
|
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:
|
|
99
|
+
elTab: HTMLAnchorElement;
|
|
100
|
+
elTabContent: HTMLDivElement;
|
|
100
101
|
isActive: boolean;
|
|
102
|
+
tabName: string;
|
|
101
103
|
toggle: (fadeTabs?: boolean) => void;
|
|
102
104
|
}
|
|
103
105
|
|
package/src/index-icons.d.ts
CHANGED
package/src/index.d.ts
CHANGED