2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2018-07-20 02:33:11 +08:00
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend({
|
2018-07-20 02:33:11 +08:00
|
|
|
tagName: "th",
|
|
|
|
classNames: ["admin-report-table-header"],
|
2018-08-02 06:40:59 +08:00
|
|
|
classNameBindings: ["label.mainProperty", "label.type", "isCurrentSort"],
|
2018-07-20 02:33:11 +08:00
|
|
|
attributeBindings: ["label.title:title"],
|
|
|
|
|
2018-08-01 05:35:13 +08:00
|
|
|
@computed("currentSortLabel.sortProperty", "label.sortProperty")
|
2018-07-20 02:33:11 +08:00
|
|
|
isCurrentSort(currentSortField, labelSortField) {
|
|
|
|
return currentSortField === labelSortField;
|
|
|
|
},
|
|
|
|
|
|
|
|
@computed("currentSortDirection")
|
|
|
|
sortIcon(currentSortDirection) {
|
|
|
|
return currentSortDirection === 1 ? "caret-up" : "caret-down";
|
|
|
|
}
|
|
|
|
});
|