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

Poc for Generic typed Date Picker #8567

Closed
wants to merge 1 commit into from

Conversation

ArieGato
Copy link
Contributor

@ArieGato ArieGato commented Apr 4, 2024

Description

How Has This Been Tested?

Types 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)

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 added breaking change v7 New major MudBlazor version labels Apr 4, 2024
@henon
Copy link
Collaborator

henon commented Apr 4, 2024

I think version 7.0.0 is the perfect time for this PR. With full test coverage of the different implementations of IDateOperations etc I see no problems. @ScarletKuro do you want to do a quick glance if the concept is sound?

@henon
Copy link
Collaborator

henon commented Apr 4, 2024

Just curious. Why did you design it like this DateOperations.WithDate(_picker_month.Value).IsMinDate() instead of extension methods IsMinDate() for different this types?

@ScarletKuro
Copy link
Member

ScarletKuro commented Apr 4, 2024

If we going to accept this solution, the IDateOperations and it's implementations should be internal, same to the injection of this service, I do not think that user needs to know about their existence and interact with them.
I also would expect the components to use ParameterState but this is optional, because MudPicker is using MudFormComponent which is not ParameterState friendly because of it's converters, and biggest design problem of it is that the value is implemented as

protected T? _value;

instead of

[Parameter]
public abstract T Value { get; set; }

and components are forced to do this:

[Parameter]
[Category(CategoryTypes.FileUpload.Behavior)]
public T? Files
{
	get => _value;
	set
	{
		if (_value != null && _value.Equals(value))
			return;
		_value = value;
	}
}

@henon
Copy link
Collaborator

henon commented Apr 4, 2024

@ArieGato We decided against generics and for just having two different bindable properties: #2954 (reply in thread)

Are you ok with that?

@ArieGato
Copy link
Contributor Author

ArieGato commented Apr 4, 2024

I think there are pro's and cons for both solutions.

My intentions were to bind the datepicker to a model without any conversions. The NumericField works simular to this.

I'm curious how the OneOf solution works out in usage.

And shouldn't we add DateTimeOffset support as well?

@henon
Copy link
Collaborator

henon commented Apr 4, 2024

And shouldn't we add DateTimeOffset support as well?

Ok, that seems to kill the Two-Properties-Solution

@danielchalmers
Copy link
Contributor

And shouldn't we add DateTimeOffset support as well?

Ok, that seems to kill the Two-Properties-Solution

If the original binding was changed to DateTimeOffset it could implicitly support DateTime right? There's implementation details to work out but maybe that could work.

@ScarletKuro
Copy link
Member

If the original binding was changed to DateTimeOffset it could implicitly support DateTime right? There's implementation details to work out but maybe that could work.

Technically, yes.

@ArieGato
Copy link
Contributor Author

@henon
Copy link
Collaborator

henon commented May 19, 2024

Oh, you haven't created a PR yet. OK, we'll link once you do.

@ArieGato
Copy link
Contributor Author

Continues in PR #9016

@henon henon moved this from In progress to TODO in v8 in The Big Break: Breaking Changes in v7 May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change v7 New major MudBlazor version
Development

Successfully merging this pull request may close these issues.

None yet

4 participants