Closed stsrki closed 2 years ago
I'm starting work on this. We are changing the parameters to be of type string, right? That's the idea?
The inspiration link seems like it will work fine. But I was thinking that for us it might be worth it doing with some kind of interface based implementation instead that we can then inject different implementations based on the provider which will result in a different string (class output)
I have kinda forgotten why exactly I wanted to use strings :)
The basic idea, I think, for the new Complex Enum is to be able to extend our current coloring system. For example, if we want to have Color="Color.Primary.WithGradient"
or Color="Color.Primary.Accent2"
. Kinda like we have it on utility classes.
So yeah, something like interface-based implementation might be needed(internally), although I don't think we would want to implement them for every provider. Can you prototype it with pseudo-code here what you had in mind so I can have a clearer picture?
Since I think this will not be much of a breaking change we can consider it for v1.1.
Oh yeah. Why I wanted string
for some. Currently, on Link Target enum we only have some of the standard target types. But the problem is that target can sometimes refer to an iframe
with an ID of the iframe
, eg Target="frame-target"
. With the complex enum supporting the implicit string we could potentially support this scenario.
See #1448
I have kinda forgotten why exactly I wanted to use strings :)
I guess it also helps users just implement their own abstractions if they want to or provide the value or values they want directly... since it just expects a string.
Edit: Might be more confusing to get to the helpers tough. An enum does have the intelisense. A string does not... the user needs to know there exists helpers, which are not as easily discovered.
We will need to document it. And it also can be one more community article.
@David-Moreira can you do a quick review?
Create a new object that will replace our current enum values like
Color
,Background
,Target
, etc. The idea is to be able to have a default set of values, with the ability to accept other types likestring
. Possibly with an implicit string operator.Should be possible to do:
Inspiration https://docs.microsoft.com/en-us/dotnet/architecture/microservices/microservice-ddd-cqrs-patterns/enumeration-classes-over-enum-types