/**
* Opens the dropdown unless it is already open.
*/
- open(containerId: string, disableAutoFocus?: boolean): void {
+ open(containerId: string, disableAutoFocus?: boolean, referenceElement?: HTMLElement): void {
const menu = _menus.get(containerId);
if (menu !== undefined && !menu.classList.contains("dropdownOpen")) {
- UiDropdownSimple.toggleDropdown(containerId, undefined, disableAutoFocus);
+ UiDropdownSimple.toggleDropdown(containerId, referenceElement, disableAutoFocus);
}
},
if (typeof data.returnValues === "object") {
const callbackClick = this.clickSelectItem.bind(this);
- let listItem;
-
Object.keys(data.returnValues).forEach((key) => {
- listItem = this.createListItem(data.returnValues[key]);
+ const listItem = this.createListItem(data.returnValues[key]);
listItem.addEventListener("click", callbackClick);
this.list!.appendChild(listItem);
if (!this.list.childElementCount && !this.handleEmptyResult()) {
UiDropdownSimple.close(this.dropdownContainerId);
} else {
- UiDropdownSimple.open(this.dropdownContainerId, true);
+ UiDropdownSimple.open(this.dropdownContainerId, true, this.element);
// mark first item as active
const firstChild = this.list.childElementCount ? (this.list.children[0] as HTMLLIElement) : undefined;
/**
* Opens the dropdown unless it is already open.
*/
- open(containerId, disableAutoFocus) {
+ open(containerId, disableAutoFocus, referenceElement) {
const menu = _menus.get(containerId);
if (menu !== undefined && !menu.classList.contains("dropdownOpen")) {
- UiDropdownSimple.toggleDropdown(containerId, undefined, disableAutoFocus);
+ UiDropdownSimple.toggleDropdown(containerId, referenceElement, disableAutoFocus);
}
},
/**
}
if (typeof data.returnValues === "object") {
const callbackClick = this.clickSelectItem.bind(this);
- let listItem;
Object.keys(data.returnValues).forEach((key) => {
- listItem = this.createListItem(data.returnValues[key]);
+ const listItem = this.createListItem(data.returnValues[key]);
listItem.addEventListener("click", callbackClick);
this.list.appendChild(listItem);
});
Simple_1.default.close(this.dropdownContainerId);
}
else {
- Simple_1.default.open(this.dropdownContainerId, true);
+ Simple_1.default.open(this.dropdownContainerId, true, this.element);
// mark first item as active
const firstChild = this.list.childElementCount ? this.list.children[0] : undefined;
if (this.autoFocus && firstChild && ~~(firstChild.dataset.objectId || "")) {