2020-02-03 21:22:14 +08:00
|
|
|
import { and, reads } from "@ember/object/computed";
|
|
|
|
import SingleSelectHeaderComponent from "select-kit/components/select-kit/single-select-header";
|
|
|
|
import { computed } from "@ember/object";
|
2020-08-29 03:30:20 +08:00
|
|
|
import layout from "select-kit/templates/components/combo-box/combo-box-header";
|
2017-11-21 18:53:09 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
export default SingleSelectHeaderComponent.extend({
|
2020-08-29 03:30:20 +08:00
|
|
|
layout,
|
2020-02-03 21:22:14 +08:00
|
|
|
classNames: ["combo-box-header"],
|
|
|
|
clearable: reads("selectKit.options.clearable"),
|
|
|
|
caretUpIcon: reads("selectKit.options.caretUpIcon"),
|
|
|
|
caretDownIcon: reads("selectKit.options.caretDownIcon"),
|
|
|
|
shouldDisplayClearableButton: and("clearable", "value"),
|
2017-11-21 18:53:09 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
caretIcon: computed(
|
|
|
|
"selectKit.isExpanded",
|
|
|
|
"caretUpIcon",
|
|
|
|
"caretDownIcon",
|
|
|
|
function () {
|
|
|
|
return this.selectKit.isExpanded ? this.caretUpIcon : this.caretDownIcon;
|
|
|
|
}
|
|
|
|
),
|
2017-11-21 18:53:09 +08:00
|
|
|
});
|