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

MudSlider: Use ParameterState and generic math #8745

Merged
merged 3 commits into from
Apr 19, 2024

Conversation

ScarletKuro
Copy link
Member

@ScarletKuro ScarletKuro commented Apr 18, 2024

Description

Uses ParameterState and generic math so we do not need pesky converters

How Has This Been Tested?

Current unit tests & visual

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.

@github-actions github-actions bot added enhancement New feature or request PR: needs review labels Apr 18, 2024
Copy link

codecov bot commented Apr 18, 2024

Codecov Report

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

Project coverage is 90.08%. Comparing base (28bc599) to head (2c96fe6).
Report is 80 commits behind head on dev.

Files Patch % Lines
src/MudBlazor/Components/Slider/MudSlider.razor.cs 82.35% 1 Missing and 2 partials ⚠️
src/MudBlazor/Components/Slider/MudSlider.razor 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8745      +/-   ##
==========================================
+ Coverage   89.82%   90.08%   +0.25%     
==========================================
  Files         412      419       +7     
  Lines       11878    12174     +296     
  Branches     2364     2396      +32     
==========================================
+ Hits        10670    10967     +297     
+ Misses        681      667      -14     
- Partials      527      540      +13     

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

@ScarletKuro
Copy link
Member Author

ScarletKuro commented Apr 18, 2024

.AddItem("Switch", typeof(MudSwitch<T>))

Because of this line and how docs currently work I had no other ideas but implement INumber to the T class. Obviously this is not the best solution and this methods should not use T : class, because what if someone needs a struct or anything like that. I couldn't even use NotImplementedException because something is invoking the methods.

@henon let me know if there is better ways.

@danielchalmers
Copy link
Contributor

What's the original purpose of the T class?

@ScarletKuro ScarletKuro changed the title Slider rework MudSlider: Use ParameterState and generic math Apr 18, 2024
@ScarletKuro
Copy link
Member Author

What's the original purpose of the T class?

It's used for docs and in some unit tests to construct the component.

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.

lgtm from my limited knowledge on this

@henon
Copy link
Collaborator

henon commented Apr 19, 2024

About class T:
The alternative would be to have a registry of types which can be used with each generic component such as MudSwitch => bool etc and then we can construct the components for the automated tests and for the API docs which use reflection to discover the properties.

@henon
Copy link
Collaborator

henon commented Apr 19, 2024

@henon let me know if there is better ways.

It suffices for now. We'll solve the problem of class T later for good.

@henon henon merged commit 80da787 into MudBlazor:dev Apr 19, 2024
3 of 4 checks passed
@henon henon added breaking change API change API that needs approval and removed PR: needs review labels Apr 19, 2024
@henon henon mentioned this pull request Apr 19, 2024
@henon
Copy link
Collaborator

henon commented Apr 19, 2024

Thanks, the code looks much better now.

Added to v7.0.0 Migration Guide #8447

@henon henon added the v7 New major MudBlazor version label Apr 19, 2024
@ScarletKuro ScarletKuro deleted the slider_rework branch April 19, 2024 13:10
@ScarletKuro
Copy link
Member Author

ScarletKuro commented Apr 20, 2024

I just thought, would it make sense to add "CultureInfo" parameter in case someone want's the ValueLabel to be in different format, for example have a coma instead of point, show currency symbol if its money related slider etc?

@henon
Copy link
Collaborator

henon commented Apr 20, 2024

Yes, that makes sense.

@ScarletKuro
Copy link
Member Author

#8760

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
API change API that needs approval breaking change enhancement New feature or request v7 New major MudBlazor version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants