on develop help sign in
Deprecate part of Widget.Input
commitd205da318878a2cf5ef8ec371c306db4015b43e8 authorTom Smalley <tfsmalley@gmail.com> dateThu 24 Jan 2019, 19:44 (8 years ago) parent707a5a8
1 file changed+17
reflex-dom-core/src/Reflex/Dom/Widget/Input.hs+17
reflex-dom-core/src/Reflex/Dom/Widget/Input.hs+17
@@ -54,6 +54,7 @@ import qualified Text.Read as T
5454import qualified GHCJS.DOM.Event as Event
5555import qualified GHCJS.DOM.HTMLInputElement as Input
5656
57+{-# DEPRECATED TextInput "Use 'inputElement' directly" #-}
5758data TextInput t
5859 = TextInput { _textInput_value :: Dynamic t Text
5960 , _textInput_input :: Event t Text
@@ -64,6 +65,7 @@ data TextInput t
6465 , _textInput_builderElement :: InputElement EventResult GhcjsDomSpace t
6566 }
6667
68+{-# DEPRECATED _textInput_element "Use 'inputElement' directly" #-}
6769_textInput_element :: TextInput t -> HTMLInputElement
6870_textInput_element = _inputElement_raw . _textInput_builderElement
6971
@@ -71,6 +73,7 @@ instance Reflex t => HasDomEvent t (TextInput t) en where
7173 type DomEventType (TextInput t) en = DomEventType (InputElement EventResult GhcjsDomSpace t) en
7274 domEvent en = domEvent en . _textInput_builderElement
7375
76+{-# DEPRECATED TextInputConfig "Use 'inputElement' directly" #-}
7477data TextInputConfig t
7578 = TextInputConfig { _textInputConfig_inputType :: Text
7679 , _textInputConfig_initialValue :: Text
@@ -86,6 +89,7 @@ instance Reflex t => Default (TextInputConfig t) where
8689 , _textInputConfig_attributes = constDyn mempty
8790 }
8891
92+{-# DEPRECATED textInput "Use 'inputElement' directly" #-}
8993-- | Create an input whose value is a string. By default, the "type" attribute is set to "text", but it can be changed using the _textInputConfig_inputType field. Note that only types for which the value is always a string will work - types whose value may be null will not work properly with this widget.
9094{-# INLINABLE textInput #-}
9195textInput :: (DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace) => TextInputConfig t -> m (TextInput t)
@@ -161,6 +165,7 @@ rangeInput (RangeInputConfig initial eSetValue dAttrs) = do
161165 , _rangeInput_element = _inputElement_raw i
162166 }
163167
168+{-# DEPRECATED TextAreaConfig "Use 'textAreaElement' directly" #-}
164169data TextAreaConfig t
165170 = TextAreaConfig { _textAreaConfig_initialValue :: Text
166171 , _textAreaConfig_setValue :: Event t Text
@@ -174,6 +179,7 @@ instance Reflex t => Default (TextAreaConfig t) where
174179 , _textAreaConfig_attributes = constDyn mempty
175180 }
176181
182+{-# DEPRECATED TextArea "Use 'textAreaElement' directly" #-}
177183data TextArea t
178184 = TextArea { _textArea_value :: Dynamic t Text
179185 , _textArea_input :: Event t Text
@@ -182,6 +188,7 @@ data TextArea t
182188 , _textArea_element :: HTMLTextAreaElement
183189 }
184190
191+{-# DEPRECATED textArea "Use 'textAreaElement' directly" #-}
185192{-# INLINABLE textArea #-}
186193textArea :: (DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace) => TextAreaConfig t -> m (TextArea t)
187194textArea (TextAreaConfig initial eSet attrs) = do
@@ -198,6 +205,7 @@ textArea (TextAreaConfig initial eSet attrs) = do
198205 , _textArea_element = _textAreaElement_raw i
199206 }
200207
208+{-# DEPRECATED CheckboxConfig "Use 'inputElement' directly" #-}
201209data CheckboxConfig t
202210 = CheckboxConfig { _checkboxConfig_setValue :: Event t Bool
203211 , _checkboxConfig_attributes :: Dynamic t (Map Text Text)
@@ -209,11 +217,13 @@ instance Reflex t => Default (CheckboxConfig t) where
209217 , _checkboxConfig_attributes = constDyn mempty
210218 }
211219
220+{-# DEPRECATED Checkbox "Use 'inputElement' directly" #-}
212221data Checkbox t
213222 = Checkbox { _checkbox_value :: Dynamic t Bool
214223 , _checkbox_change :: Event t Bool
215224 }
216225
226+{-# DEPRECATED checkbox "Use 'inputElement' directly" #-}
217227-- | Create an editable checkbox
218228-- Note: if the "type" or "checked" attributes are provided as attributes, they will be ignored
219229{-# INLINABLE checkbox #-}
@@ -232,10 +242,12 @@ checkbox checked config = do
232242 , _checkbox_change = _inputElement_checkedChange i
233243 }
234244
245+{-# DEPRECATED CheckboxViewEventResultType "Use 'inputElement' directly" #-}
235246type family CheckboxViewEventResultType (en :: EventTag) :: * where
236247 CheckboxViewEventResultType 'ClickTag = Bool
237248 CheckboxViewEventResultType t = EventResultType t
238249
250+{-# DEPRECATED regularToCheckboxViewEventType "Use 'inputElement' directly" #-}
239251regularToCheckboxViewEventType :: EventName t -> EventResultType t -> CheckboxViewEventResultType t
240252regularToCheckboxViewEventType en r = case en of
241253 Click -> error "regularToCheckboxViewEventType: EventName Click should never be encountered"
@@ -285,8 +297,10 @@ regularToCheckboxViewEventType en r = case en of
285297 Touchend -> r
286298 Touchcancel -> r
287299
300+{-# DEPRECATED CheckboxViewEventResult "Use 'inputElement' directly" #-}
288301newtype CheckboxViewEventResult en = CheckboxViewEventResult { unCheckboxViewEventResult :: CheckboxViewEventResultType en }
289302
303+{-# DEPRECATED checkboxView "Use 'inputElement' directly" #-}
290304--TODO
291305{-# INLINABLE checkboxView #-}
292306checkboxView :: forall t m. (DomBuilder t m, DomBuilderSpace m ~ GhcjsDomSpace, PostBuild t m, MonadHold t m) => Dynamic t (Map Text Text) -> Dynamic t Bool -> m (Event t Bool)
@@ -321,11 +335,13 @@ checkboxView dAttrs dValue = do
321335 i <- inputElement inputElementConfig
322336 return $ unCheckboxViewEventResult <$> select (_element_events $ _inputElement_element i) (WrapArg Click)
323337
338+{-# DEPRECATED FileInput "Use 'inputElement' directly" #-}
324339data FileInput d t
325340 = FileInput { _fileInput_value :: Dynamic t [File]
326341 , _fileInput_element :: RawInputElement d
327342 }
328343
344+{-# DEPRECATED FileInputConfig "Use 'inputElement' directly" #-}
329345newtype FileInputConfig t
330346 = FileInputConfig { _fileInputConfig_attributes :: Dynamic t (Map Text Text)
331347 }
@@ -334,6 +350,7 @@ instance Reflex t => Default (FileInputConfig t) where
334350 def = FileInputConfig { _fileInputConfig_attributes = constDyn mempty
335351 }
336352
353+{-# DEPRECATED fileInput "Use 'inputElement' directly" #-}
337354fileInput :: forall t m. (MonadIO m, MonadJSM m, MonadFix m, MonadHold t m, TriggerEvent t m, DomBuilder t m, PostBuild t m, DomBuilderSpace m ~ GhcjsDomSpace)
338355 => FileInputConfig t -> m (FileInput (DomBuilderSpace m) t)
339356fileInput config = do