redux-form
Advanced tools
Comparing version 2.4.5 to 3.0.0-beta-1
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReduxForm=e(require("react")):t.ReduxForm=e(t.React)}(this,function(t){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=r(12),u=n(o),i=r(28),a=r(13),s=n(a),c=s.default(!1,u.default,i.connect),f=c.actionTypes,l=c.blur,d=c.change,p=c.connectReduxForm,h=c.destroy,y=c.focus,v=c.reducer,m=c.reduxForm,g=c.initialize,b=c.initializeWithKey,_=c.reset,O=c.startAsyncValidation,S=c.startSubmit,T=c.stopAsyncValidation,x=c.stopSubmit,j=c.touch,A=c.untouch;e.actionTypes=f,e.blur=l,e.change=d,e.connectReduxForm=p,e.destroy=h,e.focus=y,e.reducer=v,e.reduxForm=m,e.initialize=g,e.initializeWithKey=b,e.reset=_,e.startAsyncValidation=O,e.startSubmit=S,e.stopAsyncValidation=T,e.stopSubmit=x,e.touch=j,e.untouch=A},function(t,e){"use strict";e.__esModule=!0;var r="redux-form/BLUR";e.BLUR=r;var n="redux-form/CHANGE";e.CHANGE=n;var o="redux-form/DESTROY";e.DESTROY=o;var u="redux-form/FOCUS";e.FOCUS=u;var i="redux-form/INITIALIZE";e.INITIALIZE=i;var a="redux-form/RESET";e.RESET=a;var s="redux-form/START_ASYNC_VALIDATION";e.START_ASYNC_VALIDATION=s;var c="redux-form/START_SUBMIT";e.START_SUBMIT=c;var f="redux-form/STOP_ASYNC_VALIDATION";e.STOP_ASYNC_VALIDATION=f;var l="redux-form/STOP_SUBMIT";e.STOP_SUBMIT=l;var d="redux-form/TOUCH";e.TOUCH=d;var p="redux-form/UNTOUCH";e.UNTOUCH=p},function(t,e){"use strict";function r(t,e){return Object.keys(t).reduce(function(r,o){var u;return n({},r,(u={},u[o]=e(t[o],o),u))},{})}e.__esModule=!0;var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t,e){return{type:y.BLUR,field:t,value:e}}function o(t,e){return{type:y.CHANGE,field:t,value:e}}function u(){return{type:y.DESTROY}}function i(t){return{type:y.FOCUS,field:t}}function a(t){return{type:y.INITIALIZE,data:t}}function s(){return{type:y.RESET}}function c(){return{type:y.START_ASYNC_VALIDATION}}function f(){return{type:y.START_SUBMIT}}function l(t){return{type:y.STOP_ASYNC_VALIDATION,errors:t}}function d(t){return{type:y.STOP_SUBMIT,errors:t}}function p(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return{type:y.TOUCH,fields:e}}function h(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return{type:y.UNTOUCH,fields:e}}e.__esModule=!0,e.blur=n,e.change=o,e.destroy=u,e.focus=i,e.initialize=a,e.reset=s,e.startAsyncValidation=c,e.startSubmit=f,e.stopAsyncValidation=l,e.stopSubmit=d,e.touch=p,e.untouch=h;var y=r(1)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return"function"==typeof t?function(){return u({},t.apply(void 0,arguments),e)}:"object"==typeof t?a.default(t,function(t){return o(t,e)}):t}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=o;var i=r(2),a=n(i);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function u(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){var e=["asyncValidate","handleBlur","handleChange","handleFocus","handleSubmit","onBlur","onChange","onFocus"];return!~e.indexOf(t)}function c(t){return function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;r>o;o++)n[o-1]=arguments[o];return e&&e.preventDefault?(e.preventDefault(),t.apply(void 0,n)):t.apply(void 0,[e].concat(n))}}function f(t){if(!t)return!1;var e=Object.keys(t),r=e.length;return 1>r?!1:e.reduce(function(e,r){return e&&O.default(t[r])},!0)}function l(t,e){function r(e,r){if(void 0!==e||!r)return"object"==typeof e&&e.value?e.value:e;if(!t&&void 0!==r.nativeEvent&&void 0!==r.nativeEvent.text)return r.nativeEvent.text;if(t&&void 0!==r.nativeEvent)return r.nativeEvent.text;if(void 0===r.target)return r;var n=r.target,o=n.type,u=n.value,i=n.checked,a=n.files,s=r.dataTransfer;return"checkbox"===o?i:"file"===o?a||s&&s.files:u}var n=e.Component,o=e.PropTypes;return function(t){var l=p({validate:function(){return{}},touchOnBlur:!0,touchOnChange:!1,readonly:!1,asyncValidate:null,asyncBlurFields:[]},t),h=l.form,v=l.fields,g=l.validate,_=l.readonly,S=l.touchOnBlur,j=l.touchOnChange,w=l.asyncValidate,P=l.asyncBlurFields;if(!v||!v.length)throw new Error('No fields passed to redux-form. Must be passed to connectReduxForm({fields: ["my", "field", "names"]})');var E=function(t){return _?Object.keys(t).reduce(function(e,r){var n;return s(r)?p({},e,(n={},n[r]=t[r],n)):e},{}):t};return function(t){return function(n){function s(t){var e=this;i(this,s),n.call(this,t),this.cache=A.default(this,{_actions:{params:["formName","formKey"],fn:function(t,e){return e?T.default(y,{form:t,key:e}):T.default(y,{form:t})}},_handleBlur:{params:["_actions","dispatch"],fn:function(t,n){return function(o,u){return function(i){var a=r(u,i),s=T.default(t.blur,{touch:S});if(n(s(o,a)),w&&~P.indexOf(o)){var c,f=e.getValues(),l=e.runSyncValidation(p({},f,(c={},c[o]=a,c)))[o];l||e.runAsyncValidation(t,f)}}}}},_handleFocus:{params:["_actions","dispatch"],fn:function(t,e){return function(r){return function(){return e(t.focus(r))}}}},_handleChange:{params:["_actions","dispatch"],fn:function(t,e){return function(n,o){var u=T.default(t.change,{touch:j});return o?e(u(n,r(o))):function(t){return e(u(n,r(o,t)))}}}},_fieldActions:{params:["_handleBlur","_handleChange","_handleFocus"],fn:function(t,e,r){return v.reduce(function(n,o){var u,i=t(o),a=e(o),s=r(o);return p({},n,(u={},u[o]=E({handleBlur:i,handleChange:a,handleFocus:s,name:o,onBlur:i,onChange:a,onDrop:function(t){a(t.dataTransfer.getData("value"))},onFocus:s,onUpdate:a}),u))},{})}}})}return a(s,n),d(s,null,[{key:"displayName",value:"ReduxForm("+m.default(t)+")",enumerable:!0},{key:"DecoratedComponent",value:t,enumerable:!0},{key:"propTypes",value:{formName:o.string,formKey:o.string,form:o.object,onSubmit:o.func,dispatch:o.func.isRequired,initialValues:o.object},enumerable:!0},{key:"defaultProps",value:{formName:h},enumerable:!0}]),s.prototype.componentWillMount=function(){var t=this.props,e=t.initialValues,r=t.dispatch;if(e){var n=this.cache._actions.initialize;r(n(e))}},s.prototype.runSyncValidation=function(t){return g(t,this.props)},s.prototype.runAsyncValidation=function(t,e){var r=this.props,n=r.dispatch,o=r.formKey;n(t.startAsyncValidation(o));var u=w(e,n);if(!u||"function"!=typeof u.then)throw new Error("asyncValidate function passed to reduxForm must return a promise!");var i=function(e){return n(t.stopAsyncValidation(e)),f(e)};return u.then(i,i)},s.prototype.getSubForm=function(){var t=this.props,e=t.formName,r=t.form,n=t.formKey;if(r&&r[e]){if(!n)return r[e];if(r[e][n])return r[e][n]}return x.initialState},s.prototype.getValues=function(){var t=this.getSubForm();return v.reduce(function(e,r){var n;return p({},e,(n={},n[r]=t[r]?t[r].value:void 0,n))},{})},s.prototype.componentWillReceiveProps=function(t){this.cache.componentWillReceiveProps(t)},s.prototype.render=function(){var r=this,n=this.props,o=n.formName,i=(n.form,n.formKey),a=n.dispatch,s=u(n,["formName","form","formKey","dispatch"]);if(!o)throw new Error('No form name given to redux-form. Must be passed to connectReduxForm({form: [form name]}) or as a "formName" prop');var l=this.cache,d=l._actions,h=l._fieldActions,y=l._handleBlur,m=l._handleChange,g=l._handleFocus,_=this.getSubForm(),S=!0,T=!0,x=function(t){var e=function(t){return function(e){e&&e.preventDefault&&(e.preventDefault(),e.stopPropagation());var n=r.getValues(),o=r.runSyncValidation(n);if(!f(o)){var u=function(){var e=function(){var e=t(n);return e&&"function"==typeof e.then?(a(d.startSubmit()),e.then(function(t){return a(d.stopSubmit()),t},function(t){return a(d.stopSubmit(t)),t})):void 0};return a(d.touch.apply(d,v)),S?w?{v:r.runAsyncValidation(d,n).then(function(t){return S&&t?e(n):void 0})}:{v:e(n)}:void 0}();if("object"==typeof u)return u.v}}};if("function"==typeof t)return e(t);var n=r.props.onSubmit;if(!n)throw new Error("You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop");e(n)(t)},j=this.getValues(),A=this.runSyncValidation(j),P=v.reduce(function(t,e){var r,n=_[e]||{},o=b.default(n.value,n.initial),u=A[e]||n.asyncError||n.submitError,i=O.default(u),a=s.initialValues&&s.initialValues[e];return i||(S=!1),o||(T=!1),p({},t,(r={},r[e]=E(p({active:_._active===e,checked:"boolean"==typeof n.value?n.value:void 0,defaultChecked:a,defaultValue:a,dirty:!o,error:u},h[e],{invalid:!i,name:e,onDrag:function(t){return t.dataTransfer.setData("value",n.value)},pristine:o,touched:n.touched,valid:i,value:n.value,visited:n.visited})),r))},{}),I=A._error||_._error;return I&&(S=!1),e.createElement(t,p({active:_._active,asyncValidating:_._asyncValidating,dirty:!T,error:I,fields:P,formKey:i,invalid:!S,pristine:T,submitting:_._submitting,valid:S,values:j,asyncValidate:c(function(){return r.runAsyncValidation(d,j)}),destroyForm:c(function(){return a(d.destroy())}),handleBlur:c(y),handleChange:c(m),handleFocus:g,handleSubmit:c(x),initializeForm:c(function(t){return a(d.initialize(t))}),resetForm:c(function(){return a(d.reset())}),touch:c(function(){return a(d.touch.apply(d,arguments))}),touchAll:c(function(){return a(d.touch.apply(d,v))}),untouch:c(function(){return a(d.untouch.apply(d,arguments))}),untouchAll:c(function(){return a(d.untouch.apply(d,v))}),dispatch:a},s))},s}(n)}}}e.__esModule=!0;var d=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=l;var h=r(3),y=o(h),v=r(15),m=n(v),g=r(16),b=n(g),_=r(17),O=n(_),S=r(4),T=n(S),x=r(6),j=r(23),A=n(j);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function u(){var t,e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=r.form,u=r.key,i=o(r,["form","key"]);if(!n)return e;if(u){var c,f;if(r.type===s.DESTROY){var l;return a({},e,(l={},l[n]=Object.keys(e[n]).reduce(function(t,r){var o;return r===u?t:a({},t,(o={},o[r]=e[n][r],o))},{}),l))}return a({},e,(f={},f[n]=a({},e[n],(c={},c[u]=p((e[n]||{})[u],i),c)),f))}return r.type===s.DESTROY?Object.keys(e).reduce(function(t,r){var o;return r===n?t:a({},t,(o={},o[r]=e[r],o))},{}):a({},e,(t={},t[n]=p(e[n],i),t))}function i(t){return t.plugin=function(t){var e=this;return i(function(){var r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e(r,n);return a({},o,f.default(t,function(t,e){return t(o[e]||l,n)}))})},t.normalize=function(t){var e=this;return i(function(){var r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e(r,n);return a({},o,f.default(t,function(t,e){var n=a({},l,o[e]);return a({},n,f.default(t,function(t,o){return a({},n[o],{value:t(n[o]?n[o].value:void 0,r[e]&&r[e][o]?r[e][o].value:void 0,d(n))})}))}))})},t}e.__esModule=!0;var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=r(1),c=r(2),f=n(c),l={_active:void 0,_asyncValidating:!1,_error:void 0,_submitting:!1};e.initialState=l;var d=function(t){return Object.keys(t).reduce(function(e,r){var n;return"_"===r[0]?e:a({},e,(n={},n[r]=t[r].value,n))},{})},p=function(){var t,e,r,n=arguments.length<=0||void 0===arguments[0]?l:arguments[0],o=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];switch(o.type){case s.BLUR:return a({},n,(t={},t[o.field]=a({},n[o.field],{value:void 0===o.value?(n[o.field]||{}).value:o.value,touched:!(!o.touch&&!(n[o.field]||{}).touched)}),t._active=void 0,t));case s.CHANGE:return a({},n,(e={},e[o.field]=a({},n[o.field],{value:o.value,touched:!(!o.touch&&!(n[o.field]||{}).touched),asyncError:null,submitError:null}),e._error=void 0,e));case s.DESTROY:return void 0;case s.FOCUS:return a({},n,(r={},r[o.field]=a({},n[o.field],{visited:!0}),r._active=o.field,r));case s.INITIALIZE:return a({},f.default(o.data,function(t){return{initial:t,value:t}}),{_asyncValidating:!1,_active:void 0,_error:void 0,_submitting:!1});case s.RESET:return a({},f.default(n,function(t,e){return"_"===e[0]?t:{initial:t.initial,value:t.initial}}),{_active:void 0,_asyncValidating:!1,_error:void 0,_submitting:!1});case s.START_ASYNC_VALIDATION:return a({},n,{_asyncValidating:!0});case s.START_SUBMIT:return a({},n,{_submitting:!0});case s.STOP_ASYNC_VALIDATION:return a({},n,f.default(o.errors,function(t,e){return a({},n[e],{asyncError:t})}),{_asyncValidating:!1,_error:o.errors._error});case s.STOP_SUBMIT:return a({},n,o.errors?f.default(o.errors,function(t,e){return a({},n[e],{submitError:t})}):{},{_error:o.errors&&o.errors._error,_submitting:!1});case s.TOUCH:return a({},n,o.fields.reduce(function(t,e){var r;return a({},t,(r={},r[e]=a({},n[e],{touched:!0}),r))},{}));case s.UNTOUCH:return a({},n,o.fields.reduce(function(t,e){var r;return a({},t,(r={},r[e]=a({},n[e],{touched:!1}),r))},{}));default:return n}};e.default=i(u)},function(t,e){"use strict";function r(t){return t.shape({subscribe:t.func.isRequired,dispatch:t.func.isRequired,getState:t.func.isRequired})}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){function r(){return c}function n(t){return f.push(t),function(){var e=f.indexOf(t);f.splice(e,1)}}function o(t){if(!i.default(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,c=s(c,t)}finally{l=!1}return f.slice().forEach(function(t){return t()}),t}function u(t){s=t,o({type:a.INIT})}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var s=t,c=e,f=[],l=!1;return o({type:a.INIT}),{dispatch:o,subscribe:n,getState:r,replaceReducer:u}}e.__esModule=!0,e.default=o;var u=r(10),i=n(u),a={INIT:"@@redux/INIT"};e.ActionTypes=a},function(t,e){"use strict";function r(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return function(t){return e.reduceRight(function(t,e){return e(t)},t)}}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e){"use strict";function r(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&n(r)===n(Object)}e.__esModule=!0,e.default=r;var n=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function r(t,e){return Object.keys(t).reduce(function(r,n){return r[n]=e(t[n],n),r},{})}e.__esModule=!0,e.default=r,t.exports=e.default},function(e,r){e.exports=t},function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}function u(t,e,r){return{actionTypes:_,blur:S,change:T,connectReduxForm:d.default(t,e,r),destroy:x,focus:j,reducer:s.default,initialize:A,initializeWithKey:w,reduxForm:f.default(t,e),reset:P,startAsyncValidation:E,startSubmit:I,stopAsyncValidation:M,stopSubmit:C,touch:N,untouch:R}}e.__esModule=!0;var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=u;var a=r(6),s=o(a),c=r(5),f=o(c),l=r(14),d=o(l),p=r(2),h=o(p),y=r(4),v=o(y),m=r(3),g=n(m),b=r(1),_=n(b),O=i({},h.default(i({},g,{initializeWithKey:function(t,e){return v.default(g.initialize,{key:t})(e)},destroy:function(t){return v.default(g.destroy,{key:t})()}}),function(t){return function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;r>o;o++)n[o-1]=arguments[o];return v.default(t,{form:e}).apply(void 0,n)}})),S=O.blur,T=O.change,x=O.destroy,j=O.focus,A=O.initialize,w=O.initializeWithKey,P=O.reset,E=O.startAsyncValidation,I=O.startSubmit,M=O.stopAsyncValidation,C=O.stopSubmit,N=O.touch,R=O.untouch;t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return function(t){return e.reduce(function(t,e){return e(t)},t)}}function u(t,e,r){var n=a.default(t,e),u=r(function(t){return{form:t.form}});return function(){return o(n.apply(void 0,arguments),u)}}e.__esModule=!0,e.default=u;var i=r(5),a=n(i);t.exports=e.default},function(t,e){"use strict";function r(t){return t.displayName||t.name||"Component"}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e){"use strict";function r(t,e){if(t===e)return!0;if(t&&"object"==typeof t){if(!e||"object"!=typeof e)return!1;var n=Object.keys(t),o=Object.keys(e);if(n.length!==o.length)return!1;for(var u=0;u<o.length;u++){var i=o[u];if(!r(t[i],e[i]))return!1}}else if(t||e)return t===e;return!0}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e){"use strict";function r(t){return Array.isArray(t)?t.reduce(function(t,e){return t&&r(e)},!0):!t}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){function n(t){return null===t||void 0===t}function o(t){return t&&"object"==typeof t&&"number"==typeof t.length?"function"!=typeof t.copy||"function"!=typeof t.slice?!1:t.length>0&&"number"!=typeof t[0]?!1:!0:!1}function u(t,e,r){var u,f;if(n(t)||n(e))return!1;if(t.prototype!==e.prototype)return!1;if(s(t))return s(e)?(t=i.call(t),e=i.call(e),c(t,e,r)):!1;if(o(t)){if(!o(e))return!1;if(t.length!==e.length)return!1;for(u=0;u<t.length;u++)if(t[u]!==e[u])return!1;return!0}try{var l=a(t),d=a(e)}catch(p){return!1}if(l.length!=d.length)return!1;for(l.sort(),d.sort(),u=l.length-1;u>=0;u--)if(l[u]!=d[u])return!1;for(u=l.length-1;u>=0;u--)if(f=l[u],!c(t[f],e[f],r))return!1;return typeof t==typeof e}var i=Array.prototype.slice,a=r(20),s=r(19),c=t.exports=function(t,e,r){return r||(r={}),t===e?!0:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?r.strict?t===e:t==e:u(t,e,r)}},function(t,e){function r(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function n(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var o="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=o?r:n,e.supported=r,e.unsupported=n},function(t,e){function r(t){var e=[];for(var r in t)e.push(r);return e}e=t.exports="function"==typeof Object.keys?Object.keys:r,e.shim=r},function(t,e){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0};t.exports=function(t,e){for(var o=Object.getOwnPropertyNames(e),u=0;u<o.length;++u)r[o[u]]||n[o[u]]||(t[o[u]]=e[o[u]]);return t}},function(t,e,r){"use strict";var n=function(t,e,r,n,o,u,i,a){if(!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,u,i,a],f=0;s=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return c[f++]}))}throw s.framesToPop=1,s}};t.exports=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=r(24),u=n(o);e.default=u.default,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){var r=[],n={},o={},u=function a(t){Object.keys(n).forEach(function(e){~n[e].props.indexOf(t)&&(delete n[e].value,a(e))})};return Object.keys(e).forEach(function(u){var i=e[u].fn,a=e[u].params;a.forEach(function(t){~r.indexOf(t)||r.push(t)}),n[u]={props:a},Object.defineProperty(o,u,{get:function(){var e=n[u];if(e&&void 0!==e.value)return e.value;var r=a.map(function(e){return t.props[e]||o[e]}),s=i.apply(void 0,r);return n[u]={props:a,value:s},s}})}),o.componentWillReceiveProps=function(e){var n=[];r.forEach(function(r){i.default(t.props[r],e[r])||n.push(r)}),n.forEach(u)},o}e.__esModule=!0,e.default=o;var u=r(18),i=n(u);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=i.default(t),r=s.default(t);return{Provider:e,connect:r}}e.__esModule=!0,e.default=o;var u=r(27),i=n(u),a=r(26),s=n(a);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){return t.displayName||t.name||"Component"}function a(t){var e=t.Component,r=t.PropTypes,n=f.default(r);return function(r,a,c){function f(t,e){var r=t.getState(),n=w?b(r,e):b(r);return _.default(h.default(n),"`mapStateToProps` must return an object. Instead received %s.",n),n}function l(t,e){var r=t.dispatch,n=P?j(r,e):j(r);return _.default(h.default(n),"`mapDispatchToProps` must return an object. Instead received %s.",n),n}function p(t,e,r){var n=A(t,e,r);return _.default(h.default(n),"`mergeProps` must return an object. Instead received %s.",n),n}var y=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],m=Boolean(r),b=r||O,j=h.default(a)?v.default(a):a||S,A=c||T,w=b.length>1,P=j.length>1,E=y.pure,I=void 0===E?!0:E,M=x++;return function(r){var a=function(e){function n(t,r){o(this,n),e.call(this,t,r),this.version=M,this.store=t.store||r.store,_.default(this.store,'Could not find "store" in either the context or '+('props of "'+this.constructor.displayName+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+this.constructor.displayName+'".')),this.stateProps=f(this.store,t),this.dispatchProps=l(this.store,t),this.state={storeState:null},this.updateState()}return u(n,e),n.prototype.shouldComponentUpdate=function(t,e){if(!I)return this.updateStateProps(t),this.updateDispatchProps(t),this.updateState(t),!0;var r=e.storeState!==this.state.storeState,n=!d.default(t,this.props),o=!1,u=!1;return(r||n&&w)&&(o=this.updateStateProps(t)),n&&P&&(u=this.updateDispatchProps(t)),n||o||u?(this.updateState(t),!0):!1},n.prototype.computeNextState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];return p(this.stateProps,this.dispatchProps,t)},n.prototype.updateStateProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=f(this.store,t);return d.default(e,this.stateProps)?!1:(this.stateProps=e,!0)},n.prototype.updateDispatchProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=l(this.store,t);return d.default(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},n.prototype.updateState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];this.nextState=this.computeNextState(t)},n.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},n.prototype.trySubscribe=function(){m&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},n.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},n.prototype.componentDidMount=function(){this.trySubscribe()},n.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},n.prototype.handleChange=function(){this.unsubscribe&&this.setState({storeState:this.store.getState()})},n.prototype.getWrappedInstance=function(){return this.refs.wrappedInstance},n.prototype.render=function(){return t.createElement(r,s({ref:"wrappedInstance"},this.nextState))},n}(e);return a.displayName="Connect("+i(r)+")",a.WrappedComponent=r,a.contextTypes={store:n},a.propTypes={store:n},g.default(a,r)}}}e.__esModule=!0;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=a;var c=r(7),f=n(c),l=r(30),d=n(l),p=r(29),h=n(p),y=r(31),v=n(y),m=r(21),g=n(m),b=r(22),_=n(b),O=function(){return{}},S=function(t){return{dispatch:t}},T=function(t,e,r){return s({},r,t,e)},x=0;t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){var e=t.version;if("string"!=typeof e)return!0;var r=e.split("."),n=parseInt(r[0],10),o=parseInt(r[1],10);return 0===n&&13===o}function a(t){function e(){p||d||(p=!0,console.error("With React 0.14 and later versions, you no longer need to wrap <Provider> child into a function."))}function r(){!p&&d&&(p=!0,console.error("With React 0.13, you need to wrap <Provider> child into a function. This restriction will be removed with React 0.14."))}function n(){h||(h=!0,console.error("<Provider> does not support changing `store` on the fly. It is most likely that you see this error because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers automatically. See https://github.com/rackt/react-redux/releases/tag/v2.0.0 for the migration instructions."))}var a=t.Component,s=t.PropTypes,f=t.Children,l=c.default(s),d=i(t),p=!1,h=!1,y=function(t){function i(e,r){o(this,i),t.call(this,e,r),this.store=e.store}return u(i,t),i.prototype.getChildContext=function(){return{store:this.store}},i.prototype.componentWillReceiveProps=function(t){var e=this.store,r=t.store;e!==r&&n()},i.prototype.render=function(){var t=this.props.children;return"function"==typeof t?(e(),t=t()):r(),f.only(t)},i}(a);return y.childContextTypes={store:l.isRequired},y.propTypes={store:l.isRequired,children:(d?s.func:s.element).isRequired},y}e.__esModule=!0,e.default=a;var s=r(7),c=n(s);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=r(12),u=n(o),i=r(25),a=n(i),s=a.default(u.default),c=s.Provider,f=s.connect;e.Provider=c,e.connect=f},function(t,e){"use strict";function r(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&n(r)===n(Object)}e.__esModule=!0,e.default=r;var n=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var o=Object.prototype.hasOwnProperty,u=0;u<r.length;u++)if(!o.call(e,r[u])||t[r[u]]!==e[r[u]])return!1;return!0}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return function(e){return o.bindActionCreators(t,e)}}e.__esModule=!0,e.default=n;var o=r(32);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=r(8),u=n(o),i=r(35),a=n(i),s=r(34),c=n(s),f=r(33),l=n(f),d=r(9),p=n(d);e.createStore=u.default,e.combineReducers=a.default,e.bindActionCreators=c.default,e.applyMiddleware=l.default,e.compose=p.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return function(t){return function(r,n){var o=t(r,n),i=o.dispatch,s=[],c={getState:o.getState,dispatch:function(t){return i(t)}};return s=e.map(function(t){return t(c)}),i=a.default.apply(void 0,s)(o.dispatch),u({},o,{dispatch:i})}}}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=o;var i=r(9),a=n(i);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return function(){return e(t.apply(void 0,arguments))}}function u(t,e){if("function"==typeof t)return o(t,e);if("object"!=typeof t||null===t||void 0===t)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===t?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');return a.default(t,function(t){return o(t,e)})}e.__esModule=!0,e.default=u;var i=r(11),a=n(i);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){var r=e&&e.type,n=r&&'"'+r.toString()+'"'||"an action";return'Reducer "'+t+'" returned undefined handling '+n+". To ignore an action, you must explicitly return the previous state."}function u(t){Object.keys(t).forEach(function(e){var r=t[e],n=r(void 0,{type:a.ActionTypes.INIT});if("undefined"==typeof n)throw new Error('Reducer "'+e+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');var o="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof r(void 0,{type:o}))throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+a.ActionTypes.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined."); | ||
})}function i(t){var e,r=d.default(t,function(t){return"function"==typeof t});try{u(r)}catch(n){e=n}var i=f.default(r,function(){return void 0});return function(t,n){if(void 0===t&&(t=i),e)throw e;var u=f.default(r,function(e,r){var u=e(t[r],n);if("undefined"==typeof u){var i=o(r,n);throw new Error(i)}return u});return u}}e.__esModule=!0,e.default=i;var a=r(8),s=r(10),c=(n(s),r(11)),f=n(c),l=r(36),d=n(l);t.exports=e.default},function(t,e){"use strict";function r(t,e){return Object.keys(t).reduce(function(r,n){return e(t[n])&&(r[n]=t[n]),r},{})}e.__esModule=!0,e.default=r,t.exports=e.default}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReduxForm=e(require("react")):t.ReduxForm=e(t.React)}(this,function(t){return function(t){function e(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return t[n].call(u.exports,u,u.exports,e),u.loaded=!0,u.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(22),o=n(u),i=r(24),a=n(i),s=a.default(!1,o.default),c=s.actionTypes,f=s.blur,l=s.change,d=s.destroy,p=s.focus,v=s.reducer,y=s.reduxForm,h=s.initialize,m=s.initializeWithKey,b=s.reset,g=s.startAsyncValidation,_=s.startSubmit,O=s.stopAsyncValidation,x=s.stopSubmit,S=s.touch,T=s.untouch;e.actionTypes=c,e.blur=f,e.change=l,e.destroy=d,e.focus=p,e.reducer=v,e.reduxForm=y,e.initialize=h,e.initializeWithKey=m,e.reset=b,e.startAsyncValidation=g,e.startSubmit=_,e.stopAsyncValidation=O,e.stopSubmit=x,e.touch=S,e.untouch=T},function(t,e){"use strict";function r(t){return Array.isArray(t)?t.reduce(function(t,e){return t&&r(e)},!0):t&&"object"==typeof t?Object.keys(t).reduce(function(e,n){return e&&r(t[n])},!0):!t}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r="redux-form/BLUR";e.BLUR=r;var n="redux-form/CHANGE";e.CHANGE=n;var u="redux-form/DESTROY";e.DESTROY=u;var o="redux-form/FOCUS";e.FOCUS=o;var i="redux-form/INITIALIZE";e.INITIALIZE=i;var a="redux-form/RESET";e.RESET=a;var s="redux-form/START_ASYNC_VALIDATION";e.START_ASYNC_VALIDATION=s;var c="redux-form/START_SUBMIT";e.START_SUBMIT=c;var f="redux-form/STOP_ASYNC_VALIDATION";e.STOP_ASYNC_VALIDATION=f;var l="redux-form/STOP_SUBMIT";e.STOP_SUBMIT=l;var d="redux-form/TOUCH";e.TOUCH=d;var p="redux-form/UNTOUCH";e.UNTOUCH=p},function(t,e){"use strict";function r(t,e){return t?Object.keys(t).reduce(function(r,u){var o;return n({},r,(o={},o[u]=e(t[u],u),o))},{}):t}e.__esModule=!0;var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=r,t.exports=e.default},function(t,e){function r(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}t.exports=r},function(t,e,r){"use strict";function n(t,e){return{type:y.BLUR,field:t,value:e}}function u(t,e){return{type:y.CHANGE,field:t,value:e}}function o(){return{type:y.DESTROY}}function i(t){return{type:y.FOCUS,field:t}}function a(t){return{type:y.INITIALIZE,data:t}}function s(){return{type:y.RESET}}function c(){return{type:y.START_ASYNC_VALIDATION}}function f(){return{type:y.START_SUBMIT}}function l(t){return{type:y.STOP_ASYNC_VALIDATION,errors:t}}function d(t){return{type:y.STOP_SUBMIT,errors:t}}function p(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return{type:y.TOUCH,fields:e}}function v(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return{type:y.UNTOUCH,fields:e}}e.__esModule=!0,e.blur=n,e.change=u,e.destroy=o,e.focus=i,e.initialize=a,e.reset=s,e.startAsyncValidation=c,e.startSubmit=f,e.stopAsyncValidation=l,e.stopSubmit=d,e.touch=p,e.untouch=v;var y=r(2)},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){return"function"==typeof t?function(){return o({},t.apply(void 0,arguments),e)}:"object"==typeof t?a.default(t,function(t){return u(t,e)}):t}e.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=u;var i=r(3),a=n(i);t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r="value";e.dataKey=r;var n=function(t,e){return function(t){t.dataTransfer.setData(r,e())}};e.default=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(9),o=n(u),i=function(t,e){if(o.default(t)){if(!e&&void 0!==t.nativeEvent&&void 0!==t.nativeEvent.text)return t.nativeEvent.text;if(e&&void 0!==t.nativeEvent)return t.nativeEvent.text;var r=t.target,n=r.type,u=r.value,i=r.checked,a=r.files,s=t.dataTransfer;return"checkbox"===n?i:"file"===n?a||s&&s.files:u}return"object"==typeof t&&void 0!==t.value?t.value:t};e.default=i,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=function(t){return!!(t&&t.target&&t.stopPropagation&&t.preventDefault)};e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(9),o=n(u),i=function(t){var e=o.default(t);return e&&t.preventDefault(),e};e.default=i,t.exports=e.default},function(t,e){"use strict";function r(t){return t.displayName||t.name||"Component"}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},n=function(t,e){return t.reduce(function(t,n){var u;return r({},t,(u={},u[n]=e[n]?e[n].value:void 0,u))},{})};e.default=n,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(){var t,e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=r.form,o=r.key,i=u(r,["form","key"]);if(!n)return e;if(o){var c,f;if(r.type===s.DESTROY){var l;return a({},e,(l={},l[n]=e[n]&&Object.keys(e[n]).reduce(function(t,r){var u;return r===o?t:a({},t,(u={},u[r]=e[n][r],u))},{}),l))}return a({},e,(f={},f[n]=a({},e[n],(c={},c[o]=p((e[n]||{})[o],i),c)),f))}return r.type===s.DESTROY?Object.keys(e).reduce(function(t,r){var u;return r===n?t:a({},t,(u={},u[r]=e[r],u))},{}):a({},e,(t={},t[n]=p(e[n],i),t))}function i(t){return t.plugin=function(t){var e=this;return i(function(){var r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],u=e(r,n);return a({},u,f.default(t,function(t,e){return t(u[e]||l,n)}))})},t.normalize=function(t){var e=this;return i(function(){var r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],u=e(r,n);return a({},u,f.default(t,function(t,e){var n=a({},l,u[e]);return a({},n,f.default(t,function(t,u){return a({},n[u],{value:t(n[u]?n[u].value:void 0,r[e]&&r[e][u]?r[e][u].value:void 0,d(n))})}))}))})},t}e.__esModule=!0;var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=r(2),c=r(3),f=n(c),l={_active:void 0,_asyncValidating:!1,_error:void 0,_submitting:!1};e.initialState=l;var d=function(t){return Object.keys(t).reduce(function(e,r){var n;return"_"===r[0]?e:a({},e,(n={},n[r]=t[r].value,n))},{})},p=function(){var t,e,r,n=arguments.length<=0||void 0===arguments[0]?l:arguments[0],u=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];switch(u.type){case s.BLUR:return a({},n,(t={},t[u.field]=a({},n[u.field],{value:void 0===u.value?(n[u.field]||{}).value:u.value,touched:!(!u.touch&&!(n[u.field]||{}).touched)}),t._active=void 0,t));case s.CHANGE:return a({},n,(e={},e[u.field]=a({},n[u.field],{value:u.value,touched:!(!u.touch&&!(n[u.field]||{}).touched),asyncError:void 0,submitError:void 0}),e._error=void 0,e));case s.DESTROY:return void 0;case s.FOCUS:return a({},n,(r={},r[u.field]=a({},n[u.field],{visited:!0}),r._active=u.field,r));case s.INITIALIZE:return a({},f.default(u.data,function(t){return{initial:t,value:t}}),{_asyncValidating:!1,_active:void 0,_error:void 0,_submitting:!1});case s.RESET:return a({},f.default(n,function(t,e){return"_"===e[0]?t:{initial:t.initial,value:t.initial}}),{_active:void 0,_asyncValidating:!1,_error:void 0,_submitting:!1});case s.START_ASYNC_VALIDATION:return a({},n,{_asyncValidating:!0});case s.START_SUBMIT:return a({},n,{_submitting:!0});case s.STOP_ASYNC_VALIDATION:return a({},n,f.default(u.errors,function(t,e){return a({},n[e],{asyncError:t})}),{_asyncValidating:!1,_error:u.errors&&u.errors._error});case s.STOP_SUBMIT:return a({},n,u.errors?f.default(u.errors,function(t,e){return a({},n[e],{submitError:t})}):{},{_error:u.errors&&u.errors._error,_submitting:!1});case s.TOUCH:return a({},n,u.fields.reduce(function(t,e){var r;return a({},t,(r={},r[e]=a({},n[e],{touched:!0}),r))},{}));case s.UNTOUCH:return a({},n,u.fields.reduce(function(t,e){var r;return a({},t,(r={},r[e]=a({},n[e],{touched:!1}),r))},{}));default:return n}};e.default=i(o)},function(t,e,r){function n(t){return null===t||void 0===t}function u(t){return t&&"object"==typeof t&&"number"==typeof t.length?"function"!=typeof t.copy||"function"!=typeof t.slice?!1:t.length>0&&"number"!=typeof t[0]?!1:!0:!1}function o(t,e,r){var o,f;if(n(t)||n(e))return!1;if(t.prototype!==e.prototype)return!1;if(s(t))return s(e)?(t=i.call(t),e=i.call(e),c(t,e,r)):!1;if(u(t)){if(!u(e))return!1;if(t.length!==e.length)return!1;for(o=0;o<t.length;o++)if(t[o]!==e[o])return!1;return!0}try{var l=a(t),d=a(e)}catch(p){return!1}if(l.length!=d.length)return!1;for(l.sort(),d.sort(),o=l.length-1;o>=0;o--)if(l[o]!=d[o])return!1;for(o=l.length-1;o>=0;o--)if(f=l[o],!c(t[f],e[f],r))return!1;return typeof t==typeof e}var i=Array.prototype.slice,a=r(38),s=r(37),c=t.exports=function(t,e,r){return r||(r={}),t===e?!0:t instanceof Date&&e instanceof Date?t.getTime()===e.getTime():!t||!e||"object"!=typeof t&&"object"!=typeof e?r.strict?t===e:t==e:o(t,e,r)}},function(t,e){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},n={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0};t.exports=function(t,e){for(var u=Object.getOwnPropertyNames(e),o=0;o<u.length;++o)r[u[o]]||n[u[o]]||(t[u[o]]=e[u[o]]);return t}},function(t,e){"use strict";function r(t){return t.shape({subscribe:t.func.isRequired,dispatch:t.func.isRequired,getState:t.func.isRequired})}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){function r(){return c}function n(t){return f.push(t),function(){var e=f.indexOf(t);f.splice(e,1)}}function u(t){if(!i.default(t))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof t.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,c=s(c,t)}finally{l=!1}return f.slice().forEach(function(t){return t()}),t}function o(t){s=t,u({type:a.INIT})}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var s=t,c=e,f=[],l=!1;return u({type:a.INIT}),{dispatch:u,subscribe:n,getState:r,replaceReducer:o}}e.__esModule=!0,e.default=u;var o=r(20),i=n(o),a={INIT:"@@redux/INIT"};e.ActionTypes=a},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(17),o=n(u),i=r(51),a=n(i),s=r(50),c=n(s),f=r(49),l=n(f),d=r(19),p=n(d);e.createStore=o.default,e.combineReducers=a.default,e.bindActionCreators=c.default,e.applyMiddleware=l.default,e.compose=p.default},function(t,e){"use strict";function r(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return function(t){return e.reduceRight(function(t,e){return e(t)},t)}}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e){"use strict";function r(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&n(r)===n(Object)}e.__esModule=!0,e.default=r;var n=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function r(t,e){return Object.keys(t).reduce(function(r,n){return r[n]=e(t[n],n),r},{})}e.__esModule=!0,e.default=r,t.exports=e.default},function(e,r){e.exports=t},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(4),o=n(u),i=r(1),a=n(i),s=function(t,e,r){e();var n=t();if(!o.default(n))throw new Error("asyncValidate function passed to reduxForm must return a promise");var u=function(t){return function(e){if(!a.default(e))return r(e),Promise.reject();if(t)throw r(),new Error("Asynchronous validation promise was rejected without errors.");return r(),Promise.resolve()}};return n.then(u(!1),u(!0))};e.default=s,t.exports=e.default},function(t,e,r){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function u(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){return{actionTypes:b,blur:_,change:O,destroy:x,focus:S,reducer:s.default,initialize:T,initializeWithKey:j,reduxForm:f.default(t,e),reset:P,startAsyncValidation:M,startSubmit:w,stopAsyncValidation:A,stopSubmit:E,touch:R,untouch:I}}e.__esModule=!0;var i=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=o;var a=r(13),s=u(a),c=r(26),f=u(c),l=r(3),d=u(l),p=r(6),v=u(p),y=r(5),h=n(y),m=r(2),b=n(m),g=i({},d.default(i({},h,{initializeWithKey:function(t,e){return v.default(h.initialize,{key:t})(e)},destroy:function(t){return v.default(h.destroy,{key:t})()}}),function(t){return function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),u=1;r>u;u++)n[u-1]=arguments[u];return v.default(t,{form:e}).apply(void 0,n)}})),_=g.blur,O=g.change,x=g.destroy,S=g.focus,T=g.initialize,j=g.initializeWithKey,P=g.reset,M=g.startAsyncValidation,w=g.startSubmit,A=g.stopAsyncValidation,E=g.stopSubmit,R=g.touch,I=g.untouch;t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function o(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},c=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),f=r(45),l=r(18),d=r(5),p=u(d),v=r(11),y=n(v),h=r(13),m=r(14),b=n(m),g=r(6),_=n(g),O=r(12),x=n(O),S=r(1),T=n(S),j=r(35),P=n(j),M=r(33),w=n(M),A=r(23),E=n(A),R=r(32),I=n(R),C=r(10),V=n(C),N=function(t,e,r,n){var u=r.Component,d=r.PropTypes;return function(v,m,g){var O=function(u){function f(t){i(this,f),u.call(this,t),this.asyncValidate=this.asyncValidate.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.fields=P.default(t,{},this.asyncValidate,e)}return a(f,u),c(f,null,[{key:"displayName",value:"ReduxForm("+y.default(n)+")",enumerable:!0},{key:"propTypes",value:{asyncBlurFields:d.arrayOf(d.string),asyncValidate:d.func,dispatch:d.func.isRequired,fields:d.arrayOf(d.string).isRequired,form:d.object,initialValues:d.object,onSubmit:d.func,validate:d.func,readonly:d.bool,returnRejectedSubmitPromise:d.bool,blur:d.func.isRequired,change:d.func.isRequired,destroy:d.func.isRequired,focus:d.func.isRequired,initialize:d.func.isRequired,reset:d.func.isRequired,startAsyncValidation:d.func.isRequired,startSubmit:d.func.isRequired,stopAsyncValidation:d.func.isRequired,stopSubmit:d.func.isRequired,touch:d.func.isRequired,untouch:d.func.isRequired},enumerable:!0},{key:"defaultProps",value:{asyncBlurFields:[],form:h.initialState,readonly:!1,returnRejectedSubmitPromise:!1,validate:function(){return{}}},enumerable:!0}]),f.prototype.componentWillMount=function(){var t=this.props,e=t.initialize,r=t.initialValues;r&&e(r)},f.prototype.componentWillReceiveProps=function(t){b.default(this.props.fields,t.fields)&&b.default(this.props.form,t.form)||(this.fields=P.default(t,this.fields,this.asyncValidate,e))},f.prototype.componentWillUnmount=function(){t.destroyOnUnmount&&this.props.destroy()},f.prototype.asyncValidate=function l(t,e){var r=this,n=this.props,l=n.asyncValidate,u=n.dispatch,o=n.fields,i=n.form,a=n.startAsyncValidation,s=n.stopAsyncValidation,c=n.validate;if(l){var f=function(){var n=x.default(o,i);t&&(n[t]=e);var f=c(n,r.props);return!t||T.default(f[t])?{v:E.default(function(){return l(n,u)},a,s)}:void 0}();if("object"==typeof f)return f.v}},f.prototype.handleSubmit=function(t){var e=this,r=this.props,n=r.onSubmit,u=r.fields,o=r.form,i=function(t){if(!t||"function"!=typeof t)throw new Error("You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop");return t},a=x.default(u,o);return V.default(t)?w.default(i(n),a,this.props,this.asyncValidate):I.default(function(){return w.default(i(t),a,e.props,e.asyncValidate)})},f.prototype.render=function(){var t=this,e=this.fields,u=this.props,i=(u.asyncBlurFields,u.blur,u.change,u.destroy),a=(u.focus,u.fields),c=u.form,f=(u.initialValues,u.initialize),l=(u.onSubmit,u.reset),d=(u.startAsyncValidation,u.startSubmit,u.stopAsyncValidation,u.stopSubmit,u.touch),p=u.untouch,v=(u.validate,o(u,["asyncBlurFields","blur","change","destroy","focus","fields","form","initialValues","initialize","onSubmit","reset","startAsyncValidation","startSubmit","stopAsyncValidation","stopSubmit","touch","untouch","validate"])),y=e._meta,h=y.allPristine,m=y.allValid,b=y.errors,_=y.formError,O=y.values;return r.createElement(n,s({},v,{active:c._active,asyncValidating:c._asyncValidating,dirty:!h,error:_,errors:b,fields:e,formKey:g,invalid:!m,pristine:h,submitting:c._submitting,valid:m,values:O,asyncValidate:I.default(function(){return t.asyncValidate()}),destroyForm:I.default(i),handleSubmit:this.handleSubmit,initializeForm:I.default(f),resetForm:I.default(l),touch:I.default(function(){return d.apply(void 0,arguments)}),touchAll:I.default(function(){return d.apply(void 0,a)}),untouch:I.default(function(){return p.apply(void 0,arguments)}),untouchAll:I.default(function(){return p.apply(void 0,a)})}))},c(f,null,[{key:"WrappedComponent",value:n,enumerable:!0}]),f}(u),S=s({},p,{blur:_.default(p.blur,{touch:!!t.touchOnBlur}),change:_.default(p.change,{touch:!!t.touchOnChange})}),j=void 0!==g&&null!==g?f.connect(function(t){if(!t[v])throw new Error('You need to mount the redux-form reducer at "'+v+'"');return{form:t[v]&&t[v][m]&&t[v][m][g]}},function(t){return s({},l.bindActionCreators(_.default(S,{form:m,key:g}),t),{dispatch:t})}):f.connect(function(t){if(!t[v])throw new Error('You need to mount the redux-form reducer at "'+v+'"');return{form:t[v]&&t[v][m]}},function(t){return s({},l.bindActionCreators(_.default(S,{form:m}),t),{dispatch:t})});return j(O)}};e.default=N,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o=r(27),i=n(o),a=r(15),s=n(a),c=function(t,e){var r=i.default(t,e);return function(t,n){return function(o){var i=r(o,n),a=u({touchOnBlur:!0,touchOnChange:!1,destroyOnUnmount:!0},t),c=function(t){return e.createElement(i,u({},a,t))};return s.default(c,o)}}};e.default=c,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var r={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),s=r(40),c=n(s),f=r(11),l=n(f),d=r(25),p=n(d),v=function(t,e){return function(r,n){var s=e.Component,f=e.PropTypes;return function(s){function d(u){o(this,d),s.call(this,u),this.cache=c.default(this,{ReduxForm:{params:["reduxMountPoint","form","formKey","initialValues"],fn:p.default(u,t,e,r,n)}})}return i(d,s),a(d,null,[{key:"displayName",value:"ReduxFormConnector("+l.default(r)+")",enumerable:!0},{key:"WrappedComponent",value:r,enumerable:!0},{key:"propTypes",value:{reduxMountPoint:f.string,form:f.string.isRequired,formKey:f.string},enumerable:!0},{key:"defaultProps",value:{reduxMountPoint:"form"},enumerable:!0}]),d.prototype.componentWillReceiveProps=function(t){this.cache.componentWillReceiveProps(t)},d.prototype.render=function(){var t=this.cache.ReduxForm,r=this.props,n=(r.reduxMountPoint,r.form,r.touchOnBlur,r.touchOnChange,u(r,["reduxMountPoint","form","touchOnBlur","touchOnChange"]));return e.createElement(t,n)},d}(s)}};e.default=v,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(8),o=n(u),i=function(t,e,r,n){return function(u){var i=o.default(u,r);e(t,i),n&&n(t,i)}};e.default=i,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(8),o=n(u),i=function(t,e,r){return function(n){return e(t,o.default(n,r))}};e.default=i,t.exports=e.default},function(t,e,r){"use strict";e.__esModule=!0;var n=r(7),u=function(t,e){return function(r){e(t,r.dataTransfer.getData(n.dataKey))}};e.default=u,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var r=function(t,e){return function(){return e(t)}};e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(10),o=n(u),i=function(t){return function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),u=1;r>u;u++)n[u-1]=arguments[u];return o.default(e)?t.apply(void 0,n):t.apply(void 0,[e].concat(n))}};e.default=i,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(4),o=n(u),i=r(1),a=n(i),s=function(t,e,r,n){var u=r.dispatch,i=r.fields,s=r.startSubmit,c=r.stopSubmit,f=r.returnRejectedSubmitPromise,l=r.touch,d=r.validate,p=d(e,r);if(l.apply(void 0,i),a.default(p)){var v=function(){var r=t(e,u);return o.default(r)?(s(),r.then(function(t){return c(),t},function(t){return c(t),f?Promise.reject(t):void 0})):r},y=n();return o.default(y)?y.then(v,function(){return f?Promise.reject():Promise.resolve()}):v()}};e.default=s,t.exports=e.default},function(t,e){"use strict";function r(t,e){if(t===e)return!0;if(t&&"object"==typeof t){if(!e||"object"!=typeof e)return!1;var n=Object.keys(t),u=Object.keys(e);if(n.length!==u.length)return!1;for(var o=0;o<u.length;o++){var i=u[o];if(!r(t[i],e[i]))return!1}}else if(t||e)return t===e;return!0}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o=r(28),i=n(o),a=r(29),s=n(a),c=r(7),f=n(c),l=r(30),d=n(l),p=r(31),v=n(p),y=r(34),h=n(y),m=r(1),b=n(m),g=r(12),_=n(g),O=r(36),x=n(O),S=function(t,e,r,n){var o=t.asyncBlurFields,a=t.blur,c=t.change,l=t.fields,p=t.focus,y=t.form,m=t.initialValues,g=t.readonly,O=t.validate,S=_.default(l,y),T=O(S,t),j={},P=T._error||y._error,M=!P,w=!0;return u({},l.reduce(function(t,l){var _,O=e[l]||{};if(O.name!==l){var S=s.default(l,c,n),P=m&&m[l];O.name=l,O.defaultChecked=P,O.defaultValue=P,g||(O.onBlur=i.default(l,a,n,o.includes(l)&&function(t,e){return x.default(r(t,e))}),O.onChange=S,O.onDragStart=f.default(l,function(){return O.value}),O.onDrop=d.default(l,c),O.onFocus=v.default(l,p),O.onUpdate=S),O.valid=!0,O.invalid=!1}var A=y[l]||{};O.value!==A.value&&(O.value=A.value);var E=h.default(A.value,A.initial);O.dirty=!E,O.pristine=E;var R=T[l]||A.submitError||A.asyncError,I=b.default(R);return O.invalid=!I,O.error=R,O.valid=I,R&&(j[l]=R),O.active=y._active===l,O.touched=!!A.touched,O.visited=!!A.visited,O.invalid&&(M=!1),O.dirty&&(w=!1),u({},t,(_={},_[l]=O,_))},{}),{_meta:{allPristine:w,allValid:M,values:S,errors:j,formError:P}})};e.default=S,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(4),o=n(u),i=function(){return void 0},a=function(t){return o.default(t)?t.then(i,i):t};e.default=a,t.exports=e.default},function(t,e){function r(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function n(t){return t&&"object"==typeof t&&"number"==typeof t.length&&Object.prototype.hasOwnProperty.call(t,"callee")&&!Object.prototype.propertyIsEnumerable.call(t,"callee")||!1}var u="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();e=t.exports=u?r:n,e.supported=r,e.unsupported=n},function(t,e){function r(t){var e=[];for(var r in t)e.push(r);return e}e=t.exports="function"==typeof Object.keys?Object.keys:r,e.shim=r},function(t,e,r){"use strict";var n=function(t,e,r,n,u,o,i,a){if(!t){var s;if(void 0===e)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,u,o,i,a],f=0;s=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return c[f++]}))}throw s.framesToPop=1,s}};t.exports=n},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(41),o=n(u);e.default=o.default,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var r=[],n={},u={},o=function a(t){Object.keys(n).forEach(function(e){~n[e].props.indexOf(t)&&(delete n[e].value,a(e))})};return Object.keys(e).forEach(function(o){var i=e[o].fn,a=e[o].params;a.forEach(function(t){~r.indexOf(t)||r.push(t)}),n[o]={props:a},Object.defineProperty(u,o,{get:function(){var e=n[o];if(e&&void 0!==e.value)return e.value;var r=a.map(function(e){return t.props[e]||u[e]}),s=i.apply(void 0,r);return n[o]={props:a,value:s},s}})}),u.componentWillReceiveProps=function(e){var n=[];r.forEach(function(r){i.default(t.props[r],e[r])||n.push(r)}),n.forEach(o)},u}e.__esModule=!0,e.default=u;var o=r(14),i=n(o);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t){var e=i.default(t),r=s.default(t);return{Provider:e,connect:r}}e.__esModule=!0,e.default=u;var o=r(44),i=n(o),a=r(43),s=n(a);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){return t.displayName||t.name||"Component"}function a(t){var e=t.Component,r=t.PropTypes,n=f.default(r);return function(r,a,c){function f(t,e){var r=t.getState(),n=M?g(r,e):g(r);return _.default(v.default(n),"`mapStateToProps` must return an object. Instead received %s.",n),n}function l(t,e){var r=t.dispatch,n=w?j(r,e):j(r);return _.default(v.default(n),"`mapDispatchToProps` must return an object. Instead received %s.",n),n}function p(t,e,r){var n=P(t,e,r);return _.default(v.default(n),"`mergeProps` must return an object. Instead received %s.",n),n}var y=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],m=Boolean(r),g=r||O,j=v.default(a)?h.default(a):a||x,P=c||S,M=g.length>1,w=j.length>1,A=y.pure,E=void 0===A?!0:A,R=T++;return function(r){var a=function(e){function n(t,r){u(this,n),e.call(this,t,r),this.version=R,this.store=t.store||r.store,_.default(this.store,'Could not find "store" in either the context or '+('props of "'+this.constructor.displayName+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+this.constructor.displayName+'".')),this.stateProps=f(this.store,t),this.dispatchProps=l(this.store,t),this.state={storeState:null},this.updateState()}return o(n,e),n.prototype.shouldComponentUpdate=function(t,e){if(!E)return this.updateStateProps(t),this.updateDispatchProps(t),this.updateState(t),!0;var r=e.storeState!==this.state.storeState,n=!d.default(t,this.props),u=!1,o=!1;return(r||n&&M)&&(u=this.updateStateProps(t)),n&&w&&(o=this.updateDispatchProps(t)),n||u||o?(this.updateState(t),!0):!1},n.prototype.computeNextState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];return p(this.stateProps,this.dispatchProps,t)},n.prototype.updateStateProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=f(this.store,t);return d.default(e,this.stateProps)?!1:(this.stateProps=e,!0)},n.prototype.updateDispatchProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=l(this.store,t);return d.default(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},n.prototype.updateState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];this.nextState=this.computeNextState(t)},n.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},n.prototype.trySubscribe=function(){m&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},n.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},n.prototype.componentDidMount=function(){this.trySubscribe()},n.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},n.prototype.handleChange=function(){this.unsubscribe&&this.setState({storeState:this.store.getState()})},n.prototype.getWrappedInstance=function(){return this.refs.wrappedInstance},n.prototype.render=function(){return t.createElement(r,s({ref:"wrappedInstance"},this.nextState))},n}(e);return a.displayName="Connect("+i(r)+")",a.WrappedComponent=r,a.contextTypes={store:n},a.propTypes={store:n},b.default(a,r)}}}e.__esModule=!0;var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=a;var c=r(16),f=n(c),l=r(47),d=n(l),p=r(46),v=n(p),y=r(48),h=n(y),m=r(15),b=n(m),g=r(39),_=n(g),O=function(){return{}},x=function(t){return{dispatch:t}},S=function(t,e,r){return s({},r,t,e)},T=0;t.exports=e.default},function(t,e,r){"use strict"; | ||
function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function i(t){var e=t.version;if("string"!=typeof e)return!0;var r=e.split("."),n=parseInt(r[0],10),u=parseInt(r[1],10);return 0===n&&13===u}function a(t){function e(){p||d||(p=!0,console.error("With React 0.14 and later versions, you no longer need to wrap <Provider> child into a function."))}function r(){!p&&d&&(p=!0,console.error("With React 0.13, you need to wrap <Provider> child into a function. This restriction will be removed with React 0.14."))}function n(){v||(v=!0,console.error("<Provider> does not support changing `store` on the fly. It is most likely that you see this error because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers automatically. See https://github.com/rackt/react-redux/releases/tag/v2.0.0 for the migration instructions."))}var a=t.Component,s=t.PropTypes,f=t.Children,l=c.default(s),d=i(t),p=!1,v=!1,y=function(t){function i(e,r){u(this,i),t.call(this,e,r),this.store=e.store}return o(i,t),i.prototype.getChildContext=function(){return{store:this.store}},i.prototype.componentWillReceiveProps=function(t){var e=this.store,r=t.store;e!==r&&n()},i.prototype.render=function(){var t=this.props.children;return"function"==typeof t?(e(),t=t()):r(),f.only(t)},i}(a);return y.childContextTypes={store:l.isRequired},y.propTypes={store:l.isRequired,children:(d?s.func:s.element).isRequired},y}e.__esModule=!0,e.default=a;var s=r(16),c=n(s);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var u=r(22),o=n(u),i=r(42),a=n(i),s=a.default(o.default),c=s.Provider,f=s.connect;e.Provider=c,e.connect=f},function(t,e){"use strict";function r(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&n(r)===n(Object)}e.__esModule=!0,e.default=r;var n=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var u=Object.prototype.hasOwnProperty,o=0;o<r.length;o++)if(!u.call(e,r[o])||t[r[o]]!==e[r[o]])return!1;return!0}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return function(e){return u.bindActionCreators(t,e)}}e.__esModule=!0,e.default=n;var u=r(18);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];return function(t){return function(r,n){var u=t(r,n),i=u.dispatch,s=[],c={getState:u.getState,dispatch:function(t){return i(t)}};return s=e.map(function(t){return t(c)}),i=a.default.apply(void 0,s)(u.dispatch),o({},u,{dispatch:i})}}}e.__esModule=!0;var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=u;var i=r(19),a=n(i);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){return function(){return e(t.apply(void 0,arguments))}}function o(t,e){if("function"==typeof t)return u(t,e);if("object"!=typeof t||null===t||void 0===t)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===t?"null":typeof t)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');return a.default(t,function(t){return u(t,e)})}e.__esModule=!0,e.default=o;var i=r(21),a=n(i);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var r=e&&e.type,n=r&&'"'+r.toString()+'"'||"an action";return'Reducer "'+t+'" returned undefined handling '+n+". To ignore an action, you must explicitly return the previous state."}function o(t){Object.keys(t).forEach(function(e){var r=t[e],n=r(void 0,{type:a.ActionTypes.INIT});if("undefined"==typeof n)throw new Error('Reducer "'+e+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');var u="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof r(void 0,{type:u}))throw new Error('Reducer "'+e+'" returned undefined when probed with a random type. '+("Don't try to handle "+a.ActionTypes.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.")})}function i(t){var e,r=d.default(t,function(t){return"function"==typeof t});try{o(r)}catch(n){e=n}var i=f.default(r,function(){return void 0});return function(t,n){if(void 0===t&&(t=i),e)throw e;var o=f.default(r,function(e,r){var o=e(t[r],n);if("undefined"==typeof o){var i=u(r,n);throw new Error(i)}return o});return o}}e.__esModule=!0,e.default=i;var a=r(17),s=r(20),c=(n(s),r(21)),f=n(c),l=r(52),d=n(l);t.exports=e.default},function(t,e){"use strict";function r(t,e){return Object.keys(t).reduce(function(r,n){return e(t[n])&&(r[n]=t[n]),r},{})}e.__esModule=!0,e.default=r,t.exports=e.default}])}); |
@@ -21,6 +21,2 @@ 'use strict'; | ||
var _createConnectReduxForm = require('./createConnectReduxForm'); | ||
var _createConnectReduxForm2 = _interopRequireDefault(_createConnectReduxForm); | ||
var _mapValues = require('./mapValues'); | ||
@@ -74,3 +70,3 @@ | ||
function createAll(isReactNative, React, connect) { | ||
function createAll(isReactNative, React) { | ||
return { | ||
@@ -80,3 +76,2 @@ actionTypes: actionTypes, | ||
change: change, | ||
connectReduxForm: _createConnectReduxForm2['default'](isReactNative, React, connect), | ||
destroy: destroy, | ||
@@ -83,0 +78,0 @@ focus: focus, |
@@ -5,515 +5,36 @@ 'use strict'; | ||
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
exports['default'] = createReduxForm; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } } | ||
var _createReduxFormConnector = require('./createReduxFormConnector'); | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
var _createReduxFormConnector2 = _interopRequireDefault(_createReduxFormConnector); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } | ||
var _hoistNonReactStatics = require('hoist-non-react-statics'); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics); | ||
var _actions = require('./actions'); | ||
var formActions = _interopRequireWildcard(_actions); | ||
var _getDisplayName = require('./getDisplayName'); | ||
var _getDisplayName2 = _interopRequireDefault(_getDisplayName); | ||
var _isPristine = require('./isPristine'); | ||
var _isPristine2 = _interopRequireDefault(_isPristine); | ||
var _isValid = require('./isValid'); | ||
var _isValid2 = _interopRequireDefault(_isValid); | ||
var _bindActionData = require('./bindActionData'); | ||
var _bindActionData2 = _interopRequireDefault(_bindActionData); | ||
var _reducer = require('./reducer'); | ||
var _reactLazyCache = require('react-lazy-cache'); | ||
var _reactLazyCache2 = _interopRequireDefault(_reactLazyCache); | ||
function isReadonly(prop) { | ||
var writeProps = ['asyncValidate', 'handleBlur', 'handleChange', 'handleFocus', 'handleSubmit', 'onBlur', 'onChange', 'onFocus']; | ||
return ! ~writeProps.indexOf(prop); | ||
} | ||
function silenceEvents(fn) { | ||
return function (event) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
if (event && event.preventDefault) { | ||
event.preventDefault(); | ||
return fn.apply(undefined, args); | ||
} | ||
return fn.apply(undefined, [event].concat(args)); | ||
}; | ||
} | ||
function hasErrors(errors) { | ||
if (!errors) { | ||
return false; | ||
} | ||
var errorsKeys = Object.keys(errors); | ||
var errorCount = errorsKeys.length; | ||
if (errorCount < 1) { | ||
return false; | ||
} | ||
return errorsKeys.reduce(function (valid, error) { | ||
return valid && _isValid2['default'](errors[error]); | ||
}, true); | ||
} | ||
function createReduxForm(isReactNative, React) { | ||
var Component = React.Component; | ||
var PropTypes = React.PropTypes; | ||
function getValue(passedValue, event) { | ||
if (passedValue !== undefined || !event) { | ||
// extract value from { value: value } structure. https://github.com/nikgraf/belle/issues/58 | ||
return typeof passedValue === 'object' && passedValue.value ? passedValue.value : passedValue; | ||
} | ||
if (!isReactNative && event.nativeEvent !== undefined && event.nativeEvent.text !== undefined) { | ||
return event.nativeEvent.text; | ||
} | ||
if (isReactNative && event.nativeEvent !== undefined) { | ||
return event.nativeEvent.text; | ||
} | ||
if (event.target === undefined) { | ||
// is it a value instead of an event? | ||
return event; | ||
} | ||
var _event$target = event.target; | ||
var type = _event$target.type; | ||
var value = _event$target.value; | ||
var checked = _event$target.checked; | ||
var files = _event$target.files; | ||
var dataTransfer = event.dataTransfer; | ||
if (type === 'checkbox') { | ||
return checked; | ||
} | ||
if (type === 'file') { | ||
return files || dataTransfer && dataTransfer.files; | ||
} | ||
return value; | ||
} | ||
return function reduxForm(config) { | ||
var _extends7 = _extends({ | ||
validate: function validate() { | ||
return {}; | ||
}, | ||
touchOnBlur: true, | ||
touchOnChange: false, | ||
readonly: false, | ||
asyncValidate: null, | ||
asyncBlurFields: [] | ||
}, config); | ||
var formName = _extends7.form; | ||
var fields = _extends7.fields; | ||
var syncValidate = _extends7.validate; | ||
var readonly = _extends7.readonly; | ||
var touchOnBlur = _extends7.touchOnBlur; | ||
var touchOnChange = _extends7.touchOnChange; | ||
var asyncValidate = _extends7.asyncValidate; | ||
var asyncBlurFields = _extends7.asyncBlurFields; | ||
if (!fields || !fields.length) { | ||
throw new Error('No fields passed to redux-form. Must be passed to ' + 'connectReduxForm({fields: ["my", "field", "names"]})'); | ||
} | ||
var filterProps = function filterProps(props) { | ||
return readonly ? Object.keys(props).reduce(function (accumulator, prop) { | ||
var _extends2; | ||
return isReadonly(prop) ? _extends({}, accumulator, (_extends2 = {}, _extends2[prop] = props[prop], _extends2)) : accumulator; | ||
}, {}) : props; | ||
/** | ||
* The decorator that is the main API to redux-form | ||
*/ | ||
var createReduxForm = function createReduxForm(isReactNative, React) { | ||
var reduxFormConnector = _createReduxFormConnector2['default'](isReactNative, React); | ||
return function (config, mapDispatchToProps) { | ||
return function (WrappedComponent) { | ||
var ReduxFormConnector = reduxFormConnector(WrappedComponent, mapDispatchToProps); | ||
var configWithDefaults = _extends({ | ||
touchOnBlur: true, | ||
touchOnChange: false, | ||
destroyOnUnmount: true | ||
}, config); | ||
var ConnectedForm = function ConnectedForm(props) { | ||
return React.createElement(ReduxFormConnector, _extends({}, configWithDefaults, props)); | ||
}; | ||
return _hoistNonReactStatics2['default'](ConnectedForm, WrappedComponent); | ||
}; | ||
return function (DecoratedComponent) { | ||
return (function (_Component) { | ||
_inherits(ReduxForm, _Component); | ||
_createClass(ReduxForm, null, [{ | ||
key: 'displayName', | ||
value: 'ReduxForm(' + _getDisplayName2['default'](DecoratedComponent) + ')', | ||
enumerable: true | ||
}, { | ||
key: 'DecoratedComponent', | ||
value: DecoratedComponent, | ||
enumerable: true | ||
}, { | ||
key: 'propTypes', | ||
value: { | ||
formName: PropTypes.string, | ||
formKey: PropTypes.string, | ||
form: PropTypes.object, | ||
onSubmit: PropTypes.func, | ||
dispatch: PropTypes.func.isRequired, | ||
initialValues: PropTypes.object | ||
}, | ||
enumerable: true | ||
}, { | ||
key: 'defaultProps', | ||
value: { | ||
formName: formName | ||
}, | ||
enumerable: true | ||
}]); | ||
function ReduxForm(props) { | ||
var _this = this; | ||
_classCallCheck(this, ReduxForm); | ||
_Component.call(this, props); | ||
this.cache = _reactLazyCache2['default'](this, { | ||
_actions: { | ||
params: ['formName', 'formKey'], | ||
fn: function fn(formName, formKey) { | ||
return (// eslint-disable-line no-shadow | ||
formKey ? _bindActionData2['default'](formActions, { form: formName, key: formKey }) : _bindActionData2['default'](formActions, { form: formName }) | ||
); | ||
} | ||
}, | ||
_handleBlur: { | ||
params: ['_actions', 'dispatch'], | ||
fn: function fn(actions, dispatch) { | ||
return function (name, value) { | ||
return function (event) { | ||
var fieldValue = getValue(value, event); | ||
var doBlur = _bindActionData2['default'](actions.blur, { touch: touchOnBlur }); | ||
dispatch(doBlur(name, fieldValue)); | ||
if (asyncValidate && ~asyncBlurFields.indexOf(name)) { | ||
var _extends3; | ||
var values = _this.getValues(); | ||
var syncError = _this.runSyncValidation(_extends({}, values, (_extends3 = {}, _extends3[name] = fieldValue, _extends3)))[name]; | ||
// only dispatch async call if all synchronous client-side validation passes for this field | ||
if (!syncError) { | ||
_this.runAsyncValidation(actions, values); | ||
} | ||
} | ||
}; | ||
}; | ||
} | ||
}, | ||
_handleFocus: { | ||
params: ['_actions', 'dispatch'], | ||
fn: function fn(actions, dispatch) { | ||
return function (name) { | ||
return function () { | ||
return dispatch(actions.focus(name)); | ||
}; | ||
}; | ||
} | ||
}, | ||
_handleChange: { | ||
params: ['_actions', 'dispatch'], | ||
fn: function fn(actions, dispatch) { | ||
return function (name, value) { | ||
var doChange = _bindActionData2['default'](actions.change, { touch: touchOnChange }); | ||
return value ? dispatch(doChange(name, getValue(value))) : function (event) { | ||
return dispatch(doChange(name, getValue(value, event))); | ||
}; | ||
}; | ||
} | ||
}, | ||
_fieldActions: { | ||
params: ['_handleBlur', '_handleChange', '_handleFocus'], | ||
fn: function fn(handleBlur, handleChange, handleFocus) { | ||
return fields.reduce(function (accumulator, name) { | ||
var _extends4; | ||
var fieldBlur = handleBlur(name); | ||
var fieldChange = handleChange(name); | ||
var fieldFocus = handleFocus(name); | ||
return _extends({}, accumulator, (_extends4 = {}, _extends4[name] = filterProps({ | ||
handleBlur: fieldBlur, | ||
handleChange: fieldChange, | ||
handleFocus: fieldFocus, | ||
name: name, | ||
onBlur: fieldBlur, | ||
onChange: fieldChange, | ||
onDrop: function onDrop(event) { | ||
fieldChange(event.dataTransfer.getData('value')); | ||
}, | ||
onFocus: fieldFocus, | ||
onUpdate: fieldChange // alias to support belle. https://github.com/nikgraf/belle/issues/58 | ||
}), _extends4)); | ||
}, {}); | ||
} | ||
} | ||
}); | ||
} | ||
ReduxForm.prototype.componentWillMount = function componentWillMount() { | ||
var _props = this.props; | ||
var initialValues = _props.initialValues; | ||
var dispatch = _props.dispatch; | ||
// eslint-disable-line no-shadow | ||
if (initialValues) { | ||
var initialize = this.cache._actions.initialize; | ||
dispatch(initialize(initialValues)); | ||
} | ||
}; | ||
ReduxForm.prototype.runSyncValidation = function runSyncValidation(values) { | ||
return syncValidate(values, this.props); | ||
}; | ||
ReduxForm.prototype.runAsyncValidation = function runAsyncValidation(actions, values) { | ||
var _props2 = this.props; | ||
var dispatch = _props2.dispatch; | ||
var formKey = _props2.formKey; | ||
// eslint-disable-line no-shadow | ||
dispatch(actions.startAsyncValidation(formKey)); | ||
var promise = asyncValidate(values, dispatch); | ||
if (!promise || typeof promise.then !== 'function') { | ||
throw new Error('asyncValidate function passed to reduxForm must return a promise!'); | ||
} | ||
var handleErrors = function handleErrors(asyncErrors) { | ||
dispatch(actions.stopAsyncValidation(asyncErrors)); | ||
return hasErrors(asyncErrors); | ||
}; | ||
return promise.then(handleErrors, handleErrors); | ||
}; | ||
ReduxForm.prototype.getSubForm = function getSubForm() { | ||
var _props3 = this.props; | ||
var formName = _props3.formName; | ||
var form = _props3.form; | ||
var formKey = _props3.formKey; | ||
// eslint-disable-line no-shadow | ||
if (form && form[formName]) { | ||
if (formKey) { | ||
if (form[formName][formKey]) { | ||
return form[formName][formKey]; | ||
} | ||
} else { | ||
return form[formName]; | ||
} | ||
} | ||
return _reducer.initialState; | ||
}; | ||
ReduxForm.prototype.getValues = function getValues() { | ||
var subForm = this.getSubForm(); | ||
return fields.reduce(function (accumulator, field) { | ||
var _extends5; | ||
return _extends({}, accumulator, (_extends5 = {}, _extends5[field] = subForm[field] ? subForm[field].value : undefined, _extends5)); | ||
}, {}); | ||
}; | ||
ReduxForm.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
this.cache.componentWillReceiveProps(nextProps); | ||
}; | ||
ReduxForm.prototype.render = function render() { | ||
var _this2 = this; | ||
// Read props | ||
var _props4 = this.props; | ||
var formName = _props4.formName; | ||
var form = _props4.form; | ||
var formKey = _props4.formKey; | ||
var dispatch = _props4.dispatch; | ||
var passableProps = _objectWithoutProperties(_props4, ['formName', 'form', 'formKey', 'dispatch']); | ||
// eslint-disable-line no-shadow | ||
if (!formName) { | ||
throw new Error('No form name given to redux-form. Must be passed to ' + 'connectReduxForm({form: [form name]}) or as a "formName" prop'); | ||
} | ||
var _cache = this.cache; | ||
var actions = _cache._actions; | ||
var fieldActions = _cache._fieldActions; | ||
var handleBlur = _cache._handleBlur; | ||
var handleChange = _cache._handleChange; | ||
var handleFocus = _cache._handleFocus; | ||
var subForm = this.getSubForm(); | ||
// Calculate calculable state | ||
var allValid = true; | ||
var allPristine = true; | ||
var handleSubmit = function handleSubmit(submitOrEvent) { | ||
var createEventHandler = function createEventHandler(submit) { | ||
return function (event) { | ||
if (event && event.preventDefault) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
} | ||
var values = _this2.getValues(); | ||
var syncErrors = _this2.runSyncValidation(values); | ||
if (!hasErrors(syncErrors)) { | ||
var _ret = (function () { | ||
var submitWithPromiseCheck = function submitWithPromiseCheck() { | ||
var result = submit(values); | ||
if (result && typeof result.then === 'function') { | ||
// you're showing real promise, kid! | ||
dispatch(actions.startSubmit()); | ||
return result.then(function (submitResult) { | ||
dispatch(actions.stopSubmit()); | ||
return submitResult; | ||
}, function (submitError) { | ||
dispatch(actions.stopSubmit(submitError)); | ||
return submitError; | ||
}); | ||
} | ||
}; | ||
dispatch(actions.touch.apply(actions, fields)); | ||
if (allValid) { | ||
if (asyncValidate) { | ||
return { | ||
v: _this2.runAsyncValidation(actions, values).then(function (asyncValid) { | ||
if (allValid && asyncValid) { | ||
return submitWithPromiseCheck(values); | ||
} | ||
}) | ||
}; | ||
} | ||
return { | ||
v: submitWithPromiseCheck(values) | ||
}; | ||
} | ||
})(); | ||
if (typeof _ret === 'object') return _ret.v; | ||
} | ||
}; | ||
}; | ||
if (typeof submitOrEvent === 'function') { | ||
return createEventHandler(submitOrEvent); | ||
} | ||
var onSubmit = _this2.props.onSubmit; | ||
if (!onSubmit) { | ||
throw new Error('You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop'); | ||
} | ||
createEventHandler(onSubmit)(submitOrEvent /* is event */); | ||
}; | ||
// Define fields | ||
var values = this.getValues(); | ||
var syncErrors = this.runSyncValidation(values); | ||
var allFields = fields.reduce(function (accumulator, name) { | ||
var _extends6; | ||
var field = subForm[name] || {}; | ||
var pristine = _isPristine2['default'](field.value, field.initial); | ||
var error = syncErrors[name] || field.asyncError || field.submitError; | ||
var valid = _isValid2['default'](error); | ||
var initialValue = passableProps.initialValues && passableProps.initialValues[name]; | ||
if (!valid) { | ||
allValid = false; | ||
} | ||
if (!pristine) { | ||
allPristine = false; | ||
} | ||
return _extends({}, accumulator, (_extends6 = {}, _extends6[name] = filterProps(_extends({ | ||
active: subForm._active === name, | ||
checked: typeof field.value === 'boolean' ? field.value : undefined, | ||
defaultChecked: initialValue, | ||
defaultValue: initialValue, | ||
dirty: !pristine, | ||
error: error | ||
}, fieldActions[name], { | ||
invalid: !valid, | ||
name: name, | ||
onDrag: function onDrag(event) { | ||
return event.dataTransfer.setData('value', field.value); | ||
}, | ||
pristine: pristine, | ||
touched: field.touched, | ||
valid: valid, | ||
value: field.value, | ||
visited: field.visited | ||
})), _extends6)); | ||
}, {}); | ||
var formError = syncErrors._error || subForm._error; | ||
if (formError) { | ||
allValid = false; | ||
} | ||
// Return decorated component | ||
return React.createElement(DecoratedComponent, _extends({ | ||
// State: | ||
active: subForm._active, | ||
asyncValidating: subForm._asyncValidating, | ||
dirty: !allPristine, | ||
error: formError, | ||
fields: allFields, | ||
formKey: formKey, | ||
invalid: !allValid, | ||
pristine: allPristine, | ||
submitting: subForm._submitting, | ||
valid: allValid, | ||
values: values, | ||
// Actions: | ||
asyncValidate: silenceEvents(function () { | ||
return _this2.runAsyncValidation(actions, values); | ||
}), | ||
destroyForm: silenceEvents(function () { | ||
return dispatch(actions.destroy()); | ||
}), | ||
handleBlur: silenceEvents(handleBlur), | ||
handleChange: silenceEvents(handleChange), | ||
handleFocus: handleFocus, | ||
handleSubmit: silenceEvents(handleSubmit), | ||
initializeForm: silenceEvents(function (initialValues) { | ||
return dispatch(actions.initialize(initialValues)); | ||
}), | ||
resetForm: silenceEvents(function () { | ||
return dispatch(actions.reset()); | ||
}), | ||
touch: silenceEvents(function () { | ||
return dispatch(actions.touch.apply(actions, arguments)); | ||
}), | ||
touchAll: silenceEvents(function () { | ||
return dispatch(actions.touch.apply(actions, fields)); | ||
}), | ||
untouch: silenceEvents(function () { | ||
return dispatch(actions.untouch.apply(actions, arguments)); | ||
}), | ||
untouchAll: silenceEvents(function () { | ||
return dispatch(actions.untouch.apply(actions, fields)); | ||
}), | ||
// Other: | ||
dispatch: dispatch | ||
}, passableProps)); | ||
}; | ||
return ReduxForm; | ||
})(Component); | ||
}; | ||
}; | ||
} | ||
}; | ||
exports['default'] = createReduxForm; | ||
module.exports = exports['default']; |
@@ -11,4 +11,2 @@ 'use strict'; | ||
var _reactRedux = require('react-redux'); | ||
var _createAll2 = require('./createAll'); | ||
@@ -18,3 +16,3 @@ | ||
var _createAll = _createAll3['default'](false, _react2['default'], _reactRedux.connect); | ||
var _createAll = _createAll3['default'](false, _react2['default']); | ||
@@ -24,3 +22,2 @@ var actionTypes = _createAll.actionTypes; | ||
var change = _createAll.change; | ||
var connectReduxForm = _createAll.connectReduxForm; | ||
var destroy = _createAll.destroy; | ||
@@ -42,3 +39,2 @@ var focus = _createAll.focus; | ||
exports.change = change; | ||
exports.connectReduxForm = connectReduxForm; | ||
exports.destroy = destroy; | ||
@@ -45,0 +41,0 @@ exports.focus = focus; |
@@ -1,5 +0,5 @@ | ||
"use strict"; | ||
'use strict'; | ||
exports.__esModule = true; | ||
exports["default"] = isValid; | ||
exports['default'] = isValid; | ||
@@ -12,5 +12,10 @@ function isValid(error) { | ||
} | ||
if (error && typeof error === 'object') { | ||
return Object.keys(error).reduce(function (valid, key) { | ||
return valid && isValid(error[key]); | ||
}, true); | ||
} | ||
return !error; | ||
} | ||
module.exports = exports["default"]; | ||
module.exports = exports['default']; |
@@ -13,9 +13,9 @@ /** | ||
function mapValues(obj, fn) { | ||
return Object.keys(obj).reduce(function (accumulator, key) { | ||
return obj ? Object.keys(obj).reduce(function (accumulator, key) { | ||
var _extends2; | ||
return _extends({}, accumulator, (_extends2 = {}, _extends2[key] = fn(obj[key], key), _extends2)); | ||
}, {}); | ||
}, {}) : obj; | ||
} | ||
module.exports = exports["default"]; |
@@ -11,4 +11,2 @@ 'use strict'; | ||
var _reactReduxNative = require('react-redux/native'); | ||
var _createAll2 = require('./createAll'); | ||
@@ -18,3 +16,3 @@ | ||
var _createAll = _createAll3['default'](true, _reactNative2['default'], _reactReduxNative.connect); | ||
var _createAll = _createAll3['default'](true, _reactNative2['default']); | ||
@@ -24,3 +22,2 @@ var actionTypes = _createAll.actionTypes; | ||
var change = _createAll.change; | ||
var connectReduxForm = _createAll.connectReduxForm; | ||
var destroy = _createAll.destroy; | ||
@@ -42,3 +39,2 @@ var focus = _createAll.focus; | ||
exports.change = change; | ||
exports.connectReduxForm = connectReduxForm; | ||
exports.destroy = destroy; | ||
@@ -45,0 +41,0 @@ exports.focus = focus; |
@@ -50,4 +50,4 @@ 'use strict'; | ||
touched: !!(action.touch || (state[action.field] || {}).touched), | ||
asyncError: null, | ||
submitError: null | ||
asyncError: undefined, | ||
submitError: undefined | ||
}), _extends4._error = undefined, _extends4)); | ||
@@ -99,3 +99,3 @@ case _actionTypes.DESTROY: | ||
_asyncValidating: false, | ||
_error: action.errors._error | ||
_error: action.errors && action.errors._error | ||
}); | ||
@@ -152,3 +152,3 @@ case _actionTypes.STOP_SUBMIT: | ||
return _extends({}, state, (_extends9 = {}, _extends9[form] = Object.keys(state[form]).reduce(function (accumulator, stateKey) { | ||
return _extends({}, state, (_extends9 = {}, _extends9[form] = state[form] && Object.keys(state[form]).reduce(function (accumulator, stateKey) { | ||
var _extends8; | ||
@@ -183,4 +183,4 @@ | ||
var result = _this(state, action); | ||
return _extends({}, result, _mapValues2['default'](reducers, function (red, key) { | ||
return red(result[key] || initialState, action); | ||
return _extends({}, result, _mapValues2['default'](reducers, function (pluginReducer, key) { | ||
return pluginReducer(result[key] || initialState, action); | ||
})); | ||
@@ -187,0 +187,0 @@ }); |
{ | ||
"name": "redux-form", | ||
"version": "2.4.5", | ||
"version": "3.0.0-beta-1", | ||
"description": "A higher order component decorator for forms using Redux and React", | ||
@@ -18,3 +18,3 @@ "main": "./lib/index.js", | ||
"prepublish": "npm run lint && npm run test && npm run clean && npm run build", | ||
"test": "mocha --compilers js:babel/register --recursive" | ||
"test": "mocha --compilers js:babel/register --recursive 'src/**/__tests__/*' --require src/__tests__/setup.js" | ||
}, | ||
@@ -38,2 +38,5 @@ "keywords": [ | ||
"dependencies": { | ||
"deep-equal": "^1.0.1", | ||
"hoist-non-react-statics": "^1.0.3", | ||
"is-promise": "^2.1.0", | ||
"react-lazy-cache": "^3.0.0" | ||
@@ -50,4 +53,7 @@ }, | ||
"expect": "^1.11.1", | ||
"jsdom": "^7.0.1", | ||
"mocha": "^2.3.3", | ||
"react": "^0.13.3", | ||
"react": "^0.14.0", | ||
"react-addons-test-utils": "^0.14.0", | ||
"react-dom": "^0.14.0", | ||
"react-redux": "^3.1.0", | ||
@@ -54,0 +60,0 @@ "redux": "^3.0.2", |
1023
README.md
@@ -1,2 +0,2 @@ | ||
#redux-form | ||
# redux-form | ||
--- | ||
@@ -13,1019 +13,16 @@ [<img src="http://npm.packagequality.com/badge/redux-form.png" align="right"/>](http://packagequality.com/#?package=redux-form) | ||
`redux-form` works with [React Redux](https://github.com/gaearon/react-redux) to enable an html form in | ||
[React](https://github.com/facebook/react) to use [Redux](https://github.com/gaearon/redux) to store all of its state. | ||
`redux-form` works with [React Redux](https://github.com/rackt/react-redux) to enable an html form in | ||
[React](https://github.com/facebook/react) to use [Redux](https://github.com/rackt/redux) to store all of its state. | ||
## Table of Contents | ||
<img src="logo.png" align="right" height="250" width="250"/> | ||
## This documentation is for v3.0.0! [Click here for `v2.x.x` documentation](https://github.com/erikras/redux-form/tree/v2.4.5). | ||
* [Installation](#installation) | ||
* [Release Notes](https://github.com/erikras/redux-form/releases) | ||
* [Benefits](#benefits) - Why use this library? | ||
* [Unidirectional Data Flow](#unidirectonal-data-flow) | ||
* [Redux Dev Tools](#redux-dev-tools) | ||
* [Stateless Components](#stateless-components) | ||
* [Implementation Guide](#implementation-guide) <-------------- **Start here!** | ||
* [A Simple Form Component](#a-simple-form-component) | ||
* [ES7 Decorator Sugar](#es7-decorator-sugar) - :warning: Experimental! :warning: | ||
* [React Native Support](#react-native-support) | ||
* [Synchronous Validation](#synchronous-validation) - Client Side | ||
* [Asynchronous Validation](#asynchronous-validation) - Server Side | ||
* [Submitting Your Form](#submitting-your-form) | ||
* [Responding to Other Actions](#responding-to-other-actions) | ||
* [Normalizing Form Data](#normalizing-form-data) | ||
* [Editing Multiple Records](#editing-multiple-records) | ||
* [Calculating `props` from Form Data](#calculating-props-from-form-data) | ||
* [Dynamic Forms](#dynamic-forms) | ||
* [Advanced Usage](#advanced-usage) | ||
* [Doing the `connect()`ing Yourself](#doing-the-connecting-yourself) | ||
* [Binding Action Creators](#binding-action-creators) | ||
* [API](#api) | ||
* [`connectReduxForm(config)`](#connectreduxformconfigobject) | ||
* [`reduxForm(config)`](#reduxformconfigobject) | ||
* [`reducer`](#reducer) | ||
* [`reducer.plugin(Object<String, Function>)`](#reducerpluginobjectstring-function) | ||
* [`reducer.normalize(Object<String, Function>)`](#reducerpluginobjectstring-function) | ||
* [`props` passed into your decorated component](#props-passed-into-your-decorated-component) - props provided by | ||
`redux-form` | ||
* [`props` you can pass into your decorated component](#props-you-can-pass-into-your-decorated-component) - extra | ||
functionality! | ||
* [Action Creators](#action-creators) - Advanced | ||
* [Action Types](#action-types) - Advanced | ||
* [Working Demo](#working-demo) | ||
**Dynamic forms are not yet fully supported by `v3.0.0-beta-1`. If you need that functionality, stick | ||
with `v2.x.x` for now.** | ||
--- | ||
[<img src="logo.png" align="right" class="logo" height="151" width="250"/>](http://erikras.github.io/redux-form/) | ||
## Installation | ||
## [Getting Started](http://erikras.github.io/redux-form/#/getting-started) | ||
``` | ||
npm install --save redux-form | ||
``` | ||
## [Examples](http://erikras.github.io/redux-form/#/examples) | ||
## Release Notes | ||
This project follows [SemVer](http://semver.org) and each release is posted on the | ||
[Release Notes](https://github.com/erikras/redux-form/releases) page. | ||
**New releases will be tweeted by [@ReduxForm](https://twitter.com/ReduxForm). Follow it!** | ||
## Benefits | ||
Why would anyone want to do this, you ask? React a perfectly good way of keeping state in each component! The | ||
reasons are threefold. | ||
#### Unidirectional Data Flow | ||
For the same reason that React and Flux is superior to Angular's bidirectional data binding. Tracking down bugs | ||
is much simpler when the data all flows through one dispatcher. | ||
#### Redux Dev Tools | ||
When used in conjunction with [Redux Dev Tools](https://github.com/gaearon/redux-devtools), you can fast forward | ||
and rewind through your form data entry to better find bugs. | ||
#### Stateless Components | ||
By removing the state from your form components, you inherently make them easier to understand, test, and debug. | ||
The React philosophy is to always try to use `props` instead of `state` when possible. | ||
## Implementation Guide | ||
__STEP 1:__ The first thing that you have to do is to give the `redux-form` reducer to Redux. You will only have to do | ||
this | ||
once, no matter how many form components your app uses. | ||
```javascript | ||
import { createStore, combineReducers } from 'redux'; | ||
import { reducer as formReducer } from 'redux-form'; | ||
const reducers = { | ||
// ... your other reducers here ... | ||
form: formReducer // <---- Mounted at 'form'. See note below. | ||
} | ||
const reducer = combineReducers(reducers); | ||
const store = createStore(reducer); | ||
``` | ||
*NOTE* – If you are not [doing the `connect()`ing yourself](#doing-the-connecting-yourself) (and it is recommended that | ||
you do not, unless you have an advanced use case that requires it), _you **must** mount the reducer at `form`_. | ||
__STEP 2:__ Wrap your form component with `connectReduxForm()`. `connectReduxForm()` wraps your form component in a | ||
Higher Order Component that connects to the Redux store and provides functions, as props to your component, for your | ||
form elements to use for sending `onChange` and `onBlur` events, as well as a function to handle synchronous | ||
validation `onSubmit`. Let's look at a simple example. | ||
### A Simple Form Component | ||
You will need to wrap your form component with `redux-form`'s `connectReduxForm()` function. | ||
```javascript | ||
import React, {Component, PropTypes} from 'react'; | ||
import {connectReduxForm} from 'redux-form'; | ||
import validateContact from './validateContact'; | ||
class ContactForm extends Component { | ||
static propTypes = { | ||
fields: PropTypes.object.isRequired, | ||
handleSubmit: PropTypes.func.isRequired | ||
} | ||
render() { | ||
const { fields: {name, address, phone}, handleSubmit } = this.props; | ||
return ( | ||
<form onSubmit={handleSubmit}> | ||
<label>Name</label> | ||
<input type="text" {...name}/> // will pass value, onBlur and onChange | ||
{name.error && name.touched && <div>{name.error}</div>} | ||
<label>Address</label> | ||
<input type="text" {...address}/> // will pass value, onBlur and onChange | ||
{address.error && address.touched && <div>{address.error}</div>} | ||
<label>Phone</label> | ||
<input type="text" {...phone}/> // will pass value, onBlur and onChange | ||
{phone.error && phone.touched && <div>{phone.error}</div>} | ||
<button onClick={handleSubmit}>Submit</button> | ||
</form> | ||
); | ||
} | ||
} | ||
// apply connectReduxForm() and include synchronous validation | ||
ContactForm = connectReduxForm({ | ||
form: 'contact', // the name of your form and the key to | ||
// where your form's state will be mounted | ||
fields: ['name', 'address', 'phone'], // a list of all your fields in your form | ||
validate: validateContact // a synchronous validation function | ||
})(ContactForm); | ||
// export the wrapped component | ||
export default ContactForm; | ||
``` | ||
Notice that we're just using vanilla `<input>` elements there is no state in the `ContactForm` component. | ||
`handleSubmit` will call the function passed into `ContactForm`'s [`onSubmit` prop](#onsubmit-function-optional) **after** validation (both synchronous and asynchronous) completes successfully. | ||
See [Submitting Your Form](#submitting-your-form). | ||
### ES7 Decorator Sugar | ||
Using [ES7 decorator proposal](https://github.com/wycats/javascript-decorators), the example above | ||
could be written as: | ||
```javascript | ||
@connectReduxForm({ | ||
form: 'contact', | ||
fields: ['name', 'address', 'phone'], | ||
validate: validateContact | ||
}) | ||
export default class ContactForm extends Component { | ||
``` | ||
Much nicer, don't you think? | ||
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. | ||
### React Native Support | ||
`redux-form` works just fine on React Native. Just like with `react-redux`, the only change you will need to make to | ||
use `redux-form` with React Native is to import everything from `redux-form/native`, not from `redux-form`. | ||
### Synchronous Validation | ||
You may optionally supply a validation function, which is in the form `({}, {}) => {}` and takes in all | ||
your data and spits out error messages. The first parameter is all the values in your form, and the second is the | ||
props passed into your form component. Your error messages may be strings or arrays of strings (if your field | ||
data is complex). For example: | ||
```javascript | ||
function validateContact(data, props) { | ||
const errors = {}; | ||
if(!data.name) { | ||
errors.name = 'Required'; | ||
} | ||
if(data.address && data.address.length > 50) { | ||
errors.address = 'Must be fewer than 50 characters'; | ||
} | ||
if(!data.phone) { | ||
errors.phone = 'Required'; | ||
} else if(!/\d{3}-\d{3}-\d{4}/.test(data.phone)) { | ||
errors.phone = 'Phone must match the form "999-999-9999"' | ||
} | ||
return errors; | ||
} | ||
``` | ||
You get the idea. | ||
### Asynchronous Validation | ||
Async validation can be achieved by passing in an asynchronous function that returns a Promise that will resolve | ||
to validation errors of the format that the synchronous [validation function](#synchronous-validation) | ||
generates. So this... | ||
```javascript | ||
// apply connectReduxForm() and include synchronous validation | ||
ContactForm = connectReduxForm({ | ||
form: 'contact', | ||
fields: ['name', 'address', 'phone'], | ||
validate: validateContact | ||
})(ContactForm); | ||
``` | ||
...changes to this: | ||
```javascript | ||
function validateContactAsync(data, dispatch) { | ||
return new Promise((resolve, reject) => { | ||
const errors = {}; | ||
// do async validation | ||
resolve(errors); | ||
}); | ||
} | ||
// apply connectReduxForm() and include synchronous AND asynchronous validation | ||
ContactForm = connectReduxForm({ | ||
form: 'contact', | ||
fields: ['name', 'address', 'phone'], | ||
validate: validateContact, | ||
asyncValidate: validateContactAsync | ||
})(ContactForm); | ||
``` | ||
Optionally, if you want asynchronous validation to be triggered when one or more of your form | ||
fields is blurred, you may specify those fields as `asyncBlurFields`. Like so: | ||
```javascript | ||
// will only run async validation when 'name' or 'phone' is blurred | ||
ContactForm = connectReduxForm({ | ||
form: 'contact', | ||
fields: ['name', 'address', 'phone'], | ||
validate: validateContact, | ||
asyncValidate: validateContactAsync, | ||
asyncBlurFields: ['name', 'phone'] | ||
})(ContactForm); | ||
``` | ||
With that call, the asynchronous validation will be called when either `name` or `phone` is blurred. | ||
**NOTE!** If you _only_ want asynchronous validation, you may leave out the synchronous validation function. | ||
And if you only want it to be run on submit, you may leave out the async blur fields, as well. | ||
```javascript | ||
ContactForm = connectReduxForm({ | ||
form: 'contact', | ||
fields: ['name', 'address', 'phone'], | ||
asyncValidate: validateContactAsync | ||
})(ContactForm); | ||
``` | ||
### Submitting Your Form | ||
The recommended way to submit your form is to create your form component as [shown above](#a-simple-form-component), | ||
using the `handleSubmit` prop, and then pass an [`onSubmit` prop](#onsubmit-function-optional) to your form component. | ||
```javascript | ||
import React, {Component, PropTypes} from 'react'; | ||
import {connect} from 'react-redux'; | ||
import {initialize} from 'redux-form'; | ||
class ContactPage extends Component { | ||
static propTypes = { | ||
dispatch: PropTypes.func.isRequired | ||
} | ||
handleSubmit(data) { | ||
console.log('Submission received!', data); | ||
this.props.dispatch(initialize('contact', {})); // clear form | ||
} | ||
render() { | ||
return ( | ||
<div> | ||
<h1>Contact Information</h1> | ||
<ContactForm onSubmit={this.handleSubmit.bind(this)}/> | ||
</div> | ||
); | ||
} | ||
} | ||
export default connect()(ContactPage); // adds dispatch prop | ||
``` | ||
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](#a-simple-form-component): | ||
```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 | ||
Part of the beauty of the flux architecture is that all the reducers (or "stores", in canonical Flux terminology) | ||
receive all the actions, and they can modify their data based on any of them. For example, say you have a login form, | ||
and when your login submission fails, you want to clear out the password field. Your login submission is part of | ||
another reducer/actions system, but your form can still respond. | ||
Rather than just using the vanilla reducer from `redux-form`, you can augment it to do other things by calling | ||
the `plugin()` function. | ||
```javascript | ||
import {reducer as formReducer} from 'redux-form'; | ||
import {AUTH_LOGIN_FAIL} from '../actions/actionTypes'; | ||
const reducers = { | ||
// ... your other reducers here ... | ||
form: formReducer.plugin({ | ||
login: (state, action) => { // <------ 'login' is name of form given to connectReduxForm() | ||
switch(action.type) { | ||
case AUTH_LOGIN_FAIL: | ||
return { | ||
...state, | ||
password: {} // <----- clear password field | ||
}; | ||
default: | ||
return state; | ||
} | ||
} | ||
}) | ||
} | ||
const reducer = combineReducers(reducers); | ||
const store = createStore(reducer); | ||
``` | ||
### Normalizing Form Data | ||
Let's say that you have a form field that only accepts uppercase letters and another one where you want the value to | ||
be formatted in the `999-999-9999` United States phone number format. `redux-form` gives you a way to normalize your | ||
data on every action to the reducer by calling the `normalize()` function on the default reducer. | ||
```javascript | ||
import {reducer as formReducer} from 'redux-form'; | ||
const reducers = { | ||
// ... your other reducers here ... | ||
form: formReducer.normalize({ | ||
contact: { // <--- the form name | ||
licensePlate: (value, previousValue, allValues) => // <--- field normalizer | ||
value && value.toUpperCase(), | ||
phone: (value, previousValue, allValues) => { // <--- field normalizer | ||
if (value) { | ||
const match = value.match(/(\d{3})-?(\d{3})-?(\d{4})/); | ||
if (match) { | ||
return `${match[1]}-${match[2]}-${match[3]}`; | ||
} | ||
} | ||
return value; | ||
} | ||
} | ||
}) | ||
} | ||
const reducer = combineReducers(reducers); | ||
const store = createStore(reducer); | ||
``` | ||
### Editing Multiple Records | ||
Editing multiple records on the same page is trivially easy with `redux-form`. All you have to do is to pass a | ||
unique `formKey` and `initialValues` props into your form element. Let's say we want to edit many contacts on the | ||
same page. | ||
```javascript | ||
import React, {Component, PropTypes} from 'react'; | ||
import ContactForm from './ContactForm'; | ||
export default class ContactsPage extends Component { | ||
static propTypes = { | ||
contacts: PropTypes.array.isRequired // how you pass the data in is up to you | ||
} | ||
handleSubmit(id, data) { | ||
// send to server | ||
} | ||
render() { | ||
const {contacts} = this.props; | ||
return ( | ||
<div> | ||
{contacts.map(contact => | ||
<ContactForm | ||
key={contact.id} // required by react | ||
formKey={String(contact.id)} // required by redux-form | ||
initialValues={contact} // initialize form values | ||
onSubmit={this.handleSubmit.bind(this, contact.id)}/>)} | ||
</div> | ||
); | ||
} | ||
} | ||
``` | ||
### Calculating `props` from Form Data | ||
You may want to have some calculated props, perhaps using [`reselect`](https://github.com/faassen/reselect) | ||
selectors based on the values of the data in your form. You might be tempted to do this in the `mapStateToProps` | ||
given to `connect()`. __This will not work__. The reason is that the form contents in the Redux store are lazily | ||
initialized, so `state.form.contacts.data.name` will fail, because `state.form.contacts` will be `undefined` until the | ||
first form action is dispatched. | ||
The recommended way to accomplish this is to use yet another Higher Order Component decorator, such as | ||
[`map-props`](https://github.com/erikras/map-props), like so: | ||
```javascript | ||
import mapProps from 'map-props'; | ||
... | ||
// FIRST map props | ||
ContactForm = mapProps({ | ||
hasName: props => !!props.name.value | ||
hasPhone: props => !!props.phone.value | ||
})(ContactForm); | ||
// THEN apply connectReduxForm() and include synchronous validation | ||
ContactForm = connectReduxForm({ | ||
form: 'contact', | ||
fields: ['name', 'address', 'phone'], | ||
validate: validateContact | ||
})(ContactForm); | ||
... | ||
``` | ||
Or, in ES7 land... | ||
```javascript | ||
@connectReduxForm({ | ||
form: 'contact', | ||
fields: ['name', 'address', 'phone'], | ||
validate: validateContact | ||
}) | ||
@mapProps({ | ||
hasName: props => !!props.name.value | ||
hasPhone: props => !!props.phone.value | ||
}) | ||
export default class ContactForm extends Component { | ||
``` | ||
--- | ||
### Dynamic Forms | ||
What if you don't know the shape of your form, i.e. what fields are needed, until runtime, maybe based on some data | ||
retrieved from the server? No problem! Because of the functional nature of React, Redux and `redux-form`, you can | ||
define **_and decorate_** your form component at runtime. | ||
```javascript | ||
import React, {Component, PropTypes} from 'react'; | ||
import {connectReduxForm} from 'redux-form'; | ||
class DynamicForm extends Component { | ||
static propTypes = { | ||
formName: PropTypes.string.isRequired, | ||
fieldsNeeded: PropTypes.arrayOf(PropTypes.string).isRequired | ||
} | ||
render() { | ||
const {formName, fieldsNeeded} = this.props; | ||
// define form class | ||
class Form extends Component { | ||
static propTypes = { | ||
fields: PropTypes.object.isRequired | ||
} | ||
render() { | ||
const {fields} = this.props; // passed in by redux-form | ||
return ( | ||
<div> | ||
{Object.keys(fields).map(fieldName => <div key={fieldName}> | ||
<label>{fieldName}</label> | ||
<input type="text" {...fields[fieldName]}/> | ||
</div>)} | ||
</div> | ||
); | ||
} | ||
} | ||
// connect Form to Redux and decorate with redux-form | ||
Form = connectReduxForm({ form: formName, fields: fieldsNeeded })(Form); | ||
// render connected and decorated form | ||
return <Form/>; | ||
} | ||
} | ||
``` | ||
--- | ||
## Advanced Usage | ||
#### Doing the `connect()`ing Yourself | ||
If, for some reason, you cannot mount the `redux-form` reducer at `form` in Redux, you may mount it anywhere else and | ||
do the `connect()` call yourself. Rather than wrap your form component with `redux-form`'s `connectReduxForm()`, you | ||
will need to wrap your form component *both* with | ||
[React Redux](https://github.com/gaearon/react-redux)'s `connect()` function *and* with `redux-form`'s | ||
`reduxForm()` function. | ||
```javascript | ||
import React, {Component, PropTypes} from 'react'; | ||
import {connect} from 'react-redux'; | ||
import {reduxForm} from 'redux-form'; | ||
import validateContact from './validateContact'; | ||
class ContactForm extends Component { | ||
//... | ||
} | ||
// apply reduxForm() and include synchronous validation | ||
// note: we're using reduxForm, not connectReduxForm | ||
ContactForm = reduxForm({ | ||
form: 'contact', | ||
fields: ['name', 'address', 'phone'], | ||
validate: validateContact | ||
})(ContactForm); | ||
// ------- HERE'S THE IMPORTANT BIT ------- | ||
function mapStateToProps(state, ownProps) { | ||
// this is React Redux API: https://github.com/rackt/react-redux | ||
// for example, you may use ownProps here to refer to the props passed from parent. | ||
return { | ||
form: state.placeWhereYouMountedFormReducer[ownProps.something] | ||
}; | ||
} | ||
// apply connect() to bind it to Redux state | ||
ContactForm = connect(mapStateToProps)(ContactForm); | ||
// export the wrapped component | ||
export default ContactForm; | ||
``` | ||
As you can see, `connectReduxForm()` is a tiny wrapper over `reduxForm()` that applies `connect()` for you. | ||
##### Binding Action Creators | ||
When doing the `connect()`ing yourself, if your form component also needs other redux action creators - _and you will | ||
if you are performing your server submit in your form component_ - you cannot simply use the default | ||
`bindActionCreators()` from `redux`, because that will remove `dispatch` from the props the `connect()` passes | ||
along, and `reduxForm()` needs `dispatch`. You will need to also include `dispatch` in your `mapDispatchToProps()` | ||
function. So change this... | ||
```javascript | ||
import {bindActionCreators} from `redux`; | ||
... | ||
function mapDispatchToProps(dispatch) { | ||
return bindActionCreators(actionCreators, dispatch); | ||
} | ||
ContactForm = connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(ContactForm); | ||
``` | ||
...to... | ||
```javascript | ||
import {bindActionCreators} from `redux`; | ||
... | ||
function mapDispatchToProps(dispatch) { | ||
return { | ||
...bindActionCreators(actionCreators, dispatch), | ||
dispatch // <----- passing dispatch, too | ||
}; | ||
} | ||
ContactForm = connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
)(ContactForm); | ||
``` | ||
--- | ||
## API | ||
### `connectReduxForm(config:Object)` | ||
#### -`config.form : string` [optional] | ||
> the name of your form and the key to where your form's state will be mounted, under the `redux-form` reducer, in the | ||
Redux store. If you do not provide this, you must pass it in as a `formName` prop to your component. | ||
#### -`config.fields : Array<string>` | ||
> a list of all your fields in your form. This is used for marking all of the fields as `touched` on submit. | ||
#### -`config.validate : Function` [optional] | ||
> your [synchronous validation function](#synchronous-validation). Defaults to `() => ({})` THe first parameter will | ||
be the form's values, and the second will be the props passed into the form component. | ||
#### -`config.readonly : boolean` [optional] | ||
> if `true`, the decorated component will not be passed any of the `handleX` or `onX` props that will allow it to | ||
mutate the state. Useful for decorating another component that is not your form, but that needs to know about the | ||
state of your form. | ||
#### -`config.touchOnBlur : boolean` [optional] | ||
> marks fields to touched when the blur action is fired. Defaults to `true` | ||
#### -`config.touchOnChange : boolean` [optional] | ||
> marks fields to touched when the change action is fired. Defaults to `false` | ||
#### -`config.asyncValidate : Function` [optional] | ||
> a function that takes all the form data, and the `dispatch` function and returns a Promise that will resolve to an | ||
object of validation errors in the form `{ field1: <string>, field2: <string>, valid: <boolean> }` just like the | ||
[synchronous validation function](#synchronous-validation). See | ||
[Aynchronous Validation](#asynchronous-validation) for more details. | ||
#### -`config.asyncBlurFields : Array<String>` [optional] | ||
> field names for which `handleBlur` should trigger a call to the `asyncValidate` function. Defaults to `[]`. | ||
--- | ||
### `reduxForm(config:Object)` | ||
> __[NOT RECOMMENDED]__ `reduxForm()` has the same API as | ||
[`connectReduxForm()`](#connectreduxformformnamestring-fieldsarrayltstringgt-validatefunction-touchonblurboolean-touchonchangeboolean) | ||
except that ___you must [wrap the component in `connect()` yourself](#doing-the-connecting-yourself)___. | ||
--- | ||
### `reducer` | ||
> The form reducer. Should be given to mounted to your Redux state at `form`. | ||
--- | ||
### `reducer.plugin(Object<String, Function>)` | ||
> Returns a form reducer that will also pass each action through additional reducers specified. The parameter should | ||
be an object mapping from `formName` to a `(state, action) => nextState` reducer. **The `state` passed to each reducer | ||
will only be the slice that pertains to that form.** See [Responding to Other Actions](#responding-to-other-actions). | ||
--- | ||
### `reducer.normalize(Object<String, Object<String, Function>>)` | ||
> Returns a form reducer that will also pass each form value through the normalizing functions provided. The | ||
parameter is an object mapping from `formName` to an object mapping from `fieldName` to a normalizer function. The | ||
normalizer function is given three parameters and expected to return the normalized value of the field. | ||
See [Normalizing Form Data](#normalizing-form-data). | ||
##### -`value : string` | ||
> The current value of the field | ||
##### -`previousValue : string` | ||
> The previous value of the field before the current action was dispatched | ||
##### -`allValues : Object<string, string>` | ||
> All the values of the current form | ||
--- | ||
### `props` passed into your decorated component | ||
The props passed into your decorated component by `redux-form` will be: | ||
#### -`active : String` | ||
> the name of the currently active (with focus) field | ||
#### -`asyncValidate : Function` | ||
> a function that may be called to initiate asynchronous validation if asynchronous validation is enabled | ||
#### -`asyncValidating : boolean` | ||
> `true` if the asynchronous validation function has been called but has not yet returned. | ||
#### -`destroyForm() : Function` | ||
> Destroys the form state in the Redux store. _Should be called in `componentWillUnmount()` for proper memory | ||
management._ | ||
#### -`dirty : boolean` | ||
> `true` if the form data has changed from its initialized values. Opposite of `pristine`. | ||
#### -`error : String` | ||
> a generic error for the entire form given by the `_error` key in the result from the synchronous validation function, | ||
the asynchronous validation, or the rejected promise from `handleSubmit`. | ||
#### -`fields : Object` | ||
> The form data, in the form `{ field1: <Object>, field2: <Object> }`, where each field `Object` has the following | ||
properties: | ||
##### ---`active : boolean` | ||
> `true` if this field currently has focus. It will only work if you are passing `handleFocus` to your input element. | ||
##### ---`checked : boolean?` | ||
> An alias for `value` _only when `value` is a boolean_. Provided for convenience of destructuring the whole field | ||
object into the props of a form element. | ||
##### ---`dirty : boolean` | ||
> `true` if the field value has changed from its initialized value. Opposite of `pristine`. | ||
##### ---`error : String?` | ||
> The error for this field if its value is not passing validation. Both synchronous and asynchronous validation | ||
errors will be reported here. | ||
##### ---`handleBlur : Function` | ||
> A function to call when the form field loses focus. It expects to receive the | ||
[React SyntheticEvent](http://facebook.github.io/react/docs/events.html) and is meant to be passed to the form | ||
element's `onBlur` prop. _Alternatively: you may pass the value directly into `handleBlur` to set the value on in the | ||
form._ | ||
##### ---`handleChange : Function` | ||
> A function to call when the form field is changed. It expects to receive the | ||
[React SyntheticEvent](http://facebook.github.io/react/docs/events.html) and is meant to be passed to the form | ||
element's `onChange` prop. _Alternatively: you may pass the value directly into `handleChange` to set the value on in | ||
the form._ | ||
##### ---`handleFocus : Function` | ||
> A function to call when the form field receives focus. It is meant to be passed to the form | ||
element's `onFocus` prop. | ||
##### ---`invalid : boolean` | ||
> `true` if the field value fails validation (has a validation error). Opposite of `valid`. | ||
##### ---`name : String` | ||
> The name of the field. It will be the same as the key in the `fields` Object, but useful if bundling up a field to | ||
send down to a specialized input component. | ||
##### ---`onBlur : Function` | ||
> An alias for `handleBlur`. Provided for convenience of destructuring the whole field object into the props of a | ||
form element. | ||
##### ---`onChange : Function` | ||
> An alias for `handleChange`. Provided for convenience of destructuring the whole field object into the props of a | ||
form element. | ||
##### ---`onFocus : Function` | ||
> An alias for `handleFocus`. Provided for convenience of destructuring the whole field object into the props of a | ||
form element. | ||
##### ---`onUpdate : Function` | ||
> An alias for `handleChange`. Provided for convenience of destructuring the whole field object into the props of a | ||
form element. Added to provide out-of-the-box support for [Belle](http://nikgraf.github.io/belle/) components' | ||
[`onUpdate` API](https://github.com/nikgraf/belle/issues/58). | ||
##### ---`pristine : boolean` | ||
> `true` if the field value is the same as its initialized value. Opposite of `dirty`. | ||
##### ---`touched : boolean` | ||
> `true` if the field has been touched. | ||
##### ---`valid : boolean` | ||
> `true` if the field value passes validation (has no validation errors). Opposite of `invalid`. | ||
##### ---`value: any` | ||
> The value of this form field. It will be a boolean for checkboxes, and a string for all other input types. | ||
##### ---`visited: boolean` | ||
> `true` if this field has ever had focus. It will only work if you are passing `handleFocus` to your input element. | ||
#### -`handleBlur(field:string, value:any?) : Function` | ||
> Returns a `handleBlur` function for the field passed. `handleBlur('age')` returns `fields.age.handleBlur`. If you | ||
pass it both a field and a value, it will set that value in the form. If you give it just a field, it will return a | ||
function that will set the value when either given the value or an event from an input. | ||
#### -`handleChange(field:string, value:any?) : Function` | ||
> Returns a `handleChange` function for the field passed. `handleChange('age')` returns `fields.age.handleChange`. If | ||
you pass it both a field and a value, it will set that value in the form. If you give it just a field, it will return a | ||
function that will set the value when either given the value or an event from an input. | ||
#### -`handleFocus(field:string) : Function` | ||
> Returns a `handleFocus` function for the field passed. `handleFocus('age')` returns `fields.age.handleFocus`, a | ||
function to be passsed to the `onFocus` prop of your input component. | ||
#### -`handleSubmit : Function` | ||
> a function meant to be passed to `<form onSubmit={handleSubmit}>` or to `<button onClick={handleSubmit}>`. | ||
It will run validation, both sync and async, and, if the form is valid, it will call `this.props.onSubmit(data)` | ||
with the contents of the form data. | ||
> 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))}>` | ||
> If your `onSubmit` function returns a promise, the [`submitting`](#-submitting--boolean) property will be set to | ||
`true` until the promise has been resolved or rejected. If it is rejected with an object matching | ||
`{ field1: 'error', field2: 'error' }` then the submission errors will be added to each field (to the | ||
[`error`](#---error--string) prop) just like async validation errors are. If there is an error that is not specific | ||
to any field, but applicable to the entire form, you may pass that as if it were the error for a field called `_error`, | ||
and it will be given as the `error` prop. | ||
#### -`initializeForm(data:Object) : Function` | ||
> Initializes the form data to the given values. All `dirty` and `pristine` state will be determined by | ||
comparing the current data with these initialized values. | ||
#### -`invalid : boolean` | ||
> `true` if the form has validation errors. Opposite of `valid`. | ||
#### -`pristine: boolean` | ||
> `true` if the form data is the same as its initialized values. Opposite of `dirty`. | ||
#### -`resetForm() : Function` | ||
> Resets all the values in the form to the initialized state, making it pristine again. | ||
#### -`formKey : String` | ||
> The same `formKey` prop that was passed in. See [Editing Multiple Records](#editing-multiple-records). | ||
#### -`submitting : boolean` | ||
> Whether or not your form is currently submitting. This prop will only work if you have passed an | ||
`onSubmit` function that returns a promise. It will be true until the promise is resolved or rejected. | ||
#### -`touch(...field:string) : Function` | ||
> Marks the given fields as "touched" to show errors. | ||
#### -`touchAll() : Function` | ||
> Marks all fields as "touched" to show errors. should be called on form submission. | ||
#### -`untouch(...field:string) : Function` | ||
> Clears the "touched" flag for the given fields | ||
#### -`untouchAll() : Function` | ||
> Clears the "touched" flag for the all fields | ||
#### -`valid : boolean` | ||
> `true` if the form passes validation (has no validation errors). Opposite of `invalid`. | ||
#### -`values : Object` | ||
> All of your values in the form `{ field1: <string>, field2: <string> }`. | ||
--- | ||
### `props` you can pass into your decorated component | ||
The props that you can pass into decorated component by `redux-form` will be: | ||
#### -`formKey : String` [optional] | ||
> a unique key for the subform this component will be editing. See | ||
[Editing Multiple Records](#editing-multiple-records). | ||
#### -`formName : String` [optional] | ||
> the name of your form and the key to where your form's state will be mounted, under the `redux-form` reducer, in the | ||
Redux store. Will overwrite any [`config.form`](#-configform--string-optional) value that was passed to | ||
[`connectReduxForm(config)`](#connectreduxformconfigobject). | ||
#### -`initialValues : Object` [optional] | ||
> the values with which to initialize your form in `componentWillMount`. Particularly useful when | ||
[Editing Multiple Records](#editing-multiple-records), but can also be used with single-record forms. The values | ||
should be in the form `{ field1: 'value1', field2: 'value2' }`. | ||
#### -`onSubmit : Function` [optional] | ||
> the function to call with the form data when the `handleSubmit` is fired from within the form component. If you | ||
do not specify it as a prop here, you must pass it as a parameter to `handleSubmit` inside your form component. | ||
> If your `onSubmit` function returns a promise, the [`submitting`](#-submitting--boolean) property will be set to | ||
`true` until the promise has been resolved or rejected. If it is rejected with an object matching | ||
`{ field1: 'error', field2: 'error' }` then the submission errors will be added to each field (to the | ||
[`error`](#---error--string) prop) just like async validation errors are. If there is an error that is not specific | ||
to any field, but applicable to the entire form, you may pass that as if it were the error for a field called `_error`, | ||
and it will be given as the `error` prop. | ||
--- | ||
### Action Creators | ||
`redux-form` exports all of its internal action creators, allowing you complete control to dispatch any action | ||
you wish. However, **it is *highly* recommended that you use the actions passed as props to your component | ||
for most of your needs.** | ||
#### -`blur(form:String, field:String, value:String)` | ||
> Saves the value and, if you have `touchOnBlur` enabled, marks the field as `touched`. | ||
#### -`change(form:String, field:String, value:String)` | ||
> Saves the value and, if you have `touchOnChange` enabled, marks the field as `touched`. | ||
#### -`focus(form:String, field:String)` | ||
> Marks the given field as `active` and `visited`. | ||
#### -`initialize(form:String, data:Object)` | ||
> Sets the initial values in the form with which future data values will be compared to calculate | ||
`dirty` and `pristine`. The `data` parameter should only contain `String` values. | ||
#### -`initializeWithKey(form:String, formKey, data:Object)` | ||
> Used when editing multiple records with the same form component. See | ||
[Editing Multiple Records](#editing-multiple-records). | ||
#### -`reset(form:String)` | ||
> Resets the values in the form back to the values past in with the most recent `initialize` action. | ||
#### -`startAsyncValidation(form:String)` | ||
> Flips the `asyncValidating` flag `true`. | ||
#### -`startSubmit(form:String)` | ||
> Flips the `submitting` flag `true`. | ||
#### -`stopSubmit(form:String, errors:Object)` | ||
> Flips the `submitting` flag `false` and populates `submitError` for each field. | ||
#### -`stopAsyncValidation(form:String, errors:Object)` | ||
> Flips the `asyncValidating` flag `false` and populates `asyncError` for each field. | ||
#### -`touch(form:String, ...fields:String)` | ||
> Marks all the fields passed in as `touched`. | ||
#### -`untouch(form:String, ...fields:String)` | ||
> Resets the 'touched' flag for all the fields passed in. | ||
#### -`destroy(form:String)` | ||
> Destroys the form, removing all its state. | ||
--- | ||
### Action Types | ||
`redux-form` exports all of its | ||
[internal action types](https://github.com/erikras/redux-form/blob/master/src/actionTypes.js), | ||
so that you can listen for them in another reducer if you wish. To import the `FOCUS` action type, for instance, you | ||
would do: | ||
```javascript | ||
import {actionTypes: {FOCUS}} from 'redux-form'; | ||
``` | ||
--- | ||
## Working Demo | ||
Check out the | ||
[react-redux-universal-hot-example project](https://github.com/erikras/react-redux-universal-hot-example) to see | ||
`redux-form` in action. | ||
This is an extremely young library, so the API may change. Comments and feedback welcome. | ||
## [API](http://erikras.github.io/redux-form/#/api) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
331085
58
7222
6
18
2
28
1
+ Addeddeep-equal@^1.0.1
+ Addedis-promise@^2.1.0
+ Addedhoist-non-react-statics@1.2.0(transitive)
+ Addedis-promise@2.2.2(transitive)