Releases: akuzko/react-form-base
v1.7.0
v1.6.0
v1.5.0
New Features
- Added
onValidationFailedproperty. 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 definevalidatemethod to manually
iterate over collection items to validate them. - If
Promiseis defined, Form'ssetmethod will return a promise object that will be resolved after new attributes have been set.
v1.4.0
New Features
-
Form's
validationsproperty 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 toref={ form => this.nested = form }
Other Updates
-
PropTypesusage has been migrated from React ones toprop-typespackage. 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
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
Performance Optimization and Support Improvements
- Formerly, to guarantee data immutability, form used lodash's
cloneDeepmethod to cloneattrsand then update value under potentially deep location. This was very inefficient, since usually lots of not related to update operation values were cloned. Inv1.3.1code is refactored to shallow copy only those collections that contain deeply nested value. - Code was refactored to depend only on
lodash.getandlodash.setpackages to minimize package. - If React's
PureComponentis not defined,FormextendsComponentclass instead. This should allow to support older versions of React. - Minor README update
v1.3.0
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
v1.1.0
New Features
- Added
bindStatehelper. 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
validateOnSaveprop. When enabled (which is default), form in itssavemethod will run validation routines first, and executeonRequestSavecallback only if there were no errors. validateOnChangeprop is nowtrueby default, since it seems to be expected behavior by default.
Patch Updates
- Reduced code organization complexity
- Fixed minor flaws