You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Forcing the user to provide all the ShouldDisableXX functions, even when he don't want to disable any.
Exposing an alternative API would allow us to work around this problem:
We could use classes to have optional arguments but discovery is not that great in IDE IHMO
We could use pipeline builders, making discovering API easier
Form.datePickerField {
Parser =fun value ->match value.SelectedDate with| Some date -> Ok date
| None -> Error "This field is required"
Value =_.CollectionDate
Update =fun newValue values ->{
values with
CollectionDate = newValue
// Reset the time slot when the date changes
CollectionTimeSlot =""}
Error =fun _ -> None
Attributes =
DatePickerField.Attributes.create "Collection Date"|> DatePickerField.Attributes.withDisplayMode DatePickerField.DisplayMode.Default
|> DatePickerField.Attributes.withShouldDisableDate (fun date ->
timeSlots
|> List.exists (fun slot -> Date.getDayKey slot.Start = Date.getDayKey date)|>not)}
Currently, attributes are exposed using records only meaning that we need to provides all the properties all the time.
This is annoying because we need to provide information that we don't care about.
For example, if you have a
DatePickerField
you could have attributes looking like that:Forcing the user to provide all the
ShouldDisableXX
functions, even when he don't want to disable any.Exposing an alternative API would allow us to work around this problem:
Thoth.Elmish.FormBuilder
old comparaison of the different styleToday, I think I lean more toward pipeline builders.
The text was updated successfully, but these errors were encountered: