Skip to content

refactor(grids): make the type prop public for external integrations#17153

Open
damyanpetev wants to merge 1 commit intomasterfrom
dpetev/grid-type
Open

refactor(grids): make the type prop public for external integrations#17153
damyanpetev wants to merge 1 commit intomasterfrom
dpetev/grid-type

Conversation

@damyanpetev
Copy link
Copy Markdown
Member

@damyanpetev damyanpetev commented Apr 2, 2026

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 type getter on the various grid implementations (flat/grid base, tree, hierarchical, pivot).
  • Moves the type discriminator into the core GridTypeBase contract and removes the duplicate declaration from GridType.
  • Updates Excel exporter tests to detect hierarchical grids via component.type instead of instanceof 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';
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
readonly type: 'flat' | 'tree' | 'hierarchical' | 'pivot';
readonly type?: 'flat' | 'tree' | 'hierarchical' | 'pivot';

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants