Form Control Component
This component class manages the configuration of a formControl and some render centric functionalities. The former are important for clients of a formControl, the latter for extending or changing the default behaviors.
A formControl can be configured in different aspects:
a label for a description of the control as a whole
mark the control as required
an optional helper text
provide a validation message as a Flow<ComponentValidationMessage>]; the severity is reflected by the default theme!
provide a store to the control itself, with optional additional validation (dev.fritz2.components.validation.WithValidator) at best, in order to automatically apply model validation and get the results shown
Customizing the control:
To add a new control, extend this class and add a new control function that wraps the desired control component factory function like FormControlComponent.inputField, FormControlComponent.selectField, FormControlComponent.checkbox, FormControlComponent.checkboxGroup and FormControlComponent.radioGroup do.
In order to simply change the target of some of the default control wrapping function to a different control component, extend this class and override the desired function. Be aware that you cannot provide default arguments for an overridden function, so you must offer a new function with default arguments that just directs to the overridden one.
Be aware of the render strategy - pick whether your control should be rendered as a single control or a group.
SingleControlRenderer for a control that consists of a single element
ControlGroupRenderer for a control that consists of multiple parts (like checkBoxes etc.)
If those do not fit, just implement the ControlRenderer interface and pair it with the string based key of the related control wrapping function. Have a look at the initRenderStrategies and finalizeRenderStrategies field and ControlRegistration.assignee field to learn how the mapping between control and rendering strategy is done.