Repository navigation
feat: choose a column's summary aggregates at runtime (#407) - #523
Open
michaelstonis wants to merge 2 commits into
Open
michaelstonis wants to merge 2 commits into
michaelstonis wants to merge 2 commits into
Conversation
9 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fromColumnMenuOpening(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 namedSummaries), adds or removes theSummaryColumnDescriptionfor the column'sPropertyNameand type, requests one rebuild and raisesSummaryChanged. An added aggregate has no label (theKumikoStringsdefault applies) and takes the column'sFormatfor 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.ReplaceColumnSummariesandClearColumnSummarieschange several at once with one rebuild and leave Custom aggregates alone.HasColumnSummaryandGetColumnSummariesread 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) andEffectiveAllowedSummaries: 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 aPropertyNameoffers 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 areSummary.<Type>,SummaryNone,Summaries.KumikoDataGrid: a row the source creates or removes is mirrored intoTableSummaryRows(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 useDataSourcedirectly.ApplyLayoutStatedoes 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.ColumnMenuOpeninghandler addsKumikoSummaryMenu.CreateItems(...).Public API (
src/KumikoUI.Core/PublicAPI.Unshipped.txt, added by hand from the RS0016 list becauseeng/update-public-api.shdoes not work in this environment):KumikoSummaryTypes,KumikoSummaryChangedEventArgs,KumikoSource.SetColumnSummary/ReplaceColumnSummaries/ClearColumnSummaries/HasColumnSummary/GetColumnSummaries/EditableSummaryRowName/DefaultEditableSummaryRowName/SummaryChanged,KumikoColumn.AllowedSummaries/EffectiveAllowedSummaries,KumikoSummaryMenu,KumikoStrings.SummaryMenuandSummaryNone.Acceptance criteria
tests/KumikoUI.Core.Tests/RuntimeSummaryEditingTests.cs, 24 cases, in a new file rather thanSummaryRowTests.cs): add and remove each type, row creation and reuse,EditableSummaryRowName, one rebuild per change,SummaryChanged, allowed types by column type, columns without a property.TableSummaryRowsstay in sync after a runtime change (host code builds; no host unit test for the sync, since the MAUI host cannot be unit-tested here).ColumnMenuOpening). The Uno sample builds; the MAUI sample could not be built here (pre-existing NU1605 package downgrade of Microsoft.Maui.Controls, unrelated to this change).PublicAPI.Unshipped.txtupdated (by hand, see above).AnnounceSummaryAdded/Removed) was added. Not done as a built-in; held with the built-in item for Kernel: split the grid frame into reusable painters and let panes share scroll state #446/Kernel: multi-pointer gesture recognizer (pan, pinch, wheel zoom about a point, fling) #448.AllowSummaryEditingon both hosts: held for Kernel: split the grid frame into reusable painters and let panes share scroll state #446/Kernel: multi-pointer gesture recognizer (pan, pinch, wheel zoom about a point, fling) #448 (it needs a change insideKumikoInputController).Verification
dotnet test tests/KumikoUI.Core.Tests: 4410 passed, 5 skipped, 0 failed (the German table inLocalizationTestsgained 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).kumiko, so both documentation snippet projects build with 0 errors.