@@ -4,8 +4,10 @@ import { DataUtil } from '../../data-operations/data-util';
44import { FilteringExpressionsTree , IFilteringExpressionsTree } from '../../data-operations/filtering-expressions-tree' ;
55import { IFilteringStrategy } from '../../data-operations/filtering-strategy' ;
66import { IPivotConfiguration , IPivotDimension , IPivotKeys } from './pivot-grid.interface' ;
7- import { DimensionValuesFilteringStrategy , PivotColumnDimensionsStrategy ,
8- PivotRowDimensionsStrategy } from '../../data-operations/pivot-strategy' ;
7+ import {
8+ DimensionValuesFilteringStrategy , PivotColumnDimensionsStrategy ,
9+ PivotRowDimensionsStrategy
10+ } from '../../data-operations/pivot-strategy' ;
911import { PivotUtil } from './pivot-util' ;
1012import { FilteringLogic } from '../../data-operations/filtering-expression.interface' ;
1113import { GridBaseAPIService , IgxGridBaseDirective } from '../hierarchical-grid/public_api' ;
@@ -29,18 +31,18 @@ export class IgxPivotRowPipe implements PipeTransform {
2931 _ : Map < any , boolean > ,
3032 _pipeTrigger ?: number ,
3133 __ ?,
32- pivotKeys : IPivotKeys = { aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' }
34+ pivotKeys : IPivotKeys = { aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' }
3335 ) : any [ ] {
3436 const enabledRows = config . rows . filter ( x => x . enabled ) ;
35- const rowStrategy = config . rowStrategy || PivotRowDimensionsStrategy . instance ( ) ;
37+ const rowStrategy = config . rowStrategy || PivotRowDimensionsStrategy . instance ( ) ;
3638 return rowStrategy . process ( collection . slice ( 0 ) , enabledRows , config . values , pivotKeys ) ;
3739 }
3840}
3941
4042/**
4143 * @hidden
4244 */
43- @Pipe ( {
45+ @Pipe ( {
4446 name : 'pivotGridRowExpansion' ,
4547 pure : true
4648} )
@@ -54,7 +56,7 @@ export class IgxPivotRowExpansionPipe implements PipeTransform {
5456 expansionStates : Map < any , boolean > ,
5557 _pipeTrigger ?: number ,
5658 __ ?,
57- pivotKeys : IPivotKeys = { aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' }
59+ pivotKeys : IPivotKeys = { aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' }
5860 ) : any [ ] {
5961 const enabledRows = config . rows . filter ( x => x . enabled ) ;
6062 const data = collection ? collection . slice ( 0 ) : [ ] ;
@@ -99,7 +101,7 @@ export class IgxPivotColumnPipe implements PipeTransform {
99101 _ : Map < any , boolean > ,
100102 _pipeTrigger ?: number ,
101103 __ ?,
102- pivotKeys : IPivotKeys = { aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' }
104+ pivotKeys : IPivotKeys = { aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' }
103105 ) : any [ ] {
104106 const enabledColumns = config . columns . filter ( x => x . enabled ) ;
105107 const enabledValues = config . values . filter ( x => x . enabled ) ;
@@ -112,7 +114,7 @@ export class IgxPivotColumnPipe implements PipeTransform {
112114/**
113115 * @hidden
114116 */
115- @Pipe ( {
117+ @Pipe ( {
116118 name : 'pivotGridFilter' ,
117119 pure : true
118120} )
@@ -154,20 +156,25 @@ export class IgxPivotGridFilterPipe implements PipeTransform {
154156/**
155157 * @hidden
156158 */
157- @Pipe ( {
159+ @Pipe ( {
158160 name : 'pivotGridColumnSort' ,
159161 pure : true
160162} )
161163export class IgxPivotGridSortingPipe implements PipeTransform {
162164
163- public transform ( collection : any [ ] , expressions : ISortingExpression [ ] , sorting : IGridSortingStrategy , pipeTrigger : number ) : any [ ] {
165+ public transform (
166+ collection : any [ ] ,
167+ expressions : ISortingExpression [ ] ,
168+ sorting : IGridSortingStrategy ,
169+ pipeTrigger : number ,
170+ pivotKeys : IPivotKeys = { aggregations : 'aggregations' , records : 'records' , children : 'children' , level : 'level' }
171+ ) : any [ ] {
164172 let result : any [ ] ;
165173
166174 if ( ! expressions . length ) {
167175 result = collection ;
168176 } else {
169- // TODO - sort recursively in all records collections.
170- result = DataUtil . sort ( cloneArray ( collection ) , expressions , sorting ) ;
177+ result = PivotUtil . sort ( cloneArray ( collection , true ) , expressions , sorting , pivotKeys ) ;
171178 }
172179 return result ;
173180 }
0 commit comments