Skip to content

Commit

Permalink
refactor(grid): replace any with strict types; update HeadSelectorSta…
Browse files Browse the repository at this point in the history
…tus enum
  • Loading branch information
jackofdiamond5 committed Aug 1, 2019
1 parent 653ee56 commit e62df92
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
17 changes: 8 additions & 9 deletions projects/igniteui-angular/src/lib/grids/grid-base.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export enum GridKeydownTargetType {
hierarchicalRow = 'hierarchicalRow'
}

export enum HeadSelectorStatus {
export enum TriState {
checked = 'checked',
unchecked = 'unchecked',
indeterminate = 'indeterminate'
Expand All @@ -262,7 +262,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
private _locale = null;
private _observer: MutationObserver;
protected _destroyed = false;
protected _headSelectorStatus: HeadSelectorStatus;
protected _headSelectorStatus: TriState;
private overlayIDs = [];
public rowSelected = false;

Expand Down Expand Up @@ -4622,15 +4622,15 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
const areNoneSelected = this.selection.are_none_selected(this.id);
if (headerStatus === undefined) {
if (this.allRowsSelected) {
this.headSelectorStatus = HeadSelectorStatus.checked;
this.headSelectorStatus = TriState.checked;
} else if (areNoneSelected) {
this.headSelectorStatus = HeadSelectorStatus.unchecked;
this.headSelectorStatus = TriState.unchecked;
} else {
this.headSelectorStatus = HeadSelectorStatus.indeterminate;
this.headSelectorStatus = TriState.indeterminate;
}
} else {
this.headSelectorStatus = headerStatus ?
HeadSelectorStatus.checked : HeadSelectorStatus.unchecked;
TriState.checked : TriState.unchecked;
}
if (this.headSelectorBaseTemplate) {
this.headSelectorBaseTemplate.indeterminate = !this.allRowsSelected && !areNoneSelected;
Expand All @@ -4643,12 +4643,11 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
this.cdr.markForCheck();
}

protected get headSelectorStatus(): HeadSelectorStatus {
protected get headSelectorStatus(): TriState {
return this._headSelectorStatus;
}

@Input()
protected set headSelectorStatus(v: HeadSelectorStatus) {
protected set headSelectorStatus(v: TriState) {
this._headSelectorStatus = v;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,10 @@ export class IgxGridComponent extends IgxGridBaseComponent implements IGridDataB
public dragIndicatorIconTemplate: TemplateRef<any> = null;

@ContentChild(IgxRowSelectorDirective, { read: TemplateRef, static: true })
public rowSelectorTemplate: TemplateRef<any>;
public rowSelectorTemplate: TemplateRef<IgxRowSelectorDirective>;

@ContentChild(IgxHeadSelectorDirective, { read: TemplateRef, static: true })
public headSelectorTemplate: TemplateRef<any>;
public headSelectorTemplate: TemplateRef<IgxHeadSelectorDirective>;

@ViewChildren(IgxGridGroupByRowComponent, { read: IgxGridGroupByRowComponent })
private _groupsRowList: QueryList<IgxGridGroupByRowComponent>;
Expand Down

0 comments on commit e62df92

Please sign in to comment.