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

react-final-form

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-final-form - npm Package Compare versions

Comparing version 3.5.2 to 3.6.0

3

dist/index.d.ts

@@ -27,3 +27,3 @@ import * as React from 'react'

active: boolean
data: object,
data: object
dirty: boolean

@@ -78,2 +78,3 @@ dirtySinceLastSubmit: boolean

format?: ((value: any, name: string) => any) | null
formatOnBlur?: boolean
parse?: ((value: any, name: string) => any) | null

@@ -80,0 +81,0 @@ name: string

@@ -236,2 +236,3 @@ 'use strict';

format = _props.format,
formatOnBlur = _props.formatOnBlur,
parse = _props.parse,

@@ -244,3 +245,3 @@ isEqual = _props.isEqual,

_value = _props.value,
rest = objectWithoutProperties(_props, ['allowNull', 'component', 'children', 'format', 'parse', 'isEqual', 'name', 'subscription', 'validate', 'validateFields', 'value']);
rest = objectWithoutProperties(_props, ['allowNull', 'component', 'children', 'format', 'formatOnBlur', 'parse', 'isEqual', 'name', 'subscription', 'validate', 'validateFields', 'value']);

@@ -272,3 +273,5 @@ var _ref = this.state.state || {},

};
if (format) {
if (formatOnBlur) {
value = Field.defaultProps.format(value, name);
} else if (format) {
value = format(value, name);

@@ -345,8 +348,21 @@ }

onBlur: function onBlur(event) {
_this2.state.state && _this2.state.state.blur();
var state = _this2.state.state;
// this is to appease the Flow gods
// istanbul ignore next
if (state) {
var _props2 = _this2.props,
format = _props2.format,
formatOnBlur = _props2.formatOnBlur;
state.blur();
if (format && formatOnBlur) {
state.change(format(state.value, state.name));
}
}
},
onChange: function onChange(event) {
var _props2 = _this2.props,
parse = _props2.parse,
_value = _props2.value;
var _props3 = _this2.props,
parse = _props3.parse,
_value = _props3.value;

@@ -409,3 +425,3 @@ // istanbul ignore next

var version = '3.5.2';
var version = '3.6.0';

@@ -412,0 +428,0 @@ var versions = {

@@ -230,2 +230,3 @@ import { createElement, Component } from 'react';

format = _props.format,
formatOnBlur = _props.formatOnBlur,
parse = _props.parse,

@@ -238,3 +239,3 @@ isEqual = _props.isEqual,

_value = _props.value,
rest = objectWithoutProperties(_props, ['allowNull', 'component', 'children', 'format', 'parse', 'isEqual', 'name', 'subscription', 'validate', 'validateFields', 'value']);
rest = objectWithoutProperties(_props, ['allowNull', 'component', 'children', 'format', 'formatOnBlur', 'parse', 'isEqual', 'name', 'subscription', 'validate', 'validateFields', 'value']);

@@ -266,3 +267,5 @@ var _ref = this.state.state || {},

};
if (format) {
if (formatOnBlur) {
value = Field.defaultProps.format(value, name);
} else if (format) {
value = format(value, name);

@@ -339,8 +342,21 @@ }

onBlur: function onBlur(event) {
_this2.state.state && _this2.state.state.blur();
var state = _this2.state.state;
// this is to appease the Flow gods
// istanbul ignore next
if (state) {
var _props2 = _this2.props,
format = _props2.format,
formatOnBlur = _props2.formatOnBlur;
state.blur();
if (format && formatOnBlur) {
state.change(format(state.value, state.name));
}
}
},
onChange: function onChange(event) {
var _props2 = _this2.props,
parse = _props2.parse,
_value = _props2.value;
var _props3 = _this2.props,
parse = _props3.parse,
_value = _props3.value;

@@ -403,3 +419,3 @@ // istanbul ignore next

var version$1 = '3.5.2';
var version$1 = '3.6.0';

@@ -406,0 +422,0 @@ var versions = {

@@ -234,2 +234,3 @@ (function (global, factory) {

format = _props.format,
formatOnBlur = _props.formatOnBlur,
parse = _props.parse,

@@ -242,3 +243,3 @@ isEqual = _props.isEqual,

_value = _props.value,
rest = objectWithoutProperties(_props, ['allowNull', 'component', 'children', 'format', 'parse', 'isEqual', 'name', 'subscription', 'validate', 'validateFields', 'value']);
rest = objectWithoutProperties(_props, ['allowNull', 'component', 'children', 'format', 'formatOnBlur', 'parse', 'isEqual', 'name', 'subscription', 'validate', 'validateFields', 'value']);

@@ -270,3 +271,5 @@ var _ref = this.state.state || {},

};
if (format) {
if (formatOnBlur) {
value = Field.defaultProps.format(value, name);
} else if (format) {
value = format(value, name);

@@ -343,8 +346,21 @@ }

onBlur: function onBlur(event) {
_this2.state.state && _this2.state.state.blur();
var state = _this2.state.state;
// this is to appease the Flow gods
// istanbul ignore next
if (state) {
var _props2 = _this2.props,
format = _props2.format,
formatOnBlur = _props2.formatOnBlur;
state.blur();
if (format && formatOnBlur) {
state.change(format(state.value, state.name));
}
}
},
onChange: function onChange(event) {
var _props2 = _this2.props,
parse = _props2.parse,
_value = _props2.value;
var _props3 = _this2.props,
parse = _props3.parse,
_value = _props3.value;

@@ -407,3 +423,3 @@ // istanbul ignore next

var version = '3.5.2';
var version = '3.6.0';

@@ -410,0 +426,0 @@ var versions = {

@@ -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,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})});
!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,d,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")},b=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)},v=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 y(t,e){var n=t.render,r=t.children,i=t.component,o=v(t,["render","children","component"]);return i?d.createElement(i,b({},o,{children:r,render:n})):n?n(b({},o,{children:r})):"function"!=typeof r?null:r(o)}var o="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product,s=u.fieldSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),i=function(i){function h(t,e){f(this,h);var n=l(this,i.call(this,t,e));a.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(h,i),h.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))},h.prototype.componentWillUnmount=function(){this.unsubscribe()},h.prototype.render=function(){var t=this.props,e=t.allowNull,n=t.component,r=t.children,i=t.format,o=t.formatOnBlur,a=(t.parse,t.isEqual,t.name),s=(t.subscription,t.validate,t.validateFields,t.value),u=v(t,["allowNull","component","children","format","formatOnBlur","parse","isEqual","name","subscription","validate","validateFields","value"]),c=this.state.state||{},f=(c.blur,c.change,c.focus,c.value),l=(c.name,v(c,["blur","change","focus","value","name"])),p={active:l.active,data:l.data,dirty:l.dirty,dirtySinceLastSubmit:l.dirtySinceLastSubmit,error:l.error,initial:l.initial,invalid:l.invalid,pristine:l.pristine,submitError:l.submitError,submitFailed:l.submitFailed,submitSucceeded:l.submitSucceeded,touched:l.touched,valid:l.valid,visited:l.visited};o?f=h.defaultProps.format(f,a):i&&(f=i(f,a)),null!==f||e||(f="");var m=b({name:a,value:f},this.handlers);return"checkbox"===u.type?void 0===s?m.checked=!!f:(m.checked=!(!Array.isArray(f)||!~f.indexOf(s)),m.value=s):"radio"===u.type?(m.checked=f===s,m.value=s):"select"===n&&u.multiple&&(m.value=m.value||[]),"function"==typeof r?r(b({input:m,meta:p},u)):"string"==typeof n?d.createElement(n,b({},m,{children:r},u)):y(b({},{input:m,meta:p},{children:r,component:n},u))},h}(d.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 a=function(){var a=this;this.subscribe=function(t,e){var n=t.isEqual,r=t.name,i=t.subscription,o=t.validateFields;a.unsubscribe=a.context.reactFinalForm.registerField(r,e,i||s,{isEqual:n,getValidator:function(){return a.props.validate},validateFields:o})},this.notify=function(t){return a.setState({state:t})},this.handlers={onBlur:function(t){var e=a.state.state;if(e){var n=a.props,r=n.format,i=n.formatOnBlur;e.blur(),r&&i&&e.change(r(e.value,e.name))}},onChange:function(t){var e=a.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,a=i.value,s=i.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 r=t[n];r.selected&&e.push(r.value)}return e}(t.target.options);default:return a}}(t,a.state.state&&a.state.state.value,r,o):t;a.state.state&&a.state.state.change(n?n(i,a.props.name):i)},onFocus:function(t){a.state.state&&a.state.state.focus()}}},p=function(t){return!(!t||"function"!=typeof t.stopPropagation)},m="3.6.0",h={"final-form":u.version,"react-final-form":m},F=u.formSubscriptionItems.reduce(function(t,e){return t[e]=!0,t},{}),g=function(a){function s(t){f(this,s);var e=l(this,a.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=v(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(s,a),s.prototype.getChildContext=function(){return{reactFinalForm:this.form}},s.prototype.UNSAFE_componentWillMount=function(){this.form&&this.form.pauseValidation()},s.prototype.componentDidMount=function(){this.form&&(this.unsubscriptions.push(this.form.subscribe(this.notify,this.props.subscription||F)),this.form.resumeValidation())},s.prototype.UNSAFE_componentWillUpdate=function(){this.form&&(this.resumeValidation=!this.form.isValidationPaused(),this.form.pauseValidation())},s.prototype.componentDidUpdate=function(){this.form&&this.resumeValidation&&this.form.resumeValidation()},s.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 a=n[o];if(!i(a)||t[a]!==e[a])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])})},s.prototype.componentWillUnmount=function(){this.unsubscriptions.forEach(function(t){return t()})},s.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"])),r=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){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 y(b({},e,r,{__versions:h}))},s}(d.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,v(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:b({},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:y(b({},n,this.state?this.state.state:{},i))},o}(d.Component);S.contextTypes={reactFinalForm:e.object},t.Field=i,t.Form=g,t.version=m,t.FormSpy=S,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=react-final-form.umd.min.js.map
{
"name": "react-final-form",
"version": "3.5.2",
"version": "3.6.0",
"description": "🏁 High performance subscription-based form state management for React",

@@ -15,2 +15,3 @@ "main": "dist/react-final-form.cjs.js",

"test": "nps test",
"doctoc": "doctoc README.md && doctoc docs/faq.md && prettier --write README.md && prettier --write docs/faq.md",
"precommit": "lint-staged && npm start validate",

@@ -17,0 +18,0 @@ "prepublish": "npm start validate",

@@ -18,3 +18,3 @@ # 🏁 React Final Form

✅ 💥 [**2.9k gzipped**](https://bundlephobia.com/result?p=react-final-form) 💥
✅ 💥 [**3.1k gzipped**](https://bundlephobia.com/result?p=react-final-form) 💥

@@ -151,3 +151,3 @@ ---

* [Format String By Pattern](#format-string-by-pattern)
* [AsyncTypeahead and Redux](#asynctypeahead-redux)
* [AsyncTypeahead and Redux](#asynctypeahead-and-redux)
* [Rendering](#rendering)

@@ -165,2 +165,3 @@ * [API](#api)

* [`format?: ((value: any, name: string) => any) | null`](#format-value-any-name-string--any--null)
* [`formatOnBlur?: boolean`](#formatonblur-boolean)
* [`isEqual?: (a: any, b: any) => boolean`](#isequal-a-any-b-any--boolean)

@@ -460,2 +461,6 @@ * [`name: string`](#name-string)

#### `formatOnBlur?: boolean`
If `true`, the `format` function will only be called when the field is blurred. If `false`, `format` will be called on every render. Defaults to `false`.
#### `isEqual?: (a: any, b: any) => boolean`

@@ -462,0 +467,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc