Skip to content

Commit

Permalink
feat(grouping): add missing Grouping interface properties
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Apr 13, 2020
1 parent 57f6b8c commit 7c83fd0
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 6 deletions.
30 changes: 27 additions & 3 deletions packages/common/src/interfaces/grouping.interface.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
import { Aggregator } from './aggregator.interface';
import { GroupingComparerItem } from './groupingComparerItem.interface';
import { GroupingFormatterItem } from './groupingFormatterItem.interface';
import { SortDirectionNumber } from '../enums';

type GroupingGetterFunction = (value: any) => string;

export interface Grouping {
getter?: string;
comparer?: (a: any, b: any) => number;
formatter?: (g: any) => string;
/** Getter of the Column to be Grouped */
getter?: string | GroupingGetterFunction;

/** Grouping Aggregators array */
aggregators?: Aggregator[];

/** Defaults to false, are the Aggregator Collapsed when grid is loaded */
aggregateCollapsed?: boolean;

/** Defaults to false, is the Group Collapsed when grid is loaded */
collapsed?: boolean;

/** Sort Comparer callback method */
comparer?: (a: GroupingComparerItem, b: GroupingComparerItem) => SortDirectionNumber;

/** Defaults to false, do we want to display the row with Group Totals */
displayTotalsRow?: boolean;

/** String Formatter of the Grouping Header */
formatter?: (g: GroupingFormatterItem) => string;

/** Defaults to false, lazy load the Group Totals Calculation */
lazyTotalsCalculation?: boolean;

/** Set some predefined Grouping values */
predefinedValues?: any[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface GroupingComparerItem {
/** Grouped Comparer Count */
count: number;

/** Grouped Comparer Value */
value: any;
}
13 changes: 13 additions & 0 deletions packages/common/src/interfaces/groupingFormatterItem.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export interface GroupingFormatterItem {
/** Grouped Formatter Total Count */
count: number;

/** Grouped Formatter Depth Level */
level: number;

/** Grouping Formatter Key */
groupingKey: string;

/** Grouped Formatter Value */
value: any;
}
6 changes: 4 additions & 2 deletions packages/common/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export * from './gridServiceDeleteOption.interface';
export * from './gridServiceInsertOption.interface';
export * from './gridServiceUpdateOption.interface';
export * from './grouping.interface';
export * from './groupingComparerItem.interface';
export * from './groupingFormatterItem.interface';
export * from './groupTotalsFormatter.interface';
export * from './headerButton.interface';
export * from './headerButtonItem.interface';
Expand All @@ -72,8 +74,8 @@ export * from './menuCallbackArgs.interface';
export * from './menuCommandItem.interface';
export * from './menuCommandItemCallbackArgs.interface';
export * from './menuItem.interface';
export * from './menuOptionItem.interface';
export * from './menuOptionItemCallbackArgs.interface';
export * from './menuOptionItem.interface';
export * from './metrics.interface';
export * from './multiColumnSort.interface';
export * from './multipleSelectOption.interface';
Expand All @@ -86,6 +88,6 @@ export * from './selectOption.interface';
export * from './slickEvent.interface';
export * from './slickEventData.interface';
export * from './slickEventHandler.interface';
export * from './sortChangedArgs.interface';
export * from './sorter.interface';
export * from './sortChangedArgs.interface';
export * from './treeDataOption.interface';
2 changes: 1 addition & 1 deletion packages/common/src/interfaces/sorter.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Column } from './column.interface';
import { SortDirectionNumber } from '../enums/sortDirectionNumber.enum';

export type Sorter = (value1: any, value2: any, sortDirection: SortDirectionNumber, sortColumn?: Column) => number;
export type Sorter = (value1: any, value2: any, sortDirection: SortDirectionNumber, sortColumn?: Column) => SortDirectionNumber;

0 comments on commit 7c83fd0

Please sign in to comment.