Skip to content

Commit 052aa04

Browse files
committed
Ability to hide error icon
1 parent 2a267af commit 052aa04

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Json/Form/Config.elm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ type alias Config =
88
, dense : Bool
99
, name : String
1010
, collapseNestedObjects : Bool
11+
, showErrorIcon : Bool
1112
}
1213

1314

@@ -22,12 +23,13 @@ defaultConfig =
2223
, dense = True
2324
, name = ""
2425
, collapseNestedObjects = False
26+
, showErrorIcon = True
2527
}
2628

2729

2830
decoder : Decoder Config
2931
decoder =
30-
Decode.map4 Config
32+
Decode.map5 Config
3133
((field "textFieldStyle" <|
3234
Decode.andThen
3335
(\x ->
@@ -49,3 +51,4 @@ decoder =
4951
(field "dense" bool |> maybe |> Decode.map (Maybe.withDefault True))
5052
(field "name" string |> maybe |> Decode.map (Maybe.withDefault ""))
5153
(field "collapseNestedObjects" bool |> maybe |> Decode.map (Maybe.withDefault False))
54+
(field "showErrorIcon" bool |> maybe |> Decode.map (Maybe.withDefault True))

src/Json/Form/TextField.elm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ view model schema isJson isRequired isDisabled path =
9494
else
9595
ToggleShowPassword |> eye |> Just
9696

97-
else if hasError then
98-
errorIcon |> Just
97+
else if hasError && model.config.showErrorIcon then
98+
Just errorIcon
9999

100100
else if not isRequired && editedValue /= "" && not actuallyDisabled then
101101
DeleteProperty path |> deleteIcon |> Just

0 commit comments

Comments
 (0)