discourse/app/assets/javascripts/select-kit/components/combo-box.js.es6
Joffrey JAFFEUX 3287ac77e0
FIX: reverts combobox placeholder and introduces noneLabel
noneLabels works almost like none but instead of actually adding a row in the list, it will only change the text displayed in the header, when there's no selection.
2018-03-29 13:42:00 +02:00

32 lines
913 B
JavaScript

import SingleSelectComponent from "select-kit/components/single-select";
import { on, default as computed } from "ember-addons/ember-computed-decorators";
export default SingleSelectComponent.extend({
pluginApiIdentifiers: ["combo-box"],
classNames: "combobox combo-box",
autoFilterable: true,
headerComponent: "combo-box/combo-box-header",
caretUpIcon: "caret-up fa-fw",
caretDownIcon: "caret-down fa-fw",
clearable: false,
computeHeaderContent() {
let content = this._super();
content.hasSelection = this.get("hasSelection");
return content;
},
@computed("isExpanded", "caretUpIcon", "caretDownIcon")
caretIcon(isExpanded, caretUpIcon, caretDownIcon) {
return isExpanded ? caretUpIcon : caretDownIcon;
},
@on("didReceiveAttrs")
_setComboBoxOptions() {
this.get("headerComponentOptions").setProperties({
clearable: this.get("clearable")
});
}
});