Releases: jurassix/react-validation-mixin
Release list
Babel upgrade to 6, now exposing lib using CommonJS
Ensure `getValidationMessages` always returns an array
This release fixes the inconsistency of the getValidationMessages between 4.x and 5.x. Now calls to this method always returns an array.
Ensure you update the joi-validation-strategy to v0.3.0 to pick up the dependent changes.
Nested Object validation now supported
With this release there was a major overhaul to the underlying validation framework to support nested object validation.
This release is dependent on joi-validation-strategy v0.2.1
Nested object validation support
validatorTypes: {
auth: {
firstName: Joi.string().required().label('First Name'),
},
}
...
render: function() {
return (
<section className='row'>
<h3>Signup</h3>
<form onSubmit={this.handleSubmit} className='form-horizontal'>
<fieldset>
<div className={this.getClasses('auth.firstName')}>
<label htmlFor='firstName'>First Name</label>
<input type='text'
id='firstName'
ref='firstName'
value={this.state.auth.firstName}
onChange={this.onChange('auth.firstName')}
onBlur={this.props.handleValidation('auth.firstName')}
className='form-control' placeholder='First Name' />
{this.renderHelpText(this.props.getValidationMessages('auth.firstName'))}
</div>
...Breaking Changes
A breaking change has been introduced with the this.props.getValidationMessages() api. It now no longer always returns an array, but instead depends on the datatype you are validating and the strategy implementation. Documentation is currently being updated to reflect these changes.
Async Validation
Validation is now expected to be async; if using the joi-validation-strategy make sure > v0.1.0 to account for this breaking change to strategies.
Major release breaking changes
Sample component and testing harness
This patch increases this libraries stability by adding Karma and example component tests.
Updates to readme
Updated README getValidatorData examples to match changes in 4.x
v4.0.1
4.0.0 (Major release with breaking API changes):
4.0.0 (Major release with breaking API changes):
validatorDatais nowgetValidatorDatato be more idiomatic of Reactvalidatenow takes an error-first callback, which allows for a simpler API when validating on Submit.validatealso takes an optional key as a first param that can be used to validate a single form field.isValidis now a simple wrapper aroundthis.state.errorssee example for handling form submission in 4.x.xclearValidationshas been added to reset all current errors.handleValidationsnow takes a second parameter error-first callback that can be used for custom handling of errors.