-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathbackendService.interface.ts
81 lines (61 loc) · 2.8 KB
/
backendService.interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import type {
BackendServiceOption,
ColumnFilters,
CurrentFilter,
CurrentPagination,
CurrentSorter,
FilterChangedArgs,
MultiColumnSort,
Pagination,
PaginationChangedArgs,
PaginationCursorChangedArgs,
SingleColumnSort,
} from './index.js';
import type { SharedService } from '../services/shared.service.js';
import type { SlickGrid } from '../core/index.js';
export interface BackendService {
/** Backend Service options */
options?: BackendServiceOption;
/** Optional dispose method */
dispose?: () => void;
/** Build and the return the backend service query string */
buildQuery: (serviceOptions?: BackendServiceOption) => string;
/** Allow to process/change the result */
postProcess?: (processResult: any) => void;
/** Clear all sorts */
clearFilters?: () => void;
/** Clear all sorts */
clearSorters?: () => void;
/** initialize the backend service with certain options */
init?: (serviceOptions?: BackendServiceOption | any, pagination?: Pagination, grid?: SlickGrid, sharedService?: SharedService) => void;
/** Get the dataset name */
getDatasetName?: () => string;
/** Get the Filters that are currently used by the grid */
getCurrentFilters?: () => ColumnFilters | CurrentFilter[];
/** Get the Pagination that is currently used by the grid */
getCurrentPagination?: () => CurrentPagination | null;
/** Get the Sorters that are currently used by the grid */
getCurrentSorters?: () => CurrentSorter[];
/** Reset the pagination options */
resetPaginationOptions: () => void;
/** Update the Filters options with a set of new options */
updateFilters?: (columnFilters: ColumnFilters | CurrentFilter[], isUpdatedByPresetOrDynamically: boolean) => void;
/** Update the Pagination component with it's new page number and size. If using cursor based pagination, a CursorPageInfo object needs to be supplied */
updatePagination?: (newPage: number, pageSize: number, cursorArgs?: PaginationCursorChangedArgs) => void;
/** Update the Sorters options with a set of new options */
updateSorters?: (sortColumns?: Array<SingleColumnSort>, presetSorters?: CurrentSorter[]) => void;
/** Update the backend service options */
updateOptions: (serviceOptions?: Partial<BackendServiceOption>) => void;
// --
// Events / Methods
// -----------------
/** Execute when any of the filters changed */
processOnFilterChanged: (event: Event | KeyboardEvent | undefined, args: FilterChangedArgs) => string;
/** Execute when the pagination changed */
processOnPaginationChanged: (
event: Event | undefined,
args: PaginationChangedArgs | (PaginationCursorChangedArgs & PaginationChangedArgs)
) => string;
/** Execute when any of the sorters changed */
processOnSortChanged: (event: Event | undefined, args: SingleColumnSort | MultiColumnSort) => string;
}