Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Components/DatePicker/Component.purs
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,14 @@ synchronize = do

setSelection :: forall m. MonadAff m => Maybe Date -> CompositeComponentM m Unit
setSelection selection = do
setSelectionWithoutRaising selection
H.raise $ SelectionChanged selection

setSelectionWithoutRaising :: forall m. MonadAff m => Maybe Date -> CompositeComponentM m Unit
setSelectionWithoutRaising selection = do
st <- H.get
let targetDate = maybe st.targetDate (\d -> (year d) /\ (month d)) selection
H.modify_ _ { selection = selection, targetDate = targetDate }
H.raise $ SelectionChanged selection
synchronize

--------------------------
Expand Down Expand Up @@ -318,7 +322,7 @@ embeddedHandleQuery = case _ of
SetDisabled disabled a -> Just a <$ do
H.modify_ _ { disabled = disabled }
SetSelection selection a -> Just a <$ do
setSelection selection
setSelectionWithoutRaising selection

---------------------------
-- Embedded > handleMessage
Expand Down
8 changes: 6 additions & 2 deletions src/Components/TimePicker/Component.purs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ embeddedHandleQuery = case _ of
H.modify_ _ { disabled = disabled }

SetSelection selection a -> Just a <$ do
setSelection selection
setSelectionWithoutRaising selection

embeddedRender :: forall m. CompositeComponentRender m
embeddedRender s =
Expand Down Expand Up @@ -351,6 +351,10 @@ synchronize = do

setSelection :: forall m. Maybe Time -> CompositeComponentM m Unit
setSelection selection = do
H.modify_ _ { selection = selection }
setSelectionWithoutRaising selection
H.raise $ SelectionChanged selection

setSelectionWithoutRaising :: forall m. Maybe Time -> CompositeComponentM m Unit
setSelectionWithoutRaising selection = do
H.modify_ _ { selection = selection }
synchronize