react-final-form
Advanced tools
Comparing version 3.5.1 to 3.5.2
@@ -213,3 +213,3 @@ 'use strict'; | ||
Field.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
Field.prototype.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var name = nextProps.name, | ||
@@ -406,3 +406,3 @@ subscription = nextProps.subscription; | ||
var version = '3.5.0'; | ||
var version = '3.5.2'; | ||
@@ -442,21 +442,10 @@ var versions = { | ||
var debug = props.debug, | ||
var children = props.children, | ||
component = props.component, | ||
render = props.render, | ||
subscription = props.subscription, | ||
decorators = props.decorators, | ||
initialValues = props.initialValues, | ||
keepDirtyOnReinitialize = props.keepDirtyOnReinitialize, | ||
mutators = props.mutators, | ||
onSubmit = props.onSubmit, | ||
subscription = props.subscription, | ||
validate = props.validate, | ||
validateOnBlur = props.validateOnBlur; | ||
rest = objectWithoutProperties(props, ['children', 'component', 'render', 'subscription', 'decorators']); | ||
var config = { | ||
debug: debug, | ||
initialValues: initialValues, | ||
keepDirtyOnReinitialize: keepDirtyOnReinitialize, | ||
mutators: mutators, | ||
onSubmit: onSubmit, | ||
validate: validate, | ||
validateOnBlur: validateOnBlur | ||
}; | ||
var config = rest; | ||
_this.mounted = false; | ||
@@ -494,3 +483,3 @@ try { | ||
ReactFinalForm.prototype.componentWillMount = function componentWillMount() { | ||
ReactFinalForm.prototype.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() { | ||
if (this.form) { | ||
@@ -508,3 +497,4 @@ this.form.pauseValidation(); | ||
ReactFinalForm.prototype.componentWillUpdate = function componentWillUpdate() { | ||
ReactFinalForm.prototype.UNSAFE_componentWillUpdate = function UNSAFE_componentWillUpdate() { | ||
// istanbul ignore next | ||
if (this.form) { | ||
@@ -517,2 +507,3 @@ this.resumeValidation = !this.form.isValidationPaused(); | ||
ReactFinalForm.prototype.componentDidUpdate = function componentDidUpdate() { | ||
// istanbul ignore next | ||
if (this.form && this.resumeValidation) { | ||
@@ -523,3 +514,3 @@ this.form.resumeValidation(); | ||
ReactFinalForm.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
ReactFinalForm.prototype.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var _this2 = this; | ||
@@ -695,3 +686,3 @@ | ||
FormSpy.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
FormSpy.prototype.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var subscription = nextProps.subscription; | ||
@@ -698,0 +689,0 @@ |
@@ -207,3 +207,3 @@ import { createElement, Component } from 'react'; | ||
Field.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
Field.prototype.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var name = nextProps.name, | ||
@@ -400,3 +400,3 @@ subscription = nextProps.subscription; | ||
var version$1 = '3.5.0'; | ||
var version$1 = '3.5.2'; | ||
@@ -436,21 +436,10 @@ var versions = { | ||
var debug = props.debug, | ||
var children = props.children, | ||
component = props.component, | ||
render = props.render, | ||
subscription = props.subscription, | ||
decorators = props.decorators, | ||
initialValues = props.initialValues, | ||
keepDirtyOnReinitialize = props.keepDirtyOnReinitialize, | ||
mutators = props.mutators, | ||
onSubmit = props.onSubmit, | ||
subscription = props.subscription, | ||
validate = props.validate, | ||
validateOnBlur = props.validateOnBlur; | ||
rest = objectWithoutProperties(props, ['children', 'component', 'render', 'subscription', 'decorators']); | ||
var config = { | ||
debug: debug, | ||
initialValues: initialValues, | ||
keepDirtyOnReinitialize: keepDirtyOnReinitialize, | ||
mutators: mutators, | ||
onSubmit: onSubmit, | ||
validate: validate, | ||
validateOnBlur: validateOnBlur | ||
}; | ||
var config = rest; | ||
_this.mounted = false; | ||
@@ -488,3 +477,3 @@ try { | ||
ReactFinalForm.prototype.componentWillMount = function componentWillMount() { | ||
ReactFinalForm.prototype.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() { | ||
if (this.form) { | ||
@@ -502,3 +491,4 @@ this.form.pauseValidation(); | ||
ReactFinalForm.prototype.componentWillUpdate = function componentWillUpdate() { | ||
ReactFinalForm.prototype.UNSAFE_componentWillUpdate = function UNSAFE_componentWillUpdate() { | ||
// istanbul ignore next | ||
if (this.form) { | ||
@@ -511,2 +501,3 @@ this.resumeValidation = !this.form.isValidationPaused(); | ||
ReactFinalForm.prototype.componentDidUpdate = function componentDidUpdate() { | ||
// istanbul ignore next | ||
if (this.form && this.resumeValidation) { | ||
@@ -517,3 +508,3 @@ this.form.resumeValidation(); | ||
ReactFinalForm.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
ReactFinalForm.prototype.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var _this2 = this; | ||
@@ -689,3 +680,3 @@ | ||
FormSpy.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
FormSpy.prototype.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var subscription = nextProps.subscription; | ||
@@ -692,0 +683,0 @@ |
@@ -211,3 +211,3 @@ (function (global, factory) { | ||
Field.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
Field.prototype.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var name = nextProps.name, | ||
@@ -404,3 +404,3 @@ subscription = nextProps.subscription; | ||
var version = '3.5.0'; | ||
var version = '3.5.2'; | ||
@@ -440,21 +440,10 @@ var versions = { | ||
var debug = props.debug, | ||
var children = props.children, | ||
component = props.component, | ||
render = props.render, | ||
subscription = props.subscription, | ||
decorators = props.decorators, | ||
initialValues = props.initialValues, | ||
keepDirtyOnReinitialize = props.keepDirtyOnReinitialize, | ||
mutators = props.mutators, | ||
onSubmit = props.onSubmit, | ||
subscription = props.subscription, | ||
validate = props.validate, | ||
validateOnBlur = props.validateOnBlur; | ||
rest = objectWithoutProperties(props, ['children', 'component', 'render', 'subscription', 'decorators']); | ||
var config = { | ||
debug: debug, | ||
initialValues: initialValues, | ||
keepDirtyOnReinitialize: keepDirtyOnReinitialize, | ||
mutators: mutators, | ||
onSubmit: onSubmit, | ||
validate: validate, | ||
validateOnBlur: validateOnBlur | ||
}; | ||
var config = rest; | ||
_this.mounted = false; | ||
@@ -492,3 +481,3 @@ try { | ||
ReactFinalForm.prototype.componentWillMount = function componentWillMount() { | ||
ReactFinalForm.prototype.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() { | ||
if (this.form) { | ||
@@ -506,3 +495,4 @@ this.form.pauseValidation(); | ||
ReactFinalForm.prototype.componentWillUpdate = function componentWillUpdate() { | ||
ReactFinalForm.prototype.UNSAFE_componentWillUpdate = function UNSAFE_componentWillUpdate() { | ||
// istanbul ignore next | ||
if (this.form) { | ||
@@ -515,2 +505,3 @@ this.resumeValidation = !this.form.isValidationPaused(); | ||
ReactFinalForm.prototype.componentDidUpdate = function componentDidUpdate() { | ||
// istanbul ignore next | ||
if (this.form && this.resumeValidation) { | ||
@@ -521,3 +512,3 @@ this.form.resumeValidation(); | ||
ReactFinalForm.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
ReactFinalForm.prototype.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var _this2 = this; | ||
@@ -693,3 +684,3 @@ | ||
FormSpy.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { | ||
FormSpy.prototype.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) { | ||
var subscription = nextProps.subscription; | ||
@@ -696,0 +687,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","final-form"],e):e(t["react-final-form"]={},t.React,t.PropTypes,t.FinalForm)}(this,function(t,m,e,d){"use strict";function i(e,n,t){return e?!n||t.some(function(t){return e[t]!==n[t]}):!!n}e=e&&e.hasOwnProperty("default")?e.default:e;var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},n=function(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)},v=function(t,e){var n={};for(var i in t)0<=e.indexOf(i)||Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n},y=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e};function g(t,e){var n=t.render,i=t.children,r=t.component,o=v(t,["render","children","component"]);return r?m.createElement(r,b({},o,{children:i,render:n})):n?n(b({},o,{children:i})):"function"!=typeof i?null:i(o)}var o="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,u=d.fieldSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),r=function(r){function o(t,e){h(this,o);var n=y(this,r.call(this,t,e));a.call(n);var i=void 0;return n.context.reactFinalForm&&n.subscribe(t,function(t){i?n.notify(t):i=t}),n.state={state:i},n}return n(o,r),o.prototype.componentWillReceiveProps=function(t){var e=t.name,n=t.subscription;(this.props.name!==e||i(this.props.subscription,n,d.fieldSubscriptionItems))&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(t,this.notify))},o.prototype.componentWillUnmount=function(){this.unsubscribe()},o.prototype.render=function(){var t=this.props,e=t.allowNull,n=t.component,i=t.children,r=t.format,o=(t.parse,t.isEqual,t.name),a=(t.subscription,t.validate,t.validateFields,t.value),s=v(t,["allowNull","component","children","format","parse","isEqual","name","subscription","validate","validateFields","value"]),u=this.state.state||{},c=(u.blur,u.change,u.focus,u.value),f=(u.name,v(u,["blur","change","focus","value","name"])),l={active:f.active,data:f.data,dirty:f.dirty,dirtySinceLastSubmit:f.dirtySinceLastSubmit,error:f.error,initial:f.initial,invalid:f.invalid,pristine:f.pristine,submitError:f.submitError,submitFailed:f.submitFailed,submitSucceeded:f.submitSucceeded,touched:f.touched,valid:f.valid,visited:f.visited};r&&(c=r(c,o)),null!==c||e||(c="");var p=b({name:o,value:c},this.handlers);return"checkbox"===s.type?void 0===a?p.checked=!!c:(p.checked=!(!Array.isArray(c)||!~c.indexOf(a)),p.value=a):"radio"===s.type?(p.checked=c===a,p.value=a):"select"===n&&s.multiple&&(p.value=p.value||[]),"function"==typeof i?i(b({input:p,meta:l},s)):"string"==typeof n?m.createElement(n,b({},p,{children:i},s)):g(b({},{input:p,meta:l},{children:i,component:n},s))},o}(m.Component);r.contextTypes={reactFinalForm:e.object},r.defaultProps={format:function(t,e){return void 0===t?"":t},parse:function(t,e){return""===t?void 0:t}};var a=function(){var a=this;this.subscribe=function(t,e){var n=t.isEqual,i=t.name,r=t.subscription,o=t.validateFields;a.unsubscribe=a.context.reactFinalForm.registerField(i,e,r||u,{isEqual:n,getValidator:function(){return a.props.validate},validateFields:o})},this.notify=function(t){return a.setState({state:t})},this.handlers={onBlur:function(t){a.state.state&&a.state.state.blur()},onChange:function(t){var e=a.props,n=e.parse,i=e.value,r=t&&t.target?function(t,e,n,i){if(!i&&t.nativeEvent&&void 0!==t.nativeEvent.text)return t.nativeEvent.text;if(i&&t.nativeEvent)return t.nativeEvent.text;var r=t.target,o=r.type,a=r.value,s=r.checked;switch(o){case"checkbox":if(void 0!==n){if(s)return Array.isArray(e)?e.concat(n):[n];if(!Array.isArray(e))return e;var u=e.indexOf(n);return u<0?e:e.slice(0,u).concat(e.slice(u+1))}return!!s;case"select-multiple":return function(t){var e=[];if(t)for(var n=0;n<t.length;n++){var i=t[n];i.selected&&e.push(i.value)}return e}(t.target.options);default:return a}}(t,a.state.state&&a.state.state.value,i,o):t;a.state.state&&a.state.state.change(n?n(r,a.props.name):r)},onFocus:function(t){a.state.state&&a.state.state.focus()}}},c=function(t){return!(!t||"function"!=typeof t.stopPropagation)},f="3.5.0",F={"final-form":d.version,"react-final-form":f},O=d.formSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),l=function(l){function p(t){h(this,p);var e=y(this,l.call(this,t));e.notify=function(t){e.mounted&&e.setState({state:t}),e.mounted=!0},e.handleSubmit=function(t){return t&&"function"==typeof t.preventDefault&&t.preventDefault(),e.form.submit()};var n=t.debug,i=t.decorators,r=t.initialValues,o=t.keepDirtyOnReinitialize,a=t.mutators,s=t.onSubmit,u=t.subscription,c={debug:n,initialValues:r,keepDirtyOnReinitialize:o,mutators:a,onSubmit:s,validate:t.validate,validateOnBlur:t.validateOnBlur};e.mounted=!1;try{e.form=d.createForm(c)}catch(t){}if(e.unsubscriptions=[],e.form){var f={};e.form.subscribe(function(t){f=t},u||O)(),e.state={state:f}}return i&&i.forEach(function(t){e.unsubscriptions.push(t(e.form))}),e}return n(p,l),p.prototype.getChildContext=function(){return{reactFinalForm:this.form}},p.prototype.componentWillMount=function(){this.form&&this.form.pauseValidation()},p.prototype.componentDidMount=function(){this.form&&(this.unsubscriptions.push(this.form.subscribe(this.notify,this.props.subscription||O)),this.form.resumeValidation())},p.prototype.componentWillUpdate=function(){this.form&&(this.resumeValidation=!this.form.isValidationPaused(),this.form.pauseValidation())},p.prototype.componentDidUpdate=function(){this.form&&this.resumeValidation&&this.form.resumeValidation()},p.prototype.componentWillReceiveProps=function(e){var n=this;e.initialValues&&!function(t,e){if(t===e)return!0;if("object"!==(void 0===t?"undefined":s(t))||!t||"object"!==(void 0===e?"undefined":s(e))||!e)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(var r=Object.prototype.hasOwnProperty.bind(e),o=0;o<n.length;o++){var a=n[o];if(!r(a)||t[a]!==e[a])return!1}return!0}(this.props.initialValues,e.initialValues)&&this.form.initialize(e.initialValues),d.configOptions.forEach(function(t){n.props[t]!==e[t]&&n.form.setConfig(t,e[t])})},p.prototype.componentWillUnmount=function(){this.unsubscriptions.forEach(function(t){return t()})},p.prototype.render=function(){var n=this,t=this.props,e=(t.debug,t.initialValues,t.mutators,t.onSubmit,t.subscription,t.validate,t.validateOnBlur,v(t,["debug","initialValues","mutators","onSubmit","subscription","validate","validateOnBlur"])),i=b({},this.state?this.state.state:{},{batch:this.form&&function(t){return n.form.batch(t)},blur:this.form&&function(t){return n.form.blur(t)},change:this.form&&function(t,e){return n.form.change(t,e)},focus:this.form&&function(t){return n.form.focus(t)},form:b({},this.form,{reset:function(t){c(t)?n.form.reset():n.form.reset(t)}}),handleSubmit:this.handleSubmit,initialize:this.form&&function(t){return n.form.initialize(t)},mutators:this.form&&Object.keys(this.form.mutators).reduce(function(t,e){return t[e]=function(){var t;(t=n.form.mutators)[e].apply(t,arguments)},t},{}),reset:this.form&&function(t){return n.form.reset(t)}});return g(b({},e,i,{__versions:F}))},p}(m.Component);l.childContextTypes={reactFinalForm:e.object};var p=function(r){function o(e,t){h(this,o);var i=y(this,r.call(this,e,t));i.subscribe=function(t,e){var n=t.subscription;i.unsubscribe=i.context.reactFinalForm.subscribe(e,n||O)},i.notify=function(t){i.setState({state:t}),i.props.onChange&&i.props.onChange(t)};var n=void 0;return i.context.reactFinalForm&&i.subscribe(e,function(t){n?i.notify(t):(n=t,e.onChange&&e.onChange(t))}),n&&(i.state={state:n}),i}return n(o,r),o.prototype.componentWillReceiveProps=function(t){var e=t.subscription;i(this.props.subscription,e,d.formSubscriptionItems)&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(t,this.notify))},o.prototype.componentWillUnmount=function(){this.unsubscribe()},o.prototype.render=function(){var t=this.props,e=t.onChange,n=(t.subscription,v(t,["onChange","subscription"])),i=this.context.reactFinalForm,r={batch:i&&function(t){return i.batch(t)},blur:i&&function(t){return i.blur(t)},change:i&&function(t,e){return i.change(t,e)},focus:i&&function(t){return i.focus(t)},form:b({},i,{reset:function(t){c(t)?i.reset():i.reset(t)}}),initialize:i&&function(t){return i.initialize(t)},mutators:i&&Object.keys(i.mutators).reduce(function(t,e){return t[e]=function(){var t;(t=i.mutators)[e].apply(t,arguments)},t},{}),reset:i&&function(t){return i.reset(t)}};return e?null:g(b({},n,this.state?this.state.state:{},r))},o}(m.Component);p.contextTypes={reactFinalForm:e.object},t.Field=r,t.Form=l,t.version=f,t.FormSpy=p,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("prop-types"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","final-form"],e):e(t["react-final-form"]={},t.React,t.PropTypes,t.FinalForm)}(this,function(t,m,e,u){"use strict";function r(e,n,t){return e?!n||t.some(function(t){return e[t]!==n[t]}):!!n}e=e&&e.hasOwnProperty("default")?e.default:e;var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},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},n=function(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)},d=function(t,e){var n={};for(var r in t)0<=e.indexOf(r)||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},l=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e};function b(t,e){var n=t.render,r=t.children,i=t.component,o=d(t,["render","children","component"]);return i?m.createElement(i,h({},o,{children:r,render:n})):n?n(h({},o,{children:r})):"function"!=typeof r?null:r(o)}var o="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,a=u.fieldSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),i=function(i){function o(t,e){f(this,o);var n=l(this,i.call(this,t,e));s.call(n);var r=void 0;return n.context.reactFinalForm&&n.subscribe(t,function(t){r?n.notify(t):r=t}),n.state={state:r},n}return n(o,i),o.prototype.UNSAFE_componentWillReceiveProps=function(t){var e=t.name,n=t.subscription;(this.props.name!==e||r(this.props.subscription,n,u.fieldSubscriptionItems))&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(t,this.notify))},o.prototype.componentWillUnmount=function(){this.unsubscribe()},o.prototype.render=function(){var t=this.props,e=t.allowNull,n=t.component,r=t.children,i=t.format,o=(t.parse,t.isEqual,t.name),s=(t.subscription,t.validate,t.validateFields,t.value),a=d(t,["allowNull","component","children","format","parse","isEqual","name","subscription","validate","validateFields","value"]),u=this.state.state||{},c=(u.blur,u.change,u.focus,u.value),f=(u.name,d(u,["blur","change","focus","value","name"])),l={active:f.active,data:f.data,dirty:f.dirty,dirtySinceLastSubmit:f.dirtySinceLastSubmit,error:f.error,initial:f.initial,invalid:f.invalid,pristine:f.pristine,submitError:f.submitError,submitFailed:f.submitFailed,submitSucceeded:f.submitSucceeded,touched:f.touched,valid:f.valid,visited:f.visited};i&&(c=i(c,o)),null!==c||e||(c="");var p=h({name:o,value:c},this.handlers);return"checkbox"===a.type?void 0===s?p.checked=!!c:(p.checked=!(!Array.isArray(c)||!~c.indexOf(s)),p.value=s):"radio"===a.type?(p.checked=c===s,p.value=s):"select"===n&&a.multiple&&(p.value=p.value||[]),"function"==typeof r?r(h({input:p,meta:l},a)):"string"==typeof n?m.createElement(n,h({},p,{children:r},a)):b(h({},{input:p,meta:l},{children:r,component:n},a))},o}(m.Component);i.contextTypes={reactFinalForm:e.object},i.defaultProps={format:function(t,e){return void 0===t?"":t},parse:function(t,e){return""===t?void 0:t}};var s=function(){var s=this;this.subscribe=function(t,e){var n=t.isEqual,r=t.name,i=t.subscription,o=t.validateFields;s.unsubscribe=s.context.reactFinalForm.registerField(r,e,i||a,{isEqual:n,getValidator:function(){return s.props.validate},validateFields:o})},this.notify=function(t){return s.setState({state:t})},this.handlers={onBlur:function(t){s.state.state&&s.state.state.blur()},onChange:function(t){var e=s.props,n=e.parse,r=e.value,i=t&&t.target?function(t,e,n,r){if(!r&&t.nativeEvent&&void 0!==t.nativeEvent.text)return t.nativeEvent.text;if(r&&t.nativeEvent)return t.nativeEvent.text;var i=t.target,o=i.type,s=i.value,a=i.checked;switch(o){case"checkbox":if(void 0!==n){if(a)return Array.isArray(e)?e.concat(n):[n];if(!Array.isArray(e))return e;var u=e.indexOf(n);return u<0?e:e.slice(0,u).concat(e.slice(u+1))}return!!a;case"select-multiple":return function(t){var e=[];if(t)for(var n=0;n<t.length;n++){var r=t[n];r.selected&&e.push(r.value)}return e}(t.target.options);default:return s}}(t,s.state.state&&s.state.state.value,r,o):t;s.state.state&&s.state.state.change(n?n(i,s.props.name):i)},onFocus:function(t){s.state.state&&s.state.state.focus()}}},p=function(t){return!(!t||"function"!=typeof t.stopPropagation)},v="3.5.2",y={"final-form":u.version,"react-final-form":v},F=u.formSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),g=function(s){function a(t){f(this,a);var e=l(this,s.call(this,t));e.notify=function(t){e.mounted&&e.setState({state:t}),e.mounted=!0},e.handleSubmit=function(t){return t&&"function"==typeof t.preventDefault&&t.preventDefault(),e.form.submit()};t.children,t.component,t.render;var n=t.subscription,r=t.decorators,i=d(t,["children","component","render","subscription","decorators"]);e.mounted=!1;try{e.form=u.createForm(i)}catch(t){}if(e.unsubscriptions=[],e.form){var o={};e.form.subscribe(function(t){o=t},n||F)(),e.state={state:o}}return r&&r.forEach(function(t){e.unsubscriptions.push(t(e.form))}),e}return n(a,s),a.prototype.getChildContext=function(){return{reactFinalForm:this.form}},a.prototype.UNSAFE_componentWillMount=function(){this.form&&this.form.pauseValidation()},a.prototype.componentDidMount=function(){this.form&&(this.unsubscriptions.push(this.form.subscribe(this.notify,this.props.subscription||F)),this.form.resumeValidation())},a.prototype.UNSAFE_componentWillUpdate=function(){this.form&&(this.resumeValidation=!this.form.isValidationPaused(),this.form.pauseValidation())},a.prototype.componentDidUpdate=function(){this.form&&this.resumeValidation&&this.form.resumeValidation()},a.prototype.UNSAFE_componentWillReceiveProps=function(e){var n=this;e.initialValues&&!function(t,e){if(t===e)return!0;if("object"!==(void 0===t?"undefined":c(t))||!t||"object"!==(void 0===e?"undefined":c(e))||!e)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(var i=Object.prototype.hasOwnProperty.bind(e),o=0;o<n.length;o++){var s=n[o];if(!i(s)||t[s]!==e[s])return!1}return!0}(this.props.initialValues,e.initialValues)&&this.form.initialize(e.initialValues),u.configOptions.forEach(function(t){n.props[t]!==e[t]&&n.form.setConfig(t,e[t])})},a.prototype.componentWillUnmount=function(){this.unsubscriptions.forEach(function(t){return t()})},a.prototype.render=function(){var n=this,t=this.props,e=(t.debug,t.initialValues,t.mutators,t.onSubmit,t.subscription,t.validate,t.validateOnBlur,d(t,["debug","initialValues","mutators","onSubmit","subscription","validate","validateOnBlur"])),r=h({},this.state?this.state.state:{},{batch:this.form&&function(t){return n.form.batch(t)},blur:this.form&&function(t){return n.form.blur(t)},change:this.form&&function(t,e){return n.form.change(t,e)},focus:this.form&&function(t){return n.form.focus(t)},form:h({},this.form,{reset:function(t){p(t)?n.form.reset():n.form.reset(t)}}),handleSubmit:this.handleSubmit,initialize:this.form&&function(t){return n.form.initialize(t)},mutators:this.form&&Object.keys(this.form.mutators).reduce(function(t,e){return t[e]=function(){var t;(t=n.form.mutators)[e].apply(t,arguments)},t},{}),reset:this.form&&function(t){return n.form.reset(t)}});return b(h({},e,r,{__versions:y}))},a}(m.Component);g.childContextTypes={reactFinalForm:e.object};var S=function(i){function o(e,t){f(this,o);var r=l(this,i.call(this,e,t));r.subscribe=function(t,e){var n=t.subscription;r.unsubscribe=r.context.reactFinalForm.subscribe(e,n||F)},r.notify=function(t){r.setState({state:t}),r.props.onChange&&r.props.onChange(t)};var n=void 0;return r.context.reactFinalForm&&r.subscribe(e,function(t){n?r.notify(t):(n=t,e.onChange&&e.onChange(t))}),n&&(r.state={state:n}),r}return n(o,i),o.prototype.UNSAFE_componentWillReceiveProps=function(t){var e=t.subscription;r(this.props.subscription,e,u.formSubscriptionItems)&&this.context.reactFinalForm&&(this.unsubscribe(),this.subscribe(t,this.notify))},o.prototype.componentWillUnmount=function(){this.unsubscribe()},o.prototype.render=function(){var t=this.props,e=t.onChange,n=(t.subscription,d(t,["onChange","subscription"])),r=this.context.reactFinalForm,i={batch:r&&function(t){return r.batch(t)},blur:r&&function(t){return r.blur(t)},change:r&&function(t,e){return r.change(t,e)},focus:r&&function(t){return r.focus(t)},form:h({},r,{reset:function(t){p(t)?r.reset():r.reset(t)}}),initialize:r&&function(t){return r.initialize(t)},mutators:r&&Object.keys(r.mutators).reduce(function(t,e){return t[e]=function(){var t;(t=r.mutators)[e].apply(t,arguments)},t},{}),reset:r&&function(t){return r.reset(t)}};return e?null:b(h({},n,this.state?this.state.state:{},i))},o}(m.Component);S.contextTypes={reactFinalForm:e.object},t.Field=i,t.Form=g,t.version=v,t.FormSpy=S,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=react-final-form.umd.min.js.map |
{ | ||
"name": "react-final-form", | ||
"version": "3.5.1", | ||
"version": "3.5.2", | ||
"description": "🏁 High performance subscription-based form state management for React", | ||
@@ -61,3 +61,3 @@ "main": "dist/react-final-form.cjs.js", | ||
"react-dom": "^16.3.2", | ||
"rollup": "^0.59.4", | ||
"rollup": "^0.60.0", | ||
"rollup-plugin-babel": "^3.0.4", | ||
@@ -100,3 +100,6 @@ "rollup-plugin-commonjs": "^9.1.0", | ||
"url": "https://opencollective.com/final-form" | ||
}, | ||
"dependencies": { | ||
"react-lifecycles-compat": "^3.0.4" | ||
} | ||
} |
@@ -150,2 +150,3 @@ # 🏁 React Final Form | ||
* [Format String By Pattern](#format-string-by-pattern) | ||
* [AsyncTypeahead and Redux](#asynctypeahead-redux) | ||
* [Rendering](#rendering) | ||
@@ -387,2 +388,6 @@ * [API](#api) | ||
### [AsyncTypeahead and Redux](https://codesandbox.io/s/5m4w2909k) | ||
Demonstrates creating an `AsyncTypeahead` to select github users, while storing the search results in the redux store and the form state (selected github users) via `react-final-form`. Also makes use of the [`setFieldData` mutator](https://github.com/final-form/final-form-set-field-data). | ||
## Rendering | ||
@@ -389,0 +394,0 @@ |
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
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
844
143232
4
2168
+ Addedreact-lifecycles-compat@3.0.4(transitive)