35 lines
916 B
Plaintext
Raw Normal View History

import SingleSelectComponent from "select-kit/components/single-select";
2018-06-15 17:03:24 +02:00
import {
on,
default as discourseComputed
} from "discourse-common/utils/decorators";
2017-10-19 12:51:08 -07:00
export default SingleSelectComponent.extend({
pluginApiIdentifiers: ["combo-box"],
2017-10-19 12:51:08 -07:00
classNames: "combobox combo-box",
autoFilterable: true,
headerComponent: "combo-box/combo-box-header",
caretUpIcon: "caret-up",
caretDownIcon: "caret-down",
2017-10-19 12:51:08 -07:00
clearable: false,
computeHeaderContent() {
let content = this._super(...arguments);
content.hasSelection = this.hasSelection;
return content;
},
@discourseComputed("isExpanded", "caretUpIcon", "caretDownIcon")
caretIcon(isExpanded, caretUpIcon, caretDownIcon) {
return isExpanded ? caretUpIcon : caretDownIcon;
},
@on("didUpdateAttrs", "init")
_setComboBoxOptions() {
this.headerComponentOptions.setProperties({
clearable: this.clearable
2017-11-09 10:57:53 -08:00
});
2017-10-19 12:51:08 -07:00
}
});