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

final-form

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

final-form - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

2

dist/final-form.cjs.js

@@ -389,3 +389,3 @@ 'use strict';

var FORM_ERROR = Symbol('form-error');
var version = '4.0.1';
var version = '4.0.2';

@@ -392,0 +392,0 @@ var tripleEquals = function tripleEquals(a, b) {

@@ -385,3 +385,3 @@ //

var FORM_ERROR = Symbol('form-error');
var version = '4.0.1';
var version = '4.0.2';

@@ -388,0 +388,0 @@ var tripleEquals = function tripleEquals(a, b) {

@@ -391,3 +391,3 @@ (function (global, factory) {

var FORM_ERROR = Symbol('form-error');
var version = '4.0.1';
var version = '4.0.2';

@@ -394,0 +394,0 @@ var tripleEquals = function tripleEquals(a, b) {

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["final-form"]={})}(this,function(t){"use strict";function e(t,e,r,i,n,a){var o=!1;return n.forEach(function(n){i[n]&&(t[n]=e[n],r&&(~a.indexOf(n)?v(e[n],r[n]):e[n]===r[n])||(o=!0))}),o}function r(t,e,r,i,n){var a=n(r,i,e,arguments.length>5&&void 0!==arguments[5]&&arguments[5]);a&&t(a)}function i(t,e,i,n){var a=t.entries;Object.keys(a).forEach(function(t){var o=a[Number(t)],u=o.subscription;r(o.subscriber,u,e,i,n)})}var n=function(t){if(null===t||void 0===t)return[];if("string"!=typeof t)throw new Error("toPath() expects a string");return t.length?t.split(/[.[\]]+/).filter(Boolean):[]},a="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},o=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},s=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)},l=function(t,e){var r=n(e),i=t,o=!0,u=!1,s=void 0;try{for(var l,f=r[Symbol.iterator]();!(o=(l=f.next()).done);o=!0){var c=l.value;if(void 0===i||null===i||"object"!==(void 0===i?"undefined":a(i))||Array.isArray(i)&&isNaN(c))return;i=i[c]}}catch(t){u=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(u)throw s}}return i},f=function(t,e,r){if(void 0===t||null===t)throw new Error("Cannot call setIn() with "+String(t)+" state");if(void 0===e||null===e)throw new Error("Cannot call setIn() with "+String(e)+" key");return function t(e,r,i,n){if(r>=i.length)return n;var a=i[r];if(isNaN(a)){if(void 0===e||null===e){var l=t(void 0,r+1,i,n);return void 0===l?void 0:o({},a,l)}if(Array.isArray(e))throw new Error("Cannot set a non-numeric property on an array");var f=t(e[a],r+1,i,n),c=Object.keys(e).length;if(void 0===f){if(void 0===e[a]&&0===c)return;if(void 0!==e[a]&&c<=1)return isNaN(i[r-1])?void 0:{}}return u({},e,o({},a,f))}var d=Number(a);if(void 0===e||null===e){var v=t(void 0,r+1,i,n);if(void 0===v)return;var b=[];return b[d]=v,b}if(!Array.isArray(e))throw new Error("Cannot set a numeric property on an object");var m=t(e[d],r+1,i,n),S=[].concat(s(e));return void 0===m?S.splice(d,1):S[d]=m,S}(t,0,n(e),r)},c=function(t,e){var r=t.errors,i=t.initialValues,n=t.lastSubmittedValues,a=t.submitErrors,o=t.submitFailed,u=t.submitSucceeded,s=t.values,f=e.active,c=e.blur,d=e.change,v=e.data,b=e.focus,m=e.name,S=e.touched,y=e.visited,h=l(s,m),g=l(r,m),p=a&&l(a,m),E=i&&l(i,m),O=e.isEqual(E,h),j=!(!n||e.isEqual(l(n,m),h)),w=!g&&!p;return{active:f,blur:c,change:d,data:v,dirty:!O,dirtySinceLastSubmit:j,error:g,focus:b,initial:E,invalid:!w,length:Array.isArray(h)?h.length:void 0,name:m,pristine:O,submitError:p,submitFailed:o,submitSucceeded:u,touched:S,valid:w,value:h,visited:y}},d=["active","data","dirty","dirtySinceLastSubmit","error","initial","invalid","length","pristine","submitError","submitFailed","submitSucceeded","touched","valid","value","visited"],v=function(t,e){if(t===e)return!0;if("object"!==(void 0===t?"undefined":a(t))||!t||"object"!==(void 0===e?"undefined":a(e))||!e)return!1;var r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(var n=Object.prototype.hasOwnProperty.bind(e),o=0;o<r.length;o++){var u=r[o];if(!n(u)||t[u]!==e[u])return!1}return!0},b=["data"],m=function(t,r,i,n){var a={blur:t.blur,change:t.change,focus:t.focus,name:t.name};return e(a,t,r,i,d,b)||!r||n?a:void 0},S=["active","dirty","dirtySinceLastSubmit","error","errors","initialValues","invalid","pristine","submitting","submitError","submitErrors","submitFailed","submitSucceeded","valid","validating","values"],y=[],h=function(t,r,i,n){var a={};return e(a,t,r,i,S,y)||!r||n?a:void 0},g=function(t){var e=void 0,r=void 0;return function(){for(var i=arguments.length,n=Array(i),a=0;a<i;a++)n[a]=arguments[a];return e&&n.length===e.length&&!n.some(function(t,r){return!v(e[r],t)})||(e=n,r=t.apply(void 0,n)),r}},p=function(t){return!!t&&("object"===(void 0===t?"undefined":a(t))||"function"==typeof t)&&"function"==typeof t.then},E=Symbol("form-error"),O=function(t){var e=t.active,r=t.dirtySinceLastSubmit,i=t.error,n=t.errors,a=t.initialValues,o=t.pristine,u=t.submitting,s=t.submitFailed,l=t.submitSucceeded,f=t.submitError,c=t.submitErrors,d=t.valid;return{active:e,dirty:!o,dirtySinceLastSubmit:r,error:i,errors:n,invalid:!d,initialValues:a,pristine:o,submitting:u,submitFailed:s,submitSucceeded:l,submitError:f,submitErrors:c,valid:d,validating:t.validating>0,values:t.values}};t.createForm=function(t){if(!t)throw new Error("No config specified");t.debug;var e=t.initialValues,n=t.mutators,a=t.onSubmit,o=t.validate,d=t.validateOnBlur;if(!a)throw new Error("No onSubmit function specified");var b={subscribers:{index:0,entries:{}},fieldSubscribers:{},fields:{},formState:{dirtySinceLastSubmit:!1,errors:{},initialValues:e&&u({},e),invalid:!1,pristine:!0,submitting:!1,submitFailed:!1,submitSucceeded:!1,valid:!0,validating:0,values:e?u({},e):{}},lastFormState:void 0},S=!1,y=function(t,e,r){if(t.fields[e]){var i=r(l(t.formState.values,e));t.formState.values=f(t.formState.values,e,i)||{}}},j=n&&Object.keys(n).reduce(function(t,e){return t[e]=function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];var a={formState:b.formState,fields:b.fields},o=n[e](r,a,{changeValue:y,getIn:l,setIn:f,shallowEqual:v});return b.formState=a.formState,b.fields=a.fields,F(void 0,function(){k(),A()}),o},t},{}),w=function(t){return Object.keys(t.validators).reduce(function(e,r){var i=t.validators[Number(r)]();return i&&e.push(i),e},[])},F=function(t,e){var r=b.fields,i=b.formState,n=Object.keys(r);if(o||n.some(function(t){return w(r[t]).length})){if(t){var a=r[t].validateFields;a&&(n=a.length?a.concat(t):[t])}var c={},d={},m=[].concat(s(function(t){var e=[];if(o){var r=o(u({},b.formState.values));p(r)?e.push(r.then(t)):t(r)}return e}(function(t){c=t||{}})),s(n.reduce(function(t,e){return t.concat(function(t,e){var r=[],i=w(t);if(i.length){var n=void 0;i.forEach(function(i){var a=i(l(b.formState.values,t.name),b.formState.values);a&&p(a)?r.push(a.then(e)):n||(n=a)}),e(n)}return r}(r[e],function(t){d[e]=t}))},[]))),S=function(){var t=u({},c);n.forEach(function(e){if(r[e]){var i=d[e]||l(c,e);i&&(t=f(t,e,i))}}),v(i.errors,t)||(i.errors=t),i.error=c[E]};S(),m.length?(b.formState.validating++,e&&e(),Promise.all(m).then(function(){b.formState.validating--,S(),e&&e()})):e&&e()}else e&&e()},k=function(t){if(!S){var e=b.fields,r=b.fieldSubscribers,n=b.formState;Object.keys(e).forEach(function(t){var a=e[t],o=c(n,a),u=a.lastFieldState;v(o,u)||(a.lastFieldState=o,i(r[t],o,u,m))})}},V=function(){var t=b.fields,e=b.formState,r=b.lastFormState,i=Object.keys(t);e.pristine=i.every(function(r){return t[r].isEqual(l(e.values,r),l(e.initialValues||{},r))}),e.dirtySinceLastSubmit=!(!e.lastSubmittedValues||i.every(function(r){return t[r].isEqual(l(e.values,r),l(e.lastSubmittedValues||{},r))})),e.valid=!(e.error||e.submitError||Object.keys(e.errors).length||e.submitErrors&&Object.keys(e.submitErrors).length);var n=O(e);return r&&v(r,n)?r:n},A=function(){if(!S){var t=b.lastFormState,e=V();e!==t&&(b.lastFormState=e,i(b.subscribers,e,t,h))}};F();var N={batch:function(t){S=!0,t(),S=!1,k(),A()},blur:function(t){var e=b.fields,r=b.formState,i=e[t];i&&(delete r.active,e[t]=u({},i,{active:!1,touched:!0}),d?F(t,function(){k(),A()}):(k(),A()))},change:function(t,e){var r=b.fields,i=b.formState;r[t]&&l(i.values,t)!==e&&(y(b,t,function(){return e}),d?(k(),A()):F(t,function(){k(),A()}))},focus:function(t){var e=b.fields[t];e&&!e.active&&(b.formState.active=t,e.active=!0,e.visited=!0,k(),A())},mutators:j,getRegisteredFields:function(){return Object.keys(b.fields)},getState:function(){return O(b.formState)},initialize:function(t){var e=b.fields,r=b.formState;r.initialValues=t,r.values=t,Object.keys(e).forEach(function(t){var r=e[t];r.touched=!1,r.visited=!1}),F(void 0,function(){k(),A()})},registerField:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments[3];b.fieldSubscribers[t]||(b.fieldSubscribers[t]={index:0,entries:{}});var a=b.fieldSubscribers[t].index++;if(b.fieldSubscribers[t].entries[a]={subscriber:g(e),subscription:i},!b.fields[t]){var o=b.formState.initialValues?l(b.formState.initialValues,t):void 0;b.fields[t]={active:!1,blur:function(){return N.blur(t)},change:function(e){return N.change(t,e)},data:{},focus:function(){return N.focus(t)},initial:o,isEqual:n&&n.isEqual||function(t,e){return t===e},lastFieldState:void 0,name:t,touched:!1,valid:!0,validateFields:n&&n.validateFields,validators:{},visited:!1}}n&&n.getValidator&&(b.fields[t].validators[a]=n.getValidator);var u=!1;return F(void 0,function(){A(),u||function(){var n=c(b.formState,b.fields[t]);r(e,i,n,void 0,m,!0),b.fields[t].lastFieldState=n,u=!0}(),k()}),function(){delete b.fields[t].validators[a],delete b.fieldSubscribers[t].entries[a],Object.keys(b.fieldSubscribers[t].entries).length||(delete b.fieldSubscribers[t],delete b.fields[t]),F(void 0,function(){k(),A()})}},reset:function(){N.initialize(b.formState.initialValues||{})},submit:function(){var t=b.formState,e=b.fields;if(b.formState.error||Object.keys(b.formState.errors).length)return Object.keys(e).forEach(function(t){e[t].touched=!0}),b.formState.submitFailed=!0,A(),void k();var r=void 0,i=!1,n=function(e){t.submitting=!1,e&&(Object.keys(e).length||Object.getOwnPropertySymbols(e).length)?(t.submitFailed=!0,t.submitSucceeded=!1,t.submitErrors=e,t.submitError=e[E]):(delete t.submitErrors,delete t.submitError,t.submitFailed=!1,t.submitSucceeded=!0),A(),k(),i=!0,r&&r()};if(t.submitting=!0,t.submitFailed=!1,t.submitSucceeded=!1,t.lastSubmittedValues=u({},t.values),3===a.length){if(a(t.values,N,n),!i)return A(),new Promise(function(t){r=t})}else{var o=a(t.values,N);if(o&&p(o))return A(),o.then(n);n(o)}},subscribe:function(t,e){if(!t)throw new Error("No callback given.");if(!e)throw new Error("No subscription provided. What values do you want to listen to?");var i=g(t),n=b.subscribers,a=b.lastFormState,o=n.index++;n.entries[o]={subscriber:i,subscription:e};var u=V();return u!==a&&(b.lastFormState=u),r(i,e,u,u,h,!0),function(){delete n.entries[o]}}};return N},t.FORM_ERROR=E,t.version="4.0.1",t.formSubscriptionItems=S,t.fieldSubscriptionItems=d,t.getIn=l,t.setIn=f,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t["final-form"]={})}(this,function(t){"use strict";function e(t,e,r,i,n,a){var o=!1;return n.forEach(function(n){i[n]&&(t[n]=e[n],r&&(~a.indexOf(n)?v(e[n],r[n]):e[n]===r[n])||(o=!0))}),o}function r(t,e,r,i,n){var a=n(r,i,e,arguments.length>5&&void 0!==arguments[5]&&arguments[5]);a&&t(a)}function i(t,e,i,n){var a=t.entries;Object.keys(a).forEach(function(t){var o=a[Number(t)],u=o.subscription;r(o.subscriber,u,e,i,n)})}var n=function(t){if(null===t||void 0===t)return[];if("string"!=typeof t)throw new Error("toPath() expects a string");return t.length?t.split(/[.[\]]+/).filter(Boolean):[]},a="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},o=function(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},s=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e<t.length;e++)r[e]=t[e];return r}return Array.from(t)},l=function(t,e){var r=n(e),i=t,o=!0,u=!1,s=void 0;try{for(var l,f=r[Symbol.iterator]();!(o=(l=f.next()).done);o=!0){var c=l.value;if(void 0===i||null===i||"object"!==(void 0===i?"undefined":a(i))||Array.isArray(i)&&isNaN(c))return;i=i[c]}}catch(t){u=!0,s=t}finally{try{!o&&f.return&&f.return()}finally{if(u)throw s}}return i},f=function(t,e,r){if(void 0===t||null===t)throw new Error("Cannot call setIn() with "+String(t)+" state");if(void 0===e||null===e)throw new Error("Cannot call setIn() with "+String(e)+" key");return function t(e,r,i,n){if(r>=i.length)return n;var a=i[r];if(isNaN(a)){if(void 0===e||null===e){var l=t(void 0,r+1,i,n);return void 0===l?void 0:o({},a,l)}if(Array.isArray(e))throw new Error("Cannot set a non-numeric property on an array");var f=t(e[a],r+1,i,n),c=Object.keys(e).length;if(void 0===f){if(void 0===e[a]&&0===c)return;if(void 0!==e[a]&&c<=1)return isNaN(i[r-1])?void 0:{}}return u({},e,o({},a,f))}var d=Number(a);if(void 0===e||null===e){var v=t(void 0,r+1,i,n);if(void 0===v)return;var b=[];return b[d]=v,b}if(!Array.isArray(e))throw new Error("Cannot set a numeric property on an object");var m=t(e[d],r+1,i,n),S=[].concat(s(e));return void 0===m?S.splice(d,1):S[d]=m,S}(t,0,n(e),r)},c=function(t,e){var r=t.errors,i=t.initialValues,n=t.lastSubmittedValues,a=t.submitErrors,o=t.submitFailed,u=t.submitSucceeded,s=t.values,f=e.active,c=e.blur,d=e.change,v=e.data,b=e.focus,m=e.name,S=e.touched,y=e.visited,h=l(s,m),g=l(r,m),p=a&&l(a,m),E=i&&l(i,m),O=e.isEqual(E,h),j=!(!n||e.isEqual(l(n,m),h)),w=!g&&!p;return{active:f,blur:c,change:d,data:v,dirty:!O,dirtySinceLastSubmit:j,error:g,focus:b,initial:E,invalid:!w,length:Array.isArray(h)?h.length:void 0,name:m,pristine:O,submitError:p,submitFailed:o,submitSucceeded:u,touched:S,valid:w,value:h,visited:y}},d=["active","data","dirty","dirtySinceLastSubmit","error","initial","invalid","length","pristine","submitError","submitFailed","submitSucceeded","touched","valid","value","visited"],v=function(t,e){if(t===e)return!0;if("object"!==(void 0===t?"undefined":a(t))||!t||"object"!==(void 0===e?"undefined":a(e))||!e)return!1;var r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(var n=Object.prototype.hasOwnProperty.bind(e),o=0;o<r.length;o++){var u=r[o];if(!n(u)||t[u]!==e[u])return!1}return!0},b=["data"],m=function(t,r,i,n){var a={blur:t.blur,change:t.change,focus:t.focus,name:t.name};return e(a,t,r,i,d,b)||!r||n?a:void 0},S=["active","dirty","dirtySinceLastSubmit","error","errors","initialValues","invalid","pristine","submitting","submitError","submitErrors","submitFailed","submitSucceeded","valid","validating","values"],y=[],h=function(t,r,i,n){var a={};return e(a,t,r,i,S,y)||!r||n?a:void 0},g=function(t){var e=void 0,r=void 0;return function(){for(var i=arguments.length,n=Array(i),a=0;a<i;a++)n[a]=arguments[a];return e&&n.length===e.length&&!n.some(function(t,r){return!v(e[r],t)})||(e=n,r=t.apply(void 0,n)),r}},p=function(t){return!!t&&("object"===(void 0===t?"undefined":a(t))||"function"==typeof t)&&"function"==typeof t.then},E=Symbol("form-error"),O=function(t){var e=t.active,r=t.dirtySinceLastSubmit,i=t.error,n=t.errors,a=t.initialValues,o=t.pristine,u=t.submitting,s=t.submitFailed,l=t.submitSucceeded,f=t.submitError,c=t.submitErrors,d=t.valid;return{active:e,dirty:!o,dirtySinceLastSubmit:r,error:i,errors:n,invalid:!d,initialValues:a,pristine:o,submitting:u,submitFailed:s,submitSucceeded:l,submitError:f,submitErrors:c,valid:d,validating:t.validating>0,values:t.values}};t.createForm=function(t){if(!t)throw new Error("No config specified");t.debug;var e=t.initialValues,n=t.mutators,a=t.onSubmit,o=t.validate,d=t.validateOnBlur;if(!a)throw new Error("No onSubmit function specified");var b={subscribers:{index:0,entries:{}},fieldSubscribers:{},fields:{},formState:{dirtySinceLastSubmit:!1,errors:{},initialValues:e&&u({},e),invalid:!1,pristine:!0,submitting:!1,submitFailed:!1,submitSucceeded:!1,valid:!0,validating:0,values:e?u({},e):{}},lastFormState:void 0},S=!1,y=function(t,e,r){if(t.fields[e]){var i=r(l(t.formState.values,e));t.formState.values=f(t.formState.values,e,i)||{}}},j=n&&Object.keys(n).reduce(function(t,e){return t[e]=function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];var a={formState:b.formState,fields:b.fields},o=n[e](r,a,{changeValue:y,getIn:l,setIn:f,shallowEqual:v});return b.formState=a.formState,b.fields=a.fields,F(void 0,function(){k(),A()}),o},t},{}),w=function(t){return Object.keys(t.validators).reduce(function(e,r){var i=t.validators[Number(r)]();return i&&e.push(i),e},[])},F=function(t,e){var r=b.fields,i=b.formState,n=Object.keys(r);if(o||n.some(function(t){return w(r[t]).length})){if(t){var a=r[t].validateFields;a&&(n=a.length?a.concat(t):[t])}var c={},d={},m=[].concat(s(function(t){var e=[];if(o){var r=o(u({},b.formState.values));p(r)?e.push(r.then(t)):t(r)}return e}(function(t){c=t||{}})),s(n.reduce(function(t,e){return t.concat(function(t,e){var r=[],i=w(t);if(i.length){var n=void 0;i.forEach(function(i){var a=i(l(b.formState.values,t.name),b.formState.values);a&&p(a)?r.push(a.then(e)):n||(n=a)}),e(n)}return r}(r[e],function(t){d[e]=t}))},[]))),S=function(){var t=u({},c);n.forEach(function(e){if(r[e]){var i=d[e]||l(c,e);i&&(t=f(t,e,i))}}),v(i.errors,t)||(i.errors=t),i.error=c[E]};S(),m.length?(b.formState.validating++,e&&e(),Promise.all(m).then(function(){b.formState.validating--,S(),e&&e()})):e&&e()}else e&&e()},k=function(t){if(!S){var e=b.fields,r=b.fieldSubscribers,n=b.formState;Object.keys(e).forEach(function(t){var a=e[t],o=c(n,a),u=a.lastFieldState;v(o,u)||(a.lastFieldState=o,i(r[t],o,u,m))})}},V=function(){var t=b.fields,e=b.formState,r=b.lastFormState,i=Object.keys(t);e.pristine=i.every(function(r){return t[r].isEqual(l(e.values,r),l(e.initialValues||{},r))}),e.dirtySinceLastSubmit=!(!e.lastSubmittedValues||i.every(function(r){return t[r].isEqual(l(e.values,r),l(e.lastSubmittedValues||{},r))})),e.valid=!(e.error||e.submitError||Object.keys(e.errors).length||e.submitErrors&&Object.keys(e.submitErrors).length);var n=O(e);return r&&v(r,n)?r:n},A=function(){if(!S){var t=b.lastFormState,e=V();e!==t&&(b.lastFormState=e,i(b.subscribers,e,t,h))}};F();var N={batch:function(t){S=!0,t(),S=!1,k(),A()},blur:function(t){var e=b.fields,r=b.formState,i=e[t];i&&(delete r.active,e[t]=u({},i,{active:!1,touched:!0}),d?F(t,function(){k(),A()}):(k(),A()))},change:function(t,e){var r=b.fields,i=b.formState;r[t]&&l(i.values,t)!==e&&(y(b,t,function(){return e}),d?(k(),A()):F(t,function(){k(),A()}))},focus:function(t){var e=b.fields[t];e&&!e.active&&(b.formState.active=t,e.active=!0,e.visited=!0,k(),A())},mutators:j,getRegisteredFields:function(){return Object.keys(b.fields)},getState:function(){return O(b.formState)},initialize:function(t){var e=b.fields,r=b.formState;r.initialValues=t,r.values=t,Object.keys(e).forEach(function(t){var r=e[t];r.touched=!1,r.visited=!1}),F(void 0,function(){k(),A()})},registerField:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments[3];b.fieldSubscribers[t]||(b.fieldSubscribers[t]={index:0,entries:{}});var a=b.fieldSubscribers[t].index++;if(b.fieldSubscribers[t].entries[a]={subscriber:g(e),subscription:i},!b.fields[t]){var o=b.formState.initialValues?l(b.formState.initialValues,t):void 0;b.fields[t]={active:!1,blur:function(){return N.blur(t)},change:function(e){return N.change(t,e)},data:{},focus:function(){return N.focus(t)},initial:o,isEqual:n&&n.isEqual||function(t,e){return t===e},lastFieldState:void 0,name:t,touched:!1,valid:!0,validateFields:n&&n.validateFields,validators:{},visited:!1}}n&&n.getValidator&&(b.fields[t].validators[a]=n.getValidator);var u=!1;return F(void 0,function(){A(),u||function(){var n=c(b.formState,b.fields[t]);r(e,i,n,void 0,m,!0),b.fields[t].lastFieldState=n,u=!0}(),k()}),function(){delete b.fields[t].validators[a],delete b.fieldSubscribers[t].entries[a],Object.keys(b.fieldSubscribers[t].entries).length||(delete b.fieldSubscribers[t],delete b.fields[t]),F(void 0,function(){k(),A()})}},reset:function(){N.initialize(b.formState.initialValues||{})},submit:function(){var t=b.formState,e=b.fields;if(b.formState.error||Object.keys(b.formState.errors).length)return Object.keys(e).forEach(function(t){e[t].touched=!0}),b.formState.submitFailed=!0,A(),void k();var r=void 0,i=!1,n=function(e){t.submitting=!1,e&&(Object.keys(e).length||Object.getOwnPropertySymbols(e).length)?(t.submitFailed=!0,t.submitSucceeded=!1,t.submitErrors=e,t.submitError=e[E]):(delete t.submitErrors,delete t.submitError,t.submitFailed=!1,t.submitSucceeded=!0),A(),k(),i=!0,r&&r()};if(t.submitting=!0,t.submitFailed=!1,t.submitSucceeded=!1,t.lastSubmittedValues=u({},t.values),3===a.length){if(a(t.values,N,n),!i)return A(),new Promise(function(t){r=t})}else{var o=a(t.values,N);if(o&&p(o))return A(),o.then(n);n(o)}},subscribe:function(t,e){if(!t)throw new Error("No callback given.");if(!e)throw new Error("No subscription provided. What values do you want to listen to?");var i=g(t),n=b.subscribers,a=b.lastFormState,o=n.index++;n.entries[o]={subscriber:i,subscription:e};var u=V();return u!==a&&(b.lastFormState=u),r(i,e,u,u,h,!0),function(){delete n.entries[o]}}};return N},t.FORM_ERROR=E,t.version="4.0.2",t.formSubscriptionItems=S,t.fieldSubscriptionItems=d,t.getIn=l,t.setIn=f,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=final-form.umd.min.js.map

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

