2017-11-21 11:53:09 +01:00
|
|
|
import SingleSelectComponent from "select-kit/components/single-select";
|
2018-06-15 17:03:24 +02:00
|
|
|
import {
|
|
|
|
on,
|
|
|
|
default as computed
|
|
|
|
} from "ember-addons/ember-computed-decorators";
|
2017-10-19 12:51:08 -07:00
|
|
|
|
2017-11-21 11:53:09 +01: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",
|
|
|
|
|
2018-04-12 10:56:32 +02:00
|
|
|
caretUpIcon: "caret-up",
|
|
|
|
caretDownIcon: "caret-down",
|
2017-10-19 12:51:08 -07:00
|
|
|
clearable: false,
|
|
|
|
|
2017-11-21 11:53:09 +01:00
|
|
|
computeHeaderContent() {
|
2018-03-22 11:29:55 +01:00
|
|
|
let content = this._super();
|
2017-11-21 11:53:09 +01:00
|
|
|
content.hasSelection = this.get("hasSelection");
|
|
|
|
return content;
|
|
|
|
},
|
|
|
|
|
2018-03-22 11:29:55 +01:00
|
|
|
@computed("isExpanded", "caretUpIcon", "caretDownIcon")
|
|
|
|
caretIcon(isExpanded, caretUpIcon, caretDownIcon) {
|
|
|
|
return isExpanded ? caretUpIcon : caretDownIcon;
|
|
|
|
},
|
|
|
|
|
2017-10-19 12:51:08 -07:00
|
|
|
@on("didReceiveAttrs")
|
2017-10-20 06:41:00 -07:00
|
|
|
_setComboBoxOptions() {
|
2017-11-09 10:57:53 -08:00
|
|
|
this.get("headerComponentOptions").setProperties({
|
2018-03-29 13:42:00 +02:00
|
|
|
clearable: this.get("clearable")
|
2017-11-09 10:57:53 -08:00
|
|
|
});
|
2017-10-19 12:51:08 -07:00
|
|
|
}
|
|
|
|
});
|