FormState
Reactive state of all form controls.
FormState holds and manages the states of all controls in the form, using the Compose State API so the UI recomposes automatically on changes.
Main functions:
Holding reactive control states (MutableState)
Triggering recomposition on changes
Managing hierarchical control names (e.g. for RepeatableControl)
Collecting data from all controls for processing
Control states are keyed by full path (e.g. "publicationsuuid.title"), which is what supports complex, nested structures.
Properties
Control states - a reactive map that triggers recomposition automatically
Form submission flag (triggerAction). True while an action (e.g. save, delete) is running.
Stage of loading the initial data (initData). Until it is FormLoadState.Loaded the controls have no states, so there is nothing to draw.
Functions
Collects and processes the data of all form controls.
Collects the results of the controls of one data level under their names. Containers collect their own levels, with this same function: a section once, a repeatable per row. Every control gets a context with its parent, because only that tells whether it is visible - and an invisible one passes no value to save.
Returns the states of all form controls
Returns the state of the control with the given name
Creates the control states of one data level - the form, a section or a repeatable row - from the values under their names. Containers set up their own levels in setInitValue, with this same function.
Initializes the states of all controls from the initial values.
Removes the state of the control with the given name Triggers recomposition automatically thanks to mutableStateMapOf
Removes all control states starting with the given prefix Triggers recomposition automatically thanks to mutableStateMapOf
Sets the state of the control with the given name (may be hierarchical) Triggers recomposition automatically thanks to mutableStateMapOf