discourse/app/assets/javascripts/select-kit/components/combo-box.js.es6

35 lines
917 B
Plaintext
Raw Normal View History

import SingleSelectComponent from "select-kit/components/single-select";
2018-06-15 11:03:24 -04:00
import {
on,
default as computed
} from "ember-addons/ember-computed-decorators";
2017-10-19 15:51:08 -04:00
export default SingleSelectComponent.extend({
pluginApiIdentifiers: ["combo-box"],
2017-10-19 15:51:08 -04:00
classNames: "combobox combo-box",
autoFilterable: true,
headerComponent: "combo-box/combo-box-header",
caretUpIcon: "caret-up",
caretDownIcon: "caret-down",
2017-10-19 15:51:08 -04:00
clearable: false,
computeHeaderContent() {
let content = this._super(...arguments);
content.hasSelection = this.get("hasSelection");
return content;
},
@computed("isExpanded", "caretUpIcon", "caretDownIcon")
caretIcon(isExpanded, caretUpIcon, caretDownIcon) {
return isExpanded ? caretUpIcon : caretDownIcon;
},
2017-10-19 15:51:08 -04:00
@on("didReceiveAttrs")
_setComboBoxOptions() {
2017-11-09 13:57:53 -05:00
this.get("headerComponentOptions").setProperties({
clearable: this.get("clearable")
2017-11-09 13:57:53 -05:00
});
2017-10-19 15:51:08 -04:00
}
});