Skip to content

feat: choose a column's summary aggregates at runtime (#407) - #523

Open
michaelstonis wants to merge 2 commits into
feat/389-stddev-var-distinctfrom
feat/407-runtime-aggregate-picker
Open

michaelstonis wants to merge 2 commits into
feat/389-stddev-var-distinctfrom
feat/407-runtime-aggregate-picker

Conversation

@michaelstonis

@michaelstonis michaelstonis commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Part of #407.

Stacked on #516: until that PR merges, this one also shows its commits.

Changes

Core API to add, remove and replace a column's summary aggregates while the grid runs, plus a helper that builds the column-menu entries for it. The built-in "Summaries" item of the header menu is held: it would have to be built inside KumikoInputController, which is being refactored under Foundations #446/#448, so this PR changes no input-controller or renderer file. Apps add the entries themselves from ColumnMenuOpening (the MAUI and Uno sample apps do).

  • KumikoSource.SetColumnSummary(column, type, enabled) finds or creates the editable table summary row (EditableSummaryRowName, else the first Bottom row, else a new row named Summaries), adds or removes the SummaryColumnDescription for the column's PropertyName and type, requests one rebuild and raises SummaryChanged. An added aggregate has no label (the KumikoStrings default applies) and takes the column's Format for Sum, Average, Min, Max, StdDev and StdDevPop (not for counts or variances, whose results are not in the column's unit). Aggregates go after the column's others. ReplaceColumnSummaries and ClearColumnSummaries change several at once with one rebuild and leave Custom aggregates alone. HasColumnSummary and GetColumnSummaries read the state. A row the source created is removed again when its last aggregate goes; a row the app defined is kept.
  • KumikoColumn.AllowedSummaries (KumikoSummaryTypes?, a flags enum) and EffectiveAllowedSummaries: null means by column type (numbers and progress bars all ten built-ins; date, time and date-time Count/Min/Max/DistinctCount; other columns Count/DistinctCount; selection and image none); a column without a PropertyName offers none. Adding a type the column does not allow is a no-op returning false; removing is always allowed.
  • KumikoSummaryMenu.CreateItems(source, column) (Components): separator, disabled "Summaries" caption, one check item per allowed type (label is the existing summary label without ": "), and a "None" item. Keys are Summary.<Type>, SummaryNone, Summaries.
  • MAUI and Uno KumikoDataGrid: a row the source creates or removes is mirrored into TableSummaryRows (with a guard so the collection's change handler does not clear and re-add the source's rows), so a later edit of the collection does not drop the user's summary. No new bindable properties: apps use DataSource directly.
  • ApplyLayoutState does not clear runtime summaries (tested). Saving them in the layout stays with Layout state: save and restore expanded groups, selection, scroll position and summary rows #354.
  • Samples (MAUI and Uno): the existing ColumnMenuOpening handler adds KumikoSummaryMenu.CreateItems(...).
  • Docs: README "Choosing summaries at runtime" subsection; CHANGELOG entry.

Public API (src/KumikoUI.Core/PublicAPI.Unshipped.txt, added by hand from the RS0016 list because eng/update-public-api.sh does not work in this environment): KumikoSummaryTypes, KumikoSummaryChangedEventArgs, KumikoSource.SetColumnSummary/ReplaceColumnSummaries/ClearColumnSummaries/HasColumnSummary/GetColumnSummaries/EditableSummaryRowName/DefaultEditableSummaryRowName/SummaryChanged, KumikoColumn.AllowedSummaries/EffectiveAllowedSummaries, KumikoSummaryMenu, KumikoStrings.SummaryMenu and SummaryNone.

Acceptance criteria

Verification

  • dotnet test tests/KumikoUI.Core.Tests: 4410 passed, 5 skipped, 0 failed (the German table in LocalizationTests gained the two new strings).
  • dotnet test tests/KumikoUI.Uno.Tests: 321 passed.
  • dotnet build src/KumikoUI.Core, src/KumikoUI.SkiaSharp, src/KumikoUI.Maui -f net10.0-maccatalyst: 0 warnings, 0 errors. dotnet build src/KumikoUI.Uno -f net10.0-desktop: 0 errors, 2 existing Uno0001 warnings in files this PR does not touch.
  • dotnet build samples/SampleApp.Uno -f net10.0-desktop: succeeded. samples/SampleApp.Maui: restore fails with NU1605 (existing).
  • The README aggregate picker snippet uses the README's kumiko, so both documentation snippet projects build with 0 errors.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant