Skip to content

Commit

Permalink
refactor: add missing internal types pt 2
Browse files Browse the repository at this point in the history
  • Loading branch information
spike-rabbit committed May 2, 2024
1 parent 31ffcae commit a30cdce
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class DataTableBodyCellComponent<TRow extends {level?: number} = any> imp
this.sortDir = this.calcSortDir(val);
}

get sorts(): any[] {
get sorts(): SortPropDir[] {
return this._sorts;
}

Expand Down Expand Up @@ -199,7 +199,7 @@ export class DataTableBodyCellComponent<TRow extends {level?: number} = any> imp
ghostLoaderTemplate: ViewContainerRef;

@HostBinding('class')
get columnCssClasses(): any {
get columnCssClasses(): string {
let cls = 'datatable-body-cell';
if (this.column.cellClass) {
if (typeof this.column.cellClass === 'string') {
Expand Down Expand Up @@ -268,15 +268,15 @@ export class DataTableBodyCellComponent<TRow extends {level?: number} = any> imp
return height + 'px';
}

sanitizedValue: any;
sanitizedValue: string;
value: any;
sortDir: SortDirection;
isFocused = false;

cellContext: CellContext<TRow>;

private _isSelected: boolean;
private _sorts: any[];
private _sorts: SortPropDir[];
private _column: TableColumn;
private _row: RowOrGroup<TRow>;
private _group: TRow[];
Expand Down Expand Up @@ -429,7 +429,7 @@ export class DataTableBodyCellComponent<TRow extends {level?: number} = any> imp
return;
}

const sort = sorts.find((s: any) => s.prop === this.column.prop);
const sort = sorts.find(s => s.prop === this.column.prop);

if (sort) {
return sort.dir as SortDirection;
Expand All @@ -447,7 +447,7 @@ export class DataTableBodyCellComponent<TRow extends {level?: number} = any> imp
this.treeAction.emit(this.row);
}

calcLeftMargin(column: any, row: RowOrGroup<TRow>) {
calcLeftMargin(column: TableColumn, row: RowOrGroup<TRow>) {
const levelIndent = column.treeLevelIndent != null ? column.treeLevelIndent : 50;
return column.isTreeColumn ? (row as TRow).level * levelIndent : 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class TestFixtureComponent {}
describe('DatatableGroupHeaderDirective', () => {
let fixture: ComponentFixture<TestFixtureComponent>;
let component: TestFixtureComponent;
let element: any;

// provide our implementations or mocks to the dependency injector
beforeEach(() => {
Expand All @@ -33,7 +32,6 @@ describe('DatatableGroupHeaderDirective', () => {
TestBed.compileComponents().then(() => {
fixture = TestBed.createComponent(TestFixtureComponent);
component = fixture.componentInstance;
element = fixture.nativeElement;
});
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import {
Output
} from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { RowOrGroup } from "../../types/group.type";
import { Group, RowOrGroup } from '../../types/group.type';
import { NgStyle } from '@angular/common';
import { RowDetailContext } from '../../types/detail-context.type';
import { GroupContext } from '../../types/cell-context.type';
import { DatatableGroupHeaderDirective } from './body-group-header.directive';
import { DatatableRowDetailDirective } from '../row-detail/row-detail.directive';

@Component({
selector: 'datatable-row-wrapper',
Expand Down Expand Up @@ -51,12 +52,12 @@ import { DatatableGroupHeaderDirective } from './body-group-header.directive';
})
export class DataTableRowWrapperComponent<TRow = any> implements DoCheck, OnInit {
@Input() innerWidth: number;
@Input() rowDetail: any;
@Input() rowDetail: DatatableRowDetailDirective;
@Input() groupHeader: DatatableGroupHeaderDirective;
@Input() offsetX: number;
@Input() detailRowHeight: any;
@Input() detailRowHeight: number;
@Input() row: RowOrGroup<TRow>;
@Input() groupedRows: any;
@Input() groupedRows: Group<TRow>[];
@Input() disableCheck: (row: RowOrGroup<TRow>) => boolean;
@Output() rowContextmenu = new EventEmitter<{ event: MouseEvent; row: RowOrGroup<TRow> }>(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ export class DataTableBodyComponent<TRow extends {treeStatus?: TreeStatus} = any
@Input() rowDetail: DatatableRowDetailDirective;
@Input() groupHeader: DatatableGroupHeaderDirective;
@Input() selectCheck: (value: TRow, index: number, array: TRow[]) => boolean;
@Input() displayCheck: any;
@Input() displayCheck: (row: TRow, column?: TableColumn, value?: any) => boolean;
@Input() trackByProp: string;
@Input() rowClass: NgClass['ngClass'];
@Input() groupedRows: any;
@Input() groupedRows: Group<TRow>[];
@Input() groupExpansionDefault: boolean;
@Input() innerWidth: number;
@Input() groupRowsBy: keyof TRow;
Expand Down Expand Up @@ -967,7 +967,7 @@ export class DataTableBodyComponent<TRow extends {treeStatus?: TreeStatus} = any
protected isGroup(row: RowOrGroup<TRow>[]): row is Group<TRow>[];
protected isGroup(row: RowOrGroup<TRow>): row is Group<TRow>;
protected isGroup(row: RowOrGroup<TRow> | RowOrGroup<TRow>[]): boolean {
return this.groupedRows;
return !!this.groupedRows;
}

protected isRow(row: RowOrGroup<TRow>): row is TRow {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ export class DatatableComponent<TRow = any> implements OnInit, DoCheck, AfterVie
* return row.name !== 'Ethel Price';
* }
*/
@Input() displayCheck: (row: TRow, column?: any, value?: any) => boolean;
@Input() displayCheck: (row: TRow, column?: TableColumn, value?: any) => boolean;

/**
* A boolean you can use to set the detault behaviour of rows and groups
Expand Down

0 comments on commit a30cdce

Please sign in to comment.