2020-02-03 08:22:14 -05:00
|
|
|
import SingleSelectHeaderComponent from "select-kit/components/select-kit/single-select-header";
|
|
|
|
import { computed } from "@ember/object";
|
2020-08-28 15:30:20 -04:00
|
|
|
import layout from "select-kit/templates/components/dropdown-select-box/dropdown-select-box-header";
|
2020-02-03 08:22:14 -05:00
|
|
|
import { readOnly } from "@ember/object/computed";
|
2017-11-21 05:53:09 -05:00
|
|
|
|
2020-02-03 08:22:14 -05:00
|
|
|
export default SingleSelectHeaderComponent.extend({
|
2020-08-28 15:30:20 -04:00
|
|
|
layout,
|
2021-05-20 02:00:45 -04:00
|
|
|
classNames: ["dropdown-select-box-header"],
|
|
|
|
classNameBindings: ["btnClassName", "btnStyleClass"],
|
2020-02-03 08:22:14 -05:00
|
|
|
showFullTitle: readOnly("selectKit.options.showFullTitle"),
|
2021-05-20 02:00:45 -04:00
|
|
|
customStyle: readOnly("selectKit.options.customStyle"),
|
2017-11-21 05:53:09 -05:00
|
|
|
|
2020-02-03 08:22:14 -05:00
|
|
|
btnClassName: computed("showFullTitle", function () {
|
|
|
|
return `btn ${this.showFullTitle ? "btn-icon-text" : "no-text btn-icon"}`;
|
2020-05-18 04:50:33 -04:00
|
|
|
}),
|
|
|
|
|
2021-05-20 02:00:45 -04:00
|
|
|
btnStyleClass: computed("customStyle", function () {
|
|
|
|
return `${this.customStyle ? "" : "btn-default"}`;
|
|
|
|
}),
|
|
|
|
|
2020-05-18 04:50:33 -04: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 05:53:09 -05:00
|
|
|
});
|