export interface Subscription {
[key: string]: boolean
}
export type Subscriber<V> = (value: V) => void

@@ -8,19 +5,19 @@ export type IsEqual = (a: any, b: any) => boolean

export interface FormSubscription extends Subscription {
active: boolean
dirty: boolean
dirtySinceLastSubmit: boolean
error: boolean
errors: boolean
initialValues: boolean
invalid: boolean
pristine: boolean
submitError: boolean
submitErrors: boolean
submitFailed: boolean
submitSucceeded: boolean
submitting: boolean
valid: boolean
validating: boolean
values: boolean
export interface FormSubscription {
active?: boolean
dirty?: boolean
dirtySinceLastSubmit?: boolean
error?: boolean
errors?: boolean
initialValues?: boolean
invalid?: boolean
pristine?: boolean
submitError?: boolean
submitErrors?: boolean
submitFailed?: boolean
submitting?: boolean
submitSucceeded?: boolean
valid?: boolean
validating?: boolean
values?: boolean
}

@@ -73,19 +70,19 @@

export interface FieldSubscription extends Subscription {
active: boolean
data: boolean
dirty: boolean
dirtySinceLastSubmit: boolean
error: boolean
initial: boolean
invalid: boolean
length: boolean
pristine: boolean
submitError: boolean
submitFailed: boolean
submitSucceeded: boolean
touched: boolean
valid: boolean
value: boolean
visited: boolean
export interface FieldSubscription {
active?: boolean
data?: boolean
dirty?: boolean
dirtySinceLastSubmit?: boolean
error?: boolean
initial?: boolean
invalid?: boolean
length?: boolean
pristine?: boolean
submitError?: boolean
submitFailed?: boolean
submitSucceeded?: boolean
touched?: boolean
valid?: boolean
value?: boolean
visited?: boolean
}

@@ -92,0 +89,0 @@

{
"name": "final-form",
"version": "4.0.2",
"description": "🏁 Framework agnostic, high performance, subscription-based form state management",
"version": "4.0.3",
"description":
"🏁 Framework agnostic, high performance, subscription-based form state management",
"main": "dist/final-form.cjs.js",

@@ -9,5 +10,3 @@ "jsnext:main": "dist/final-form.es.js",

"typings": "dist/index.d.js",
"files": [
"dist"
],
"files": ["dist"],
"scripts": {

@@ -18,3 +17,4 @@ "start": "nps",

},
"author": "Erik Rasmussen <rasmussenerik@gmail.com> (http://github.com/erikras)",
"author":
"Erik Rasmussen <rasmussenerik@gmail.com> (http://github.com/erikras)",
"license": "MIT",

@@ -64,6 +64,3 @@ "repository": {

"lint-staged": {
"*.{js*,ts*,json,md,css}": [
"prettier --write",
"git add"
]
"*.{js*,ts*,json,md,css}": ["prettier --write", "git add"]
},

@@ -70,0 +67,0 @@ "bundlesize": [

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