2020-02-03 21:22:14 +08:00
|
|
|
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/dropdown-select-box/dropdown-select-box-header";
|
2020-02-03 21:22:14 +08:00
|
|
|
import { readOnly } from "@ember/object/computed";
|
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,
|
2021-05-20 14:00:45 +08:00
|
|
|
classNames: ["dropdown-select-box-header"],
|
|
|
|
classNameBindings: ["btnClassName", "btnStyleClass"],
|
2020-02-03 21:22:14 +08:00
|
|
|
showFullTitle: readOnly("selectKit.options.showFullTitle"),
|
2021-05-20 14:00:45 +08:00
|
|
|
customStyle: readOnly("selectKit.options.customStyle"),
|
2017-11-21 18:53:09 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
btnClassName: computed("showFullTitle", function () {
|
|
|
|
return `btn ${this.showFullTitle ? "btn-icon-text" : "no-text btn-icon"}`;
|
2020-05-18 16:50:33 +08:00
|
|
|
}),
|
|
|
|
|
2021-05-20 14:00:45 +08:00
|
|
|
btnStyleClass: computed("customStyle", function () {
|
|
|
|
return `${this.customStyle ? "" : "btn-default"}`;
|
|
|
|
}),
|
|
|
|
|
2020-05-18 16:50:33 +08:00
|
|
|
caretUpIcon: readOnly("selectKit.options.caretUpIcon"),
|
|
|
|
|
|
|
|
caretDownIcon: readOnly("selectKit.options.caretDownIcon"),
|
|
|
|
|
|
|
|
caretIcon: computed(
|
|
|
|
"selectKit.isExpanded",
|
|
|
|
"caretUpIcon",
|
|
|
|
"caretDownIcon",
|
|
|
|
function () {
|
|
|
|
return this.selectKit.isExpanded ? this.caretUpIcon : this.caretDownIcon;
|
|
|
|
}
|
|
|
|
),
|
2017-11-21 18:53:09 +08:00
|
|
|
});
|