Releases: Wroud/react-painlessform
Releases · Wroud/react-painlessform
2.0.1
New Features
- Deep composing
Validation
andTransform
components Validation
component support getters in props() => this.state.some
for correct rerenderingValidation
now exclude recursive updatesValidation
now correctly caches resultForm
.onSubmit
event now have third argumentisValid
that reflects the status of validation
Breaking Changes
transformer
prop inTransform
now accepts two arguments- values -
{ [fieldName]: { value, isChanged: boolean, isVisited: boolean }
contains all changed fields include changes from anotherTransform
, must return{ [fieldName]: { value, isChanged: boolean, isVisited: boolean }
map - model - current form
model
- values -
Field
contextformState
renamed toform
updateModel
renamed tosetModelValues
About Validation
and Transform
composition
Now that components support composition and have some features.
Transform
<Transform {1}>
<Transform {2}>
<Transform {3}/>
</Transform {2}>
<Transform {4}>
</Transform {4}>
</Transform {1}>
Indexes 1-4 shows transformer
execute order. If {1}
and {3}
was changed field1
, to model will be appled changes from {3}
. In same time values
argument in {3}
transformer will be contains field1
change from {1}
transformer.
Validation
Now you can access validation data from deeper validators from one hight ordered.
<Validation {1}>
<Validation {2}>
<Validation {3}/>
</Validation {2}>
<Validation {4}>
</Validation {4}>
</Validation {1}>
Indexes 1-4 shows validation
execute order. Every validator (1-4) have same errors and isValid
value. It means that form have one united validation state (merged from 1-4 validators).
1.0.0
0.0.2
0.0.1-alpha
Field isVisited sets false if received undefined || "" value