Skip to content

feat: let apps customize the filter popup's value list (#353) - #504

Open
michaelstonis wants to merge 4 commits into
mainfrom
feat/353-filter-popup-customization
Open

michaelstonis wants to merge 4 commits into
mainfrom
feat/353-filter-popup-customization

Conversation

@michaelstonis

Copy link
Copy Markdown
Contributor

Part of #353.

Changes

Apps can now change the filter popup's value list. Replacing the popup content per column is held back (see below).

KumikoSource.GetFilterValues(column) builds the list the popup shows: the distinct display values (GetUniqueColumnValues, so the other columns' filters still apply) as KumikoFilterValues, then raises KumikoSource.FilterValuesLoading once, then sorts by display text under the source's culture (blank entry first) unless the handler sets KeepOrder. With no handler the list is exactly what it was. DrawnFilterPopup loads its items from it: selection, the OK result and the existing-filter check state use Value; drawing and search use DisplayText (an empty display text shows the blanks label). Entries no row has can be added. Bucketed entries need a matching condition or a SetFilter predicate (documented on the event args and in the README); a KumikoFilterValue.Predicate is a possible follow-up.

FilterValuesLoading is forwarded on the MAUI and Uno KumikoDataGrid (KumikoDataGrid.Options.cs). Nothing under src/KumikoUI.Core/Input is changed.

Public API added (PublicAPI.Unshipped.txt for Core, Maui, Uno): KumikoFilterValue, KumikoFilterValuesLoadingEventArgs, KumikoSource.FilterValuesLoading, KumikoSource.GetFilterValues, DrawnFilterPopup.VisibleDisplayTexts, and KumikoDataGrid.FilterValuesLoading on both hosts.

Docs and samples. README ("Customizing the filter popup", events list, feature table), CHANGELOG entry, and a Filter Popup page in both sample apps (shared logic in samples/Shared/FilterPopupDemo.cs): State codes relabeled as names, and Status with Active first and Internal hidden.

Acceptance criteria

  • FilterValuesLoading can add, remove, reorder and relabel values; selection and search use Value and DisplayText; no handler means today's list.
  • FilterPopupFactory replaces the popup content, applies a filter through the context and closes; focus and keyboard work. Held, see below.
  • Behavior tests in tests/KumikoUI.Core.Tests for the value list, ordering and selection round trip (custom content open/apply/close is held).
  • Works on MAUI and Uno with the same event name for FilterValuesLoading (FilterPopupShown is held).
  • Sample page shows a relabeled value list (done, both apps) and a custom range filter (held).
  • XML docs on every new public member; PublicAPI.Unshipped.txt updated (the update script left the Core file empty in this environment, so lines were taken from the RS0016 diagnostics and merged sorted; additions only).
  • README filtering section and CHANGELOG entry under Unreleased.
  • The popup lists, searches and navigates by the display text (VisibleDisplayTexts exposes it); it has no separate accessibility tree.
  • No allocations added to the per-frame render path: the list is built once per open, and DrawnFilterPopup drawing is unchanged.

Held for Foundations #445 (popup manager)

Showing a column's own component as the filter popup needs changes in KumikoInputController (ShowFilterPopup, CloseFilterPopup, popup-close routing, ActiveTextInput, WouldHandleTab) while the popup manager and input work in #445 / #448 is in flight, so this half was removed from the branch (it exists in commits 65368e7 and 45f7532 of this branch's history). Removed:

  • API: KumikoColumn.FilterPopupFactory, KumikoFilterPopupContext (Column, Source, Style, ActiveFilter, Apply, Close), KumikoFilterPopupEventArgs, KumikoInputController.FilterPopupShown, and the FilterPopupShown event on both KumikoDataGrids.
  • Criteria not met: FilterPopupFactory replacing the content with focus and keyboard working; the typed popup-opened event; custom content open/apply/close tests; the custom range filter in the samples.
  • Behavior to restore on top of Kernel: popup manager and drawn focus manager usable by any control #445: a returned component placed below the header like the built-in popup, themed, focused, closed by an outside press, with Enter and Escape handled by the component; FilterPopupOpened / FilterPopupClosed raised for it too; FilterPopupShown raised after FilterPopupOpened for both popup kinds.

Verification

  • dotnet build src/KumikoUI.Core, src/KumikoUI.SkiaSharp, src/KumikoUI.Maui -f net10.0-maccatalyst, src/KumikoUI.Uno -f net10.0-desktop: 0 warnings, 0 errors.
  • Samples: samples/SampleApp.Maui -f net10.0-maccatalyst -p:KumikoDevFlow=false and samples/SampleApp.Uno -f net10.0-desktop: 0 errors (the default Debug MAUI sample build fails on an existing DevFlow package-version downgrade, NU1605).
  • dotnet test tests/KumikoUI.Core.Tests: 4372 passed, 5 skipped.
  • dotnet test tests/KumikoUI.Maui.Tests: 451 passed.
  • dotnet test tests/KumikoUI.Uno.Tests: 321 passed.
  • The README FilterValuesLoading snippet declares stateNames and uses the column name, so both documentation snippet projects (tests/KumikoUI.Docs.Snippets.Maui, .Uno) build with 0 errors.

@michaelstonis michaelstonis changed the title feat: customize the filter popup's value list and replace its content per column (#353) feat: let apps customize the filter popup's value list (#353) Nov 30, 2026
Comment on lines +57 to +59
foreach (var value in e.Values)
if (StateNames.TryGetValue(value.Value, out var name))
value.DisplayText = name;

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.

2 participants