redux-form
Version:
A higher order component decorator for forms using Redux and React
52 lines (46 loc) • 2.6 kB
JavaScript
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var any = _react.PropTypes.any;
var bool = _react.PropTypes.bool;
var func = _react.PropTypes.func;
var shape = _react.PropTypes.shape;
var propTypes = {
// State:
asyncValidating: bool.isRequired, // true if async validation is running
dirty: bool.isRequired, // true if any values are different from initialValues
error: any, // form-wide error from '_error' key in validation result
invalid: bool.isRequired, // true if there are any validation errors
initialized: bool.isRequired, // true if the form has been initialized
pristine: bool.isRequired, // true if the values are the same as initialValues
submitting: bool.isRequired, // true if the form is in the process of being submitted
submitFailed: bool.isRequired, // true if the form was submitted and failed for any reason
submitSucceeded: bool.isRequired, // true if the form was successfully submitted
valid: bool.isRequired, // true if there are no validation errors
// Actions:
array: shape({
insert: func.isRequired, // function to insert a value into an array field
move: func.isRequired, // function to move a value within an array field
pop: func.isRequired, // function to pop a value off of an array field
push: func.isRequired, // function to push a value onto an array field
remove: func.isRequired, // function to remove a value from an array field
removeAll: func.isRequired, // function to remove all the values from an array field
shift: func.isRequired, // function to shift a value out of an array field
splice: func.isRequired, // function to splice a value into an array field
swap: func.isRequired, // function to swap values in an array field
unshift: func.isRequired // function to unshift a value into an array field
}),
asyncValidate: func.isRequired, // function to trigger async validation
blur: func.isRequired, // action to mark a field as blurred
change: func.isRequired, // action to change the value of a field
destroy: func.isRequired, // action to destroy the form's data in Redux
dispatch: func.isRequired, // the Redux dispatch action
handleSubmit: func.isRequired, // function to submit the form
initialize: func.isRequired, // action to initialize form data
reset: func.isRequired, // action to reset the form data to previously initialized values
touch: func.isRequired, // action to mark fields as touched
untouch: func.isRequired // action to mark fields as untouched
};
exports.default = propTypes;