edit field utilities
fields =
{ name = "name" |> Conflict.init signature ""
}
form = fields |> Edit.form
name_ = Form.prop .name (\v m -> { m | name = v })
get_name = .name
blank = Validate.blank "blank"
(isStatic,options) =
{ error = "conflict"
, form = form
, last = http.get.response
, isConflict = http.put.isConflict
, isDifferent = response.isDifferentResponse
}
|> Edit.options
view a =
{ name = a
}
( isStatic
, Conflict.compose view
( options |> ( ( name_, get_name ) |> Conflict.single [ fields.name |> V.blank ] ) )
)
|> Edit.view
{-
{ isStatic = True
, state = HasError
, form =
{ name =
( "name"
, { field = model.name
, prop = name_
}
, { errors = [ "blank" ] -- model.name |> blank
, isModified = True
}
)
}
}
-}isStatic, state (HasError, HasModified) and form
fields HasError or HasModified or Same
construct form
{ name = "name" |> Conflict.init signature ""
}
|> Edit.formconstruct Conflict.Options
{ error = "conflict"
, form = form
, last = http.get.response
, isConflict = http.put.isConflict
, isDifferent = response.isDifferentResponse
}
|> Edit.options
-- ( isStatic, options )construct Conflict.Options
let
fields = form |> Edit.fields
in
( isStatic
, Conflict.compose view
( options |> ( ( name_, get_name ) |> Conflict.single [ fields.name |> V.blank ] ) )
)
|> Edit.view
edit/static state and fields