FormManager
Class responsible for managing the data and state of a form.
The form manager stores, provides access, and allows manipulating the content of a form with a provided formSchema in a concurrent and controlled manner. It further manages state associated with the different fields of the form such as keeping track of validation issues, "dirty" and "touched" states, and others.
All form value/state accesses and manipulations should go through an instance of the form manager, to make sure that changes are tracked and no "dangerous" concurrent operations are performed. As such, storing non-copied form values outside the form manager is highly discouraged. Certain methods like valueInfo, get, and validate take lambdas as arguments to guarantee that data access only happens within a "controlled environment", i.e. during the lifetime of the lambda.
A coroutineContext may be provided to specify the context of coroutines launched by the form manager.
Constructors
Functions
Adds external issues to the form manager. Once added, each issue can be removed either manually via removeExternalIssues or automatically when the value referenced by the issue or one of the values referenced by the issue's dependencies change.
Runs the provided valueHandler with the single value at path. Returns the result of valueHandler.
Runs externalContextHandler with the external context named externalContextName currently available to validations.
Runs infoHandler with all information of values at paths matching path. Returns the result of infoHandler.
Initialises the form manager.
Returns whether all values at a path matching path are pristine (i.e. are not dirty).
Returns whether all values at paths matching path are untouched (i.e. are not touched).
Returns whether there exists at least one schema at a path matching path.
Removes the external context with name externalContextName available to validations and returns it if it existed.
Returns a sequence of information about the schemas at paths matching path.
Sets an external context with name externalContextName to be available to validations and returns the previous external context associated with the same name if one existed.
Sets all values at paths matching path as pristine (i.e. as not dirty), as well as their descendents.
Sets all values at paths matching path as touched, as well as their parents.
Sets all values at paths matching path as untouched (i.e. as not touched), as well as their descendents.
Sets the validation mode.
Subscribes to all events with paths matching path by running eventHandler for each event. Returns a function that should be called to unsubscribe from the subscription.
Validates all values at paths matching path and returns a list of all found validation issues.
Validates all values at paths matching path by running a function issuesHandler with the flow of all found validation issues. Returns the result of issuesHandler.
Runs the infoHandler lambda with the value-information of values at paths matching path. Returns the result of infoHandler.