Skip to content

Commit 50b0274

Browse files
committed
fix(grids): base types and implementations strict incompatibilities
1 parent a6770ea commit 50b0274

File tree

9 files changed

+33
-36
lines changed

9 files changed

+33
-36
lines changed

projects/igniteui-angular/core/src/data-operations/grid-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ export interface ColumnType extends FieldType {
330330
* The immediate parent (right above) column of this column (if any).
331331
* If there is no parent, that means the current column is the root parent
332332
*/
333-
parent?: ColumnType;
333+
parent: ColumnType | null;
334334
pipeArgs: IColumnPipeArgs;
335335
hasNestedPath: boolean;
336336
additionalTemplateContext: any;

projects/igniteui-angular/grids/core/src/api.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ export class GridBaseAPIService<T extends GridType> implements GridServiceType {
3131
public cms = inject(IgxColumnMovingService)
3232

3333
public grid: T;
34-
protected destroyMap: Map<string, Subject<boolean>> = new Map<string, Subject<boolean>>();
34+
protected destroyMap: Map<string, Subject<boolean>> = new Map<string, Subject<boolean>>();
3535

3636
public get_column_by_name(name: string): ColumnType {
3737
return this.grid.columns.find((col: ColumnType) => col.field === name);
3838
}
3939

40-
public get_summary_data() {
40+
public get_summary_data(): any[] | null {
4141
const grid = this.grid;
4242
let data = grid.filteredData;
4343
if (data && grid.hasPinnedRecords) {

projects/igniteui-angular/grids/core/src/columns/column.component.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,10 +1801,8 @@ export class IgxColumnComponent implements AfterContentInit, OnDestroy, ColumnTy
18011801
* ```typescript
18021802
* this.column.parent = higherLevelColumn;
18031803
* ```
1804-
*
1805-
* @memberof IgxColumnComponent
18061804
*/
1807-
public parent = null;
1805+
public parent: ColumnType | null = null;
18081806

18091807
/* blazorSuppress */
18101808
/**

projects/igniteui-angular/grids/core/src/common/grid.interface.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const IGX_GRID_SERVICE_BASE = /*@__PURE__*/new InjectionToken<GridService
2727

2828
export interface IGridDataBindable extends GridTypeBase {
2929
data: any[] | null;
30-
get filteredData(): any[];
30+
get filteredData(): any[] | null;
3131
}
3232

3333
/* marshalByValue */
@@ -385,7 +385,7 @@ export interface GridServiceType {
385385
get_row_expansion_state(id: any): boolean;
386386
/** Represents a method declaration for setting a new expansion state. It can be triggered by an event */
387387
set_row_expansion_state(id: any, expanded: boolean, event?: Event): void;
388-
get_summary_data(): any[];
388+
get_summary_data(): any[] | null;
389389

390390
prepare_sorting_expression(stateCollections: Array<Array<any>>, expression: ISortingExpression): void;
391391
/**
@@ -417,7 +417,7 @@ export interface GridServiceType {
417417
clear_groupby?(field: string | any): void;
418418
getParentRowId?(child: GridType): any;
419419
getChildGrids?(inDepth?: boolean): GridType[];
420-
getChildGrid?(path: IPathSegment[]): GridType;
420+
getChildGrid?(path: IPathSegment[]): GridType | undefined;
421421

422422
unsetChildRowIsland?(rowIsland: GridType): void;
423423
registerChildRowIsland?(rowIsland: GridType): void;
@@ -497,7 +497,7 @@ export interface GridType extends IGridDataBindable {
497497
/** @hidden @internal */
498498
tfoot: ElementRef<HTMLElement>;
499499
/** @hidden @internal */
500-
paginator: IgxPaginatorComponent;
500+
paginator?: IgxPaginatorComponent;
501501
/** @hidden @internal */
502502
paginatorList?: QueryList<IgxPaginatorComponent>;
503503
/** @hidden @internal */
@@ -691,7 +691,7 @@ export interface GridType extends IGridDataBindable {
691691
dataView: any[];
692692
_filteredUnpinnedData: any[];
693693
_filteredSortedUnpinnedData: any[];
694-
filteredSortedData: any[];
694+
filteredSortedData: any[] | null;
695695
dataWithAddedInTransactionRows: any[];
696696
/** Represents the transaction service for the grid. */
697697
readonly transactions: TransactionService<Transaction, State>;

projects/igniteui-angular/grids/grid/src/grid-base.directive.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,11 +2729,11 @@ export abstract class IgxGridBaseDirective implements GridType,
27292729
}
27302730

27312731
/** @hidden @internal */
2732-
public get activeDescendant() {
2732+
public get activeDescendant(): string | undefined {
27332733
const activeElem = this.navigation.activeNode;
27342734

27352735
if (!activeElem || !Object.keys(activeElem).length || activeElem.row < 0) {
2736-
return null;
2736+
return;
27372737
}
27382738
return `${this.id}_${activeElem.row}_${activeElem.column}`;
27392739
}
@@ -2773,7 +2773,7 @@ export abstract class IgxGridBaseDirective implements GridType,
27732773
/**
27742774
* @hidden @internal
27752775
*/
2776-
public get maxLevelHeaderDepth() {
2776+
public get maxLevelHeaderDepth(): number {
27772777
if (this._maxLevelHeaderDepth === null) {
27782778
this._maxLevelHeaderDepth = this.hasColumnLayouts ?
27792779
this._columns.reduce((acc, col) => Math.max(acc, col.rowStart), 0) :
@@ -3139,7 +3139,7 @@ export abstract class IgxGridBaseDirective implements GridType,
31393139
/**
31403140
* @hidden
31413141
*/
3142-
protected _maxLevelHeaderDepth = null;
3142+
protected _maxLevelHeaderDepth = 0;
31433143
/**
31443144
* @hidden
31453145
*/
@@ -3353,7 +3353,7 @@ export abstract class IgxGridBaseDirective implements GridType,
33533353
* const filteredSortedData = this.grid1.filteredSortedData;
33543354
* ```
33553355
*/
3356-
public get filteredSortedData(): any[] {
3356+
public get filteredSortedData(): any[] | null {
33573357
return this._filteredSortedData;
33583358
}
33593359

projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid-api.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class IgxHierarchicalGridAPIService extends GridBaseAPIService<GridType>
2525
return this.childRowIslands.get(key);
2626
}
2727

28-
public getChildGrid(path: Array<IPathSegment>) {
28+
public getChildGrid(path: Array<IPathSegment>): GridType | undefined {
2929
const currPath = path;
3030
let grid;
3131
const pathElem = currPath.shift();

projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ const MINIMUM_COLUMN_WIDTH_SUPER_COMPACT = 104;
153153
})
154154
export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnInit, AfterContentInit,
155155
PivotGridType, AfterViewInit, OnChanges {
156-
public override readonly gridAPI = inject<GridBaseAPIService<IgxGridBaseDirective & GridType>>(GridBaseAPIService);
157156
public override navigation = inject(IgxPivotGridNavigationService);
158157
protected override colResizingService = inject(IgxPivotColumnResizingService);
159158

@@ -676,8 +675,8 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
676675
* @hidden @internal
677676
*/
678677
@Input()
679-
public override get pagingMode() {
680-
return;
678+
public override get pagingMode(): GridPagingMode {
679+
return 'local';
681680
}
682681

683682
public override set pagingMode(_val: GridPagingMode) {
@@ -688,8 +687,8 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
688687
*/
689688
@WatchChanges()
690689
@Input({ transform: booleanAttribute })
691-
public override get hideRowSelectors() {
692-
return;
690+
public override get hideRowSelectors(): boolean {
691+
return false;
693692
}
694693

695694
public override set hideRowSelectors(_value: boolean) {
@@ -733,7 +732,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
733732
*/
734733
@Input({ transform: booleanAttribute })
735734
public override get rowDraggable(): boolean {
736-
return;
735+
return false;
737736
}
738737

739738

@@ -789,7 +788,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
789788
*/
790789
@Input()
791790
public override get perPage(): number {
792-
return;
791+
return 0;
793792
}
794793

795794
public override set perPage(_val: number) {
@@ -894,7 +893,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
894893
}
895894

896895
/**
897-
* @hidden @interal
896+
* @hidden @internal
898897
*/
899898
@Input()
900899
public override get summaryCalculationMode() {
@@ -905,7 +904,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
905904
}
906905

907906
/**
908-
* @hidden @interal
907+
* @hidden @internal
909908
*/
910909
@Input({ transform: booleanAttribute })
911910
public override get showSummaryOnCollapse() {
@@ -918,23 +917,23 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
918917
/**
919918
* @hidden @internal
920919
*/
921-
public override get hiddenColumnsCount() {
922-
return null;
920+
public override get hiddenColumnsCount(): number {
921+
return 0;
923922
}
924923

925924
/**
926925
* @hidden @internal
927926
*/
928-
public override get pinnedColumnsCount() {
929-
return null;
927+
public override get pinnedColumnsCount(): number {
928+
return 0;
930929
}
931930

932931
/**
933932
* @hidden @internal
934933
*/
935934
@Input({ transform: booleanAttribute })
936935
public override get batchEditing(): boolean {
937-
return;
936+
return false;
938937
}
939938

940939
public override set batchEditing(_val: boolean) {
@@ -1276,7 +1275,7 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
12761275
* @hidden @internal
12771276
*/
12781277
public override isRecordPinnedByIndex(_rowIndex: number) {
1279-
return null;
1278+
return false;
12801279
}
12811280

12821281
/**
@@ -1991,9 +1990,9 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
19911990
}
19921991

19931992
/** @hidden @internal */
1994-
public override get activeDescendant() {
1993+
public override get activeDescendant(): string | undefined {
19951994
if (this.navigation.isRowHeaderActive || this.navigation.isRowDimensionHeaderActive) {
1996-
return null;
1995+
return;
19971996
}
19981997
return super.activeDescendant;
19991998
}

projects/igniteui-angular/grids/tree-grid/src/tree-grid-api.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class IgxTreeGridAPIService extends GridBaseAPIService<GridType> {
2828
return data;
2929
}
3030

31-
public override get_summary_data() {
31+
public override get_summary_data(): any[] | null {
3232
const grid = this.grid;
3333
const data = grid.processedRootRecords?.filter(row => row.isFilteredOutParent === undefined || row.isFilteredOutParent === false)
3434
.map(rec => rec.data);

projects/igniteui-angular/grids/tree-grid/src/tree-grid.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ export class IgxTreeGridComponent extends IgxGridBaseDirective implements GridTy
518518
super.ngAfterContentInit();
519519
}
520520

521-
public override getDefaultExpandState(record: ITreeGridRecord) {
521+
public override getDefaultExpandState(record: ITreeGridRecord): boolean {
522522
return record.children && record.children.length && record.level < this.expansionDepth;
523523
}
524524

0 commit comments

Comments
 (0)