Repository navigation
feat: per-column filter operators, default operator and compare options (#373) - #511
Open
michaelstonis wants to merge 1 commit into
Open
michaelstonis wants to merge 1 commit into
michaelstonis wants to merge 1 commit into
Conversation
Comment on lines
+87
to
+88
| foreach (var op in keep) | ||
| if (op != null && !allowed.Contains(op)) allowed.Add(op); |
Comment on lines
+96
to
+97
| foreach (var op in list) | ||
| if (!result.Contains(op)) result.Add(op); |
Comment on lines
+174
to
+187
| foreach (var part in text.Split(',')) | ||
| { | ||
| var name = part.Trim(); | ||
| if (name.Length == 0) continue; | ||
| if (char.IsLetter(name[0]) && Enum.TryParse<TEnum>(name, ignoreCase: true, out var value) && Enum.IsDefined(value)) | ||
| { | ||
| if (!list.Contains(value)) list.Add(value); | ||
| } | ||
| else if (strict) | ||
| { | ||
| throw new ArgumentException( | ||
| $"'{name}' is not a {typeof(TEnum).Name} operator."); | ||
| } | ||
| } |
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 #373.
Changes
Per-column filter settings on
KumikoColumn(a Core object, so MAUI and Uno XAML and code get them without host properties).KumikoColumnis nowpartial; the new members live inKumikoColumn.FilterOptions.cs. The only edit toKumikoColumn.csis thepartialkeyword and re-parsingAllowedFilterOperatorsStringwhenColumnTypechanges.AllowedTextFilterOperators,AllowedNumericFilterOperators,AllowedDateFilterOperators: the operators the filter popup lists, in order. Null or empty offers all.AllowedFilterOperatorsString: XAML form ("Equals,StartsWith"), case-insensitive, parsed with genericEnum.TryParse<TEnum>(AOT-safe) against the enum ofColumnType(Text/ComboBox/Picker text; Numeric/ProgressBar numeric; Date/DateTime/Time date). An unknown name, a numeric string or a column type without operators throwsArgumentExceptionat assignment. WhenColumnTypechanges afterward the names are parsed again leniently (names that no longer fit are dropped).DefaultTextFilterOperator,DefaultNumericFilterOperator,DefaultDateFilterOperator,CreateDefaultFilterCondition(): an explicit default is honored as given; with none, the stock operator (Contains / Equals / Equals) applies, or the first allowed operator when the allowed list does not contain it.FilterCompareOptions: replacesKumikoSource.StringCompareOptionsfor the column's conditions and its value list (culture still the source's).FilterSpeccarries the per-column comparer;PrepareFilters(foreground and background builds, so the worker captures it with the other filter state),ViewBuilder.Passes,GetUniqueColumnValuesandFilterDescription.Evaluateuse it. The comparer is cached on the column, keyed by culture and options, so a rebuild does not allocate one per filter; no per-row allocation was added. Changing the option rebuilds an active filter.DrawnFilterPopup.Conditions.cs(small, focused edit): the operator drop-downs list the allowed operators plus the operators of conditions the column already has (so a condition set from code is never changed silently), and start on the default operator.FilterConditionTypesgained the helpers.SetColumnFilterdoes not reject disallowed operators (code is trusted); documented in the XML docs, README and CHANGELOG.PublicAPI.Unshipped.txt, 17 lines): the properties above andCreateDefaultFilterCondition()onKumikoColumn.KumikoRenderer,KumikoInputController, the hit tester.Acceptance criteria
KumikoColumnproperties with change notification and XAML string form on MAUI and Uno. Notification is tested; the string form is onKumikoColumnitself, shared by both hosts. Nullable-enum properties (DefaultTextFilterOperator="StartsWith",FilterCompareOptions="None") in Uno XAML were not verified in a running head; the string form covers operator lists either way.FilterCompareOptionschanges how that column's conditions and value list compare, without affecting other columns, in foreground and background rebuilds (tests for both).CreateDefaultFilterConditionhonors the default operators.tests/KumikoUI.Core.Tests: newColumnFilterOptionsTests(defaults, default condition, notification, string parsing and its errors, case sensitivity for conditions, value list andGetUniqueColumnValues, comparer cache, popup operator lists and defaults), a background case inBackgroundRebuildTests. ExistingFilterConditionTestsandFilterDescriptionTestspass unchanged; the filter-description behavior is covered in the new file.PublicAPI.Unshipped.txtupdated (the script emptied the file in this worktree, so the 17 lines were added by hand from the RS0016 list and sorted).Empty/NotEmptyis possible through the allowed list; noAllowValueListFilter) were left as scope cuts.Verification
dotnet build src/KumikoUI.Core: 0 warnings, 0 errorsdotnet build src/KumikoUI.SkiaSharp: 0 errorsdotnet build src/KumikoUI.Maui -f net10.0-maccatalyst: 0 errorsdotnet build src/KumikoUI.Uno -f net10.0-desktop: 0 errorsdotnet test tests/KumikoUI.Core.Tests: 4385 passed, 5 skipped, 0 faileddotnet test tests/KumikoUI.Uno.Tests: 321 passeddotnet test tests/KumikoUI.Maui.Tests: 449 passed