Skip to content

Commit 16050f5

Browse files
MKirovaMKirova
authored andcommitted
chore(*): Move logic to column actions as hiding/pinning directives already have function that determines if col should appear in ui - actionEnabledColumnsFilter. Same can be re-used to track potential changes.
1 parent d100df4 commit 16050f5

File tree

4 files changed

+4
-33
lines changed

4 files changed

+4
-33
lines changed

projects/igniteui-angular/src/lib/grids/column-actions/column-actions-base.directive.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ export abstract class IgxColumnActionsBaseDirective {
2323
*/
2424
public uncheckAllLabel: string;
2525

26-
/**
27-
* @hidden @internal
28-
*/
29-
public trackChanges: Function;
30-
3126
/**
3227
* @hidden @internal
3328
*/

projects/igniteui-angular/src/lib/grids/column-actions/column-actions.component.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import {
66
QueryList,
77
EventEmitter,
88
Output,
9-
AfterViewInit,
109
IterableDiffers,
1110
IterableDiffer,
12-
DoCheck,
13-
OnInit
11+
DoCheck
1412
} from '@angular/core';
1513
import { IgxColumnComponent } from '../columns/column.component';
1614
import { ColumnDisplayOrder } from '../common/enums';
@@ -31,10 +29,11 @@ let NEXT_ID = 0;
3129
selector: 'igx-column-actions',
3230
templateUrl: './column-actions.component.html'
3331
})
34-
export class IgxColumnActionsComponent implements DoCheck, OnInit {
32+
export class IgxColumnActionsComponent implements DoCheck {
3533
protected _differ: IterableDiffer<any> | null = null;
3634

3735
constructor (private differs: IterableDiffers) {
36+
this._differ = this.differs.find([]).create(this.trackChanges);
3837
}
3938

4039
/**
@@ -360,7 +359,7 @@ export class IgxColumnActionsComponent implements DoCheck, OnInit {
360359
* @hidden @internal
361360
*/
362361
public trackChanges = (index, col) => {
363-
return col.field;
362+
return col.field + '_' + this.actionsDirective.actionEnabledColumnsFilter(col, index, []);
364363
}
365364

366365
/**
@@ -375,13 +374,6 @@ export class IgxColumnActionsComponent implements DoCheck, OnInit {
375374
}
376375
}
377376

378-
/**
379-
* @hidden @internal
380-
*/
381-
ngOnInit() {
382-
this._differ = this.differs.find([]).create(this.trackChanges);
383-
}
384-
385377
/**
386378
* Unchecks all columns and performs the appropriate action.
387379
* @example

projects/igniteui-angular/src/lib/grids/column-actions/column-hiding.directive.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export class IgxColumnHidingDirective extends IgxColumnActionsBaseDirective {
1313
) {
1414
super();
1515
columnActions.actionsDirective = this;
16-
columnActions.trackChanges = this.trackColumnChanges;
1716
}
1817

1918
/**
@@ -52,13 +51,6 @@ export class IgxColumnHidingDirective extends IgxColumnActionsBaseDirective {
5251
return column.hidden;
5352
}
5453

55-
/**
56-
* @hidden @internal
57-
*/
58-
trackColumnChanges = (index, col) => {
59-
return col.field + '_' + col.disableHiding;
60-
}
61-
6254
/**
6355
* @hidden @internal
6456
*/

projects/igniteui-angular/src/lib/grids/column-actions/column-pinning.directive.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export class IgxColumnPinningDirective extends IgxColumnActionsBaseDirective {
1313
) {
1414
super();
1515
columnActions.actionsDirective = this;
16-
columnActions.trackChanges = this.trackColumnChanges;
1716
}
1817

1918
/**
@@ -52,13 +51,6 @@ export class IgxColumnPinningDirective extends IgxColumnActionsBaseDirective {
5251
return column.pinned;
5352
}
5453

55-
/**
56-
* @hidden @internal
57-
*/
58-
trackColumnChanges = (index, col) => {
59-
return col.field + '_' + col.disablePinning;
60-
}
61-
6254
/**
6355
* @hidden @internal
6456
*/

0 commit comments

Comments
 (0)