-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Labels
enhancementEnhances existing functionality.Enhances existing functionality.
Milestone
Description
What
Add support to pre-format the serialized value of a field.
Why
This feature can be used in multiple scenarios:
- Encrypt the entered password upon serialization (before sending/accessing the data).
- Format date input value to match the desired date format.
- General value normalization (casing, characters stripping)
How
- As a part of
createField
options (not preferable) - Would be nice to have it as
serialize
method on the instance of a custom component wrapped increateField
Specification
General statements
- Serialization formatting affects only the returned serialized value. It has no affect over the actual field's value, or field's state, in general.
- It is possible to provide a custom serialization formatter in two ways:
- Upon the field's composition.
- As a dedicated prop to the field's instance.
- When no custom formatter function is provided, a field's
value
is returned during the serialization (as it is now)
Syntax
type SerializeFunc<ValueType> = (value: ValueType) => ValueType
Metadata
Metadata
Assignees
Labels
enhancementEnhances existing functionality.Enhances existing functionality.