canceraiddev/elm-form-builder/1.0.0

NOTE: the latest version is 28.0.1

Form.Field

Field type and helper functions

Field

type Field
= StringField_ StringField
| BoolField_ BoolField
| NumericField_ NumericField
= SimpleField SimpleFieldProperties
| SelectField SelectFieldProperties
| HttpSelectField HttpSelectFieldProperties
| RadioField RadioFieldProperties
= CheckboxField CheckboxFieldProperties
| RadioBoolField MaybeBoolFieldProperties
| RadioEnumField MaybeEnumFieldProperties
= NumericField NumericFieldProperties

Properties

StringFieldProperties { tipe : SimpleFieldType }
StringFieldProperties
{ default : Maybe String
, options : List Option
}
StringFieldProperties
{ url : String
, default : Maybe String
, options : RemoteData (Error String) (List Option)
}
type alias BoolFieldProperties a =
FieldProperties { a | value : Bool }
FieldProperties
, value : Bool
}
FieldProperties
{ value : Maybe Bool
, title : String
, default : Maybe String
, options : List Bool
}
FieldProperties
{ value : Maybe Value
, title : String
, default : Maybe Value
, options : List Value
}

Getters

getBoolProperties : Field -> Maybe Bool
getEnabledBy : Field -> Maybe String
getLabel : Field -> String
getNumericValue : Field -> Maybe Int
getOrder : Field -> Int
getProperties : Field -> FieldProperties {}
getStringValue : Field -> Maybe String
getTitle : Field -> String
getUrl : Field -> Maybe String

Setters

setRequired : Bool -> Field -> Field
updateRadioBoolValue : Maybe Bool -> Field -> Field
updateRemoteOptions : RemoteData (Error String) (List Option) -> Field -> Field
maybeUpdateStringValue : Maybe String -> Field -> Field

Keep existing field if the value is Nothing

Predicates

hasTitle : Field -> Bool
isCheckbox : Field -> Bool
isColumn : Field -> Bool
isRequired : Field -> Bool

Encode

encode : Field -> Value

Metadata

metadataKey : String -> Maybe String