Remove import alias to avoid bug in elm-codegen generated code.

This commit is contained in:
Dillon Kearns 2023-02-06 19:29:43 -08:00
parent e5e007741a
commit 11ea217b06

View File

@ -273,7 +273,7 @@ import FatalError exposing (FatalError)
import Form.Field as Field exposing (Field(..)) import Form.Field as Field exposing (Field(..))
import Form.FieldStatus as FieldStatus exposing (FieldStatus) import Form.FieldStatus as FieldStatus exposing (FieldStatus)
import Form.FieldView import Form.FieldView
import Form.Validation as Validation exposing (Combined) import Form.Validation exposing (Combined)
import Html exposing (Html) import Html exposing (Html)
import Html.Attributes as Attr import Html.Attributes as Attr
import Html.Lazy import Html.Lazy
@ -333,7 +333,7 @@ dynamic :
-> ->
Form Form
error error
{ combine : Validation.Validation error parsed named constraints1 { combine : Form.Validation.Validation error parsed named constraints1
, view : subView , view : subView
} }
data data
@ -342,7 +342,7 @@ dynamic :
Form Form
error error
--((decider -> Validation error parsed named) -> combined) --((decider -> Validation error parsed named) -> combined)
({ combine : decider -> Validation.Validation error parsed named constraints1 ({ combine : decider -> Form.Validation.Validation error parsed named constraints1
, view : decider -> subView , view : decider -> subView
} }
-> combineAndView -> combineAndView
@ -503,7 +503,7 @@ Use [`Form.Field`](Form-Field) to define the field and its validations.
field : field :
String String
-> Field error parsed data kind constraints -> Field error parsed data kind constraints
-> Form error (Validation.Field error parsed kind -> combineAndView) data -> Form error (Form.Validation.Field error parsed kind -> combineAndView) data
-> Form error combineAndView data -> Form error combineAndView data
field name (Field fieldParser kind) (Form definitions parseFn toInitialValues) = field name (Field fieldParser kind) (Form definitions parseFn toInitialValues) =
Form Form
@ -531,13 +531,13 @@ field name (Field fieldParser kind) (Form definitions parseFn toInitialValues) =
, kind = ( kind, fieldParser.properties ) , kind = ( kind, fieldParser.properties )
} }
parsedField : Validation.Field error parsed kind parsedField : Form.Validation.Field error parsed kind
parsedField = parsedField =
Pages.Internal.Form.Validation (Just thing) (Just name) ( maybeParsed, Dict.empty ) Pages.Internal.Form.Validation (Just thing) (Just name) ( maybeParsed, Dict.empty )
myFn : myFn :
{ result : Dict String (List error) { result : Dict String (List error)
, combineAndView : Validation.Field error parsed kind -> combineAndView , combineAndView : Form.Validation.Field error parsed kind -> combineAndView
, isMatchCandidate : Bool , isMatchCandidate : Bool
} }
-> ->
@ -547,7 +547,7 @@ field name (Field fieldParser kind) (Form definitions parseFn toInitialValues) =
} }
myFn soFar = myFn soFar =
let let
validationField : Validation.Field error parsed kind validationField : Form.Validation.Field error parsed kind
validationField = validationField =
parsedField parsedField
in in
@ -601,7 +601,7 @@ You define the field's validations the same way as for `field`, with the
hiddenField : hiddenField :
String String
-> Field error parsed data kind constraints -> Field error parsed data kind constraints
-> Form error (Validation.Field error parsed Form.FieldView.Hidden -> combineAndView) data -> Form error (Form.Validation.Field error parsed Form.FieldView.Hidden -> combineAndView) data
-> Form error combineAndView data -> Form error combineAndView data
hiddenField name (Field fieldParser _) (Form definitions parseFn toInitialValues) = hiddenField name (Field fieldParser _) (Form definitions parseFn toInitialValues) =
Form Form
@ -628,13 +628,13 @@ hiddenField name (Field fieldParser _) (Form definitions parseFn toInitialValues
, kind = ( Form.FieldView.Hidden, fieldParser.properties ) , kind = ( Form.FieldView.Hidden, fieldParser.properties )
} }
parsedField : Validation.Field error parsed Form.FieldView.Hidden parsedField : Form.Validation.Field error parsed Form.FieldView.Hidden
parsedField = parsedField =
Pages.Internal.Form.Validation (Just thing) (Just name) ( maybeParsed, Dict.empty ) Pages.Internal.Form.Validation (Just thing) (Just name) ( maybeParsed, Dict.empty )
myFn : myFn :
{ result : Dict String (List error) { result : Dict String (List error)
, combineAndView : Validation.Field error parsed Form.FieldView.Hidden -> combineAndView , combineAndView : Form.Validation.Field error parsed Form.FieldView.Hidden -> combineAndView
, isMatchCandidate : Bool , isMatchCandidate : Bool
} }
-> ->
@ -644,7 +644,7 @@ hiddenField name (Field fieldParser _) (Form definitions parseFn toInitialValues
} }
myFn soFar = myFn soFar =
let let
validationField : Validation.Field error parsed Form.FieldView.Hidden validationField : Form.Validation.Field error parsed Form.FieldView.Hidden
validationField = validationField =
parsedField parsedField
in in
@ -675,14 +675,14 @@ hiddenField name (Field fieldParser _) (Form definitions parseFn toInitialValues
toServerForm : toServerForm :
Form Form
error error
{ combine : Validation.Validation error combined kind constraints { combine : Form.Validation.Validation error combined kind constraints
, view : viewFn , view : viewFn
} }
data data
-> ->
Form Form
error error
{ combine : Validation.Validation error (BackendTask FatalError (Validation.Validation error combined kind constraints)) kind constraints { combine : Form.Validation.Validation error (BackendTask FatalError (Form.Validation.Validation error combined kind constraints)) kind constraints
, view : viewFn , view : viewFn
} }
data data
@ -695,7 +695,7 @@ toServerForm (Form a b c) =
{ result : Dict String (List error) { result : Dict String (List error)
, isMatchCandidate : Bool , isMatchCandidate : Bool
, combineAndView : , combineAndView :
{ combine : Validation.Validation error (BackendTask FatalError (Validation.Validation error combined kind constraints)) kind constraints { combine : Form.Validation.Validation error (BackendTask FatalError (Form.Validation.Validation error combined kind constraints)) kind constraints
, view : viewFn , view : viewFn
} }
} }
@ -707,7 +707,7 @@ toServerForm (Form a b c) =
{ combine = { combine =
thing.combineAndView.combine thing.combineAndView.combine
|> BackendTask.succeed |> BackendTask.succeed
|> Validation.succeed2 |> Form.Validation.succeed2
, view = thing.combineAndView.view , view = thing.combineAndView.view
} }
, isMatchCandidate = thing.isMatchCandidate , isMatchCandidate = thing.isMatchCandidate
@ -786,10 +786,10 @@ type Errors error
{-| -} {-| -}
errorsForField : Validation.Field error parsed kind -> Errors error -> List error errorsForField : Form.Validation.Field error parsed kind -> Errors error -> List error
errorsForField field_ (Errors errorsDict) = errorsForField field_ (Errors errorsDict) =
errorsDict errorsDict
|> Dict.get (Validation.fieldName field_) |> Dict.get (Form.Validation.fieldName field_)
|> Maybe.withDefault [] |> Maybe.withDefault []
@ -846,7 +846,7 @@ parse :
String String
-> AppContext app actionData -> AppContext app actionData
-> data -> data
-> Form error { info | combine : Validation.Validation error parsed named constraints } data -> Form error { info | combine : Form.Validation.Validation error parsed named constraints } data
-> ( Maybe parsed, Dict String (List error) ) -> ( Maybe parsed, Dict String (List error) )
parse formId app data (Form _ parser _) = parse formId app data (Form _ parser _) =
-- TODO Get transition context from `app` so you can check if the current form is being submitted -- TODO Get transition context from `app` so you can check if the current form is being submitted
@ -885,7 +885,7 @@ insertIfNonempty key values dict =
{-| -} {-| -}
runServerSide : runServerSide :
List ( String, String ) List ( String, String )
-> Form error (Validation.Validation error parsed kind constraints) data -> Form error (Form.Validation.Validation error parsed kind constraints) data
-> ( Bool, ( Maybe parsed, Dict String (List error) ) ) -> ( Bool, ( Maybe parsed, Dict String (List error) ) )
runServerSide rawFormData (Form _ parser _) = runServerSide rawFormData (Form _ parser _) =
let let
@ -987,7 +987,7 @@ renderHtml :
-> ->
FinalForm FinalForm
error error
(Validation.Validation error parsed named constraints) (Form.Validation.Validation error parsed named constraints)
data data
(Context error data (Context error data
-> List (Html (Pages.Msg.Msg msg)) -> List (Html (Pages.Msg.Msg msg))
@ -1023,14 +1023,14 @@ toDynamicFetcher :
-> ->
Form Form
error error
{ combine : Validation.Validation error parsed field constraints { combine : Form.Validation.Validation error parsed field constraints
, view : Context error data -> view , view : Context error data -> view
} }
data data
-> ->
FinalForm FinalForm
error error
(Validation.Validation error parsed field constraints) (Form.Validation.Validation error parsed field constraints)
data data
(Context error data -> view) (Context error data -> view)
userMsg userMsg
@ -1096,14 +1096,14 @@ toDynamicTransition :
-> ->
Form Form
error error
{ combine : Validation.Validation error parsed field constraints { combine : Form.Validation.Validation error parsed field constraints
, view : Context error data -> view , view : Context error data -> view
} }
data data
-> ->
FinalForm FinalForm
error error
(Validation.Validation error parsed field constraints) (Form.Validation.Validation error parsed field constraints)
data data
(Context error data -> view) (Context error data -> view)
userMsg userMsg
@ -1124,7 +1124,7 @@ toDynamicTransition name (Form a b c) =
{ result : Dict String (List error) { result : Dict String (List error)
, isMatchCandidate : Bool , isMatchCandidate : Bool
, combineAndView : , combineAndView :
{ combine : Validation.Validation error parsed field constraints { combine : Form.Validation.Validation error parsed field constraints
, view : Context error data -> view , view : Context error data -> view
} }
} }
@ -1134,7 +1134,7 @@ toDynamicTransition name (Form a b c) =
-> FormState -> FormState
-> ->
{ result : { result :
( Validation.Validation error parsed field constraints ( Form.Validation.Validation error parsed field constraints
, Dict String (List error) , Dict String (List error)
) )
, isMatchCandidate : Bool , isMatchCandidate : Bool
@ -1148,7 +1148,7 @@ toDynamicTransition name (Form a b c) =
{ result : Dict String (List error) { result : Dict String (List error)
, isMatchCandidate : Bool , isMatchCandidate : Bool
, combineAndView : , combineAndView :
{ combine : Validation.Validation error parsed field constraints { combine : Form.Validation.Validation error parsed field constraints
, view : Context error data -> view , view : Context error data -> view
} }
} }
@ -1184,7 +1184,7 @@ renderStyledHtml :
-> ->
FinalForm FinalForm
error error
(Validation.Validation error parsed named constraints) (Form.Validation.Validation error parsed named constraints)
data data
(Context error data (Context error data
-> List (Html.Styled.Html (Pages.Msg.Msg msg)) -> List (Html.Styled.Html (Pages.Msg.Msg msg))
@ -1206,7 +1206,7 @@ renderHelper :
-> RenderOptions msg -> RenderOptions msg
-> AppContext app actionData -> AppContext app actionData
-> data -> data
-> FormInternal error (Validation.Validation error parsed named constraints) data (Context error data -> List (Html (Pages.Msg.Msg msg))) -> FormInternal error (Form.Validation.Validation error parsed named constraints) data (Context error data -> List (Html (Pages.Msg.Msg msg)))
-> Html (Pages.Msg.Msg msg) -> Html (Pages.Msg.Msg msg)
renderHelper attrs accessResponse options formState data form = renderHelper attrs accessResponse options formState data form =
-- TODO Get transition context from `app` so you can check if the current form is being submitted -- TODO Get transition context from `app` so you can check if the current form is being submitted
@ -1244,7 +1244,7 @@ renderStyledHelper :
-> RenderOptions msg -> RenderOptions msg
-> AppContext app actionData -> AppContext app actionData
-> data -> data
-> FormInternal error (Validation.Validation error parsed named constraints) data (Context error data -> List (Html.Styled.Html (Pages.Msg.Msg msg))) -> FormInternal error (Form.Validation.Validation error parsed named constraints) data (Context error data -> List (Html.Styled.Html (Pages.Msg.Msg msg)))
-> Html.Styled.Html (Pages.Msg.Msg msg) -> Html.Styled.Html (Pages.Msg.Msg msg)
renderStyledHelper attrs accessResponse options formState data form = renderStyledHelper attrs accessResponse options formState data form =
-- TODO Get transition context from `app` so you can check if the current form is being submitted -- TODO Get transition context from `app` so you can check if the current form is being submitted
@ -1283,7 +1283,7 @@ helperValues :
-> AppContext app actionData -> AppContext app actionData
-> data -> data
---> Form error parsed data view ---> Form error parsed data view
-> FormInternal error (Validation.Validation error parsed named constraints) data (Context error data -> List view) -> FormInternal error (Form.Validation.Validation error parsed named constraints) data (Context error data -> List view)
-> { formId : String, hiddenInputs : List view, children : List view, isValid : Bool } -> { formId : String, hiddenInputs : List view, children : List view, isValid : Bool }
helperValues toHiddenInput accessResponse options formState data (FormInternal fieldDefinitions parser toInitialValues) = helperValues toHiddenInput accessResponse options formState data (FormInternal fieldDefinitions parser toInitialValues) =
let let
@ -1330,18 +1330,18 @@ helperValues toHiddenInput accessResponse options formState data (FormInternal f
|> Dict.union part2 |> Dict.union part2
parsed : parsed :
{ result : ( Validation.Validation error parsed named constraints, Dict String (List error) ) { result : ( Form.Validation.Validation error parsed named constraints, Dict String (List error) )
, isMatchCandidate : Bool , isMatchCandidate : Bool
, view : Context error data -> List view , view : Context error data -> List view
} }
parsed = parsed =
parser (Just data) thisFormState parser (Just data) thisFormState
withoutServerErrors : Validation.Validation error parsed named constraints withoutServerErrors : Form.Validation.Validation error parsed named constraints
withoutServerErrors = withoutServerErrors =
parsed |> mergeResults parsed |> mergeResults
withServerErrors : Validation.Validation error parsed named constraints withServerErrors : Form.Validation.Validation error parsed named constraints
withServerErrors = withServerErrors =
mergeResults mergeResults
{ parsed { parsed
@ -1486,7 +1486,7 @@ initCombined :
Form Form
error error
{ combineAndView { combineAndView
| combine : Validation.Validation error parsed kind constraints | combine : Form.Validation.Validation error parsed kind constraints
} }
input input
-> ServerForms error combined -> ServerForms error combined
@ -1499,13 +1499,13 @@ initCombined mapFn (Form _ parseFn _) =
foo : foo :
{ result : Dict String (List error) { result : Dict String (List error)
, isMatchCandidate : Bool , isMatchCandidate : Bool
, combineAndView : { combineAndView | combine : Validation.Validation error parsed kind constraints } , combineAndView : { combineAndView | combine : Form.Validation.Validation error parsed kind constraints }
} }
foo = foo =
parseFn Nothing formState parseFn Nothing formState
in in
{ result = foo.result { result = foo.result
, combineAndView = foo.combineAndView.combine |> Validation.mapWithNever mapFn , combineAndView = foo.combineAndView.combine |> Form.Validation.mapWithNever mapFn
, isMatchCandidate = foo.isMatchCandidate , isMatchCandidate = foo.isMatchCandidate
} }
) )
@ -1520,7 +1520,7 @@ combine :
Form Form
error error
{ combineAndView { combineAndView
| combine : Validation.Validation error parsed kind constraints | combine : Form.Validation.Validation error parsed kind constraints
} }
input input
-> ServerForms error combined -> ServerForms error combined
@ -1534,13 +1534,13 @@ combine mapFn (Form _ parseFn _) (ServerForms serverForms) =
foo : foo :
{ result : Dict String (List error) { result : Dict String (List error)
, isMatchCandidate : Bool , isMatchCandidate : Bool
, combineAndView : { combineAndView | combine : Validation.Validation error parsed kind constraints } , combineAndView : { combineAndView | combine : Form.Validation.Validation error parsed kind constraints }
} }
foo = foo =
parseFn Nothing formState parseFn Nothing formState
in in
{ result = foo.result { result = foo.result
, combineAndView = foo.combineAndView.combine |> Validation.mapWithNever mapFn , combineAndView = foo.combineAndView.combine |> Form.Validation.mapWithNever mapFn
, isMatchCandidate = foo.isMatchCandidate , isMatchCandidate = foo.isMatchCandidate
} }
) )
@ -1556,12 +1556,12 @@ initCombinedServer :
Form Form
error error
{ combineAndView { combineAndView
| combine : Combined error (BackendTask backendTaskError (Validation.Validation error parsed kind constraints)) | combine : Combined error (BackendTask backendTaskError (Form.Validation.Validation error parsed kind constraints))
} }
input input
-> ServerForms error (BackendTask backendTaskError (Validation.Validation error combined kind constraints)) -> ServerForms error (BackendTask backendTaskError (Form.Validation.Validation error combined kind constraints))
initCombinedServer mapFn serverForms = initCombinedServer mapFn serverForms =
initCombined (BackendTask.map (Validation.map mapFn)) serverForms initCombined (BackendTask.map (Form.Validation.map mapFn)) serverForms
{-| -} {-| -}
@ -1572,13 +1572,13 @@ combineServer :
error error
{ combineAndView { combineAndView
| combine : | combine :
Combined error (BackendTask backendTaskError (Validation.Validation error parsed kind constraints)) Combined error (BackendTask backendTaskError (Form.Validation.Validation error parsed kind constraints))
} }
input input
-> ServerForms error (BackendTask backendTaskError (Validation.Validation error combined kind constraints)) -> ServerForms error (BackendTask backendTaskError (Form.Validation.Validation error combined kind constraints))
-> ServerForms error (BackendTask backendTaskError (Validation.Validation error combined kind constraints)) -> ServerForms error (BackendTask backendTaskError (Form.Validation.Validation error combined kind constraints))
combineServer mapFn a b = combineServer mapFn a b =
combine (BackendTask.map (Validation.map mapFn)) a b combine (BackendTask.map (Form.Validation.map mapFn)) a b
{-| -} {-| -}