Skip to content

Releases: akuzko/react-form-base

v1.7.0

21 Mar 13:07
Compare
Choose a tag to compare

New Features

  • ifValid helper method now accepts failueCallback as second argument. If passed, it will be executed instead of
    props.onValidationFailed in case there were any validation errors

v1.6.0

20 Mar 23:10
Compare
Choose a tag to compare

New Features

  • When calling set method, additional meta object may be passed to it for both set(name, value, meta) and set(attributes, meta) variants. This object will be passed to onChange prop alongside with new updated attributes as second argument

v1.5.0

12 Nov 22:55
Compare
Choose a tag to compare

New Features

  • Added onValidationFailed property. It accepts a callback that is executed during validation routines in case there were validation errors. It is executed after errors are set.
  • Form's default validation now validates inputs within collections that have wildcard validation defined. I.e. if you have 'items.*.name': 'presence' validation defined, you no longer have to define validate method to manually
    iterate over collection items to validate them.
  • If Promise is defined, Form's set method will return a promise object that will be resolved after new attributes have been set.

v1.4.0

20 Jun 21:51
Compare
Choose a tag to compare

New Features

  • Form's validations property may now be a function. In this case it is called, and it's return result is used as object that describes validation rules.

  • When validating nested forms, validator object will now check for reference on form object itself first. It is assumed that due to string refs deprecation nested forms with refs like ref="nested" are changed to ref={ form => this.nested = form }

Other Updates

  • PropTypes usage has been migrated from React ones to prop-types package. 0070238 by @AleksandrZhukov

  • Code that was responsible for deep attributes object updates with persistent immutability was extracted into separate package, update-js. BTW, it was extracted a while ago, and since then it obtained a bunch of features you may find useful.

  • JSX syntax flaw example in README has been fixed. aa468f3 by @piton4eg

  • Small code style updates in demo app forms and other files.

v1.3.2

21 Mar 23:38
Compare
Choose a tag to compare

Pure Render Optimization

  • Added caching of input onChange handlers to prevent pure input components re-rendering when rest of properties was not changed.
    Caching works for simple cases, i.e. <TextField {...$('name')} /> as well as for more complicated cases, such as <TextField {...$('name')(this.changeName, i)} />. Thanks to @finom who pointed on this flaw.

v1.3.1

20 Mar 22:48
Compare
Choose a tag to compare

Performance Optimization and Support Improvements

  • Formerly, to guarantee data immutability, form used lodash's cloneDeep method to clone attrs and then update value under potentially deep location. This was very inefficient, since usually lots of not related to update operation values were cloned. In v1.3.1 code is refactored to shallow copy only those collections that contain deeply nested value.
  • Code was refactored to depend only on lodash.get and lodash.set packages to minimize package.
  • If React's PureComponent is not defined, Form extends Component class instead. This should allow to support older versions of React.
  • Minor README update

v1.3.0

09 Mar 23:09
Compare
Choose a tag to compare

New Features

  • Added support of inline forms. Now, to render small forms without writing dedicated Form class, you can do the following:
<Form {...bindState(this)} validations={{ email: ['presence', 'email'], fullName: 'presence' }}>
  {$ => (
    <div>
      <TextField {...$('email')} label="Email" />
      <TextField {...$('fullName')} label="FullName" />
      <button onClick={this.registerUser}>Register</button>
    </div>
  )}
</Form>

Minor Updates

  • Extracted most of README to project's Wiki to make former more light-weight and "user-friendly"

v1.2.0

26 Feb 09:02
Compare
Choose a tag to compare

New Features

  • Added Form#reset(attrs = {}) method that sets input values to ones specified with attrs (i.e. drops them by default) and clears errors.

Minor Updates

  • Added integration with travis-ci.
  • Updated README.

v1.1.0

22 Feb 21:34
Compare
Choose a tag to compare

New Features

  • Added bindState helper. This helper function will save you a couple of lines when rendering form in a form's container. It generates a { attrs, onChange } props object bounded to a state of the given component. Sample usage code:
render() {
  return <MyForm {...bindState(this)} onRequestSave={this.saveForm} />
}
  • Added validateOnSave prop. When enabled (which is default), form in its save method will run validation routines first, and execute onRequestSave callback only if there were no errors.
  • validateOnChange prop is now true by default, since it seems to be expected behavior by default.

Patch Updates

  • Reduced code organization complexity
  • Fixed minor flaws