mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-25 09:21:57 +03:00
Remove unused.
This commit is contained in:
parent
b4c26d5401
commit
c99e78b49c
@ -1,6 +1,5 @@
|
||||
module Form.FieldView exposing
|
||||
( Input(..), InputType(..), Options(..), input, inputTypeToString, radio, select, toHtmlProperties
|
||||
, radioStyled, inputStyled
|
||||
( Input(..), InputType(..), Options(..), inputTypeToString, select, toHtmlProperties
|
||||
, Hidden(..), input2, inputStyled2, radio2, radioStyled2
|
||||
)
|
||||
|
||||
@ -147,92 +146,6 @@ input2 attrs (Validation viewField fieldName ( maybeParsed, fieldErrors )) =
|
||||
[]
|
||||
|
||||
|
||||
{-| -}
|
||||
input :
|
||||
List (Html.Attribute msg)
|
||||
->
|
||||
{ input
|
||||
| value : Maybe String
|
||||
, name : String
|
||||
, kind : ( Input, List ( String, Encode.Value ) )
|
||||
}
|
||||
-> Html msg
|
||||
input attrs rawField =
|
||||
case rawField.kind of
|
||||
( Input Textarea, properties ) ->
|
||||
Html.textarea
|
||||
(attrs
|
||||
++ toHtmlProperties properties
|
||||
++ [ Attr.value (rawField.value |> Maybe.withDefault "")
|
||||
, Attr.name rawField.name
|
||||
]
|
||||
)
|
||||
[]
|
||||
|
||||
( Input inputType, properties ) ->
|
||||
Html.input
|
||||
(attrs
|
||||
++ toHtmlProperties properties
|
||||
++ [ (case inputType of
|
||||
Checkbox ->
|
||||
Attr.checked ((rawField.value |> Maybe.withDefault "") == "on")
|
||||
|
||||
_ ->
|
||||
Attr.value (rawField.value |> Maybe.withDefault "")
|
||||
-- TODO is this an okay default?
|
||||
)
|
||||
, Attr.name rawField.name
|
||||
, inputType |> inputTypeToString |> Attr.type_
|
||||
]
|
||||
)
|
||||
[]
|
||||
|
||||
|
||||
{-| -}
|
||||
inputStyled :
|
||||
List (Html.Styled.Attribute msg)
|
||||
->
|
||||
{ input
|
||||
| value : Maybe String
|
||||
, name : String
|
||||
, kind : ( Input, List ( String, Encode.Value ) )
|
||||
}
|
||||
-> Html.Styled.Html msg
|
||||
inputStyled attrs rawField =
|
||||
case rawField.kind of
|
||||
( Input Textarea, properties ) ->
|
||||
Html.Styled.textarea
|
||||
(attrs
|
||||
++ (toHtmlProperties properties |> List.map StyledAttr.fromUnstyled)
|
||||
++ ([ Attr.value (rawField.value |> Maybe.withDefault "")
|
||||
, Attr.name rawField.name
|
||||
]
|
||||
|> List.map StyledAttr.fromUnstyled
|
||||
)
|
||||
)
|
||||
[]
|
||||
|
||||
( Input inputType, properties ) ->
|
||||
Html.Styled.input
|
||||
(attrs
|
||||
++ (toHtmlProperties properties |> List.map StyledAttr.fromUnstyled)
|
||||
++ ([ (case inputType of
|
||||
Checkbox ->
|
||||
Attr.checked ((rawField.value |> Maybe.withDefault "") == "on")
|
||||
|
||||
_ ->
|
||||
Attr.value (rawField.value |> Maybe.withDefault "")
|
||||
-- TODO is this an okay default?
|
||||
)
|
||||
, Attr.name rawField.name
|
||||
, inputType |> inputTypeToString |> Attr.type_
|
||||
]
|
||||
|> List.map StyledAttr.fromUnstyled
|
||||
)
|
||||
)
|
||||
[]
|
||||
|
||||
|
||||
{-| -}
|
||||
inputStyled2 :
|
||||
List (Html.Styled.Attribute msg)
|
||||
@ -335,67 +248,6 @@ select selectAttrs enumToOption rawField =
|
||||
)
|
||||
|
||||
|
||||
{-| -}
|
||||
radio :
|
||||
List (Html.Attribute msg)
|
||||
->
|
||||
(parsed
|
||||
-> (List (Html.Attribute msg) -> Html msg)
|
||||
-> Html msg
|
||||
)
|
||||
->
|
||||
{ input
|
||||
| value : Maybe String
|
||||
, name : String
|
||||
, kind : ( Options parsed, List ( String, Encode.Value ) )
|
||||
}
|
||||
-> Html msg
|
||||
radio selectAttrs enumToOption rawField =
|
||||
let
|
||||
(Options parseValue possibleValues) =
|
||||
rawField.kind |> Tuple.first
|
||||
in
|
||||
Html.fieldset
|
||||
(selectAttrs
|
||||
++ [ Attr.value (rawField.value |> Maybe.withDefault "")
|
||||
, Attr.name rawField.name
|
||||
]
|
||||
)
|
||||
(possibleValues
|
||||
|> List.filterMap
|
||||
(\possibleValue ->
|
||||
let
|
||||
parsed : Maybe parsed
|
||||
parsed =
|
||||
possibleValue
|
||||
|> parseValue
|
||||
in
|
||||
case parsed of
|
||||
Just justParsed ->
|
||||
let
|
||||
renderedElement : Html msg
|
||||
renderedElement =
|
||||
enumToOption justParsed
|
||||
(\userHtmlAttrs ->
|
||||
Html.input
|
||||
([ Attr.type_ "radio"
|
||||
, Attr.value possibleValue
|
||||
, Attr.name rawField.name
|
||||
, Attr.checked (rawField.value == Just possibleValue)
|
||||
]
|
||||
++ userHtmlAttrs
|
||||
)
|
||||
[]
|
||||
)
|
||||
in
|
||||
Just renderedElement
|
||||
|
||||
Nothing ->
|
||||
Nothing
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
{-| -}
|
||||
radio2 :
|
||||
List (Html.Attribute msg)
|
||||
@ -461,69 +313,6 @@ radio2 selectAttrs enumToOption (Validation viewField fieldName ( maybeParsed, f
|
||||
)
|
||||
|
||||
|
||||
{-| -}
|
||||
radioStyled :
|
||||
List (Html.Styled.Attribute msg)
|
||||
->
|
||||
(parsed
|
||||
-> (List (Html.Styled.Attribute msg) -> Html.Styled.Html msg)
|
||||
-> Html.Styled.Html msg
|
||||
)
|
||||
->
|
||||
{ input
|
||||
| value : Maybe String
|
||||
, name : String
|
||||
, kind : ( Options parsed, List ( String, Encode.Value ) )
|
||||
}
|
||||
-> Html.Styled.Html msg
|
||||
radioStyled selectAttrs enumToOption rawField =
|
||||
let
|
||||
(Options parseValue possibleValues) =
|
||||
rawField.kind |> Tuple.first
|
||||
in
|
||||
Html.Styled.fieldset
|
||||
(selectAttrs
|
||||
++ [ StyledAttr.value (rawField.value |> Maybe.withDefault "")
|
||||
, StyledAttr.name rawField.name
|
||||
]
|
||||
)
|
||||
(possibleValues
|
||||
|> List.filterMap
|
||||
(\possibleValue ->
|
||||
let
|
||||
parsed : Maybe parsed
|
||||
parsed =
|
||||
possibleValue
|
||||
|> parseValue
|
||||
in
|
||||
case parsed of
|
||||
Just justParsed ->
|
||||
let
|
||||
renderedElement : Html.Styled.Html msg
|
||||
renderedElement =
|
||||
enumToOption justParsed
|
||||
(\userHtmlAttrs ->
|
||||
Html.Styled.input
|
||||
(([ Attr.type_ "radio"
|
||||
, Attr.value possibleValue
|
||||
, Attr.name rawField.name
|
||||
, Attr.checked (rawField.value == Just possibleValue)
|
||||
]
|
||||
|> List.map StyledAttr.fromUnstyled
|
||||
)
|
||||
++ userHtmlAttrs
|
||||
)
|
||||
[]
|
||||
)
|
||||
in
|
||||
Just renderedElement
|
||||
|
||||
Nothing ->
|
||||
Nothing
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
expectViewField : Maybe (ViewField kind) -> ViewField kind
|
||||
expectViewField viewField =
|
||||
case viewField of
|
||||
|
Loading…
Reference in New Issue
Block a user