@@ -52,7 +52,7 @@ export interface IGridStateOptions {
52
52
rowPinning ?: boolean ;
53
53
pinningConfig ?: boolean ;
54
54
expansion ?: boolean ;
55
- inheritance ?: boolean ;
55
+ rowIslands ?: boolean ;
56
56
}
57
57
58
58
export interface IColumnState {
@@ -82,7 +82,7 @@ export type GridFeatures = keyof IGridStateOptions;
82
82
export interface Feature {
83
83
getFeatureState : ( context : IgxGridStateDirective ) => IGridState ;
84
84
restoreFeatureState : ( context : IgxGridStateDirective , state : IColumnState [ ] | IPagingState | ISortingExpression [ ] |
85
- IGroupingState | FilteringExpressionsTree | GridSelectionRange [ ] | IPinningConfig | any [ ] ) => void ;
85
+ IGroupingState | IFilteringExpressionsTree | GridSelectionRange [ ] | IPinningConfig | any [ ] ) => void ;
86
86
}
87
87
88
88
@Directive ( {
@@ -93,7 +93,7 @@ export class IgxGridStateDirective {
93
93
/**
94
94
* @hidden @internal
95
95
*/
96
- public features : string [ ] = [ ] ;
96
+ public features : GridFeatures [ ] = [ ] ;
97
97
/**
98
98
* @hidden @internal
99
99
*/
@@ -114,7 +114,7 @@ export class IgxGridStateDirective {
114
114
columnSelection : true ,
115
115
rowPinning : true ,
116
116
expansion : true ,
117
- inheritance : true
117
+ rowIslands : true
118
118
} ;
119
119
120
120
/**
@@ -136,7 +136,7 @@ export class IgxGridStateDirective {
136
136
if ( ! ( this . grid instanceof IgxGridComponent ) ) {
137
137
delete this . _options . groupBy ;
138
138
} else {
139
- delete this . _options . inheritance ;
139
+ delete this . _options . rowIslands ;
140
140
}
141
141
}
142
142
@@ -162,7 +162,7 @@ export class IgxGridStateDirective {
162
162
* let state = this.state(false) // returns `IGridState` object
163
163
* ```
164
164
*/
165
- public getState ( serialize = true , features ?: string | string [ ] ) : IGridState | string {
165
+ public getState ( serialize = true , features ?: GridFeatures | GridFeatures [ ] ) : IGridState | string {
166
166
let state : IGridState | string ;
167
167
this . currGrid = this . grid ;
168
168
this . state = state = this . buildState ( features ) as IGridState ;
@@ -184,7 +184,7 @@ export class IgxGridStateDirective {
184
184
* this.state.setState(gridState);
185
185
* ```
186
186
*/
187
- public setState ( state : IGridState | string , features ?: string | string [ ] ) {
187
+ public setState ( state : IGridState | string , features ?: GridFeatures | GridFeatures [ ] ) {
188
188
if ( typeof state === 'string' ) {
189
189
state = JSON . parse ( state ) as IGridState ;
190
190
}
@@ -197,12 +197,11 @@ export class IgxGridStateDirective {
197
197
* Builds an IGridState object.
198
198
* @hidden @internal
199
199
*/
200
- public buildState ( keys ?: string | string [ ] ) : IGridState {
200
+ public buildState ( keys ?: GridFeatures | GridFeatures [ ] ) : IGridState {
201
201
this . applyFeatures ( keys ) ;
202
202
let gridState = { } as IGridState ;
203
203
this . features . forEach ( f => {
204
204
if ( this . options [ f ] ) {
205
- f = f === 'inheritance' ? 'rowIslands' : f ;
206
205
if ( ! ( this . grid instanceof IgxGridComponent ) && f === 'groupBy' ) {
207
206
return ;
208
207
}
@@ -218,11 +217,10 @@ export class IgxGridStateDirective {
218
217
* The method that calls corresponding methods to restore features from the passed IGridState object.
219
218
* @hidden @internal
220
219
*/
221
- public restoreGridState ( state : IGridState , features ?: string | string [ ] ) {
220
+ public restoreGridState ( state : IGridState , features ?: GridFeatures | GridFeatures [ ] ) {
222
221
this . applyFeatures ( features ) ;
223
222
this . features . forEach ( f => {
224
223
if ( this . options [ f ] ) {
225
- f = f === 'inheritance' ? 'rowIslands' : f ;
226
224
const featureState = state [ f ] ;
227
225
if ( featureState ) {
228
226
const feature = this . getFeature ( f ) ;
@@ -235,14 +233,14 @@ export class IgxGridStateDirective {
235
233
/**
236
234
* Returns a collection of all grid features.
237
235
*/
238
- private applyFeatures ( keys ?: string | string [ ] ) {
236
+ private applyFeatures ( keys ?: GridFeatures | GridFeatures [ ] ) {
239
237
this . features = [ ] ;
240
238
if ( ! keys ) {
241
239
for ( const key of Object . keys ( this . options ) ) {
242
- this . features . push ( key ) ;
240
+ this . features . push ( key as GridFeatures ) ;
243
241
}
244
242
} else if ( Array . isArray ( keys ) ) {
245
- this . features = [ ...keys as string [ ] ] ;
243
+ this . features = [ ...keys as GridFeatures [ ] ] ;
246
244
} else {
247
245
this . features . push ( keys ) ;
248
246
}
0 commit comments