Moved from tslint to eslint as tslint was depreciated.
Added prettier and also prettied all the typescript files using prettier ESLint is using the AirBnB rules which are the most strict to lint the files.
This commit is contained in:
@ -1,33 +1,29 @@
|
||||
import {DataSource} from '@angular/cdk/collections';
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import {map} from 'rxjs/operators';
|
||||
import {merge, Observable, of as observableOf} from 'rxjs';
|
||||
import {Role} from '../role';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { merge, Observable, of as observableOf } from 'rxjs';
|
||||
import { Role } from '../role';
|
||||
|
||||
export class RoleListDatasource extends DataSource<Role> {
|
||||
|
||||
constructor(private paginator: MatPaginator, private sort: MatSort, public data: Role[]) {
|
||||
super();
|
||||
}
|
||||
|
||||
connect(): Observable<Role[]> {
|
||||
const dataMutations = [
|
||||
observableOf(this.data),
|
||||
this.paginator.page,
|
||||
this.sort.sortChange
|
||||
];
|
||||
const dataMutations = [observableOf(this.data), this.paginator.page, this.sort.sortChange];
|
||||
|
||||
// Set the paginators length
|
||||
this.paginator.length = this.data.length;
|
||||
|
||||
return merge(...dataMutations).pipe(map(() => {
|
||||
return this.getPagedData(this.getSortedData([...this.data]));
|
||||
}));
|
||||
return merge(...dataMutations).pipe(
|
||||
map(() => {
|
||||
return this.getPagedData(this.getSortedData([...this.data]));
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
}
|
||||
disconnect() {}
|
||||
|
||||
private getPagedData(data: Role[]) {
|
||||
const startIndex = this.paginator.pageIndex * this.paginator.pageSize;
|
||||
|
||||
Reference in New Issue
Block a user