Formless.Types.Component
- Package
- purescript-halogen-formless
- Repository
- thomashoneyman/purescript-halogen-formless
#Spec Source
type Spec form st query act slots input msg m = { finalize :: Maybe act, handleAction :: act -> HalogenM form st act slots msg m Unit, handleEvent :: Event form st -> HalogenM form st act slots msg m Unit, handleQuery :: forall a. query a -> HalogenM form st act slots msg m (Maybe a), initialize :: Maybe act, receive :: input -> Maybe act, render :: PublicState form st -> ComponentHTML form act slots m }
A type representing the various functions that can be provided to extend
the Formless component. Usually only the render
function is required,
but you may also provide others. For example, if you have child components,
you can tell Formless how to manage those child components by adding a
handler action and handleAction
case.
#Action Source
type Action form act = Variant (userAction :: act | (InternalAction act) + (PublicAction form))
The component action type. While actions are typically considered
internal to a component, in Formless you write the render function and will
need to be able to use these directly. Many of these are shared with queries
of the same name so they can be used either as queries or as actions. See
Formless.Action
and Formless.Query
.
You can freely extend this type with your own actions using injAction
.
#PublicAction Source
type PublicAction form = (loadForm :: form Record InputField, modify :: form Variant InputFunction, modifyAll :: Tuple (form Record InputFunction) Boolean, modifyValidate :: Tuple (Maybe Milliseconds) (form Variant InputFunction), reset :: form Variant InputFunction, resetAll :: Unit, setAll :: Tuple (form Record InputField) Boolean, submit :: Unit, validate :: form Variant U, validateAll :: Unit)
#InternalAction Source
type InternalAction act r = (initialize :: Maybe act, syncFormData :: Unit | r)
#QueryF Source
data QueryF form slots a
The internals of the public component query type. Many of these are shared
with actions of the same name so they can be used in rendering. See
Formless.Action
and Formless.Query
for more.
Constructors
SubmitReply (Maybe (form Record OutputField) -> a)
SendQuery (ChildQueryBox slots (Maybe a))
AsQuery (Variant (PublicAction form)) a
Instances
#Component' Source
type Component' form input m = Component form (Const Void) () input Void m
A simple component type when the component does not need extension
#ComponentHTML Source
type ComponentHTML form act slots m = ComponentHTML (Action form act) slots m
The component's HTML type, the result of the render function.
#ComponentHTML' Source
type ComponentHTML' form m = ComponentHTML form Void () m
A simple component HTML type when the component does not need extension
#State Source
type State form st m = Record (StateRow form (internal :: InternalState form m | st))
The component local state
#PublicState Source
type PublicState form st = Record (StateRow form st)
The component's public state
#InternalState Source
newtype InternalState form m
A newtype to make easier type errors for end users to read by hiding internal fields
Constructors
InternalState { allTouched :: Boolean, debounceRef :: Maybe (Ref (Maybe Debouncer)), initialInputs :: form Record InputField, validationRef :: Maybe (Ref (Maybe ForkId)), validators :: form Record (Validation form m) }
Instances
Newtype (InternalState form m) _
#ValidStatus Source
#Input Source
type Input form st m = { initialInputs :: Maybe (form Record InputField), validators :: form Record (Validation form m) | st }
The component's input type. If you provide Nothing
as your initialInputs
then the form will fill in values based on the Initial
type class for the
field's input type. Otherwise, the form will contain the values you provide.
Validators can be created using the Formless.Validation module.
#Event Source
data Event form st
The component tries to require as few messages to be handled as possible. You can always use the *Reply variants of queries to perform actions and receive a result out the other end, or extend these messages.
Constructors
Submitted (form Record OutputField)
Changed (PublicState form st)
- Modules
- Formless
- Formless.
Action - Formless.
Class. Initial - Formless.
Component - Formless.
Data. FormFieldResult - Formless.
Internal. Component - Formless.
Internal. Debounce - Formless.
Internal. Transform - Formless.
Query - Formless.
Retrieve - Formless.
Transform. Record - Formless.
Transform. Row - Formless.
Types. Component - Formless.
Types. Form - Formless.
Validation