Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit add5287

Browse files
authored
Merge pull request #223 from ghiscoding/feat/test-graphql-query-builder
feat(tests): add GraphqlQueryBuilder unit tests
2 parents 7c1d006 + b26f281 commit add5287

18 files changed

+1259
-68
lines changed

src/app/modules/angular-slickgrid/global-grid-options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export const GlobalGridOptions: GridOption = {
106106
saveDetailViewOnScroll: false,
107107

108108
// the following 2 property/method should always be override by the user
109-
process: () => new Promise((resolve) => resolve('')),
109+
process: undefined,
110110
viewComponent: null
111111
},
112112
rowHeight: 35,

src/app/modules/angular-slickgrid/models/backendService.interface.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ export interface BackendService {
6161
// -----------------
6262

6363
/** Execute when any of the filters changed */
64-
processOnFilterChanged: (event: Event, args: FilterChangedArgs) => Promise<string>;
64+
// @deprecated return output should be string only not Promise
65+
processOnFilterChanged: (event: Event, args: FilterChangedArgs) => string | Promise<string>;
6566

6667
/** Execute when the pagination changed */
6768
processOnPaginationChanged: (event: Event | undefined, args: PaginationChangedArgs) => string;

src/app/modules/angular-slickgrid/models/backendServiceOption.interface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export interface BackendServiceOption {
88
/** What are the pagination options? ex.: (first, last, offset) */
99
paginationOptions?: any;
1010

11-
/** array of Filtering Options, ex.: { field: name, operator: EQ, value: "John" } */
11+
/** array of Filtering Options, ex.: [{ field: 'firstName', operator: 'EQ', value: 'John' }] */
1212
filteringOptions?: any[];
1313

14-
/** array of Filtering Options, ex.: { field: name, direction: DESC } */
14+
/** array of Filtering Options, ex.: [{ field: 'firstName', direction: 'DESC' }] */
1515
sortingOptions?: any[];
1616

1717
/** Execute the process callback command on component init (page load) */

src/app/modules/angular-slickgrid/models/column.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export interface Column {
4747
/** Default to false, which leads to exclude the column title from the Grid Menu. */
4848
excludeFromGridMenu?: boolean;
4949

50-
/** Defaults to false, which leads to exclude the field from the query (mostly a backend service query) */
50+
/** Defaults to false, which leads to exclude the field from the query (typically a backend service query) */
5151
excludeFromQuery?: boolean;
5252

5353
/** Defaults to false, which leads to exclude the column from getting a header menu. For example, the checkbox row selection should not have a header menu. */
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
import { Column } from './column.interface';
22

33
export interface ColumnSort {
4+
/** SlickGrid grid object */
5+
grid?: any;
6+
7+
/** Defaults to false, is it a multi-column sort? */
8+
multiColumnSort?: boolean;
9+
10+
/** Column Id to be sorted */
411
columnId?: string | number;
5-
sortAsc?: boolean;
6-
sortCol?: Column;
12+
13+
/** Are we sorting Ascending? */
14+
sortAsc: boolean;
15+
16+
/** Column to be sorted */
17+
sortCol: Column;
718
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import { SearchTerm } from './searchTerm.type';
2+
import { Column } from './column.interface';
23
import { ColumnFilters } from './columnFilters.interface';
4+
import { OperatorType } from './operatorType.enum';
5+
import { OperatorString } from 'dist/public_api';
36

47
export interface FilterChangedArgs {
8+
clearFilterTriggered?: boolean;
9+
columnDef: Column;
510
columnFilters: ColumnFilters;
611
grid: any;
12+
operator: OperatorType | OperatorString;
713
searchTerms: SearchTerm[];
14+
shouldTriggerQuery?: boolean;
815
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { OperatorType } from './operatorType.enum';
2+
import { OperatorString } from './operatorString';
3+
24
export interface GraphqlFilteringOption {
35
field: string;
4-
operator: OperatorType;
6+
operator: OperatorType | OperatorString;
57
value: any | any[];
68
}

src/app/modules/angular-slickgrid/models/graphqlServiceOption.interface.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ export interface GraphqlServiceOption extends BackendServiceOption {
1212
*/
1313
addLocaleIntoQuery?: boolean;
1414

15-
/** Array of column ids that are included in the column definitions */
16-
columnIds?: string[];
17-
1815
/** What is the dataset, this is required for the GraphQL query to be built */
1916
datasetName?: string;
2017

src/app/modules/angular-slickgrid/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export * from './headerMenuOnCommandArgs.interface';
7979
export * from './headerMenuOnBeforeMenuShowArgs.interface';
8080
export * from './htmlElementPosition.interface';
8181
export * from './keyCode.enum';
82+
export * from './multiColumnSort.interface';
8283
export * from './multipleSelectOption.interface';
8384
export * from './odataOption.interface';
8485
export * from './onEventArgs.interface';
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { ColumnSort } from './columnSort.interface';
2+
3+
export interface MultiColumnSort {
4+
/** SlickGrid grid object */
5+
grid?: any;
6+
7+
/** Defaults to false, is it a multi-column sort? */
8+
multiColumnSort?: boolean;
9+
10+
/** Array of Columns to be sorted */
11+
sortCols: ColumnSort[];
12+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type OperatorString = '' | '<>' | '!=' | '=' | '==' | '>' | '>=' | '<' | '<=' | '*' | 'a*' | '*z' | 'EQ' | 'GE' | 'GT' | 'NE' | 'LE' | 'LT' | 'IN' | 'NIN' | 'NOT_IN' | 'IN_CONTAINS' | 'NIN_CONTAINS' | 'NOT_IN_CONTAINS';
1+
export type OperatorString = '' | '<>' | '!=' | '=' | '==' | '>' | '>=' | '<' | '<=' | '*' | 'a*' | '*z' | 'EQ' | 'GE' | 'GT' | 'NE' | 'LE' | 'LT' | 'IN' | 'NIN' | 'NOT_IN' | 'IN_CONTAINS' | 'NIN_CONTAINS' | 'NOT_IN_CONTAINS' | 'endsWith' | 'startsWith';
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
/** @deprecated to be replaced in the future by ColumnSort | MultiColumnSort */
12
export interface SortChangedArgs {
23
multiColumnSort?: boolean;
3-
sortAsc: boolean;
4+
sortAsc?: boolean;
45
sortCol?: any;
56
sortCols?: any[];
67
}

0 commit comments

Comments
 (0)