mirror of
https://github.com/dillonkearns/elm-pages.git
synced 2024-09-11 09:05:28 +03:00
Use navigation requests as default form submission strategy, with builder function to set withConcurrent.
This commit is contained in:
parent
d0a4feeb02
commit
284a40c306
2
elm.json
2
elm.json
@ -50,7 +50,7 @@
|
|||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1 <= v < 2.0.0",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1 <= v < 2.0.0",
|
||||||
"dillonkearns/elm-cli-options-parser": "3.2.0 <= v < 4.0.0",
|
"dillonkearns/elm-cli-options-parser": "3.2.0 <= v < 4.0.0",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0 <= v < 3.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0 <= v < 3.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2 <= v < 3.0.0",
|
"dillonkearns/elm-form": "3.0.0 <= v < 4.0.0",
|
||||||
"elm/browser": "1.0.2 <= v < 2.0.0",
|
"elm/browser": "1.0.2 <= v < 2.0.0",
|
||||||
"elm/bytes": "1.0.8 <= v < 2.0.0",
|
"elm/bytes": "1.0.8 <= v < 2.0.0",
|
||||||
"elm/core": "1.0.5 <= v < 2.0.0",
|
"elm/core": "1.0.5 <= v < 2.0.0",
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"danyx23/elm-mimetype": "4.0.1",
|
"danyx23/elm-mimetype": "4.0.1",
|
||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2",
|
"dillonkearns/elm-form": "3.0.0",
|
||||||
"dillonkearns/elm-markdown": "7.0.1",
|
"dillonkearns/elm-markdown": "7.0.1",
|
||||||
"elm/browser": "1.0.2",
|
"elm/browser": "1.0.2",
|
||||||
"elm/bytes": "1.0.8",
|
"elm/bytes": "1.0.8",
|
||||||
|
3
examples/base-path/package-lock.json
generated
3
examples/base-path/package-lock.json
generated
@ -17,7 +17,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"version": "3.0.0-beta.38",
|
"name": "elm-pages",
|
||||||
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -153,7 +153,6 @@ view app shared model =
|
|||||||
[ Html.h2 [] [ Html.text "Form" ]
|
[ Html.h2 [] [ Html.text "Form" ]
|
||||||
, form
|
, form
|
||||||
|> Pages.Form.renderHtml []
|
|> Pages.Form.renderHtml []
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "form"
|
(Form.options "form"
|
||||||
|> Form.withInput app.data.post
|
|> Form.withInput app.data.post
|
||||||
|> Form.withServerResponse
|
|> Form.withServerResponse
|
||||||
@ -166,7 +165,6 @@ view app shared model =
|
|||||||
else
|
else
|
||||||
deleteForm
|
deleteForm
|
||||||
|> Pages.Form.renderHtml []
|
|> Pages.Form.renderHtml []
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "delete")
|
(Form.options "delete")
|
||||||
app
|
app
|
||||||
]
|
]
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
||||||
"dillonkearns/elm-cli-options-parser": "3.2.0",
|
"dillonkearns/elm-cli-options-parser": "3.2.0",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2",
|
"dillonkearns/elm-form": "3.0.0",
|
||||||
"dillonkearns/elm-graphql": "5.0.11",
|
"dillonkearns/elm-graphql": "5.0.11",
|
||||||
"dillonkearns/elm-markdown": "7.0.1",
|
"dillonkearns/elm-markdown": "7.0.1",
|
||||||
"elm/browser": "1.0.2",
|
"elm/browser": "1.0.2",
|
||||||
|
2
examples/blog-engine/package-lock.json
generated
2
examples/blog-engine/package-lock.json
generated
@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"danyx23/elm-mimetype": "4.0.1",
|
"danyx23/elm-mimetype": "4.0.1",
|
||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2",
|
"dillonkearns/elm-form": "3.0.0",
|
||||||
"dillonkearns/elm-markdown": "7.0.1",
|
"dillonkearns/elm-markdown": "7.0.1",
|
||||||
"dillonkearns/elm-oembed": "1.0.0",
|
"dillonkearns/elm-oembed": "1.0.0",
|
||||||
"dillonkearns/elm-rss": "2.0.3",
|
"dillonkearns/elm-rss": "2.0.3",
|
||||||
|
2
examples/docs/package-lock.json
generated
2
examples/docs/package-lock.json
generated
@ -22,7 +22,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -212,9 +212,9 @@ view app shared model =
|
|||||||
]
|
]
|
||||||
[ form
|
[ form
|
||||||
|> Pages.Form.renderStyledHtml []
|
|> Pages.Form.renderStyledHtml []
|
||||||
Pages.Form.Parallel
|
|
||||||
(Form.options "dark-mode"
|
(Form.options "dark-mode"
|
||||||
|> Form.withInput app.data.isDarkMode
|
|> Form.withInput app.data.isDarkMode
|
||||||
|
|> Pages.Form.withConcurrent
|
||||||
)
|
)
|
||||||
app
|
app
|
||||||
, Html.text <|
|
, Html.text <|
|
||||||
|
@ -240,7 +240,6 @@ view app sharedModel model =
|
|||||||
, form
|
, form
|
||||||
|> Pages.Form.renderStyledHtml
|
|> Pages.Form.renderStyledHtml
|
||||||
[]
|
[]
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options ("add-item-" ++ String.fromInt model.itemIndex)
|
(Form.options ("add-item-" ++ String.fromInt model.itemIndex)
|
||||||
|> Form.withOnSubmit (\_ -> AddItemSubmitted)
|
|> Form.withOnSubmit (\_ -> AddItemSubmitted)
|
||||||
)
|
)
|
||||||
@ -249,8 +248,9 @@ view app sharedModel model =
|
|||||||
[ deleteForm
|
[ deleteForm
|
||||||
|> Pages.Form.renderStyledHtml
|
|> Pages.Form.renderStyledHtml
|
||||||
[]
|
[]
|
||||||
Pages.Form.Parallel
|
(Form.options "delete-all"
|
||||||
(Form.options "delete-all")
|
|> Pages.Form.withConcurrent
|
||||||
|
)
|
||||||
app
|
app
|
||||||
]
|
]
|
||||||
, optimisticItems
|
, optimisticItems
|
||||||
|
@ -252,7 +252,6 @@ view app shared =
|
|||||||
, Attr.style "flex-direction" "column"
|
, Attr.style "flex-direction" "column"
|
||||||
, Attr.style "gap" "20px"
|
, Attr.style "gap" "20px"
|
||||||
]
|
]
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "user-form"
|
(Form.options "user-form"
|
||||||
|> Form.withInput defaultUser
|
|> Form.withInput defaultUser
|
||||||
|> Form.withServerResponse (app.action |> Maybe.map .formResponse)
|
|> Form.withServerResponse (app.action |> Maybe.map .formResponse)
|
||||||
|
@ -130,7 +130,6 @@ view app shared =
|
|||||||
, Attr.style "flex-direction" "column"
|
, Attr.style "flex-direction" "column"
|
||||||
, Attr.style "gap" "20px"
|
, Attr.style "gap" "20px"
|
||||||
]
|
]
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "user-form"
|
(Form.options "user-form"
|
||||||
|> Form.withInput app.data.filters
|
|> Form.withInput app.data.filters
|
||||||
|> Form.withGetMethod
|
|> Form.withGetMethod
|
||||||
|
@ -222,7 +222,6 @@ view app shared =
|
|||||||
, form
|
, form
|
||||||
|> Pages.Form.renderStyledHtml
|
|> Pages.Form.renderStyledHtml
|
||||||
[]
|
[]
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "form"
|
(Form.options "form"
|
||||||
|> Form.withServerResponse (app.action |> Maybe.map .errors)
|
|> Form.withServerResponse (app.action |> Maybe.map .errors)
|
||||||
)
|
)
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
||||||
"dillonkearns/elm-cli-options-parser": "3.2.0",
|
"dillonkearns/elm-cli-options-parser": "3.2.0",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2",
|
"dillonkearns/elm-form": "3.0.0",
|
||||||
"elm/browser": "1.0.2",
|
"elm/browser": "1.0.2",
|
||||||
"elm/bytes": "1.0.8",
|
"elm/bytes": "1.0.8",
|
||||||
"elm/core": "1.0.5",
|
"elm/core": "1.0.5",
|
||||||
|
2
examples/end-to-end/package-lock.json
generated
2
examples/end-to-end/package-lock.json
generated
@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.39",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"danyx23/elm-mimetype": "4.0.1",
|
"danyx23/elm-mimetype": "4.0.1",
|
||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2",
|
"dillonkearns/elm-form": "3.0.0",
|
||||||
"dillonkearns/elm-markdown": "7.0.1",
|
"dillonkearns/elm-markdown": "7.0.1",
|
||||||
"elm/browser": "1.0.2",
|
"elm/browser": "1.0.2",
|
||||||
"elm/bytes": "1.0.8",
|
"elm/bytes": "1.0.8",
|
||||||
|
3
examples/escaping/package-lock.json
generated
3
examples/escaping/package-lock.json
generated
@ -17,7 +17,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"version": "3.0.0-beta.38",
|
"name": "elm-pages",
|
||||||
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -7,7 +7,7 @@ import Html exposing (Html)
|
|||||||
import Html.Styled
|
import Html.Styled
|
||||||
import Pages.Flags
|
import Pages.Flags
|
||||||
import Pages.PageUrl exposing (PageUrl)
|
import Pages.PageUrl exposing (PageUrl)
|
||||||
import Path exposing (Path)
|
import UrlPath exposing (UrlPath)
|
||||||
import Route exposing (Route)
|
import Route exposing (Route)
|
||||||
import SharedTemplate exposing (SharedTemplate)
|
import SharedTemplate exposing (SharedTemplate)
|
||||||
import View exposing (View)
|
import View exposing (View)
|
||||||
@ -26,7 +26,7 @@ template =
|
|||||||
|
|
||||||
type Msg
|
type Msg
|
||||||
= OnPageChange
|
= OnPageChange
|
||||||
{ path : Path
|
{ path : UrlPath
|
||||||
, query : Maybe String
|
, query : Maybe String
|
||||||
, fragment : Maybe String
|
, fragment : Maybe String
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ init :
|
|||||||
->
|
->
|
||||||
Maybe
|
Maybe
|
||||||
{ path :
|
{ path :
|
||||||
{ path : Path
|
{ path : UrlPath
|
||||||
, query : Maybe String
|
, query : Maybe String
|
||||||
, fragment : Maybe String
|
, fragment : Maybe String
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ update msg model =
|
|||||||
( { model | showMobileMenu = False }, Effect.none )
|
( { model | showMobileMenu = False }, Effect.none )
|
||||||
|
|
||||||
|
|
||||||
subscriptions : Path -> Model -> Sub Msg
|
subscriptions : UrlPath -> Model -> Sub Msg
|
||||||
subscriptions _ _ =
|
subscriptions _ _ =
|
||||||
Sub.none
|
Sub.none
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ data =
|
|||||||
view :
|
view :
|
||||||
Data
|
Data
|
||||||
->
|
->
|
||||||
{ path : Path
|
{ path : UrlPath
|
||||||
, route : Maybe Route
|
, route : Maybe Route
|
||||||
}
|
}
|
||||||
-> Model
|
-> Model
|
||||||
|
2
examples/hackernews/package-lock.json
generated
2
examples/hackernews/package-lock.json
generated
@ -23,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"danyx23/elm-mimetype": "4.0.1",
|
"danyx23/elm-mimetype": "4.0.1",
|
||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2",
|
"dillonkearns/elm-form": "3.0.0",
|
||||||
"dillonkearns/elm-markdown": "6.0.1",
|
"dillonkearns/elm-markdown": "6.0.1",
|
||||||
"elm/browser": "1.0.2",
|
"elm/browser": "1.0.2",
|
||||||
"elm/bytes": "1.0.8",
|
"elm/bytes": "1.0.8",
|
||||||
|
2
examples/hello/package-lock.json
generated
2
examples/hello/package-lock.json
generated
@ -15,7 +15,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -267,7 +267,6 @@ view app shared =
|
|||||||
, Attr.style "flex-direction" "column"
|
, Attr.style "flex-direction" "column"
|
||||||
, Attr.style "gap" "20px"
|
, Attr.style "gap" "20px"
|
||||||
]
|
]
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "test1"
|
(Form.options "test1"
|
||||||
|> Form.withInput defaultUser
|
|> Form.withInput defaultUser
|
||||||
)
|
)
|
||||||
|
@ -206,7 +206,6 @@ view static sharedModel model =
|
|||||||
, form
|
, form
|
||||||
|> Pages.Form.renderHtml
|
|> Pages.Form.renderHtml
|
||||||
[]
|
[]
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "test1" |> Form.withGetMethod)
|
(Form.options "test1" |> Form.withGetMethod)
|
||||||
-- TODO pass in server data
|
-- TODO pass in server data
|
||||||
static
|
static
|
||||||
|
@ -265,7 +265,6 @@ view app shared model =
|
|||||||
, form
|
, form
|
||||||
|> Pages.Form.renderHtml
|
|> Pages.Form.renderHtml
|
||||||
[]
|
[]
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "test1")
|
(Form.options "test1")
|
||||||
-- TODO pass in server data
|
-- TODO pass in server data
|
||||||
app
|
app
|
||||||
|
@ -703,7 +703,6 @@ view app model sharedModel =
|
|||||||
, form
|
, form
|
||||||
|> Pages.Form.renderStyledHtml
|
|> Pages.Form.renderStyledHtml
|
||||||
[]
|
[]
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "test"
|
(Form.options "test"
|
||||||
|> Form.withServerResponse
|
|> Form.withServerResponse
|
||||||
(app.action |> Maybe.andThen .formResponse)
|
(app.action |> Maybe.andThen .formResponse)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"danyx23/elm-mimetype": "4.0.1",
|
"danyx23/elm-mimetype": "4.0.1",
|
||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2",
|
"dillonkearns/elm-form": "3.0.0",
|
||||||
"dillonkearns/elm-graphql": "5.0.11",
|
"dillonkearns/elm-graphql": "5.0.11",
|
||||||
"dillonkearns/elm-markdown": "7.0.1",
|
"dillonkearns/elm-markdown": "7.0.1",
|
||||||
"dillonkearns/elm-sitemap": "1.0.2",
|
"dillonkearns/elm-sitemap": "1.0.2",
|
||||||
|
2
examples/pokedex/package-lock.json
generated
2
examples/pokedex/package-lock.json
generated
@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
2
examples/repos/package-lock.json
generated
2
examples/repos/package-lock.json
generated
@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -7,7 +7,7 @@ import Html exposing (Html)
|
|||||||
import Html.Styled
|
import Html.Styled
|
||||||
import Pages.Flags
|
import Pages.Flags
|
||||||
import Pages.PageUrl exposing (PageUrl)
|
import Pages.PageUrl exposing (PageUrl)
|
||||||
import Path exposing (Path)
|
import UrlPath exposing (UrlPath)
|
||||||
import Route exposing (Route)
|
import Route exposing (Route)
|
||||||
import SharedTemplate exposing (SharedTemplate)
|
import SharedTemplate exposing (SharedTemplate)
|
||||||
import View exposing (View)
|
import View exposing (View)
|
||||||
@ -26,7 +26,7 @@ template =
|
|||||||
|
|
||||||
type Msg
|
type Msg
|
||||||
= OnPageChange
|
= OnPageChange
|
||||||
{ path : Path
|
{ path : UrlPath
|
||||||
, query : Maybe String
|
, query : Maybe String
|
||||||
, fragment : Maybe String
|
, fragment : Maybe String
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ init :
|
|||||||
->
|
->
|
||||||
Maybe
|
Maybe
|
||||||
{ path :
|
{ path :
|
||||||
{ path : Path
|
{ path : UrlPath
|
||||||
, query : Maybe String
|
, query : Maybe String
|
||||||
, fragment : Maybe String
|
, fragment : Maybe String
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ update msg model =
|
|||||||
( { model | showMobileMenu = False }, Effect.none )
|
( { model | showMobileMenu = False }, Effect.none )
|
||||||
|
|
||||||
|
|
||||||
subscriptions : Path -> Model -> Sub Msg
|
subscriptions : UrlPath -> Model -> Sub Msg
|
||||||
subscriptions _ _ =
|
subscriptions _ _ =
|
||||||
Sub.none
|
Sub.none
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ data =
|
|||||||
view :
|
view :
|
||||||
Data
|
Data
|
||||||
->
|
->
|
||||||
{ path : Path
|
{ path : UrlPath
|
||||||
, route : Maybe Route
|
, route : Maybe Route
|
||||||
}
|
}
|
||||||
-> Model
|
-> Model
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"danyx23/elm-mimetype": "4.0.1",
|
"danyx23/elm-mimetype": "4.0.1",
|
||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2",
|
"dillonkearns/elm-form": "3.0.0",
|
||||||
"elm/browser": "1.0.2",
|
"elm/browser": "1.0.2",
|
||||||
"elm/bytes": "1.0.8",
|
"elm/bytes": "1.0.8",
|
||||||
"elm/core": "1.0.5",
|
"elm/core": "1.0.5",
|
||||||
|
2
examples/routing/package-lock.json
generated
2
examples/routing/package-lock.json
generated
@ -18,7 +18,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
2
examples/slides/package-lock.json
generated
2
examples/slides/package-lock.json
generated
@ -17,7 +17,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
2
examples/smoothies/package-lock.json
generated
2
examples/smoothies/package-lock.json
generated
@ -26,7 +26,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -398,8 +398,9 @@ view app shared =
|
|||||||
[ Html.text <| "Hello! You are already logged in as " ++ username
|
[ Html.text <| "Hello! You are already logged in as " ++ username
|
||||||
, logoutForm
|
, logoutForm
|
||||||
|> Pages.Form.renderHtml []
|
|> Pages.Form.renderHtml []
|
||||||
Pages.Form.Parallel
|
(Form.options "logout"
|
||||||
(Form.options "logout")
|
|> Pages.Form.withConcurrent
|
||||||
|
)
|
||||||
app
|
app
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -408,7 +409,6 @@ view app shared =
|
|||||||
]
|
]
|
||||||
, form
|
, form
|
||||||
|> Pages.Form.renderHtml []
|
|> Pages.Form.renderHtml []
|
||||||
Pages.Form.Serial
|
|
||||||
(Form.options "login"
|
(Form.options "login"
|
||||||
|> Form.withServerResponse (app.action |> Maybe.andThen .maybeError)
|
|> Form.withServerResponse (app.action |> Maybe.andThen .maybeError)
|
||||||
)
|
)
|
||||||
|
@ -497,13 +497,13 @@ view app shared model =
|
|||||||
[ class "create-form"
|
[ class "create-form"
|
||||||
, hidden (not (List.isEmpty failedAddItemActions))
|
, hidden (not (List.isEmpty failedAddItemActions))
|
||||||
]
|
]
|
||||||
Pages.Form.Parallel
|
|
||||||
(Form.options
|
(Form.options
|
||||||
("new-item-"
|
("new-item-"
|
||||||
++ (model.nextId |> Time.posixToMillis |> String.fromInt)
|
++ (model.nextId |> Time.posixToMillis |> String.fromInt)
|
||||||
)
|
)
|
||||||
|> Form.withInput Nothing
|
|> Form.withInput Nothing
|
||||||
|> Form.withOnSubmit (\_ -> NewItemSubmitted)
|
|> Form.withOnSubmit (\_ -> NewItemSubmitted)
|
||||||
|
|> Pages.Form.withConcurrent
|
||||||
)
|
)
|
||||||
app
|
app
|
||||||
, div []
|
, div []
|
||||||
@ -513,10 +513,10 @@ view app shared model =
|
|||||||
addItemForm
|
addItemForm
|
||||||
|> Pages.Form.renderHtml
|
|> Pages.Form.renderHtml
|
||||||
[ class "create-form", hidden (index /= 0) ]
|
[ class "create-form", hidden (index /= 0) ]
|
||||||
Pages.Form.Parallel
|
|
||||||
(Form.options key
|
(Form.options key
|
||||||
|> Form.withOnSubmit (\_ -> NewItemSubmitted)
|
|> Form.withOnSubmit (\_ -> NewItemSubmitted)
|
||||||
|> Form.withInput (Just createFetcherErrors)
|
|> Form.withInput (Just createFetcherErrors)
|
||||||
|
|> Pages.Form.withConcurrent
|
||||||
)
|
)
|
||||||
app
|
app
|
||||||
)
|
)
|
||||||
@ -737,9 +737,9 @@ viewEntries app visibility entries =
|
|||||||
]
|
]
|
||||||
[ toggleAllForm
|
[ toggleAllForm
|
||||||
|> Pages.Form.renderHtml []
|
|> Pages.Form.renderHtml []
|
||||||
Pages.Form.Parallel
|
|
||||||
(Form.options "toggle-all"
|
(Form.options "toggle-all"
|
||||||
|> Form.withInput { allCompleted = allCompleted }
|
|> Form.withInput { allCompleted = allCompleted }
|
||||||
|
|> Pages.Form.withConcurrent
|
||||||
)
|
)
|
||||||
app
|
app
|
||||||
, Keyed.ul [ class "todo-list" ] <|
|
, Keyed.ul [ class "todo-list" ] <|
|
||||||
@ -767,17 +767,17 @@ viewEntry app todo =
|
|||||||
[ class "view" ]
|
[ class "view" ]
|
||||||
[ checkItemForm
|
[ checkItemForm
|
||||||
|> Pages.Form.renderHtml []
|
|> Pages.Form.renderHtml []
|
||||||
Pages.Form.Parallel
|
|
||||||
(("toggle-" ++ todo.id)
|
(("toggle-" ++ todo.id)
|
||||||
|> Form.options
|
|> Form.options
|
||||||
|> Form.withInput todo
|
|> Form.withInput todo
|
||||||
|
|> Pages.Form.withConcurrent
|
||||||
)
|
)
|
||||||
app
|
app
|
||||||
, editItemForm
|
, editItemForm
|
||||||
|> Pages.Form.renderHtml []
|
|> Pages.Form.renderHtml []
|
||||||
Pages.Form.Parallel
|
|
||||||
(Form.options ("edit-" ++ todo.id)
|
(Form.options ("edit-" ++ todo.id)
|
||||||
|> Form.withInput todo
|
|> Form.withInput todo
|
||||||
|
|> Pages.Form.withConcurrent
|
||||||
)
|
)
|
||||||
app
|
app
|
||||||
, if todo.isSaving then
|
, if todo.isSaving then
|
||||||
@ -786,9 +786,9 @@ viewEntry app todo =
|
|||||||
else
|
else
|
||||||
deleteItemForm
|
deleteItemForm
|
||||||
|> Pages.Form.renderHtml []
|
|> Pages.Form.renderHtml []
|
||||||
Pages.Form.Parallel
|
|
||||||
(Form.options ("delete-" ++ todo.id)
|
(Form.options ("delete-" ++ todo.id)
|
||||||
|> Form.withInput todo
|
|> Form.withInput todo
|
||||||
|
|> Pages.Form.withConcurrent
|
||||||
)
|
)
|
||||||
app
|
app
|
||||||
]
|
]
|
||||||
@ -881,9 +881,9 @@ viewControlsClear : App Data ActionData RouteParams -> Int -> Html (PagesMsg Msg
|
|||||||
viewControlsClear app entriesCompleted =
|
viewControlsClear app entriesCompleted =
|
||||||
clearCompletedForm
|
clearCompletedForm
|
||||||
|> Pages.Form.renderHtml []
|
|> Pages.Form.renderHtml []
|
||||||
Pages.Form.Parallel
|
|
||||||
(Form.options "clear-completed"
|
(Form.options "clear-completed"
|
||||||
|> Form.withInput { entriesCompleted = entriesCompleted }
|
|> Form.withInput { entriesCompleted = entriesCompleted }
|
||||||
|
|> Pages.Form.withConcurrent
|
||||||
)
|
)
|
||||||
app
|
app
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
"dillonkearns/elm-bcp47-language-tag": "1.0.1",
|
||||||
"dillonkearns/elm-cli-options-parser": "3.2.0",
|
"dillonkearns/elm-cli-options-parser": "3.2.0",
|
||||||
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
"dillonkearns/elm-date-or-date-time": "2.0.0",
|
||||||
"dillonkearns/elm-form": "2.0.2",
|
"dillonkearns/elm-form": "3.0.0",
|
||||||
"dillonkearns/elm-graphql": "5.0.11",
|
"dillonkearns/elm-graphql": "5.0.11",
|
||||||
"dillonkearns/elm-markdown": "7.0.1",
|
"dillonkearns/elm-markdown": "7.0.1",
|
||||||
"elm/browser": "1.0.2",
|
"elm/browser": "1.0.2",
|
||||||
|
2
examples/todos/package-lock.json
generated
2
examples/todos/package-lock.json
generated
@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
2
examples/trails/package-lock.json
generated
2
examples/trails/package-lock.json
generated
@ -23,7 +23,7 @@
|
|||||||
},
|
},
|
||||||
"../..": {
|
"../..": {
|
||||||
"name": "elm-pages",
|
"name": "elm-pages",
|
||||||
"version": "3.0.0-beta.38",
|
"version": "3.0.0-beta.40",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
module Pages.Form exposing
|
module Pages.Form exposing
|
||||||
( Strategy(..), renderHtml, renderStyledHtml
|
( renderHtml, renderStyledHtml
|
||||||
, FormWithServerValidations, Handler
|
, FormWithServerValidations, Handler
|
||||||
|
, Options, withConcurrent
|
||||||
)
|
)
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
|
||||||
@docs Strategy, renderHtml, renderStyledHtml
|
@docs renderHtml, renderStyledHtml
|
||||||
|
|
||||||
@docs FormWithServerValidations, Handler
|
@docs FormWithServerValidations, Handler
|
||||||
|
|
||||||
|
@docs Options, withConcurrent
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
import BackendTask exposing (BackendTask)
|
import BackendTask exposing (BackendTask)
|
||||||
@ -45,6 +48,15 @@ type alias Handler error combined =
|
|||||||
Form.Handler.Handler error (BackendTask FatalError (Validation error combined Never Never))
|
Form.Handler.Handler error (BackendTask FatalError (Validation error combined Never Never))
|
||||||
|
|
||||||
|
|
||||||
|
type alias Options error parsed input msg =
|
||||||
|
Form.Options error parsed input msg { concurrent : Bool }
|
||||||
|
|
||||||
|
|
||||||
|
withConcurrent : Options error parsed input msg -> Options error parsed input msg
|
||||||
|
withConcurrent options_ =
|
||||||
|
{ options_ | extras = Just { concurrent = True } }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--init :
|
--init :
|
||||||
-- (parsed -> combined)
|
-- (parsed -> combined)
|
||||||
@ -78,8 +90,7 @@ type Strategy
|
|||||||
{-| -}
|
{-| -}
|
||||||
renderHtml :
|
renderHtml :
|
||||||
List (Html.Attribute (PagesMsg userMsg))
|
List (Html.Attribute (PagesMsg userMsg))
|
||||||
-> Strategy
|
-> Options error parsed input userMsg
|
||||||
-> Form.Options error parsed input userMsg
|
|
||||||
->
|
->
|
||||||
{ --path : Path
|
{ --path : Path
|
||||||
--, url : Maybe PageUrl
|
--, url : Maybe PageUrl
|
||||||
@ -91,7 +102,12 @@ renderHtml :
|
|||||||
}
|
}
|
||||||
-> Form.Form error { combine : Validation error parsed named constraints, view : Form.Context error input -> List (Html.Html (PagesMsg userMsg)) } parsed input
|
-> Form.Form error { combine : Validation error parsed named constraints, view : Form.Context error input -> List (Html.Html (PagesMsg userMsg)) } parsed input
|
||||||
-> Html.Html (PagesMsg userMsg)
|
-> Html.Html (PagesMsg userMsg)
|
||||||
renderHtml attrs strategy options_ app form_ =
|
renderHtml attrs options_ app form_ =
|
||||||
|
let
|
||||||
|
concurrent : Bool
|
||||||
|
concurrent =
|
||||||
|
options_.extras |> Maybe.map .concurrent |> Maybe.withDefault False
|
||||||
|
in
|
||||||
form_
|
form_
|
||||||
|> Form.renderHtml
|
|> Form.renderHtml
|
||||||
{ state = app.pageFormState
|
{ state = app.pageFormState
|
||||||
@ -137,7 +153,7 @@ renderHtml attrs strategy options_ app form_ =
|
|||||||
case submission.parsed of
|
case submission.parsed of
|
||||||
Form.Valid _ ->
|
Form.Valid _ ->
|
||||||
Pages.Internal.Msg.Submit
|
Pages.Internal.Msg.Submit
|
||||||
{ useFetcher = strategy == Parallel
|
{ useFetcher = concurrent
|
||||||
, action = submission.action
|
, action = submission.action
|
||||||
, fields = submission.fields
|
, fields = submission.fields
|
||||||
, method = submission.method
|
, method = submission.method
|
||||||
@ -151,7 +167,7 @@ renderHtml attrs strategy options_ app form_ =
|
|||||||
|
|
||||||
Form.Invalid _ _ ->
|
Form.Invalid _ _ ->
|
||||||
Pages.Internal.Msg.Submit
|
Pages.Internal.Msg.Submit
|
||||||
{ useFetcher = strategy == Parallel
|
{ useFetcher = concurrent
|
||||||
, action = submission.action
|
, action = submission.action
|
||||||
, method = submission.method
|
, method = submission.method
|
||||||
, fields = submission.fields
|
, fields = submission.fields
|
||||||
@ -160,6 +176,7 @@ renderHtml attrs strategy options_ app form_ =
|
|||||||
, valid = False
|
, valid = False
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
, extras = Nothing
|
||||||
}
|
}
|
||||||
attrs
|
attrs
|
||||||
|
|
||||||
@ -167,8 +184,7 @@ renderHtml attrs strategy options_ app form_ =
|
|||||||
{-| -}
|
{-| -}
|
||||||
renderStyledHtml :
|
renderStyledHtml :
|
||||||
List (Html.Styled.Attribute (PagesMsg userMsg))
|
List (Html.Styled.Attribute (PagesMsg userMsg))
|
||||||
-> Strategy
|
-> Options error parsed input userMsg
|
||||||
-> Form.Options error parsed input userMsg
|
|
||||||
->
|
->
|
||||||
{ --path : Path
|
{ --path : Path
|
||||||
--, url : Maybe PageUrl
|
--, url : Maybe PageUrl
|
||||||
@ -180,7 +196,12 @@ renderStyledHtml :
|
|||||||
}
|
}
|
||||||
-> Form.Form error { combine : Validation error parsed named constraints, view : Form.Context error input -> List (Html.Styled.Html (PagesMsg userMsg)) } parsed input
|
-> Form.Form error { combine : Validation error parsed named constraints, view : Form.Context error input -> List (Html.Styled.Html (PagesMsg userMsg)) } parsed input
|
||||||
-> Html.Styled.Html (PagesMsg userMsg)
|
-> Html.Styled.Html (PagesMsg userMsg)
|
||||||
renderStyledHtml attrs strategy options_ app form_ =
|
renderStyledHtml attrs options_ app form_ =
|
||||||
|
let
|
||||||
|
concurrent : Bool
|
||||||
|
concurrent =
|
||||||
|
options_.extras |> Maybe.map .concurrent |> Maybe.withDefault False
|
||||||
|
in
|
||||||
form_
|
form_
|
||||||
|> Form.renderStyledHtml
|
|> Form.renderStyledHtml
|
||||||
{ state = app.pageFormState
|
{ state = app.pageFormState
|
||||||
@ -226,7 +247,7 @@ renderStyledHtml attrs strategy options_ app form_ =
|
|||||||
case submission.parsed of
|
case submission.parsed of
|
||||||
Form.Valid _ ->
|
Form.Valid _ ->
|
||||||
Pages.Internal.Msg.Submit
|
Pages.Internal.Msg.Submit
|
||||||
{ useFetcher = strategy == Parallel
|
{ useFetcher = concurrent
|
||||||
, action = submission.action
|
, action = submission.action
|
||||||
, fields = submission.fields
|
, fields = submission.fields
|
||||||
, method = submission.method
|
, method = submission.method
|
||||||
@ -240,7 +261,7 @@ renderStyledHtml attrs strategy options_ app form_ =
|
|||||||
|
|
||||||
Form.Invalid _ _ ->
|
Form.Invalid _ _ ->
|
||||||
Pages.Internal.Msg.Submit
|
Pages.Internal.Msg.Submit
|
||||||
{ useFetcher = strategy == Parallel
|
{ useFetcher = concurrent
|
||||||
, action = submission.action
|
, action = submission.action
|
||||||
, fields = submission.fields
|
, fields = submission.fields
|
||||||
, method = submission.method
|
, method = submission.method
|
||||||
@ -249,5 +270,6 @@ renderStyledHtml attrs strategy options_ app form_ =
|
|||||||
, valid = False
|
, valid = False
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
, extras = Nothing
|
||||||
}
|
}
|
||||||
attrs
|
attrs
|
||||||
|
Loading…
Reference in New Issue
Block a user