igniteui-webcomponents
igniteui-webcomponents copied to clipboard
issue with composite properties for "simple" components.
If you take something like DateTimeInput and look at the spinDelta
property, we are unable to set it via an attribute. This creates some friction at the blazor level.
We have 2 distinct paths for handling components at the Blazor level 'indirect' where we can pass complete values around for properties (whole trees of sub elements, etc), and 'direct' where we try to use Blazor's render path directly to keep things trim and simple and not inject extra container etc. For simple components it would be best if we can use this direct render path. But the problem is that that direct render path really wants everything to be settable via an attribute. So any time the components use { attribute: false } on a public property, like spinDelta
is an issue.
I think we have a few options for these kind of cases:
- make it settable via an attribute for the purposes of blazor (parse a json obj coming in off the attribute if you get a string, for an example, to hydrate (this would work automagically for blazor).
- create an alternate path. For example, make that property also settable via a method. Even for the direct render path, we attempt to make methods callable via our usual side channels.
- Simplify the property. Maybe rather than using a composite property that lets you set all the spin deltas in one, create several properties. This helps simplify the binding anyhow.
- We could change the component to the "indirect" mode, but I think this is not the preferred route for a simple input as it adds overhead/complexitty.
- We could invent a side channel for trying to set these kinds of properties out of band in indirect mode, but this would be more work and creates some uncertainties around arrival time of the side band property values (would arrive later than the rest of the attributes)
as an example, this is what our Blazor stuff winds up trying to do for spinDelta
<igc-date-time-input class="igb-web-date-time-input" data-ig-id="bfe75460-f0ac-4952-b30c-09bd9e2614da" value="2022-04-12T00:00:00.0000000" spin-delta="{"name":"e634d3b5-e150-4a71-b424-f39eb067c749","year":10,"type":"DatePartDeltas"}" _bl_16="" size="medium" dir="auto">
</igc-date-time-input>
which would work if the components attempted to JSON.parse the string value. If we used indirect mode this would all work differently and spinDelta
would work today as is it now, but that's really overly heavy for DateTimeInput
.
@gmurray81 , AppBuilder doesn't seem to support setting spinDelta
so let's hide the property for now. We'll discuss this further when time allows.
Closing this since we have gathered sufficient experience in designing the public API to meet the requirements of Blazor.