2023-10-11 02:38:59 +08:00
|
|
|
import Component from "@ember/component";
|
2023-02-23 23:32:53 +08:00
|
|
|
import {
|
|
|
|
attributeBindings,
|
|
|
|
classNameBindings,
|
|
|
|
classNames,
|
|
|
|
tagName,
|
|
|
|
} from "@ember-decorators/component";
|
2019-11-08 05:38:28 +08:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2018-07-20 02:33:11 +08:00
|
|
|
|
2023-02-23 23:32:53 +08:00
|
|
|
@tagName("th")
|
|
|
|
@classNames("admin-report-table-header")
|
|
|
|
@classNameBindings("label.mainProperty", "label.type", "isCurrentSort")
|
|
|
|
@attributeBindings("label.title:title")
|
|
|
|
export default class AdminReportTableHeader extends Component {
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("currentSortLabel.sortProperty", "label.sortProperty")
|
2018-07-20 02:33:11 +08:00
|
|
|
isCurrentSort(currentSortField, labelSortField) {
|
|
|
|
return currentSortField === labelSortField;
|
2023-02-23 23:32:53 +08:00
|
|
|
}
|
2018-07-20 02:33:11 +08:00
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("currentSortDirection")
|
2018-07-20 02:33:11 +08:00
|
|
|
sortIcon(currentSortDirection) {
|
|
|
|
return currentSortDirection === 1 ? "caret-up" : "caret-down";
|
2023-02-23 23:32:53 +08:00
|
|
|
}
|
|
|
|
}
|