refactor(grids): make the type prop public for external integrations#17153
refactor(grids): make the type prop public for external integrations#17153damyanpetev wants to merge 1 commit intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors grid type identification by surfacing a public type discriminator ('flat' | 'tree' | 'hierarchical' | 'pivot') for external integrations and by using it internally where instanceof checks were previously required.
Changes:
- Publicly documents/exposes the
typegetter on the various grid implementations (flat/grid base, tree, hierarchical, pivot). - Moves the
typediscriminator into the coreGridTypeBasecontract and removes the duplicate declaration fromGridType. - Updates Excel exporter tests to detect hierarchical grids via
component.typeinstead ofinstanceof IgxHierarchicalGridComponent.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| projects/igniteui-angular/grids/tree-grid/src/tree-grid.component.ts | Publicly documents the Tree Grid type getter ('tree'). |
| projects/igniteui-angular/grids/pivot-grid/src/pivot-grid.component.ts | Publicly documents the Pivot Grid type getter ('pivot'). |
| projects/igniteui-angular/grids/hierarchical-grid/src/hierarchical-grid-base.directive.ts | Publicly documents the Hierarchical Grid type getter ('hierarchical'). |
| projects/igniteui-angular/grids/grid/src/grid-base.directive.ts | Publicly documents the base grid type getter ('flat'). |
| projects/igniteui-angular/grids/core/src/services/excel/excel-exporter-grid.spec.ts | Uses grid.type instead of instanceof to detect hierarchical grids in export verification. |
| projects/igniteui-angular/grids/core/src/common/grid.interface.ts | Removes the duplicate type declaration from GridType (now inherited via GridTypeBase). |
| projects/igniteui-angular/core/src/data-operations/grid-types.ts | Adds type to the public GridTypeBase interface. |
| data: any[] | null; | ||
| /* csSuppress */ | ||
| /** The type of the grid: `'flat'`, `'tree'`, `'hierarchical'`, or `'pivot'`. */ | ||
| readonly type: 'flat' | 'tree' | 'hierarchical' | 'pivot'; |
There was a problem hiding this comment.
GridTypeBase is exported from core/src/public_api.ts, so adding a required type property is a TypeScript breaking change for any external code that passes custom objects as GridTypeBase (or implements it) without this field. If the intent is only to improve typing, consider making type optional (and treat undefined as 'flat' internally), or document this as a breaking change with the appropriate changelog/migration steps.
| readonly type: 'flat' | 'tree' | 'hierarchical' | 'pivot'; | |
| readonly type?: 'flat' | 'tree' | 'hierarchical' | 'pivot'; |
Additional information (check all that apply):
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)