Repository navigation
feat: predefined column filters as toggles in the filter popup (#409) - #524
Open
michaelstonis wants to merge 6 commits into
Open
michaelstonis wants to merge 6 commits into
michaelstonis wants to merge 6 commits into
Conversation
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.
Closes #409.
Stacked on #504: until that PR merges, this one also shows its commits.
Changes
Apps can define named filters for a column and the filter popup shows them as toggles.
Definitions.
KumikoColumn.PredefinedFilters(anIList<KumikoPredefinedFilter>, created on first access so XAML can add to it). AKumikoPredefinedFilterhas a stableName, theTextthe popup shows, a declarativeCondition(aFilterCondition, so it works from XAML; its text value is read with the source's culture) and aPredicateon the cell value. With both set, both must pass; with neither the filter passes every row.Evaluation.
FilterDescription.PredefinedFilterNamesholds the checked names. A row passes the column filter when any checked predefined filter passes (OR), and the value list and conditions pass too (AND). Names the column does not define are ignored.IsActiveis true when a checked name is one the column defines, so the header glyph andItemPropertyImpact(row-affecting item changes) follow it, and an unknown name alone does not light the glyph.CloneForBuildsnapshots the checked filters (conditions cloned, predicates by reference), so a background build never reads the live column; the same code path serves the synchronous build, the publicEvaluateoverload andGetUniqueColumnValues.Popup.
DrawnFilterPopupdraws one check row per filter in a section between the Values | Conditions switch and the page (on both pages), with hover and keyboard-focus states like the other rows, and nothing when the column defines none (the popup height is unchanged then). The checks are pending state: OK applies them together with the value list and conditions (all values selected, no condition and no toggle still means no filter), Cancel discards, Clear unchecks them. The section is one Tab stop (FocusStop.Quick, between the mode switch and the search box); Up and Down move between rows, Space toggles, typing on the Values page returns to the search box. Pointer and key handling is insideDrawnFilterPopup(a new partial file,DrawnFilterPopup.Predefined.cs). Toggling announces the label through the popup's existing announcement event. Rows are check rows at the popup's fixed 220 px width; chips are not used.Layout state.
KumikoFilterLayoutState.PredefinedFilterssaves the checked names (sorted); definitions stay with the app. Unknown names survive a round trip and are ignored.No new
KumikoStringsmembers. Labels are app text and the section has no header.Public API added (
PublicAPI.Unshipped.txt, Core):KumikoPredefinedFilter(Name,Text,Condition,Predicate),KumikoColumn.PredefinedFilters,FilterDescription.PredefinedFilterNames,KumikoFilterLayoutState.PredefinedFilters,DrawnFilterPopup.PredefinedFilterTexts,DrawnFilterPopup.CheckedPredefinedFilters,DrawnFilterPopup.SetPredefinedFilterChecked. The hosts need nothing new: the definitions live onKumikoColumn, which both hosts already use in theirColumns(XAML and code).Scope. No file under
src/KumikoUI.Core/Input/and noKumikoRenderer*.csfile is touched (git diff main -- src/KumikoUI.Core/Inputis empty).Docs and sample. README "Predefined filters" subsection, CHANGELOG entry, and the Filter Popup sample page (both apps) gets three XAML-declared toggles on the Status column (nested
FilterConditionelements).Acceptance criteria
tests/KumikoUI.Core.Tests(Components/DrawnFilterPopupPredefinedTests.cs): OR among checked filters, AND with values and conditions, condition form (text value read as a number), predicate form, condition plus predicate, background build agreement (a gated build while the live definitions change), glyph/IsActivestate, OK, Cancel, Clear, mouse and keyboard toggling, layout round trip with unknown names. They are in one new file instead of the three files the issue names.FilterConditionelement parses in both XAML dialects (both samples compile it).PublicAPI.Unshipped.txtupdated (lines taken from the RS0016 diagnostics, merged in sorted order; the diff is additions only).Not part of this change (issue notes only): the grid-wide
KumikoSource.PredefinedFilterssecond stage (belongs with the filter bar, #374).Held for Foundations #445 (popup manager)
Nothing: no criterion needs the custom-content popup half.
Verification
dotnet build src/KumikoUI.Core,src/KumikoUI.SkiaSharp: 0 warnings, 0 errors.dotnet build src/KumikoUI.Maui -f net10.0-maccatalyst: 0 warnings, 0 errors.dotnet build src/KumikoUI.Uno -f net10.0-desktop: 0 errors; the 2 Uno0001 warnings are existing.dotnet build samples/SampleApp.Uno -f net10.0-desktopandsamples/SampleApp.Maui -f net10.0-maccatalyst -p:KumikoDevFlow=false: 0 errors.dotnet test tests/KumikoUI.Core.Tests: 4393 passed, 5 skipped (21 new).dotnet test tests/KumikoUI.Maui.Tests: 453 passed (2 new).dotnet test tests/KumikoUI.Uno.Tests: 321 passed.dotnet test tests/KumikoUI.SkiaSharp.Tests: 42 passed.state.Columnsis not null before searching it (CS8604 gone). Both documentation snippet projects build with 0 errors;tests/KumikoUI.Maui.Tests453 passed.