final-form
Advanced tools
Comparing version 4.13.0 to 4.13.1
@@ -403,3 +403,3 @@ 'use strict'; | ||
Object.keys(entries).forEach(function (key) { | ||
var entry = entries[Number(key)]; | ||
var entry = entries[Number(key)]; // istanbul ignore next | ||
@@ -604,6 +604,9 @@ if (entry) { | ||
formState = state.formState; | ||
var fieldKeys = Object.keys(fields); | ||
var safeFields = _extends({}, fields); | ||
var fieldKeys = Object.keys(safeFields); | ||
if (!validate && !fieldKeys.some(function (key) { | ||
return getValidators(fields[key]).length; | ||
return getValidators(safeFields[key]).length; | ||
})) { | ||
@@ -621,3 +624,3 @@ if (callback) { | ||
if (fieldChanged) { | ||
var changedField = fields[fieldChanged]; | ||
var changedField = safeFields[fieldChanged]; | ||
@@ -639,3 +642,3 @@ if (changedField) { | ||
}), fieldKeys.reduce(function (result, name) { | ||
return result.concat(runFieldLevelValidation(fields[name], function (error) { | ||
return result.concat(runFieldLevelValidation(safeFields[name], function (error) { | ||
fieldLevelErrors[name] = error; | ||
@@ -655,3 +658,3 @@ })); | ||
var errorFromParent = getIn(merged, name); | ||
var hasFieldLevelValidation = getValidators(fields[name]).length; | ||
var hasFieldLevelValidation = getValidators(safeFields[name]).length; | ||
var fieldLevelError = fieldLevelErrors[name]; | ||
@@ -716,4 +719,7 @@ fn(name, hasFieldLevelValidation && fieldLevelError || validate && recordLevelError || (!recordLevelError && !limitedFieldLevelValidation ? errorFromParent : undefined)); | ||
formState = state.formState; | ||
Object.keys(fields).forEach(function (name) { | ||
var field = fields[name]; | ||
var safeFields = _extends({}, fields); | ||
Object.keys(safeFields).forEach(function (name) { | ||
var field = safeFields[name]; | ||
var fieldState = publishFieldState(formState, field); | ||
@@ -731,3 +737,3 @@ var lastFieldState = field.lastFieldState; | ||
// 'notifying', | ||
// name, | ||
// field.name, | ||
// '\nField State\n', | ||
@@ -748,3 +754,7 @@ // diffKeys.reduce( | ||
field.lastFieldState = fieldState; | ||
notify(fieldSubscribers[name], fieldState, lastFieldState, filterFieldState); | ||
var fieldSubscriber = fieldSubscribers[name]; | ||
if (fieldSubscriber) { | ||
notify(fieldSubscriber, fieldState, lastFieldState, filterFieldState); | ||
} | ||
} | ||
@@ -768,7 +778,10 @@ }); | ||
lastFormState = state.lastFormState; | ||
var fieldKeys = Object.keys(fields); // calculate dirty/pristine | ||
var safeFields = _extends({}, fields); | ||
var safeFieldKeys = Object.keys(safeFields); // calculate dirty/pristine | ||
var foundDirty = false; | ||
var dirtyFields = fieldKeys.reduce(function (result, key) { | ||
var dirty = !fields[key].isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
var dirtyFields = safeFieldKeys.reduce(function (result, key) { | ||
var dirty = !safeFields[key].isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
@@ -783,7 +796,7 @@ if (dirty) { | ||
formState.pristine = !foundDirty; | ||
formState.dirtySinceLastSubmit = !!(formState.lastSubmittedValues && !fieldKeys.every(function (key) { | ||
formState.dirtySinceLastSubmit = !!(formState.lastSubmittedValues && !safeFieldKeys.every(function (key) { | ||
// istanbul ignore next | ||
var nonNullLastSubmittedValues = formState.lastSubmittedValues || {}; // || {} is for flow, but causes branch coverage complaint | ||
return fields[key].isEqual(getIn(formState.values, key), getIn(nonNullLastSubmittedValues, key)); | ||
return safeFields[key].isEqual(getIn(formState.values, key), getIn(nonNullLastSubmittedValues, key)); | ||
})); | ||
@@ -793,6 +806,6 @@ formState.valid = !formState.error && !formState.submitError && !hasAnyError(formState.errors) && !(formState.submitErrors && hasAnyError(formState.submitErrors)); | ||
var _fieldKeys$reduce = fieldKeys.reduce(function (result, key) { | ||
result.modified[key] = fields[key].modified; | ||
result.touched[key] = fields[key].touched; | ||
result.visited[key] = fields[key].visited; | ||
var _safeFieldKeys$reduce = safeFieldKeys.reduce(function (result, key) { | ||
result.modified[key] = safeFields[key].modified; | ||
result.touched[key] = safeFields[key].touched; | ||
result.visited[key] = safeFields[key].visited; | ||
return result; | ||
@@ -804,5 +817,5 @@ }, { | ||
}), | ||
modified = _fieldKeys$reduce.modified, | ||
touched = _fieldKeys$reduce.touched, | ||
visited = _fieldKeys$reduce.visited; | ||
modified = _safeFieldKeys$reduce.modified, | ||
touched = _safeFieldKeys$reduce.touched, | ||
visited = _safeFieldKeys$reduce.visited; | ||
@@ -951,2 +964,5 @@ nextFormState.dirtyFields = lastFormState && shallowEqual(lastFormState.dirtyFields, dirtyFields) ? lastFormState.dirtyFields : dirtyFields; | ||
formState = state.formState; | ||
var safeFields = _extends({}, fields); | ||
var values = typeof data === 'function' ? data(formState.values) : data; | ||
@@ -958,4 +974,4 @@ | ||
Object.keys(fields).forEach(function (key) { | ||
var field = fields[key]; | ||
Object.keys(safeFields).forEach(function (key) { | ||
var field = safeFields[key]; | ||
field.modified = false; | ||
@@ -966,3 +982,3 @@ field.touched = false; | ||
if (keepDirtyOnReinitialize) { | ||
var pristine = fields[key].isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
var pristine = field.isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
@@ -969,0 +985,0 @@ if (pristine) { |
@@ -397,3 +397,3 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
Object.keys(entries).forEach(function (key) { | ||
var entry = entries[Number(key)]; | ||
var entry = entries[Number(key)]; // istanbul ignore next | ||
@@ -598,6 +598,9 @@ if (entry) { | ||
formState = state.formState; | ||
var fieldKeys = Object.keys(fields); | ||
var safeFields = _extends({}, fields); | ||
var fieldKeys = Object.keys(safeFields); | ||
if (!validate && !fieldKeys.some(function (key) { | ||
return getValidators(fields[key]).length; | ||
return getValidators(safeFields[key]).length; | ||
})) { | ||
@@ -615,3 +618,3 @@ if (callback) { | ||
if (fieldChanged) { | ||
var changedField = fields[fieldChanged]; | ||
var changedField = safeFields[fieldChanged]; | ||
@@ -633,3 +636,3 @@ if (changedField) { | ||
}), fieldKeys.reduce(function (result, name) { | ||
return result.concat(runFieldLevelValidation(fields[name], function (error) { | ||
return result.concat(runFieldLevelValidation(safeFields[name], function (error) { | ||
fieldLevelErrors[name] = error; | ||
@@ -649,3 +652,3 @@ })); | ||
var errorFromParent = getIn(merged, name); | ||
var hasFieldLevelValidation = getValidators(fields[name]).length; | ||
var hasFieldLevelValidation = getValidators(safeFields[name]).length; | ||
var fieldLevelError = fieldLevelErrors[name]; | ||
@@ -710,4 +713,7 @@ fn(name, hasFieldLevelValidation && fieldLevelError || validate && recordLevelError || (!recordLevelError && !limitedFieldLevelValidation ? errorFromParent : undefined)); | ||
formState = state.formState; | ||
Object.keys(fields).forEach(function (name) { | ||
var field = fields[name]; | ||
var safeFields = _extends({}, fields); | ||
Object.keys(safeFields).forEach(function (name) { | ||
var field = safeFields[name]; | ||
var fieldState = publishFieldState(formState, field); | ||
@@ -725,3 +731,3 @@ var lastFieldState = field.lastFieldState; | ||
// 'notifying', | ||
// name, | ||
// field.name, | ||
// '\nField State\n', | ||
@@ -742,3 +748,7 @@ // diffKeys.reduce( | ||
field.lastFieldState = fieldState; | ||
notify(fieldSubscribers[name], fieldState, lastFieldState, filterFieldState); | ||
var fieldSubscriber = fieldSubscribers[name]; | ||
if (fieldSubscriber) { | ||
notify(fieldSubscriber, fieldState, lastFieldState, filterFieldState); | ||
} | ||
} | ||
@@ -762,7 +772,10 @@ }); | ||
lastFormState = state.lastFormState; | ||
var fieldKeys = Object.keys(fields); // calculate dirty/pristine | ||
var safeFields = _extends({}, fields); | ||
var safeFieldKeys = Object.keys(safeFields); // calculate dirty/pristine | ||
var foundDirty = false; | ||
var dirtyFields = fieldKeys.reduce(function (result, key) { | ||
var dirty = !fields[key].isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
var dirtyFields = safeFieldKeys.reduce(function (result, key) { | ||
var dirty = !safeFields[key].isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
@@ -777,7 +790,7 @@ if (dirty) { | ||
formState.pristine = !foundDirty; | ||
formState.dirtySinceLastSubmit = !!(formState.lastSubmittedValues && !fieldKeys.every(function (key) { | ||
formState.dirtySinceLastSubmit = !!(formState.lastSubmittedValues && !safeFieldKeys.every(function (key) { | ||
// istanbul ignore next | ||
var nonNullLastSubmittedValues = formState.lastSubmittedValues || {}; // || {} is for flow, but causes branch coverage complaint | ||
return fields[key].isEqual(getIn(formState.values, key), getIn(nonNullLastSubmittedValues, key)); | ||
return safeFields[key].isEqual(getIn(formState.values, key), getIn(nonNullLastSubmittedValues, key)); | ||
})); | ||
@@ -787,6 +800,6 @@ formState.valid = !formState.error && !formState.submitError && !hasAnyError(formState.errors) && !(formState.submitErrors && hasAnyError(formState.submitErrors)); | ||
var _fieldKeys$reduce = fieldKeys.reduce(function (result, key) { | ||
result.modified[key] = fields[key].modified; | ||
result.touched[key] = fields[key].touched; | ||
result.visited[key] = fields[key].visited; | ||
var _safeFieldKeys$reduce = safeFieldKeys.reduce(function (result, key) { | ||
result.modified[key] = safeFields[key].modified; | ||
result.touched[key] = safeFields[key].touched; | ||
result.visited[key] = safeFields[key].visited; | ||
return result; | ||
@@ -798,5 +811,5 @@ }, { | ||
}), | ||
modified = _fieldKeys$reduce.modified, | ||
touched = _fieldKeys$reduce.touched, | ||
visited = _fieldKeys$reduce.visited; | ||
modified = _safeFieldKeys$reduce.modified, | ||
touched = _safeFieldKeys$reduce.touched, | ||
visited = _safeFieldKeys$reduce.visited; | ||
@@ -945,2 +958,5 @@ nextFormState.dirtyFields = lastFormState && shallowEqual(lastFormState.dirtyFields, dirtyFields) ? lastFormState.dirtyFields : dirtyFields; | ||
formState = state.formState; | ||
var safeFields = _extends({}, fields); | ||
var values = typeof data === 'function' ? data(formState.values) : data; | ||
@@ -952,4 +968,4 @@ | ||
Object.keys(fields).forEach(function (key) { | ||
var field = fields[key]; | ||
Object.keys(safeFields).forEach(function (key) { | ||
var field = safeFields[key]; | ||
field.modified = false; | ||
@@ -960,3 +976,3 @@ field.touched = false; | ||
if (keepDirtyOnReinitialize) { | ||
var pristine = fields[key].isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
var pristine = field.isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
@@ -963,0 +979,0 @@ if (pristine) { |
@@ -433,3 +433,3 @@ (function (global, factory) { | ||
Object.keys(entries).forEach(function (key) { | ||
var entry = entries[Number(key)]; | ||
var entry = entries[Number(key)]; // istanbul ignore next | ||
@@ -634,6 +634,9 @@ if (entry) { | ||
formState = state.formState; | ||
var fieldKeys = Object.keys(fields); | ||
var safeFields = _extends({}, fields); | ||
var fieldKeys = Object.keys(safeFields); | ||
if (!validate && !fieldKeys.some(function (key) { | ||
return getValidators(fields[key]).length; | ||
return getValidators(safeFields[key]).length; | ||
})) { | ||
@@ -651,3 +654,3 @@ if (callback) { | ||
if (fieldChanged) { | ||
var changedField = fields[fieldChanged]; | ||
var changedField = safeFields[fieldChanged]; | ||
@@ -669,3 +672,3 @@ if (changedField) { | ||
}), fieldKeys.reduce(function (result, name) { | ||
return result.concat(runFieldLevelValidation(fields[name], function (error) { | ||
return result.concat(runFieldLevelValidation(safeFields[name], function (error) { | ||
fieldLevelErrors[name] = error; | ||
@@ -685,3 +688,3 @@ })); | ||
var errorFromParent = getIn(merged, name); | ||
var hasFieldLevelValidation = getValidators(fields[name]).length; | ||
var hasFieldLevelValidation = getValidators(safeFields[name]).length; | ||
var fieldLevelError = fieldLevelErrors[name]; | ||
@@ -746,4 +749,7 @@ fn(name, hasFieldLevelValidation && fieldLevelError || validate && recordLevelError || (!recordLevelError && !limitedFieldLevelValidation ? errorFromParent : undefined)); | ||
formState = state.formState; | ||
Object.keys(fields).forEach(function (name) { | ||
var field = fields[name]; | ||
var safeFields = _extends({}, fields); | ||
Object.keys(safeFields).forEach(function (name) { | ||
var field = safeFields[name]; | ||
var fieldState = publishFieldState(formState, field); | ||
@@ -761,3 +767,3 @@ var lastFieldState = field.lastFieldState; | ||
// 'notifying', | ||
// name, | ||
// field.name, | ||
// '\nField State\n', | ||
@@ -778,3 +784,7 @@ // diffKeys.reduce( | ||
field.lastFieldState = fieldState; | ||
notify(fieldSubscribers[name], fieldState, lastFieldState, filterFieldState); | ||
var fieldSubscriber = fieldSubscribers[name]; | ||
if (fieldSubscriber) { | ||
notify(fieldSubscriber, fieldState, lastFieldState, filterFieldState); | ||
} | ||
} | ||
@@ -798,7 +808,10 @@ }); | ||
lastFormState = state.lastFormState; | ||
var fieldKeys = Object.keys(fields); // calculate dirty/pristine | ||
var safeFields = _extends({}, fields); | ||
var safeFieldKeys = Object.keys(safeFields); // calculate dirty/pristine | ||
var foundDirty = false; | ||
var dirtyFields = fieldKeys.reduce(function (result, key) { | ||
var dirty = !fields[key].isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
var dirtyFields = safeFieldKeys.reduce(function (result, key) { | ||
var dirty = !safeFields[key].isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
@@ -813,7 +826,7 @@ if (dirty) { | ||
formState.pristine = !foundDirty; | ||
formState.dirtySinceLastSubmit = !!(formState.lastSubmittedValues && !fieldKeys.every(function (key) { | ||
formState.dirtySinceLastSubmit = !!(formState.lastSubmittedValues && !safeFieldKeys.every(function (key) { | ||
// istanbul ignore next | ||
var nonNullLastSubmittedValues = formState.lastSubmittedValues || {}; // || {} is for flow, but causes branch coverage complaint | ||
return fields[key].isEqual(getIn(formState.values, key), getIn(nonNullLastSubmittedValues, key)); | ||
return safeFields[key].isEqual(getIn(formState.values, key), getIn(nonNullLastSubmittedValues, key)); | ||
})); | ||
@@ -823,6 +836,6 @@ formState.valid = !formState.error && !formState.submitError && !hasAnyError(formState.errors) && !(formState.submitErrors && hasAnyError(formState.submitErrors)); | ||
var _fieldKeys$reduce = fieldKeys.reduce(function (result, key) { | ||
result.modified[key] = fields[key].modified; | ||
result.touched[key] = fields[key].touched; | ||
result.visited[key] = fields[key].visited; | ||
var _safeFieldKeys$reduce = safeFieldKeys.reduce(function (result, key) { | ||
result.modified[key] = safeFields[key].modified; | ||
result.touched[key] = safeFields[key].touched; | ||
result.visited[key] = safeFields[key].visited; | ||
return result; | ||
@@ -834,5 +847,5 @@ }, { | ||
}), | ||
modified = _fieldKeys$reduce.modified, | ||
touched = _fieldKeys$reduce.touched, | ||
visited = _fieldKeys$reduce.visited; | ||
modified = _safeFieldKeys$reduce.modified, | ||
touched = _safeFieldKeys$reduce.touched, | ||
visited = _safeFieldKeys$reduce.visited; | ||
@@ -981,2 +994,5 @@ nextFormState.dirtyFields = lastFormState && shallowEqual(lastFormState.dirtyFields, dirtyFields) ? lastFormState.dirtyFields : dirtyFields; | ||
formState = state.formState; | ||
var safeFields = _extends({}, fields); | ||
var values = typeof data === 'function' ? data(formState.values) : data; | ||
@@ -988,4 +1004,4 @@ | ||
Object.keys(fields).forEach(function (key) { | ||
var field = fields[key]; | ||
Object.keys(safeFields).forEach(function (key) { | ||
var field = safeFields[key]; | ||
field.modified = false; | ||
@@ -996,3 +1012,3 @@ field.touched = false; | ||
if (keepDirtyOnReinitialize) { | ||
var pristine = fields[key].isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
var pristine = field.isEqual(getIn(formState.values, key), getIn(formState.initialValues || {}, key)); | ||
@@ -999,0 +1015,0 @@ if (pristine) { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["final-form"]={})}(this,function(e){"use strict";function N(){return(N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(this,arguments)}function u(e){if(null==e||!e.length)return[];if("string"!=typeof e)throw new Error("toPath() expects a string");return e.split(/[.[\]]+/).filter(Boolean)}function R(e,t){for(var i=u(t),r=e,n=0;n<i.length;n++){var a=i[n];if(null==r||"object"!=typeof r||Array.isArray(r)&&isNaN(a))return;r=r[a]}return r}function S(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof t?t:String(t)}function h(e,t,i,r,n){if(t>=i.length)return r;var a=i[t];if(isNaN(a)){var u;if(null==e){var o,s=h(void 0,t+1,i,r,n);return void 0===s?void 0:((o={})[a]=s,o)}if(Array.isArray(e))throw new Error("Cannot set a non-numeric property on an array");var l=h(e[a],t+1,i,r,n);if(void 0!==l)return N({},e,((u={})[a]=l,u));var f=Object.keys(e).length;if(void 0===e[a]&&0===f)return;if(void 0!==e[a]&&f<=1)return isNaN(i[t-1])||n?void 0:{};e[a];return function(e,t){if(null==e)return{};var i,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)i=a[r],0<=t.indexOf(i)||(n[i]=e[i]);return n}(e,[a].map(S))}var d=Number(a);if(null==e){var c=h(void 0,t+1,i,r,n);if(void 0===c)return;var v=[];return v[d]=c,v}if(!Array.isArray(e))throw new Error("Cannot set a numeric property on an object");var b=h(e[d],t+1,i,r,n),m=[].concat(e);if(n&&void 0===b){if(m.splice(d,1),0===m.length)return}else m[d]=b;return m}function A(e,t,i,r){if(void 0===r&&(r=!1),null==e)throw new Error("Cannot call setIn() with "+String(e)+" state");if(null==t)throw new Error("Cannot call setIn() with "+String(t)+" key");return h(e,0,u(t),i,r)}function x(e,t){var i=e.errors,r=e.initialValues,n=e.lastSubmittedValues,a=e.submitErrors,u=e.submitFailed,o=e.submitSucceeded,s=e.submitting,l=e.values,f=t.active,d=t.blur,c=t.change,v=t.data,b=t.focus,m=t.modified,S=t.name,h=t.touched,y=t.visited,g=R(l,S),p=R(i,S);p&&p[L]&&(p=p[L]);var E=a&&R(a,S),F=r&&R(r,S),O=t.isEqual(F,g),j=!p&&!E;return{active:f,blur:d,change:c,data:v,dirty:!O,dirtySinceLastSubmit:!(!n||t.isEqual(R(n,S),g)),error:p,focus:b,initial:F,invalid:!j,length:Array.isArray(g)?g.length:void 0,modified:m,name:S,pristine:O,submitError:E,submitFailed:u,submitSucceeded:o,submitting:s,touched:h,valid:j,value:g,visited:y}}function I(e,t){if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(var n=Object.prototype.hasOwnProperty.bind(t),a=0;a<i.length;a++){var u=i[a];if(!n(u)||e[u]!==t[u])return!1}return!0}var P="FINAL_FORM/form-error",L="FINAL_FORM/array-error",a=["active","data","dirty","dirtySinceLastSubmit","error","initial","invalid","length","modified","pristine","submitError","submitFailed","submitSucceeded","submitting","touched","valid","value","visited"];function o(t,i,r,n,e,a){var u=!1;return e.forEach(function(e){n[e]&&(t[e]=i[e],r&&(~a.indexOf(e)?I(i[e],r[e]):i[e]===r[e])||(u=!0))}),u}function q(e,t,i,r){var n={blur:e.blur,change:e.change,focus:e.focus,name:e.name};return o(n,e,t,i,a,s)||!t||r?n:void 0}function z(e,t,i,r){var n={};return o(n,e,t,i,l,f)||!t||r?n:void 0}function _(r){var n,a;return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n&&t.length===n.length&&!t.some(function(e,t){return!I(n[t],e)})||(n=t,a=r.apply(void 0,t)),a}}function C(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function B(e,t){return e===t}function M(i){return Object.keys(i).some(function(e){var t=i[e];return t&&"object"==typeof t?M(t):void 0!==t})}var s=["data"],l=["active","dirty","dirtyFields","dirtySinceLastSubmit","error","errors","hasSubmitErrors","hasValidationErrors","initialValues","invalid","modified","pristine","submitting","submitError","submitErrors","submitFailed","submitSucceeded","touched","valid","validating","values","visited"],f=["touched","visited"];function D(e,t,i,r,n,a){void 0===a&&(a=!1);var u=n(i,r,t,a);u&&e(u)}function U(e,r,n,a){var u=e.entries;Object.keys(u).forEach(function(e){var t=u[Number(e)];if(t){var i=t.subscription;D(t.subscriber,i,r,n,a)}})}e.ARRAY_ERROR=L,e.FORM_ERROR=P,e.configOptions=["debug","initialValues","keepDirtyOnReinitialize","mutators","onSubmit","validate","validateOnBlur"],e.createForm=function(e){if(!e)throw new Error("No config specified");e.debug;var u=e.destroyOnUnregister,a=e.keepDirtyOnReinitialize,t=e.initialValues,o=e.mutators,s=e.onSubmit,v=e.validate,l=e.validateOnBlur;if(!s)throw new Error("No onSubmit function specified");function b(t){return function(e){return delete E[t],e}}function f(e,t,i){var r=i(R(e.formState.values,t));e.formState.values=A(e.formState.values,t,r)||{}}function d(e,t,i){if(e.fields[t]){var r,n;e.fields=N({},e.fields,((r={})[i]=N({},e.fields[t],{name:i,lastFieldState:void 0}),r)),delete e.fields[t],e.fieldSubscribers=N({},e.fieldSubscribers,((n={})[i]=e.fieldSubscribers[t],n)),delete e.fieldSubscribers[t];var a=R(e.formState.values,t);e.formState.values=A(e.formState.values,t,void 0)||{},e.formState.values=A(e.formState.values,i,a),delete e.lastFormState}}function i(a){return function(){if(o){for(var e={formState:h.formState,fields:h.fields,fieldSubscribers:h.fieldSubscribers,lastFormState:h.lastFormState},t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];var n=o[a](i,e,{changeValue:f,getIn:R,renameField:d,setIn:A,shallowEqual:I});return h.formState=e.formState,h.fields=e.fields,h.fieldSubscribers=e.fieldSubscribers,h.lastFormState=e.lastFormState,F(void 0,function(){O(),w()}),n}}}function m(r){return Object.keys(r.validators).reduce(function(e,t){var i=r.validators[Number(t)]();return i&&e.push(i),e},[])}function c(){Object.keys(h.fields).forEach(function(e){h.fields[e].touched=!0})}function S(){var i=h.fields,r=h.formState,e=h.lastFormState,t=Object.keys(i),n=!1,a=t.reduce(function(e,t){return!i[t].isEqual(R(r.values,t),R(r.initialValues||{},t))&&(n=!0,e[t]=!0),e},{});r.pristine=!n,r.dirtySinceLastSubmit=!(!r.lastSubmittedValues||t.every(function(e){var t=r.lastSubmittedValues||{};return i[e].isEqual(R(r.values,e),R(t,e))})),r.valid=!(r.error||r.submitError||M(r.errors)||r.submitErrors&&M(r.submitErrors));var u=function(e){var t=e.active,i=e.dirtySinceLastSubmit,r=e.error,n=e.errors,a=e.initialValues,u=e.pristine,o=e.submitting,s=e.submitFailed,l=e.submitSucceeded,f=e.submitError,d=e.submitErrors,c=e.valid,v=e.validating,b=e.values;return{active:t,dirty:!u,dirtySinceLastSubmit:i,error:r,errors:n,hasSubmitErrors:!!(f||d&&M(d)),hasValidationErrors:!(!r&&!M(n)),invalid:!c,initialValues:a,pristine:u,submitting:o,submitFailed:s,submitSucceeded:l,submitError:f,submitErrors:d,valid:c,validating:0<v,values:b}}(r),o=t.reduce(function(e,t){return e.modified[t]=i[t].modified,e.touched[t]=i[t].touched,e.visited[t]=i[t].visited,e},{modified:{},touched:{},visited:{}}),s=o.modified,l=o.touched,f=o.visited;return u.dirtyFields=e&&I(e.dirtyFields,a)?e.dirtyFields:a,u.modified=e&&I(e.modified,s)?e.modified:s,u.touched=e&&I(e.touched,l)?e.touched:l,u.visited=e&&I(e.visited,f)?e.visited:f,e&&I(e,u)?e:u}var h={subscribers:{index:0,entries:{}},fieldSubscribers:{},fields:{},formState:{dirtySinceLastSubmit:!1,errors:{},initialValues:t&&N({},t),invalid:!1,pristine:!0,submitting:!1,submitFailed:!1,submitSucceeded:!1,valid:!0,validating:0,values:t?N({},t):{}},lastFormState:void 0},r=!1,y=!1,g=!1,p=0,E={},n=o?Object.keys(o).reduce(function(e,t){return e[t]=i(t),e},{}):{},F=function(e,t){if(y)return g=!0,void(t&&t());var o=h.fields,i=h.formState,r=Object.keys(o);if(v||r.some(function(e){return m(o[e]).length})){var s=!1;if(e){var n=o[e];if(n){var a=n.validateFields;a&&(s=!0,r=a.length?a.concat(e):[e])}}var l={},f={},u=[].concat(function(e){var t=[];if(v){var i=v(N({},h.formState.values));if(C(i)){var r=p++,n=i.then(e).then(b(r));t.push(n),E[r]=n}else e(i)}return t}(function(e){l=e||{}}),r.reduce(function(e,t){return e.concat(function(n,a){var u,o=[],e=m(n);e.length&&(e.forEach(function(e){var t=e(R(h.formState.values,n.name),h.formState.values,3===e.length?x(h.formState,h.fields[n.name]):void 0);if(t&&C(t)){var i=p++,r=t.then(a).then(b(i));o.push(r),E[i]=r}else u||(u=t)}),a(u));return o}(o[t],function(e){f[t]=e}))},[])),d=function(){function e(a){r.forEach(function(e){if(o[e]){var t=R(l,e),i=R(u,e),r=m(o[e]).length,n=f[e];a(e,r&&n||v&&t||(t||s?void 0:i))}})}var u=N({},s?i.errors:{},l);e(function(e,t){u=A(u,e,t)||{}}),e(function(e,t){if(t&&t[L]){var i=R(u,e),r=[].concat(i);r[L]=t[L],u=A(u,e,r)}}),I(i.errors,u)||(i.errors=u),i.error=l[P]};if(d(),u.length){h.formState.validating++,t&&t();var c=function(){h.formState.validating--,d(),t&&t()};Promise.all(u).then(c,c)}else t&&t()}else t&&t()},O=function(e){if(!r&&!y){var n=h.fields,a=h.fieldSubscribers,u=h.formState;Object.keys(n).forEach(function(e){var t=n[e],i=x(u,t),r=t.lastFieldState;I(i,r)||(t.lastFieldState=i,U(a[e],i,r,q))})}},j=!1,k=!1,w=function e(){if(j)k=!0;else{if(j=!0,!r&&!y){var t=h.lastFormState,i=S();i!==t&&(h.lastFormState=i,U(h.subscribers,i,t,z))}j=!1,k&&(k=!1,e())}};F();var V={batch:function(e){r=!0,e(),r=!1,O(),w()},blur:function(e){var t=h.fields,i=h.formState,r=t[e];r&&(delete i.active,t[e]=N({},r,{active:!1,touched:!0}),l?F(e,function(){O(),w()}):(O(),w()))},change:function(e,t){var i=h.fields,r=h.formState;if(R(r.values,e)!==t){f(h,e,function(){return t});var n=i[e];n&&(i[e]=N({},n,{modified:!0})),l?(O(),w()):F(e,function(){O(),w()})}},focus:function(e){var t=h.fields[e];t&&!t.active&&(h.formState.active=e,t.active=!0,t.visited=!0,O(),w())},mutators:n,getFieldState:function(e){var t=h.fields[e];return t&&t.lastFieldState},getRegisteredFields:function(){return Object.keys(h.fields)},getState:function(){return S()},initialize:function(e){var i=h.fields,r=h.formState,n="function"==typeof e?e(r.values):e;a||(r.values=n),Object.keys(i).forEach(function(e){var t=i[e];t.modified=!1,t.touched=!1,t.visited=!1,!a||i[e].isEqual(R(r.values,e),R(r.initialValues||{},e))&&(r.values=A(r.values,e,R(n,e)))}),r.initialValues=n,F(void 0,function(){O(),w()})},isValidationPaused:function(){return y},pauseValidation:function(){y=!0},registerField:function(t,i,r,e){void 0===r&&(r={}),h.fieldSubscribers[t]||(h.fieldSubscribers[t]={index:0,entries:{}});var n=h.fieldSubscribers[t].index++;h.fieldSubscribers[t].entries[n]={subscriber:_(i),subscription:r},h.fields[t]||(h.fields[t]={active:!1,afterSubmit:e&&e.afterSubmit,beforeSubmit:e&&e.beforeSubmit,blur:function(){return V.blur(t)},change:function(e){return V.change(t,e)},data:{},focus:function(){return V.focus(t)},isEqual:e&&e.isEqual||B,lastFieldState:void 0,modified:!1,name:t,touched:!1,valid:!0,validateFields:e&&e.validateFields,validators:{},visited:!1}),e&&(e.getValidator&&(h.fields[t].validators[n]=e.getValidator),void 0!==e.initialValue&&(h.formState.initialValues=A(h.formState.initialValues||{},t,e.initialValue),h.formState.values=A(h.formState.values,t,e.initialValue)),void 0!==e.defaultValue&&(h.formState.values=A(h.formState.values,t,e.defaultValue)));var a=!1;return F(void 0,function(){w(),a||function(){var e=x(h.formState,h.fields[t]);D(i,r,e,void 0,q,!0),h.fields[t].lastFieldState=e,a=!0}(),O()}),function(){delete h.fields[t].validators[n],delete h.fieldSubscribers[t].entries[n],Object.keys(h.fieldSubscribers[t].entries).length||(delete h.fieldSubscribers[t],delete h.fields[t],h.formState.errors=A(h.formState.errors,t,void 0)||{},u&&(h.formState.values=A(h.formState.values,t,void 0,!0)||{})),F(void 0,function(){O(),w()})}},reset:function(e){void 0===e&&(e=h.formState.initialValues),h.formState.submitFailed=!1,h.formState.submitSucceeded=!1,delete h.formState.submitError,delete h.formState.submitErrors,delete h.formState.lastSubmittedValues,V.initialize(e||{})},resumeValidation:function(){y=!1,g&&F(void 0,function(){O(),w()}),g=!1},setConfig:function(e,t){switch(e){case"debug":t;break;case"destroyOnUnregister":u=t;break;case"initialValues":V.initialize(t);break;case"keepDirtyOnReinitialize":a=t;break;case"mutators":(o=t)?(Object.keys(n).forEach(function(e){e in t||delete n[e]}),Object.keys(t).forEach(function(e){n[e]=i(e)})):Object.keys(n).forEach(function(e){delete n[e]});break;case"onSubmit":s=t;break;case"validate":v=t,F(void 0,function(){O(),w()});break;case"validateOnBlur":l=t;break;default:throw new Error("Unrecognised option "+e)}},submit:function(){var t=h.formState;if(!t.submitting){if(h.formState.error||M(h.formState.errors))return c(),h.formState.submitFailed=!0,w(),void O();var e=Object.keys(E);if(e.length)Promise.all(e.reduce(function(e,t){return e.push(E[Number(t)]),e},[])).then(V.submit,V.submit);else if(!Object.keys(h.fields).find(function(e){return h.fields[e].beforeSubmit&&!1===h.fields[e].beforeSubmit()})){var i,r=!1,n=function(e){return t.submitting=!1,e&&M(e)?(t.submitFailed=!0,t.submitSucceeded=!1,t.submitErrors=e,t.submitError=e[P],c()):(delete t.submitErrors,delete t.submitError,t.submitFailed=!1,t.submitSucceeded=!0,Object.keys(h.fields).forEach(function(e){return h.fields[e].afterSubmit&&h.fields[e].afterSubmit()})),w(),O(),r=!0,i&&i(e),e};t.submitting=!0,t.submitFailed=!1,t.submitSucceeded=!1,t.lastSubmittedValues=N({},t.values);var a=s(t.values,V,n);if(!r){if(a&&C(a))return w(),O(),a.then(n,function(e){throw n(),e});if(3<=s.length)return w(),O(),new Promise(function(e){i=e});n(a)}}}},subscribe:function(e,t){if(!e)throw new Error("No callback given.");if(!t)throw new Error("No subscription provided. What values do you want to listen to?");var i=_(e),r=h.subscribers,n=h.lastFormState,a=r.index++;r.entries[a]={subscriber:i,subscription:t};var u=S();return u!==n&&(h.lastFormState=u),D(i,t,u,u,z,!0),function(){delete r.entries[a]}}};return V},e.fieldSubscriptionItems=a,e.formSubscriptionItems=l,e.getIn=R,e.setIn=A,e.version="4.13.0",Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["final-form"]={})}(this,function(e){"use strict";function N(){return(N=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(this,arguments)}function u(e){if(null==e||!e.length)return[];if("string"!=typeof e)throw new Error("toPath() expects a string");return e.split(/[.[\]]+/).filter(Boolean)}function R(e,t){for(var i=u(t),r=e,n=0;n<i.length;n++){var a=i[n];if(null==r||"object"!=typeof r||Array.isArray(r)&&isNaN(a))return;r=r[a]}return r}function S(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0===i)return("string"===t?String:Number)(e);var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof t?t:String(t)}function h(e,t,i,r,n){if(t>=i.length)return r;var a=i[t];if(isNaN(a)){var u;if(null==e){var o,s=h(void 0,t+1,i,r,n);return void 0===s?void 0:((o={})[a]=s,o)}if(Array.isArray(e))throw new Error("Cannot set a non-numeric property on an array");var l=h(e[a],t+1,i,r,n);if(void 0!==l)return N({},e,((u={})[a]=l,u));var f=Object.keys(e).length;if(void 0===e[a]&&0===f)return;if(void 0!==e[a]&&f<=1)return isNaN(i[t-1])||n?void 0:{};e[a];return function(e,t){if(null==e)return{};var i,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)i=a[r],0<=t.indexOf(i)||(n[i]=e[i]);return n}(e,[a].map(S))}var d=Number(a);if(null==e){var c=h(void 0,t+1,i,r,n);if(void 0===c)return;var v=[];return v[d]=c,v}if(!Array.isArray(e))throw new Error("Cannot set a numeric property on an object");var b=h(e[d],t+1,i,r,n),m=[].concat(e);if(n&&void 0===b){if(m.splice(d,1),0===m.length)return}else m[d]=b;return m}function A(e,t,i,r){if(void 0===r&&(r=!1),null==e)throw new Error("Cannot call setIn() with "+String(e)+" state");if(null==t)throw new Error("Cannot call setIn() with "+String(t)+" key");return h(e,0,u(t),i,r)}function x(e,t){var i=e.errors,r=e.initialValues,n=e.lastSubmittedValues,a=e.submitErrors,u=e.submitFailed,o=e.submitSucceeded,s=e.submitting,l=e.values,f=t.active,d=t.blur,c=t.change,v=t.data,b=t.focus,m=t.modified,S=t.name,h=t.touched,y=t.visited,g=R(l,S),p=R(i,S);p&&p[L]&&(p=p[L]);var E=a&&R(a,S),F=r&&R(r,S),O=t.isEqual(F,g),j=!p&&!E;return{active:f,blur:d,change:c,data:v,dirty:!O,dirtySinceLastSubmit:!(!n||t.isEqual(R(n,S),g)),error:p,focus:b,initial:F,invalid:!j,length:Array.isArray(g)?g.length:void 0,modified:m,name:S,pristine:O,submitError:E,submitFailed:u,submitSucceeded:o,submitting:s,touched:h,valid:j,value:g,visited:y}}function I(e,t){if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(var n=Object.prototype.hasOwnProperty.bind(t),a=0;a<i.length;a++){var u=i[a];if(!n(u)||e[u]!==t[u])return!1}return!0}var P="FINAL_FORM/form-error",L="FINAL_FORM/array-error",a=["active","data","dirty","dirtySinceLastSubmit","error","initial","invalid","length","modified","pristine","submitError","submitFailed","submitSucceeded","submitting","touched","valid","value","visited"];function o(t,i,r,n,e,a){var u=!1;return e.forEach(function(e){n[e]&&(t[e]=i[e],r&&(~a.indexOf(e)?I(i[e],r[e]):i[e]===r[e])||(u=!0))}),u}function q(e,t,i,r){var n={blur:e.blur,change:e.change,focus:e.focus,name:e.name};return o(n,e,t,i,a,s)||!t||r?n:void 0}function z(e,t,i,r){var n={};return o(n,e,t,i,l,f)||!t||r?n:void 0}function _(r){var n,a;return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n&&t.length===n.length&&!t.some(function(e,t){return!I(n[t],e)})||(n=t,a=r.apply(void 0,t)),a}}function C(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function B(e,t){return e===t}function M(i){return Object.keys(i).some(function(e){var t=i[e];return t&&"object"==typeof t?M(t):void 0!==t})}var s=["data"],l=["active","dirty","dirtyFields","dirtySinceLastSubmit","error","errors","hasSubmitErrors","hasValidationErrors","initialValues","invalid","modified","pristine","submitting","submitError","submitErrors","submitFailed","submitSucceeded","touched","valid","validating","values","visited"],f=["touched","visited"];function D(e,t,i,r,n,a){void 0===a&&(a=!1);var u=n(i,r,t,a);u&&e(u)}function U(e,r,n,a){var u=e.entries;Object.keys(u).forEach(function(e){var t=u[Number(e)];if(t){var i=t.subscription;D(t.subscriber,i,r,n,a)}})}e.ARRAY_ERROR=L,e.FORM_ERROR=P,e.configOptions=["debug","initialValues","keepDirtyOnReinitialize","mutators","onSubmit","validate","validateOnBlur"],e.createForm=function(e){if(!e)throw new Error("No config specified");e.debug;var u=e.destroyOnUnregister,a=e.keepDirtyOnReinitialize,t=e.initialValues,o=e.mutators,s=e.onSubmit,b=e.validate,l=e.validateOnBlur;if(!s)throw new Error("No onSubmit function specified");function m(t){return function(e){return delete E[t],e}}function f(e,t,i){var r=i(R(e.formState.values,t));e.formState.values=A(e.formState.values,t,r)||{}}function d(e,t,i){if(e.fields[t]){var r,n;e.fields=N({},e.fields,((r={})[i]=N({},e.fields[t],{name:i,lastFieldState:void 0}),r)),delete e.fields[t],e.fieldSubscribers=N({},e.fieldSubscribers,((n={})[i]=e.fieldSubscribers[t],n)),delete e.fieldSubscribers[t];var a=R(e.formState.values,t);e.formState.values=A(e.formState.values,t,void 0)||{},e.formState.values=A(e.formState.values,i,a),delete e.lastFormState}}function i(a){return function(){if(o){for(var e={formState:h.formState,fields:h.fields,fieldSubscribers:h.fieldSubscribers,lastFormState:h.lastFormState},t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];var n=o[a](i,e,{changeValue:f,getIn:R,renameField:d,setIn:A,shallowEqual:I});return h.formState=e.formState,h.fields=e.fields,h.fieldSubscribers=e.fieldSubscribers,h.lastFormState=e.lastFormState,F(void 0,function(){O(),w()}),n}}}function S(r){return Object.keys(r.validators).reduce(function(e,t){var i=r.validators[Number(t)]();return i&&e.push(i),e},[])}function c(){Object.keys(h.fields).forEach(function(e){h.fields[e].touched=!0})}function v(){var e=h.fields,i=h.formState,t=h.lastFormState,r=N({},e),n=Object.keys(r),a=!1,u=n.reduce(function(e,t){return!r[t].isEqual(R(i.values,t),R(i.initialValues||{},t))&&(a=!0,e[t]=!0),e},{});i.pristine=!a,i.dirtySinceLastSubmit=!(!i.lastSubmittedValues||n.every(function(e){var t=i.lastSubmittedValues||{};return r[e].isEqual(R(i.values,e),R(t,e))})),i.valid=!(i.error||i.submitError||M(i.errors)||i.submitErrors&&M(i.submitErrors));var o=function(e){var t=e.active,i=e.dirtySinceLastSubmit,r=e.error,n=e.errors,a=e.initialValues,u=e.pristine,o=e.submitting,s=e.submitFailed,l=e.submitSucceeded,f=e.submitError,d=e.submitErrors,c=e.valid,v=e.validating,b=e.values;return{active:t,dirty:!u,dirtySinceLastSubmit:i,error:r,errors:n,hasSubmitErrors:!!(f||d&&M(d)),hasValidationErrors:!(!r&&!M(n)),invalid:!c,initialValues:a,pristine:u,submitting:o,submitFailed:s,submitSucceeded:l,submitError:f,submitErrors:d,valid:c,validating:0<v,values:b}}(i),s=n.reduce(function(e,t){return e.modified[t]=r[t].modified,e.touched[t]=r[t].touched,e.visited[t]=r[t].visited,e},{modified:{},touched:{},visited:{}}),l=s.modified,f=s.touched,d=s.visited;return o.dirtyFields=t&&I(t.dirtyFields,u)?t.dirtyFields:u,o.modified=t&&I(t.modified,l)?t.modified:l,o.touched=t&&I(t.touched,f)?t.touched:f,o.visited=t&&I(t.visited,d)?t.visited:d,t&&I(t,o)?t:o}var h={subscribers:{index:0,entries:{}},fieldSubscribers:{},fields:{},formState:{dirtySinceLastSubmit:!1,errors:{},initialValues:t&&N({},t),invalid:!1,pristine:!0,submitting:!1,submitFailed:!1,submitSucceeded:!1,valid:!0,validating:0,values:t?N({},t):{}},lastFormState:void 0},r=!1,y=!1,g=!1,p=0,E={},n=o?Object.keys(o).reduce(function(e,t){return e[t]=i(t),e},{}):{},F=function(e,t){if(y)return g=!0,void(t&&t());var o=h.fields,i=h.formState,s=N({},o),r=Object.keys(s);if(b||r.some(function(e){return S(s[e]).length})){var l=!1;if(e){var n=s[e];if(n){var a=n.validateFields;a&&(l=!0,r=a.length?a.concat(e):[e])}}var f={},d={},u=[].concat(function(e){var t=[];if(b){var i=b(N({},h.formState.values));if(C(i)){var r=p++,n=i.then(e).then(m(r));t.push(n),E[r]=n}else e(i)}return t}(function(e){f=e||{}}),r.reduce(function(e,t){return e.concat(function(n,a){var u,o=[],e=S(n);e.length&&(e.forEach(function(e){var t=e(R(h.formState.values,n.name),h.formState.values,3===e.length?x(h.formState,h.fields[n.name]):void 0);if(t&&C(t)){var i=p++,r=t.then(a).then(m(i));o.push(r),E[i]=r}else u||(u=t)}),a(u));return o}(s[t],function(e){d[t]=e}))},[])),c=function(){function e(a){r.forEach(function(e){if(o[e]){var t=R(f,e),i=R(u,e),r=S(s[e]).length,n=d[e];a(e,r&&n||b&&t||(t||l?void 0:i))}})}var u=N({},l?i.errors:{},f);e(function(e,t){u=A(u,e,t)||{}}),e(function(e,t){if(t&&t[L]){var i=R(u,e),r=[].concat(i);r[L]=t[L],u=A(u,e,r)}}),I(i.errors,u)||(i.errors=u),i.error=f[P]};if(c(),u.length){h.formState.validating++,t&&t();var v=function(){h.formState.validating--,c(),t&&t()};Promise.all(u).then(v,v)}else t&&t()}else t&&t()},O=function(e){if(!r&&!y){var t=h.fields,a=h.fieldSubscribers,u=h.formState,o=N({},t);Object.keys(o).forEach(function(e){var t=o[e],i=x(u,t),r=t.lastFieldState;if(!I(i,r)){t.lastFieldState=i;var n=a[e];n&&U(n,i,r,q)}})}},j=!1,k=!1,w=function e(){if(j)k=!0;else{if(j=!0,!r&&!y){var t=h.lastFormState,i=v();i!==t&&(h.lastFormState=i,U(h.subscribers,i,t,z))}j=!1,k&&(k=!1,e())}};F();var V={batch:function(e){r=!0,e(),r=!1,O(),w()},blur:function(e){var t=h.fields,i=h.formState,r=t[e];r&&(delete i.active,t[e]=N({},r,{active:!1,touched:!0}),l?F(e,function(){O(),w()}):(O(),w()))},change:function(e,t){var i=h.fields,r=h.formState;if(R(r.values,e)!==t){f(h,e,function(){return t});var n=i[e];n&&(i[e]=N({},n,{modified:!0})),l?(O(),w()):F(e,function(){O(),w()})}},focus:function(e){var t=h.fields[e];t&&!t.active&&(h.formState.active=e,t.active=!0,t.visited=!0,O(),w())},mutators:n,getFieldState:function(e){var t=h.fields[e];return t&&t.lastFieldState},getRegisteredFields:function(){return Object.keys(h.fields)},getState:function(){return v()},initialize:function(e){var t=h.fields,i=h.formState,r=N({},t),n="function"==typeof e?e(i.values):e;a||(i.values=n),Object.keys(r).forEach(function(e){var t=r[e];t.modified=!1,t.touched=!1,t.visited=!1,!a||t.isEqual(R(i.values,e),R(i.initialValues||{},e))&&(i.values=A(i.values,e,R(n,e)))}),i.initialValues=n,F(void 0,function(){O(),w()})},isValidationPaused:function(){return y},pauseValidation:function(){y=!0},registerField:function(t,i,r,e){void 0===r&&(r={}),h.fieldSubscribers[t]||(h.fieldSubscribers[t]={index:0,entries:{}});var n=h.fieldSubscribers[t].index++;h.fieldSubscribers[t].entries[n]={subscriber:_(i),subscription:r},h.fields[t]||(h.fields[t]={active:!1,afterSubmit:e&&e.afterSubmit,beforeSubmit:e&&e.beforeSubmit,blur:function(){return V.blur(t)},change:function(e){return V.change(t,e)},data:{},focus:function(){return V.focus(t)},isEqual:e&&e.isEqual||B,lastFieldState:void 0,modified:!1,name:t,touched:!1,valid:!0,validateFields:e&&e.validateFields,validators:{},visited:!1}),e&&(e.getValidator&&(h.fields[t].validators[n]=e.getValidator),void 0!==e.initialValue&&(h.formState.initialValues=A(h.formState.initialValues||{},t,e.initialValue),h.formState.values=A(h.formState.values,t,e.initialValue)),void 0!==e.defaultValue&&(h.formState.values=A(h.formState.values,t,e.defaultValue)));var a=!1;return F(void 0,function(){w(),a||function(){var e=x(h.formState,h.fields[t]);D(i,r,e,void 0,q,!0),h.fields[t].lastFieldState=e,a=!0}(),O()}),function(){delete h.fields[t].validators[n],delete h.fieldSubscribers[t].entries[n],Object.keys(h.fieldSubscribers[t].entries).length||(delete h.fieldSubscribers[t],delete h.fields[t],h.formState.errors=A(h.formState.errors,t,void 0)||{},u&&(h.formState.values=A(h.formState.values,t,void 0,!0)||{})),F(void 0,function(){O(),w()})}},reset:function(e){void 0===e&&(e=h.formState.initialValues),h.formState.submitFailed=!1,h.formState.submitSucceeded=!1,delete h.formState.submitError,delete h.formState.submitErrors,delete h.formState.lastSubmittedValues,V.initialize(e||{})},resumeValidation:function(){y=!1,g&&F(void 0,function(){O(),w()}),g=!1},setConfig:function(e,t){switch(e){case"debug":t;break;case"destroyOnUnregister":u=t;break;case"initialValues":V.initialize(t);break;case"keepDirtyOnReinitialize":a=t;break;case"mutators":(o=t)?(Object.keys(n).forEach(function(e){e in t||delete n[e]}),Object.keys(t).forEach(function(e){n[e]=i(e)})):Object.keys(n).forEach(function(e){delete n[e]});break;case"onSubmit":s=t;break;case"validate":b=t,F(void 0,function(){O(),w()});break;case"validateOnBlur":l=t;break;default:throw new Error("Unrecognised option "+e)}},submit:function(){var t=h.formState;if(!t.submitting){if(h.formState.error||M(h.formState.errors))return c(),h.formState.submitFailed=!0,w(),void O();var e=Object.keys(E);if(e.length)Promise.all(e.reduce(function(e,t){return e.push(E[Number(t)]),e},[])).then(V.submit,V.submit);else if(!Object.keys(h.fields).find(function(e){return h.fields[e].beforeSubmit&&!1===h.fields[e].beforeSubmit()})){var i,r=!1,n=function(e){return t.submitting=!1,e&&M(e)?(t.submitFailed=!0,t.submitSucceeded=!1,t.submitErrors=e,t.submitError=e[P],c()):(delete t.submitErrors,delete t.submitError,t.submitFailed=!1,t.submitSucceeded=!0,Object.keys(h.fields).forEach(function(e){return h.fields[e].afterSubmit&&h.fields[e].afterSubmit()})),w(),O(),r=!0,i&&i(e),e};t.submitting=!0,t.submitFailed=!1,t.submitSucceeded=!1,t.lastSubmittedValues=N({},t.values);var a=s(t.values,V,n);if(!r){if(a&&C(a))return w(),O(),a.then(n,function(e){throw n(),e});if(3<=s.length)return w(),O(),new Promise(function(e){i=e});n(a)}}}},subscribe:function(e,t){if(!e)throw new Error("No callback given.");if(!t)throw new Error("No subscription provided. What values do you want to listen to?");var i=_(e),r=h.subscribers,n=h.lastFormState,a=r.index++;r.entries[a]={subscriber:i,subscription:t};var u=v();return u!==n&&(h.lastFormState=u),D(i,t,u,u,z,!0),function(){delete r.entries[a]}}};return V},e.fieldSubscriptionItems=a,e.formSubscriptionItems=l,e.getIn=R,e.setIn=A,e.version="4.13.0",Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=final-form.umd.min.js.map |
{ | ||
"name": "final-form", | ||
"version": "4.13.0", | ||
"version": "4.13.1", | ||
"description": "🏁 Framework agnostic, high performance, subscription-based form state management", | ||
@@ -5,0 +5,0 @@ "main": "dist/final-form.cjs.js", |
@@ -105,2 +105,3 @@ # 🏁 Final Form | ||
- [Examples](#examples) | ||
- [Vanilla JS Example](#vanilla-js-example) | ||
- [Simple React Example](#simple-react-example) | ||
@@ -115,2 +116,3 @@ - [Official Mutators](#official-mutators) | ||
- [Web Components Bindings](#web-components-bindings) | ||
- [Frontier Forms](#frontier-forms) | ||
- [Define Form and React Define Form](#define-form-and-react-define-form) | ||
@@ -120,2 +122,3 @@ - [🏁 Final Form Focus 🧐](#-final-form-focus-) | ||
- [🏁 React Final Form Listeners](#-react-final-form-listeners) | ||
- [🏁 Final Form Submit Listener 🧐](#-final-form-submit-listener-) | ||
- [Field Names](#field-names) | ||
@@ -311,2 +314,6 @@ - [API](#api) | ||
### [Vanilla JS Example](https://jsfiddle.net/erikras/cfeh67mk/) | ||
You don't need any javascript framework to use 🏁 Final Form's powerful subscription-based form state management. You can attach it directly to the DOM inputs. | ||
### [Simple React Example](https://codesandbox.io/s/q78r2oqq96) | ||
@@ -352,2 +359,6 @@ | ||
### [Frontier Forms](https://frontier-forms.dev) | ||
Opinionated way to create forms in React. Data-driven forms that let you focus on what matters: your application. Provide a `GraphQL` mutation and `<Frontier/>` will do the rest for you. | ||
### [Define Form](https://github.com/ForbesLindesay/define-form/tree/master/packages/define-form) and [React Define Form](https://github.com/ForbesLindesay/define-form/tree/master/packages/react-define-form) | ||
@@ -369,2 +380,6 @@ | ||
### [🏁 Final Form Submit Listener 🧐](https://github.com/final-form/final-form-submit-listener) | ||
A "decorator" that will listen for events around attempted, successful, or failed submissions and fire callbacks you provide. | ||
## Field Names | ||
@@ -371,0 +386,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
210537
3571
1286