redux-form
Advanced tools
Comparing version 1.3.4 to 1.4.0
@@ -1,1 +0,1 @@ | ||
!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(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(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 n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=n(5),a=o(i),s=n(6),c=o(s),f=n(14),l=o(f),d=n(1),p=o(d),h=n(4),y=o(h),v=n(3),m=r(v),g=u({},p.default(u({},m,{initializeWithKey:function(t,e){return y.default(m.initialize,{key:t})(e)}}),function(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];return y.default(t,{form:e}).apply(void 0,r)}})),b=g.blur,_=g.change,O=g.initialize,T=g.initializeWithKey,w=g.reset,S=g.startAsyncValidation,x=g.stopAsyncValidation,A=g.touch,j=g.untouch;e.blur=b,e.change=_,e.connectReduxForm=l.default,e.reducer=a.default,e.initialize=O,e.initializeWithKey=T,e.reset=w,e.startAsyncValidation=S,e.stopAsyncValidation=x,e.touch=A,e.untouch=j,e.default=c.default},function(t,e){"use strict";function n(t,e){return Object.keys(t).reduce(function(n,o){var u;return r({},n,(u={},u[o]=e(t[o],o),u))},{})}e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=n,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var n="redux-form/BLUR";e.BLUR=n;var r="redux-form/CHANGE";e.CHANGE=r;var o="redux-form/INITIALIZE";e.INITIALIZE=o;var u="redux-form/RESET";e.RESET=u;var i="redux-form/START_ASYNC_VALIDATION";e.START_ASYNC_VALIDATION=i;var a="redux-form/START_SUBMIT";e.START_SUBMIT=a;var s="redux-form/STOP_ASYNC_VALIDATION";e.STOP_ASYNC_VALIDATION=s;var c="redux-form/STOP_SUBMIT";e.STOP_SUBMIT=c;var f="redux-form/TOUCH";e.TOUCH=f;var l="redux-form/UNTOUCH";e.UNTOUCH=l},function(t,e,n){"use strict";function r(t,e){return{type:p.BLUR,field:t,value:e}}function o(t,e){return{type:p.CHANGE,field:t,value:e}}function u(t){return{type:p.INITIALIZE,data:t}}function i(){return{type:p.RESET}}function a(){return{type:p.START_ASYNC_VALIDATION}}function s(){return{type:p.START_SUBMIT}}function c(t){return{type:p.STOP_ASYNC_VALIDATION,errors:t}}function f(){return{type:p.STOP_SUBMIT}}function l(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return{type:p.TOUCH,fields:e}}function d(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return{type:p.UNTOUCH,fields:e}}e.__esModule=!0,e.blur=r,e.change=o,e.initialize=u,e.reset=i,e.startAsyncValidation=a,e.startSubmit=s,e.stopAsyncValidation=c,e.stopSubmit=f,e.touch=l,e.untouch=d;var p=n(2)},function(t,e,n){"use strict";function r(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 n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=o;var i=n(1),a=r(i);t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function u(){var t,e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=n.form,u=n.key,i=o(n,["form","key"]);if(!r)return e;if(u){var s,c;return a({},e,(c={},c[r]=a({},e[r],(s={},s[u]=p((e[r]||{})[u],i),s)),c))}return a({},e,(t={},t[r]=p(e[r],i),t))}function i(t){return t.plugin=function(t){var e=this;return i(function(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e(n,r);return a({},o,f.default(t,function(t,e){return t(o[e]||l,r)}))})},t.normalize=function(t){var e=this;return i(function(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e(n,r);return a({},o,f.default(t,function(t,e){return a({},o[e],f.default(t,function(t,r){return a({},o[e][r],{value:t(o[e][r]?o[e][r].value:void 0,n[e]&&n[e][r]?n[e][r].value:void 0,d(o[e]))})}))}))})},t}e.__esModule=!0;var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=n(2),c=n(1),f=r(c),l={_asyncValidating:!1,_submitting:!1};e.initialState=l;var d=function(t){return Object.keys(t).reduce(function(e,n){var r;return"_"===n[0]?e:a({},e,(r={},r[n]=t[n].value,r))},{})},p=function(){var t,e,n=arguments.length<=0||void 0===arguments[0]?l:arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];switch(r.type){case s.BLUR:return a({},n,(t={},t[r.field]=a({},n[r.field],{value:r.value,touched:!(!r.touch&&!(n[r.field]||{}).touched)}),t));case s.CHANGE:return a({},n,(e={},e[r.field]=a({},n[r.field],{value:r.value,touched:!(!r.touch&&!(n[r.field]||{}).touched),asyncError:null}),e));case s.INITIALIZE:return a({},f.default(r.data,function(t){return{initial:t,value:t}}),{_asyncValidating:!1,_submitting:!1});case s.RESET:return a({},f.default(n,function(t,e){return"_"===e[0]?t:{initial:t.initial,value:t.initial}}),{_asyncValidating:!1,_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(r.errors,function(t,e){return a({},n[e],{asyncError:t})}),{_asyncValidating:!1});case s.STOP_SUBMIT:return a({},n,{_submitting:!1});case s.TOUCH:return a({},n,r.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,r.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,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}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,e,n){if(t&&t[e]){if(!n)return t[e];if(t[e][n])return t[e][n]}return j.initialState}function c(t,e){if(void 0!==t||!e)return t;if(void 0===e.target)return e;var n=e.target,r=n.type,o=n.value,u=n.checked;return"checkbox"===r?u:o}function f(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];return e&&e.preventDefault?(e.preventDefault(),e.stopPropagation(),t.apply(void 0,r)):t.apply(void 0,[e].concat(r))}}function l(t){return t?void 0===t.valid?!Object.keys(t):!!t.valid:!0}function d(t){var e=h({validate:function(){return{}},touchOnBlur:!0,touchOnChange:!1,asyncValidate:null,asyncBlurFields:[]},t),n=e.form,r=e.fields,o=e.validate,d=e.touchOnBlur,m=e.touchOnChange,b=e.asyncValidate,O=e.asyncBlurFields;if(!r||!r.length)throw new Error('No fields passed to redux-form. Must be passed to connectReduxForm({fields: ["my", "field", "names"]})');return function(t){return function(e){function w(){i(this,w),e.apply(this,arguments)}return a(w,e),w.prototype.componentWillMount=function(){var t=this.props,e=t.initialValues,n=t.dispatch,r=t.formName,o=t.formKey;if(e){var u=o?A.default(g,{form:r,key:o}):A.default(g,{form:r}),i=u.initialize;n(i(e))}},w.prototype.render=function(){function e(){_(k(y));var t=b(I);if(!t||"function"!=typeof t.then)throw new Error("asyncValidate function passed to reduxForm must return a promise!");return t.then(function(t){return _(U(t)),l(t)},function(t){throw _(U({})),new Error("redux-form: Asynchronous validation failed: "+t)})}var n=this,i=this.props,a=i.formName,p=i.form,y=i.formKey,_=i.dispatch,w=u(i,["formName","form","formKey","dispatch"]);if(!a)throw new Error('No form name given to redux-form. Must be passed to connectReduxForm({form: [form name]}) or as a "formName" prop');var x=s(p,a,y),j=!0,P=!0,I=r.reduce(function(t,e){var n;return h({},t,(n={},n[e]=x[e]?x[e].value:void 0,n))},{}),M=y?A.default(g,{form:a,key:y}):A.default(g,{form:a}),E=M.blur,N=M.change,C=M.initialize,R=M.reset,k=M.startAsyncValidation,V=M.startSubmit,U=M.stopAsyncValidation,D=M.stopSubmit,B=M.touch,L=M.untouch,z=function(t,n){return function(r){var u=c(n,r),i=A.default(E,{touch:d});if(_(i(t,u)),b&&~O.indexOf(t)){var a,s=o(h({},I,(a={},a[t]=u,a)))[t];s||e()}}},F=function(t,e){return function(n){var r=A.default(N,{touch:m});_(r(t,c(e,n)))}},H=function(t){var o=function(t){return function(n){n&&n.preventDefault&&(n.preventDefault(),n.stopPropagation());var o=function(){var e=t(I);if(e&&"function"==typeof e.then){var n=function(t){return _(D()),t};_(V()),e.then(n,n)}};return _(B.apply(void 0,r)),j?b?e().then(function(t){return j&&t?o(I):void 0}):o(I):void 0}};if("function"==typeof t)return o(t);var u=n.props.onSubmit;if(!u)throw new Error("You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop");o(u)(t)},W=o(I),q=r.reduce(function(t,e){var n,r=x[e]||{},o=T.default(r.value,r.initial),u=W[e]||r.asyncError,i=S.default(u);return i||(j=!1),o||(P=!1),h({},t,(n={},n[e]={checked:"boolean"==typeof r.value?r.value:void 0,dirty:!o,error:u,handleBlur:z(e),handleChange:F(e),invalid:!i,name:e,onBlur:z(e),onChange:F(e),pristine:o,touched:r.touched,valid:i,value:r.value},n))},{});return v.default.createElement(t,h({asyncValidating:x._asyncValidating,dirty:!P,fields:q,formKey:y,invalid:!j,pristine:P,submitting:x._submitting,valid:j,values:I,asyncValidate:f(e),handleBlur:f(z),handleChange:f(F),handleSubmit:f(H),initializeForm:f(function(t){return _(C(t))}),resetForm:f(function(){return _(R())}),touch:f(function(){return _(B.apply(void 0,arguments))}),touchAll:f(function(){return _(B.apply(void 0,r))}),untouch:f(function(){return _(L.apply(void 0,arguments))}),untouchAll:f(function(){return _(untouchAll.apply(void 0,r))}),dispatch:_},w))},p(w,null,[{key:"displayName",value:"ReduxForm("+_.default(t)+")",enumerable:!0},{key:"DecoratedComponent",value:t,enumerable:!0},{key:"propTypes",value:{formName:y.PropTypes.string,formKey:y.PropTypes.string,form:y.PropTypes.object,onSubmit:y.PropTypes.func,dispatch:y.PropTypes.func.isRequired,initialValues:y.PropTypes.object},enumerable:!0},{key:"defaultProps",value:{formName:n},enumerable:!0}]),w}(y.Component)}}e.__esModule=!0;var p=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),h=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=d;var y=n(13),v=o(y),m=n(3),g=r(m),b=n(15),_=o(b),O=n(16),T=o(O),w=n(17),S=o(w),x=n(4),A=o(x),j=n(5);t.exports=e.default},function(t,e){"use strict";function n(t){return t.shape({subscribe:t.func.isRequired,dispatch:t.func.isRequired,getState:t.func.isRequired})}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){function n(){return f}function r(t){return l.push(t),function(){var e=l.indexOf(t);l.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(d)throw new Error("Reducers may not dispatch actions.");try{d=!0,f=c(f,t)}finally{d=!1}return l.slice().forEach(function(t){return t()}),t}function u(){return c}function s(t){c=t,o({type:a.INIT})}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var c=t,f=e,l=[],d=!1;return o({type:a.INIT}),{dispatch:o,subscribe:r,getState:n,getReducer:u,replaceReducer:s}}e.__esModule=!0,e.default=o;var u=n(10),i=r(u),a={INIT:"@@redux/INIT"};e.ActionTypes=a},function(t,e){"use strict";function n(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return e.reduceRight(function(t,e){return e(t)})}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){"use strict";function n(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 n=e.constructor;return"function"==typeof n&&n instanceof n&&r(n)===r(Object)}e.__esModule=!0,e.default=n;var r=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function n(t,e){return Object.keys(t).reduce(function(n,r){return n[r]=e(t[r],r),n},{})}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){function n(){c=!1,i.length?s=i.concat(s):f=-1,s.length&&r()}function r(){if(!c){var t=setTimeout(n);c=!0;for(var e=s.length;e;){for(i=s,s=[];++f<e;)i[f].run();f=-1,e=s.length}i=null,c=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function u(){}var i,a=t.exports={},s=[],c=!1,f=-1;a.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new o(t,e)),1!==s.length||c||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=u,a.addListener=u,a.once=u,a.off=u,a.removeListener=u,a.removeAllListeners=u,a.emit=u,a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return function(t){return e.reduce(function(t,e){return e(t)},t)}}function u(){return o(s.default.apply(void 0,arguments),c)}e.__esModule=!0,e.default=u;var i=n(21),a=n(6),s=r(a),c=i.connect(function(t){return{form:t.form}});t.exports=e.default},function(t,e){"use strict";function n(t){return t.displayName||t.name||"Component"}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){"use strict";function n(t,e){if(t===e)return!0;if(t&&"object"==typeof t){if(!e||"object"!=typeof e)return!1;for(var r=Object.keys(e),o=0;o<r.length;o++){var u=r[o];if(!n(t[u],e[u]))return!1}}else if(t||e)return t===e;return!0}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){"use strict";function n(t){return Array.isArray(t)?t.reduce(function(t,e){return t&&!e},!0):!t}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=i.default(t),n=s.default(t);return{Provider:e,connect:n}}e.__esModule=!0,e.default=o;var u=n(20),i=r(u),a=n(19),s=r(a);t.exports=e.default},function(t,e,n){(function(r){"use strict";function o(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 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)}function a(t){return t.displayName||t.name||"Component"}function s(t){var e=t.Component,n=t.PropTypes,o=d.default(n);return function(n,s,l){function d(t,e){var n=t.getState(),r=j?b(n,e):b(n);return _.default(v.default(r),"`mapStateToProps` must return an object. Instead received %s.",r),r}function p(t,e){var n=t.dispatch,r=P?x(n,e):x(n);return _.default(v.default(r),"`mapDispatchToProps` must return an object. Instead received %s.",r),r}function y(t,e,n){var r=A(t,e,n);return _.default(v.default(r),"`mergeProps` must return an object. Instead received %s.",r),r}var m=Boolean(n),b=n||O,x=v.default(s)?g.default(s):s||T,A=l||w,j=b.length>1,P=x.length>1,I=S++;return function(n){var s=function(e){function r(t,n){u(this,r),e.call(this,t,n),this.version=I,this.store=t.store||n.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=d(this.store,t),this.dispatchProps=p(this.store,t),this.state={props:this.computeNextState()}}return i(r,e),r.prototype.shouldComponentUpdate=function(t,e){return!h.default(this.state.props,e.props)},c(r,null,[{key:"displayName",value:"Connect("+a(n)+")",enumerable:!0},{key:"WrappedComponent",value:n,enumerable:!0},{key:"contextTypes",value:{store:o},enumerable:!0},{key:"propTypes",value:{store:o},enumerable:!0}]),r.prototype.computeNextState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];return y(this.stateProps,this.dispatchProps,t)},r.prototype.updateStateProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=d(this.store,t);return h.default(e,this.stateProps)?!1:(this.stateProps=e,!0)},r.prototype.updateDispatchProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=p(this.store,t);return h.default(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},r.prototype.updateState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=this.computeNextState(t);h.default(e,this.state.props)||this.setState({props:e})},r.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},r.prototype.trySubscribe=function(){m&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},r.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},r.prototype.componentDidMount=function(){this.trySubscribe()},r.prototype.componentWillReceiveProps=function(t){h.default(t,this.props)||(j&&this.updateStateProps(t),P&&this.updateDispatchProps(t),this.updateState(t))},r.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},r.prototype.handleChange=function(){this.updateStateProps()&&this.updateState()},r.prototype.getWrappedInstance=function(){return this.refs.wrappedInstance},r.prototype.render=function(){return t.createElement(n,f({ref:"wrappedInstance"},this.state.props))},r}(e);return"undefined"!=typeof r&&"undefined"!=typeof r.env,"undefined"!=typeof __DEV__&&__DEV__&&(s.prototype.componentWillUpdate=function(){this.version!==I&&(this.version=I,this.trySubscribe(),this.updateStateProps(),this.updateDispatchProps(),this.updateState())}),s}}}e.__esModule=!0;var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=s;var l=n(7),d=o(l),p=n(23),h=o(p),y=n(22),v=o(y),m=n(24),g=o(m),b=n(25),_=o(b),O=function(){return{}},T=function(t){return{dispatch:t}},w=function(t,e,n){return f({},n,t,e)},S=0;t.exports=e.default}).call(e,n(12))},function(t,e,n){"use strict";function r(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!1;var n=e.split("."),r=parseInt(n[0],10),o=parseInt(n[1],10);return 0===r&&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 n(){!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."))}var r=t.Component,a=t.PropTypes,c=t.Children,l=f.default(a),d=i(t),p=!1;return function(t){function r(e,n){o(this,r),t.call(this,e,n),this.state={store:e.store}}return u(r,t),r.prototype.getChildContext=function(){return{store:this.state.store}},s(r,null,[{key:"childContextTypes",value:{store:l.isRequired},enumerable:!0},{key:"propTypes",value:{store:l.isRequired,children:(d?a.func:a.element).isRequired},enumerable:!0}]),r.prototype.componentWillReceiveProps=function(t){var e=this.state.store,n=t.store;if(e!==n){var r=n.getReducer();e.replaceReducer(r)}},r.prototype.render=function(){var t=this.props.children;return"function"==typeof t?(e(),t=t()):n(),c.only(t)},r}(r)}e.__esModule=!0;var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();e.default=a;var c=n(7),f=r(c);t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=n(13),u=r(o),i=n(18),a=r(i),s=a.default(u.default),c=s.Provider,f=s.connect;e.Provider=c,e.connect=f},function(t,e){"use strict";function n(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 n=e.constructor;return"function"==typeof n&&n instanceof n&&r(n)===r(Object)}e.__esModule=!0,e.default=n;var r=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function n(t,e){if(t===e)return!0;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=Object.prototype.hasOwnProperty,u=0;u<n.length;u++)if(!o.call(e,n[u])||t[n[u]]!==e[n[u]])return!1;return!0}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return function(e){return o.bindActionCreators(t,e)}}e.__esModule=!0,e.default=r;var o=n(26);t.exports=e.default},function(t,e,n){"use strict";var r=function(t,e,n,r,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=[n,r,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=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=n(8),u=r(o),i=n(29),a=r(i),s=n(28),c=r(s),f=n(27),l=r(f),d=n(9),p=r(d);e.createStore=u.default,e.combineReducers=a.default,e.bindActionCreators=c.default,e.applyMiddleware=l.default,e.compose=p.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return function(t){return function(n,r){var o=t(n,r),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.concat([o.dispatch])),u({},o,{dispatch:i})}}}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=o;var i=n(9),a=r(i);t.exports=e.default},function(t,e,n){"use strict";function r(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)throw new Error("bindActionCreators expected an object or a function, instead received "+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=n(11),a=r(i);t.exports=e.default},function(t,e,n){(function(r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var n=e&&e.type,r=n&&'"'+n.toString()+'"'||"an action";return'Reducer "'+t+'" returned undefined handling '+r+". To ignore an action, you must explicitly return the previous state."}function i(t,e){var n=Object.keys(e);if(0===n.length)return void console.error("Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.");if(!f.default(t))return void console.error('initialState has unexpected type of "'+{}.toString.call(t).match(/\s([a-z|A-Z]+)/)[1]+'". Expected initialState to be an object with the following '+('keys: "'+n.join('", "')+'"'));var r=Object.keys(t).filter(function(t){return n.indexOf(t)<0});r.length>0&&console.error("Unexpected "+(r.length>1?"keys":"key")+" "+('"'+r.join('", "')+'" in initialState will be ignored. ')+('Expected to find one of the known reducer keys instead: "'+n.join('", "')+'"'))}function a(t){var e=h.default(t,function(t){return"function"==typeof t});Object.keys(e).forEach(function(t){var n=e[t];if("undefined"==typeof n(void 0,{type:s.ActionTypes.INIT}))throw new Error('Reducer "'+t+'" 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 r=Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof n(void 0,{type:r}))throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+s.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.")});var n,o=d.default(e,function(){return void 0});return function(t,a){void 0===t&&(t=o);var s=d.default(e,function(e,n){var r=e(t[n],a);if("undefined"==typeof r)throw new Error(u(n,a));return r});return"undefined"!=typeof r&&"undefined"!=typeof r.env,"undefined"!=typeof __DEV__&&__DEV__&&(n||(i(t,s),n=!0)),s}}e.__esModule=!0,e.default=a;var s=n(8),c=n(10),f=o(c),l=n(11),d=o(l),p=n(30),h=o(p);t.exports=e.default}).call(e,n(12))},function(t,e){"use strict";function n(t,e){return Object.keys(t).reduce(function(n,r){return e(t[r])&&(n[r]=t[r]),n},{})}e.__esModule=!0,e.default=n,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(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(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 n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=n(5),a=o(i),s=n(6),c=o(s),f=n(14),l=o(f),d=n(1),p=o(d),h=n(4),v=o(h),y=n(3),m=r(y),g=u({},p.default(u({},m,{initializeWithKey:function(t,e){return v.default(m.initialize,{key:t})(e)}}),function(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];return v.default(t,{form:e}).apply(void 0,r)}})),b=g.blur,_=g.change,O=g.initialize,T=g.initializeWithKey,S=g.reset,w=g.startAsyncValidation,x=g.stopAsyncValidation,A=g.touch,j=g.untouch;e.blur=b,e.change=_,e.connectReduxForm=l.default,e.reducer=a.default,e.initialize=O,e.initializeWithKey=T,e.reset=S,e.startAsyncValidation=w,e.stopAsyncValidation=x,e.touch=A,e.untouch=j,e.default=c.default},function(t,e){"use strict";function n(t,e){return Object.keys(t).reduce(function(n,o){var u;return r({},n,(u={},u[o]=e(t[o],o),u))},{})}e.__esModule=!0;var r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=n,t.exports=e.default},function(t,e){"use strict";e.__esModule=!0;var n="redux-form/BLUR";e.BLUR=n;var r="redux-form/CHANGE";e.CHANGE=r;var o="redux-form/FOCUS";e.FOCUS=o;var u="redux-form/INITIALIZE";e.INITIALIZE=u;var i="redux-form/RESET";e.RESET=i;var a="redux-form/START_ASYNC_VALIDATION";e.START_ASYNC_VALIDATION=a;var s="redux-form/START_SUBMIT";e.START_SUBMIT=s;var c="redux-form/STOP_ASYNC_VALIDATION";e.STOP_ASYNC_VALIDATION=c;var f="redux-form/STOP_SUBMIT";e.STOP_SUBMIT=f;var l="redux-form/TOUCH";e.TOUCH=l;var d="redux-form/UNTOUCH";e.UNTOUCH=d},function(t,e,n){"use strict";function r(t,e){return{type:h.BLUR,field:t,value:e}}function o(t,e){return{type:h.CHANGE,field:t,value:e}}function u(t){return{type:h.FOCUS,field:t}}function i(t){return{type:h.INITIALIZE,data:t}}function a(){return{type:h.RESET}}function s(){return{type:h.START_ASYNC_VALIDATION}}function c(){return{type:h.START_SUBMIT}}function f(t){return{type:h.STOP_ASYNC_VALIDATION,errors:t}}function l(){return{type:h.STOP_SUBMIT}}function d(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return{type:h.TOUCH,fields:e}}function p(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return{type:h.UNTOUCH,fields:e}}e.__esModule=!0,e.blur=r,e.change=o,e.focus=u,e.initialize=i,e.reset=a,e.startAsyncValidation=s,e.startSubmit=c,e.stopAsyncValidation=f,e.stopSubmit=l,e.touch=d,e.untouch=p;var h=n(2)},function(t,e,n){"use strict";function r(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 n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=o;var i=n(1),a=r(i);t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}function u(){var t,e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=n.form,u=n.key,i=o(n,["form","key"]);if(!r)return e;if(u){var s,c;return a({},e,(c={},c[r]=a({},e[r],(s={},s[u]=p((e[r]||{})[u],i),s)),c))}return a({},e,(t={},t[r]=p(e[r],i),t))}function i(t){return t.plugin=function(t){var e=this;return i(function(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e(n,r);return a({},o,f.default(t,function(t,e){return t(o[e]||l,r)}))})},t.normalize=function(t){var e=this;return i(function(){var n=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e(n,r);return a({},o,f.default(t,function(t,e){return a({},o[e],f.default(t,function(t,r){return a({},o[e][r],{value:t(o[e][r]?o[e][r].value:void 0,n[e]&&n[e][r]?n[e][r].value:void 0,d(o[e]))})}))}))})},t}e.__esModule=!0;var a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=n(2),c=n(1),f=r(c),l={_asyncValidating:!1,_submitting:!1};e.initialState=l;var d=function(t){return Object.keys(t).reduce(function(e,n){var r;return"_"===n[0]?e:a({},e,(r={},r[n]=t[n].value,r))},{})},p=function(){var t,e,n,r=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({},r,(t={},t[o.field]=a({},r[o.field],{value:o.value,touched:!(!o.touch&&!(r[o.field]||{}).touched)}),t));case s.CHANGE:return a({},r,(e={},e[o.field]=a({},r[o.field],{value:o.value,touched:!(!o.touch&&!(r[o.field]||{}).touched),asyncError:null}),e));case s.FOCUS:return a({},r,(n={},n[o.field]=a({},r[o.field],{visited:!0}),n._active=o.field,n));case s.INITIALIZE:return a({},f.default(o.data,function(t){return{initial:t,value:t}}),{_asyncValidating:!1,_submitting:!1});case s.RESET:return a({},f.default(r,function(t,e){return"_"===e[0]?t:{initial:t.initial,value:t.initial}}),{_asyncValidating:!1,_submitting:!1});case s.START_ASYNC_VALIDATION:return a({},r,{_asyncValidating:!0});case s.START_SUBMIT:return a({},r,{_submitting:!0});case s.STOP_ASYNC_VALIDATION:return a({},r,f.default(o.errors,function(t,e){return a({},r[e],{asyncError:t})}),{_asyncValidating:!1});case s.STOP_SUBMIT:return a({},r,{_submitting:!1});case s.TOUCH:return a({},r,o.fields.reduce(function(t,e){var n;return a({},t,(n={},n[e]=a({},r[e],{touched:!0}),n))},{}));case s.UNTOUCH:return a({},r,o.fields.reduce(function(t,e){var n;return a({},t,(n={},n[e]=a({},r[e],{touched:!1}),n))},{}));default:return r}};e.default=i(u)},function(t,e,n){"use strict";function r(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function o(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}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,e,n){if(t&&t[e]){if(!n)return t[e];if(t[e][n])return t[e][n]}return P.initialState}function f(t,e){if(void 0!==t||!e)return t;if(void 0===e.target)return e;var n=e.target,r=n.type,o=n.value,u=n.checked;return"checkbox"===r?u:o}function l(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;n>o;o++)r[o-1]=arguments[o];return e&&e.preventDefault?(e.preventDefault(),e.stopPropagation(),t.apply(void 0,r)):t.apply(void 0,[e].concat(r))}}function d(t){return t?void 0===t.valid?!Object.keys(t):!!t.valid:!0}function p(t){var e=v({validate:function(){return{}},touchOnBlur:!0,touchOnChange:!1,readonly:!1,asyncValidate:null,asyncBlurFields:[]},t),n=e.form,r=e.fields,o=e.validate,p=e.readonly,g=e.touchOnBlur,_=e.touchOnChange,T=e.asyncValidate,w=e.asyncBlurFields;if(!r||!r.length)throw new Error('No fields passed to redux-form. Must be passed to connectReduxForm({fields: ["my", "field", "names"]})');var A=function(t){return p?Object.keys(t).reduce(function(e,n){var r;return s(n)?v({},e,(r={},r[n]=t[n],r)):e},{}):t};return function(t){return function(e){function s(){i(this,s),e.apply(this,arguments)}return a(s,e),s.prototype.componentWillMount=function(){var t=this.props,e=t.initialValues,n=t.dispatch,r=t.formName,o=t.formKey;if(e){var u=o?j.default(b,{form:r,key:o}):j.default(b,{form:r}),i=u.initialize;n(i(e))}},s.prototype.render=function(){function e(){h(V(p));var t=T(M);if(!t||"function"!=typeof t.then)throw new Error("asyncValidate function passed to reduxForm must return a promise!");return t.then(function(t){return h(B(t)),d(t)},function(t){throw h(B({})),new Error("redux-form: Asynchronous validation failed: "+t)})}var n=this,i=this.props,a=i.formName,s=i.form,p=i.formKey,h=i.dispatch,y=u(i,["formName","form","formKey","dispatch"]);if(!a)throw new Error('No form name given to redux-form. Must be passed to connectReduxForm({form: [form name]}) or as a "formName" prop');var O=c(s,a,p),P=!0,I=!0,M=r.reduce(function(t,e){var n;return v({},t,(n={},n[e]=O[e]?O[e].value:void 0,n))},{}),C=p?j.default(b,{form:a,key:p}):j.default(b,{form:a}),E=C.blur,N=C.change,R=C.focus,k=C.initialize,U=C.reset,V=C.startAsyncValidation,D=C.startSubmit,B=C.stopAsyncValidation,F=C.stopSubmit,L=C.touch,z=C.untouch,H=function(t,n){return function(r){var u=f(n,r),i=j.default(E,{touch:g});if(h(i(t,u)),T&&~w.indexOf(t)){var a,s=o(v({},M,(a={},a[t]=u,a)))[t];s||e()}}},W=function(t){return function(){h(R(t))}},q=function(t,e){return function(n){var r=j.default(N,{touch:_});h(r(t,f(e,n)))}},Y=function(t){var o=function(t){return function(n){n&&n.preventDefault&&(n.preventDefault(),n.stopPropagation());var o=function(){var e=t(M);if(e&&"function"==typeof e.then){var n=function(t){return h(F()),t};h(D()),e.then(n,n)}};return h(L.apply(void 0,r)),P?T?e().then(function(t){return P&&t?o(M):void 0}):o(M):void 0}};if("function"==typeof t)return o(t);var u=n.props.onSubmit;if(!u)throw new Error("You must either pass handleSubmit() an onSubmit function or pass onSubmit as a prop");o(u)(t)},K=o(M),Z=r.reduce(function(t,e){var n,r=O[e]||{},o=S.default(r.value,r.initial),u=K[e]||r.asyncError,i=x.default(u);return i||(P=!1),o||(I=!1),v({},t,(n={},n[e]=A({active:O._active===e,checked:"boolean"==typeof r.value?r.value:void 0,dirty:!o,error:u,handleBlur:H(e),handleChange:q(e),handleFocus:W(e),invalid:!i,name:e,onBlur:H(e),onChange:q(e),onFocus:W(e),pristine:o,touched:r.touched,valid:i,value:r.value,visited:r.visited}),n))},{});return m.default.createElement(t,v({active:O._active,asyncValidating:O._asyncValidating,dirty:!I,fields:Z,formKey:p,invalid:!P,pristine:I,submitting:O._submitting,valid:P,values:M,asyncValidate:l(e),handleBlur:l(H),handleChange:l(q),handleFocus:W,handleSubmit:l(Y),initializeForm:l(function(t){return h(k(t))}),resetForm:l(function(){return h(U())}),touch:l(function(){return h(L.apply(void 0,arguments))}),touchAll:l(function(){return h(L.apply(void 0,r))}),untouch:l(function(){return h(z.apply(void 0,arguments))}),untouchAll:l(function(){return h(untouchAll.apply(void 0,r))}),dispatch:h},y))},h(s,null,[{key:"displayName",value:"ReduxForm("+O.default(t)+")",enumerable:!0},{key:"DecoratedComponent",value:t,enumerable:!0},{key:"propTypes",value:{formName:y.PropTypes.string,formKey:y.PropTypes.string,form:y.PropTypes.object,onSubmit:y.PropTypes.func,dispatch:y.PropTypes.func.isRequired,initialValues:y.PropTypes.object},enumerable:!0},{key:"defaultProps",value:{formName:n},enumerable:!0}]),s}(y.Component)}}e.__esModule=!0;var h=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),v=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=p;var y=n(13),m=o(y),g=n(3),b=r(g),_=n(15),O=o(_),T=n(16),S=o(T),w=n(17),x=o(w),A=n(4),j=o(A),P=n(5);t.exports=e.default},function(t,e){"use strict";function n(t){return t.shape({subscribe:t.func.isRequired,dispatch:t.func.isRequired,getState:t.func.isRequired})}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){function n(){return f}function r(t){return l.push(t),function(){var e=l.indexOf(t);l.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(d)throw new Error("Reducers may not dispatch actions.");try{d=!0,f=c(f,t)}finally{d=!1}return l.slice().forEach(function(t){return t()}),t}function u(){return c}function s(t){c=t,o({type:a.INIT})}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var c=t,f=e,l=[],d=!1;return o({type:a.INIT}),{dispatch:o,subscribe:r,getState:n,getReducer:u,replaceReducer:s}}e.__esModule=!0,e.default=o;var u=n(10),i=r(u),a={INIT:"@@redux/INIT"};e.ActionTypes=a},function(t,e){"use strict";function n(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return e.reduceRight(function(t,e){return e(t)})}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){"use strict";function n(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 n=e.constructor;return"function"==typeof n&&n instanceof n&&r(n)===r(Object)}e.__esModule=!0,e.default=n;var r=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function n(t,e){return Object.keys(t).reduce(function(n,r){return n[r]=e(t[r],r),n},{})}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){function n(){c=!1,i.length?s=i.concat(s):f=-1,s.length&&r()}function r(){if(!c){var t=setTimeout(n);c=!0;for(var e=s.length;e;){for(i=s,s=[];++f<e;)i[f].run();f=-1,e=s.length}i=null,c=!1,clearTimeout(t)}}function o(t,e){this.fun=t,this.array=e}function u(){}var i,a=t.exports={},s=[],c=!1,f=-1;a.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new o(t,e)),1!==s.length||c||setTimeout(r,0)},o.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=u,a.addListener=u,a.once=u,a.off=u,a.removeListener=u,a.removeAllListeners=u,a.emit=u,a.binding=function(t){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(t){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(e,n){e.exports=t},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return function(t){return e.reduce(function(t,e){return e(t)},t)}}function u(){return o(s.default.apply(void 0,arguments),c)}e.__esModule=!0,e.default=u;var i=n(21),a=n(6),s=r(a),c=i.connect(function(t){return{form:t.form}});t.exports=e.default},function(t,e){"use strict";function n(t){return t.displayName||t.name||"Component"}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){"use strict";function n(t,e){if(t===e)return!0;if(t&&"object"==typeof t){if(!e||"object"!=typeof e)return!1;for(var r=Object.keys(e),o=0;o<r.length;o++){var u=r[o];if(!n(t[u],e[u]))return!1}}else if(t||e)return t===e;return!0}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){"use strict";function n(t){return Array.isArray(t)?t.reduce(function(t,e){return t&&!e},!0):!t}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=i.default(t),n=s.default(t);return{Provider:e,connect:n}}e.__esModule=!0,e.default=o;var u=n(20),i=r(u),a=n(19),s=r(a);t.exports=e.default},function(t,e,n){(function(r){"use strict";function o(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 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)}function a(t){return t.displayName||t.name||"Component"}function s(t){var e=t.Component,n=t.PropTypes,o=d.default(n);return function(n,s,l){function d(t,e){var n=t.getState(),r=j?b(n,e):b(n);return _.default(y.default(r),"`mapStateToProps` must return an object. Instead received %s.",r),r}function p(t,e){var n=t.dispatch,r=P?x(n,e):x(n);return _.default(y.default(r),"`mapDispatchToProps` must return an object. Instead received %s.",r),r}function v(t,e,n){var r=A(t,e,n);return _.default(y.default(r),"`mergeProps` must return an object. Instead received %s.",r),r}var m=Boolean(n),b=n||O,x=y.default(s)?g.default(s):s||T,A=l||S,j=b.length>1,P=x.length>1,I=w++;return function(n){var s=function(e){function r(t,n){u(this,r),e.call(this,t,n),this.version=I,this.store=t.store||n.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=d(this.store,t),this.dispatchProps=p(this.store,t),this.state={props:this.computeNextState()}}return i(r,e),r.prototype.shouldComponentUpdate=function(t,e){return!h.default(this.state.props,e.props)},c(r,null,[{key:"displayName",value:"Connect("+a(n)+")",enumerable:!0},{key:"WrappedComponent",value:n,enumerable:!0},{key:"contextTypes",value:{store:o},enumerable:!0},{key:"propTypes",value:{store:o},enumerable:!0}]),r.prototype.computeNextState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];return v(this.stateProps,this.dispatchProps,t)},r.prototype.updateStateProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=d(this.store,t);return h.default(e,this.stateProps)?!1:(this.stateProps=e,!0)},r.prototype.updateDispatchProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=p(this.store,t);return h.default(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},r.prototype.updateState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=this.computeNextState(t);h.default(e,this.state.props)||this.setState({props:e})},r.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},r.prototype.trySubscribe=function(){m&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},r.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},r.prototype.componentDidMount=function(){this.trySubscribe()},r.prototype.componentWillReceiveProps=function(t){h.default(t,this.props)||(j&&this.updateStateProps(t),P&&this.updateDispatchProps(t),this.updateState(t))},r.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},r.prototype.handleChange=function(){this.updateStateProps()&&this.updateState()},r.prototype.getWrappedInstance=function(){return this.refs.wrappedInstance},r.prototype.render=function(){return t.createElement(n,f({ref:"wrappedInstance"},this.state.props))},r}(e);return"undefined"!=typeof r&&"undefined"!=typeof r.env,"undefined"!=typeof __DEV__&&__DEV__&&(s.prototype.componentWillUpdate=function(){this.version!==I&&(this.version=I,this.trySubscribe(),this.updateStateProps(),this.updateDispatchProps(),this.updateState())}),s}}}e.__esModule=!0;var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=s;var l=n(7),d=o(l),p=n(23),h=o(p),v=n(22),y=o(v),m=n(24),g=o(m),b=n(25),_=o(b),O=function(){return{}},T=function(t){return{dispatch:t}},S=function(t,e,n){return f({},n,t,e)},w=0;t.exports=e.default}).call(e,n(12))},function(t,e,n){"use strict";function r(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!1;var n=e.split("."),r=parseInt(n[0],10),o=parseInt(n[1],10);return 0===r&&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 n(){!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."))}var r=t.Component,a=t.PropTypes,c=t.Children,l=f.default(a),d=i(t),p=!1;return function(t){function r(e,n){o(this,r),t.call(this,e,n),this.state={store:e.store}}return u(r,t),r.prototype.getChildContext=function(){return{store:this.state.store}},s(r,null,[{key:"childContextTypes",value:{store:l.isRequired},enumerable:!0},{key:"propTypes",value:{store:l.isRequired,children:(d?a.func:a.element).isRequired},enumerable:!0}]),r.prototype.componentWillReceiveProps=function(t){var e=this.state.store,n=t.store;if(e!==n){var r=n.getReducer();e.replaceReducer(r)}},r.prototype.render=function(){var t=this.props.children;return"function"==typeof t?(e(),t=t()):n(),c.only(t)},r}(r)}e.__esModule=!0;var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();e.default=a;var c=n(7),f=r(c);t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=n(13),u=r(o),i=n(18),a=r(i),s=a.default(u.default),c=s.Provider,f=s.connect;e.Provider=c,e.connect=f},function(t,e){"use strict";function n(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 n=e.constructor;return"function"==typeof n&&n instanceof n&&r(n)===r(Object)}e.__esModule=!0,e.default=n;var r=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function n(t,e){if(t===e)return!0;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var o=Object.prototype.hasOwnProperty,u=0;u<n.length;u++)if(!o.call(e,n[u])||t[n[u]]!==e[n[u]])return!1;return!0}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return function(e){return o.bindActionCreators(t,e)}}e.__esModule=!0,e.default=r;var o=n(26);t.exports=e.default},function(t,e,n){"use strict";var r=function(t,e,n,r,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=[n,r,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=r},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=n(8),u=r(o),i=n(29),a=r(i),s=n(28),c=r(s),f=n(27),l=r(f),d=n(9),p=r(d);e.createStore=u.default,e.combineReducers=a.default,e.bindActionCreators=c.default,e.applyMiddleware=l.default,e.compose=p.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return function(t){return function(n,r){var o=t(n,r),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.concat([o.dispatch])),u({},o,{dispatch:i})}}}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=o;var i=n(9),a=r(i);t.exports=e.default},function(t,e,n){"use strict";function r(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)throw new Error("bindActionCreators expected an object or a function, instead received "+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=n(11),a=r(i);t.exports=e.default},function(t,e,n){(function(r){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function u(t,e){var n=e&&e.type,r=n&&'"'+n.toString()+'"'||"an action";return'Reducer "'+t+'" returned undefined handling '+r+". To ignore an action, you must explicitly return the previous state."}function i(t,e){var n=Object.keys(e);if(0===n.length)return void console.error("Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.");if(!f.default(t))return void console.error('initialState has unexpected type of "'+{}.toString.call(t).match(/\s([a-z|A-Z]+)/)[1]+'". Expected initialState to be an object with the following '+('keys: "'+n.join('", "')+'"'));var r=Object.keys(t).filter(function(t){return n.indexOf(t)<0});r.length>0&&console.error("Unexpected "+(r.length>1?"keys":"key")+" "+('"'+r.join('", "')+'" in initialState will be ignored. ')+('Expected to find one of the known reducer keys instead: "'+n.join('", "')+'"'))}function a(t){var e=h.default(t,function(t){return"function"==typeof t});Object.keys(e).forEach(function(t){var n=e[t];if("undefined"==typeof n(void 0,{type:s.ActionTypes.INIT}))throw new Error('Reducer "'+t+'" 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 r=Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof n(void 0,{type:r}))throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+s.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.")});var n,o=d.default(e,function(){return void 0});return function(t,a){void 0===t&&(t=o);var s=d.default(e,function(e,n){var r=e(t[n],a);if("undefined"==typeof r)throw new Error(u(n,a));return r});return"undefined"!=typeof r&&"undefined"!=typeof r.env,"undefined"!=typeof __DEV__&&__DEV__&&(n||(i(t,s),n=!0)),s}}e.__esModule=!0,e.default=a;var s=n(8),c=n(10),f=o(c),l=n(11),d=o(l),p=n(30),h=o(p);t.exports=e.default}).call(e,n(12))},function(t,e){"use strict";function n(t,e){return Object.keys(t).reduce(function(n,r){return e(t[r])&&(n[r]=t[r]),n},{})}e.__esModule=!0,e.default=n,t.exports=e.default}])}); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
exports.change = change; | ||
exports.focus = focus; | ||
exports.initialize = initialize; | ||
@@ -26,2 +27,6 @@ exports.reset = reset; | ||
function focus(field) { | ||
return { type: _actionTypes.FOCUS, field: field }; | ||
} | ||
function initialize(data) { | ||
@@ -28,0 +33,0 @@ return { type: _actionTypes.INITIALIZE, data: data }; |
@@ -8,2 +8,4 @@ 'use strict'; | ||
exports.CHANGE = CHANGE; | ||
var FOCUS = 'redux-form/FOCUS'; | ||
exports.FOCUS = FOCUS; | ||
var INITIALIZE = 'redux-form/INITIALIZE'; | ||
@@ -10,0 +12,0 @@ exports.INITIALIZE = INITIALIZE; |
@@ -34,3 +34,3 @@ 'use strict'; | ||
var _extends3, _extends4; | ||
var _extends3, _extends4, _extends5; | ||
@@ -51,2 +51,6 @@ var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
}), _extends4)); | ||
case _actionTypes.FOCUS: | ||
return _extends({}, state, (_extends5 = {}, _extends5[action.field] = _extends({}, state[action.field], { | ||
visited: true | ||
}), _extends5._active = action.field, _extends5)); | ||
case _actionTypes.INITIALIZE: | ||
@@ -94,15 +98,15 @@ return _extends({}, _mapValues2['default'](action.data, function (value) { | ||
return _extends({}, state, action.fields.reduce(function (accumulator, field) { | ||
var _extends5; | ||
var _extends6; | ||
return _extends({}, accumulator, (_extends5 = {}, _extends5[field] = _extends({}, state[field], { | ||
return _extends({}, accumulator, (_extends6 = {}, _extends6[field] = _extends({}, state[field], { | ||
touched: true | ||
}), _extends5)); | ||
}), _extends6)); | ||
}, {})); | ||
case _actionTypes.UNTOUCH: | ||
return _extends({}, state, action.fields.reduce(function (accumulator, field) { | ||
var _extends6; | ||
var _extends7; | ||
return _extends({}, accumulator, (_extends6 = {}, _extends6[field] = _extends({}, state[field], { | ||
return _extends({}, accumulator, (_extends7 = {}, _extends7[field] = _extends({}, state[field], { | ||
touched: false | ||
}), _extends6)); | ||
}), _extends7)); | ||
}, {})); | ||
@@ -117,3 +121,3 @@ default: | ||
var _extends9; | ||
var _extends10; | ||
@@ -130,7 +134,7 @@ var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
if (key) { | ||
var _extends7, _extends8; | ||
var _extends8, _extends9; | ||
return _extends({}, state, (_extends8 = {}, _extends8[form] = _extends({}, state[form], (_extends7 = {}, _extends7[key] = reducer((state[form] || {})[key], rest), _extends7)), _extends8)); | ||
return _extends({}, state, (_extends9 = {}, _extends9[form] = _extends({}, state[form], (_extends8 = {}, _extends8[key] = reducer((state[form] || {})[key], rest), _extends8)), _extends9)); | ||
} | ||
return _extends({}, state, (_extends9 = {}, _extends9[form] = reducer(state[form], rest), _extends9)); | ||
return _extends({}, state, (_extends10 = {}, _extends10[form] = reducer(state[form], rest), _extends10)); | ||
} | ||
@@ -137,0 +141,0 @@ |
@@ -47,2 +47,7 @@ 'use strict'; | ||
function isReadonly(prop) { | ||
var writeProps = ['asyncValidate', 'handleBlur', 'handleChange', 'handleFocus', 'handleSubmit', 'onBlur', 'onChange', 'onFocus']; | ||
return ! ~writeProps.indexOf(prop); | ||
} | ||
function getSubForm(form, formName, formKey) { | ||
@@ -106,3 +111,3 @@ if (form && form[formName]) { | ||
function reduxForm(config) { | ||
var _extends5 = _extends({ | ||
var _extends6 = _extends({ | ||
validate: function validate() { | ||
@@ -113,2 +118,3 @@ return {}; | ||
touchOnChange: false, | ||
readonly: false, | ||
asyncValidate: null, | ||
@@ -118,9 +124,10 @@ asyncBlurFields: [] | ||
var formName = _extends5.form; | ||
var fields = _extends5.fields; | ||
var syncValidate = _extends5.validate; | ||
var touchOnBlur = _extends5.touchOnBlur; | ||
var touchOnChange = _extends5.touchOnChange; | ||
var asyncValidate = _extends5.asyncValidate; | ||
var asyncBlurFields = _extends5.asyncBlurFields; | ||
var formName = _extends6.form; | ||
var fields = _extends6.fields; | ||
var syncValidate = _extends6.validate; | ||
var readonly = _extends6.readonly; | ||
var touchOnBlur = _extends6.touchOnBlur; | ||
var touchOnChange = _extends6.touchOnChange; | ||
var asyncValidate = _extends6.asyncValidate; | ||
var asyncBlurFields = _extends6.asyncBlurFields; | ||
@@ -130,2 +137,11 @@ if (!fields || !fields.length) { | ||
} | ||
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; | ||
}; | ||
return function (DecoratedComponent) { | ||
@@ -179,5 +195,5 @@ return (function (_Component) { | ||
var values = fields.reduce(function (accumulator, field) { | ||
var _extends2; | ||
var _extends3; | ||
return _extends({}, accumulator, (_extends2 = {}, _extends2[field] = subForm[field] ? subForm[field].value : undefined, _extends2)); | ||
return _extends({}, accumulator, (_extends3 = {}, _extends3[field] = subForm[field] ? subForm[field].value : undefined, _extends3)); | ||
}, {}); | ||
@@ -191,2 +207,3 @@ | ||
var change = _ref2.change; | ||
var focus = _ref2.focus; | ||
var initialize = _ref2.initialize; | ||
@@ -222,5 +239,5 @@ var reset = _ref2.reset; | ||
if (asyncValidate && ~asyncBlurFields.indexOf(name)) { | ||
var _extends3; | ||
var _extends4; | ||
var syncError = syncValidate(_extends({}, values, (_extends3 = {}, _extends3[name] = fieldValue, _extends3)))[name]; | ||
var syncError = syncValidate(_extends({}, values, (_extends4 = {}, _extends4[name] = fieldValue, _extends4)))[name]; | ||
// only dispatch async call if all synchronous client-side validation passes for this field | ||
@@ -233,2 +250,7 @@ if (!syncError) { | ||
}; | ||
var handleFocus = function handleFocus(name) { | ||
return function () { | ||
dispatch(focus(name)); | ||
}; | ||
}; | ||
var handleChange = function handleChange(name, value) { | ||
@@ -286,3 +308,3 @@ return function (event) { | ||
var allFields = fields.reduce(function (accumulator, name) { | ||
var _extends4; | ||
var _extends5; | ||
@@ -299,3 +321,4 @@ var field = subForm[name] || {}; | ||
} | ||
return _extends({}, accumulator, (_extends4 = {}, _extends4[name] = { | ||
return _extends({}, accumulator, (_extends5 = {}, _extends5[name] = filterProps({ | ||
active: subForm._active === name, | ||
checked: typeof field.value === 'boolean' ? field.value : undefined, | ||
@@ -306,2 +329,3 @@ dirty: !pristine, | ||
handleChange: handleChange(name), | ||
handleFocus: handleFocus(name), | ||
invalid: !valid, | ||
@@ -311,13 +335,16 @@ name: name, | ||
onChange: handleChange(name), | ||
onFocus: handleFocus(name), | ||
pristine: pristine, | ||
touched: field.touched, | ||
valid: valid, | ||
value: field.value | ||
}, _extends4)); | ||
value: field.value, | ||
visited: field.visited | ||
}), _extends5)); | ||
}, {}); | ||
// Return decorated component | ||
return _react2['default'].createElement(DecoratedComponent, | ||
// State: | ||
_extends({ asyncValidating: subForm._asyncValidating, | ||
return _react2['default'].createElement(DecoratedComponent, _extends({ | ||
// State: | ||
active: subForm._active, | ||
asyncValidating: subForm._asyncValidating, | ||
dirty: !allPristine, | ||
@@ -336,2 +363,3 @@ fields: allFields, | ||
handleChange: silenceEvents(handleChange), | ||
handleFocus: handleFocus, | ||
handleSubmit: silenceEvents(handleSubmit), | ||
@@ -338,0 +366,0 @@ initializeForm: silenceEvents(function (initialValues) { |
{ | ||
"name": "redux-form", | ||
"version": "1.3.4", | ||
"description": "A higher order component generator for forms using Redux and React", | ||
"version": "1.4.0", | ||
"description": "A higher order component decorator for forms using Redux and React", | ||
"main": "./lib/index.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
105
README.md
@@ -31,2 +31,3 @@ #redux-form | ||
* [Calculating `props` from Form Data](#calculating-props-from-form-data) | ||
* [Dynamic Forms](#dynamic-forms) | ||
* [Advanced Usage](#advanced-usage) | ||
@@ -470,2 +471,51 @@ * [Doing the `connect()`ing Yourself](#doing-the-connecting-yourself) | ||
### 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.arrayOf(PropTypes.object).isRequired | ||
} | ||
render() { | ||
const {fields} = this.props; // passed in by redux-form | ||
return ( | ||
<div> | ||
{fields.map(field => <div key={field.name}> | ||
<label>{field.name}</label> | ||
<input type="text" {...field}/> | ||
</div>)} | ||
</div> | ||
); | ||
} | ||
} | ||
// connect Form to Redux and decorate with redux-form | ||
Form = connectReduxForm({ form: formName, fields: fieldsNeed })(Form); | ||
// render connected and decorated form | ||
return <Form/>; | ||
} | ||
} | ||
``` | ||
--- | ||
## Advanced Usage | ||
@@ -578,2 +628,8 @@ | ||
#### -`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] | ||
@@ -647,2 +703,6 @@ | ||
#### -`active : String` | ||
> the name of the currently active (with focus) field | ||
#### -`asyncValidate : Function` | ||
@@ -665,2 +725,6 @@ | ||
##### ---`active : boolean` | ||
> `true` if this field currently has focus. It will only work if you are passing `handleFocus` to your input element. | ||
##### ---`checked : boolean?` | ||
@@ -682,12 +746,19 @@ | ||
> A function to call when the form field is blurred. It expects to receive the | ||
> 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. | ||
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 blurred. It expects to receive the | ||
> 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. | ||
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` | ||
@@ -712,2 +783,7 @@ | ||
##### ---`onFocus : Function` | ||
> An alias for `handleFocus`. Provided for convenience of destructuring the whole field object into the props of a | ||
form element. | ||
##### ---`pristine : boolean` | ||
@@ -729,10 +805,23 @@ | ||
#### -`handleBlur(field:string) : Function` | ||
##### ---`visited: boolean` | ||
> Returns a `handleBlur` function for the field passed. `handleBlur('age')` returns `fields.age.handleBlur`. | ||
> `true` if this field has ever had focus. It will only work if you are passing `handleFocus` to your input element. | ||
#### -`handleChange(field:string) : Function` | ||
#### -`handleBlur(field:string, value:any?) : Function` | ||
> Returns a `handleChange` function for the field passed. `handleChange('age')` returns `fields.age.handleChange`. | ||
> 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` | ||
@@ -739,0 +828,0 @@ |
Sorry, the diff of this file is too big to display
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
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
171793
2533
960