Skip to content

MudList: Implement selection modes Single-, Toggle- and MultiSelection#8775

Merged
henon merged 11 commits intoMudBlazor:devfrom
henon:list-multiselect
Apr 28, 2024
Merged

MudList: Implement selection modes Single-, Toggle- and MultiSelection#8775
henon merged 11 commits intoMudBlazor:devfrom
henon:list-multiselect

Conversation

@henon
Copy link
Contributor

@henon henon commented Apr 22, 2024

Description

Adds SelectionMode like in MudChipSet, MudTreeView and MudButtonGroup

Renames parameter AdornmentColor to ExpandIconColor
Renames parameter OnClickHandlerPreventDefault to OnClickPreventDefault

image

image

How Has This Been Tested?

unit | visually

Type of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (fix or improvement to the website or code docs)

Checklist

  • The PR is submitted to the correct branch (dev).
  • My code follows the code style of this project.
  • I've added relevant tests.

@henon henon marked this pull request as draft April 22, 2024 03:39
@github-actions github-actions bot added breaking change This change will require consumer code updates enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library PR: needs review labels Apr 22, 2024
@henon henon added needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request v7 API change Modifies the public API surface labels Apr 22, 2024
@henon henon requested a review from mckaragoz April 22, 2024 09:26
@henon
Copy link
Contributor Author

henon commented Apr 22, 2024

@mckaragoz FYI, this implements multiselection like you suggested. Is it OK that the nesting items are not selectable themselves in multiselection or what do you say?

image

@Yomodo
Copy link
Contributor

Yomodo commented Apr 22, 2024

Having the nesting items selectable would be a big help to easily to select al sub-items,
provided there's a checkbox on the nested item.

@henon
Copy link
Contributor Author

henon commented Apr 22, 2024

Ok, makes sense. Interestingly in the current implementation (single-selection only) it is impossible to select a nested list item. If you click it, it just toggles expansion.

image

@henon
Copy link
Contributor Author

henon commented Apr 22, 2024

So I guess the best way would be to add Selectable to the items. If it is set, the nested item can be selected by a body click in single-selection as well as multiselection and can only be expanded by a click on the expand button. If unset, it behaves as before.

@henon
Copy link
Contributor Author

henon commented Apr 22, 2024

We may leave it at nesting items being only for nesting/grouping, not selection. Neither Vuetify nor MUI have such functionality, and I guess for good reason.

@henon henon removed the needs: tests A maintainer has explicitly asked for associated test cases to be added to this pull request label Apr 22, 2024
@henon henon marked this pull request as ready for review April 22, 2024 12:07
henon added 3 commits April 22, 2024 14:17
# Conflicts:
#	src/MudBlazor/Base/MudComponentBase.cs
#	src/MudBlazor/Components/Menu/MudMenu.razor
@henon
Copy link
Contributor Author

henon commented Apr 22, 2024

If you look at MUI there are a couple of cool things a list can do, such as show the checkboxes either left or right, or show a switch instead of checkboxes.

The most promising way to implement all these things (as well as tri-state checkboxes for selecting on/off all nested items) would be to implement special list items, i.e. a MudListSwitchActionItem. That's gonna be a project for a future PR though.

Copy link
Member

@danielchalmers danielchalmers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't ran it but LGTM. Glad to see standardization

@codecov
Copy link

codecov bot commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 82.02247% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 90.02%. Comparing base (28bc599) to head (02a1bc7).
Report is 126 commits behind head on dev.

Files Patch % Lines
src/MudBlazor/Components/List/MudList.razor.cs 86.88% 3 Missing and 5 partials ⚠️
src/MudBlazor/Components/List/MudListItem.razor.cs 73.07% 0 Missing and 7 partials ⚠️
src/MudBlazor/Components/List/MudListItem.razor 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8775      +/-   ##
==========================================
+ Coverage   89.82%   90.02%   +0.19%     
==========================================
  Files         412      421       +9     
  Lines       11878    12286     +408     
  Branches     2364     2437      +73     
==========================================
+ Hits        10670    11061     +391     
+ Misses        681      671      -10     
- Partials      527      554      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@henon
Copy link
Contributor Author

henon commented Apr 27, 2024

@ScarletKuro do you still want to review this?

Copy link
Member

@ScarletKuro ScarletKuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM

Copy link
Member

@ScarletKuro ScarletKuro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@henon henon merged commit d5ecb34 into MudBlazor:dev Apr 28, 2024
@henon henon mentioned this pull request Apr 28, 2024
@henon
Copy link
Contributor Author

henon commented Apr 28, 2024

added to v7.0.0 Migration Guide #8447

@henon henon deleted the list-multiselect branch April 28, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API change Modifies the public API surface breaking change This change will require consumer code updates enhancement Adds a new feature or enhances existing functionality (not fixing a defect) in the main library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants