UNPKG

1.91 kBTypeScriptView Raw
1import { DataSource } from '../data-source';
2export declare class LocalDataSource extends DataSource {
3 protected data: Array<any>;
4 protected filteredAndSorted: Array<any>;
5 protected sortConf: Array<any>;
6 protected filterConf: any;
7 protected pagingConf: any;
8 constructor(data?: Array<any>);
9 load(data: Array<any>): Promise<any>;
10 prepend(element: any): Promise<any>;
11 append(element: any): Promise<any>;
12 add(element: any): Promise<any>;
13 remove(element: any): Promise<any>;
14 update(element: any, values: any): Promise<any>;
15 find(element: any): Promise<any>;
16 getElements(): Promise<any>;
17 getFilteredAndSorted(): Promise<any>;
18 getAll(): Promise<any>;
19 reset(silent?: boolean): void;
20 empty(): Promise<any>;
21 count(): number;
22 /**
23 *
24 * Array of conf objects
25 * [
26 * {field: string, direction: asc|desc|null, compare: Function|null},
27 * ]
28 * @param conf
29 * @param doEmit
30 * @returns {LocalDataSource}
31 */
32 setSort(conf: Array<any>, doEmit?: boolean): LocalDataSource;
33 /**
34 *
35 * Array of conf objects
36 * [
37 * {field: string, search: string, filter: Function|null},
38 * ]
39 * @param conf
40 * @param andOperator
41 * @param doEmit
42 * @returns {LocalDataSource}
43 */
44 setFilter(conf: Array<any>, andOperator?: boolean, doEmit?: boolean): LocalDataSource;
45 addFilter(fieldConf: any, andOperator?: boolean, doEmit?: boolean): LocalDataSource;
46 setPaging(page: number, perPage: number, doEmit?: boolean): LocalDataSource;
47 setPage(page: number, doEmit?: boolean): LocalDataSource;
48 getSort(): any;
49 getFilter(): any;
50 getPaging(): any;
51 protected prepareData(data: Array<any>): Array<any>;
52 protected sort(data: Array<any>): Array<any>;
53 protected filter(data: Array<any>): Array<any>;
54 protected paginate(data: Array<any>): Array<any>;
55}