mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-25 09:21:57 +03:00
Migrate select field renderer to new form type.
This commit is contained in:
parent
6a5a9f4c8c
commit
565833804c
@ -1,23 +1,17 @@
|
|||||||
module Form.FieldView exposing
|
module Form.FieldView exposing
|
||||||
( Input(..), InputType(..), Options(..), input, inputTypeToString, radio, toHtmlProperties, Hidden(..)
|
( Input(..), InputType(..), Options(..), input, inputTypeToString, radio, toHtmlProperties, Hidden(..), select
|
||||||
, radioStyled, inputStyled
|
, radioStyled, inputStyled
|
||||||
, selectOld
|
|
||||||
)
|
)
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
|
||||||
@docs Input, InputType, Options, input, inputTypeToString, radio, toHtmlProperties, Hidden
|
@docs Input, InputType, Options, input, inputTypeToString, radio, toHtmlProperties, Hidden, select
|
||||||
|
|
||||||
|
|
||||||
## Html.Styled Helpers
|
## Html.Styled Helpers
|
||||||
|
|
||||||
@docs radioStyled, inputStyled
|
@docs radioStyled, inputStyled
|
||||||
|
|
||||||
|
|
||||||
## Need to Migrate to New Validation Form type
|
|
||||||
|
|
||||||
@docs selectOld
|
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
import Form.Validation
|
import Form.Validation
|
||||||
@ -206,7 +200,7 @@ inputStyled attrs (Validation viewField fieldName ( maybeParsed, fieldErrors ))
|
|||||||
|
|
||||||
|
|
||||||
{-| -}
|
{-| -}
|
||||||
selectOld :
|
select :
|
||||||
List (Html.Attribute msg)
|
List (Html.Attribute msg)
|
||||||
->
|
->
|
||||||
(parsed
|
(parsed
|
||||||
@ -215,15 +209,19 @@ selectOld :
|
|||||||
, String
|
, String
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->
|
-> Form.Validation.Field error parsed2 (Options parsed)
|
||||||
{ input
|
|
||||||
| value : Maybe String
|
|
||||||
, name : String
|
|
||||||
, kind : ( Options parsed, List ( String, Encode.Value ) )
|
|
||||||
}
|
|
||||||
-> Html msg
|
-> Html msg
|
||||||
selectOld selectAttrs enumToOption rawField =
|
select selectAttrs enumToOption (Validation viewField fieldName ( maybeParsed, fieldErrors )) =
|
||||||
let
|
let
|
||||||
|
justViewField =
|
||||||
|
viewField |> expectViewField
|
||||||
|
|
||||||
|
rawField =
|
||||||
|
{ name = fieldName |> Maybe.withDefault ""
|
||||||
|
, value = justViewField.value
|
||||||
|
, kind = justViewField.kind
|
||||||
|
}
|
||||||
|
|
||||||
(Options parseValue possibleValues) =
|
(Options parseValue possibleValues) =
|
||||||
rawField.kind |> Tuple.first
|
rawField.kind |> Tuple.first
|
||||||
in
|
in
|
||||||
|
Loading…
Reference in New Issue
Block a user