edit field utilities - conflict
name_ = Form.prop .name (\v m -> { m | name = v })
get_name = .name
model =
{ name = "name" |> Conflict.init signature ""
}
blank = Validate.blank "blank"
opts =
{ error = "conflict"
, form = model
, response =
{ first = form.response
, last = http.response
}
}
view a =
{ name = a
}
Conflict.compose view
( model |> ( ( name_, get_name ) |> Conflict.single [ model.name |> blank ] ) )
{-
{ hasError = True
, hasModified = True
, form =
{ name =
( "name"
, { field = model.name
, prop = name_
}
, { errors = [ "blank" ] -- model.name |> blank
, isModified = True
}
)
}
}
-}field name, form and errors
single form model
attribute of conflict state and resolve operation
field, prop and last value
response to value getter
initialize options
{ error : String -- error message
, form : form -- fields
, response :
{ first : Maybe response -- response of edit start
, last : response -- last response
}
}conflict state
resolve type
construct Field
"name" |> Conflict.init signature ""construct Single
{ error = "conflict"
, form = form
, response =
{ first = form.response
, last = http.response
}
}
|> ( ( name_, get_name ) |> Conflict.single [ form.name |> Validate.blank "blank" ] )set conflict
resolve conflict
model |> Conflict.resolve prop Conflict.leave
model |> Conflict.resolve prop (Conflict.revert value)compose models
type alias Form =
{ name = Conflict.Field String
}
type alias Model =
{ name = Conflict.Single Form {} String
}
name_ = Form.prop .name (\v m -> { m | name = v })
get_name = .name
opts =
{ error = "conflict"
, form = form
, response =
{ first = form.response
, last = http.response
}
}
Conflict.compose Model
( opts |> ( ( name_, get_name ) |> Conflict.single [ form.name |> Validate.blank "blank" ] ) )compose models with 2 args
Conflict.compose2 Model
( opts |> ( ( name_, get_name ) |> Conflict.single [ form.name |> Validate.blank "blank" ] ) )
( opts |> ( ( age_, get_age ) |> Conflict.single [] ) )compose models with 3 args
compose models with 4 args
compose models with 5 args
compose models with 6 args
compose models with 7 args
compose models with 8 args
compose models with 9 args
compose models with 10 args
compose models with 11 args
compose models with 12 args
compose models with 13 args
compose models with 14 args
compose models with 15 args
compose models with 16 args
models and that has error, has modified