2020-02-03 21:22:14 +08:00
|
|
|
import { computed } from "@ember/object";
|
|
|
|
import { readOnly } from "@ember/object/computed";
|
2024-08-23 19:17:07 +08:00
|
|
|
import { classNameBindings, classNames } from "@ember-decorators/component";
|
2023-10-11 02:38:59 +08:00
|
|
|
import SingleSelectHeaderComponent from "select-kit/components/select-kit/single-select-header";
|
2017-11-21 18:53:09 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@classNames("dropdown-select-box-header")
|
|
|
|
@classNameBindings("btnClassName", "btnStyleClass", "btnCustomClasses")
|
|
|
|
export default class DropdownSelectBoxHeader extends SingleSelectHeaderComponent {
|
|
|
|
@readOnly("selectKit.options.showFullTitle") showFullTitle;
|
|
|
|
@readOnly("selectKit.options.customStyle") customStyle;
|
|
|
|
@readOnly("selectKit.options.btnCustomClasses") btnCustomClasses;
|
|
|
|
@readOnly("selectKit.options.caretUpIcon") caretUpIcon;
|
|
|
|
@readOnly("selectKit.options.caretDownIcon") caretDownIcon;
|
2017-11-21 18:53:09 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@computed("showFullTitle")
|
|
|
|
get btnClassName() {
|
2020-02-03 21:22:14 +08:00
|
|
|
return `btn ${this.showFullTitle ? "btn-icon-text" : "no-text btn-icon"}`;
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2020-05-18 16:50:33 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@computed("customStyle")
|
|
|
|
get btnStyleClass() {
|
2021-05-20 14:00:45 +08:00
|
|
|
return `${this.customStyle ? "" : "btn-default"}`;
|
2024-08-23 19:17:07 +08:00
|
|
|
}
|
2020-05-18 16:50:33 +08:00
|
|
|
|
2024-08-23 19:17:07 +08:00
|
|
|
@computed("selectKit.isExpanded", "caretUpIcon", "caretDownIcon")
|
|
|
|
get caretIcon() {
|
|
|
|
return this.selectKit.isExpanded ? this.caretUpIcon : this.caretDownIcon;
|
|
|
|
}
|
|
|
|
}
|