@@ -3,29 +3,55 @@ import { FilteringExpressionsTree } from '../../data-operations/filtering-expres
33import { SortingDirection } from '../../data-operations/sorting-strategy' ;
44import { ColumnType } from '../common/grid.interface' ;
55
6+
7+ /**
8+ * Default pivot keys used for data processing in the pivot pipes.
9+ */
610export const DEFAULT_PIVOT_KEYS = {
711 aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' ,
812 rowDimensionSeparator : '_' , columnDimensionSeparator : '-'
913} ;
1014
15+
16+ /**
17+ * Event emitted when dimension collection for rows, columns of filters is changed.
18+ */
1119export interface IDimensionsChange {
20+ /** The new list of dimensions. */
1221 dimensions : IPivotDimension [ ] ,
22+ /** The dimension list type - Row, Column or Filter. */
1323 dimensionCollectionType : PivotDimensionType
1424}
1525
26+ /**
27+ * Event emitted when values list is changed.
28+ */
1629export interface IValuesChange {
30+ /** The new list of values. */
1731 values : IPivotValue [ ]
1832}
1933
34+ /**
35+ * Interface describing Pivot data processing for dimensions.
36+ * Should contain a process method and return records hierarchy based on the provided dimensions.
37+ */
2038export interface IPivotDimensionStrategy {
2139 process ( collection : any ,
2240 dimensions : IPivotDimension [ ] ,
2341 values : IPivotValue [ ] ,
2442 pivotKeys ?: IPivotKeys ) : any [ ] ;
2543}
2644
45+ /**
46+ * Interface describing a PivotAggregation function.
47+ * Accepts an array of extracted data members and a array of the original data records.
48+ */
2749export type PivotAggregation = ( members : any [ ] , data : any [ ] ) => any ;
2850
51+ /**
52+ * Interface describing a IPivotAggregator class.
53+ * Used for specifying custom aggregator lists.
54+ */
2955export interface IPivotAggregator {
3056 /** Aggregation unique key. */
3157 key : string ;
@@ -38,7 +64,7 @@ export interface IPivotAggregator {
3864 aggregator : ( members : any [ ] , data ?: any [ ] ) => any ;
3965}
4066
41- /**
67+ /**
4268 * Configuration of the pivot grid.
4369 */
4470export interface IPivotConfiguration {
@@ -54,9 +80,13 @@ export interface IPivotConfiguration {
5480 values : IPivotValue [ ] | null ;
5581 /** Dimensions to be displayed in the filter area. */
5682 filters ?: IPivotDimension [ ] | null ;
83+ /** Pivot data keys used for data generation. Can be used for custom remote scenarios where the data is pre-populated. */
5784 pivotKeys ?: IPivotKeys ;
5885}
5986
87+ /**
88+ * Configuration of a pivot dimension.
89+ */
6090export interface IPivotDimension {
6191 /** Allows defining a hierarchy when multiple sub groups need to be extracted from single member. */
6292 childLevel ?: IPivotDimension ;
@@ -70,15 +100,24 @@ export interface IPivotDimension {
70100 * A predefined or defined via the `igxPivotSelector` filter expression tree for the current dimension to be applied in the filter pipe.
71101 * */
72102 filter ?: FilteringExpressionsTree | null ;
103+ /**
104+ * The sorting direction of the current dimension. Determines the order in which the values will appear in the related dimension.
105+ */
73106 sortDirection ?: SortingDirection ;
107+ /**
108+ * The dataType of the related data field.
109+ */
74110 dataType ?: GridColumnDataType ;
75- // The width of the dimension cells to be rendered.Can be pixel or %.
76- width ? : string ;
111+ /** The width of the dimension cells to be rendered.Can be pixel or %. */
112+ width ?: string ;
77113}
78-
114+ /**
115+ * Configuration of a pivot value aggregation.
116+ */
79117export interface IPivotValue {
118+ /** Field name to use in order to extract value. */
80119 member : string ;
81- // display name if present shows instead of member for the column header of this value
120+ /** Display name to show instead of member for the column header of this value. **/
82121 displayName ?: string ;
83122 /**
84123 * Active aggregator definition with key, label and aggregator.
@@ -88,34 +127,51 @@ export interface IPivotValue {
88127 * List of aggregates to show in aggregate drop-down.
89128 */
90129 aggregateList ?: IPivotAggregator [ ] ;
91- // Enables/Disables a particular value from pivot aggregation.
130+ /** Enables/Disables a particular value from pivot aggregation. */
92131 enabled : boolean ;
93- // Allow conditionally styling of the IgxPivotGrid cells
132+ /** Allow conditionally styling of the IgxPivotGrid cells. */
94133 styles ?: any ;
95- // Enables a data type specific template of the cells
134+ /** Enables a data type specific template of the cells */
96135 dataType ?: GridColumnDataType ;
97- // Applies display format to cell values.
136+ /** Applies display format to cell values. */
98137 formatter ?: ( value : any , rowData ?: any ) => any ;
99138}
100139
140+ /** Interface describing the Pivot data keys used for data generation.
141+ * Can be used for custom remote scenarios where the data is pre-populated.
142+ */
101143export interface IPivotKeys {
144+ /** Field that stores children for hierarchy building. */
102145 children : string ;
146+ /** Field that stores reference to the original data records. */
103147 records : string ;
148+ /** Field that stores aggregation values. */
104149 aggregations : string ;
150+ /** Field that stores dimension level based on its hierarchy. */
105151 level : string ;
152+ /** Separator used when generating the unique column field values. */
106153 columnDimensionSeparator : string ;
154+ /** Separator used when generating the unique row field values. */
107155 rowDimensionSeparator : string ;
108156}
109157
158+ /** The dimension types - Row, Column or Filter. */
110159export enum PivotDimensionType {
111160 Row ,
112161 Column ,
113162 Filter
114163}
115164
165+ /** Interface describing the pivot dimension data.
166+ * Contains additional information needed to render dimension headers.
167+ */
116168export interface IPivotDimensionData {
169+ /** Associated column definition. */
117170 column : ColumnType ;
171+ /** Associated dimension definition. */
118172 dimension : IPivotDimension ;
173+ /** List of previous dimension groups. */
119174 prevDimensions : IPivotDimension [ ] ;
175+ /** Whether this a child dimension. */
120176 isChild ?: boolean ;
121177}
0 commit comments