2018-07-20 02:33:11 +08:00
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
|
|
|
|
|
|
|
export default Ember.Component.extend({
|
|
|
|
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";
|
|
|
|
}
|
|
|
|
});
|