@@ -40,7 +40,7 @@ import { PivotUtil } from './pivot-util';
40
40
selector : 'igx-pivot-header-row' ,
41
41
templateUrl : './pivot-header-row.component.html'
42
42
} )
43
- export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implements OnChanges {
43
+ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implements OnChanges {
44
44
public aggregateList : IPivotAggregator [ ] = [ ] ;
45
45
46
46
public value : IPivotValue ;
@@ -66,18 +66,34 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implem
66
66
super ( ref , cdr ) ;
67
67
}
68
68
69
- /** The virtualized part of the header row containing the unpinned header groups. */
70
- @ViewChildren ( 'headerVirtualContainer' , { read : IgxGridForOfDirective } )
71
- public headerContainers : QueryList < IgxGridForOfDirective < IgxGridHeaderGroupComponent > > ;
69
+ /** The virtualized part of the header row containing the unpinned header groups. */
70
+ @ViewChildren ( 'headerVirtualContainer' , { read : IgxGridForOfDirective } )
71
+ public headerContainers : QueryList < IgxGridForOfDirective < IgxGridHeaderGroupComponent > > ;
72
72
73
- public get headerForOf ( ) {
74
- return this . headerContainers . last ;
75
- }
73
+ public get headerForOf ( ) {
74
+ return this . headerContainers . last ;
75
+ }
76
76
77
77
@ViewChildren ( 'notifyChip' )
78
78
public notificationChips : QueryList < IgxChipComponent > ;
79
79
80
- public columnDimensionsByLevel : any [ ] ;
80
+ public columnDimensionsByLevel : any [ ] = [ ] ;
81
+ public get totalDepth ( ) {
82
+ const columnDimensions = this . grid . columnDimensions ;
83
+ if ( columnDimensions . length === 0 ) {
84
+ return 1 ;
85
+ }
86
+ let totalDepth = columnDimensions . map ( x => PivotUtil . getDimensionDepth ( x ) ) . reduce ( ( acc , val ) => acc + val ) + 1 ;
87
+ if ( this . grid . hasMultipleValues ) {
88
+ totalDepth += 1 ;
89
+ }
90
+ return totalDepth ;
91
+ }
92
+
93
+ public get maxContainerHeight ( ) {
94
+ return this . totalDepth * this . grid . renderedRowHeight ;
95
+ }
96
+
81
97
82
98
public populateColumnDimensionsByLevel ( ) {
83
99
const res = [ ] ;
@@ -87,11 +103,7 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implem
87
103
return ;
88
104
}
89
105
const cols = this . unpinnedColumnCollection ;
90
- let totalDepth = columnDimensions . map ( x => PivotUtil . getDimensionDepth ( x ) ) . reduce ( ( acc , val ) => acc + val ) + 1 ;
91
- if ( this . grid . hasMultipleValues ) {
92
- totalDepth += 1 ;
93
- }
94
- for ( let i = 0 ; i < totalDepth ; i ++ ) {
106
+ for ( let i = 0 ; i < this . totalDepth ; i ++ ) {
95
107
const lvl = i ;
96
108
const colsForLevel = cols . filter ( x => x . level === lvl ) ;
97
109
res [ i ] = colsForLevel ;
@@ -100,17 +112,17 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implem
100
112
}
101
113
102
114
public ngOnChanges ( changes : SimpleChanges ) {
103
- if ( changes . unpinnedColumnCollection ) {
115
+ if ( changes . unpinnedColumnCollection && this . unpinnedColumnCollection . length > 0 ) {
104
116
this . populateColumnDimensionsByLevel ( ) ;
105
- }
117
+ }
106
118
}
107
119
108
120
public onDimDragStart ( event , area ) {
109
121
this . cdr . detectChanges ( ) ;
110
122
for ( let chip of this . notificationChips ) {
111
123
if ( area . chipsList . toArray ( ) . indexOf ( chip ) === - 1 &&
112
- chip . nativeElement . parentElement . children . length > 0 &&
113
- chip . nativeElement . parentElement . children . item ( 0 ) . id !== 'empty' ) {
124
+ chip . nativeElement . parentElement . children . length > 0 &&
125
+ chip . nativeElement . parentElement . children . item ( 0 ) . id !== 'empty' ) {
114
126
chip . nativeElement . hidden = false ;
115
127
chip . nativeElement . scrollIntoView ( ) ;
116
128
}
@@ -124,7 +136,7 @@ export class IgxPivotHeaderRowComponent extends IgxGridHeaderRowComponent implem
124
136
}
125
137
126
138
public getAreaHeight ( area : IgxChipsAreaComponent ) {
127
- const chips = area . chipsList ;
139
+ const chips = area . chipsList ;
128
140
return chips && chips . length > 0 ? chips . first . nativeElement . clientHeight : 0 ;
129
141
}
130
142
0 commit comments