diff --git a/src/Feliz.Bulma.DateTimePicker/DateTime.fs b/src/Feliz.Bulma.DateTimePicker/DateTime.fs index 6e828a1..a367c4d 100644 --- a/src/Feliz.Bulma.DateTimePicker/DateTime.fs +++ b/src/Feliz.Bulma.DateTimePicker/DateTime.fs @@ -39,6 +39,7 @@ module DatePicker = abstract maxDate: DateTime option abstract dateOnly : bool abstract allowTextInput : bool + abstract showClearButton : bool abstract closeOnSelect: bool type private DateTimeValue = { Date : DateTime option; Time : TimeSpan option } @@ -464,14 +465,15 @@ module DatePicker = ] ] ] - Html.divClassed "datetimepicker-footer" [ - Html.button [ - prop.classes [ "datetimepicker-footer-clear"; "has-text-danger"; "button"; "is-small"; "is-text" ] - prop.type' "button" - prop.text p.clearLabel - prop.onClick onClear + if p.showClearButton then + Html.divClassed "datetimepicker-footer" [ + Html.button [ + prop.classes [ "datetimepicker-footer-clear"; "has-text-danger"; "button"; "is-small"; "is-text" ] + prop.type' "button" + prop.text p.clearLabel + prop.onClick onClear + ] ] - ] ] let format (d:DateTime) = let formatString = @@ -616,3 +618,4 @@ type dateTimePicker = /// Close the picker when the date is selected, only applicable for DatePicker static member inline closeOnSelect (v:bool) : IDateTimePickerProperty = unbox ("closeOnSelect", v) static member inline allowTextInput (v:bool) : IDateTimePickerProperty = unbox ("allowTextInput", v) + static member inline showClearButton (v:bool) : IDateTimePickerProperty = unbox ("showClearButton", v) diff --git a/src/Feliz.Bulma.DateTimePicker/Time.fs b/src/Feliz.Bulma.DateTimePicker/Time.fs index d6424a0..8585d49 100644 --- a/src/Feliz.Bulma.DateTimePicker/Time.fs +++ b/src/Feliz.Bulma.DateTimePicker/Time.fs @@ -18,6 +18,7 @@ module TimePicker = abstract isRange : bool abstract displayMode : DisplayMode abstract clearLabel : string + abstract showClearButton : bool let private safeHours (hrs:int) = if hrs < 0 then 23 @@ -133,14 +134,15 @@ module TimePicker = ] ] ] - Html.divClassed "datetimepicker-footer" [ - Html.button [ - prop.classes [ "datetimepicker-footer-clear"; "has-text-danger"; "button"; "is-small"; "is-text" ] - prop.type' "button" - prop.text p.clearLabel - prop.onClick (fun _ -> None |> updateTime) + if p.showClearButton then + Html.divClassed "datetimepicker-footer" [ + Html.button [ + prop.classes [ "datetimepicker-footer-clear"; "has-text-danger"; "button"; "is-small"; "is-text" ] + prop.type' "button" + prop.text p.clearLabel + prop.onClick (fun _ -> None |> updateTime) + ] ] - ] ] let txtValue = if p.isRange then time |> Option.map (fun (s,t) -> sprintf "%s - %s" (toFormattedTime s) (toFormattedTime t)) @@ -186,3 +188,4 @@ type timePicker = static member inline isRange (v:bool) : ITimePickerProperty = unbox ("isRange", v) static member inline displayMode (v:DisplayMode) : ITimePickerProperty = unbox ("displayMode", v) static member inline clearLabel (v:string) : ITimePickerProperty = unbox ("clearLabel", v) + static member inline showClearButton (v:bool) : ITimePickerProperty = unbox ("showClearButton", v)