UNPKG

ngx-nested-data-table

Version:
42 lines (41 loc) 1.58 kB
import { DataSource } from '@angular/cdk/collections'; import { MatPaginator, MatSort } from '@angular/material'; import { Observable, BehaviorSubject } from 'rxjs'; /** * Data source for the NgxDataTable view. This class should * encapsulate all logic for fetching and manipulating the displayed data * (including sorting, pagination, and filtering). */ export declare class NgxDataTableDataSource extends DataSource<any> { private paginator; private _data; private sort; data: any[]; _filterChange: BehaviorSubject<string>; filteredData: any[]; filter: string; constructor(paginator: MatPaginator, _data: any[], sort: MatSort); /** * Connect this data source to the table. The table will only update when * the returned stream emits new items. * @returns A stream of the items to be rendered. */ connect(): Observable<any[]>; private _enrichData(filtered); private _filterData(data); /** * Called when the table is being destroyed. Use this function, to clean up * any open connections or free any held resources that were set up during connect. */ disconnect(): void; /** * Paginate the data (client-side). If you're using server-side pagination, * this would be replaced by requesting the appropriate data from the server. */ private getPagedData(data); /** * Sort the data (client-side). If you're using server-side sorting, * this would be replaced by requesting the appropriate data from the server. */ private getSortedData(data); }