Skip to content

Review & update Grid summaries API surface #17403

Description

@damyanpetev

Sparked off from an discussion in #17389 (comment)

Thus far discovered:

We have ISummaryExpression that's public, but not documented. It's exported and listed in the API docs https://www.infragistics.com/api/angular/igniteui-angular/22.0.0/interfaces/ISummaryExpression/, yet it's not used anywhere. - I don't see it in docs and/or samples https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/summaries

There's exactly 1 use of ISummaryExpression and that's in a protected method:

protected _multipleSummaries(expressions: ISummaryExpression[], hasSummary: boolean) {

However, that method is in:
/**
* Enables summaries for the specified column and applies your customSummary.
*
* @remarks
* If you do not provide the customSummary, then the default summary for the column data type will be applied.
* @example
* ```typescript
* grid.enableSummaries([{ fieldName: 'ProductName' }, { fieldName: 'ID' }]);
* ```
* Enable summaries for the listed columns.
* @example
* ```typescript
* grid.enableSummaries('ProductName');
* ```
* @param rest
*/
public enableSummaries(...rest) {
if (rest.length === 1 && Array.isArray(rest[0])) {
this._multipleSummaries(rest[0], true);

Seems to me rest is actually ISummaryExpression[], technically ISummaryExpression[] | [fieldName: string, customSummary?: any] (destructed ISummaryExpression)?! looking at the way the description/logic is, but that should really be in overloads instead. Also the spread might be absolute bull, considering the logic uses [0] a lot... -.-
Pretty sure the same thing applies to the equivalent public disableSummaries() on first glance.

Then there's the customSummary prop:

export interface ISummaryExpression {
fieldName: string;
/* blazorCSSuppress */
customSummary?: any;
}

Whatever that is kind of hard to track, but it appears that's actually be IgxSummaryOperand but that's tracked from it being assigned to the respective column summaries, which opens another can of worms:

I've confirmed that's how the API entered initially (see #845) and there's nothing of note described in https://github.com/IgniteUI/igniteui-angular/wiki/Summaries-Specification, so usage mostly needs to be inferred from tests and samples I guess.

Bottomline:

  • Clean up the Grid summaries API & update the spec
  • Update docs & samples guidance
  • Enable noImplicitAny/strict and consider lint no-explicit-any errors in general. Beyond user-provided data and derived values, any is rarely an acceptable type on public API.

Metadata

Metadata

Type

Fields

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions