build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
+29 -23
View File
@@ -14,13 +14,16 @@ import { ActivatedRoute, Router } from '@angular/router';
styleUrls: ['./reports.component.scss']
})
export class ReportsComponent implements OnInit {
/** Reports data. */
reportsData: any;
/** Report category filter. */
filter: string;
/** Columns to be displayed in reports table. */
displayedColumns: string[] = ['reportName', 'reportType', 'reportCategory'];
displayedColumns: string[] = [
'reportName',
'reportType',
'reportCategory'
];
/** Data source for reports table. */
dataSource = new MatTableDataSource();
@@ -35,10 +38,12 @@ export class ReportsComponent implements OnInit {
* Prevents reuse of route parameter `filter`.
* @param {Router} router: Router.
*/
constructor(private route: ActivatedRoute,
private router: Router) {
constructor(
private route: ActivatedRoute,
private router: Router
) {
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
this.route.data.subscribe(( data: { reports: any }) => {
this.route.data.subscribe((data: { reports: any }) => {
this.reportsData = data.reports;
});
this.filter = this.route.snapshot.params['filter'];
@@ -58,8 +63,8 @@ export class ReportsComponent implements OnInit {
*/
applyFilter(filterValue: string) {
if (filterValue.length) {
this.setCustomFilterPredicate();
this.dataSource.filter = filterValue.trim().toLowerCase();
this.setCustomFilterPredicate();
this.dataSource.filter = filterValue.trim().toLowerCase();
} else {
this.filterReportsByCategory();
}
@@ -89,22 +94,23 @@ export class ReportsComponent implements OnInit {
*/
setCustomFilterPredicate() {
this.dataSource.filterPredicate = (data: any, filter: string) => {
/** Transform the data into a lowercase string of all property values. */
const dataStr = Object.keys(data).reduce(function (currentTerm: string, key: string) {
/** Use an obscure Unicode character to delimit the words in the concatenated string.
* This avoids matches where the values of two columns combined will match the user's query
*/
return currentTerm + ((/** @type {any} */ (data)))[key] + '◬';
}, '').toLowerCase();
/** Transform the filter by converting it to lowercase and removing whitespace. */
const transformedFilter = filter.trim().toLowerCase();
/* Seperates filter for All reports page.*/
if (this.filter) {
return dataStr.indexOf(transformedFilter) !== -1 && data.reportCategory === this.filter;
} else {
return dataStr.indexOf(transformedFilter) !== -1;
}
/** Transform the data into a lowercase string of all property values. */
const dataStr = Object.keys(data)
.reduce(function (currentTerm: string, key: string) {
/** Use an obscure Unicode character to delimit the words in the concatenated string.
* This avoids matches where the values of two columns combined will match the user's query
*/
return currentTerm + /** @type {any} */ data[key] + '◬';
}, '')
.toLowerCase();
/** Transform the filter by converting it to lowercase and removing whitespace. */
const transformedFilter = filter.trim().toLowerCase();
/* Seperates filter for All reports page.*/
if (this.filter) {
return dataStr.indexOf(transformedFilter) !== -1 && data.reportCategory === this.filter;
} else {
return dataStr.indexOf(transformedFilter) !== -1;
}
};
}
}