-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MudChipSet: use SelectionMode
instead of MultiSelect
and Mandatory
#8722
Conversation
The collection comparer can only be added to _selectedValues state once #8661 is merged. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #8722 +/- ##
==========================================
+ Coverage 89.82% 90.14% +0.31%
==========================================
Files 412 419 +7
Lines 11878 12181 +303
Branches 2364 2396 +32
==========================================
+ Hits 10670 10981 +311
+ Misses 681 664 -17
- Partials 527 536 +9 ☔ View full report in Codecov by Sentry. |
Added to v7.0.0 Migration Guide #8447 |
This one is done |
Tests failed, I wonder if it's related |
Yes. My implementation completely broke down, not sure why, but seeing how unstable it was I had to overhaul it again. I had to do it like in TreeView, that in single selection mode SelectedValues is ignored and in multi selection SelectedValue is ignored. |
Yea, it seems just adding comparer to SelectedValues break everything and the implementation requires |
Btw, not related question, but why such complicated GetHasCode? public int GetHashCode(IReadOnlyCollection<T> obj)
{
var hasher = new HashCode();
foreach (var item in obj)
{
if (item is not null)
{
hasher.Add(_comparer.GetHashCode(item));
}
}
return hasher.ToHashCode();
} Why does it require |
As I understand it hashing algorithms are not commutative. So if you hash [1, 2, 3] and [3,2,1] you'll get different results. |
And we don't know if the user supplies a hash set. IReadOnlyCollection can be anything, such as Array, List, etc |
Description
Followup to the ChipSet rework in #4342
Replaced the dual parameters
MultiSelection
andMandatory
withSelectionMode
which was originally introduced forMudToggleGroup
.MudTreeView
now also uses the newSelectionMode
andMudList
is also gonna use it when we implement multi-selection for it. This is an effort to unify selection features in the library.Note:
MudSelect
,MudTable
andMudDataGrid
and some others still useMultiSelect="true"
. We might also change them, but I doubt it is gonna be possible to do this in v7.Warning
MudChipSet: Replace the dual parameters
MultiSelection
andMandatory
withSelectionMode
.MultiSelection="true"
corresponds toSelectionMode.MultiSelection
. For the default single-selection of the old chip set useSelectionMode.ToggleSelection
andMandatory="true"
corresponds toSelectionMode.SingleSelection
.Due to the unification of selection features over all components the default selection mode of MudChipSet has changed. Prior to v7 chips could be selected off by default. In v7 the default is
SelectionMode.SingleSelection
(like for all other components that support parameterSelectionMode
) which does not allow to de-select chips by clicking again. Set toSelectionMode.ToggleSelection
for that. #8722true
SelectionMode.MultiSelection
false
true
SelectionMode.SingleSelection
false
false
SelectionMode.ToggleSelection
How Has This Been Tested?
unit
Type of Changes
Checklist
dev
).