2016-01-25 11:48:13 +08:00
|
|
|
import React from 'react';
|
2015-08-03 13:34:40 +08:00
|
|
|
import Validation from 'rc-form-validation';
|
2016-01-25 11:48:13 +08:00
|
|
|
import warning from 'warning';
|
2015-08-03 13:34:40 +08:00
|
|
|
|
2016-01-25 11:48:13 +08:00
|
|
|
export default class AntValidation extends React.Component {
|
|
|
|
validate(callback) {
|
|
|
|
this.refs.validation.validate(callback);
|
|
|
|
}
|
|
|
|
|
|
|
|
reset() {
|
|
|
|
this.refs.validation.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
forceValidate(fields, callback) {
|
|
|
|
this.refs.validation.forceValidate(fields, callback);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
warning(false, '`Validation` is deprecated, please use `Form` which has supported validation after antd@0.12.0.');
|
|
|
|
return <Validation {...this.props} ref="validation" />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
AntValidation.Validator = Validation.Validator;
|
|
|
|
AntValidation.FieldMixin = Validation.FieldMixin;
|