Skip to content

Releases: Wroud/react-painlessform

2.0.1

01 May 14:08
Compare
Choose a tag to compare

New Features

  • Deep composing Validation and Transform components
  • Validation component support getters in props () => this.state.some for correct rerendering
  • Validation now exclude recursive updates
  • Validation now correctly caches result
  • Form.onSubmit event now have third argument isValid that reflects the status of validation

Breaking Changes

  • transformer prop in Transform now accepts two arguments
    • values - { [fieldName]: { value, isChanged: boolean, isVisited: boolean } contains all changed fields include changes from another Transform, must return { [fieldName]: { value, isChanged: boolean, isVisited: boolean } map
    • model - current form model
  • Field context formState renamed to form
  • updateModel renamed to setModelValues

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

26 Apr 12:40
Compare
Choose a tag to compare
update builds

0.0.2

24 Apr 22:23
Compare
Choose a tag to compare
0.0.2-beta

update builds

0.0.1-alpha

20 Apr 17:25
Compare
Choose a tag to compare
0.0.1-alpha Pre-release
Pre-release
Field isVisited  sets false if received undefined || "" value