gd-bs 5.0.7 → 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.7",
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",
@@ -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
  }