Skip to content
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

MudTreeView: Add AutoExpand, ExpandAll() and CollapseAll() #8762

Merged
merged 13 commits into from
Apr 22, 2024

Conversation

henon
Copy link
Collaborator

@henon henon commented Apr 20, 2024

Description

New features:

  • AutoExpand will automatically and recursively expand down the tree until the selected item is visible. This of course happens only when its Selected state changes from false to true due to a change in SelectedValue or SelectedValues.
  • ExpandAll() recursively expands all items
  • CollapseAll() recursively collapses all items

treeview autoexpand

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.

Copy link

codecov bot commented Apr 20, 2024

Codecov Report

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

Project coverage is 90.11%. Comparing base (28bc599) to head (3a27018).
Report is 99 commits behind head on dev.

Files Patch % Lines
...lazor/Components/TreeView/MudTreeViewItem.razor.cs 75.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8762      +/-   ##
==========================================
+ Coverage   89.82%   90.11%   +0.28%     
==========================================
  Files         412      419       +7     
  Lines       11878    12175     +297     
  Branches     2364     2397      +33     
==========================================
+ Hits        10670    10971     +301     
+ Misses        681      660      -21     
- Partials      527      544      +17     

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

Copy link
Contributor

@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.

You are going to hate me after this review

@henon
Copy link
Collaborator Author

henon commented Apr 20, 2024

You are going to hate me after this review

No ;)

I just hate how braces for single line ifs and empty lines waste vertical space. I really don't understand why we need this style code

@henon
Copy link
Collaborator Author

henon commented Apr 20, 2024

@danielchalmers To make a clear point, let me answer a bit longer. I don't hate anybody for reviewing. I am grateful for everyone who reviews, but I don't have to agree with everything either.

I respect all the work you have done for MudBlazor, I respect the skills and expertise you obviously have in many areas. I also admire your ability to hone and polish something until it is truly perfect. And if your critisism makes sense to me I'll be on your side.

That said, I also respectfully refuse to do busywork that I think is pointless. Like adding or removing empty lines or adding braces where they aren't needed. I hope you'll forgive me for that ;)

Sometimes I think @ScarletKuro adds more empty lines in his methods than actual lines of code, but I sure as hell won't start requesting him to remove them just because my coding style is different and I like methods without any empty lines. I can read his code just fine. Everything else would be a serious skill issue on my part. And it would be plain wrong on so many levels to impose my preferences on Kuro:

  • I'd waste my own time asking pointless changes
  • I'd waste his time when he has to think about how to write the code so that I be happy with it
  • I'd maybe even alienate Kuro resulting in loosing one of the most valuable members of the team

I want that we focus on productive changes and that we don't use our time for polishing the wrong stuff. It doesn't matter for MudBlazor how blank lines or braces are set in the code. I am all for polishing things that make a difference, such as public API consistency, the UI design, overall functionality, etc.

I hope we can agree on that? Of course, please continue to review and I'll of course gladly accept any suggestion that has obvious merit.

@danielchalmers
Copy link
Contributor

@henon Sure! In reality I'm just relaying what @ScarletKuro has taught me about his expectations for the code. I don't have any strong feelings either way. I thought you were on the same page which is why I was pointing out the discrepancies which I thought you missed accidentally! Will keep that in mind. Again, I'm not that concerned either way, just trying to help keep the quality up and style maintained.

@henon
Copy link
Collaborator Author

henon commented Apr 20, 2024

OK, great. I still have to write unit tests for this thing.

@ScarletKuro
Copy link
Member

ScarletKuro commented Apr 21, 2024

Damn, a whole discussion. I just prefer to use in open source what most people are comfortable with, and my observations from discussions, forums, reddit, stackoverflow etc - it's always brackets, because it's clearer at a glance, it is less prone to error during revision etc. It's also funny that MS added this syntax, but doesn't allow it in most of their projects that I worked with, and I have this mindset that Microsoft is a golden standard in .NET world. But I'm obviously not going to fight over it with a team member 😂

@henon
Copy link
Collaborator Author

henon commented Apr 21, 2024

Sorry for making a scene yesterday, it obviously riled me. OK, I don't have to love how much screen space a method with a couple of simple ifs and returns will waste on the screen but I can absolutely work with it. And I don't have to manually add all those braces. I can just let Resharper do it for me:

image

@henon henon force-pushed the treeview-autoexpand-and-selectable branch from 2216c79 to 3a27018 Compare April 21, 2024 17:07
@henon henon merged commit 0e4b155 into MudBlazor:dev Apr 22, 2024
4 checks passed
@henon henon deleted the treeview-autoexpand-and-selectable branch April 22, 2024 01:36
biegehydra pushed a commit to biegehydra/MudBlazor that referenced this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants