Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-form

Package Overview
Dependencies
Maintainers
1
Versions
236
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-form - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

45

dist/redux-form.js

@@ -417,11 +417,12 @@ (function webpackUniversalModuleDefinition(root, factory) {

ReduxForm.prototype.render = function render() {
var _this = this;
var _props = this.props;
// eslint-disable-line no-shadow
var form = _props.form;
var sliceName = _props.sliceName;
var dispatch = _props.dispatch;
var onSubmit = _props.onSubmit;
var passableProps = _objectWithoutProperties(_props, ['form', 'sliceName', 'dispatch', 'onSubmit']);
var passableProps = _objectWithoutProperties(_props, ['form', 'sliceName', 'dispatch']);
// eslint-disable-line no-shadow
var runAsyncValidation = asyncValidate ? function () {

@@ -466,19 +467,29 @@ dispatch(_actions.startAsyncValidation(sliceName));

};
var handleSubmit = function handleSubmit(event) {
if (event) {
event.preventDefault();
var handleSubmit = function handleSubmit(submitOrEvent) {
var createEventHandler = function createEventHandler(submit) {
return function (event) {
if (event) {
event.preventDefault();
}
dispatch(_actions.touchAll(sliceName));
if (runAsyncValidation) {
runAsyncValidation().then(function (asyncValid) {
if (valid && asyncValid) {
submit(form.data);
}
});
} else if (valid) {
submit(form.data);
}
};
};
if (typeof submitOrEvent === 'function') {
return createEventHandler(submitOrEvent);
}
var onSubmit = _this.props.onSubmit;
if (!onSubmit) {
throw new Error('If you are going to use handleSubmit(), you must specify an onSubmit prop');
throw new Error('You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop');
}
dispatch(_actions.touchAll(sliceName));
if (runAsyncValidation) {
runAsyncValidation().then(function (asyncValid) {
if (valid && asyncValid) {
onSubmit(form.data);
}
});
} else if (valid) {
onSubmit(form.data);
}
createEventHandler(onSubmit)(submitOrEvent /* is event */);
};

@@ -485,0 +496,0 @@ return _react2['default'].createElement(DecoratedComponent, _extends({

@@ -1,1 +0,1 @@

!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react")):"function"==typeof define&&define.amd?define(["react"],r):"object"==typeof exports?exports.ReduxForm=r(require("react")):t.ReduxForm=r(t.React)}(this,function(t){return function(t){function r(n){if(e[n])return e[n].exports;var a=e[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var e={};return r.m=t,r.c=e,r.p="",r(0)}([function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}r.__esModule=!0;var a=e(3),u=n(a),o=e(4),i=n(o),c=e(2);r.default=i.default,r.blur=c.blur,r.change=c.change,r.createFormReducer=u.default,r.initialize=c.initialize,r.reset=c.reset,r.startAsyncValidation=c.startAsyncValidation,r.stopAsyncValidation=c.stopAsyncValidation,r.touch=c.touch,r.touchAll=c.touchAll,r.untouch=c.untouch,r.untouchAll=c.untouchAll},function(t,r){"use strict";r.__esModule=!0;var e="redux-form/BLUR";r.BLUR=e;var n="redux-form/CHANGE";r.CHANGE=n;var a="redux-form/INITIALIZE";r.INITIALIZE=a;var u="redux-form/RESET";r.RESET=u;var o="redux-form/START_ASYNC_VALIDATION";r.START_ASYNC_VALIDATION=o;var i="redux-form/STOP_ASYNC_VALIDATION";r.STOP_ASYNC_VALIDATION=i;var c="redux-form/TOUCH";r.TOUCH=c;var s="redux-form/TOUCH_ALL";r.TOUCH_ALL=s;var l="redux-form/UNTOUCH";r.UNTOUCH=l;var f="redux-form/UNTOUCH_ALL";r.UNTOUCH_ALL=f},function(t,r,e){"use strict";function n(t,r,e){return{type:p.BLUR,form:t,field:r,value:e}}function a(t,r,e){return{type:p.CHANGE,form:t,field:r,value:e}}function u(t,r){return{type:p.INITIALIZE,form:t,data:r}}function o(t){return{type:p.RESET,form:t}}function i(t){return{type:p.START_ASYNC_VALIDATION,form:t}}function c(t,r){return{type:p.STOP_ASYNC_VALIDATION,form:t,errors:r}}function s(t){for(var r=arguments.length,e=Array(r>1?r-1:0),n=1;r>n;n++)e[n-1]=arguments[n];return{type:p.TOUCH,form:t,fields:e}}function l(t){return{type:p.TOUCH_ALL,form:t}}function f(t){for(var r=arguments.length,e=Array(r>1?r-1:0),n=1;r>n;n++)e[n-1]=arguments[n];return{type:p.UNTOUCH,form:t,fields:e}}function d(t){return{type:p.UNTOUCH_ALL,form:t}}r.__esModule=!0,r.blur=n,r.change=a,r.initialize=u,r.reset=o,r.startAsyncValidation=i,r.stopAsyncValidation=c,r.touch=s,r.touchAll=l,r.untouch=f,r.untouchAll=d;var p=e(1)},function(t,r,e){"use strict";function n(t,r){var e=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=e.touchOnBlur,o=void 0===n?!0:n,i=e.touchOnChange,c=void 0===i?!1:i;return function(){var e,n,i=arguments.length<=0||void 0===arguments[0]?{initial:{},data:{},touched:{},asyncValidating:!1,asyncErrors:{}}:arguments[0],s=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(s.form!==t)return i;switch(s.type){case u.BLUR:var l={data:a({},i.data,(e={},e[s.field]=s.value,e))};if(o){var f;l.touched=a({},i.touched,(f={},f[s.field]=!0,f))}return a({},i,l);case u.CHANGE:var d={data:a({},i.data,(n={},n[s.field]=s.value,n))};if(c){var p;d.touched=a({},i.touched,(p={},p[s.field]=!0,p))}return a({},i,d);case u.INITIALIZE:return{initial:s.data,data:s.data,asyncValidating:!1,asyncErrors:{},touched:{}};case u.RESET:return{initial:i.initial,data:i.initial,touched:{},asyncValidating:!1,asyncErrors:{}};case u.START_ASYNC_VALIDATION:return a({},i,{asyncValidating:!0});case u.STOP_ASYNC_VALIDATION:return a({},i,{asyncValidating:!1,asyncErrors:s.errors});case u.TOUCH:var m={};return s.fields.forEach(function(t){if("string"!=typeof t)throw new Error("fields passed to touch() must be strings");m[t]=!0}),a({},i,{touched:a({},i.touched,m)});case u.TOUCH_ALL:var h={};return r.forEach(function(t){return h[t]=!0}),a({},i,{touched:h});case u.UNTOUCH:var y={};return s.fields.forEach(function(t){if("string"!=typeof t)throw new Error("fields passed to untouch() must be strings");y[t]=!1}),a({},i,{touched:a({},i.touched,y)});case u.UNTOUCH_ALL:return a({},i,{touched:{}});default:return i}}}r.__esModule=!0;var a=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t};r.default=n;var u=e(1);t.exports=r.default},function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function a(t,r){var e={};for(var n in t)r.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function u(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function o(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(t,r):t.__proto__=r)}function i(t,r,e,n){function i(t){var e=r(t.data),n=l({valid:!0},t.asyncErrors),a=!(!e.valid||!n.valid);return l({},e,n,{valid:a})}return function(c){return function(h){function y(){u(this,y),h.apply(this,arguments)}return o(y,h),y.prototype.render=function(){var t=this.props,u=t.form,o=t.sliceName,s=t.dispatch,f=t.onSubmit,h=a(t,["form","sliceName","dispatch","onSubmit"]),y=e?function(){s(p.startAsyncValidation(o));var t=e(u.data);if(!t||"function"!=typeof t.then)throw new Error("asyncValidate function passed to reduxForm must return a promise!");return t.then(function(t){return s(p.stopAsyncValidation(o,t)),!!t.valid})}:void 0,v=function(t,e){return function(a){var i=e||a.target.value;if(s(p.blur(o,t,i)),y&&~n.indexOf(t)){var c,f=r(l({},u.data,(c={},c[t]=i,c)))[t];f||y()}}},A=m.isPristine(u.initial,u.data),g=i(u),T=g.valid,O=a(g,["valid"]),_=function(t,r){return function(e){return s(p.change(o,t,r||e.target.value))}},N=function(t){if(t&&t.preventDefault(),!f)throw new Error("If you are going to use handleSubmit(), you must specify an onSubmit prop");s(p.touchAll(o)),y?y().then(function(t){T&&t&&f(u.data)}):T&&f(u.data)};return d.default.createElement(c,l({asyncValidate:y,asyncValidating:u.asyncValidating,data:u.data,dirty:!A,dispatch:s,errors:O,handleBlur:v,handleChange:_,handleSubmit:N,initializeForm:function(t){return s(p.initialize(o,t))},invalid:!T,pristine:A,resetForm:function(){return s(p.reset(o))},touch:function(){for(var t=arguments.length,r=Array(t),e=0;t>e;e++)r[e]=arguments[e];return s(p.touch.apply(void 0,[o].concat(r)))},touched:u.touched,touchAll:function(){return s(p.touchAll(o))},untouch:function(){for(var t=arguments.length,r=Array(t),e=0;t>e;e++)r[e]=arguments[e];return s(p.untouch.apply(void 0,[o].concat(r)))},untouchAll:function(){return s(p.untouchAll(o))},valid:T},h))},s(y,null,[{key:"displayName",value:"ReduxForm("+m.getDisplayName(c)+")",enumerable:!0},{key:"DecoratedComponent",value:c,enumerable:!0},{key:"propTypes",value:{sliceName:f.PropTypes.string,form:f.PropTypes.object.isRequired,onSubmit:f.PropTypes.func,dispatch:f.PropTypes.func.isRequired},enumerable:!0},{key:"defaultProps",value:{sliceName:t},enumerable:!0}]),y}(f.Component)}}function c(t){var r=arguments.length<=1||void 0===arguments[1]?function(){return{valid:!0}}:arguments[1],e=i(t,r);return e.async=function(e){for(var n=arguments.length,a=Array(n>1?n-1:0),u=1;n>u;u++)a[u-1]=arguments[u];var o=Array.isArray(a[0])?a[0]:a;return i(t,r,e,o)},e}r.__esModule=!0;var s=function(){function t(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(r,e,n){return e&&t(r.prototype,e),n&&t(r,n),r}}(),l=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t};r.default=c;var f=e(6),d=n(f),p=e(2),m=e(5);t.exports=r.default},function(t,r){"use strict";function e(t){return t.displayName||t.name||"Component"}function n(t,r){if(t===r)return!0;for(var e=Object.keys(r),n=0;n<e.length;n++){var a=e[n],u=r[a],o=t[a];if((u||o)&&u!==o)return!1}return!0}r.__esModule=!0,r.getDisplayName=e,r.isPristine=n},function(r,e){r.exports=t}])});
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react")):"function"==typeof define&&define.amd?define(["react"],r):"object"==typeof exports?exports.ReduxForm=r(require("react")):t.ReduxForm=r(t.React)}(this,function(t){return function(t){function r(n){if(e[n])return e[n].exports;var a=e[n]={exports:{},id:n,loaded:!1};return t[n].call(a.exports,a,a.exports,r),a.loaded=!0,a.exports}var e={};return r.m=t,r.c=e,r.p="",r(0)}([function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}r.__esModule=!0;var a=e(3),u=n(a),o=e(4),i=n(o),c=e(2);r.default=i.default,r.blur=c.blur,r.change=c.change,r.createFormReducer=u.default,r.initialize=c.initialize,r.reset=c.reset,r.startAsyncValidation=c.startAsyncValidation,r.stopAsyncValidation=c.stopAsyncValidation,r.touch=c.touch,r.touchAll=c.touchAll,r.untouch=c.untouch,r.untouchAll=c.untouchAll},function(t,r){"use strict";r.__esModule=!0;var e="redux-form/BLUR";r.BLUR=e;var n="redux-form/CHANGE";r.CHANGE=n;var a="redux-form/INITIALIZE";r.INITIALIZE=a;var u="redux-form/RESET";r.RESET=u;var o="redux-form/START_ASYNC_VALIDATION";r.START_ASYNC_VALIDATION=o;var i="redux-form/STOP_ASYNC_VALIDATION";r.STOP_ASYNC_VALIDATION=i;var c="redux-form/TOUCH";r.TOUCH=c;var s="redux-form/TOUCH_ALL";r.TOUCH_ALL=s;var f="redux-form/UNTOUCH";r.UNTOUCH=f;var l="redux-form/UNTOUCH_ALL";r.UNTOUCH_ALL=l},function(t,r,e){"use strict";function n(t,r,e){return{type:p.BLUR,form:t,field:r,value:e}}function a(t,r,e){return{type:p.CHANGE,form:t,field:r,value:e}}function u(t,r){return{type:p.INITIALIZE,form:t,data:r}}function o(t){return{type:p.RESET,form:t}}function i(t){return{type:p.START_ASYNC_VALIDATION,form:t}}function c(t,r){return{type:p.STOP_ASYNC_VALIDATION,form:t,errors:r}}function s(t){for(var r=arguments.length,e=Array(r>1?r-1:0),n=1;r>n;n++)e[n-1]=arguments[n];return{type:p.TOUCH,form:t,fields:e}}function f(t){return{type:p.TOUCH_ALL,form:t}}function l(t){for(var r=arguments.length,e=Array(r>1?r-1:0),n=1;r>n;n++)e[n-1]=arguments[n];return{type:p.UNTOUCH,form:t,fields:e}}function d(t){return{type:p.UNTOUCH_ALL,form:t}}r.__esModule=!0,r.blur=n,r.change=a,r.initialize=u,r.reset=o,r.startAsyncValidation=i,r.stopAsyncValidation=c,r.touch=s,r.touchAll=f,r.untouch=l,r.untouchAll=d;var p=e(1)},function(t,r,e){"use strict";function n(t,r){var e=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=e.touchOnBlur,o=void 0===n?!0:n,i=e.touchOnChange,c=void 0===i?!1:i;return function(){var e,n,i=arguments.length<=0||void 0===arguments[0]?{initial:{},data:{},touched:{},asyncValidating:!1,asyncErrors:{}}:arguments[0],s=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(s.form!==t)return i;switch(s.type){case u.BLUR:var f={data:a({},i.data,(e={},e[s.field]=s.value,e))};if(o){var l;f.touched=a({},i.touched,(l={},l[s.field]=!0,l))}return a({},i,f);case u.CHANGE:var d={data:a({},i.data,(n={},n[s.field]=s.value,n))};if(c){var p;d.touched=a({},i.touched,(p={},p[s.field]=!0,p))}return a({},i,d);case u.INITIALIZE:return{initial:s.data,data:s.data,asyncValidating:!1,asyncErrors:{},touched:{}};case u.RESET:return{initial:i.initial,data:i.initial,touched:{},asyncValidating:!1,asyncErrors:{}};case u.START_ASYNC_VALIDATION:return a({},i,{asyncValidating:!0});case u.STOP_ASYNC_VALIDATION:return a({},i,{asyncValidating:!1,asyncErrors:s.errors});case u.TOUCH:var m={};return s.fields.forEach(function(t){if("string"!=typeof t)throw new Error("fields passed to touch() must be strings");m[t]=!0}),a({},i,{touched:a({},i.touched,m)});case u.TOUCH_ALL:var h={};return r.forEach(function(t){return h[t]=!0}),a({},i,{touched:h});case u.UNTOUCH:var v={};return s.fields.forEach(function(t){if("string"!=typeof t)throw new Error("fields passed to untouch() must be strings");v[t]=!1}),a({},i,{touched:a({},i.touched,v)});case u.UNTOUCH_ALL:return a({},i,{touched:{}});default:return i}}}r.__esModule=!0;var a=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t};r.default=n;var u=e(1);t.exports=r.default},function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function a(t,r){var e={};for(var n in t)r.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function u(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function o(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r&&(Object.setPrototypeOf?Object.setPrototypeOf(t,r):t.__proto__=r)}function i(t,r,e,n){function i(t){var e=r(t.data),n=f({valid:!0},t.asyncErrors),a=!(!e.valid||!n.valid);return f({},e,n,{valid:a})}return function(c){return function(h){function v(){u(this,v),h.apply(this,arguments)}return o(v,h),v.prototype.render=function(){var t=this,u=this.props,o=u.form,s=u.sliceName,l=u.dispatch,h=a(u,["form","sliceName","dispatch"]),v=e?function(){l(p.startAsyncValidation(s));var t=e(o.data);if(!t||"function"!=typeof t.then)throw new Error("asyncValidate function passed to reduxForm must return a promise!");return t.then(function(t){return l(p.stopAsyncValidation(s,t)),!!t.valid})}:void 0,y=function(t,e){return function(a){var u=e||a.target.value;if(l(p.blur(s,t,u)),v&&~n.indexOf(t)){var i,c=r(f({},o.data,(i={},i[t]=u,i)))[t];c||v()}}},A=m.isPristine(o.initial,o.data),g=i(o),T=g.valid,O=a(g,["valid"]),_=function(t,r){return function(e){return l(p.change(s,t,r||e.target.value))}},N=function(r){var e=function(t){return function(r){r&&r.preventDefault(),l(p.touchAll(s)),v?v().then(function(r){T&&r&&t(o.data)}):T&&t(o.data)}};if("function"==typeof r)return e(r);var n=t.props.onSubmit;if(!n)throw new Error("You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop");e(n)(r)};return d.default.createElement(c,f({asyncValidate:v,asyncValidating:o.asyncValidating,data:o.data,dirty:!A,dispatch:l,errors:O,handleBlur:y,handleChange:_,handleSubmit:N,initializeForm:function(t){return l(p.initialize(s,t))},invalid:!T,pristine:A,resetForm:function(){return l(p.reset(s))},touch:function(){for(var t=arguments.length,r=Array(t),e=0;t>e;e++)r[e]=arguments[e];return l(p.touch.apply(void 0,[s].concat(r)))},touched:o.touched,touchAll:function(){return l(p.touchAll(s))},untouch:function(){for(var t=arguments.length,r=Array(t),e=0;t>e;e++)r[e]=arguments[e];return l(p.untouch.apply(void 0,[s].concat(r)))},untouchAll:function(){return l(p.untouchAll(s))},valid:T},h))},s(v,null,[{key:"displayName",value:"ReduxForm("+m.getDisplayName(c)+")",enumerable:!0},{key:"DecoratedComponent",value:c,enumerable:!0},{key:"propTypes",value:{sliceName:l.PropTypes.string,form:l.PropTypes.object.isRequired,onSubmit:l.PropTypes.func,dispatch:l.PropTypes.func.isRequired},enumerable:!0},{key:"defaultProps",value:{sliceName:t},enumerable:!0}]),v}(l.Component)}}function c(t){var r=arguments.length<=1||void 0===arguments[1]?function(){return{valid:!0}}:arguments[1],e=i(t,r);return e.async=function(e){for(var n=arguments.length,a=Array(n>1?n-1:0),u=1;n>u;u++)a[u-1]=arguments[u];var o=Array.isArray(a[0])?a[0]:a;return i(t,r,e,o)},e}r.__esModule=!0;var s=function(){function t(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(r,e,n){return e&&t(r.prototype,e),n&&t(r,n),r}}(),f=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t};r.default=c;var l=e(6),d=n(l),p=e(2),m=e(5);t.exports=r.default},function(t,r){"use strict";function e(t){return t.displayName||t.name||"Component"}function n(t,r){if(t===r)return!0;for(var e=Object.keys(r),n=0;n<e.length;n++){var a=e[n],u=r[a],o=t[a];if((u||o)&&u!==o)return!1}return!0}r.__esModule=!0,r.getDisplayName=e,r.isPristine=n},function(r,e){r.exports=t}])});

@@ -48,11 +48,12 @@ 'use strict';

ReduxForm.prototype.render = function render() {
var _this = this;
var _props = this.props;
// eslint-disable-line no-shadow
var form = _props.form;
var sliceName = _props.sliceName;
var dispatch = _props.dispatch;
var onSubmit = _props.onSubmit;
var passableProps = _objectWithoutProperties(_props, ['form', 'sliceName', 'dispatch', 'onSubmit']);
var passableProps = _objectWithoutProperties(_props, ['form', 'sliceName', 'dispatch']);
// eslint-disable-line no-shadow
var runAsyncValidation = asyncValidate ? function () {

@@ -97,19 +98,29 @@ dispatch(_actions.startAsyncValidation(sliceName));

};
var handleSubmit = function handleSubmit(event) {
if (event) {
event.preventDefault();
var handleSubmit = function handleSubmit(submitOrEvent) {
var createEventHandler = function createEventHandler(submit) {
return function (event) {
if (event) {
event.preventDefault();
}
dispatch(_actions.touchAll(sliceName));
if (runAsyncValidation) {
runAsyncValidation().then(function (asyncValid) {
if (valid && asyncValid) {
submit(form.data);
}
});
} else if (valid) {
submit(form.data);
}
};
};
if (typeof submitOrEvent === 'function') {
return createEventHandler(submitOrEvent);
}
var onSubmit = _this.props.onSubmit;
if (!onSubmit) {
throw new Error('If you are going to use handleSubmit(), you must specify an onSubmit prop');
throw new Error('You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop');
}
dispatch(_actions.touchAll(sliceName));
if (runAsyncValidation) {
runAsyncValidation().then(function (asyncValid) {
if (valid && asyncValid) {
onSubmit(form.data);
}
});
} else if (valid) {
onSubmit(form.data);
}
createEventHandler(onSubmit)(submitOrEvent /* is event */);
};

@@ -116,0 +127,0 @@ return _react2['default'].createElement(DecoratedComponent, _extends({

{
"name": "redux-form",
"version": "0.2.0",
"version": "0.2.1",
"description": "A higher order component generator for forms using Redux and React",

@@ -32,9 +32,9 @@ "main": "./lib/index.js",

"devDependencies": {
"babel": "^5.8.19",
"babel-core": "^5.8.19",
"babel-eslint": "^4.0.5",
"babel-loader": "^5.3.2",
"eslint": "^0.24.1",
"eslint-config-airbnb": "0.0.6",
"eslint-plugin-react": "^3.1.0",
"babel": "5.8.21",
"babel-core": "^5.8.22",
"babel-eslint": "^4.0.10",
"babel-loader": "5.3.2",
"eslint": "^1.2.0",
"eslint-config-airbnb": "0.0.7",
"eslint-plugin-react": "^3.2.3",
"react": "^0.13.3",

@@ -41,0 +41,0 @@ "rifraf": "^2.0.2",

@@ -6,2 +6,3 @@ #redux-form

[![Build Status](https://img.shields.io/travis/erikras/redux-form/master.svg?style=flat-square)](https://travis-ci.org/erikras/redux-form)
[![devDependency Status](https://david-dm.org/erikras/redux-form/dev-status.svg)](https://david-dm.org/erikras/redux-form#info=devDependencies)
[![redux-form channel on slack](https://img.shields.io/badge/slack-redux--form%40reactiflux-blue.svg)](http://www.reactiflux.com)

@@ -69,2 +70,3 @@

handleChange: PropTypes.func.isRequired,
handleSubmit: PropTypes.func.isRequired,
initializeForm: PropTypes.func.isRequired,

@@ -182,3 +184,3 @@ invalid: PropTypes.bool.isRequired,

You can enable it with [Babel stage 2](http://babeljs.io/docs/usage/experimental/).
You can enable it with [Babel Stage 1](http://babeljs.io/docs/usage/experimental/).
Note that decorators are experimental, and this syntax might change or be removed later.

@@ -345,2 +347,5 @@

> Optionally, you may also pass your `onSubmit` function to `handleSubmit` which will take the place of the
`onSubmit` prop. For example: `<form onSubmit={handleSubmit(this.save.bind(this))}>`
##### -`initializeForm(data:Object) : Function`

@@ -411,3 +416,3 @@

<ContactForm onSubmit={::this.handleSubmit}/>
<ContactForm onSubmit={this.handleSubmit.bind(this)}/>
</div>

@@ -421,2 +426,30 @@ );

Or, if you wish to do your submission directly from your decorated form component, you may pass a function
to `handleSubmit`. To abbreviate the example [shown above](#how-it-works):
```javascript
class ContactForm extends Component {
static propTypes = {
// ...
handleSubmit: PropTypes.func.isRequired
}
saveForm(data) {
// make server call to save the data
}
render() {
const {
// ...
handleSubmit
} = this.props;
return (
<form onSubmit={handleSubmit(this.saveForm)}> // <--- pass saveForm
// ...
</form>
);
}
}
```
## Responding to other actions

@@ -423,0 +456,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc