@gridkitjs/core v0.9.0
Minor Changes#
-
6e8189b: Aggregate functions:
computeAggregatesreduces rows through built-in reducers (sum,avg,min,max,count,countDistinct) or a customAggregateFn, andwithGroupAggregatesattaches each group's own subtotal to its header — or, withdisplay: "row", appends aResolvedGroupSummaryRowcarrying the same results as its own entry in the display list.AggregateSpec.alignmentoverrides that aggregate's own cell alignment, falling back to its column's ownalignmentwhen omitted. New exports:computeAggregates,withGroupAggregates, and the typesAggregateFn/AggregateSpec/AggregateState/AggregateResults/BuiltInAggregate/FooterTemplateContext/GroupAggregateDisplay/ResolvedGroupSummaryRow.Every aggregate — built-in or custom — is always computed from the full leaf-row set in scope, never combined from already-computed child results, so a non-associative aggregate (a custom "distinct count", for example) is never silently wrong at a nested group level. A collapsed group's subtotal is recomputed the same way, independent of its own collapse state. Under
display: "row", a group's own summary row is inserted immediately after its last visible entry at every nesting level, never splits from its group across a page boundary (paginateRowstreats it as part of the same unit), and never receives a keyboard tab stop —nextFocusForKeytakes a new optionalisSkippableRowpredicate soArrowUp/ArrowDown/PageUp/PageDown/Ctrl+Endstep over it.Breaking:
ResolvedGroupRowgains a requiredaggregates: AggregateResultsfield (empty when no aggregates are active), andDisplayRow<Row>widens to include the newResolvedGroupSummaryRowvariant — a caller doing an exhaustive"kind" in entrycheck now needs to also narrow onentry.kindto tell a group header apart from a summary row.ColumnDefinitiongains an optionalfooterTemplatefor rendering a column's own aggregate result. -
6e8189b: Pagination primitives:
paginateRowsslices aDisplayRow<Row>[]into pages, treating a top-level group and its whole subtree as one unit so a page never splits a group. New exports:paginateRows, and the typesPaginationState/PaginationChangeEvent.Breaking:
ResolvedRow/ResolvedGroupRow/CellTemplateContextgain a requireddatasetIndexfield — a row's absolute position in the whole filtered/sorted/grouped dataset, distinct fromrowIndex(which is scoped to what's currently rendered — the page, once pagination is in use). A caller constructing either of these directly, or reading a template context, needs to account for the new field. -
6e8189b: New export:
paginationWindow(currentPage, pageCount, options?), the boundary + sibling windowing logic behind a numbered pager — which page numbers to show and where to collapse a gap into aPaginationWindowEntry"ellipsis"entry.