fabric8-planner
Version:
A planner front-end for Fabric8.
78 lines • 3.07 kB
JavaScript
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
var SelectDropdownComponent = /** @class */ (function () {
function SelectDropdownComponent() {
this.headerText = 'This is default header';
this.menuItems = [];
this.showSearch = false;
this.disabled = false;
this.loading = false;
this.onSelect = new EventEmitter();
this.onSearch = new EventEmitter();
this.onOpen = new EventEmitter();
this.onClose = new EventEmitter();
this.displayDropdown = false;
}
SelectDropdownComponent.prototype.ngOnInit = function () { };
SelectDropdownComponent.prototype.openDropdown = function () {
var _this = this;
if (!this.disabled) {
this.loading = false;
this.displayDropdown = true;
if (this.searchInput) {
setTimeout(function () { return _this.searchInput.nativeElement.focus(); });
}
this.onOpen.emit('open');
}
};
SelectDropdownComponent.prototype.closeDropdown = function () {
this.displayDropdown = false;
this.onClose.emit('close');
};
SelectDropdownComponent.prototype.selectItem = function (item) {
this.onSelect.emit(item);
};
SelectDropdownComponent.prototype.searchItem = function (text) {
if (!text.trim()) {
this.loading = false;
}
this.onSearch.emit(text);
};
SelectDropdownComponent.prototype.clickOut = function () {
if (this.displayDropdown) {
this.closeDropdown();
}
};
SelectDropdownComponent.prototype.setSearchText = function (text) {
if (this.searchInput) {
this.searchInput.nativeElement.value = text;
}
};
SelectDropdownComponent.decorators = [
{ type: Component, args: [{
selector: 'f8-select-dropdown',
template: require('./select-dropdown.component.html'),
styles: [require('./select-dropdown.component.css').toString()],
changeDetection: ChangeDetectionStrategy.OnPush
},] },
];
/** @nocollapse */
SelectDropdownComponent.ctorParameters = function () { return []; };
SelectDropdownComponent.propDecorators = {
'headerText': [{ type: Input },],
'toggleButtonRef': [{ type: Input },],
'dropdownItem': [{ type: Input },],
'dropdownFooter': [{ type: Input },],
'menuItems': [{ type: Input },],
'showSearch': [{ type: Input },],
'disabled': [{ type: Input },],
'loading': [{ type: Input },],
'onSelect': [{ type: Output },],
'onSearch': [{ type: Output },],
'onOpen': [{ type: Output },],
'onClose': [{ type: Output },],
'searchInput': [{ type: ViewChild, args: ['searchInput',] },],
};
return SelectDropdownComponent;
}());
export { SelectDropdownComponent };
//# sourceMappingURL=select-dropdown.component.js.map